From e68c492f9e77394d3b365a711781a87078e5ac93 Mon Sep 17 00:00:00 2001 From: RISCi_ATOM Date: Sat, 31 Aug 2019 22:56:01 -0400 Subject: [PATCH] Upstream refresh for v1.5.0-rc1 : Upstream 19.07 : 4fb6b8c553f692eeb5bcb203e0f8ee8df099e77e --- Config.in | 2 - Makefile | 2 - README.md | 15 - config/Config-build.in | 13 + config/Config-images.in | 7 +- config/Config-kernel.in | 4 + include/download.mk | 5 +- include/feeds.mk | 2 +- include/image-commands.mk | 4 +- include/image.mk | 16 +- include/kernel-version.mk | 17 +- include/kernel.mk | 7 +- include/package-ipkg.mk | 3 +- include/rootfs.mk | 8 +- include/target.mk | 30 +- include/unpack.mk | 9 +- include/version.mk | 8 +- package/Makefile | 8 +- package/base-files/Makefile | 13 +- package/base-files/files/bin/config_generate | 5 +- package/base-files/files/etc/group | 2 +- package/base-files/files/etc/rc.button/reboot | 12 + package/base-files/files/etc/rc.common | 3 + .../files/lib/functions/migrations.sh | 39 + .../base-files/files/lib/functions/system.sh | 2 +- .../files/lib/functions/uci-defaults.sh | 14 + .../base-files/files/lib/upgrade/common.sh | 32 +- package/base-files/files/usr/lib/os-release | 16 +- package/base-files/image-config.in | 2 +- package/boot/uboot-envtools/files/ath79 | 7 +- package/boot/uboot-envtools/files/imx6 | 4 + package/boot/uboot-envtools/files/ipq40xx | 3 + package/boot/uboot-envtools/files/mvebu | 29 +- package/boot/uboot-envtools/files/oxnas | 4 +- package/boot/uboot-envtools/files/ramips | 6 +- package/boot/uboot-sunxi/Makefile | 11 +- .../003-add-theobroma-a31-pangolin.patch | 4 +- .../patches/062-A20-improve-gmac-upload.patch | 4 +- .../063-fix-lime2-revK-add-micrel-PHY.patch | 44 + ...2-sunxi-make_CONS_INDEX-configurable.patch | 2 +- .../patches/210-sunxi-deactivate-binman.patch | 4 +- package/boot/uboot-xburst/Makefile | 88 - .../0001-qi_lb60-add-nand-spl-support.patch | 894 --- ...qi_lb60-add-software-usbboot-support.patch | 916 --- .../patches/0003-add-mmc-support.patch | 1664 ----- ...dd-more-boot-options-F1-F2-F3-F4-M-S.patch | 200 - .../0005-add-nanonote-lcd-support.patch | 847 --- .../patches/0006-enable-silent-console.patch | 60 - package/devel/perf/Makefile | 2 +- package/devel/strace/Makefile | 4 +- .../patches/001-mips-o32-fix-build.patch | 91 - ...00-workaround--pt-reg-collisions-ppc.patch | 10 +- package/devel/valgrind/Makefile | 185 + package/devel/valgrind/files/default.supp | 42 + .../patches/100-fix_configure_check.patch | 11 + .../patches/130-fix_arm_arch_detection.patch | 17 + .../button-hotplug/src/button-hotplug.c | 1 + package/kernel/cryptodev-linux/Makefile | 59 + .../src/gpio-button-hotplug.c | 252 +- package/kernel/kmod-sched-cake/Makefile | 8 +- package/kernel/linux/modules/block.mk | 6 +- package/kernel/linux/modules/can.mk | 16 +- package/kernel/linux/modules/crypto.mk | 36 +- package/kernel/linux/modules/fs.mk | 2 +- package/kernel/linux/modules/hwmon.mk | 2 +- package/kernel/linux/modules/iio.mk | 6 +- package/kernel/linux/modules/lib.mk | 4 +- package/kernel/linux/modules/netdevices.mk | 24 +- package/kernel/linux/modules/netfilter.mk | 4 +- package/kernel/linux/modules/netsupport.mk | 83 +- package/kernel/linux/modules/other.mk | 41 +- package/kernel/linux/modules/sound.mk | 1 + package/kernel/linux/modules/usb.mk | 16 +- package/kernel/linux/modules/video.mk | 47 +- package/kernel/linux/modules/w1.mk | 2 +- package/kernel/linux/modules/wpan.mk | 18 +- package/kernel/mac80211/Makefile | 78 +- package/kernel/mac80211/ath.mk | 42 +- .../files/lib/netifd/wireless/mac80211.sh | 24 +- ...w-reset-AHB-WMAC-interface-on-AR91xx.patch | 2 +- ..._hw-issue-external-reset-for-QCA955x.patch | 4 +- ...erpret-requested-txpower-in-EIRP-dom.patch | 4 +- ...power-reduction-for-US-regulatory-do.patch | 8 +- .../patches/ath/404-regd_no_assoc_hints.patch | 4 +- .../ath/510-ath9k_intr_mitigation_tweak.patch | 2 +- .../patches/ath/513-ath9k_add_pci_ids.patch | 2 +- .../patches/ath/542-ath9k_debugfs_diag.patch | 4 +- ...544-ath9k-ar933x-usb-hang-workaround.patch | 8 +- ...roduce-ath_dynack_set_timeout-routin.patch | 94 + ...-only-mask-use_eeprom-on-of-noeeprom.patch | 73 - ...perly-set-last-timeout-timestamp-in-.patch | 32 + ...-max-timeout-according-to-channel-wi.patch | 96 + ...-ackto-to-max-timeout-in-ath_dynack_.patch | 78 + .../patches/build/001-fix_build.patch | 12 +- ...eck-for-txstatus-timeout-every-time-.patch | 4 +- ...rent-txstatus-timeouts-when-flushing.patch | 2 +- ...ratelimited-variants-of-err-and-warn.patch | 39 + ...o-not-print-error-when-queue-is-full.patch | 33 - ...atelimited-variants-dev_warn-dev_err.patch | 42 + ...rt2x00-check-number-of-EPROTO-errors.patch | 96 + ...o-not-print-error-when-queue-is-full.patch | 43 + ...restore-old-mmio-txstatus-behaviour.patch} | 0 ...lush-implementation-for-SoC-devices.patch} | 0 ...t2800-move-txstatus-pending-routine.patch} | 0 ...26-rt2x00-remove-last_nostatus_check.patch | 57 - ...-rt2800mmio-fetch-tx-status-changes.patch} | 0 ...mer-and-work-for-handling-tx-status.patch} | 0 ...29-rt2x00-remove-last_nostatus_check.patch | 57 + ...-rt2x00-remove-not-used-entry-field.patch} | 0 ...31-rt2x00mmio-remove-legacy-comment.patch} | 0 .../050-rt2x00-add-RT3883-support.patch | 959 +++ ...-rt2800lib-enable-support-for-RT3883.patch | 20 - ...x00-rt2800lib-add-rf_vals-for-RF3853.patch | 112 - ...ib-enable-VCO-calibration-for-RF3853.patch | 28 - ...-add-channel-configuration-function-.patch | 235 - ...2x00-rt2800lib-enable-RF3853-support.patch | 20 - ...-add-MAC-register-initialization-for.patch | 62 - ...-fix-rt2800soc_disable_radio-for-RT3.patch | 30 - ...-add-BBP-register-initialization-for.patch | 71 - ...-add-RFCSR-initialization-for-RT3883.patch | 178 - ...-use-the-extended-EEPROM-map-for-RT3.patch | 22 - ...ib-force-rf-type-to-RF3853-on-RT3883.patch | 21 - ...-add-channel-configuration-code-for-.patch | 136 - ...-fix-txpower_to_dev-function-for-RT3.patch | 30 - ...-use-correct-txpower-calculation-fun.patch | 23 - ...-hardcode-txmixer-gain-values-to-zer.patch | 33 - ...b-use-correct-RT-XWI-size-for-RT3883.patch | 20 - ...-fix-antenna-configuration-for-RT388.patch | 22 - ...-fix-LNA-gain-configuration-for-RT38.patch | 32 - ...0-rt2800lib-fix-VGC-setup-for-RT3883.patch | 44 - ...-fix-EEPROM-LNA-validation-for-RT388.patch | 42 - ...-fix-txpower-compensation-for-RT3883.patch | 22 - .../602-rt2x00-introduce-rt2x00eeprom.patch | 4 +- .../100-remove-cryptoapi-dependencies.patch | 4 +- .../110-mac80211_keep_keys_on_stop_ap.patch | 2 +- .../subsys/140-tweak-TSQ-setting.patch | 2 +- .../mac80211/patches/subsys/210-ap_scan.patch | 2 +- ...d-stop-start-logic-for-software-TXQs.patch | 6 +- ...call-driver-wake_tx_queue-op-during-.patch | 33 - ...-Enable-STBC-and-LDPC-for-VHT-Rates.patch} | 0 ...-remove-unnecessary-debugfs-cleanup.patch} | 0 ...-merge-with-minstrel_ht-always-enab.patch} | 0 ...rel-reduce-minstrel_mcs_groups-size.patch} | 0 ...-fix-using-short-preamble-CCK-rates.patch} | 0 ...el-fix-CCK-rate-group-streams-value.patch} | 0 ...-fix-sampling-reporting-of-CCK-rate.patch} | 0 ...-do-not-sample-rates-3-times-slower.patch} | 0 ...l_ht-add-flag-to-indicate-missing-in.patch | 122 + ...l_ht-fix-per-group-max-throughput-ra.patch | 22 + ...l_ht-reduce-unnecessary-rate-probing.patch | 42 + ...l_ht-fix-default-max-throughput-rate.patch | 46 + ...l_ht-improve-rate-probing-for-device.patch | 481 ++ ...l_ht-fix-infinite-loop-because-suppo.patch | 25 + .../320-mac80211-Add-TXQ-scheduling-API.patch | 292 + ...-Add-airtime-statistics-and-settings.patch | 202 + ...time-accounting-and-scheduling-to-TX.patch | 522 ++ ...pose-ieee80211_schedule_txq-function.patch | 73 + ...0211-add-hdrlen-to-ieee80211_tx_data.patch | 228 + ...1-add-TX_NEEDS_ALIGNED4_SKBS-hw-flag.patch | 304 + ...locking-for-txq-scheduling-airtime-f.patch | 214 + ...op-redundant-rcu_read_lock-unlock-ca.patch | 96 + ...te-hash-for-fq-without-holding-fq-lo.patch | 124 + ...e-dequeue-late-tx-handlers-without-h.patch | 55 + ...IF_F_LLTX-when-using-intermediate-tx.patch | 22 + ...0211-add-hdrlen-to-ieee80211_tx_data.patch | 219 - .../357-mac80211-optimize-skb-resizing.patch | 202 + ...80211-add-NEED_ALIGNED4_SKBS-hw-flag.patch | 233 - ...ee80211_schedule_txq-schedule-empty-.patch | 105 + ...-un-schedule-TXQs-on-powersave-start.patch | 31 + ...ing-iTXQ-select-the-queue-in-ieee802.patch | 183 + ...E80211_KEY_FLAG_GENERATE_MMIE-to-iee.patch | 58 + ...ory-accounting-with-A-MSDU-aggregati.patch | 58 - ...l_ht-add-flag-to-indicate-missing-in.patch | 121 - ...ow-4addr-AP-operation-on-crypto-cont.patch | 107 - .../522-mac80211_configure_antenna_gain.patch | 55 +- package/kernel/rotary-gpio-custom/Makefile | 47 - package/kernel/rotary-gpio-custom/src/Kconfig | 9 - .../kernel/rotary-gpio-custom/src/Makefile | 1 - .../src/rotary-gpio-custom.c | 193 - package/libs/elfutils/Makefile | 6 +- .../patches/003-libintl-compatibility.patch | 2 +- .../patches/200-uclibc-ng-compat.patch | 38 + package/libs/libbsd/Makefile | 2 +- package/libs/libbsd/patches/010-fix-arc.patch | 30 + package/libs/libnftnl/Makefile | 6 +- package/libs/libroxml/Makefile | 10 +- package/libs/libunwind/Makefile | 11 +- .../libunwind/patches/001-disable-tests.patch | 11 - package/libs/mbedtls/Makefile | 10 +- package/libs/mbedtls/patches/200-config.patch | 44 +- ...optimized-MULADDC-code-only-on-ARM-6.patch | 2 +- package/libs/nghttp2/Makefile | 6 +- package/libs/openssl/Config.in | 44 +- package/libs/openssl/Makefile | 80 +- .../patches/100-Configure-afalg-support.patch | 2 +- .../patches/130-dont-build-tests-fuzz.patch | 4 +- .../patches/140-allow-prefer-chacha20.patch | 4 +- ...o-save-ioctl-if-EVP_MD_.FLAG_ONESHOT.patch | 58 + ..._devcrypto-add-configuration-options.patch | 566 ++ ...ypto-add-command-to-dump-driver-info.patch | 273 + ...o-make-the-dev-crypto-engine-dynamic.patch | 2693 ++++++++ ...default-to-not-use-digests-in-engine.patch | 41 + ...to-ignore-error-when-closing-session.patch | 24 + package/libs/toolchain/Makefile | 2 +- package/libs/uclibc++/Makefile | 28 +- package/libs/uclibc++/files/config.default | 10 +- .../libs/uclibc++/patches/001-no-ansi.patch | 10 + .../uclibc++/patches/002-path_to_bash.patch | 11 - .../libs/uclibc++/patches/002-quote-fix.patch | 13 + .../libs/uclibc++/patches/003-no-fPIC.patch | 10 + .../uclibc++/patches/004-no-pedantic.patch | 13 + .../libs/uclibc++/patches/006-eabi_fix.patch | 38 - .../uclibc++/patches/010-honor-ldflags.patch | 23 - .../uclibc++/patches/020-template-fix.patch | 22 - .../patches/030-memory_corruption_fix.patch | 114 - .../uclibc++/patches/040-delete-c++14.patch | 20 - ...-erase-on-derived-__base_associative.patch | 40 - package/libs/uclient/Makefile | 6 +- package/libs/wolfssl/Config.in | 55 +- package/libs/wolfssl/Makefile | 129 +- .../patches/100-disable-hardening-check.patch | 4 +- .../400-additional_compatibility.patch | 12 - .../900-remove-broken-autoconf-macros.patch | 21 - package/libs/zlib/Makefile | 2 +- .../004-relative-pkg-config-paths.patch | 14 + package/network/config/gre/Makefile | 2 +- package/network/config/gre/files/gre.sh | 14 +- package/network/config/netifd/Makefile | 8 +- .../config/netifd/files/etc/init.d/network | 4 +- .../netifd/files/lib/netifd/proto/dhcp.sh | 2 + package/network/config/xfrm/Makefile | 38 + package/network/config/xfrm/files/xfrm.sh | 65 + package/network/ipv6/464xlat/Makefile | 2 +- package/network/ipv6/464xlat/files/464xlat.sh | 28 +- package/network/ipv6/6to4/Makefile | 2 +- package/network/ipv6/map/Makefile | 2 +- package/network/ipv6/map/files/map.sh | 48 +- package/network/ipv6/thc-ipv6/Makefile | 61 + .../patches/000-cflags_override.patch | 12 + .../ipv6/thc-ipv6/patches/100-no-ssl.patch | 9 + package/network/services/dnsmasq/Makefile | 2 +- .../services/dnsmasq/files/dnsmasq.init | 39 +- package/network/services/dropbear/Config.in | 35 +- package/network/services/dropbear/Makefile | 58 +- .../services/dropbear/files/dropbear.init | 121 +- .../patches/010-runtime-maxauthtries.patch | 130 - .../020-Wait-to-fail-invalid-usernames.patch | 221 - .../dropbear/patches/100-pubkey_path.patch | 45 +- .../dropbear/patches/110-change_user.patch | 2 +- .../patches/120-openwrt_options.patch | 82 - .../patches/130-ssh_ignore_x_args.patch | 4 +- .../dropbear/patches/140-disable_assert.patch | 2 +- .../patches/150-dbconvert_standalone.patch | 14 - .../dropbear/patches/160-lto-jobserver.patch | 8 +- .../600-allow-blank-root-password.patch | 2 +- ...610-skip-default-keys-in-custom-runs.patch | 18 - .../patches/900-configure-hardening.patch | 56 + .../patches/901-bundled-libs-cflags.patch | 48 + package/network/services/ead/Makefile | 52 + package/network/services/ead/src/Makefile | 33 + package/network/services/ead/src/aes.c | 1061 +++ package/network/services/ead/src/ead-client.c | 433 ++ package/network/services/ead/src/ead-crypt.c | 179 + package/network/services/ead/src/ead-crypt.h | 21 + package/network/services/ead/src/ead-pcap.h | 71 + package/network/services/ead/src/ead.c | 974 +++ package/network/services/ead/src/ead.h | 139 + package/network/services/ead/src/filter.c | 25 + package/network/services/ead/src/libbridge.h | 60 + .../network/services/ead/src/libbridge_init.c | 127 + .../services/ead/src/libbridge_private.h | 35 + package/network/services/ead/src/list.h | 602 ++ package/network/services/ead/src/passwd | 3 + package/network/services/ead/src/pfc.c | 54 + .../network/services/ead/src/pw_encrypt_md5.c | 646 ++ package/network/services/ead/src/sha1.c | 104 + .../services/ead/src/tinysrp/Makefile.am | 28 + .../services/ead/src/tinysrp/Makefile.in | 477 ++ .../network/services/ead/src/tinysrp/Notes | 110 + .../services/ead/src/tinysrp/acconfig.h | 9 + .../services/ead/src/tinysrp/acinclude.m4 | 27 + .../services/ead/src/tinysrp/aclocal.m4 | 157 + package/network/services/ead/src/tinysrp/bn.h | 471 ++ .../network/services/ead/src/tinysrp/bn_add.c | 305 + .../network/services/ead/src/tinysrp/bn_asm.c | 382 ++ .../network/services/ead/src/tinysrp/bn_ctx.c | 142 + .../network/services/ead/src/tinysrp/bn_div.c | 378 + .../network/services/ead/src/tinysrp/bn_exp.c | 395 ++ .../network/services/ead/src/tinysrp/bn_lcl.h | 419 ++ .../network/services/ead/src/tinysrp/bn_lib.c | 576 ++ .../network/services/ead/src/tinysrp/bn_mul.c | 172 + .../services/ead/src/tinysrp/bn_prime.h | 325 + .../services/ead/src/tinysrp/bn_shift.c | 139 + .../network/services/ead/src/tinysrp/bn_sqr.c | 160 + .../services/ead/src/tinysrp/bn_word.c | 130 + .../services/ead/src/tinysrp/clitest.c | 110 + .../services/ead/src/tinysrp/config.h.in | 79 + .../services/ead/src/tinysrp/configure | 2421 +++++++ .../services/ead/src/tinysrp/configure.in | 52 + .../services/ead/src/tinysrp/install-sh | 250 + .../network/services/ead/src/tinysrp/missing | 134 + .../services/ead/src/tinysrp/mkinstalldirs | 39 + .../services/ead/src/tinysrp/srvtest.c | 111 + .../services/ead/src/tinysrp/stamp-h.in | 1 + .../services/ead/src/tinysrp/t_client.c | 285 + .../services/ead/src/tinysrp/t_client.h | 148 + .../network/services/ead/src/tinysrp/t_conf.c | 1080 +++ .../network/services/ead/src/tinysrp/t_conv.c | 226 + .../services/ead/src/tinysrp/t_defines.h | 169 + .../services/ead/src/tinysrp/t_getconf.c | 118 + .../services/ead/src/tinysrp/t_getpass.c | 191 + .../network/services/ead/src/tinysrp/t_math.c | 177 + .../network/services/ead/src/tinysrp/t_misc.c | 338 + .../network/services/ead/src/tinysrp/t_pw.c | 262 + .../network/services/ead/src/tinysrp/t_pwd.h | 310 + .../network/services/ead/src/tinysrp/t_read.c | 81 + .../network/services/ead/src/tinysrp/t_read.h | 55 + .../services/ead/src/tinysrp/t_server.c | 259 + .../services/ead/src/tinysrp/t_server.h | 138 + .../network/services/ead/src/tinysrp/t_sha.c | 166 + .../network/services/ead/src/tinysrp/t_sha.h | 26 + .../services/ead/src/tinysrp/t_truerand.c | 151 + .../network/services/ead/src/tinysrp/tconf.c | 157 + .../services/ead/src/tinysrp/tinysrp.c | 235 + .../services/ead/src/tinysrp/tinysrp.h | 18 + .../network/services/ead/src/tinysrp/tpasswd | 2 + .../services/ead/src/tinysrp/tphrase.c | 354 + package/network/services/hostapd/Makefile | 2 +- ...tant-time-operations-for-private-big.patch | 88 + ...nctions-for-constant-time-operations.patch | 212 + ...tant-time-selection-for-crypto_bignu.patch | 55 + ...timing-differences-in-PWE-derivation.patch | 242 + ...anches-in-is_quadratic_residue_blind.patch | 139 + ...-Mask-timing-of-MODP-groups-22-23-24.patch | 113 + ...-const_time-selection-for-PWE-in-FFC.patch | 100 + ...-time-operations-in-sae_test_pwd_see.patch | 133 + ...tant-time-and-memory-access-for-find.patch | 319 + ...rm-message-validation-in-error-cases.patch | 52 + ...r-Verify-received-scalar-and-element.patch | 53 + ...pwd-server-Detect-reflection-attacks.patch | 40 + ...t-Verify-received-scalar-and-element.patch | 53 + ...k-element-x-y-coordinates-explicitly.patch | 320 + package/network/services/lldpd/Makefile | 19 +- .../network/services/lldpd/files/lldpd.config | 1 + .../network/services/lldpd/files/lldpd.init | 4 + .../lldpd/patches/001-disable_libcap.patch | 17 + package/network/services/odhcpd/Makefile | 6 +- package/network/services/openvpn/Makefile | 8 +- .../services/openvpn/files/openvpn.init | 5 +- ...bedtls-disable-runtime-version-check.patch | 2 +- .../210-build_always_use_internal_lz4.patch | 2 +- package/network/services/ppp/Makefile | 8 +- package/network/services/ppp/files/ppp.sh | 7 + .../ppp/patches/140-pppoe_compile_fix.patch | 11 - .../services/ppp/patches/203-opt_flags.patch | 2 +- .../ppp/patches/204-radius_config.patch | 2 +- .../patches/205-no_exponential_timeout.patch | 4 +- .../patches/400-simplify_kernel_checks.patch | 8 +- .../services/ppp/patches/520-uniq.patch | 269 - .../patches/540-save-pppol2tp_fd_str.patch | 6 +- package/network/services/tinc/Makefile | 64 + .../network/services/tinc/files/tinc.config | 56 + package/network/services/tinc/files/tinc.init | 239 + .../network/services/tinc/files/tinc.upgrade | 1 + ...n-when-OpenSSL-has-no-ENGINE-support.patch | 48 + ...tion-without-deprecated-OpenSSL-APIs.patch | 98 + package/network/services/tinyproxy/Makefile | 51 + .../services/tinyproxy/files/tinyproxy.config | 251 + .../services/tinyproxy/files/tinyproxy.init | 142 + .../patches/010-no-docs-and-tests.patch | 86 + .../patches/020-config_and_pid-path.patch | 13 + .../030-allow_bind_in_transparent_mode.patch | 22 + .../tinyproxy/patches/120-fix_INET6.patch | 38 + ...2-3505-tiniproxy-randomized-hashmaps.patch | 101 + ...VE-2012-3505-tinyproxy-limit-headers.patch | 44 + package/network/services/tor/Makefile | 150 + package/network/services/tor/files/tor.init | 22 + .../services/tor/patches/001-torrc.patch | 25 + package/network/services/torsocks/Makefile | 62 + package/network/services/uhttpd/Makefile | 10 +- .../services/uhttpd/files/uhttpd.config | 2 +- package/network/services/wireguard/Makefile | 4 +- .../services/wireguard/files/wireguard.sh | 333 +- package/network/utils/comgt/files/ncm.sh | 10 + package/network/utils/curl/Makefile | 4 +- ...bedtls-disable-runtime-version-check.patch | 11 - package/network/utils/ethtool/Makefile | 4 +- package/network/utils/iperf/Makefile | 6 +- ...n-signal-handling-per-POSIX-calling-.patch | 43 - ...rtup-fix-daemon-mode-per-redirecting.patch | 161 - .../patches/0003-fix-non-ipv6-builds.patch | 16 +- package/network/utils/iproute2/Makefile | 43 +- .../001-tc-fix-undefined-XATTR_SIZE_MAX.patch | 10 - .../iproute2/patches/010-cake-fwmark.patch | 152 + ...tc-add-support-for-action-act_ctinfo.patch | 589 ++ .../utils/iproute2/patches/130-no_netem.patch | 2 +- .../patches/135-sync-iptables-header.patch | 101 + .../patches/140-keep_libmnl_optional.patch | 2 +- .../patches/145-keep_libelf_optional.patch | 11 + .../patches/150-keep_libcap_optional.patch | 11 + .../utils/iproute2/patches/170-ip_tiny.patch | 20 +- .../patches/175-reduce-dynamic-syms.patch | 44 + .../patches/190-link-libelf-to-tc-only.patch | 60 - package/network/utils/ipset/Makefile | 7 +- package/network/utils/iptables/Makefile | 17 +- ...sions_format-security_fixes_in_libip.patch | 52 - ...build_with_kernel_headers_before_4_2.patch | 48 - ...x_userspace_kernel_headers_collision.patch | 41 - .../patches/101-remove-check-already.patch | 4 +- .../iptables/patches/103-optional-xml.patch | 2 +- .../patches/200-configurable_builtin.patch | 12 +- .../iptables/patches/600-shared-libext.patch | 22 +- .../utils/iw/patches/001-nl80211_h_sync.patch | 28 +- package/network/utils/iwinfo/Makefile | 6 +- .../network/utils/layerscape/restool/Makefile | 6 +- .../510-remove-LINUX_NETDEVICE-hack.patch | 52 + package/network/utils/nftables/Makefile | 2 +- .../nftables/patches/010-uclibc-ng.patch | 28 + package/network/utils/umbim/Makefile | 6 +- package/network/utils/uqmi/Makefile | 8 +- .../utils/uqmi/files/lib/netifd/proto/qmi.sh | 10 + package/network/utils/wpan-tools/Makefile | 4 - package/system/ca-certificates/Makefile | 7 +- package/system/fstools/Makefile | 12 +- package/system/fstools/files/fstab.init | 6 +- package/system/librecmc-keyring/Makefile | 38 - package/system/mtd/src/Makefile | 3 +- package/system/mtd/src/linksys_bootcount.c | 108 +- .../system/mtd/src/linksys_bootcount_fix.c | 115 - package/system/mtd/src/wrgg.c | 27 +- package/system/openwrt-keyring/Makefile | 6 +- package/system/opkg/Makefile | 10 +- package/system/procd/Makefile | 9 +- package/system/procd/files/hotplug.json | 4 + package/system/procd/files/procd.sh | 23 +- package/system/rpcd/Makefile | 8 +- package/system/rpcd/files/rpcd.init | 7 +- package/system/ubox/Makefile | 23 +- package/system/ucert/Makefile | 1 + package/system/uci/Makefile | 8 +- package/system/uci/files/lib/config/uci.sh | 20 +- package/system/urandom-seed/Makefile | 32 + .../files/etc/init.d/urandom_seed | 0 .../files/lib/preinit/81_urandom_seed | 0 .../urandom-seed}/files/sbin/urandom_seed | 0 package/system/urngd/Makefile | 48 + package/system/urngd/files/urngd.init | 17 + package/system/usign/Makefile | 6 +- package/utils/adb/Makefile | 1 + .../adb/patches/003-fix-musl-build.patch | 10 + package/utils/busybox/Makefile | 22 +- ...se-rtnl_send_check-on-flush-commands.patch | 214 + package/utils/bzip2/Makefile | 15 +- .../bzip2/patches/010-CVE-2016-3189.patch | 11 - .../utils/bzip2/patches/020-no-utime.patch | 27 + package/utils/lua/Makefile | 2 +- .../013-lnum-strtoul-parsing-fixes.patch | 48 + .../013-lnum-strtoul-parsing-fixes.patch | 48 + package/utils/mdadm/Makefile | 2 +- .../mdadm/patches/100-cross_compile.patch | 2 +- ...missing-include-file-sys-sysmacros.h.patch | 29 + .../utils/mdadm/patches/200-reduce_size.patch | 2 +- package/utils/mtd-utils/Makefile | 6 +- ...rrect-error-number-in-ubi_get_vol_in.patch | 30 - package/utils/spidev_test/Makefile | 26 +- package/utils/spidev_test/src/spidev_test.c | 318 - package/utils/usbutils/Makefile | 8 +- package/utils/xfsprogs/Makefile | 2 +- ...six_memalign-instead-of-deprecated-v.patch | 31 + scripts/clean-package.sh | 1 + scripts/download.pl | 45 +- scripts/gen_image_generic.sh | 2 +- scripts/getver.sh | 2 +- scripts/metadata.pm | 5 + scripts/package-metadata.pl | 20 +- scripts/qemustart | 75 +- scripts/target-metadata.pl | 23 +- scripts/ubinize-image.sh | 2 +- target/Config.in | 3 + target/Makefile | 5 +- target/ccsdisk/Config.in | 25 - target/ccsdisk/Makefile | 41 - target/ccsdisk/files/README | 94 - target/imagebuilder/files/Makefile | 15 +- .../ar71xx/base-files/etc/board.d/01_leds | 12 +- .../ar71xx/base-files/etc/board.d/02_network | 90 +- target/linux/ar71xx/base-files/etc/diag.sh | 6 +- .../etc/hotplug.d/firmware/10-ath9k-eeprom | 6 +- .../etc/hotplug.d/net/10-ar922x-led-fix | 3 + target/linux/ar71xx/base-files/lib/ar71xx.sh | 315 +- .../lib/preinit/05_set_preinit_iface_ar71xx | 1 + .../ar71xx/base-files/lib/upgrade/platform.sh | 10 +- .../files/arch/mips/ath79/Kconfig.openwrt | 1 + .../files/arch/mips/ath79/mach-archer-c7.c | 20 +- .../files/arch/mips/ath79/mach-cpe510.c | 3 + .../files/arch/mips/ath79/mach-hiveap-121.c | 2 +- .../files/arch/mips/ath79/mach-rambutan.c | 2 + .../files/arch/mips/ath79/mach-rb2011.c | 6 +- .../ar71xx/files/arch/mips/ath79/mach-rb4xx.c | 2 +- .../ar71xx/files/arch/mips/ath79/mach-rb922.c | 107 +- .../ar71xx/files/arch/mips/ath79/mach-rbspi.c | 16 + .../files/arch/mips/ath79/mach-tl-wr940n-v4.c | 2 +- .../files/arch/mips/ath79/mach-ubnt-xm.c | 3 + .../files/arch/mips/ath79/mach-wnr2200.c | 1 + .../ar71xx/files/arch/mips/ath79/machtypes.h | 2 + .../ethernet/atheros/ag71xx/ag71xx_ethtool.c | 48 +- .../net/ethernet/atheros/ag71xx/ag71xx_main.c | 153 +- .../net/ethernet/atheros/ag71xx/ag71xx_phy.c | 6 +- target/linux/ar71xx/image/Makefile | 1 + .../ar71xx/image/generic-legacy-devices.mk | 7 + target/linux/ar71xx/image/generic-tp-link.mk | 50 +- target/linux/ar71xx/image/generic-ubnt.mk | 280 + target/linux/ar71xx/image/generic.mk | 77 +- target/linux/ar71xx/image/nand.mk | 4 + .../linux/ar71xx/image/tiny-legacy-devices.mk | 1 + .../310-lib-add-rle-decompression.patch | 2 +- ...50-gpio-nxp-74hc153-gpio-chip-driver.patch | 2 +- ...x164-improve-platform-device-support.patch | 2 +- .../452-gpio-add-gpio-latch-driver.patch | 2 +- .../patches-4.14/500-MIPS-fw-myloader.patch | 2 +- ...PS-ath79-process-board-kernel-option.patch | 2 +- ...525-MIPS-ath79-enable-qca-usb-quirks.patch | 2 +- .../patches-4.14/604-MIPS-ath79-no-of.patch | 4 +- .../910-unaligned_access_hacks.patch | 12 +- .../patches-4.14/930-chipidea-pullup.patch | 2 +- .../950-add-boardinfo-platform-data.patch | 6 +- .../ath79/base-files/etc/board.d/01_leds | 93 +- .../ath79/base-files/etc/board.d/02_network | 174 +- .../base-files/etc/board.d/03_gpio_switches | 22 + .../etc/hotplug.d/firmware/10-ath9k-eeprom | 21 +- .../etc/hotplug.d/ieee80211/00-wifi-migration | 50 + .../etc/uci-defaults/04_led_migration | 28 + .../ath79/base-files/lib/upgrade/platform.sh | 33 +- target/linux/ath79/config-4.19 | 229 + .../linux/ath79/dts/ar7161_aruba_ap-105.dts | 190 + .../linux/ath79/dts/ar7161_jjplus_ja76pf2.dts | 126 + .../ath79/dts/ar7161_netgear_wndr3700.dtsi | 3 +- target/linux/ath79/dts/ar7240.dtsi | 3 +- target/linux/ath79/dts/ar7241.dtsi | 5 +- .../linux/ath79/dts/ar7241_ubnt_airrouter.dts | 4 +- target/linux/ath79/dts/ar7241_ubnt_nano-m.dts | 9 - .../ath79/dts/ar7241_ubnt_nanostation-m.dts | 9 + target/linux/ath79/dts/ar7242.dtsi | 7 +- .../ath79/dts/ar7242_buffalo_bhr-4grv.dts | 2 +- .../ath79/dts/ar7242_buffalo_wzr-bhr.dtsi | 4 +- .../ath79/dts/ar7242_buffalo_wzr-hp-g450h.dts | 4 +- target/linux/ath79/dts/ar9330.dtsi | 19 +- .../ath79/dts/ar9330_glinet_gl-ar150.dts | 2 +- .../ath79/dts/ar9331_8dev_carambola2.dts | 135 + .../dts/ar9331_dptechnics_dpt-module.dts | 69 - .../linux/ath79/dts/ar9331_dragino_ms14.dts | 90 - .../dts/ar9331_embeddedwireless_dorin.dts | 2 +- .../linux/ath79/dts/ar9331_etactica_eg200.dts | 4 +- target/linux/ath79/dts/ar9331_onion_omega.dts | 69 - .../ath79/dts/ar9331_tplink_tl-mr3040-v2.dts | 2 + .../ath79/dts/ar9331_tplink_tl-wr710n-v1.dts | 130 + .../dts/ar9331_tplink_tl-wr741nd-v4.dtsi | 2 +- .../linux/ath79/dts/ar9342_iodata_etg3-r.dts | 2 +- .../ath79/dts/ar9342_ubnt_nanobeam-ac.dts | 64 + .../dts/ar9342_ubnt_nanostation-m-xw.dts | 37 + .../linux/ath79/dts/ar9344_ocedo_raccoon.dts | 3 +- .../ath79/dts/ar9344_tplink_tl-wdr3600-v1.dts | 9 + .../ath79/dts/ar9344_tplink_tl-wdr3600.dts | 9 - .../ath79/dts/ar9344_tplink_tl-wdr4300-v1.dts | 9 + .../ath79/dts/ar9344_tplink_tl-wdr4300.dts | 9 - .../linux/ath79/dts/ar9344_wd_mynet-n750.dts | 216 + .../ar9344_wd_mynet-wifi-rangeextender.dts | 6 +- .../ath79/dts/ar9344_zbtlink_zbt-wd323.dts | 166 + target/linux/ath79/dts/ar934x.dtsi | 16 +- target/linux/ath79/dts/ath79.dtsi | 4 +- .../linux/ath79/dts/qca9531_comfast_cf-e5.dts | 141 + .../ath79/dts/qca9531_engenius_ews511ap.dts | 144 - .../dts/qca9531_glinet_gl-ar300m-lite.dts | 22 + .../dts/qca9531_glinet_gl-ar300m-nand.dts | 34 - .../dts/qca9531_glinet_gl-ar300m-nor.dts | 39 - .../ath79/dts/qca9531_glinet_gl-ar300m.dtsi | 58 +- .../ath79/dts/qca9531_glinet_gl-x750.dts | 1 + .../linux/ath79/dts/qca9531_yuncore_a770.dts | 126 + .../ath79/dts/qca9533_tplink_cpe210-v2.dts | 9 + .../ath79/dts/qca9533_tplink_cpe210-v3.dts | 9 + .../ath79/dts/qca9533_tplink_cpe210.dtsi | 135 + .../ath79/dts/qca9533_tplink_tl-wr842n-v3.dts | 168 + .../linux/ath79/dts/qca9533_ubnt_acb-isp.dts | 95 + target/linux/ath79/dts/qca953x.dtsi | 7 +- target/linux/ath79/dts/qca9557.dtsi | 20 +- .../ath79/dts/qca9557_iodata_wn-ac1167dgr.dts | 28 - .../ath79/dts/qca9557_iodata_wn-ac1600dgr.dts | 28 - .../dts/qca9557_iodata_wn-ac1600dgr2.dts | 28 - .../ath79/dts/qca9558_devolo_dvl1200e.dts | 47 - .../ath79/dts/qca9558_devolo_dvl1200i.dts | 51 - .../ath79/dts/qca9558_devolo_dvl1750c.dts | 46 - .../ath79/dts/qca9558_devolo_dvl1750e.dts | 83 - .../ath79/dts/qca9558_devolo_dvl1750i.dts | 51 - .../qca9558_librerouter_librerouter-v1.dts | 211 + .../ath79/dts/qca9558_netgear_ex6400.dts | 9 + .../ath79/dts/qca9558_netgear_ex7300.dtsi | 222 + .../linux/ath79/dts/qca9558_ocedo_koala.dts | 160 - .../ath79/dts/qca9558_openmesh_om5p-ac-v2.dts | 168 - .../dts/qca9558_tplink_tl-wr941n-v7-cn.dts | 126 + .../dts/qca9561_tplink_archer-c58-v1.dts | 125 - .../dts/qca9561_tplink_archer-c59-v1.dts | 147 - .../ath79/dts/qca9563_dlink_dir-859-a1.dts | 177 - .../dts/qca9563_elecom_wrc-1750ghbk2-i.dts | 56 - .../dts/qca9563_elecom_wrc-300ghbk2-i.dts | 4 +- .../ath79/dts/qca9563_elecom_wrc-ghbk2-i.dtsi | 4 +- .../ath79/dts/qca9563_glinet_gl-ar750s.dts | 30 +- .../linux/ath79/dts/qca9563_nec_wg800hp.dts | 188 - .../linux/ath79/dts/qca9563_phicomm_k2t.dts | 148 - .../ath79/dts/qca9563_rosinson_wr818.dts | 2 +- .../ath79/dts/qca9563_tplink_archer-a7-v5.dts | 50 - .../ath79/dts/qca9563_tplink_archer-c2-v3.dts | 185 - .../ath79/dts/qca9563_tplink_archer-c6-v2.dts | 9 - .../ath79/dts/qca9563_tplink_archer-c7-v4.dts | 271 - .../ath79/dts/qca9563_tplink_archer-c7-v5.dts | 55 - .../dts/qca9563_tplink_archer-x6-v2.dtsi | 1 + .../dts/qca9563_tplink_archer-x7-v5.dtsi | 118 +- .../ath79/dts/qca9563_tplink_re450-v2.dts | 189 - .../dts/qca9563_tplink_tl-wr1043n-v5.dts | 74 + .../ath79/dts/qca9563_tplink_tl-wr1043n.dtsi | 71 +- .../dts/qca9563_tplink_tl-wr1043nd-v4.dts | 73 +- target/linux/ath79/dts/qca956x.dtsi | 9 +- .../net/ethernet/atheros/ag71xx/Makefile | 1 - .../net/ethernet/atheros/ag71xx/ag71xx.h | 1 + .../ethernet/atheros/ag71xx/ag71xx_ar7240.c | 1344 ---- .../ethernet/atheros/ag71xx/ag71xx_ethtool.c | 40 +- .../net/ethernet/atheros/ag71xx/ag71xx_gmac.c | 1 + .../net/ethernet/atheros/ag71xx/ag71xx_main.c | 155 +- .../net/ethernet/atheros/ag71xx/ag71xx_mdio.c | 2 +- .../net/ethernet/atheros/ag71xx/ag71xx_phy.c | 4 +- target/linux/ath79/generic/config-default | 1 + target/linux/ath79/image/Makefile | 1 + target/linux/ath79/image/common-netgear.mk | 17 + target/linux/ath79/image/common-tp-link.mk | 5 +- target/linux/ath79/image/generic-tp-link.mk | 105 +- target/linux/ath79/image/generic-ubnt.mk | 243 + target/linux/ath79/image/generic.mk | 117 +- target/linux/ath79/image/tiny-netgear.mk | 28 +- target/linux/ath79/image/tiny-tp-link.mk | 8 + ...0027-MIPS-ath79-drop-legacy-IRQ-code.patch | 2 +- .../0028-MIPS-ath79-drop-machfiles.patch | 4 +- .../0036-GPIO-add-named-gpio-exports.patch | 2 +- .../408-mtd-redboot_partition_scan.patch | 44 + .../910-unaligned_access_hacks.patch | 8 +- .../011-kbuild-export-SUBARCH.patch | 4 +- ...-for-controlling-warnings-to-linux-c.patch | 4 +- ...tcp-allow-drivers-to-tweak-TSQ-logic.patch | 6 +- ...ption-fix-dwm-158-3g-modem-interface.patch | 2 +- ...port-for-host-mode-external-vbus-sup.patch | 10 +- ...wc2_vbus_supply_init-fix-error-check.patch | 2 +- ...ddress-assignment-via-ifconfig-ioctl.patch | 4 +- ...acket.h-include-its-headers-directly.patch | 36 + ...dv-Remove-usage-of-BIT-x-in-packet.h.patch | 72 + ...e-kernel-fixed-width-types-in-packet.patch | 386 ++ ...-adv-Convert-packet.h-to-uapi-header.patch | 1665 +++++ ...tor-Parse-batman-adv-unicast-headers.patch | 108 + ...e-size-of-hook-entry-point-locations.patch | 6 +- ...allocate-space-for-arp-bridge-hooks-.patch | 2 +- ...nly-allow-one-nat-hook-per-hook-poin.patch | 2 +- ...les-remove-multihook-chains-and-fami.patch | 36 +- ...hecksum-indirection-to-struct-nf_ipv.patch | 2 +- ...hecksum_partial-indirection-to-struc.patch | 2 +- ...-saveroute-indirection-in-struct-nf_.patch | 8 +- ...oute-indirection-to-struct-nf_ipv6_o.patch | 2 +- ...eroute-indirection-to-struct-nf_ipv6.patch | 10 +- ...-route_key_size-field-in-struct-nf_a.patch | 4 +- ...-struct-nf_afinfo-and-its-helper-fun.patch | 4 +- ...les-remove-hooks-from-family-definit.patch | 6 +- ...conntrack-add-IPS_OFFLOAD-status-bit.patch | 16 +- ...bles-add-flow-table-netlink-frontend.patch | 32 +- ...etfilter-flow-table-support-for-IPv6.patch | 2 +- ...les-remove-nhooks-field-from-struct-.patch | 4 +- ...les-fix-a-typo-in-nf_tables_getflowt.patch | 2 +- ...les-remove-flag-field-from-struct-nf.patch | 2 +- ...les-no-need-for-struct-nft_af_info-t.patch | 12 +- ...les-remove-struct-nft_af_info-parame.patch | 6 +- ...les-fix-potential-NULL-ptr-deref-in-.patch | 2 +- ...les-add-single-table-list-for-all-fa.patch | 144 +- ...tfilter-exit_net-cleanup-check-added.patch | 4 +- ...nf_tables-get-rid-of-pernet-families.patch | 10 +- ...les-get-rid-of-struct-nft_af_info-ab.patch | 128 +- ...ow_offload-wait-for-garbage-collecto.patch | 2 +- ...tfilter-nf_tables-fix-flowtable-free.patch | 2 +- ...les-allocate-handle-and-delete-objec.patch | 48 +- ...ipv6-make-ip6_dst_mtu_forward-inline.patch | 2 +- ...w_table-move-init-code-to-nf_flow_ta.patch | 4 +- ...w_table-fix-priv-pointer-for-netdev-.patch | 2 +- ...w_table-track-flow-tables-in-nf_flow.patch | 2 +- ...w_table-fix-offloaded-connection-tim.patch | 4 +- ...et-sched-Introduce-act_ctinfo-action.patch | 566 ++ ...dev-fix-refcnt-leak-on-interface-ren.patch | 69 + ...ault-compression-selection-in-ubifs.patch} | 0 ...-dmi-Add-access-to-the-SKU-ID-string.patch | 57 + ...y-serial-exar-generalize-rs485-setup.patch | 75 + ...dcode-path-to-awk-in-scripts-ld-vers.patch | 30 - .../011-kbuild-export-SUBARCH.patch | 23 - .../020-backport_netfilter_rtcache.patch | 558 -- ...inal-flags-for-every-struct-mtd_info.patch | 58 - ...ulating-partition-boundaries-when-ch.patch | 55 - ...-direct-pointer-to-the-struct-device.patch | 199 - ...002-bcma-use-dev_-printing-functions.patch | 36 - ...ddress-assignment-via-ifconfig-ioctl.patch | 79 - ...s3xxx-use-actual-size-reads-for-PCIe.patch | 46 - ...ow_offload-handle-netdevice-events-f.patch | 99 - ...w_table-clean-up-and-fix-dst-handlin.patch | 89 - ...w_table-fix-offloaded-connection-tim.patch | 110 - ...w_table-fix-up-ct-state-of-flows-aft.patch | 24 - ...dcode-path-to-awk-in-scripts-ld-vers.patch | 29 - .../011-kbuild-export-SUBARCH.patch | 23 - ...-for-controlling-warnings-to-linux-c.patch | 143 - ...te-alias-warning-for-SYSCALL_DEFINEx.patch | 88 - .../020-backport_netfilter_rtcache.patch | 543 -- .../021-bridge-multicast-to-unicast.patch | 499 -- ...rsion-of-alloc_etherdev_mqs-function.patch | 69 - ...024-1-tcp-tsq-add-tsq_flags-tsq_enum.patch | 90 - ...ve-one-locked-operation-in-tcp_wfree.patch | 48 - ...tsq-add-shortcut-in-tcp_tasklet_func.patch | 71 - ...cp-tsq-avoid-one-atomic-in-tcp_wfree.patch | 38 - ...-a-shortcut-in-tcp_small_queue_check.patch | 37 - ...cp_mtu_probe-is-likely-to-exit-early.patch | 55 - ...struct-sock-for-better-data-locality.patch | 158 - ...ove-tsq_flags-close-to-sk_wmem_alloc.patch | 176 - ...-missing-barrier-in-tcp_tasklet_func.patch | 40 - ...tcp-allow-drivers-to-tweak-TSQ-logic.patch | 85 - ...imit-and-delta-fields-from-struct-ub.patch | 82 - ...writeback_interval-value-for-wbuf-ti.patch | 66 - ...or-releasing-multiple-instances-of-a.patch | 75 - ...c_page_frag-to-page_frag_alloc-and-_.patch | 137 - ..._frag-functions-to-__page_frag_cache.patch | 79 - ...flash-use-platform_-set-get-_drvdata.patch | 63 - ...h-support-reading-flash-out-of-mappi.patch | 81 - ...move-TRX-parsing-code-to-separated-f.patch | 180 - ...support-layouts-with-multiple-TRX-pa.patch | 112 - ...Macronix-mx25u25635f-to-list-of-know.patch | 22 - ...mtd-spi-nor-fix-spansion-quad-enable.patch | 42 - ...-mtd-spi-nor-fix-flags-for-s25fl128s.patch | 28 - ...td-spi-nor-add-support-for-s25fl208k.patch | 23 - ...-Add-at25df321-spi-nor-flash-support.patch | 26 - ...mtd-spi-nor-Add-support-for-N25Q016A.patch | 29 - ...-mtd-spi-nor-Add-support-for-mr25h40.patch | 25 - ...Add-support-for-S3AN-spi-nor-devices.patch | 312 - ...spi-nor-improve-macronix_quad_enable.patch | 28 - ...ve-WARN_ONCE-message-in-spi_nor_writ.patch | 33 - ...me-SPINOR_OP_-macros-of-the-4-byte-a.patch | 187 - ...a-stateless-method-to-support-memory.patch | 150 - ...Add-lock-unlock-support-for-f25l32pa.patch | 26 - ...-nor-Fix-S3AN-addressing-calculation.patch | 35 - ...-mtd-spi-nor-Add-support-for-gd25q16.patch | 28 - ...mtd-nand-Add-Winbond-manufacturer-id.patch | 34 - ...td-introduce-function-max_bad_blocks.patch | 73 - ...n-device-node-to-mtd-partition-devic.patch | 50 - ...le-stateless-4b-op-codes-for-mx25u25.patch | 29 - ...itioning-on-devices-with-0-erasesize.patch | 77 - ...tions-factor-out-code-calling-parser.patch | 68 - ...ns-add-helper-for-deleting-partition.patch | 119 - ...emove-sysfs-files-when-deleting-all-.patch | 45 - ...ename-master-to-the-parent-where-app.patch | 606 -- ...itions-add-support-for-subpartitions.patch | 96 - ...ns-add-support-for-partition-parsers.patch | 110 - ...parser-out-of-bcm47xxpart-into-a-sep.patch | 320 - ...ding-master-MTD-out-of-mtd_add_devic.patch | 74 - ...rid-of-the-mtd_add_device_partitions.patch | 93 - ...dd-of_match_table-parser-matching-fo.patch | 200 - ...t-parser-to-fixed-partitions-as-it-f.patch | 74 - ...of_match_table-with-fixed-partitions.patch | 44 - ...ding-registering-partitions-to-the-p.patch | 168 - ...-improve-handling-TRX-partition-size.patch | 70 - .../backport-4.9/070-bcma-from-4.11.patch | 85 - ...te-struct-bgmac-just-once-don-t-copy.patch | 139 - ...truct-bcma_mdio-we-don-t-need-anymor.patch | 261 - ...e-PHY-subsystem-for-initializing-PHY.patch | 53 - ...-master-mode-for-BCM54210E-and-B5021.patch | 50 - .../backport-4.9/072-bcma-from-4.12.patch | 47 - ...-Update-Auxiliary-Control-Register-m.patch | 34 - ...y-broadcom-Add-support-for-BCM54612E.patch | 94 - ...phy-broadcom-add-bcm54xx_auxctl_read.patch | 41 - ...-phy-broadcom-Add-BCM54810-PHY-entry.patch | 176 - ...-Move-bcm54xx_auxctl_-read-write-to-.patch | 74 - ...m-Allow-enabling-or-disabling-of-EEE.patch | 87 - ...-Add-support-code-for-reading-PHY-co.patch | 125 - ...et-phy-bcm7xxx-Add-entry-for-BCM7278.patch | 38 - ...-Implement-EGPHY-workaround-for-7278.patch | 68 - ...-use-auxctl-reading-helper-in-BCM546.patch | 45 - ...y-broadcom-add-support-for-BCM54210E.patch | 89 - ...adcom-rehook-BCM54612E-specific-init.patch | 121 - ...-support-new-device-flag-for-setting.patch | 54 - ...-variants-of-LED-registering-functio.patch | 120 - ...-variant-of-LED-registering-function.patch | 60 - ...5-add-thermal-driver-for-bcm2835-SoC.patch | 365 - ...roadcom-add-Northstar-thermal-driver.patch | 173 - ...B-ports-from-DT-in-the-usbport-LED-t.patch | 106 - ...le-working-over-slow-can_sleep-GPIOs.patch | 84 - .../087-regmap-make-LZO-cache-optional.patch | 69 - ...90-net-generalize-napi_complete_done.patch | 1412 ---- ...issing-tunnel-encapsulation-limit-op.patch | 50 - ...ort-ipv6_push_frag_opts-for-tunnelin.patch | 31 - ...ddress-assignment-via-ifconfig-ioctl.patch | 79 - ...3-0001-rtc-ds1307-add-ds1308-variant.patch | 51 - ...reserve-link-scope-traffic-original-.patch | 32 - ...s3xxx-use-actual-size-reads-for-PCIe.patch | 46 - ...s-trigger-Introduce-a-NETDEV-trigger.patch | 588 -- ...add-of_match_table-with-a-new-DT-bin.patch | 47 - ...add-of_match_table-with-the-new-DT-b.patch | 45 - ...se-DT-info-for-parsing-partitions-wi.patch | 102 - target/linux/generic/config-3.18 | 4667 ------------- target/linux/generic/config-4.14 | 31 +- target/linux/generic/config-4.19 | 6063 ----------------- target/linux/generic/config-4.9 | 5339 --------------- .../generic/files/drivers/misc/owl-loader.c | 2 +- .../drivers/mtd/mtdsplit/mtdsplit_wrgg.c | 10 + .../generic/files/drivers/net/phy/ar8216.c | 829 ++- .../generic/files/drivers/net/phy/ar8216.h | 72 +- .../generic/files/drivers/net/phy/ar8327.c | 35 +- .../files/drivers/net/phy/b53/b53_mdio.c | 10 + .../hack-4.14/202-reduce_module_size.patch | 24 - .../hack-4.14/207-disable-modorder.patch | 4 +- .../generic/hack-4.14/220-gc_sections.patch | 2 +- .../hack-4.14/259-regmap_dynamic.patch | 2 +- .../400-mt29f_spinand-fix-memleak.patch | 90 + .../702-phy_add_aneg_done_function.patch | 2 +- .../generic/hack-4.14/721-phy_packets.patch | 4 +- .../hack-4.14/901-debloat_sock_diag.patch | 2 +- .../generic/hack-4.14/902-debloat_proc.patch | 10 +- .../hack-4.14/904-debloat_dma_buf.patch | 2 +- .../911-kobject_add_broadcast_uevent.patch | 2 +- .../generic/hack-4.14/930-crashlog.patch | 2 +- .../hack-4.19/202-reduce_module_size.patch | 24 - .../generic/hack-4.19/204-module_strip.patch | 206 - .../hack-4.19/207-disable-modorder.patch | 44 - .../210-darwin_scripts_include.patch | 3053 --------- .../211-host_tools_portability.patch | 40 - .../hack-4.19/212-byteshift_portability.patch | 65 - .../hack-4.19/214-spidev_h_portability.patch | 24 - .../generic/hack-4.19/220-gc_sections.patch | 192 - .../hack-4.19/221-module_exports.patch | 101 - .../hack-4.19/230-openwrt_lzma_options.patch | 71 - .../hack-4.19/250-netfilter_depends.patch | 27 - .../generic/hack-4.19/251-sound_kconfig.patch | 197 - .../hack-4.19/259-regmap_dynamic.patch | 110 - .../260-crypto_test_dependencies.patch | 60 - .../generic/hack-4.19/280-rfkill-stubs.patch | 84 - ...mem-make-CONFIG_NVMEM-tristate-again.patch | 33 - ...cache-use-more-efficient-cache-blast.patch | 66 - .../301-mips_image_cmdline_hack.patch | 38 - .../321-powerpc_crtsavres_prereq.patch | 39 - .../generic/hack-4.19/531-debloat_lzma.patch | 1040 --- .../640-bridge-only-accept-EAP-locally.patch | 31 - .../hack-4.19/647-netfilter-flow-acct.patch | 70 - .../650-netfilter-add-xt_OFFLOAD-target.patch | 499 -- .../hack-4.19/651-wireless_mesh_header.patch | 24 - .../hack-4.19/660-fq_codel_defaults.patch | 27 - .../661-use_fq_codel_by_default.patch | 94 - .../hack-4.19/662-remove_pfifo_fast.patch | 221 - .../700-swconfig_switch_drivers.patch | 140 - .../702-phy_add_aneg_done_function.patch | 27 - .../generic/hack-4.19/721-phy_packets.patch | 176 - .../hack-4.19/773-bgmac-add-srab-switch.patch | 98 - .../hack-4.19/835-misc-owl_loader.patch | 52 - .../hack-4.19/901-debloat_sock_diag.patch | 136 - .../generic/hack-4.19/902-debloat_proc.patch | 405 -- .../hack-4.19/904-debloat_dma_buf.patch | 64 - .../hack-4.19/910-kobject_uevent.patch | 32 - .../911-kobject_add_broadcast_uevent.patch | 76 - ...ays-create-console-node-in-initramfs.patch | 40 - .../generic/hack-4.19/930-crashlog.patch | 338 - ...p-offload-hooks-on-netdev-unregister.patch | 91 - .../hack-4.9/202-reduce_module_size.patch | 24 - .../generic/hack-4.9/204-module_strip.patch | 214 - .../hack-4.9/207-disable-modorder.patch | 44 - .../hack-4.9/210-darwin_scripts_include.patch | 3065 --------- .../hack-4.9/211-host_tools_portability.patch | 40 - .../hack-4.9/212-byteshift_portability.patch | 65 - .../hack-4.9/214-spidev_h_portability.patch | 24 - .../generic/hack-4.9/220-gc_sections.patch | 448 -- .../generic/hack-4.9/221-module_exports.patch | 101 - .../hack-4.9/230-openwrt_lzma_options.patch | 71 - .../hack-4.9/250-netfilter_depends.patch | 27 - .../generic/hack-4.9/251-sound_kconfig.patch | 195 - .../generic/hack-4.9/259-regmap_dynamic.patch | 100 - .../260-crypto_test_dependencies.patch | 62 - .../generic/hack-4.9/280-rfkill-stubs.patch | 94 - ...cache-use-more-efficient-cache-blast.patch | 66 - .../301-mips_image_cmdline_hack.patch | 38 - .../321-powerpc_crtsavres_prereq.patch | 26 - .../generic/hack-4.9/531-debloat_lzma.patch | 1040 --- .../640-bridge-only-accept-EAP-locally.patch | 32 - .../hack-4.9/641-bridge_port_isolate.patch | 76 - .../hack-4.9/651-wireless_mesh_header.patch | 24 - .../hack-4.9/660-fq_codel_defaults.patch | 27 - .../661-use_fq_codel_by_default.patch | 94 - .../hack-4.9/662-remove_pfifo_fast.patch | 159 - .../700-swconfig_switch_drivers.patch | 150 - .../702-phy_add_aneg_done_function.patch | 27 - ...710-phy-add-mdio_register_board_info.patch | 197 - .../generic/hack-4.9/721-phy_packets.patch | 176 - .../hack-4.9/773-bgmac-add-srab-switch.patch | 98 - .../hack-4.9/835-misc-owl_loader.patch | 52 - .../hack-4.9/901-debloat_sock_diag.patch | 95 - .../generic/hack-4.9/902-debloat_proc.patch | 406 -- .../hack-4.9/904-debloat_dma_buf.patch | 64 - .../generic/hack-4.9/910-kobject_uevent.patch | 32 - .../911-kobject_add_broadcast_uevent.patch | 76 - ...ays-create-console-node-in-initramfs.patch | 40 - .../linux/generic/hack-4.9/930-crashlog.patch | 338 - .../pending-3.18/001-mtdsplit_backport.patch | 142 - .../002-phy_drivers_backport.patch | 552 -- .../pending-3.18/003-myloader_backport.patch | 11 - .../generic/pending-3.18/020-ssb_update.patch | 134 - .../generic/pending-3.18/021-ssb_sprom.patch | 32 - .../pending-3.18/025-bcma_backport.patch | 286 - .../pending-3.18/026-bcma-from-3.20.patch | 527 -- .../pending-3.18/027-bcma-from-4.1.patch | 680 -- .../pending-3.18/028-bcma-from-4.2.patch | 86 - .../pending-3.18/029-bcma-from-4.4.patch | 26 - .../030-backport_bcm47xx_nvram.patch | 52 - ...11-Allow-set-network-namespace-by-fd.patch | 21 - .../pending-3.18/031-bcma-from-4.5.patch | 49 - .../pending-3.18/032-bcma-from-4.6.patch | 716 -- ...-mtd-bcm47xxpart-backports-from-3.19.patch | 50 - ...-mtd-bcm47xxpart-backports-from-3.20.patch | 95 - ...GD25Q128B_support_backport_from_3.19.patch | 15 - .../044-backport-m25p80-jedec-probe.patch | 39 - .../050-backport_netfilter_rtcache.patch | 509 -- ...ting-hash_max-multicast_router-if-in.patch | 99 - .../060-mips_decompressor_memmove.patch | 22 - ...gmac-register-napi-before-the-device.patch | 44 - ...rqs-only-if-there-is-nothing-to-poll.patch | 30 - .../073-bgmac-Clean-warning-messages.patch | 50 - ...ixed-PHY-for-ARM-BCM470X-BCM5301X-ch.patch | 76 - ...mac-allow-enabling-on-ARCH_BCM_5301X.patch | 28 - ...76-net-phy-export-fixed_phy_register.patch | 30 - ...scriptor-frame-start-end-definitions.patch | 24 - ...gmac-implement-GRO-and-use-build_skb.patch | 189 - ...mac-implement-scatter-gather-support.patch | 267 - ...gmac-simplify-tx-ring-index-handling.patch | 125 - ...rrupts-disabled-as-long-as-there-is-.patch | 87 - ...received-skb-headroom-to-NET_SKB_PAD.patch | 66 - ...bgmac-simplify-rx-DMA-error-handling.patch | 130 - ...gmac-add-check-for-oversized-packets.patch | 27 - ...ncrease-rx-ring-size-from-511-to-512.patch | 23 - ...7-10-bgmac-simplify-dma-init-cleanup.patch | 184 - .../077-11-bgmac-fix-DMA-rx-corruption.patch | 88 - .../077-12-bgmac-drop-ring-num_slots.patch | 132 - ...enable-Ethernet-core-before-using-it.patch | 31 - ...fix-MAC-soft-reset-bit-for-corerev-4.patch | 34 - ...c-net-fib_trie-when-CONFIG_IP_MULTIP.patch | 46 - ...e-balancing-issue-if-new-node-pushes.patch | 72 - ...usage-stats-to-be-percpu-instead-of-.patch | 200 - ...rie-Make-leaf-and-tnode-more-uniform.patch | 421 -- ...node_free-and-leaf_free-into-node_fr.patch | 209 - ...80-05-fib_trie-Merge-leaf-into-tnode.patch | 928 --- ...e-fib_table_lookup-to-avoid-wasting-.patch | 343 - ...0-07-fib_trie-Optimize-fib_find_node.patch | 64 - ...8-fib_trie-Optimize-fib_table_insert.patch | 276 - ...meaning-of-pos-to-represent-unchecke.patch | 346 - ...igned-long-for-anything-dealing-with.patch | 186 - ...Push-rcu_read_lock-unlock-to-callers.patch | 403 -- ...e-Move-resize-to-after-inflate-halve.patch | 345 - ...ctions-should_inflate-and-should_hal.patch | 250 - ...signment-of-child-to-parent-down-int.patch | 336 - ...tnode-flushing-down-to-inflate-halve.patch | 237 - ...-halve-nodes-in-a-more-RCU-friendly-.patch | 345 - ...checks-for-index-tnode_child_length-.patch | 95 - ...Add-tracking-value-for-suffix-length.patch | 234 - ...ex-0ul-n-bits-instead-of-index-n-bit.patch | 52 - ...-bug-and-merge-similar-bits-of-infla.patch | 267 - ...ck-to-slen-update-on-inflate-halve-f.patch | 61 - ...llapse-and-should_collapse-to-resize.patch | 206 - ...ty_children-instead-of-counting-empt.patch | 34 - ...b_find_alias-to-file-where-it-is-use.patch | 79 - ...-Various-clean-ups-for-handling-slen.patch | 116 - ...eue-to-die-properly-when-a-PADT-is-r.patch | 89 - ...02-pppoe-Lacks-DST-MAC-address-check.patch | 25 - ...poe-device-in-pppoe_unbind_sock_work.patch | 28 - ..._state-to-PPPOX_ZOMBIE-in-pppoe_disc.patch | 45 - ...ppp-remove-PPPOX_ZOMBIE-socket-state.patch | 51 - ...ry-corruption-in-padt-work-structure.patch | 82 - ...ment-fix-headroom-tests-and-skb-leak.patch | 101 - ...ncrease-headroom-on-received-packets.patch | 54 - .../087-regmap-make-LZO-cache-optional.patch | 67 - ...layfs-fallback-to-readonly-when-full.patch | 109 - ...i-nor-add-support-Spansion_S25FL164K.patch | 10 - ...-if-the-device-is-processing-a-messa.patch | 47 - ...rs-inside-calling-context-for-spi_sy.patch | 184 - ...e-message-pump-in-the-worker-kthread.patch | 83 - ...ility-of-linux-in.h-with-netinet-in..patch | 146 - ...ing_init-new-hook-for-archs-before-m.patch | 182 - .../pending-3.18/102-ehci_hcd_ignore_oc.patch | 82 - ...ame2-and-add-RENAME_WHITEOUT-support.patch | 86 - ...11-jffs2-add-RENAME_EXCHANGE-support.patch | 58 - ...ge_allow_receiption_on_disabled_port.patch | 54 - .../132-mips_inline_dma_ops.patch | 688 -- ...-generic-parsing-of-linux-part-probe.patch | 175 - ...part-don-t-fail-because-of-bit-flips.patch | 92 - ...ci-make-USB_XHCI_PLATFORM-selectable.patch | 41 - ...t_for_moving_ndp_to_end_of_ncm_frame.patch | 228 - ...-support-for-Quectel-EC20-Mini-PCIe-.patch | 114 - ...-quirk-for-Quectel-EC20-Mini-PCIe-mo.patch | 91 - .../pending-3.18/200-fix_localversion.patch | 11 - .../pending-3.18/201-extra_optimization.patch | 14 - .../pending-3.18/202-reduce_module_size.patch | 11 - .../203-kallsyms_uncompressed.patch | 108 - .../pending-3.18/204-module_strip.patch | 190 - .../205-backtrace_module_info.patch | 36 - .../210-darwin_scripts_include.patch | 3088 --------- .../212-byteshift_portability.patch | 51 - .../213-x86_vdso_portability.patch | 13 - .../214-spidev_h_portability.patch | 11 - .../pending-3.18/220-gc_sections.patch | 531 -- .../pending-3.18/221-module_exports.patch | 88 - .../230-openwrt_lzma_options.patch | 58 - .../pending-3.18/250-netfilter_depends.patch | 18 - .../pending-3.18/251-sound_kconfig.patch | 18 - .../pending-3.18/252-mv_cesa_depends.patch | 10 - .../pending-3.18/253-ssb_b43_default_on.patch | 29 - .../254-textsearch_kconfig_hacks.patch | 23 - .../255-lib80211_kconfig_hacks.patch | 31 - .../256-crypto_add_kconfig_prompts.patch | 47 - .../257-wireless_ext_kconfig_hack.patch | 22 - .../258-netfilter_netlink_kconfig_hack.patch | 11 - .../pending-3.18/259-regmap_dynamic.patch | 83 - .../260-crypto_test_dependencies.patch | 37 - ...t-add-fallback-for-unsupported-libcs.patch | 102 - ...prevent-redefinition-of-struct-ethhd.patch | 55 - .../300-mips_expose_boot_raw.patch | 39 - .../301-mips_image_cmdline_hack.patch | 28 - .../302-mips_no_branch_likely.patch | 11 - .../pending-3.18/304-mips_disable_fpu.patch | 105 - .../pending-3.18/305-mips_module_reloc.patch | 356 - .../306-mips_mem_functions_performance.patch | 83 - .../307-mips_highmem_offset.patch | 17 - .../310-arm_module_unresolved_weak_sym.patch | 13 - .../320-ppc4xx_optimization.patch | 31 - .../321-powerpc_crtsavres_prereq.patch | 10 - ...t-command-line-parameters-from-users.patch | 298 - .../400-mtd-add-rootfs-split-support.patch | 171 - ...for-different-partition-parser-types.patch | 113 - ...arsers-for-rootfs-and-firmware-split.patch | 72 - .../403-mtd-hook-mtdsplit-to-Kbuild.patch | 22 - .../404-mtd-add-more-helper-functions.patch | 101 - ...405-mtd-old-firmware-uimage-splitter.patch | 70 - ...406-mtd-old-rootfs-squashfs-splitter.patch | 76 - ...rward-declaration-of-struct-mtd_info.patch | 18 - .../411-mtd-partial_eraseblock_write.patch | 142 - .../412-mtd-partial_eraseblock_unlock.patch | 18 - .../pending-3.18/420-mtd-redboot_space.patch | 30 - ...30-mtd-add-myloader-partition-parser.patch | 35 - ...check-for-bad-blocks-when-calculatin.patch | 100 - ...bcm47xxpart-detect-T_Meter-partition.patch | 42 - .../pending-3.18/440-block2mtd_init.patch | 107 - .../pending-3.18/441-block2mtd_probe.patch | 110 - ...-to-use-platform-specific-chip-fixup.patch | 37 - ...n-code-of-nand_correct_data-function.patch | 11 - ...mtd-cfi_cmdset_0002-no-erase_suspend.patch | 11 - ...et_0002-add-buffer-write-cmd-timeout.patch | 18 - ...add-support-for-Winbond-W25X05-flash.patch | 20 - ...support-for-the-Macronix-MX25L512E-S.patch | 21 - ...support-for-the-ISSI-SI25CD512-SPI-f.patch | 22 - ...mtd-spi-nor-add-macronix-mx25u25635f.patch | 10 - .../476-mtd-spi-nor-add-eon-en25qh32.patch | 10 - .../480-mtd-set-rootfs-to-be-root-dev.patch | 26 - ...mtd-device-named-ubi-or-data-on-boot.patch | 76 - ...to-create-ubiblock-device-for-rootfs.patch | 69 - ...ting-ubi0-rootfs-in-init-do_mounts.c.patch | 54 - ...ROOT_DEV-to-ubiblock-rootfs-if-unset.patch | 37 - .../494-mtd-ubi-add-EOF-marker-support.patch | 51 - .../530-jffs2_make_lzma_available.patch | 5142 -------------- .../pending-3.18/531-debloat_lzma.patch | 1024 --- .../pending-3.18/532-jffs2_eofdetect.patch | 56 - .../550-ubifs-symlink-xattr-support.patch | 55 - ...fs-fix-default-compression-selection.patch | 29 - .../600-netfilter_conntrack_flush.patch | 86 - ...etfilter_match_bypass_default_checks.patch | 101 - ...netfilter_match_bypass_default_table.patch | 94 - ...netfilter_match_reduce_memory_access.patch | 16 - ...-netfilter_optional_tcp_window_check.patch | 36 - .../616-net_optimize_xfrm_calls.patch | 12 - .../pending-3.18/621-sched_act_connmark.patch | 161 - .../pending-3.18/630-packet_socket_type.patch | 134 - .../640-bridge_no_eap_forward.patch | 23 - .../641-bridge_always_accept_eap.patch | 17 - .../642-bridge_port_isolate.patch | 92 - .../645-bridge_multicast_to_unicast.patch | 390 -- .../pending-3.18/650-pppoe_header_pad.patch | 0 .../651-wireless_mesh_header.patch | 11 - .../653-disable_netlink_trim.patch | 26 - .../pending-3.18/655-increase_skb_pad.patch | 11 - .../656-skb_reduce_truesize-helper.patch | 41 - .../657-qdisc_reduce_truesize.patch | 63 - .../pending-3.18/660-fq_codel_defaults.patch | 13 - .../661-fq_codel_keep_dropped_stats.patch | 10 - .../662-use_fq_codel_by_default.patch | 95 - .../pending-3.18/663-remove_pfifo_fast.patch | 143 - ...Add-support-for-MAP-E-FMRs-mesh-mode.patch | 481 -- ...urce-specific-default-route-handling.patch | 96 - ...ng-with-source-address-failed-policy.patch | 249 - ...nes-for-_POLICY_FAILED-until-all-cod.patch | 53 - ...T-skip-GRO-for-foreign-MAC-addresses.patch | 160 - .../681-NET-add-of_get_mac_address_mtd.patch | 88 - .../generic/pending-3.18/700-swconfig.patch | 39 - .../pending-3.18/701-phy_extension.patch | 63 - .../702-phy_add_aneg_done_function.patch | 27 - ...detach-callback-to-struct-phy_driver.patch | 27 - ...710-phy-add-mdio_register_board_info.patch | 192 - .../pending-3.18/720-phy_adm6996.patch | 26 - .../pending-3.18/721-phy_packets.patch | 161 - .../pending-3.18/722-phy_mvswitch.patch | 23 - .../generic/pending-3.18/723-phy_ip175c.patch | 23 - .../generic/pending-3.18/724-phy_ar8216.patch | 24 - .../pending-3.18/725-phy_rtl8306.patch | 23 - .../pending-3.18/726-phy_rtl8366.patch | 45 - .../pending-3.18/727-phy-rtl8367.patch | 23 - .../pending-3.18/728-phy-rtl8367b.patch | 23 - .../generic/pending-3.18/729-phy-tantos.patch | 21 - .../generic/pending-3.18/730-phy_b53.patch | 60 - .../732-phy-ar8216-led-support.patch | 13 - .../pending-3.18/733-phy_mvsw61xx.patch | 23 - ...-at803x-allow-to-configure-via-pdata.patch | 180 - ...net-phy-at803x-fix-at8033-sgmii-mode.patch | 96 - .../760-8139cp-fixes-from-4.3.patch | 365 - .../773-bgmac-add-srab-switch.patch | 72 - .../785-hso-support-0af0-9300.patch | 25 - .../810-pci_disable_common_quirks.patch | 51 - .../811-pci_disable_usb_common_quirks.patch | 101 - .../pending-3.18/821-usb-dwc2-dualrole.patch | 146 - .../pending-3.18/834-ledtrig-libata.patch | 153 - .../generic/pending-3.18/840-rtc7301.patch | 250 - .../pending-3.18/841-rtc_pt7c4338.patch | 247 - .../861-04_spi_gpio_implement_spi_delay.patch | 58 - .../pending-3.18/862-gpio_spi_driver.patch | 373 - .../pending-3.18/870-hifn795x_byteswap.patch | 17 - .../890-8250_optional_sysrq.patch | 24 - .../pending-3.18/901-debloat_sock_diag.patch | 65 - .../pending-3.18/902-debloat_proc.patch | 342 - .../pending-3.18/904-debloat_dma_buf.patch | 44 - .../pending-3.18/910-kobject_uevent.patch | 21 - .../911-kobject_add_broadcast_uevent.patch | 65 - .../921-use_preinit_as_init.patch | 12 - ...ays-create-console-node-in-initramfs.patch | 30 - .../generic/pending-3.18/930-crashlog.patch | 276 - ...e-filenames-from-deps_initramfs-list.patch | 29 - .../980-arm_openwrt_machtypes.patch | 32 - .../generic/pending-3.18/990-gpio_wdt.patch | 360 - .../pending-3.18/995-mangle_bootargs.patch | 58 - .../997-device_tree_cmdline.patch | 24 - ...able_wilink_platform_without_drivers.patch | 15 - .../pending-3.18/999-seccomp_log.patch | 34 - ...f-ath79-Fix-perfcount-IRQ-assignment.patch | 110 + ...e_mem_map-with-ARCH_PFN_OFFSET-calcu.patch | 2 +- ...ge_allow_receiption_on_disabled_port.patch | 20 +- ...nefficient-copy-of-unaligned-buffers.patch | 6 +- .../pending-4.14/201-extra_optimization.patch | 8 +- .../203-kallsyms_uncompressed.patch | 8 +- .../pending-4.14/220-optimize_inlining.patch | 111 +- .../pending-4.14/305-mips_module_reloc.patch | 11 +- .../pending-4.14/308-mips32r2_tune.patch | 2 +- .../332-arc-add-OWRTDTB-section.patch | 66 +- ...ernel-XZ-compression-option-on-PPC_8.patch | 24 + .../530-jffs2_make_lzma_available.patch | 4 +- .../pending-4.14/630-packet_socket_type.patch | 8 +- ...w_table-add-hardware-offload-support.patch | 6 +- ...-support-hardware-flow-table-offload.patch | 4 +- .../pending-4.14/655-increase_skb_pad.patch | 2 +- ...Add-support-for-MAP-E-FMRs-mesh-mode.patch | 22 +- ...ng-with-source-address-failed-policy.patch | 14 +- ...T-skip-GRO-for-foreign-MAC-addresses.patch | 8 +- .../pending-4.14/701-phy_extension.patch | 95 - ...detach-callback-to-struct-phy_driver.patch | 2 +- .../810-pci_disable_common_quirks.patch | 6 +- .../811-pci_disable_usb_common_quirks.patch | 6 +- .../pending-4.14/834-ledtrig-libata.patch | 8 +- ...y-serial-exar-generalize-rs485-setup.patch | 76 - ...problem-with-platfom-data-in-w1-gpio.patch | 26 - ...s-negative-stack-offsets-on-stack-tr.patch | 57 - .../pending-4.19/110-ehci_hcd_ignore_oc.patch | 79 - ...e_mem_map-with-ARCH_PFN_OFFSET-calcu.patch | 82 - ...0-add-linux-spidev-compatible-si3210.patch | 18 - ..._value_cansleep-for-setting-chipsele.patch | 20 - ...ame2-and-add-RENAME_WHITEOUT-support.patch | 62 - ...41-jffs2-add-RENAME_EXCHANGE-support.patch | 73 - ...ge_allow_receiption_on_disabled_port.patch | 43 - ...et-phy-at803x-add-support-for-AT8032.patch | 63 - .../pending-4.19/201-extra_optimization.patch | 32 - .../203-kallsyms_uncompressed.patch | 119 - .../205-backtrace_module_info.patch | 45 - .../pending-4.19/220-optimize_inlining.patch | 70 - ...e-filenames-from-deps_initramfs-list.patch | 46 - ...able_wilink_platform_without_drivers.patch | 20 - .../300-mips_expose_boot_raw.patch | 40 - .../302-mips_no_branch_likely.patch | 22 - .../pending-4.19/304-mips_disable_fpu.patch | 137 - .../pending-4.19/305-mips_module_reloc.patch | 366 - .../306-mips_mem_functions_performance.patch | 106 - .../307-mips_highmem_offset.patch | 19 - .../pending-4.19/308-mips32r2_tune.patch | 22 - ...CPU-option-reporting-to-proc-cpuinfo.patch | 142 - .../310-arm_module_unresolved_weak_sym.patch | 22 - ...t-command-line-parameters-from-users.patch | 272 - .../332-arc-add-OWRTDTB-section.patch | 80 - ...able-unaligned-access-in-kernel-mode.patch | 24 - ...ove-no-op-dma_map_ops-where-possible.patch | 82 - .../400-mtd-add-rootfs-split-support.patch | 107 - ...for-different-partition-parser-types.patch | 142 - ...arsers-for-rootfs-and-firmware-split.patch | 44 - .../403-mtd-hook-mtdsplit-to-Kbuild.patch | 32 - .../404-mtd-add-more-helper-functions.patch | 76 - .../411-mtd-partial_eraseblock_write.patch | 132 - .../412-mtd-partial_eraseblock_unlock.patch | 40 - ...t-add-of_match_table-with-DT-binding.patch | 31 - .../pending-4.19/420-mtd-redboot_space.patch | 41 - ...30-mtd-add-myloader-partition-parser.patch | 47 - ...check-for-bad-blocks-when-calculatin.patch | 68 - ...bcm47xxpart-detect-T_Meter-partition.patch | 37 - .../pending-4.19/440-block2mtd_init.patch | 116 - .../pending-4.19/441-block2mtd_probe.patch | 47 - ...w-NOR-driver-to-write-fewer-bytes-th.patch | 36 - ...mtd-cfi_cmdset_0002-no-erase_suspend.patch | 25 - ...et_0002-add-buffer-write-cmd-timeout.patch | 17 - ...25p80-mx-disable-software-protection.patch | 18 - ...or-fix-Spansion-regressions-aliased-.patch | 37 - ...ort-limiting-4K-sectors-support-base.patch | 56 - ...pi-nor-Add-Winbond-w25q128jv-support.patch | 34 - .../476-mtd-spi-nor-add-eon-en25q128.patch | 18 - .../477-mtd-add-spi-nor-add-mx25u3235f.patch | 18 - .../479-mtd-spi-nor-add-eon-en25qh64.patch | 10 - .../480-mtd-set-rootfs-to-be-root-dev.patch | 38 - ...mtd-device-named-ubi-or-data-on-boot.patch | 97 - ...to-create-ubiblock-device-for-rootfs.patch | 66 - ...ting-ubi0-rootfs-in-init-do_mounts.c.patch | 51 - ...ROOT_DEV-to-ubiblock-rootfs-if-unset.patch | 34 - .../494-mtd-ubi-add-EOF-marker-support.patch | 60 - ...-mtd-core-add-get_mtd_device_by_node.patch | 75 - ...-add-bindings-for-mtd-concat-devices.patch | 52 - ...cat-add-dt-driver-for-concat-devices.patch | 216 - .../530-jffs2_make_lzma_available.patch | 5180 -------------- .../pending-4.19/532-jffs2_eofdetect.patch | 65 - ...fs-fix-default-compression-selection.patch | 37 - ...-to-create-UBI-FS-version-4-on-empty.patch | 63 - .../600-netfilter_conntrack_flush.patch | 88 - ...etfilter_match_bypass_default_checks.patch | 110 - ...netfilter_match_bypass_default_table.patch | 106 - ...netfilter_match_reduce_memory_access.patch | 22 - ...-netfilter_optional_tcp_window_check.patch | 44 - .../616-net_optimize_xfrm_calls.patch | 20 - ...del-do-not-defer-queue-length-update.patch | 86 - .../pending-4.19/630-packet_socket_type.patch | 138 - ...w_table-add-hardware-offload-support.patch | 564 -- ...w_table-support-hw-offload-through-v.patch | 303 - ...-support-hardware-flow-table-offload.patch | 60 - ...-support-hardware-flow-table-offload.patch | 61 - ...-support-hardware-flow-table-offload.patch | 125 - ...w_table-rework-hardware-offload-time.patch | 37 - ...low_table-rework-private-driver-data.patch | 25 - .../pending-4.19/655-increase_skb_pad.patch | 20 - ...Add-support-for-MAP-E-FMRs-mesh-mode.patch | 500 -- ...ng-with-source-address-failed-policy.patch | 247 - ...nes-for-_POLICY_FAILED-until-all-cod.patch | 50 - ...T-skip-GRO-for-foreign-MAC-addresses.patch | 152 - .../681-NET-add-of_get_mac_address_mtd.patch | 133 - .../pending-4.19/701-phy_extension.patch | 95 - ...detach-callback-to-struct-phy_driver.patch | 38 - ...-at803x-allow-to-configure-via-pdata.patch | 142 - ...net-phy-at803x-fix-at8033-sgmii-mode.patch | 51 - ...phy-at803x-allow-to-configure-via-dt.patch | 47 - ...ice-struct-copy-its-DMA-params-to-th.patch | 70 - .../810-pci_disable_common_quirks.patch | 62 - .../811-pci_disable_usb_common_quirks.patch | 115 - .../pending-4.19/834-ledtrig-libata.patch | 149 - .../pending-4.19/920-mangle_bootargs.patch | 71 - ...problem-with-platfom-data-in-w1-gpio.patch | 38 - ...fix-cache-flushing-for-highmem-pages.patch | 30 - .../pending-4.9/110-ehci_hcd_ignore_oc.patch | 79 - ...e_mem_map-with-ARCH_PFN_OFFSET-calcu.patch | 82 - ...0-add-linux-spidev-compatible-si3210.patch | 18 - ..._value_cansleep-for-setting-chipsele.patch | 20 - ...ame2-and-add-RENAME_WHITEOUT-support.patch | 62 - ...41-jffs2-add-RENAME_EXCHANGE-support.patch | 73 - ...ge_allow_receiption_on_disabled_port.patch | 43 - ...-generic-parsing-of-linux-part-probe.patch | 181 - ...ontrollers-before-the-specified-head.patch | 30 - ...et-phy-at803x-add-support-for-AT8032.patch | 70 - ...ng-comment-related-to-link-detection.patch | 43 - .../pending-4.9/201-extra_optimization.patch | 32 - .../203-kallsyms_uncompressed.patch | 119 - .../205-backtrace_module_info.patch | 45 - .../pending-4.9/220-optimize_inlining.patch | 70 - ...e-filenames-from-deps_initramfs-list.patch | 47 - ...able_wilink_platform_without_drivers.patch | 20 - .../300-mips_expose_boot_raw.patch | 40 - .../302-mips_no_branch_likely.patch | 22 - .../pending-4.9/304-mips_disable_fpu.patch | 137 - .../pending-4.9/305-mips_module_reloc.patch | 370 - .../306-mips_mem_functions_performance.patch | 106 - .../pending-4.9/307-mips_highmem_offset.patch | 19 - .../pending-4.9/308-mips32r2_tune.patch | 22 - ...CPU-option-reporting-to-proc-cpuinfo.patch | 134 - .../310-arm_module_unresolved_weak_sym.patch | 22 - ...t-command-line-parameters-from-users.patch | 269 - .../332-arc-add-OWRTDTB-section.patch | 80 - ...able-unaligned-access-in-kernel-mode.patch | 24 - ...IPS-mm-remove-mips_dma_mapping_error.patch | 32 - ...ove-no-op-dma_map_ops-where-possible.patch | 140 - .../400-mtd-add-rootfs-split-support.patch | 108 - ...for-different-partition-parser-types.patch | 142 - ...arsers-for-rootfs-and-firmware-split.patch | 44 - .../403-mtd-hook-mtdsplit-to-Kbuild.patch | 32 - .../404-mtd-add-more-helper-functions.patch | 76 - .../411-mtd-partial_eraseblock_write.patch | 154 - .../412-mtd-partial_eraseblock_unlock.patch | 40 - ...t-add-of_match_table-with-DT-binding.patch | 39 - .../pending-4.9/420-mtd-redboot_space.patch | 41 - ...30-mtd-add-myloader-partition-parser.patch | 47 - ...check-for-bad-blocks-when-calculatin.patch | 68 - ...bcm47xxpart-detect-T_Meter-partition.patch | 37 - .../pending-4.9/440-block2mtd_init.patch | 116 - .../pending-4.9/441-block2mtd_probe.patch | 47 - ...-fallback-from-spi_flash_read-to-reg.patch | 36 - ...mtd-cfi_cmdset_0002-no-erase_suspend.patch | 25 - ...et_0002-add-buffer-write-cmd-timeout.patch | 17 - ...25p80-mx-disable-software-protection.patch | 18 - ...or-fix-Spansion-regressions-aliased-.patch | 37 - ...ort-limiting-4K-sectors-support-base.patch | 56 - ...pi-nor-Add-Winbond-w25q128jv-support.patch | 34 - .../476-mtd-spi-nor-add-eon-en25q128.patch | 18 - .../477-mtd-add-spi-nor-add-mx25u3235f.patch | 18 - ...support-for-XM25QH64A-and-XM25QH128A.patch | 30 - .../479-mtd-spi-nor-add-eon-en25qh32.patch | 10 - .../480-mtd-set-rootfs-to-be-root-dev.patch | 38 - ...mtd-device-named-ubi-or-data-on-boot.patch | 97 - ...to-create-ubiblock-device-for-rootfs.patch | 66 - ...ting-ubi0-rootfs-in-init-do_mounts.c.patch | 51 - ...ROOT_DEV-to-ubiblock-rootfs-if-unset.patch | 34 - .../494-mtd-ubi-add-EOF-marker-support.patch | 60 - .../530-jffs2_make_lzma_available.patch | 5180 -------------- .../pending-4.9/532-jffs2_eofdetect.patch | 65 - ...fs-fix-default-compression-selection.patch | 37 - .../600-netfilter_conntrack_flush.patch | 95 - ...etfilter_match_bypass_default_checks.patch | 110 - ...netfilter_match_bypass_default_table.patch | 119 - ...netfilter_match_reduce_memory_access.patch | 22 - ...-netfilter_optional_tcp_window_check.patch | 44 - .../616-net_optimize_xfrm_calls.patch | 20 - ...del-do-not-defer-queue-length-update.patch | 86 - .../pending-4.9/630-packet_socket_type.patch | 138 - .../pending-4.9/655-increase_skb_pad.patch | 20 - ...Add-support-for-MAP-E-FMRs-mesh-mode.patch | 500 -- ...ng-with-source-address-failed-policy.patch | 255 - ...nes-for-_POLICY_FAILED-until-all-cod.patch | 50 - ...T-skip-GRO-for-foreign-MAC-addresses.patch | 154 - .../681-NET-add-of_get_mac_address_mtd.patch | 127 - .../pending-4.9/701-phy_extension.patch | 72 - ...detach-callback-to-struct-phy_driver.patch | 38 - ...-at803x-allow-to-configure-via-pdata.patch | 142 - ...net-phy-at803x-fix-at8033-sgmii-mode.patch | 51 - .../810-pci_disable_common_quirks.patch | 60 - .../811-pci_disable_usb_common_quirks.patch | 110 - ...ove-annoying-warning-about-bogus-URB.patch | 76 - .../pending-4.9/834-ledtrig-libata.patch | 149 - .../pending-4.9/890-uart_optional_sysrq.patch | 40 - .../pending-4.9/920-mangle_bootargs.patch | 71 - .../base-files/lib/preinit/79_move_config | 2 +- .../sunxi/base-files/lib/upgrade/platform.sh | 7 +- target/linux/sunxi/config-4.14 | 1 - target/linux/sunxi/config-4.19 | 1 - target/linux/sunxi/cortexa53/config-4.14 | 2 - target/linux/sunxi/cortexa53/config-4.19 | 2 - target/linux/sunxi/image/cortex-a7.mk | 10 + ...-sun8i-Handle-integrated-external-MD.patch | 14 +- ...stmmac-sun8i-Restore-the-compatibles.patch | 2 +- ...-sun8i-fix-allwinner-leds-active-low.patch | 2 +- ...ers-arch_timer-Workaround-for-Allwin.patch | 244 - ...nner-a64-Enable-A64-timer-workaround.patch | 26 - ...angepi_pc2_usb_otg_to_host_key_power.patch | 20 - ...un7i-Add-BCM53125-switch-nodes-to-th.patch | 88 - ...a64-sopine-Add-Sopine-flash-partitio.patch | 46 - target/linux/uml/config/x86_64 | 1 - target/linux/x86/64/config-4.14 | 1 + target/linux/x86/config-4.14 | 3 +- target/linux/x86/config-4.19 | 3 +- target/linux/x86/generic/config-4.14 | 1 + .../linux/x86/generic/profiles/000-Generic.mk | 3 +- target/linux/x86/geode/config-4.14 | 1 + target/linux/x86/legacy/config-4.14 | 1 + .../200-pcengines-apu2-reboot.patch | 2 +- .../patches-4.19/011-tune_lzma_options.patch | 22 - .../100-fix_cs5535_clockevt.patch | 12 - .../200-pcengines-apu2-reboot.patch | 19 - ...0-hwmon-w83627ehf-dont-claim-nct677x.patch | 30 - target/linux/xburst/Makefile | 25 - .../xburst/base-files/etc/board.d/01_system | 12 - .../linux/xburst/base-files/etc/config/fstab | 6 - .../xburst/base-files/etc/config/network | 13 - target/linux/xburst/config-3.18 | 346 - target/linux/xburst/image/Makefile | 46 - target/linux/xburst/image/ubinize.cfg | 14 - target/linux/xburst/modules.mk | 40 - ...e-vid-header-instead-of-the-whole-pa.patch | 20 - ...-Optimize-NAND_ECC_HW_OOB_FIRST-read.patch | 43 - ...-for-subpage-reads-for-NAND_ECC_HW_O.patch | 104 - ...y-activation-of-the-DAC-to-work-arou.patch | 33 - ...it-the-regulator-register-on-startup.patch | 55 - .../006-Add-ili8960-lcd-driver.patch | 309 - ...e-3-wire-spi-mode-for-the-display-fo.patch | 21 - target/linux/xburst/qi_lb60/config-default | 33 - target/linux/xburst/qi_lb60/target.mk | 1 - target/sdk/Makefile | 8 + toolchain/Config.in | 4 +- toolchain/binutils/Config.in | 8 +- toolchain/binutils/Config.version | 6 +- toolchain/binutils/Makefile | 54 +- .../2.32/300-012_check_ldrunpath_length.patch | 2 +- .../400-mips_no_dynamic_linking_sym.patch | 4 +- ...e-default-emulation-for-mips64-linux.patch | 4 +- toolchain/gcc/Config.in | 7 +- toolchain/gcc/Config.version | 6 +- toolchain/gcc/common.mk | 25 +- .../001-revert_register_mode_search.patch | 77 - .../002-case_insensitive.patch | 24 - .../010-documentation.patch | 35 - .../arc-2017.09-release/230-musl_libssp.patch | 28 - .../300-mips_Os_cpu_rtx_cost_model.patch | 21 - .../800-arm_v5te_no_ldrd_strd.patch | 32 - .../810-arm-softfloat-libgcc.patch | 33 - .../arc-2017.09-release/820-libgcc_pic.patch | 44 - .../840-armv4_pass_fix-v4bx_to_ld.patch | 28 - .../850-use_shared_libgcc.patch | 54 - .../851-libgcc_no_compat.patch | 22 - .../870-ppc_no_crtsavres.patch | 18 - .../881-no_tm_section.patch | 22 - .../900-bad-mips16-crt.patch | 30 - .../arc-2017.09-release/910-mbsd_multi.patch | 146 - .../920-specs_nonfatal_getenv.patch | 22 - .../930-fix-mips-noexecstack.patch | 111 - .../940-no-clobber-stamp-bits.patch | 33 - .../950-cpp_file_path_translation.patch | 181 - toolchain/glibc/common.mk | 4 +- toolchain/musl/common.mk | 8 +- ..._donot_return_address_from_undef_sym.patch | 136 + ...balance-in-corner-cases-of-i386-math.patch | 179 + ...ression-in-i386-asm-for-atan2-atan2f.patch | 28 + ...ribute-to-some-function-declarations.patch | 10 +- toolchain/nasm/Makefile | 4 +- ...rt-upstream-GCC8-compatibility-fixes.patch | 15 - tools/Makefile | 4 + tools/cbootimage-configs/Makefile | 32 + tools/cbootimage/Makefile | 31 + tools/ccache/Makefile | 7 +- tools/ccache/patches/100-honour-copts.patch | 2 +- ...-checks-Match-warnings-more-strictly.patch | 25 + tools/firmware-utils/Makefile | 3 +- tools/firmware-utils/src/jcgimage.c | 114 +- tools/firmware-utils/src/mkdlinkfw.c | 13 +- tools/firmware-utils/src/mksenaofw.c | 204 +- tools/firmware-utils/src/mktplinkfw2.c | 12 + tools/firmware-utils/src/nec-enc.c | 129 + tools/firmware-utils/src/tplink-safeloader.c | 73 +- tools/libelf/Makefile | 5 +- tools/make-ext4fs/Makefile | 2 +- tools/mkimage/Makefile | 4 +- tools/mtd-utils/Makefile | 6 +- tools/mtd-utils/patches/110-portability.patch | 22 +- .../201-ubinize-add-terminator-support.patch | 2 +- tools/patch/Makefile | 2 +- tools/patch/patches/050-CVE-2019-13636.patch | 108 + tools/patch/patches/060-CVE-2019-13638.patch | 38 + tools/scons/Makefile | 4 +- tools/tar/Makefile | 4 +- tools/wrt350nv2-builder/Makefile | 41 + tools/wrt350nv2-builder/src/crypt.h | 132 + tools/wrt350nv2-builder/src/ioapi.c | 177 + tools/wrt350nv2-builder/src/ioapi.h | 75 + tools/wrt350nv2-builder/src/md5.c | 381 ++ tools/wrt350nv2-builder/src/md5.h | 91 + tools/wrt350nv2-builder/src/upgrade.h | 77 + .../wrt350nv2-builder/src/wrt350nv2-builder.c | 1126 +++ tools/xz/Makefile | 5 +- 1475 files changed, 46634 insertions(+), 125205 deletions(-) delete mode 100644 README.md create mode 100755 package/base-files/files/etc/rc.button/reboot create mode 100644 package/base-files/files/lib/functions/migrations.sh create mode 100644 package/boot/uboot-sunxi/patches/063-fix-lime2-revK-add-micrel-PHY.patch delete mode 100644 package/boot/uboot-xburst/Makefile delete mode 100644 package/boot/uboot-xburst/patches/0001-qi_lb60-add-nand-spl-support.patch delete mode 100644 package/boot/uboot-xburst/patches/0002-qi_lb60-add-software-usbboot-support.patch delete mode 100644 package/boot/uboot-xburst/patches/0003-add-mmc-support.patch delete mode 100644 package/boot/uboot-xburst/patches/0004-add-more-boot-options-F1-F2-F3-F4-M-S.patch delete mode 100644 package/boot/uboot-xburst/patches/0005-add-nanonote-lcd-support.patch delete mode 100644 package/boot/uboot-xburst/patches/0006-enable-silent-console.patch delete mode 100644 package/devel/strace/patches/001-mips-o32-fix-build.patch create mode 100644 package/devel/valgrind/Makefile create mode 100644 package/devel/valgrind/files/default.supp create mode 100644 package/devel/valgrind/patches/100-fix_configure_check.patch create mode 100644 package/devel/valgrind/patches/130-fix_arm_arch_detection.patch create mode 100644 package/kernel/cryptodev-linux/Makefile create mode 100644 package/kernel/mac80211/patches/ath/558-ath9k-dynack-introduce-ath_dynack_set_timeout-routin.patch delete mode 100644 package/kernel/mac80211/patches/ath/558-ath9k-only-mask-use_eeprom-on-of-noeeprom.patch create mode 100644 package/kernel/mac80211/patches/ath/559-ath9k-dynack-properly-set-last-timeout-timestamp-in-.patch create mode 100644 package/kernel/mac80211/patches/ath/560-ath9k-dynack-set-max-timeout-according-to-channel-wi.patch create mode 100644 package/kernel/mac80211/patches/ath/561-ath9k-dynack-set-ackto-to-max-timeout-in-ath_dynack_.patch create mode 100644 package/kernel/mac80211/patches/rt2x00/020-cfg80211-add-ratelimited-variants-of-err-and-warn.patch delete mode 100644 package/kernel/mac80211/patches/rt2x00/020-rt2x00-do-not-print-error-when-queue-is-full.patch create mode 100644 package/kernel/mac80211/patches/rt2x00/021-rt2x00-use-ratelimited-variants-dev_warn-dev_err.patch create mode 100644 package/kernel/mac80211/patches/rt2x00/022-rt2x00-check-number-of-EPROTO-errors.patch create mode 100644 package/kernel/mac80211/patches/rt2x00/023-rt2x00-do-not-print-error-when-queue-is-full.patch rename package/kernel/mac80211/patches/rt2x00/{021-rt2800-partially-restore-old-mmio-txstatus-behaviour.patch => 024-rt2800-partially-restore-old-mmio-txstatus-behaviour.patch} (100%) rename package/kernel/mac80211/patches/rt2x00/{022-rt2800-new-flush-implementation-for-SoC-devices.patch => 025-rt2800-new-flush-implementation-for-SoC-devices.patch} (100%) rename package/kernel/mac80211/patches/rt2x00/{023-rt2800-move-txstatus-pending-routine.patch => 026-rt2800-move-txstatus-pending-routine.patch} (100%) delete mode 100644 package/kernel/mac80211/patches/rt2x00/026-rt2x00-remove-last_nostatus_check.patch rename package/kernel/mac80211/patches/rt2x00/{024-rt2800mmio-fetch-tx-status-changes.patch => 027-rt2800mmio-fetch-tx-status-changes.patch} (100%) rename package/kernel/mac80211/patches/rt2x00/{025-rt2800mmio-use-timer-and-work-for-handling-tx-status.patch => 028-rt2800mmio-use-timer-and-work-for-handling-tx-status.patch} (100%) create mode 100644 package/kernel/mac80211/patches/rt2x00/029-rt2x00-remove-last_nostatus_check.patch rename package/kernel/mac80211/patches/rt2x00/{027-rt2x00-remove-not-used-entry-field.patch => 030-rt2x00-remove-not-used-entry-field.patch} (100%) rename package/kernel/mac80211/patches/rt2x00/{028-rt2x00mmio-remove-legacy-comment.patch => 031-rt2x00mmio-remove-legacy-comment.patch} (100%) create mode 100644 package/kernel/mac80211/patches/rt2x00/050-rt2x00-add-RT3883-support.patch delete mode 100644 package/kernel/mac80211/patches/rt2x00/502-rt2x00-rt2800lib-enable-support-for-RT3883.patch delete mode 100644 package/kernel/mac80211/patches/rt2x00/503-rt2x00-rt2800lib-add-rf_vals-for-RF3853.patch delete mode 100644 package/kernel/mac80211/patches/rt2x00/504-rt2x00-rt2800lib-enable-VCO-calibration-for-RF3853.patch delete mode 100644 package/kernel/mac80211/patches/rt2x00/505-rt2x00-rt2800lib-add-channel-configuration-function-.patch delete mode 100644 package/kernel/mac80211/patches/rt2x00/506-rt2x00-rt2800lib-enable-RF3853-support.patch delete mode 100644 package/kernel/mac80211/patches/rt2x00/507-rt2x00-rt2800lib-add-MAC-register-initialization-for.patch delete mode 100644 package/kernel/mac80211/patches/rt2x00/508-rt2x00-rt2800soc-fix-rt2800soc_disable_radio-for-RT3.patch delete mode 100644 package/kernel/mac80211/patches/rt2x00/509-rt2x00-rt2800lib-add-BBP-register-initialization-for.patch delete mode 100644 package/kernel/mac80211/patches/rt2x00/510-rt2x00-rt2800lib-add-RFCSR-initialization-for-RT3883.patch delete mode 100644 package/kernel/mac80211/patches/rt2x00/511-rt2x00-rt2800lib-use-the-extended-EEPROM-map-for-RT3.patch delete mode 100644 package/kernel/mac80211/patches/rt2x00/512-rt2x00-rt2800lib-force-rf-type-to-RF3853-on-RT3883.patch delete mode 100644 package/kernel/mac80211/patches/rt2x00/513-rt2x00-rt2800lib-add-channel-configuration-code-for-.patch delete mode 100644 package/kernel/mac80211/patches/rt2x00/514-rt2x00-rt2800lib-fix-txpower_to_dev-function-for-RT3.patch delete mode 100644 package/kernel/mac80211/patches/rt2x00/515-rt2x00-rt2800lib-use-correct-txpower-calculation-fun.patch delete mode 100644 package/kernel/mac80211/patches/rt2x00/516-rt2x00-rt2800lib-hardcode-txmixer-gain-values-to-zer.patch delete mode 100644 package/kernel/mac80211/patches/rt2x00/517-rt2x00-rt2800lib-use-correct-RT-XWI-size-for-RT3883.patch delete mode 100644 package/kernel/mac80211/patches/rt2x00/518-rt2x00-rt2800lib-fix-antenna-configuration-for-RT388.patch delete mode 100644 package/kernel/mac80211/patches/rt2x00/519-rt2x00-rt2800lib-fix-LNA-gain-configuration-for-RT38.patch delete mode 100644 package/kernel/mac80211/patches/rt2x00/520-rt2x00-rt2800lib-fix-VGC-setup-for-RT3883.patch delete mode 100644 package/kernel/mac80211/patches/rt2x00/521-rt2x00-rt2800lib-fix-EEPROM-LNA-validation-for-RT388.patch delete mode 100644 package/kernel/mac80211/patches/rt2x00/522-rt2x00-rt2800lib-fix-txpower-compensation-for-RT3883.patch delete mode 100644 package/kernel/mac80211/patches/subsys/301-mac80211-do-not-call-driver-wake_tx_queue-op-during-.patch rename package/kernel/mac80211/patches/subsys/{359-mac80211-minstrel-Enable-STBC-and-LDPC-for-VHT-Rates.patch => 303-mac80211-minstrel-Enable-STBC-and-LDPC-for-VHT-Rates.patch} (100%) rename package/kernel/mac80211/patches/subsys/{370-mac80211-minstrel-remove-unnecessary-debugfs-cleanup.patch => 304-mac80211-minstrel-remove-unnecessary-debugfs-cleanup.patch} (100%) rename package/kernel/mac80211/patches/subsys/{371-mac80211-minstrel-merge-with-minstrel_ht-always-enab.patch => 305-mac80211-minstrel-merge-with-minstrel_ht-always-enab.patch} (100%) rename package/kernel/mac80211/patches/subsys/{372-mac80211-minstrel-reduce-minstrel_mcs_groups-size.patch => 306-mac80211-minstrel-reduce-minstrel_mcs_groups-size.patch} (100%) rename package/kernel/mac80211/patches/subsys/{373-mac80211-minstrel-fix-using-short-preamble-CCK-rates.patch => 307-mac80211-minstrel-fix-using-short-preamble-CCK-rates.patch} (100%) rename package/kernel/mac80211/patches/subsys/{375-mac80211-minstrel-fix-CCK-rate-group-streams-value.patch => 308-mac80211-minstrel-fix-CCK-rate-group-streams-value.patch} (100%) rename package/kernel/mac80211/patches/subsys/{376-mac80211-minstrel-fix-sampling-reporting-of-CCK-rate.patch => 309-mac80211-minstrel-fix-sampling-reporting-of-CCK-rate.patch} (100%) rename package/kernel/mac80211/patches/subsys/{377-mac80211-minstrel-do-not-sample-rates-3-times-slower.patch => 310-mac80211-minstrel-do-not-sample-rates-3-times-slower.patch} (100%) create mode 100644 package/kernel/mac80211/patches/subsys/312-mac80211-minstrel_ht-add-flag-to-indicate-missing-in.patch create mode 100644 package/kernel/mac80211/patches/subsys/313-mac80211-minstrel_ht-fix-per-group-max-throughput-ra.patch create mode 100644 package/kernel/mac80211/patches/subsys/314-mac80211-minstrel_ht-reduce-unnecessary-rate-probing.patch create mode 100644 package/kernel/mac80211/patches/subsys/315-mac80211-minstrel_ht-fix-default-max-throughput-rate.patch create mode 100644 package/kernel/mac80211/patches/subsys/316-mac80211-minstrel_ht-improve-rate-probing-for-device.patch create mode 100644 package/kernel/mac80211/patches/subsys/317-mac80211-minstrel_ht-fix-infinite-loop-because-suppo.patch create mode 100644 package/kernel/mac80211/patches/subsys/320-mac80211-Add-TXQ-scheduling-API.patch create mode 100644 package/kernel/mac80211/patches/subsys/321-cfg80211-Add-airtime-statistics-and-settings.patch create mode 100644 package/kernel/mac80211/patches/subsys/322-mac80211-Add-airtime-accounting-and-scheduling-to-TX.patch create mode 100644 package/kernel/mac80211/patches/subsys/323-mac80211-Expose-ieee80211_schedule_txq-function.patch create mode 100644 package/kernel/mac80211/patches/subsys/350-mac80211-add-hdrlen-to-ieee80211_tx_data.patch create mode 100644 package/kernel/mac80211/patches/subsys/351-mac80211-add-TX_NEEDS_ALIGNED4_SKBS-hw-flag.patch create mode 100644 package/kernel/mac80211/patches/subsys/352-mac80211-rework-locking-for-txq-scheduling-airtime-f.patch create mode 100644 package/kernel/mac80211/patches/subsys/353-mac80211-mesh-drop-redundant-rcu_read_lock-unlock-ca.patch create mode 100644 package/kernel/mac80211/patches/subsys/354-mac80211-calculate-hash-for-fq-without-holding-fq-lo.patch create mode 100644 package/kernel/mac80211/patches/subsys/355-mac80211-run-late-dequeue-late-tx-handlers-without-h.patch create mode 100644 package/kernel/mac80211/patches/subsys/356-mac80211-set-NETIF_F_LLTX-when-using-intermediate-tx.patch delete mode 100644 package/kernel/mac80211/patches/subsys/357-mac80211-add-hdrlen-to-ieee80211_tx_data.patch create mode 100644 package/kernel/mac80211/patches/subsys/357-mac80211-optimize-skb-resizing.patch delete mode 100644 package/kernel/mac80211/patches/subsys/358-mac80211-add-NEED_ALIGNED4_SKBS-hw-flag.patch create mode 100644 package/kernel/mac80211/patches/subsys/358-mac80211-make-ieee80211_schedule_txq-schedule-empty-.patch create mode 100644 package/kernel/mac80211/patches/subsys/359-mac80211-un-schedule-TXQs-on-powersave-start.patch create mode 100644 package/kernel/mac80211/patches/subsys/360-mac80211-when-using-iTXQ-select-the-queue-in-ieee802.patch create mode 100644 package/kernel/mac80211/patches/subsys/361-mac80211-add-IEEE80211_KEY_FLAG_GENERATE_MMIE-to-iee.patch delete mode 100644 package/kernel/mac80211/patches/subsys/378-mac80211-fix-memory-accounting-with-A-MSDU-aggregati.patch delete mode 100644 package/kernel/mac80211/patches/subsys/383-mac80211-minstrel_ht-add-flag-to-indicate-missing-in.patch delete mode 100644 package/kernel/mac80211/patches/subsys/390-nl-mac-80211-allow-4addr-AP-operation-on-crypto-cont.patch delete mode 100644 package/kernel/rotary-gpio-custom/Makefile delete mode 100644 package/kernel/rotary-gpio-custom/src/Kconfig delete mode 100644 package/kernel/rotary-gpio-custom/src/Makefile delete mode 100644 package/kernel/rotary-gpio-custom/src/rotary-gpio-custom.c create mode 100644 package/libs/elfutils/patches/200-uclibc-ng-compat.patch create mode 100644 package/libs/libbsd/patches/010-fix-arc.patch delete mode 100644 package/libs/libunwind/patches/001-disable-tests.patch create mode 100644 package/libs/openssl/patches/400-eng_devcrypto-save-ioctl-if-EVP_MD_.FLAG_ONESHOT.patch create mode 100644 package/libs/openssl/patches/410-eng_devcrypto-add-configuration-options.patch create mode 100644 package/libs/openssl/patches/420-eng_devcrypto-add-command-to-dump-driver-info.patch create mode 100644 package/libs/openssl/patches/430-e_devcrypto-make-the-dev-crypto-engine-dynamic.patch create mode 100644 package/libs/openssl/patches/500-e_devcrypto-default-to-not-use-digests-in-engine.patch create mode 100644 package/libs/openssl/patches/510-e_devcrypto-ignore-error-when-closing-session.patch create mode 100644 package/libs/uclibc++/patches/001-no-ansi.patch delete mode 100644 package/libs/uclibc++/patches/002-path_to_bash.patch create mode 100644 package/libs/uclibc++/patches/002-quote-fix.patch create mode 100644 package/libs/uclibc++/patches/003-no-fPIC.patch create mode 100644 package/libs/uclibc++/patches/004-no-pedantic.patch delete mode 100644 package/libs/uclibc++/patches/006-eabi_fix.patch delete mode 100644 package/libs/uclibc++/patches/010-honor-ldflags.patch delete mode 100644 package/libs/uclibc++/patches/020-template-fix.patch delete mode 100644 package/libs/uclibc++/patches/030-memory_corruption_fix.patch delete mode 100644 package/libs/uclibc++/patches/040-delete-c++14.patch delete mode 100644 package/libs/uclibc++/patches/050-Bugfix-erase-on-derived-__base_associative.patch delete mode 100644 package/libs/wolfssl/patches/400-additional_compatibility.patch delete mode 100644 package/libs/wolfssl/patches/900-remove-broken-autoconf-macros.patch create mode 100644 package/libs/zlib/patches/004-relative-pkg-config-paths.patch create mode 100644 package/network/config/xfrm/Makefile create mode 100755 package/network/config/xfrm/files/xfrm.sh create mode 100644 package/network/ipv6/thc-ipv6/Makefile create mode 100644 package/network/ipv6/thc-ipv6/patches/000-cflags_override.patch create mode 100644 package/network/ipv6/thc-ipv6/patches/100-no-ssl.patch delete mode 100644 package/network/services/dropbear/patches/010-runtime-maxauthtries.patch delete mode 100644 package/network/services/dropbear/patches/020-Wait-to-fail-invalid-usernames.patch delete mode 100644 package/network/services/dropbear/patches/120-openwrt_options.patch delete mode 100644 package/network/services/dropbear/patches/150-dbconvert_standalone.patch delete mode 100644 package/network/services/dropbear/patches/610-skip-default-keys-in-custom-runs.patch create mode 100644 package/network/services/dropbear/patches/900-configure-hardening.patch create mode 100644 package/network/services/dropbear/patches/901-bundled-libs-cflags.patch create mode 100644 package/network/services/ead/Makefile create mode 100644 package/network/services/ead/src/Makefile create mode 100644 package/network/services/ead/src/aes.c create mode 100644 package/network/services/ead/src/ead-client.c create mode 100644 package/network/services/ead/src/ead-crypt.c create mode 100644 package/network/services/ead/src/ead-crypt.h create mode 100644 package/network/services/ead/src/ead-pcap.h create mode 100644 package/network/services/ead/src/ead.c create mode 100644 package/network/services/ead/src/ead.h create mode 100644 package/network/services/ead/src/filter.c create mode 100644 package/network/services/ead/src/libbridge.h create mode 100644 package/network/services/ead/src/libbridge_init.c create mode 100644 package/network/services/ead/src/libbridge_private.h create mode 100644 package/network/services/ead/src/list.h create mode 100644 package/network/services/ead/src/passwd create mode 100644 package/network/services/ead/src/pfc.c create mode 100644 package/network/services/ead/src/pw_encrypt_md5.c create mode 100644 package/network/services/ead/src/sha1.c create mode 100644 package/network/services/ead/src/tinysrp/Makefile.am create mode 100644 package/network/services/ead/src/tinysrp/Makefile.in create mode 100644 package/network/services/ead/src/tinysrp/Notes create mode 100644 package/network/services/ead/src/tinysrp/acconfig.h create mode 100644 package/network/services/ead/src/tinysrp/acinclude.m4 create mode 100644 package/network/services/ead/src/tinysrp/aclocal.m4 create mode 100644 package/network/services/ead/src/tinysrp/bn.h create mode 100644 package/network/services/ead/src/tinysrp/bn_add.c create mode 100644 package/network/services/ead/src/tinysrp/bn_asm.c create mode 100644 package/network/services/ead/src/tinysrp/bn_ctx.c create mode 100644 package/network/services/ead/src/tinysrp/bn_div.c create mode 100644 package/network/services/ead/src/tinysrp/bn_exp.c create mode 100644 package/network/services/ead/src/tinysrp/bn_lcl.h create mode 100644 package/network/services/ead/src/tinysrp/bn_lib.c create mode 100644 package/network/services/ead/src/tinysrp/bn_mul.c create mode 100644 package/network/services/ead/src/tinysrp/bn_prime.h create mode 100644 package/network/services/ead/src/tinysrp/bn_shift.c create mode 100644 package/network/services/ead/src/tinysrp/bn_sqr.c create mode 100644 package/network/services/ead/src/tinysrp/bn_word.c create mode 100644 package/network/services/ead/src/tinysrp/clitest.c create mode 100644 package/network/services/ead/src/tinysrp/config.h.in create mode 100755 package/network/services/ead/src/tinysrp/configure create mode 100644 package/network/services/ead/src/tinysrp/configure.in create mode 100755 package/network/services/ead/src/tinysrp/install-sh create mode 100755 package/network/services/ead/src/tinysrp/missing create mode 100755 package/network/services/ead/src/tinysrp/mkinstalldirs create mode 100644 package/network/services/ead/src/tinysrp/srvtest.c create mode 100644 package/network/services/ead/src/tinysrp/stamp-h.in create mode 100644 package/network/services/ead/src/tinysrp/t_client.c create mode 100644 package/network/services/ead/src/tinysrp/t_client.h create mode 100644 package/network/services/ead/src/tinysrp/t_conf.c create mode 100644 package/network/services/ead/src/tinysrp/t_conv.c create mode 100644 package/network/services/ead/src/tinysrp/t_defines.h create mode 100644 package/network/services/ead/src/tinysrp/t_getconf.c create mode 100644 package/network/services/ead/src/tinysrp/t_getpass.c create mode 100644 package/network/services/ead/src/tinysrp/t_math.c create mode 100644 package/network/services/ead/src/tinysrp/t_misc.c create mode 100644 package/network/services/ead/src/tinysrp/t_pw.c create mode 100644 package/network/services/ead/src/tinysrp/t_pwd.h create mode 100644 package/network/services/ead/src/tinysrp/t_read.c create mode 100644 package/network/services/ead/src/tinysrp/t_read.h create mode 100644 package/network/services/ead/src/tinysrp/t_server.c create mode 100644 package/network/services/ead/src/tinysrp/t_server.h create mode 100644 package/network/services/ead/src/tinysrp/t_sha.c create mode 100644 package/network/services/ead/src/tinysrp/t_sha.h create mode 100644 package/network/services/ead/src/tinysrp/t_truerand.c create mode 100644 package/network/services/ead/src/tinysrp/tconf.c create mode 100644 package/network/services/ead/src/tinysrp/tinysrp.c create mode 100644 package/network/services/ead/src/tinysrp/tinysrp.h create mode 100644 package/network/services/ead/src/tinysrp/tpasswd create mode 100644 package/network/services/ead/src/tinysrp/tphrase.c create mode 100644 package/network/services/hostapd/patches/061-0001-OpenSSL-Use-constant-time-operations-for-private-big.patch create mode 100644 package/network/services/hostapd/patches/061-0002-Add-helper-functions-for-constant-time-operations.patch create mode 100644 package/network/services/hostapd/patches/061-0003-OpenSSL-Use-constant-time-selection-for-crypto_bignu.patch create mode 100644 package/network/services/hostapd/patches/061-0005-SAE-Minimize-timing-differences-in-PWE-derivation.patch create mode 100644 package/network/services/hostapd/patches/061-0006-SAE-Avoid-branches-in-is_quadratic_residue_blind.patch create mode 100644 package/network/services/hostapd/patches/061-0007-SAE-Mask-timing-of-MODP-groups-22-23-24.patch create mode 100644 package/network/services/hostapd/patches/061-0008-SAE-Use-const_time-selection-for-PWE-in-FFC.patch create mode 100644 package/network/services/hostapd/patches/061-0009-SAE-Use-constant-time-operations-in-sae_test_pwd_see.patch create mode 100644 package/network/services/hostapd/patches/062-0004-EAP-pwd-Use-constant-time-and-memory-access-for-find.patch create mode 100644 package/network/services/hostapd/patches/063-0010-SAE-Fix-confirm-message-validation-in-error-cases.patch create mode 100644 package/network/services/hostapd/patches/064-0011-EAP-pwd-server-Verify-received-scalar-and-element.patch create mode 100644 package/network/services/hostapd/patches/064-0012-EAP-pwd-server-Detect-reflection-attacks.patch create mode 100644 package/network/services/hostapd/patches/064-0013-EAP-pwd-client-Verify-received-scalar-and-element.patch create mode 100644 package/network/services/hostapd/patches/064-0014-EAP-pwd-Check-element-x-y-coordinates-explicitly.patch create mode 100644 package/network/services/lldpd/patches/001-disable_libcap.patch delete mode 100644 package/network/services/ppp/patches/520-uniq.patch create mode 100644 package/network/services/tinc/Makefile create mode 100644 package/network/services/tinc/files/tinc.config create mode 100644 package/network/services/tinc/files/tinc.init create mode 100644 package/network/services/tinc/files/tinc.upgrade create mode 100644 package/network/services/tinc/patches/010-Fix-compilation-when-OpenSSL-has-no-ENGINE-support.patch create mode 100644 package/network/services/tinc/patches/020-Fix-compilation-without-deprecated-OpenSSL-APIs.patch create mode 100644 package/network/services/tinyproxy/Makefile create mode 100644 package/network/services/tinyproxy/files/tinyproxy.config create mode 100644 package/network/services/tinyproxy/files/tinyproxy.init create mode 100644 package/network/services/tinyproxy/patches/010-no-docs-and-tests.patch create mode 100644 package/network/services/tinyproxy/patches/020-config_and_pid-path.patch create mode 100644 package/network/services/tinyproxy/patches/030-allow_bind_in_transparent_mode.patch create mode 100644 package/network/services/tinyproxy/patches/120-fix_INET6.patch create mode 100644 package/network/services/tinyproxy/patches/CVE-2012-3505-tiniproxy-randomized-hashmaps.patch create mode 100644 package/network/services/tinyproxy/patches/CVE-2012-3505-tinyproxy-limit-headers.patch create mode 100644 package/network/services/tor/Makefile create mode 100644 package/network/services/tor/files/tor.init create mode 100644 package/network/services/tor/patches/001-torrc.patch create mode 100644 package/network/services/torsocks/Makefile delete mode 100644 package/network/utils/curl/patches/310-mbedtls-disable-runtime-version-check.patch delete mode 100644 package/network/utils/iperf/patches/0001-fix-latent-bug-in-signal-handling-per-POSIX-calling-.patch delete mode 100644 package/network/utils/iperf/patches/0002-cleanup-main-startup-fix-daemon-mode-per-redirecting.patch delete mode 100644 package/network/utils/iproute2/patches/001-tc-fix-undefined-XATTR_SIZE_MAX.patch create mode 100644 package/network/utils/iproute2/patches/010-cake-fwmark.patch create mode 100644 package/network/utils/iproute2/patches/090-tc-add-support-for-action-act_ctinfo.patch create mode 100644 package/network/utils/iproute2/patches/135-sync-iptables-header.patch create mode 100644 package/network/utils/iproute2/patches/145-keep_libelf_optional.patch create mode 100644 package/network/utils/iproute2/patches/150-keep_libcap_optional.patch create mode 100644 package/network/utils/iproute2/patches/175-reduce-dynamic-syms.patch delete mode 100644 package/network/utils/iproute2/patches/190-link-libelf-to-tc-only.patch delete mode 100644 package/network/utils/iptables/patches/001-extensions_format-security_fixes_in_libip.patch delete mode 100644 package/network/utils/iptables/patches/002-include_fix_build_with_kernel_headers_before_4_2.patch delete mode 100644 package/network/utils/iptables/patches/003-ebtables-vlan-fix_userspace_kernel_headers_collision.patch create mode 100644 package/network/utils/linux-atm/patches/510-remove-LINUX_NETDEVICE-hack.patch create mode 100644 package/network/utils/nftables/patches/010-uclibc-ng.patch delete mode 100644 package/system/librecmc-keyring/Makefile delete mode 100644 package/system/mtd/src/linksys_bootcount_fix.c create mode 100644 package/system/urandom-seed/Makefile rename package/{base-files => system/urandom-seed}/files/etc/init.d/urandom_seed (100%) rename package/{base-files => system/urandom-seed}/files/lib/preinit/81_urandom_seed (100%) rename package/{base-files => system/urandom-seed}/files/sbin/urandom_seed (100%) create mode 100644 package/system/urngd/Makefile create mode 100644 package/system/urngd/files/urngd.init create mode 100644 package/utils/adb/patches/003-fix-musl-build.patch create mode 100644 package/utils/busybox/patches/530-ip-use-rtnl_send_check-on-flush-commands.patch delete mode 100644 package/utils/bzip2/patches/010-CVE-2016-3189.patch create mode 100644 package/utils/bzip2/patches/020-no-utime.patch create mode 100644 package/utils/lua/patches-host/013-lnum-strtoul-parsing-fixes.patch create mode 100644 package/utils/lua/patches/013-lnum-strtoul-parsing-fixes.patch create mode 100644 package/utils/mdadm/patches/102-Add-missing-include-file-sys-sysmacros.h.patch delete mode 100644 package/utils/mtd-utils/patches/200-Revert-Return-correct-error-number-in-ubi_get_vol_in.patch delete mode 100644 package/utils/spidev_test/src/spidev_test.c create mode 100644 package/utils/xfsprogs/patches/130-db-malloc-Use-posix_memalign-instead-of-deprecated-v.patch delete mode 100644 target/ccsdisk/Config.in delete mode 100644 target/ccsdisk/Makefile delete mode 100644 target/ccsdisk/files/README create mode 100644 target/linux/ar71xx/image/generic-ubnt.mk create mode 100644 target/linux/ath79/base-files/etc/hotplug.d/ieee80211/00-wifi-migration create mode 100644 target/linux/ath79/base-files/etc/uci-defaults/04_led_migration create mode 100644 target/linux/ath79/config-4.19 create mode 100644 target/linux/ath79/dts/ar7161_aruba_ap-105.dts create mode 100644 target/linux/ath79/dts/ar7161_jjplus_ja76pf2.dts delete mode 100644 target/linux/ath79/dts/ar7241_ubnt_nano-m.dts create mode 100644 target/linux/ath79/dts/ar7241_ubnt_nanostation-m.dts create mode 100644 target/linux/ath79/dts/ar9331_8dev_carambola2.dts delete mode 100644 target/linux/ath79/dts/ar9331_dptechnics_dpt-module.dts delete mode 100644 target/linux/ath79/dts/ar9331_dragino_ms14.dts delete mode 100644 target/linux/ath79/dts/ar9331_onion_omega.dts create mode 100644 target/linux/ath79/dts/ar9331_tplink_tl-wr710n-v1.dts create mode 100644 target/linux/ath79/dts/ar9342_ubnt_nanobeam-ac.dts create mode 100644 target/linux/ath79/dts/ar9342_ubnt_nanostation-m-xw.dts create mode 100644 target/linux/ath79/dts/ar9344_tplink_tl-wdr3600-v1.dts delete mode 100644 target/linux/ath79/dts/ar9344_tplink_tl-wdr3600.dts create mode 100644 target/linux/ath79/dts/ar9344_tplink_tl-wdr4300-v1.dts delete mode 100644 target/linux/ath79/dts/ar9344_tplink_tl-wdr4300.dts create mode 100644 target/linux/ath79/dts/ar9344_wd_mynet-n750.dts create mode 100644 target/linux/ath79/dts/ar9344_zbtlink_zbt-wd323.dts create mode 100644 target/linux/ath79/dts/qca9531_comfast_cf-e5.dts delete mode 100644 target/linux/ath79/dts/qca9531_engenius_ews511ap.dts create mode 100644 target/linux/ath79/dts/qca9531_glinet_gl-ar300m-lite.dts create mode 100644 target/linux/ath79/dts/qca9531_yuncore_a770.dts create mode 100644 target/linux/ath79/dts/qca9533_tplink_cpe210-v2.dts create mode 100644 target/linux/ath79/dts/qca9533_tplink_cpe210-v3.dts create mode 100644 target/linux/ath79/dts/qca9533_tplink_cpe210.dtsi create mode 100644 target/linux/ath79/dts/qca9533_tplink_tl-wr842n-v3.dts create mode 100644 target/linux/ath79/dts/qca9533_ubnt_acb-isp.dts delete mode 100644 target/linux/ath79/dts/qca9557_iodata_wn-ac1167dgr.dts delete mode 100644 target/linux/ath79/dts/qca9557_iodata_wn-ac1600dgr.dts delete mode 100644 target/linux/ath79/dts/qca9557_iodata_wn-ac1600dgr2.dts delete mode 100644 target/linux/ath79/dts/qca9558_devolo_dvl1200e.dts delete mode 100644 target/linux/ath79/dts/qca9558_devolo_dvl1200i.dts delete mode 100644 target/linux/ath79/dts/qca9558_devolo_dvl1750c.dts delete mode 100644 target/linux/ath79/dts/qca9558_devolo_dvl1750e.dts delete mode 100644 target/linux/ath79/dts/qca9558_devolo_dvl1750i.dts create mode 100644 target/linux/ath79/dts/qca9558_librerouter_librerouter-v1.dts create mode 100644 target/linux/ath79/dts/qca9558_netgear_ex6400.dts create mode 100644 target/linux/ath79/dts/qca9558_netgear_ex7300.dtsi delete mode 100644 target/linux/ath79/dts/qca9558_ocedo_koala.dts delete mode 100644 target/linux/ath79/dts/qca9558_openmesh_om5p-ac-v2.dts create mode 100644 target/linux/ath79/dts/qca9558_tplink_tl-wr941n-v7-cn.dts delete mode 100644 target/linux/ath79/dts/qca9561_tplink_archer-c58-v1.dts delete mode 100644 target/linux/ath79/dts/qca9561_tplink_archer-c59-v1.dts delete mode 100644 target/linux/ath79/dts/qca9563_dlink_dir-859-a1.dts delete mode 100644 target/linux/ath79/dts/qca9563_elecom_wrc-1750ghbk2-i.dts delete mode 100644 target/linux/ath79/dts/qca9563_nec_wg800hp.dts delete mode 100644 target/linux/ath79/dts/qca9563_phicomm_k2t.dts delete mode 100644 target/linux/ath79/dts/qca9563_tplink_archer-a7-v5.dts delete mode 100644 target/linux/ath79/dts/qca9563_tplink_archer-c2-v3.dts delete mode 100644 target/linux/ath79/dts/qca9563_tplink_archer-c6-v2.dts delete mode 100644 target/linux/ath79/dts/qca9563_tplink_archer-c7-v4.dts delete mode 100644 target/linux/ath79/dts/qca9563_tplink_archer-c7-v5.dts delete mode 100644 target/linux/ath79/dts/qca9563_tplink_re450-v2.dts create mode 100644 target/linux/ath79/dts/qca9563_tplink_tl-wr1043n-v5.dts delete mode 100644 target/linux/ath79/files/drivers/net/ethernet/atheros/ag71xx/ag71xx_ar7240.c create mode 100644 target/linux/ath79/image/generic-ubnt.mk create mode 100644 target/linux/ath79/patches-4.14/408-mtd-redboot_partition_scan.patch create mode 100644 target/linux/generic/backport-4.14/270-batman-adv-Let-packet.h-include-its-headers-directly.patch create mode 100644 target/linux/generic/backport-4.14/271-batman-adv-Remove-usage-of-BIT-x-in-packet.h.patch create mode 100644 target/linux/generic/backport-4.14/272-batman-adv-Remove-kernel-fixed-width-types-in-packet.patch create mode 100644 target/linux/generic/backport-4.14/273-batman-adv-Convert-packet.h-to-uapi-header.patch create mode 100644 target/linux/generic/backport-4.14/274-flow_dissector-Parse-batman-adv-unicast-headers.patch create mode 100644 target/linux/generic/backport-4.14/380-v5.3-net-sched-Introduce-act_ctinfo-action.patch create mode 100644 target/linux/generic/backport-4.14/401-v5.2-leds-trigger-netdev-fix-refcnt-leak-on-interface-ren.patch rename target/linux/generic/{pending-4.14/551-ubifs-fix-default-compression-selection.patch => backport-4.14/500-v4.20-ubifs-Fix-default-compression-selection-in-ubifs.patch} (100%) create mode 100644 target/linux/generic/backport-4.14/900-v4.18-firmware-dmi-Add-access-to-the-SKU-ID-string.patch create mode 100644 target/linux/generic/backport-4.14/950-tty-serial-exar-generalize-rs485-setup.patch delete mode 100644 target/linux/generic/backport-4.19/010-Kbuild-don-t-hardcode-path-to-awk-in-scripts-ld-vers.patch delete mode 100644 target/linux/generic/backport-4.19/011-kbuild-export-SUBARCH.patch delete mode 100644 target/linux/generic/backport-4.19/020-backport_netfilter_rtcache.patch delete mode 100644 target/linux/generic/backport-4.19/047-v4.21-mtd-keep-original-flags-for-every-struct-mtd_info.patch delete mode 100644 target/linux/generic/backport-4.19/048-v4.21-mtd-improve-calculating-partition-boundaries-when-ch.patch delete mode 100644 target/linux/generic/backport-4.19/080-v5.1-0001-bcma-keep-a-direct-pointer-to-the-struct-device.patch delete mode 100644 target/linux/generic/backport-4.19/080-v5.1-0002-bcma-use-dev_-printing-functions.patch delete mode 100644 target/linux/generic/backport-4.19/095-Allow-class-e-address-assignment-via-ifconfig-ioctl.patch delete mode 100644 target/linux/generic/backport-4.19/101-arm-cns3xxx-use-actual-size-reads-for-PCIe.patch delete mode 100644 target/linux/generic/backport-4.19/343-netfilter-nft_flow_offload-handle-netdevice-events-f.patch delete mode 100644 target/linux/generic/backport-4.19/366-netfilter-nf_flow_table-clean-up-and-fix-dst-handlin.patch delete mode 100644 target/linux/generic/backport-4.19/370-netfilter-nf_flow_table-fix-offloaded-connection-tim.patch delete mode 100644 target/linux/generic/backport-4.19/371-netfilter-nf_flow_table-fix-up-ct-state-of-flows-aft.patch delete mode 100644 target/linux/generic/backport-4.9/010-Kbuild-don-t-hardcode-path-to-awk-in-scripts-ld-vers.patch delete mode 100644 target/linux/generic/backport-4.9/011-kbuild-export-SUBARCH.patch delete mode 100644 target/linux/generic/backport-4.9/012-kbuild-add-macro-for-controlling-warnings-to-linux-c.patch delete mode 100644 target/linux/generic/backport-4.9/013-disable-Wattribute-alias-warning-for-SYSCALL_DEFINEx.patch delete mode 100644 target/linux/generic/backport-4.9/020-backport_netfilter_rtcache.patch delete mode 100644 target/linux/generic/backport-4.9/021-bridge-multicast-to-unicast.patch delete mode 100644 target/linux/generic/backport-4.9/022-net-add-devm-version-of-alloc_etherdev_mqs-function.patch delete mode 100644 target/linux/generic/backport-4.9/024-1-tcp-tsq-add-tsq_flags-tsq_enum.patch delete mode 100644 target/linux/generic/backport-4.9/024-2-tcp-tsq-remove-one-locked-operation-in-tcp_wfree.patch delete mode 100644 target/linux/generic/backport-4.9/024-3-tcp-tsq-add-shortcut-in-tcp_tasklet_func.patch delete mode 100644 target/linux/generic/backport-4.9/024-4-tcp-tsq-avoid-one-atomic-in-tcp_wfree.patch delete mode 100644 target/linux/generic/backport-4.9/024-5-tcp-tsq-add-a-shortcut-in-tcp_small_queue_check.patch delete mode 100644 target/linux/generic/backport-4.9/024-6-tcp-tcp_mtu_probe-is-likely-to-exit-early.patch delete mode 100644 target/linux/generic/backport-4.9/024-7-net-reorganize-struct-sock-for-better-data-locality.patch delete mode 100644 target/linux/generic/backport-4.9/024-8-tcp-tsq-move-tsq_flags-close-to-sk_wmem_alloc.patch delete mode 100644 target/linux/generic/backport-4.9/024-9-tcp-add-a-missing-barrier-in-tcp_tasklet_func.patch delete mode 100644 target/linux/generic/backport-4.9/025-tcp-allow-drivers-to-tweak-TSQ-logic.patch delete mode 100644 target/linux/generic/backport-4.9/030-01-ubifs-Drop-softlimit-and-delta-fields-from-struct-ub.patch delete mode 100644 target/linux/generic/backport-4.9/030-02-ubifs-Use-dirty_writeback_interval-value-for-wbuf-ti.patch delete mode 100644 target/linux/generic/backport-4.9/040-mm-add-support-for-releasing-multiple-instances-of-a.patch delete mode 100644 target/linux/generic/backport-4.9/041-mm-rename-__alloc_page_frag-to-page_frag_alloc-and-_.patch delete mode 100644 target/linux/generic/backport-4.9/042-mm-rename-__page_frag-functions-to-__page_frag_cache.patch delete mode 100644 target/linux/generic/backport-4.9/060-0002-mtd-bcm47xxsflash-use-platform_-set-get-_drvdata.patch delete mode 100644 target/linux/generic/backport-4.9/060-0003-mtd-bcm47xxsflash-support-reading-flash-out-of-mappi.patch delete mode 100644 target/linux/generic/backport-4.9/060-0004-mtd-bcm47xxpart-move-TRX-parsing-code-to-separated-f.patch delete mode 100644 target/linux/generic/backport-4.9/060-0005-mtd-bcm47xxpart-support-layouts-with-multiple-TRX-pa.patch delete mode 100644 target/linux/generic/backport-4.9/061-v4.10-0001-mtd-spi-nor-add-Macronix-mx25u25635f-to-list-of-know.patch delete mode 100644 target/linux/generic/backport-4.9/061-v4.10-0002-mtd-spi-nor-fix-spansion-quad-enable.patch delete mode 100644 target/linux/generic/backport-4.9/061-v4.10-0003-mtd-spi-nor-fix-flags-for-s25fl128s.patch delete mode 100644 target/linux/generic/backport-4.9/061-v4.10-0004-mtd-spi-nor-add-support-for-s25fl208k.patch delete mode 100644 target/linux/generic/backport-4.9/061-v4.10-0005-mtd-spi-nor-Add-at25df321-spi-nor-flash-support.patch delete mode 100644 target/linux/generic/backport-4.9/061-v4.10-0006-mtd-spi-nor-Add-support-for-N25Q016A.patch delete mode 100644 target/linux/generic/backport-4.9/061-v4.10-0007-mtd-spi-nor-Add-support-for-mr25h40.patch delete mode 100644 target/linux/generic/backport-4.9/062-v4.11-0001-mtd-spi-nor-Add-support-for-S3AN-spi-nor-devices.patch delete mode 100644 target/linux/generic/backport-4.9/062-v4.11-0002-mtd-spi-nor-improve-macronix_quad_enable.patch delete mode 100644 target/linux/generic/backport-4.9/062-v4.11-0003-mtd-spi-nor-remove-WARN_ONCE-message-in-spi_nor_writ.patch delete mode 100644 target/linux/generic/backport-4.9/062-v4.11-0004-mtd-spi-nor-rename-SPINOR_OP_-macros-of-the-4-byte-a.patch delete mode 100644 target/linux/generic/backport-4.9/062-v4.11-0005-mtd-spi-nor-add-a-stateless-method-to-support-memory.patch delete mode 100644 target/linux/generic/backport-4.9/062-v4.11-0006-mtd-spi-nor-Add-lock-unlock-support-for-f25l32pa.patch delete mode 100644 target/linux/generic/backport-4.9/062-v4.11-0007-mtd-spi-nor-Fix-S3AN-addressing-calculation.patch delete mode 100644 target/linux/generic/backport-4.9/062-v4.11-0008-mtd-spi-nor-Add-support-for-gd25q16.patch delete mode 100644 target/linux/generic/backport-4.9/063-v4.11-0001-mtd-nand-Add-Winbond-manufacturer-id.patch delete mode 100644 target/linux/generic/backport-4.9/063-v4.11-0002-mtd-introduce-function-max_bad_blocks.patch delete mode 100644 target/linux/generic/backport-4.9/063-v4.11-0003-mtd-Add-partition-device-node-to-mtd-partition-devic.patch delete mode 100644 target/linux/generic/backport-4.9/064-v4.12-mtd-spi-nor-enable-stateless-4b-op-codes-for-mx25u25.patch delete mode 100644 target/linux/generic/backport-4.9/065-v4.13-0001-mtd-handle-partitioning-on-devices-with-0-erasesize.patch delete mode 100644 target/linux/generic/backport-4.9/065-v4.13-0002-mtd-partitions-factor-out-code-calling-parser.patch delete mode 100644 target/linux/generic/backport-4.9/065-v4.13-0003-mtd-partitions-add-helper-for-deleting-partition.patch delete mode 100644 target/linux/generic/backport-4.9/065-v4.13-0004-mtd-partitions-remove-sysfs-files-when-deleting-all-.patch delete mode 100644 target/linux/generic/backport-4.9/065-v4.13-0005-mtd-partitions-rename-master-to-the-parent-where-app.patch delete mode 100644 target/linux/generic/backport-4.9/065-v4.13-0006-mtd-partitions-add-support-for-subpartitions.patch delete mode 100644 target/linux/generic/backport-4.9/065-v4.13-0007-mtd-partitions-add-support-for-partition-parsers.patch delete mode 100644 target/linux/generic/backport-4.9/065-v4.13-0008-mtd-extract-TRX-parser-out-of-bcm47xxpart-into-a-sep.patch delete mode 100644 target/linux/generic/backport-4.9/066-v4.17-0001-mtd-move-code-adding-master-MTD-out-of-mtd_add_devic.patch delete mode 100644 target/linux/generic/backport-4.9/066-v4.17-0002-mtd-get-rid-of-the-mtd_add_device_partitions.patch delete mode 100644 target/linux/generic/backport-4.9/067-v4.17-0001-mtd-partitions-add-of_match_table-parser-matching-fo.patch delete mode 100644 target/linux/generic/backport-4.9/067-v4.17-0002-mtd-rename-ofpart-parser-to-fixed-partitions-as-it-f.patch delete mode 100644 target/linux/generic/backport-4.9/067-v4.17-0003-mtd-ofpart-add-of_match_table-with-fixed-partitions.patch delete mode 100644 target/linux/generic/backport-4.9/068-v4.18-0001-mtd-move-code-adding-registering-partitions-to-the-p.patch delete mode 100644 target/linux/generic/backport-4.9/069-v4.18-mtd-bcm47xxpart-improve-handling-TRX-partition-size.patch delete mode 100644 target/linux/generic/backport-4.9/070-bcma-from-4.11.patch delete mode 100644 target/linux/generic/backport-4.9/071-v4.10-0001-net-bgmac-allocate-struct-bgmac-just-once-don-t-copy.patch delete mode 100644 target/linux/generic/backport-4.9/071-v4.10-0002-net-bgmac-drop-struct-bcma_mdio-we-don-t-need-anymor.patch delete mode 100644 target/linux/generic/backport-4.9/071-v4.10-0003-net-bgmac-use-PHY-subsystem-for-initializing-PHY.patch delete mode 100644 target/linux/generic/backport-4.9/071-v4.15-0001-net-bgmac-enable-master-mode-for-BCM54210E-and-B5021.patch delete mode 100644 target/linux/generic/backport-4.9/072-bcma-from-4.12.patch delete mode 100644 target/linux/generic/backport-4.9/075-v4.10-0001-net-phy-broadcom-Update-Auxiliary-Control-Register-m.patch delete mode 100644 target/linux/generic/backport-4.9/075-v4.10-0002-net-phy-broadcom-Add-support-for-BCM54612E.patch delete mode 100644 target/linux/generic/backport-4.9/075-v4.10-0003-net-phy-broadcom-add-bcm54xx_auxctl_read.patch delete mode 100644 target/linux/generic/backport-4.9/075-v4.10-0004-net-phy-broadcom-Add-BCM54810-PHY-entry.patch delete mode 100644 target/linux/generic/backport-4.9/075-v4.10-0005-net-phy-broadcom-Move-bcm54xx_auxctl_-read-write-to-.patch delete mode 100644 target/linux/generic/backport-4.9/076-v4.11-0001-net-phy-broadcom-Allow-enabling-or-disabling-of-EEE.patch delete mode 100644 target/linux/generic/backport-4.9/076-v4.11-0002-net-phy-broadcom-Add-support-code-for-reading-PHY-co.patch delete mode 100644 target/linux/generic/backport-4.9/076-v4.11-0003-net-phy-bcm7xxx-Add-entry-for-BCM7278.patch delete mode 100644 target/linux/generic/backport-4.9/076-v4.11-0004-net-phy-bcm7xxx-Implement-EGPHY-workaround-for-7278.patch delete mode 100644 target/linux/generic/backport-4.9/076-v4.11-0005-net-phy-broadcom-use-auxctl-reading-helper-in-BCM546.patch delete mode 100644 target/linux/generic/backport-4.9/076-v4.11-0006-net-phy-broadcom-add-support-for-BCM54210E.patch delete mode 100644 target/linux/generic/backport-4.9/076-v4.11-0007-net-phy-broadcom-rehook-BCM54612E-specific-init.patch delete mode 100644 target/linux/generic/backport-4.9/076-v4.15-0001-net-phy-broadcom-support-new-device-flag-for-setting.patch delete mode 100644 target/linux/generic/backport-4.9/080-0001-leds-core-add-OF-variants-of-LED-registering-functio.patch delete mode 100644 target/linux/generic/backport-4.9/080-0002-leds-gpio-use-OF-variant-of-LED-registering-function.patch delete mode 100644 target/linux/generic/backport-4.9/081-0001-thermal-bcm2835-add-thermal-driver-for-bcm2835-SoC.patch delete mode 100644 target/linux/generic/backport-4.9/081-0002-thermal-broadcom-add-Northstar-thermal-driver.patch delete mode 100644 target/linux/generic/backport-4.9/082-0001-usb-core-read-USB-ports-from-DT-in-the-usbport-LED-t.patch delete mode 100644 target/linux/generic/backport-4.9/085-v4.16-0001-i2c-gpio-Enable-working-over-slow-can_sleep-GPIOs.patch delete mode 100644 target/linux/generic/backport-4.9/087-regmap-make-LZO-cache-optional.patch delete mode 100644 target/linux/generic/backport-4.9/090-net-generalize-napi_complete_done.patch delete mode 100644 target/linux/generic/backport-4.9/094-v4.12-0001-ip6_tunnel-Fix-missing-tunnel-encapsulation-limit-op.patch delete mode 100644 target/linux/generic/backport-4.9/094-v4.12-0002-ipv6-Need-to-export-ipv6_push_frag_opts-for-tunnelin.patch delete mode 100644 target/linux/generic/backport-4.9/095-Allow-class-e-address-assignment-via-ifconfig-ioctl.patch delete mode 100644 target/linux/generic/backport-4.9/095-v4.13-0001-rtc-ds1307-add-ds1308-variant.patch delete mode 100644 target/linux/generic/backport-4.9/096-v4.20-netfilter-ipv6-Preserve-link-scope-traffic-original-.patch delete mode 100644 target/linux/generic/backport-4.9/101-arm-cns3xxx-use-actual-size-reads-for-PCIe.patch delete mode 100644 target/linux/generic/backport-4.9/400-v4.16-leds-trigger-Introduce-a-NETDEV-trigger.patch delete mode 100644 target/linux/generic/backport-4.9/400-v4.18-mtd-bcm47xxpart-add-of_match_table-with-a-new-DT-bin.patch delete mode 100644 target/linux/generic/backport-4.9/401-v4.19-mtd-parsers-trx-add-of_match_table-with-the-new-DT-b.patch delete mode 100644 target/linux/generic/backport-4.9/402-v4.19-mtd-partitions-use-DT-info-for-parsing-partitions-wi.patch delete mode 100644 target/linux/generic/config-3.18 delete mode 100644 target/linux/generic/config-4.19 delete mode 100644 target/linux/generic/config-4.9 delete mode 100644 target/linux/generic/hack-4.14/202-reduce_module_size.patch create mode 100644 target/linux/generic/hack-4.14/400-mt29f_spinand-fix-memleak.patch delete mode 100644 target/linux/generic/hack-4.19/202-reduce_module_size.patch delete mode 100644 target/linux/generic/hack-4.19/204-module_strip.patch delete mode 100644 target/linux/generic/hack-4.19/207-disable-modorder.patch delete mode 100644 target/linux/generic/hack-4.19/210-darwin_scripts_include.patch delete mode 100644 target/linux/generic/hack-4.19/211-host_tools_portability.patch delete mode 100644 target/linux/generic/hack-4.19/212-byteshift_portability.patch delete mode 100644 target/linux/generic/hack-4.19/214-spidev_h_portability.patch delete mode 100644 target/linux/generic/hack-4.19/220-gc_sections.patch delete mode 100644 target/linux/generic/hack-4.19/221-module_exports.patch delete mode 100644 target/linux/generic/hack-4.19/230-openwrt_lzma_options.patch delete mode 100644 target/linux/generic/hack-4.19/250-netfilter_depends.patch delete mode 100644 target/linux/generic/hack-4.19/251-sound_kconfig.patch delete mode 100644 target/linux/generic/hack-4.19/259-regmap_dynamic.patch delete mode 100644 target/linux/generic/hack-4.19/260-crypto_test_dependencies.patch delete mode 100644 target/linux/generic/hack-4.19/280-rfkill-stubs.patch delete mode 100644 target/linux/generic/hack-4.19/290-nvmem-make-CONFIG_NVMEM-tristate-again.patch delete mode 100644 target/linux/generic/hack-4.19/300-MIPS-r4k_cache-use-more-efficient-cache-blast.patch delete mode 100644 target/linux/generic/hack-4.19/301-mips_image_cmdline_hack.patch delete mode 100644 target/linux/generic/hack-4.19/321-powerpc_crtsavres_prereq.patch delete mode 100644 target/linux/generic/hack-4.19/531-debloat_lzma.patch delete mode 100644 target/linux/generic/hack-4.19/640-bridge-only-accept-EAP-locally.patch delete mode 100644 target/linux/generic/hack-4.19/647-netfilter-flow-acct.patch delete mode 100644 target/linux/generic/hack-4.19/650-netfilter-add-xt_OFFLOAD-target.patch delete mode 100644 target/linux/generic/hack-4.19/651-wireless_mesh_header.patch delete mode 100644 target/linux/generic/hack-4.19/660-fq_codel_defaults.patch delete mode 100644 target/linux/generic/hack-4.19/661-use_fq_codel_by_default.patch delete mode 100644 target/linux/generic/hack-4.19/662-remove_pfifo_fast.patch delete mode 100644 target/linux/generic/hack-4.19/700-swconfig_switch_drivers.patch delete mode 100644 target/linux/generic/hack-4.19/702-phy_add_aneg_done_function.patch delete mode 100644 target/linux/generic/hack-4.19/721-phy_packets.patch delete mode 100644 target/linux/generic/hack-4.19/773-bgmac-add-srab-switch.patch delete mode 100644 target/linux/generic/hack-4.19/835-misc-owl_loader.patch delete mode 100644 target/linux/generic/hack-4.19/901-debloat_sock_diag.patch delete mode 100644 target/linux/generic/hack-4.19/902-debloat_proc.patch delete mode 100644 target/linux/generic/hack-4.19/904-debloat_dma_buf.patch delete mode 100644 target/linux/generic/hack-4.19/910-kobject_uevent.patch delete mode 100644 target/linux/generic/hack-4.19/911-kobject_add_broadcast_uevent.patch delete mode 100644 target/linux/generic/hack-4.19/921-always-create-console-node-in-initramfs.patch delete mode 100644 target/linux/generic/hack-4.19/930-crashlog.patch delete mode 100644 target/linux/generic/hack-4.19/940-cleanup-offload-hooks-on-netdev-unregister.patch delete mode 100644 target/linux/generic/hack-4.9/202-reduce_module_size.patch delete mode 100644 target/linux/generic/hack-4.9/204-module_strip.patch delete mode 100644 target/linux/generic/hack-4.9/207-disable-modorder.patch delete mode 100644 target/linux/generic/hack-4.9/210-darwin_scripts_include.patch delete mode 100644 target/linux/generic/hack-4.9/211-host_tools_portability.patch delete mode 100644 target/linux/generic/hack-4.9/212-byteshift_portability.patch delete mode 100644 target/linux/generic/hack-4.9/214-spidev_h_portability.patch delete mode 100644 target/linux/generic/hack-4.9/220-gc_sections.patch delete mode 100644 target/linux/generic/hack-4.9/221-module_exports.patch delete mode 100644 target/linux/generic/hack-4.9/230-openwrt_lzma_options.patch delete mode 100644 target/linux/generic/hack-4.9/250-netfilter_depends.patch delete mode 100644 target/linux/generic/hack-4.9/251-sound_kconfig.patch delete mode 100644 target/linux/generic/hack-4.9/259-regmap_dynamic.patch delete mode 100644 target/linux/generic/hack-4.9/260-crypto_test_dependencies.patch delete mode 100644 target/linux/generic/hack-4.9/280-rfkill-stubs.patch delete mode 100644 target/linux/generic/hack-4.9/300-MIPS-r4k_cache-use-more-efficient-cache-blast.patch delete mode 100644 target/linux/generic/hack-4.9/301-mips_image_cmdline_hack.patch delete mode 100644 target/linux/generic/hack-4.9/321-powerpc_crtsavres_prereq.patch delete mode 100644 target/linux/generic/hack-4.9/531-debloat_lzma.patch delete mode 100644 target/linux/generic/hack-4.9/640-bridge-only-accept-EAP-locally.patch delete mode 100644 target/linux/generic/hack-4.9/641-bridge_port_isolate.patch delete mode 100644 target/linux/generic/hack-4.9/651-wireless_mesh_header.patch delete mode 100644 target/linux/generic/hack-4.9/660-fq_codel_defaults.patch delete mode 100644 target/linux/generic/hack-4.9/661-use_fq_codel_by_default.patch delete mode 100644 target/linux/generic/hack-4.9/662-remove_pfifo_fast.patch delete mode 100644 target/linux/generic/hack-4.9/700-swconfig_switch_drivers.patch delete mode 100644 target/linux/generic/hack-4.9/702-phy_add_aneg_done_function.patch delete mode 100644 target/linux/generic/hack-4.9/710-phy-add-mdio_register_board_info.patch delete mode 100644 target/linux/generic/hack-4.9/721-phy_packets.patch delete mode 100644 target/linux/generic/hack-4.9/773-bgmac-add-srab-switch.patch delete mode 100644 target/linux/generic/hack-4.9/835-misc-owl_loader.patch delete mode 100644 target/linux/generic/hack-4.9/901-debloat_sock_diag.patch delete mode 100644 target/linux/generic/hack-4.9/902-debloat_proc.patch delete mode 100644 target/linux/generic/hack-4.9/904-debloat_dma_buf.patch delete mode 100644 target/linux/generic/hack-4.9/910-kobject_uevent.patch delete mode 100644 target/linux/generic/hack-4.9/911-kobject_add_broadcast_uevent.patch delete mode 100644 target/linux/generic/hack-4.9/921-always-create-console-node-in-initramfs.patch delete mode 100644 target/linux/generic/hack-4.9/930-crashlog.patch delete mode 100644 target/linux/generic/pending-3.18/001-mtdsplit_backport.patch delete mode 100644 target/linux/generic/pending-3.18/002-phy_drivers_backport.patch delete mode 100644 target/linux/generic/pending-3.18/003-myloader_backport.patch delete mode 100644 target/linux/generic/pending-3.18/020-ssb_update.patch delete mode 100644 target/linux/generic/pending-3.18/021-ssb_sprom.patch delete mode 100644 target/linux/generic/pending-3.18/025-bcma_backport.patch delete mode 100644 target/linux/generic/pending-3.18/026-bcma-from-3.20.patch delete mode 100644 target/linux/generic/pending-3.18/027-bcma-from-4.1.patch delete mode 100644 target/linux/generic/pending-3.18/028-bcma-from-4.2.patch delete mode 100644 target/linux/generic/pending-3.18/029-bcma-from-4.4.patch delete mode 100644 target/linux/generic/pending-3.18/030-backport_bcm47xx_nvram.patch delete mode 100644 target/linux/generic/pending-3.18/030-nl80211-Allow-set-network-namespace-by-fd.patch delete mode 100644 target/linux/generic/pending-3.18/031-bcma-from-4.5.patch delete mode 100644 target/linux/generic/pending-3.18/032-bcma-from-4.6.patch delete mode 100644 target/linux/generic/pending-3.18/040-mtd-bcm47xxpart-backports-from-3.19.patch delete mode 100644 target/linux/generic/pending-3.18/041-mtd-bcm47xxpart-backports-from-3.20.patch delete mode 100644 target/linux/generic/pending-3.18/043-mtd_GD25Q128B_support_backport_from_3.19.patch delete mode 100644 target/linux/generic/pending-3.18/044-backport-m25p80-jedec-probe.patch delete mode 100644 target/linux/generic/pending-3.18/050-backport_netfilter_rtcache.patch delete mode 100644 target/linux/generic/pending-3.18/051-02-bridge-allow-setting-hash_max-multicast_router-if-in.patch delete mode 100644 target/linux/generic/pending-3.18/060-mips_decompressor_memmove.patch delete mode 100644 target/linux/generic/pending-3.18/070-bgmac-register-napi-before-the-device.patch delete mode 100644 target/linux/generic/pending-3.18/071-bgmac-activate-irqs-only-if-there-is-nothing-to-poll.patch delete mode 100644 target/linux/generic/pending-3.18/073-bgmac-Clean-warning-messages.patch delete mode 100644 target/linux/generic/pending-3.18/074-bgmac-register-fixed-PHY-for-ARM-BCM470X-BCM5301X-ch.patch delete mode 100644 target/linux/generic/pending-3.18/075-bgmac-allow-enabling-on-ARCH_BCM_5301X.patch delete mode 100644 target/linux/generic/pending-3.18/076-net-phy-export-fixed_phy_register.patch delete mode 100644 target/linux/generic/pending-3.18/077-01-bgmac-fix-descriptor-frame-start-end-definitions.patch delete mode 100644 target/linux/generic/pending-3.18/077-02-bgmac-implement-GRO-and-use-build_skb.patch delete mode 100644 target/linux/generic/pending-3.18/077-03-bgmac-implement-scatter-gather-support.patch delete mode 100644 target/linux/generic/pending-3.18/077-04-bgmac-simplify-tx-ring-index-handling.patch delete mode 100644 target/linux/generic/pending-3.18/077-05-bgmac-leave-interrupts-disabled-as-long-as-there-is-.patch delete mode 100644 target/linux/generic/pending-3.18/077-06-bgmac-set-received-skb-headroom-to-NET_SKB_PAD.patch delete mode 100644 target/linux/generic/pending-3.18/077-07-bgmac-simplify-rx-DMA-error-handling.patch delete mode 100644 target/linux/generic/pending-3.18/077-08-bgmac-add-check-for-oversized-packets.patch delete mode 100644 target/linux/generic/pending-3.18/077-09-bgmac-increase-rx-ring-size-from-511-to-512.patch delete mode 100644 target/linux/generic/pending-3.18/077-10-bgmac-simplify-dma-init-cleanup.patch delete mode 100644 target/linux/generic/pending-3.18/077-11-bgmac-fix-DMA-rx-corruption.patch delete mode 100644 target/linux/generic/pending-3.18/077-12-bgmac-drop-ring-num_slots.patch delete mode 100644 target/linux/generic/pending-3.18/078-bgmac-reset-enable-Ethernet-core-before-using-it.patch delete mode 100644 target/linux/generic/pending-3.18/079-bgmac-fix-MAC-soft-reset-bit-for-corerev-4.patch delete mode 100644 target/linux/generic/pending-3.18/080-00-fib_trie-Fix-proc-net-fib_trie-when-CONFIG_IP_MULTIP.patch delete mode 100644 target/linux/generic/pending-3.18/080-01-fib_trie-Fix-trie-balancing-issue-if-new-node-pushes.patch delete mode 100644 target/linux/generic/pending-3.18/080-02-fib_trie-Update-usage-stats-to-be-percpu-instead-of-.patch delete mode 100644 target/linux/generic/pending-3.18/080-03-fib_trie-Make-leaf-and-tnode-more-uniform.patch delete mode 100644 target/linux/generic/pending-3.18/080-04-fib_trie-Merge-tnode_free-and-leaf_free-into-node_fr.patch delete mode 100644 target/linux/generic/pending-3.18/080-05-fib_trie-Merge-leaf-into-tnode.patch delete mode 100644 target/linux/generic/pending-3.18/080-06-fib_trie-Optimize-fib_table_lookup-to-avoid-wasting-.patch delete mode 100644 target/linux/generic/pending-3.18/080-07-fib_trie-Optimize-fib_find_node.patch delete mode 100644 target/linux/generic/pending-3.18/080-08-fib_trie-Optimize-fib_table_insert.patch delete mode 100644 target/linux/generic/pending-3.18/080-09-fib_trie-Update-meaning-of-pos-to-represent-unchecke.patch delete mode 100644 target/linux/generic/pending-3.18/080-10-fib_trie-Use-unsigned-long-for-anything-dealing-with.patch delete mode 100644 target/linux/generic/pending-3.18/080-11-fib_trie-Push-rcu_read_lock-unlock-to-callers.patch delete mode 100644 target/linux/generic/pending-3.18/080-12-fib_trie-Move-resize-to-after-inflate-halve.patch delete mode 100644 target/linux/generic/pending-3.18/080-13-fib_trie-Add-functions-should_inflate-and-should_hal.patch delete mode 100644 target/linux/generic/pending-3.18/080-14-fib_trie-Push-assignment-of-child-to-parent-down-int.patch delete mode 100644 target/linux/generic/pending-3.18/080-15-fib_trie-Push-tnode-flushing-down-to-inflate-halve.patch delete mode 100644 target/linux/generic/pending-3.18/080-16-fib_trie-inflate-halve-nodes-in-a-more-RCU-friendly-.patch delete mode 100644 target/linux/generic/pending-3.18/080-17-fib_trie-Remove-checks-for-index-tnode_child_length-.patch delete mode 100644 target/linux/generic/pending-3.18/080-18-fib_trie-Add-tracking-value-for-suffix-length.patch delete mode 100644 target/linux/generic/pending-3.18/080-19-fib_trie-Use-index-0ul-n-bits-instead-of-index-n-bit.patch delete mode 100644 target/linux/generic/pending-3.18/080-20-fib_trie-Fix-RCU-bug-and-merge-similar-bits-of-infla.patch delete mode 100644 target/linux/generic/pending-3.18/080-21-fib_trie-Fall-back-to-slen-update-on-inflate-halve-f.patch delete mode 100644 target/linux/generic/pending-3.18/080-22-fib_trie-Add-collapse-and-should_collapse-to-resize.patch delete mode 100644 target/linux/generic/pending-3.18/080-23-fib_trie-Use-empty_children-instead-of-counting-empt.patch delete mode 100644 target/linux/generic/pending-3.18/080-24-fib_trie-Move-fib_find_alias-to-file-where-it-is-use.patch delete mode 100644 target/linux/generic/pending-3.18/080-25-fib_trie-Various-clean-ups-for-handling-slen.patch delete mode 100644 target/linux/generic/pending-3.18/081-01-pppoe-Use-workqueue-to-die-properly-when-a-PADT-is-r.patch delete mode 100644 target/linux/generic/pending-3.18/081-02-pppoe-Lacks-DST-MAC-address-check.patch delete mode 100644 target/linux/generic/pending-3.18/081-03-pppoe-drop-pppoe-device-in-pppoe_unbind_sock_work.patch delete mode 100644 target/linux/generic/pending-3.18/081-06-ppp-don-t-set-sk_state-to-PPPOX_ZOMBIE-in-pppoe_disc.patch delete mode 100644 target/linux/generic/pending-3.18/081-07-ppp-remove-PPPOX_ZOMBIE-socket-state.patch delete mode 100644 target/linux/generic/pending-3.18/081-08-pppoe-fix-memory-corruption-in-padt-work-structure.patch delete mode 100644 target/linux/generic/pending-3.18/082-ipv6-ip6_fragment-fix-headroom-tests-and-skb-leak.patch delete mode 100644 target/linux/generic/pending-3.18/083-solos-pci-Increase-headroom-on-received-packets.patch delete mode 100644 target/linux/generic/pending-3.18/087-regmap-make-LZO-cache-optional.patch delete mode 100644 target/linux/generic/pending-3.18/090-overlayfs-fallback-to-readonly-when-full.patch delete mode 100644 target/linux/generic/pending-3.18/091-mtd-spi-nor-add-support-Spansion_S25FL164K.patch delete mode 100644 target/linux/generic/pending-3.18/092-01-spi-Check-to-see-if-the-device-is-processing-a-messa.patch delete mode 100644 target/linux/generic/pending-3.18/092-02-spi-Pump-transfers-inside-calling-context-for-spi_sy.patch delete mode 100644 target/linux/generic/pending-3.18/092-03-spi-Only-idle-the-message-pump-in-the-worker-kthread.patch delete mode 100644 target/linux/generic/pending-3.18/095-api-fix-compatibility-of-linux-in.h-with-netinet-in..patch delete mode 100644 target/linux/generic/pending-3.18/099-module_arch_freeing_init-new-hook-for-archs-before-m.patch delete mode 100644 target/linux/generic/pending-3.18/102-ehci_hcd_ignore_oc.patch delete mode 100644 target/linux/generic/pending-3.18/110-jffs2-use-.rename2-and-add-RENAME_WHITEOUT-support.patch delete mode 100644 target/linux/generic/pending-3.18/111-jffs2-add-RENAME_EXCHANGE-support.patch delete mode 100644 target/linux/generic/pending-3.18/120-bridge_allow_receiption_on_disabled_port.patch delete mode 100644 target/linux/generic/pending-3.18/132-mips_inline_dma_ops.patch delete mode 100644 target/linux/generic/pending-3.18/140-mtd-part-add-generic-parsing-of-linux-part-probe.patch delete mode 100644 target/linux/generic/pending-3.18/142-mtd-bcm47xxpart-don-t-fail-because-of-bit-flips.patch delete mode 100644 target/linux/generic/pending-3.18/180-usb-xhci-make-USB_XHCI_PLATFORM-selectable.patch delete mode 100644 target/linux/generic/pending-3.18/190-cdc_ncm_add_support_for_moving_ndp_to_end_of_ncm_frame.patch delete mode 100644 target/linux/generic/pending-3.18/192-USB-qcserial-Add-support-for-Quectel-EC20-Mini-PCIe-.patch delete mode 100644 target/linux/generic/pending-3.18/193-USB-qmi_wwan-Add-quirk-for-Quectel-EC20-Mini-PCIe-mo.patch delete mode 100644 target/linux/generic/pending-3.18/200-fix_localversion.patch delete mode 100644 target/linux/generic/pending-3.18/201-extra_optimization.patch delete mode 100644 target/linux/generic/pending-3.18/202-reduce_module_size.patch delete mode 100644 target/linux/generic/pending-3.18/203-kallsyms_uncompressed.patch delete mode 100644 target/linux/generic/pending-3.18/204-module_strip.patch delete mode 100644 target/linux/generic/pending-3.18/205-backtrace_module_info.patch delete mode 100644 target/linux/generic/pending-3.18/210-darwin_scripts_include.patch delete mode 100644 target/linux/generic/pending-3.18/212-byteshift_portability.patch delete mode 100644 target/linux/generic/pending-3.18/213-x86_vdso_portability.patch delete mode 100644 target/linux/generic/pending-3.18/214-spidev_h_portability.patch delete mode 100644 target/linux/generic/pending-3.18/220-gc_sections.patch delete mode 100644 target/linux/generic/pending-3.18/221-module_exports.patch delete mode 100644 target/linux/generic/pending-3.18/230-openwrt_lzma_options.patch delete mode 100644 target/linux/generic/pending-3.18/250-netfilter_depends.patch delete mode 100644 target/linux/generic/pending-3.18/251-sound_kconfig.patch delete mode 100644 target/linux/generic/pending-3.18/252-mv_cesa_depends.patch delete mode 100644 target/linux/generic/pending-3.18/253-ssb_b43_default_on.patch delete mode 100644 target/linux/generic/pending-3.18/254-textsearch_kconfig_hacks.patch delete mode 100644 target/linux/generic/pending-3.18/255-lib80211_kconfig_hacks.patch delete mode 100644 target/linux/generic/pending-3.18/256-crypto_add_kconfig_prompts.patch delete mode 100644 target/linux/generic/pending-3.18/257-wireless_ext_kconfig_hack.patch delete mode 100644 target/linux/generic/pending-3.18/258-netfilter_netlink_kconfig_hack.patch delete mode 100644 target/linux/generic/pending-3.18/259-regmap_dynamic.patch delete mode 100644 target/linux/generic/pending-3.18/260-crypto_test_dependencies.patch delete mode 100644 target/linux/generic/pending-3.18/270-uapi-libc-compat-add-fallback-for-unsupported-libcs.patch delete mode 100644 target/linux/generic/pending-3.18/272-uapi-if_ether.h-prevent-redefinition-of-struct-ethhd.patch delete mode 100644 target/linux/generic/pending-3.18/300-mips_expose_boot_raw.patch delete mode 100644 target/linux/generic/pending-3.18/301-mips_image_cmdline_hack.patch delete mode 100644 target/linux/generic/pending-3.18/302-mips_no_branch_likely.patch delete mode 100644 target/linux/generic/pending-3.18/304-mips_disable_fpu.patch delete mode 100644 target/linux/generic/pending-3.18/305-mips_module_reloc.patch delete mode 100644 target/linux/generic/pending-3.18/306-mips_mem_functions_performance.patch delete mode 100644 target/linux/generic/pending-3.18/307-mips_highmem_offset.patch delete mode 100644 target/linux/generic/pending-3.18/310-arm_module_unresolved_weak_sym.patch delete mode 100644 target/linux/generic/pending-3.18/320-ppc4xx_optimization.patch delete mode 100644 target/linux/generic/pending-3.18/321-powerpc_crtsavres_prereq.patch delete mode 100644 target/linux/generic/pending-3.18/330-MIPS-kexec-Accept-command-line-parameters-from-users.patch delete mode 100644 target/linux/generic/pending-3.18/400-mtd-add-rootfs-split-support.patch delete mode 100644 target/linux/generic/pending-3.18/401-mtd-add-support-for-different-partition-parser-types.patch delete mode 100644 target/linux/generic/pending-3.18/402-mtd-use-typed-mtd-parsers-for-rootfs-and-firmware-split.patch delete mode 100644 target/linux/generic/pending-3.18/403-mtd-hook-mtdsplit-to-Kbuild.patch delete mode 100644 target/linux/generic/pending-3.18/404-mtd-add-more-helper-functions.patch delete mode 100644 target/linux/generic/pending-3.18/405-mtd-old-firmware-uimage-splitter.patch delete mode 100644 target/linux/generic/pending-3.18/406-mtd-old-rootfs-squashfs-splitter.patch delete mode 100644 target/linux/generic/pending-3.18/410-mtd-move-forward-declaration-of-struct-mtd_info.patch delete mode 100644 target/linux/generic/pending-3.18/411-mtd-partial_eraseblock_write.patch delete mode 100644 target/linux/generic/pending-3.18/412-mtd-partial_eraseblock_unlock.patch delete mode 100644 target/linux/generic/pending-3.18/420-mtd-redboot_space.patch delete mode 100644 target/linux/generic/pending-3.18/430-mtd-add-myloader-partition-parser.patch delete mode 100644 target/linux/generic/pending-3.18/431-mtd-bcm47xxpart-check-for-bad-blocks-when-calculatin.patch delete mode 100644 target/linux/generic/pending-3.18/432-mtd-bcm47xxpart-detect-T_Meter-partition.patch delete mode 100644 target/linux/generic/pending-3.18/440-block2mtd_init.patch delete mode 100644 target/linux/generic/pending-3.18/441-block2mtd_probe.patch delete mode 100644 target/linux/generic/pending-3.18/450-mtd-nand-allow-to-use-platform-specific-chip-fixup.patch delete mode 100644 target/linux/generic/pending-3.18/451-mtd-nand-fix-return-code-of-nand_correct_data-function.patch delete mode 100644 target/linux/generic/pending-3.18/460-mtd-cfi_cmdset_0002-no-erase_suspend.patch delete mode 100644 target/linux/generic/pending-3.18/461-mtd-cfi_cmdset_0002-add-buffer-write-cmd-timeout.patch delete mode 100644 target/linux/generic/pending-3.18/472-mtd-m25p80-add-support-for-Winbond-W25X05-flash.patch delete mode 100644 target/linux/generic/pending-3.18/473-mtd-spi-nor-add-support-for-the-Macronix-MX25L512E-S.patch delete mode 100644 target/linux/generic/pending-3.18/474-mtd-spi-nor-add-support-for-the-ISSI-SI25CD512-SPI-f.patch delete mode 100644 target/linux/generic/pending-3.18/475-mtd-spi-nor-add-macronix-mx25u25635f.patch delete mode 100644 target/linux/generic/pending-3.18/476-mtd-spi-nor-add-eon-en25qh32.patch delete mode 100644 target/linux/generic/pending-3.18/480-mtd-set-rootfs-to-be-root-dev.patch delete mode 100644 target/linux/generic/pending-3.18/490-ubi-auto-attach-mtd-device-named-ubi-or-data-on-boot.patch delete mode 100644 target/linux/generic/pending-3.18/491-ubi-auto-create-ubiblock-device-for-rootfs.patch delete mode 100644 target/linux/generic/pending-3.18/492-try-auto-mounting-ubi0-rootfs-in-init-do_mounts.c.patch delete mode 100644 target/linux/generic/pending-3.18/493-ubi-set-ROOT_DEV-to-ubiblock-rootfs-if-unset.patch delete mode 100644 target/linux/generic/pending-3.18/494-mtd-ubi-add-EOF-marker-support.patch delete mode 100644 target/linux/generic/pending-3.18/530-jffs2_make_lzma_available.patch delete mode 100644 target/linux/generic/pending-3.18/531-debloat_lzma.patch delete mode 100644 target/linux/generic/pending-3.18/532-jffs2_eofdetect.patch delete mode 100644 target/linux/generic/pending-3.18/550-ubifs-symlink-xattr-support.patch delete mode 100644 target/linux/generic/pending-3.18/551-ubifs-fix-default-compression-selection.patch delete mode 100644 target/linux/generic/pending-3.18/600-netfilter_conntrack_flush.patch delete mode 100644 target/linux/generic/pending-3.18/610-netfilter_match_bypass_default_checks.patch delete mode 100644 target/linux/generic/pending-3.18/611-netfilter_match_bypass_default_table.patch delete mode 100644 target/linux/generic/pending-3.18/612-netfilter_match_reduce_memory_access.patch delete mode 100644 target/linux/generic/pending-3.18/613-netfilter_optional_tcp_window_check.patch delete mode 100644 target/linux/generic/pending-3.18/616-net_optimize_xfrm_calls.patch delete mode 100644 target/linux/generic/pending-3.18/621-sched_act_connmark.patch delete mode 100644 target/linux/generic/pending-3.18/630-packet_socket_type.patch delete mode 100644 target/linux/generic/pending-3.18/640-bridge_no_eap_forward.patch delete mode 100644 target/linux/generic/pending-3.18/641-bridge_always_accept_eap.patch delete mode 100644 target/linux/generic/pending-3.18/642-bridge_port_isolate.patch delete mode 100644 target/linux/generic/pending-3.18/645-bridge_multicast_to_unicast.patch delete mode 100644 target/linux/generic/pending-3.18/650-pppoe_header_pad.patch delete mode 100644 target/linux/generic/pending-3.18/651-wireless_mesh_header.patch delete mode 100644 target/linux/generic/pending-3.18/653-disable_netlink_trim.patch delete mode 100644 target/linux/generic/pending-3.18/655-increase_skb_pad.patch delete mode 100644 target/linux/generic/pending-3.18/656-skb_reduce_truesize-helper.patch delete mode 100644 target/linux/generic/pending-3.18/657-qdisc_reduce_truesize.patch delete mode 100644 target/linux/generic/pending-3.18/660-fq_codel_defaults.patch delete mode 100644 target/linux/generic/pending-3.18/661-fq_codel_keep_dropped_stats.patch delete mode 100644 target/linux/generic/pending-3.18/662-use_fq_codel_by_default.patch delete mode 100644 target/linux/generic/pending-3.18/663-remove_pfifo_fast.patch delete mode 100644 target/linux/generic/pending-3.18/666-Add-support-for-MAP-E-FMRs-mesh-mode.patch delete mode 100644 target/linux/generic/pending-3.18/667-ipv6-Fixed-source-specific-default-route-handling.patch delete mode 100644 target/linux/generic/pending-3.18/670-ipv6-allow-rejecting-with-source-address-failed-policy.patch delete mode 100644 target/linux/generic/pending-3.18/671-net-provide-defines-for-_POLICY_FAILED-until-all-cod.patch delete mode 100644 target/linux/generic/pending-3.18/680-NET-skip-GRO-for-foreign-MAC-addresses.patch delete mode 100644 target/linux/generic/pending-3.18/681-NET-add-of_get_mac_address_mtd.patch delete mode 100644 target/linux/generic/pending-3.18/700-swconfig.patch delete mode 100644 target/linux/generic/pending-3.18/701-phy_extension.patch delete mode 100644 target/linux/generic/pending-3.18/702-phy_add_aneg_done_function.patch delete mode 100644 target/linux/generic/pending-3.18/703-phy-add-detach-callback-to-struct-phy_driver.patch delete mode 100644 target/linux/generic/pending-3.18/710-phy-add-mdio_register_board_info.patch delete mode 100644 target/linux/generic/pending-3.18/720-phy_adm6996.patch delete mode 100644 target/linux/generic/pending-3.18/721-phy_packets.patch delete mode 100644 target/linux/generic/pending-3.18/722-phy_mvswitch.patch delete mode 100644 target/linux/generic/pending-3.18/723-phy_ip175c.patch delete mode 100644 target/linux/generic/pending-3.18/724-phy_ar8216.patch delete mode 100644 target/linux/generic/pending-3.18/725-phy_rtl8306.patch delete mode 100644 target/linux/generic/pending-3.18/726-phy_rtl8366.patch delete mode 100644 target/linux/generic/pending-3.18/727-phy-rtl8367.patch delete mode 100644 target/linux/generic/pending-3.18/728-phy-rtl8367b.patch delete mode 100644 target/linux/generic/pending-3.18/729-phy-tantos.patch delete mode 100644 target/linux/generic/pending-3.18/730-phy_b53.patch delete mode 100644 target/linux/generic/pending-3.18/732-phy-ar8216-led-support.patch delete mode 100644 target/linux/generic/pending-3.18/733-phy_mvsw61xx.patch delete mode 100644 target/linux/generic/pending-3.18/734-net-phy-at803x-allow-to-configure-via-pdata.patch delete mode 100644 target/linux/generic/pending-3.18/735-net-phy-at803x-fix-at8033-sgmii-mode.patch delete mode 100644 target/linux/generic/pending-3.18/760-8139cp-fixes-from-4.3.patch delete mode 100644 target/linux/generic/pending-3.18/773-bgmac-add-srab-switch.patch delete mode 100644 target/linux/generic/pending-3.18/785-hso-support-0af0-9300.patch delete mode 100644 target/linux/generic/pending-3.18/810-pci_disable_common_quirks.patch delete mode 100644 target/linux/generic/pending-3.18/811-pci_disable_usb_common_quirks.patch delete mode 100644 target/linux/generic/pending-3.18/821-usb-dwc2-dualrole.patch delete mode 100644 target/linux/generic/pending-3.18/834-ledtrig-libata.patch delete mode 100644 target/linux/generic/pending-3.18/840-rtc7301.patch delete mode 100644 target/linux/generic/pending-3.18/841-rtc_pt7c4338.patch delete mode 100644 target/linux/generic/pending-3.18/861-04_spi_gpio_implement_spi_delay.patch delete mode 100644 target/linux/generic/pending-3.18/862-gpio_spi_driver.patch delete mode 100644 target/linux/generic/pending-3.18/870-hifn795x_byteswap.patch delete mode 100644 target/linux/generic/pending-3.18/890-8250_optional_sysrq.patch delete mode 100644 target/linux/generic/pending-3.18/901-debloat_sock_diag.patch delete mode 100644 target/linux/generic/pending-3.18/902-debloat_proc.patch delete mode 100644 target/linux/generic/pending-3.18/904-debloat_dma_buf.patch delete mode 100644 target/linux/generic/pending-3.18/910-kobject_uevent.patch delete mode 100644 target/linux/generic/pending-3.18/911-kobject_add_broadcast_uevent.patch delete mode 100644 target/linux/generic/pending-3.18/921-use_preinit_as_init.patch delete mode 100644 target/linux/generic/pending-3.18/922-always-create-console-node-in-initramfs.patch delete mode 100644 target/linux/generic/pending-3.18/930-crashlog.patch delete mode 100644 target/linux/generic/pending-3.18/970-remove-unsane-filenames-from-deps_initramfs-list.patch delete mode 100644 target/linux/generic/pending-3.18/980-arm_openwrt_machtypes.patch delete mode 100644 target/linux/generic/pending-3.18/990-gpio_wdt.patch delete mode 100644 target/linux/generic/pending-3.18/995-mangle_bootargs.patch delete mode 100644 target/linux/generic/pending-3.18/997-device_tree_cmdline.patch delete mode 100644 target/linux/generic/pending-3.18/998-enable_wilink_platform_without_drivers.patch delete mode 100644 target/linux/generic/pending-3.18/999-seccomp_log.patch create mode 100644 target/linux/generic/pending-4.14/103-MIPS-perf-ath79-Fix-perfcount-IRQ-assignment.patch create mode 100644 target/linux/generic/pending-4.14/342-powerpc-Enable-kernel-XZ-compression-option-on-PPC_8.patch delete mode 100644 target/linux/generic/pending-4.14/701-phy_extension.patch delete mode 100644 target/linux/generic/pending-4.14/950-tty-serial-exar-generalize-rs485-setup.patch delete mode 100644 target/linux/generic/pending-4.19/0931-w1-gpio-fix-problem-with-platfom-data-in-w1-gpio.patch delete mode 100644 target/linux/generic/pending-4.19/102-MIPS-only-process-negative-stack-offsets-on-stack-tr.patch delete mode 100644 target/linux/generic/pending-4.19/110-ehci_hcd_ignore_oc.patch delete mode 100644 target/linux/generic/pending-4.19/120-Fix-alloc_node_mem_map-with-ARCH_PFN_OFFSET-calcu.patch delete mode 100644 target/linux/generic/pending-4.19/130-add-linux-spidev-compatible-si3210.patch delete mode 100644 target/linux/generic/pending-4.19/131-spi-use-gpio_set_value_cansleep-for-setting-chipsele.patch delete mode 100644 target/linux/generic/pending-4.19/140-jffs2-use-.rename2-and-add-RENAME_WHITEOUT-support.patch delete mode 100644 target/linux/generic/pending-4.19/141-jffs2-add-RENAME_EXCHANGE-support.patch delete mode 100644 target/linux/generic/pending-4.19/150-bridge_allow_receiption_on_disabled_port.patch delete mode 100644 target/linux/generic/pending-4.19/180-net-phy-at803x-add-support-for-AT8032.patch delete mode 100644 target/linux/generic/pending-4.19/201-extra_optimization.patch delete mode 100644 target/linux/generic/pending-4.19/203-kallsyms_uncompressed.patch delete mode 100644 target/linux/generic/pending-4.19/205-backtrace_module_info.patch delete mode 100644 target/linux/generic/pending-4.19/220-optimize_inlining.patch delete mode 100644 target/linux/generic/pending-4.19/240-remove-unsane-filenames-from-deps_initramfs-list.patch delete mode 100644 target/linux/generic/pending-4.19/261-enable_wilink_platform_without_drivers.patch delete mode 100644 target/linux/generic/pending-4.19/300-mips_expose_boot_raw.patch delete mode 100644 target/linux/generic/pending-4.19/302-mips_no_branch_likely.patch delete mode 100644 target/linux/generic/pending-4.19/304-mips_disable_fpu.patch delete mode 100644 target/linux/generic/pending-4.19/305-mips_module_reloc.patch delete mode 100644 target/linux/generic/pending-4.19/306-mips_mem_functions_performance.patch delete mode 100644 target/linux/generic/pending-4.19/307-mips_highmem_offset.patch delete mode 100644 target/linux/generic/pending-4.19/308-mips32r2_tune.patch delete mode 100644 target/linux/generic/pending-4.19/309-MIPS-Add-CPU-option-reporting-to-proc-cpuinfo.patch delete mode 100644 target/linux/generic/pending-4.19/310-arm_module_unresolved_weak_sym.patch delete mode 100644 target/linux/generic/pending-4.19/330-MIPS-kexec-Accept-command-line-parameters-from-users.patch delete mode 100644 target/linux/generic/pending-4.19/332-arc-add-OWRTDTB-section.patch delete mode 100644 target/linux/generic/pending-4.19/333-arc-enable-unaligned-access-in-kernel-mode.patch delete mode 100644 target/linux/generic/pending-4.19/341-MIPS-mm-remove-no-op-dma_map_ops-where-possible.patch delete mode 100644 target/linux/generic/pending-4.19/400-mtd-add-rootfs-split-support.patch delete mode 100644 target/linux/generic/pending-4.19/401-mtd-add-support-for-different-partition-parser-types.patch delete mode 100644 target/linux/generic/pending-4.19/402-mtd-use-typed-mtd-parsers-for-rootfs-and-firmware-split.patch delete mode 100644 target/linux/generic/pending-4.19/403-mtd-hook-mtdsplit-to-Kbuild.patch delete mode 100644 target/linux/generic/pending-4.19/404-mtd-add-more-helper-functions.patch delete mode 100644 target/linux/generic/pending-4.19/411-mtd-partial_eraseblock_write.patch delete mode 100644 target/linux/generic/pending-4.19/412-mtd-partial_eraseblock_unlock.patch delete mode 100644 target/linux/generic/pending-4.19/419-mtd-redboot-add-of_match_table-with-DT-binding.patch delete mode 100644 target/linux/generic/pending-4.19/420-mtd-redboot_space.patch delete mode 100644 target/linux/generic/pending-4.19/430-mtd-add-myloader-partition-parser.patch delete mode 100644 target/linux/generic/pending-4.19/431-mtd-bcm47xxpart-check-for-bad-blocks-when-calculatin.patch delete mode 100644 target/linux/generic/pending-4.19/432-mtd-bcm47xxpart-detect-T_Meter-partition.patch delete mode 100644 target/linux/generic/pending-4.19/440-block2mtd_init.patch delete mode 100644 target/linux/generic/pending-4.19/441-block2mtd_probe.patch delete mode 100644 target/linux/generic/pending-4.19/450-mtd-spi-nor-allow-NOR-driver-to-write-fewer-bytes-th.patch delete mode 100644 target/linux/generic/pending-4.19/460-mtd-cfi_cmdset_0002-no-erase_suspend.patch delete mode 100644 target/linux/generic/pending-4.19/461-mtd-cfi_cmdset_0002-add-buffer-write-cmd-timeout.patch delete mode 100644 target/linux/generic/pending-4.19/465-m25p80-mx-disable-software-protection.patch delete mode 100644 target/linux/generic/pending-4.19/466-Revert-mtd-spi-nor-fix-Spansion-regressions-aliased-.patch delete mode 100644 target/linux/generic/pending-4.19/470-mtd-spi-nor-support-limiting-4K-sectors-support-base.patch delete mode 100644 target/linux/generic/pending-4.19/475-mtd-spi-nor-Add-Winbond-w25q128jv-support.patch delete mode 100644 target/linux/generic/pending-4.19/476-mtd-spi-nor-add-eon-en25q128.patch delete mode 100644 target/linux/generic/pending-4.19/477-mtd-add-spi-nor-add-mx25u3235f.patch delete mode 100644 target/linux/generic/pending-4.19/479-mtd-spi-nor-add-eon-en25qh64.patch delete mode 100644 target/linux/generic/pending-4.19/480-mtd-set-rootfs-to-be-root-dev.patch delete mode 100644 target/linux/generic/pending-4.19/490-ubi-auto-attach-mtd-device-named-ubi-or-data-on-boot.patch delete mode 100644 target/linux/generic/pending-4.19/491-ubi-auto-create-ubiblock-device-for-rootfs.patch delete mode 100644 target/linux/generic/pending-4.19/492-try-auto-mounting-ubi0-rootfs-in-init-do_mounts.c.patch delete mode 100644 target/linux/generic/pending-4.19/493-ubi-set-ROOT_DEV-to-ubiblock-rootfs-if-unset.patch delete mode 100644 target/linux/generic/pending-4.19/494-mtd-ubi-add-EOF-marker-support.patch delete mode 100644 target/linux/generic/pending-4.19/495-mtd-core-add-get_mtd_device_by_node.patch delete mode 100644 target/linux/generic/pending-4.19/496-dt-bindings-add-bindings-for-mtd-concat-devices.patch delete mode 100644 target/linux/generic/pending-4.19/497-mtd-mtdconcat-add-dt-driver-for-concat-devices.patch delete mode 100644 target/linux/generic/pending-4.19/530-jffs2_make_lzma_available.patch delete mode 100644 target/linux/generic/pending-4.19/532-jffs2_eofdetect.patch delete mode 100644 target/linux/generic/pending-4.19/551-ubifs-fix-default-compression-selection.patch delete mode 100644 target/linux/generic/pending-4.19/553-ubifs-Add-option-to-create-UBI-FS-version-4-on-empty.patch delete mode 100644 target/linux/generic/pending-4.19/600-netfilter_conntrack_flush.patch delete mode 100644 target/linux/generic/pending-4.19/610-netfilter_match_bypass_default_checks.patch delete mode 100644 target/linux/generic/pending-4.19/611-netfilter_match_bypass_default_table.patch delete mode 100644 target/linux/generic/pending-4.19/612-netfilter_match_reduce_memory_access.patch delete mode 100644 target/linux/generic/pending-4.19/613-netfilter_optional_tcp_window_check.patch delete mode 100644 target/linux/generic/pending-4.19/616-net_optimize_xfrm_calls.patch delete mode 100644 target/linux/generic/pending-4.19/620-net_sched-codel-do-not-defer-queue-length-update.patch delete mode 100644 target/linux/generic/pending-4.19/630-packet_socket_type.patch delete mode 100644 target/linux/generic/pending-4.19/640-netfilter-nf_flow_table-add-hardware-offload-support.patch delete mode 100644 target/linux/generic/pending-4.19/641-netfilter-nf_flow_table-support-hw-offload-through-v.patch delete mode 100644 target/linux/generic/pending-4.19/642-net-8021q-support-hardware-flow-table-offload.patch delete mode 100644 target/linux/generic/pending-4.19/643-net-bridge-support-hardware-flow-table-offload.patch delete mode 100644 target/linux/generic/pending-4.19/644-net-pppoe-support-hardware-flow-table-offload.patch delete mode 100644 target/linux/generic/pending-4.19/645-netfilter-nf_flow_table-rework-hardware-offload-time.patch delete mode 100644 target/linux/generic/pending-4.19/646-netfilter-nf_flow_table-rework-private-driver-data.patch delete mode 100644 target/linux/generic/pending-4.19/655-increase_skb_pad.patch delete mode 100644 target/linux/generic/pending-4.19/666-Add-support-for-MAP-E-FMRs-mesh-mode.patch delete mode 100644 target/linux/generic/pending-4.19/670-ipv6-allow-rejecting-with-source-address-failed-policy.patch delete mode 100644 target/linux/generic/pending-4.19/671-net-provide-defines-for-_POLICY_FAILED-until-all-cod.patch delete mode 100644 target/linux/generic/pending-4.19/680-NET-skip-GRO-for-foreign-MAC-addresses.patch delete mode 100644 target/linux/generic/pending-4.19/681-NET-add-of_get_mac_address_mtd.patch delete mode 100644 target/linux/generic/pending-4.19/701-phy_extension.patch delete mode 100644 target/linux/generic/pending-4.19/703-phy-add-detach-callback-to-struct-phy_driver.patch delete mode 100644 target/linux/generic/pending-4.19/734-net-phy-at803x-allow-to-configure-via-pdata.patch delete mode 100644 target/linux/generic/pending-4.19/735-net-phy-at803x-fix-at8033-sgmii-mode.patch delete mode 100644 target/linux/generic/pending-4.19/736-net-phy-at803x-allow-to-configure-via-dt.patch delete mode 100644 target/linux/generic/pending-4.19/800-bcma-get-SoC-device-struct-copy-its-DMA-params-to-th.patch delete mode 100644 target/linux/generic/pending-4.19/810-pci_disable_common_quirks.patch delete mode 100644 target/linux/generic/pending-4.19/811-pci_disable_usb_common_quirks.patch delete mode 100644 target/linux/generic/pending-4.19/834-ledtrig-libata.patch delete mode 100644 target/linux/generic/pending-4.19/920-mangle_bootargs.patch delete mode 100644 target/linux/generic/pending-4.9/0931-w1-gpio-fix-problem-with-platfom-data-in-w1-gpio.patch delete mode 100644 target/linux/generic/pending-4.9/100-MIPS-fix-cache-flushing-for-highmem-pages.patch delete mode 100644 target/linux/generic/pending-4.9/110-ehci_hcd_ignore_oc.patch delete mode 100644 target/linux/generic/pending-4.9/120-Fix-alloc_node_mem_map-with-ARCH_PFN_OFFSET-calcu.patch delete mode 100644 target/linux/generic/pending-4.9/130-add-linux-spidev-compatible-si3210.patch delete mode 100644 target/linux/generic/pending-4.9/131-spi-use-gpio_set_value_cansleep-for-setting-chipsele.patch delete mode 100644 target/linux/generic/pending-4.9/140-jffs2-use-.rename2-and-add-RENAME_WHITEOUT-support.patch delete mode 100644 target/linux/generic/pending-4.9/141-jffs2-add-RENAME_EXCHANGE-support.patch delete mode 100644 target/linux/generic/pending-4.9/150-bridge_allow_receiption_on_disabled_port.patch delete mode 100644 target/linux/generic/pending-4.9/161-mtd-part-add-generic-parsing-of-linux-part-probe.patch delete mode 100644 target/linux/generic/pending-4.9/170-MIPS-PCI-add-controllers-before-the-specified-head.patch delete mode 100644 target/linux/generic/pending-4.9/180-net-phy-at803x-add-support-for-AT8032.patch delete mode 100644 target/linux/generic/pending-4.9/190-2-5-e1000e-Fix-wrong-comment-related-to-link-detection.patch delete mode 100644 target/linux/generic/pending-4.9/201-extra_optimization.patch delete mode 100644 target/linux/generic/pending-4.9/203-kallsyms_uncompressed.patch delete mode 100644 target/linux/generic/pending-4.9/205-backtrace_module_info.patch delete mode 100644 target/linux/generic/pending-4.9/220-optimize_inlining.patch delete mode 100644 target/linux/generic/pending-4.9/240-remove-unsane-filenames-from-deps_initramfs-list.patch delete mode 100644 target/linux/generic/pending-4.9/261-enable_wilink_platform_without_drivers.patch delete mode 100644 target/linux/generic/pending-4.9/300-mips_expose_boot_raw.patch delete mode 100644 target/linux/generic/pending-4.9/302-mips_no_branch_likely.patch delete mode 100644 target/linux/generic/pending-4.9/304-mips_disable_fpu.patch delete mode 100644 target/linux/generic/pending-4.9/305-mips_module_reloc.patch delete mode 100644 target/linux/generic/pending-4.9/306-mips_mem_functions_performance.patch delete mode 100644 target/linux/generic/pending-4.9/307-mips_highmem_offset.patch delete mode 100644 target/linux/generic/pending-4.9/308-mips32r2_tune.patch delete mode 100644 target/linux/generic/pending-4.9/309-MIPS-Add-CPU-option-reporting-to-proc-cpuinfo.patch delete mode 100644 target/linux/generic/pending-4.9/310-arm_module_unresolved_weak_sym.patch delete mode 100644 target/linux/generic/pending-4.9/330-MIPS-kexec-Accept-command-line-parameters-from-users.patch delete mode 100644 target/linux/generic/pending-4.9/332-arc-add-OWRTDTB-section.patch delete mode 100644 target/linux/generic/pending-4.9/333-arc-enable-unaligned-access-in-kernel-mode.patch delete mode 100644 target/linux/generic/pending-4.9/340-MIPS-mm-remove-mips_dma_mapping_error.patch delete mode 100644 target/linux/generic/pending-4.9/341-MIPS-mm-remove-no-op-dma_map_ops-where-possible.patch delete mode 100644 target/linux/generic/pending-4.9/400-mtd-add-rootfs-split-support.patch delete mode 100644 target/linux/generic/pending-4.9/401-mtd-add-support-for-different-partition-parser-types.patch delete mode 100644 target/linux/generic/pending-4.9/402-mtd-use-typed-mtd-parsers-for-rootfs-and-firmware-split.patch delete mode 100644 target/linux/generic/pending-4.9/403-mtd-hook-mtdsplit-to-Kbuild.patch delete mode 100644 target/linux/generic/pending-4.9/404-mtd-add-more-helper-functions.patch delete mode 100644 target/linux/generic/pending-4.9/411-mtd-partial_eraseblock_write.patch delete mode 100644 target/linux/generic/pending-4.9/412-mtd-partial_eraseblock_unlock.patch delete mode 100644 target/linux/generic/pending-4.9/419-mtd-redboot-add-of_match_table-with-DT-binding.patch delete mode 100644 target/linux/generic/pending-4.9/420-mtd-redboot_space.patch delete mode 100644 target/linux/generic/pending-4.9/430-mtd-add-myloader-partition-parser.patch delete mode 100644 target/linux/generic/pending-4.9/431-mtd-bcm47xxpart-check-for-bad-blocks-when-calculatin.patch delete mode 100644 target/linux/generic/pending-4.9/432-mtd-bcm47xxpart-detect-T_Meter-partition.patch delete mode 100644 target/linux/generic/pending-4.9/440-block2mtd_init.patch delete mode 100644 target/linux/generic/pending-4.9/441-block2mtd_probe.patch delete mode 100644 target/linux/generic/pending-4.9/450-mtd-m25p80-allow-fallback-from-spi_flash_read-to-reg.patch delete mode 100644 target/linux/generic/pending-4.9/460-mtd-cfi_cmdset_0002-no-erase_suspend.patch delete mode 100644 target/linux/generic/pending-4.9/461-mtd-cfi_cmdset_0002-add-buffer-write-cmd-timeout.patch delete mode 100644 target/linux/generic/pending-4.9/465-m25p80-mx-disable-software-protection.patch delete mode 100644 target/linux/generic/pending-4.9/466-Revert-mtd-spi-nor-fix-Spansion-regressions-aliased-.patch delete mode 100644 target/linux/generic/pending-4.9/470-mtd-spi-nor-support-limiting-4K-sectors-support-base.patch delete mode 100644 target/linux/generic/pending-4.9/475-mtd-spi-nor-Add-Winbond-w25q128jv-support.patch delete mode 100644 target/linux/generic/pending-4.9/476-mtd-spi-nor-add-eon-en25q128.patch delete mode 100644 target/linux/generic/pending-4.9/477-mtd-add-spi-nor-add-mx25u3235f.patch delete mode 100644 target/linux/generic/pending-4.9/478-mtd-spi-nor-Add-support-for-XM25QH64A-and-XM25QH128A.patch delete mode 100644 target/linux/generic/pending-4.9/479-mtd-spi-nor-add-eon-en25qh32.patch delete mode 100644 target/linux/generic/pending-4.9/480-mtd-set-rootfs-to-be-root-dev.patch delete mode 100644 target/linux/generic/pending-4.9/490-ubi-auto-attach-mtd-device-named-ubi-or-data-on-boot.patch delete mode 100644 target/linux/generic/pending-4.9/491-ubi-auto-create-ubiblock-device-for-rootfs.patch delete mode 100644 target/linux/generic/pending-4.9/492-try-auto-mounting-ubi0-rootfs-in-init-do_mounts.c.patch delete mode 100644 target/linux/generic/pending-4.9/493-ubi-set-ROOT_DEV-to-ubiblock-rootfs-if-unset.patch delete mode 100644 target/linux/generic/pending-4.9/494-mtd-ubi-add-EOF-marker-support.patch delete mode 100644 target/linux/generic/pending-4.9/530-jffs2_make_lzma_available.patch delete mode 100644 target/linux/generic/pending-4.9/532-jffs2_eofdetect.patch delete mode 100644 target/linux/generic/pending-4.9/551-ubifs-fix-default-compression-selection.patch delete mode 100644 target/linux/generic/pending-4.9/600-netfilter_conntrack_flush.patch delete mode 100644 target/linux/generic/pending-4.9/610-netfilter_match_bypass_default_checks.patch delete mode 100644 target/linux/generic/pending-4.9/611-netfilter_match_bypass_default_table.patch delete mode 100644 target/linux/generic/pending-4.9/612-netfilter_match_reduce_memory_access.patch delete mode 100644 target/linux/generic/pending-4.9/613-netfilter_optional_tcp_window_check.patch delete mode 100644 target/linux/generic/pending-4.9/616-net_optimize_xfrm_calls.patch delete mode 100644 target/linux/generic/pending-4.9/620-net_sched-codel-do-not-defer-queue-length-update.patch delete mode 100644 target/linux/generic/pending-4.9/630-packet_socket_type.patch delete mode 100644 target/linux/generic/pending-4.9/655-increase_skb_pad.patch delete mode 100644 target/linux/generic/pending-4.9/666-Add-support-for-MAP-E-FMRs-mesh-mode.patch delete mode 100644 target/linux/generic/pending-4.9/670-ipv6-allow-rejecting-with-source-address-failed-policy.patch delete mode 100644 target/linux/generic/pending-4.9/671-net-provide-defines-for-_POLICY_FAILED-until-all-cod.patch delete mode 100644 target/linux/generic/pending-4.9/680-NET-skip-GRO-for-foreign-MAC-addresses.patch delete mode 100644 target/linux/generic/pending-4.9/681-NET-add-of_get_mac_address_mtd.patch delete mode 100644 target/linux/generic/pending-4.9/701-phy_extension.patch delete mode 100644 target/linux/generic/pending-4.9/703-phy-add-detach-callback-to-struct-phy_driver.patch delete mode 100644 target/linux/generic/pending-4.9/734-net-phy-at803x-allow-to-configure-via-pdata.patch delete mode 100644 target/linux/generic/pending-4.9/735-net-phy-at803x-fix-at8033-sgmii-mode.patch delete mode 100644 target/linux/generic/pending-4.9/810-pci_disable_common_quirks.patch delete mode 100644 target/linux/generic/pending-4.9/811-pci_disable_usb_common_quirks.patch delete mode 100644 target/linux/generic/pending-4.9/821-usb-Remove-annoying-warning-about-bogus-URB.patch delete mode 100644 target/linux/generic/pending-4.9/834-ledtrig-libata.patch delete mode 100644 target/linux/generic/pending-4.9/890-uart_optional_sysrq.patch delete mode 100644 target/linux/generic/pending-4.9/920-mangle_bootargs.patch delete mode 100644 target/linux/sunxi/patches-4.19/100-clocksource-drivers-arch_timer-Workaround-for-Allwin.patch delete mode 100644 target/linux/sunxi/patches-4.19/101-arm64-dts-allwinner-a64-Enable-A64-timer-workaround.patch delete mode 100644 target/linux/sunxi/patches-4.19/301-orangepi_pc2_usb_otg_to_host_key_power.patch delete mode 100644 target/linux/sunxi/patches-4.19/310-Revert-ARM-dts-sun7i-Add-BCM53125-switch-nodes-to-th.patch delete mode 100644 target/linux/sunxi/patches-4.19/400-arm64-allwinner-a64-sopine-Add-Sopine-flash-partitio.patch delete mode 100644 target/linux/x86/patches-4.19/011-tune_lzma_options.patch delete mode 100644 target/linux/x86/patches-4.19/100-fix_cs5535_clockevt.patch delete mode 100644 target/linux/x86/patches-4.19/200-pcengines-apu2-reboot.patch delete mode 100644 target/linux/x86/patches-4.19/800-hwmon-w83627ehf-dont-claim-nct677x.patch delete mode 100644 target/linux/xburst/Makefile delete mode 100755 target/linux/xburst/base-files/etc/board.d/01_system delete mode 100644 target/linux/xburst/base-files/etc/config/fstab delete mode 100644 target/linux/xburst/base-files/etc/config/network delete mode 100644 target/linux/xburst/config-3.18 delete mode 100644 target/linux/xburst/image/Makefile delete mode 100644 target/linux/xburst/image/ubinize.cfg delete mode 100644 target/linux/xburst/modules.mk delete mode 100644 target/linux/xburst/patches-3.18/001-ubi-Read-only-the-vid-header-instead-of-the-whole-pa.patch delete mode 100644 target/linux/xburst/patches-3.18/002-NAND-Optimize-NAND_ECC_HW_OOB_FIRST-read.patch delete mode 100644 target/linux/xburst/patches-3.18/003-NAND-Add-support-for-subpage-reads-for-NAND_ECC_HW_O.patch delete mode 100644 target/linux/xburst/patches-3.18/004-ASoC-JZ4740-delay-activation-of-the-DAC-to-work-arou.patch delete mode 100644 target/linux/xburst/patches-3.18/005-RTC-JZ4740-Init-the-regulator-register-on-startup.patch delete mode 100644 target/linux/xburst/patches-3.18/006-Add-ili8960-lcd-driver.patch delete mode 100644 target/linux/xburst/patches-3.18/007-qi_lb60-Don-t-use-3-wire-spi-mode-for-the-display-fo.patch delete mode 100644 target/linux/xburst/qi_lb60/config-default delete mode 100644 target/linux/xburst/qi_lb60/target.mk delete mode 100644 toolchain/gcc/patches/arc-2017.09-release/001-revert_register_mode_search.patch delete mode 100644 toolchain/gcc/patches/arc-2017.09-release/002-case_insensitive.patch delete mode 100644 toolchain/gcc/patches/arc-2017.09-release/010-documentation.patch delete mode 100644 toolchain/gcc/patches/arc-2017.09-release/230-musl_libssp.patch delete mode 100644 toolchain/gcc/patches/arc-2017.09-release/300-mips_Os_cpu_rtx_cost_model.patch delete mode 100644 toolchain/gcc/patches/arc-2017.09-release/800-arm_v5te_no_ldrd_strd.patch delete mode 100644 toolchain/gcc/patches/arc-2017.09-release/810-arm-softfloat-libgcc.patch delete mode 100644 toolchain/gcc/patches/arc-2017.09-release/820-libgcc_pic.patch delete mode 100644 toolchain/gcc/patches/arc-2017.09-release/840-armv4_pass_fix-v4bx_to_ld.patch delete mode 100644 toolchain/gcc/patches/arc-2017.09-release/850-use_shared_libgcc.patch delete mode 100644 toolchain/gcc/patches/arc-2017.09-release/851-libgcc_no_compat.patch delete mode 100644 toolchain/gcc/patches/arc-2017.09-release/870-ppc_no_crtsavres.patch delete mode 100644 toolchain/gcc/patches/arc-2017.09-release/881-no_tm_section.patch delete mode 100644 toolchain/gcc/patches/arc-2017.09-release/900-bad-mips16-crt.patch delete mode 100644 toolchain/gcc/patches/arc-2017.09-release/910-mbsd_multi.patch delete mode 100644 toolchain/gcc/patches/arc-2017.09-release/920-specs_nonfatal_getenv.patch delete mode 100644 toolchain/gcc/patches/arc-2017.09-release/930-fix-mips-noexecstack.patch delete mode 100644 toolchain/gcc/patches/arc-2017.09-release/940-no-clobber-stamp-bits.patch delete mode 100644 toolchain/gcc/patches/arc-2017.09-release/950-cpp_file_path_translation.patch create mode 100644 toolchain/musl/patches/020-mips-dlsym_donot_return_address_from_undef_sym.patch create mode 100644 toolchain/musl/patches/030-fix-x87-stack-imbalance-in-corner-cases-of-i386-math.patch create mode 100644 toolchain/musl/patches/031-fix-build-regression-in-i386-asm-for-atan2-atan2f.patch delete mode 100644 toolchain/nasm/patches/100-backport-upstream-GCC8-compatibility-fixes.patch create mode 100644 tools/cbootimage-configs/Makefile create mode 100644 tools/cbootimage/Makefile create mode 100644 tools/cmake/patches/150-C-feature-checks-Match-warnings-more-strictly.patch create mode 100644 tools/firmware-utils/src/nec-enc.c create mode 100644 tools/patch/patches/050-CVE-2019-13636.patch create mode 100644 tools/patch/patches/060-CVE-2019-13638.patch create mode 100644 tools/wrt350nv2-builder/Makefile create mode 100644 tools/wrt350nv2-builder/src/crypt.h create mode 100644 tools/wrt350nv2-builder/src/ioapi.c create mode 100644 tools/wrt350nv2-builder/src/ioapi.h create mode 100644 tools/wrt350nv2-builder/src/md5.c create mode 100644 tools/wrt350nv2-builder/src/md5.h create mode 100644 tools/wrt350nv2-builder/src/upgrade.h create mode 100644 tools/wrt350nv2-builder/src/wrt350nv2-builder.c diff --git a/Config.in b/Config.in index d8efc18921..47391703b5 100644 --- a/Config.in +++ b/Config.in @@ -31,6 +31,4 @@ source "target/sdk/Config.in" source "target/toolchain/Config.in" -source "target/ccsdisk/Config.in" - source "tmp/.config-package.in" diff --git a/Makefile b/Makefile index a6d7322a12..f94c6664f9 100644 --- a/Makefile +++ b/Makefile @@ -89,8 +89,6 @@ prereq: $(target/stamp-prereq) tmp/.prereq_packages checksum: FORCE $(call sha256sums,$(BIN_DIR),$(CONFIG_BUILDBOT)) -ccsdisk: $(target/ccsdisk/install) - diffconfig: FORCE mkdir -p $(BIN_DIR) $(SCRIPT_DIR)/diffconfig.sh > $(BIN_DIR)/config.seed diff --git a/README.md b/README.md deleted file mode 100644 index 867a0fd333..0000000000 --- a/README.md +++ /dev/null @@ -1,15 +0,0 @@ -# libreCMC : The _libre_ Embedded GNU/Linux Distro. - -libreCMC is a set of fully [free](http://www.gnu.org/philosophy/free-sw.en.html) embedded Operating Systems for general purpose computers. It aims to give its users freedom and control over the software that runs on their hardware. Most of the hardware that libreCMC supports includes a wide range of routers and some small single board computers. - -## Useful links: - -* [Get libreCMC source code](/) : Checkout the latest libreCMC sources. - -* [Supported Hardware](/docs/Supported_Hardware.md): Devices officially supported by libreCMC. - -* [Router reset instructions](/docs/Router_Reset_Instructions.md) : Generic libreCMC router reset instructions. - -* [Report a bug or issue](https://gogs.librecmc.org/libreCMC/libreCMC/issues) : Is something broken? Did you find a non-free component or do you want to make libreCMC better? Submit an issue. - -* [Build Documentation](/docs/How_To_Build_libreCMC.md) : Learn how to build libreCMC for your device. diff --git a/config/Config-build.in b/config/Config-build.in index b5acd8cbeb..4cda24826f 100644 --- a/config/Config-build.in +++ b/config/Config-build.in @@ -34,8 +34,21 @@ menu "Global build settings" bool "Cryptographically signed package lists" default y + config SIGNATURE_CHECK + bool "Enable signature checking in opkg" + default SIGNED_PACKAGES + comment "General build options" + config TESTING_KERNEL + bool "Use the testing kernel version" + depends on HAS_TESTING_KERNEL + default n + help + If the target supports a newer kernel version than the default, + you can use this config option to enable it + + config DISPLAY_SUPPORT bool "Show packages that require graphics support (local or remote)" default n diff --git a/config/Config-images.in b/config/Config-images.in index 5e8f028f27..86e6bd7baa 100644 --- a/config/Config-images.in +++ b/config/Config-images.in @@ -14,10 +14,11 @@ menu "Target Images" choice prompt "Compression" - default TARGET_INITRAMFS_COMPRESSION_LZMA if TARGET_ar71xx - default TARGET_INITRAMFS_COMPRESSION_LZMA if TARGET_ramips default TARGET_INITRAMFS_COMPRESSION_LZMA if TARGET_apm821xx + default TARGET_INITRAMFS_COMPRESSION_LZMA if TARGET_ar71xx + default TARGET_INITRAMFS_COMPRESSION_LZMA if TARGET_lantiq default TARGET_INITRAMFS_COMPRESSION_LZMA if TARGET_mpc85xx + default TARGET_INITRAMFS_COMPRESSION_LZMA if TARGET_ramips default TARGET_INITRAMFS_COMPRESSION_NONE depends on TARGET_ROOTFS_INITRAMFS help @@ -272,7 +273,7 @@ menu "Target Images" config TARGET_ROOTFS_PARTSIZE int "Root filesystem partition size (in MB)" - depends on GRUB_IMAGES || USES_ROOTFS_PART || TARGET_ROOTFS_EXT4FS || TARGET_mvebu || TARGET_omap || TARGET_rb532 || TARGET_sunxi || TARGET_uml + depends on GRUB_IMAGES || USES_ROOTFS_PART || TARGET_ROOTFS_EXT4FS || TARGET_omap || TARGET_rb532 || TARGET_sunxi || TARGET_uml default 256 help Select the root filesystem partition size. diff --git a/config/Config-kernel.in b/config/Config-kernel.in index c860b2992f..2624f53eed 100644 --- a/config/Config-kernel.in +++ b/config/Config-kernel.in @@ -192,6 +192,10 @@ config KERNEL_KPROBE_EVENT bool default y if KERNEL_KPROBES +config KERNEL_KPROBE_EVENTS + bool + default y if KERNEL_KPROBES + config KERNEL_AIO bool "Compile the kernel with asynchronous IO support" default n diff --git a/include/download.mk b/include/download.mk index a9a3c3a110..c9ef95e0bf 100644 --- a/include/download.mk +++ b/include/download.mk @@ -28,7 +28,7 @@ define dl_method $(strip \ $(if $(filter git,$(2)),$(call dl_method_git,$(1),$(2)), $(if $(2),$(2), \ - $(if $(filter @APACHE/% @GNOME/% @GNU/% @KERNEL_LIBRE/% @KERNEL/% @SF/% @SAVANNAH/% ftp://% http://% https://% file://%,$(1)),default, \ + $(if $(filter @APACHE/% @GITHUB/% @GNOME/% @GNU/% @KERNEL_LIBRE/% @KERNEL/% @SF/% @SAVANNAH/% ftp://% http://% https://% file://%,$(1)),default, \ $(if $(filter git://%,$(1)),$(call dl_method_git,$(1),$(2)), \ $(if $(filter svn://%,$(1)),svn, \ $(if $(filter cvs://%,$(1)),cvs, \ @@ -55,7 +55,8 @@ define dl_pack $(if $(dl_pack/$(call ext,$(1))),$(dl_pack/$(call ext,$(1))),$(dl_pack/unknown)) endef define dl_tar_pack - $(TAR) --numeric-owner --owner=0 --group=0 --sort=name $$$${TAR_TIMESTAMP:+--mtime="$$$$TAR_TIMESTAMP"} -c $(2) | $(call dl_pack,$(1)) + $(TAR) --numeric-owner --owner=0 --group=0 --mode=a-s --sort=name \ + $$$${TAR_TIMESTAMP:+--mtime="$$$$TAR_TIMESTAMP"} -c $(2) | $(call dl_pack,$(1)) endef ifdef CHECK diff --git a/include/feeds.mk b/include/feeds.mk index 4d85a47599..9637424c5b 100644 --- a/include/feeds.mk +++ b/include/feeds.mk @@ -9,7 +9,7 @@ -include $(TMP_DIR)/.packageauxvars FEEDS_INSTALLED:=$(notdir $(wildcard $(TOPDIR)/package/feeds/*)) -FEEDS_AVAILABLE:=$(sort $(FEEDS_INSTALLED) $(shell $(SCRIPT_DIR)/feeds list -n)) +FEEDS_AVAILABLE:=$(sort $(FEEDS_INSTALLED) $(shell $(SCRIPT_DIR)/feeds list -n 2>/dev/null)) PACKAGE_SUBDIRS=$(PACKAGE_DIR) ifneq ($(CONFIG_PER_FEED_REPO),) diff --git a/include/image-commands.mk b/include/image-commands.mk index ade370cc0d..8251a81400 100644 --- a/include/image-commands.mk +++ b/include/image-commands.mk @@ -355,12 +355,14 @@ json_quote=$(subst ','\'',$(subst ",\",$(1))) metadata_devices=$(if $(1),$(subst "$(space)","$(comma)",$(strip $(foreach v,$(1),"$(call json_quote,$(v))")))) metadata_json = \ '{ $(if $(IMAGE_METADATA),$(IMAGE_METADATA)$(comma)) \ + "metadata_version": "1.0", \ "supported_devices":[$(call metadata_devices,$(1))], \ "version": { \ "dist": "$(call json_quote,$(VERSION_DIST))", \ "version": "$(call json_quote,$(VERSION_NUMBER))", \ "revision": "$(call json_quote,$(REVISION))", \ - "board": "$(call json_quote,$(BOARD))" \ + "target": "$(call json_quote,$(TARGETID))", \ + "board": "$(call json_quote,$(if $(BOARD_NAME),$(BOARD_NAME),$(DEVICE_NAME)))" \ } \ }' diff --git a/include/image.mk b/include/image.mk index 5268f0bdb7..530a2b1335 100644 --- a/include/image.mk +++ b/include/image.mk @@ -154,10 +154,10 @@ endif # Disable noisy checks by default as in upstream -ifeq ($(strip $(call kernel_patchver_ge,4.6.0)),1) +ifeq ($(strip $(call kernel_patchver_ge,4.7.0)),1) DTC_FLAGS += -Wno-unit_address_vs_reg endif -ifeq ($(strip $(call kernel_patchver_ge,4.11.0)),1) +ifeq ($(strip $(call kernel_patchver_ge,4.12.0)),1) DTC_FLAGS += \ -Wno-unit_address_vs_reg \ -Wno-simple_bus_reg \ @@ -166,12 +166,12 @@ ifeq ($(strip $(call kernel_patchver_ge,4.11.0)),1) -Wno-pci_device_bus_num \ -Wno-pci_device_reg endif -ifeq ($(strip $(call kernel_patchver_ge,4.16.0)),1) +ifeq ($(strip $(call kernel_patchver_ge,4.17.0)),1) DTC_FLAGS += \ -Wno-avoid_unnecessary_addr_size \ -Wno-alias_paths endif -ifeq ($(strip $(call kernel_patchver_ge,4.17.0)),1) +ifeq ($(strip $(call kernel_patchver_ge,4.18.0)),1) DTC_FLAGS += \ -Wno-graph_child_address \ -Wno-graph_port \ @@ -291,7 +291,7 @@ endef ifdef CONFIG_TARGET_ROOTFS_TARGZ define Image/Build/targz - $(TAR) -cp --numeric-owner --owner=0 --group=0 --sort=name \ + $(TAR) -cp --numeric-owner --owner=0 --group=0 --mode=a-s --sort=name \ $(if $(SOURCE_DATE_EPOCH),--mtime="@$(SOURCE_DATE_EPOCH)") \ -C $(TARGET_DIR)/ . | gzip -9n > $(BIN_DIR)/$(IMG_PREFIX)$(if $(PROFILE_SANITIZED),-$(PROFILE_SANITIZED))-rootfs.tar.gz endef @@ -383,6 +383,8 @@ define Device/Init IMAGE_METADATA := FILESYSTEMS := $(TARGET_FILESYSTEMS) + + UBOOT_PATH := $(STAGING_DIR_IMAGE)/uboot-$(1) endef DEFAULT_DEVICE_VARS := \ @@ -390,7 +392,7 @@ DEFAULT_DEVICE_VARS := \ CMDLINE UBOOTENV_IN_UBI KERNEL_IN_UBI BLOCKSIZE PAGESIZE SUBPAGESIZE \ VID_HDR_OFFSET UBINIZE_OPTS UBINIZE_PARTS MKUBIFS_OPTS DEVICE_DTS \ DEVICE_DTS_CONFIG DEVICE_DTS_DIR BOARD_NAME UIMAGE_NAME SUPPORTED_DEVICES \ - IMAGE_METADATA KERNEL_ENTRY KERNEL_LOADADDR + IMAGE_METADATA KERNEL_ENTRY KERNEL_LOADADDR UBOOT_PATH define Device/ExportVar $(1) : $(2):=$$($(2)) @@ -557,6 +559,8 @@ define Device/DumpInfo Target-Profile: DEVICE_$(1) Target-Profile-Name: $(DEVICE_TITLE) Target-Profile-Packages: $(DEVICE_PACKAGES) +Target-Profile-hasImageMetadata: $(if $(foreach image,$(IMAGES),$(findstring append-metadata,$(IMAGE/$(image)))),1,0) +Target-Profile-SupportedDevices: $(SUPPORTED_DEVICES) Target-Profile-Description: $(DEVICE_DESCRIPTION) @@ diff --git a/include/kernel-version.mk b/include/kernel-version.mk index 5d3c8390c6..96ce88fbce 100644 --- a/include/kernel-version.mk +++ b/include/kernel-version.mk @@ -2,15 +2,13 @@ LINUX_RELEASE?=1 -LINUX_VERSION-3.18 = .136 -LINUX_VERSION-4.9 = .160 -LINUX_VERSION-4.14 = .103 -LINUX_VERSION-4.19 = .25 +ifdef CONFIG_TESTING_KERNEL + KERNEL_PATCHVER:=$(KERNEL_TESTING_PATCHVER) +endif + +LINUX_VERSION-4.14 = .141 -LINUX_KERNEL_HASH-3.18.136 = -LINUX_KERNEL_HASH-4.9.160 = -LINUX_KERNEL_HASH-4.14.103 = efebd67ba78b7c99eb9a1d2e3ceb30997e9c39f70d030d36899619a9e659ec17 -LINUX_KERNEL_HASH-4.19.25 = +LINUX_KERNEL_HASH-4.14.141 = 0bb9f0812326ec4554de1bea02628840e03b6664b5abfd9d8510049e43203a17 remove_uri_prefix=$(subst git://,,$(subst http://,,$(subst https://,,$(1)))) sanitize_uri=$(call qstrip,$(subst @,_,$(subst :,_,$(subst .,_,$(subst -,_,$(subst /,_,$(1))))))) @@ -25,6 +23,9 @@ else ifdef KERNEL_PATCHVER LINUX_VERSION:=$(KERNEL_PATCHVER)$(strip $(LINUX_VERSION-$(KERNEL_PATCHVER))) endif +ifdef KERNEL_TESTING_PATCHVER + LINUX_TESTING_VERSION:=$(KERNEL_TESTING_PATCHVER)$(strip $(LINUX_VERSION-$(KERNEL_TESTING_PATCHVER))) +endif endif split_version=$(subst ., ,$(1)) diff --git a/include/kernel.mk b/include/kernel.mk index ce7a6223e1..d01bfda9d2 100644 --- a/include/kernel.mk +++ b/include/kernel.mk @@ -66,7 +66,7 @@ else endif ifneq (,$(findstring -rc,$(LINUX_VERSION))) - LINUX_SITE:=https://git.kernel.org/torvalds/t + LINUX_SITE:= else ifeq ($(call qstrip,$(CONFIG_EXTERNAL_KERNEL_TREE))$(call qstrip,$(CONFIG_KERNEL_GIT_CLONE_URI)),) LINUX_SITE:=@KERNEL_LIBRE/$(LINUX_VERSION)-gnu$(TESTING) else @@ -141,7 +141,10 @@ endef define collect_module_symvers for subdir in $(PKG_EXTMOD_SUBDIRS); do \ - grep -F $$$$(readlink -f $(PKG_BUILD_DIR)) $(PKG_BUILD_DIR)/$$$$subdir/Module.symvers >> $(PKG_BUILD_DIR)/Module.symvers.tmp; \ + realdir=$$$$(readlink -f $(PKG_BUILD_DIR)); \ + grep -F $(PKG_BUILD_DIR) $(PKG_BUILD_DIR)/$$$$subdir/Module.symvers >> $(PKG_BUILD_DIR)/Module.symvers.tmp; \ + [ "$(PKG_BUILD_DIR)" = "$$$$realdir" ] || \ + grep -F $$$$realdir $(PKG_BUILD_DIR)/$$$$subdir/Module.symvers >> $(PKG_BUILD_DIR)/Module.symvers.tmp; \ done; \ sort -u $(PKG_BUILD_DIR)/Module.symvers.tmp > $(PKG_BUILD_DIR)/Module.symvers; \ mv $(PKG_BUILD_DIR)/Module.symvers $(PKG_INFO_DIR)/$(PKG_NAME).symvers diff --git a/include/package-ipkg.mk b/include/package-ipkg.mk index 9ca4879bfa..38252b95cd 100644 --- a/include/package-ipkg.mk +++ b/include/package-ipkg.mk @@ -35,7 +35,8 @@ PARENR :=) dep_split=$(subst :,$(space),$(1)) dep_rem=$(subst !,,$(subst $(strip $(PARENL)),,$(subst $(strip $(PARENR)),,$(word 1,$(call dep_split,$(1)))))) -dep_confvar=$(strip $(foreach cond,$(subst ||, ,$(call dep_rem,$(1))),$(CONFIG_$(cond)))) +dep_and=dep_and_res:=$$(and $(subst $(space),$(comma),$(foreach cond,$(subst &&, ,$(1)),$$(CONFIG_$(cond))))) +dep_confvar=$(strip $(foreach cond,$(subst ||, ,$(call dep_rem,$(1))),$(eval $(call dep_and,$(cond)))$(dep_and_res))) dep_pos=$(if $(call dep_confvar,$(1)),$(call dep_val,$(1))) dep_neg=$(if $(call dep_confvar,$(1)),,$(call dep_val,$(1))) dep_if=$(if $(findstring !,$(1)),$(call dep_neg,$(1)),$(call dep_pos,$(1))) diff --git a/include/rootfs.mk b/include/rootfs.mk index dc8621dbae..f2d2494ae2 100644 --- a/include/rootfs.mk +++ b/include/rootfs.mk @@ -78,7 +78,13 @@ define prepare_rootfs done; \ for script in ./etc/init.d/*; do \ grep '#!/bin/sh /etc/rc.common' $$script >/dev/null || continue; \ - IPKG_INSTROOT=$(1) $$(which bash) ./etc/rc.common $$script enable; \ + if ! echo " $(3) " | grep -q " $$(basename $$script) "; then \ + IPKG_INSTROOT=$(1) $$(which bash) ./etc/rc.common $$script enable; \ + echo "Enabling" $$(basename $$script); \ + else \ + IPKG_INSTROOT=$(1) $$(which bash) ./etc/rc.common $$script disable; \ + echo "Disabling" $$(basename $$script); \ + fi; \ done || true \ ) $(if $(SOURCE_DATE_EPOCH),sed -i "s/Installed-Time: .*/Installed-Time: $(SOURCE_DATE_EPOCH)/" $(1)/usr/lib/opkg/status) diff --git a/include/target.mk b/include/target.mk index 10f57d6498..a813ba2d2d 100644 --- a/include/target.mk +++ b/include/target.mk @@ -13,11 +13,11 @@ __target_inc=1 DEVICE_TYPE?=router # Default packages - the really basic set -DEFAULT_PACKAGES:=base-files libc libgcc busybox dropbear mtd uci opkg netifd fstools uclient-fetch logd +DEFAULT_PACKAGES:=base-files libc libgcc busybox dropbear mtd uci opkg netifd fstools uclient-fetch logd urandom-seed urngd # For nas targets DEFAULT_PACKAGES.nas:=block-mount fdisk lsblk mdadm # For router targets -DEFAULT_PACKAGES.router:=dnsmasq iptables ip6tables ppp ppp-mod-pppoa ppp-mod-pppoe firewall odhcpd-ipv6only odhcp6c kmod-ipt-offload +DEFAULT_PACKAGES.router:=dnsmasq iptables ip6tables ppp ppp-mod-pppoe firewall odhcpd-ipv6only odhcp6c kmod-ipt-offload DEFAULT_PACKAGES.bootloader:= ifneq ($(DUMP),) @@ -51,7 +51,7 @@ else endif endif -ifneq ($(filter 3.18 4.9,$(KERNEL_PATCHVER)),) +ifneq ($(filter 4.9,$(KERNEL_PATCHVER)),) DEFAULT_PACKAGES.router:=$(filter-out kmod-ipt-offload,$(DEFAULT_PACKAGES.router)) endif @@ -183,26 +183,6 @@ ifeq ($(DUMP),1) endif ifneq ($(findstring arm,$(ARCH)),) CPU_TYPE ?= xscale - CPU_CFLAGS_arm920t = -mcpu=arm920t - CPU_CFLAGS_arm926ej-s = -mcpu=arm926ej-s - CPU_CFLAGS_arm1136j-s = -mcpu=arm1136j-s - CPU_CFLAGS_arm1176jzf-s = -mcpu=arm1176jzf-s - CPU_CFLAGS_cortex-a5 = -mcpu=cortex-a5 - CPU_CFLAGS_cortex-a7 = -mcpu=cortex-a7 - CPU_CFLAGS_cortex-a8 = -mcpu=cortex-a8 - CPU_CFLAGS_cortex-a9 = -mcpu=cortex-a9 - CPU_CFLAGS_cortex-a15 = -mcpu=cortex-a15 - CPU_CFLAGS_cortex-a53 = -mcpu=cortex-a53 - CPU_CFLAGS_cortex-a72 = -mcpu=cortex-a72 - CPU_CFLAGS_fa526 = -mcpu=fa526 - CPU_CFLAGS_mpcore = -mcpu=mpcore - CPU_CFLAGS_xscale = -mcpu=xscale - ifeq ($(CONFIG_SOFT_FLOAT),) - CPU_CFLAGS_neon = -mfpu=neon - CPU_CFLAGS_vfp = -mfpu=vfp - CPU_CFLAGS_vfpv3 = -mfpu=vfpv3-d16 - CPU_CFLAGS_neon-vfpv4 = -mfpu=neon-vfpv4 - endif endif ifeq ($(ARCH),powerpc) CPU_CFLAGS_603e:=-mcpu=603e @@ -245,6 +225,9 @@ ifeq ($(DUMP),1) .SILENT: $(TMP_CONFIG) .PRECIOUS: $(TMP_CONFIG) + ifdef KERNEL_TESTING_PATCHVER + FEATURES += testing-kernel + endif ifneq ($(CONFIG_OF),) FEATURES += dt endif @@ -303,6 +286,7 @@ define BuildTargets/DumpCurrent echo 'Target-Optimization: $(if $(CFLAGS),$(CFLAGS),$(DEFAULT_CFLAGS))'; \ echo 'CPU-Type: $(CPU_TYPE)$(if $(CPU_SUBTYPE),+$(CPU_SUBTYPE))'; \ echo 'Linux-Version: $(LINUX_VERSION)'; \ + $(if $(LINUX_TESTING_VERSION),echo 'Linux-Testing-Version: $(LINUX_TESTING_VERSION)';) \ echo 'Linux-Release: $(LINUX_RELEASE)'; \ echo 'Linux-Kernel-Arch: $(LINUX_KARCH)'; \ $(if $(SUBTARGET),,$(if $(DEFAULT_SUBTARGET), echo 'Default-Subtarget: $(DEFAULT_SUBTARGET)'; )) \ diff --git a/include/unpack.mk b/include/unpack.mk index a139827490..6141b1c722 100644 --- a/include/unpack.mk +++ b/include/unpack.mk @@ -58,18 +58,13 @@ ifeq ($(strip $(UNPACK_CMD)),) UNPACK_CMD=gzip -dc $(DL_DIR)/$(PKG_SOURCE) | $(TAR_CMD) endif endif - ifneq ($(strip $(CRLF_WORKAROUND)),) - CRLF_CMD := && find $(PKG_BUILD_DIR) -type f -print0 | xargs -0 perl -pi -e 's!\r$$$$!!g' - else - CRLF_CMD := - endif endif ifdef PKG_BUILD_DIR - PKG_UNPACK ?= $(SH_FUNC) $(call UNPACK_CMD,$(PKG_BUILD_DIR)) $(call CRLF_CMD,$(PKG_BUILD_DIR)) + PKG_UNPACK ?= $(SH_FUNC) $(call UNPACK_CMD,$(PKG_BUILD_DIR)) endif ifdef HOST_BUILD_DIR - HOST_UNPACK ?= $(SH_FUNC) $(call UNPACK_CMD,$(HOST_BUILD_DIR)) $(call CRLF_CMD,$(HOST_BUILD_DIR)) + HOST_UNPACK ?= $(SH_FUNC) $(call UNPACK_CMD,$(HOST_BUILD_DIR)) endif endif # PKG_SOURCE diff --git a/include/version.mk b/include/version.mk index 3cad216aa5..b9a95d6a8a 100644 --- a/include/version.mk +++ b/include/version.mk @@ -26,13 +26,13 @@ PKG_CONFIG_DEPENDS += \ sanitize = $(call tolower,$(subst _,-,$(subst $(space),-,$(1)))) VERSION_NUMBER:=$(call qstrip,$(CONFIG_VERSION_NUMBER)) -VERSION_NUMBER:=$(if $(VERSION_NUMBER),$(VERSION_NUMBER),v1.5) +VERSION_NUMBER:=$(if $(VERSION_NUMBER),$(VERSION_NUMBER),v1.5.0) VERSION_CODE:=$(call qstrip,$(CONFIG_VERSION_CODE)) VERSION_CODE:=$(if $(VERSION_CODE),$(VERSION_CODE),$(REVISION)) VERSION_REPO:=$(call qstrip,$(CONFIG_VERSION_REPO)) -VERSION_REPO:=$(if $(VERSION_REPO),$(VERSION_REPO),https://librecmc.org/librecmc/downloads/snapshots/beta/%v) +VERSION_REPO:=$(if $(VERSION_REPO),$(VERSION_REPO),https://librecmc.org/librecmc/downloads/snapshots/%v) VERSION_DIST:=$(call qstrip,$(CONFIG_VERSION_DIST)) VERSION_DIST:=$(if $(VERSION_DIST),$(VERSION_DIST),libreCMC) @@ -42,10 +42,10 @@ VERSION_MANUFACTURER:=$(call qstrip,$(CONFIG_VERSION_MANUFACTURER)) VERSION_MANUFACTURER:=$(if $(VERSION_MANUFACTURER),$(VERSION_MANUFACTURER),libreCMC) VERSION_MANUFACTURER_URL:=$(call qstrip,$(CONFIG_VERSION_MANUFACTURER_URL)) -VERSION_MANUFACTURER_URL:=$(if $(VERSION_MANUFACTURER_URL),$(VERSION_MANUFACTURER_URL),https://librecmc.org/) +VERSION_MANUFACTURER_URL:=$(if $(VERSION_MANUFACTURER_URL),$(VERSION_MANUFACTURER_URL),https://openwrt.org/) VERSION_BUG_URL:=$(call qstrip,$(CONFIG_VERSION_BUG_URL)) -VERSION_BUG_URL:=$(if $(VERSION_BUG_URL),$(VERSION_BUG_URL),https://gogs.librecmc.org/libreCMC/libreCMC/issues) +VERSION_BUG_URL:=$(if $(VERSION_BUG_URL),$(VERSION_BUG_URL),https://git.gnu.io/librecmc/librecmc/issues/) VERSION_HOME_URL:=$(call qstrip,$(CONFIG_VERSION_HOME_URL)) VERSION_HOME_URL:=$(if $(VERSION_HOME_URL),$(VERSION_HOME_URL),https://librecmc.org/) diff --git a/package/Makefile b/package/Makefile index abbf5f91f2..58c1ba2bbf 100644 --- a/package/Makefile +++ b/package/Makefile @@ -84,8 +84,12 @@ $(curdir)/index: FORCE mkdir -p $$d; \ cd $$d || continue; \ $(SCRIPT_DIR)/ipkg-make-index.sh . 2>&1 > Packages.manifest; \ - grep -vE '^(Maintainer|LicenseFiles|Source|SourceName|Require)' Packages.manifest > Packages && \ - gzip -9nc Packages > Packages.gz; \ + grep -vE '^(Maintainer|LicenseFiles|Source|SourceName|Require)' Packages.manifest > Packages; \ + case "$$(((64 + $$(stat -L -c%s Packages)) % 128))" in 110|111) \ + $(call ERROR_MESSAGE,WARNING: Applying padding in $$d/Packages to workaround usign SHA-512 bug!); \ + { echo ""; echo ""; } >> Packages;; \ + esac; \ + gzip -9nc Packages > Packages.gz; \ ); done ifdef CONFIG_SIGNED_PACKAGES @echo Signing package index... diff --git a/package/base-files/Makefile b/package/base-files/Makefile index 01417b5cf6..830aeb8ba8 100644 --- a/package/base-files/Makefile +++ b/package/base-files/Makefile @@ -12,7 +12,7 @@ include $(INCLUDE_DIR)/version.mk include $(INCLUDE_DIR)/feeds.mk PKG_NAME:=base-files -PKG_RELEASE:=197 +PKG_RELEASE:=198 PKG_FLAGS:=nonshared PKG_FILE_DEPENDS:=$(PLATFORM_DIR)/ $(GENERIC_PLATFORM_DIR)/base-files/ @@ -37,12 +37,21 @@ endif define Package/base-files SECTION:=base CATEGORY:=Base system - DEPENDS:=+netifd +libc +procd +jsonfilter +SIGNED_PACKAGES:usign +SIGNED_PACKAGES:librecmc-keyring +NAND_SUPPORT:ubi-utils +fstools +fwtool + DEPENDS:=+netifd +libc +procd +jsonfilter +SIGNED_PACKAGES:usign +SIGNED_PACKAGES:openwrt-keyring +NAND_SUPPORT:ubi-utils +fstools +fwtool TITLE:=Base filesystem for libreCMC URL:=http://openwrt.org/ VERSION:=$(PKG_RELEASE)-$(REVISION) endef +define Package/urandom-seed + SECTION:=base + CATEGORY:=Base system + DEPENDS:=+libc +ubox-getrandom + TITLE:=/etc/urandom.seed handling for libreCMC + URL:=http://openwrt.org/ + VERSION:=$(PKG_RELEASE)-$(REVISION) +endef + define Package/base-files/conffiles /etc/config/ /etc/config/network diff --git a/package/base-files/files/bin/config_generate b/package/base-files/files/bin/config_generate index 707f791bb7..62e928dc21 100755 --- a/package/base-files/files/bin/config_generate +++ b/package/base-files/files/bin/config_generate @@ -213,7 +213,8 @@ generate_switch() { json_select switch json_select "$key" - json_get_vars enable reset blinkrate cpu_port + json_get_vars enable reset blinkrate cpu_port \ + ar8xxx_mib_type ar8xxx_mib_poll_interval uci -q batch <<-EOF add network switch @@ -221,6 +222,8 @@ generate_switch() { set network.@switch[-1].reset='$reset' set network.@switch[-1].enable_vlan='$enable' set network.@switch[-1].blinkrate='$blinkrate' + set network.@switch[-1].ar8xxx_mib_type='$ar8xxx_mib_type' + set network.@switch[-1].ar8xxx_mib_poll_interval='$ar8xxx_mib_poll_interval' EOF generate_switch_vlans_ports "$1" diff --git a/package/base-files/files/etc/group b/package/base-files/files/etc/group index e8e2adf4ac..5b06dc6db9 100644 --- a/package/base-files/files/etc/group +++ b/package/base-files/files/etc/group @@ -1,8 +1,8 @@ root:x:0: daemon:x:1: adm:x:4: -tty:x:5: mail:x:8: +dialout:x:20: audio:x:29: www-data:x:33: ftp:x:55: diff --git a/package/base-files/files/etc/rc.button/reboot b/package/base-files/files/etc/rc.button/reboot new file mode 100755 index 0000000000..cd547e3329 --- /dev/null +++ b/package/base-files/files/etc/rc.button/reboot @@ -0,0 +1,12 @@ +#!/bin/sh + +[ "${ACTION}" = "released" ] || exit 0 + +if [ "$SEEN" -ge 5 ] +then + echo "REBOOT" > /dev/console + sync + reboot +fi + +return 0 diff --git a/package/base-files/files/etc/rc.common b/package/base-files/files/etc/rc.common index d9773a0c5a..75dbeedf34 100755 --- a/package/base-files/files/etc/rc.common +++ b/package/base-files/files/etc/rc.common @@ -131,6 +131,9 @@ ${INIT_TRACE:+set -x} procd_lock stop_service "$@" procd_kill "$(basename ${basescript:-$initscript})" "$1" + if eval "type service_stopped" 2>/dev/null >/dev/null; then + service_stopped + fi } reload() { diff --git a/package/base-files/files/lib/functions/migrations.sh b/package/base-files/files/lib/functions/migrations.sh new file mode 100644 index 0000000000..b180a0242f --- /dev/null +++ b/package/base-files/files/lib/functions/migrations.sh @@ -0,0 +1,39 @@ +#!/bin/sh + +. /lib/functions.sh + +migrate_led_sysfs() { + local cfg="$1"; shift + local tuples="$@" + local sysfs + local name + + config_get sysfs ${cfg} sysfs + config_get name ${cfg} name + + [ -z "${sysfs}" ] && return + + for tuple in ${tuples}; do + local old=${tuple%=*} + local new=${tuple#*=} + local new_sysfs + + new_sysfs=$(echo ${sysfs} | sed "s/${old}/${new}/") + + [ "${new_sysfs}" = "${sysfs}" ] && continue + + uci set system.${cfg}.sysfs="${new_sysfs}" + + logger -t led-migration "sysfs option of LED \"${name}\" updated to ${new_sysfs}" + done; +} + +migrate_leds() { + config_load system + config_foreach migrate_led_sysfs led "$@" +} + +migrations_apply() { + local realm="$1" + [ -n "$(uci changes ${realm})" ] && uci -q commit ${realm} +} diff --git a/package/base-files/files/lib/functions/system.sh b/package/base-files/files/lib/functions/system.sh index 7ed62804a0..9b9d03df7b 100644 --- a/package/base-files/files/lib/functions/system.sh +++ b/package/base-files/files/lib/functions/system.sh @@ -4,7 +4,7 @@ get_mac_binary() { local path="$1" local offset="$2" - if [ -z "$path" ]; then + if ! [ -e "$path" ]; then echo "get_mac_binary: file $path not found!" >&2 return fi diff --git a/package/base-files/files/lib/functions/uci-defaults.sh b/package/base-files/files/lib/functions/uci-defaults.sh index 315df7b708..2fb7555969 100755 --- a/package/base-files/files/lib/functions/uci-defaults.sh +++ b/package/base-files/files/lib/functions/uci-defaults.sh @@ -182,6 +182,19 @@ _ucidef_finish_switch_roles() { done } +ucidef_set_ar8xxx_switch_mib() { + local name="$1" + local type="$2" + local interval="$3" + + json_select_object switch + json_select_object "$name" + json_add_int ar8xxx_mib_type $type + json_add_int ar8xxx_mib_poll_interval $interval + json_select .. + json_select .. +} + ucidef_add_switch() { local name="$1"; shift local port num role device index need_tag prev_role @@ -463,6 +476,7 @@ _ucidef_set_led_timer() { _ucidef_set_led_common "$1" "$2" "$3" + json_add_string type "$trigger_name" json_add_string trigger "$trigger_name" json_add_int delayon "$delayon" json_add_int delayoff "$delayoff" diff --git a/package/base-files/files/lib/upgrade/common.sh b/package/base-files/files/lib/upgrade/common.sh index b3a29fb32e..bbedeefd26 100644 --- a/package/base-files/files/lib/upgrade/common.sh +++ b/package/base-files/files/lib/upgrade/common.sh @@ -101,35 +101,41 @@ get_magic_long() { } export_bootdevice() { - local cmdline uuid disk uevent line + local cmdline bootdisk rootpart uuid blockdev uevent line local MAJOR MINOR DEVNAME DEVTYPE if read cmdline < /proc/cmdline; then case "$cmdline" in *block2mtd=*) - disk="${cmdline##*block2mtd=}" - disk="${disk%%,*}" + bootdisk="${cmdline##*block2mtd=}" + bootdisk="${bootdisk%%,*}" ;; *root=*) - disk="${cmdline##*root=}" - disk="${disk%% *}" + rootpart="${cmdline##*root=}" + rootpart="${rootpart%% *}" ;; esac - case "$disk" in - PARTUUID=[a-f0-9][a-f0-9][a-f0-9][a-f0-9][a-f0-9][a-f0-9][a-f0-9][a-f0-9]-02) - uuid="${disk#PARTUUID=}" - uuid="${uuid%-02}" - for disk in $(find /dev -type b); do - set -- $(dd if=$disk bs=1 skip=440 count=4 2>/dev/null | hexdump -v -e '4/1 "%02x "') + case "$bootdisk" in + /dev/*) + uevent="/sys/class/block/${bootdisk##*/}/uevent" + ;; + esac + + case "$rootpart" in + PARTUUID=[a-f0-9][a-f0-9][a-f0-9][a-f0-9][a-f0-9][a-f0-9][a-f0-9][a-f0-9]-[a-f0-9][a-f0-9]) + uuid="${rootpart#PARTUUID=}" + uuid="${uuid%-[a-f0-9][a-f0-9]}" + for blockdev in $(find /dev -type b); do + set -- $(dd if=$blockdev bs=1 skip=440 count=4 2>/dev/null | hexdump -v -e '4/1 "%02x "') if [ "$4$3$2$1" = "$uuid" ]; then - uevent="/sys/class/block/${disk##*/}/uevent" + uevent="/sys/class/block/${blockdev##*/}/uevent" break fi done ;; /dev/*) - uevent="/sys/class/block/${disk##*/}/uevent" + uevent="/sys/class/block/${rootpart##*/}/../uevent" ;; esac diff --git a/package/base-files/files/usr/lib/os-release b/package/base-files/files/usr/lib/os-release index 9e8fd87fb7..f71ffe9ed4 100644 --- a/package/base-files/files/usr/lib/os-release +++ b/package/base-files/files/usr/lib/os-release @@ -8,11 +8,11 @@ HOME_URL="%u" BUG_URL="%b" SUPPORT_URL="%s" BUILD_ID="%R" -LEDE_BOARD="%S" -LEDE_ARCH="%A" -LEDE_TAINTS="%t" -LEDE_DEVICE_MANUFACTURER="%M" -LEDE_DEVICE_MANUFACTURER_URL="%m" -LEDE_DEVICE_PRODUCT="%P" -LEDE_DEVICE_REVISION="%h" -LEDE_RELEASE="%D %V %C" +LIBRECMC_BOARD="%S" +LIBRECMC_ARCH="%A" +LIBRECMC_TAINTS="%t" +LIBRECMC_DEVICE_MANUFACTURER="%M" +LIBRECMC_DEVICE_MANUFACTURER_URL="%m" +LIBRECMC_DEVICE_PRODUCT="%P" +LIBRECMC_DEVICE_REVISION="%h" +LIBRECMC_RELEASE="%D %V %C" diff --git a/package/base-files/image-config.in b/package/base-files/image-config.in index 49d2103da9..7a239c8c89 100644 --- a/package/base-files/image-config.in +++ b/package/base-files/image-config.in @@ -183,7 +183,7 @@ if VERSIONOPT config VERSION_REPO string prompt "Release repository" - default "http://downloads.lede-project.org/snapshots" + default "http://downloads.openwrt.org/releases/19.07-SNAPSHOT" help This is the repository address embedded in the image, it defaults to the trunk snapshot repo; the url may contain the following placeholders: diff --git a/package/boot/uboot-envtools/files/ath79 b/package/boot/uboot-envtools/files/ath79 index bf8ca2f7cd..069d7be06b 100644 --- a/package/boot/uboot-envtools/files/ath79 +++ b/package/boot/uboot-envtools/files/ath79 @@ -17,11 +17,16 @@ buffalo,wzr-hp-ag300h) ubootenv_add_uci_config "/dev/mtd3" "0x0" "0x10000" "0x10000" ;; buffalo,bhr-4grv2|\ +engenius,ecb1750|\ glinet,gl-ar300m-nand|\ glinet,gl-ar300m-nor|\ +librerouter,librerouter-v1|\ +netgear,ex6400|\ +netgear,ex7300|\ ocedo,koala|\ ocedo,raccoon|\ -openmesh,om5p-ac-v2) +openmesh,om5p-ac-v2|\ +yuncore,a770) ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x10000" "0x10000" ;; esac diff --git a/package/boot/uboot-envtools/files/imx6 b/package/boot/uboot-envtools/files/imx6 index fec8ce0aa4..fb05f13346 100644 --- a/package/boot/uboot-envtools/files/imx6 +++ b/package/boot/uboot-envtools/files/imx6 @@ -7,12 +7,16 @@ touch /etc/config/ubootenv +. /lib/imx6.sh . /lib/uboot-envtools.sh . /lib/functions.sh board=$(board_name) case "$board" in +apalis*) + ubootenv_add_uci_config $(bootdev_from_uuid)boot0 -0x2200 0x2000 0x200 10 + ;; *gw5*) if [ -c /dev/mtd1 ]; then # board boots from NAND diff --git a/package/boot/uboot-envtools/files/ipq40xx b/package/boot/uboot-envtools/files/ipq40xx index c16e60bac5..7bcad00b01 100644 --- a/package/boot/uboot-envtools/files/ipq40xx +++ b/package/boot/uboot-envtools/files/ipq40xx @@ -40,6 +40,9 @@ openmesh,a62) linksys,ea6350v3) ubootenv_add_uci_config "/dev/mtd7" "0x0" "0x20000" "0x20000" ;; +linksys,ea8300) + ubootenv_add_uci_config "/dev/mtd7" "0x0" "0x40000" "0x20000" + ;; zyxel,nbg6617) ubootenv_add_uci_config "/dev/mtd6" "0x0" "0x10000" "0x10000" ;; diff --git a/package/boot/uboot-envtools/files/mvebu b/package/boot/uboot-envtools/files/mvebu index 7d16a59666..c2e746d959 100644 --- a/package/boot/uboot-envtools/files/mvebu +++ b/package/boot/uboot-envtools/files/mvebu @@ -14,25 +14,28 @@ touch /etc/config/ubootenv board=$(board_name) case "$board" in -armada-385-linksys-caiman|\ -armada-385-linksys-cobra|\ -armada-385-linksys-shelby) - ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x20000" "0x40000" - ;; -armada-385-linksys-rango|\ -armada-385-linksys-venom) - ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x20000" "0x20000" - ;; -armada-385-turris-omnia) +cznic,turris-omnia) ubootenv_add_uci_config "/dev/mtd0" "0xC0000" "0x10000" "0x40000" ;; -armada-xp-linksys-mamba) - ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x40000" "0x20000" - ;; globalscale,espressobin|\ +globalscale,espressobin-emmc|\ +globalscale,espressobin-v7|\ +globalscale,espressobin-v7-emmc|\ marvell,armada8040-mcbin) ubootenv_add_uci_config "/dev/mtd0" "0x3f0000" "0x10000" "0x10000" "1" ;; +linksys,caiman|\ +linksys,cobra|\ +linksys,shelby) + ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x20000" "0x40000" + ;; +linksys,mamba) + ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x40000" "0x20000" + ;; +linksys,rango|\ +linksys,venom) + ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x20000" "0x20000" + ;; esac config_load ubootenv diff --git a/package/boot/uboot-envtools/files/oxnas b/package/boot/uboot-envtools/files/oxnas index e54fae8173..4427bb50c9 100644 --- a/package/boot/uboot-envtools/files/oxnas +++ b/package/boot/uboot-envtools/files/oxnas @@ -14,10 +14,12 @@ board=$(board_name) case "$board" in "cloudengines,pogoplug"* | \ -"mitrastar,stg-212" | \ "shuttle,kd20") ubootenv_add_uci_config "/dev/mtd2" "0x0" "0x2000" "0x2000" "1" ;; +"mitrastar,stg-212") + ubootenv_add_uci_config "/dev/mtd2" "0x0" "0x20000" "0x20000" "1" + ;; esac config_load ubootenv diff --git a/package/boot/uboot-envtools/files/ramips b/package/boot/uboot-envtools/files/ramips index 6b539ef6d8..589e602f4c 100644 --- a/package/boot/uboot-envtools/files/ramips +++ b/package/boot/uboot-envtools/files/ramips @@ -14,7 +14,8 @@ board=$(board_name) case "$board" in alfa-network,ac1200rm|\ -alfa-network,awusfree1) +alfa-network,awusfree1|\ +alfa-network,tube-e4g) ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x1000" "0x1000" ;; all0256n-4M|\ @@ -30,7 +31,8 @@ wsr-600|\ zbt-wg2626) ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x1000" "0x10000" ;; -mir3g) +xiaomi,mir3p|\ +xiaomi,mir3g) ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x1000" "0x20000" ;; esac diff --git a/package/boot/uboot-sunxi/Makefile b/package/boot/uboot-sunxi/Makefile index 1e3883dfb4..6b83bd27c6 100644 --- a/package/boot/uboot-sunxi/Makefile +++ b/package/boot/uboot-sunxi/Makefile @@ -9,9 +9,9 @@ include $(TOPDIR)/rules.mk include $(INCLUDE_DIR)/kernel.mk -PKG_VERSION:=2018.11 +PKG_VERSION:=2019.01 -PKG_HASH:=737c93f2ea03fec669e840dbee32bcf6238e6924ff5f20e4f1c472ee24e5d37e +PKG_HASH:=50bd7e5a466ab828914d080d5f6a432345b500e8fba1ad3b7b61e95e60d51c22 PKG_MAINTAINER:=Zoltan HERPAI @@ -168,6 +168,12 @@ define U-Boot/orangepi_pc BUILD_DEVICES:=sun8i-h3-orangepi-pc endef +define U-Boot/orangepi_pc_plus + BUILD_SUBTARGET:=cortexa7 + NAME:=Orange Pi PC Plus (H3) + BUILD_DEVICES:=sun8i-h3-orangepi-pc-plus +endef + define U-Boot/orangepi_plus BUILD_SUBTARGET:=cortexa7 NAME:=Orange Pi Plus (H3) @@ -268,6 +274,7 @@ UBOOT_TARGETS := \ orangepi_r1 \ orangepi_one \ orangepi_pc \ + orangepi_pc_plus \ orangepi_plus \ orangepi_2 \ orangepi_pc2 \ diff --git a/package/boot/uboot-sunxi/patches/003-add-theobroma-a31-pangolin.patch b/package/boot/uboot-sunxi/patches/003-add-theobroma-a31-pangolin.patch index 565ecf7643..899bcb1299 100644 --- a/package/boot/uboot-sunxi/patches/003-add-theobroma-a31-pangolin.patch +++ b/package/boot/uboot-sunxi/patches/003-add-theobroma-a31-pangolin.patch @@ -1,6 +1,6 @@ --- a/arch/arm/dts/Makefile +++ b/arch/arm/dts/Makefile -@@ -306,6 +306,7 @@ dtb-$(CONFIG_MACH_SUN6I) += \ +@@ -313,6 +313,7 @@ dtb-$(CONFIG_MACH_SUN6I) += \ sun6i-a31-m9.dtb \ sun6i-a31-mele-a1000g-quad.dtb \ sun6i-a31-mixtile-loftq.dtb \ @@ -358,7 +358,7 @@ +CONFIG_SUNXI_SPI=y --- a/arch/arm/mach-sunxi/Kconfig +++ b/arch/arm/mach-sunxi/Kconfig -@@ -872,6 +872,14 @@ config VIDEO_LCD_PANEL_I2C_SCL +@@ -875,6 +875,14 @@ config VIDEO_LCD_PANEL_I2C_SCL Set the SCL pin for the LCD i2c interface. This takes a string in the format understood by sunxi_name_to_gpio, e.g. PH1 for pin 1 of port H. diff --git a/package/boot/uboot-sunxi/patches/062-A20-improve-gmac-upload.patch b/package/boot/uboot-sunxi/patches/062-A20-improve-gmac-upload.patch index 1759ef1c37..a1caf18a18 100644 --- a/package/boot/uboot-sunxi/patches/062-A20-improve-gmac-upload.patch +++ b/package/boot/uboot-sunxi/patches/062-A20-improve-gmac-upload.patch @@ -8,5 +8,5 @@ CONFIG_SUN7I_GMAC=y +CONFIG_GMAC_TX_DELAY=1 CONFIG_AXP_ALDO3_VOLT=2800 - CONFIG_AXP_ALDO4_VOLT=2800 - CONFIG_SCSI=y + CONFIG_AXP_ALDO3_VOLT_SLOPE_08=y + CONFIG_AXP_ALDO3_INRUSH_QUIRK=y diff --git a/package/boot/uboot-sunxi/patches/063-fix-lime2-revK-add-micrel-PHY.patch b/package/boot/uboot-sunxi/patches/063-fix-lime2-revK-add-micrel-PHY.patch new file mode 100644 index 0000000000..9ea0642537 --- /dev/null +++ b/package/boot/uboot-sunxi/patches/063-fix-lime2-revK-add-micrel-PHY.patch @@ -0,0 +1,44 @@ +--- a/configs/A20-OLinuXino-Lime2-eMMC_defconfig ++++ b/configs/A20-OLinuXino-Lime2-eMMC_defconfig +@@ -8,6 +8,8 @@ CONFIG_MMC_SUNXI_SLOT_EXTRA=2 + CONFIG_USB0_VBUS_PIN="PC17" + CONFIG_USB0_VBUS_DET="PH5" + CONFIG_I2C1_ENABLE=y ++CONFIG_PHY_MICREL=y ++CONFIG_PHY_MICREL_KSZ90X1=y + CONFIG_SATAPWR="PC3" + CONFIG_AHCI=y + CONFIG_NR_DRAM_BANKS=1 +--- a/configs/A20-OLinuXino-Lime2_defconfig ++++ b/configs/A20-OLinuXino-Lime2_defconfig +@@ -7,6 +7,8 @@ CONFIG_MMC0_CD_PIN="PH1" + CONFIG_USB0_VBUS_PIN="PC17" + CONFIG_USB0_VBUS_DET="PH5" + CONFIG_I2C1_ENABLE=y ++CONFIG_PHY_MICREL=y ++CONFIG_PHY_MICREL_KSZ90X1=y + CONFIG_SATAPWR="PC3" + CONFIG_AHCI=y + CONFIG_NR_DRAM_BANKS=1 +--- a/drivers/net/phy/micrel_ksz90x1.c ++++ b/drivers/net/phy/micrel_ksz90x1.c +@@ -13,6 +13,8 @@ + #include + #include + #include ++#include ++#include + + /* + * KSZ9021 - KSZ9031 common +@@ -329,6 +331,10 @@ static int ksz9031_phy_extwrite(struct p + static int ksz9031_config(struct phy_device *phydev) + { + int ret; ++ struct sunxi_ccm_reg *const ccm = ++ (struct sunxi_ccm_reg *)SUNXI_CCM_BASE; ++ ++ setbits_le32(&ccm->gmac_clk_cfg, CCM_GMAC_CTRL_TX_CLK_DELAY(4)); + + ret = ksz9031_of_config(phydev); + if (ret) diff --git a/package/boot/uboot-sunxi/patches/102-sunxi-make_CONS_INDEX-configurable.patch b/package/boot/uboot-sunxi/patches/102-sunxi-make_CONS_INDEX-configurable.patch index a3a0156668..4e35d582fa 100644 --- a/package/boot/uboot-sunxi/patches/102-sunxi-make_CONS_INDEX-configurable.patch +++ b/package/boot/uboot-sunxi/patches/102-sunxi-make_CONS_INDEX-configurable.patch @@ -6,7 +6,7 @@ Subject: ARM: sunxi: Make CONS_INDEX configurable --- a/arch/arm/mach-sunxi/Kconfig +++ b/arch/arm/mach-sunxi/Kconfig -@@ -535,6 +535,14 @@ config SYS_BOARD +@@ -538,6 +538,14 @@ config SYS_BOARD config SYS_SOC default "sunxi" diff --git a/package/boot/uboot-sunxi/patches/210-sunxi-deactivate-binman.patch b/package/boot/uboot-sunxi/patches/210-sunxi-deactivate-binman.patch index fe1821d9f8..d86097858a 100644 --- a/package/boot/uboot-sunxi/patches/210-sunxi-deactivate-binman.patch +++ b/package/boot/uboot-sunxi/patches/210-sunxi-deactivate-binman.patch @@ -12,7 +12,7 @@ old way of generating images. --- a/Makefile +++ b/Makefile -@@ -1255,8 +1255,10 @@ endif +@@ -1344,8 +1344,10 @@ endif ifneq ($(CONFIG_ARCH_SUNXI),) ifeq ($(CONFIG_ARM64),) @@ -27,7 +27,7 @@ old way of generating images. $(call if_changed,cat) --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig -@@ -820,7 +820,6 @@ config ARCH_SOCFPGA +@@ -842,7 +842,6 @@ config ARCH_SOCFPGA config ARCH_SUNXI bool "Support sunxi (Allwinner) SoCs" diff --git a/package/boot/uboot-xburst/Makefile b/package/boot/uboot-xburst/Makefile deleted file mode 100644 index 4113602a19..0000000000 --- a/package/boot/uboot-xburst/Makefile +++ /dev/null @@ -1,88 +0,0 @@ -# -# Copyright (C) 2010 OpenWrt.org -# -# This is free software, licensed under the GNU General Public License v2. -# See /LICENSE for more information. -# - -include $(TOPDIR)/rules.mk -include $(INCLUDE_DIR)/kernel.mk - -PKG_NAME:=u-boot -PKG_VERSION:=2012.10-rc2 -PKG_RELEASE:=1 - -PKG_BUILD_DIR:=$(KERNEL_BUILD_DIR)/$(PKG_NAME)-$(BUILD_VARIANT)/$(PKG_NAME)-$(PKG_VERSION) -PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2 -PKG_SOURCE_URL:= \ - http://mirror2.openwrt.org/sources \ - ftp://ftp.denx.de/pub/u-boot -PKG_HASH:=6d094cafa7ecea8b671fbdcd21130b6a4f5744fc47dd263e101ed5d3629dffd4 -PKG_TARGETS:=bin - -PKG_LICENSE:=GPL-2.0 GPL-2.0+ -PKG_LICENSE_FILES:=Licenses/README - -include $(INCLUDE_DIR)/package.mk - -define uboot/Default - TITLE:= - CONFIG:= - IMAGE:= -endef - -define uboot/qi_lb60 - TITLE:=U-boot for the qi_lb60 board -endef - -UBOOTS:=qi_lb60 - -define Package/uboot/template -define Package/uboot-xburst-$(1) - SECTION:=boot - CATEGORY:=Boot Loaders - DEPENDS:=@TARGET_xburst - TITLE:=$(2) - URL:=http://www.denx.de/wiki/UBoot/WebHome - VARIANT:=$(1) -endef -endef - -define BuildUbootPackage - $(eval $(uboot/Default)) - $(eval $(uboot/$(1))) - $(call Package/uboot/template,$(1),$(TITLE)) -endef - - -ifdef BUILD_VARIANT -$(eval $(call uboot/$(BUILD_VARIANT))) -UBOOT_CONFIG:=$(if $(CONFIG),$(CONFIG),$(BUILD_VARIANT)) -UBOOT_IMAGE:=$(if $(IMAGE),$(IMAGE),librecmc-$(BOARD)-$(BUILD_VARIANT)-u-boot.bin) -endif - -define Build/Configure - $(MAKE) -C $(PKG_BUILD_DIR) \ - $(UBOOT_CONFIG)_config -endef - -define Build/Compile - $(MAKE) -C $(PKG_BUILD_DIR) \ - CROSS_COMPILE=$(TARGET_CROSS) -endef - -define Package/uboot/install/template -define Package/uboot-xburst-$(1)/install - $(CP) $(PKG_BUILD_DIR)/u-boot-xburst.bin $(BIN_DIR)/$(2) - rmdir $$(1) -endef -endef - -$(foreach u,$(UBOOTS), \ - $(eval $(call Package/uboot/install/template,$(u),librecmc-$(BOARD)-$(u)-u-boot.bin)) \ -) - -$(foreach u,$(UBOOTS), \ - $(eval $(call BuildUbootPackage,$(u))) \ - $(eval $(call BuildPackage,uboot-xburst-$(u))) \ -) diff --git a/package/boot/uboot-xburst/patches/0001-qi_lb60-add-nand-spl-support.patch b/package/boot/uboot-xburst/patches/0001-qi_lb60-add-nand-spl-support.patch deleted file mode 100644 index e770243528..0000000000 --- a/package/boot/uboot-xburst/patches/0001-qi_lb60-add-nand-spl-support.patch +++ /dev/null @@ -1,894 +0,0 @@ -From 0329cf7965956a5a7044827e0ce88ae8d5150e54 Mon Sep 17 00:00:00 2001 -From: Xiangfu -Date: Fri, 12 Oct 2012 09:46:58 +0800 -Subject: [PATCH 1/6] qi_lb60: add nand spl support - - The JZ4740 CPU can load 8KB from two different addresses: - 1. the normal area up to 8KB starting from NAND flash address 0x00000000 - 2. the backup area up to 8KB starting from NAND flash address 0x00002000 - -Signed-off-by: Xiangfu ---- - Makefile | 12 +++ - arch/mips/cpu/xburst/Makefile | 7 +- - arch/mips/cpu/xburst/cpu.c | 4 + - arch/mips/cpu/xburst/jz4740.c | 82 +++++++---------- - arch/mips/cpu/xburst/spl/Makefile | 47 ++++++++++ - arch/mips/cpu/xburst/spl/start.S | 63 +++++++++++++ - board/qi/qi_lb60/Makefile | 4 + - board/qi/qi_lb60/qi_lb60-spl.c | 30 +++++++ - board/qi/qi_lb60/qi_lb60.c | 8 +- - board/qi/qi_lb60/u-boot-spl.lds | 61 +++++++++++++ - drivers/mtd/nand/jz4740_nand.c | 39 ++++++++- - include/configs/qi_lb60.h | 175 ++++++++++++++++++------------------- - 12 files changed, 386 insertions(+), 146 deletions(-) - create mode 100644 arch/mips/cpu/xburst/spl/Makefile - create mode 100644 arch/mips/cpu/xburst/spl/start.S - create mode 100644 board/qi/qi_lb60/qi_lb60-spl.c - create mode 100644 board/qi/qi_lb60/u-boot-spl.lds - -diff --git a/Makefile b/Makefile -index 34d9075..a22778e 100644 ---- a/Makefile -+++ b/Makefile -@@ -393,6 +393,10 @@ ALL-y += $(obj)u-boot-nodtb-tegra.bin - endif - endif - -+ifeq ($(CPU),xburst) -+ALL-y += $(obj)u-boot-xburst.bin -+endif -+ - all: $(ALL-y) $(SUBDIR_EXAMPLES) - - $(obj)u-boot.dtb: $(obj)u-boot -@@ -506,6 +510,14 @@ $(obj)u-boot-nodtb-tegra.bin: $(obj)spl/u-boot-spl.bin $(obj)u-boot.bin - endif - endif - -+ifeq ($(CPU),xburst) -+$(obj)u-boot-xburst.bin: $(obj)spl/u-boot-spl.bin $(obj)u-boot.bin -+ dd if=$(obj)spl/u-boot-spl.bin of=$(obj)spl/u-boot-pad.bin conv=sync bs=8192 count=1 -+ dd if=$(obj)spl/u-boot-spl.bin of=$(obj)spl/u-boot-pad.bin conv=sync,notrunc oflag=append bs=8192 count=1 -+ tr '\0' '\377' < /dev/zero | dd of=$(obj)spl/u-boot-pad.bin conv=sync,notrunc oflag=append bs=16384 count=1 -+ cat $(obj)spl/u-boot-pad.bin u-boot.bin > $@ -+endif -+ - ifeq ($(CONFIG_SANDBOX),y) - GEN_UBOOT = \ - cd $(LNDIR) && $(CC) $(SYMS) -T $(obj)u-boot.lds \ -diff --git a/arch/mips/cpu/xburst/Makefile b/arch/mips/cpu/xburst/Makefile -index b1f2ae4..ec35e55 100644 ---- a/arch/mips/cpu/xburst/Makefile -+++ b/arch/mips/cpu/xburst/Makefile -@@ -24,9 +24,12 @@ include $(TOPDIR)/config.mk - - LIB = $(obj)lib$(CPU).o - -+COBJS-y = cpu.o jz_serial.o -+ -+ifneq ($(CONFIG_SPL_BUILD),y) - START = start.o --SOBJS-y = --COBJS-y = cpu.o timer.o jz_serial.o -+COBJS-y += timer.o -+endif - - COBJS-$(CONFIG_JZ4740) += jz4740.o - -diff --git a/arch/mips/cpu/xburst/cpu.c b/arch/mips/cpu/xburst/cpu.c -index ddcbfaa..1432838 100644 ---- a/arch/mips/cpu/xburst/cpu.c -+++ b/arch/mips/cpu/xburst/cpu.c -@@ -42,6 +42,8 @@ - : \ - : "i" (op), "R" (*(unsigned char *)(addr))) - -+#ifndef CONFIG_SPL_BUILD -+ - void __attribute__((weak)) _machine_restart(void) - { - struct jz4740_wdt *wdt = (struct jz4740_wdt *)JZ4740_WDT_BASE; -@@ -109,6 +111,8 @@ void invalidate_dcache_range(ulong start_addr, ulong stop) - cache_op(Hit_Invalidate_D, addr); - } - -+#endif -+ - void flush_icache_all(void) - { - u32 addr, t = 0; -diff --git a/arch/mips/cpu/xburst/jz4740.c b/arch/mips/cpu/xburst/jz4740.c -index c0b9817..8816aa3 100644 ---- a/arch/mips/cpu/xburst/jz4740.c -+++ b/arch/mips/cpu/xburst/jz4740.c -@@ -32,31 +32,19 @@ int disable_interrupts(void) - return 0; - } - --/* -- * PLL output clock = EXTAL * NF / (NR * NO) -- * NF = FD + 2, NR = RD + 2 -- * NO = 1 (if OD = 0), NO = 2 (if OD = 1 or 2), NO = 4 (if OD = 3) -- */ - void pll_init(void) - { - struct jz4740_cpm *cpm = (struct jz4740_cpm *)JZ4740_CPM_BASE; - -- register unsigned int cfcr, plcr1; -- int n2FR[33] = { -- 0, 0, 1, 2, 3, 0, 4, 0, 5, 0, 0, 0, 6, 0, 0, 0, -- 7, 0, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, -- 9 -- }; -- int div[5] = {1, 3, 3, 3, 3}; /* divisors of I:S:P:L:M */ -- int nf, pllout2; -+ register unsigned int cfcr, plcr; -+ unsigned int nf, pllout2; - - cfcr = CPM_CPCCR_CLKOEN | -- CPM_CPCCR_PCS | -- (n2FR[div[0]] << CPM_CPCCR_CDIV_BIT) | -- (n2FR[div[1]] << CPM_CPCCR_HDIV_BIT) | -- (n2FR[div[2]] << CPM_CPCCR_PDIV_BIT) | -- (n2FR[div[3]] << CPM_CPCCR_MDIV_BIT) | -- (n2FR[div[4]] << CPM_CPCCR_LDIV_BIT); -+ (0 << CPM_CPCCR_CDIV_BIT) | -+ (2 << CPM_CPCCR_HDIV_BIT) | -+ (2 << CPM_CPCCR_PDIV_BIT) | -+ (2 << CPM_CPCCR_MDIV_BIT) | -+ (2 << CPM_CPCCR_LDIV_BIT); - - pllout2 = (cfcr & CPM_CPCCR_PCS) ? - CONFIG_SYS_CPU_SPEED : (CONFIG_SYS_CPU_SPEED / 2); -@@ -65,15 +53,18 @@ void pll_init(void) - writel(pllout2 / 48000000 - 1, &cpm->uhccdr); - - nf = CONFIG_SYS_CPU_SPEED * 2 / CONFIG_SYS_EXTAL; -- plcr1 = ((nf - 2) << CPM_CPPCR_PLLM_BIT) | /* FD */ -+ plcr = ((nf - 2) << CPM_CPPCR_PLLM_BIT) | /* FD */ - (0 << CPM_CPPCR_PLLN_BIT) | /* RD=0, NR=2 */ - (0 << CPM_CPPCR_PLLOD_BIT) | /* OD=0, NO=1 */ -- (0x20 << CPM_CPPCR_PLLST_BIT) | /* PLL stable time */ -+ (0x32 << CPM_CPPCR_PLLST_BIT) | /* PLL stable time */ - CPM_CPPCR_PLLEN; /* enable PLL */ - - /* init PLL */ - writel(cfcr, &cpm->cpccr); -- writel(plcr1, &cpm->cppcr); -+ writel(plcr, &cpm->cppcr); -+ -+ while (!(readl(&cpm->cppcr) & CPM_CPPCR_PLLS)) -+ ; - } - - void sdram_init(void) -@@ -92,26 +83,12 @@ void sdram_init(void) - 2 << EMC_DMCR_TCL_BIT /* CAS latency is 3 */ - }; - -- int div[] = {1, 2, 3, 4, 6, 8, 12, 16, 24, 32}; -- - cpu_clk = CONFIG_SYS_CPU_SPEED; -- mem_clk = cpu_clk * div[__cpm_get_cdiv()] / div[__cpm_get_mdiv()]; -+ mem_clk = 84000000; - - writel(0, &emc->bcr); /* Disable bus release */ - writew(0, &emc->rtcsr); /* Disable clock for counting */ - -- /* Fault DMCR value for mode register setting*/ --#define SDRAM_ROW0 11 --#define SDRAM_COL0 8 --#define SDRAM_BANK40 0 -- -- dmcr0 = ((SDRAM_ROW0 - 11) << EMC_DMCR_RA_BIT) | -- ((SDRAM_COL0 - 8) << EMC_DMCR_CA_BIT) | -- (SDRAM_BANK40 << EMC_DMCR_BA_BIT) | -- (SDRAM_BW16 << EMC_DMCR_BW_BIT) | -- EMC_DMCR_EPIN | -- cas_latency_dmcr[((SDRAM_CASL == 3) ? 1 : 0)]; -- - /* Basic DMCR value */ - dmcr = ((SDRAM_ROW - 11) << EMC_DMCR_RA_BIT) | - ((SDRAM_COL - 8) << EMC_DMCR_CA_BIT) | -@@ -128,31 +105,31 @@ void sdram_init(void) - if (tmp > 11) - tmp = 11; - dmcr |= (tmp - 4) << EMC_DMCR_TRAS_BIT; -- tmp = SDRAM_RCD / ns; - -+ tmp = SDRAM_RCD / ns; - if (tmp > 3) - tmp = 3; - dmcr |= tmp << EMC_DMCR_RCD_BIT; -- tmp = SDRAM_TPC / ns; - -+ tmp = SDRAM_TPC / ns; - if (tmp > 7) - tmp = 7; - dmcr |= tmp << EMC_DMCR_TPC_BIT; -- tmp = SDRAM_TRWL / ns; - -+ tmp = SDRAM_TRWL / ns; - if (tmp > 3) - tmp = 3; - dmcr |= tmp << EMC_DMCR_TRWL_BIT; -- tmp = (SDRAM_TRAS + SDRAM_TPC) / ns; - -+ tmp = (SDRAM_TRAS + SDRAM_TPC) / ns; - if (tmp > 14) - tmp = 14; - dmcr |= ((tmp + 1) >> 1) << EMC_DMCR_TRC_BIT; - - /* SDRAM mode value */ -- sdmode = EMC_SDMR_BT_SEQ | -- EMC_SDMR_OM_NORMAL | -- EMC_SDMR_BL_4 | -+ sdmode = EMC_SDMR_BT_SEQ | -+ EMC_SDMR_OM_NORMAL | -+ EMC_SDMR_BL_4 | - cas_latency_sdmr[((SDRAM_CASL == 3) ? 1 : 0)]; - - /* Stage 1. Precharge all banks by writing SDMR with DMCR.MRSET=0 */ -@@ -172,8 +149,8 @@ void sdram_init(void) - if (tmp > 0xff) - tmp = 0xff; - writew(tmp, &emc->rtcor); -+ - writew(0, &emc->rtcnt); -- /* Divisor is 64, CKO/64 */ - writew(EMC_RTCSR_CKS_64, &emc->rtcsr); - - /* Wait for number of auto-refresh cycles */ -@@ -182,13 +159,17 @@ void sdram_init(void) - ; - - /* Stage 3. Mode Register Set */ -+ dmcr0 = (11 << EMC_DMCR_RA_BIT) | -+ (8 << EMC_DMCR_CA_BIT) | -+ (0 << EMC_DMCR_BA_BIT) | -+ EMC_DMCR_EPIN | -+ (SDRAM_BW16 << EMC_DMCR_BW_BIT) | -+ cas_latency_dmcr[((SDRAM_CASL == 3) ? 1 : 0)]; - writel(dmcr0 | EMC_DMCR_RFSH | EMC_DMCR_MRSET, &emc->dmcr); - writeb(0, JZ4740_EMC_SDMR0 | sdmode); - - /* Set back to basic DMCR value */ - writel(dmcr | EMC_DMCR_RFSH | EMC_DMCR_MRSET, &emc->dmcr); -- -- /* everything is ok now */ - } - - DECLARE_GLOBAL_DATA_PTR; -@@ -232,9 +213,10 @@ void rtc_init(void) - phys_size_t initdram(int board_type) - { - struct jz4740_emc *emc = (struct jz4740_emc *)JZ4740_EMC_BASE; -- u32 dmcr; -- u32 rows, cols, dw, banks; -- ulong size; -+ -+ unsigned int dmcr; -+ unsigned int rows, cols, dw, banks; -+ unsigned long size; - - dmcr = readl(&emc->dmcr); - rows = 11 + ((dmcr & EMC_DMCR_RA_MASK) >> EMC_DMCR_RA_BIT); -diff --git a/arch/mips/cpu/xburst/spl/Makefile b/arch/mips/cpu/xburst/spl/Makefile -new file mode 100644 -index 0000000..f45e8c8 ---- /dev/null -+++ b/arch/mips/cpu/xburst/spl/Makefile -@@ -0,0 +1,47 @@ -+# -+# Copyright (C) 2011 Xiangfu Liu -+# -+# 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 $(TOPDIR)/config.mk -+ -+LIB = $(obj)lib$(CPU).o -+ -+START = start.o -+SOBJS-y = -+COBJS-y = -+ -+SRCS := $(START:.o=.S) $(SOBJS-y:.o=.S) $(COBJS-y:.o=.c) -+OBJS := $(addprefix $(obj),$(SOBJS-y) $(COBJS-y)) -+START := $(addprefix $(obj),$(START)) -+ -+all: $(obj).depend $(START) $(LIB) -+ -+$(LIB): $(OBJS) -+ $(call cmd_link_o_target, $(OBJS)) -+ -+######################################################################### -+ -+# defines $(obj).depend target -+include $(SRCTREE)/rules.mk -+ -+sinclude $(obj).depend -+ -+######################################################################### -diff --git a/arch/mips/cpu/xburst/spl/start.S b/arch/mips/cpu/xburst/spl/start.S -new file mode 100644 -index 0000000..e31c4c8 ---- /dev/null -+++ b/arch/mips/cpu/xburst/spl/start.S -@@ -0,0 +1,63 @@ -+/* -+ * Copyright (c) 2010 Xiangfu Liu -+ * -+ * 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 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, write to the Free Software -+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, -+ * MA 02111-1307 USA -+ */ -+ -+#include -+#include -+#include -+#include -+#include -+#include -+ -+#include -+ -+ .set noreorder -+ -+ .globl _start -+ .text -+_start: -+ .word JZ4740_NANDBOOT_CFG /* fetched during NAND Boot */ -+reset: -+ /* -+ * STATUS register -+ * CU0=UM=EXL=IE=0, BEV=ERL=1, IP2~7=1 -+ */ -+ li t0, 0x0040FC04 -+ mtc0 t0, CP0_STATUS -+ /* -+ * CAUSE register -+ * IV=1, use the specical interrupt vector (0x200) -+ */ -+ li t1, 0x00800000 -+ mtc0 t1, CP0_CAUSE -+ -+ bal 1f -+ nop -+ .word _GLOBAL_OFFSET_TABLE_ -+1: -+ move gp, ra -+ lw t1, 0(ra) -+ move gp, t1 -+ -+ la sp, 0x80004000 -+ la t9, nand_spl_boot -+ j t9 -+ nop -diff --git a/board/qi/qi_lb60/Makefile b/board/qi/qi_lb60/Makefile -index 5dae11b..e399246 100644 ---- a/board/qi/qi_lb60/Makefile -+++ b/board/qi/qi_lb60/Makefile -@@ -22,7 +22,11 @@ include $(TOPDIR)/config.mk - - LIB = $(obj)lib$(BOARD).o - -+ifeq ($(CONFIG_SPL_BUILD),y) -+COBJS := $(BOARD)-spl.o -+else - COBJS := $(BOARD).o -+endif - - SRCS := $(SOBJS:.o=.S) $(COBJS:.o=.c) - OBJS := $(addprefix $(obj),$(SOBJS) $(COBJS)) -diff --git a/board/qi/qi_lb60/qi_lb60-spl.c b/board/qi/qi_lb60/qi_lb60-spl.c -new file mode 100644 -index 0000000..3fe3fa3 ---- /dev/null -+++ b/board/qi/qi_lb60/qi_lb60-spl.c -@@ -0,0 +1,30 @@ -+/* -+ * Authors: Xiangfu Liu -+ * -+ * 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. -+ */ -+ -+#include -+#include -+#include -+#include -+ -+void nand_spl_boot(void) -+{ -+ __gpio_as_sdram_16bit_4720(); -+ __gpio_as_uart0(); -+ __gpio_jtag_to_uart0(); -+ -+ serial_init(); -+ -+ pll_init(); -+ sdram_init(); -+ -+ nand_init(); -+ -+ puts("\nQi LB60 SPL: Starting U-Boot ...\n"); -+ nand_boot(); -+} -diff --git a/board/qi/qi_lb60/qi_lb60.c b/board/qi/qi_lb60/qi_lb60.c -index d975209..3bd4e2f 100644 ---- a/board/qi/qi_lb60/qi_lb60.c -+++ b/board/qi/qi_lb60/qi_lb60.c -@@ -1,5 +1,5 @@ - /* -- * Authors: Xiangfu Liu -+ * Authors: Xiangfu Liu - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License -@@ -97,8 +97,10 @@ int board_early_init_f(void) - /* U-Boot common routines */ - int checkboard(void) - { -- printf("Board: Qi LB60 (Ingenic XBurst Jz4740 SoC, Speed %ld MHz)\n", -- gd->cpu_clk / 1000000); -+ printf("Board: Qi LB60 (Ingenic XBurst Jz4740 SoC)\n"); -+ printf(" CPU: %ld\n", gd->cpu_clk); -+ printf(" MEM: %ld\n", gd->mem_clk); -+ printf(" DEV: %ld\n", gd->dev_clk); - - return 0; - } -diff --git a/board/qi/qi_lb60/u-boot-spl.lds b/board/qi/qi_lb60/u-boot-spl.lds -new file mode 100644 -index 0000000..930537f ---- /dev/null -+++ b/board/qi/qi_lb60/u-boot-spl.lds -@@ -0,0 +1,61 @@ -+/* -+ * (C) Copyright 2012 Xiangfu Liu -+ * -+ * 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 -+ */ -+ -+OUTPUT_FORMAT("elf32-tradlittlemips", "elf32-tradlittlemips", "elf32-tradlittlemips") -+ -+OUTPUT_ARCH(mips) -+ENTRY(_start) -+SECTIONS -+{ -+ . = 0x80000000; -+ . = ALIGN(4); -+ .text : -+ { -+ *(.text) -+ } -+ -+ . = ALIGN(4); -+ .rodata : { *(SORT_BY_ALIGNMENT(SORT_BY_NAME(.rodata*))) } -+ -+ . = ALIGN(4); -+ .data : { *(.data) } -+ -+ . = ALIGN(4); -+ .sdata : { *(.sdata) } -+ -+ _gp = ALIGN(16); -+ -+ __got_start = .; -+ .got : { *(.got) } -+ __got_end = .; -+ -+ . = .; -+ __u_boot_cmd_start = .; -+ .u_boot_cmd : { *(.u_boot_cmd) } -+ __u_boot_cmd_end = .; -+ -+ uboot_end_data = .; -+ num_got_entries = (__got_end - __got_start) >> 2; -+ -+ . = ALIGN(4); -+ .sbss : { *(.sbss) } -+ .bss : { *(.bss) } -+ uboot_end = .; -+} -+ASSERT(uboot_end <= 0x80002000, "NAND bootstrap too big"); -diff --git a/drivers/mtd/nand/jz4740_nand.c b/drivers/mtd/nand/jz4740_nand.c -index 3ec34f3..24a4921 100644 ---- a/drivers/mtd/nand/jz4740_nand.c -+++ b/drivers/mtd/nand/jz4740_nand.c -@@ -15,6 +15,9 @@ - #include - #include - -+#ifdef CONFIG_SPL_BUILD -+#define printf(s) puts(s) -+#endif - #define JZ_NAND_DATA_ADDR ((void __iomem *)0xB8000000) - #define JZ_NAND_CMD_ADDR (JZ_NAND_DATA_ADDR + 0x8000) - #define JZ_NAND_ADDR_ADDR (JZ_NAND_DATA_ADDR + 0x10000) -@@ -176,7 +179,7 @@ static int jz_nand_rs_correct_data(struct mtd_info *mtd, u_char *dat, - for (k = 0; k < 9; k++) - writeb(read_ecc[k], &emc->nfpar[k]); - } -- /* Set PRDY */ -+ - writel(readl(&emc->nfecr) | EMC_NFECR_PRDY, &emc->nfecr); - - /* Wait for completion */ -@@ -184,7 +187,7 @@ static int jz_nand_rs_correct_data(struct mtd_info *mtd, u_char *dat, - status = readl(&emc->nfints); - } while (!(status & EMC_NFINTS_DECF)); - -- /* disable ecc */ -+ /* Disable ECC */ - writel(readl(&emc->nfecr) & ~EMC_NFECR_ECCE, &emc->nfecr); - - /* Check decoding */ -@@ -192,7 +195,7 @@ static int jz_nand_rs_correct_data(struct mtd_info *mtd, u_char *dat, - return 0; - - if (status & EMC_NFINTS_UNCOR) { -- printf("uncorrectable ecc\n"); -+ printf("JZ4740 uncorrectable ECC\n"); - return -1; - } - -@@ -230,6 +233,32 @@ static int jz_nand_rs_correct_data(struct mtd_info *mtd, u_char *dat, - return errcnt; - } - -+#ifdef CONFIG_SPL_BUILD -+static void jz_nand_read_buf(struct mtd_info *mtd, uint8_t *buf, int len) -+{ -+ int i; -+ struct nand_chip *this = mtd->priv; -+ -+#if (JZ4740_NANDBOOT_CFG == JZ4740_NANDBOOT_B16R3) || \ -+ (JZ4740_NANDBOOT_CFG == JZ4740_NANDBOOT_B16R2) -+ for (i = 0; i < len; i += 2) -+ buf[i] = readw(this->IO_ADDR_R); -+#elif (JZ4740_NANDBOOT_CFG == JZ4740_NANDBOOT_B8R3) || \ -+ (JZ4740_NANDBOOT_CFG == JZ4740_NANDBOOT_B8R2) -+ for (i = 0; i < len; i++) -+ buf[i] = readb(this->IO_ADDR_R); -+#else -+ #error JZ4740_NANDBOOT_CFG not defined or wrong -+#endif -+} -+ -+static uint8_t jz_nand_read_byte(struct mtd_info *mtd) -+{ -+ struct nand_chip *this = mtd->priv; -+ return readb(this->IO_ADDR_R); -+} -+#endif -+ - /* - * Main initialization routine - */ -@@ -254,6 +283,10 @@ int board_nand_init(struct nand_chip *nand) - nand->ecc.size = CONFIG_SYS_NAND_ECCSIZE; - nand->ecc.bytes = CONFIG_SYS_NAND_ECCBYTES; - nand->ecc.layout = &qi_lb60_ecclayout_2gb; -+#ifdef CONFIG_SPL_BUILD -+ nand->read_byte = jz_nand_read_byte; -+ nand->read_buf = jz_nand_read_buf; -+#endif - nand->chip_delay = 50; - nand->options = NAND_USE_FLASH_BBT; - -diff --git a/include/configs/qi_lb60.h b/include/configs/qi_lb60.h -index 4bb5bbc..7bff444 100644 ---- a/include/configs/qi_lb60.h -+++ b/include/configs/qi_lb60.h -@@ -1,5 +1,5 @@ - /* -- * Authors: Xiangfu Liu -+ * Authors: Xiangfu Liu - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License -@@ -14,7 +14,6 @@ - #define CONFIG_SYS_LITTLE_ENDIAN - #define CONFIG_JZSOC /* Jz SoC */ - #define CONFIG_JZ4740 /* Jz4740 SoC */ --#define CONFIG_NAND_JZ4740 - - #define CONFIG_SYS_CPU_SPEED 336000000 /* CPU clock: 336 MHz */ - #define CONFIG_SYS_EXTAL 12000000 /* EXTAL freq: 12 MHz */ -@@ -24,24 +23,43 @@ - #define CONFIG_SYS_UART_BASE JZ4740_UART0_BASE /* Base of the UART channel */ - #define CONFIG_BAUDRATE 57600 - -+#define CONFIG_BOOTP_MASK (CONFIG_BOOTP_DEFAUL) -+#define CONFIG_BOOTDELAY 0 -+#define CONFIG_BOOTARGS "mem=32M console=tty0 console=ttyS0,57600n8 ubi.mtd=2 rootfstype=ubifs root=ubi0:rootfs rw rootwait" -+#define CONFIG_BOOTCOMMAND "nand read 0x80600000 0x400000 0x280000;bootm" -+ -+/* -+ * Miscellaneous configurable options -+ */ -+#define CONFIG_SYS_SDRAM_BASE 0x80000000 /* Cached addr */ -+#define CONFIG_SYS_INIT_SP_OFFSET 0x400000 -+#define CONFIG_SYS_LOAD_ADDR 0x80600000 -+#define CONFIG_SYS_MEMTEST_START 0x80100000 -+#define CONFIG_SYS_MEMTEST_END 0x80A00000 -+#define CONFIG_SYS_TEXT_BASE 0x80100000 -+#define CONFIG_SYS_MONITOR_BASE CONFIG_SYS_TEXT_BASE -+ -+#define CONFIG_SYS_MALLOC_LEN (4 * 1024 * 1024) -+#define CONFIG_SYS_BOOTPARAMS_LEN (128 * 1024) -+ -+#define CONFIG_SYS_CBSIZE 256 /* Console I/O Buffer Size */ -+#define CONFIG_SYS_PBSIZE (CONFIG_SYS_CBSIZE + sizeof(CONFIG_SYS_PROMPT) + 16) -+ -+#define CONFIG_SYS_LONGHELP -+#define CONFIG_SYS_MAXARGS 16 -+#define CONFIG_SYS_PROMPT "NanoNote# " -+ - #define CONFIG_SKIP_LOWLEVEL_INIT - #define CONFIG_BOARD_EARLY_INIT_F - #define CONFIG_SYS_NO_FLASH - #define CONFIG_SYS_FLASH_BASE 0 /* init flash_base as 0 */ --#define CONFIG_ENV_OVERWRITE -- --#define CONFIG_BOOTP_MASK (CONFIG_BOOTP_DEFAUL) --#define CONFIG_BOOTDELAY 0 --#define CONFIG_BOOTARGS "mem=32M console=tty0 console=ttyS0,57600n8 ubi.mtd=2 rootfstype=ubifs root=ubi0:rootfs rw rootwait" --#define CONFIG_BOOTCOMMAND "nand read 0x80600000 0x400000 0x200000;bootm" - - /* -- * Command line configuration. -+ * Command line configuration - */ - #define CONFIG_CMD_BOOTD /* bootd */ - #define CONFIG_CMD_CONSOLE /* coninfo */ - #define CONFIG_CMD_ECHO /* echo arguments */ -- - #define CONFIG_CMD_LOADB /* loadb */ - #define CONFIG_CMD_LOADS /* loads */ - #define CONFIG_CMD_MEMORY /* md mm nm mw cp cmp crc base loop mtest */ -@@ -58,45 +76,16 @@ - #define CONFIG_LOADS_ECHO 1 /* echo on for serial download */ - - /* -- * Miscellaneous configurable options -- */ --#define CONFIG_SYS_MAXARGS 16 --#define CONFIG_SYS_LONGHELP --#define CONFIG_SYS_PROMPT "NanoNote# " --#define CONFIG_SYS_CBSIZE 256 /* Console I/O Buffer Size */ --#define CONFIG_SYS_PBSIZE (CONFIG_SYS_CBSIZE + sizeof(CONFIG_SYS_PROMPT) + 16) -- --#define CONFIG_SYS_MALLOC_LEN (4 * 1024 * 1024) --#define CONFIG_SYS_BOOTPARAMS_LEN (128 * 1024) -- --#define CONFIG_SYS_SDRAM_BASE 0x80000000 /* Cached addr */ --#define CONFIG_SYS_INIT_SP_OFFSET 0x400000 --#define CONFIG_SYS_LOAD_ADDR 0x80600000 --#define CONFIG_SYS_MEMTEST_START 0x80100000 --#define CONFIG_SYS_MEMTEST_END 0x80800000 -- --/* -- * Environment -+ * NAND driver configuration - */ --#define CONFIG_ENV_IS_IN_NAND /* use NAND for environment vars */ -- --#define CONFIG_SYS_NAND_5_ADDR_CYCLE --/* -- * if board nand flash is 1GB, set to 1 -- * if board nand flash is 2GB, set to 2 -- * for change the PAGE_SIZE and BLOCK_SIZE -- * will delete when there is no 1GB flash -- */ --#define NANONOTE_NAND_SIZE 2 -- --#define CONFIG_SYS_NAND_PAGE_SIZE (2048 * NANONOTE_NAND_SIZE) --#define CONFIG_SYS_NAND_BLOCK_SIZE (256 * NANONOTE_NAND_SIZE << 10) --/* nand bad block was marked at this page in a block, start from 0 */ -+#define CONFIG_NAND_JZ4740 -+#define CONFIG_SYS_NAND_PAGE_SIZE 4096 -+#define CONFIG_SYS_NAND_BLOCK_SIZE (512 << 10) -+/* NAND bad block was marked at this page in a block, start from 0 */ - #define CONFIG_SYS_NAND_BADBLOCK_PAGE 127 - #define CONFIG_SYS_NAND_PAGE_COUNT 128 - #define CONFIG_SYS_NAND_BAD_BLOCK_POS 0 --/* ECC offset position in oob area, default value is 6 if it isn't defined */ --#define CONFIG_SYS_NAND_ECC_POS (6 * NANONOTE_NAND_SIZE) -+#define CONFIG_SYS_NAND_ECC_POS 12 - #define CONFIG_SYS_NAND_ECCSIZE 512 - #define CONFIG_SYS_NAND_ECCBYTES 9 - #define CONFIG_SYS_NAND_ECCPOS \ -@@ -115,10 +104,9 @@ - #define CONFIG_SYS_ONENAND_BASE CONFIG_SYS_NAND_BASE - #define CONFIG_SYS_MAX_NAND_DEVICE 1 - #define CONFIG_SYS_NAND_SELECT_DEVICE 1 /* nand driver supports mutipl.*/ --#define CONFIG_NAND_SPL_TEXT_BASE 0x80000000 - - /* -- * IPL (Initial Program Loader, integrated inside CPU) -+ * IPL (Initial Program Loader, integrated inside Ingenic Xburst JZ4740 CPU) - * Will load first 8k from NAND (SPL) into cache and execute it from there. - * - * SPL (Secondary Program Loader) -@@ -130,77 +118,88 @@ - * NUB (NAND U-Boot) - * This NAND U-Boot (NUB) is a special U-Boot version which can be started - * from RAM. Therefore it mustn't (re-)configure the SDRAM controller. -- * - */ -+ -+/* -+ * NAND SPL configuration -+ */ -+#define CONFIG_SPL -+#define CONFIG_SPL_LIBGENERIC_SUPPORT -+#define CONFIG_SPL_LIBCOMMON_SUPPORT -+#define CONFIG_SPL_NAND_LOAD -+#define CONFIG_SPL_NAND_SIMPLE -+#define CONFIG_SPL_NAND_SUPPORT -+#define CONFIG_SPL_TEXT_BASE 0x80000000 -+#define CONFIG_SPL_START_S_PATH "arch/mips/cpu/xburst/spl" -+ -+#define CONFIG_SYS_NAND_5_ADDR_CYCLE -+#define CONFIG_SYS_NAND_HW_ECC_OOBFIRST -+#define JZ4740_NANDBOOT_CFG JZ4740_NANDBOOT_B8R3 -+ - #define CONFIG_SYS_NAND_U_BOOT_DST 0x80100000 /* Load NUB to this addr */ - #define CONFIG_SYS_NAND_U_BOOT_START CONFIG_SYS_NAND_U_BOOT_DST --/* Start NUB from this addr*/ -+ /* Start NUB from this addr */ -+#define CONFIG_SYS_NAND_U_BOOT_OFFS (32 << 10) /* Offset of NUB */ -+#define CONFIG_SYS_NAND_U_BOOT_SIZE (256 << 10) /* Size of NUB */ - - /* -- * Define the partitioning of the NAND chip (only RAM U-Boot is needed here) -+ * Environment configuration - */ --#define CONFIG_SYS_NAND_U_BOOT_OFFS (256 << 10) /* Offset to RAM U-Boot image */ --#define CONFIG_SYS_NAND_U_BOOT_SIZE (512 << 10) /* Size of RAM U-Boot image */ -- -+#define CONFIG_ENV_OVERWRITE -+#define CONFIG_ENV_IS_IN_NAND - #define CONFIG_ENV_SIZE (4 << 10) - #define CONFIG_ENV_OFFSET \ - (CONFIG_SYS_NAND_BLOCK_SIZE + CONFIG_SYS_NAND_U_BOOT_SIZE) - #define CONFIG_ENV_OFFSET_REDUND \ - (CONFIG_ENV_OFFSET + CONFIG_SYS_NAND_BLOCK_SIZE) - --#define CONFIG_SYS_TEXT_BASE 0x80100000 --#define CONFIG_SYS_MONITOR_BASE CONFIG_SYS_TEXT_BASE -- - /* -- * SDRAM Info. -+ * CPU cache configuration - */ --#define CONFIG_NR_DRAM_BANKS 1 -+#define CONFIG_SYS_DCACHE_SIZE 16384 -+#define CONFIG_SYS_ICACHE_SIZE 16384 -+#define CONFIG_SYS_CACHELINE_SIZE 32 - - /* -- * Cache Configuration -+ * SDRAM configuration - */ --#define CONFIG_SYS_DCACHE_SIZE 16384 --#define CONFIG_SYS_ICACHE_SIZE 16384 --#define CONFIG_SYS_CACHELINE_SIZE 32 -+#define CONFIG_NR_DRAM_BANKS 1 -+ -+#define SDRAM_BW16 1 /* Data bus width: 0-32bit, 1-16bit */ -+#define SDRAM_BANK4 1 /* Banks each chip: 0-2bank, 1-4bank */ -+#define SDRAM_ROW 13 /* Row address: 11 to 13 */ -+#define SDRAM_COL 9 /* Column address: 8 to 12 */ -+#define SDRAM_CASL 2 /* CAS latency: 2 or 3 */ -+#define SDRAM_TRAS 45 /* RAS# Active Time */ -+#define SDRAM_RCD 20 /* RAS# to CAS# Delay */ -+#define SDRAM_TPC 20 /* RAS# Precharge Time */ -+#define SDRAM_TRWL 7 /* Write Latency Time */ -+#define SDRAM_TREF 15625 /* Refresh period: 8192 cycles/64ms */ - - /* -- * GPIO definition -+ * GPIO configuration - */ --#define GPIO_LCD_CS (2 * 32 + 21) --#define GPIO_AMP_EN (3 * 32 + 4) -+#define GPIO_LCD_CS (2 * 32 + 21) -+#define GPIO_AMP_EN (3 * 32 + 4) - --#define GPIO_SDPW_EN (3 * 32 + 2) --#define GPIO_SD_DETECT (3 * 32 + 0) -+#define GPIO_SDPW_EN (3 * 32 + 2) -+#define GPIO_SD_DETECT (3 * 32 + 0) - --#define GPIO_BUZZ_PWM (3 * 32 + 27) --#define GPIO_USB_DETECT (3 * 32 + 28) -+#define GPIO_BUZZ_PWM (3 * 32 + 27) -+#define GPIO_USB_DETECT (3 * 32 + 28) - --#define GPIO_AUDIO_POP (1 * 32 + 29) --#define GPIO_COB_TEST (1 * 32 + 30) -+#define GPIO_AUDIO_POP (1 * 32 + 29) -+#define GPIO_COB_TEST (1 * 32 + 30) - - #define GPIO_KEYOUT_BASE (2 * 32 + 10) --#define GPIO_KEYIN_BASE (3 * 32 + 18) --#define GPIO_KEYIN_8 (3 * 32 + 26) -+#define GPIO_KEYIN_BASE (3 * 32 + 18) -+#define GPIO_KEYIN_8 (3 * 32 + 26) - --#define GPIO_SD_CD_N GPIO_SD_DETECT /* SD Card insert detect */ -+#define GPIO_SD_CD_N GPIO_SD_DETECT /* SD Card insert detect */ - #define GPIO_SD_VCC_EN_N GPIO_SDPW_EN /* SD Card Power Enable */ - - #define SPEN GPIO_LCD_CS /* LCDCS :Serial command enable */ - #define SPDA (2 * 32 + 22) /* LCDSCL:Serial command clock input */ - #define SPCK (2 * 32 + 23) /* LCDSDA:Serial command data input */ - --/* SDRAM paramters */ --#define SDRAM_BW16 1 /* Data bus width: 0-32bit, 1-16bit */ --#define SDRAM_BANK4 1 /* Banks each chip: 0-2bank, 1-4bank */ --#define SDRAM_ROW 13 /* Row address: 11 to 13 */ --#define SDRAM_COL 9 /* Column address: 8 to 12 */ --#define SDRAM_CASL 2 /* CAS latency: 2 or 3 */ -- --/* SDRAM Timings, unit: ns */ --#define SDRAM_TRAS 45 /* RAS# Active Time */ --#define SDRAM_RCD 20 /* RAS# to CAS# Delay */ --#define SDRAM_TPC 20 /* RAS# Precharge Time */ --#define SDRAM_TRWL 7 /* Write Latency Time */ --#define SDRAM_TREF 15625 /* Refresh period: 8192 cycles/64ms */ -- - #endif --- -1.7.9.5 - diff --git a/package/boot/uboot-xburst/patches/0002-qi_lb60-add-software-usbboot-support.patch b/package/boot/uboot-xburst/patches/0002-qi_lb60-add-software-usbboot-support.patch deleted file mode 100644 index feaf297b7c..0000000000 --- a/package/boot/uboot-xburst/patches/0002-qi_lb60-add-software-usbboot-support.patch +++ /dev/null @@ -1,916 +0,0 @@ -From fa51192b912d296b8eec10f7d44c6c17eb1dd368 Mon Sep 17 00:00:00 2001 -From: Xiangfu -Date: Fri, 12 Oct 2012 09:47:39 +0800 -Subject: [PATCH 2/6] qi_lb60: add software usbboot support - - JZ4740 CPU have a internal ROM have such kind of code, that make - JZ4740 can boot from USB - - usbboot.S can downloads user program from the USB port to internal - SRAM and branches to the internal SRAM to execute the program - -Signed-off-by: Xiangfu ---- - board/qi/qi_lb60/Makefile | 1 + - board/qi/qi_lb60/qi_lb60-spl.c | 20 + - board/qi/qi_lb60/usbboot.S | 838 ++++++++++++++++++++++++++++++++++++++++ - 3 files changed, 859 insertions(+) - create mode 100644 board/qi/qi_lb60/usbboot.S - -diff --git a/board/qi/qi_lb60/Makefile b/board/qi/qi_lb60/Makefile -index e399246..6dd8c6f 100644 ---- a/board/qi/qi_lb60/Makefile -+++ b/board/qi/qi_lb60/Makefile -@@ -23,6 +23,7 @@ include $(TOPDIR)/config.mk - LIB = $(obj)lib$(BOARD).o - - ifeq ($(CONFIG_SPL_BUILD),y) -+SOBJS := usbboot.o - COBJS := $(BOARD)-spl.o - else - COBJS := $(BOARD).o -diff --git a/board/qi/qi_lb60/qi_lb60-spl.c b/board/qi/qi_lb60/qi_lb60-spl.c -index 3fe3fa3..aea459c 100644 ---- a/board/qi/qi_lb60/qi_lb60-spl.c -+++ b/board/qi/qi_lb60/qi_lb60-spl.c -@@ -12,6 +12,24 @@ - #include - #include - -+#define KEY_U_OUT (32 * 2 + 16) -+#define KEY_U_IN (32 * 3 + 19) -+ -+extern void usb_boot(void); -+ -+static void check_usb_boot(void) -+{ -+ __gpio_as_input(KEY_U_IN); -+ __gpio_enable_pull(KEY_U_IN); -+ __gpio_as_output(KEY_U_OUT); -+ __gpio_clear_pin(KEY_U_OUT); -+ -+ if (!__gpio_get_pin(KEY_U_IN)) { -+ puts("[U] pressed, goto USBBOOT mode\n"); -+ usb_boot(); -+ } -+} -+ - void nand_spl_boot(void) - { - __gpio_as_sdram_16bit_4720(); -@@ -23,6 +41,8 @@ void nand_spl_boot(void) - pll_init(); - sdram_init(); - -+ check_usb_boot(); -+ - nand_init(); - - puts("\nQi LB60 SPL: Starting U-Boot ...\n"); -diff --git a/board/qi/qi_lb60/usbboot.S b/board/qi/qi_lb60/usbboot.S -new file mode 100644 -index 0000000..c872266 ---- /dev/null -+++ b/board/qi/qi_lb60/usbboot.S -@@ -0,0 +1,838 @@ -+/* -+ * for jz4740 usb boot -+ * -+ * Copyright (c) 2009 Author: -+ * -+ * 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 -+ */ -+ .set noreorder -+ .globl usb_boot -+ .text -+ -+/* -+ * Both NAND and USB boot load data to D-Cache first, then transfer -+ * data from D-Cache to I-Cache, and jump to execute the code in I-Cache. -+ * So init caches first and then dispatch to a proper boot routine. -+ */ -+ -+.macro load_addr reg addr -+ li \reg, 0x80000000 -+ addiu \reg, \reg, \addr -+ la $2, usbboot_begin -+ subu \reg, \reg, $2 -+.endm -+ -+usb_boot: -+ /* Initialize PLL: set ICLK to 84MHz and HCLK to 42MHz. */ -+ la $9, 0xB0000000 /* CPCCR: Clock Control Register */ -+ la $8, 0x42041110 /* I:S:M:P=1:2:2:2 */ -+ sw $8, 0($9) -+ -+ la $9, 0xB0000010 /* CPPCR: PLL Control Register */ -+ la $8, 0x06000120 /* M=12 N=0 D=0 CLK=12*(M+2)/(N+2) */ -+ sw $8, 0($9) -+ -+ mtc0 $0, $26 /* CP0_ERRCTL, restore WST reset state */ -+ nop -+ -+ mtc0 $0, $16 /* CP0_CONFIG */ -+ nop -+ -+ /* Relocate code to beginning of the ram */ -+ -+ la $2, usbboot_begin -+ la $3, usbboot_end -+ li $4, 0x80000000 -+ -+1: -+ lw $5, 0($2) -+ sw $5, 0($4) -+ addiu $2, $2, 4 -+ bne $2, $3, 1b -+ addiu $4, $4, 4 -+ -+ li $2, 0x80000000 -+ ori $3, $2, 0 -+ addiu $3, $3, usbboot_end -+ la $4, usbboot_begin -+ subu $3, $3, $4 -+ -+ -+2: -+ cache 0x0, 0($2) /* Index_Invalidate_I */ -+ cache 0x1, 0($2) /* Index_Writeback_Inv_D */ -+ addiu $2, $2, 32 -+ subu $4, $3, $2 -+ bgtz $4, 2b -+ nop -+ -+ load_addr $3, usb_boot_return -+ -+ jr $3 -+ -+usbboot_begin: -+ -+init_caches: -+ li $2, 3 /* cacheable for kseg0 access */ -+ mtc0 $2, $16 /* CP0_CONFIG */ -+ nop -+ -+ li $2, 0x20000000 /* enable idx-store-data cache insn */ -+ mtc0 $2, $26 /* CP0_ERRCTL */ -+ -+ ori $2, $28, 0 /* start address */ -+ ori $3, $2, 0x3fe0 /* end address, total 16KB */ -+ mtc0 $0, $28, 0 /* CP0_TAGLO */ -+ mtc0 $0, $28, 1 /* CP0_DATALO */ -+cache_clear_a_line: -+ cache 0x8, 0($2) /* Index_Store_Tag_I */ -+ cache 0x9, 0($2) /* Index_Store_Tag_D */ -+ bne $2, $3, cache_clear_a_line -+ addiu $2, $2, 32 /* increment CACHE_LINE_SIZE */ -+ -+ ori $2, $28, 0 /* start address */ -+ ori $3, $2, 0x3fe0 /* end address, total 16KB */ -+ la $4, 0x1ffff000 /* physical address and 4KB page mask */ -+cache_alloc_a_line: -+ and $5, $2, $4 -+ ori $5, $5, 1 /* V bit of the physical tag */ -+ mtc0 $5, $28, 0 /* CP0_TAGLO */ -+ cache 0x8, 0($2) /* Index_Store_Tag_I */ -+ cache 0x9, 0($2) /* Index_Store_Tag_D */ -+ bne $2, $3, cache_alloc_a_line -+ addiu $2, $2, 32 /* increment CACHE_LINE_SIZE */ -+ -+ nop -+ nop -+ nop -+ /* -+ * Transfer data from dcache to icache, then jump to icache. -+ * Input parameters: -+ * $19: data length in bytes -+ * $20: jump target address -+ */ -+xfer_d2i: -+ -+ ori $8, $20, 0 -+ addu $9, $8, $19 /* total 16KB */ -+ -+1: -+ cache 0x0, 0($8) /* Index_Invalidate_I */ -+ cache 0x1, 0($8) /* Index_Writeback_Inv_D */ -+ bne $8, $9, 1b -+ addiu $8, $8, 32 -+ -+ /* flush write-buffer */ -+ sync -+ -+ /* Invalidate BTB */ -+ mfc0 $8, $16, 7 /* CP0_CONFIG */ -+ nop -+ ori $8, 2 -+ mtc0 $8, $16, 7 -+ nop -+ -+ /* Overwrite config to disable ram initalisation */ -+ li $2, 0xff -+ sb $2, 20($20) -+ -+ jalr $20 -+ nop -+ -+icache_return: -+ /* User code can return to here after executing itself in -+ icache, by jumping to $31. */ -+ b usb_boot_return -+ nop -+ -+ -+usb_boot_return: -+ /* Enable the USB PHY */ -+ la $9, 0xB0000024 /* CPM_SCR */ -+ lw $8, 0($9) -+ ori $8, 0x40 /* USBPHY_ENABLE */ -+ sw $8, 0($9) -+ -+ /* Initialize USB registers */ -+ la $27, 0xb3040000 /* USB registers base address */ -+ -+ sb $0, 0x0b($27) /* INTRUSBE: disable common USB interrupts */ -+ sh $0, 0x06($27) /* INTRINE: disable EPIN interrutps */ -+ sh $0, 0x08($27) /* INTROUTE: disable EPOUT interrutps */ -+ -+ li $9, 0x61 -+ sb $9, 0x01($27) /* POWER: HSENAB | SUSPENDM | SOFTCONN */ -+ -+ /* Initialize USB states */ -+ li $22, 0 /* set EP0 to IDLE state */ -+ li $23, 1 /* no data stage */ -+ -+ /* Main loop of polling the usb commands */ -+usb_command_loop: -+ lbu $9, 0x0a($27) /* read INTRUSB */ -+ andi $9, 0x04 /* check USB_INTR_RESET */ -+ beqz $9, check_intr_ep0in -+ nop -+ -+ /* 1. Handle USB reset interrupt */ -+handle_reset_intr: -+ lbu $9, 0x01($27) /* read POWER */ -+ andi $9, 0x10 /* test HS_MODE */ -+ bnez $9, _usb_set_maxpktsize -+ li $9, 512 /* max packet size of HS mode */ -+ li $9, 64 /* max packet size of FS mode */ -+ -+_usb_set_maxpktsize: -+ li $8, 1 -+ sb $8, 0x0e($27) /* set INDEX 1 */ -+ -+ sh $9, 0x10($27) /* INMAXP */ -+ sb $0, 0x13($27) /* INCSRH */ -+ sh $9, 0x14($27) /* OUTMAXP */ -+ sb $0, 0x17($27) /* OUTCSRH */ -+ -+_usb_flush_fifo: -+ li $8, 0x48 /* INCSR_CDT && INCSR_FF */ -+ sb $8, 0x12($27) /* INCSR */ -+ li $8, 0x90 /* OUTCSR_CDT && OUTCSR_FF */ -+ sb $8, 0x16($27) /* OUTCSR */ -+ -+ li $22, 0 /* set EP0 to IDLE state */ -+ li $23, 1 /* no data stage */ -+ -+ /* 2. Check and handle EP0 interrupt */ -+check_intr_ep0in: -+ lhu $10, 0x02($27) /* read INTRIN */ -+ andi $9, $10, 0x1 /* check EP0 interrupt */ -+ beqz $9, check_intr_ep1in -+ nop -+ -+handle_ep0_intr: -+ sb $0, 0x0e($27) /* set INDEX 0 */ -+ lbu $11, 0x12($27) /* read CSR0 */ -+ -+ andi $9, $11, 0x04 /* check SENTSTALL */ -+ beqz $9, _ep0_setupend -+ nop -+ -+_ep0_sentstall: -+ andi $9, $11, 0xdb -+ sb $9, 0x12($27) /* clear SENDSTALL and SENTSTALL */ -+ li $22, 0 /* set EP0 to IDLE state */ -+ -+_ep0_setupend: -+ andi $9, $11, 0x10 /* check SETUPEND */ -+ beqz $9, ep0_idle_state -+ nop -+ -+ ori $9, $11, 0x80 -+ sb $9, 0x12($27) /* set SVDSETUPEND */ -+ li $22, 0 /* set EP0 to IDLE state */ -+ -+ep0_idle_state: -+ bnez $22, ep0_tx_state -+ nop -+ -+ /* 2.1 Handle EP0 IDLE state interrupt */ -+ andi $9, $11, 0x01 /* check OUTPKTRDY */ -+ beqz $9, check_intr_ep1in -+ nop -+ -+ /* Read 8-bytes setup packet from the FIFO */ -+ lw $25, 0x20($27) /* first word of setup packet */ -+ lw $26, 0x20($27) /* second word of setup packet */ -+ -+ andi $9, $25, 0x60 /* bRequestType & USB_TYPE_MASK */ -+ beqz $9, _ep0_std_req -+ nop -+ -+ /* 2.1.1 Vendor-specific setup request */ -+_ep0_vend_req: -+ li $22, 0 /* set EP0 to IDLE state */ -+ li $23, 1 /* NoData = 1 */ -+ -+ andi $9, $25, 0xff00 /* check bRequest */ -+ srl $9, $9, 8 -+ beqz $9, __ep0_get_cpu_info -+ sub $8, $9, 0x1 -+ beqz $8, __ep0_set_data_address -+ sub $8, $9, 0x2 -+ beqz $8, __ep0_set_data_length -+ sub $8, $9, 0x3 -+ beqz $8, __ep0_flush_caches -+ sub $8, $9, 0x4 -+ beqz $8, __ep0_prog_start1 -+ sub $8, $9, 0x5 -+ beqz $8, __ep0_prog_start2 -+ nop -+ b _ep0_idle_state_fini /* invalid request */ -+ nop -+ -+__ep0_get_cpu_info: -+ load_addr $20, cpu_info_data /* data pointer to transfer */ -+ li $21, 8 /* bytes left to transfer */ -+ li $22, 1 /* set EP0 to TX state */ -+ li $23, 0 /* NoData = 0 */ -+ -+ b _ep0_idle_state_fini -+ nop -+ -+__ep0_set_data_address: -+ li $9, 0xffff0000 -+ and $9, $25, $9 -+ andi $8, $26, 0xffff -+ or $20, $9, $8 /* data address of next transfer */ -+ -+ b _ep0_idle_state_fini -+ nop -+ -+__ep0_set_data_length: -+ li $9, 0xffff0000 -+ and $9, $25, $9 -+ andi $8, $26, 0xffff -+ or $21, $9, $8 /* data length of next transfer */ -+ -+ li $9, 0x48 /* SVDOUTPKTRDY and DATAEND */ -+ sb $9, 0x12($27) /* CSR0 */ -+ -+ /* We must write packet to FIFO before EP1-IN interrupt here. */ -+ b handle_epin1_intr -+ nop -+ -+__ep0_flush_caches: -+ /* Flush dcache and invalidate icache. */ -+ li $8, 0x80000000 -+ addi $9, $8, 0x3fe0 /* total 16KB */ -+ -+1: -+ cache 0x0, 0($8) /* Index_Invalidate_I */ -+ cache 0x1, 0($8) /* Index_Writeback_Inv_D */ -+ bne $8, $9, 1b -+ addiu $8, $8, 32 -+ -+ /* flush write-buffer */ -+ sync -+ -+ /* Invalidate BTB */ -+ mfc0 $8, $16, 7 /* CP0_CONFIG */ -+ nop -+ ori $8, 2 -+ mtc0 $8, $16, 7 -+ nop -+ -+ b _ep0_idle_state_fini -+ nop -+ -+__ep0_prog_start1: -+ li $9, 0x48 /* SVDOUTPKTRDY and DATAEND */ -+ sb $9, 0x12($27) /* CSR0 */ -+ -+ li $9, 0xffff0000 -+ and $9, $25, $9 -+ andi $8, $26, 0xffff -+ or $20, $9, $8 /* target address */ -+ -+ b xfer_d2i -+ li $19, 0x2000 /* 16KB data length */ -+ -+__ep0_prog_start2: -+ li $9, 0x48 /* SVDOUTPKTRDY and DATAEND */ -+ sb $9, 0x12($27) /* CSR0 */ -+ -+ li $9, 0xffff0000 -+ and $9, $25, $9 -+ andi $8, $26, 0xffff -+ or $20, $9, $8 /* target address */ -+ -+ jalr $20 /* jump, and place the return address in $31 */ -+ nop -+ -+__ep0_prog_start2_return: -+/* User code can return to here after executing itself, by jumping to $31 */ -+ b usb_boot_return -+ nop -+ -+ /* 2.1.2 Standard setup request */ -+_ep0_std_req: -+ andi $12, $25, 0xff00 /* check bRequest */ -+ srl $12, $12, 8 -+ sub $9, $12, 0x05 /* check USB_REQ_SET_ADDRESS */ -+ bnez $9, __ep0_req_set_config -+ nop -+ -+ /* Handle USB_REQ_SET_ADDRESS */ -+__ep0_req_set_addr: -+ srl $9, $25, 16 /* get wValue */ -+ sb $9, 0x0($27) /* set FADDR */ -+ li $23, 1 /* NoData = 1 */ -+ b _ep0_idle_state_fini -+ nop -+ -+__ep0_req_set_config: -+ sub $9, $12, 0x09 /* check USB_REQ_SET_CONFIGURATION */ -+ bnez $9, __ep0_req_get_desc -+ nop -+ -+ /* Handle USB_REQ_SET_CONFIGURATION */ -+ li $23, 1 /* NoData = 1 */ -+ b _ep0_idle_state_fini -+ nop -+ -+__ep0_req_get_desc: -+ sub $9, $12, 0x06 /* check USB_REQ_GET_DESCRIPTOR */ -+ bnez $9, _ep0_idle_state_fini -+ li $23, 1 /* NoData = 1 */ -+ -+ /* Handle USB_REQ_GET_DESCRIPTOR */ -+ li $23, 0 /* NoData = 0 */ -+ -+ srl $9, $25, 24 /* wValue >> 8 */ -+ sub $8, $9, 0x01 /* check USB_DT_DEVICE */ -+ beqz $8, ___ep0_get_dev_desc -+ srl $21, $26, 16 /* get wLength */ -+ sub $8, $9, 0x02 /* check USB_DT_CONFIG */ -+ beqz $8, ___ep0_get_conf_desc -+ sub $8, $9, 0x03 /* check USB_DT_STRING */ -+ beqz $8, ___ep0_get_string_desc -+ sub $8, $9, 0x06 /* check USB_DT_DEVICE_QUALIFIER */ -+ beqz $8, ___ep0_get_dev_qualifier -+ nop -+ b _ep0_idle_state_fini -+ nop -+ -+___ep0_get_dev_desc: -+ load_addr $20, device_desc /* data pointer */ -+ li $22, 1 /* set EP0 to TX state */ -+ sub $8, $21, 18 -+ blez $8, _ep0_idle_state_fini /* wLength <= 18 */ -+ nop -+ li $21, 18 /* max length of device_desc */ -+ b _ep0_idle_state_fini -+ nop -+ -+___ep0_get_dev_qualifier: -+ load_addr $20, dev_qualifier /* data pointer */ -+ li $22, 1 /* set EP0 to TX state */ -+ sub $8, $21, 10 -+ blez $8, _ep0_idle_state_fini /* wLength <= 10 */ -+ nop -+ li $21, 10 /* max length of dev_qualifier */ -+ b _ep0_idle_state_fini -+ nop -+ -+___ep0_get_conf_desc: -+ load_addr $20, config_desc_fs /* data pointer of FS mode */ -+ lbu $8, 0x01($27) /* read POWER */ -+ andi $8, 0x10 /* test HS_MODE */ -+ beqz $8, ___ep0_get_conf_desc2 -+ nop -+ load_addr $20, config_desc_hs /* data pointer of HS mode */ -+ -+___ep0_get_conf_desc2: -+ li $22, 1 /* set EP0 to TX state */ -+ sub $8, $21, 32 -+ blez $8, _ep0_idle_state_fini /* wLength <= 32 */ -+ nop -+ li $21, 32 /* max length of config_desc */ -+ b _ep0_idle_state_fini -+ nop -+ -+___ep0_get_string_desc: -+ li $22, 1 /* set EP0 to TX state */ -+ -+ srl $9, $25, 16 /* wValue & 0xff */ -+ andi $9, 0xff -+ -+ sub $8, $9, 1 -+ beqz $8, ___ep0_get_string_manufacture -+ sub $8, $9, 2 -+ beqz $8, ___ep0_get_string_product -+ nop -+ -+___ep0_get_string_lang_ids: -+ load_addr $20, string_lang_ids /* data pointer */ -+ b _ep0_idle_state_fini -+ li $21, 4 /* data length */ -+ -+___ep0_get_string_manufacture: -+ load_addr $20, string_manufacture /* data pointer */ -+ b _ep0_idle_state_fini -+ li $21, 16 /* data length */ -+ -+___ep0_get_string_product: -+ load_addr $20, string_product /* data pointer */ -+ b _ep0_idle_state_fini -+ li $21, 46 /* data length */ -+ -+_ep0_idle_state_fini: -+ li $9, 0x40 /* SVDOUTPKTRDY */ -+ beqz $23, _ep0_idle_state_fini2 -+ nop -+ ori $9, $9, 0x08 /* DATAEND */ -+_ep0_idle_state_fini2: -+ sb $9, 0x12($27) /* CSR0 */ -+ beqz $22, check_intr_ep1in -+ nop -+ -+ /* 2.2 Handle EP0 TX state interrupt */ -+ep0_tx_state: -+ sub $9, $22, 1 -+ bnez $9, check_intr_ep1in -+ nop -+ -+ sub $9, $21, 64 /* max packetsize */ -+ blez $9, _ep0_tx_state2 /* data count <= 64 */ -+ ori $19, $21, 0 -+ li $19, 64 -+ -+_ep0_tx_state2: -+ beqz $19, _ep0_tx_state3 /* send ZLP */ -+ ori $18, $19, 0 /* record bytes to be transferred */ -+ sub $21, $21, $19 /* decrement data count */ -+ -+_ep0_fifo_write_loop: -+ lbu $9, 0($20) /* read data */ -+ sb $9, 0x20($27) /* load FIFO */ -+ sub $19, $19, 1 /* decrement counter */ -+ bnez $19, _ep0_fifo_write_loop -+ addi $20, $20, 1 /* increment data pointer */ -+ -+ sub $9, $18, 64 /* max packetsize */ -+ beqz $9, _ep0_tx_state4 -+ nop -+ -+_ep0_tx_state3: -+ /* transferred bytes < max packetsize */ -+ li $9, 0x0a /* set INPKTRDY and DATAEND */ -+ sb $9, 0x12($27) /* CSR0 */ -+ li $22, 0 /* set EP0 to IDLE state */ -+ b check_intr_ep1in -+ nop -+ -+_ep0_tx_state4: -+ /* transferred bytes == max packetsize */ -+ li $9, 0x02 /* set INPKTRDY */ -+ sb $9, 0x12($27) /* CSR0 */ -+ b check_intr_ep1in -+ nop -+ -+ /* 3. Check and handle EP1 BULK-IN interrupt */ -+check_intr_ep1in: -+ andi $9, $10, 0x2 /* check EP1 IN interrupt */ -+ beqz $9, check_intr_ep1out -+ nop -+ -+handle_epin1_intr: -+ li $9, 1 -+ sb $9, 0x0e($27) /* set INDEX 1 */ -+ lbu $9, 0x12($27) /* read INCSR */ -+ -+ andi $8, $9, 0x2 /* check INCSR_FFNOTEMPT */ -+ bnez $8, _epin1_tx_state4 -+ nop -+ -+_epin1_write_fifo: -+ lhu $9, 0x10($27) /* get INMAXP */ -+ sub $8, $21, $9 -+ blez $8, _epin1_tx_state1 /* bytes left <= INMAXP */ -+ ori $19, $21, 0 -+ ori $19, $9, 0 -+ -+_epin1_tx_state1: -+ beqz $19, _epin1_tx_state4 /* No data */ -+ nop -+ -+ sub $21, $21, $19 /* decrement data count */ -+ -+ srl $5, $19, 2 /* # of word */ -+ andi $6, $19, 0x3 /* # of byte */ -+ beqz $5, _epin1_tx_state2 -+ nop -+ -+_epin1_fifo_write_word: -+ lw $9, 0($20) /* read data from source address */ -+ sw $9, 0x24($27) /* write FIFO */ -+ sub $5, $5, 1 /* decrement counter */ -+ bnez $5, _epin1_fifo_write_word -+ addiu $20, $20, 4 /* increment dest address */ -+ -+_epin1_tx_state2: -+ beqz $6, _epin1_tx_state3 -+ nop -+ -+_epin1_fifo_write_byte: -+ lbu $9, 0($20) /* read data from source address */ -+ sb $9, 0x24($27) /* write FIFO */ -+ sub $6, $6, 1 /* decrement counter */ -+ bnez $6, _epin1_fifo_write_byte -+ addiu $20, $20, 1 /* increment dest address */ -+ -+_epin1_tx_state3: -+ li $9, 0x1 -+ sb $9, 0x12($27) /* INCSR, set INPKTRDY */ -+ -+_epin1_tx_state4: -+ /* 4. Check and handle EP1 BULK-OUT interrupt */ -+check_intr_ep1out: -+ lhu $9, 0x04($27) /* read INTROUT */ -+ andi $9, 0x2 -+ beqz $9, check_status_next -+ nop -+ -+handle_epout1_intr: -+ li $9, 1 -+ sb $9, 0x0e($27) /* set INDEX 1 */ -+ -+ lbu $9, 0x16($27) /* read OUTCSR */ -+ andi $9, 0x1 /* check OUTPKTRDY */ -+ beqz $9, check_status_next -+ nop -+ -+_epout1_read_fifo: -+ lhu $19, 0x18($27) /* read OUTCOUNT */ -+ srl $5, $19, 2 /* # of word */ -+ andi $6, $19, 0x3 /* # of byte */ -+ beqz $5, _epout1_rx_state1 -+ nop -+ -+_epout1_fifo_read_word: -+ lw $9, 0x24($27) /* read FIFO */ -+ sw $9, 0($20) /* store to dest address */ -+ sub $5, $5, 1 /* decrement counter */ -+ bnez $5, _epout1_fifo_read_word -+ addiu $20, $20, 4 /* increment dest address */ -+ -+_epout1_rx_state1: -+ beqz $6, _epout1_rx_state2 -+ nop -+ -+_epout1_fifo_read_byte: -+ lbu $9, 0x24($27) /* read FIFO */ -+ sb $9, 0($20) /* store to dest address */ -+ sub $6, $6, 1 /* decrement counter */ -+ bnez $6, _epout1_fifo_read_byte -+ addiu $20, $20, 1 /* increment dest address */ -+ -+_epout1_rx_state2: -+ sb $0, 0x16($27) /* clear OUTPKTRDY */ -+ -+check_status_next: -+ b usb_command_loop -+ nop -+ -+/* Device/Configuration/Interface/Endpoint/String Descriptors */ -+ -+ .align 2 -+device_desc: -+ .byte 0x12 /* bLength */ -+ .byte 0x01 /* bDescriptorType */ -+ .byte 0x00 /* bcdUSB */ -+ .byte 0x02 /* bcdUSB */ -+ .byte 0x00 /* bDeviceClass */ -+ .byte 0x00 /* bDeviceSubClass */ -+ .byte 0x00 /* bDeviceProtocol */ -+ .byte 0x40 /* bMaxPacketSize0 */ -+ .byte 0x1a /* idVendor */ -+ .byte 0x60 /* idVendor */ -+ .byte 0x40 /* idProduct */ -+ .byte 0x47 /* idProduct */ -+ .byte 0x00 /* bcdDevice */ -+ .byte 0x01 /* bcdDevice */ -+ .byte 0x01 /* iManufacturer */ -+ .byte 0x02 /* iProduct */ -+ .byte 0x00 /* iSerialNumber */ -+ .byte 0x01 /* bNumConfigurations */ -+ -+ .align 2 -+dev_qualifier: -+ .byte 0x0a /* bLength */ -+ .byte 0x06 /* bDescriptorType */ -+ .byte 0x00 /* bcdUSB */ -+ .byte 0x02 /* bcdUSB */ -+ .byte 0x00 /* bDeviceClass */ -+ .byte 0x00 /* bDeviceSubClass */ -+ .byte 0x00 /* bDeviceProtocol */ -+ .byte 0x40 /* bMaxPacketSize0 */ -+ .byte 0x01 /* bNumConfigurations */ -+ .byte 0x00 /* bRESERVED */ -+ -+ .align 2 -+config_desc_hs: -+ .byte 0x09 /* bLength */ -+ .byte 0x02 /* bDescriptorType */ -+ .byte 0x20 /* wTotalLength */ -+ .byte 0x00 /* wTotalLength */ -+ .byte 0x01 /* bNumInterfaces */ -+ .byte 0x01 /* bConfigurationValue */ -+ .byte 0x00 /* iConfiguration */ -+ .byte 0xc0 /* bmAttributes */ -+ .byte 0x01 /* MaxPower */ -+intf_desc_hs: -+ .byte 0x09 /* bLength */ -+ .byte 0x04 /* bDescriptorType */ -+ .byte 0x00 /* bInterfaceNumber */ -+ .byte 0x00 /* bAlternateSetting */ -+ .byte 0x02 /* bNumEndpoints */ -+ .byte 0xff /* bInterfaceClass */ -+ .byte 0x00 /* bInterfaceSubClass */ -+ .byte 0x50 /* bInterfaceProtocol */ -+ .byte 0x00 /* iInterface */ -+ep1_desc_hs: -+ .byte 0x07 /* bLength */ -+ .byte 0x05 /* bDescriptorType */ -+ .byte 0x01 /* bEndpointAddress */ -+ .byte 0x02 /* bmAttributes */ -+ .byte 0x00 /* wMaxPacketSize */ -+ .byte 0x02 /* wMaxPacketSize */ -+ .byte 0x00 /* bInterval */ -+ep2_desc_hs: -+ .byte 0x07 /* bLength */ -+ .byte 0x05 /* bDescriptorType */ -+ .byte 0x81 /* bEndpointAddress */ -+ .byte 0x02 /* bmAttributes */ -+ .byte 0x00 /* wMaxPacketSize */ -+ .byte 0x02 /* wMaxPacketSize */ -+ .byte 0x00 /* bInterval */ -+ -+ .align 2 -+config_desc_fs: -+ .byte 0x09 /* bLength */ -+ .byte 0x02 /* bDescriptorType */ -+ .byte 0x20 /* wTotalLength */ -+ .byte 0x00 /* wTotalLength */ -+ .byte 0x01 /* bNumInterfaces */ -+ .byte 0x01 /* bConfigurationValue */ -+ .byte 0x00 /* iConfiguration */ -+ .byte 0xc0 /* bmAttributes */ -+ .byte 0x01 /* MaxPower */ -+intf_desc_fs: -+ .byte 0x09 /* bLength */ -+ .byte 0x04 /* bDescriptorType */ -+ .byte 0x00 /* bInterfaceNumber */ -+ .byte 0x00 /* bAlternateSetting */ -+ .byte 0x02 /* bNumEndpoints */ -+ .byte 0xff /* bInterfaceClass */ -+ .byte 0x00 /* bInterfaceSubClass */ -+ .byte 0x50 /* bInterfaceProtocol */ -+ .byte 0x00 /* iInterface */ -+ep1_desc_fs: -+ .byte 0x07 /* bLength */ -+ .byte 0x05 /* bDescriptorType */ -+ .byte 0x01 /* bEndpointAddress */ -+ .byte 0x02 /* bmAttributes */ -+ .byte 0x40 /* wMaxPacketSize */ -+ .byte 0x00 /* wMaxPacketSize */ -+ .byte 0x00 /* bInterval */ -+ep2_desc_fs: -+ .byte 0x07 /* bLength */ -+ .byte 0x05 /* bDescriptorType */ -+ .byte 0x81 /* bEndpointAddress */ -+ .byte 0x02 /* bmAttributes */ -+ .byte 0x40 /* wMaxPacketSize */ -+ .byte 0x00 /* wMaxPacketSize */ -+ .byte 0x00 /* bInterval */ -+ -+ .align 2 -+string_lang_ids: -+ .byte 0x04 -+ .byte 0x03 -+ .byte 0x09 -+ .byte 0x04 -+ -+ .align 2 -+string_manufacture: -+ .byte 0x10 -+ .byte 0x03 -+ .byte 0x49 -+ .byte 0x00 -+ .byte 0x6e -+ .byte 0x00 -+ .byte 0x67 -+ .byte 0x00 -+ .byte 0x65 -+ .byte 0x00 -+ .byte 0x6e -+ .byte 0x00 -+ .byte 0x69 -+ .byte 0x00 -+ .byte 0x63 -+ .byte 0x00 -+ -+ .align 2 -+string_product: -+ .byte 0x2e -+ .byte 0x03 -+ .byte 0x4a -+ .byte 0x00 -+ .byte 0x5a -+ .byte 0x00 -+ .byte 0x34 -+ .byte 0x00 -+ .byte 0x37 -+ .byte 0x00 -+ .byte 0x34 -+ .byte 0x00 -+ .byte 0x30 -+ .byte 0x00 -+ .byte 0x20 -+ .byte 0x00 -+ .byte 0x55 -+ .byte 0x00 -+ .byte 0x53 -+ .byte 0x00 -+ .byte 0x42 -+ .byte 0x00 -+ .byte 0x20 -+ .byte 0x00 -+ .byte 0x42 -+ .byte 0x00 -+ .byte 0x6f -+ .byte 0x00 -+ .byte 0x6f -+ .byte 0x00 -+ .byte 0x74 -+ .byte 0x00 -+ .byte 0x20 -+ .byte 0x00 -+ .byte 0x44 -+ .byte 0x00 -+ .byte 0x65 -+ .byte 0x00 -+ .byte 0x76 -+ .byte 0x00 -+ .byte 0x69 -+ .byte 0x00 -+ .byte 0x63 -+ .byte 0x00 -+ .byte 0x65 -+ .byte 0x00 -+ -+ .align 2 -+cpu_info_data: -+ .byte 0x4a -+ .byte 0x5a -+ .byte 0x34 -+ .byte 0x37 -+ .byte 0x34 -+ .byte 0x30 -+ .byte 0x56 -+ .byte 0x31 -+usbboot_end: -+ -+ .set reorder --- -1.7.9.5 - diff --git a/package/boot/uboot-xburst/patches/0003-add-mmc-support.patch b/package/boot/uboot-xburst/patches/0003-add-mmc-support.patch deleted file mode 100644 index e9baa7c373..0000000000 --- a/package/boot/uboot-xburst/patches/0003-add-mmc-support.patch +++ /dev/null @@ -1,1664 +0,0 @@ -From bd36739e77669e8df45c38f6acfe2cea511534d9 Mon Sep 17 00:00:00 2001 -From: Xiangfu -Date: Wed, 10 Oct 2012 18:19:41 +0800 -Subject: [PATCH 3/6] add mmc support - ---- - arch/mips/include/asm/jz4740.h | 166 ++++++ - board/qi/qi_lb60/qi_lb60.c | 9 +- - drivers/mmc/Makefile | 1 + - drivers/mmc/jz_mmc.c | 1179 ++++++++++++++++++++++++++++++++++++++++ - drivers/mmc/jz_mmc.h | 176 ++++++ - include/configs/qi_lb60.h | 9 + - include/mmc.h | 40 ++ - 7 files changed, 1578 insertions(+), 2 deletions(-) - create mode 100644 drivers/mmc/jz_mmc.c - create mode 100644 drivers/mmc/jz_mmc.h - -diff --git a/arch/mips/include/asm/jz4740.h b/arch/mips/include/asm/jz4740.h -index 7a7cfff..68287fb 100644 ---- a/arch/mips/include/asm/jz4740.h -+++ b/arch/mips/include/asm/jz4740.h -@@ -1146,5 +1146,171 @@ extern void sdram_init(void); - extern void calc_clocks(void); - extern void rtc_init(void); - -+/************************************************************************* -+ * MSC -+ *************************************************************************/ -+#define REG8(addr) *((volatile u8 *)(addr)) -+#define REG16(addr) *((volatile u16 *)(addr)) -+#define REG32(addr) *((volatile u32 *)(addr)) -+ -+#define CPM_BASE 0xB0000000 -+#define CPM_CPCCR (CPM_BASE+0x00) -+#define CPM_MSCCDR (CPM_BASE+0x68) -+#define REG_CPM_MSCCDR REG32(CPM_MSCCDR) -+#define REG_CPM_CPCCR REG32(CPM_CPCCR) -+ -+#define MSC_BASE 0xB0021000 -+ -+#define MSC_STRPCL (MSC_BASE + 0x000) -+#define MSC_STAT (MSC_BASE + 0x004) -+#define MSC_CLKRT (MSC_BASE + 0x008) -+#define MSC_CMDAT (MSC_BASE + 0x00C) -+#define MSC_RESTO (MSC_BASE + 0x010) -+#define MSC_RDTO (MSC_BASE + 0x014) -+#define MSC_BLKLEN (MSC_BASE + 0x018) -+#define MSC_NOB (MSC_BASE + 0x01C) -+#define MSC_SNOB (MSC_BASE + 0x020) -+#define MSC_IMASK (MSC_BASE + 0x024) -+#define MSC_IREG (MSC_BASE + 0x028) -+#define MSC_CMD (MSC_BASE + 0x02C) -+#define MSC_ARG (MSC_BASE + 0x030) -+#define MSC_RES (MSC_BASE + 0x034) -+#define MSC_RXFIFO (MSC_BASE + 0x038) -+#define MSC_TXFIFO (MSC_BASE + 0x03C) -+ -+#define REG_MSC_STRPCL REG16(MSC_STRPCL) -+#define REG_MSC_STAT REG32(MSC_STAT) -+#define REG_MSC_CLKRT REG16(MSC_CLKRT) -+#define REG_MSC_CMDAT REG32(MSC_CMDAT) -+#define REG_MSC_RESTO REG16(MSC_RESTO) -+#define REG_MSC_RDTO REG16(MSC_RDTO) -+#define REG_MSC_BLKLEN REG16(MSC_BLKLEN) -+#define REG_MSC_NOB REG16(MSC_NOB) -+#define REG_MSC_SNOB REG16(MSC_SNOB) -+#define REG_MSC_IMASK REG16(MSC_IMASK) -+#define REG_MSC_IREG REG16(MSC_IREG) -+#define REG_MSC_CMD REG8(MSC_CMD) -+#define REG_MSC_ARG REG32(MSC_ARG) -+#define REG_MSC_RES REG16(MSC_RES) -+#define REG_MSC_RXFIFO REG32(MSC_RXFIFO) -+#define REG_MSC_TXFIFO REG32(MSC_TXFIFO) -+ -+/* MSC Clock and Control Register (MSC_STRPCL) */ -+ -+#define MSC_STRPCL_EXIT_MULTIPLE (1 << 7) -+#define MSC_STRPCL_EXIT_TRANSFER (1 << 6) -+#define MSC_STRPCL_START_READWAIT (1 << 5) -+#define MSC_STRPCL_STOP_READWAIT (1 << 4) -+#define MSC_STRPCL_RESET (1 << 3) -+#define MSC_STRPCL_START_OP (1 << 2) -+#define MSC_STRPCL_CLOCK_CONTROL_BIT 0 -+#define MSC_STRPCL_CLOCK_CONTROL_MASK (0x3 << MSC_STRPCL_CLOCK_CONTROL_BIT) -+ #define MSC_STRPCL_CLOCK_CONTROL_STOP (0x1 << MSC_STRPCL_CLOCK_CONTROL_BIT) /* Stop MMC/SD clock */ -+ #define MSC_STRPCL_CLOCK_CONTROL_START (0x2 << MSC_STRPCL_CLOCK_CONTROL_BIT) /* Start MMC/SD clock */ -+ -+/* MSC Status Register (MSC_STAT) */ -+ -+#define MSC_STAT_IS_RESETTING (1 << 15) -+#define MSC_STAT_SDIO_INT_ACTIVE (1 << 14) -+#define MSC_STAT_PRG_DONE (1 << 13) -+#define MSC_STAT_DATA_TRAN_DONE (1 << 12) -+#define MSC_STAT_END_CMD_RES (1 << 11) -+#define MSC_STAT_DATA_FIFO_AFULL (1 << 10) -+#define MSC_STAT_IS_READWAIT (1 << 9) -+#define MSC_STAT_CLK_EN (1 << 8) -+#define MSC_STAT_DATA_FIFO_FULL (1 << 7) -+#define MSC_STAT_DATA_FIFO_EMPTY (1 << 6) -+#define MSC_STAT_CRC_RES_ERR (1 << 5) -+#define MSC_STAT_CRC_READ_ERROR (1 << 4) -+#define MSC_STAT_CRC_WRITE_ERROR_BIT 2 -+#define MSC_STAT_CRC_WRITE_ERROR_MASK (0x3 << MSC_STAT_CRC_WRITE_ERROR_BIT) -+ #define MSC_STAT_CRC_WRITE_ERROR_NO (0 << MSC_STAT_CRC_WRITE_ERROR_BIT) /* No error on transmission of data */ -+ #define MSC_STAT_CRC_WRITE_ERROR (1 << MSC_STAT_CRC_WRITE_ERROR_BIT) /* Card observed erroneous transmission of data */ -+ #define MSC_STAT_CRC_WRITE_ERROR_NOSTS (2 << MSC_STAT_CRC_WRITE_ERROR_BIT) /* No CRC status is sent back */ -+#define MSC_STAT_TIME_OUT_RES (1 << 1) -+#define MSC_STAT_TIME_OUT_READ (1 << 0) -+ -+/* MSC Bus Clock Control Register (MSC_CLKRT) */ -+ -+#define MSC_CLKRT_CLK_RATE_BIT 0 -+#define MSC_CLKRT_CLK_RATE_MASK (0x7 << MSC_CLKRT_CLK_RATE_BIT) -+ #define MSC_CLKRT_CLK_RATE_DIV_1 (0x0 << MSC_CLKRT_CLK_RATE_BIT) /* CLK_SRC */ -+ #define MSC_CLKRT_CLK_RATE_DIV_2 (0x1 << MSC_CLKRT_CLK_RATE_BIT) /* 1/2 of CLK_SRC */ -+ #define MSC_CLKRT_CLK_RATE_DIV_4 (0x2 << MSC_CLKRT_CLK_RATE_BIT) /* 1/4 of CLK_SRC */ -+ #define MSC_CLKRT_CLK_RATE_DIV_8 (0x3 << MSC_CLKRT_CLK_RATE_BIT) /* 1/8 of CLK_SRC */ -+ #define MSC_CLKRT_CLK_RATE_DIV_16 (0x4 << MSC_CLKRT_CLK_RATE_BIT) /* 1/16 of CLK_SRC */ -+ #define MSC_CLKRT_CLK_RATE_DIV_32 (0x5 << MSC_CLKRT_CLK_RATE_BIT) /* 1/32 of CLK_SRC */ -+ #define MSC_CLKRT_CLK_RATE_DIV_64 (0x6 << MSC_CLKRT_CLK_RATE_BIT) /* 1/64 of CLK_SRC */ -+ #define MSC_CLKRT_CLK_RATE_DIV_128 (0x7 << MSC_CLKRT_CLK_RATE_BIT) /* 1/128 of CLK_SRC */ -+ -+/* MSC Command Sequence Control Register (MSC_CMDAT) */ -+ -+#define MSC_CMDAT_IO_ABORT (1 << 11) -+#define MSC_CMDAT_BUS_WIDTH_BIT 9 -+#define MSC_CMDAT_BUS_WIDTH_MASK (0x3 << MSC_CMDAT_BUS_WIDTH_BIT) -+#define MSC_CMDAT_BUS_WIDTH_1BIT (0x0 << MSC_CMDAT_BUS_WIDTH_BIT) -+#define MSC_CMDAT_BUS_WIDTH_4BIT (0x2 << MSC_CMDAT_BUS_WIDTH_BIT) -+#define MSC_CMDAT_DMA_EN (1 << 8) -+#define MSC_CMDAT_INIT (1 << 7) -+#define MSC_CMDAT_BUSY (1 << 6) -+#define MSC_CMDAT_STREAM_BLOCK (1 << 5) -+#define MSC_CMDAT_WRITE (1 << 4) -+#define MSC_CMDAT_READ (0 << 4) -+#define MSC_CMDAT_DATA_EN (1 << 3) -+#define MSC_CMDAT_RESPONSE_BIT 0 -+#define MSC_CMDAT_RESPONSE_MASK (0x7 << MSC_CMDAT_RESPONSE_BIT) -+#define MSC_CMDAT_RESPONSE_NONE (0x0 << MSC_CMDAT_RESPONSE_BIT) -+#define MSC_CMDAT_RESPONSE_R1 (0x1 << MSC_CMDAT_RESPONSE_BIT) -+#define MSC_CMDAT_RESPONSE_R2 (0x2 << MSC_CMDAT_RESPONSE_BIT) -+#define MSC_CMDAT_RESPONSE_R3 (0x3 << MSC_CMDAT_RESPONSE_BIT) -+#define MSC_CMDAT_RESPONSE_R4 (0x4 << MSC_CMDAT_RESPONSE_BIT) -+#define MSC_CMDAT_RESPONSE_R5 (0x5 << MSC_CMDAT_RESPONSE_BIT) -+#define MSC_CMDAT_RESPONSE_R6 (0x6 << MSC_CMDAT_RESPONSE_BIT) -+ -+/* MSC Interrupts Mask Register (MSC_IMASK) */ -+#define MSC_IMASK_SDIO (1 << 7) -+#define MSC_IMASK_TXFIFO_WR_REQ (1 << 6) -+#define MSC_IMASK_RXFIFO_RD_REQ (1 << 5) -+#define MSC_IMASK_END_CMD_RES (1 << 2) -+#define MSC_IMASK_PRG_DONE (1 << 1) -+#define MSC_IMASK_DATA_TRAN_DONE (1 << 0) -+ -+ -+/* MSC Interrupts Status Register (MSC_IREG) */ -+#define MSC_IREG_SDIO (1 << 7) -+#define MSC_IREG_TXFIFO_WR_REQ (1 << 6) -+#define MSC_IREG_RXFIFO_RD_REQ (1 << 5) -+#define MSC_IREG_END_CMD_RES (1 << 2) -+#define MSC_IREG_PRG_DONE (1 << 1) -+#define MSC_IREG_DATA_TRAN_DONE (1 << 0) -+ -+static __inline__ unsigned int __cpm_get_pllout2(void) -+{ -+ if (REG_CPM_CPCCR & CPM_CPCCR_PCS) -+ return __cpm_get_pllout(); -+ else -+ return __cpm_get_pllout()/2; -+} -+ -+static inline void __cpm_select_msc_clk(int sd) -+{ -+ unsigned int pllout2 = __cpm_get_pllout2(); -+ unsigned int div = 0; -+ -+ if (sd) { -+ div = pllout2 / 24000000; -+ } -+ else { -+ div = pllout2 / 16000000; -+ } -+ -+ REG_CPM_MSCCDR = div - 1; -+} -+#define __msc_reset() \ -+do { \ -+ REG_MSC_STRPCL = MSC_STRPCL_RESET; \ -+ while (REG_MSC_STAT & MSC_STAT_IS_RESETTING); \ -+} while (0) -+ - #endif /* !__ASSEMBLY__ */ - #endif /* __JZ4740_H__ */ -diff --git a/board/qi/qi_lb60/qi_lb60.c b/board/qi/qi_lb60/qi_lb60.c -index 3bd4e2f..a2ba648 100644 ---- a/board/qi/qi_lb60/qi_lb60.c -+++ b/board/qi/qi_lb60/qi_lb60.c -@@ -40,8 +40,13 @@ static void gpio_init(void) - __gpio_clear_pin(GPIO_KEYOUT_BASE + i); - } - -- __gpio_as_input(GPIO_KEYIN_8); -- __gpio_enable_pull(GPIO_KEYIN_8); -+ if (__gpio_get_pin(GPIO_KEYIN_BASE + 2) == 0){ -+ printf("[S] pressed, enable UART0\n"); -+ __gpio_as_uart0(); -+ } else { -+ __gpio_as_input(GPIO_KEYIN_8); -+ __gpio_enable_pull(GPIO_KEYIN_8); -+ } - - /* enable the TP4, TP5 as UART0 */ - __gpio_jtag_to_uart0(); -diff --git a/drivers/mmc/Makefile b/drivers/mmc/Makefile -index 565ba6a..3c717b1 100644 ---- a/drivers/mmc/Makefile -+++ b/drivers/mmc/Makefile -@@ -47,6 +47,7 @@ COBJS-$(CONFIG_SDHCI) += sdhci.o - COBJS-$(CONFIG_S5P_SDHCI) += s5p_sdhci.o - COBJS-$(CONFIG_SH_MMCIF) += sh_mmcif.o - COBJS-$(CONFIG_TEGRA_MMC) += tegra_mmc.o -+COBJS-$(CONFIG_JZ4740_MMC) += jz_mmc.o - - COBJS := $(COBJS-y) - SRCS := $(COBJS:.o=.c) -diff --git a/drivers/mmc/jz_mmc.c b/drivers/mmc/jz_mmc.c -new file mode 100644 -index 0000000..642cecc ---- /dev/null -+++ b/drivers/mmc/jz_mmc.c -@@ -0,0 +1,1179 @@ -+/* -+ * (C) Copyright 2003 -+ * Kyle Harris, Nexus Technologies, Inc. kharris@nexus-tech.net -+ * -+ * 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 -+#include -+#include -+#include -+ -+#include -+#include -+#include "jz_mmc.h" -+ -+static int sd2_0 = 0; -+static int mmc_ready = 0; -+static int use_4bit; /* Use 4-bit data bus */ -+/* -+ * MMC Events -+ */ -+#define MMC_EVENT_NONE 0x00 /* No events */ -+#define MMC_EVENT_RX_DATA_DONE 0x01 /* Rx data done */ -+#define MMC_EVENT_TX_DATA_DONE 0x02 /* Tx data done */ -+#define MMC_EVENT_PROG_DONE 0x04 /* Programming is done */ -+ -+ -+#define MMC_IRQ_MASK() \ -+do { \ -+ REG_MSC_IMASK = 0xffff; \ -+ REG_MSC_IREG = 0xffff; \ -+} while (0) -+ -+/* -+ * GPIO definition -+ */ -+#if defined(CONFIG_SAKC) -+ -+#define __msc_init_io() \ -+do { \ -+ __gpio_as_input(GPIO_SD_CD_N); \ -+} while (0) -+ -+#else -+#define __msc_init_io() \ -+do { \ -+ __gpio_as_output(GPIO_SD_VCC_EN_N); \ -+ __gpio_as_input(GPIO_SD_CD_N); \ -+} while (0) -+ -+#define __msc_enable_power() \ -+do { \ -+ __gpio_clear_pin(GPIO_SD_VCC_EN_N); \ -+} while (0) -+ -+#define __msc_disable_power() \ -+do { \ -+ __gpio_set_pin(GPIO_SD_VCC_EN_N); \ -+} while (0) -+ -+#endif /* CONFIG_SAKE */ -+ -+#define __msc_card_detected() \ -+({ \ -+ int detected = 1; \ -+ __gpio_as_input(GPIO_SD_CD_N); \ -+ __gpio_disable_pull(GPIO_SD_CD_N); \ -+ if (!__gpio_get_pin(GPIO_SD_CD_N)) \ -+ detected = 0; \ -+ detected; \ -+}) -+ -+/* -+ * Local functions -+ */ -+ -+extern int -+fat_register_device(block_dev_desc_t *dev_desc, int part_no); -+ -+static block_dev_desc_t mmc_dev; -+ -+block_dev_desc_t * mmc_get_dev(int dev) -+{ -+ return ((block_dev_desc_t *)&mmc_dev); -+} -+ -+/* Stop the MMC clock and wait while it happens */ -+static inline int jz_mmc_stop_clock(void) -+{ -+ int timeout = 1000; -+ -+ REG_MSC_STRPCL = MSC_STRPCL_CLOCK_CONTROL_STOP; -+ -+ while (timeout && (REG_MSC_STAT & MSC_STAT_CLK_EN)) { -+ timeout--; -+ if (timeout == 0) -+ return MMC_ERROR_TIMEOUT; -+ udelay(1); -+ } -+ return MMC_NO_ERROR; -+} -+ -+/* Start the MMC clock and operation */ -+static inline int jz_mmc_start_clock(void) -+{ -+ REG_MSC_STRPCL = MSC_STRPCL_CLOCK_CONTROL_START | MSC_STRPCL_START_OP; -+ return MMC_NO_ERROR; -+} -+ -+static inline u32 jz_mmc_calc_clkrt(int is_sd, u32 rate) -+{ -+ u32 clkrt = 0; -+ u32 clk_src = is_sd ? 24000000 : 16000000; -+ -+ while (rate < clk_src) { -+ clkrt ++; -+ clk_src >>= 1; -+ } -+ -+ return clkrt; -+} -+ -+/* Set the MMC clock frequency */ -+void jz_mmc_set_clock(int sd, u32 rate) -+{ -+ jz_mmc_stop_clock(); -+ -+ /* Select clock source of MSC */ -+ __cpm_select_msc_clk(sd); -+ -+ /* Set clock dividor of MSC */ -+ REG_MSC_CLKRT = jz_mmc_calc_clkrt(sd, rate); -+} -+ -+static int jz_mmc_check_status(struct mmc_request *request) -+{ -+ u32 status = REG_MSC_STAT; -+ -+ /* Checking for response or data timeout */ -+ if (status & (MSC_STAT_TIME_OUT_RES | MSC_STAT_TIME_OUT_READ)) { -+ printf("MMC/SD timeout, MMC_STAT 0x%x CMD %d\n", status, request->cmd); -+ return MMC_ERROR_TIMEOUT; -+ } -+ -+ /* Checking for CRC error */ -+ if (status & (MSC_STAT_CRC_READ_ERROR | MSC_STAT_CRC_WRITE_ERROR | MSC_STAT_CRC_RES_ERR)) { -+ printf("MMC/CD CRC error, MMC_STAT 0x%x\n", status); -+ return MMC_ERROR_CRC; -+ } -+ -+ return MMC_NO_ERROR; -+} -+ -+/* Obtain response to the command and store it to response buffer */ -+static void jz_mmc_get_response(struct mmc_request *request) -+{ -+ int i; -+ u8 *buf; -+ u32 data; -+ -+ debug("fetch response for request %d, cmd %d\n", -+ request->rtype, request->cmd); -+ -+ buf = request->response; -+ request->result = MMC_NO_ERROR; -+ -+ switch (request->rtype) { -+ case RESPONSE_R1: case RESPONSE_R1B: case RESPONSE_R6: -+ case RESPONSE_R3: case RESPONSE_R4: case RESPONSE_R5: -+ { -+ data = REG_MSC_RES; -+ buf[0] = (data >> 8) & 0xff; -+ buf[1] = data & 0xff; -+ data = REG_MSC_RES; -+ buf[2] = (data >> 8) & 0xff; -+ buf[3] = data & 0xff; -+ data = REG_MSC_RES; -+ buf[4] = data & 0xff; -+ -+ debug("request %d, response [%02x %02x %02x %02x %02x]\n", -+ request->rtype, buf[0], buf[1], buf[2], buf[3], buf[4]); -+ break; -+ } -+ case RESPONSE_R2_CID: case RESPONSE_R2_CSD: -+ { -+ for (i = 0; i < 16; i += 2) { -+ data = REG_MSC_RES; -+ buf[i] = (data >> 8) & 0xff; -+ buf[i+1] = data & 0xff; -+ } -+ debug("request %d, response [", request->rtype); -+#if CONFIG_MMC_DEBUG_VERBOSE > 2 -+ if (g_mmc_debug >= 3) { -+ int n; -+ for (n = 0; n < 17; n++) -+ printk("%02x ", buf[n]); -+ printk("]\n"); -+ } -+#endif -+ break; -+ } -+ case RESPONSE_NONE: -+ debug("No response\n"); -+ break; -+ -+ default: -+ debug("unhandled response type for request %d\n", request->rtype); -+ break; -+ } -+} -+ -+static int jz_mmc_receive_data(struct mmc_request *req) -+{ -+ u32 stat, timeout, data, cnt; -+ u8 *buf = req->buffer; -+ u32 wblocklen = (u32)(req->block_len + 3) >> 2; /* length in word */ -+ -+ timeout = 0x3ffffff; -+ -+ while (timeout) { -+ timeout--; -+ stat = REG_MSC_STAT; -+ -+ if (stat & MSC_STAT_TIME_OUT_READ) -+ return MMC_ERROR_TIMEOUT; -+ else if (stat & MSC_STAT_CRC_READ_ERROR) -+ return MMC_ERROR_CRC; -+ else if (!(stat & MSC_STAT_DATA_FIFO_EMPTY) -+ || (stat & MSC_STAT_DATA_FIFO_AFULL)) { -+ /* Ready to read data */ -+ break; -+ } -+ udelay(1); -+ } -+ if (!timeout) -+ return MMC_ERROR_TIMEOUT; -+ -+ /* Read data from RXFIFO. It could be FULL or PARTIAL FULL */ -+ cnt = wblocklen; -+ while (cnt) { -+ data = REG_MSC_RXFIFO; -+ { -+ *buf++ = (u8)(data >> 0); -+ *buf++ = (u8)(data >> 8); -+ *buf++ = (u8)(data >> 16); -+ *buf++ = (u8)(data >> 24); -+ } -+ cnt --; -+ while (cnt && (REG_MSC_STAT & MSC_STAT_DATA_FIFO_EMPTY)) -+ ; -+ } -+ return MMC_NO_ERROR; -+} -+ -+static int jz_mmc_transmit_data(struct mmc_request *req) -+{ -+#if 0 -+ u32 nob = req->nob; -+ u32 wblocklen = (u32)(req->block_len + 3) >> 2; /* length in word */ -+ u8 *buf = req->buffer; -+ u32 *wbuf = (u32 *)buf; -+ u32 waligned = (((u32)buf & 0x3) == 0); /* word aligned ? */ -+ u32 stat, timeout, data, cnt; -+ -+ for (nob; nob >= 1; nob--) { -+ timeout = 0x3FFFFFF; -+ -+ while (timeout) { -+ timeout--; -+ stat = REG_MSC_STAT; -+ -+ if (stat & (MSC_STAT_CRC_WRITE_ERROR | MSC_STAT_CRC_WRITE_ERROR_NOSTS)) -+ return MMC_ERROR_CRC; -+ else if (!(stat & MSC_STAT_DATA_FIFO_FULL)) { -+ /* Ready to write data */ -+ break; -+ } -+ -+ udelay(1); -+ } -+ -+ if (!timeout) -+ return MMC_ERROR_TIMEOUT; -+ -+ /* Write data to TXFIFO */ -+ cnt = wblocklen; -+ while (cnt) { -+ while (REG_MSC_STAT & MSC_STAT_DATA_FIFO_FULL) -+ ; -+ -+ if (waligned) { -+ REG_MSC_TXFIFO = *wbuf++; -+ } -+ else { -+ data = *buf++ | (*buf++ << 8) | (*buf++ << 16) | (*buf++ << 24); -+ REG_MSC_TXFIFO = data; -+ } -+ -+ cnt--; -+ } -+ } -+#endif -+ return MMC_NO_ERROR; -+} -+ -+ -+/* -+ * Name: int jz_mmc_exec_cmd() -+ * Function: send command to the card, and get a response -+ * Input: struct mmc_request *req : MMC/SD request -+ * Output: 0: right >0: error code -+ */ -+int jz_mmc_exec_cmd(struct mmc_request *request) -+{ -+ u32 cmdat = 0, events = 0; -+ int retval, timeout = 0x3fffff; -+ -+ /* Indicate we have no result yet */ -+ request->result = MMC_NO_RESPONSE; -+ if (request->cmd == MMC_CIM_RESET) { -+ /* On reset, 1-bit bus width */ -+ use_4bit = 0; -+ -+ /* Reset MMC/SD controller */ -+ __msc_reset(); -+ -+ /* On reset, drop MMC clock down */ -+ jz_mmc_set_clock(0, MMC_CLOCK_SLOW); -+ -+ /* On reset, stop MMC clock */ -+ jz_mmc_stop_clock(); -+ } -+ if (request->cmd == MMC_CMD_SEND_OP_COND) { -+ debug("Have an MMC card\n"); -+ /* always use 1bit for MMC */ -+ use_4bit = 0; -+ } -+ if (request->cmd == SET_BUS_WIDTH) { -+ if (request->arg == 0x2) { -+ printf("Use 4-bit bus width\n"); -+ use_4bit = 1; -+ } else { -+ printf("Use 1-bit bus width\n"); -+ use_4bit = 0; -+ } -+ } -+ -+ /* stop clock */ -+ jz_mmc_stop_clock(); -+ -+ /* mask all interrupts */ -+ REG_MSC_IMASK = 0xffff; -+ -+ /* clear status */ -+ REG_MSC_IREG = 0xffff; -+ -+ /* use 4-bit bus width when possible */ -+ if (use_4bit) -+ cmdat |= MSC_CMDAT_BUS_WIDTH_4BIT; -+ -+ /* Set command type and events */ -+ switch (request->cmd) { -+ /* MMC core extra command */ -+ case MMC_CIM_RESET: -+ cmdat |= MSC_CMDAT_INIT; /* Initialization sequence sent prior to command */ -+ break; -+ -+ /* bc - broadcast - no response */ -+ case MMC_CMD_GO_IDLE_STATE: -+ case MMC_CMD_SET_DSR: -+ break; -+ -+ /* bcr - broadcast with response */ -+ case MMC_CMD_SEND_OP_COND: -+ case MMC_CMD_ALL_SEND_CID: -+ case MMC_GO_IRQ_STATE: -+ break; -+ -+ /* adtc - addressed with data transfer */ -+ case MMC_READ_DAT_UNTIL_STOP: -+ case MMC_CMD_READ_SINGLE_BLOCK: -+ case MMC_CMD_READ_MULTIPLE_BLOCK: -+ case SD_CMD_APP_SEND_SCR: -+ cmdat |= MSC_CMDAT_DATA_EN | MSC_CMDAT_READ; -+ events = MMC_EVENT_RX_DATA_DONE; -+ break; -+ -+ case MMC_WRITE_DAT_UNTIL_STOP: -+ case MMC_CMD_WRITE_SINGLE_BLOCK: -+ case MMC_CMD_WRITE_MULTIPLE_BLOCK: -+ case MMC_PROGRAM_CID: -+ case MMC_PROGRAM_CSD: -+ case MMC_SEND_WRITE_PROT: -+ case MMC_GEN_CMD: -+ case MMC_LOCK_UNLOCK: -+ cmdat |= MSC_CMDAT_DATA_EN | MSC_CMDAT_WRITE; -+ events = MMC_EVENT_TX_DATA_DONE | MMC_EVENT_PROG_DONE; -+ -+ break; -+ -+ case MMC_CMD_STOP_TRANSMISSION: -+ events = MMC_EVENT_PROG_DONE; -+ break; -+ -+ /* ac - no data transfer */ -+ default: -+ break; -+ } -+ -+ /* Set response type */ -+ switch (request->rtype) { -+ case RESPONSE_NONE: -+ break; -+ -+ case RESPONSE_R1B: -+ cmdat |= MSC_CMDAT_BUSY; -+ /*FALLTHRU*/ -+ case RESPONSE_R1: -+ cmdat |= MSC_CMDAT_RESPONSE_R1; -+ break; -+ case RESPONSE_R2_CID: -+ case RESPONSE_R2_CSD: -+ cmdat |= MSC_CMDAT_RESPONSE_R2; -+ break; -+ case RESPONSE_R3: -+ cmdat |= MSC_CMDAT_RESPONSE_R3; -+ break; -+ case RESPONSE_R4: -+ cmdat |= MSC_CMDAT_RESPONSE_R4; -+ break; -+ case RESPONSE_R5: -+ cmdat |= MSC_CMDAT_RESPONSE_R5; -+ break; -+ case RESPONSE_R6: -+ cmdat |= MSC_CMDAT_RESPONSE_R6; -+ break; -+ default: -+ break; -+ } -+ -+ /* Set command index */ -+ if (request->cmd == MMC_CIM_RESET) { -+ REG_MSC_CMD = MMC_CMD_GO_IDLE_STATE; -+ } else { -+ REG_MSC_CMD = request->cmd; -+ } -+ -+ /* Set argument */ -+ REG_MSC_ARG = request->arg; -+ -+ /* Set block length and nob */ -+ if (request->cmd == SD_CMD_APP_SEND_SCR) { /* get SCR from DataFIFO */ -+ REG_MSC_BLKLEN = 8; -+ REG_MSC_NOB = 1; -+ } else { -+ REG_MSC_BLKLEN = request->block_len; -+ REG_MSC_NOB = request->nob; -+ } -+ -+ /* Set command */ -+ REG_MSC_CMDAT = cmdat; -+ -+ debug("Send cmd %d cmdat: %x arg: %x resp %d\n", request->cmd, -+ cmdat, request->arg, request->rtype); -+ -+ /* Start MMC/SD clock and send command to card */ -+ jz_mmc_start_clock(); -+ -+ /* Wait for command completion */ -+ while (timeout-- && !(REG_MSC_STAT & MSC_STAT_END_CMD_RES)) -+ ; -+ -+ if (timeout == 0) -+ return MMC_ERROR_TIMEOUT; -+ -+ REG_MSC_IREG = MSC_IREG_END_CMD_RES; /* clear flag */ -+ -+ /* Check for status */ -+ retval = jz_mmc_check_status(request); -+ if (retval) { -+ return retval; -+ } -+ -+ /* Complete command with no response */ -+ if (request->rtype == RESPONSE_NONE) { -+ return MMC_NO_ERROR; -+ } -+ -+ /* Get response */ -+ jz_mmc_get_response(request); -+ -+ /* Start data operation */ -+ if (events & (MMC_EVENT_RX_DATA_DONE | MMC_EVENT_TX_DATA_DONE)) { -+ if (events & MMC_EVENT_RX_DATA_DONE) { -+ if (request->cmd == SD_CMD_APP_SEND_SCR) { -+ /* SD card returns SCR register as data. -+ MMC core expect it in the response buffer, -+ after normal response. */ -+ request->buffer = (u8 *)((u32)request->response + 5); -+ } -+ jz_mmc_receive_data(request); -+ } -+ -+ if (events & MMC_EVENT_TX_DATA_DONE) { -+ jz_mmc_transmit_data(request); -+ } -+ -+ /* Wait for Data Done */ -+ while (!(REG_MSC_IREG & MSC_IREG_DATA_TRAN_DONE)) -+ ; -+ REG_MSC_IREG = MSC_IREG_DATA_TRAN_DONE; /* clear status */ -+ } -+ -+ /* Wait for Prog Done event */ -+ if (events & MMC_EVENT_PROG_DONE) { -+ while (!(REG_MSC_IREG & MSC_IREG_PRG_DONE)) -+ ; -+ REG_MSC_IREG = MSC_IREG_PRG_DONE; /* clear status */ -+ } -+ -+ /* Command completed */ -+ -+ return MMC_NO_ERROR; /* return successfully */ -+} -+ -+int mmc_block_read(u8 *dst, ulong src, ulong len) -+{ -+ -+ struct mmc_request request; -+ struct mmc_response_r1 r1; -+ int retval = 0; -+ -+ if (len == 0) -+ goto exit; -+ -+ mmc_simple_cmd(&request, MMC_CMD_SEND_STATUS, mmcinfo.rca, RESPONSE_R1); -+ retval = mmc_unpack_r1(&request, &r1, 0); -+ if (retval && (retval != MMC_ERROR_STATE_MISMATCH)) -+ goto exit; -+ -+ mmc_simple_cmd(&request, MMC_CMD_SET_BLOCKLEN, len, RESPONSE_R1); -+ if (retval = mmc_unpack_r1(&request, &r1, 0)) -+ goto exit; -+ -+ if (!sd2_0) -+ src *= mmcinfo.block_len; -+ -+ mmc_send_cmd(&request, MMC_CMD_READ_SINGLE_BLOCK, src, 1, len, RESPONSE_R1, dst); -+ if (retval = mmc_unpack_r1(&request, &r1, 0)) -+ goto exit; -+ -+exit: -+ return retval; -+} -+ -+ulong mmc_bread(int dev_num, ulong blkstart, ulong blkcnt, ulong *dst) -+{ -+ if (!mmc_ready) { -+ printf("Please initial the MMC first\n"); -+ return -1; -+ } -+ -+ int i = 0; -+ ulong dst_tmp = dst; -+ -+ for (i = 0; i < blkcnt; i++) { -+ if ((mmc_block_read((uchar *)(dst_tmp), blkstart, mmcinfo.block_len)) < 0) -+ return -1; -+ -+ dst_tmp += mmcinfo.block_len; -+ blkstart++; -+ } -+ -+ return i; -+} -+ -+int mmc_select_card(void) -+{ -+ struct mmc_request request; -+ struct mmc_response_r1 r1; -+ int retval; -+ -+ mmc_simple_cmd(&request, MMC_CMD_SELECT_CARD, mmcinfo.rca, RESPONSE_R1B); -+ retval = mmc_unpack_r1(&request, &r1, 0); -+ if (retval) { -+ return retval; -+ } -+ -+ if (mmcinfo.sd) { -+ mmc_simple_cmd(&request, MMC_CMD_APP_CMD, mmcinfo.rca, RESPONSE_R1); -+ retval = mmc_unpack_r1(&request,&r1,0); -+ if (retval) { -+ return retval; -+ } -+#if defined(MMC_BUS_WIDTH_1BIT) -+ mmc_simple_cmd(&request, SET_BUS_WIDTH, 1, RESPONSE_R1); -+#else -+ mmc_simple_cmd(&request, SET_BUS_WIDTH, 2, RESPONSE_R1); -+#endif -+ retval = mmc_unpack_r1(&request,&r1,0); -+ if (retval) { -+ return retval; -+ } -+ } -+ return 0; -+} -+ -+/* -+ * Configure card -+ */ -+static void mmc_configure_card(void) -+{ -+ u32 rate; -+ -+ /* Get card info */ -+ if (sd2_0) -+ mmcinfo.block_num = (mmcinfo.csd.c_size + 1) << 10; -+ else -+ mmcinfo.block_num = (mmcinfo.csd.c_size + 1) * (1 << (mmcinfo.csd.c_size_mult + 2)); -+ -+ mmcinfo.block_len = 1 << mmcinfo.csd.read_bl_len; -+ -+ mmc_dev.if_type = IF_TYPE_SD; -+ mmc_dev.part_type = PART_TYPE_DOS; -+ mmc_dev.dev = 0; -+ mmc_dev.lun = 0; -+ mmc_dev.type = 0; -+ mmc_dev.blksz = mmcinfo.block_len; -+ mmc_dev.lba = mmcinfo.block_num; -+ mmc_dev.removable = 0; -+ -+ printf("%s Detected: %lu blocks of %lu bytes\n", -+ sd2_0 == 1 ? "SDHC" : "SD", -+ mmc_dev.lba, -+ mmc_dev.blksz); -+ -+ /* Fix the clock rate */ -+ rate = mmc_tran_speed(mmcinfo.csd.tran_speed); -+ if (rate < MMC_CLOCK_SLOW) -+ rate = MMC_CLOCK_SLOW; -+ if ((mmcinfo.sd == 0) && (rate > MMC_CLOCK_FAST)) -+ rate = MMC_CLOCK_FAST; -+ if ((mmcinfo.sd) && (rate > SD_CLOCK_FAST)) -+ rate = SD_CLOCK_FAST; -+ -+ debug("%s: block_len=%d block_num=%d rate=%d\n", -+ __func__, mmcinfo.block_len, mmcinfo.block_num, rate); -+ -+ jz_mmc_set_clock(mmcinfo.sd, rate); -+} -+ -+/* -+ * State machine routines to initialize card(s) -+ */ -+ -+/* -+ CIM_SINGLE_CARD_ACQ (frequency at 400 kHz) -+ --- Must enter from GO_IDLE_STATE --- -+ 1. SD_SEND_OP_COND (SD Card) [CMD55] + [CMD41] -+ 2. SEND_OP_COND (Full Range) [CMD1] {optional} -+ 3. SEND_OP_COND (Set Range ) [CMD1] -+ If busy, delay and repeat step 2 -+ 4. ALL_SEND_CID [CMD2] -+ If timeout, set an error (no cards found) -+ 5. SET_RELATIVE_ADDR [CMD3] -+ 6. SEND_CSD [CMD9] -+ 7. SET_DSR [CMD4] Only call this if (csd.dsr_imp). -+ 8. Set clock frequency (check available in csd.tran_speed) -+ */ -+ -+#define MMC_INIT_DOING 0 -+#define MMC_INIT_PASSED 1 -+#define MMC_INIT_FAILED 2 -+ -+static int mmc_init_card_state(struct mmc_request *request) -+{ -+ struct mmc_response_r1 r1; -+ struct mmc_response_r3 r3; -+ int retval; -+ int ocr = 0x40300000; -+ int limit_41 = 0; -+ -+ switch (request->cmd) { -+ case MMC_CMD_GO_IDLE_STATE: /* No response to parse */ -+ if (mmcinfo.sd) -+ mmc_simple_cmd(request, 8, 0x1aa, RESPONSE_R1); -+ else -+ mmc_simple_cmd(request, MMC_CMD_SEND_OP_COND, MMC_OCR_ARG, RESPONSE_R3); -+ break; -+ -+ case 8: -+ retval = mmc_unpack_r1(request,&r1,mmcinfo.state); -+ mmc_simple_cmd(request, MMC_CMD_APP_CMD, 0, RESPONSE_R1); -+ break; -+ -+ case MMC_CMD_APP_CMD: -+ retval = mmc_unpack_r1(request,&r1,mmcinfo.state); -+ if (retval & (limit_41 < 100)) { -+ debug("%s: unable to MMC_APP_CMD error=%d (%s)\n", -+ __func__, retval, mmc_result_to_string(retval)); -+ limit_41++; -+ mmc_simple_cmd(request, SD_CMD_APP_SEND_OP_COND, ocr, RESPONSE_R3); -+ } else if (limit_41 < 100) { -+ limit_41++; -+ mmc_simple_cmd(request, SD_CMD_APP_SEND_OP_COND, ocr, RESPONSE_R3); -+ } else{ -+ /* reset the card to idle*/ -+ mmc_simple_cmd(request, MMC_CMD_GO_IDLE_STATE, 0, RESPONSE_NONE); -+ mmcinfo.sd = 0; -+ } -+ break; -+ -+ case SD_CMD_APP_SEND_OP_COND: -+ retval = mmc_unpack_r3(request, &r3); -+ if (retval) { -+ debug("%s: try MMC card\n", __func__); -+ mmc_simple_cmd(request, SD_CMD_APP_SEND_OP_COND, MMC_OCR_ARG, RESPONSE_R3); -+ break; -+ } -+ -+ debug("%s: read ocr value = 0x%08x\n", __func__, r3.ocr); -+ -+ if(!(r3.ocr & MMC_CARD_BUSY || ocr == 0)){ -+ udelay(50000); -+ mmc_simple_cmd(request, MMC_CMD_APP_CMD, 0, RESPONSE_R1); -+ } else { -+ mmcinfo.sd = 1; /* SD Card ready */ -+ mmcinfo.state = CARD_STATE_READY; -+ mmc_simple_cmd(request, MMC_CMD_ALL_SEND_CID, 0, RESPONSE_R2_CID); -+ } -+ break; -+ -+ case MMC_CMD_SEND_OP_COND: -+ retval = mmc_unpack_r3(request, &r3); -+ if (retval) { -+ debug("%s: failed SEND_OP_COND error=%d (%s)\n", -+ __func__, retval, mmc_result_to_string(retval)); -+ return MMC_INIT_FAILED; -+ } -+ -+ debug("%s: read ocr value = 0x%08x\n", __func__, r3.ocr); -+ if (!(r3.ocr & MMC_CARD_BUSY)) { -+ mmc_simple_cmd(request, MMC_CMD_SEND_OP_COND, MMC_OCR_ARG, RESPONSE_R3); -+ } else { -+ mmcinfo.sd = 0; /* MMC Card ready */ -+ mmcinfo.state = CARD_STATE_READY; -+ mmc_simple_cmd(request, MMC_CMD_ALL_SEND_CID, 0, RESPONSE_R2_CID); -+ } -+ break; -+ -+ case MMC_CMD_ALL_SEND_CID: -+ retval = mmc_unpack_cid( request, &mmcinfo.cid ); -+ /*FIXME:ignore CRC error for CMD2/CMD9/CMD10 */ -+ if ( retval && (retval != MMC_ERROR_CRC)) { -+ debug("mmc_init_card_state: unable to ALL_SEND_CID error=%d (%s)\n", -+ retval, mmc_result_to_string(retval)); -+ return MMC_INIT_FAILED; -+ } -+ mmcinfo.state = CARD_STATE_IDENT; -+ if(mmcinfo.sd) -+ mmc_simple_cmd(request, MMC_CMD_SET_RELATIVE_ADDR, 0, RESPONSE_R6); -+ else -+ mmc_simple_cmd(request, MMC_CMD_SET_RELATIVE_ADDR, ID_TO_RCA(mmcinfo.id) << 16, RESPONSE_R1); -+ break; -+ -+ case MMC_CMD_SET_RELATIVE_ADDR: -+ if (mmcinfo.sd) { -+ retval = mmc_unpack_r6(request, &r1, mmcinfo.state, &mmcinfo.rca); -+ mmcinfo.rca = mmcinfo.rca << 16; -+ debug("%s: Get RCA from SD: 0x%04x Status: %x\n", -+ __func__, mmcinfo.rca, r1.status); -+ } else { -+ retval = mmc_unpack_r1(request,&r1,mmcinfo.state); -+ mmcinfo.rca = ID_TO_RCA(mmcinfo.id) << 16; -+ } -+ if (retval) { -+ debug("%s: unable to SET_RELATIVE_ADDR error=%d (%s)\n", -+ __func__, retval, mmc_result_to_string(retval)); -+ return MMC_INIT_FAILED; -+ } -+ -+ mmcinfo.state = CARD_STATE_STBY; -+ mmc_simple_cmd(request, MMC_CMD_SEND_CSD, mmcinfo.rca, RESPONSE_R2_CSD); -+ -+ break; -+ -+ case MMC_CMD_SEND_CSD: -+ retval = mmc_unpack_csd(request, &mmcinfo.csd); -+ mmc_ready = 1; -+ /*FIXME:ignore CRC error for CMD2/CMD9/CMD10 */ -+ if (retval && (retval != MMC_ERROR_CRC)) { -+ debug("%s: unable to SEND_CSD error=%d (%s)\n", -+ __func__, retval, mmc_result_to_string(retval)); -+ return MMC_INIT_FAILED; -+ } -+ if (mmcinfo.csd.dsr_imp) { -+ debug("%s: driver doesn't support setting DSR\n", __func__); -+ } -+ mmc_configure_card(); -+ return MMC_INIT_PASSED; -+ -+ default: -+ debug("%s: error! Illegal last cmd %d\n", __func__, request->cmd); -+ return MMC_INIT_FAILED; -+ } -+ -+ return MMC_INIT_DOING; -+} -+ -+int mmc_init_card(void) -+{ -+ struct mmc_request request; -+ int retval; -+ -+ mmc_simple_cmd(&request, MMC_CIM_RESET, 0, RESPONSE_NONE); /* reset card */ -+ mmc_simple_cmd(&request, MMC_CMD_GO_IDLE_STATE, 0, RESPONSE_NONE); -+ mmcinfo.sd = 1; /* assuming a SD card */ -+ -+ while ((retval = mmc_init_card_state(&request)) == MMC_INIT_DOING) -+ ; -+ -+ if (retval == MMC_INIT_PASSED) -+ return MMC_NO_ERROR; -+ else -+ return MMC_NO_RESPONSE; -+} -+ -+int mmc_legacy_init(int verbose) -+{ -+ if (!__msc_card_detected()) -+ return 1; -+ -+ /* Step-1: init GPIO */ -+ __gpio_as_msc(); -+ __msc_init_io(); -+ -+ /* Step-2: turn on power of card */ -+#if !defined(CONFIG_SAKC) -+ __msc_enable_power(); -+#endif -+ -+ /* Step-3: Reset MSC Controller. */ -+ __msc_reset(); -+ -+ /* Step-3: mask all IRQs. */ -+ MMC_IRQ_MASK(); -+ -+ /* Step-4: stop MMC/SD clock */ -+ jz_mmc_stop_clock(); -+ mmc_init_card(); -+ mmc_select_card(); -+ -+ mmc_dev.block_read = mmc_bread; -+ fat_register_device(&mmc_dev,1); /* partitions start counting with 1 */ -+ -+ return 0; -+} -+ -+/* -+ * Debugging functions -+ */ -+static char * mmc_result_strings[] = { -+ "NO_RESPONSE", -+ "NO_ERROR", -+ "ERROR_OUT_OF_RANGE", -+ "ERROR_ADDRESS", -+ "ERROR_BLOCK_LEN", -+ "ERROR_ERASE_SEQ", -+ "ERROR_ERASE_PARAM", -+ "ERROR_WP_VIOLATION", -+ "ERROR_CARD_IS_LOCKED", -+ "ERROR_LOCK_UNLOCK_FAILED", -+ "ERROR_COM_CRC", -+ "ERROR_ILLEGAL_COMMAND", -+ "ERROR_CARD_ECC_FAILED", -+ "ERROR_CC", -+ "ERROR_GENERAL", -+ "ERROR_UNDERRUN", -+ "ERROR_OVERRUN", -+ "ERROR_CID_CSD_OVERWRITE", -+ "ERROR_STATE_MISMATCH", -+ "ERROR_HEADER_MISMATCH", -+ "ERROR_TIMEOUT", -+ "ERROR_CRC", -+ "ERROR_DRIVER_FAILURE", -+}; -+ -+char * mmc_result_to_string(int i) -+{ -+ return mmc_result_strings[i+1]; -+} -+ -+static char * card_state_strings[] = { -+ "empty", -+ "idle", -+ "ready", -+ "ident", -+ "stby", -+ "tran", -+ "data", -+ "rcv", -+ "prg", -+ "dis", -+}; -+ -+static inline char * card_state_to_string(int i) -+{ -+ return card_state_strings[i+1]; -+} -+ -+/* -+ * Utility functions -+ */ -+ -+#define PARSE_U32(_buf,_index) \ -+ (((u32)_buf[_index]) << 24) | (((u32)_buf[_index+1]) << 16) | \ -+ (((u32)_buf[_index+2]) << 8) | ((u32)_buf[_index+3]); -+ -+#define PARSE_U16(_buf,_index) \ -+ (((u16)_buf[_index]) << 8) | ((u16)_buf[_index+1]); -+ -+int mmc_unpack_csd(struct mmc_request *request, struct mmc_csd *csd) -+{ -+ u8 *buf = request->response; -+ int num = 0; -+ -+ if (request->result) -+ return request->result; -+ -+ if (buf[0] != 0x3f) -+ return MMC_ERROR_HEADER_MISMATCH; -+ -+ csd->csd_structure = (buf[1] & 0xc0) >> 6; -+ if (csd->csd_structure) -+ sd2_0 = 1; -+ else -+ sd2_0 = 0; -+ -+ switch (csd->csd_structure) { -+ case 0 :/* Version 1.01-1.10 -+ * Version 2.00/Standard Capacity */ -+ csd->taac = buf[2]; -+ csd->nsac = buf[3]; -+ csd->tran_speed = buf[4]; -+ csd->ccc = (((u16)buf[5]) << 4) | ((buf[6] & 0xf0) >> 4); -+ csd->read_bl_len = buf[6] & 0x0f; -+ /* for support 2GB card*/ -+ if (csd->read_bl_len >= 10) -+ { -+ num = csd->read_bl_len - 9; -+ csd->read_bl_len = 9; -+ } -+ -+ csd->read_bl_partial = (buf[7] & 0x80) ? 1 : 0; -+ csd->write_blk_misalign = (buf[7] & 0x40) ? 1 : 0; -+ csd->read_blk_misalign = (buf[7] & 0x20) ? 1 : 0; -+ csd->dsr_imp = (buf[7] & 0x10) ? 1 : 0; -+ csd->c_size = ((((u16)buf[7]) & 0x03) << 10) | (((u16)buf[8]) << 2) | (((u16)buf[9]) & 0xc0) >> 6; -+ -+ if (num) -+ csd->c_size = csd->c_size << num; -+ -+ -+ csd->vdd_r_curr_min = (buf[9] & 0x38) >> 3; -+ csd->vdd_r_curr_max = buf[9] & 0x07; -+ csd->vdd_w_curr_min = (buf[10] & 0xe0) >> 5; -+ csd->vdd_w_curr_max = (buf[10] & 0x1c) >> 2; -+ csd->c_size_mult = ((buf[10] & 0x03) << 1) | ((buf[11] & 0x80) >> 7); -+ csd->sector_size = (buf[11] & 0x7c) >> 2; -+ csd->erase_grp_size = ((buf[11] & 0x03) << 3) | ((buf[12] & 0xe0) >> 5); -+ csd->wp_grp_size = buf[12] & 0x1f; -+ csd->wp_grp_enable = (buf[13] & 0x80) ? 1 : 0; -+ csd->default_ecc = (buf[13] & 0x60) >> 5; -+ csd->r2w_factor = (buf[13] & 0x1c) >> 2; -+ csd->write_bl_len = ((buf[13] & 0x03) << 2) | ((buf[14] & 0xc0) >> 6); -+ if (csd->write_bl_len >= 10) -+ csd->write_bl_len = 9; -+ -+ csd->write_bl_partial = (buf[14] & 0x20) ? 1 : 0; -+ csd->file_format_grp = (buf[15] & 0x80) ? 1 : 0; -+ csd->copy = (buf[15] & 0x40) ? 1 : 0; -+ csd->perm_write_protect = (buf[15] & 0x20) ? 1 : 0; -+ csd->tmp_write_protect = (buf[15] & 0x10) ? 1 : 0; -+ csd->file_format = (buf[15] & 0x0c) >> 2; -+ csd->ecc = buf[15] & 0x03; -+ break; -+ case 1 : /* Version 2.00/High Capacity */ -+ csd->taac = 0; -+ csd->nsac = 0; -+ csd->tran_speed = buf[4]; -+ csd->ccc = (((u16)buf[5]) << 4) | ((buf[6] & 0xf0) >> 4); -+ -+ csd->read_bl_len = 9; -+ csd->read_bl_partial = 0; -+ csd->write_blk_misalign = 0; -+ csd->read_blk_misalign = 0; -+ csd->dsr_imp = (buf[7] & 0x10) ? 1 : 0; -+ csd->c_size = ((((u16)buf[8]) & 0x3f) << 16) | (((u16)buf[9]) << 8) | ((u16)buf[10]) ; -+ csd->sector_size = 0x7f; -+ csd->erase_grp_size = 0; -+ csd->wp_grp_size = 0; -+ csd->wp_grp_enable = 0; -+ csd->default_ecc = (buf[13] & 0x60) >> 5; -+ csd->r2w_factor = 4;/* Unused */ -+ csd->write_bl_len = 9; -+ -+ csd->write_bl_partial = 0; -+ csd->file_format_grp = 0; -+ csd->copy = (buf[15] & 0x40) ? 1 : 0; -+ csd->perm_write_protect = (buf[15] & 0x20) ? 1 : 0; -+ csd->tmp_write_protect = (buf[15] & 0x10) ? 1 : 0; -+ csd->file_format = 0; -+ csd->ecc = buf[15] & 0x03; -+ } -+ -+ return 0; -+} -+ -+int mmc_unpack_r1(struct mmc_request *request, struct mmc_response_r1 *r1, enum card_state state) -+{ -+ u8 *buf = request->response; -+ -+ if (request->result) -+ return request->result; -+ -+ r1->cmd = buf[0]; -+ r1->status = PARSE_U32(buf,1); -+ -+ debug("mmc_unpack_r1: cmd=%d status=%08x\n", r1->cmd, r1->status); -+ -+ if (R1_STATUS(r1->status)) { -+ if (r1->status & R1_OUT_OF_RANGE) return MMC_ERROR_OUT_OF_RANGE; -+ if (r1->status & R1_ADDRESS_ERROR) return MMC_ERROR_ADDRESS; -+ if (r1->status & R1_BLOCK_LEN_ERROR) return MMC_ERROR_BLOCK_LEN; -+ if (r1->status & R1_ERASE_SEQ_ERROR) return MMC_ERROR_ERASE_SEQ; -+ if (r1->status & R1_ERASE_PARAM) return MMC_ERROR_ERASE_PARAM; -+ if (r1->status & R1_WP_VIOLATION) return MMC_ERROR_WP_VIOLATION; -+ /*if (r1->status & R1_CARD_IS_LOCKED) return MMC_ERROR_CARD_IS_LOCKED; */ -+ if (r1->status & R1_LOCK_UNLOCK_FAILED) return MMC_ERROR_LOCK_UNLOCK_FAILED; -+ if (r1->status & R1_COM_CRC_ERROR) return MMC_ERROR_COM_CRC; -+ if (r1->status & R1_ILLEGAL_COMMAND) return MMC_ERROR_ILLEGAL_COMMAND; -+ if (r1->status & R1_CARD_ECC_FAILED) return MMC_ERROR_CARD_ECC_FAILED; -+ if (r1->status & R1_CC_ERROR) return MMC_ERROR_CC; -+ if (r1->status & R1_ERROR) return MMC_ERROR_GENERAL; -+ if (r1->status & R1_UNDERRUN) return MMC_ERROR_UNDERRUN; -+ if (r1->status & R1_OVERRUN) return MMC_ERROR_OVERRUN; -+ if (r1->status & R1_CID_CSD_OVERWRITE) return MMC_ERROR_CID_CSD_OVERWRITE; -+ } -+ -+ if (buf[0] != request->cmd) -+ return MMC_ERROR_HEADER_MISMATCH; -+ -+ /* This should be last - it's the least dangerous error */ -+ -+ return 0; -+} -+ -+int mmc_unpack_scr(struct mmc_request *request, struct mmc_response_r1 *r1, enum card_state state, u32 *scr) -+{ -+ u8 *buf = request->response; -+ if (request->result) -+ return request->result; -+ -+ *scr = PARSE_U32(buf, 5); /* Save SCR returned by the SD Card */ -+ return mmc_unpack_r1(request, r1, state); -+ -+} -+ -+int mmc_unpack_r6(struct mmc_request *request, struct mmc_response_r1 *r1, enum card_state state, int *rca) -+{ -+ u8 *buf = request->response; -+ -+ if (request->result) -+ return request->result; -+ -+ *rca = PARSE_U16(buf,1); /* Save RCA returned by the SD Card */ -+ -+ *(buf+1) = 0; -+ *(buf+2) = 0; -+ -+ return mmc_unpack_r1(request, r1, state); -+} -+ -+int mmc_unpack_cid(struct mmc_request *request, struct mmc_cid *cid) -+{ -+ int i; -+ u8 *buf = request->response; -+ -+ if (request->result) -+ return request->result; -+ -+ cid->mid = buf[1]; -+ cid->oid = PARSE_U16(buf,2); -+ for (i = 0 ; i < 5 ; i++) -+ cid->pnm[i] = buf[4+i]; -+ cid->pnm[6] = 0; -+ cid->prv = buf[10]; -+ cid->psn = PARSE_U32(buf,10); -+ cid->mdt = buf[15]; -+ -+ printf("Man %02x OEM 0x%04x \"%s\" %d.%d 0x%08x " -+ "Date %02u/%04u\n", -+ cid->mid, -+ cid->oid, -+ cid->pnm, -+ cid->prv >> 4, -+ cid->prv & 0xf, -+ cid->psn, -+ cid->mdt & 0xf, -+ (cid->mdt >> 4) + 2000); -+ -+ if (buf[0] != 0x3f) -+ return MMC_ERROR_HEADER_MISMATCH; -+ return 0; -+} -+ -+int mmc_unpack_r3(struct mmc_request *request, struct mmc_response_r3 *r3) -+{ -+ u8 *buf = request->response; -+ -+ if (request->result) -+ return request->result; -+ -+ r3->ocr = PARSE_U32(buf,1); -+ debug("mmc_unpack_r3: ocr=%08x\n", r3->ocr); -+ -+ if (buf[0] != 0x3f) return MMC_ERROR_HEADER_MISMATCH; -+ return 0; -+} -+ -+#define KBPS 1 -+#define MBPS 1000 -+ -+static u32 ts_exp[] = { 100*KBPS, 1*MBPS, 10*MBPS, 100*MBPS, 0, 0, 0, 0 }; -+static u32 ts_mul[] = { 0, 1000, 1200, 1300, 1500, 2000, 2500, 3000, -+ 3500, 4000, 4500, 5000, 5500, 6000, 7000, 8000 }; -+ -+u32 mmc_tran_speed(u8 ts) -+{ -+ u32 rate = ts_exp[(ts & 0x7)] * ts_mul[(ts & 0x78) >> 3]; -+ -+ if (rate <= 0) { -+ debug("%s: error - unrecognized speed 0x%02x\n", __func__, ts); -+ return 1; -+ } -+ -+ return rate; -+} -+ -+void mmc_send_cmd(struct mmc_request *request, int cmd, u32 arg, -+ u16 nob, u16 block_len, enum mmc_rsp_t rtype, u8 *buffer) -+{ -+ request->cmd = cmd; -+ request->arg = arg; -+ request->rtype = rtype; -+ request->nob = nob; -+ request->block_len = block_len; -+ request->buffer = buffer; -+ request->cnt = nob * block_len; -+ -+ jz_mmc_exec_cmd(request); -+} -diff --git a/drivers/mmc/jz_mmc.h b/drivers/mmc/jz_mmc.h -new file mode 100644 -index 0000000..936c514 ---- /dev/null -+++ b/drivers/mmc/jz_mmc.h -@@ -0,0 +1,176 @@ -+/* -+ * linux/drivers/mmc/jz_mmc.h -+ * -+ * Author: Vladimir Shebordaev, Igor Oblakov -+ * Copyright: MontaVista Software Inc. -+ * -+ * $Id: jz_mmc.h,v 1.3 2007-06-15 08:04:20 jlwei Exp $ -+ * -+ * 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 __MMC_JZMMC_H__ -+#define __MMC_JZMMC_H__ -+ -+#define ID_TO_RCA(x) ((x)+1) -+#define MMC_OCR_ARG 0x00ff8000 /* Argument of OCR */ -+ -+/* Standard MMC/SD clock speeds */ -+#define MMC_CLOCK_SLOW 400000 /* 400 kHz for initial setup */ -+#define MMC_CLOCK_FAST 20000000 /* 20 MHz for maximum for normal operation */ -+#define SD_CLOCK_FAST 24000000 /* 24 MHz for SD Cards */ -+ -+/* Use negative numbers to disambiguate */ -+#define MMC_CIM_RESET -1 -+#define SET_BUS_WIDTH 6 /* ac [1:0] bus width R1 */ -+ -+#define R1_OUT_OF_RANGE (1 << 31) /* er, c */ -+#define R1_ADDRESS_ERROR (1 << 30) /* erx, c */ -+#define R1_BLOCK_LEN_ERROR (1 << 29) /* er, c */ -+#define R1_ERASE_SEQ_ERROR (1 << 28) /* er, c */ -+#define R1_ERASE_PARAM (1 << 27) /* ex, c */ -+#define R1_WP_VIOLATION (1 << 26) /* erx, c */ -+#define R1_CARD_IS_LOCKED (1 << 25) /* sx, a */ -+#define R1_LOCK_UNLOCK_FAILED (1 << 24) /* erx, c */ -+#define R1_COM_CRC_ERROR (1 << 23) /* er, b */ -+#define R1_ILLEGAL_COMMAND (1 << 22) /* er, b */ -+#define R1_CARD_ECC_FAILED (1 << 21) /* ex, c */ -+#define R1_CC_ERROR (1 << 20) /* erx, c */ -+#define R1_ERROR (1 << 19) /* erx, c */ -+#define R1_UNDERRUN (1 << 18) /* ex, c */ -+#define R1_OVERRUN (1 << 17) /* ex, c */ -+#define R1_CID_CSD_OVERWRITE (1 << 16) /* erx, c, CID/CSD overwrite */ -+#define R1_WP_ERASE_SKIP (1 << 15) /* sx, c */ -+#define R1_CARD_ECC_DISABLED (1 << 14) /* sx, a */ -+#define R1_ERASE_RESET (1 << 13) /* sr, c */ -+#define R1_STATUS(x) (x & 0xFFFFE000) -+ -+#define MMC_CARD_BUSY 0x80000000 /* Card Power up status bit */ -+ -+#define MMC_PROGRAM_CID 26 /* adtc R1 */ -+#define MMC_PROGRAM_CSD 27 /* adtc R1 */ -+ -+#define MMC_GO_IRQ_STATE 40 /* bcr R5 */ -+#define MMC_GEN_CMD 56 /* adtc [0] RD/WR R1b */ -+#define MMC_LOCK_UNLOCK 42 /* adtc R1b */ -+#define MMC_WRITE_DAT_UNTIL_STOP 20 /* adtc [31:0] data addr R1 */ -+#define MMC_READ_DAT_UNTIL_STOP 11 /* adtc [31:0] dadr R1 */ -+#define MMC_SEND_WRITE_PROT 30 /* adtc [31:0] wpdata addr R1 */ -+ -+ -+enum mmc_result_t { -+ MMC_NO_RESPONSE = -1, -+ MMC_NO_ERROR = 0, -+ MMC_ERROR_OUT_OF_RANGE, -+ MMC_ERROR_ADDRESS, -+ MMC_ERROR_BLOCK_LEN, -+ MMC_ERROR_ERASE_SEQ, -+ MMC_ERROR_ERASE_PARAM, -+ MMC_ERROR_WP_VIOLATION, -+ MMC_ERROR_CARD_IS_LOCKED, -+ MMC_ERROR_LOCK_UNLOCK_FAILED, -+ MMC_ERROR_COM_CRC, -+ MMC_ERROR_ILLEGAL_COMMAND, -+ MMC_ERROR_CARD_ECC_FAILED, -+ MMC_ERROR_CC, -+ MMC_ERROR_GENERAL, -+ MMC_ERROR_UNDERRUN, -+ MMC_ERROR_OVERRUN, -+ MMC_ERROR_CID_CSD_OVERWRITE, -+ MMC_ERROR_STATE_MISMATCH, -+ MMC_ERROR_HEADER_MISMATCH, -+ MMC_ERROR_TIMEOUT, -+ MMC_ERROR_CRC, -+ MMC_ERROR_DRIVER_FAILURE, -+}; -+ -+enum card_state { -+ CARD_STATE_EMPTY = -1, -+ CARD_STATE_IDLE = 0, -+ CARD_STATE_READY = 1, -+ CARD_STATE_IDENT = 2, -+ CARD_STATE_STBY = 3, -+ CARD_STATE_TRAN = 4, -+ CARD_STATE_DATA = 5, -+ CARD_STATE_RCV = 6, -+ CARD_STATE_PRG = 7, -+ CARD_STATE_DIS = 8, -+}; -+ -+enum mmc_rsp_t { -+ RESPONSE_NONE = 0, -+ RESPONSE_R1 = 1, -+ RESPONSE_R1B = 2, -+ RESPONSE_R2_CID = 3, -+ RESPONSE_R2_CSD = 4, -+ RESPONSE_R3 = 5, -+ RESPONSE_R4 = 6, -+ RESPONSE_R5 = 7, -+ RESPONSE_R6 = 8, -+}; -+ -+struct mmc_response_r1 { -+ u8 cmd; -+ u32 status; -+}; -+ -+struct mmc_response_r3 { -+ u32 ocr; -+}; -+ -+/* the information structure of MMC/SD Card */ -+struct mmc_info { -+ int id; /* Card index */ -+ int sd; /* MMC or SD card */ -+ int rca; /* RCA */ -+ u32 scr; /* SCR 63:32*/ -+ int flags; /* Ejected, inserted */ -+ enum card_state state; /* empty, ident, ready, whatever */ -+ -+ /* Card specific information */ -+ struct mmc_cid cid; -+ struct mmc_csd csd; -+ u32 block_num; -+ u32 block_len; -+ u32 erase_unit; -+}; -+ -+struct mmc_info mmcinfo; -+ -+struct mmc_request { -+ int index; /* Slot index - used for CS lines */ -+ int cmd; /* Command to send */ -+ u32 arg; /* Argument to send */ -+ enum mmc_rsp_t rtype; /* Response type expected */ -+ -+ /* Data transfer (these may be modified at the low level) */ -+ u16 nob; /* Number of blocks to transfer*/ -+ u16 block_len; /* Block length */ -+ u8 *buffer; /* Data buffer */ -+ u32 cnt; /* Data length, for PIO */ -+ -+ /* Results */ -+ u8 response[18]; /* Buffer to store response - CRC is optional */ -+ enum mmc_result_t result; -+}; -+ -+char * mmc_result_to_string(int); -+int mmc_unpack_csd(struct mmc_request *request, struct mmc_csd *csd); -+int mmc_unpack_r1(struct mmc_request *request, struct mmc_response_r1 *r1, enum card_state state); -+int mmc_unpack_r6(struct mmc_request *request, struct mmc_response_r1 *r1, enum card_state state, int *rca); -+int mmc_unpack_scr(struct mmc_request *request, struct mmc_response_r1 *r1, enum card_state state, u32 *scr); -+int mmc_unpack_cid(struct mmc_request *request, struct mmc_cid *cid); -+int mmc_unpack_r3(struct mmc_request *request, struct mmc_response_r3 *r3); -+ -+void mmc_send_cmd(struct mmc_request *request, int cmd, u32 arg, -+ u16 nob, u16 block_len, enum mmc_rsp_t rtype, u8 *buffer); -+u32 mmc_tran_speed(u8 ts); -+void jz_mmc_set_clock(int sd, u32 rate); -+ -+static inline void mmc_simple_cmd(struct mmc_request *request, int cmd, u32 arg, enum mmc_rsp_t rtype) -+{ -+ mmc_send_cmd( request, cmd, arg, 0, 0, rtype, 0); -+} -+ -+#endif /* __MMC_JZMMC_H__ */ -diff --git a/include/configs/qi_lb60.h b/include/configs/qi_lb60.h -index 7bff444..7b33be0 100644 ---- a/include/configs/qi_lb60.h -+++ b/include/configs/qi_lb60.h -@@ -31,6 +31,15 @@ - /* - * Miscellaneous configurable options - */ -+#define CONFIG_JZ4740_MMC -+#define CONFIG_MMC 1 -+#define CONFIG_FAT 1 -+#define CONFIG_DOS_PARTITION 1 -+#define CONFIG_CMD_MMC -+#define CONFIG_CMD_FAT -+#define CONFIG_CMD_EXT2 -+ -+ - #define CONFIG_SYS_SDRAM_BASE 0x80000000 /* Cached addr */ - #define CONFIG_SYS_INIT_SP_OFFSET 0x400000 - #define CONFIG_SYS_LOAD_ADDR 0x80600000 -diff --git a/include/mmc.h b/include/mmc.h -index a13e2bd..3c4761c 100644 ---- a/include/mmc.h -+++ b/include/mmc.h -@@ -283,4 +283,44 @@ struct mmc *mmc_spi_init(uint bus, uint cs, uint speed, uint mode); - int mmc_legacy_init(int verbose); - #endif - -+struct mmc_csd -+{ -+ u8 csd_structure:2, -+ spec_vers:4, -+ rsvd1:2; -+ u8 taac; -+ u8 nsac; -+ u8 tran_speed; -+ u16 ccc:12, -+ read_bl_len:4; -+ u32 c_size:22; -+ u64 read_bl_partial:1, -+ write_blk_misalign:1, -+ read_blk_misalign:1, -+ dsr_imp:1, -+ rsvd2:2, -+ vdd_r_curr_min:3, -+ vdd_r_curr_max:3, -+ vdd_w_curr_min:3, -+ vdd_w_curr_max:3, -+ c_size_mult:3, -+ sector_size:5, -+ erase_grp_size:5, -+ wp_grp_size:5, -+ wp_grp_enable:1, -+ default_ecc:2, -+ r2w_factor:3, -+ write_bl_len:4, -+ write_bl_partial:1, -+ rsvd3:5; -+ u8 file_format_grp:1, -+ copy:1, -+ perm_write_protect:1, -+ tmp_write_protect:1, -+ file_format:2, -+ ecc:2; -+ u8 crc:7; -+ u8 one:1; -+}; -+ - #endif /* _MMC_H_ */ --- -1.7.9.5 - diff --git a/package/boot/uboot-xburst/patches/0004-add-more-boot-options-F1-F2-F3-F4-M-S.patch b/package/boot/uboot-xburst/patches/0004-add-more-boot-options-F1-F2-F3-F4-M-S.patch deleted file mode 100644 index 73e03243c3..0000000000 --- a/package/boot/uboot-xburst/patches/0004-add-more-boot-options-F1-F2-F3-F4-M-S.patch +++ /dev/null @@ -1,200 +0,0 @@ -From c52b6168979d03fc31205444c3278c537787472a Mon Sep 17 00:00:00 2001 -From: Xiangfu -Date: Wed, 10 Oct 2012 18:39:55 +0800 -Subject: [PATCH 4/6] add more boot options(F1/F2/F3/F4/M/S) - ---- - arch/mips/include/asm/global_data.h | 3 +++ - arch/mips/lib/bootm.c | 17 ++++++++++++++++- - board/qi/qi_lb60/qi_lb60.c | 26 +++++++++++++++++++++++--- - common/main.c | 21 +++++++++++++++++++-- - include/configs/qi_lb60.h | 32 ++++++++++++++++++++++++++++++++ - 5 files changed, 93 insertions(+), 6 deletions(-) - -diff --git a/arch/mips/include/asm/global_data.h b/arch/mips/include/asm/global_data.h -index 6e2cdc7..cd03d7e 100644 ---- a/arch/mips/include/asm/global_data.h -+++ b/arch/mips/include/asm/global_data.h -@@ -59,6 +59,9 @@ typedef struct global_data { - unsigned long env_valid; /* Checksum of Environment valid? */ - void **jt; /* jump table */ - char env_buf[32]; /* buffer for getenv() before reloc. */ -+#if defined(CONFIG_NANONOTE) -+ unsigned long boot_option; -+#endif - } gd_t; - - #include -diff --git a/arch/mips/lib/bootm.c b/arch/mips/lib/bootm.c -index 608c1a7..e00416b 100644 ---- a/arch/mips/lib/bootm.c -+++ b/arch/mips/lib/bootm.c -@@ -47,10 +47,25 @@ int do_bootm_linux(int flag, int argc, char * const argv[], - bootm_headers_t *images) - { - void (*theKernel) (int, char **, char **, int *); -- char *commandline = getenv("bootargs"); -+ char *commandline; - char env_buf[12]; - char *cp; - -+#if defined(CONFIG_NANONOTE) -+ if (gd->boot_option & BOOT_FROM_MEMCARD) -+ commandline = getenv ("bootargsfromsd"); -+ else if (gd->boot_option & BOOT_WITH_F1) -+ commandline = getenv ("bootargsf1"); -+ else if (gd->boot_option & BOOT_WITH_F2) -+ commandline = getenv ("bootargsf2"); -+ else if (gd->boot_option & BOOT_WITH_F3) -+ commandline = getenv ("bootargsf3"); -+ else if (gd->boot_option & BOOT_WITH_F4) -+ commandline = getenv ("bootargsf4"); -+ else -+#endif -+ commandline = getenv ("bootargs"); -+ - if ((flag != 0) && (flag != BOOTM_STATE_OS_GO)) - return 1; - -diff --git a/board/qi/qi_lb60/qi_lb60.c b/board/qi/qi_lb60/qi_lb60.c -index a2ba648..d622219 100644 ---- a/board/qi/qi_lb60/qi_lb60.c -+++ b/board/qi/qi_lb60/qi_lb60.c -@@ -15,7 +15,7 @@ DECLARE_GLOBAL_DATA_PTR; - - static void gpio_init(void) - { -- unsigned int i; -+ unsigned int i, j; - - /* Initialize NAND Flash Pins */ - __gpio_as_nand(); -@@ -42,14 +42,34 @@ static void gpio_init(void) - - if (__gpio_get_pin(GPIO_KEYIN_BASE + 2) == 0){ - printf("[S] pressed, enable UART0\n"); -+ gd->boot_option |= BOOT_WITH_ENABLE_UART; - __gpio_as_uart0(); - } else { - __gpio_as_input(GPIO_KEYIN_8); - __gpio_enable_pull(GPIO_KEYIN_8); - } - -- /* enable the TP4, TP5 as UART0 */ -- __gpio_jtag_to_uart0(); -+ if (__gpio_get_pin(GPIO_KEYIN_BASE + 3) == 0) { -+ printf("[M] pressed, boot from memory card\n"); -+ gd->boot_option |= BOOT_FROM_MEMCARD; -+ __gpio_jtag_to_uart0(); -+ } -+ -+ for (j = 0; j < 4; j++) { -+ for (i = 0; i < 4; i++) -+ __gpio_set_pin(GPIO_KEYOUT_BASE + i); -+ -+ __gpio_clear_pin(GPIO_KEYOUT_BASE + j); -+ -+ if (__gpio_get_pin(GPIO_KEYIN_BASE) == 0) { -+ printf("[F%d] pressed", (j + 1)); -+ gd->boot_option |= (1 << (j + 2)); -+ /* BOOT_WITH_F1 (1 << 2) */ -+ /* BOOT_WITH_F2 (1 << 3) */ -+ /* BOOT_WITH_F3 (1 << 4) */ -+ /* BOOT_WITH_F4 (1 << 5) */ -+ } -+ } - - __gpio_as_output(GPIO_AUDIO_POP); - __gpio_set_pin(GPIO_AUDIO_POP); -diff --git a/common/main.c b/common/main.c -index 9507cec..dbfb7ca 100644 ---- a/common/main.c -+++ b/common/main.c -@@ -355,7 +355,11 @@ void main_loop (void) - #if defined(CONFIG_BOOTDELAY) && (CONFIG_BOOTDELAY >= 0) - s = getenv ("bootdelay"); - bootdelay = s ? (int)simple_strtol(s, NULL, 10) : CONFIG_BOOTDELAY; -- -+#if defined(CONFIG_NANONOTE) -+ DECLARE_GLOBAL_DATA_PTR; -+ if (gd->boot_option & BOOT_WITH_ENABLE_UART) -+ bootdelay = 3; -+# endif - debug ("### main_loop entered: bootdelay=%d\n\n", bootdelay); - - #if defined(CONFIG_MENU_SHOW) -@@ -379,7 +383,20 @@ void main_loop (void) - } - else - #endif /* CONFIG_BOOTCOUNT_LIMIT */ -- s = getenv ("bootcmd"); -+#if defined(CONFIG_NANONOTE) -+ if (gd->boot_option & BOOT_FROM_MEMCARD) -+ s = getenv ("bootcmdfromsd"); -+ else if (gd->boot_option & BOOT_WITH_F1) -+ s = getenv ("bootcmdf1"); -+ else if (gd->boot_option & BOOT_WITH_F2) -+ s = getenv ("bootcmdf2"); -+ else if (gd->boot_option & BOOT_WITH_F3) -+ s = getenv ("bootcmdf3"); -+ else if (gd->boot_option & BOOT_WITH_F4) -+ s = getenv ("bootcmdf4"); -+ else -+#endif -+ s = getenv ("bootcmd"); - - debug ("### main_loop: bootcmd=\"%s\"\n", s ? s : ""); - -diff --git a/include/configs/qi_lb60.h b/include/configs/qi_lb60.h -index 7b33be0..52b370c 100644 ---- a/include/configs/qi_lb60.h -+++ b/include/configs/qi_lb60.h -@@ -31,6 +31,7 @@ - /* - * Miscellaneous configurable options - */ -+#define CONFIG_NANONOTE - #define CONFIG_JZ4740_MMC - #define CONFIG_MMC 1 - #define CONFIG_FAT 1 -@@ -39,6 +40,37 @@ - #define CONFIG_CMD_FAT - #define CONFIG_CMD_EXT2 - -+#define CONFIG_CMD_UBIFS -+#define CONFIG_CMD_UBI -+#define CONFIG_MTD_PARTITIONS -+#define CONFIG_MTD_DEVICE -+#define CONFIG_CMD_MTDPARTS -+#define CONFIG_CMD_UBI -+#define CONFIG_CMD_UBIFS -+#define CONFIG_LZO -+#define CONFIG_RBTREE -+ -+#define MTDIDS_DEFAULT "nand0=jz4740-nand" -+#define MTDPARTS_DEFAULT "mtdparts=jz4740-nand:4M@0(uboot)ro,4M@4M(kernel)ro,512M@8M(rootfs)ro,-(data)ro" -+ -+#define BOOT_FROM_MEMCARD 1 -+#define BOOT_WITH_ENABLE_UART (1 << 1) /* Vaule for global_data.h gd->boot_option */ -+#define BOOT_WITH_F1 (1 << 2) -+#define BOOT_WITH_F2 (1 << 3) -+#define BOOT_WITH_F3 (1 << 4) -+#define BOOT_WITH_F4 (1 << 5) -+ -+#define CONFIG_EXTRA_ENV_SETTINGS \ -+ "bootcmdfromsd=mmc init; ext2load mmc 0 0x80600000 /boot/uImage; bootm;\0" \ -+ "bootargsfromsd=mem=32M console=tty0 console=ttyS0,57600n8 rootfstype=ext2 root=/dev/mmcblk0p1 rw rootwait\0" \ -+ "bootcmdf1=mmc init; ext2load mmc 0:1 0x80600000 /boot/uImage; bootm;\0" \ -+ "bootargsf1=mem=32M console=tty0 console=ttyS0,57600n8 rootfstype=ext2 root=/dev/mmcblk0p1 rw rootwait\0" \ -+ "bootcmdf2=mmc init; ext2load mmc 0:2 0x80600000 /boot/uImage; bootm;\0" \ -+ "bootargsf2=mem=32M console=tty0 console=ttyS0,57600n8 rootfstype=ext2 root=/dev/mmcblk0p2 rw rootwait\0" \ -+ "bootcmdf3=mmc init; ext2load mmc 0:3 0x80600000 /boot/uImage; bootm;\0" \ -+ "bootargsf3=mem=32M console=tty0 console=ttyS0,57600n8 rootfstype=ext2 root=/dev/mmcblk0p3 rw rootwait\0" \ -+ "bootcmdf4=mtdparts default;ubi part rootfs;ubifsmount rootfs;ubifsload 0x80600000 /boot/uImage; bootm;\0" \ -+ "bootargsf4=mem=32M console=tty0 console=ttyS0,57600n8 ubi.mtd=2 rootfstype=ubifs root=ubi0:rootfs rw rootwait" - - #define CONFIG_SYS_SDRAM_BASE 0x80000000 /* Cached addr */ - #define CONFIG_SYS_INIT_SP_OFFSET 0x400000 --- -1.7.9.5 - diff --git a/package/boot/uboot-xburst/patches/0005-add-nanonote-lcd-support.patch b/package/boot/uboot-xburst/patches/0005-add-nanonote-lcd-support.patch deleted file mode 100644 index 2c550f7205..0000000000 --- a/package/boot/uboot-xburst/patches/0005-add-nanonote-lcd-support.patch +++ /dev/null @@ -1,847 +0,0 @@ -From ca8c5216cfd3ad3fda9867ed2d157ae5a209834b Mon Sep 17 00:00:00 2001 -From: Xiangfu -Date: Wed, 10 Oct 2012 22:05:27 +0800 -Subject: [PATCH 5/6] add nanonote lcd support - ---- - arch/mips/include/asm/global_data.h | 1 + - arch/mips/include/asm/jz4740.h | 90 ++++++++ - arch/mips/lib/board.c | 6 + - common/lcd.c | 9 +- - drivers/video/Makefile | 1 + - drivers/video/nanonote_gpm940b0.c | 400 +++++++++++++++++++++++++++++++++++ - drivers/video/nanonote_gpm940b0.h | 135 ++++++++++++ - include/configs/qi_lb60.h | 7 + - include/lcd.h | 52 ++++- - 9 files changed, 697 insertions(+), 4 deletions(-) - create mode 100644 drivers/video/nanonote_gpm940b0.c - create mode 100644 drivers/video/nanonote_gpm940b0.h - -diff --git a/arch/mips/include/asm/global_data.h b/arch/mips/include/asm/global_data.h -index cd03d7e..7cec2de 100644 ---- a/arch/mips/include/asm/global_data.h -+++ b/arch/mips/include/asm/global_data.h -@@ -44,6 +44,7 @@ typedef struct global_data { - unsigned long per_clk; /* Peripheral bus clock */ - unsigned long mem_clk; /* Memory bus clock */ - unsigned long dev_clk; /* Device clock */ -+ unsigned long fb_base; /* base address of framebuffer */ - /* "static data" needed by most of timer.c */ - unsigned long tbl; - unsigned long lastinc; -diff --git a/arch/mips/include/asm/jz4740.h b/arch/mips/include/asm/jz4740.h -index 68287fb..13724a2 100644 ---- a/arch/mips/include/asm/jz4740.h -+++ b/arch/mips/include/asm/jz4740.h -@@ -1312,5 +1312,95 @@ do { \ - while (REG_MSC_STAT & MSC_STAT_IS_RESETTING); \ - } while (0) - -+/************************************************************************* -+ * LCD (LCD Controller) -+ *************************************************************************/ -+#define REG32(addr) *((volatile u32 *)(addr)) -+ -+#define CPM_BASE 0xB0000000 -+#define CPM_CPCCR (CPM_BASE+0x00) -+#define REG_CPM_CPCCR REG32(CPM_CPCCR) -+ -+#define LCD_BASE 0xB3050000 -+#define LCD_CFG (LCD_BASE + 0x00) /* LCD Configure Register */ -+#define LCD_VSYNC (LCD_BASE + 0x04) /* Vertical Synchronize Register */ -+#define LCD_HSYNC (LCD_BASE + 0x08) /* Horizontal Synchronize Register */ -+#define LCD_VAT (LCD_BASE + 0x0c) /* Virtual Area Setting Register */ -+#define LCD_DAH (LCD_BASE + 0x10) /* Display Area Horizontal Start/End Point */ -+#define LCD_DAV (LCD_BASE + 0x14) /* Display Area Vertical Start/End Point */ -+#define LCD_PS (LCD_BASE + 0x18) /* PS Signal Setting */ -+#define LCD_CLS (LCD_BASE + 0x1c) /* CLS Signal Setting */ -+#define LCD_SPL (LCD_BASE + 0x20) /* SPL Signal Setting */ -+#define LCD_REV (LCD_BASE + 0x24) /* REV Signal Setting */ -+#define LCD_CTRL (LCD_BASE + 0x30) /* LCD Control Register */ -+#define LCD_STATE (LCD_BASE + 0x34) /* LCD Status Register */ -+#define LCD_IID (LCD_BASE + 0x38) /* Interrupt ID Register */ -+#define LCD_DA0 (LCD_BASE + 0x40) /* Descriptor Address Register 0 */ -+#define LCD_SA0 (LCD_BASE + 0x44) /* Source Address Register 0 */ -+#define LCD_FID0 (LCD_BASE + 0x48) /* Frame ID Register 0 */ -+#define LCD_CMD0 (LCD_BASE + 0x4c) /* DMA Command Register 0 */ -+#define LCD_DA1 (LCD_BASE + 0x50) /* Descriptor Address Register 1 */ -+#define LCD_SA1 (LCD_BASE + 0x54) /* Source Address Register 1 */ -+#define LCD_FID1 (LCD_BASE + 0x58) /* Frame ID Register 1 */ -+#define LCD_CMD1 (LCD_BASE + 0x5c) /* DMA Command Register 1 */ -+ -+#define REG_LCD_CFG REG32(LCD_CFG) -+#define REG_LCD_VSYNC REG32(LCD_VSYNC) -+#define REG_LCD_HSYNC REG32(LCD_HSYNC) -+#define REG_LCD_VAT REG32(LCD_VAT) -+#define REG_LCD_DAH REG32(LCD_DAH) -+#define REG_LCD_DAV REG32(LCD_DAV) -+#define REG_LCD_PS REG32(LCD_PS) -+#define REG_LCD_CLS REG32(LCD_CLS) -+#define REG_LCD_SPL REG32(LCD_SPL) -+#define REG_LCD_REV REG32(LCD_REV) -+#define REG_LCD_CTRL REG32(LCD_CTRL) -+#define REG_LCD_STATE REG32(LCD_STATE) -+#define REG_LCD_IID REG32(LCD_IID) -+#define REG_LCD_DA0 REG32(LCD_DA0) -+#define REG_LCD_SA0 REG32(LCD_SA0) -+#define REG_LCD_FID0 REG32(LCD_FID0) -+#define REG_LCD_CMD0 REG32(LCD_CMD0) -+#define REG_LCD_DA1 REG32(LCD_DA1) -+#define REG_LCD_SA1 REG32(LCD_SA1) -+#define REG_LCD_FID1 REG32(LCD_FID1) -+#define REG_LCD_CMD1 REG32(LCD_CMD1) -+ -+#define LCD_CTRL_BPP_BIT 0 /* Bits Per Pixel */ -+#define LCD_CTRL_BPP_MASK (0x07 << LCD_CTRL_BPP_BIT) -+ #define LCD_CTRL_BPP_1 (0 << LCD_CTRL_BPP_BIT) /* 1 bpp */ -+ #define LCD_CTRL_BPP_2 (1 << LCD_CTRL_BPP_BIT) /* 2 bpp */ -+ #define LCD_CTRL_BPP_4 (2 << LCD_CTRL_BPP_BIT) /* 4 bpp */ -+ #define LCD_CTRL_BPP_8 (3 << LCD_CTRL_BPP_BIT) /* 8 bpp */ -+ #define LCD_CTRL_BPP_16 (4 << LCD_CTRL_BPP_BIT) /* 15/16 bpp */ -+ #define LCD_CTRL_BPP_18_24 (5 << LCD_CTRL_BPP_BIT) /* 18/24/32 bpp */ -+ -+#define LCD_CTRL_BST_BIT 28 /* Burst Length Selection */ -+#define LCD_CTRL_BST_MASK (0x03 << LCD_CTRL_BST_BIT) -+ #define LCD_CTRL_BST_4 (0 << LCD_CTRL_BST_BIT) /* 4-word */ -+ #define LCD_CTRL_BST_8 (1 << LCD_CTRL_BST_BIT) /* 8-word */ -+ #define LCD_CTRL_BST_16 (2 << LCD_CTRL_BST_BIT) /* 16-word */ -+#define LCD_CTRL_RGB565 (0 << 27) /* RGB565 mode */ -+#define LCD_CTRL_RGB555 (1 << 27) /* RGB555 mode */ -+#define LCD_CTRL_OFUP (1 << 26) /* Output FIFO underrun protection enable */ -+#define LCD_CTRL_FRC_BIT 24 /* STN FRC Algorithm Selection */ -+#define LCD_CTRL_FRC_MASK (0x03 << LCD_CTRL_FRC_BIT) -+ #define LCD_CTRL_FRC_16 (0 << LCD_CTRL_FRC_BIT) /* 16 grayscale */ -+ #define LCD_CTRL_FRC_4 (1 << LCD_CTRL_FRC_BIT) /* 4 grayscale */ -+ #define LCD_CTRL_FRC_2 (2 << LCD_CTRL_FRC_BIT) /* 2 grayscale */ -+ -+#define CPM_LPCDR (CPM_BASE+0x64) -+#define CPM_CLKGR (CPM_BASE+0x20) -+#define REG_CPM_LPCDR REG32(CPM_LPCDR) -+#define REG_CPM_CLKGR REG32(CPM_CLKGR) -+ -+#define __cpm_start_tcu() (REG_CPM_CLKGR &= ~CPM_CLKGR_TCU) -+#define __cpm_stop_lcd() (REG_CPM_CLKGR |= CPM_CLKGR_LCD) -+#define __cpm_set_pixdiv(v) \ -+ (REG_CPM_LPCDR = (REG_CPM_LPCDR & ~CPM_LPCDR_PIXDIV_MASK) | ((v) << (CPM_LPCDR_PIXDIV_BIT))) -+#define __cpm_set_ldiv(v) \ -+ (REG_CPM_CPCCR = (REG_CPM_CPCCR & ~CPM_CPCCR_LDIV_MASK) | ((v) << (CPM_CPCCR_LDIV_BIT))) -+#define __cpm_start_lcd() (REG_CPM_CLKGR &= ~CPM_CLKGR_LCD) -+ - #endif /* !__ASSEMBLY__ */ - #endif /* __JZ4740_H__ */ -diff --git a/arch/mips/lib/board.c b/arch/mips/lib/board.c -index b14b33e..c2e64d9 100644 ---- a/arch/mips/lib/board.c -+++ b/arch/mips/lib/board.c -@@ -172,6 +172,12 @@ void board_init_f(ulong bootflag) - addr &= ~(4096 - 1); - debug("Top of RAM usable for U-Boot at: %08lx\n", addr); - -+#ifdef CONFIG_LCD -+ /* reserve memory for LCD display (always full pages) */ -+ addr = lcd_setmem (addr); -+ gd->fb_base = addr; -+#endif /* CONFIG_LCD */ -+ - /* Reserve memory for U-Boot code, data & bss - * round down to next 16 kB limit - */ -diff --git a/common/lcd.c b/common/lcd.c -index b6be800..af1281a 100644 ---- a/common/lcd.c -+++ b/common/lcd.c -@@ -263,6 +263,13 @@ static void lcd_drawchars(ushort x, ushort y, uchar *str, int count) - lcd_color_fg : lcd_color_bg; - bits <<= 1; - } -+#elif LCD_BPP == LCD_COLOR32 -+ uint *m = (uint *)d; -+ for (c=0; c<32; ++c) { -+ *m++ = (bits & 0x80) ? -+ lcd_color_fg : lcd_color_bg; -+ bits <<= 1; -+ } - #endif - } - #if LCD_BPP == LCD_MONOCHROME -@@ -509,7 +516,7 @@ static inline ushort *configuration_get_cmap(void) - return (ushort *)&(cp->lcd_cmap[255 * sizeof(ushort)]); - #elif defined(CONFIG_ATMEL_LCD) - return (ushort *)(panel_info.mmio + ATMEL_LCDC_LUT(0)); --#elif !defined(CONFIG_ATMEL_HLCD) && !defined(CONFIG_EXYNOS_FB) -+#elif !defined(CONFIG_ATMEL_HLCD) && !defined(CONFIG_EXYNOS_FB) && !defined(CONFIG_VIDEO_GPM940B0) - return panel_info.cmap; - #else - #if defined(CONFIG_LCD_LOGO) -diff --git a/drivers/video/Makefile b/drivers/video/Makefile -index ebb6da8..03625bc 100644 ---- a/drivers/video/Makefile -+++ b/drivers/video/Makefile -@@ -50,6 +50,7 @@ COBJS-$(CONFIG_VIDEO_SED13806) += sed13806.o - COBJS-$(CONFIG_VIDEO_SM501) += sm501.o - COBJS-$(CONFIG_VIDEO_SMI_LYNXEM) += smiLynxEM.o videomodes.o - COBJS-$(CONFIG_VIDEO_VCXK) += bus_vcxk.o -+COBJS-$(CONFIG_VIDEO_GPM940B0) += nanonote_gpm940b0.o - - COBJS := $(sort $(COBJS-y)) - SRCS := $(COBJS:.o=.c) -diff --git a/drivers/video/nanonote_gpm940b0.c b/drivers/video/nanonote_gpm940b0.c -new file mode 100644 -index 0000000..11efb72 ---- /dev/null -+++ b/drivers/video/nanonote_gpm940b0.c -@@ -0,0 +1,400 @@ -+/* -+ * JzRISC lcd controller -+ * -+ * Xiangfu Liu -+ * -+ * 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 -+#include -+#include -+ -+#include /* virt_to_phys() */ -+#include -+ -+#include "nanonote_gpm940b0.h" -+ -+#define align2(n) (n)=((((n)+1)>>1)<<1) -+#define align4(n) (n)=((((n)+3)>>2)<<2) -+#define align8(n) (n)=((((n)+7)>>3)<<3) -+ -+struct jzfb_info { -+ unsigned int cfg; /* panel mode and pin usage etc. */ -+ unsigned int w; -+ unsigned int h; -+ unsigned int bpp; /* bit per pixel */ -+ unsigned int fclk; /* frame clk */ -+ unsigned int hsw; /* hsync width, in pclk */ -+ unsigned int vsw; /* vsync width, in line count */ -+ unsigned int elw; /* end of line, in pclk */ -+ unsigned int blw; /* begin of line, in pclk */ -+ unsigned int efw; /* end of frame, in line count */ -+ unsigned int bfw; /* begin of frame, in line count */ -+}; -+ -+static struct jzfb_info jzfb = { -+ MODE_8BIT_SERIAL_TFT | PCLK_N | HSYNC_N | VSYNC_N, -+ 320, 240, 32, 70, 1, 1, 273, 140, 1, 20 -+}; -+ -+vidinfo_t panel_info = { -+ 320, 240, LCD_BPP, -+}; -+ -+void *lcd_base; -+void *lcd_console_address; -+int lcd_line_length; -+int lcd_color_fg; -+int lcd_color_bg; -+short console_col; -+short console_row; -+ -+static int jz_lcd_init_mem(void *lcdbase, vidinfo_t *vid) -+{ -+ u_long palette_mem_size; -+ struct jz_fb_info *fbi = &vid->jz_fb; -+ int fb_size = vid->vl_row * (vid->vl_col * NBITS (vid->vl_bpix)) / 8; -+ -+ fbi->screen = (u_long)lcdbase; -+ fbi->palette_size = 256; -+ palette_mem_size = fbi->palette_size * sizeof(u16); -+ -+ debug("jz_lcd.c palette_mem_size = 0x%08lx\n", (u_long) palette_mem_size); -+ /* locate palette and descs at end of page following fb */ -+ fbi->palette = (u_long)lcdbase + fb_size + PAGE_SIZE - palette_mem_size; -+ -+ return 0; -+} -+ -+static void jz_lcd_desc_init(vidinfo_t *vid) -+{ -+ struct jz_fb_info * fbi; -+ fbi = &vid->jz_fb; -+ fbi->dmadesc_fblow = (struct jz_fb_dma_descriptor *)((unsigned int)fbi->palette - 3*16); -+ fbi->dmadesc_fbhigh = (struct jz_fb_dma_descriptor *)((unsigned int)fbi->palette - 2*16); -+ fbi->dmadesc_palette = (struct jz_fb_dma_descriptor *)((unsigned int)fbi->palette - 1*16); -+ -+ #define BYTES_PER_PANEL (vid->vl_col * vid->vl_row * NBITS(vid->vl_bpix) / 8) -+ -+ /* populate descriptors */ -+ fbi->dmadesc_fblow->fdadr = virt_to_phys(fbi->dmadesc_fblow); -+ fbi->dmadesc_fblow->fsadr = virt_to_phys((void *)(fbi->screen + BYTES_PER_PANEL)); -+ fbi->dmadesc_fblow->fidr = 0; -+ fbi->dmadesc_fblow->ldcmd = BYTES_PER_PANEL / 4 ; -+ -+ fbi->fdadr1 = virt_to_phys(fbi->dmadesc_fblow); /* only used in dual-panel mode */ -+ -+ fbi->dmadesc_fbhigh->fsadr = virt_to_phys((void *)fbi->screen); -+ fbi->dmadesc_fbhigh->fidr = 0; -+ fbi->dmadesc_fbhigh->ldcmd = BYTES_PER_PANEL / 4; /* length in word */ -+ -+ fbi->dmadesc_palette->fsadr = virt_to_phys((void *)fbi->palette); -+ fbi->dmadesc_palette->fidr = 0; -+ fbi->dmadesc_palette->ldcmd = (fbi->palette_size * 2)/4 | (1<<28); -+ -+ if(NBITS(vid->vl_bpix) < 12) { -+ /* assume any mode with <12 bpp is palette driven */ -+ fbi->dmadesc_palette->fdadr = virt_to_phys(fbi->dmadesc_fbhigh); -+ fbi->dmadesc_fbhigh->fdadr = virt_to_phys(fbi->dmadesc_palette); -+ /* flips back and forth between pal and fbhigh */ -+ fbi->fdadr0 = virt_to_phys(fbi->dmadesc_palette); -+ } else { -+ /* palette shouldn't be loaded in true-color mode */ -+ fbi->dmadesc_fbhigh->fdadr = virt_to_phys((void *)fbi->dmadesc_fbhigh); -+ fbi->fdadr0 = virt_to_phys(fbi->dmadesc_fbhigh); /* no pal just fbhigh */ -+ } -+} -+ -+static int jz_lcd_hw_init(vidinfo_t *vid) -+{ -+ struct jz_fb_info *fbi = &vid->jz_fb; -+ unsigned int val = 0; -+ unsigned int pclk; -+ unsigned int stnH; -+ int pll_div; -+ -+ /* Setting Control register */ -+ switch (jzfb.bpp) { -+ case 1: -+ val |= LCD_CTRL_BPP_1; -+ break; -+ case 2: -+ val |= LCD_CTRL_BPP_2; -+ break; -+ case 4: -+ val |= LCD_CTRL_BPP_4; -+ break; -+ case 8: -+ val |= LCD_CTRL_BPP_8; -+ break; -+ case 15: -+ val |= LCD_CTRL_RGB555; -+ case 16: -+ val |= LCD_CTRL_BPP_16; -+ break; -+ case 17 ... 32: -+ val |= LCD_CTRL_BPP_18_24; /* target is 4bytes/pixel */ -+ break; -+ -+ default: -+ printf("jz_lcd.c The BPP %d is not supported\n", jzfb.bpp); -+ val |= LCD_CTRL_BPP_16; -+ break; -+ } -+ -+ switch (jzfb.cfg & MODE_MASK) { -+ case MODE_STN_MONO_DUAL: -+ case MODE_STN_COLOR_DUAL: -+ case MODE_STN_MONO_SINGLE: -+ case MODE_STN_COLOR_SINGLE: -+ switch (jzfb.bpp) { -+ case 1: -+ /* val |= LCD_CTRL_PEDN; */ -+ case 2: -+ val |= LCD_CTRL_FRC_2; -+ break; -+ case 4: -+ val |= LCD_CTRL_FRC_4; -+ break; -+ case 8: -+ default: -+ val |= LCD_CTRL_FRC_16; -+ break; -+ } -+ break; -+ } -+ -+ val |= LCD_CTRL_BST_16; /* Burst Length is 16WORD=64Byte */ -+ val |= LCD_CTRL_OFUP; /* OutFIFO underrun protect */ -+ -+ switch (jzfb.cfg & MODE_MASK) { -+ case MODE_STN_MONO_DUAL: -+ case MODE_STN_COLOR_DUAL: -+ case MODE_STN_MONO_SINGLE: -+ case MODE_STN_COLOR_SINGLE: -+ switch (jzfb.cfg & STN_DAT_PINMASK) { -+ case STN_DAT_PIN1: -+ /* Do not adjust the hori-param value. */ -+ break; -+ case STN_DAT_PIN2: -+ align2(jzfb.hsw); -+ align2(jzfb.elw); -+ align2(jzfb.blw); -+ break; -+ case STN_DAT_PIN4: -+ align4(jzfb.hsw); -+ align4(jzfb.elw); -+ align4(jzfb.blw); -+ break; -+ case STN_DAT_PIN8: -+ align8(jzfb.hsw); -+ align8(jzfb.elw); -+ align8(jzfb.blw); -+ break; -+ } -+ break; -+ } -+ -+ REG_LCD_CTRL = val; -+ -+ switch (jzfb.cfg & MODE_MASK) { -+ case MODE_STN_MONO_DUAL: -+ case MODE_STN_COLOR_DUAL: -+ case MODE_STN_MONO_SINGLE: -+ case MODE_STN_COLOR_SINGLE: -+ if (((jzfb.cfg & MODE_MASK) == MODE_STN_MONO_DUAL) || -+ ((jzfb.cfg & MODE_MASK) == MODE_STN_COLOR_DUAL)) -+ stnH = jzfb.h >> 1; -+ else -+ stnH = jzfb.h; -+ -+ REG_LCD_VSYNC = (0 << 16) | jzfb.vsw; -+ REG_LCD_HSYNC = ((jzfb.blw+jzfb.w) << 16) | (jzfb.blw+jzfb.w+jzfb.hsw); -+ -+ /* Screen setting */ -+ REG_LCD_VAT = ((jzfb.blw + jzfb.w + jzfb.hsw + jzfb.elw) << 16) | (stnH + jzfb.vsw + jzfb.bfw + jzfb.efw); -+ REG_LCD_DAH = (jzfb.blw << 16) | (jzfb.blw + jzfb.w); -+ REG_LCD_DAV = (0 << 16) | (stnH); -+ -+ /* AC BIAs signal */ -+ REG_LCD_PS = (0 << 16) | (stnH+jzfb.vsw+jzfb.efw+jzfb.bfw); -+ -+ break; -+ -+ case MODE_TFT_GEN: -+ case MODE_TFT_SHARP: -+ case MODE_TFT_CASIO: -+ case MODE_TFT_SAMSUNG: -+ case MODE_8BIT_SERIAL_TFT: -+ case MODE_TFT_18BIT: -+ REG_LCD_VSYNC = (0 << 16) | jzfb.vsw; -+ REG_LCD_HSYNC = (0 << 16) | jzfb.hsw; -+ REG_LCD_DAV =((jzfb.vsw+jzfb.bfw) << 16) | (jzfb.vsw +jzfb.bfw+jzfb.h); -+ REG_LCD_DAH = ((jzfb.hsw + jzfb.blw) << 16) | (jzfb.hsw + jzfb.blw + jzfb.w ); -+ REG_LCD_VAT = (((jzfb.blw + jzfb.w + jzfb.elw + jzfb.hsw)) << 16) \ -+ | (jzfb.vsw + jzfb.bfw + jzfb.h + jzfb.efw); -+ break; -+ } -+ -+ switch (jzfb.cfg & MODE_MASK) { -+ case MODE_TFT_SAMSUNG: -+ { -+ unsigned int total, tp_s, tp_e, ckv_s, ckv_e; -+ unsigned int rev_s, rev_e, inv_s, inv_e; -+ -+ pclk = val * (jzfb.w + jzfb.hsw + jzfb.elw + jzfb.blw) * -+ (jzfb.h + jzfb.vsw + jzfb.efw + jzfb.bfw); /* Pixclk */ -+ -+ total = jzfb.blw + jzfb.w + jzfb.elw + jzfb.hsw; -+ tp_s = jzfb.blw + jzfb.w + 1; -+ tp_e = tp_s + 1; -+ ckv_s = tp_s - pclk/(1000000000/4100); -+ ckv_e = tp_s + total; -+ rev_s = tp_s - 11; /* -11.5 clk */ -+ rev_e = rev_s + total; -+ inv_s = tp_s; -+ inv_e = inv_s + total; -+ REG_LCD_CLS = (tp_s << 16) | tp_e; -+ REG_LCD_PS = (ckv_s << 16) | ckv_e; -+ REG_LCD_SPL = (rev_s << 16) | rev_e; -+ REG_LCD_REV = (inv_s << 16) | inv_e; -+ jzfb.cfg |= STFT_REVHI | STFT_SPLHI; -+ break; -+ } -+ case MODE_TFT_SHARP: -+ { -+ unsigned int total, cls_s, cls_e, ps_s, ps_e; -+ unsigned int spl_s, spl_e, rev_s, rev_e; -+ total = jzfb.blw + jzfb.w + jzfb.elw + jzfb.hsw; -+ spl_s = 1; -+ spl_e = spl_s + 1; -+ cls_s = 0; -+ cls_e = total - 60; /* > 4us (pclk = 80ns) */ -+ ps_s = cls_s; -+ ps_e = cls_e; -+ rev_s = total - 40; /* > 3us (pclk = 80ns) */ -+ rev_e = rev_s + total; -+ jzfb.cfg |= STFT_PSHI; -+ REG_LCD_SPL = (spl_s << 16) | spl_e; -+ REG_LCD_CLS = (cls_s << 16) | cls_e; -+ REG_LCD_PS = (ps_s << 16) | ps_e; -+ REG_LCD_REV = (rev_s << 16) | rev_e; -+ break; -+ } -+ case MODE_TFT_CASIO: -+ break; -+ } -+ -+ /* Configure the LCD panel */ -+ REG_LCD_CFG = jzfb.cfg; -+ -+ /* Timing setting */ -+ __cpm_stop_lcd(); -+ -+ val = jzfb.fclk; /* frame clk */ -+ if ( (jzfb.cfg & MODE_MASK) != MODE_8BIT_SERIAL_TFT) { -+ pclk = val * (jzfb.w + jzfb.hsw + jzfb.elw + jzfb.blw) * -+ (jzfb.h + jzfb.vsw + jzfb.efw + jzfb.bfw); /* Pixclk */ -+ } else { -+ /* serial mode: Hsync period = 3*Width_Pixel */ -+ pclk = val * (jzfb.w*3 + jzfb.hsw + jzfb.elw + jzfb.blw) * -+ (jzfb.h + jzfb.vsw + jzfb.efw + jzfb.bfw); /* Pixclk */ -+ } -+ -+ if (((jzfb.cfg & MODE_MASK) == MODE_STN_COLOR_SINGLE) || -+ ((jzfb.cfg & MODE_MASK) == MODE_STN_COLOR_DUAL)) -+ pclk = (pclk * 3); -+ -+ if (((jzfb.cfg & MODE_MASK) == MODE_STN_COLOR_SINGLE) || -+ ((jzfb.cfg & MODE_MASK) == MODE_STN_COLOR_DUAL) || -+ ((jzfb.cfg & MODE_MASK) == MODE_STN_MONO_SINGLE) || -+ ((jzfb.cfg & MODE_MASK) == MODE_STN_MONO_DUAL)) -+ pclk = pclk >> ((jzfb.cfg & STN_DAT_PINMASK) >> 4); -+ -+ if (((jzfb.cfg & MODE_MASK) == MODE_STN_COLOR_DUAL) || -+ ((jzfb.cfg & MODE_MASK) == MODE_STN_MONO_DUAL)) -+ pclk >>= 1; -+ -+ pll_div = (REG_CPM_CPCCR & CPM_CPCCR_PCS); /* clock source,0:pllout/2 1: pllout */ -+ pll_div = pll_div ? 1 : 2; -+ val = (__cpm_get_pllout() / pll_div) / pclk; -+ val--; -+ if (val > 0x1ff) { -+ printf("CPM_LPCDR too large, set it to 0x1ff\n"); -+ val = 0x1ff; -+ } -+ __cpm_set_pixdiv(val); -+ -+ val = pclk * 3 ; /* LCDClock > 2.5*Pixclock */ -+ if (val > 150000000) { -+ printf("Warning: LCDClock=%d\n, LCDClock must less or equal to 150MHz.\n", val); -+ printf("Change LCDClock to 150MHz\n"); -+ val = 150000000; -+ } -+ val = (__cpm_get_pllout() / pll_div) / val; -+ val--; -+ if (val > 0x1f) { -+ printf("CPM_CPCCR.LDIV too large, set it to 0x1f\n"); -+ val = 0x1f; -+ } -+ __cpm_set_ldiv( val ); -+ REG_CPM_CPCCR |= CPM_CPCCR_CE ; /* update divide */ -+ -+ __cpm_start_lcd(); -+ udelay(1000); -+ -+ REG_LCD_DA0 = fbi->fdadr0; /* frame descripter*/ -+ -+ if (((jzfb.cfg & MODE_MASK) == MODE_STN_COLOR_DUAL) || -+ ((jzfb.cfg & MODE_MASK) == MODE_STN_MONO_DUAL)) -+ REG_LCD_DA1 = fbi->fdadr1; /* frame descripter*/ -+ -+ return 0; -+} -+ -+void lcd_ctrl_init (void *lcdbase) -+{ -+ __lcd_display_pin_init(); -+ __lcd_display_on() ; -+ -+ jz_lcd_init_mem(lcdbase, &panel_info); -+ jz_lcd_desc_init(&panel_info); -+ jz_lcd_hw_init(&panel_info); -+ -+} -+ -+/* -+ * Before enabled lcd controller, lcd registers should be configured correctly. -+ */ -+void lcd_enable (void) -+{ -+ REG_LCD_CTRL &= ~(1<<4); /* LCDCTRL.DIS */ -+ REG_LCD_CTRL |= 1<<3; /* LCDCTRL.ENA*/ -+} -+ -+void lcd_disable (void) -+{ -+ REG_LCD_CTRL |= (1<<4); -+} -+ -+void lcd_setcolreg (ushort regno, ushort red, ushort green, ushort blue) -+{ -+} -+ -+void lcd_initcolregs (void) -+{ -+} -diff --git a/drivers/video/nanonote_gpm940b0.h b/drivers/video/nanonote_gpm940b0.h -new file mode 100644 -index 0000000..efe491e ---- /dev/null -+++ b/drivers/video/nanonote_gpm940b0.h -@@ -0,0 +1,135 @@ -+/* -+ * JzRISC lcd controller -+ * -+ * Xiangfu Liu -+ * -+ * 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 __QI_LB60_GPM940B0_H__ -+#define __QI_LB60_GPM940B0_H__ -+ -+struct lcd_desc{ -+ unsigned int next_desc; /* LCDDAx */ -+ unsigned int databuf; /* LCDSAx */ -+ unsigned int frame_id; /* LCDFIDx */ -+ unsigned int cmd; /* LCDCMDx */ -+}; -+ -+#define MODE_MASK 0x0f -+#define MODE_TFT_GEN 0x00 -+#define MODE_TFT_SHARP 0x01 -+#define MODE_TFT_CASIO 0x02 -+#define MODE_TFT_SAMSUNG 0x03 -+#define MODE_CCIR656_NONINT 0x04 -+#define MODE_CCIR656_INT 0x05 -+#define MODE_STN_COLOR_SINGLE 0x08 -+#define MODE_STN_MONO_SINGLE 0x09 -+#define MODE_STN_COLOR_DUAL 0x0a -+#define MODE_STN_MONO_DUAL 0x0b -+#define MODE_8BIT_SERIAL_TFT 0x0c -+ -+#define MODE_TFT_18BIT (1<<7) -+ -+#define STN_DAT_PIN1 (0x00 << 4) -+#define STN_DAT_PIN2 (0x01 << 4) -+#define STN_DAT_PIN4 (0x02 << 4) -+#define STN_DAT_PIN8 (0x03 << 4) -+#define STN_DAT_PINMASK STN_DAT_PIN8 -+ -+#define STFT_PSHI (1 << 15) -+#define STFT_CLSHI (1 << 14) -+#define STFT_SPLHI (1 << 13) -+#define STFT_REVHI (1 << 12) -+ -+#define SYNC_MASTER (0 << 16) -+#define SYNC_SLAVE (1 << 16) -+ -+#define DE_P (0 << 9) -+#define DE_N (1 << 9) -+ -+#define PCLK_P (0 << 10) -+#define PCLK_N (1 << 10) -+ -+#define HSYNC_P (0 << 11) -+#define HSYNC_N (1 << 11) -+ -+#define VSYNC_P (0 << 8) -+#define VSYNC_N (1 << 8) -+ -+#define DATA_NORMAL (0 << 17) -+#define DATA_INVERSE (1 << 17) -+ -+ -+/* Jz LCDFB supported I/O controls. */ -+#define FBIOSETBACKLIGHT 0x4688 -+#define FBIODISPON 0x4689 -+#define FBIODISPOFF 0x468a -+#define FBIORESET 0x468b -+#define FBIOPRINT_REG 0x468c -+ -+/* -+ * LCD panel specific definition -+ */ -+#define MODE (0xc9) /* 8bit serial RGB */ -+ -+#define __spi_write_reg1(reg, val) \ -+do { \ -+ unsigned char no; \ -+ unsigned short value; \ -+ unsigned char a=reg; \ -+ unsigned char b=val; \ -+ __gpio_set_pin(SPEN); \ -+ __gpio_set_pin(SPCK); \ -+ __gpio_clear_pin(SPDA); \ -+ __gpio_clear_pin(SPEN); \ -+ value=((a<<8)|(b&0xFF)); \ -+ for(no=0;no<16;no++) \ -+ { \ -+ __gpio_clear_pin(SPCK); \ -+ if((value&0x8000)==0x8000) \ -+ __gpio_set_pin(SPDA); \ -+ else \ -+ __gpio_clear_pin(SPDA); \ -+ __gpio_set_pin(SPCK); \ -+ value=(value<<1); \ -+ } \ -+ __gpio_set_pin(SPEN); \ -+} while (0) -+ -+#define __lcd_display_pin_init() \ -+do { \ -+ __cpm_start_tcu(); \ -+ __gpio_as_output(SPEN); /* use SPDA */ \ -+ __gpio_as_output(SPCK); /* use SPCK */ \ -+ __gpio_as_output(SPDA); /* use SPDA */ \ -+} while (0) -+ -+#define __lcd_display_on() \ -+do { \ -+ __spi_write_reg1(0x05, 0x1e); \ -+ __spi_write_reg1(0x05, 0x5e); \ -+ __spi_write_reg1(0x07, 0x8d); \ -+ __spi_write_reg1(0x13, 0x01); \ -+ __spi_write_reg1(0x05, 0x5f); \ -+} while (0) -+ -+#define __lcd_display_off() \ -+do { \ -+ __spi_write_reg1(0x05, 0x5e); \ -+} while (0) -+ -+#endif /* __QI_LB60_GPM940B0_H__ */ -diff --git a/include/configs/qi_lb60.h b/include/configs/qi_lb60.h -index 52b370c..d3e78ad 100644 ---- a/include/configs/qi_lb60.h -+++ b/include/configs/qi_lb60.h -@@ -32,6 +32,13 @@ - * Miscellaneous configurable options - */ - #define CONFIG_NANONOTE -+ -+#define CONFIG_LCD -+#define CONFIG_SYS_WHITE_ON_BLACK -+#define LCD_BPP LCD_COLOR32 -+#define CONFIG_VIDEO_GPM940B0 -+ -+ - #define CONFIG_JZ4740_MMC - #define CONFIG_MMC 1 - #define CONFIG_FAT 1 -diff --git a/include/lcd.h b/include/lcd.h -index 42070d7..6de5482 100644 ---- a/include/lcd.h -+++ b/include/lcd.h -@@ -263,8 +263,44 @@ typedef struct vidinfo { - - void init_panel_info(vidinfo_t *vid); - --#else -+#elif defined(CONFIG_JZSOC) -+/* -+ * LCD controller stucture for JZSOC: JZ4740 -+ */ -+struct jz_fb_dma_descriptor { -+ u_long fdadr; /* Frame descriptor address register */ -+ u_long fsadr; /* Frame source address register */ -+ u_long fidr; /* Frame ID register */ -+ u_long ldcmd; /* Command register */ -+}; -+ -+/* -+ * Jz LCD info -+ */ -+struct jz_fb_info { -+ -+ u_long fdadr0; /* physical address of frame/palette descriptor */ -+ u_long fdadr1; /* physical address of frame descriptor */ -+ -+ /* DMA descriptors */ -+ struct jz_fb_dma_descriptor * dmadesc_fblow; -+ struct jz_fb_dma_descriptor * dmadesc_fbhigh; -+ struct jz_fb_dma_descriptor * dmadesc_palette; -+ u_long screen; /* address of frame buffer */ -+ u_long palette; /* address of palette memory */ -+ u_int palette_size; -+}; -+typedef struct vidinfo { -+ ushort vl_col; /* Number of columns (i.e. 640) */ -+ ushort vl_row; /* Number of rows (i.e. 480) */ -+ u_char vl_bpix; /* Bits per pixel, 0 = 1, 1 = 2, 2 = 4, 3 = 8 */ -+ -+ struct jz_fb_info jz_fb; -+} vidinfo_t; -+ -+extern vidinfo_t panel_info; - -+#else - typedef struct vidinfo { - ushort vl_col; /* Number of columns (i.e. 160) */ - ushort vl_row; /* Number of rows (i.e. 100) */ -@@ -318,6 +354,7 @@ void lcd_show_board_info(void); - #define LCD_COLOR4 2 - #define LCD_COLOR8 3 - #define LCD_COLOR16 4 -+#define LCD_COLOR32 5 - - /*----------------------------------------------------------------------*/ - #if defined(CONFIG_LCD_INFO_BELOW_LOGO) -@@ -369,7 +406,7 @@ void lcd_show_board_info(void); - # define CONSOLE_COLOR_GREY 14 - # define CONSOLE_COLOR_WHITE 15 /* Must remain last / highest */ - --#else -+#elif LCD_BPP == LCD_COLOR16 - - /* - * 16bpp color definitions -@@ -377,6 +414,15 @@ void lcd_show_board_info(void); - # define CONSOLE_COLOR_BLACK 0x0000 - # define CONSOLE_COLOR_WHITE 0xffff /* Must remain last / highest */ - -+#elif LCD_BPP == LCD_COLOR32 -+/* -+ * 18,24,32 bpp color definitions -+ */ -+# define CONSOLE_COLOR_BLACK 0x00000000 -+# define CONSOLE_COLOR_WHITE 0xffffffff /* Must remain last / highest */ -+ -+#else -+ - #endif /* color definitions */ - - /************************************************************************/ -@@ -406,7 +452,7 @@ void lcd_show_board_info(void); - #if LCD_BPP == LCD_MONOCHROME - # define COLOR_MASK(c) ((c) | (c) << 1 | (c) << 2 | (c) << 3 | \ - (c) << 4 | (c) << 5 | (c) << 6 | (c) << 7) --#elif (LCD_BPP == LCD_COLOR8) || (LCD_BPP == LCD_COLOR16) -+#elif (LCD_BPP == LCD_COLOR8) || (LCD_BPP == LCD_COLOR16) || (LCD_BPP == LCD_COLOR32) - # define COLOR_MASK(c) (c) - #else - # error Unsupported LCD BPP. --- -1.7.9.5 - diff --git a/package/boot/uboot-xburst/patches/0006-enable-silent-console.patch b/package/boot/uboot-xburst/patches/0006-enable-silent-console.patch deleted file mode 100644 index ebd6a6a7bf..0000000000 --- a/package/boot/uboot-xburst/patches/0006-enable-silent-console.patch +++ /dev/null @@ -1,60 +0,0 @@ -From 5eb4d4c598f2806bd1b3d1140e917bfead7851ad Mon Sep 17 00:00:00 2001 -From: Xiangfu -Date: Wed, 10 Oct 2012 23:51:26 +0800 -Subject: [PATCH 6/6] enable silent console - ---- - common/console.c | 16 ++++++++++++++++ - include/configs/qi_lb60.h | 2 ++ - 2 files changed, 18 insertions(+) - -diff --git a/common/console.c b/common/console.c -index 1177f7d..e8a2078 100644 ---- a/common/console.c -+++ b/common/console.c -@@ -685,6 +685,14 @@ done: - - gd->flags |= GD_FLG_DEVINIT; /* device initialization completed */ - -+#ifdef CONFIG_SILENT_CONSOLE -+ /* Check one more time the contents of the silent environment -+ * variable, because if the environment is loaded from NAND it was -+ * not available when console_init_f() was called */ -+ if (getenv("silent") != NULL) -+ gd->flags |= GD_FLG_SILENT; -+#endif -+ - stdio_print_current_devices(); - - #ifdef CONFIG_SYS_CONSOLE_ENV_OVERWRITE -@@ -760,6 +768,14 @@ int console_init_r(void) - - gd->flags |= GD_FLG_DEVINIT; /* device initialization completed */ - -+#ifdef CONFIG_SILENT_CONSOLE -+ /* Check one more time the contents of the silent environment -+ * variable, because if the environment is loaded from NAND it was -+ * not available when console_init_f() was called */ -+ if (getenv("silent") != NULL) -+ gd->flags |= GD_FLG_SILENT; -+#endif -+ - stdio_print_current_devices(); - - /* Setting environment variables */ -diff --git a/include/configs/qi_lb60.h b/include/configs/qi_lb60.h -index d3e78ad..a3534ff 100644 ---- a/include/configs/qi_lb60.h -+++ b/include/configs/qi_lb60.h -@@ -102,6 +102,8 @@ - #define CONFIG_SYS_NO_FLASH - #define CONFIG_SYS_FLASH_BASE 0 /* init flash_base as 0 */ - -+#define CONFIG_SILENT_CONSOLE 1 /* Enable silent console */ -+ - /* - * Command line configuration - */ --- -1.7.9.5 - diff --git a/package/devel/perf/Makefile b/package/devel/perf/Makefile index 1f20f44050..45c6cfc32c 100644 --- a/package/devel/perf/Makefile +++ b/package/devel/perf/Makefile @@ -26,7 +26,7 @@ include $(INCLUDE_DIR)/package.mk define Package/perf SECTION:=devel CATEGORY:=Development - DEPENDS:= +libelf +libdw +(mips||mipsel||powerpc||i386||x86_64||arm||aarch64):libunwind +libpthread +librt +objdump @!LINUX_3_18 @!IN_SDK @!TARGET_arc770 @KERNEL_PERF_EVENTS + DEPENDS:= +libelf +libdw +(mips||mipsel||powerpc||i386||x86_64||arm||aarch64):libunwind +libpthread +librt +objdump @!IN_SDK @!TARGET_arc770 @KERNEL_PERF_EVENTS TITLE:=Linux performance monitoring tool VERSION:=$(LINUX_VERSION)-$(PKG_RELEASE) URL:=http://www.kernel.org diff --git a/package/devel/strace/Makefile b/package/devel/strace/Makefile index b342a8c0d0..2d4332bf79 100644 --- a/package/devel/strace/Makefile +++ b/package/devel/strace/Makefile @@ -9,12 +9,12 @@ include $(TOPDIR)/rules.mk include $(INCLUDE_DIR)/kernel.mk PKG_NAME:=strace -PKG_VERSION:=4.26 +PKG_VERSION:=5.0 PKG_RELEASE:=1 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz PKG_SOURCE_URL:=https://strace.io/files/$(PKG_VERSION) -PKG_HASH:=7c4d2ffeef4f7d1cdc71062ca78d1130eb52f947c2fca82f59f6a1183bfa1e1c +PKG_HASH:=3b7ad77eb2b81dc6078046a9cc56eed5242b67b63748e7fc28f7c2daf4e647da PKG_LICENSE:=BSD-3c PKG_LICENSE_FILES:=COPYRIGHT diff --git a/package/devel/strace/patches/001-mips-o32-fix-build.patch b/package/devel/strace/patches/001-mips-o32-fix-build.patch deleted file mode 100644 index 71dbf70da8..0000000000 --- a/package/devel/strace/patches/001-mips-o32-fix-build.patch +++ /dev/null @@ -1,91 +0,0 @@ -From 2c8b6de913973274e877639658e9e7273a012adb Mon Sep 17 00:00:00 2001 -From: "Dmitry V. Levin" -Date: Tue, 8 Jan 2019 19:23:44 +0000 -Subject: [PATCH] mips o32: fix build - -Commit 917c2ccf3a67 "Refactor stack pointers" moved mips_REG_* macros -from linux/mips/arch_regs.h to linux/mips/arch_regs.c because these -macros are no longer used outside syscall.c or files included by -syscall.c, but this caused a build regression on mips o32 because -decode_syscall_subcall() uses mips_REG_SP prior to its definition. - -* syscall.c (decode_syscall_subcall): Move ... -* linux/mips/get_syscall_args.c: ... here. -* NEWS: Mention this fix. - -Reported-by: Baruch Siach -Fixes: v4.26~61 "Refactor stack pointers" ---- - NEWS | 1 + - linux/mips/get_syscall_args.c | 26 ++++++++++++++++++++++++++ - syscall.c | 27 ++------------------------- - 3 files changed, 29 insertions(+), 25 deletions(-) - ---- a/linux/mips/get_syscall_args.c -+++ b/linux/mips/get_syscall_args.c -@@ -37,3 +37,29 @@ arch_get_syscall_args(struct tcb *tcp) - #endif - return 1; - } -+ -+#ifdef SYS_syscall_subcall -+static void -+decode_syscall_subcall(struct tcb *tcp) -+{ -+ if (!scno_is_valid(tcp->u_arg[0])) -+ return; -+ tcp->scno = tcp->u_arg[0]; -+ tcp->qual_flg = qual_flags(tcp->scno); -+ tcp->s_ent = &sysent[tcp->scno]; -+ memmove(&tcp->u_arg[0], &tcp->u_arg[1], -+ sizeof(tcp->u_arg) - sizeof(tcp->u_arg[0])); -+ /* -+ * Fetching the last arg of 7-arg syscalls (fadvise64_64 -+ * and sync_file_range) requires additional code, -+ * see linux/mips/get_syscall_args.c -+ */ -+ if (tcp->s_ent->nargs == MAX_ARGS) { -+ if (umoven(tcp, -+ mips_REG_SP + MAX_ARGS * sizeof(tcp->u_arg[0]), -+ sizeof(tcp->u_arg[0]), -+ &tcp->u_arg[MAX_ARGS - 1]) < 0) -+ tcp->u_arg[MAX_ARGS - 1] = 0; -+ } -+} -+#endif /* SYS_syscall_subcall */ ---- a/syscall.c -+++ b/syscall.c -@@ -349,31 +349,8 @@ decode_ipc_subcall(struct tcb *tcp) - #endif /* SYS_ipc_subcall */ - - #ifdef SYS_syscall_subcall --static void --decode_syscall_subcall(struct tcb *tcp) --{ -- if (!scno_is_valid(tcp->u_arg[0])) -- return; -- tcp->scno = tcp->u_arg[0]; -- tcp->qual_flg = qual_flags(tcp->scno); -- tcp->s_ent = &sysent[tcp->scno]; -- memmove(&tcp->u_arg[0], &tcp->u_arg[1], -- sizeof(tcp->u_arg) - sizeof(tcp->u_arg[0])); --# ifdef LINUX_MIPSO32 -- /* -- * Fetching the last arg of 7-arg syscalls (fadvise64_64 -- * and sync_file_range) requires additional code, -- * see linux/mips/get_syscall_args.c -- */ -- if (tcp->s_ent->nargs == MAX_ARGS) { -- if (umoven(tcp, -- mips_REG_SP + MAX_ARGS * sizeof(tcp->u_arg[0]), -- sizeof(tcp->u_arg[0]), -- &tcp->u_arg[MAX_ARGS - 1]) < 0) -- tcp->u_arg[MAX_ARGS - 1] = 0; -- } --# endif /* LINUX_MIPSO32 */ --} -+/* The implementation is architecture specific. */ -+static void decode_syscall_subcall(struct tcb *); - #endif /* SYS_syscall_subcall */ - - static void diff --git a/package/devel/strace/patches/100-workaround--pt-reg-collisions-ppc.patch b/package/devel/strace/patches/100-workaround--pt-reg-collisions-ppc.patch index 9560804a7a..93e2980749 100644 --- a/package/devel/strace/patches/100-workaround--pt-reg-collisions-ppc.patch +++ b/package/devel/strace/patches/100-workaround--pt-reg-collisions-ppc.patch @@ -1,17 +1,17 @@ --- a/ptrace.h +++ b/ptrace.h @@ -30,7 +30,14 @@ - # define ptrace_peeksiginfo_args XXX_ptrace_peeksiginfo_args - #endif + # define ptrace_peeksiginfo_args XXX_ptrace_peeksiginfo_args + # endif +#if POWERPC +#include +#define __ASSEMBLY__ +#endif - #include + # include +#if POWERPC +#undef __ASSEMBLY__ +#endif - #ifdef HAVE_STRUCT_IA64_FPREG - # undef ia64_fpreg + # ifdef HAVE_STRUCT_IA64_FPREG + # undef ia64_fpreg diff --git a/package/devel/valgrind/Makefile b/package/devel/valgrind/Makefile new file mode 100644 index 0000000000..956e5ad722 --- /dev/null +++ b/package/devel/valgrind/Makefile @@ -0,0 +1,185 @@ +# +# Copyright (C) 2006-2013 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +include $(TOPDIR)/rules.mk + +PKG_NAME:=valgrind +PKG_VERSION:=3.15.0 +PKG_RELEASE:=1 + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2 +PKG_SOURCE_URL:=http://sourceware.org/pub/valgrind/ +PKG_HASH:=417c7a9da8f60dd05698b3a7bc6002e4ef996f14c13f0ff96679a16873e78ab1 + +PKG_MAINTAINER:=Felix Fietkau +PKG_LICENSE:=GPL-2.0+ +PKG_CPE_ID:=cpe:/a:valgrind:valgrind + +PKG_FIXUP = autoreconf +PKG_INSTALL := 1 +PKG_BUILD_PARALLEL := 1 +PKG_USE_MIPS16:=0 +PKG_SSP:=0 + +include $(INCLUDE_DIR)/package.mk +include $(INCLUDE_DIR)/kernel.mk + +define Package/valgrind + SECTION:=devel + CATEGORY:=Development + DEPENDS:=@mips||mipsel||i386||x86_64||powerpc||arm_v7||aarch64 +libpthread +librt + TITLE:=debugging and profiling tools for Linux + URL:=http://www.valgrind.org +endef + +define Package/valgrind/default + $(Package/valgrind) + DEPENDS := valgrind +endef + +define Package/valgrind-cachegrind + $(Package/valgrind/default) + TITLE += (cache profiling) +endef + +define Package/valgrind-callgrind + $(Package/valgrind/default) + TITLE += (callgraph profiling) +endef + +define Package/valgrind-drd + $(Package/valgrind/default) + TITLE += (thread error detection) +endef + +define Package/valgrind-massif + $(Package/valgrind/default) + TITLE += (heap profiling) +endef + +define Package/valgrind-helgrind + $(Package/valgrind/default) + TITLE += (thread debugging) +endef + +define Package/valgrind-vgdb + $(Package/valgrind/default) + TITLE += (GDB interface) +endef + +define Package/valgrind/description + Valgrind is an award-winning suite of tools for debugging and + profiling Linux programs. With the tools that come with Valgrind, + you can automatically detect many memory management and threading + bugs, avoiding hours of frustrating bug-hunting, making your + programs more stable. You can also perform detailed profiling, + to speed up and reduce memory use of your programs. +endef + +CPU := $(patsubst x86_64,amd64,$(patsubst x86,i386,$(patsubst um,$(ARCH),$(LINUX_KARCH)))) + +CONFIGURE_VARS += \ + UNAME_R=$(LINUX_VERSION) + +ifeq ($(CONFIG_ARCH_64BIT),y) + CONFIGURE_ARGS += \ + --enable-only64bit + BITS := 64bit +else + CONFIGURE_ARGS += \ + --enable-only32bit + BITS := 32bit +endif + +CONFIGURE_ARGS += \ + --enable-tls \ + --without-x \ + --without-mpicc \ + --without-uiout \ + --disable-valgrindmi \ + --disable-tui \ + --disable-valgrindtk \ + --without-included-gettext \ + --with-pagesize=4 \ + +define Package/valgrind/install + $(INSTALL_DIR) $(1)/usr/bin + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/valgrind* $(1)/usr/bin/ + $(INSTALL_DIR) $(1)/usr/lib/valgrind + $(CP) \ + ./files/default.supp \ + $(PKG_INSTALL_DIR)/usr/lib/valgrind/none-* \ + $(PKG_INSTALL_DIR)/usr/lib/valgrind/vgpreload_core*.so \ + $(PKG_INSTALL_DIR)/usr/lib/valgrind/$(BITS)-core*.xml \ + $(PKG_INSTALL_DIR)/usr/lib/valgrind/$(BITS)-linux*.xml \ + $(PKG_INSTALL_DIR)/usr/lib/valgrind/memcheck-* \ + $(PKG_INSTALL_DIR)/usr/lib/valgrind/vgpreload_memcheck*.so \ + $(1)/usr/lib/valgrind/ + +ifneq ($(ARCH),aarch64) + $(CP) \ + $(PKG_INSTALL_DIR)/usr/lib/valgrind/$(CPU)-*.xml \ + $(1)/usr/lib/valgrind/ +endif +endef + +define Package/valgrind-cachegrind/install + $(INSTALL_DIR) $(1)/usr/bin + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/cg_* $(1)/usr/bin/ + $(INSTALL_DIR) $(1)/usr/lib/valgrind + $(CP) \ + $(PKG_INSTALL_DIR)/usr/lib/valgrind/cachegrind-* \ + $(1)/usr/lib/valgrind/ +endef + +define Package/valgrind-callgrind/install + $(INSTALL_DIR) $(1)/usr/bin + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/callgrind* $(1)/usr/bin/ + $(INSTALL_DIR) $(1)/usr/lib/valgrind + $(CP) \ + $(PKG_INSTALL_DIR)/usr/lib/valgrind/callgrind-* \ + $(1)/usr/lib/valgrind/ +endef + +define Package/valgrind-drd/install + $(INSTALL_DIR) $(1)/usr/lib/valgrind + $(CP) \ + $(PKG_INSTALL_DIR)/usr/lib/valgrind/drd-* \ + $(PKG_INSTALL_DIR)/usr/lib/valgrind/vgpreload_drd*.so \ + $(1)/usr/lib/valgrind/ +endef + +define Package/valgrind-massif/install + $(INSTALL_DIR) $(1)/usr/bin + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/ms_print $(1)/usr/bin/ + $(INSTALL_DIR) $(1)/usr/lib/valgrind + $(CP) \ + $(PKG_INSTALL_DIR)/usr/lib/valgrind/massif-* \ + $(PKG_INSTALL_DIR)/usr/lib/valgrind/vgpreload_massif*.so \ + $(1)/usr/lib/valgrind/ +endef + +define Package/valgrind-helgrind/install + $(INSTALL_DIR) $(1)/usr/lib/valgrind + $(CP) \ + $(PKG_INSTALL_DIR)/usr/lib/valgrind/helgrind-* \ + $(PKG_INSTALL_DIR)/usr/lib/valgrind/vgpreload_helgrind*.so \ + $(1)/usr/lib/valgrind/ +endef + +define Package/valgrind-vgdb/install + $(INSTALL_DIR) $(1)/usr/bin + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/vgdb $(1)/usr/bin/ +endef + +$(eval $(call BuildPackage,valgrind)) +$(eval $(call BuildPackage,valgrind-cachegrind)) +$(eval $(call BuildPackage,valgrind-callgrind)) +$(eval $(call BuildPackage,valgrind-drd)) +$(eval $(call BuildPackage,valgrind-massif)) +$(eval $(call BuildPackage,valgrind-helgrind)) +$(eval $(call BuildPackage,valgrind-vgdb)) diff --git a/package/devel/valgrind/files/default.supp b/package/devel/valgrind/files/default.supp new file mode 100644 index 0000000000..beff55984c --- /dev/null +++ b/package/devel/valgrind/files/default.supp @@ -0,0 +1,42 @@ +{ + ld(Addr1) + Memcheck:Addr1 + fun:* + obj:/lib/ld-* +} +{ + ld(Addr2) + Memcheck:Addr2 + fun:* + obj:/lib/ld-* +} +{ + ld(Addr4) + Memcheck:Addr4 + fun:* + obj:/lib/ld-* +} +{ + ld(Cond) + Memcheck:Cond + fun:* + obj:/lib/ld-* +} +{ + strlen(Cond) + Memcheck:Cond + fun:strlen + fun:* +} +{ + strnlen(Cond) + Memcheck:Cond + fun:strnlen + fun:* +} +{ + index(Cond) + Memcheck:Cond + fun:index + fun:* +} diff --git a/package/devel/valgrind/patches/100-fix_configure_check.patch b/package/devel/valgrind/patches/100-fix_configure_check.patch new file mode 100644 index 0000000000..270181ae37 --- /dev/null +++ b/package/devel/valgrind/patches/100-fix_configure_check.patch @@ -0,0 +1,11 @@ +--- a/configure.ac ++++ b/configure.ac +@@ -341,7 +341,7 @@ case "${host_os}" in + # Ok, this is linux. Check the kernel version + AC_MSG_CHECKING([for the kernel version]) + +- kernel=`uname -r` ++ kernel=${UNAME_R:-`uname -r`} + + case "${kernel}" in + 0.*|1.*|2.0.*|2.1.*|2.2.*|2.3.*|2.4.*|2.5.*) diff --git a/package/devel/valgrind/patches/130-fix_arm_arch_detection.patch b/package/devel/valgrind/patches/130-fix_arm_arch_detection.patch new file mode 100644 index 0000000000..26291f777b --- /dev/null +++ b/package/devel/valgrind/patches/130-fix_arm_arch_detection.patch @@ -0,0 +1,17 @@ +Description: Fix FTBFS on armhf by correctly detecting the architecture +Origin: vendor +Bug-Debian: http://bugs.debian.org/730844 +Author: Alessandro Ghedini +Last-Update: 2013-11-30 + +--- a/configure.ac ++++ b/configure.ac +@@ -252,7 +252,7 @@ case "${host_cpu}" in + ARCH_MAX="s390x" + ;; + +- armv7*) ++ arm*) + AC_MSG_RESULT([ok (${host_cpu})]) + ARCH_MAX="arm" + ;; diff --git a/package/kernel/button-hotplug/src/button-hotplug.c b/package/kernel/button-hotplug/src/button-hotplug.c index 5294a9700d..1b77cd7922 100644 --- a/package/kernel/button-hotplug/src/button-hotplug.c +++ b/package/kernel/button-hotplug/src/button-hotplug.c @@ -85,6 +85,7 @@ static struct bh_map button_map[] = { BH_MAP(BTN_9, "BTN_9"), BH_MAP(KEY_RESTART, "reset"), BH_MAP(KEY_POWER, "power"), + BH_MAP(KEY_POWER2, "reboot"), BH_MAP(KEY_RFKILL, "rfkill"), BH_MAP(KEY_WPS_BUTTON, "wps"), BH_MAP(KEY_WIMAX, "wwan"), diff --git a/package/kernel/cryptodev-linux/Makefile b/package/kernel/cryptodev-linux/Makefile new file mode 100644 index 0000000000..2a8890286d --- /dev/null +++ b/package/kernel/cryptodev-linux/Makefile @@ -0,0 +1,59 @@ +# +# Copyright (C) 2014 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# +# $Id$ + +include $(TOPDIR)/rules.mk +include $(INCLUDE_DIR)/kernel.mk + +PKG_NAME:=cryptodev-linux +PKG_VERSION:=1.10 +PKG_RELEASE:=1 + +PKG_SOURCE_URL:=https://codeload.github.com/$(PKG_NAME)/$(PKG_NAME)/tar.gz/$(PKG_NAME)-$(PKG_VERSION)? +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_HASH:=833ab7c5c88d2b700a7c702a151254c089a3058886a63cc7d12630e364b8ea83 +PKG_LICENSE:=GPL-2.0 +PKG_LICENSE_FILES:=COPYING + +PKG_MAINTAINER:=Ansuel Smith + +PKG_BUILD_DIR:=$(KERNEL_BUILD_DIR)/$(PKG_NAME)-$(PKG_NAME)-$(PKG_VERSION) + +include $(INCLUDE_DIR)/package.mk + +define KernelPackage/cryptodev + SUBMENU:=Cryptographic API modules + DEFAULT:=m if ALL + TITLE:=Driver for cryptographic acceleration + URL:=http://cryptodev-linux.org/ + VERSION:=$(LINUX_VERSION)+$(PKG_VERSION)-$(BOARD)-$(PKG_RELEASE) + DEPENDS:=+kmod-crypto-authenc +kmod-crypto-hash + FILES:=$(PKG_BUILD_DIR)/cryptodev.$(LINUX_KMOD_SUFFIX) + AUTOLOAD:=$(call AutoLoad,50,cryptodev) + MODPARAMS.cryptodev:=cryptodev_verbosity=-1 +endef + +define KernelPackage/cryptodev/description + This is a driver for that allows to use the Linux kernel supported + hardware ciphers by user-space applications. +endef + +define Build/Configure +endef + +define Build/Compile + $(MAKE) -C $(PKG_BUILD_DIR) \ + $(KERNEL_MAKE_FLAGS) \ + KERNEL_DIR="$(LINUX_DIR)" +endef + +define Build/InstallDev + $(INSTALL_DIR) $(STAGING_DIR)/usr/include/crypto + $(CP) $(PKG_BUILD_DIR)/crypto/cryptodev.h $(STAGING_DIR)/usr/include/crypto/ +endef + +$(eval $(call KernelPackage,cryptodev)) diff --git a/package/kernel/gpio-button-hotplug/src/gpio-button-hotplug.c b/package/kernel/gpio-button-hotplug/src/gpio-button-hotplug.c index 1aef23e876..7366695231 100644 --- a/package/kernel/gpio-button-hotplug/src/gpio-button-hotplug.c +++ b/package/kernel/gpio-button-hotplug/src/gpio-button-hotplug.c @@ -26,28 +26,15 @@ #include #include #include +#include #include - -#define DRV_NAME "gpio-keys" +#include #define BH_SKB_SIZE 2048 +#define DRV_NAME "gpio-keys" #define PFX DRV_NAME ": " -#undef BH_DEBUG - -#ifdef BH_DEBUG -#define BH_DBG(fmt, args...) printk(KERN_DEBUG "%s: " fmt, DRV_NAME, ##args ) -#else -#define BH_DBG(fmt, args...) do {} while (0) -#endif - -#define BH_ERR(fmt, args...) printk(KERN_ERR "%s: " fmt, DRV_NAME, ##args ) - -struct bh_priv { - unsigned long seen; -}; - struct bh_event { const char *name; unsigned int type; @@ -65,12 +52,16 @@ struct bh_map { struct gpio_keys_button_data { struct delayed_work work; - struct bh_priv bh; + unsigned long seen; + int map_entry; int last_state; int count; int threshold; int can_sleep; - struct gpio_keys_button *b; + int irq; + unsigned int software_debounce; + struct gpio_desc *gpiod; + const struct gpio_keys_button *b; }; extern u64 uevent_next_seqnum(void); @@ -100,6 +91,7 @@ static struct bh_map button_map[] = { BH_MAP(KEY_LIGHTS_TOGGLE, "lights_toggle"), BH_MAP(KEY_PHONE, "phone"), BH_MAP(KEY_POWER, "power"), + BH_MAP(KEY_POWER2, "reboot"), BH_MAP(KEY_RESTART, "reset"), BH_MAP(KEY_RFKILL, "rfkill"), BH_MAP(KEY_VIDEO, "video"), @@ -133,7 +125,7 @@ int bh_event_add_var(struct bh_event *event, int argv, const char *format, ...) s = skb_put(event->skb, len + 1); strcpy(s, buf); - BH_DBG("added variable '%s'\n", s); + pr_debug(PFX "added variable '%s'\n", s); return 0; } @@ -200,7 +192,7 @@ static void button_hotplug_work(struct work_struct *work) out_free_skb: if (ret) { - BH_ERR("work error %d\n", ret); + pr_err(PFX "work error %d\n", ret); kfree_skb(event->skb); } out_free_event: @@ -212,8 +204,8 @@ static int button_hotplug_create_event(const char *name, unsigned int type, { struct bh_event *event; - BH_DBG("create event, name=%s, seen=%lu, pressed=%d\n", - name, seen, pressed); + pr_debug(PFX "create event, name=%s, seen=%lu, pressed=%d\n", + name, seen, pressed); event = kzalloc(sizeof(*event), GFP_KERNEL); if (!event) @@ -243,36 +235,6 @@ static int button_get_index(unsigned int code) return -1; } -static void button_hotplug_event(struct gpio_keys_button_data *data, - unsigned int type, int value) -{ - struct bh_priv *priv = &data->bh; - unsigned long seen = jiffies; - int btn; - - BH_DBG("event type=%u, code=%u, value=%d\n", type, data->b->code, value); - - if ((type != EV_KEY) && (type != EV_SW)) - return; - - btn = button_get_index(data->b->code); - if (btn < 0) - return; - - button_hotplug_create_event(button_map[btn].name, type, - (seen - priv->seen) / HZ, value); - priv->seen = seen; -} - -struct gpio_keys_button_dev { - int polled; - struct delayed_work work; - - struct device *dev; - struct gpio_keys_platform_data *pdata; - struct gpio_keys_button_data data[0]; -}; - static int gpio_button_get_value(struct gpio_keys_button_data *bdata) { int val; @@ -285,27 +247,61 @@ static int gpio_button_get_value(struct gpio_keys_button_data *bdata) return val ^ bdata->b->active_low; } -static void gpio_keys_polled_check_state(struct gpio_keys_button_data *bdata) +static void gpio_keys_handle_button(struct gpio_keys_button_data *bdata) { + unsigned int type = bdata->b->type ?: EV_KEY; int state = gpio_button_get_value(bdata); + unsigned long seen = jiffies; - if (state != bdata->last_state) { - unsigned int type = bdata->b->type ?: EV_KEY; + pr_debug(PFX "event type=%u, code=%u, pressed=%d\n", + type, bdata->b->code, state); + + /* is this the initialization state? */ + if (bdata->last_state == -1) { + /* + * Don't advertise unpressed buttons on initialization. + * Just save their state and continue otherwise this + * can cause libreCMC to enter failsafe. + */ + if (type == EV_KEY && state == 0) + goto set_state; + /* + * But we are very interested in pressed buttons and + * initial switch state. These will be reported to + * userland. + */ + } else if (bdata->last_state == state) { + /* reset asserted counter (only relevant for polled keys) */ + bdata->count = 0; + return; + } - if (bdata->count < bdata->threshold) { - bdata->count++; - return; - } + if (bdata->count < bdata->threshold) { + bdata->count++; + return; + } - if ((bdata->last_state != -1) || (type == EV_SW)) - button_hotplug_event(bdata, type, state); + if (bdata->seen == 0) + bdata->seen = seen; - bdata->last_state = state; - } + button_hotplug_create_event(button_map[bdata->map_entry].name, type, + (seen - bdata->seen) / HZ, state); + bdata->seen = seen; +set_state: + bdata->last_state = state; bdata->count = 0; } +struct gpio_keys_button_dev { + int polled; + struct delayed_work work; + + struct device *dev; + struct gpio_keys_platform_data *pdata; + struct gpio_keys_button_data data[0]; +}; + static void gpio_keys_polled_queue_work(struct gpio_keys_button_dev *bdev) { struct gpio_keys_platform_data *pdata = bdev->pdata; @@ -324,7 +320,9 @@ static void gpio_keys_polled_poll(struct work_struct *work) for (i = 0; i < bdev->pdata->nbuttons; i++) { struct gpio_keys_button_data *bdata = &bdev->data[i]; - gpio_keys_polled_check_state(bdata); + + if (bdata->gpiod) + gpio_keys_handle_button(bdata); } gpio_keys_polled_queue_work(bdev); } @@ -339,11 +337,21 @@ static void gpio_keys_polled_close(struct gpio_keys_button_dev *bdev) pdata->disable(bdev->dev); } +static void gpio_keys_irq_work_func(struct work_struct *work) +{ + struct gpio_keys_button_data *bdata = container_of(work, + struct gpio_keys_button_data, work.work); + + gpio_keys_handle_button(bdata); +} + static irqreturn_t button_handle_irq(int irq, void *_bdata) { - struct gpio_keys_button_data *bdata = (struct gpio_keys_button_data *) _bdata; + struct gpio_keys_button_data *bdata = + (struct gpio_keys_button_data *) _bdata; - button_hotplug_event(bdata, bdata->b->type ?: EV_KEY, gpio_button_get_value(bdata)); + mod_delayed_work(system_wq, &bdata->work, + msecs_to_jiffies(bdata->software_debounce)); return IRQ_HANDLED; } @@ -389,7 +397,9 @@ gpio_keys_get_devtree_pdata(struct device *dev) continue; } - button = &pdata->buttons[i++]; + button = (struct gpio_keys_button *)(&pdata->buttons[i++]); + + button->irq = irq_of_parse_and_map(pp, 0); button->gpio = of_get_gpio_flags(pp, 0, &flags); if (button->gpio < 0) { @@ -402,7 +412,7 @@ gpio_keys_get_devtree_pdata(struct device *dev) return ERR_PTR(error); } } else { - button->active_low = flags & OF_GPIO_ACTIVE_LOW; + button->active_low = !!(flags & OF_GPIO_ACTIVE_LOW); } if (of_property_read_u32(pp, "linux,code", &button->code)) { @@ -509,6 +519,19 @@ static int gpio_keys_button_probe(struct platform_device *pdev, return -EINVAL; } + bdata->map_entry = button_get_index(button->code); + if (bdata->map_entry < 0) { + dev_warn(dev, DRV_NAME "does not support key code:%u\n", + button->code); + continue; + } + + if (!(button->type == 0 || button->type == EV_KEY || + button->type == EV_SW)) { + dev_warn(dev, DRV_NAME "only supports buttons or switches\n"); + continue; + } + error = devm_gpio_request(dev, gpio, button->desc ? button->desc : DRV_NAME); if (error) { @@ -516,6 +539,9 @@ static int gpio_keys_button_probe(struct platform_device *pdev, gpio, error); return error; } + bdata->gpiod = gpio_to_desc(gpio); + if (!bdata->gpiod) + return -EINVAL; error = gpio_direction_input(gpio); if (error) { @@ -526,13 +552,27 @@ static int gpio_keys_button_probe(struct platform_device *pdev, } bdata->can_sleep = gpio_cansleep(gpio); - bdata->last_state = -1; + bdata->last_state = -1; /* Unknown state on boot */ - if (bdev->polled) + if (bdev->polled) { bdata->threshold = DIV_ROUND_UP(button->debounce_interval, - pdata->poll_interval); - else - bdata->threshold = 1; + pdata->poll_interval); + } else { + /* bdata->threshold = 0; already initialized */ + + if (button->debounce_interval) { + error = gpiod_set_debounce(bdata->gpiod, + button->debounce_interval * 1000); + /* + * use timer if gpiolib doesn't provide + * debounce. + */ + if (error < 0) { + bdata->software_debounce = + button->debounce_interval; + } + } + } bdata->b = &pdata->buttons[i]; } @@ -560,26 +600,45 @@ static int gpio_keys_probe(struct platform_device *pdev) pdata = bdev->pdata; for (i = 0; i < pdata->nbuttons; i++) { - struct gpio_keys_button *button = &pdata->buttons[i]; + const struct gpio_keys_button *button = &pdata->buttons[i]; struct gpio_keys_button_data *bdata = &bdev->data[i]; + unsigned long irqflags = IRQF_ONESHOT; + + INIT_DELAYED_WORK(&bdata->work, gpio_keys_irq_work_func); - if (!button->irq) - button->irq = gpio_to_irq(button->gpio); - if (button->irq < 0) { - dev_err(&pdev->dev, "failed to get irq for gpio:%d\n", button->gpio); + if (!bdata->gpiod) continue; + + if (!button->irq) { + bdata->irq = gpio_to_irq(button->gpio); + + if (bdata->irq < 0) { + dev_err(&pdev->dev, "failed to get irq for gpio:%d\n", + button->gpio); + continue; + } + + irqflags |= IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING; + } else { + bdata->irq = button->irq; } - ret = devm_request_threaded_irq(&pdev->dev, button->irq, NULL, button_handle_irq, - IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING | IRQF_ONESHOT, - dev_name(&pdev->dev), bdata); - if (ret < 0) - dev_err(&pdev->dev, "failed to request irq:%d for gpio:%d\n", button->irq, button->gpio); - else - dev_dbg(&pdev->dev, "gpio:%d has irq:%d\n", button->gpio, button->irq); + schedule_delayed_work(&bdata->work, + msecs_to_jiffies(bdata->software_debounce)); + + ret = devm_request_threaded_irq(&pdev->dev, + bdata->irq, NULL, button_handle_irq, + irqflags, dev_name(&pdev->dev), bdata); - if (bdata->b->type == EV_SW) - button_hotplug_event(bdata, EV_SW, gpio_button_get_value(bdata)); + if (ret < 0) { + bdata->irq = 0; + dev_err(&pdev->dev, "failed to request irq:%d for gpio:%d\n", + bdata->irq, button->gpio); + continue; + } else { + dev_dbg(&pdev->dev, "gpio:%d has irq:%d\n", + button->gpio, bdata->irq); + } } return 0; @@ -590,7 +649,6 @@ static int gpio_keys_polled_probe(struct platform_device *pdev) struct gpio_keys_platform_data *pdata; struct gpio_keys_button_dev *bdev; int ret; - int i; ret = gpio_keys_button_probe(pdev, &bdev, 1); @@ -604,14 +662,24 @@ static int gpio_keys_polled_probe(struct platform_device *pdev) if (pdata->enable) pdata->enable(bdev->dev); - for (i = 0; i < pdata->nbuttons; i++) - gpio_keys_polled_check_state(&bdev->data[i]); - gpio_keys_polled_queue_work(bdev); return ret; } +static void gpio_keys_irq_close(struct gpio_keys_button_dev *bdev) +{ + struct gpio_keys_platform_data *pdata = bdev->pdata; + size_t i; + + for (i = 0; i < pdata->nbuttons; i++) { + struct gpio_keys_button_data *bdata = &bdev->data[i]; + + disable_irq(bdata->irq); + cancel_delayed_work_sync(&bdata->work); + } +} + static int gpio_keys_remove(struct platform_device *pdev) { struct gpio_keys_button_dev *bdev = platform_get_drvdata(pdev); @@ -620,6 +688,8 @@ static int gpio_keys_remove(struct platform_device *pdev) if (bdev->polled) gpio_keys_polled_close(bdev); + else + gpio_keys_irq_close(bdev); return 0; } diff --git a/package/kernel/kmod-sched-cake/Makefile b/package/kernel/kmod-sched-cake/Makefile index ed1243f652..35446641ab 100644 --- a/package/kernel/kmod-sched-cake/Makefile +++ b/package/kernel/kmod-sched-cake/Makefile @@ -13,9 +13,9 @@ PKG_RELEASE:=1 PKG_SOURCE_PROTO:=git PKG_SOURCE_URL:=https://github.com/dtaht/sch_cake.git -PKG_SOURCE_DATE:=2019-01-08 -PKG_SOURCE_VERSION:=331ac70c8580544cd08a556579dc8807d9941d2e -PKG_MIRROR_HASH:=e2174531a92d1e9c48bcb74757399255aa205cb64f9863f307e357c5e23c3449 +PKG_SOURCE_DATE:=2019-03-12 +PKG_SOURCE_VERSION:=057c738801e9dc64e8dd72a3fc4f50734214433c +PKG_MIRROR_HASH:=5bf06a804824db36ae393fc174aeec7b12633176e05a765c0931b39df5bd34df PKG_MAINTAINER:=Kevin Darbyshire-Bryant include $(INCLUDE_DIR)/package.mk @@ -26,7 +26,7 @@ define KernelPackage/sched-cake URL:=https://github.com/dtaht/sch_cake FILES:=$(PKG_BUILD_DIR)/sch_cake.ko AUTOLOAD:=$(call AutoLoad,75,sch_cake) - DEPENDS:=+kmod-ipt-conntrack @!LINUX_3_18 + DEPENDS:=+kmod-ipt-conntrack endef include $(INCLUDE_DIR)/kernel-defaults.mk diff --git a/package/kernel/linux/modules/block.mk b/package/kernel/linux/modules/block.mk index d73c8fc4d7..3bc607c12e 100644 --- a/package/kernel/linux/modules/block.mk +++ b/package/kernel/linux/modules/block.mk @@ -209,7 +209,7 @@ $(eval $(call KernelPackage,block2mtd)) define KernelPackage/dax SUBMENU:=$(BLOCK_MENU) TITLE:=DAX: direct access to differentiated memory - DEPENDS:=@!LINUX_3_18 @!LINUX_4_9 + DEPENDS:=@!LINUX_4_9 KCONFIG:=CONFIG_DAX FILES:=$(LINUX_DIR)/drivers/dax/dax.ko endef @@ -220,7 +220,7 @@ $(eval $(call KernelPackage,dax)) define KernelPackage/dm SUBMENU:=$(BLOCK_MENU) TITLE:=Device Mapper - DEPENDS:=+kmod-crypto-manager +!(LINUX_3_18||LINUX_4_9):kmod-dax + DEPENDS:=+kmod-crypto-manager +!LINUX_4_9:kmod-dax # All the "=n" are unnecessary, they're only there # to stop the config from asking the question. # MIRROR is M because I've needed it for pvmove. @@ -337,7 +337,7 @@ $(eval $(call KernelPackage,md-raid10)) define KernelPackage/md-raid456 -$(call KernelPackage/md/Depends,+kmod-lib-raid6 +kmod-lib-xor +!LINUX_3_18:kmod-lib-crc32c) +$(call KernelPackage/md/Depends,+kmod-lib-raid6 +kmod-lib-xor +kmod-lib-crc32c) TITLE:=RAID Level 456 Driver KCONFIG:= \ CONFIG_ASYNC_CORE \ diff --git a/package/kernel/linux/modules/can.mk b/package/kernel/linux/modules/can.mk index b0d254511b..c2c7411c6e 100644 --- a/package/kernel/linux/modules/can.mk +++ b/package/kernel/linux/modules/can.mk @@ -26,7 +26,6 @@ define KernelPackage/can CONFIG_CAN_MSCAN=n \ CONFIG_CAN_SJA1000=n \ CONFIG_CAN_SOFTING=n \ - CONFIG_CAN_XILINXCAN=n \ CONFIG_NET_EMATCH_CANID=n \ CONFIG_CAN_DEBUG_DEVICES=n FILES:=$(LINUX_DIR)/drivers/net/can/can-dev.ko \ @@ -99,7 +98,7 @@ $(eval $(call KernelPackage,can-c-can-pci)) define KernelPackage/can-c-can-platform TITLE:=Platform Bus based BOSCH C_CAN/D_CAN driver KCONFIG:=CONFIG_CAN_C_CAN_PLATFORM - DEPENDS:=kmod-can-c-can +!LINUX_3_18:kmod-regmap-core + DEPENDS:=kmod-can-c-can +kmod-regmap-core FILES:=$(LINUX_DIR)/drivers/net/can/c_can/c_can_platform.ko AUTOLOAD:=$(call AutoProbe,c_can_platform) $(call AddDepends/can) @@ -277,4 +276,17 @@ endef $(eval $(call KernelPackage,can-vcan)) +define KernelPackage/can-xilinx-can + TITLE:=Xilinx CAN IP + KCONFIG:=CONFIG_CAN_XILINXCAN + FILES:=$(LINUX_DIR)/drivers/net/can/xilinx_can.ko + AUTOLOAD:=$(call AutoProbe,xilinx_can) + $(call AddDepends/can,@TARGET_zynq) +endef + +define KernelPackage/can-xilinx-can/description + Xilinx CAN driver. This driver supports both + soft AXI CAN IP and Zynq CANPS IP. +endef +$(eval $(call KernelPackage,can-xilinx-can)) diff --git a/package/kernel/linux/modules/crypto.mk b/package/kernel/linux/modules/crypto.mk index d70eb924c3..9cab04c6ed 100644 --- a/package/kernel/linux/modules/crypto.mk +++ b/package/kernel/linux/modules/crypto.mk @@ -40,7 +40,7 @@ define KernelPackage/crypto-aead CONFIG_CRYPTO_AEAD2 FILES:=$(LINUX_DIR)/crypto/aead.ko AUTOLOAD:=$(call AutoLoad,09,aead,1) - $(call AddDepends/crypto, +!LINUX_3_18:kmod-crypto-null) + $(call AddDepends/crypto, +kmod-crypto-null) endef $(eval $(call KernelPackage,crypto-aead)) @@ -48,7 +48,7 @@ $(eval $(call KernelPackage,crypto-aead)) define KernelPackage/crypto-authenc TITLE:=Combined mode wrapper for IPsec - DEPENDS:=+kmod-crypto-manager +!LINUX_3_18:kmod-crypto-null + DEPENDS:=+kmod-crypto-manager +kmod-crypto-null KCONFIG:=CONFIG_CRYPTO_AUTHENC FILES:=$(LINUX_DIR)/crypto/authenc.ko AUTOLOAD:=$(call AutoLoad,09,authenc) @@ -145,7 +145,7 @@ $(eval $(call KernelPackage,crypto-cts)) define KernelPackage/crypto-deflate TITLE:=Deflate compression CryptoAPI module - DEPENDS:=+kmod-lib-zlib-inflate +kmod-lib-zlib-deflate +!(LINUX_3_18||LINUX_4_9):kmod-crypto-acompress + DEPENDS:=+kmod-lib-zlib-inflate +kmod-lib-zlib-deflate +!LINUX_4_9:kmod-crypto-acompress KCONFIG:=CONFIG_CRYPTO_DEFLATE FILES:=$(LINUX_DIR)/crypto/deflate.ko AUTOLOAD:=$(call AutoLoad,09,deflate) @@ -180,7 +180,7 @@ $(eval $(call KernelPackage,crypto-ecb)) define KernelPackage/crypto-ecdh TITLE:=ECDH algorithm - DEPENDS:=@!LINUX_3_18 +kmod-crypto-kpp + DEPENDS:=+kmod-crypto-kpp KCONFIG:= CONFIG_CRYPTO_ECDH FILES:= \ $(LINUX_DIR)/crypto/ecdh_generic.ko @@ -226,6 +226,18 @@ endef $(eval $(call KernelPackage,crypto-gcm)) +define KernelPackage/crypto-xcbc + TITLE:=XCBC CryptoAPI module + DEPENDS:=+kmod-crypto-hash +kmod-crypto-manager + KCONFIG:=CONFIG_CRYPTO_XCBC + FILES:=$(LINUX_DIR)/crypto/xcbc.ko + AUTOLOAD:=$(call AutoLoad,09,xcbc) + $(call AddDepends/crypto) +endef + +$(eval $(call KernelPackage,crypto-xcbc)) + + define KernelPackage/crypto-gf128 TITLE:=GF(2^128) multiplication functions CryptoAPI module KCONFIG:=CONFIG_CRYPTO_GF128MUL @@ -274,7 +286,7 @@ $(eval $(call KernelPackage,crypto-hmac)) define KernelPackage/crypto-hw-ccp TITLE:=AMD Cryptographic Coprocessor - DEPENDS:=+kmod-crypto-authenc +kmod-crypto-hash +kmod-crypto-manager +kmod-random-core +kmod-crypto-sha1 +kmod-crypto-sha256 +!(LINUX_3_18||LINUX_4_9):kmod-crypto-rsa + DEPENDS:=+kmod-crypto-authenc +kmod-crypto-hash +kmod-crypto-manager +kmod-random-core +kmod-crypto-sha1 +kmod-crypto-sha256 +!LINUX_4_9:kmod-crypto-rsa KCONFIG:= \ CONFIG_CRYPTO_HW=y \ CONFIG_CRYPTO_DEV_CCP=y \ @@ -571,7 +583,7 @@ $(eval $(call KernelPackage,crypto-pcompress)) define KernelPackage/crypto-rsa TITLE:=RSA algorithm - DEPENDS:=@!LINUX_3_18 +kmod-crypto-manager +kmod-asn1-decoder + DEPENDS:=+kmod-crypto-manager +kmod-asn1-decoder KCONFIG:= CONFIG_CRYPTO_RSA HIDDEN:=1 FILES:= \ @@ -585,6 +597,18 @@ endef $(eval $(call KernelPackage,crypto-rsa)) +define KernelPackage/crypto-rmd160 + TITLE:=RIPEMD160 digest CryptoAPI module + DEPENDS:=+kmod-crypto-hash + KCONFIG:=CONFIG_CRYPTO_RMD160 + FILES:=$(LINUX_DIR)/crypto/rmd160.ko + AUTOLOAD:=$(call AutoLoad,09,rmd160) + $(call AddDepends/crypto) +endef + +$(eval $(call KernelPackage,crypto-rmd160)) + + define KernelPackage/crypto-rng TITLE:=CryptoAPI random number generation DEPENDS:=+kmod-crypto-hash +kmod-crypto-hmac +kmod-crypto-sha256 diff --git a/package/kernel/linux/modules/fs.mk b/package/kernel/linux/modules/fs.mk index edd2774a63..12290e94b5 100644 --- a/package/kernel/linux/modules/fs.mk +++ b/package/kernel/linux/modules/fs.mk @@ -68,7 +68,7 @@ $(eval $(call KernelPackage,fs-autofs4)) define KernelPackage/fs-btrfs SUBMENU:=$(FS_MENU) TITLE:=BTRFS filesystem support - DEPENDS:=+kmod-lib-crc32c +kmod-lib-lzo +kmod-lib-zlib-inflate +kmod-lib-zlib-deflate +kmod-lib-raid6 +kmod-lib-xor +!(LINUX_3_18||LINUX_4_9):kmod-lib-zstd + DEPENDS:=+kmod-lib-crc32c +kmod-lib-lzo +kmod-lib-zlib-inflate +kmod-lib-zlib-deflate +kmod-lib-raid6 +kmod-lib-xor +!LINUX_4_9:kmod-lib-zstd KCONFIG:=\ CONFIG_BTRFS_FS \ CONFIG_BTRFS_FS_POSIX_ACL=n \ diff --git a/package/kernel/linux/modules/hwmon.mk b/package/kernel/linux/modules/hwmon.mk index bf2860881e..e79304b4fe 100644 --- a/package/kernel/linux/modules/hwmon.mk +++ b/package/kernel/linux/modules/hwmon.mk @@ -112,7 +112,7 @@ define KernelPackage/hwmon-ina2xx KCONFIG:=CONFIG_SENSORS_INA2XX FILES:=$(LINUX_DIR)/drivers/hwmon/ina2xx.ko AUTOLOAD:=$(call AutoProbe,ina2xx) - $(call AddDepends/hwmon,+kmod-i2c-core +!LINUX_3_18:kmod-regmap-i2c) + $(call AddDepends/hwmon,+kmod-i2c-core +kmod-regmap-i2c) endef define KernelPackage/hwmon-ina2xx/description diff --git a/package/kernel/linux/modules/iio.mk b/package/kernel/linux/modules/iio.mk index 44a4806b34..2d5cd6e11e 100644 --- a/package/kernel/linux/modules/iio.mk +++ b/package/kernel/linux/modules/iio.mk @@ -132,7 +132,7 @@ $(eval $(call KernelPackage,iio-dht11)) define KernelPackage/iio-bmp280 SUBMENU:=$(IIO_MENU) TITLE:=BMP180/BMP280/BME280 pressure/temperatur sensor - DEPENDS:=@!LINUX_3_18 +kmod-iio-core +kmod-regmap-core + DEPENDS:=+kmod-iio-core +kmod-regmap-core KCONFIG:=CONFIG_BMP280 FILES:=$(LINUX_DIR)/drivers/iio/pressure/bmp280.ko endef @@ -152,7 +152,7 @@ define KernelPackage/iio-bmp280-i2c DEPENDS:=+kmod-iio-bmp280 +kmod-i2c-core +kmod-regmap-i2c KCONFIG:=CONFIG_BMP280_I2C FILES:=$(LINUX_DIR)/drivers/iio/pressure/bmp280-i2c.ko - AUTOLOAD:=$(call AutoProbe,iio-bmp280-i2c) + AUTOLOAD:=$(call AutoProbe,bmp280-i2c) endef define KernelPackage/iio-bmp280-i2c/description This driver adds support for Bosch Sensortec's digital pressure and @@ -168,7 +168,7 @@ define KernelPackage/iio-bmp280-spi DEPENDS:=+kmod-iio-bmp280 +kmod-spi-bitbang KCONFIG:=CONFIG_BMP280_SPI FILES:=$(LINUX_DIR)/drivers/iio/pressure/bmp280-spi.ko - AUTOLOAD:=$(call AutoProbe,iio-bmp280-spi) + AUTOLOAD:=$(call AutoProbe,bmp280-spi) endef define KernelPackage/iio-bmp280-spi/description This driver adds support for Bosch Sensortec's digital pressure and diff --git a/package/kernel/linux/modules/lib.mk b/package/kernel/linux/modules/lib.mk index b0d19ff8bd..3e5a12e926 100644 --- a/package/kernel/linux/modules/lib.mk +++ b/package/kernel/linux/modules/lib.mk @@ -101,7 +101,7 @@ $(eval $(call KernelPackage,lib-crc32c)) define KernelPackage/lib-lzo SUBMENU:=$(LIB_MENU) TITLE:=LZO support - DEPENDS:=+!(LINUX_3_18||LINUX_4_9):kmod-crypto-acompress + DEPENDS:=+!LINUX_4_9:kmod-crypto-acompress KCONFIG:= \ CONFIG_CRYPTO_LZO@ge4.9 \ CONFIG_LZO_COMPRESS \ @@ -146,7 +146,7 @@ $(eval $(call KernelPackage,lib-zstd)) define KernelPackage/lib-lz4 SUBMENU:=$(LIB_MENU) TITLE:=LZ4 support - DEPENDS:=+!(LINUX_3_18||LINUX_4_9):kmod-crypto-acompress + DEPENDS:=+!LINUX_4_9:kmod-crypto-acompress HIDDEN:=1 KCONFIG:= \ CONFIG_CRYPTO_LZ4@ge4.9 \ diff --git a/package/kernel/linux/modules/netdevices.mk b/package/kernel/linux/modules/netdevices.mk index 7ceb4c63c5..da4ddaeec0 100644 --- a/package/kernel/linux/modules/netdevices.mk +++ b/package/kernel/linux/modules/netdevices.mk @@ -113,7 +113,7 @@ $(eval $(call KernelPackage,mii)) define KernelPackage/mdio-gpio SUBMENU:=$(NETWORK_DEVICES_MENU) TITLE:= Supports GPIO lib-based MDIO busses - DEPENDS:=+kmod-libphy @GPIO_SUPPORT +(TARGET_armvirt||TARGET_brcm2708_bcm2708||TARGET_samsung):kmod-of-mdio + DEPENDS:=+kmod-libphy @GPIO_SUPPORT +(TARGET_armvirt||TARGET_brcm2708_bcm2708||TARGET_samsung||TARGET_tegra):kmod-of-mdio KCONFIG:= \ CONFIG_MDIO_BITBANG \ CONFIG_MDIO_GPIO @@ -261,7 +261,7 @@ $(eval $(call KernelPackage,switch-rtl8306)) define KernelPackage/switch-rtl8366-smi SUBMENU:=$(NETWORK_DEVICES_MENU) TITLE:=Realtek RTL8366 SMI switch interface support - DEPENDS:=@GPIO_SUPPORT +kmod-swconfig +(TARGET_armvirt||TARGET_brcm2708_bcm2708||TARGET_samsung):kmod-of-mdio + DEPENDS:=@GPIO_SUPPORT +kmod-swconfig +(TARGET_armvirt||TARGET_brcm2708_bcm2708||TARGET_samsung||TARGET_tegra):kmod-of-mdio KCONFIG:=CONFIG_RTL8366_SMI FILES:=$(LINUX_DIR)/drivers/net/phy/rtl8366_smi.ko AUTOLOAD:=$(call AutoLoad,42,rtl8366_smi) @@ -479,22 +479,6 @@ endef $(eval $(call KernelPackage,8139cp)) -define KernelPackage/r8169 - SUBMENU:=$(NETWORK_DEVICES_MENU) - TITLE:=RealTek RTL-8169 PCI Gigabit Ethernet Adapter kernel support - DEPENDS:=@PCI_SUPPORT +kmod-mii +LINUX_4_19:kmod-phy-realtek - KCONFIG:=CONFIG_R8169 \ - CONFIG_R8169_NAPI=y \ - CONFIG_R8169_VLAN=n - FILES:=$(LINUX_DIR)/drivers/net/ethernet/realtek/r8169.ko - AUTOLOAD:=$(call AutoProbe,r8169) -endef - -define KernelPackage/r8169/description - Kernel modules for RealTek RTL-8169 PCI Gigabit Ethernet adapters -endef - -$(eval $(call KernelPackage,r8169)) define KernelPackage/ne2k-pci @@ -684,7 +668,7 @@ define KernelPackage/tg3 TITLE:=Broadcom Tigon3 Gigabit Ethernet KCONFIG:=CONFIG_TIGON3 \ CONFIG_TIGON3_HWMON=n - DEPENDS:=+!TARGET_brcm47xx:kmod-libphy +(LINUX_3_18||LINUX_4_9):kmod-hwmon-core +kmod-ptp + DEPENDS:=+!TARGET_brcm47xx:kmod-libphy +LINUX_4_9:kmod-hwmon-core +kmod-ptp SUBMENU:=$(NETWORK_DEVICES_MENU) FILES:=$(LINUX_DIR)/drivers/net/ethernet/broadcom/tg3.ko AUTOLOAD:=$(call AutoLoad,19,tg3,1) @@ -959,3 +943,5 @@ define KernelPackage/ethoc/description endef $(eval $(call KernelPackage,ethoc)) + + diff --git a/package/kernel/linux/modules/netfilter.mk b/package/kernel/linux/modules/netfilter.mk index 6c78394297..53188eab5a 100644 --- a/package/kernel/linux/modules/netfilter.mk +++ b/package/kernel/linux/modules/netfilter.mk @@ -152,7 +152,7 @@ define KernelPackage/nf-flow CONFIG_NETFILTER_INGRESS=y \ CONFIG_NF_FLOW_TABLE \ CONFIG_NF_FLOW_TABLE_HW - DEPENDS:=+kmod-nf-conntrack @!LINUX_3_18 @!LINUX_4_9 + DEPENDS:=+kmod-nf-conntrack @!LINUX_4_9 FILES:= \ $(LINUX_DIR)/net/netfilter/nf_flow_table.ko \ $(LINUX_DIR)/net/netfilter/nf_flow_table_hw.ko @@ -368,7 +368,7 @@ IPVS_MODULES:= \ define KernelPackage/nf-ipvs SUBMENU:=Netfilter Extensions TITLE:=IP Virtual Server modules - DEPENDS:=@IPV6 +kmod-lib-crc32c +kmod-ipt-conntrack +kmod-nf-conntrack + DEPENDS:=@IPV6 +kmod-lib-crc32c +kmod-ipt-conntrack +kmod-nf-conntrack +LINUX_4_14:kmod-nf-conntrack6 KCONFIG:= \ CONFIG_IP_VS \ CONFIG_IP_VS_IPV6=y \ diff --git a/package/kernel/linux/modules/netsupport.mk b/package/kernel/linux/modules/netsupport.mk index 003603f10b..5bd5df340a 100644 --- a/package/kernel/linux/modules/netsupport.mk +++ b/package/kernel/linux/modules/netsupport.mk @@ -383,6 +383,22 @@ endef $(eval $(call KernelPackage,ip6-vti)) +define KernelPackage/xfrm-interface + SUBMENU:=$(NETWORK_SUPPORT_MENU) + TITLE:=IPsec XFRM Interface + DEPENDS:=+kmod-ipsec4 +kmod-ipsec6 @!LINUX_4_14 + KCONFIG:=CONFIG_XFRM_INTERFACE + FILES:=$(LINUX_DIR)/net/xfrm/xfrm_interface.ko + AUTOLOAD:=$(call AutoLoad,33,xfrm_interface) +endef + +define KernelPackage/xfrm-interface/description + Kernel module for XFRM interface support +endef + +$(eval $(call KernelPackage,xfrm-interface)) + + define KernelPackage/iptunnel4 SUBMENU:=$(NETWORK_SUPPORT_MENU) TITLE:=IPv4 tunneling @@ -717,7 +733,7 @@ $(eval $(call KernelPackage,mppe)) SCHED_MODULES = $(patsubst $(LINUX_DIR)/net/sched/%.ko,%,$(wildcard $(LINUX_DIR)/net/sched/*.ko)) SCHED_MODULES_CORE = sch_ingress sch_fq_codel sch_hfsc sch_htb sch_tbf cls_basic cls_fw cls_route cls_flow cls_tcindex cls_u32 em_u32 act_mirred act_skbedit cls_matchall -SCHED_MODULES_FILTER = $(SCHED_MODULES_CORE) act_connmark sch_netem em_ipset cls_bpf act_bpf +SCHED_MODULES_FILTER = $(SCHED_MODULES_CORE) act_connmark act_ctinfo sch_netem sch_mqprio em_ipset cls_bpf cls_flower act_bpf act_vlan SCHED_MODULES_EXTRA = $(filter-out $(SCHED_MODULES_FILTER),$(SCHED_MODULES)) SCHED_FILES = $(patsubst %,$(LINUX_DIR)/net/sched/%.ko,$(filter $(SCHED_MODULES_CORE),$(SCHED_MODULES))) SCHED_FILES_EXTRA = $(patsubst %,$(LINUX_DIR)/net/sched/%.ko,$(SCHED_MODULES_EXTRA)) @@ -725,7 +741,6 @@ SCHED_FILES_EXTRA = $(patsubst %,$(LINUX_DIR)/net/sched/%.ko,$(SCHED_MODULES_EXT define KernelPackage/sched-core SUBMENU:=$(NETWORK_SUPPORT_MENU) TITLE:=Traffic schedulers - DEPENDS:=@!LINUX_3_18 KCONFIG:= \ CONFIG_NET_SCHED=y \ CONFIG_NET_SCH_HFSC \ @@ -757,6 +772,53 @@ endef $(eval $(call KernelPackage,sched-core)) +define KernelPackage/sched-flower + SUBMENU:=$(NETWORK_SUPPORT_MENU) + TITLE:=Flower traffic classifier + DEPENDS:=+kmod-sched-core + KCONFIG:=CONFIG_NET_CLS_FLOWER + FILES:=$(LINUX_DIR)/net/sched/cls_flower.ko + AUTOLOAD:=$(call AutoProbe, cls_flower) +endef + +define KernelPackage/sched-flower/description + Allows to classify packets based on a configurable combination of packet keys and masks. +endef + +$(eval $(call KernelPackage,sched-flower)) + + +define KernelPackage/sched-act-vlan + SUBMENU:=$(NETWORK_SUPPORT_MENU) + TITLE:=Traffic VLAN manipulation + DEPENDS:=+kmod-sched-core + KCONFIG:=CONFIG_NET_ACT_VLAN + FILES:=$(LINUX_DIR)/net/sched/act_vlan.ko + AUTOLOAD:=$(call AutoProbe, act_vlan) +endef + +define KernelPackage/sched-act-vlan/description + Allows to configure rules to push or pop vlan headers. +endef + +$(eval $(call KernelPackage,sched-act-vlan)) + + +define KernelPackage/sched-mqprio + SUBMENU:=$(NETWORK_SUPPORT_MENU) + TITLE:=Multi-queue priority scheduler (MQPRIO) + DEPENDS:=+kmod-sched-core + KCONFIG:=CONFIG_NET_SCH_MQPRIO + FILES:=$(LINUX_DIR)/net/sched/sch_mqprio.ko + AUTOLOAD:=$(call AutoProbe, sch_mqprio) +endef + +define KernelPackage/sched-mqprio/description + This scheduler allows QOS to be offloaded on NICs that have support for offloading QOS schedulers. +endef + +$(eval $(call KernelPackage,sched-mqprio)) + define KernelPackage/sched-connmark SUBMENU:=$(NETWORK_SUPPORT_MENU) TITLE:=Traffic shaper conntrack mark support @@ -767,6 +829,15 @@ define KernelPackage/sched-connmark endef $(eval $(call KernelPackage,sched-connmark)) +define KernelPackage/sched-ctinfo + SUBMENU:=$(NETWORK_SUPPORT_MENU) + TITLE:=Traffic shaper ctinfo support + DEPENDS:=+kmod-sched-core +kmod-ipt-core +kmod-ipt-conntrack-extra + KCONFIG:=CONFIG_NET_ACT_CTINFO + FILES:=$(LINUX_DIR)/net/sched/act_ctinfo.ko + AUTOLOAD:=$(call AutoLoad,71, act_ctinfo) +endef +$(eval $(call KernelPackage,sched-ctinfo)) define KernelPackage/sched-ipset SUBMENU:=$(NETWORK_SUPPORT_MENU) @@ -785,7 +856,6 @@ $(eval $(call KernelPackage,sched-ipset)) define KernelPackage/sched-bpf SUBMENU:=$(NETWORK_SUPPORT_MENU) TITLE:=Traffic shaper support for Berkeley Packet Filter - DEPENDS:=@!LINUX_3_18 KCONFIG:= \ CONFIG_NET_CLS_BPF \ CONFIG_NET_ACT_BPF @@ -801,7 +871,6 @@ $(eval $(call KernelPackage,sched-bpf)) define KernelPackage/bpf-test SUBMENU:=$(NETWORK_SUPPORT_MENU) TITLE:=Test Berkeley Packet Filter functionality - DEPENDS:=@!LINUX_3_18 KCONFIG:=CONFIG_TEST_BPF FILES:=$(LINUX_DIR)/lib/test_bpf.ko endef @@ -849,7 +918,7 @@ $(eval $(call KernelPackage,sched)) define KernelPackage/tcp-bbr SUBMENU:=$(NETWORK_SUPPORT_MENU) TITLE:=BBR TCP congestion control - DEPENDS:=@!LINUX_3_18 +LINUX_4_9:kmod-sched + DEPENDS:=+LINUX_4_9:kmod-sched KCONFIG:= \ CONFIG_TCP_CONG_ADVANCED=y \ CONFIG_TCP_CONG_BBR @@ -1065,7 +1134,7 @@ $(eval $(call KernelPackage,rxrpc)) define KernelPackage/mpls SUBMENU:=$(NETWORK_SUPPORT_MENU) TITLE:=MPLS support - DEPENDS:=@!LINUX_3_18 +LINUX_4_19:kmod-iptunnel + DEPENDS:=+LINUX_4_19:kmod-iptunnel KCONFIG:= \ CONFIG_MPLS=y \ CONFIG_LWTUNNEL=y \ @@ -1142,7 +1211,7 @@ $(eval $(call KernelPackage,mdio)) define KernelPackage/macsec SUBMENU:=$(NETWORK_SUPPORT_MENU) TITLE:=IEEE 802.1AE MAC-level encryption (MAC) - DEPENDS:=+kmod-crypto-gcm @!LINUX_3_18 + DEPENDS:=+kmod-crypto-gcm KCONFIG:=CONFIG_MACSEC FILES:=$(LINUX_DIR)/drivers/net/macsec.ko AUTOLOAD:=$(call AutoLoad,13,macsec) diff --git a/package/kernel/linux/modules/other.mk b/package/kernel/linux/modules/other.mk index 31ee2a7ec5..6e7a8bfd7d 100644 --- a/package/kernel/linux/modules/other.mk +++ b/package/kernel/linux/modules/other.mk @@ -30,7 +30,7 @@ $(eval $(call KernelPackage,6lowpan)) define KernelPackage/bluetooth SUBMENU:=$(OTHER_MENU) TITLE:=Bluetooth support - DEPENDS:=@USB_SUPPORT +kmod-usb-core +kmod-crypto-hash +kmod-crypto-ecb +kmod-lib-crc16 +kmod-hid +!LINUX_3_18:kmod-crypto-cmac +!LINUX_3_18:kmod-regmap-core +!(LINUX_3_18||LINUX_4_9):kmod-crypto-ecdh + DEPENDS:=@USB_SUPPORT +kmod-usb-core +kmod-crypto-hash +kmod-crypto-ecb +kmod-lib-crc16 +kmod-hid +kmod-crypto-cmac +kmod-regmap-core +!LINUX_4_9:kmod-crypto-ecdh KCONFIG:= \ CONFIG_BT \ CONFIG_BT_BREDR=y \ @@ -178,7 +178,7 @@ $(eval $(call KernelPackage,gpio-dev)) define KernelPackage/gpio-mcp23s08 SUBMENU:=$(OTHER_MENU) TITLE:=Microchip MCP23xxx I/O expander - DEPENDS:=@GPIO_SUPPORT +kmod-i2c-core +!(LINUX_3_18||LINUX_4_9):kmod-regmap-i2c + DEPENDS:=@GPIO_SUPPORT +kmod-i2c-core +!LINUX_4_9:kmod-regmap-i2c KCONFIG:= \ CONFIG_GPIO_MCP23S08 \ CONFIG_PINCTRL_MCP23S08 @@ -435,7 +435,7 @@ define KernelPackage/rtc-ds1307 SUBMENU:=$(OTHER_MENU) TITLE:=Dallas/Maxim DS1307 (and compatible) RTC support DEFAULT:=m if ALL_KMODS && RTC_SUPPORT - DEPENDS:=+kmod-i2c-core +!(LINUX_3_18||LINUX_4_9):kmod-regmap-i2c +!(LINUX_3_18||LINUX_4_9):kmod-hwmon-core + DEPENDS:=+kmod-i2c-core +!LINUX_4_9:kmod-regmap-i2c +!LINUX_4_9:kmod-hwmon-core KCONFIG:=CONFIG_RTC_DRV_DS1307 \ CONFIG_RTC_CLASS=y FILES:=$(LINUX_DIR)/drivers/rtc/rtc-ds1307.ko @@ -487,6 +487,24 @@ endef $(eval $(call KernelPackage,rtc-ds1672)) +define KernelPackage/rtc-em3027 + SUBMENU:=$(OTHER_MENU) + TITLE:=Microelectronic EM3027 RTC support + DEFAULT:=m if ALL_KMODS && RTC_SUPPORT + DEPENDS:=+kmod-i2c-core + KCONFIG:=CONFIG_RTC_DRV_EM3027 \ + CONFIG_RTC_CLASS=y + FILES:=$(LINUX_DIR)/drivers/rtc/rtc-em3027.ko + AUTOLOAD:=$(call AutoProbe,rtc-em3027) +endef + +define KernelPackage/rtc-em3027/description + Kernel module for Microelectronic EM3027 RTC. +endef + +$(eval $(call KernelPackage,rtc-em3027)) + + define KernelPackage/rtc-isl1208 SUBMENU:=$(OTHER_MENU) TITLE:=Intersil ISL1208 RTC support @@ -893,21 +911,6 @@ endef $(eval $(call KernelPackage,random-core)) -define KernelPackage/random-omap - SUBMENU:=$(OTHER_MENU) - TITLE:=Hardware Random Number Generator OMAP support - KCONFIG:=CONFIG_HW_RANDOM_OMAP - FILES:=$(LINUX_DIR)/drivers/char/hw_random/omap-rng.ko - DEPENDS:=@TARGET_omap24xx +kmod-random-core - AUTOLOAD:=$(call AutoProbe,random-omap) -endef - -define KernelPackage/random-omap/description - Kernel module for the OMAP Random Number Generator - found on OMAP16xx, OMAP2/3/4/5 and AM33xx/AM43xx multimedia processors. -endef - -$(eval $(call KernelPackage,random-omap)) define KernelPackage/random-tpm SUBMENU:=$(OTHER_MENU) @@ -994,7 +997,7 @@ $(eval $(call KernelPackage,echo)) define KernelPackage/bmp085 SUBMENU:=$(OTHER_MENU) TITLE:=BMP085/BMP18x pressure sensor - DEPENDS:= +kmod-regmap-core @!LINUX_3_18 + DEPENDS:= +kmod-regmap-core KCONFIG:= CONFIG_BMP085 FILES:= $(LINUX_DIR)/drivers/misc/bmp085.ko endef diff --git a/package/kernel/linux/modules/sound.mk b/package/kernel/linux/modules/sound.mk index bf4bd5d7c0..c83e553d8f 100644 --- a/package/kernel/linux/modules/sound.mk +++ b/package/kernel/linux/modules/sound.mk @@ -191,6 +191,7 @@ define KernelPackage/sound-soc-core DEPENDS:=+kmod-regmap-core +kmod-ac97 KCONFIG:= \ CONFIG_SND_SOC \ + CONFIG_SND_SOC_ADI=n \ CONFIG_SND_SOC_DMAENGINE_PCM=y \ CONFIG_SND_SOC_ALL_CODECS=n FILES:=$(LINUX_DIR)/sound/soc/snd-soc-core.ko diff --git a/package/kernel/linux/modules/usb.mk b/package/kernel/linux/modules/usb.mk index 9d64c303d4..3666a2bff7 100644 --- a/package/kernel/linux/modules/usb.mk +++ b/package/kernel/linux/modules/usb.mk @@ -39,7 +39,6 @@ endef define KernelPackage/usb-ledtrig-usbport TITLE:=LED trigger for USB ports KCONFIG:=CONFIG_USB_LEDS_TRIGGER_USBPORT - DEPENDS:=@!LINUX_3_18 FILES:=$(LINUX_DIR)/drivers/usb/core/ledtrig-usbport.ko AUTOLOAD:=$(call AutoLoad,50,ledtrig-usbport) $(call AddDepends/usb) @@ -375,6 +374,7 @@ define KernelPackage/usb2 +TARGET_brcm47xx:kmod-usb-bcma \ +TARGET_brcm47xx:kmod-usb-ssb \ +TARGET_bcm53xx:kmod-usb-bcma \ + +TARGET_bcm53xx:kmod-phy-bcm-ns-usb2 \ +TARGET_ath79:kmod-phy-ath79-usb \ +kmod-usb-ehci KCONFIG:=\ @@ -394,7 +394,13 @@ define KernelPackage/usb2 ifneq ($(wildcard $(LINUX_DIR)/drivers/usb/host/ehci-atmel.ko),) FILES+=$(LINUX_DIR)/drivers/usb/host/ehci-atmel.ko endif - AUTOLOAD:=$(call AutoLoad,40,ehci-hcd ehci-platform ehci-orion ehci-atmel,1) + ifneq ($(wildcard $(LINUX_DIR)/drivers/usb/host/ehci-fsl.ko),) + FILES+=$(LINUX_DIR)/drivers/usb/host/ehci-fsl.ko + endif + ifneq ($(wildcard $(LINUX_DIR)/drivers/usb/host/fsl-mph-dr-of.ko),) + FILES+=$(LINUX_DIR)/drivers/usb/host/fsl-mph-dr-of.ko + endif + AUTOLOAD:=$(call AutoLoad,40,ehci-hcd ehci-platform ehci-orion ehci-atmel ehci-fsl fsl-mph-dr-of,1) $(call AddDepends/usb) endef @@ -627,6 +633,8 @@ endef $(eval $(call KernelPackage,usb-serial-ch341)) + + define KernelPackage/usb-serial-ftdi TITLE:=Support for FTDI devices KCONFIG:=CONFIG_USB_SERIAL_FTDI_SIO @@ -1629,8 +1637,8 @@ XHCI_AUTOLOAD := $(patsubst $(LINUX_DIR)/drivers/usb/host/%.ko,%,$(XHCI_FILES)) define KernelPackage/usb3 TITLE:=Support for USB3 controllers DEPENDS:= \ - - + +TARGET_bcm53xx:kmod-usb-bcma \ + +TARGET_bcm53xx:kmod-phy-bcm-ns-usb3 KCONFIG:= \ CONFIG_USB_PCI=y \ CONFIG_USB_XHCI_HCD \ diff --git a/package/kernel/linux/modules/video.mk b/package/kernel/linux/modules/video.mk index 5d821123c0..abbe087e92 100644 --- a/package/kernel/linux/modules/video.mk +++ b/package/kernel/linux/modules/video.mk @@ -187,7 +187,7 @@ define KernelPackage/fb-tft SUBMENU:=$(VIDEO_MENU) TITLE:=Support for small TFT LCD display modules DEPENDS:= \ - @GPIO_SUPPORT @!LINUX_3_18 @!LINUX_4_9 +kmod-backlight \ + @GPIO_SUPPORT @!LINUX_4_9 +kmod-backlight \ +kmod-fb +kmod-fb-sys-fops +kmod-fb-sys-ram +kmod-spi-bitbang KCONFIG:= \ CONFIG_FB_BACKLIGHT=y \ @@ -239,11 +239,46 @@ endef $(eval $(call KernelPackage,drm)) +define KernelPackage/drm-ttm + SUBMENU:=$(VIDEO_MENU) + TITLE:=GPU memory management subsystem + DEPENDS:=@DISPLAY_SUPPORT +kmod-drm + KCONFIG:=CONFIG_DRM_TTM + FILES:=$(LINUX_DIR)/drivers/gpu/drm/ttm/ttm.ko + AUTOLOAD:=$(call AutoProbe,ttm) +endef + +define KernelPackage/drm-ttm/description + GPU memory management subsystem for devices with multiple GPU memory types. + Will be enabled automatically if a device driver uses it. +endef + +$(eval $(call KernelPackage,drm-ttm)) + +define KernelPackage/drm-kms-helper + SUBMENU:=$(VIDEO_MENU) + TITLE:=CRTC helpers for KMS drivers + DEPENDS:=@DISPLAY_SUPPORT +kmod-drm +kmod-fb +kmod-fb-sys-fops +kmod-fb-cfb-copyarea \ + +kmod-fb-cfb-fillrect +kmod-fb-cfb-imgblt +kmod-fb-sys-ram + KCONFIG:= \ + CONFIG_DRM_KMS_HELPER \ + CONFIG_DRM_KMS_FB_HELPER=y + FILES:=$(LINUX_DIR)/drivers/gpu/drm/drm_kms_helper.ko + AUTOLOAD:=$(call AutoProbe,drm_kms_helper) +endef + +define KernelPackage/drm-kms-helper/description + CRTC helpers for KMS drivers. +endef + +$(eval $(call KernelPackage,drm-kms-helper)) + + define KernelPackage/drm-imx SUBMENU:=$(VIDEO_MENU) TITLE:=Freescale i.MX DRM support - DEPENDS:=@TARGET_imx6 +kmod-drm +kmod-fb +kmod-fb-cfb-copyarea +kmod-fb-cfb-imgblt +kmod-fb-cfb-fillrect +kmod-fb-sys-fops +kmod-fb-sys-ram + DEPENDS:=@TARGET_imx6 +kmod-drm-kms-helper KCONFIG:=CONFIG_DRM_IMX \ CONFIG_DRM_FBDEV_EMULATION=y \ CONFIG_DRM_FBDEV_OVERALLOC=100 \ @@ -251,8 +286,6 @@ define KernelPackage/drm-imx CONFIG_RESET_CONTROLLER=y \ CONFIG_DRM_IMX_IPUV3 \ CONFIG_IMX_IPUV3 \ - CONFIG_DRM_KMS_HELPER \ - CONFIG_DRM_KMS_FB_HELPER=y \ CONFIG_DRM_GEM_CMA_HELPER=y \ CONFIG_DRM_KMS_CMA_HELPER=y \ CONFIG_DRM_IMX_FB_HELPER \ @@ -262,8 +295,7 @@ define KernelPackage/drm-imx CONFIG_DRM_IMX_HDMI=n FILES:= \ $(LINUX_DIR)/drivers/gpu/drm/imx/imxdrm.ko \ - $(LINUX_DIR)/drivers/gpu/ipu-v3/imx-ipu-v3.ko \ - $(LINUX_DIR)/drivers/gpu/drm/drm_kms_helper.ko + $(LINUX_DIR)/drivers/gpu/ipu-v3/imx-ipu-v3.ko AUTOLOAD:=$(call AutoLoad,08,imxdrm imx-ipu-v3 imx-ipuv3-crtc) endef @@ -318,6 +350,7 @@ endef $(eval $(call KernelPackage,drm-imx-ldb)) + # # Video Capture # @@ -364,7 +397,7 @@ endef define KernelPackage/video-videobuf2 TITLE:=videobuf2 lib - DEPENDS:=+kmod-dma-buf @!LINUX_3_18 + DEPENDS:=+kmod-dma-buf KCONFIG:= \ CONFIG_VIDEOBUF2_CORE \ CONFIG_VIDEOBUF2_MEMOPS \ diff --git a/package/kernel/linux/modules/w1.mk b/package/kernel/linux/modules/w1.mk index baf6b06625..5055d78a18 100644 --- a/package/kernel/linux/modules/w1.mk +++ b/package/kernel/linux/modules/w1.mk @@ -14,7 +14,7 @@ define KernelPackage/w1 TITLE:=Dallas's 1-wire support KCONFIG:=CONFIG_W1 FILES:=$(LINUX_DIR)/drivers/w1/wire.ko - DEPENDS:=+!(LINUX_3_18||LINUX_4_9):kmod-hwmon-core + DEPENDS:=+!LINUX_4_9:kmod-hwmon-core endef define KernelPackage/w1/description diff --git a/package/kernel/linux/modules/wpan.mk b/package/kernel/linux/modules/wpan.mk index d8d58fa0bc..1e986ee0ca 100644 --- a/package/kernel/linux/modules/wpan.mk +++ b/package/kernel/linux/modules/wpan.mk @@ -9,7 +9,6 @@ WPAN_MENU:=WPAN 802.15.4 Support define KernelPackage/ieee802154 SUBMENU:=$(WPAN_MENU) TITLE:=IEEE-802.15.4 support - DEPENDS:=@!LINUX_3_18 KCONFIG:= \ CONFIG_IEEE802154 \ CONFIG_IEEE802154_SOCKET=y \ @@ -33,7 +32,7 @@ $(eval $(call KernelPackage,ieee802154)) define KernelPackage/mac802154 SUBMENU:=$(WPAN_MENU) TITLE:=MAC-802.15.4 support - DEPENDS:=+kmod-ieee802154 +kmod-crypto-aead +kmod-lib-crc-ccitt @!LINUX_3_18 + DEPENDS:=+kmod-ieee802154 +kmod-crypto-aead +kmod-lib-crc-ccitt KCONFIG:= \ CONFIG_MAC802154 \ CONFIG_IEEE802154_DRIVERS=y @@ -56,7 +55,7 @@ $(eval $(call KernelPackage,mac802154)) define KernelPackage/fakelb SUBMENU:=$(WPAN_MENU) TITLE:=Fake LR-WPAN driver - DEPENDS:=+kmod-mac802154 @!LINUX_3_18 + DEPENDS:=+kmod-mac802154 KCONFIG:=CONFIG_IEEE802154_FAKELB FILES:=$(LINUX_DIR)/drivers/net/ieee802154/fakelb.ko AUTOLOAD:=$(call AutoLoad,92,fakelb) @@ -69,6 +68,17 @@ endef $(eval $(call KernelPackage,fakelb)) +define KernelPackage/atusb + SUBMENU:=$(WPAN_MENU) + TITLE:=ATUSB transceiver driver + DEPENDS:=@USB_SUPPORT +kmod-usb-core +kmod-mac802154 + KCONFIG:=CONFIG_IEEE802154_ATUSB + FILES:=$(LINUX_DIR)/drivers/net/ieee802154/atusb.ko + AUTOLOAD:=$(call AutoProbe,atusb) +endef + +$(eval $(call KernelPackage,atusb)) + define KernelPackage/at86rf230 SUBMENU:=$(WPAN_MENU) TITLE:=AT86RF230 transceiver driver @@ -109,7 +119,7 @@ $(eval $(call KernelPackage,cc2520)) define KernelPackage/ieee802154_6lowpan SUBMENU:=$(WPAN_MENU) TITLE:= 6LoWPAN support over IEEE-802.15.4 - DEPENDS:=@!LINUX_3_18 +kmod-6lowpan +kmod-ieee802154 + DEPENDS:=+kmod-6lowpan +kmod-ieee802154 KCONFIG:=CONFIG_IEEE802154_6LOWPAN FILES:= \ $(LINUX_DIR)/net/ieee802154/6lowpan/ieee802154_6lowpan.ko@ge4.0 \ diff --git a/package/kernel/mac80211/Makefile b/package/kernel/mac80211/Makefile index 910b8b3197..904a288df4 100644 --- a/package/kernel/mac80211/Makefile +++ b/package/kernel/mac80211/Makefile @@ -10,10 +10,10 @@ include $(INCLUDE_DIR)/kernel.mk PKG_NAME:=mac80211 -PKG_VERSION:=4.19.23-1 -PKG_RELEASE:=4 -PKG_SOURCE_URL:=@KERNEL/linux/kernel/projects/backports/stable/v4.19.23/ -PKG_HASH:=703e940b542eb56067fcd847a7c69398dcc9829f34472647eea4211cb2ab3b83 +PKG_VERSION:=4.19.66-1 +PKG_RELEASE:=1 +PKG_SOURCE_URL:=@KERNEL/linux/kernel/projects/backports/stable/v4.19.66/ +PKG_HASH:=1f3c6a58cb45b247f6e473d1b52236bfbb41cb3e11e38a74526727e911b51a02 PKG_SOURCE:=backports-$(PKG_VERSION).tar.xz PKG_BUILD_DIR:=$(KERNEL_BUILD_DIR)/backports-$(PKG_VERSION) @@ -22,15 +22,19 @@ PKG_BUILD_PARALLEL:=1 PKG_MAINTAINER:=Felix Fietkau PKG_DRIVERS = \ + adm8211 \ lib80211 \ mac80211-hwsim - + PKG_CONFIG_DEPENDS:= \ CONFIG_PACKAGE_kmod-mac80211 \ CONFIG_PACKAGE_MAC80211_DEBUGFS \ CONFIG_PACKAGE_MAC80211_MESH \ CONFIG_PACKAGE_MAC80211_TRACING \ + CONFIG_PACKAGE_IWLWIFI_DEBUG \ + CONFIG_PACKAGE_IWLWIFI_DEBUGFS \ + CONFIG_PACKAGE_RTLWIFI_DEBUG \ include $(INCLUDE_DIR)/package.mk @@ -55,7 +59,19 @@ config-y:= \ MAC80211_RC_DEFAULT_MINSTREL \ WLAN_VENDOR_ADMTEK \ WLAN_VENDOR_ATH \ - + WLAN_VENDOR_ATMEL \ + WLAN_VENDOR_BROADCOM \ + WLAN_VENDOR_CISCO \ + WLAN_VENDOR_INTEL \ + WLAN_VENDOR_INTERSIL \ + WLAN_VENDOR_MARVELL \ + WLAN_VENDOR_MEDIATEK \ + WLAN_VENDOR_RALINK \ + WLAN_VENDOR_REALTEK \ + WLAN_VENDOR_RSI \ + WLAN_VENDOR_ST \ + WLAN_VENDOR_TI \ + WLAN_VENDOR_ZYDAS \ config-$(call config_package,cfg80211) += CFG80211 @@ -124,6 +140,25 @@ define KernelPackage/mac80211/description Generic IEEE 802.11 Networking Stack (mac80211) endef +define KernelPackage/adm8211 + $(call KernelPackage/mac80211/Default) + TITLE:=ADMTek 8211 support + DEPENDS+=@PCI_SUPPORT +kmod-mac80211 +kmod-eeprom-93cx6 + FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/admtek/adm8211.ko + AUTOLOAD:=$(call AutoProbe,adm8211) +endef + + + + + + + + + + + + define KernelPackage/lib80211 $(call KernelPackage/mac80211/Default) TITLE:=802.11 Networking stack @@ -159,6 +194,25 @@ define KernelPackage/mac80211-hwsim AUTOLOAD:=$(call AutoProbe,mac80211_hwsim) endef + + + + + + + + + + + + + + + + + + + ifdef CONFIG_PACKAGE_MAC80211_DEBUGFS config-y += \ @@ -173,8 +227,16 @@ endif config-$(call config_package,lib80211) += LIB80211 LIB80211_CRYPT_WEP LIB80211_CRYPT_CCMP LIB80211_CRYPT_TKIP + config-$(call config_package,mac80211-hwsim) += MAC80211_HWSIM + + +config-$(call config_package,adm8211) += ADM8211 +config-$(call config_package,rsi91x) += RSI_91X +config-$(call config_package,rsi91x-usb) += RSI_USB +config-$(call config_package,rsi91x-sdio) += RSI_SDIO + config-$(CONFIG_LEDS_TRIGGERS) += MAC80211_LEDS MAKE_OPTS:= -C "$(PKG_BUILD_DIR)" \ @@ -243,6 +305,7 @@ define Build/Patch $(call PatchDir,$(PKG_BUILD_DIR),$(PATCH_DIR)/ath,ath/) $(call PatchDir,$(PKG_BUILD_DIR),$(PATCH_DIR)/rt2x00,rt2x00/) $(call PatchDir,$(PKG_BUILD_DIR),$(PATCH_DIR)/mwl,mwl/) + $(call PatchDir,$(PKG_BUILD_DIR),$(PATCH_DIR)/brcm,brcm/) $(if $(QUILT),touch $(PKG_BUILD_DIR)/.quilt_used) endef @@ -252,6 +315,7 @@ define Quilt/Refresh/Package $(call Quilt/RefreshDir,$(PKG_BUILD_DIR),$(PATCH_DIR)/ath,ath/) $(call Quilt/RefreshDir,$(PKG_BUILD_DIR),$(PATCH_DIR)/rt2x00,rt2x00/) $(call Quilt/RefreshDir,$(PKG_BUILD_DIR),$(PATCH_DIR)/mwl,mwl/) + $(call Quilt/RefreshDir,$(PKG_BUILD_DIR),$(PATCH_DIR)/brcm,brcm/) endef define Build/Compile @@ -274,6 +338,7 @@ define Build/InstallDev endef + define KernelPackage/cfg80211/install $(INSTALL_DIR) $(1)/lib/wifi $(1)/lib/netifd/wireless $(INSTALL_DATA) ./files/lib/wifi/mac80211.sh $(1)/lib/wifi @@ -282,6 +347,7 @@ define KernelPackage/cfg80211/install $(INSTALL_DATA) ./files/mac80211.hotplug $(1)/etc/hotplug.d/ieee80211/10-wifi-detect endef + $(eval $(foreach drv,$(PKG_DRIVERS),$(call KernelPackage,$(drv)))) $(eval $(call KernelPackage,cfg80211)) $(eval $(call KernelPackage,mac80211)) diff --git a/package/kernel/mac80211/ath.mk b/package/kernel/mac80211/ath.mk index 7533f08ba2..224e90d04a 100644 --- a/package/kernel/mac80211/ath.mk +++ b/package/kernel/mac80211/ath.mk @@ -1,5 +1,5 @@ PKG_DRIVERS += \ - ath ath5k ath6kl ath9k ath9k-common ath9k-htc \ + ath ath5k ath9k ath9k-common ath9k-htc \ carl9170 PKG_CONFIG_DEPENDS += \ @@ -49,9 +49,6 @@ else config-y += ATH5K_PCI endif -config-$(call config_package,ath6kl) += ATH6KL -config-$(call config_package,ath6kl-sdio) += ATH6KL_SDIO -config-$(call config_package,ath6kl-usb) += ATH6KL_USB config-$(call config_package,carl9170) += CARL9170 @@ -73,7 +70,7 @@ define KernelPackage/ath/config bool "Atheros wireless debugging" help Say Y, if you want to debug atheros wireless drivers. - Only ath9k makes use of this. + Only ath9k & ath10k make use of this. config PACKAGE_ATH_DFS bool "Enable DFS support" @@ -131,42 +128,10 @@ define KernelPackage/ath5k/description Atheros 5xxx chipset. endef -define KernelPackage/ath6kl - $(call KernelPackage/mac80211/Default) - TITLE:=Atheros FullMAC wireless devices (common code for ath6kl_sdio and ath6kl_usb) - URL:=https://wireless.wiki.kernel.org/en/users/drivers/ath6kl - HIDDEN:=1 - DEPENDS+= +kmod-ath +@DRIVER_11N_SUPPORT - FILES:= $(PKG_BUILD_DIR)/drivers/net/wireless/ath/ath6kl/ath6kl_core.ko -endef -define KernelPackage/ath6kl-sdio - $(call KernelPackage/mac80211/Default) - TITLE:=Atheros 802.11n SDIO wireless cards support - URL:=https://wireless.wiki.kernel.org/en/users/drivers/ath6kl - DEPENDS+= +kmod-mmc +kmod-ath6kl - FILES:= $(PKG_BUILD_DIR)/drivers/net/wireless/ath/ath6kl/ath6kl_sdio.ko - AUTOLOAD:=$(call AutoProbe,ath6kl_sdio) -endef -define KernelPackage/ath6kl-sdio/description -This module adds support for wireless adapters based on -Atheros IEEE 802.11n AR6003 and AR6004 family of chipsets. -endef -define KernelPackage/ath6kl-usb - $(call KernelPackage/mac80211/Default) - TITLE:=Atheros 802.11n USB wireless cards support - URL:=https://wireless.wiki.kernel.org/en/users/drivers/ath6kl - DEPENDS+= @USB_SUPPORT +kmod-usb-core +kmod-ath6kl - FILES:= $(PKG_BUILD_DIR)/drivers/net/wireless/ath/ath6kl/ath6kl_usb.ko - AUTOLOAD:=$(call AutoProbe,ath6kl_usb) -endef -define KernelPackage/ath6kl-usb/description -This module adds support for wireless adapters based on the -Atheros IEEE 802.11n AR6004 chipset. -endef define KernelPackage/ath9k-common $(call KernelPackage/mac80211/Default) @@ -226,6 +191,9 @@ This module adds support for wireless adapters based on Atheros USB AR9271 and AR7010 family of chipsets. endef + + + define KernelPackage/carl9170 $(call KernelPackage/mac80211/Default) TITLE:=Driver for Atheros AR9170 USB sticks diff --git a/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh b/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh index e7d442f8ef..6dc4e5bf5f 100644 --- a/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh +++ b/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh @@ -23,6 +23,7 @@ drv_mac80211_init_device_config() { config_add_string path phy 'macaddr:macaddr' config_add_string hwmode + config_add_string tx_burst config_add_int beacon_int chanbw frag rts config_add_int rxantenna txantenna antenna_gain txpower distance config_add_boolean noscan ht_coex @@ -97,7 +98,10 @@ mac80211_hostapd_setup_base() { [ "$auto_channel" -gt 0 ] && json_get_values channel_list channels json_get_vars noscan ht_coex - json_get_values ht_capab_list ht_capab + json_get_values ht_capab_list ht_capab tx_burst + + [ -n "$noscan" -a "$noscan" -gt 0 ] && hostapd_noscan=1 + [ "$tx_burst" = 0 ] && tx_burst= ieee80211n=1 ht_capab= @@ -227,6 +231,7 @@ mac80211_hostapd_setup_base() { vht_link_adapt:3 \ vht160:2 + set_default tx_burst 2.0 append base_cfg "ieee80211ac=1" "$N" vht_cap=0 for cap in $(iw phy "$phy" info | awk -F "[()]" '/VHT Capabilities/ { print $2 }'); do @@ -307,7 +312,8 @@ mac80211_hostapd_setup_base() { cat >> "$hostapd_conf_file" </dev/null 2>&1 iw phy "$phy" set antenna_gain $antenna_gain iw phy "$phy" set distance "$distance" @@ -795,9 +808,12 @@ drv_mac80211_setup() { has_ap= hostapd_ctrl= + hostapd_noscan= for_each_interface "ap" mac80211_check_ap rm -f "$hostapd_conf_file" + + for_each_interface "sta adhoc mesh" mac80211_set_noscan [ -n "$has_ap" ] && mac80211_hostapd_setup_base "$phy" for_each_interface "sta adhoc mesh monitor" mac80211_prepare_vif diff --git a/package/kernel/mac80211/patches/ath/350-ath9k_hw-reset-AHB-WMAC-interface-on-AR91xx.patch b/package/kernel/mac80211/patches/ath/350-ath9k_hw-reset-AHB-WMAC-interface-on-AR91xx.patch index cadbf6809c..d648a3a3e5 100644 --- a/package/kernel/mac80211/patches/ath/350-ath9k_hw-reset-AHB-WMAC-interface-on-AR91xx.patch +++ b/package/kernel/mac80211/patches/ath/350-ath9k_hw-reset-AHB-WMAC-interface-on-AR91xx.patch @@ -9,7 +9,7 @@ Signed-off-by: Felix Fietkau --- a/drivers/net/wireless/ath/ath9k/hw.c +++ b/drivers/net/wireless/ath/ath9k/hw.c -@@ -1421,8 +1421,12 @@ static bool ath9k_hw_set_reset(struct at +@@ -1435,8 +1435,12 @@ static bool ath9k_hw_set_reset(struct at if (!AR_SREV_9100(ah)) REG_WRITE(ah, AR_RC, 0); diff --git a/package/kernel/mac80211/patches/ath/351-ath9k_hw-issue-external-reset-for-QCA955x.patch b/package/kernel/mac80211/patches/ath/351-ath9k_hw-issue-external-reset-for-QCA955x.patch index ac9e112f51..5f265b84c2 100644 --- a/package/kernel/mac80211/patches/ath/351-ath9k_hw-issue-external-reset-for-QCA955x.patch +++ b/package/kernel/mac80211/patches/ath/351-ath9k_hw-issue-external-reset-for-QCA955x.patch @@ -10,7 +10,7 @@ Signed-off-by: Felix Fietkau --- a/drivers/net/wireless/ath/ath9k/hw.c +++ b/drivers/net/wireless/ath/ath9k/hw.c -@@ -1298,39 +1298,56 @@ void ath9k_hw_get_delta_slope_vals(struc +@@ -1312,39 +1312,56 @@ void ath9k_hw_get_delta_slope_vals(struc *coef_exponent = coef_exp - 16; } @@ -94,7 +94,7 @@ Signed-off-by: Felix Fietkau return true; } -@@ -1383,24 +1400,24 @@ static bool ath9k_hw_set_reset(struct at +@@ -1397,24 +1414,24 @@ static bool ath9k_hw_set_reset(struct at rst_flags |= AR_RTC_RC_MAC_COLD; } diff --git a/package/kernel/mac80211/patches/ath/356-Revert-ath9k-interpret-requested-txpower-in-EIRP-dom.patch b/package/kernel/mac80211/patches/ath/356-Revert-ath9k-interpret-requested-txpower-in-EIRP-dom.patch index 3adcb8b796..1a91265f1b 100644 --- a/package/kernel/mac80211/patches/ath/356-Revert-ath9k-interpret-requested-txpower-in-EIRP-dom.patch +++ b/package/kernel/mac80211/patches/ath/356-Revert-ath9k-interpret-requested-txpower-in-EIRP-dom.patch @@ -8,7 +8,7 @@ This reverts commit 71f5137bf010c6faffab50c0ec15374c59c4a411. --- a/drivers/net/wireless/ath/ath9k/hw.c +++ b/drivers/net/wireless/ath/ath9k/hw.c -@@ -2962,7 +2962,8 @@ void ath9k_hw_apply_txpower(struct ath_h +@@ -2976,7 +2976,8 @@ void ath9k_hw_apply_txpower(struct ath_h { struct ath_regulatory *reg = ath9k_hw_regulatory(ah); struct ieee80211_channel *channel; @@ -18,7 +18,7 @@ This reverts commit 71f5137bf010c6faffab50c0ec15374c59c4a411. u16 ctl = NO_CTL; if (!chan) -@@ -2974,9 +2975,14 @@ void ath9k_hw_apply_txpower(struct ath_h +@@ -2988,9 +2989,14 @@ void ath9k_hw_apply_txpower(struct ath_h channel = chan->chan; chan_pwr = min_t(int, channel->max_power * 2, MAX_RATE_POWER); new_pwr = min_t(int, chan_pwr, reg->power_limit); diff --git a/package/kernel/mac80211/patches/ath/365-ath9k-adjust-tx-power-reduction-for-US-regulatory-do.patch b/package/kernel/mac80211/patches/ath/365-ath9k-adjust-tx-power-reduction-for-US-regulatory-do.patch index cbc2f5ad91..288d4e478c 100644 --- a/package/kernel/mac80211/patches/ath/365-ath9k-adjust-tx-power-reduction-for-US-regulatory-do.patch +++ b/package/kernel/mac80211/patches/ath/365-ath9k-adjust-tx-power-reduction-for-US-regulatory-do.patch @@ -3,7 +3,7 @@ Date: Wed, 19 Jul 2017 08:49:31 +0200 Subject: [PATCH] ath9k: adjust tx power reduction for US regulatory domain -FCC regulatory rules allow for up to 3 dBi antenna gain. Account for +FCC regulatory rules allow for up to 6 dBi antenna gain. Account for this in the EEPROM based tx power reduction code. Signed-off-by: Felix Fietkau @@ -11,13 +11,13 @@ Signed-off-by: Felix Fietkau --- a/drivers/net/wireless/ath/ath9k/hw.c +++ b/drivers/net/wireless/ath/ath9k/hw.c -@@ -2981,6 +2981,10 @@ void ath9k_hw_apply_txpower(struct ath_h +@@ -2995,6 +2995,10 @@ void ath9k_hw_apply_txpower(struct ath_h if (ant_gain > max_gain) ant_reduction = ant_gain - max_gain; -+ /* FCC allows maximum antenna gain of 3 dBi */ ++ /* FCC allows maximum antenna gain of 6 dBi */ + if (reg->region == NL80211_DFS_FCC) -+ ant_reduction = max_t(int, ant_reduction - 6, 0); ++ ant_reduction = max_t(int, ant_reduction - 12, 0); + ah->eep_ops->set_txpower(ah, chan, ctl, ant_reduction, new_pwr, test); diff --git a/package/kernel/mac80211/patches/ath/404-regd_no_assoc_hints.patch b/package/kernel/mac80211/patches/ath/404-regd_no_assoc_hints.patch index ec95206acb..d4c7318377 100644 --- a/package/kernel/mac80211/patches/ath/404-regd_no_assoc_hints.patch +++ b/package/kernel/mac80211/patches/ath/404-regd_no_assoc_hints.patch @@ -1,6 +1,6 @@ --- a/net/wireless/reg.c +++ b/net/wireless/reg.c -@@ -2982,6 +2982,8 @@ void regulatory_hint_country_ie(struct w +@@ -3021,6 +3021,8 @@ void regulatory_hint_country_ie(struct w enum environment_cap env = ENVIRON_ANY; struct regulatory_request *request = NULL, *lr; @@ -9,7 +9,7 @@ /* IE len must be evenly divisible by 2 */ if (country_ie_len & 0x01) return; -@@ -3188,6 +3190,7 @@ static void restore_regulatory_settings( +@@ -3227,6 +3229,7 @@ static void restore_regulatory_settings( void regulatory_hint_disconnect(void) { diff --git a/package/kernel/mac80211/patches/ath/510-ath9k_intr_mitigation_tweak.patch b/package/kernel/mac80211/patches/ath/510-ath9k_intr_mitigation_tweak.patch index 356939a354..75b48b480e 100644 --- a/package/kernel/mac80211/patches/ath/510-ath9k_intr_mitigation_tweak.patch +++ b/package/kernel/mac80211/patches/ath/510-ath9k_intr_mitigation_tweak.patch @@ -1,6 +1,6 @@ --- a/drivers/net/wireless/ath/ath9k/hw.c +++ b/drivers/net/wireless/ath/ath9k/hw.c -@@ -392,13 +392,8 @@ static void ath9k_hw_init_config(struct +@@ -403,13 +403,8 @@ static void ath9k_hw_init_config(struct ah->config.rx_intr_mitigation = true; diff --git a/package/kernel/mac80211/patches/ath/513-ath9k_add_pci_ids.patch b/package/kernel/mac80211/patches/ath/513-ath9k_add_pci_ids.patch index e536e60794..113c35625f 100644 --- a/package/kernel/mac80211/patches/ath/513-ath9k_add_pci_ids.patch +++ b/package/kernel/mac80211/patches/ath/513-ath9k_add_pci_ids.patch @@ -1,6 +1,6 @@ --- a/drivers/net/wireless/ath/ath9k/hw.c +++ b/drivers/net/wireless/ath/ath9k/hw.c -@@ -649,6 +649,7 @@ int ath9k_hw_init(struct ath_hw *ah) +@@ -663,6 +663,7 @@ int ath9k_hw_init(struct ath_hw *ah) /* These are all the AR5008/AR9001/AR9002/AR9003 hardware family of chipsets */ switch (ah->hw_version.devid) { diff --git a/package/kernel/mac80211/patches/ath/542-ath9k_debugfs_diag.patch b/package/kernel/mac80211/patches/ath/542-ath9k_debugfs_diag.patch index 55896c834b..e627c38495 100644 --- a/package/kernel/mac80211/patches/ath/542-ath9k_debugfs_diag.patch +++ b/package/kernel/mac80211/patches/ath/542-ath9k_debugfs_diag.patch @@ -94,7 +94,7 @@ struct ath_gen_timer *ath_gen_timer_alloc(struct ath_hw *ah, --- a/drivers/net/wireless/ath/ath9k/hw.c +++ b/drivers/net/wireless/ath/ath9k/hw.c -@@ -1869,6 +1869,20 @@ u32 ath9k_hw_get_tsf_offset(struct times +@@ -1883,6 +1883,20 @@ u32 ath9k_hw_get_tsf_offset(struct times } EXPORT_SYMBOL(ath9k_hw_get_tsf_offset); @@ -115,7 +115,7 @@ int ath9k_hw_reset(struct ath_hw *ah, struct ath9k_channel *chan, struct ath9k_hw_cal_data *caldata, bool fastcc) { -@@ -2077,6 +2091,7 @@ int ath9k_hw_reset(struct ath_hw *ah, st +@@ -2091,6 +2105,7 @@ int ath9k_hw_reset(struct ath_hw *ah, st ar9003_hw_disable_phy_restart(ah); ath9k_hw_apply_gpio_override(ah); diff --git a/package/kernel/mac80211/patches/ath/544-ath9k-ar933x-usb-hang-workaround.patch b/package/kernel/mac80211/patches/ath/544-ath9k-ar933x-usb-hang-workaround.patch index ba8f1e5d61..93eee34b64 100644 --- a/package/kernel/mac80211/patches/ath/544-ath9k-ar933x-usb-hang-workaround.patch +++ b/package/kernel/mac80211/patches/ath/544-ath9k-ar933x-usb-hang-workaround.patch @@ -20,7 +20,7 @@ /******************/ /* Chip Revisions */ /******************/ -@@ -1441,6 +1454,9 @@ static bool ath9k_hw_set_reset(struct at +@@ -1455,6 +1468,9 @@ static bool ath9k_hw_set_reset(struct at udelay(50); } @@ -30,7 +30,7 @@ return true; } -@@ -1540,6 +1556,9 @@ static bool ath9k_hw_chip_reset(struct a +@@ -1554,6 +1570,9 @@ static bool ath9k_hw_chip_reset(struct a ar9003_hw_internal_regulator_apply(ah); ath9k_hw_init_pll(ah, chan); @@ -40,7 +40,7 @@ return true; } -@@ -1847,8 +1866,14 @@ static int ath9k_hw_do_fastcc(struct ath +@@ -1861,8 +1880,14 @@ static int ath9k_hw_do_fastcc(struct ath if (AR_SREV_9271(ah)) ar9002_hw_load_ani_reg(ah, chan); @@ -55,7 +55,7 @@ return -EINVAL; } -@@ -2102,6 +2127,9 @@ int ath9k_hw_reset(struct ath_hw *ah, st +@@ -2116,6 +2141,9 @@ int ath9k_hw_reset(struct ath_hw *ah, st ath9k_hw_set_radar_params(ah); } diff --git a/package/kernel/mac80211/patches/ath/558-ath9k-dynack-introduce-ath_dynack_set_timeout-routin.patch b/package/kernel/mac80211/patches/ath/558-ath9k-dynack-introduce-ath_dynack_set_timeout-routin.patch new file mode 100644 index 0000000000..e13a15026e --- /dev/null +++ b/package/kernel/mac80211/patches/ath/558-ath9k-dynack-introduce-ath_dynack_set_timeout-routin.patch @@ -0,0 +1,94 @@ +From 4420866ef1b602682b009e0186fbb8aefd2125be Mon Sep 17 00:00:00 2001 +From: Lorenzo Bianconi +Date: Tue, 20 Aug 2019 18:20:19 +0200 +Subject: [PATCH 1/4] ath9k: dynack: introduce ath_dynack_set_timeout routine + +Introduce ath_dynack_set_timeout routine to configure slottime/ack/cts +timeouts and remove duplicated code + +Tested-by: Koen Vandeputte +Signed-off-by: Lorenzo Bianconi +--- + drivers/net/wireless/ath/ath9k/dynack.c | 37 ++++++++++++++----------- + 1 file changed, 21 insertions(+), 16 deletions(-) + +diff --git a/drivers/net/wireless/ath/ath9k/dynack.c b/drivers/net/wireless/ath/ath9k/dynack.c +index f112fa5b2eac..38dbe25919f7 100644 +--- a/drivers/net/wireless/ath/ath9k/dynack.c ++++ b/drivers/net/wireless/ath/ath9k/dynack.c +@@ -78,6 +78,24 @@ static inline bool ath_dynack_bssidmask(struct ath_hw *ah, const u8 *mac) + return true; + } + ++/** ++ * ath_dynack_set_timeout - configure timeouts/slottime registers ++ * @ah: ath hw ++ * @to: timeout value ++ * ++ */ ++static void ath_dynack_set_timeout(struct ath_hw *ah, int to) ++{ ++ struct ath_common *common = ath9k_hw_common(ah); ++ int slottime = (to - 3) / 2; ++ ++ ath_dbg(common, DYNACK, "ACK timeout %u slottime %u\n", ++ to, slottime); ++ ath9k_hw_setslottime(ah, slottime); ++ ath9k_hw_set_ack_timeout(ah, to); ++ ath9k_hw_set_cts_timeout(ah, to); ++} ++ + /** + * ath_dynack_compute_ackto - compute ACK timeout as the maximum STA timeout + * @ah: ath hw +@@ -86,7 +104,6 @@ static inline bool ath_dynack_bssidmask(struct ath_hw *ah, const u8 *mac) + */ + static void ath_dynack_compute_ackto(struct ath_hw *ah) + { +- struct ath_common *common = ath9k_hw_common(ah); + struct ath_dynack *da = &ah->dynack; + struct ath_node *an; + int to = 0; +@@ -96,15 +113,8 @@ static void ath_dynack_compute_ackto(struct ath_hw *ah) + to = an->ackto; + + if (to && da->ackto != to) { +- u32 slottime; +- +- slottime = (to - 3) / 2; ++ ath_dynack_set_timeout(ah, to); + da->ackto = to; +- ath_dbg(common, DYNACK, "ACK timeout %u slottime %u\n", +- da->ackto, slottime); +- ath9k_hw_setslottime(ah, slottime); +- ath9k_hw_set_ack_timeout(ah, da->ackto); +- ath9k_hw_set_cts_timeout(ah, da->ackto); + } + } + +@@ -198,10 +208,7 @@ void ath_dynack_sample_tx_ts(struct ath_hw *ah, struct sk_buff *skb, + ieee80211_is_assoc_resp(hdr->frame_control) || + ieee80211_is_auth(hdr->frame_control)) { + ath_dbg(common, DYNACK, "late ack\n"); +- +- ath9k_hw_setslottime(ah, (LATEACK_TO - 3) / 2); +- ath9k_hw_set_ack_timeout(ah, LATEACK_TO); +- ath9k_hw_set_cts_timeout(ah, LATEACK_TO); ++ ath_dynack_set_timeout(ah, LATEACK_TO); + if (sta) { + struct ath_node *an; + +@@ -340,9 +347,7 @@ void ath_dynack_reset(struct ath_hw *ah) + da->ack_rbf.h_rb = 0; + + /* init acktimeout */ +- ath9k_hw_setslottime(ah, (ackto - 3) / 2); +- ath9k_hw_set_ack_timeout(ah, ackto); +- ath9k_hw_set_cts_timeout(ah, ackto); ++ ath_dynack_set_timeout(ah, ackto); + } + EXPORT_SYMBOL(ath_dynack_reset); + +-- +2.17.1 + diff --git a/package/kernel/mac80211/patches/ath/558-ath9k-only-mask-use_eeprom-on-of-noeeprom.patch b/package/kernel/mac80211/patches/ath/558-ath9k-only-mask-use_eeprom-on-of-noeeprom.patch deleted file mode 100644 index 93f43c8983..0000000000 --- a/package/kernel/mac80211/patches/ath/558-ath9k-only-mask-use_eeprom-on-of-noeeprom.patch +++ /dev/null @@ -1,73 +0,0 @@ -ath9k: Avoid OF no-EEPROM quirks without qca,no-eeprom - -ath9k_of_init() function[0] was initially written on the assumption that -if someone had an explicit ath9k OF node that "there must be something -wrong, why would someone add an OF node if everything is fine"[1] -(Quoting Martin Blumenstingl) - -"it turns out it's not that simple. with your requirements I'm now aware -of two use-cases where the current code in ath9k_of_init() doesn't work -without modifications"[1] - -The "your requirements" Martin speaks of is the result of the fact that I -have a device (PowerCloud Systems CR5000) that uses the EEPROM for -caldata and firmware but for which the MAC address is take from the MTD -"art" partition[2], or more succinctly: - -"some cards come with a physical EEPROM chip so "qca,no-eeprom" should not -be set (your use-case). in this case AH_USE_EEPROM should be set (which -is the default when there is no OF node)"[1] - -The other use case is: - -the firmware on some PowerMac G5 seems to add a OF node for the ath9k -card automatically. depending on the EEPROM on the card AH_NO_EEP_SWAP -should be unset (which is the default when there is no OF node). see [3] - -After this patch to ath9k_of_init() the new behavior will be: - - if there's no OF node then everything is the same as before - if there's an empty OF node then ath9k will use the hardware EEPROM - (before ath9k would fail to initialize because no EEPROM data was - provided by userspace) - if there's an OF node with only a MAC address then ath9k will use - the MAC address and the hardware EEPROM (see the case above) - with "qca,no-eeprom" EEPROM data from userspace will be requested. - the behavior here will not change -[1] - -Martin provides additional background on EEPROM swapping[1] which I have -included in the patch annotation but not the commit message. - -Thanks to Christian Lampartar for all his help on -troubleshooting this issue and the basis for this patch. - -Fixes: 138b41253d9c ("ath9k: parse the device configuration from an OF node") - -[0]https://elixir.bootlin.com/linux/v4.20-rc7/source/drivers/net/wireless/ath/ath9k/init.c#L615 -[1]https://github.com/librecmc/librecmc/pull/1645#issuecomment-448027058 -[2]https://github.com/librecmc/librecmc/pull/1613 -[3]https://patchwork.kernel.org/patch/10241731/ - -Signed-off-by: Daniel F. Dickinson ---- a/drivers/net/wireless/ath/ath9k/init.c -+++ b/drivers/net/wireless/ath/ath9k/init.c -@@ -642,15 +642,15 @@ static int ath9k_of_init(struct ath_soft - ret = ath9k_eeprom_request(sc, eeprom_name); - if (ret) - return ret; -+ -+ ah->ah_flags &= ~AH_USE_EEPROM; -+ ah->ah_flags |= AH_NO_EEP_SWAP; - } - - mac = of_get_mac_address(np); - if (mac) - ether_addr_copy(common->macaddr, mac); - -- ah->ah_flags &= ~AH_USE_EEPROM; -- ah->ah_flags |= AH_NO_EEP_SWAP; -- - return 0; - } - diff --git a/package/kernel/mac80211/patches/ath/559-ath9k-dynack-properly-set-last-timeout-timestamp-in-.patch b/package/kernel/mac80211/patches/ath/559-ath9k-dynack-properly-set-last-timeout-timestamp-in-.patch new file mode 100644 index 0000000000..9504af1419 --- /dev/null +++ b/package/kernel/mac80211/patches/ath/559-ath9k-dynack-properly-set-last-timeout-timestamp-in-.patch @@ -0,0 +1,32 @@ +From e5b56ce50eab31d24df6a70cf025db3acc4aa3ac Mon Sep 17 00:00:00 2001 +From: Lorenzo Bianconi +Date: Tue, 20 Aug 2019 18:20:20 +0200 +Subject: [PATCH 2/4] ath9k: dynack: properly set last timeout timestamp in + ath_dynack_reset + +Add compute timeout to last computation timestamp in +ath_dynack_reset in order to not run ath_dynack_compute_ackto +immediately + +Tested-by: Koen Vandeputte +Signed-off-by: Lorenzo Bianconi +--- + drivers/net/wireless/ath/ath9k/dynack.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/net/wireless/ath/ath9k/dynack.c b/drivers/net/wireless/ath/ath9k/dynack.c +index 38dbe25919f7..398ea872751f 100644 +--- a/drivers/net/wireless/ath/ath9k/dynack.c ++++ b/drivers/net/wireless/ath/ath9k/dynack.c +@@ -338,7 +338,7 @@ void ath_dynack_reset(struct ath_hw *ah) + u32 ackto = 9 + 16 + 64; + struct ath_dynack *da = &ah->dynack; + +- da->lto = jiffies; ++ da->lto = jiffies + COMPUTE_TO; + da->ackto = ackto; + + da->st_rbf.t_rb = 0; +-- +2.17.1 + diff --git a/package/kernel/mac80211/patches/ath/560-ath9k-dynack-set-max-timeout-according-to-channel-wi.patch b/package/kernel/mac80211/patches/ath/560-ath9k-dynack-set-max-timeout-according-to-channel-wi.patch new file mode 100644 index 0000000000..f40289cca4 --- /dev/null +++ b/package/kernel/mac80211/patches/ath/560-ath9k-dynack-set-max-timeout-according-to-channel-wi.patch @@ -0,0 +1,96 @@ +From 3f737abb7d53cc80d619a3b4a30b6fa63cdc8df7 Mon Sep 17 00:00:00 2001 +From: Lorenzo Bianconi +Date: Tue, 20 Aug 2019 18:20:21 +0200 +Subject: [PATCH 3/4] ath9k: dynack: set max timeout according to channel width + +Compute maximum configurable ackimeout/ctstimeout according to channel +width (clockrate) + +Tested-by: Koen Vandeputte +Signed-off-by: Lorenzo Bianconi +--- + drivers/net/wireless/ath/ath9k/dynack.c | 38 +++++++++++++++++++------ + 1 file changed, 30 insertions(+), 8 deletions(-) + +diff --git a/drivers/net/wireless/ath/ath9k/dynack.c b/drivers/net/wireless/ath/ath9k/dynack.c +index 398ea872751f..fe9181533de3 100644 +--- a/drivers/net/wireless/ath/ath9k/dynack.c ++++ b/drivers/net/wireless/ath/ath9k/dynack.c +@@ -20,11 +20,30 @@ + + #define COMPUTE_TO (5 * HZ) + #define LATEACK_DELAY (10 * HZ) +-#define LATEACK_TO 256 +-#define MAX_DELAY 300 + #define EWMA_LEVEL 96 + #define EWMA_DIV 128 + ++/** ++ * ath_dynack_get_max_to - set max timeout according to channel width ++ * @ah: ath hw ++ * ++ */ ++static u32 ath_dynack_get_max_to(struct ath_hw *ah) ++{ ++ const struct ath9k_channel *chan = ah->curchan; ++ ++ if (!chan) ++ return 300; ++ ++ if (IS_CHAN_HT40(chan)) ++ return 300; ++ if (IS_CHAN_HALF_RATE(chan)) ++ return 750; ++ if (IS_CHAN_QUARTER_RATE(chan)) ++ return 1500; ++ return 600; ++} ++ + /** + * ath_dynack_ewma - EWMA (Exponentially Weighted Moving Average) calculation + * +@@ -126,15 +145,16 @@ static void ath_dynack_compute_ackto(struct ath_hw *ah) + */ + static void ath_dynack_compute_to(struct ath_hw *ah) + { +- u32 ackto, ack_ts; +- u8 *dst, *src; ++ struct ath_dynack *da = &ah->dynack; ++ u32 ackto, ack_ts, max_to; + struct ieee80211_sta *sta; +- struct ath_node *an; + struct ts_info *st_ts; +- struct ath_dynack *da = &ah->dynack; ++ struct ath_node *an; ++ u8 *dst, *src; + + rcu_read_lock(); + ++ max_to = ath_dynack_get_max_to(ah); + while (da->st_rbf.h_rb != da->st_rbf.t_rb && + da->ack_rbf.h_rb != da->ack_rbf.t_rb) { + ack_ts = da->ack_rbf.tstamp[da->ack_rbf.h_rb]; +@@ -150,7 +170,7 @@ static void ath_dynack_compute_to(struct ath_hw *ah) + if (ack_ts > st_ts->tstamp + st_ts->dur) { + ackto = ack_ts - st_ts->tstamp - st_ts->dur; + +- if (ackto < MAX_DELAY) { ++ if (ackto < max_to) { + sta = ieee80211_find_sta_by_ifaddr(ah->hw, dst, + src); + if (sta) { +@@ -207,8 +227,10 @@ void ath_dynack_sample_tx_ts(struct ath_hw *ah, struct sk_buff *skb, + if (ieee80211_is_assoc_req(hdr->frame_control) || + ieee80211_is_assoc_resp(hdr->frame_control) || + ieee80211_is_auth(hdr->frame_control)) { ++ u32 max_to = ath_dynack_get_max_to(ah); ++ + ath_dbg(common, DYNACK, "late ack\n"); +- ath_dynack_set_timeout(ah, LATEACK_TO); ++ ath_dynack_set_timeout(ah, max_to); + if (sta) { + struct ath_node *an; + +-- +2.17.1 + diff --git a/package/kernel/mac80211/patches/ath/561-ath9k-dynack-set-ackto-to-max-timeout-in-ath_dynack_.patch b/package/kernel/mac80211/patches/ath/561-ath9k-dynack-set-ackto-to-max-timeout-in-ath_dynack_.patch new file mode 100644 index 0000000000..5b75096e19 --- /dev/null +++ b/package/kernel/mac80211/patches/ath/561-ath9k-dynack-set-ackto-to-max-timeout-in-ath_dynack_.patch @@ -0,0 +1,78 @@ +From cc783bfa67e87d2e6206f7626b7bbb74d5c5f269 Mon Sep 17 00:00:00 2001 +From: Lorenzo Bianconi +Date: Tue, 20 Aug 2019 18:20:22 +0200 +Subject: [PATCH 4/4] ath9k: dynack: set ackto to max timeout in + ath_dynack_reset + +Initialize acktimeout to the maximum configurable value in +ath_dynack_reset in order to not disconnect long distance static links +enabling dynack and even to take care of possible errors configuring +a static timeout. Moreover initialize station timeout value to the current +acktimeout value + +Tested-by: Koen Vandeputte +Signed-off-by: Lorenzo Bianconi +--- + drivers/net/wireless/ath/ath9k/dynack.c | 20 +++++++++++++------- + 1 file changed, 13 insertions(+), 7 deletions(-) + +diff --git a/drivers/net/wireless/ath/ath9k/dynack.c b/drivers/net/wireless/ath/ath9k/dynack.c +index fe9181533de3..f786be04d0ac 100644 +--- a/drivers/net/wireless/ath/ath9k/dynack.c ++++ b/drivers/net/wireless/ath/ath9k/dynack.c +@@ -321,11 +321,9 @@ EXPORT_SYMBOL(ath_dynack_sample_ack_ts); + */ + void ath_dynack_node_init(struct ath_hw *ah, struct ath_node *an) + { +- /* ackto = slottime + sifs + air delay */ +- u32 ackto = 9 + 16 + 64; + struct ath_dynack *da = &ah->dynack; + +- an->ackto = ackto; ++ an->ackto = da->ackto; + + spin_lock(&da->qlock); + list_add_tail(&an->list, &da->nodes); +@@ -356,20 +354,26 @@ EXPORT_SYMBOL(ath_dynack_node_deinit); + */ + void ath_dynack_reset(struct ath_hw *ah) + { +- /* ackto = slottime + sifs + air delay */ +- u32 ackto = 9 + 16 + 64; + struct ath_dynack *da = &ah->dynack; ++ struct ath_node *an; ++ ++ spin_lock_bh(&da->qlock); + + da->lto = jiffies + COMPUTE_TO; +- da->ackto = ackto; + + da->st_rbf.t_rb = 0; + da->st_rbf.h_rb = 0; + da->ack_rbf.t_rb = 0; + da->ack_rbf.h_rb = 0; + ++ da->ackto = ath_dynack_get_max_to(ah); ++ list_for_each_entry(an, &da->nodes, list) ++ an->ackto = da->ackto; ++ + /* init acktimeout */ +- ath_dynack_set_timeout(ah, ackto); ++ ath_dynack_set_timeout(ah, da->ackto); ++ ++ spin_unlock_bh(&da->qlock); + } + EXPORT_SYMBOL(ath_dynack_reset); + +@@ -386,6 +390,8 @@ void ath_dynack_init(struct ath_hw *ah) + + spin_lock_init(&da->qlock); + INIT_LIST_HEAD(&da->nodes); ++ /* ackto = slottime + sifs + air delay */ ++ da->ackto = 9 + 16 + 64; + + ah->hw->wiphy->features |= NL80211_FEATURE_ACKTO_ESTIMATION; + } +-- +2.17.1 + diff --git a/package/kernel/mac80211/patches/build/001-fix_build.patch b/package/kernel/mac80211/patches/build/001-fix_build.patch index 9e272e90af..e57ca190e4 100644 --- a/package/kernel/mac80211/patches/build/001-fix_build.patch +++ b/package/kernel/mac80211/patches/build/001-fix_build.patch @@ -27,7 +27,7 @@ @set -e ; test -f local-symbols || ( \ echo "/--------------" ;\ echo "| You shouldn't run make in the backports tree, but only in" ;\ -@@ -60,57 +62,61 @@ mrproper: +@@ -60,58 +62,62 @@ mrproper: echo "| (that isn't currently running.)" ;\ echo "\\--" ;\ false) @@ -56,12 +56,13 @@ - done \ - ) > Kconfig.kernel ;\ - kver=$$($(MAKE) --no-print-directory -C $(KLIB_BUILD) kernelversion | \ -- sed 's/^\(\([3-4]\|2\.6\)\.[0-9]\+\).*/\1/;t;d') ;\ +- sed 's/^\(\([3-5]\|2\.6\)\.[0-9]\+\).*/\1/;t;d') ;\ - test "$$kver" != "" || echo "Kernel version parse failed!" ;\ - test "$$kver" != "" ;\ - kvers="$$(seq 14 39 | sed 's/^/2.6./')" ;\ - kvers="$$kvers $$(seq 0 19 | sed 's/^/3./')" ;\ -- kvers="$$kvers $$(seq 0 99 | sed 's/^/4./')" ;\ +- kvers="$$kvers $$(seq 0 20 | sed 's/^/4./')" ;\ +- kvers="$$kvers $$(seq 0 99 | sed 's/^/5./')" ;\ - print=0 ;\ - for v in $$kvers ; do \ - if [ "$$print" = "1" ] ; then \ @@ -112,12 +113,13 @@ + +Kconfig.versions: Kconfig.kernel + @kver=$$($(MAKE) --no-print-directory -C $(KLIB_BUILD) kernelversion | \ -+ sed 's/^\(\([3-4]\|2\.6\)\.[0-9]\+\).*/\1/;t;d') ;\ ++ sed 's/^\(\([3-5]\|2\.6\)\.[0-9]\+\).*/\1/;t;d') ;\ + test "$$kver" != "" || echo "Kernel version parse failed!" ;\ + test "$$kver" != "" ;\ + kvers="$$(seq 14 39 | sed 's/^/2.6./')" ;\ + kvers="$$kvers $$(seq 0 19 | sed 's/^/3./')" ;\ -+ kvers="$$kvers $$(seq 0 99 | sed 's/^/4./')" ;\ ++ kvers="$$kvers $$(seq 0 20 | sed 's/^/4./')" ;\ ++ kvers="$$kvers $$(seq 0 99 | sed 's/^/5./')" ;\ + print=0 ;\ + for v in $$kvers ; do \ + if [ "$$print" = "1" ] ; then \ diff --git a/package/kernel/mac80211/patches/rt2x00/004-rt2x00-do-not-check-for-txstatus-timeout-every-time-.patch b/package/kernel/mac80211/patches/rt2x00/004-rt2x00-do-not-check-for-txstatus-timeout-every-time-.patch index 832768d042..3e76379fa4 100644 --- a/package/kernel/mac80211/patches/rt2x00/004-rt2x00-do-not-check-for-txstatus-timeout-every-time-.patch +++ b/package/kernel/mac80211/patches/rt2x00/004-rt2x00-do-not-check-for-txstatus-timeout-every-time-.patch @@ -51,7 +51,7 @@ Signed-off-by: Kalle Valo rt2800mmio_enable_interrupt(rt2x00dev, --- a/drivers/net/wireless/ralink/rt2x00/rt2x00.h +++ b/drivers/net/wireless/ralink/rt2x00/rt2x00.h -@@ -980,6 +980,8 @@ struct rt2x00_dev { +@@ -979,6 +979,8 @@ struct rt2x00_dev { */ DECLARE_KFIFO_PTR(txstatus_fifo, u32); @@ -62,7 +62,7 @@ Signed-off-by: Kalle Valo */ --- a/drivers/net/wireless/ralink/rt2x00/rt2x00queue.c +++ b/drivers/net/wireless/ralink/rt2x00/rt2x00queue.c -@@ -1039,6 +1039,7 @@ void rt2x00queue_start_queues(struct rt2 +@@ -1042,6 +1042,7 @@ void rt2x00queue_start_queues(struct rt2 */ tx_queue_for_each(rt2x00dev, queue) rt2x00queue_start_queue(queue); diff --git a/package/kernel/mac80211/patches/rt2x00/005-rt2x00-use-different-txstatus-timeouts-when-flushing.patch b/package/kernel/mac80211/patches/rt2x00/005-rt2x00-use-different-txstatus-timeouts-when-flushing.patch index 0f29026373..f2839941af 100644 --- a/package/kernel/mac80211/patches/rt2x00/005-rt2x00-use-different-txstatus-timeouts-when-flushing.patch +++ b/package/kernel/mac80211/patches/rt2x00/005-rt2x00-use-different-txstatus-timeouts-when-flushing.patch @@ -97,7 +97,7 @@ Signed-off-by: Kalle Valo * Driver configuration --- a/drivers/net/wireless/ralink/rt2x00/rt2x00mac.c +++ b/drivers/net/wireless/ralink/rt2x00/rt2x00mac.c -@@ -720,8 +720,12 @@ void rt2x00mac_flush(struct ieee80211_hw +@@ -710,8 +710,12 @@ void rt2x00mac_flush(struct ieee80211_hw if (!test_bit(DEVICE_STATE_PRESENT, &rt2x00dev->flags)) return; diff --git a/package/kernel/mac80211/patches/rt2x00/020-cfg80211-add-ratelimited-variants-of-err-and-warn.patch b/package/kernel/mac80211/patches/rt2x00/020-cfg80211-add-ratelimited-variants-of-err-and-warn.patch new file mode 100644 index 0000000000..bea1884489 --- /dev/null +++ b/package/kernel/mac80211/patches/rt2x00/020-cfg80211-add-ratelimited-variants-of-err-and-warn.patch @@ -0,0 +1,39 @@ +From patchwork Tue Mar 12 09:51:40 2019 +Content-Type: text/plain; charset="utf-8" +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +X-Patchwork-Submitter: Stanislaw Gruszka +X-Patchwork-Id: 10848957 +X-Patchwork-Delegate: johannes@sipsolutions.net +From: Stanislaw Gruszka +To: linux-wireless@vger.kernel.org +Cc: =?utf-8?q?Tomislav_Po=C5=BEega?= , + Daniel Golle , Felix Fietkau , + Mathias Kresin +Subject: [PATCH v3 1/4] cfg80211: add ratelimited variants of err and warn +Date: Tue, 12 Mar 2019 10:51:40 +0100 +Message-Id: <1552384303-29529-2-git-send-email-sgruszka@redhat.com> +In-Reply-To: <1552384303-29529-1-git-send-email-sgruszka@redhat.com> +References: <1552384303-29529-1-git-send-email-sgruszka@redhat.com> + +wiphy_{err,warn}_ratelimited will be used by rt2x00 + +Signed-off-by: Stanislaw Gruszka +--- + include/net/cfg80211.h | 5 +++++ + 1 file changed, 5 insertions(+) + +--- a/include/net/cfg80211.h ++++ b/include/net/cfg80211.h +@@ -6597,6 +6597,11 @@ int cfg80211_external_auth_request(struc + #define wiphy_info(wiphy, format, args...) \ + dev_info(&(wiphy)->dev, format, ##args) + ++#define wiphy_err_ratelimited(wiphy, format, args...) \ ++ dev_err_ratelimited(&(wiphy)->dev, format, ##args) ++#define wiphy_warn_ratelimited(wiphy, format, args...) \ ++ dev_warn_ratelimited(&(wiphy)->dev, format, ##args) ++ + #define wiphy_debug(wiphy, format, args...) \ + wiphy_printk(KERN_DEBUG, wiphy, format, ##args) + diff --git a/package/kernel/mac80211/patches/rt2x00/020-rt2x00-do-not-print-error-when-queue-is-full.patch b/package/kernel/mac80211/patches/rt2x00/020-rt2x00-do-not-print-error-when-queue-is-full.patch deleted file mode 100644 index 5098672ac3..0000000000 --- a/package/kernel/mac80211/patches/rt2x00/020-rt2x00-do-not-print-error-when-queue-is-full.patch +++ /dev/null @@ -1,33 +0,0 @@ -From 1a8a8989b779e51e4652a30e9f22c36a1b6ffc4b Mon Sep 17 00:00:00 2001 -From: Stanislaw Gruszka -Date: Thu, 20 Dec 2018 16:16:11 +0100 -X-Patchwork-Submitter: Stanislaw Gruszka -X-Patchwork-Id: 10739037 -X-Patchwork-Delegate: kvalo@adurom.com -Subject: [PATCH 20/28] rt2x00: do not print error when queue is full - -For unknown reasons printk() on some context can cause CPU hung on -embedded MT7620 AP/router MIPS platforms. What can result on wifi -disconnects. - -This patch move queue full messages to debug level what is consistent -with other mac80211 drivers which drop packet silently if tx queue is -full. This make MT7620 OpenWRT routers more stable, what was reported -by various users. - -Signed-off-by: Stanislaw Gruszka ---- - drivers/net/wireless/ralink/rt2x00/rt2x00queue.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - ---- a/drivers/net/wireless/ralink/rt2x00/rt2x00queue.c -+++ b/drivers/net/wireless/ralink/rt2x00/rt2x00queue.c -@@ -671,7 +671,7 @@ int rt2x00queue_write_tx_frame(struct da - spin_lock(&queue->tx_lock); - - if (unlikely(rt2x00queue_full(queue))) { -- rt2x00_err(queue->rt2x00dev, "Dropping frame due to full tx queue %d\n", -+ rt2x00_dbg(queue->rt2x00dev, "Dropping frame due to full tx queue %d\n", - queue->qid); - ret = -ENOBUFS; - goto out; diff --git a/package/kernel/mac80211/patches/rt2x00/021-rt2x00-use-ratelimited-variants-dev_warn-dev_err.patch b/package/kernel/mac80211/patches/rt2x00/021-rt2x00-use-ratelimited-variants-dev_warn-dev_err.patch new file mode 100644 index 0000000000..2d74a71e1f --- /dev/null +++ b/package/kernel/mac80211/patches/rt2x00/021-rt2x00-use-ratelimited-variants-dev_warn-dev_err.patch @@ -0,0 +1,42 @@ +From patchwork Tue Mar 12 09:51:41 2019 +Content-Type: text/plain; charset="utf-8" +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +X-Patchwork-Submitter: Stanislaw Gruszka +X-Patchwork-Id: 10848959 +X-Patchwork-Delegate: kvalo@adurom.com +From: Stanislaw Gruszka +To: linux-wireless@vger.kernel.org +Cc: =?utf-8?q?Tomislav_Po=C5=BEega?= , + Daniel Golle , Felix Fietkau , + Mathias Kresin +Subject: [PATCH v3 2/4] rt2x00: use ratelimited variants dev_warn/dev_err +Date: Tue, 12 Mar 2019 10:51:41 +0100 +Message-Id: <1552384303-29529-3-git-send-email-sgruszka@redhat.com> +In-Reply-To: <1552384303-29529-1-git-send-email-sgruszka@redhat.com> +References: <1552384303-29529-1-git-send-email-sgruszka@redhat.com> + +As reported by Randy we can overwhelm logs on some USB error conditions. +To avoid that use dev_warn_ratelimited() and dev_err_ratelimitd(). + +Reported-and-tested-by: Randy Oostdyk +Signed-off-by: Stanislaw Gruszka +--- + drivers/net/wireless/ralink/rt2x00/rt2x00.h | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +--- a/drivers/net/wireless/ralink/rt2x00/rt2x00.h ++++ b/drivers/net/wireless/ralink/rt2x00/rt2x00.h +@@ -69,10 +69,10 @@ + printk(KERN_ERR KBUILD_MODNAME ": %s: Error - " fmt, \ + __func__, ##__VA_ARGS__) + #define rt2x00_err(dev, fmt, ...) \ +- wiphy_err((dev)->hw->wiphy, "%s: Error - " fmt, \ ++ wiphy_err_ratelimited((dev)->hw->wiphy, "%s: Error - " fmt, \ + __func__, ##__VA_ARGS__) + #define rt2x00_warn(dev, fmt, ...) \ +- wiphy_warn((dev)->hw->wiphy, "%s: Warning - " fmt, \ ++ wiphy_warn_ratelimited((dev)->hw->wiphy, "%s: Warning - " fmt, \ + __func__, ##__VA_ARGS__) + #define rt2x00_info(dev, fmt, ...) \ + wiphy_info((dev)->hw->wiphy, "%s: Info - " fmt, \ diff --git a/package/kernel/mac80211/patches/rt2x00/022-rt2x00-check-number-of-EPROTO-errors.patch b/package/kernel/mac80211/patches/rt2x00/022-rt2x00-check-number-of-EPROTO-errors.patch new file mode 100644 index 0000000000..c1754694bd --- /dev/null +++ b/package/kernel/mac80211/patches/rt2x00/022-rt2x00-check-number-of-EPROTO-errors.patch @@ -0,0 +1,96 @@ +From patchwork Tue Mar 12 09:51:42 2019 +Content-Type: text/plain; charset="utf-8" +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +X-Patchwork-Submitter: Stanislaw Gruszka +X-Patchwork-Id: 10848961 +X-Patchwork-Delegate: kvalo@adurom.com +From: Stanislaw Gruszka +To: linux-wireless@vger.kernel.org +Cc: =?utf-8?q?Tomislav_Po=C5=BEega?= , + Daniel Golle , Felix Fietkau , + Mathias Kresin +Subject: [PATCH v3 3/4] rt2x00: check number of EPROTO errors +Date: Tue, 12 Mar 2019 10:51:42 +0100 +Message-Id: <1552384303-29529-4-git-send-email-sgruszka@redhat.com> +In-Reply-To: <1552384303-29529-1-git-send-email-sgruszka@redhat.com> +References: <1552384303-29529-1-git-send-email-sgruszka@redhat.com> + +Some USB host devices/drivers on some conditions can always return +EPROTO error on submitted URBs. That can cause infinity loop in the +rt2x00 driver. + +Since we can have single EPROTO errors we can not mark as device as +removed to avoid infinity loop. However we can count consecutive +EPROTO errors and mark device as removed if get lot of it. +I choose number 10 as threshold. + +Reported-and-tested-by: Randy Oostdyk +Signed-off-by: Stanislaw Gruszka +--- + drivers/net/wireless/ralink/rt2x00/rt2x00.h | 1 + + drivers/net/wireless/ralink/rt2x00/rt2x00usb.c | 22 +++++++++++++++++++--- + 2 files changed, 20 insertions(+), 3 deletions(-) + +--- a/drivers/net/wireless/ralink/rt2x00/rt2x00.h ++++ b/drivers/net/wireless/ralink/rt2x00/rt2x00.h +@@ -1016,6 +1016,7 @@ struct rt2x00_dev { + unsigned int extra_tx_headroom; + + struct usb_anchor *anchor; ++ unsigned int num_proto_errs; + + /* Clock for System On Chip devices. */ + struct clk *clk; +--- a/drivers/net/wireless/ralink/rt2x00/rt2x00usb.c ++++ b/drivers/net/wireless/ralink/rt2x00/rt2x00usb.c +@@ -31,6 +31,22 @@ + #include "rt2x00.h" + #include "rt2x00usb.h" + ++static bool rt2x00usb_check_usb_error(struct rt2x00_dev *rt2x00dev, int status) ++{ ++ if (status == -ENODEV || status == -ENOENT) ++ return true; ++ ++ if (status == -EPROTO || status == -ETIMEDOUT) ++ rt2x00dev->num_proto_errs++; ++ else ++ rt2x00dev->num_proto_errs = 0; ++ ++ if (rt2x00dev->num_proto_errs > 3) ++ return true; ++ ++ return false; ++} ++ + /* + * Interfacing with the HW. + */ +@@ -57,7 +73,7 @@ int rt2x00usb_vendor_request(struct rt2x + if (status >= 0) + return 0; + +- if (status == -ENODEV || status == -ENOENT) { ++ if (rt2x00usb_check_usb_error(rt2x00dev, status)) { + /* Device has disappeared. */ + clear_bit(DEVICE_STATE_PRESENT, &rt2x00dev->flags); + break; +@@ -321,7 +337,7 @@ static bool rt2x00usb_kick_tx_entry(stru + + status = usb_submit_urb(entry_priv->urb, GFP_ATOMIC); + if (status) { +- if (status == -ENODEV || status == -ENOENT) ++ if (rt2x00usb_check_usb_error(rt2x00dev, status)) + clear_bit(DEVICE_STATE_PRESENT, &rt2x00dev->flags); + set_bit(ENTRY_DATA_IO_FAILED, &entry->flags); + rt2x00lib_dmadone(entry); +@@ -410,7 +426,7 @@ static bool rt2x00usb_kick_rx_entry(stru + + status = usb_submit_urb(entry_priv->urb, GFP_ATOMIC); + if (status) { +- if (status == -ENODEV || status == -ENOENT) ++ if (rt2x00usb_check_usb_error(rt2x00dev, status)) + clear_bit(DEVICE_STATE_PRESENT, &rt2x00dev->flags); + set_bit(ENTRY_DATA_IO_FAILED, &entry->flags); + rt2x00lib_dmadone(entry); diff --git a/package/kernel/mac80211/patches/rt2x00/023-rt2x00-do-not-print-error-when-queue-is-full.patch b/package/kernel/mac80211/patches/rt2x00/023-rt2x00-do-not-print-error-when-queue-is-full.patch new file mode 100644 index 0000000000..223abab4f1 --- /dev/null +++ b/package/kernel/mac80211/patches/rt2x00/023-rt2x00-do-not-print-error-when-queue-is-full.patch @@ -0,0 +1,43 @@ +From patchwork Tue Mar 12 09:51:43 2019 +Content-Type: text/plain; charset="utf-8" +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +X-Patchwork-Submitter: Stanislaw Gruszka +X-Patchwork-Id: 10848963 +X-Patchwork-Delegate: kvalo@adurom.com +From: Stanislaw Gruszka +To: linux-wireless@vger.kernel.org +Cc: =?utf-8?q?Tomislav_Po=C5=BEega?= , + Daniel Golle , Felix Fietkau , + Mathias Kresin +Subject: [PATCH v3 4/4] rt2x00: do not print error when queue is full +Date: Tue, 12 Mar 2019 10:51:43 +0100 +Message-Id: <1552384303-29529-5-git-send-email-sgruszka@redhat.com> +In-Reply-To: <1552384303-29529-1-git-send-email-sgruszka@redhat.com> +References: <1552384303-29529-1-git-send-email-sgruszka@redhat.com> + +For unknown reasons printk() on some context can cause CPU hung on +embedded MT7620 AP/router MIPS platforms. What can result on wifi +disconnects. + +This patch move queue full messages to debug level what is consistent +with other mac80211 drivers which drop packet silently if tx queue is +full. This make MT7620 OpenWRT routers more stable, what was reported +by various users. + +Signed-off-by: Stanislaw Gruszka +--- + drivers/net/wireless/ralink/rt2x00/rt2x00queue.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/net/wireless/ralink/rt2x00/rt2x00queue.c ++++ b/drivers/net/wireless/ralink/rt2x00/rt2x00queue.c +@@ -674,7 +674,7 @@ int rt2x00queue_write_tx_frame(struct da + spin_lock(&queue->tx_lock); + + if (unlikely(rt2x00queue_full(queue))) { +- rt2x00_err(queue->rt2x00dev, "Dropping frame due to full tx queue %d\n", ++ rt2x00_dbg(queue->rt2x00dev, "Dropping frame due to full tx queue %d\n", + queue->qid); + ret = -ENOBUFS; + goto out; diff --git a/package/kernel/mac80211/patches/rt2x00/021-rt2800-partially-restore-old-mmio-txstatus-behaviour.patch b/package/kernel/mac80211/patches/rt2x00/024-rt2800-partially-restore-old-mmio-txstatus-behaviour.patch similarity index 100% rename from package/kernel/mac80211/patches/rt2x00/021-rt2800-partially-restore-old-mmio-txstatus-behaviour.patch rename to package/kernel/mac80211/patches/rt2x00/024-rt2800-partially-restore-old-mmio-txstatus-behaviour.patch diff --git a/package/kernel/mac80211/patches/rt2x00/022-rt2800-new-flush-implementation-for-SoC-devices.patch b/package/kernel/mac80211/patches/rt2x00/025-rt2800-new-flush-implementation-for-SoC-devices.patch similarity index 100% rename from package/kernel/mac80211/patches/rt2x00/022-rt2800-new-flush-implementation-for-SoC-devices.patch rename to package/kernel/mac80211/patches/rt2x00/025-rt2800-new-flush-implementation-for-SoC-devices.patch diff --git a/package/kernel/mac80211/patches/rt2x00/023-rt2800-move-txstatus-pending-routine.patch b/package/kernel/mac80211/patches/rt2x00/026-rt2800-move-txstatus-pending-routine.patch similarity index 100% rename from package/kernel/mac80211/patches/rt2x00/023-rt2800-move-txstatus-pending-routine.patch rename to package/kernel/mac80211/patches/rt2x00/026-rt2800-move-txstatus-pending-routine.patch diff --git a/package/kernel/mac80211/patches/rt2x00/026-rt2x00-remove-last_nostatus_check.patch b/package/kernel/mac80211/patches/rt2x00/026-rt2x00-remove-last_nostatus_check.patch deleted file mode 100644 index 0daaef5e8b..0000000000 --- a/package/kernel/mac80211/patches/rt2x00/026-rt2x00-remove-last_nostatus_check.patch +++ /dev/null @@ -1,57 +0,0 @@ -From 6013a91f15c9dabd668d5736652b9bcfb0ef0378 Mon Sep 17 00:00:00 2001 -From: Stanislaw Gruszka -Date: Sat, 9 Feb 2019 12:08:36 +0100 -X-Patchwork-Submitter: Stanislaw Gruszka -X-Patchwork-Id: 10804447 -X-Patchwork-Delegate: kvalo@adurom.com -Subject: [PATCH 26/28] rt2x00: remove last_nostatus_check - -We do not any longer check txstatus timeout from tasklet, so do not need -this optimization. - -Signed-off-by: Stanislaw Gruszka ---- - drivers/net/wireless/ralink/rt2x00/rt2800lib.c | 9 --------- - drivers/net/wireless/ralink/rt2x00/rt2x00.h | 2 -- - drivers/net/wireless/ralink/rt2x00/rt2x00queue.c | 1 - - 3 files changed, 12 deletions(-) - ---- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c -+++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c -@@ -1164,15 +1164,6 @@ bool rt2800_txstatus_timeout(struct rt2x - struct data_queue *queue; - struct queue_entry *entry; - -- if (!test_bit(DEVICE_STATE_FLUSHING, &rt2x00dev->flags)) { -- unsigned long tout = msecs_to_jiffies(1000); -- -- if (time_before(jiffies, rt2x00dev->last_nostatus_check + tout)) -- return false; -- } -- -- rt2x00dev->last_nostatus_check = jiffies; -- - tx_queue_for_each(rt2x00dev, queue) { - entry = rt2x00queue_get_entry(queue, Q_INDEX_DONE); - if (rt2800_entry_txstatus_timeout(rt2x00dev, entry)) ---- a/drivers/net/wireless/ralink/rt2x00/rt2x00.h -+++ b/drivers/net/wireless/ralink/rt2x00/rt2x00.h -@@ -981,8 +981,6 @@ struct rt2x00_dev { - */ - DECLARE_KFIFO_PTR(txstatus_fifo, u32); - -- unsigned long last_nostatus_check; -- - /* - * Timer to ensure tx status reports are read (rt2800usb). - */ ---- a/drivers/net/wireless/ralink/rt2x00/rt2x00queue.c -+++ b/drivers/net/wireless/ralink/rt2x00/rt2x00queue.c -@@ -1039,7 +1039,6 @@ void rt2x00queue_start_queues(struct rt2 - */ - tx_queue_for_each(rt2x00dev, queue) - rt2x00queue_start_queue(queue); -- rt2x00dev->last_nostatus_check = jiffies; - - rt2x00queue_start_queue(rt2x00dev->rx); - } diff --git a/package/kernel/mac80211/patches/rt2x00/024-rt2800mmio-fetch-tx-status-changes.patch b/package/kernel/mac80211/patches/rt2x00/027-rt2800mmio-fetch-tx-status-changes.patch similarity index 100% rename from package/kernel/mac80211/patches/rt2x00/024-rt2800mmio-fetch-tx-status-changes.patch rename to package/kernel/mac80211/patches/rt2x00/027-rt2800mmio-fetch-tx-status-changes.patch diff --git a/package/kernel/mac80211/patches/rt2x00/025-rt2800mmio-use-timer-and-work-for-handling-tx-status.patch b/package/kernel/mac80211/patches/rt2x00/028-rt2800mmio-use-timer-and-work-for-handling-tx-status.patch similarity index 100% rename from package/kernel/mac80211/patches/rt2x00/025-rt2800mmio-use-timer-and-work-for-handling-tx-status.patch rename to package/kernel/mac80211/patches/rt2x00/028-rt2800mmio-use-timer-and-work-for-handling-tx-status.patch diff --git a/package/kernel/mac80211/patches/rt2x00/029-rt2x00-remove-last_nostatus_check.patch b/package/kernel/mac80211/patches/rt2x00/029-rt2x00-remove-last_nostatus_check.patch new file mode 100644 index 0000000000..08ac24033d --- /dev/null +++ b/package/kernel/mac80211/patches/rt2x00/029-rt2x00-remove-last_nostatus_check.patch @@ -0,0 +1,57 @@ +From 6013a91f15c9dabd668d5736652b9bcfb0ef0378 Mon Sep 17 00:00:00 2001 +From: Stanislaw Gruszka +Date: Sat, 9 Feb 2019 12:08:36 +0100 +X-Patchwork-Submitter: Stanislaw Gruszka +X-Patchwork-Id: 10804447 +X-Patchwork-Delegate: kvalo@adurom.com +Subject: [PATCH 26/28] rt2x00: remove last_nostatus_check + +We do not any longer check txstatus timeout from tasklet, so do not need +this optimization. + +Signed-off-by: Stanislaw Gruszka +--- + drivers/net/wireless/ralink/rt2x00/rt2800lib.c | 9 --------- + drivers/net/wireless/ralink/rt2x00/rt2x00.h | 2 -- + drivers/net/wireless/ralink/rt2x00/rt2x00queue.c | 1 - + 3 files changed, 12 deletions(-) + +--- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c ++++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c +@@ -1164,15 +1164,6 @@ bool rt2800_txstatus_timeout(struct rt2x + struct data_queue *queue; + struct queue_entry *entry; + +- if (!test_bit(DEVICE_STATE_FLUSHING, &rt2x00dev->flags)) { +- unsigned long tout = msecs_to_jiffies(1000); +- +- if (time_before(jiffies, rt2x00dev->last_nostatus_check + tout)) +- return false; +- } +- +- rt2x00dev->last_nostatus_check = jiffies; +- + tx_queue_for_each(rt2x00dev, queue) { + entry = rt2x00queue_get_entry(queue, Q_INDEX_DONE); + if (rt2800_entry_txstatus_timeout(rt2x00dev, entry)) +--- a/drivers/net/wireless/ralink/rt2x00/rt2x00.h ++++ b/drivers/net/wireless/ralink/rt2x00/rt2x00.h +@@ -980,8 +980,6 @@ struct rt2x00_dev { + */ + DECLARE_KFIFO_PTR(txstatus_fifo, u32); + +- unsigned long last_nostatus_check; +- + /* + * Timer to ensure tx status reports are read (rt2800usb). + */ +--- a/drivers/net/wireless/ralink/rt2x00/rt2x00queue.c ++++ b/drivers/net/wireless/ralink/rt2x00/rt2x00queue.c +@@ -1042,7 +1042,6 @@ void rt2x00queue_start_queues(struct rt2 + */ + tx_queue_for_each(rt2x00dev, queue) + rt2x00queue_start_queue(queue); +- rt2x00dev->last_nostatus_check = jiffies; + + rt2x00queue_start_queue(rt2x00dev->rx); + } diff --git a/package/kernel/mac80211/patches/rt2x00/027-rt2x00-remove-not-used-entry-field.patch b/package/kernel/mac80211/patches/rt2x00/030-rt2x00-remove-not-used-entry-field.patch similarity index 100% rename from package/kernel/mac80211/patches/rt2x00/027-rt2x00-remove-not-used-entry-field.patch rename to package/kernel/mac80211/patches/rt2x00/030-rt2x00-remove-not-used-entry-field.patch diff --git a/package/kernel/mac80211/patches/rt2x00/028-rt2x00mmio-remove-legacy-comment.patch b/package/kernel/mac80211/patches/rt2x00/031-rt2x00mmio-remove-legacy-comment.patch similarity index 100% rename from package/kernel/mac80211/patches/rt2x00/028-rt2x00mmio-remove-legacy-comment.patch rename to package/kernel/mac80211/patches/rt2x00/031-rt2x00mmio-remove-legacy-comment.patch diff --git a/package/kernel/mac80211/patches/rt2x00/050-rt2x00-add-RT3883-support.patch b/package/kernel/mac80211/patches/rt2x00/050-rt2x00-add-RT3883-support.patch new file mode 100644 index 0000000000..b224d58c44 --- /dev/null +++ b/package/kernel/mac80211/patches/rt2x00/050-rt2x00-add-RT3883-support.patch @@ -0,0 +1,959 @@ +From d0e61a0f7cca51ce340a5a73595189972122ff25 Mon Sep 17 00:00:00 2001 +From: Gabor Juhos +Date: Wed, 24 Apr 2019 09:49:24 +0200 +Subject: [PATCH] rt2x00: add RT3883 support + +Patch add support for RT3883 chip. Code was taken direclty +from librecmc project and merge into one patch. + +Signed-off-by: Gabor Juhos +Signed-off-by: Stanislaw Gruszka +Signed-off-by: Kalle Valo +--- + drivers/net/wireless/ralink/rt2x00/rt2800.h | 19 +- + .../net/wireless/ralink/rt2x00/rt2800lib.c | 598 +++++++++++++++++- + .../net/wireless/ralink/rt2x00/rt2800soc.c | 9 +- + 3 files changed, 607 insertions(+), 19 deletions(-) + +--- a/drivers/net/wireless/ralink/rt2x00/rt2800.h ++++ b/drivers/net/wireless/ralink/rt2x00/rt2800.h +@@ -48,7 +48,8 @@ + * RF2853 2.4G/5G 3T3R + * RF3320 2.4G 1T1R(RT3350/RT3370/RT3390) + * RF3322 2.4G 2T2R(RT3352/RT3371/RT3372/RT3391/RT3392) +- * RF3053 2.4G/5G 3T3R(RT3883/RT3563/RT3573/RT3593/RT3662) ++ * RF3053 2.4G/5G 3T3R(RT3563/RT3573/RT3593) ++ * RF3853 2.4G/5G 3T3R(RT3883/RT3662) + * RF5592 2.4G/5G 2T2R + * RF3070 2.4G 1T1R + * RF5360 2.4G 1T1R +@@ -72,6 +73,7 @@ + #define RF5592 0x000f + #define RF3070 0x3070 + #define RF3290 0x3290 ++#define RF3853 0x3853 + #define RF5350 0x5350 + #define RF5360 0x5360 + #define RF5362 0x5362 +@@ -1726,6 +1728,20 @@ + #define TX_PWR_CFG_9B_STBC_MCS7 FIELD32(0x000000ff) + + /* ++ * TX_TXBF_CFG: ++ */ ++#define TX_TXBF_CFG_0 0x138c ++#define TX_TXBF_CFG_1 0x13a4 ++#define TX_TXBF_CFG_2 0x13a8 ++#define TX_TXBF_CFG_3 0x13ac ++ ++/* ++ * TX_FBK_CFG_3S: ++ */ ++#define TX_FBK_CFG_3S_0 0x13c4 ++#define TX_FBK_CFG_3S_1 0x13c8 ++ ++/* + * RX_FILTER_CFG: RX configuration register. + */ + #define RX_FILTER_CFG 0x1400 +@@ -2296,6 +2312,7 @@ struct mac_iveiv_entry { + /* + * RFCSR 2: + */ ++#define RFCSR2_RESCAL_BP FIELD8(0x40) + #define RFCSR2_RESCAL_EN FIELD8(0x80) + #define RFCSR2_RX2_EN_MT7620 FIELD8(0x02) + #define RFCSR2_TX2_EN_MT7620 FIELD8(0x20) +--- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c ++++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c +@@ -381,7 +381,8 @@ static unsigned int rt2800_eeprom_word_i + wiphy_name(rt2x00dev->hw->wiphy), word)) + return 0; + +- if (rt2x00_rt(rt2x00dev, RT3593)) ++ if (rt2x00_rt(rt2x00dev, RT3593) || ++ rt2x00_rt(rt2x00dev, RT3883)) + map = rt2800_eeprom_map_ext; + else + map = rt2800_eeprom_map; +@@ -590,6 +591,7 @@ void rt2800_get_txwi_rxwi_size(struct rt + { + switch (rt2x00dev->chip.rt) { + case RT3593: ++ case RT3883: + *txwi_size = TXWI_DESC_SIZE_4WORDS; + *rxwi_size = RXWI_DESC_SIZE_5WORDS; + break; +@@ -2180,7 +2182,8 @@ void rt2800_config_ant(struct rt2x00_dev + rt2800_bbp_write(rt2x00dev, 3, r3); + rt2800_bbp_write(rt2x00dev, 1, r1); + +- if (rt2x00_rt(rt2x00dev, RT3593)) { ++ if (rt2x00_rt(rt2x00dev, RT3593) || ++ rt2x00_rt(rt2x00dev, RT3883)) { + if (ant->rx_chain_num == 1) + rt2800_bbp_write(rt2x00dev, 86, 0x00); + else +@@ -2202,7 +2205,8 @@ static void rt2800_config_lna_gain(struc + eeprom = rt2800_eeprom_read(rt2x00dev, EEPROM_LNA); + lna_gain = rt2x00_get_field16(eeprom, EEPROM_LNA_A0); + } else if (libconf->rf.channel <= 128) { +- if (rt2x00_rt(rt2x00dev, RT3593)) { ++ if (rt2x00_rt(rt2x00dev, RT3593) || ++ rt2x00_rt(rt2x00dev, RT3883)) { + eeprom = rt2800_eeprom_read(rt2x00dev, EEPROM_EXT_LNA2); + lna_gain = rt2x00_get_field16(eeprom, + EEPROM_EXT_LNA2_A1); +@@ -2212,7 +2216,8 @@ static void rt2800_config_lna_gain(struc + EEPROM_RSSI_BG2_LNA_A1); + } + } else { +- if (rt2x00_rt(rt2x00dev, RT3593)) { ++ if (rt2x00_rt(rt2x00dev, RT3593) || ++ rt2x00_rt(rt2x00dev, RT3883)) { + eeprom = rt2800_eeprom_read(rt2x00dev, EEPROM_EXT_LNA2); + lna_gain = rt2x00_get_field16(eeprom, + EEPROM_EXT_LNA2_A2); +@@ -2880,6 +2885,211 @@ static void rt2800_config_channel_rf3053 + } + } + ++static void rt2800_config_channel_rf3853(struct rt2x00_dev *rt2x00dev, ++ struct ieee80211_conf *conf, ++ struct rf_channel *rf, ++ struct channel_info *info) ++{ ++ u8 rfcsr; ++ u8 bbp; ++ u8 pwr1, pwr2, pwr3; ++ ++ const bool txbf_enabled = false; /* TODO */ ++ ++ /* TODO: add band selection */ ++ ++ if (rf->channel <= 14) ++ rt2800_rfcsr_write(rt2x00dev, 6, 0x40); ++ else if (rf->channel < 132) ++ rt2800_rfcsr_write(rt2x00dev, 6, 0x80); ++ else ++ rt2800_rfcsr_write(rt2x00dev, 6, 0x40); ++ ++ rt2800_rfcsr_write(rt2x00dev, 8, rf->rf1); ++ rt2800_rfcsr_write(rt2x00dev, 9, rf->rf3); ++ ++ if (rf->channel <= 14) ++ rt2800_rfcsr_write(rt2x00dev, 11, 0x46); ++ else ++ rt2800_rfcsr_write(rt2x00dev, 11, 0x48); ++ ++ if (rf->channel <= 14) ++ rt2800_rfcsr_write(rt2x00dev, 12, 0x1a); ++ else ++ rt2800_rfcsr_write(rt2x00dev, 12, 0x52); ++ ++ rt2800_rfcsr_write(rt2x00dev, 13, 0x12); ++ ++ rfcsr = rt2800_rfcsr_read(rt2x00dev, 1); ++ rt2x00_set_field8(&rfcsr, RFCSR1_RX0_PD, 0); ++ rt2x00_set_field8(&rfcsr, RFCSR1_TX0_PD, 0); ++ rt2x00_set_field8(&rfcsr, RFCSR1_RX1_PD, 0); ++ rt2x00_set_field8(&rfcsr, RFCSR1_TX1_PD, 0); ++ rt2x00_set_field8(&rfcsr, RFCSR1_RX2_PD, 0); ++ rt2x00_set_field8(&rfcsr, RFCSR1_TX2_PD, 0); ++ rt2x00_set_field8(&rfcsr, RFCSR1_RF_BLOCK_EN, 1); ++ rt2x00_set_field8(&rfcsr, RFCSR1_PLL_PD, 1); ++ ++ switch (rt2x00dev->default_ant.tx_chain_num) { ++ case 3: ++ rt2x00_set_field8(&rfcsr, RFCSR1_TX2_PD, 1); ++ /* fallthrough */ ++ case 2: ++ rt2x00_set_field8(&rfcsr, RFCSR1_TX1_PD, 1); ++ /* fallthrough */ ++ case 1: ++ rt2x00_set_field8(&rfcsr, RFCSR1_TX0_PD, 1); ++ break; ++ } ++ ++ switch (rt2x00dev->default_ant.rx_chain_num) { ++ case 3: ++ rt2x00_set_field8(&rfcsr, RFCSR1_RX2_PD, 1); ++ /* fallthrough */ ++ case 2: ++ rt2x00_set_field8(&rfcsr, RFCSR1_RX1_PD, 1); ++ /* fallthrough */ ++ case 1: ++ rt2x00_set_field8(&rfcsr, RFCSR1_RX0_PD, 1); ++ break; ++ } ++ rt2800_rfcsr_write(rt2x00dev, 1, rfcsr); ++ ++ rt2800_freq_cal_mode1(rt2x00dev); ++ ++ rfcsr = rt2800_rfcsr_read(rt2x00dev, 30); ++ if (!conf_is_ht40(conf)) ++ rfcsr &= ~(0x06); ++ else ++ rfcsr |= 0x06; ++ rt2800_rfcsr_write(rt2x00dev, 30, rfcsr); ++ ++ if (rf->channel <= 14) ++ rt2800_rfcsr_write(rt2x00dev, 31, 0xa0); ++ else ++ rt2800_rfcsr_write(rt2x00dev, 31, 0x80); ++ ++ if (conf_is_ht40(conf)) ++ rt2800_rfcsr_write(rt2x00dev, 32, 0x80); ++ else ++ rt2800_rfcsr_write(rt2x00dev, 32, 0xd8); ++ ++ if (rf->channel <= 14) ++ rt2800_rfcsr_write(rt2x00dev, 34, 0x3c); ++ else ++ rt2800_rfcsr_write(rt2x00dev, 34, 0x20); ++ ++ /* loopback RF_BS */ ++ rfcsr = rt2800_rfcsr_read(rt2x00dev, 36); ++ if (rf->channel <= 14) ++ rt2x00_set_field8(&rfcsr, RFCSR36_RF_BS, 1); ++ else ++ rt2x00_set_field8(&rfcsr, RFCSR36_RF_BS, 0); ++ rt2800_rfcsr_write(rt2x00dev, 36, rfcsr); ++ ++ if (rf->channel <= 14) ++ rfcsr = 0x23; ++ else if (rf->channel < 100) ++ rfcsr = 0x36; ++ else if (rf->channel < 132) ++ rfcsr = 0x32; ++ else ++ rfcsr = 0x30; ++ ++ if (txbf_enabled) ++ rfcsr |= 0x40; ++ ++ rt2800_rfcsr_write(rt2x00dev, 39, rfcsr); ++ ++ if (rf->channel <= 14) ++ rt2800_rfcsr_write(rt2x00dev, 44, 0x93); ++ else ++ rt2800_rfcsr_write(rt2x00dev, 44, 0x9b); ++ ++ if (rf->channel <= 14) ++ rfcsr = 0xbb; ++ else if (rf->channel < 100) ++ rfcsr = 0xeb; ++ else if (rf->channel < 132) ++ rfcsr = 0xb3; ++ else ++ rfcsr = 0x9b; ++ rt2800_rfcsr_write(rt2x00dev, 45, rfcsr); ++ ++ if (rf->channel <= 14) ++ rfcsr = 0x8e; ++ else ++ rfcsr = 0x8a; ++ ++ if (txbf_enabled) ++ rfcsr |= 0x20; ++ ++ rt2800_rfcsr_write(rt2x00dev, 49, rfcsr); ++ ++ rt2800_rfcsr_write(rt2x00dev, 50, 0x86); ++ ++ rfcsr = rt2800_rfcsr_read(rt2x00dev, 51); ++ if (rf->channel <= 14) ++ rt2800_rfcsr_write(rt2x00dev, 51, 0x75); ++ else ++ rt2800_rfcsr_write(rt2x00dev, 51, 0x51); ++ ++ rfcsr = rt2800_rfcsr_read(rt2x00dev, 52); ++ if (rf->channel <= 14) ++ rt2800_rfcsr_write(rt2x00dev, 52, 0x45); ++ else ++ rt2800_rfcsr_write(rt2x00dev, 52, 0x05); ++ ++ if (rf->channel <= 14) { ++ pwr1 = info->default_power1 & 0x1f; ++ pwr2 = info->default_power2 & 0x1f; ++ pwr3 = info->default_power3 & 0x1f; ++ } else { ++ pwr1 = 0x48 | ((info->default_power1 & 0x18) << 1) | ++ (info->default_power1 & 0x7); ++ pwr2 = 0x48 | ((info->default_power2 & 0x18) << 1) | ++ (info->default_power2 & 0x7); ++ pwr3 = 0x48 | ((info->default_power3 & 0x18) << 1) | ++ (info->default_power3 & 0x7); ++ } ++ ++ rt2800_rfcsr_write(rt2x00dev, 53, pwr1); ++ rt2800_rfcsr_write(rt2x00dev, 54, pwr2); ++ rt2800_rfcsr_write(rt2x00dev, 55, pwr3); ++ ++ rt2x00_dbg(rt2x00dev, "Channel:%d, pwr1:%02x, pwr2:%02x, pwr3:%02x\n", ++ rf->channel, pwr1, pwr2, pwr3); ++ ++ bbp = (info->default_power1 >> 5) | ++ ((info->default_power2 & 0xe0) >> 1); ++ rt2800_bbp_write(rt2x00dev, 109, bbp); ++ ++ bbp = rt2800_bbp_read(rt2x00dev, 110); ++ bbp &= 0x0f; ++ bbp |= (info->default_power3 & 0xe0) >> 1; ++ rt2800_bbp_write(rt2x00dev, 110, bbp); ++ ++ rfcsr = rt2800_rfcsr_read(rt2x00dev, 57); ++ if (rf->channel <= 14) ++ rt2800_rfcsr_write(rt2x00dev, 57, 0x6e); ++ else ++ rt2800_rfcsr_write(rt2x00dev, 57, 0x3e); ++ ++ /* Enable RF tuning */ ++ rfcsr = rt2800_rfcsr_read(rt2x00dev, 3); ++ rt2x00_set_field8(&rfcsr, RFCSR3_VCOCAL_EN, 1); ++ rt2800_rfcsr_write(rt2x00dev, 3, rfcsr); ++ ++ udelay(2000); ++ ++ bbp = rt2800_bbp_read(rt2x00dev, 49); ++ /* clear update flag */ ++ rt2800_bbp_write(rt2x00dev, 49, bbp & 0xfe); ++ rt2800_bbp_write(rt2x00dev, 49, bbp); ++ ++ /* TODO: add calibration for TxBF */ ++} ++ + #define POWER_BOUND 0x27 + #define POWER_BOUND_5G 0x2b + +@@ -3683,19 +3893,51 @@ static char rt2800_txpower_to_dev(struct + unsigned int channel, + char txpower) + { +- if (rt2x00_rt(rt2x00dev, RT3593)) ++ if (rt2x00_rt(rt2x00dev, RT3593) || ++ rt2x00_rt(rt2x00dev, RT3883)) + txpower = rt2x00_get_field8(txpower, EEPROM_TXPOWER_ALC); + + if (channel <= 14) + return clamp_t(char, txpower, MIN_G_TXPOWER, MAX_G_TXPOWER); + +- if (rt2x00_rt(rt2x00dev, RT3593)) ++ if (rt2x00_rt(rt2x00dev, RT3593) || ++ rt2x00_rt(rt2x00dev, RT3883)) + return clamp_t(char, txpower, MIN_A_TXPOWER_3593, + MAX_A_TXPOWER_3593); + else + return clamp_t(char, txpower, MIN_A_TXPOWER, MAX_A_TXPOWER); + } + ++static void rt3883_bbp_adjust(struct rt2x00_dev *rt2x00dev, ++ struct rf_channel *rf) ++{ ++ u8 bbp; ++ ++ bbp = (rf->channel > 14) ? 0x48 : 0x38; ++ rt2800_bbp_write_with_rx_chain(rt2x00dev, 66, bbp); ++ ++ rt2800_bbp_write(rt2x00dev, 69, 0x12); ++ ++ if (rf->channel <= 14) { ++ rt2800_bbp_write(rt2x00dev, 70, 0x0a); ++ } else { ++ /* Disable CCK packet detection */ ++ rt2800_bbp_write(rt2x00dev, 70, 0x00); ++ } ++ ++ rt2800_bbp_write(rt2x00dev, 73, 0x10); ++ ++ if (rf->channel > 14) { ++ rt2800_bbp_write(rt2x00dev, 62, 0x1d); ++ rt2800_bbp_write(rt2x00dev, 63, 0x1d); ++ rt2800_bbp_write(rt2x00dev, 64, 0x1d); ++ } else { ++ rt2800_bbp_write(rt2x00dev, 62, 0x2d); ++ rt2800_bbp_write(rt2x00dev, 63, 0x2d); ++ rt2800_bbp_write(rt2x00dev, 64, 0x2d); ++ } ++} ++ + static void rt2800_config_channel(struct rt2x00_dev *rt2x00dev, + struct ieee80211_conf *conf, + struct rf_channel *rf, +@@ -3714,6 +3956,12 @@ static void rt2800_config_channel(struct + rt2800_txpower_to_dev(rt2x00dev, rf->channel, + info->default_power3); + ++ switch (rt2x00dev->chip.rt) { ++ case RT3883: ++ rt3883_bbp_adjust(rt2x00dev, rf); ++ break; ++ } ++ + switch (rt2x00dev->chip.rf) { + case RF2020: + case RF3020: +@@ -3734,6 +3982,9 @@ static void rt2800_config_channel(struct + case RF3322: + rt2800_config_channel_rf3322(rt2x00dev, conf, rf, info); + break; ++ case RF3853: ++ rt2800_config_channel_rf3853(rt2x00dev, conf, rf, info); ++ break; + case RF3070: + case RF5350: + case RF5360: +@@ -3815,6 +4066,15 @@ static void rt2800_config_channel(struct + rt2800_bbp_write(rt2x00dev, 63, 0x37 - rt2x00dev->lna_gain); + rt2800_bbp_write(rt2x00dev, 64, 0x37 - rt2x00dev->lna_gain); + rt2800_bbp_write(rt2x00dev, 77, 0x98); ++ } else if (rt2x00_rt(rt2x00dev, RT3883)) { ++ rt2800_bbp_write(rt2x00dev, 62, 0x37 - rt2x00dev->lna_gain); ++ rt2800_bbp_write(rt2x00dev, 63, 0x37 - rt2x00dev->lna_gain); ++ rt2800_bbp_write(rt2x00dev, 64, 0x37 - rt2x00dev->lna_gain); ++ ++ if (rt2x00dev->default_ant.rx_chain_num > 1) ++ rt2800_bbp_write(rt2x00dev, 86, 0x46); ++ else ++ rt2800_bbp_write(rt2x00dev, 86, 0); + } else { + rt2800_bbp_write(rt2x00dev, 62, 0x37 - rt2x00dev->lna_gain); + rt2800_bbp_write(rt2x00dev, 63, 0x37 - rt2x00dev->lna_gain); +@@ -3828,6 +4088,7 @@ static void rt2800_config_channel(struct + !rt2x00_rt(rt2x00dev, RT6352)) { + if (rt2x00_has_cap_external_lna_bg(rt2x00dev)) { + rt2800_bbp_write(rt2x00dev, 82, 0x62); ++ rt2800_bbp_write(rt2x00dev, 82, 0x62); + rt2800_bbp_write(rt2x00dev, 75, 0x46); + } else { + if (rt2x00_rt(rt2x00dev, RT3593)) +@@ -3836,19 +4097,22 @@ static void rt2800_config_channel(struct + rt2800_bbp_write(rt2x00dev, 82, 0x84); + rt2800_bbp_write(rt2x00dev, 75, 0x50); + } +- if (rt2x00_rt(rt2x00dev, RT3593)) ++ if (rt2x00_rt(rt2x00dev, RT3593) || ++ rt2x00_rt(rt2x00dev, RT3883)) + rt2800_bbp_write(rt2x00dev, 83, 0x8a); + } + + } else { + if (rt2x00_rt(rt2x00dev, RT3572)) + rt2800_bbp_write(rt2x00dev, 82, 0x94); +- else if (rt2x00_rt(rt2x00dev, RT3593)) ++ else if (rt2x00_rt(rt2x00dev, RT3593) || ++ rt2x00_rt(rt2x00dev, RT3883)) + rt2800_bbp_write(rt2x00dev, 82, 0x82); + else if (!rt2x00_rt(rt2x00dev, RT6352)) + rt2800_bbp_write(rt2x00dev, 82, 0xf2); + +- if (rt2x00_rt(rt2x00dev, RT3593)) ++ if (rt2x00_rt(rt2x00dev, RT3593) || ++ rt2x00_rt(rt2x00dev, RT3883)) + rt2800_bbp_write(rt2x00dev, 83, 0x9a); + + if (rt2x00_has_cap_external_lna_a(rt2x00dev)) +@@ -3984,6 +4248,23 @@ static void rt2800_config_channel(struct + usleep_range(1000, 1500); + } + ++ if (rt2x00_rt(rt2x00dev, RT3883)) { ++ if (!conf_is_ht40(conf)) ++ rt2800_bbp_write(rt2x00dev, 105, 0x34); ++ else ++ rt2800_bbp_write(rt2x00dev, 105, 0x04); ++ ++ /* AGC init */ ++ if (rf->channel <= 14) ++ reg = 0x2e + rt2x00dev->lna_gain; ++ else ++ reg = 0x20 + ((rt2x00dev->lna_gain * 5) / 3); ++ ++ rt2800_bbp_write_with_rx_chain(rt2x00dev, 66, reg); ++ ++ usleep_range(1000, 1500); ++ } ++ + if (rt2x00_rt(rt2x00dev, RT5592) || rt2x00_rt(rt2x00dev, RT6352)) { + reg = 0x10; + if (!conf_is_ht40(conf)) { +@@ -4243,6 +4524,9 @@ static u8 rt2800_compensate_txpower(stru + if (rt2x00_rt(rt2x00dev, RT3593)) + return min_t(u8, txpower, 0xc); + ++ if (rt2x00_rt(rt2x00dev, RT3883)) ++ return min_t(u8, txpower, 0xf); ++ + if (rt2x00_has_cap_power_limit(rt2x00dev)) { + /* + * Check if eirp txpower exceed txpower_limit. +@@ -5004,7 +5288,8 @@ static void rt2800_config_txpower(struct + struct ieee80211_channel *chan, + int power_level) + { +- if (rt2x00_rt(rt2x00dev, RT3593)) ++ if (rt2x00_rt(rt2x00dev, RT3593) || ++ rt2x00_rt(rt2x00dev, RT3883)) + rt2800_config_txpower_rt3593(rt2x00dev, chan, power_level); + else if (rt2x00_rt(rt2x00dev, RT6352)) + rt2800_config_txpower_rt6352(rt2x00dev, chan, power_level); +@@ -5051,6 +5336,7 @@ void rt2800_vco_calibration(struct rt2x0 + case RF3053: + case RF3070: + case RF3290: ++ case RF3853: + case RF5350: + case RF5360: + case RF5362: +@@ -5251,7 +5537,8 @@ static u8 rt2800_get_default_vgc(struct + else + vgc = 0x2e + rt2x00dev->lna_gain; + } else { /* 5GHZ band */ +- if (rt2x00_rt(rt2x00dev, RT3593)) ++ if (rt2x00_rt(rt2x00dev, RT3593) || ++ rt2x00_rt(rt2x00dev, RT3883)) + vgc = 0x20 + (rt2x00dev->lna_gain * 5) / 3; + else if (rt2x00_rt(rt2x00dev, RT5592)) + vgc = 0x24 + (2 * rt2x00dev->lna_gain); +@@ -5271,7 +5558,8 @@ static inline void rt2800_set_vgc(struct + { + if (qual->vgc_level != vgc_level) { + if (rt2x00_rt(rt2x00dev, RT3572) || +- rt2x00_rt(rt2x00dev, RT3593)) { ++ rt2x00_rt(rt2x00dev, RT3593) || ++ rt2x00_rt(rt2x00dev, RT3883)) { + rt2800_bbp_write_with_rx_chain(rt2x00dev, 66, + vgc_level); + } else if (rt2x00_rt(rt2x00dev, RT5592)) { +@@ -5318,6 +5606,11 @@ void rt2800_link_tuner(struct rt2x00_dev + } + break; + ++ case RT3883: ++ if (qual->rssi > -65) ++ vgc += 0x10; ++ break; ++ + case RT5592: + if (qual->rssi > -65) + vgc += 0x20; +@@ -5470,6 +5763,12 @@ static int rt2800_init_registers(struct + rt2800_register_write(rt2x00dev, TX_SW_CFG2, + 0x00000000); + } ++ } else if (rt2x00_rt(rt2x00dev, RT3883)) { ++ rt2800_register_write(rt2x00dev, TX_SW_CFG0, 0x00000402); ++ rt2800_register_write(rt2x00dev, TX_SW_CFG1, 0x00000000); ++ rt2800_register_write(rt2x00dev, TX_SW_CFG2, 0x00040000); ++ rt2800_register_write(rt2x00dev, TX_TXBF_CFG_0, 0x8000fc21); ++ rt2800_register_write(rt2x00dev, TX_TXBF_CFG_3, 0x00009c40); + } else if (rt2x00_rt(rt2x00dev, RT5390) || + rt2x00_rt(rt2x00dev, RT5392) || + rt2x00_rt(rt2x00dev, RT6352)) { +@@ -5683,6 +5982,11 @@ static int rt2800_init_registers(struct + reg = rt2x00_rt(rt2x00dev, RT5592) ? 0x00000082 : 0x00000002; + rt2800_register_write(rt2x00dev, TXOP_HLDR_ET, reg); + ++ if (rt2x00_rt(rt2x00dev, RT3883)) { ++ rt2800_register_write(rt2x00dev, TX_FBK_CFG_3S_0, 0x12111008); ++ rt2800_register_write(rt2x00dev, TX_FBK_CFG_3S_1, 0x16151413); ++ } ++ + reg = rt2800_register_read(rt2x00dev, TX_RTS_CFG); + rt2x00_set_field32(®, TX_RTS_CFG_AUTO_RTS_RETRY_LIMIT, 7); + rt2x00_set_field32(®, TX_RTS_CFG_RTS_THRES, +@@ -6299,6 +6603,47 @@ static void rt2800_init_bbp_3593(struct + rt2800_bbp_write(rt2x00dev, 103, 0xc0); + } + ++static void rt2800_init_bbp_3883(struct rt2x00_dev *rt2x00dev) ++{ ++ rt2800_init_bbp_early(rt2x00dev); ++ ++ rt2800_bbp_write(rt2x00dev, 4, 0x50); ++ rt2800_bbp_write(rt2x00dev, 47, 0x48); ++ ++ rt2800_bbp_write(rt2x00dev, 86, 0x46); ++ rt2800_bbp_write(rt2x00dev, 88, 0x90); ++ ++ rt2800_bbp_write(rt2x00dev, 92, 0x02); ++ ++ rt2800_bbp_write(rt2x00dev, 103, 0xc0); ++ rt2800_bbp_write(rt2x00dev, 104, 0x92); ++ rt2800_bbp_write(rt2x00dev, 105, 0x34); ++ rt2800_bbp_write(rt2x00dev, 106, 0x12); ++ rt2800_bbp_write(rt2x00dev, 120, 0x50); ++ rt2800_bbp_write(rt2x00dev, 137, 0x0f); ++ rt2800_bbp_write(rt2x00dev, 163, 0x9d); ++ ++ /* Set ITxBF timeout to 0x9C40=1000msec */ ++ rt2800_bbp_write(rt2x00dev, 179, 0x02); ++ rt2800_bbp_write(rt2x00dev, 180, 0x00); ++ rt2800_bbp_write(rt2x00dev, 182, 0x40); ++ rt2800_bbp_write(rt2x00dev, 180, 0x01); ++ rt2800_bbp_write(rt2x00dev, 182, 0x9c); ++ ++ rt2800_bbp_write(rt2x00dev, 179, 0x00); ++ ++ /* Reprogram the inband interface to put right values in RXWI */ ++ rt2800_bbp_write(rt2x00dev, 142, 0x04); ++ rt2800_bbp_write(rt2x00dev, 143, 0x3b); ++ rt2800_bbp_write(rt2x00dev, 142, 0x06); ++ rt2800_bbp_write(rt2x00dev, 143, 0xa0); ++ rt2800_bbp_write(rt2x00dev, 142, 0x07); ++ rt2800_bbp_write(rt2x00dev, 143, 0xa1); ++ rt2800_bbp_write(rt2x00dev, 142, 0x08); ++ rt2800_bbp_write(rt2x00dev, 143, 0xa2); ++ rt2800_bbp_write(rt2x00dev, 148, 0xc8); ++} ++ + static void rt2800_init_bbp_53xx(struct rt2x00_dev *rt2x00dev) + { + int ant, div_mode; +@@ -6743,6 +7088,9 @@ static void rt2800_init_bbp(struct rt2x0 + case RT3593: + rt2800_init_bbp_3593(rt2x00dev); + return; ++ case RT3883: ++ rt2800_init_bbp_3883(rt2x00dev); ++ return; + case RT5390: + case RT5392: + rt2800_init_bbp_53xx(rt2x00dev); +@@ -7614,6 +7962,144 @@ static void rt2800_init_rfcsr_5350(struc + rt2800_rfcsr_write(rt2x00dev, 63, 0x00); + } + ++static void rt2800_init_rfcsr_3883(struct rt2x00_dev *rt2x00dev) ++{ ++ u8 rfcsr; ++ ++ /* TODO: get the actual ECO value from the SoC */ ++ const unsigned int eco = 5; ++ ++ rt2800_rf_init_calibration(rt2x00dev, 2); ++ ++ rt2800_rfcsr_write(rt2x00dev, 0, 0xe0); ++ rt2800_rfcsr_write(rt2x00dev, 1, 0x03); ++ rt2800_rfcsr_write(rt2x00dev, 2, 0x50); ++ rt2800_rfcsr_write(rt2x00dev, 3, 0x20); ++ rt2800_rfcsr_write(rt2x00dev, 4, 0x00); ++ rt2800_rfcsr_write(rt2x00dev, 5, 0x00); ++ rt2800_rfcsr_write(rt2x00dev, 6, 0x40); ++ rt2800_rfcsr_write(rt2x00dev, 7, 0x00); ++ rt2800_rfcsr_write(rt2x00dev, 8, 0x5b); ++ rt2800_rfcsr_write(rt2x00dev, 9, 0x08); ++ rt2800_rfcsr_write(rt2x00dev, 10, 0xd3); ++ rt2800_rfcsr_write(rt2x00dev, 11, 0x48); ++ rt2800_rfcsr_write(rt2x00dev, 12, 0x1a); ++ rt2800_rfcsr_write(rt2x00dev, 13, 0x12); ++ rt2800_rfcsr_write(rt2x00dev, 14, 0x00); ++ rt2800_rfcsr_write(rt2x00dev, 15, 0x00); ++ rt2800_rfcsr_write(rt2x00dev, 16, 0x00); ++ ++ /* RFCSR 17 will be initialized later based on the ++ * frequency offset stored in the EEPROM ++ */ ++ ++ rt2800_rfcsr_write(rt2x00dev, 18, 0x40); ++ rt2800_rfcsr_write(rt2x00dev, 19, 0x00); ++ rt2800_rfcsr_write(rt2x00dev, 20, 0x00); ++ rt2800_rfcsr_write(rt2x00dev, 21, 0x00); ++ rt2800_rfcsr_write(rt2x00dev, 22, 0x20); ++ rt2800_rfcsr_write(rt2x00dev, 23, 0xc0); ++ rt2800_rfcsr_write(rt2x00dev, 24, 0x00); ++ rt2800_rfcsr_write(rt2x00dev, 25, 0x00); ++ rt2800_rfcsr_write(rt2x00dev, 26, 0x00); ++ rt2800_rfcsr_write(rt2x00dev, 27, 0x00); ++ rt2800_rfcsr_write(rt2x00dev, 28, 0x00); ++ rt2800_rfcsr_write(rt2x00dev, 29, 0x00); ++ rt2800_rfcsr_write(rt2x00dev, 30, 0x10); ++ rt2800_rfcsr_write(rt2x00dev, 31, 0x80); ++ rt2800_rfcsr_write(rt2x00dev, 32, 0x80); ++ rt2800_rfcsr_write(rt2x00dev, 33, 0x00); ++ rt2800_rfcsr_write(rt2x00dev, 34, 0x20); ++ rt2800_rfcsr_write(rt2x00dev, 35, 0x00); ++ rt2800_rfcsr_write(rt2x00dev, 36, 0x00); ++ rt2800_rfcsr_write(rt2x00dev, 37, 0x00); ++ rt2800_rfcsr_write(rt2x00dev, 38, 0x86); ++ rt2800_rfcsr_write(rt2x00dev, 39, 0x23); ++ rt2800_rfcsr_write(rt2x00dev, 40, 0x00); ++ rt2800_rfcsr_write(rt2x00dev, 41, 0x00); ++ rt2800_rfcsr_write(rt2x00dev, 42, 0x00); ++ rt2800_rfcsr_write(rt2x00dev, 43, 0x00); ++ rt2800_rfcsr_write(rt2x00dev, 44, 0x93); ++ rt2800_rfcsr_write(rt2x00dev, 45, 0xbb); ++ rt2800_rfcsr_write(rt2x00dev, 46, 0x60); ++ rt2800_rfcsr_write(rt2x00dev, 47, 0x00); ++ rt2800_rfcsr_write(rt2x00dev, 48, 0x00); ++ rt2800_rfcsr_write(rt2x00dev, 49, 0x8e); ++ rt2800_rfcsr_write(rt2x00dev, 50, 0x86); ++ rt2800_rfcsr_write(rt2x00dev, 51, 0x51); ++ rt2800_rfcsr_write(rt2x00dev, 52, 0x05); ++ rt2800_rfcsr_write(rt2x00dev, 53, 0x76); ++ rt2800_rfcsr_write(rt2x00dev, 54, 0x76); ++ rt2800_rfcsr_write(rt2x00dev, 55, 0x76); ++ rt2800_rfcsr_write(rt2x00dev, 56, 0xdb); ++ rt2800_rfcsr_write(rt2x00dev, 57, 0x3e); ++ rt2800_rfcsr_write(rt2x00dev, 58, 0x00); ++ rt2800_rfcsr_write(rt2x00dev, 59, 0x00); ++ rt2800_rfcsr_write(rt2x00dev, 60, 0x00); ++ rt2800_rfcsr_write(rt2x00dev, 61, 0x00); ++ rt2800_rfcsr_write(rt2x00dev, 62, 0x00); ++ rt2800_rfcsr_write(rt2x00dev, 63, 0x00); ++ ++ /* TODO: rx filter calibration? */ ++ ++ rt2800_bbp_write(rt2x00dev, 137, 0x0f); ++ ++ rt2800_bbp_write(rt2x00dev, 163, 0x9d); ++ ++ rt2800_bbp_write(rt2x00dev, 105, 0x05); ++ ++ rt2800_bbp_write(rt2x00dev, 179, 0x02); ++ rt2800_bbp_write(rt2x00dev, 180, 0x00); ++ rt2800_bbp_write(rt2x00dev, 182, 0x40); ++ rt2800_bbp_write(rt2x00dev, 180, 0x01); ++ rt2800_bbp_write(rt2x00dev, 182, 0x9c); ++ ++ rt2800_bbp_write(rt2x00dev, 179, 0x00); ++ ++ rt2800_bbp_write(rt2x00dev, 142, 0x04); ++ rt2800_bbp_write(rt2x00dev, 143, 0x3b); ++ rt2800_bbp_write(rt2x00dev, 142, 0x06); ++ rt2800_bbp_write(rt2x00dev, 143, 0xa0); ++ rt2800_bbp_write(rt2x00dev, 142, 0x07); ++ rt2800_bbp_write(rt2x00dev, 143, 0xa1); ++ rt2800_bbp_write(rt2x00dev, 142, 0x08); ++ rt2800_bbp_write(rt2x00dev, 143, 0xa2); ++ rt2800_bbp_write(rt2x00dev, 148, 0xc8); ++ ++ if (eco == 5) { ++ rt2800_rfcsr_write(rt2x00dev, 32, 0xd8); ++ rt2800_rfcsr_write(rt2x00dev, 33, 0x32); ++ } ++ ++ rfcsr = rt2800_rfcsr_read(rt2x00dev, 2); ++ rt2x00_set_field8(&rfcsr, RFCSR2_RESCAL_BP, 0); ++ rt2x00_set_field8(&rfcsr, RFCSR2_RESCAL_EN, 1); ++ rt2800_rfcsr_write(rt2x00dev, 2, rfcsr); ++ msleep(1); ++ rt2x00_set_field8(&rfcsr, RFCSR2_RESCAL_EN, 0); ++ rt2800_rfcsr_write(rt2x00dev, 2, rfcsr); ++ ++ rfcsr = rt2800_rfcsr_read(rt2x00dev, 1); ++ rt2x00_set_field8(&rfcsr, RFCSR1_RF_BLOCK_EN, 1); ++ rt2800_rfcsr_write(rt2x00dev, 1, rfcsr); ++ ++ rfcsr = rt2800_rfcsr_read(rt2x00dev, 6); ++ rfcsr |= 0xc0; ++ rt2800_rfcsr_write(rt2x00dev, 6, rfcsr); ++ ++ rfcsr = rt2800_rfcsr_read(rt2x00dev, 22); ++ rfcsr |= 0x20; ++ rt2800_rfcsr_write(rt2x00dev, 22, rfcsr); ++ ++ rfcsr = rt2800_rfcsr_read(rt2x00dev, 46); ++ rfcsr |= 0x20; ++ rt2800_rfcsr_write(rt2x00dev, 46, rfcsr); ++ ++ rfcsr = rt2800_rfcsr_read(rt2x00dev, 20); ++ rfcsr &= ~0xee; ++ rt2800_rfcsr_write(rt2x00dev, 20, rfcsr); ++} ++ + static void rt2800_init_rfcsr_5390(struct rt2x00_dev *rt2x00dev) + { + rt2800_rf_init_calibration(rt2x00dev, 2); +@@ -8456,6 +8942,9 @@ static void rt2800_init_rfcsr(struct rt2 + case RT3390: + rt2800_init_rfcsr_3390(rt2x00dev); + break; ++ case RT3883: ++ rt2800_init_rfcsr_3883(rt2x00dev); ++ break; + case RT3572: + rt2800_init_rfcsr_3572(rt2x00dev); + break; +@@ -8661,7 +9150,8 @@ static u8 rt2800_get_txmixer_gain_24g(st + { + u16 word; + +- if (rt2x00_rt(rt2x00dev, RT3593)) ++ if (rt2x00_rt(rt2x00dev, RT3593) || ++ rt2x00_rt(rt2x00dev, RT3883)) + return 0; + + word = rt2800_eeprom_read(rt2x00dev, EEPROM_TXMIXER_GAIN_BG); +@@ -8675,7 +9165,8 @@ static u8 rt2800_get_txmixer_gain_5g(str + { + u16 word; + +- if (rt2x00_rt(rt2x00dev, RT3593)) ++ if (rt2x00_rt(rt2x00dev, RT3593) || ++ rt2x00_rt(rt2x00dev, RT3883)) + return 0; + + word = rt2800_eeprom_read(rt2x00dev, EEPROM_TXMIXER_GAIN_A); +@@ -8781,7 +9272,8 @@ static int rt2800_validate_eeprom(struct + word = rt2800_eeprom_read(rt2x00dev, EEPROM_RSSI_BG2); + if (abs(rt2x00_get_field16(word, EEPROM_RSSI_BG2_OFFSET2)) > 10) + rt2x00_set_field16(&word, EEPROM_RSSI_BG2_OFFSET2, 0); +- if (!rt2x00_rt(rt2x00dev, RT3593)) { ++ if (!rt2x00_rt(rt2x00dev, RT3593) && ++ !rt2x00_rt(rt2x00dev, RT3883)) { + if (rt2x00_get_field16(word, EEPROM_RSSI_BG2_LNA_A1) == 0x00 || + rt2x00_get_field16(word, EEPROM_RSSI_BG2_LNA_A1) == 0xff) + rt2x00_set_field16(&word, EEPROM_RSSI_BG2_LNA_A1, +@@ -8801,7 +9293,8 @@ static int rt2800_validate_eeprom(struct + word = rt2800_eeprom_read(rt2x00dev, EEPROM_RSSI_A2); + if (abs(rt2x00_get_field16(word, EEPROM_RSSI_A2_OFFSET2)) > 10) + rt2x00_set_field16(&word, EEPROM_RSSI_A2_OFFSET2, 0); +- if (!rt2x00_rt(rt2x00dev, RT3593)) { ++ if (!rt2x00_rt(rt2x00dev, RT3593) && ++ !rt2x00_rt(rt2x00dev, RT3883)) { + if (rt2x00_get_field16(word, EEPROM_RSSI_A2_LNA_A2) == 0x00 || + rt2x00_get_field16(word, EEPROM_RSSI_A2_LNA_A2) == 0xff) + rt2x00_set_field16(&word, EEPROM_RSSI_A2_LNA_A2, +@@ -8809,7 +9302,8 @@ static int rt2800_validate_eeprom(struct + } + rt2800_eeprom_write(rt2x00dev, EEPROM_RSSI_A2, word); + +- if (rt2x00_rt(rt2x00dev, RT3593)) { ++ if (rt2x00_rt(rt2x00dev, RT3593) || ++ rt2x00_rt(rt2x00dev, RT3883)) { + word = rt2800_eeprom_read(rt2x00dev, EEPROM_EXT_LNA2); + if (rt2x00_get_field16(word, EEPROM_EXT_LNA2_A1) == 0x00 || + rt2x00_get_field16(word, EEPROM_EXT_LNA2_A1) == 0xff) +@@ -8848,6 +9342,8 @@ static int rt2800_init_eeprom(struct rt2 + rf = rt2800_eeprom_read(rt2x00dev, EEPROM_CHIP_ID); + else if (rt2x00_rt(rt2x00dev, RT3352)) + rf = RF3322; ++ else if (rt2x00_rt(rt2x00dev, RT3883)) ++ rf = RF3853; + else if (rt2x00_rt(rt2x00dev, RT5350)) + rf = RF5350; + else +@@ -8868,6 +9364,7 @@ static int rt2800_init_eeprom(struct rt2 + case RF3290: + case RF3320: + case RF3322: ++ case RF3853: + case RF5350: + case RF5360: + case RF5362: +@@ -9154,6 +9651,66 @@ static const struct rf_channel rf_vals_3 + {14, 0xF0, 2, 0x18}, + }; + ++static const struct rf_channel rf_vals_3853[] = { ++ {1, 241, 6, 2}, ++ {2, 241, 6, 7}, ++ {3, 242, 6, 2}, ++ {4, 242, 6, 7}, ++ {5, 243, 6, 2}, ++ {6, 243, 6, 7}, ++ {7, 244, 6, 2}, ++ {8, 244, 6, 7}, ++ {9, 245, 6, 2}, ++ {10, 245, 6, 7}, ++ {11, 246, 6, 2}, ++ {12, 246, 6, 7}, ++ {13, 247, 6, 2}, ++ {14, 248, 6, 4}, ++ ++ {36, 0x56, 8, 4}, ++ {38, 0x56, 8, 6}, ++ {40, 0x56, 8, 8}, ++ {44, 0x57, 8, 0}, ++ {46, 0x57, 8, 2}, ++ {48, 0x57, 8, 4}, ++ {52, 0x57, 8, 8}, ++ {54, 0x57, 8, 10}, ++ {56, 0x58, 8, 0}, ++ {60, 0x58, 8, 4}, ++ {62, 0x58, 8, 6}, ++ {64, 0x58, 8, 8}, ++ ++ {100, 0x5b, 8, 8}, ++ {102, 0x5b, 8, 10}, ++ {104, 0x5c, 8, 0}, ++ {108, 0x5c, 8, 4}, ++ {110, 0x5c, 8, 6}, ++ {112, 0x5c, 8, 8}, ++ {114, 0x5c, 8, 10}, ++ {116, 0x5d, 8, 0}, ++ {118, 0x5d, 8, 2}, ++ {120, 0x5d, 8, 4}, ++ {124, 0x5d, 8, 8}, ++ {126, 0x5d, 8, 10}, ++ {128, 0x5e, 8, 0}, ++ {132, 0x5e, 8, 4}, ++ {134, 0x5e, 8, 6}, ++ {136, 0x5e, 8, 8}, ++ {140, 0x5f, 8, 0}, ++ ++ {149, 0x5f, 8, 9}, ++ {151, 0x5f, 8, 11}, ++ {153, 0x60, 8, 1}, ++ {157, 0x60, 8, 5}, ++ {159, 0x60, 8, 7}, ++ {161, 0x60, 8, 9}, ++ {165, 0x61, 8, 1}, ++ {167, 0x61, 8, 3}, ++ {169, 0x61, 8, 5}, ++ {171, 0x61, 8, 7}, ++ {173, 0x61, 8, 9}, ++}; ++ + static const struct rf_channel rf_vals_5592_xtal20[] = { + /* Channel, N, K, mod, R */ + {1, 482, 4, 10, 3}, +@@ -9417,6 +9974,11 @@ static int rt2800_probe_hw_mode(struct r + spec->channels = rf_vals_3x; + break; + ++ case RF3853: ++ spec->num_channels = ARRAY_SIZE(rf_vals_3853); ++ spec->channels = rf_vals_3853; ++ break; ++ + case RF5592: + reg = rt2800_register_read(rt2x00dev, MAC_DEBUG_INDEX); + if (rt2x00_get_field32(reg, MAC_DEBUG_INDEX_XTAL)) { +@@ -9536,6 +10098,7 @@ static int rt2800_probe_hw_mode(struct r + case RF3053: + case RF3070: + case RF3290: ++ case RF3853: + case RF5350: + case RF5360: + case RF5362: +@@ -9578,6 +10141,7 @@ static int rt2800_probe_rt(struct rt2x00 + case RT3390: + case RT3572: + case RT3593: ++ case RT3883: + case RT5350: + case RT5390: + case RT5392: +--- a/drivers/net/wireless/ralink/rt2x00/rt2800soc.c ++++ b/drivers/net/wireless/ralink/rt2x00/rt2800soc.c +@@ -51,9 +51,16 @@ static bool rt2800soc_hwcrypt_disabled(s + + static void rt2800soc_disable_radio(struct rt2x00_dev *rt2x00dev) + { ++ u32 reg; ++ + rt2800_disable_radio(rt2x00dev); + rt2x00mmio_register_write(rt2x00dev, PWR_PIN_CFG, 0); +- rt2x00mmio_register_write(rt2x00dev, TX_PIN_CFG, 0); ++ ++ reg = 0; ++ if (rt2x00_rt(rt2x00dev, RT3883)) ++ rt2x00_set_field32(®, TX_PIN_CFG_RFTR_EN, 1); ++ ++ rt2x00mmio_register_write(rt2x00dev, TX_PIN_CFG, reg); + } + + static int rt2800soc_set_device_state(struct rt2x00_dev *rt2x00dev, diff --git a/package/kernel/mac80211/patches/rt2x00/502-rt2x00-rt2800lib-enable-support-for-RT3883.patch b/package/kernel/mac80211/patches/rt2x00/502-rt2x00-rt2800lib-enable-support-for-RT3883.patch deleted file mode 100644 index 95cdc7fa6a..0000000000 --- a/package/kernel/mac80211/patches/rt2x00/502-rt2x00-rt2800lib-enable-support-for-RT3883.patch +++ /dev/null @@ -1,20 +0,0 @@ -From 4f16582c93a71eba9d389e0f0a8aa9099a9587cd Mon Sep 17 00:00:00 2001 -From: Gabor Juhos -Date: Sun, 24 Mar 2013 19:26:26 +0100 -Subject: [PATCH] rt2x00: rt2800lib: enable support for RT3883 - -Signed-off-by: Gabor Juhos ---- - drivers/net/wireless/ralink/rt2x00/rt2800lib.c | 1 + - 1 file changed, 1 insertion(+) - ---- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c -+++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c -@@ -9578,6 +9578,7 @@ static int rt2800_probe_rt(struct rt2x00 - case RT3390: - case RT3572: - case RT3593: -+ case RT3883: - case RT5350: - case RT5390: - case RT5392: diff --git a/package/kernel/mac80211/patches/rt2x00/503-rt2x00-rt2800lib-add-rf_vals-for-RF3853.patch b/package/kernel/mac80211/patches/rt2x00/503-rt2x00-rt2800lib-add-rf_vals-for-RF3853.patch deleted file mode 100644 index 160319633b..0000000000 --- a/package/kernel/mac80211/patches/rt2x00/503-rt2x00-rt2800lib-add-rf_vals-for-RF3853.patch +++ /dev/null @@ -1,112 +0,0 @@ -From ecb394ccf248d8652c463133c4f404458a57a9c1 Mon Sep 17 00:00:00 2001 -From: Gabor Juhos -Date: Sun, 24 Mar 2013 19:26:26 +0100 -Subject: [PATCH] rt2x00: rt2800lib: add rf_vals for RF3853 - -Signed-off-by: Gabor Juhos ---- - drivers/net/wireless/ralink/rt2x00/rt2800.h | 4 +- - drivers/net/wireless/ralink/rt2x00/rt2800lib.c | 65 +++++++++++++++++++++++++++++++ - 2 files changed, 68 insertions(+), 1 deletion(-) - ---- a/drivers/net/wireless/ralink/rt2x00/rt2800.h -+++ b/drivers/net/wireless/ralink/rt2x00/rt2800.h -@@ -48,7 +48,8 @@ - * RF2853 2.4G/5G 3T3R - * RF3320 2.4G 1T1R(RT3350/RT3370/RT3390) - * RF3322 2.4G 2T2R(RT3352/RT3371/RT3372/RT3391/RT3392) -- * RF3053 2.4G/5G 3T3R(RT3883/RT3563/RT3573/RT3593/RT3662) -+ * RF3053 2.4G/5G 3T3R(RT3563/RT3573/RT3593) -+ * RF3853 2.4G/5G 3T3R(RT3883/RT3662) - * RF5592 2.4G/5G 2T2R - * RF3070 2.4G 1T1R - * RF5360 2.4G 1T1R -@@ -72,6 +73,7 @@ - #define RF5592 0x000f - #define RF3070 0x3070 - #define RF3290 0x3290 -+#define RF3853 0x3853 - #define RF5350 0x5350 - #define RF5360 0x5360 - #define RF5362 0x5362 ---- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c -+++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c -@@ -9154,6 +9154,66 @@ static const struct rf_channel rf_vals_3 - {14, 0xF0, 2, 0x18}, - }; - -+static const struct rf_channel rf_vals_3853[] = { -+ {1, 241, 6, 2}, -+ {2, 241, 6, 7}, -+ {3, 242, 6, 2}, -+ {4, 242, 6, 7}, -+ {5, 243, 6, 2}, -+ {6, 243, 6, 7}, -+ {7, 244, 6, 2}, -+ {8, 244, 6, 7}, -+ {9, 245, 6, 2}, -+ {10, 245, 6, 7}, -+ {11, 246, 6, 2}, -+ {12, 246, 6, 7}, -+ {13, 247, 6, 2}, -+ {14, 248, 6, 4}, -+ -+ {36, 0x56, 8, 4}, -+ {38, 0x56, 8, 6}, -+ {40, 0x56, 8, 8}, -+ {44, 0x57, 8, 0}, -+ {46, 0x57, 8, 2}, -+ {48, 0x57, 8, 4}, -+ {52, 0x57, 8, 8}, -+ {54, 0x57, 8, 10}, -+ {56, 0x58, 8, 0}, -+ {60, 0x58, 8, 4}, -+ {62, 0x58, 8, 6}, -+ {64, 0x58, 8, 8}, -+ -+ {100, 0x5b, 8, 8}, -+ {102, 0x5b, 8, 10}, -+ {104, 0x5c, 8, 0}, -+ {108, 0x5c, 8, 4}, -+ {110, 0x5c, 8, 6}, -+ {112, 0x5c, 8, 8}, -+ {114, 0x5c, 8, 10}, -+ {116, 0x5d, 8, 0}, -+ {118, 0x5d, 8, 2}, -+ {120, 0x5d, 8, 4}, -+ {124, 0x5d, 8, 8}, -+ {126, 0x5d, 8, 10}, -+ {128, 0x5e, 8, 0}, -+ {132, 0x5e, 8, 4}, -+ {134, 0x5e, 8, 6}, -+ {136, 0x5e, 8, 8}, -+ {140, 0x5f, 8, 0}, -+ -+ {149, 0x5f, 8, 9}, -+ {151, 0x5f, 8, 11}, -+ {153, 0x60, 8, 1}, -+ {157, 0x60, 8, 5}, -+ {159, 0x60, 8, 7}, -+ {161, 0x60, 8, 9}, -+ {165, 0x61, 8, 1}, -+ {167, 0x61, 8, 3}, -+ {169, 0x61, 8, 5}, -+ {171, 0x61, 8, 7}, -+ {173, 0x61, 8, 9}, -+}; -+ - static const struct rf_channel rf_vals_5592_xtal20[] = { - /* Channel, N, K, mod, R */ - {1, 482, 4, 10, 3}, -@@ -9417,6 +9477,11 @@ static int rt2800_probe_hw_mode(struct r - spec->channels = rf_vals_3x; - break; - -+ case RF3853: -+ spec->num_channels = ARRAY_SIZE(rf_vals_3853); -+ spec->channels = rf_vals_3853; -+ break; -+ - case RF5592: - reg = rt2800_register_read(rt2x00dev, MAC_DEBUG_INDEX); - if (rt2x00_get_field32(reg, MAC_DEBUG_INDEX_XTAL)) { diff --git a/package/kernel/mac80211/patches/rt2x00/504-rt2x00-rt2800lib-enable-VCO-calibration-for-RF3853.patch b/package/kernel/mac80211/patches/rt2x00/504-rt2x00-rt2800lib-enable-VCO-calibration-for-RF3853.patch deleted file mode 100644 index dbe592646b..0000000000 --- a/package/kernel/mac80211/patches/rt2x00/504-rt2x00-rt2800lib-enable-VCO-calibration-for-RF3853.patch +++ /dev/null @@ -1,28 +0,0 @@ -From f8e3fcf18e1f2d7f9e6a9680c5452da090f33d88 Mon Sep 17 00:00:00 2001 -From: Gabor Juhos -Date: Thu, 1 Aug 2013 14:40:44 +0200 -Subject: [PATCH] rt2x00: rt2800lib: enable VCO calibration for RF3853 - -Signed-off-by: Gabor Juhos ---- - drivers/net/wireless/ralink/rt2x00/rt2800lib.c | 2 ++ - 1 file changed, 2 insertions(+) - ---- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c -+++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c -@@ -5051,6 +5051,7 @@ void rt2800_vco_calibration(struct rt2x0 - case RF3053: - case RF3070: - case RF3290: -+ case RF3853: - case RF5350: - case RF5360: - case RF5362: -@@ -9601,6 +9602,7 @@ static int rt2800_probe_hw_mode(struct r - case RF3053: - case RF3070: - case RF3290: -+ case RF3853: - case RF5350: - case RF5360: - case RF5362: diff --git a/package/kernel/mac80211/patches/rt2x00/505-rt2x00-rt2800lib-add-channel-configuration-function-.patch b/package/kernel/mac80211/patches/rt2x00/505-rt2x00-rt2800lib-add-channel-configuration-function-.patch deleted file mode 100644 index dc538df484..0000000000 --- a/package/kernel/mac80211/patches/rt2x00/505-rt2x00-rt2800lib-add-channel-configuration-function-.patch +++ /dev/null @@ -1,235 +0,0 @@ -From 6e3a17190815c6aa4dc53c2cfe9125fb1154f187 Mon Sep 17 00:00:00 2001 -From: Gabor Juhos -Date: Sun, 24 Mar 2013 19:26:27 +0100 -Subject: [PATCH] rt2x00: rt2800lib: add channel configuration function for - RF3853 - -Signed-off-by: Gabor Juhos ---- - drivers/net/wireless/ralink/rt2x00/rt2800lib.c | 208 +++++++++++++++++++++++++++++++ - 1 file changed, 208 insertions(+) - ---- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c -+++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c -@@ -2880,6 +2880,211 @@ static void rt2800_config_channel_rf3053 - } - } - -+static void rt2800_config_channel_rf3853(struct rt2x00_dev *rt2x00dev, -+ struct ieee80211_conf *conf, -+ struct rf_channel *rf, -+ struct channel_info *info) -+{ -+ u8 rfcsr; -+ u8 bbp; -+ u8 pwr1, pwr2, pwr3; -+ -+ const bool txbf_enabled = false; /* TODO */ -+ -+ /* TODO: add band selection */ -+ -+ if (rf->channel <= 14) -+ rt2800_rfcsr_write(rt2x00dev, 6, 0x40); -+ else if (rf->channel < 132) -+ rt2800_rfcsr_write(rt2x00dev, 6, 0x80); -+ else -+ rt2800_rfcsr_write(rt2x00dev, 6, 0x40); -+ -+ rt2800_rfcsr_write(rt2x00dev, 8, rf->rf1); -+ rt2800_rfcsr_write(rt2x00dev, 9, rf->rf3); -+ -+ if (rf->channel <= 14) -+ rt2800_rfcsr_write(rt2x00dev, 11, 0x46); -+ else -+ rt2800_rfcsr_write(rt2x00dev, 11, 0x48); -+ -+ if (rf->channel <= 14) -+ rt2800_rfcsr_write(rt2x00dev, 12, 0x1a); -+ else -+ rt2800_rfcsr_write(rt2x00dev, 12, 0x52); -+ -+ rt2800_rfcsr_write(rt2x00dev, 13, 0x12); -+ -+ rfcsr = rt2800_rfcsr_read(rt2x00dev, 1); -+ rt2x00_set_field8(&rfcsr, RFCSR1_RX0_PD, 0); -+ rt2x00_set_field8(&rfcsr, RFCSR1_TX0_PD, 0); -+ rt2x00_set_field8(&rfcsr, RFCSR1_RX1_PD, 0); -+ rt2x00_set_field8(&rfcsr, RFCSR1_TX1_PD, 0); -+ rt2x00_set_field8(&rfcsr, RFCSR1_RX2_PD, 0); -+ rt2x00_set_field8(&rfcsr, RFCSR1_TX2_PD, 0); -+ rt2x00_set_field8(&rfcsr, RFCSR1_RF_BLOCK_EN, 1); -+ rt2x00_set_field8(&rfcsr, RFCSR1_PLL_PD, 1); -+ -+ switch (rt2x00dev->default_ant.tx_chain_num) { -+ case 3: -+ rt2x00_set_field8(&rfcsr, RFCSR1_TX2_PD, 1); -+ /* fallthrough */ -+ case 2: -+ rt2x00_set_field8(&rfcsr, RFCSR1_TX1_PD, 1); -+ /* fallthrough */ -+ case 1: -+ rt2x00_set_field8(&rfcsr, RFCSR1_TX0_PD, 1); -+ break; -+ } -+ -+ switch (rt2x00dev->default_ant.rx_chain_num) { -+ case 3: -+ rt2x00_set_field8(&rfcsr, RFCSR1_RX2_PD, 1); -+ /* fallthrough */ -+ case 2: -+ rt2x00_set_field8(&rfcsr, RFCSR1_RX1_PD, 1); -+ /* fallthrough */ -+ case 1: -+ rt2x00_set_field8(&rfcsr, RFCSR1_RX0_PD, 1); -+ break; -+ } -+ rt2800_rfcsr_write(rt2x00dev, 1, rfcsr); -+ -+ rt2800_freq_cal_mode1(rt2x00dev); -+ -+ rfcsr = rt2800_rfcsr_read(rt2x00dev, 30); -+ if (!conf_is_ht40(conf)) -+ rfcsr &= ~(0x06); -+ else -+ rfcsr |= 0x06; -+ rt2800_rfcsr_write(rt2x00dev, 30, rfcsr); -+ -+ if (rf->channel <= 14) -+ rt2800_rfcsr_write(rt2x00dev, 31, 0xa0); -+ else -+ rt2800_rfcsr_write(rt2x00dev, 31, 0x80); -+ -+ if (conf_is_ht40(conf)) -+ rt2800_rfcsr_write(rt2x00dev, 32, 0x80); -+ else -+ rt2800_rfcsr_write(rt2x00dev, 32, 0xd8); -+ -+ if (rf->channel <= 14) -+ rt2800_rfcsr_write(rt2x00dev, 34, 0x3c); -+ else -+ rt2800_rfcsr_write(rt2x00dev, 34, 0x20); -+ -+ /* loopback RF_BS */ -+ rfcsr = rt2800_rfcsr_read(rt2x00dev, 36); -+ if (rf->channel <= 14) -+ rt2x00_set_field8(&rfcsr, RFCSR36_RF_BS, 1); -+ else -+ rt2x00_set_field8(&rfcsr, RFCSR36_RF_BS, 0); -+ rt2800_rfcsr_write(rt2x00dev, 36, rfcsr); -+ -+ if (rf->channel <= 14) -+ rfcsr = 0x23; -+ else if (rf->channel < 100) -+ rfcsr = 0x36; -+ else if (rf->channel < 132) -+ rfcsr = 0x32; -+ else -+ rfcsr = 0x30; -+ -+ if (txbf_enabled) -+ rfcsr |= 0x40; -+ -+ rt2800_rfcsr_write(rt2x00dev, 39, rfcsr); -+ -+ if (rf->channel <= 14) -+ rt2800_rfcsr_write(rt2x00dev, 44, 0x93); -+ else -+ rt2800_rfcsr_write(rt2x00dev, 44, 0x9b); -+ -+ if (rf->channel <= 14) -+ rfcsr = 0xbb; -+ else if (rf->channel < 100) -+ rfcsr = 0xeb; -+ else if (rf->channel < 132) -+ rfcsr = 0xb3; -+ else -+ rfcsr = 0x9b; -+ rt2800_rfcsr_write(rt2x00dev, 45, rfcsr); -+ -+ if (rf->channel <= 14) -+ rfcsr = 0x8e; -+ else -+ rfcsr = 0x8a; -+ -+ if (txbf_enabled) -+ rfcsr |= 0x20; -+ -+ rt2800_rfcsr_write(rt2x00dev, 49, rfcsr); -+ -+ rt2800_rfcsr_write(rt2x00dev, 50, 0x86); -+ -+ rfcsr = rt2800_rfcsr_read(rt2x00dev, 51); -+ if (rf->channel <= 14) -+ rt2800_rfcsr_write(rt2x00dev, 51, 0x75); -+ else -+ rt2800_rfcsr_write(rt2x00dev, 51, 0x51); -+ -+ rfcsr = rt2800_rfcsr_read(rt2x00dev, 52); -+ if (rf->channel <= 14) -+ rt2800_rfcsr_write(rt2x00dev, 52, 0x45); -+ else -+ rt2800_rfcsr_write(rt2x00dev, 52, 0x05); -+ -+ if (rf->channel <= 14) { -+ pwr1 = info->default_power1 & 0x1f; -+ pwr2 = info->default_power2 & 0x1f; -+ pwr3 = info->default_power3 & 0x1f; -+ } else { -+ pwr1 = 0x48 | ((info->default_power1 & 0x18) << 1) | -+ (info->default_power1 & 0x7); -+ pwr2 = 0x48 | ((info->default_power2 & 0x18) << 1) | -+ (info->default_power2 & 0x7); -+ pwr3 = 0x48 | ((info->default_power3 & 0x18) << 1) | -+ (info->default_power3 & 0x7); -+ } -+ -+ rt2800_rfcsr_write(rt2x00dev, 53, pwr1); -+ rt2800_rfcsr_write(rt2x00dev, 54, pwr2); -+ rt2800_rfcsr_write(rt2x00dev, 55, pwr3); -+ -+ rt2x00_dbg(rt2x00dev, "Channel:%d, pwr1:%02x, pwr2:%02x, pwr3:%02x\n", -+ rf->channel, pwr1, pwr2, pwr3); -+ -+ bbp = (info->default_power1 >> 5) | -+ ((info->default_power2 & 0xe0) >> 1); -+ rt2800_bbp_write(rt2x00dev, 109, bbp); -+ -+ bbp = rt2800_bbp_read(rt2x00dev, 110); -+ bbp &= 0x0f; -+ bbp |= (info->default_power3 & 0xe0) >> 1; -+ rt2800_bbp_write(rt2x00dev, 110, bbp); -+ -+ rfcsr = rt2800_rfcsr_read(rt2x00dev, 57); -+ if (rf->channel <= 14) -+ rt2800_rfcsr_write(rt2x00dev, 57, 0x6e); -+ else -+ rt2800_rfcsr_write(rt2x00dev, 57, 0x3e); -+ -+ /* Enable RF tuning */ -+ rfcsr = rt2800_rfcsr_read(rt2x00dev, 3); -+ rt2x00_set_field8(&rfcsr, RFCSR3_VCOCAL_EN, 1); -+ rt2800_rfcsr_write(rt2x00dev, 3, rfcsr); -+ -+ udelay(2000); -+ -+ bbp = rt2800_bbp_read(rt2x00dev, 49); -+ /* clear update flag */ -+ rt2800_bbp_write(rt2x00dev, 49, bbp & 0xfe); -+ rt2800_bbp_write(rt2x00dev, 49, bbp); -+ -+ /* TODO: add calibration for TxBF */ -+} -+ - #define POWER_BOUND 0x27 - #define POWER_BOUND_5G 0x2b - -@@ -3734,6 +3939,9 @@ static void rt2800_config_channel(struct - case RF3322: - rt2800_config_channel_rf3322(rt2x00dev, conf, rf, info); - break; -+ case RF3853: -+ rt2800_config_channel_rf3853(rt2x00dev, conf, rf, info); -+ break; - case RF3070: - case RF5350: - case RF5360: diff --git a/package/kernel/mac80211/patches/rt2x00/506-rt2x00-rt2800lib-enable-RF3853-support.patch b/package/kernel/mac80211/patches/rt2x00/506-rt2x00-rt2800lib-enable-RF3853-support.patch deleted file mode 100644 index c6ffd7a374..0000000000 --- a/package/kernel/mac80211/patches/rt2x00/506-rt2x00-rt2800lib-enable-RF3853-support.patch +++ /dev/null @@ -1,20 +0,0 @@ -From afd38ae82226551bf879b6c7c4b620c271fee9d2 Mon Sep 17 00:00:00 2001 -From: Gabor Juhos -Date: Thu, 1 Aug 2013 14:42:05 +0200 -Subject: [PATCH] rt2x00: rt2800lib: enable RF3853 support - -Signed-off-by: Gabor Juhos ---- - drivers/net/wireless/ralink/rt2x00/rt2800lib.c | 1 + - 1 file changed, 1 insertion(+) - ---- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c -+++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c -@@ -9077,6 +9077,7 @@ static int rt2800_init_eeprom(struct rt2 - case RF3290: - case RF3320: - case RF3322: -+ case RF3853: - case RF5350: - case RF5360: - case RF5362: diff --git a/package/kernel/mac80211/patches/rt2x00/507-rt2x00-rt2800lib-add-MAC-register-initialization-for.patch b/package/kernel/mac80211/patches/rt2x00/507-rt2x00-rt2800lib-add-MAC-register-initialization-for.patch deleted file mode 100644 index 102374a474..0000000000 --- a/package/kernel/mac80211/patches/rt2x00/507-rt2x00-rt2800lib-add-MAC-register-initialization-for.patch +++ /dev/null @@ -1,62 +0,0 @@ -From 0094872a5e8e4664c6ea1b2dfa487063d39ae363 Mon Sep 17 00:00:00 2001 -From: Gabor Juhos -Date: Sun, 24 Mar 2013 19:26:26 +0100 -Subject: [PATCH] rt2x00: rt2800lib: add MAC register initialization for - RT3883 - -Signed-off-by: Gabor Juhos ---- - drivers/net/wireless/ralink/rt2x00/rt2800.h | 14 ++++++++++++++ - drivers/net/wireless/ralink/rt2x00/rt2800lib.c | 19 ++++++++++++++++--- - 2 files changed, 30 insertions(+), 3 deletions(-) - ---- a/drivers/net/wireless/ralink/rt2x00/rt2800.h -+++ b/drivers/net/wireless/ralink/rt2x00/rt2800.h -@@ -1728,6 +1728,20 @@ - #define TX_PWR_CFG_9B_STBC_MCS7 FIELD32(0x000000ff) - - /* -+ * TX_TXBF_CFG: -+ */ -+#define TX_TXBF_CFG_0 0x138c -+#define TX_TXBF_CFG_1 0x13a4 -+#define TX_TXBF_CFG_2 0x13a8 -+#define TX_TXBF_CFG_3 0x13ac -+ -+/* -+ * TX_FBK_CFG_3S: -+ */ -+#define TX_FBK_CFG_3S_0 0x13c4 -+#define TX_FBK_CFG_3S_1 0x13c8 -+ -+/* - * RX_FILTER_CFG: RX configuration register. - */ - #define RX_FILTER_CFG 0x1400 ---- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c -+++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c -@@ -5679,6 +5679,12 @@ static int rt2800_init_registers(struct - rt2800_register_write(rt2x00dev, TX_SW_CFG2, - 0x00000000); - } -+ } else if (rt2x00_rt(rt2x00dev, RT3883)) { -+ rt2800_register_write(rt2x00dev, TX_SW_CFG0, 0x00000402); -+ rt2800_register_write(rt2x00dev, TX_SW_CFG1, 0x00000000); -+ rt2800_register_write(rt2x00dev, TX_SW_CFG2, 0x00040000); -+ rt2800_register_write(rt2x00dev, TX_TXBF_CFG_0, 0x8000fc21); -+ rt2800_register_write(rt2x00dev, TX_TXBF_CFG_3, 0x00009c40); - } else if (rt2x00_rt(rt2x00dev, RT5390) || - rt2x00_rt(rt2x00dev, RT5392) || - rt2x00_rt(rt2x00dev, RT6352)) { -@@ -5892,6 +5898,11 @@ static int rt2800_init_registers(struct - reg = rt2x00_rt(rt2x00dev, RT5592) ? 0x00000082 : 0x00000002; - rt2800_register_write(rt2x00dev, TXOP_HLDR_ET, reg); - -+ if (rt2x00_rt(rt2x00dev, RT3883)) { -+ rt2800_register_write(rt2x00dev, TX_FBK_CFG_3S_0, 0x12111008); -+ rt2800_register_write(rt2x00dev, TX_FBK_CFG_3S_1, 0x16151413); -+ } -+ - reg = rt2800_register_read(rt2x00dev, TX_RTS_CFG); - rt2x00_set_field32(®, TX_RTS_CFG_AUTO_RTS_RETRY_LIMIT, 7); - rt2x00_set_field32(®, TX_RTS_CFG_RTS_THRES, diff --git a/package/kernel/mac80211/patches/rt2x00/508-rt2x00-rt2800soc-fix-rt2800soc_disable_radio-for-RT3.patch b/package/kernel/mac80211/patches/rt2x00/508-rt2x00-rt2800soc-fix-rt2800soc_disable_radio-for-RT3.patch deleted file mode 100644 index d68ad50447..0000000000 --- a/package/kernel/mac80211/patches/rt2x00/508-rt2x00-rt2800soc-fix-rt2800soc_disable_radio-for-RT3.patch +++ /dev/null @@ -1,30 +0,0 @@ -From 6c2d32478159fffff0b85abb6817a21bb2338231 Mon Sep 17 00:00:00 2001 -From: Gabor Juhos -Date: Sun, 24 Mar 2013 19:26:27 +0100 -Subject: [PATCH] rt2x00: rt2800soc: fix rt2800soc_disable_radio for RT3883 - -Signed-off-by: Gabor Juhos ---- - drivers/net/wireless/ralink/rt2x00/rt2800soc.c | 9 ++++++++- - 1 file changed, 8 insertions(+), 1 deletion(-) - ---- a/drivers/net/wireless/ralink/rt2x00/rt2800soc.c -+++ b/drivers/net/wireless/ralink/rt2x00/rt2800soc.c -@@ -51,9 +51,16 @@ static bool rt2800soc_hwcrypt_disabled(s - - static void rt2800soc_disable_radio(struct rt2x00_dev *rt2x00dev) - { -+ u32 reg; -+ - rt2800_disable_radio(rt2x00dev); - rt2x00mmio_register_write(rt2x00dev, PWR_PIN_CFG, 0); -- rt2x00mmio_register_write(rt2x00dev, TX_PIN_CFG, 0); -+ -+ reg = 0; -+ if (rt2x00_rt(rt2x00dev, RT3883)) -+ rt2x00_set_field32(®, TX_PIN_CFG_RFTR_EN, 1); -+ -+ rt2x00mmio_register_write(rt2x00dev, TX_PIN_CFG, reg); - } - - static int rt2800soc_set_device_state(struct rt2x00_dev *rt2x00dev, diff --git a/package/kernel/mac80211/patches/rt2x00/509-rt2x00-rt2800lib-add-BBP-register-initialization-for.patch b/package/kernel/mac80211/patches/rt2x00/509-rt2x00-rt2800lib-add-BBP-register-initialization-for.patch deleted file mode 100644 index 3879d0f712..0000000000 --- a/package/kernel/mac80211/patches/rt2x00/509-rt2x00-rt2800lib-add-BBP-register-initialization-for.patch +++ /dev/null @@ -1,71 +0,0 @@ -From 84833056aa7dd25f5b097e31c78f2a0914c5160c Mon Sep 17 00:00:00 2001 -From: Gabor Juhos -Date: Sun, 24 Mar 2013 19:26:26 +0100 -Subject: [PATCH] rt2x00: rt2800lib: add BBP register initialization for - RT3883 - -Signed-off-by: Gabor Juhos ---- - drivers/net/wireless/ralink/rt2x00/rt2800lib.c | 44 +++++++++++++++++++++++++++++++ - 1 file changed, 44 insertions(+) - ---- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c -+++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c -@@ -6519,6 +6519,47 @@ static void rt2800_init_bbp_3593(struct - rt2800_bbp_write(rt2x00dev, 103, 0xc0); - } - -+static void rt2800_init_bbp_3883(struct rt2x00_dev *rt2x00dev) -+{ -+ rt2800_init_bbp_early(rt2x00dev); -+ -+ rt2800_bbp_write(rt2x00dev, 4, 0x50); -+ rt2800_bbp_write(rt2x00dev, 47, 0x48); -+ -+ rt2800_bbp_write(rt2x00dev, 86, 0x46); -+ rt2800_bbp_write(rt2x00dev, 88, 0x90); -+ -+ rt2800_bbp_write(rt2x00dev, 92, 0x02); -+ -+ rt2800_bbp_write(rt2x00dev, 103, 0xc0); -+ rt2800_bbp_write(rt2x00dev, 104, 0x92); -+ rt2800_bbp_write(rt2x00dev, 105, 0x34); -+ rt2800_bbp_write(rt2x00dev, 106, 0x12); -+ rt2800_bbp_write(rt2x00dev, 120, 0x50); -+ rt2800_bbp_write(rt2x00dev, 137, 0x0f); -+ rt2800_bbp_write(rt2x00dev, 163, 0x9d); -+ -+ /* Set ITxBF timeout to 0x9C40=1000msec */ -+ rt2800_bbp_write(rt2x00dev, 179, 0x02); -+ rt2800_bbp_write(rt2x00dev, 180, 0x00); -+ rt2800_bbp_write(rt2x00dev, 182, 0x40); -+ rt2800_bbp_write(rt2x00dev, 180, 0x01); -+ rt2800_bbp_write(rt2x00dev, 182, 0x9c); -+ -+ rt2800_bbp_write(rt2x00dev, 179, 0x00); -+ -+ /* Reprogram the inband interface to put right values in RXWI */ -+ rt2800_bbp_write(rt2x00dev, 142, 0x04); -+ rt2800_bbp_write(rt2x00dev, 143, 0x3b); -+ rt2800_bbp_write(rt2x00dev, 142, 0x06); -+ rt2800_bbp_write(rt2x00dev, 143, 0xa0); -+ rt2800_bbp_write(rt2x00dev, 142, 0x07); -+ rt2800_bbp_write(rt2x00dev, 143, 0xa1); -+ rt2800_bbp_write(rt2x00dev, 142, 0x08); -+ rt2800_bbp_write(rt2x00dev, 143, 0xa2); -+ rt2800_bbp_write(rt2x00dev, 148, 0xc8); -+} -+ - static void rt2800_init_bbp_53xx(struct rt2x00_dev *rt2x00dev) - { - int ant, div_mode; -@@ -6963,6 +7004,9 @@ static void rt2800_init_bbp(struct rt2x0 - case RT3593: - rt2800_init_bbp_3593(rt2x00dev); - return; -+ case RT3883: -+ rt2800_init_bbp_3883(rt2x00dev); -+ return; - case RT5390: - case RT5392: - rt2800_init_bbp_53xx(rt2x00dev); diff --git a/package/kernel/mac80211/patches/rt2x00/510-rt2x00-rt2800lib-add-RFCSR-initialization-for-RT3883.patch b/package/kernel/mac80211/patches/rt2x00/510-rt2x00-rt2800lib-add-RFCSR-initialization-for-RT3883.patch deleted file mode 100644 index c3c37e902f..0000000000 --- a/package/kernel/mac80211/patches/rt2x00/510-rt2x00-rt2800lib-add-RFCSR-initialization-for-RT3883.patch +++ /dev/null @@ -1,178 +0,0 @@ -From 99c659cf345640fd0f733cbcaf4583cc2c868ec0 Mon Sep 17 00:00:00 2001 -From: Gabor Juhos -Date: Mon, 29 Apr 2013 13:21:48 +0200 -Subject: [PATCH] rt2x00: rt2800lib: add RFCSR initialization for RT3883 - -Signed-off-by: Gabor Juhos ---- - drivers/net/wireless/ralink/rt2x00/rt2800.h | 1 + - drivers/net/wireless/ralink/rt2x00/rt2800lib.c | 141 +++++++++++++++++++++++++++++++ - 2 files changed, 142 insertions(+) - ---- a/drivers/net/wireless/ralink/rt2x00/rt2800.h -+++ b/drivers/net/wireless/ralink/rt2x00/rt2800.h -@@ -2312,6 +2312,7 @@ struct mac_iveiv_entry { - /* - * RFCSR 2: - */ -+#define RFCSR2_RESCAL_BP FIELD8(0x40) - #define RFCSR2_RESCAL_EN FIELD8(0x80) - #define RFCSR2_RX2_EN_MT7620 FIELD8(0x02) - #define RFCSR2_TX2_EN_MT7620 FIELD8(0x20) ---- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c -+++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c -@@ -7878,6 +7878,144 @@ static void rt2800_init_rfcsr_5350(struc - rt2800_rfcsr_write(rt2x00dev, 63, 0x00); - } - -+static void rt2800_init_rfcsr_3883(struct rt2x00_dev *rt2x00dev) -+{ -+ u8 rfcsr; -+ -+ /* TODO: get the actual ECO value from the SoC */ -+ const unsigned int eco = 5; -+ -+ rt2800_rf_init_calibration(rt2x00dev, 2); -+ -+ rt2800_rfcsr_write(rt2x00dev, 0, 0xe0); -+ rt2800_rfcsr_write(rt2x00dev, 1, 0x03); -+ rt2800_rfcsr_write(rt2x00dev, 2, 0x50); -+ rt2800_rfcsr_write(rt2x00dev, 3, 0x20); -+ rt2800_rfcsr_write(rt2x00dev, 4, 0x00); -+ rt2800_rfcsr_write(rt2x00dev, 5, 0x00); -+ rt2800_rfcsr_write(rt2x00dev, 6, 0x40); -+ rt2800_rfcsr_write(rt2x00dev, 7, 0x00); -+ rt2800_rfcsr_write(rt2x00dev, 8, 0x5b); -+ rt2800_rfcsr_write(rt2x00dev, 9, 0x08); -+ rt2800_rfcsr_write(rt2x00dev, 10, 0xd3); -+ rt2800_rfcsr_write(rt2x00dev, 11, 0x48); -+ rt2800_rfcsr_write(rt2x00dev, 12, 0x1a); -+ rt2800_rfcsr_write(rt2x00dev, 13, 0x12); -+ rt2800_rfcsr_write(rt2x00dev, 14, 0x00); -+ rt2800_rfcsr_write(rt2x00dev, 15, 0x00); -+ rt2800_rfcsr_write(rt2x00dev, 16, 0x00); -+ -+ /* RFCSR 17 will be initialized later based on the -+ * frequency offset stored in the EEPROM -+ */ -+ -+ rt2800_rfcsr_write(rt2x00dev, 18, 0x40); -+ rt2800_rfcsr_write(rt2x00dev, 19, 0x00); -+ rt2800_rfcsr_write(rt2x00dev, 20, 0x00); -+ rt2800_rfcsr_write(rt2x00dev, 21, 0x00); -+ rt2800_rfcsr_write(rt2x00dev, 22, 0x20); -+ rt2800_rfcsr_write(rt2x00dev, 23, 0xc0); -+ rt2800_rfcsr_write(rt2x00dev, 24, 0x00); -+ rt2800_rfcsr_write(rt2x00dev, 25, 0x00); -+ rt2800_rfcsr_write(rt2x00dev, 26, 0x00); -+ rt2800_rfcsr_write(rt2x00dev, 27, 0x00); -+ rt2800_rfcsr_write(rt2x00dev, 28, 0x00); -+ rt2800_rfcsr_write(rt2x00dev, 29, 0x00); -+ rt2800_rfcsr_write(rt2x00dev, 30, 0x10); -+ rt2800_rfcsr_write(rt2x00dev, 31, 0x80); -+ rt2800_rfcsr_write(rt2x00dev, 32, 0x80); -+ rt2800_rfcsr_write(rt2x00dev, 33, 0x00); -+ rt2800_rfcsr_write(rt2x00dev, 34, 0x20); -+ rt2800_rfcsr_write(rt2x00dev, 35, 0x00); -+ rt2800_rfcsr_write(rt2x00dev, 36, 0x00); -+ rt2800_rfcsr_write(rt2x00dev, 37, 0x00); -+ rt2800_rfcsr_write(rt2x00dev, 38, 0x86); -+ rt2800_rfcsr_write(rt2x00dev, 39, 0x23); -+ rt2800_rfcsr_write(rt2x00dev, 40, 0x00); -+ rt2800_rfcsr_write(rt2x00dev, 41, 0x00); -+ rt2800_rfcsr_write(rt2x00dev, 42, 0x00); -+ rt2800_rfcsr_write(rt2x00dev, 43, 0x00); -+ rt2800_rfcsr_write(rt2x00dev, 44, 0x93); -+ rt2800_rfcsr_write(rt2x00dev, 45, 0xbb); -+ rt2800_rfcsr_write(rt2x00dev, 46, 0x60); -+ rt2800_rfcsr_write(rt2x00dev, 47, 0x00); -+ rt2800_rfcsr_write(rt2x00dev, 48, 0x00); -+ rt2800_rfcsr_write(rt2x00dev, 49, 0x8e); -+ rt2800_rfcsr_write(rt2x00dev, 50, 0x86); -+ rt2800_rfcsr_write(rt2x00dev, 51, 0x51); -+ rt2800_rfcsr_write(rt2x00dev, 52, 0x05); -+ rt2800_rfcsr_write(rt2x00dev, 53, 0x76); -+ rt2800_rfcsr_write(rt2x00dev, 54, 0x76); -+ rt2800_rfcsr_write(rt2x00dev, 55, 0x76); -+ rt2800_rfcsr_write(rt2x00dev, 56, 0xdb); -+ rt2800_rfcsr_write(rt2x00dev, 57, 0x3e); -+ rt2800_rfcsr_write(rt2x00dev, 58, 0x00); -+ rt2800_rfcsr_write(rt2x00dev, 59, 0x00); -+ rt2800_rfcsr_write(rt2x00dev, 60, 0x00); -+ rt2800_rfcsr_write(rt2x00dev, 61, 0x00); -+ rt2800_rfcsr_write(rt2x00dev, 62, 0x00); -+ rt2800_rfcsr_write(rt2x00dev, 63, 0x00); -+ -+ /* TODO: rx filter calibration? */ -+ -+ rt2800_bbp_write(rt2x00dev, 137, 0x0f); -+ -+ rt2800_bbp_write(rt2x00dev, 163, 0x9d); -+ -+ rt2800_bbp_write(rt2x00dev, 105, 0x05); -+ -+ rt2800_bbp_write(rt2x00dev, 179, 0x02); -+ rt2800_bbp_write(rt2x00dev, 180, 0x00); -+ rt2800_bbp_write(rt2x00dev, 182, 0x40); -+ rt2800_bbp_write(rt2x00dev, 180, 0x01); -+ rt2800_bbp_write(rt2x00dev, 182, 0x9c); -+ -+ rt2800_bbp_write(rt2x00dev, 179, 0x00); -+ -+ rt2800_bbp_write(rt2x00dev, 142, 0x04); -+ rt2800_bbp_write(rt2x00dev, 143, 0x3b); -+ rt2800_bbp_write(rt2x00dev, 142, 0x06); -+ rt2800_bbp_write(rt2x00dev, 143, 0xa0); -+ rt2800_bbp_write(rt2x00dev, 142, 0x07); -+ rt2800_bbp_write(rt2x00dev, 143, 0xa1); -+ rt2800_bbp_write(rt2x00dev, 142, 0x08); -+ rt2800_bbp_write(rt2x00dev, 143, 0xa2); -+ rt2800_bbp_write(rt2x00dev, 148, 0xc8); -+ -+ if (eco == 5) { -+ rt2800_rfcsr_write(rt2x00dev, 32, 0xd8); -+ rt2800_rfcsr_write(rt2x00dev, 33, 0x32); -+ } -+ -+ rfcsr = rt2800_rfcsr_read(rt2x00dev, 2); -+ rt2x00_set_field8(&rfcsr, RFCSR2_RESCAL_BP, 0); -+ rt2x00_set_field8(&rfcsr, RFCSR2_RESCAL_EN, 1); -+ rt2800_rfcsr_write(rt2x00dev, 2, rfcsr); -+ msleep(1); -+ rt2x00_set_field8(&rfcsr, RFCSR2_RESCAL_EN, 0); -+ rt2800_rfcsr_write(rt2x00dev, 2, rfcsr); -+ -+ rfcsr = rt2800_rfcsr_read(rt2x00dev, 1); -+ rt2x00_set_field8(&rfcsr, RFCSR1_RF_BLOCK_EN, 1); -+ rt2800_rfcsr_write(rt2x00dev, 1, rfcsr); -+ -+ rfcsr = rt2800_rfcsr_read(rt2x00dev, 6); -+ rfcsr |= 0xc0; -+ rt2800_rfcsr_write(rt2x00dev, 6, rfcsr); -+ -+ rfcsr = rt2800_rfcsr_read(rt2x00dev, 22); -+ rfcsr |= 0x20; -+ rt2800_rfcsr_write(rt2x00dev, 22, rfcsr); -+ -+ rfcsr = rt2800_rfcsr_read(rt2x00dev, 46); -+ rfcsr |= 0x20; -+ rt2800_rfcsr_write(rt2x00dev, 46, rfcsr); -+ -+ rfcsr = rt2800_rfcsr_read(rt2x00dev, 20); -+ rfcsr &= ~0xee; -+ rt2800_rfcsr_write(rt2x00dev, 20, rfcsr); -+} -+ - static void rt2800_init_rfcsr_5390(struct rt2x00_dev *rt2x00dev) - { - rt2800_rf_init_calibration(rt2x00dev, 2); -@@ -8720,6 +8858,9 @@ static void rt2800_init_rfcsr(struct rt2 - case RT3390: - rt2800_init_rfcsr_3390(rt2x00dev); - break; -+ case RT3883: -+ rt2800_init_rfcsr_3883(rt2x00dev); -+ break; - case RT3572: - rt2800_init_rfcsr_3572(rt2x00dev); - break; diff --git a/package/kernel/mac80211/patches/rt2x00/511-rt2x00-rt2800lib-use-the-extended-EEPROM-map-for-RT3.patch b/package/kernel/mac80211/patches/rt2x00/511-rt2x00-rt2800lib-use-the-extended-EEPROM-map-for-RT3.patch deleted file mode 100644 index e74f399e65..0000000000 --- a/package/kernel/mac80211/patches/rt2x00/511-rt2x00-rt2800lib-use-the-extended-EEPROM-map-for-RT3.patch +++ /dev/null @@ -1,22 +0,0 @@ -From 86022438ffeb1b87dfcd018bf477fdbb43076691 Mon Sep 17 00:00:00 2001 -From: Gabor Juhos -Date: Wed, 8 May 2013 19:35:33 +0200 -Subject: [PATCH] rt2x00: rt2800lib: use the extended EEPROM map for RT3883 - -Signed-off-by: Gabor Juhos ---- - drivers/net/wireless/ralink/rt2x00/rt2800lib.c | 3 ++- - 1 file changed, 2 insertions(+), 1 deletion(-) - ---- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c -+++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c -@@ -381,7 +381,8 @@ static unsigned int rt2800_eeprom_word_i - wiphy_name(rt2x00dev->hw->wiphy), word)) - return 0; - -- if (rt2x00_rt(rt2x00dev, RT3593)) -+ if (rt2x00_rt(rt2x00dev, RT3593) || -+ rt2x00_rt(rt2x00dev, RT3883)) - map = rt2800_eeprom_map_ext; - else - map = rt2800_eeprom_map; diff --git a/package/kernel/mac80211/patches/rt2x00/512-rt2x00-rt2800lib-force-rf-type-to-RF3853-on-RT3883.patch b/package/kernel/mac80211/patches/rt2x00/512-rt2x00-rt2800lib-force-rf-type-to-RF3853-on-RT3883.patch deleted file mode 100644 index 62a199d61f..0000000000 --- a/package/kernel/mac80211/patches/rt2x00/512-rt2x00-rt2800lib-force-rf-type-to-RF3853-on-RT3883.patch +++ /dev/null @@ -1,21 +0,0 @@ -From 4cf5403f02fa65dc2207f61d223cffa9ae50e907 Mon Sep 17 00:00:00 2001 -From: Gabor Juhos -Date: Thu, 1 Aug 2013 14:48:21 +0200 -Subject: [PATCH] rt2x00: rt2800lib: force rf type to RF3853 on RT3883 - -Signed-off-by: Gabor Juhos ---- - drivers/net/wireless/ralink/rt2x00/rt2800lib.c | 2 ++ - 1 file changed, 2 insertions(+) - ---- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c -+++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c -@@ -9254,6 +9254,8 @@ static int rt2800_init_eeprom(struct rt2 - rf = rt2800_eeprom_read(rt2x00dev, EEPROM_CHIP_ID); - else if (rt2x00_rt(rt2x00dev, RT3352)) - rf = RF3322; -+ else if (rt2x00_rt(rt2x00dev, RT3883)) -+ rf = RF3853; - else if (rt2x00_rt(rt2x00dev, RT5350)) - rf = RF5350; - else diff --git a/package/kernel/mac80211/patches/rt2x00/513-rt2x00-rt2800lib-add-channel-configuration-code-for-.patch b/package/kernel/mac80211/patches/rt2x00/513-rt2x00-rt2800lib-add-channel-configuration-code-for-.patch deleted file mode 100644 index 2b0869099e..0000000000 --- a/package/kernel/mac80211/patches/rt2x00/513-rt2x00-rt2800lib-add-channel-configuration-code-for-.patch +++ /dev/null @@ -1,136 +0,0 @@ -From 269f19c848a2380db03a3f207cafb88e28d71c53 Mon Sep 17 00:00:00 2001 -From: Gabor Juhos -Date: Sun, 24 Mar 2013 19:26:28 +0100 -Subject: [PATCH] rt2x00: rt2800lib: add channel configuration code for RT3883 - -Signed-off-by: Gabor Juhos ---- - drivers/net/wireless/ralink/rt2x00/rt2800lib.c | 72 +++++++++++++++++++++++++++++-- - 1 file changed, 69 insertions(+), 3 deletions(-) - ---- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c -+++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c -@@ -3902,6 +3902,36 @@ static char rt2800_txpower_to_dev(struct - return clamp_t(char, txpower, MIN_A_TXPOWER, MAX_A_TXPOWER); - } - -+static void rt3883_bbp_adjust(struct rt2x00_dev *rt2x00dev, -+ struct rf_channel *rf) -+{ -+ u8 bbp; -+ -+ bbp = (rf->channel > 14) ? 0x48 : 0x38; -+ rt2800_bbp_write_with_rx_chain(rt2x00dev, 66, bbp); -+ -+ rt2800_bbp_write(rt2x00dev, 69, 0x12); -+ -+ if (rf->channel <= 14) { -+ rt2800_bbp_write(rt2x00dev, 70, 0x0a); -+ } else { -+ /* Disable CCK packet detection */ -+ rt2800_bbp_write(rt2x00dev, 70, 0x00); -+ } -+ -+ rt2800_bbp_write(rt2x00dev, 73, 0x10); -+ -+ if (rf->channel > 14) { -+ rt2800_bbp_write(rt2x00dev, 62, 0x1d); -+ rt2800_bbp_write(rt2x00dev, 63, 0x1d); -+ rt2800_bbp_write(rt2x00dev, 64, 0x1d); -+ } else { -+ rt2800_bbp_write(rt2x00dev, 62, 0x2d); -+ rt2800_bbp_write(rt2x00dev, 63, 0x2d); -+ rt2800_bbp_write(rt2x00dev, 64, 0x2d); -+ } -+} -+ - static void rt2800_config_channel(struct rt2x00_dev *rt2x00dev, - struct ieee80211_conf *conf, - struct rf_channel *rf, -@@ -3920,6 +3950,12 @@ static void rt2800_config_channel(struct - rt2800_txpower_to_dev(rt2x00dev, rf->channel, - info->default_power3); - -+ switch (rt2x00dev->chip.rt) { -+ case RT3883: -+ rt3883_bbp_adjust(rt2x00dev, rf); -+ break; -+ } -+ - switch (rt2x00dev->chip.rf) { - case RF2020: - case RF3020: -@@ -4024,6 +4060,15 @@ static void rt2800_config_channel(struct - rt2800_bbp_write(rt2x00dev, 63, 0x37 - rt2x00dev->lna_gain); - rt2800_bbp_write(rt2x00dev, 64, 0x37 - rt2x00dev->lna_gain); - rt2800_bbp_write(rt2x00dev, 77, 0x98); -+ } else if (rt2x00_rt(rt2x00dev, RT3883)) { -+ rt2800_bbp_write(rt2x00dev, 62, 0x37 - rt2x00dev->lna_gain); -+ rt2800_bbp_write(rt2x00dev, 63, 0x37 - rt2x00dev->lna_gain); -+ rt2800_bbp_write(rt2x00dev, 64, 0x37 - rt2x00dev->lna_gain); -+ -+ if (rt2x00dev->default_ant.rx_chain_num > 1) -+ rt2800_bbp_write(rt2x00dev, 86, 0x46); -+ else -+ rt2800_bbp_write(rt2x00dev, 86, 0); - } else { - rt2800_bbp_write(rt2x00dev, 62, 0x37 - rt2x00dev->lna_gain); - rt2800_bbp_write(rt2x00dev, 63, 0x37 - rt2x00dev->lna_gain); -@@ -4037,6 +4082,7 @@ static void rt2800_config_channel(struct - !rt2x00_rt(rt2x00dev, RT6352)) { - if (rt2x00_has_cap_external_lna_bg(rt2x00dev)) { - rt2800_bbp_write(rt2x00dev, 82, 0x62); -+ rt2800_bbp_write(rt2x00dev, 82, 0x62); - rt2800_bbp_write(rt2x00dev, 75, 0x46); - } else { - if (rt2x00_rt(rt2x00dev, RT3593)) -@@ -4045,19 +4091,22 @@ static void rt2800_config_channel(struct - rt2800_bbp_write(rt2x00dev, 82, 0x84); - rt2800_bbp_write(rt2x00dev, 75, 0x50); - } -- if (rt2x00_rt(rt2x00dev, RT3593)) -+ if (rt2x00_rt(rt2x00dev, RT3593) || -+ rt2x00_rt(rt2x00dev, RT3883)) - rt2800_bbp_write(rt2x00dev, 83, 0x8a); - } - - } else { - if (rt2x00_rt(rt2x00dev, RT3572)) - rt2800_bbp_write(rt2x00dev, 82, 0x94); -- else if (rt2x00_rt(rt2x00dev, RT3593)) -+ else if (rt2x00_rt(rt2x00dev, RT3593) || -+ rt2x00_rt(rt2x00dev, RT3883)) - rt2800_bbp_write(rt2x00dev, 82, 0x82); - else if (!rt2x00_rt(rt2x00dev, RT6352)) - rt2800_bbp_write(rt2x00dev, 82, 0xf2); - -- if (rt2x00_rt(rt2x00dev, RT3593)) -+ if (rt2x00_rt(rt2x00dev, RT3593) || -+ rt2x00_rt(rt2x00dev, RT3883)) - rt2800_bbp_write(rt2x00dev, 83, 0x9a); - - if (rt2x00_has_cap_external_lna_a(rt2x00dev)) -@@ -4190,6 +4239,23 @@ static void rt2800_config_channel(struct - - rt2800_bbp_write_with_rx_chain(rt2x00dev, 66, reg); - -+ usleep_range(1000, 1500); -+ } -+ -+ if (rt2x00_rt(rt2x00dev, RT3883)) { -+ if (!conf_is_ht40(conf)) -+ rt2800_bbp_write(rt2x00dev, 105, 0x34); -+ else -+ rt2800_bbp_write(rt2x00dev, 105, 0x04); -+ -+ /* AGC init */ -+ if (rf->channel <= 14) -+ reg = 0x2e + rt2x00dev->lna_gain; -+ else -+ reg = 0x20 + ((rt2x00dev->lna_gain * 5) / 3); -+ -+ rt2800_bbp_write_with_rx_chain(rt2x00dev, 66, reg); -+ - usleep_range(1000, 1500); - } - diff --git a/package/kernel/mac80211/patches/rt2x00/514-rt2x00-rt2800lib-fix-txpower_to_dev-function-for-RT3.patch b/package/kernel/mac80211/patches/rt2x00/514-rt2x00-rt2800lib-fix-txpower_to_dev-function-for-RT3.patch deleted file mode 100644 index 48283ce709..0000000000 --- a/package/kernel/mac80211/patches/rt2x00/514-rt2x00-rt2800lib-fix-txpower_to_dev-function-for-RT3.patch +++ /dev/null @@ -1,30 +0,0 @@ -From e37d93abaabe3ab72b0332a18092acc162307274 Mon Sep 17 00:00:00 2001 -From: Gabor Juhos -Date: Mon, 30 Sep 2013 13:57:26 +0200 -Subject: [PATCH] rt2x00: rt2800lib: fix txpower_to_dev function for RT3883 - -Signed-off-by: Gabor Juhos ---- - drivers/net/wireless/ralink/rt2x00/rt2800lib.c | 6 ++++-- - 1 file changed, 4 insertions(+), 2 deletions(-) - ---- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c -+++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c -@@ -3889,13 +3889,15 @@ static char rt2800_txpower_to_dev(struct - unsigned int channel, - char txpower) - { -- if (rt2x00_rt(rt2x00dev, RT3593)) -+ if (rt2x00_rt(rt2x00dev, RT3593) || -+ rt2x00_rt(rt2x00dev, RT3883)) - txpower = rt2x00_get_field8(txpower, EEPROM_TXPOWER_ALC); - - if (channel <= 14) - return clamp_t(char, txpower, MIN_G_TXPOWER, MAX_G_TXPOWER); - -- if (rt2x00_rt(rt2x00dev, RT3593)) -+ if (rt2x00_rt(rt2x00dev, RT3593) || -+ rt2x00_rt(rt2x00dev, RT3883)) - return clamp_t(char, txpower, MIN_A_TXPOWER_3593, - MAX_A_TXPOWER_3593); - else diff --git a/package/kernel/mac80211/patches/rt2x00/515-rt2x00-rt2800lib-use-correct-txpower-calculation-fun.patch b/package/kernel/mac80211/patches/rt2x00/515-rt2x00-rt2800lib-use-correct-txpower-calculation-fun.patch deleted file mode 100644 index a764c91f1b..0000000000 --- a/package/kernel/mac80211/patches/rt2x00/515-rt2x00-rt2800lib-use-correct-txpower-calculation-fun.patch +++ /dev/null @@ -1,23 +0,0 @@ -From c4d79e344bd580d85821390d49f92dced7d8e125 Mon Sep 17 00:00:00 2001 -From: Gabor Juhos -Date: Sun, 24 Mar 2013 19:26:29 +0100 -Subject: [PATCH] rt2x00: rt2800lib: use correct txpower calculation function - for RT3883 - -Signed-off-by: Gabor Juhos ---- - drivers/net/wireless/ralink/rt2x00/rt2800lib.c | 3 ++- - 1 file changed, 2 insertions(+), 1 deletion(-) - ---- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c -+++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c -@@ -5281,7 +5281,8 @@ static void rt2800_config_txpower(struct - struct ieee80211_channel *chan, - int power_level) - { -- if (rt2x00_rt(rt2x00dev, RT3593)) -+ if (rt2x00_rt(rt2x00dev, RT3593) || -+ rt2x00_rt(rt2x00dev, RT3883)) - rt2800_config_txpower_rt3593(rt2x00dev, chan, power_level); - else if (rt2x00_rt(rt2x00dev, RT6352)) - rt2800_config_txpower_rt6352(rt2x00dev, chan, power_level); diff --git a/package/kernel/mac80211/patches/rt2x00/516-rt2x00-rt2800lib-hardcode-txmixer-gain-values-to-zer.patch b/package/kernel/mac80211/patches/rt2x00/516-rt2x00-rt2800lib-hardcode-txmixer-gain-values-to-zer.patch deleted file mode 100644 index 37239c31b2..0000000000 --- a/package/kernel/mac80211/patches/rt2x00/516-rt2x00-rt2800lib-hardcode-txmixer-gain-values-to-zer.patch +++ /dev/null @@ -1,33 +0,0 @@ -From caea0671cd8fd9ade4f5969cbe0ee545e94ae105 Mon Sep 17 00:00:00 2001 -From: Gabor Juhos -Date: Sat, 24 Aug 2013 11:49:55 +0200 -Subject: [PATCH] rt2x00: rt2800lib: hardcode txmixer gain values to zero for - RT3883 - -Signed-off-by: Gabor Juhos ---- - drivers/net/wireless/ralink/rt2x00/rt2800lib.c | 6 ++++-- - 1 file changed, 4 insertions(+), 2 deletions(-) - ---- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c -+++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c -@@ -9136,7 +9136,8 @@ static u8 rt2800_get_txmixer_gain_24g(st - { - u16 word; - -- if (rt2x00_rt(rt2x00dev, RT3593)) -+ if (rt2x00_rt(rt2x00dev, RT3593) || -+ rt2x00_rt(rt2x00dev, RT3883)) - return 0; - - word = rt2800_eeprom_read(rt2x00dev, EEPROM_TXMIXER_GAIN_BG); -@@ -9150,7 +9151,8 @@ static u8 rt2800_get_txmixer_gain_5g(str - { - u16 word; - -- if (rt2x00_rt(rt2x00dev, RT3593)) -+ if (rt2x00_rt(rt2x00dev, RT3593) || -+ rt2x00_rt(rt2x00dev, RT3883)) - return 0; - - word = rt2800_eeprom_read(rt2x00dev, EEPROM_TXMIXER_GAIN_A); diff --git a/package/kernel/mac80211/patches/rt2x00/517-rt2x00-rt2800lib-use-correct-RT-XWI-size-for-RT3883.patch b/package/kernel/mac80211/patches/rt2x00/517-rt2x00-rt2800lib-use-correct-RT-XWI-size-for-RT3883.patch deleted file mode 100644 index 197aabd7bc..0000000000 --- a/package/kernel/mac80211/patches/rt2x00/517-rt2x00-rt2800lib-use-correct-RT-XWI-size-for-RT3883.patch +++ /dev/null @@ -1,20 +0,0 @@ -From 11c40fb47c4a4dd6ad060c2ae127ced89ffb9fe1 Mon Sep 17 00:00:00 2001 -From: Gabor Juhos -Date: Thu, 18 Apr 2013 14:33:33 +0200 -Subject: [PATCH] rt2x00: rt2800lib: use correct [RT]XWI size for RT3883 - -Signed-off-by: Gabor Juhos ---- - drivers/net/wireless/ralink/rt2x00/rt2800lib.c | 1 + - 1 file changed, 1 insertion(+) - ---- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c -+++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c -@@ -591,6 +591,7 @@ void rt2800_get_txwi_rxwi_size(struct rt - { - switch (rt2x00dev->chip.rt) { - case RT3593: -+ case RT3883: - *txwi_size = TXWI_DESC_SIZE_4WORDS; - *rxwi_size = RXWI_DESC_SIZE_5WORDS; - break; diff --git a/package/kernel/mac80211/patches/rt2x00/518-rt2x00-rt2800lib-fix-antenna-configuration-for-RT388.patch b/package/kernel/mac80211/patches/rt2x00/518-rt2x00-rt2800lib-fix-antenna-configuration-for-RT388.patch deleted file mode 100644 index 30da2cbb6e..0000000000 --- a/package/kernel/mac80211/patches/rt2x00/518-rt2x00-rt2800lib-fix-antenna-configuration-for-RT388.patch +++ /dev/null @@ -1,22 +0,0 @@ -From fa5ad9c025610c22048add2f0ad03f62b6ca1e74 Mon Sep 17 00:00:00 2001 -From: Gabor Juhos -Date: Mon, 30 Sep 2013 16:53:33 +0200 -Subject: [PATCH] rt2x00: rt2800lib: fix antenna configuration for RT3883 - -Signed-off-by: Gabor Juhos ---- - drivers/net/wireless/ralink/rt2x00/rt2800lib.c | 3 ++- - 1 file changed, 2 insertions(+), 1 deletion(-) - ---- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c -+++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c -@@ -2182,7 +2182,8 @@ void rt2800_config_ant(struct rt2x00_dev - rt2800_bbp_write(rt2x00dev, 3, r3); - rt2800_bbp_write(rt2x00dev, 1, r1); - -- if (rt2x00_rt(rt2x00dev, RT3593)) { -+ if (rt2x00_rt(rt2x00dev, RT3593) || -+ rt2x00_rt(rt2x00dev, RT3883)) { - if (ant->rx_chain_num == 1) - rt2800_bbp_write(rt2x00dev, 86, 0x00); - else diff --git a/package/kernel/mac80211/patches/rt2x00/519-rt2x00-rt2800lib-fix-LNA-gain-configuration-for-RT38.patch b/package/kernel/mac80211/patches/rt2x00/519-rt2x00-rt2800lib-fix-LNA-gain-configuration-for-RT38.patch deleted file mode 100644 index 2514d824f2..0000000000 --- a/package/kernel/mac80211/patches/rt2x00/519-rt2x00-rt2800lib-fix-LNA-gain-configuration-for-RT38.patch +++ /dev/null @@ -1,32 +0,0 @@ -From 6d668fef3a1baa60bdd715ee062ddb6333d2647c Mon Sep 17 00:00:00 2001 -From: Gabor Juhos -Date: Mon, 30 Sep 2013 16:58:23 +0200 -Subject: [PATCH] rt2x00: rt2800lib: fix LNA gain configuration for RT3883 - -Signed-off-by: Gabor Juhos ---- - drivers/net/wireless/ralink/rt2x00/rt2800lib.c | 6 ++++-- - 1 file changed, 4 insertions(+), 2 deletions(-) - ---- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c -+++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c -@@ -2205,7 +2205,8 @@ static void rt2800_config_lna_gain(struc - eeprom = rt2800_eeprom_read(rt2x00dev, EEPROM_LNA); - lna_gain = rt2x00_get_field16(eeprom, EEPROM_LNA_A0); - } else if (libconf->rf.channel <= 128) { -- if (rt2x00_rt(rt2x00dev, RT3593)) { -+ if (rt2x00_rt(rt2x00dev, RT3593) || -+ rt2x00_rt(rt2x00dev, RT3883)) { - eeprom = rt2800_eeprom_read(rt2x00dev, EEPROM_EXT_LNA2); - lna_gain = rt2x00_get_field16(eeprom, - EEPROM_EXT_LNA2_A1); -@@ -2215,7 +2216,8 @@ static void rt2800_config_lna_gain(struc - EEPROM_RSSI_BG2_LNA_A1); - } - } else { -- if (rt2x00_rt(rt2x00dev, RT3593)) { -+ if (rt2x00_rt(rt2x00dev, RT3593) || -+ rt2x00_rt(rt2x00dev, RT3883)) { - eeprom = rt2800_eeprom_read(rt2x00dev, EEPROM_EXT_LNA2); - lna_gain = rt2x00_get_field16(eeprom, - EEPROM_EXT_LNA2_A2); diff --git a/package/kernel/mac80211/patches/rt2x00/520-rt2x00-rt2800lib-fix-VGC-setup-for-RT3883.patch b/package/kernel/mac80211/patches/rt2x00/520-rt2x00-rt2800lib-fix-VGC-setup-for-RT3883.patch deleted file mode 100644 index 49393c2f6d..0000000000 --- a/package/kernel/mac80211/patches/rt2x00/520-rt2x00-rt2800lib-fix-VGC-setup-for-RT3883.patch +++ /dev/null @@ -1,44 +0,0 @@ -From c49b2d829aa1c816a46a577cdec6d2ff14d9f06e Mon Sep 17 00:00:00 2001 -From: Gabor Juhos -Date: Tue, 1 Oct 2013 15:40:08 +0200 -Subject: [PATCH] rt2x00: rt2800lib: fix VGC setup for RT3883 - -Signed-off-by: Gabor Juhos ---- - drivers/net/wireless/ralink/rt2x00/rt2800lib.c | 11 +++++++++-- - 1 file changed, 9 insertions(+), 2 deletions(-) - ---- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c -+++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c -@@ -5534,7 +5534,8 @@ static u8 rt2800_get_default_vgc(struct - else - vgc = 0x2e + rt2x00dev->lna_gain; - } else { /* 5GHZ band */ -- if (rt2x00_rt(rt2x00dev, RT3593)) -+ if (rt2x00_rt(rt2x00dev, RT3593) || -+ rt2x00_rt(rt2x00dev, RT3883)) - vgc = 0x20 + (rt2x00dev->lna_gain * 5) / 3; - else if (rt2x00_rt(rt2x00dev, RT5592)) - vgc = 0x24 + (2 * rt2x00dev->lna_gain); -@@ -5554,7 +5555,8 @@ static inline void rt2800_set_vgc(struct - { - if (qual->vgc_level != vgc_level) { - if (rt2x00_rt(rt2x00dev, RT3572) || -- rt2x00_rt(rt2x00dev, RT3593)) { -+ rt2x00_rt(rt2x00dev, RT3593) || -+ rt2x00_rt(rt2x00dev, RT3883)) { - rt2800_bbp_write_with_rx_chain(rt2x00dev, 66, - vgc_level); - } else if (rt2x00_rt(rt2x00dev, RT5592)) { -@@ -5601,6 +5603,11 @@ void rt2800_link_tuner(struct rt2x00_dev - } - break; - -+ case RT3883: -+ if (qual->rssi > -65) -+ vgc += 0x10; -+ break; -+ - case RT5592: - if (qual->rssi > -65) - vgc += 0x20; diff --git a/package/kernel/mac80211/patches/rt2x00/521-rt2x00-rt2800lib-fix-EEPROM-LNA-validation-for-RT388.patch b/package/kernel/mac80211/patches/rt2x00/521-rt2x00-rt2800lib-fix-EEPROM-LNA-validation-for-RT388.patch deleted file mode 100644 index 1e1fb6e4b5..0000000000 --- a/package/kernel/mac80211/patches/rt2x00/521-rt2x00-rt2800lib-fix-EEPROM-LNA-validation-for-RT388.patch +++ /dev/null @@ -1,42 +0,0 @@ -From 1616650aea676541d4dc8adc6f4219856d193c8b Mon Sep 17 00:00:00 2001 -From: Gabor Juhos -Date: Tue, 1 Oct 2013 17:27:57 +0200 -Subject: [PATCH] rt2x00: rt2800lib: fix EEPROM LNA validation for RT3883 - -Signed-off-by: Gabor Juhos ---- - drivers/net/wireless/ralink/rt2x00/rt2800lib.c | 9 ++++++--- - 1 file changed, 6 insertions(+), 3 deletions(-) - ---- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c -+++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c -@@ -9269,7 +9269,8 @@ static int rt2800_validate_eeprom(struct - word = rt2800_eeprom_read(rt2x00dev, EEPROM_RSSI_BG2); - if (abs(rt2x00_get_field16(word, EEPROM_RSSI_BG2_OFFSET2)) > 10) - rt2x00_set_field16(&word, EEPROM_RSSI_BG2_OFFSET2, 0); -- if (!rt2x00_rt(rt2x00dev, RT3593)) { -+ if (!rt2x00_rt(rt2x00dev, RT3593) && -+ !rt2x00_rt(rt2x00dev, RT3883)) { - if (rt2x00_get_field16(word, EEPROM_RSSI_BG2_LNA_A1) == 0x00 || - rt2x00_get_field16(word, EEPROM_RSSI_BG2_LNA_A1) == 0xff) - rt2x00_set_field16(&word, EEPROM_RSSI_BG2_LNA_A1, -@@ -9289,7 +9290,8 @@ static int rt2800_validate_eeprom(struct - word = rt2800_eeprom_read(rt2x00dev, EEPROM_RSSI_A2); - if (abs(rt2x00_get_field16(word, EEPROM_RSSI_A2_OFFSET2)) > 10) - rt2x00_set_field16(&word, EEPROM_RSSI_A2_OFFSET2, 0); -- if (!rt2x00_rt(rt2x00dev, RT3593)) { -+ if (!rt2x00_rt(rt2x00dev, RT3593) && -+ !rt2x00_rt(rt2x00dev, RT3883)) { - if (rt2x00_get_field16(word, EEPROM_RSSI_A2_LNA_A2) == 0x00 || - rt2x00_get_field16(word, EEPROM_RSSI_A2_LNA_A2) == 0xff) - rt2x00_set_field16(&word, EEPROM_RSSI_A2_LNA_A2, -@@ -9297,7 +9299,8 @@ static int rt2800_validate_eeprom(struct - } - rt2800_eeprom_write(rt2x00dev, EEPROM_RSSI_A2, word); - -- if (rt2x00_rt(rt2x00dev, RT3593)) { -+ if (rt2x00_rt(rt2x00dev, RT3593) || -+ rt2x00_rt(rt2x00dev, RT3883)) { - word = rt2800_eeprom_read(rt2x00dev, EEPROM_EXT_LNA2); - if (rt2x00_get_field16(word, EEPROM_EXT_LNA2_A1) == 0x00 || - rt2x00_get_field16(word, EEPROM_EXT_LNA2_A1) == 0xff) diff --git a/package/kernel/mac80211/patches/rt2x00/522-rt2x00-rt2800lib-fix-txpower-compensation-for-RT3883.patch b/package/kernel/mac80211/patches/rt2x00/522-rt2x00-rt2800lib-fix-txpower-compensation-for-RT3883.patch deleted file mode 100644 index 64dba012ec..0000000000 --- a/package/kernel/mac80211/patches/rt2x00/522-rt2x00-rt2800lib-fix-txpower-compensation-for-RT3883.patch +++ /dev/null @@ -1,22 +0,0 @@ -From e3871034a0e7c8a95152dc3eafbcc4535398cbdc Mon Sep 17 00:00:00 2001 -From: Gabor Juhos -Date: Wed, 2 Oct 2013 10:11:59 +0200 -Subject: [PATCH] rt2x00: rt2800lib: fix txpower compensation for RT3883 - -Signed-off-by: Gabor Juhos ---- - drivers/net/wireless/ralink/rt2x00/rt2800lib.c | 3 +++ - 1 file changed, 3 insertions(+) - ---- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c -+++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c -@@ -4524,6 +4524,9 @@ static u8 rt2800_compensate_txpower(stru - if (rt2x00_rt(rt2x00dev, RT3593)) - return min_t(u8, txpower, 0xc); - -+ if (rt2x00_rt(rt2x00dev, RT3883)) -+ return min_t(u8, txpower, 0xf); -+ - if (rt2x00_has_cap_power_limit(rt2x00dev)) { - /* - * Check if eirp txpower exceed txpower_limit. diff --git a/package/kernel/mac80211/patches/rt2x00/602-rt2x00-introduce-rt2x00eeprom.patch b/package/kernel/mac80211/patches/rt2x00/602-rt2x00-introduce-rt2x00eeprom.patch index c6d4862e41..697d8188f0 100644 --- a/package/kernel/mac80211/patches/rt2x00/602-rt2x00-introduce-rt2x00eeprom.patch +++ b/package/kernel/mac80211/patches/rt2x00/602-rt2x00-introduce-rt2x00eeprom.patch @@ -105,7 +105,7 @@ .drv_init_registers = rt2800mmio_init_registers, --- a/drivers/net/wireless/ralink/rt2x00/rt2x00.h +++ b/drivers/net/wireless/ralink/rt2x00/rt2x00.h -@@ -703,6 +703,7 @@ enum rt2x00_capability_flags { +@@ -702,6 +702,7 @@ enum rt2x00_capability_flags { REQUIRE_HT_TX_DESC, REQUIRE_PS_AUTOWAKE, REQUIRE_DELAYED_RFKILL, @@ -113,7 +113,7 @@ /* * Capabilities -@@ -978,6 +979,11 @@ struct rt2x00_dev { +@@ -977,6 +978,11 @@ struct rt2x00_dev { const struct firmware *fw; /* diff --git a/package/kernel/mac80211/patches/subsys/100-remove-cryptoapi-dependencies.patch b/package/kernel/mac80211/patches/subsys/100-remove-cryptoapi-dependencies.patch index 0fe6ee196c..0cedfb3ac6 100644 --- a/package/kernel/mac80211/patches/subsys/100-remove-cryptoapi-dependencies.patch +++ b/package/kernel/mac80211/patches/subsys/100-remove-cryptoapi-dependencies.patch @@ -499,8 +499,8 @@ struct ieee80211_rx_status *status = IEEE80211_SKB_RXCB(skb); struct ieee80211_key *key = rx->key; struct ieee80211_mmie_16 *mmie; -- u8 aad[GMAC_AAD_LEN], mic[GMAC_MIC_LEN], ipn[6], nonce[GMAC_NONCE_LEN]; -+ u8 aad[20], mic[16], ipn[6], nonce[12]; +- u8 aad[GMAC_AAD_LEN], *mic, ipn[6], nonce[GMAC_NONCE_LEN]; ++ u8 aad[20], *mic, ipn[6], nonce[12]; struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; if (!ieee80211_is_mgmt(hdr->frame_control)) diff --git a/package/kernel/mac80211/patches/subsys/110-mac80211_keep_keys_on_stop_ap.patch b/package/kernel/mac80211/patches/subsys/110-mac80211_keep_keys_on_stop_ap.patch index 6d49326f0a..d7b322e0aa 100644 --- a/package/kernel/mac80211/patches/subsys/110-mac80211_keep_keys_on_stop_ap.patch +++ b/package/kernel/mac80211/patches/subsys/110-mac80211_keep_keys_on_stop_ap.patch @@ -2,7 +2,7 @@ Used for AP+STA support in libreCMC - preserve AP mode keys across STA reconnect --- a/net/mac80211/cfg.c +++ b/net/mac80211/cfg.c -@@ -1063,7 +1063,6 @@ static int ieee80211_stop_ap(struct wiph +@@ -1067,7 +1067,6 @@ static int ieee80211_stop_ap(struct wiph sdata->u.ap.driver_smps_mode = IEEE80211_SMPS_OFF; __sta_info_flush(sdata, true); diff --git a/package/kernel/mac80211/patches/subsys/140-tweak-TSQ-setting.patch b/package/kernel/mac80211/patches/subsys/140-tweak-TSQ-setting.patch index 42a6382209..f78ba82de3 100644 --- a/package/kernel/mac80211/patches/subsys/140-tweak-TSQ-setting.patch +++ b/package/kernel/mac80211/patches/subsys/140-tweak-TSQ-setting.patch @@ -1,6 +1,6 @@ --- a/net/mac80211/tx.c +++ b/net/mac80211/tx.c -@@ -3797,6 +3797,12 @@ out: +@@ -3800,6 +3800,12 @@ out: netdev_tx_t ieee80211_subif_start_xmit(struct sk_buff *skb, struct net_device *dev) { diff --git a/package/kernel/mac80211/patches/subsys/210-ap_scan.patch b/package/kernel/mac80211/patches/subsys/210-ap_scan.patch index 174096f5ea..fcc173da69 100644 --- a/package/kernel/mac80211/patches/subsys/210-ap_scan.patch +++ b/package/kernel/mac80211/patches/subsys/210-ap_scan.patch @@ -1,6 +1,6 @@ --- a/net/mac80211/cfg.c +++ b/net/mac80211/cfg.c -@@ -2229,7 +2229,7 @@ static int ieee80211_scan(struct wiphy * +@@ -2237,7 +2237,7 @@ static int ieee80211_scan(struct wiphy * * the frames sent while scanning on other channel will be * lost) */ diff --git a/package/kernel/mac80211/patches/subsys/300-mac80211-add-stop-start-logic-for-software-TXQs.patch b/package/kernel/mac80211/patches/subsys/300-mac80211-add-stop-start-logic-for-software-TXQs.patch index 422e9c2977..e57a33ec1f 100644 --- a/package/kernel/mac80211/patches/subsys/300-mac80211-add-stop-start-logic-for-software-TXQs.patch +++ b/package/kernel/mac80211/patches/subsys/300-mac80211-add-stop-start-logic-for-software-TXQs.patch @@ -77,7 +77,7 @@ Signed-off-by: Johannes Berg atomic_t agg_queue_stop[IEEE80211_MAX_QUEUES]; -@@ -2039,6 +2041,7 @@ void ieee80211_txq_remove_vlan(struct ie +@@ -2046,6 +2048,7 @@ void ieee80211_txq_remove_vlan(struct ie struct ieee80211_sub_if_data *sdata); void ieee80211_fill_txq_stats(struct cfg80211_txq_stats *txqstats, struct txq_info *txqi); @@ -100,7 +100,7 @@ Signed-off-by: Johannes Berg (unsigned long) local); --- a/net/mac80211/tx.c +++ b/net/mac80211/tx.c -@@ -3482,13 +3482,19 @@ struct sk_buff *ieee80211_tx_dequeue(str +@@ -3485,13 +3485,19 @@ struct sk_buff *ieee80211_tx_dequeue(str struct ieee80211_tx_info *info; struct ieee80211_tx_data tx; ieee80211_tx_result r; @@ -122,7 +122,7 @@ Signed-off-by: Johannes Berg /* Make sure fragments stay together. */ skb = __skb_dequeue(&txqi->frags); if (skb) -@@ -3583,6 +3589,7 @@ begin: +@@ -3586,6 +3592,7 @@ begin: } IEEE80211_SKB_CB(skb)->control.vif = vif; diff --git a/package/kernel/mac80211/patches/subsys/301-mac80211-do-not-call-driver-wake_tx_queue-op-during-.patch b/package/kernel/mac80211/patches/subsys/301-mac80211-do-not-call-driver-wake_tx_queue-op-during-.patch deleted file mode 100644 index 5bbf4db23b..0000000000 --- a/package/kernel/mac80211/patches/subsys/301-mac80211-do-not-call-driver-wake_tx_queue-op-during-.patch +++ /dev/null @@ -1,33 +0,0 @@ -From: Felix Fietkau -Date: Fri, 1 Mar 2019 14:42:56 +0100 -Subject: [PATCH] mac80211: do not call driver wake_tx_queue op during reconfig - -There are several scenarios in which mac80211 can call drv_wake_tx_queue -after ieee80211_restart_hw has been called and has not yet completed. -Driver private structs are considered uninitialized until mac80211 has -uploaded the vifs, stations and keys again, so using private tx queue -data during that time is not safe. - -The driver can also not rely on drv_reconfig_complete to figure out when -it is safe to accept drv_wake_tx_queue calls again, because it is only -called after all tx queues are woken again. - -To fix this, bail out early in drv_wake_tx_queue if local->in_reconfig -is set. - -Cc: stable@vger.kernel.org -Signed-off-by: Felix Fietkau ---- - ---- a/net/mac80211/driver-ops.h -+++ b/net/mac80211/driver-ops.h -@@ -1166,6 +1166,9 @@ static inline void drv_wake_tx_queue(str - { - struct ieee80211_sub_if_data *sdata = vif_to_sdata(txq->txq.vif); - -+ if (local->in_reconfig) -+ return; -+ - if (!check_sdata_in_driver(sdata)) - return; - diff --git a/package/kernel/mac80211/patches/subsys/359-mac80211-minstrel-Enable-STBC-and-LDPC-for-VHT-Rates.patch b/package/kernel/mac80211/patches/subsys/303-mac80211-minstrel-Enable-STBC-and-LDPC-for-VHT-Rates.patch similarity index 100% rename from package/kernel/mac80211/patches/subsys/359-mac80211-minstrel-Enable-STBC-and-LDPC-for-VHT-Rates.patch rename to package/kernel/mac80211/patches/subsys/303-mac80211-minstrel-Enable-STBC-and-LDPC-for-VHT-Rates.patch diff --git a/package/kernel/mac80211/patches/subsys/370-mac80211-minstrel-remove-unnecessary-debugfs-cleanup.patch b/package/kernel/mac80211/patches/subsys/304-mac80211-minstrel-remove-unnecessary-debugfs-cleanup.patch similarity index 100% rename from package/kernel/mac80211/patches/subsys/370-mac80211-minstrel-remove-unnecessary-debugfs-cleanup.patch rename to package/kernel/mac80211/patches/subsys/304-mac80211-minstrel-remove-unnecessary-debugfs-cleanup.patch diff --git a/package/kernel/mac80211/patches/subsys/371-mac80211-minstrel-merge-with-minstrel_ht-always-enab.patch b/package/kernel/mac80211/patches/subsys/305-mac80211-minstrel-merge-with-minstrel_ht-always-enab.patch similarity index 100% rename from package/kernel/mac80211/patches/subsys/371-mac80211-minstrel-merge-with-minstrel_ht-always-enab.patch rename to package/kernel/mac80211/patches/subsys/305-mac80211-minstrel-merge-with-minstrel_ht-always-enab.patch diff --git a/package/kernel/mac80211/patches/subsys/372-mac80211-minstrel-reduce-minstrel_mcs_groups-size.patch b/package/kernel/mac80211/patches/subsys/306-mac80211-minstrel-reduce-minstrel_mcs_groups-size.patch similarity index 100% rename from package/kernel/mac80211/patches/subsys/372-mac80211-minstrel-reduce-minstrel_mcs_groups-size.patch rename to package/kernel/mac80211/patches/subsys/306-mac80211-minstrel-reduce-minstrel_mcs_groups-size.patch diff --git a/package/kernel/mac80211/patches/subsys/373-mac80211-minstrel-fix-using-short-preamble-CCK-rates.patch b/package/kernel/mac80211/patches/subsys/307-mac80211-minstrel-fix-using-short-preamble-CCK-rates.patch similarity index 100% rename from package/kernel/mac80211/patches/subsys/373-mac80211-minstrel-fix-using-short-preamble-CCK-rates.patch rename to package/kernel/mac80211/patches/subsys/307-mac80211-minstrel-fix-using-short-preamble-CCK-rates.patch diff --git a/package/kernel/mac80211/patches/subsys/375-mac80211-minstrel-fix-CCK-rate-group-streams-value.patch b/package/kernel/mac80211/patches/subsys/308-mac80211-minstrel-fix-CCK-rate-group-streams-value.patch similarity index 100% rename from package/kernel/mac80211/patches/subsys/375-mac80211-minstrel-fix-CCK-rate-group-streams-value.patch rename to package/kernel/mac80211/patches/subsys/308-mac80211-minstrel-fix-CCK-rate-group-streams-value.patch diff --git a/package/kernel/mac80211/patches/subsys/376-mac80211-minstrel-fix-sampling-reporting-of-CCK-rate.patch b/package/kernel/mac80211/patches/subsys/309-mac80211-minstrel-fix-sampling-reporting-of-CCK-rate.patch similarity index 100% rename from package/kernel/mac80211/patches/subsys/376-mac80211-minstrel-fix-sampling-reporting-of-CCK-rate.patch rename to package/kernel/mac80211/patches/subsys/309-mac80211-minstrel-fix-sampling-reporting-of-CCK-rate.patch diff --git a/package/kernel/mac80211/patches/subsys/377-mac80211-minstrel-do-not-sample-rates-3-times-slower.patch b/package/kernel/mac80211/patches/subsys/310-mac80211-minstrel-do-not-sample-rates-3-times-slower.patch similarity index 100% rename from package/kernel/mac80211/patches/subsys/377-mac80211-minstrel-do-not-sample-rates-3-times-slower.patch rename to package/kernel/mac80211/patches/subsys/310-mac80211-minstrel-do-not-sample-rates-3-times-slower.patch diff --git a/package/kernel/mac80211/patches/subsys/312-mac80211-minstrel_ht-add-flag-to-indicate-missing-in.patch b/package/kernel/mac80211/patches/subsys/312-mac80211-minstrel_ht-add-flag-to-indicate-missing-in.patch new file mode 100644 index 0000000000..f221d36bf8 --- /dev/null +++ b/package/kernel/mac80211/patches/subsys/312-mac80211-minstrel_ht-add-flag-to-indicate-missing-in.patch @@ -0,0 +1,122 @@ +From: Felix Fietkau +Date: Wed, 16 Jan 2019 22:32:12 +0100 +Subject: [PATCH] mac80211: minstrel_ht: add flag to indicate + missing/inaccurate tx A-MPDU length + +Some hardware (e.g. MediaTek MT7603) cannot report A-MPDU length in tx status +information. Add support for a flag to indicate that, to allow minstrel_ht +to use a fixed value in its internal calculation (which gives better results +than just defaulting to 1). + +Signed-off-by: Felix Fietkau +Signed-off-by: Johannes Berg +--- + +--- a/include/net/mac80211.h ++++ b/include/net/mac80211.h +@@ -2131,6 +2131,9 @@ struct ieee80211_txq { + * @IEEE80211_HW_DOESNT_SUPPORT_QOS_NDP: The driver (or firmware) doesn't + * support QoS NDP for AP probing - that's most likely a driver bug. + * ++ * @IEEE80211_HW_TX_STATUS_NO_AMPDU_LEN: Driver does not report accurate A-MPDU ++ * length in tx status information ++ * + * @NUM_IEEE80211_HW_FLAGS: number of hardware flags, used for sizing arrays + */ + enum ieee80211_hw_flags { +@@ -2176,6 +2179,7 @@ enum ieee80211_hw_flags { + IEEE80211_HW_SUPPORTS_TDLS_BUFFER_STA, + IEEE80211_HW_DEAUTH_NEED_MGD_TX_PREP, + IEEE80211_HW_DOESNT_SUPPORT_QOS_NDP, ++ IEEE80211_HW_TX_STATUS_NO_AMPDU_LEN, + + /* keep last, obviously */ + NUM_IEEE80211_HW_FLAGS +--- a/net/mac80211/debugfs.c ++++ b/net/mac80211/debugfs.c +@@ -214,6 +214,7 @@ static const char *hw_flag_names[] = { + FLAG(SUPPORTS_TDLS_BUFFER_STA), + FLAG(DEAUTH_NEED_MGD_TX_PREP), + FLAG(DOESNT_SUPPORT_QOS_NDP), ++ FLAG(TX_STATUS_NO_AMPDU_LEN), + #undef FLAG + }; + +--- a/net/mac80211/rc80211_minstrel_ht.c ++++ b/net/mac80211/rc80211_minstrel_ht.c +@@ -294,6 +294,15 @@ minstrel_get_ratestats(struct minstrel_h + return &mi->groups[index / MCS_GROUP_RATES].rates[index % MCS_GROUP_RATES]; + } + ++static unsigned int ++minstrel_ht_avg_ampdu_len(struct minstrel_ht_sta *mi) ++{ ++ if (!mi->avg_ampdu_len) ++ return AVG_AMPDU_SIZE; ++ ++ return MINSTREL_TRUNC(mi->avg_ampdu_len); ++} ++ + /* + * Return current throughput based on the average A-MPDU length, taking into + * account the expected number of retransmissions and their expected length +@@ -309,7 +318,7 @@ minstrel_ht_get_tp_avg(struct minstrel_h + return 0; + + if (group != MINSTREL_CCK_GROUP) +- nsecs = 1000 * mi->overhead / MINSTREL_TRUNC(mi->avg_ampdu_len); ++ nsecs = 1000 * mi->overhead / minstrel_ht_avg_ampdu_len(mi); + + nsecs += minstrel_mcs_groups[group].duration[rate] << + minstrel_mcs_groups[group].shift; +@@ -503,8 +512,12 @@ minstrel_ht_update_stats(struct minstrel + u16 tmp_cck_tp_rate[MAX_THR_RATES], index; + + if (mi->ampdu_packets > 0) { +- mi->avg_ampdu_len = minstrel_ewma(mi->avg_ampdu_len, +- MINSTREL_FRAC(mi->ampdu_len, mi->ampdu_packets), EWMA_LEVEL); ++ if (!ieee80211_hw_check(mp->hw, TX_STATUS_NO_AMPDU_LEN)) ++ mi->avg_ampdu_len = minstrel_ewma(mi->avg_ampdu_len, ++ MINSTREL_FRAC(mi->ampdu_len, mi->ampdu_packets), ++ EWMA_LEVEL); ++ else ++ mi->avg_ampdu_len = 0; + mi->ampdu_len = 0; + mi->ampdu_packets = 0; + } +@@ -709,7 +722,9 @@ minstrel_ht_tx_status(void *priv, struct + mi->ampdu_len += info->status.ampdu_len; + + if (!mi->sample_wait && !mi->sample_tries && mi->sample_count > 0) { +- mi->sample_wait = 16 + 2 * MINSTREL_TRUNC(mi->avg_ampdu_len); ++ int avg_ampdu_len = minstrel_ht_avg_ampdu_len(mi); ++ ++ mi->sample_wait = 16 + 2 * avg_ampdu_len; + mi->sample_tries = 1; + mi->sample_count--; + } +@@ -777,7 +792,7 @@ minstrel_calc_retransmit(struct minstrel + unsigned int cw = mp->cw_min; + unsigned int ctime = 0; + unsigned int t_slot = 9; /* FIXME */ +- unsigned int ampdu_len = MINSTREL_TRUNC(mi->avg_ampdu_len); ++ unsigned int ampdu_len = minstrel_ht_avg_ampdu_len(mi); + unsigned int overhead = 0, overhead_rtscts = 0; + + mrs = minstrel_get_ratestats(mi, index); +--- a/net/mac80211/rc80211_minstrel_ht_debugfs.c ++++ b/net/mac80211/rc80211_minstrel_ht_debugfs.c +@@ -163,9 +163,10 @@ minstrel_ht_stats_open(struct inode *ino + "lookaround %d\n", + max(0, (int) mi->total_packets - (int) mi->sample_packets), + mi->sample_packets); +- p += sprintf(p, "Average # of aggregated frames per A-MPDU: %d.%d\n", +- MINSTREL_TRUNC(mi->avg_ampdu_len), +- MINSTREL_TRUNC(mi->avg_ampdu_len * 10) % 10); ++ if (mi->avg_ampdu_len) ++ p += sprintf(p, "Average # of aggregated frames per A-MPDU: %d.%d\n", ++ MINSTREL_TRUNC(mi->avg_ampdu_len), ++ MINSTREL_TRUNC(mi->avg_ampdu_len * 10) % 10); + ms->len = p - ms->buf; + WARN_ON(ms->len + sizeof(*ms) > 32768); + diff --git a/package/kernel/mac80211/patches/subsys/313-mac80211-minstrel_ht-fix-per-group-max-throughput-ra.patch b/package/kernel/mac80211/patches/subsys/313-mac80211-minstrel_ht-fix-per-group-max-throughput-ra.patch new file mode 100644 index 0000000000..5ae29918e7 --- /dev/null +++ b/package/kernel/mac80211/patches/subsys/313-mac80211-minstrel_ht-fix-per-group-max-throughput-ra.patch @@ -0,0 +1,22 @@ +From: Felix Fietkau +Date: Fri, 14 Jun 2019 21:12:04 +0200 +Subject: [PATCH] mac80211: minstrel_ht: fix per-group max throughput rate + initialization + +The group number needs to be multiplied by the number of rates per group +to get the full rate index + +Signed-off-by: Felix Fietkau +--- + +--- a/net/mac80211/rc80211_minstrel_ht.c ++++ b/net/mac80211/rc80211_minstrel_ht.c +@@ -542,7 +542,7 @@ minstrel_ht_update_stats(struct minstrel + + /* (re)Initialize group rate indexes */ + for(j = 0; j < MAX_THR_RATES; j++) +- tmp_group_tp_rate[j] = group; ++ tmp_group_tp_rate[j] = MCS_GROUP_RATES * group; + + for (i = 0; i < MCS_GROUP_RATES; i++) { + if (!(mi->supported[group] & BIT(i))) diff --git a/package/kernel/mac80211/patches/subsys/314-mac80211-minstrel_ht-reduce-unnecessary-rate-probing.patch b/package/kernel/mac80211/patches/subsys/314-mac80211-minstrel_ht-reduce-unnecessary-rate-probing.patch new file mode 100644 index 0000000000..ed089afb06 --- /dev/null +++ b/package/kernel/mac80211/patches/subsys/314-mac80211-minstrel_ht-reduce-unnecessary-rate-probing.patch @@ -0,0 +1,42 @@ +From: Felix Fietkau +Date: Wed, 5 Jun 2019 20:42:49 +0200 +Subject: [PATCH] mac80211: minstrel_ht: reduce unnecessary rate probing + attempts + +On hardware with static fallback tables (e.g. mt76x2), rate probing attempts +can be very expensive. +On such devices, avoid sampling rates slower than the per-group max throughput +rate, based on the assumption that the fallback table will take care of probing +lower rates within that group if the higher rates fail. +To make this work, this also fixes a wrong initialization in the previously +unused per-group sorted rate array. +To further reduce unnecessary probing attempts, skip duplicate attempts on +rates slower than the max throughput rate. + +Signed-off-by: Felix Fietkau +--- + +--- a/net/mac80211/rc80211_minstrel_ht.c ++++ b/net/mac80211/rc80211_minstrel_ht.c +@@ -1028,6 +1028,21 @@ minstrel_get_sample_rate(struct minstrel + minstrel_get_duration(mi->max_prob_rate) * 3 < sample_dur) + return -1; + ++ ++ /* ++ * For devices with no configurable multi-rate retry, skip sampling ++ * below the per-group max throughput rate, and only use one sampling ++ * attempt per rate ++ */ ++ if (mp->hw->max_rates == 1 && ++ (minstrel_get_duration(mg->max_group_tp_rate[0]) < sample_dur || ++ mrs->attempts)) ++ return -1; ++ ++ /* Skip already sampled slow rates */ ++ if (sample_dur >= minstrel_get_duration(tp_rate1) && mrs->attempts) ++ return -1; ++ + /* + * Make sure that lower rates get sampled only occasionally, + * if the link is working perfectly. diff --git a/package/kernel/mac80211/patches/subsys/315-mac80211-minstrel_ht-fix-default-max-throughput-rate.patch b/package/kernel/mac80211/patches/subsys/315-mac80211-minstrel_ht-fix-default-max-throughput-rate.patch new file mode 100644 index 0000000000..3dcea654a2 --- /dev/null +++ b/package/kernel/mac80211/patches/subsys/315-mac80211-minstrel_ht-fix-default-max-throughput-rate.patch @@ -0,0 +1,46 @@ +From: Felix Fietkau +Date: Fri, 14 Jun 2019 21:14:22 +0200 +Subject: [PATCH] mac80211: minstrel_ht: fix default max throughput rate + indexes + +Use the first supported rate instead of 0 (which can be invalid) + +Signed-off-by: Felix Fietkau +--- + +--- a/net/mac80211/rc80211_minstrel_ht.c ++++ b/net/mac80211/rc80211_minstrel_ht.c +@@ -453,7 +453,7 @@ minstrel_ht_assign_best_tp_rates(struct + tmp_prob = mi->groups[tmp_group].rates[tmp_idx].prob_ewma; + tmp_mcs_tp = minstrel_ht_get_tp_avg(mi, tmp_group, tmp_idx, tmp_prob); + +- if (tmp_cck_tp > tmp_mcs_tp) { ++ if (tmp_cck_tp_rate && tmp_cck_tp > tmp_mcs_tp) { + for(i = 0; i < MAX_THR_RATES; i++) { + minstrel_ht_sort_best_tp_rates(mi, tmp_cck_tp_rate[i], + tmp_mcs_tp_rate); +@@ -525,11 +525,19 @@ minstrel_ht_update_stats(struct minstrel + mi->sample_slow = 0; + mi->sample_count = 0; + +- /* Initialize global rate indexes */ +- for(j = 0; j < MAX_THR_RATES; j++){ +- tmp_mcs_tp_rate[j] = 0; +- tmp_cck_tp_rate[j] = 0; +- } ++ memset(tmp_mcs_tp_rate, 0, sizeof(tmp_mcs_tp_rate)); ++ memset(tmp_cck_tp_rate, 0, sizeof(tmp_cck_tp_rate)); ++ if (mi->supported[MINSTREL_CCK_GROUP]) ++ for (j = 0; j < ARRAY_SIZE(tmp_cck_tp_rate); j++) ++ tmp_cck_tp_rate[j] = MINSTREL_CCK_GROUP * MCS_GROUP_RATES; ++ ++ if (mi->supported[MINSTREL_VHT_GROUP_0]) ++ index = MINSTREL_VHT_GROUP_0 * MCS_GROUP_RATES; ++ else ++ index = MINSTREL_HT_GROUP_0 * MCS_GROUP_RATES; ++ ++ for (j = 0; j < ARRAY_SIZE(tmp_mcs_tp_rate); j++) ++ tmp_mcs_tp_rate[j] = index; + + /* Find best rate sets within all MCS groups*/ + for (group = 0; group < ARRAY_SIZE(minstrel_mcs_groups); group++) { diff --git a/package/kernel/mac80211/patches/subsys/316-mac80211-minstrel_ht-improve-rate-probing-for-device.patch b/package/kernel/mac80211/patches/subsys/316-mac80211-minstrel_ht-improve-rate-probing-for-device.patch new file mode 100644 index 0000000000..07d59e0ed7 --- /dev/null +++ b/package/kernel/mac80211/patches/subsys/316-mac80211-minstrel_ht-improve-rate-probing-for-device.patch @@ -0,0 +1,481 @@ +From: Felix Fietkau +Date: Fri, 14 Jun 2019 21:15:47 +0200 +Subject: [PATCH] mac80211: minstrel_ht: improve rate probing for devices + with static fallback + +On some devices that only support static rate fallback tables sending rate +control probing packets can be really expensive. +Probing lower rates can already hurt throughput quite a bit. What hurts even +more is the fact that on mt76x0/mt76x2, single probing packets can only be +forced by directing packets at a different internal hardware queue, which +causes some heavy reordering and extra latency. +The reordering issue is mainly problematic while pushing lots of packets to +a particular station. If there is little activity, the overhead of probing is +neglegible. + +The static fallback behavior is designed to pretty much only handle rate +control algorithms that use only a very limited set of rates on which the +algorithm switches up/down based on packet error rate. + +In order to better support that kind of hardware, this patch implements a +different approach to rate probing where it switches to a slightly higher rate, +waits for tx status feedback, then updates the stats and switches back to +the new max throughput rate. This only triggers above a packet rate of 100 +per stats interval (~50ms). +For that kind of probing, the code has to reduce the set of probing rates +a lot more compared to single packet probing, so it uses only one packet +per MCS group which is either slightly faster, or as close as possible to +the max throughput rate. +This allows switching between similar rates with different numbers of +streams. The algorithm assumes that the hardware will work its way lower +within an MCS group in case of retransmissions, so that lower rates don't +have to be probed by the high packets per second rate probing code. + +To further reduce the search space, it also does not probe rates with lower +channel bandwidth than the max throughput rate. + +At the moment, these changes will only affect mt76x0/mt76x2. + +Signed-off-by: Felix Fietkau +--- + +--- a/net/mac80211/rc80211_minstrel.h ++++ b/net/mac80211/rc80211_minstrel.h +@@ -114,6 +114,7 @@ struct minstrel_sta_info { + struct minstrel_priv { + struct ieee80211_hw *hw; + bool has_mrr; ++ u32 sample_switch; + unsigned int cw_min; + unsigned int cw_max; + unsigned int max_retry; +--- a/net/mac80211/rc80211_minstrel_ht.c ++++ b/net/mac80211/rc80211_minstrel_ht.c +@@ -21,6 +21,8 @@ + #define AVG_AMPDU_SIZE 16 + #define AVG_PKT_SIZE 1200 + ++#define SAMPLE_SWITCH_THR 100 ++ + /* Number of bits for an average sized packet */ + #define MCS_NBITS ((AVG_PKT_SIZE * AVG_AMPDU_SIZE) << 3) + +@@ -56,6 +58,7 @@ + [GROUP_IDX(_streams, _sgi, _ht40)] = { \ + .streams = _streams, \ + .shift = _s, \ ++ .bw = _ht40, \ + .flags = \ + IEEE80211_TX_RC_MCS | \ + (_sgi ? IEEE80211_TX_RC_SHORT_GI : 0) | \ +@@ -85,6 +88,7 @@ + [VHT_GROUP_IDX(_streams, _sgi, _bw)] = { \ + .streams = _streams, \ + .shift = _s, \ ++ .bw = _bw, \ + .flags = \ + IEEE80211_TX_RC_VHT_MCS | \ + (_sgi ? IEEE80211_TX_RC_SHORT_GI : 0) | \ +@@ -493,6 +497,133 @@ minstrel_ht_prob_rate_reduce_streams(str + } + } + ++static inline int ++minstrel_get_duration(int index) ++{ ++ const struct mcs_group *group = &minstrel_mcs_groups[index / MCS_GROUP_RATES]; ++ unsigned int duration = group->duration[index % MCS_GROUP_RATES]; ++ return duration << group->shift; ++} ++ ++static bool ++minstrel_ht_probe_group(struct minstrel_ht_sta *mi, const struct mcs_group *tp_group, ++ int tp_idx, const struct mcs_group *group) ++{ ++ if (group->bw < tp_group->bw) ++ return false; ++ ++ if (group->streams == tp_group->streams) ++ return true; ++ ++ if (tp_idx < 4 && group->streams == tp_group->streams - 1) ++ return true; ++ ++ return group->streams == tp_group->streams + 1; ++} ++ ++static void ++minstrel_ht_find_probe_rates(struct minstrel_ht_sta *mi, u16 *rates, int *n_rates, ++ bool faster_rate) ++{ ++ const struct mcs_group *group, *tp_group; ++ int i, g, max_dur; ++ int tp_idx; ++ ++ tp_group = &minstrel_mcs_groups[mi->max_tp_rate[0] / MCS_GROUP_RATES]; ++ tp_idx = mi->max_tp_rate[0] % MCS_GROUP_RATES; ++ ++ max_dur = minstrel_get_duration(mi->max_tp_rate[0]); ++ if (faster_rate) ++ max_dur -= max_dur / 16; ++ ++ for (g = 0; g < MINSTREL_GROUPS_NB; g++) { ++ u16 supported = mi->supported[g]; ++ ++ if (!supported) ++ continue; ++ ++ group = &minstrel_mcs_groups[g]; ++ if (!minstrel_ht_probe_group(mi, tp_group, tp_idx, group)) ++ continue; ++ ++ for (i = 0; supported; supported >>= 1, i++) { ++ int idx; ++ ++ if (!(supported & 1)) ++ continue; ++ ++ if ((group->duration[i] << group->shift) > max_dur) ++ continue; ++ ++ idx = g * MCS_GROUP_RATES + i; ++ if (idx == mi->max_tp_rate[0]) ++ continue; ++ ++ rates[(*n_rates)++] = idx; ++ break; ++ } ++ } ++} ++ ++static void ++minstrel_ht_rate_sample_switch(struct minstrel_priv *mp, ++ struct minstrel_ht_sta *mi) ++{ ++ struct minstrel_rate_stats *mrs; ++ u16 rates[MINSTREL_GROUPS_NB]; ++ int n_rates = 0; ++ int probe_rate = 0; ++ bool faster_rate; ++ int i; ++ u8 random; ++ ++ /* ++ * Use rate switching instead of probing packets for devices with ++ * little control over retry fallback behavior ++ */ ++ if (mp->hw->max_rates > 1) ++ return; ++ ++ /* ++ * If the current EWMA prob is >75%, look for a rate that's 6.25% ++ * faster than the max tp rate. ++ * If that fails, look again for a rate that is at least as fast ++ */ ++ mrs = minstrel_get_ratestats(mi, mi->max_tp_rate[0]); ++ faster_rate = mrs->prob_ewma > MINSTREL_FRAC(75, 100); ++ minstrel_ht_find_probe_rates(mi, rates, &n_rates, faster_rate); ++ if (!n_rates && faster_rate) ++ minstrel_ht_find_probe_rates(mi, rates, &n_rates, false); ++ ++ /* If no suitable rate was found, try to pick the next one in the group */ ++ if (!n_rates) { ++ int g_idx = mi->max_tp_rate[0] / MCS_GROUP_RATES; ++ u16 supported = mi->supported[g_idx]; ++ ++ supported >>= mi->max_tp_rate[0] % MCS_GROUP_RATES; ++ for (i = 0; supported; i++) { ++ if (!(supported & 1)) ++ continue; ++ ++ probe_rate = mi->max_tp_rate[0] + i; ++ goto out; ++ } ++ ++ return; ++ } ++ ++ i = 0; ++ if (n_rates > 1) { ++ random = prandom_u32(); ++ i = random % n_rates; ++ } ++ probe_rate = rates[i]; ++ ++out: ++ mi->sample_rate = probe_rate; ++ mi->sample_mode = MINSTREL_SAMPLE_ACTIVE; ++} ++ + /* + * Update rate statistics and select new primary rates + * +@@ -503,7 +634,8 @@ minstrel_ht_prob_rate_reduce_streams(str + * higher throughput rates, even if the probablity is a bit lower + */ + static void +-minstrel_ht_update_stats(struct minstrel_priv *mp, struct minstrel_ht_sta *mi) ++minstrel_ht_update_stats(struct minstrel_priv *mp, struct minstrel_ht_sta *mi, ++ bool sample) + { + struct minstrel_mcs_group_data *mg; + struct minstrel_rate_stats *mrs; +@@ -511,6 +643,18 @@ minstrel_ht_update_stats(struct minstrel + u16 tmp_mcs_tp_rate[MAX_THR_RATES], tmp_group_tp_rate[MAX_THR_RATES]; + u16 tmp_cck_tp_rate[MAX_THR_RATES], index; + ++ mi->sample_mode = MINSTREL_SAMPLE_IDLE; ++ ++ if (sample) { ++ mi->total_packets_cur = mi->total_packets - ++ mi->total_packets_last; ++ mi->total_packets_last = mi->total_packets; ++ } ++ if (!mp->sample_switch) ++ sample = false; ++ if (mi->total_packets_cur < SAMPLE_SWITCH_THR && mp->sample_switch != 1) ++ sample = false; ++ + if (mi->ampdu_packets > 0) { + if (!ieee80211_hw_check(mp->hw, TX_STATUS_NO_AMPDU_LEN)) + mi->avg_ampdu_len = minstrel_ewma(mi->avg_ampdu_len, +@@ -597,12 +741,16 @@ minstrel_ht_update_stats(struct minstrel + /* try to sample all available rates during each interval */ + mi->sample_count *= 8; + ++ if (sample) ++ minstrel_ht_rate_sample_switch(mp, mi); ++ + #ifdef CPTCFG_MAC80211_DEBUGFS + /* use fixed index if set */ + if (mp->fixed_rate_idx != -1) { + for (i = 0; i < 4; i++) + mi->max_tp_rate[i] = mp->fixed_rate_idx; + mi->max_prob_rate = mp->fixed_rate_idx; ++ mi->sample_mode = MINSTREL_SAMPLE_IDLE; + } + #endif + +@@ -706,15 +854,17 @@ minstrel_ht_tx_status(void *priv, struct + struct minstrel_ht_sta_priv *msp = priv_sta; + struct minstrel_ht_sta *mi = &msp->ht; + struct ieee80211_tx_rate *ar = info->status.rates; +- struct minstrel_rate_stats *rate, *rate2; ++ struct minstrel_rate_stats *rate, *rate2, *rate_sample = NULL; + struct minstrel_priv *mp = priv; + bool last, update = false; ++ bool sample_status = false; + int i; + + if (!msp->is_ht) + return mac80211_minstrel.tx_status_ext(priv, sband, + &msp->legacy, st); + ++ + /* This packet was aggregated but doesn't carry status info */ + if ((info->flags & IEEE80211_TX_CTL_AMPDU) && + !(info->flags & IEEE80211_TX_STAT_AMPDU)) +@@ -740,12 +890,17 @@ minstrel_ht_tx_status(void *priv, struct + if (info->flags & IEEE80211_TX_CTL_RATE_CTRL_PROBE) + mi->sample_packets += info->status.ampdu_len; + ++ if (mi->sample_mode != MINSTREL_SAMPLE_IDLE) ++ rate_sample = minstrel_get_ratestats(mi, mi->sample_rate); ++ + last = !minstrel_ht_txstat_valid(mp, &ar[0]); + for (i = 0; !last; i++) { + last = (i == IEEE80211_TX_MAX_RATES - 1) || + !minstrel_ht_txstat_valid(mp, &ar[i + 1]); + + rate = minstrel_ht_get_stats(mp, mi, &ar[i]); ++ if (rate == rate_sample) ++ sample_status = true; + + if (last) + rate->success += info->status.ampdu_ack_len; +@@ -753,44 +908,60 @@ minstrel_ht_tx_status(void *priv, struct + rate->attempts += ar[i].count * info->status.ampdu_len; + } + +- /* +- * check for sudden death of spatial multiplexing, +- * downgrade to a lower number of streams if necessary. +- */ +- rate = minstrel_get_ratestats(mi, mi->max_tp_rate[0]); +- if (rate->attempts > 30 && +- MINSTREL_FRAC(rate->success, rate->attempts) < +- MINSTREL_FRAC(20, 100)) { +- minstrel_downgrade_rate(mi, &mi->max_tp_rate[0], true); ++ switch (mi->sample_mode) { ++ case MINSTREL_SAMPLE_IDLE: ++ break; ++ ++ case MINSTREL_SAMPLE_ACTIVE: ++ if (!sample_status) ++ break; ++ ++ mi->sample_mode = MINSTREL_SAMPLE_PENDING; + update = true; +- } ++ break; ++ ++ case MINSTREL_SAMPLE_PENDING: ++ if (sample_status) ++ break; + +- rate2 = minstrel_get_ratestats(mi, mi->max_tp_rate[1]); +- if (rate2->attempts > 30 && +- MINSTREL_FRAC(rate2->success, rate2->attempts) < +- MINSTREL_FRAC(20, 100)) { +- minstrel_downgrade_rate(mi, &mi->max_tp_rate[1], false); + update = true; ++ minstrel_ht_update_stats(mp, mi, false); ++ break; ++ } ++ ++ ++ if (mp->hw->max_rates > 1) { ++ /* ++ * check for sudden death of spatial multiplexing, ++ * downgrade to a lower number of streams if necessary. ++ */ ++ rate = minstrel_get_ratestats(mi, mi->max_tp_rate[0]); ++ if (rate->attempts > 30 && ++ MINSTREL_FRAC(rate->success, rate->attempts) < ++ MINSTREL_FRAC(20, 100)) { ++ minstrel_downgrade_rate(mi, &mi->max_tp_rate[0], true); ++ update = true; ++ } ++ ++ rate2 = minstrel_get_ratestats(mi, mi->max_tp_rate[1]); ++ if (rate2->attempts > 30 && ++ MINSTREL_FRAC(rate2->success, rate2->attempts) < ++ MINSTREL_FRAC(20, 100)) { ++ minstrel_downgrade_rate(mi, &mi->max_tp_rate[1], false); ++ update = true; ++ } + } + + if (time_after(jiffies, mi->last_stats_update + + (mp->update_interval / 2 * HZ) / 1000)) { + update = true; +- minstrel_ht_update_stats(mp, mi); ++ minstrel_ht_update_stats(mp, mi, true); + } + + if (update) + minstrel_ht_update_rates(mp, mi); + } + +-static inline int +-minstrel_get_duration(int index) +-{ +- const struct mcs_group *group = &minstrel_mcs_groups[index / MCS_GROUP_RATES]; +- unsigned int duration = group->duration[index % MCS_GROUP_RATES]; +- return duration << group->shift; +-} +- + static void + minstrel_calc_retransmit(struct minstrel_priv *mp, struct minstrel_ht_sta *mi, + int index) +@@ -955,14 +1126,18 @@ static void + minstrel_ht_update_rates(struct minstrel_priv *mp, struct minstrel_ht_sta *mi) + { + struct ieee80211_sta_rates *rates; ++ u16 first_rate = mi->max_tp_rate[0]; + int i = 0; + ++ if (mi->sample_mode == MINSTREL_SAMPLE_ACTIVE) ++ first_rate = mi->sample_rate; ++ + rates = kzalloc(sizeof(*rates), GFP_ATOMIC); + if (!rates) + return; + + /* Start with max_tp_rate[0] */ +- minstrel_ht_set_rate(mp, mi, rates, i++, mi->max_tp_rate[0]); ++ minstrel_ht_set_rate(mp, mi, rates, i++, first_rate); + + if (mp->hw->max_rates >= 3) { + /* At least 3 tx rates supported, use max_tp_rate[1] next */ +@@ -989,6 +1164,11 @@ minstrel_get_sample_rate(struct minstrel + int tp_rate1, tp_rate2; + int sample_idx = 0; + ++ if (mp->hw->max_rates == 1 && mp->sample_switch && ++ (mi->total_packets_cur >= SAMPLE_SWITCH_THR || ++ mp->sample_switch == 1)) ++ return -1; ++ + if (mi->sample_wait > 0) { + mi->sample_wait--; + return -1; +@@ -1315,7 +1495,7 @@ minstrel_ht_update_caps(void *priv, stru + mi->supported[MINSTREL_CCK_GROUP] |= mi->cck_supported_short << 4; + + /* create an initial rate table with the lowest supported rates */ +- minstrel_ht_update_stats(mp, mi); ++ minstrel_ht_update_stats(mp, mi, true); + minstrel_ht_update_rates(mp, mi); + + return; +@@ -1433,6 +1613,8 @@ minstrel_ht_alloc(struct ieee80211_hw *h + if (!mp) + return NULL; + ++ mp->sample_switch = -1; ++ + /* contention window settings + * Just an approximation. Using the per-queue values would complicate + * the calculations and is probably unnecessary */ +@@ -1464,6 +1646,8 @@ minstrel_ht_alloc(struct ieee80211_hw *h + mp->fixed_rate_idx = (u32) -1; + debugfs_create_u32("fixed_rate_idx", S_IRUGO | S_IWUGO, debugfsdir, + &mp->fixed_rate_idx); ++ debugfs_create_u32("sample_switch", S_IRUGO | S_IWUSR, debugfsdir, ++ &mp->sample_switch); + #endif + + minstrel_ht_init_cck_rates(mp); +--- a/net/mac80211/rc80211_minstrel_ht.h ++++ b/net/mac80211/rc80211_minstrel_ht.h +@@ -36,6 +36,7 @@ struct mcs_group { + u16 flags; + u8 streams; + u8 shift; ++ u8 bw; + u16 duration[MCS_GROUP_RATES]; + }; + +@@ -53,6 +54,12 @@ struct minstrel_mcs_group_data { + struct minstrel_rate_stats rates[MCS_GROUP_RATES]; + }; + ++enum minstrel_sample_mode { ++ MINSTREL_SAMPLE_IDLE, ++ MINSTREL_SAMPLE_ACTIVE, ++ MINSTREL_SAMPLE_PENDING, ++}; ++ + struct minstrel_ht_sta { + struct ieee80211_sta *sta; + +@@ -74,6 +81,8 @@ struct minstrel_ht_sta { + unsigned int overhead; + unsigned int overhead_rtscts; + ++ unsigned int total_packets_last; ++ unsigned int total_packets_cur; + unsigned int total_packets; + unsigned int sample_packets; + +@@ -85,6 +94,9 @@ struct minstrel_ht_sta { + u8 sample_count; + u8 sample_slow; + ++ enum minstrel_sample_mode sample_mode; ++ u16 sample_rate; ++ + /* current MCS group to be sampled */ + u8 sample_group; + diff --git a/package/kernel/mac80211/patches/subsys/317-mac80211-minstrel_ht-fix-infinite-loop-because-suppo.patch b/package/kernel/mac80211/patches/subsys/317-mac80211-minstrel_ht-fix-infinite-loop-because-suppo.patch new file mode 100644 index 0000000000..59fc726683 --- /dev/null +++ b/package/kernel/mac80211/patches/subsys/317-mac80211-minstrel_ht-fix-infinite-loop-because-suppo.patch @@ -0,0 +1,25 @@ +From: Colin Ian King +Date: Thu, 22 Aug 2019 13:20:34 +0100 +Subject: [PATCH] mac80211: minstrel_ht: fix infinite loop because supported is + not being shifted + +Currently the for-loop will spin forever if variable supported is +non-zero because supported is never changed. Fix this by adding in +the missing right shift of supported. + +Addresses-Coverity: ("Infinite loop") +Fixes: 48cb39522a9d ("mac80211: minstrel_ht: improve rate probing for devices with static fallback") +Signed-off-by: Colin Ian King +--- + +--- a/net/mac80211/rc80211_minstrel_ht.c ++++ b/net/mac80211/rc80211_minstrel_ht.c +@@ -601,7 +601,7 @@ minstrel_ht_rate_sample_switch(struct mi + u16 supported = mi->supported[g_idx]; + + supported >>= mi->max_tp_rate[0] % MCS_GROUP_RATES; +- for (i = 0; supported; i++) { ++ for (i = 0; supported; supported >>= 1, i++) { + if (!(supported & 1)) + continue; + diff --git a/package/kernel/mac80211/patches/subsys/320-mac80211-Add-TXQ-scheduling-API.patch b/package/kernel/mac80211/patches/subsys/320-mac80211-Add-TXQ-scheduling-API.patch new file mode 100644 index 0000000000..4566e99319 --- /dev/null +++ b/package/kernel/mac80211/patches/subsys/320-mac80211-Add-TXQ-scheduling-API.patch @@ -0,0 +1,292 @@ +From: =?UTF-8?q?Toke=20H=C3=B8iland-J=C3=B8rgensen?= +Date: Tue, 18 Dec 2018 17:02:06 -0800 +Subject: [PATCH] mac80211: Add TXQ scheduling API +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +This adds an API to mac80211 to handle scheduling of TXQs. The interface +between driver and mac80211 for TXQ handling is changed by adding two new +functions: ieee80211_next_txq(), which will return the next TXQ to schedule +in the current round-robin rotation, and ieee80211_return_txq(), which the +driver uses to indicate that it has finished scheduling a TXQ (which will +then be put back in the scheduling rotation if it isn't empty). + +The driver must call ieee80211_txq_schedule_start() at the start of each +scheduling session, and ieee80211_txq_schedule_end() at the end. The API +then guarantees that the same TXQ is not returned twice in the same +session (so a driver can loop on ieee80211_next_txq() without worrying +about breaking the loop. + +Usage of the new API is optional, so drivers can be ported one at a time. +In this patch, the actual scheduling performed by mac80211 is simple +round-robin, but a subsequent commit adds airtime fairness awareness to the +scheduler. + +Signed-off-by: Toke Høiland-Jørgensen +[minor kernel-doc fix, propagate sparse locking checks out] +Signed-off-by: Johannes Berg +--- + +--- a/include/net/mac80211.h ++++ b/include/net/mac80211.h +@@ -107,9 +107,15 @@ + * The driver is expected to initialize its private per-queue data for stations + * and interfaces in the .add_interface and .sta_add ops. + * +- * The driver can't access the queue directly. To dequeue a frame, it calls +- * ieee80211_tx_dequeue(). Whenever mac80211 adds a new frame to a queue, it +- * calls the .wake_tx_queue driver op. ++ * The driver can't access the queue directly. To dequeue a frame from a ++ * txq, it calls ieee80211_tx_dequeue(). Whenever mac80211 adds a new frame to a ++ * queue, it calls the .wake_tx_queue driver op. ++ * ++ * Drivers can optionally delegate responsibility for scheduling queues to ++ * mac80211, to take advantage of airtime fairness accounting. In this case, to ++ * obtain the next queue to pull frames from, the driver calls ++ * ieee80211_next_txq(). The driver is then expected to return the txq using ++ * ieee80211_return_txq(). + * + * For AP powersave TIM handling, the driver only needs to indicate if it has + * buffered packets in the driver specific data structures by calling +@@ -5979,7 +5985,8 @@ void ieee80211_unreserve_tid(struct ieee + * ieee80211_tx_dequeue - dequeue a packet from a software tx queue + * + * @hw: pointer as obtained from ieee80211_alloc_hw() +- * @txq: pointer obtained from station or virtual interface ++ * @txq: pointer obtained from station or virtual interface, or from ++ * ieee80211_next_txq() + * + * Returns the skb if successful, %NULL if no frame was available. + */ +@@ -5987,6 +5994,54 @@ struct sk_buff *ieee80211_tx_dequeue(str + struct ieee80211_txq *txq); + + /** ++ * ieee80211_next_txq - get next tx queue to pull packets from ++ * ++ * @hw: pointer as obtained from ieee80211_alloc_hw() ++ * @ac: AC number to return packets from. ++ * ++ * Should only be called between calls to ieee80211_txq_schedule_start() ++ * and ieee80211_txq_schedule_end(). ++ * Returns the next txq if successful, %NULL if no queue is eligible. If a txq ++ * is returned, it should be returned with ieee80211_return_txq() after the ++ * driver has finished scheduling it. ++ */ ++struct ieee80211_txq *ieee80211_next_txq(struct ieee80211_hw *hw, u8 ac); ++ ++/** ++ * ieee80211_return_txq - return a TXQ previously acquired by ieee80211_next_txq() ++ * ++ * @hw: pointer as obtained from ieee80211_alloc_hw() ++ * @txq: pointer obtained from station or virtual interface ++ * ++ * Should only be called between calls to ieee80211_txq_schedule_start() ++ * and ieee80211_txq_schedule_end(). ++ */ ++void ieee80211_return_txq(struct ieee80211_hw *hw, struct ieee80211_txq *txq); ++ ++/** ++ * ieee80211_txq_schedule_start - acquire locks for safe scheduling of an AC ++ * ++ * @hw: pointer as obtained from ieee80211_alloc_hw() ++ * @ac: AC number to acquire locks for ++ * ++ * Acquire locks needed to schedule TXQs from the given AC. Should be called ++ * before ieee80211_next_txq() or ieee80211_return_txq(). ++ */ ++void ieee80211_txq_schedule_start(struct ieee80211_hw *hw, u8 ac) ++ __acquires(txq_lock); ++ ++/** ++ * ieee80211_txq_schedule_end - release locks for safe scheduling of an AC ++ * ++ * @hw: pointer as obtained from ieee80211_alloc_hw() ++ * @ac: AC number to acquire locks for ++ * ++ * Release locks previously acquired by ieee80211_txq_schedule_end(). ++ */ ++void ieee80211_txq_schedule_end(struct ieee80211_hw *hw, u8 ac) ++ __releases(txq_lock); ++ ++/** + * ieee80211_txq_get_depth - get pending frame/byte count of given txq + * + * The values are not guaranteed to be coherent with regard to each other, i.e. +--- a/net/mac80211/agg-tx.c ++++ b/net/mac80211/agg-tx.c +@@ -229,7 +229,7 @@ ieee80211_agg_start_txq(struct sta_info + clear_bit(IEEE80211_TXQ_STOP, &txqi->flags); + local_bh_disable(); + rcu_read_lock(); +- drv_wake_tx_queue(sta->sdata->local, txqi); ++ schedule_and_wake_txq(sta->sdata->local, txqi); + rcu_read_unlock(); + local_bh_enable(); + } +--- a/net/mac80211/driver-ops.h ++++ b/net/mac80211/driver-ops.h +@@ -1176,6 +1176,15 @@ static inline void drv_wake_tx_queue(str + local->ops->wake_tx_queue(&local->hw, &txq->txq); + } + ++static inline void schedule_and_wake_txq(struct ieee80211_local *local, ++ struct txq_info *txqi) ++{ ++ spin_lock_bh(&local->active_txq_lock[txqi->txq.ac]); ++ ieee80211_return_txq(&local->hw, &txqi->txq); ++ spin_unlock_bh(&local->active_txq_lock[txqi->txq.ac]); ++ drv_wake_tx_queue(local, txqi); ++} ++ + static inline int drv_start_nan(struct ieee80211_local *local, + struct ieee80211_sub_if_data *sdata, + struct cfg80211_nan_conf *conf) +--- a/net/mac80211/ieee80211_i.h ++++ b/net/mac80211/ieee80211_i.h +@@ -829,6 +829,8 @@ enum txq_info_flags { + * a fq_flow which is already owned by a different tin + * @def_cvars: codel vars for @def_flow + * @frags: used to keep fragments created after dequeue ++ * @schedule_order: used with ieee80211_local->active_txqs ++ * @schedule_round: counter to prevent infinite loops on TXQ scheduling + */ + struct txq_info { + struct fq_tin tin; +@@ -836,6 +838,8 @@ struct txq_info { + struct codel_vars def_cvars; + struct codel_stats cstats; + struct sk_buff_head frags; ++ struct list_head schedule_order; ++ u16 schedule_round; + unsigned long flags; + + /* keep last! */ +@@ -1127,6 +1131,11 @@ struct ieee80211_local { + struct codel_vars *cvars; + struct codel_params cparams; + ++ /* protects active_txqs and txqi->schedule_order */ ++ spinlock_t active_txq_lock[IEEE80211_NUM_ACS]; ++ struct list_head active_txqs[IEEE80211_NUM_ACS]; ++ u16 schedule_round[IEEE80211_NUM_ACS]; ++ + const struct ieee80211_ops *ops; + + /* +--- a/net/mac80211/main.c ++++ b/net/mac80211/main.c +@@ -652,6 +652,11 @@ struct ieee80211_hw *ieee80211_alloc_hw_ + spin_lock_init(&local->rx_path_lock); + spin_lock_init(&local->queue_stop_reason_lock); + ++ for (i = 0; i < IEEE80211_NUM_ACS; i++) { ++ INIT_LIST_HEAD(&local->active_txqs[i]); ++ spin_lock_init(&local->active_txq_lock[i]); ++ } ++ + INIT_LIST_HEAD(&local->chanctx_list); + mutex_init(&local->chanctx_mtx); + +--- a/net/mac80211/sta_info.c ++++ b/net/mac80211/sta_info.c +@@ -1244,7 +1244,7 @@ void ieee80211_sta_ps_deliver_wakeup(str + if (!txq_has_queue(sta->sta.txq[i])) + continue; + +- drv_wake_tx_queue(local, to_txq_info(sta->sta.txq[i])); ++ schedule_and_wake_txq(local, to_txq_info(sta->sta.txq[i])); + } + } + +--- a/net/mac80211/tx.c ++++ b/net/mac80211/tx.c +@@ -1441,6 +1441,7 @@ void ieee80211_txq_init(struct ieee80211 + codel_vars_init(&txqi->def_cvars); + codel_stats_init(&txqi->cstats); + __skb_queue_head_init(&txqi->frags); ++ INIT_LIST_HEAD(&txqi->schedule_order); + + txqi->txq.vif = &sdata->vif; + +@@ -1464,6 +1465,9 @@ void ieee80211_txq_purge(struct ieee8021 + + fq_tin_reset(fq, tin, fq_skb_free_func); + ieee80211_purge_tx_queue(&local->hw, &txqi->frags); ++ spin_lock_bh(&local->active_txq_lock[txqi->txq.ac]); ++ list_del_init(&txqi->schedule_order); ++ spin_unlock_bh(&local->active_txq_lock[txqi->txq.ac]); + } + + void ieee80211_txq_set_params(struct ieee80211_local *local) +@@ -1580,7 +1584,7 @@ static bool ieee80211_queue_skb(struct i + ieee80211_txq_enqueue(local, txqi, skb); + spin_unlock_bh(&fq->lock); + +- drv_wake_tx_queue(local, txqi); ++ schedule_and_wake_txq(local, txqi); + + return true; + } +@@ -3600,6 +3604,60 @@ out: + } + EXPORT_SYMBOL(ieee80211_tx_dequeue); + ++struct ieee80211_txq *ieee80211_next_txq(struct ieee80211_hw *hw, u8 ac) ++{ ++ struct ieee80211_local *local = hw_to_local(hw); ++ struct txq_info *txqi = NULL; ++ ++ lockdep_assert_held(&local->active_txq_lock[ac]); ++ ++ txqi = list_first_entry_or_null(&local->active_txqs[ac], ++ struct txq_info, ++ schedule_order); ++ ++ if (!txqi || txqi->schedule_round == local->schedule_round[ac]) ++ return NULL; ++ ++ list_del_init(&txqi->schedule_order); ++ txqi->schedule_round = local->schedule_round[ac]; ++ return &txqi->txq; ++} ++EXPORT_SYMBOL(ieee80211_next_txq); ++ ++void ieee80211_return_txq(struct ieee80211_hw *hw, ++ struct ieee80211_txq *txq) ++{ ++ struct ieee80211_local *local = hw_to_local(hw); ++ struct txq_info *txqi = to_txq_info(txq); ++ ++ lockdep_assert_held(&local->active_txq_lock[txq->ac]); ++ ++ if (list_empty(&txqi->schedule_order) && ++ (!skb_queue_empty(&txqi->frags) || txqi->tin.backlog_packets)) ++ list_add_tail(&txqi->schedule_order, ++ &local->active_txqs[txq->ac]); ++} ++EXPORT_SYMBOL(ieee80211_return_txq); ++ ++void ieee80211_txq_schedule_start(struct ieee80211_hw *hw, u8 ac) ++ __acquires(txq_lock) ++{ ++ struct ieee80211_local *local = hw_to_local(hw); ++ ++ spin_lock_bh(&local->active_txq_lock[ac]); ++ local->schedule_round[ac]++; ++} ++EXPORT_SYMBOL(ieee80211_txq_schedule_start); ++ ++void ieee80211_txq_schedule_end(struct ieee80211_hw *hw, u8 ac) ++ __releases(txq_lock) ++{ ++ struct ieee80211_local *local = hw_to_local(hw); ++ ++ spin_unlock_bh(&local->active_txq_lock[ac]); ++} ++EXPORT_SYMBOL(ieee80211_txq_schedule_end); ++ + void __ieee80211_subif_start_xmit(struct sk_buff *skb, + struct net_device *dev, + u32 info_flags) diff --git a/package/kernel/mac80211/patches/subsys/321-cfg80211-Add-airtime-statistics-and-settings.patch b/package/kernel/mac80211/patches/subsys/321-cfg80211-Add-airtime-statistics-and-settings.patch new file mode 100644 index 0000000000..338e247307 --- /dev/null +++ b/package/kernel/mac80211/patches/subsys/321-cfg80211-Add-airtime-statistics-and-settings.patch @@ -0,0 +1,202 @@ +From: =?UTF-8?q?Toke=20H=C3=B8iland-J=C3=B8rgensen?= +Date: Tue, 18 Dec 2018 17:02:07 -0800 +Subject: [PATCH] cfg80211: Add airtime statistics and settings +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +This adds TX airtime statistics to the cfg80211 station dump (to go along +with the RX info already present), and adds a new parameter to set the +airtime weight of each station. The latter allows userspace to implement +policies for different stations by varying their weights. + +Signed-off-by: Toke Høiland-Jørgensen +[rmanohar@codeaurora.org: fixed checkpatch warnings] +Signed-off-by: Rajkumar Manoharan +[move airtime weight != 0 check into policy] +Signed-off-by: Johannes Berg +--- + +--- a/include/net/cfg80211.h ++++ b/include/net/cfg80211.h +@@ -988,6 +988,7 @@ enum station_parameters_apply_mask { + * @support_p2p_ps: information if station supports P2P PS mechanism + * @he_capa: HE capabilities of station + * @he_capa_len: the length of the HE capabilities ++ * @airtime_weight: airtime scheduler weight for this station + */ + struct station_parameters { + const u8 *supported_rates; +@@ -1017,6 +1018,7 @@ struct station_parameters { + int support_p2p_ps; + const struct ieee80211_he_cap_elem *he_capa; + u8 he_capa_len; ++ u16 airtime_weight; + }; + + /** +@@ -1284,6 +1286,8 @@ struct cfg80211_tid_stats { + * @rx_beacon_signal_avg: signal strength average (in dBm) for beacons received + * from this peer + * @rx_duration: aggregate PPDU duration(usecs) for all the frames from a peer ++ * @tx_duration: aggregate PPDU duration(usecs) for all the frames to a peer ++ * @airtime_weight: current airtime scheduling weight + * @pertid: per-TID statistics, see &struct cfg80211_tid_stats, using the last + * (IEEE80211_NUM_TIDS) index for MSDUs not encapsulated in QoS-MPDUs. + * Note that this doesn't use the @filled bit, but is used if non-NULL. +@@ -1330,12 +1334,15 @@ struct station_info { + + u32 expected_throughput; + +- u64 rx_beacon; ++ u64 tx_duration; + u64 rx_duration; ++ u64 rx_beacon; + u8 rx_beacon_signal_avg; + struct cfg80211_tid_stats *pertid; + s8 ack_signal; + s8 avg_ack_signal; ++ ++ u16 airtime_weight; + }; + + #if IS_ENABLED(CPTCFG_CFG80211) +@@ -2361,6 +2368,8 @@ enum wiphy_params_flags { + WIPHY_PARAM_TXQ_QUANTUM = 1 << 8, + }; + ++#define IEEE80211_DEFAULT_AIRTIME_WEIGHT 256 ++ + /** + * struct cfg80211_pmksa - PMK Security Association + * +--- a/include/uapi/linux/nl80211.h ++++ b/include/uapi/linux/nl80211.h +@@ -2241,6 +2241,9 @@ enum nl80211_commands { + * association request when used with NL80211_CMD_NEW_STATION). Can be set + * only if %NL80211_STA_FLAG_WME is set. + * ++ * @NL80211_ATTR_AIRTIME_WEIGHT: Station's weight when scheduled by the airtime ++ * scheduler. ++ * + * @NUM_NL80211_ATTR: total number of nl80211_attrs available + * @NL80211_ATTR_MAX: highest attribute number currently defined + * @__NL80211_ATTR_AFTER_LAST: internal use +@@ -2682,6 +2685,14 @@ enum nl80211_attrs { + + NL80211_ATTR_HE_CAPABILITY, + ++ /* not backported yet */ ++ NL80211_ATTR_FTM_RESPONDER, ++ NL80211_ATTR_FTM_RESPONDER_STATS, ++ NL80211_ATTR_TIMEOUT, ++ NL80211_ATTR_PEER_MEASUREMENTS, ++ ++ NL80211_ATTR_AIRTIME_WEIGHT, ++ + /* add attributes here, update the policy in nl80211.c */ + + __NL80211_ATTR_AFTER_LAST, +@@ -3052,6 +3063,9 @@ enum nl80211_sta_bss_param { + * @NL80211_STA_INFO_ACK_SIGNAL: signal strength of the last ACK frame(u8, dBm) + * @NL80211_STA_INFO_DATA_ACK_SIGNAL_AVG: avg signal strength of (data) + * ACK frame (s8, dBm) ++ * @NL80211_STA_INFO_TX_DURATION: aggregate PPDU duration for all frames ++ * sent to the station (u64, usec) ++ * @NL80211_STA_INFO_AIRTIME_WEIGHT: current airtime weight for station (u16) + * @__NL80211_STA_INFO_AFTER_LAST: internal + * @NL80211_STA_INFO_MAX: highest possible station info attribute + */ +@@ -3093,6 +3107,14 @@ enum nl80211_sta_info { + NL80211_STA_INFO_ACK_SIGNAL, + NL80211_STA_INFO_DATA_ACK_SIGNAL_AVG, + ++ /* not backported yet */ ++ NL80211_STA_INFO_RX_MPDUS, ++ NL80211_STA_INFO_FCS_ERROR_COUNT, ++ NL80211_STA_INFO_CONNECTED_TO_GATE, ++ ++ NL80211_STA_INFO_TX_DURATION, ++ NL80211_STA_INFO_AIRTIME_WEIGHT, ++ + /* keep last */ + __NL80211_STA_INFO_AFTER_LAST, + NL80211_STA_INFO_MAX = __NL80211_STA_INFO_AFTER_LAST - 1 +@@ -5224,6 +5246,10 @@ enum nl80211_feature_flags { + * except for supported rates from the probe request content if requested + * by the %NL80211_SCAN_FLAG_MIN_PREQ_CONTENT flag. + * ++ * @NL80211_EXT_FEATURE_AIRTIME_FAIRNESS: Driver supports getting airtime ++ * fairness for transmitted packets and has enabled airtime fairness ++ * scheduling. ++ * + * @NUM_NL80211_EXT_FEATURES: number of extended features. + * @MAX_NL80211_EXT_FEATURES: highest extended feature index. + */ +@@ -5260,6 +5286,12 @@ enum nl80211_ext_feature_index { + NL80211_EXT_FEATURE_SCAN_RANDOM_SN, + NL80211_EXT_FEATURE_SCAN_MIN_PREQ_CONTENT, + ++ /* --- not backported yet --- */ ++ NL80211_EXT_FEATURE_CAN_REPLACE_PTK0, ++ NL80211_EXT_FEATURE_ENABLE_FTM_RESPONDER, ++ ++ NL80211_EXT_FEATURE_AIRTIME_FAIRNESS, ++ + /* add new features before the definition below */ + NUM_NL80211_EXT_FEATURES, + MAX_NL80211_EXT_FEATURES = NUM_NL80211_EXT_FEATURES - 1 +--- a/net/wireless/nl80211.c ++++ b/net/wireless/nl80211.c +@@ -430,6 +430,7 @@ static const struct nla_policy nl80211_p + [NL80211_ATTR_TXQ_QUANTUM] = { .type = NLA_U32 }, + [NL80211_ATTR_HE_CAPABILITY] = { .type = NLA_BINARY, + .len = NL80211_HE_MAX_CAPABILITY_LEN }, ++ [NL80211_ATTR_AIRTIME_WEIGHT] = NLA_POLICY_MIN(NLA_U16, 1), + }; + + /* policy for the key attributes */ +@@ -4664,6 +4665,11 @@ static int nl80211_send_station(struct s + PUT_SINFO(PLID, plid, u16); + PUT_SINFO(PLINK_STATE, plink_state, u8); + PUT_SINFO_U64(RX_DURATION, rx_duration); ++ PUT_SINFO_U64(TX_DURATION, tx_duration); ++ ++ if (wiphy_ext_feature_isset(&rdev->wiphy, ++ NL80211_EXT_FEATURE_AIRTIME_FAIRNESS)) ++ PUT_SINFO(AIRTIME_WEIGHT, airtime_weight, u16); + + switch (rdev->wiphy.signal_type) { + case CFG80211_SIGNAL_TYPE_MBM: +@@ -5300,6 +5306,15 @@ static int nl80211_set_station(struct sk + nla_get_u8(info->attrs[NL80211_ATTR_OPMODE_NOTIF]); + } + ++ if (info->attrs[NL80211_ATTR_AIRTIME_WEIGHT]) ++ params.airtime_weight = ++ nla_get_u16(info->attrs[NL80211_ATTR_AIRTIME_WEIGHT]); ++ ++ if (params.airtime_weight && ++ !wiphy_ext_feature_isset(&rdev->wiphy, ++ NL80211_EXT_FEATURE_AIRTIME_FAIRNESS)) ++ return -EOPNOTSUPP; ++ + /* Include parameters for TDLS peer (will check later) */ + err = nl80211_set_station_tdls(info, ¶ms); + if (err) +@@ -5438,6 +5453,15 @@ static int nl80211_new_station(struct sk + return -EINVAL; + } + ++ if (info->attrs[NL80211_ATTR_AIRTIME_WEIGHT]) ++ params.airtime_weight = ++ nla_get_u16(info->attrs[NL80211_ATTR_AIRTIME_WEIGHT]); ++ ++ if (params.airtime_weight && ++ !wiphy_ext_feature_isset(&rdev->wiphy, ++ NL80211_EXT_FEATURE_AIRTIME_FAIRNESS)) ++ return -EOPNOTSUPP; ++ + err = nl80211_parse_sta_channel_info(info, ¶ms); + if (err) + return err; diff --git a/package/kernel/mac80211/patches/subsys/322-mac80211-Add-airtime-accounting-and-scheduling-to-TX.patch b/package/kernel/mac80211/patches/subsys/322-mac80211-Add-airtime-accounting-and-scheduling-to-TX.patch new file mode 100644 index 0000000000..c8decd2f08 --- /dev/null +++ b/package/kernel/mac80211/patches/subsys/322-mac80211-Add-airtime-accounting-and-scheduling-to-TX.patch @@ -0,0 +1,522 @@ +From: =?UTF-8?q?Toke=20H=C3=B8iland-J=C3=B8rgensen?= +Date: Tue, 18 Dec 2018 17:02:08 -0800 +Subject: [PATCH] mac80211: Add airtime accounting and scheduling to TXQs +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +This adds airtime accounting and scheduling to the mac80211 TXQ +scheduler. A new callback, ieee80211_sta_register_airtime(), is added +that drivers can call to report airtime usage for stations. + +When airtime information is present, mac80211 will schedule TXQs +(through ieee80211_next_txq()) in a way that enforces airtime fairness +between active stations. This scheduling works the same way as the ath9k +in-driver airtime fairness scheduling. If no airtime usage is reported +by the driver, the scheduler will default to round-robin scheduling. + +For drivers that don't control TXQ scheduling in software, a new API +function, ieee80211_txq_may_transmit(), is added which the driver can use +to check if the TXQ is eligible for transmission, or should be throttled to +enforce fairness. Calls to this function must also be enclosed in +ieee80211_txq_schedule_{start,end}() calls to ensure proper locking. + +The API ieee80211_txq_may_transmit() also ensures that TXQ list will be +aligned aginst driver's own round-robin scheduler list. i.e it rotates +the TXQ list till it makes the requested node becomes the first entry +in TXQ list. Thus both the TXQ list and driver's list are in sync. + +Co-developed-by: Rajkumar Manoharan +Signed-off-by: Louie Lu +[added debugfs write op to reset airtime counter] +Signed-off-by: Toke Høiland-Jørgensen +Signed-off-by: Rajkumar Manoharan +Signed-off-by: Johannes Berg +--- + +--- a/include/net/mac80211.h ++++ b/include/net/mac80211.h +@@ -2304,6 +2304,9 @@ enum ieee80211_hw_flags { + * supported by HW. + * @max_nan_de_entries: maximum number of NAN DE functions supported by the + * device. ++ * ++ * @weight_multipler: Driver specific airtime weight multiplier used while ++ * refilling deficit of each TXQ. + */ + struct ieee80211_hw { + struct ieee80211_conf conf; +@@ -2339,6 +2342,7 @@ struct ieee80211_hw { + u8 n_cipher_schemes; + const struct ieee80211_cipher_scheme *cipher_schemes; + u8 max_nan_de_entries; ++ u8 weight_multiplier; + }; + + static inline bool _ieee80211_hw_check(struct ieee80211_hw *hw, +@@ -5299,6 +5303,34 @@ void ieee80211_sta_eosp(struct ieee80211 + void ieee80211_send_eosp_nullfunc(struct ieee80211_sta *pubsta, int tid); + + /** ++ * ieee80211_sta_register_airtime - register airtime usage for a sta/tid ++ * ++ * Register airtime usage for a given sta on a given tid. The driver can call ++ * this function to notify mac80211 that a station used a certain amount of ++ * airtime. This information will be used by the TXQ scheduler to schedule ++ * stations in a way that ensures airtime fairness. ++ * ++ * The reported airtime should as a minimum include all time that is spent ++ * transmitting to the remote station, including overhead and padding, but not ++ * including time spent waiting for a TXOP. If the time is not reported by the ++ * hardware it can in some cases be calculated from the rate and known frame ++ * composition. When possible, the time should include any failed transmission ++ * attempts. ++ * ++ * The driver can either call this function synchronously for every packet or ++ * aggregate, or asynchronously as airtime usage information becomes available. ++ * TX and RX airtime can be reported together, or separately by setting one of ++ * them to 0. ++ * ++ * @pubsta: the station ++ * @tid: the TID to register airtime for ++ * @tx_airtime: airtime used during TX (in usec) ++ * @rx_airtime: airtime used during RX (in usec) ++ */ ++void ieee80211_sta_register_airtime(struct ieee80211_sta *pubsta, u8 tid, ++ u32 tx_airtime, u32 rx_airtime); ++ ++/** + * ieee80211_iter_keys - iterate keys programmed into the device + * @hw: pointer obtained from ieee80211_alloc_hw() + * @vif: virtual interface to iterate, may be %NULL for all +@@ -6042,6 +6074,33 @@ void ieee80211_txq_schedule_end(struct i + __releases(txq_lock); + + /** ++ * ieee80211_txq_may_transmit - check whether TXQ is allowed to transmit ++ * ++ * This function is used to check whether given txq is allowed to transmit by ++ * the airtime scheduler, and can be used by drivers to access the airtime ++ * fairness accounting without going using the scheduling order enfored by ++ * next_txq(). ++ * ++ * Returns %true if the airtime scheduler thinks the TXQ should be allowed to ++ * transmit, and %false if it should be throttled. This function can also have ++ * the side effect of rotating the TXQ in the scheduler rotation, which will ++ * eventually bring the deficit to positive and allow the station to transmit ++ * again. ++ * ++ * The API ieee80211_txq_may_transmit() also ensures that TXQ list will be ++ * aligned aginst driver's own round-robin scheduler list. i.e it rotates ++ * the TXQ list till it makes the requested node becomes the first entry ++ * in TXQ list. Thus both the TXQ list and driver's list are in sync. If this ++ * function returns %true, the driver is expected to schedule packets ++ * for transmission, and then return the TXQ through ieee80211_return_txq(). ++ * ++ * @hw: pointer as obtained from ieee80211_alloc_hw() ++ * @txq: pointer obtained from station or virtual interface ++ */ ++bool ieee80211_txq_may_transmit(struct ieee80211_hw *hw, ++ struct ieee80211_txq *txq); ++ ++/** + * ieee80211_txq_get_depth - get pending frame/byte count of given txq + * + * The values are not guaranteed to be coherent with regard to each other, i.e. +--- a/net/mac80211/cfg.c ++++ b/net/mac80211/cfg.c +@@ -1434,6 +1434,9 @@ static int sta_apply_parameters(struct i + if (ieee80211_vif_is_mesh(&sdata->vif)) + sta_apply_mesh_params(local, sta, params); + ++ if (params->airtime_weight) ++ sta->airtime_weight = params->airtime_weight; ++ + /* set the STA state after all sta info from usermode has been set */ + if (test_sta_flag(sta, WLAN_STA_TDLS_PEER) || + set & BIT(NL80211_STA_FLAG_ASSOCIATED)) { +--- a/net/mac80211/debugfs.c ++++ b/net/mac80211/debugfs.c +@@ -380,6 +380,9 @@ void debugfs_hw_add(struct ieee80211_loc + if (local->ops->wake_tx_queue) + DEBUGFS_ADD_MODE(aqm, 0600); + ++ debugfs_create_u16("airtime_flags", 0600, ++ phyd, &local->airtime_flags); ++ + statsd = debugfs_create_dir("statistics", phyd); + + /* if the dir failed, don't put all the other things into the root! */ +--- a/net/mac80211/debugfs_sta.c ++++ b/net/mac80211/debugfs_sta.c +@@ -178,9 +178,9 @@ static ssize_t sta_aqm_read(struct file + txqi->tin.tx_bytes, + txqi->tin.tx_packets, + txqi->flags, +- txqi->flags & (1<flags & (1<flags & (1<flags) ? "STOP" : "RUN", ++ test_bit(IEEE80211_TXQ_AMPDU, &txqi->flags) ? " AMPDU" : "", ++ test_bit(IEEE80211_TXQ_NO_AMSDU, &txqi->flags) ? " NO-AMSDU" : ""); + } + + rcu_read_unlock(); +@@ -192,6 +192,64 @@ static ssize_t sta_aqm_read(struct file + } + STA_OPS(aqm); + ++static ssize_t sta_airtime_read(struct file *file, char __user *userbuf, ++ size_t count, loff_t *ppos) ++{ ++ struct sta_info *sta = file->private_data; ++ struct ieee80211_local *local = sta->sdata->local; ++ size_t bufsz = 200; ++ char *buf = kzalloc(bufsz, GFP_KERNEL), *p = buf; ++ u64 rx_airtime = 0, tx_airtime = 0; ++ s64 deficit[IEEE80211_NUM_ACS]; ++ ssize_t rv; ++ int ac; ++ ++ if (!buf) ++ return -ENOMEM; ++ ++ for (ac = 0; ac < IEEE80211_NUM_ACS; ac++) { ++ spin_lock_bh(&local->active_txq_lock[ac]); ++ rx_airtime += sta->airtime[ac].rx_airtime; ++ tx_airtime += sta->airtime[ac].tx_airtime; ++ deficit[ac] = sta->airtime[ac].deficit; ++ spin_unlock_bh(&local->active_txq_lock[ac]); ++ } ++ ++ p += scnprintf(p, bufsz + buf - p, ++ "RX: %llu us\nTX: %llu us\nWeight: %u\n" ++ "Deficit: VO: %lld us VI: %lld us BE: %lld us BK: %lld us\n", ++ rx_airtime, ++ tx_airtime, ++ sta->airtime_weight, ++ deficit[0], ++ deficit[1], ++ deficit[2], ++ deficit[3]); ++ ++ rv = simple_read_from_buffer(userbuf, count, ppos, buf, p - buf); ++ kfree(buf); ++ return rv; ++} ++ ++static ssize_t sta_airtime_write(struct file *file, const char __user *userbuf, ++ size_t count, loff_t *ppos) ++{ ++ struct sta_info *sta = file->private_data; ++ struct ieee80211_local *local = sta->sdata->local; ++ int ac; ++ ++ for (ac = 0; ac < IEEE80211_NUM_ACS; ac++) { ++ spin_lock_bh(&local->active_txq_lock[ac]); ++ sta->airtime[ac].rx_airtime = 0; ++ sta->airtime[ac].tx_airtime = 0; ++ sta->airtime[ac].deficit = sta->airtime_weight; ++ spin_unlock_bh(&local->active_txq_lock[ac]); ++ } ++ ++ return count; ++} ++STA_OPS_RW(airtime); ++ + static ssize_t sta_agg_status_read(struct file *file, char __user *userbuf, + size_t count, loff_t *ppos) + { +@@ -546,6 +604,10 @@ void ieee80211_sta_debugfs_add(struct st + if (local->ops->wake_tx_queue) + DEBUGFS_ADD(aqm); + ++ if (wiphy_ext_feature_isset(local->hw.wiphy, ++ NL80211_EXT_FEATURE_AIRTIME_FAIRNESS)) ++ DEBUGFS_ADD(airtime); ++ + if (sizeof(sta->driver_buffered_tids) == sizeof(u32)) + debugfs_create_x32("driver_buffered_tids", 0400, + sta->debugfs_dir, +--- a/net/mac80211/ieee80211_i.h ++++ b/net/mac80211/ieee80211_i.h +@@ -1136,6 +1136,8 @@ struct ieee80211_local { + struct list_head active_txqs[IEEE80211_NUM_ACS]; + u16 schedule_round[IEEE80211_NUM_ACS]; + ++ u16 airtime_flags; ++ + const struct ieee80211_ops *ops; + + /* +--- a/net/mac80211/main.c ++++ b/net/mac80211/main.c +@@ -656,6 +656,7 @@ struct ieee80211_hw *ieee80211_alloc_hw_ + INIT_LIST_HEAD(&local->active_txqs[i]); + spin_lock_init(&local->active_txq_lock[i]); + } ++ local->airtime_flags = AIRTIME_USE_TX | AIRTIME_USE_RX; + + INIT_LIST_HEAD(&local->chanctx_list); + mutex_init(&local->chanctx_mtx); +@@ -1142,6 +1143,9 @@ int ieee80211_register_hw(struct ieee802 + if (!local->hw.max_nan_de_entries) + local->hw.max_nan_de_entries = IEEE80211_MAX_NAN_INSTANCE_ID; + ++ if (!local->hw.weight_multiplier) ++ local->hw.weight_multiplier = 1; ++ + result = ieee80211_wep_init(local); + if (result < 0) + wiphy_debug(local->hw.wiphy, "Failed to initialize wep: %d\n", +--- a/net/mac80211/sta_info.c ++++ b/net/mac80211/sta_info.c +@@ -90,7 +90,6 @@ static void __cleanup_single_sta(struct + struct tid_ampdu_tx *tid_tx; + struct ieee80211_sub_if_data *sdata = sta->sdata; + struct ieee80211_local *local = sdata->local; +- struct fq *fq = &local->fq; + struct ps_data *ps; + + if (test_sta_flag(sta, WLAN_STA_PS_STA) || +@@ -115,9 +114,7 @@ static void __cleanup_single_sta(struct + for (i = 0; i < ARRAY_SIZE(sta->sta.txq); i++) { + struct txq_info *txqi = to_txq_info(sta->sta.txq[i]); + +- spin_lock_bh(&fq->lock); + ieee80211_txq_purge(local, txqi); +- spin_unlock_bh(&fq->lock); + } + } + +@@ -381,9 +378,12 @@ struct sta_info *sta_info_alloc(struct i + if (sta_prepare_rate_control(local, sta, gfp)) + goto free_txq; + ++ sta->airtime_weight = IEEE80211_DEFAULT_AIRTIME_WEIGHT; ++ + for (i = 0; i < IEEE80211_NUM_ACS; i++) { + skb_queue_head_init(&sta->ps_tx_buf[i]); + skb_queue_head_init(&sta->tx_filtered[i]); ++ sta->airtime[i].deficit = sta->airtime_weight; + } + + for (i = 0; i < IEEE80211_NUM_TIDS; i++) +@@ -1821,6 +1821,27 @@ void ieee80211_sta_set_buffered(struct i + } + EXPORT_SYMBOL(ieee80211_sta_set_buffered); + ++void ieee80211_sta_register_airtime(struct ieee80211_sta *pubsta, u8 tid, ++ u32 tx_airtime, u32 rx_airtime) ++{ ++ struct sta_info *sta = container_of(pubsta, struct sta_info, sta); ++ struct ieee80211_local *local = sta->sdata->local; ++ u8 ac = ieee80211_ac_from_tid(tid); ++ u32 airtime = 0; ++ ++ if (sta->local->airtime_flags & AIRTIME_USE_TX) ++ airtime += tx_airtime; ++ if (sta->local->airtime_flags & AIRTIME_USE_RX) ++ airtime += rx_airtime; ++ ++ spin_lock_bh(&local->active_txq_lock[ac]); ++ sta->airtime[ac].tx_airtime += tx_airtime; ++ sta->airtime[ac].rx_airtime += rx_airtime; ++ sta->airtime[ac].deficit -= airtime; ++ spin_unlock_bh(&local->active_txq_lock[ac]); ++} ++EXPORT_SYMBOL(ieee80211_sta_register_airtime); ++ + int sta_info_move_state(struct sta_info *sta, + enum ieee80211_sta_state new_state) + { +@@ -2183,6 +2204,23 @@ void sta_set_sinfo(struct sta_info *sta, + sinfo->filled |= BIT_ULL(NL80211_STA_INFO_TX_FAILED); + } + ++ if (!(sinfo->filled & BIT_ULL(NL80211_STA_INFO_RX_DURATION))) { ++ for (ac = 0; ac < IEEE80211_NUM_ACS; ac++) ++ sinfo->rx_duration += sta->airtime[ac].rx_airtime; ++ sinfo->filled |= BIT_ULL(NL80211_STA_INFO_RX_DURATION); ++ } ++ ++ if (!(sinfo->filled & BIT_ULL(NL80211_STA_INFO_TX_DURATION))) { ++ for (ac = 0; ac < IEEE80211_NUM_ACS; ac++) ++ sinfo->tx_duration += sta->airtime[ac].tx_airtime; ++ sinfo->filled |= BIT_ULL(NL80211_STA_INFO_TX_DURATION); ++ } ++ ++ if (!(sinfo->filled & BIT_ULL(NL80211_STA_INFO_AIRTIME_WEIGHT))) { ++ sinfo->airtime_weight = sta->airtime_weight; ++ sinfo->filled |= BIT_ULL(NL80211_STA_INFO_AIRTIME_WEIGHT); ++ } ++ + sinfo->rx_dropped_misc = sta->rx_stats.dropped; + if (sta->pcpu_rx_stats) { + for_each_possible_cpu(cpu) { +--- a/net/mac80211/sta_info.h ++++ b/net/mac80211/sta_info.h +@@ -127,6 +127,16 @@ enum ieee80211_agg_stop_reason { + AGG_STOP_DESTROY_STA, + }; + ++/* Debugfs flags to enable/disable use of RX/TX airtime in scheduler */ ++#define AIRTIME_USE_TX BIT(0) ++#define AIRTIME_USE_RX BIT(1) ++ ++struct airtime_info { ++ u64 rx_airtime; ++ u64 tx_airtime; ++ s64 deficit; ++}; ++ + struct sta_info; + + /** +@@ -563,6 +573,9 @@ struct sta_info { + } tx_stats; + u16 tid_seq[IEEE80211_QOS_CTL_TID_MASK + 1]; + ++ struct airtime_info airtime[IEEE80211_NUM_ACS]; ++ u16 airtime_weight; ++ + /* + * Aggregation information, locked with lock. + */ +--- a/net/mac80211/status.c ++++ b/net/mac80211/status.c +@@ -825,6 +825,12 @@ static void __ieee80211_tx_status(struct + ieee80211_sta_tx_notify(sta->sdata, (void *) skb->data, + acked, info->status.tx_time); + ++ if (info->status.tx_time && ++ wiphy_ext_feature_isset(local->hw.wiphy, ++ NL80211_EXT_FEATURE_AIRTIME_FAIRNESS)) ++ ieee80211_sta_register_airtime(&sta->sta, tid, ++ info->status.tx_time, 0); ++ + if (ieee80211_hw_check(&local->hw, REPORTS_TX_ACK_STATUS)) { + if (info->flags & IEEE80211_TX_STAT_ACK) { + if (sta->status_stats.lost_packets) +--- a/net/mac80211/tx.c ++++ b/net/mac80211/tx.c +@@ -1463,8 +1463,11 @@ void ieee80211_txq_purge(struct ieee8021 + struct fq *fq = &local->fq; + struct fq_tin *tin = &txqi->tin; + ++ spin_lock_bh(&fq->lock); + fq_tin_reset(fq, tin, fq_skb_free_func); + ieee80211_purge_tx_queue(&local->hw, &txqi->frags); ++ spin_unlock_bh(&fq->lock); ++ + spin_lock_bh(&local->active_txq_lock[txqi->txq.ac]); + list_del_init(&txqi->schedule_order); + spin_unlock_bh(&local->active_txq_lock[txqi->txq.ac]); +@@ -3611,11 +3614,28 @@ struct ieee80211_txq *ieee80211_next_txq + + lockdep_assert_held(&local->active_txq_lock[ac]); + ++ begin: + txqi = list_first_entry_or_null(&local->active_txqs[ac], + struct txq_info, + schedule_order); ++ if (!txqi) ++ return NULL; ++ ++ if (txqi->txq.sta) { ++ struct sta_info *sta = container_of(txqi->txq.sta, ++ struct sta_info, sta); ++ ++ if (sta->airtime[txqi->txq.ac].deficit < 0) { ++ sta->airtime[txqi->txq.ac].deficit += ++ sta->airtime_weight; ++ list_move_tail(&txqi->schedule_order, ++ &local->active_txqs[txqi->txq.ac]); ++ goto begin; ++ } ++ } ++ + +- if (!txqi || txqi->schedule_round == local->schedule_round[ac]) ++ if (txqi->schedule_round == local->schedule_round[ac]) + return NULL; + + list_del_init(&txqi->schedule_order); +@@ -3633,12 +3653,74 @@ void ieee80211_return_txq(struct ieee802 + lockdep_assert_held(&local->active_txq_lock[txq->ac]); + + if (list_empty(&txqi->schedule_order) && +- (!skb_queue_empty(&txqi->frags) || txqi->tin.backlog_packets)) +- list_add_tail(&txqi->schedule_order, +- &local->active_txqs[txq->ac]); ++ (!skb_queue_empty(&txqi->frags) || txqi->tin.backlog_packets)) { ++ /* If airtime accounting is active, always enqueue STAs at the ++ * head of the list to ensure that they only get moved to the ++ * back by the airtime DRR scheduler once they have a negative ++ * deficit. A station that already has a negative deficit will ++ * get immediately moved to the back of the list on the next ++ * call to ieee80211_next_txq(). ++ */ ++ if (txqi->txq.sta && ++ wiphy_ext_feature_isset(local->hw.wiphy, ++ NL80211_EXT_FEATURE_AIRTIME_FAIRNESS)) ++ list_add(&txqi->schedule_order, ++ &local->active_txqs[txq->ac]); ++ else ++ list_add_tail(&txqi->schedule_order, ++ &local->active_txqs[txq->ac]); ++ } + } + EXPORT_SYMBOL(ieee80211_return_txq); + ++bool ieee80211_txq_may_transmit(struct ieee80211_hw *hw, ++ struct ieee80211_txq *txq) ++{ ++ struct ieee80211_local *local = hw_to_local(hw); ++ struct txq_info *iter, *tmp, *txqi = to_txq_info(txq); ++ struct sta_info *sta; ++ u8 ac = txq->ac; ++ ++ lockdep_assert_held(&local->active_txq_lock[ac]); ++ ++ if (!txqi->txq.sta) ++ goto out; ++ ++ if (list_empty(&txqi->schedule_order)) ++ goto out; ++ ++ list_for_each_entry_safe(iter, tmp, &local->active_txqs[ac], ++ schedule_order) { ++ if (iter == txqi) ++ break; ++ ++ if (!iter->txq.sta) { ++ list_move_tail(&iter->schedule_order, ++ &local->active_txqs[ac]); ++ continue; ++ } ++ sta = container_of(iter->txq.sta, struct sta_info, sta); ++ if (sta->airtime[ac].deficit < 0) ++ sta->airtime[ac].deficit += sta->airtime_weight; ++ list_move_tail(&iter->schedule_order, &local->active_txqs[ac]); ++ } ++ ++ sta = container_of(txqi->txq.sta, struct sta_info, sta); ++ if (sta->airtime[ac].deficit >= 0) ++ goto out; ++ ++ sta->airtime[ac].deficit += sta->airtime_weight; ++ list_move_tail(&txqi->schedule_order, &local->active_txqs[ac]); ++ ++ return false; ++out: ++ if (!list_empty(&txqi->schedule_order)) ++ list_del_init(&txqi->schedule_order); ++ ++ return true; ++} ++EXPORT_SYMBOL(ieee80211_txq_may_transmit); ++ + void ieee80211_txq_schedule_start(struct ieee80211_hw *hw, u8 ac) + __acquires(txq_lock) + { diff --git a/package/kernel/mac80211/patches/subsys/323-mac80211-Expose-ieee80211_schedule_txq-function.patch b/package/kernel/mac80211/patches/subsys/323-mac80211-Expose-ieee80211_schedule_txq-function.patch new file mode 100644 index 0000000000..b5b06cdde9 --- /dev/null +++ b/package/kernel/mac80211/patches/subsys/323-mac80211-Expose-ieee80211_schedule_txq-function.patch @@ -0,0 +1,73 @@ +From: =?UTF-8?q?Toke=20H=C3=B8iland-J=C3=B8rgensen?= +Date: Tue, 22 Jan 2019 15:20:16 +0100 +Subject: [PATCH] mac80211: Expose ieee80211_schedule_txq() function +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Since we reworked ieee80211_return_txq() so it assumes that the caller +takes care of logging, we need another function that can be called without +holding any locks. Introduce ieee80211_schedule_txq() which serves this +purpose. + +Signed-off-by: Toke Høiland-Jørgensen +Signed-off-by: Johannes Berg +--- + +--- a/include/net/mac80211.h ++++ b/include/net/mac80211.h +@@ -6074,6 +6074,19 @@ void ieee80211_txq_schedule_end(struct i + __releases(txq_lock); + + /** ++ * ieee80211_schedule_txq - schedule a TXQ for transmission ++ * ++ * @hw: pointer as obtained from ieee80211_alloc_hw() ++ * @txq: pointer obtained from station or virtual interface ++ * ++ * Schedules a TXQ for transmission if it is not already scheduled. Takes a ++ * lock, which means it must *not* be called between ++ * ieee80211_txq_schedule_start() and ieee80211_txq_schedule_end() ++ */ ++void ieee80211_schedule_txq(struct ieee80211_hw *hw, struct ieee80211_txq *txq) ++ __acquires(txq_lock) __releases(txq_lock); ++ ++/** + * ieee80211_txq_may_transmit - check whether TXQ is allowed to transmit + * + * This function is used to check whether given txq is allowed to transmit by +--- a/net/mac80211/driver-ops.h ++++ b/net/mac80211/driver-ops.h +@@ -1179,9 +1179,7 @@ static inline void drv_wake_tx_queue(str + static inline void schedule_and_wake_txq(struct ieee80211_local *local, + struct txq_info *txqi) + { +- spin_lock_bh(&local->active_txq_lock[txqi->txq.ac]); +- ieee80211_return_txq(&local->hw, &txqi->txq); +- spin_unlock_bh(&local->active_txq_lock[txqi->txq.ac]); ++ ieee80211_schedule_txq(&local->hw, &txqi->txq); + drv_wake_tx_queue(local, txqi); + } + +--- a/net/mac80211/tx.c ++++ b/net/mac80211/tx.c +@@ -3673,6 +3673,19 @@ void ieee80211_return_txq(struct ieee802 + } + EXPORT_SYMBOL(ieee80211_return_txq); + ++void ieee80211_schedule_txq(struct ieee80211_hw *hw, ++ struct ieee80211_txq *txq) ++ __acquires(txq_lock) __releases(txq_lock) ++{ ++ struct ieee80211_local *local = hw_to_local(hw); ++ struct txq_info *txqi = to_txq_info(txq); ++ ++ spin_lock_bh(&local->active_txq_lock[txq->ac]); ++ ieee80211_return_txq(hw, txq); ++ spin_unlock_bh(&local->active_txq_lock[txq->ac]); ++} ++EXPORT_SYMBOL(ieee80211_schedule_txq); ++ + bool ieee80211_txq_may_transmit(struct ieee80211_hw *hw, + struct ieee80211_txq *txq) + { diff --git a/package/kernel/mac80211/patches/subsys/350-mac80211-add-hdrlen-to-ieee80211_tx_data.patch b/package/kernel/mac80211/patches/subsys/350-mac80211-add-hdrlen-to-ieee80211_tx_data.patch new file mode 100644 index 0000000000..7b2a4a1c09 --- /dev/null +++ b/package/kernel/mac80211/patches/subsys/350-mac80211-add-hdrlen-to-ieee80211_tx_data.patch @@ -0,0 +1,228 @@ +From: Janusz Dziedzic +Date: Fri, 19 Feb 2016 11:01:49 +0100 +Subject: [PATCH] mac80211: add hdrlen to ieee80211_tx_data + +This is preparation for adding support for inserting padding between the +802.11 header and LLC data + +Signed-off-by: Janusz Dziedzic +Signed-off-by: Felix Fietkau +--- + +--- a/net/mac80211/ieee80211_i.h ++++ b/net/mac80211/ieee80211_i.h +@@ -179,6 +179,7 @@ struct ieee80211_tx_data { + struct ieee80211_tx_rate rate; + + unsigned int flags; ++ unsigned int hdrlen; + }; + + +--- a/net/mac80211/tx.c ++++ b/net/mac80211/tx.c +@@ -925,7 +925,7 @@ ieee80211_tx_h_fragment(struct ieee80211 + struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); + struct ieee80211_hdr *hdr = (void *)skb->data; + int frag_threshold = tx->local->hw.wiphy->frag_threshold; +- int hdrlen; ++ int hdrlen = tx->hdrlen; + int fragnum; + + /* no matter what happens, tx->skb moves to tx->skbs */ +@@ -946,8 +946,6 @@ ieee80211_tx_h_fragment(struct ieee80211 + if (WARN_ON(info->flags & IEEE80211_TX_CTL_AMPDU)) + return TX_DROP; + +- hdrlen = ieee80211_hdrlen(hdr->frame_control); +- + /* internal error, why isn't DONTFRAG set? */ + if (WARN_ON(skb->len + FCS_LEN <= frag_threshold)) + return TX_DROP; +@@ -1178,6 +1176,8 @@ ieee80211_tx_prepare(struct ieee80211_su + + hdr = (struct ieee80211_hdr *) skb->data; + ++ tx->hdrlen = ieee80211_hdrlen(hdr->frame_control); ++ + if (likely(sta)) { + if (!IS_ERR(sta)) + tx->sta = sta; +@@ -3523,6 +3523,7 @@ begin: + tx.local = local; + tx.skb = skb; + tx.sdata = vif_to_sdata(info->control.vif); ++ tx.hdrlen = ieee80211_hdrlen(hdr->frame_control); + + if (txq->sta) + tx.sta = container_of(txq->sta, struct sta_info, sta); +@@ -3549,7 +3550,7 @@ begin: + + if (tx.key && + (tx.key->conf.flags & IEEE80211_KEY_FLAG_GENERATE_IV)) +- pn_offs = ieee80211_hdrlen(hdr->frame_control); ++ pn_offs = tx.hdrlen; + + ieee80211_xmit_fast_finish(sta->sdata, sta, pn_offs, + tx.key, skb); +@@ -4006,6 +4007,7 @@ ieee80211_build_data_template(struct iee + hdr = (void *)skb->data; + tx.sta = sta_info_get(sdata, hdr->addr1); + tx.skb = skb; ++ tx.hdrlen = ieee80211_hdrlen(hdr->frame_control); + + if (ieee80211_tx_h_select_key(&tx) != TX_CONTINUE) { + rcu_read_unlock(); +--- a/net/mac80211/util.c ++++ b/net/mac80211/util.c +@@ -1390,6 +1390,7 @@ void ieee80211_send_auth(struct ieee8021 + struct ieee80211_local *local = sdata->local; + struct sk_buff *skb; + struct ieee80211_mgmt *mgmt; ++ unsigned int hdrlen; + int err; + + /* 24 + 6 = header + auth_algo + auth_transaction + status_code */ +@@ -1413,8 +1414,10 @@ void ieee80211_send_auth(struct ieee8021 + skb_put_data(skb, extra, extra_len); + + if (auth_alg == WLAN_AUTH_SHARED_KEY && transaction == 3) { ++ hdrlen = ieee80211_hdrlen(mgmt->frame_control); + mgmt->frame_control |= cpu_to_le16(IEEE80211_FCTL_PROTECTED); +- err = ieee80211_wep_encrypt(local, skb, key, key_len, key_idx); ++ err = ieee80211_wep_encrypt(local, skb, hdrlen, key, ++ key_len, key_idx); + WARN_ON(err); + } + +--- a/net/mac80211/wep.c ++++ b/net/mac80211/wep.c +@@ -89,11 +89,11 @@ static void ieee80211_wep_get_iv(struct + + static u8 *ieee80211_wep_add_iv(struct ieee80211_local *local, + struct sk_buff *skb, ++ unsigned int hdrlen, + int keylen, int keyidx) + { + struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; + struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); +- unsigned int hdrlen; + u8 *newhdr; + + hdr->frame_control |= cpu_to_le16(IEEE80211_FCTL_PROTECTED); +@@ -101,7 +101,6 @@ static u8 *ieee80211_wep_add_iv(struct i + if (WARN_ON(skb_headroom(skb) < IEEE80211_WEP_IV_LEN)) + return NULL; + +- hdrlen = ieee80211_hdrlen(hdr->frame_control); + newhdr = skb_push(skb, IEEE80211_WEP_IV_LEN); + memmove(newhdr, newhdr + IEEE80211_WEP_IV_LEN, hdrlen); + +@@ -160,6 +159,7 @@ int ieee80211_wep_encrypt_data(struct cr + */ + int ieee80211_wep_encrypt(struct ieee80211_local *local, + struct sk_buff *skb, ++ unsigned int hdrlen, + const u8 *key, int keylen, int keyidx) + { + u8 *iv; +@@ -169,7 +169,7 @@ int ieee80211_wep_encrypt(struct ieee802 + if (WARN_ON(skb_tailroom(skb) < IEEE80211_WEP_ICV_LEN)) + return -1; + +- iv = ieee80211_wep_add_iv(local, skb, keylen, keyidx); ++ iv = ieee80211_wep_add_iv(local, skb, hdrlen, keylen, keyidx); + if (!iv) + return -1; + +@@ -307,13 +307,14 @@ static int wep_encrypt_skb(struct ieee80 + struct ieee80211_key_conf *hw_key = info->control.hw_key; + + if (!hw_key) { +- if (ieee80211_wep_encrypt(tx->local, skb, tx->key->conf.key, ++ if (ieee80211_wep_encrypt(tx->local, skb, tx->hdrlen, ++ tx->key->conf.key, + tx->key->conf.keylen, + tx->key->conf.keyidx)) + return -1; + } else if ((hw_key->flags & IEEE80211_KEY_FLAG_GENERATE_IV) || + (hw_key->flags & IEEE80211_KEY_FLAG_PUT_IV_SPACE)) { +- if (!ieee80211_wep_add_iv(tx->local, skb, ++ if (!ieee80211_wep_add_iv(tx->local, skb, tx->hdrlen, + tx->key->conf.keylen, + tx->key->conf.keyidx)) + return -1; +--- a/net/mac80211/wep.h ++++ b/net/mac80211/wep.h +@@ -22,6 +22,7 @@ int ieee80211_wep_encrypt_data(struct cr + size_t klen, u8 *data, size_t data_len); + int ieee80211_wep_encrypt(struct ieee80211_local *local, + struct sk_buff *skb, ++ unsigned int hdrlen, + const u8 *key, int keylen, int keyidx); + int ieee80211_wep_decrypt_data(struct crypto_cipher *tfm, u8 *rc4key, + size_t klen, u8 *data, size_t data_len); +--- a/net/mac80211/wpa.c ++++ b/net/mac80211/wpa.c +@@ -44,7 +44,7 @@ ieee80211_tx_h_michael_mic_add(struct ie + skb->len < 24 || !ieee80211_is_data_present(hdr->frame_control)) + return TX_CONTINUE; + +- hdrlen = ieee80211_hdrlen(hdr->frame_control); ++ hdrlen = tx->hdrlen; + if (skb->len < hdrlen) + return TX_DROP; + +@@ -195,7 +195,6 @@ mic_fail_no_key: + + static int tkip_encrypt_skb(struct ieee80211_tx_data *tx, struct sk_buff *skb) + { +- struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data; + struct ieee80211_key *key = tx->key; + struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); + unsigned int hdrlen; +@@ -210,7 +209,7 @@ static int tkip_encrypt_skb(struct ieee8 + return 0; + } + +- hdrlen = ieee80211_hdrlen(hdr->frame_control); ++ hdrlen = tx->hdrlen; + len = skb->len - hdrlen; + + if (info->control.hw_key) +@@ -428,7 +427,7 @@ static int ccmp_encrypt_skb(struct ieee8 + return 0; + } + +- hdrlen = ieee80211_hdrlen(hdr->frame_control); ++ hdrlen = tx->hdrlen; + len = skb->len - hdrlen; + + if (info->control.hw_key) +@@ -660,7 +659,7 @@ static int gcmp_encrypt_skb(struct ieee8 + return 0; + } + +- hdrlen = ieee80211_hdrlen(hdr->frame_control); ++ hdrlen = tx->hdrlen; + len = skb->len - hdrlen; + + if (info->control.hw_key) +@@ -800,7 +799,6 @@ static ieee80211_tx_result + ieee80211_crypto_cs_encrypt(struct ieee80211_tx_data *tx, + struct sk_buff *skb) + { +- struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; + struct ieee80211_key *key = tx->key; + struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); + int hdrlen; +@@ -816,8 +814,7 @@ ieee80211_crypto_cs_encrypt(struct ieee8 + pskb_expand_head(skb, iv_len, 0, GFP_ATOMIC))) + return TX_DROP; + +- hdrlen = ieee80211_hdrlen(hdr->frame_control); +- ++ hdrlen = tx->hdrlen; + pos = skb_push(skb, iv_len); + memmove(pos, pos + iv_len, hdrlen); + diff --git a/package/kernel/mac80211/patches/subsys/351-mac80211-add-TX_NEEDS_ALIGNED4_SKBS-hw-flag.patch b/package/kernel/mac80211/patches/subsys/351-mac80211-add-TX_NEEDS_ALIGNED4_SKBS-hw-flag.patch new file mode 100644 index 0000000000..e1e846e0df --- /dev/null +++ b/package/kernel/mac80211/patches/subsys/351-mac80211-add-TX_NEEDS_ALIGNED4_SKBS-hw-flag.patch @@ -0,0 +1,304 @@ +From: Janusz Dziedzic +Date: Sun, 10 Mar 2019 17:22:08 +0100 +Subject: [PATCH] mac80211: add TX_NEEDS_ALIGNED4_SKBS hw flag + +The driver should set this flag if the hardware requires tx skb data +(starting with the LLC header) to be aligned to 4 bytes. + +Padding is added after ieee80211_hdr, before IV/LLC. + +Before this patch, we have to do memmove(hdrlen) twice in the driver: +Once before we pass this to HW and once again in tx completion +(to fix up the skb for monitor mode). + +With this patch we can skip this memmove() and thus reduce CPU cycles in +the data path. + +Signed-off-by: Janusz Dziedzic +Signed-off-by: Felix Fietkau +--- + +--- a/include/net/mac80211.h ++++ b/include/net/mac80211.h +@@ -2140,6 +2140,9 @@ struct ieee80211_txq { + * @IEEE80211_HW_TX_STATUS_NO_AMPDU_LEN: Driver does not report accurate A-MPDU + * length in tx status information + * ++ * @IEEE80211_HW_TX_NEEDS_ALIGNED4_SKBS: Driver need aligned skbs to four-byte. ++ * Padding will be added after ieee80211_hdr, before IV/LLC. ++ * + * @NUM_IEEE80211_HW_FLAGS: number of hardware flags, used for sizing arrays + */ + enum ieee80211_hw_flags { +@@ -2186,6 +2189,7 @@ enum ieee80211_hw_flags { + IEEE80211_HW_DEAUTH_NEED_MGD_TX_PREP, + IEEE80211_HW_DOESNT_SUPPORT_QOS_NDP, + IEEE80211_HW_TX_STATUS_NO_AMPDU_LEN, ++ IEEE80211_HW_TX_NEEDS_ALIGNED4_SKBS, + + /* keep last, obviously */ + NUM_IEEE80211_HW_FLAGS +@@ -2472,6 +2476,40 @@ ieee80211_get_alt_retry_rate(const struc + void ieee80211_free_txskb(struct ieee80211_hw *hw, struct sk_buff *skb); + + /** ++ * ieee80211_hdr_padsize - get size of padding between 802.11 header and LLC ++ * @hw: the hardware ++ * @hdrlen: 802.11 header length ++ */ ++static inline unsigned int ++ieee80211_hdr_padsize(struct ieee80211_hw *hw, unsigned int hdrlen) ++{ ++ /* ++ * While hdrlen is already aligned to two-byte boundaries, ++ * simple check with & 2 will return correct padsize. ++ */ ++ if (ieee80211_hw_check(hw, TX_NEEDS_ALIGNED4_SKBS)) ++ return hdrlen & 2; ++ return 0; ++} ++ ++/** ++ * ieee80211_padded_hdrlen - get padded 802.11 header size ++ * @hw: the hardware ++ * @fc: frame control field in little-endian format ++ */ ++static inline unsigned int ++ieee80211_padded_hdrlen(struct ieee80211_hw *hw, __le16 fc) ++{ ++ unsigned int hdrlen; ++ ++ hdrlen = ieee80211_hdrlen(fc); ++ hdrlen += ieee80211_hdr_padsize(hw, hdrlen); ++ ++ return hdrlen; ++} ++ ++ ++/** + * DOC: Hardware crypto acceleration + * + * mac80211 is capable of taking advantage of many hardware +--- a/net/mac80211/iface.c ++++ b/net/mac80211/iface.c +@@ -1871,6 +1871,10 @@ int ieee80211_if_add(struct ieee80211_lo + + 8 /* rfc1042/bridge tunnel */ + - ETH_HLEN /* ethernet hard_header_len */ + + IEEE80211_ENCRYPT_HEADROOM; ++ ++ if (ieee80211_hw_check(&local->hw, TX_NEEDS_ALIGNED4_SKBS)) ++ ndev->needed_headroom += 2; /* padding */ ++ + ndev->needed_tailroom = IEEE80211_ENCRYPT_TAILROOM; + + ret = dev_alloc_name(ndev, ndev->name); +--- a/net/mac80211/mesh_pathtbl.c ++++ b/net/mac80211/mesh_pathtbl.c +@@ -105,13 +105,15 @@ void mesh_path_assign_nexthop(struct mes + static void prepare_for_gate(struct sk_buff *skb, char *dst_addr, + struct mesh_path *gate_mpath) + { ++ struct ieee80211_sub_if_data *sdata = gate_mpath->sdata; ++ struct ieee80211_hw *hw = &sdata->local->hw; + struct ieee80211_hdr *hdr; + struct ieee80211s_hdr *mshdr; + int mesh_hdrlen, hdrlen; + char *next_hop; + + hdr = (struct ieee80211_hdr *) skb->data; +- hdrlen = ieee80211_hdrlen(hdr->frame_control); ++ hdrlen = ieee80211_padded_hdrlen(hw, hdr->frame_control); + mshdr = (struct ieee80211s_hdr *) (skb->data + hdrlen); + + if (!(mshdr->flags & MESH_FLAGS_AE)) { +--- a/net/mac80211/rx.c ++++ b/net/mac80211/rx.c +@@ -2597,7 +2597,7 @@ ieee80211_rx_h_mesh_fwding(struct ieee80 + struct ieee80211_local *local = rx->local; + struct ieee80211_sub_if_data *sdata = rx->sdata; + struct ieee80211_if_mesh *ifmsh = &sdata->u.mesh; +- u16 ac, q, hdrlen; ++ u16 ac, q, hdrlen, padsize; + int tailroom = 0; + + hdr = (struct ieee80211_hdr *) skb->data; +@@ -2690,7 +2690,9 @@ ieee80211_rx_h_mesh_fwding(struct ieee80 + if (sdata->crypto_tx_tailroom_needed_cnt) + tailroom = IEEE80211_ENCRYPT_TAILROOM; + +- fwd_skb = skb_copy_expand(skb, local->tx_headroom + ++ padsize = ieee80211_hdr_padsize(&local->hw, hdrlen); ++ ++ fwd_skb = skb_copy_expand(skb, local->tx_headroom + padsize + + sdata->encrypt_headroom, + tailroom, GFP_ATOMIC); + if (!fwd_skb) +@@ -2722,6 +2724,12 @@ ieee80211_rx_h_mesh_fwding(struct ieee80 + return RX_DROP_MONITOR; + } + ++ if (padsize) { ++ skb_push(fwd_skb, padsize); ++ memmove(fwd_skb->data, skb->data + padsize, hdrlen); ++ memset(fwd_skb->data + hdrlen, 0, padsize); ++ } ++ + IEEE80211_IFSTA_MESH_CTR_INC(ifmsh, fwded_frames); + ieee80211_add_pending_skb(local, fwd_skb); + out: +--- a/net/mac80211/sta_info.h ++++ b/net/mac80211/sta_info.h +@@ -311,7 +311,7 @@ struct ieee80211_fast_tx { + u8 hdr_len; + u8 sa_offs, da_offs, pn_offs; + u8 band; +- u8 hdr[30 + 2 + IEEE80211_FAST_XMIT_MAX_IV + ++ u8 hdr[30 + 2 + 2 + IEEE80211_FAST_XMIT_MAX_IV + + sizeof(rfc1042_header)] __aligned(2); + + struct rcu_head rcu_head; +--- a/net/mac80211/status.c ++++ b/net/mac80211/status.c +@@ -515,6 +515,7 @@ static void ieee80211_report_used_skb(st + { + struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); + struct ieee80211_hdr *hdr = (void *)skb->data; ++ struct ieee80211_hw *hw = &local->hw; + bool acked = info->flags & IEEE80211_TX_STAT_ACK; + + if (dropped) +@@ -531,7 +532,7 @@ static void ieee80211_report_used_skb(st + skb->dev = NULL; + } else { + unsigned int hdr_size = +- ieee80211_hdrlen(hdr->frame_control); ++ ieee80211_padded_hdrlen(hw, hdr->frame_control); + + /* Check to see if packet is a TDLS teardown packet */ + if (ieee80211_is_data(hdr->frame_control) && +@@ -655,9 +656,22 @@ void ieee80211_tx_monitor(struct ieee802 + struct sk_buff *skb2; + struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); + struct ieee80211_sub_if_data *sdata; ++ struct ieee80211_hdr *hdr = (void *)skb->data; + struct net_device *prev_dev = NULL; ++ unsigned int hdrlen, padsize; + int rtap_len; + ++ /* Remove padding if was added */ ++ if (ieee80211_hw_check(&local->hw, TX_NEEDS_ALIGNED4_SKBS)) { ++ hdrlen = ieee80211_hdrlen(hdr->frame_control); ++ padsize = ieee80211_hdr_padsize(&local->hw, hdrlen); ++ ++ if (padsize && skb->len > hdrlen + padsize) { ++ memmove(skb->data + padsize, skb->data, hdrlen); ++ skb_pull(skb, padsize); ++ } ++ } ++ + /* send frame to monitor interfaces now */ + rtap_len = ieee80211_tx_radiotap_len(info); + if (WARN_ON_ONCE(skb_headroom(skb) < rtap_len)) { +--- a/net/mac80211/tkip.c ++++ b/net/mac80211/tkip.c +@@ -201,10 +201,12 @@ void ieee80211_get_tkip_p2k(struct ieee8 + { + struct ieee80211_key *key = (struct ieee80211_key *) + container_of(keyconf, struct ieee80211_key, conf); ++ struct ieee80211_hw *hw = &key->local->hw; + const u8 *tk = &key->conf.key[NL80211_TKIP_DATA_OFFSET_ENCR_KEY]; + struct tkip_ctx *ctx = &key->u.tkip.tx; + struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; +- const u8 *data = (u8 *)hdr + ieee80211_hdrlen(hdr->frame_control); ++ const u8 *data = (u8 *)hdr + ieee80211_padded_hdrlen(hw, ++ hdr->frame_control); + u32 iv32 = get_unaligned_le32(&data[4]); + u16 iv16 = data[2] | (data[0] << 8); + +--- a/net/mac80211/tx.c ++++ b/net/mac80211/tx.c +@@ -1175,8 +1175,7 @@ ieee80211_tx_prepare(struct ieee80211_su + info->flags &= ~IEEE80211_TX_INTFL_NEED_TXPROCESSING; + + hdr = (struct ieee80211_hdr *) skb->data; +- +- tx->hdrlen = ieee80211_hdrlen(hdr->frame_control); ++ tx->hdrlen = ieee80211_padded_hdrlen(&local->hw, hdr->frame_control); + + if (likely(sta)) { + if (!IS_ERR(sta)) +@@ -2222,7 +2221,7 @@ netdev_tx_t ieee80211_monitor_start_xmit + goto fail; + + hdr = (struct ieee80211_hdr *)(skb->data + len_rthdr); +- hdrlen = ieee80211_hdrlen(hdr->frame_control); ++ hdrlen = ieee80211_padded_hdrlen(&local->hw, hdr->frame_control); + + if (skb->len < len_rthdr + hdrlen) + goto fail; +@@ -2440,7 +2439,7 @@ static struct sk_buff *ieee80211_build_h + struct ieee80211_chanctx_conf *chanctx_conf; + struct ieee80211_sub_if_data *ap_sdata; + enum nl80211_band band; +- int ret; ++ int padsize, ret; + + if (IS_ERR(sta)) + sta = NULL; +@@ -2739,7 +2738,9 @@ static struct sk_buff *ieee80211_build_h + } + + skb_pull(skb, skip_header_bytes); ++ padsize = ieee80211_hdr_padsize(&local->hw, hdrlen); + head_need = hdrlen + encaps_len + meshhdrlen - skb_headroom(skb); ++ head_need += padsize; + + /* + * So we need to modify the skb header and hence need a copy of +@@ -2772,6 +2773,9 @@ static struct sk_buff *ieee80211_build_h + memcpy(skb_push(skb, meshhdrlen), &mesh_hdr, meshhdrlen); + #endif + ++ if (padsize) ++ memset(skb_push(skb, padsize), 0, padsize); ++ + if (ieee80211_is_data_qos(fc)) { + __le16 *qos_control; + +@@ -2947,6 +2951,8 @@ void ieee80211_check_fast_xmit(struct st + fc |= cpu_to_le16(IEEE80211_STYPE_QOS_DATA); + } + ++ build.hdr_len += ieee80211_hdr_padsize(&local->hw, build.hdr_len); ++ + /* We store the key here so there's no point in using rcu_dereference() + * but that's fine because the code that changes the pointers will call + * this function after doing so. For a single CPU that would be enough, +@@ -3523,7 +3529,7 @@ begin: + tx.local = local; + tx.skb = skb; + tx.sdata = vif_to_sdata(info->control.vif); +- tx.hdrlen = ieee80211_hdrlen(hdr->frame_control); ++ tx.hdrlen = ieee80211_padded_hdrlen(hw, hdr->frame_control); + + if (txq->sta) + tx.sta = container_of(txq->sta, struct sta_info, sta); +@@ -4007,7 +4013,7 @@ ieee80211_build_data_template(struct iee + hdr = (void *)skb->data; + tx.sta = sta_info_get(sdata, hdr->addr1); + tx.skb = skb; +- tx.hdrlen = ieee80211_hdrlen(hdr->frame_control); ++ tx.hdrlen = ieee80211_padded_hdrlen(&tx.local->hw, hdr->frame_control); + + if (ieee80211_tx_h_select_key(&tx) != TX_CONTINUE) { + rcu_read_unlock(); +--- a/net/mac80211/debugfs.c ++++ b/net/mac80211/debugfs.c +@@ -215,6 +215,7 @@ static const char *hw_flag_names[] = { + FLAG(DEAUTH_NEED_MGD_TX_PREP), + FLAG(DOESNT_SUPPORT_QOS_NDP), + FLAG(TX_STATUS_NO_AMPDU_LEN), ++ FLAG(TX_NEEDS_ALIGNED4_SKBS), + #undef FLAG + }; + diff --git a/package/kernel/mac80211/patches/subsys/352-mac80211-rework-locking-for-txq-scheduling-airtime-f.patch b/package/kernel/mac80211/patches/subsys/352-mac80211-rework-locking-for-txq-scheduling-airtime-f.patch new file mode 100644 index 0000000000..0404afe7d2 --- /dev/null +++ b/package/kernel/mac80211/patches/subsys/352-mac80211-rework-locking-for-txq-scheduling-airtime-f.patch @@ -0,0 +1,214 @@ +From: Felix Fietkau +Date: Wed, 13 Mar 2019 19:09:22 +0100 +Subject: [PATCH] mac80211: rework locking for txq scheduling / airtime + fairness + +Holding the lock around the entire duration of tx scheduling can create +some nasty lock contention, especially when processing airtime information +from the tx status or the rx path. +Improve locking by only holding the active_txq_lock for lookups / scheduling +list modifications. + +Signed-off-by: Felix Fietkau +--- + +--- a/include/net/mac80211.h ++++ b/include/net/mac80211.h +@@ -6069,8 +6069,6 @@ struct sk_buff *ieee80211_tx_dequeue(str + * @hw: pointer as obtained from ieee80211_alloc_hw() + * @ac: AC number to return packets from. + * +- * Should only be called between calls to ieee80211_txq_schedule_start() +- * and ieee80211_txq_schedule_end(). + * Returns the next txq if successful, %NULL if no queue is eligible. If a txq + * is returned, it should be returned with ieee80211_return_txq() after the + * driver has finished scheduling it. +@@ -6078,51 +6076,41 @@ struct sk_buff *ieee80211_tx_dequeue(str + struct ieee80211_txq *ieee80211_next_txq(struct ieee80211_hw *hw, u8 ac); + + /** +- * ieee80211_return_txq - return a TXQ previously acquired by ieee80211_next_txq() +- * +- * @hw: pointer as obtained from ieee80211_alloc_hw() +- * @txq: pointer obtained from station or virtual interface +- * +- * Should only be called between calls to ieee80211_txq_schedule_start() +- * and ieee80211_txq_schedule_end(). +- */ +-void ieee80211_return_txq(struct ieee80211_hw *hw, struct ieee80211_txq *txq); +- +-/** +- * ieee80211_txq_schedule_start - acquire locks for safe scheduling of an AC ++ * ieee80211_txq_schedule_start - start new scheduling round for TXQs + * + * @hw: pointer as obtained from ieee80211_alloc_hw() + * @ac: AC number to acquire locks for + * +- * Acquire locks needed to schedule TXQs from the given AC. Should be called +- * before ieee80211_next_txq() or ieee80211_return_txq(). ++ * Should be called before ieee80211_next_txq() or ieee80211_return_txq(). + */ +-void ieee80211_txq_schedule_start(struct ieee80211_hw *hw, u8 ac) +- __acquires(txq_lock); ++void ieee80211_txq_schedule_start(struct ieee80211_hw *hw, u8 ac); ++ ++/* (deprecated) */ ++static inline void ieee80211_txq_schedule_end(struct ieee80211_hw *hw, u8 ac) ++{ ++} + + /** +- * ieee80211_txq_schedule_end - release locks for safe scheduling of an AC ++ * ieee80211_schedule_txq - schedule a TXQ for transmission + * + * @hw: pointer as obtained from ieee80211_alloc_hw() +- * @ac: AC number to acquire locks for ++ * @txq: pointer obtained from station or virtual interface + * +- * Release locks previously acquired by ieee80211_txq_schedule_end(). ++ * Schedules a TXQ for transmission if it is not already scheduled. + */ +-void ieee80211_txq_schedule_end(struct ieee80211_hw *hw, u8 ac) +- __releases(txq_lock); ++void ieee80211_schedule_txq(struct ieee80211_hw *hw, struct ieee80211_txq *txq); + + /** +- * ieee80211_schedule_txq - schedule a TXQ for transmission ++ * ieee80211_return_txq - return a TXQ previously acquired by ieee80211_next_txq() + * + * @hw: pointer as obtained from ieee80211_alloc_hw() + * @txq: pointer obtained from station or virtual interface +- * +- * Schedules a TXQ for transmission if it is not already scheduled. Takes a +- * lock, which means it must *not* be called between +- * ieee80211_txq_schedule_start() and ieee80211_txq_schedule_end() + */ +-void ieee80211_schedule_txq(struct ieee80211_hw *hw, struct ieee80211_txq *txq) +- __acquires(txq_lock) __releases(txq_lock); ++static inline void ++ieee80211_return_txq(struct ieee80211_hw *hw, struct ieee80211_txq *txq) ++{ ++ ieee80211_schedule_txq(hw, txq); ++} + + /** + * ieee80211_txq_may_transmit - check whether TXQ is allowed to transmit +--- a/net/mac80211/tx.c ++++ b/net/mac80211/tx.c +@@ -3617,16 +3617,17 @@ EXPORT_SYMBOL(ieee80211_tx_dequeue); + struct ieee80211_txq *ieee80211_next_txq(struct ieee80211_hw *hw, u8 ac) + { + struct ieee80211_local *local = hw_to_local(hw); ++ struct ieee80211_txq *ret = NULL; + struct txq_info *txqi = NULL; + +- lockdep_assert_held(&local->active_txq_lock[ac]); ++ spin_lock_bh(&local->active_txq_lock[ac]); + + begin: + txqi = list_first_entry_or_null(&local->active_txqs[ac], + struct txq_info, + schedule_order); + if (!txqi) +- return NULL; ++ goto out; + + if (txqi->txq.sta) { + struct sta_info *sta = container_of(txqi->txq.sta, +@@ -3643,21 +3644,25 @@ struct ieee80211_txq *ieee80211_next_txq + + + if (txqi->schedule_round == local->schedule_round[ac]) +- return NULL; ++ goto out; + + list_del_init(&txqi->schedule_order); + txqi->schedule_round = local->schedule_round[ac]; +- return &txqi->txq; ++ ret = &txqi->txq; ++ ++out: ++ spin_unlock_bh(&local->active_txq_lock[ac]); ++ return ret; + } + EXPORT_SYMBOL(ieee80211_next_txq); + +-void ieee80211_return_txq(struct ieee80211_hw *hw, +- struct ieee80211_txq *txq) ++void ieee80211_schedule_txq(struct ieee80211_hw *hw, ++ struct ieee80211_txq *txq) + { + struct ieee80211_local *local = hw_to_local(hw); + struct txq_info *txqi = to_txq_info(txq); + +- lockdep_assert_held(&local->active_txq_lock[txq->ac]); ++ spin_lock_bh(&local->active_txq_lock[txq->ac]); + + if (list_empty(&txqi->schedule_order) && + (!skb_queue_empty(&txqi->frags) || txqi->tin.backlog_packets)) { +@@ -3677,18 +3682,7 @@ void ieee80211_return_txq(struct ieee802 + list_add_tail(&txqi->schedule_order, + &local->active_txqs[txq->ac]); + } +-} +-EXPORT_SYMBOL(ieee80211_return_txq); + +-void ieee80211_schedule_txq(struct ieee80211_hw *hw, +- struct ieee80211_txq *txq) +- __acquires(txq_lock) __releases(txq_lock) +-{ +- struct ieee80211_local *local = hw_to_local(hw); +- struct txq_info *txqi = to_txq_info(txq); +- +- spin_lock_bh(&local->active_txq_lock[txq->ac]); +- ieee80211_return_txq(hw, txq); + spin_unlock_bh(&local->active_txq_lock[txq->ac]); + } + EXPORT_SYMBOL(ieee80211_schedule_txq); +@@ -3701,7 +3695,7 @@ bool ieee80211_txq_may_transmit(struct i + struct sta_info *sta; + u8 ac = txq->ac; + +- lockdep_assert_held(&local->active_txq_lock[ac]); ++ spin_lock_bh(&local->active_txq_lock[ac]); + + if (!txqi->txq.sta) + goto out; +@@ -3731,34 +3725,27 @@ bool ieee80211_txq_may_transmit(struct i + + sta->airtime[ac].deficit += sta->airtime_weight; + list_move_tail(&txqi->schedule_order, &local->active_txqs[ac]); ++ spin_unlock_bh(&local->active_txq_lock[ac]); + + return false; + out: + if (!list_empty(&txqi->schedule_order)) + list_del_init(&txqi->schedule_order); ++ spin_unlock_bh(&local->active_txq_lock[ac]); + + return true; + } + EXPORT_SYMBOL(ieee80211_txq_may_transmit); + + void ieee80211_txq_schedule_start(struct ieee80211_hw *hw, u8 ac) +- __acquires(txq_lock) + { + struct ieee80211_local *local = hw_to_local(hw); + + spin_lock_bh(&local->active_txq_lock[ac]); + local->schedule_round[ac]++; +-} +-EXPORT_SYMBOL(ieee80211_txq_schedule_start); +- +-void ieee80211_txq_schedule_end(struct ieee80211_hw *hw, u8 ac) +- __releases(txq_lock) +-{ +- struct ieee80211_local *local = hw_to_local(hw); +- + spin_unlock_bh(&local->active_txq_lock[ac]); + } +-EXPORT_SYMBOL(ieee80211_txq_schedule_end); ++EXPORT_SYMBOL(ieee80211_txq_schedule_start); + + void __ieee80211_subif_start_xmit(struct sk_buff *skb, + struct net_device *dev, diff --git a/package/kernel/mac80211/patches/subsys/353-mac80211-mesh-drop-redundant-rcu_read_lock-unlock-ca.patch b/package/kernel/mac80211/patches/subsys/353-mac80211-mesh-drop-redundant-rcu_read_lock-unlock-ca.patch new file mode 100644 index 0000000000..86300be4ed --- /dev/null +++ b/package/kernel/mac80211/patches/subsys/353-mac80211-mesh-drop-redundant-rcu_read_lock-unlock-ca.patch @@ -0,0 +1,96 @@ +From: Felix Fietkau +Date: Sat, 16 Mar 2019 17:43:58 +0100 +Subject: [PATCH] mac80211: mesh: drop redundant rcu_read_lock/unlock calls + +The callers of these functions are all within RCU locked sections + +Signed-off-by: Felix Fietkau +--- + +--- a/net/mac80211/mesh_hwmp.c ++++ b/net/mac80211/mesh_hwmp.c +@@ -1112,16 +1112,13 @@ int mesh_nexthop_resolve(struct ieee8021 + struct mesh_path *mpath; + struct sk_buff *skb_to_free = NULL; + u8 *target_addr = hdr->addr3; +- int err = 0; + + /* Nulls are only sent to peers for PS and should be pre-addressed */ + if (ieee80211_is_qos_nullfunc(hdr->frame_control)) + return 0; + +- rcu_read_lock(); +- err = mesh_nexthop_lookup(sdata, skb); +- if (!err) +- goto endlookup; ++ if (!mesh_nexthop_lookup(sdata, skb)) ++ return 0; + + /* no nexthop found, start resolving */ + mpath = mesh_path_lookup(sdata, target_addr); +@@ -1129,8 +1126,7 @@ int mesh_nexthop_resolve(struct ieee8021 + mpath = mesh_path_add(sdata, target_addr); + if (IS_ERR(mpath)) { + mesh_path_discard_frame(sdata, skb); +- err = PTR_ERR(mpath); +- goto endlookup; ++ return PTR_ERR(mpath); + } + } + +@@ -1143,13 +1139,10 @@ int mesh_nexthop_resolve(struct ieee8021 + info->flags |= IEEE80211_TX_INTFL_NEED_TXPROCESSING; + ieee80211_set_qos_hdr(sdata, skb); + skb_queue_tail(&mpath->frame_queue, skb); +- err = -ENOENT; + if (skb_to_free) + mesh_path_discard_frame(sdata, skb_to_free); + +-endlookup: +- rcu_read_unlock(); +- return err; ++ return -ENOENT; + } + + /** +@@ -1169,13 +1162,10 @@ int mesh_nexthop_lookup(struct ieee80211 + struct sta_info *next_hop; + struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data; + u8 *target_addr = hdr->addr3; +- int err = -ENOENT; + +- rcu_read_lock(); + mpath = mesh_path_lookup(sdata, target_addr); +- + if (!mpath || !(mpath->flags & MESH_PATH_ACTIVE)) +- goto endlookup; ++ return -ENOENT; + + if (time_after(jiffies, + mpath->exp_time - +@@ -1190,12 +1180,10 @@ int mesh_nexthop_lookup(struct ieee80211 + memcpy(hdr->addr1, next_hop->sta.addr, ETH_ALEN); + memcpy(hdr->addr2, sdata->vif.addr, ETH_ALEN); + ieee80211_mps_set_frame_flags(sdata, next_hop, hdr); +- err = 0; ++ return 0; + } + +-endlookup: +- rcu_read_unlock(); +- return err; ++ return -ENOENT; + } + + void mesh_path_timer(struct timer_list *t) +--- a/net/mac80211/mesh_pathtbl.c ++++ b/net/mac80211/mesh_pathtbl.c +@@ -219,7 +219,7 @@ static struct mesh_path *mpath_lookup(st + { + struct mesh_path *mpath; + +- mpath = rhashtable_lookup_fast(&tbl->rhead, dst, mesh_rht_params); ++ mpath = rhashtable_lookup(&tbl->rhead, dst, mesh_rht_params); + + if (mpath && mpath_expired(mpath)) { + spin_lock_bh(&mpath->state_lock); diff --git a/package/kernel/mac80211/patches/subsys/354-mac80211-calculate-hash-for-fq-without-holding-fq-lo.patch b/package/kernel/mac80211/patches/subsys/354-mac80211-calculate-hash-for-fq-without-holding-fq-lo.patch new file mode 100644 index 0000000000..3084a4ba32 --- /dev/null +++ b/package/kernel/mac80211/patches/subsys/354-mac80211-calculate-hash-for-fq-without-holding-fq-lo.patch @@ -0,0 +1,124 @@ +From: Felix Fietkau +Date: Sat, 16 Mar 2019 17:57:38 +0100 +Subject: [PATCH] mac80211: calculate hash for fq without holding fq->lock + in itxq enqueue + +Reduces lock contention on enqueue/dequeue of iTXQ packets + +Signed-off-by: Felix Fietkau +--- + +--- a/include/net/fq_impl.h ++++ b/include/net/fq_impl.h +@@ -107,21 +107,23 @@ begin: + return skb; + } + ++static u32 fq_flow_idx(struct fq *fq, struct sk_buff *skb) ++{ ++ u32 hash = skb_get_hash_perturb(skb, fq->perturbation); ++ ++ return reciprocal_scale(hash, fq->flows_cnt); ++} ++ + static struct fq_flow *fq_flow_classify(struct fq *fq, +- struct fq_tin *tin, ++ struct fq_tin *tin, u32 idx, + struct sk_buff *skb, + fq_flow_get_default_t get_default_func) + { + struct fq_flow *flow; +- u32 hash; +- u32 idx; + + lockdep_assert_held(&fq->lock); + +- hash = skb_get_hash_perturb(skb, fq->perturbation); +- idx = reciprocal_scale(hash, fq->flows_cnt); + flow = &fq->flows[idx]; +- + if (flow->tin && flow->tin != tin) { + flow = get_default_func(fq, tin, idx, skb); + tin->collisions++; +@@ -153,7 +155,7 @@ static void fq_recalc_backlog(struct fq + } + + static void fq_tin_enqueue(struct fq *fq, +- struct fq_tin *tin, ++ struct fq_tin *tin, u32 idx, + struct sk_buff *skb, + fq_skb_free_t free_func, + fq_flow_get_default_t get_default_func) +@@ -163,7 +165,7 @@ static void fq_tin_enqueue(struct fq *fq + + lockdep_assert_held(&fq->lock); + +- flow = fq_flow_classify(fq, tin, skb, get_default_func); ++ flow = fq_flow_classify(fq, tin, idx, skb, get_default_func); + + flow->tin = tin; + flow->backlog += skb->len; +--- a/net/mac80211/tx.c ++++ b/net/mac80211/tx.c +@@ -1390,11 +1390,15 @@ static void ieee80211_txq_enqueue(struct + { + struct fq *fq = &local->fq; + struct fq_tin *tin = &txqi->tin; ++ u32 flow_idx = fq_flow_idx(fq, skb); + + ieee80211_set_skb_enqueue_time(skb); +- fq_tin_enqueue(fq, tin, skb, ++ ++ spin_lock_bh(&fq->lock); ++ fq_tin_enqueue(fq, tin, flow_idx, skb, + fq_skb_free_func, + fq_flow_get_default_func); ++ spin_unlock_bh(&fq->lock); + } + + static bool fq_vlan_filter_func(struct fq *fq, struct fq_tin *tin, +@@ -1564,7 +1568,6 @@ static bool ieee80211_queue_skb(struct i + struct sta_info *sta, + struct sk_buff *skb) + { +- struct fq *fq = &local->fq; + struct ieee80211_vif *vif; + struct txq_info *txqi; + +@@ -1582,9 +1585,7 @@ static bool ieee80211_queue_skb(struct i + if (!txqi) + return false; + +- spin_lock_bh(&fq->lock); + ieee80211_txq_enqueue(local, txqi, skb); +- spin_unlock_bh(&fq->lock); + + schedule_and_wake_txq(local, txqi); + +@@ -3198,6 +3199,7 @@ static bool ieee80211_amsdu_aggregate(st + u8 max_subframes = sta->sta.max_amsdu_subframes; + int max_frags = local->hw.max_tx_fragments; + int max_amsdu_len = sta->sta.max_amsdu_len; ++ u32 flow_idx; + int orig_truesize; + __be16 len; + void *data; +@@ -3220,6 +3222,8 @@ static bool ieee80211_amsdu_aggregate(st + max_amsdu_len = min_t(int, max_amsdu_len, + sta->sta.max_rc_amsdu_len); + ++ flow_idx = fq_flow_idx(fq, skb); ++ + spin_lock_bh(&fq->lock); + + /* TODO: Ideally aggregation should be done on dequeue to remain +@@ -3227,7 +3231,8 @@ static bool ieee80211_amsdu_aggregate(st + */ + + tin = &txqi->tin; +- flow = fq_flow_classify(fq, tin, skb, fq_flow_get_default_func); ++ flow = fq_flow_classify(fq, tin, flow_idx, skb, ++ fq_flow_get_default_func); + head = skb_peek_tail(&flow->queue); + if (!head) + goto out; diff --git a/package/kernel/mac80211/patches/subsys/355-mac80211-run-late-dequeue-late-tx-handlers-without-h.patch b/package/kernel/mac80211/patches/subsys/355-mac80211-run-late-dequeue-late-tx-handlers-without-h.patch new file mode 100644 index 0000000000..ba25458816 --- /dev/null +++ b/package/kernel/mac80211/patches/subsys/355-mac80211-run-late-dequeue-late-tx-handlers-without-h.patch @@ -0,0 +1,55 @@ +From: Felix Fietkau +Date: Sat, 16 Mar 2019 18:00:12 +0100 +Subject: [PATCH] mac80211: run late dequeue late tx handlers without + holding fq->lock + +Reduces lock contention on enqueue/dequeue of iTXQ packets + +Signed-off-by: Felix Fietkau +--- + +--- a/net/mac80211/tx.c ++++ b/net/mac80211/tx.c +@@ -3505,6 +3505,7 @@ struct sk_buff *ieee80211_tx_dequeue(str + ieee80211_tx_result r; + struct ieee80211_vif *vif = txq->vif; + ++begin: + spin_lock_bh(&fq->lock); + + if (test_bit(IEEE80211_TXQ_STOP, &txqi->flags) || +@@ -3521,11 +3522,12 @@ struct sk_buff *ieee80211_tx_dequeue(str + if (skb) + goto out; + +-begin: + skb = fq_tin_dequeue(fq, tin, fq_tin_dequeue_func); + if (!skb) + goto out; + ++ spin_unlock_bh(&fq->lock); ++ + hdr = (struct ieee80211_hdr *)skb->data; + info = IEEE80211_SKB_CB(skb); + +@@ -3571,8 +3573,11 @@ begin: + + skb = __skb_dequeue(&tx.skbs); + +- if (!skb_queue_empty(&tx.skbs)) ++ if (!skb_queue_empty(&tx.skbs)) { ++ spin_lock_bh(&fq->lock); + skb_queue_splice_tail(&tx.skbs, &txqi->frags); ++ spin_unlock_bh(&fq->lock); ++ } + } + + if (skb && skb_has_frag_list(skb) && +@@ -3611,6 +3616,7 @@ begin: + } + + IEEE80211_SKB_CB(skb)->control.vif = vif; ++ return skb; + + out: + spin_unlock_bh(&fq->lock); diff --git a/package/kernel/mac80211/patches/subsys/356-mac80211-set-NETIF_F_LLTX-when-using-intermediate-tx.patch b/package/kernel/mac80211/patches/subsys/356-mac80211-set-NETIF_F_LLTX-when-using-intermediate-tx.patch new file mode 100644 index 0000000000..95ab3ab9fb --- /dev/null +++ b/package/kernel/mac80211/patches/subsys/356-mac80211-set-NETIF_F_LLTX-when-using-intermediate-tx.patch @@ -0,0 +1,22 @@ +From: Felix Fietkau +Date: Sat, 16 Mar 2019 18:01:53 +0100 +Subject: [PATCH] mac80211: set NETIF_F_LLTX when using intermediate tx + queues + +When using iTXQ, tx sequence number allocation and statistics are run at +dequeue time. Because of that, it is safe to enable NETIF_F_LLTX, which +allows tx handlers to run on multiple CPUs in parallel. + +Signed-off-by: Felix Fietkau +--- + +--- a/net/mac80211/iface.c ++++ b/net/mac80211/iface.c +@@ -1301,6 +1301,7 @@ static void ieee80211_if_setup(struct ne + static void ieee80211_if_setup_no_queue(struct net_device *dev) + { + ieee80211_if_setup(dev); ++ dev->features |= NETIF_F_LLTX; + #if LINUX_VERSION_IS_GEQ(4,3,0) + dev->priv_flags |= IFF_NO_QUEUE; + #else diff --git a/package/kernel/mac80211/patches/subsys/357-mac80211-add-hdrlen-to-ieee80211_tx_data.patch b/package/kernel/mac80211/patches/subsys/357-mac80211-add-hdrlen-to-ieee80211_tx_data.patch deleted file mode 100644 index 2914461b41..0000000000 --- a/package/kernel/mac80211/patches/subsys/357-mac80211-add-hdrlen-to-ieee80211_tx_data.patch +++ /dev/null @@ -1,219 +0,0 @@ -From: Janusz Dziedzic -Date: Fri, 19 Feb 2016 11:01:49 +0100 -Subject: [PATCH] mac80211: add hdrlen to ieee80211_tx_data - -Add hdrlen to ieee80211_tx_data and use this -when wep/ccmd/tkip. This is preparation for -aligned4 code. - -Signed-off-by: Janusz Dziedzic ---- - ---- a/net/mac80211/ieee80211_i.h -+++ b/net/mac80211/ieee80211_i.h -@@ -179,6 +179,7 @@ struct ieee80211_tx_data { - struct ieee80211_tx_rate rate; - - unsigned int flags; -+ unsigned int hdrlen; - }; - - ---- a/net/mac80211/tx.c -+++ b/net/mac80211/tx.c -@@ -925,7 +925,7 @@ ieee80211_tx_h_fragment(struct ieee80211 - struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); - struct ieee80211_hdr *hdr = (void *)skb->data; - int frag_threshold = tx->local->hw.wiphy->frag_threshold; -- int hdrlen; -+ int hdrlen = tx->hdrlen; - int fragnum; - - /* no matter what happens, tx->skb moves to tx->skbs */ -@@ -946,8 +946,6 @@ ieee80211_tx_h_fragment(struct ieee80211 - if (WARN_ON(info->flags & IEEE80211_TX_CTL_AMPDU)) - return TX_DROP; - -- hdrlen = ieee80211_hdrlen(hdr->frame_control); -- - /* internal error, why isn't DONTFRAG set? */ - if (WARN_ON(skb->len + FCS_LEN <= frag_threshold)) - return TX_DROP; -@@ -1178,6 +1176,8 @@ ieee80211_tx_prepare(struct ieee80211_su - - hdr = (struct ieee80211_hdr *) skb->data; - -+ tx->hdrlen = ieee80211_hdrlen(hdr->frame_control); -+ - if (likely(sta)) { - if (!IS_ERR(sta)) - tx->sta = sta; -@@ -3513,6 +3513,7 @@ begin: - tx.local = local; - tx.skb = skb; - tx.sdata = vif_to_sdata(info->control.vif); -+ tx.hdrlen = ieee80211_padded_hdrlen(hw, hdr->frame_control); - - if (txq->sta) - tx.sta = container_of(txq->sta, struct sta_info, sta); -@@ -3850,6 +3851,7 @@ ieee80211_build_data_template(struct iee - hdr = (void *)skb->data; - tx.sta = sta_info_get(sdata, hdr->addr1); - tx.skb = skb; -+ tx.hdrlen = ieee80211_padded_hdrlen(&tx.local->hw, hdr->frame_control); - - if (ieee80211_tx_h_select_key(&tx) != TX_CONTINUE) { - rcu_read_unlock(); ---- a/net/mac80211/util.c -+++ b/net/mac80211/util.c -@@ -1390,6 +1390,7 @@ void ieee80211_send_auth(struct ieee8021 - struct ieee80211_local *local = sdata->local; - struct sk_buff *skb; - struct ieee80211_mgmt *mgmt; -+ unsigned int hdrlen; - int err; - - /* 24 + 6 = header + auth_algo + auth_transaction + status_code */ -@@ -1413,8 +1414,10 @@ void ieee80211_send_auth(struct ieee8021 - skb_put_data(skb, extra, extra_len); - - if (auth_alg == WLAN_AUTH_SHARED_KEY && transaction == 3) { -+ hdrlen = ieee80211_hdrlen(mgmt->frame_control); - mgmt->frame_control |= cpu_to_le16(IEEE80211_FCTL_PROTECTED); -- err = ieee80211_wep_encrypt(local, skb, key, key_len, key_idx); -+ err = ieee80211_wep_encrypt(local, skb, hdrlen, key, -+ key_len, key_idx); - WARN_ON(err); - } - ---- a/net/mac80211/wep.c -+++ b/net/mac80211/wep.c -@@ -89,11 +89,11 @@ static void ieee80211_wep_get_iv(struct - - static u8 *ieee80211_wep_add_iv(struct ieee80211_local *local, - struct sk_buff *skb, -+ unsigned int hdrlen, - int keylen, int keyidx) - { - struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; - struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); -- unsigned int hdrlen; - u8 *newhdr; - - hdr->frame_control |= cpu_to_le16(IEEE80211_FCTL_PROTECTED); -@@ -101,7 +101,6 @@ static u8 *ieee80211_wep_add_iv(struct i - if (WARN_ON(skb_headroom(skb) < IEEE80211_WEP_IV_LEN)) - return NULL; - -- hdrlen = ieee80211_hdrlen(hdr->frame_control); - newhdr = skb_push(skb, IEEE80211_WEP_IV_LEN); - memmove(newhdr, newhdr + IEEE80211_WEP_IV_LEN, hdrlen); - -@@ -160,6 +159,7 @@ int ieee80211_wep_encrypt_data(struct cr - */ - int ieee80211_wep_encrypt(struct ieee80211_local *local, - struct sk_buff *skb, -+ unsigned int hdrlen, - const u8 *key, int keylen, int keyidx) - { - u8 *iv; -@@ -169,7 +169,7 @@ int ieee80211_wep_encrypt(struct ieee802 - if (WARN_ON(skb_tailroom(skb) < IEEE80211_WEP_ICV_LEN)) - return -1; - -- iv = ieee80211_wep_add_iv(local, skb, keylen, keyidx); -+ iv = ieee80211_wep_add_iv(local, skb, hdrlen, keylen, keyidx); - if (!iv) - return -1; - -@@ -307,13 +307,14 @@ static int wep_encrypt_skb(struct ieee80 - struct ieee80211_key_conf *hw_key = info->control.hw_key; - - if (!hw_key) { -- if (ieee80211_wep_encrypt(tx->local, skb, tx->key->conf.key, -+ if (ieee80211_wep_encrypt(tx->local, skb, tx->hdrlen, -+ tx->key->conf.key, - tx->key->conf.keylen, - tx->key->conf.keyidx)) - return -1; - } else if ((hw_key->flags & IEEE80211_KEY_FLAG_GENERATE_IV) || - (hw_key->flags & IEEE80211_KEY_FLAG_PUT_IV_SPACE)) { -- if (!ieee80211_wep_add_iv(tx->local, skb, -+ if (!ieee80211_wep_add_iv(tx->local, skb, tx->hdrlen, - tx->key->conf.keylen, - tx->key->conf.keyidx)) - return -1; ---- a/net/mac80211/wep.h -+++ b/net/mac80211/wep.h -@@ -22,6 +22,7 @@ int ieee80211_wep_encrypt_data(struct cr - size_t klen, u8 *data, size_t data_len); - int ieee80211_wep_encrypt(struct ieee80211_local *local, - struct sk_buff *skb, -+ unsigned int hdrlen, - const u8 *key, int keylen, int keyidx); - int ieee80211_wep_decrypt_data(struct crypto_cipher *tfm, u8 *rc4key, - size_t klen, u8 *data, size_t data_len); ---- a/net/mac80211/wpa.c -+++ b/net/mac80211/wpa.c -@@ -44,7 +44,7 @@ ieee80211_tx_h_michael_mic_add(struct ie - skb->len < 24 || !ieee80211_is_data_present(hdr->frame_control)) - return TX_CONTINUE; - -- hdrlen = ieee80211_hdrlen(hdr->frame_control); -+ hdrlen = tx->hdrlen; - if (skb->len < hdrlen) - return TX_DROP; - -@@ -195,7 +195,6 @@ mic_fail_no_key: - - static int tkip_encrypt_skb(struct ieee80211_tx_data *tx, struct sk_buff *skb) - { -- struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data; - struct ieee80211_key *key = tx->key; - struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); - unsigned int hdrlen; -@@ -210,7 +209,7 @@ static int tkip_encrypt_skb(struct ieee8 - return 0; - } - -- hdrlen = ieee80211_hdrlen(hdr->frame_control); -+ hdrlen = tx->hdrlen; - len = skb->len - hdrlen; - - if (info->control.hw_key) -@@ -428,7 +427,7 @@ static int ccmp_encrypt_skb(struct ieee8 - return 0; - } - -- hdrlen = ieee80211_hdrlen(hdr->frame_control); -+ hdrlen = tx->hdrlen; - len = skb->len - hdrlen; - - if (info->control.hw_key) -@@ -660,7 +659,7 @@ static int gcmp_encrypt_skb(struct ieee8 - return 0; - } - -- hdrlen = ieee80211_hdrlen(hdr->frame_control); -+ hdrlen = tx->hdrlen; - len = skb->len - hdrlen; - - if (info->control.hw_key) -@@ -800,7 +799,6 @@ static ieee80211_tx_result - ieee80211_crypto_cs_encrypt(struct ieee80211_tx_data *tx, - struct sk_buff *skb) - { -- struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; - struct ieee80211_key *key = tx->key; - struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); - int hdrlen; -@@ -816,8 +814,7 @@ ieee80211_crypto_cs_encrypt(struct ieee8 - pskb_expand_head(skb, iv_len, 0, GFP_ATOMIC))) - return TX_DROP; - -- hdrlen = ieee80211_hdrlen(hdr->frame_control); -- -+ hdrlen = tx->hdrlen; - pos = skb_push(skb, iv_len); - memmove(pos, pos + iv_len, hdrlen); - diff --git a/package/kernel/mac80211/patches/subsys/357-mac80211-optimize-skb-resizing.patch b/package/kernel/mac80211/patches/subsys/357-mac80211-optimize-skb-resizing.patch new file mode 100644 index 0000000000..8853ccd059 --- /dev/null +++ b/package/kernel/mac80211/patches/subsys/357-mac80211-optimize-skb-resizing.patch @@ -0,0 +1,202 @@ +From: Felix Fietkau +Date: Sun, 17 Mar 2019 18:11:30 +0100 +Subject: [PATCH] mac80211: optimize skb resizing + +When forwarding unicast packets from ethernet to batman-adv over 802.11s +(with forwarding disabled), the typical required headroom to transmit +encrypted packets on mt76 is 32 (802.11) + 6 (802.11s) + 8 (CCMP) + +2 (padding) + 6 (LLC) + 18 (batman-adv) - 14 (old ethernet header) = 58 bytes. + +On systems where NET_SKB_PAD is 64 this leads to a call to pskb_expand_head +for every packet, since mac80211 also tries to allocate 16 bytes status +headroom for radiotap headers. + +This patch fixes these unnecessary reallocations by only requiring the extra +status headroom in ieee80211_tx_monitor() +If however a reallocation happens before that call, the status headroom gets +added there as well, in order to avoid double reallocation. + +The patch also cleans up the code by moving the headroom calculation to +ieee80211_skb_resize. + +Signed-off-by: Felix Fietkau +--- + +--- a/net/mac80211/ieee80211_i.h ++++ b/net/mac80211/ieee80211_i.h +@@ -1761,6 +1761,9 @@ void ieee80211_clear_fast_xmit(struct st + int ieee80211_tx_control_port(struct wiphy *wiphy, struct net_device *dev, + const u8 *buf, size_t len, + const u8 *dest, __be16 proto, bool unencrypted); ++int ieee80211_skb_resize(struct ieee80211_local *local, ++ struct ieee80211_sub_if_data *sdata, ++ struct sk_buff *skb, int hdrlen, int hdr_add); + + /* HT */ + void ieee80211_apply_htcap_overrides(struct ieee80211_sub_if_data *sdata, +--- a/net/mac80211/status.c ++++ b/net/mac80211/status.c +@@ -672,6 +672,11 @@ void ieee80211_tx_monitor(struct ieee802 + } + } + ++ if (ieee80211_skb_resize(local, NULL, skb, 0, 0)) { ++ dev_kfree_skb(skb); ++ return; ++ } ++ + /* send frame to monitor interfaces now */ + rtap_len = ieee80211_tx_radiotap_len(info); + if (WARN_ON_ONCE(skb_headroom(skb) < rtap_len)) { +--- a/net/mac80211/tx.c ++++ b/net/mac80211/tx.c +@@ -1914,37 +1914,53 @@ static bool ieee80211_tx(struct ieee8021 + } + + /* device xmit handlers */ +- +-static int ieee80211_skb_resize(struct ieee80211_sub_if_data *sdata, +- struct sk_buff *skb, +- int head_need, bool may_encrypt) ++int ieee80211_skb_resize(struct ieee80211_local *local, ++ struct ieee80211_sub_if_data *sdata, ++ struct sk_buff *skb, int hdr_len, int hdr_extra) + { +- struct ieee80211_local *local = sdata->local; ++ struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); + struct ieee80211_hdr *hdr; +- bool enc_tailroom; +- int tail_need = 0; +- +- hdr = (struct ieee80211_hdr *) skb->data; +- enc_tailroom = may_encrypt && +- (sdata->crypto_tx_tailroom_needed_cnt || +- ieee80211_is_mgmt(hdr->frame_control)); +- +- if (enc_tailroom) { +- tail_need = IEEE80211_ENCRYPT_TAILROOM; +- tail_need -= skb_tailroom(skb); +- tail_need = max_t(int, tail_need, 0); ++ int head_need, head_max; ++ int tail_need, tail_max; ++ bool enc_tailroom = false; ++ ++ if (sdata && !hdr_len && ++ !(info->flags & IEEE80211_TX_INTFL_DONT_ENCRYPT)) { ++ hdr = (struct ieee80211_hdr *) skb->data; ++ enc_tailroom = (sdata->crypto_tx_tailroom_needed_cnt || ++ ieee80211_is_mgmt(hdr->frame_control)); ++ hdr_len += sdata->encrypt_headroom; ++ } ++ ++ head_need = head_max = hdr_len; ++ tail_need = tail_max = 0; ++ if (!sdata) { ++ head_need = head_max = local->tx_headroom; ++ } else { ++ head_max += hdr_extra; ++ head_max += max_t(int, local->tx_headroom, ++ local->hw.extra_tx_headroom); ++ head_need += local->hw.extra_tx_headroom; ++ ++ tail_max = IEEE80211_ENCRYPT_TAILROOM; ++ if (enc_tailroom) ++ tail_need = tail_max; + } + + if (skb_cloned(skb) && + (!ieee80211_hw_check(&local->hw, SUPPORTS_CLONED_SKBS) || + !skb_clone_writable(skb, ETH_HLEN) || enc_tailroom)) + I802_DEBUG_INC(local->tx_expand_skb_head_cloned); +- else if (head_need || tail_need) ++ else if (head_need > skb_headroom(skb) || ++ tail_need > skb_tailroom(skb)) + I802_DEBUG_INC(local->tx_expand_skb_head); + else + return 0; + +- if (pskb_expand_head(skb, head_need, tail_need, GFP_ATOMIC)) { ++ head_max = max_t(int, 0, head_max - skb_headroom(skb)); ++ tail_max = max_t(int, 0, tail_max - skb_tailroom(skb)); ++ ++ if (pskb_expand_head(skb, head_max, tail_max, GFP_ATOMIC)) { + wiphy_debug(local->hw.wiphy, + "failed to reallocate TX buffer\n"); + return -ENOMEM; +@@ -1960,18 +1976,8 @@ void ieee80211_xmit(struct ieee80211_sub + struct ieee80211_local *local = sdata->local; + struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); + struct ieee80211_hdr *hdr; +- int headroom; +- bool may_encrypt; +- +- may_encrypt = !(info->flags & IEEE80211_TX_INTFL_DONT_ENCRYPT); + +- headroom = local->tx_headroom; +- if (may_encrypt) +- headroom += sdata->encrypt_headroom; +- headroom -= skb_headroom(skb); +- headroom = max_t(int, 0, headroom); +- +- if (ieee80211_skb_resize(sdata, skb, headroom, may_encrypt)) { ++ if (ieee80211_skb_resize(local, sdata, skb, 0, 0)) { + ieee80211_free_txskb(&local->hw, skb); + return; + } +@@ -2740,30 +2746,14 @@ static struct sk_buff *ieee80211_build_h + + skb_pull(skb, skip_header_bytes); + padsize = ieee80211_hdr_padsize(&local->hw, hdrlen); +- head_need = hdrlen + encaps_len + meshhdrlen - skb_headroom(skb); ++ head_need = hdrlen + encaps_len + meshhdrlen; + head_need += padsize; + +- /* +- * So we need to modify the skb header and hence need a copy of +- * that. The head_need variable above doesn't, so far, include +- * the needed header space that we don't need right away. If we +- * can, then we don't reallocate right now but only after the +- * frame arrives at the master device (if it does...) +- * +- * If we cannot, however, then we will reallocate to include all +- * the ever needed space. Also, if we need to reallocate it anyway, +- * make it big enough for everything we may ever need. +- */ +- +- if (head_need > 0 || skb_cloned(skb)) { +- head_need += sdata->encrypt_headroom; +- head_need += local->tx_headroom; +- head_need = max_t(int, 0, head_need); +- if (ieee80211_skb_resize(sdata, skb, head_need, true)) { +- ieee80211_free_txskb(&local->hw, skb); +- skb = NULL; +- return ERR_PTR(-ENOMEM); +- } ++ if (ieee80211_skb_resize(local, sdata, skb, head_need, ++ sdata->encrypt_headroom)) { ++ ieee80211_free_txskb(&local->hw, skb); ++ skb = NULL; ++ return ERR_PTR(-ENOMEM); + } + + if (encaps_data) +@@ -3375,7 +3365,6 @@ static bool ieee80211_xmit_fast(struct i + struct ieee80211_local *local = sdata->local; + u16 ethertype = (skb->data[12] << 8) | skb->data[13]; + int extra_head = fast_tx->hdr_len - (ETH_HLEN - 2); +- int hw_headroom = sdata->local->hw.extra_tx_headroom; + struct ethhdr eth; + struct ieee80211_tx_info *info; + struct ieee80211_hdr *hdr = (void *)fast_tx->hdr; +@@ -3427,10 +3416,7 @@ static bool ieee80211_xmit_fast(struct i + * as the may-encrypt argument for the resize to not account for + * more room than we already have in 'extra_head' + */ +- if (unlikely(ieee80211_skb_resize(sdata, skb, +- max_t(int, extra_head + hw_headroom - +- skb_headroom(skb), 0), +- false))) { ++ if (unlikely(ieee80211_skb_resize(local, sdata, skb, extra_head, 0))) { + kfree_skb(skb); + return true; + } diff --git a/package/kernel/mac80211/patches/subsys/358-mac80211-add-NEED_ALIGNED4_SKBS-hw-flag.patch b/package/kernel/mac80211/patches/subsys/358-mac80211-add-NEED_ALIGNED4_SKBS-hw-flag.patch deleted file mode 100644 index f4048b0420..0000000000 --- a/package/kernel/mac80211/patches/subsys/358-mac80211-add-NEED_ALIGNED4_SKBS-hw-flag.patch +++ /dev/null @@ -1,233 +0,0 @@ -From: Janusz Dziedzic -Date: Fri, 19 Feb 2016 11:01:50 +0100 -Subject: [PATCH] mac80211: add NEED_ALIGNED4_SKBS hw flag - -HW/driver should set NEED_ALIGNED4_SKBS flag in case -require aligned skbs to four-byte boundaries. -This affect only TX direction. - -Padding is added after ieee80211_hdr, before IV/LLC. - -Before we have to do memmove(hdrlen) twice in the -dirver. Once before we pass this to HW and next -in tx completion (to be sure monitor will report -this tx frame correctly). - -With this patch we can skip this memmove() and save CPU. - -Currently this was tested with ath9k, both hw/sw crypt for -wep/tkip/ccmp. - -Signed-off-by: Janusz Dziedzic ---- - ---- a/include/net/mac80211.h -+++ b/include/net/mac80211.h -@@ -2131,6 +2131,9 @@ struct ieee80211_txq { - * @IEEE80211_HW_DOESNT_SUPPORT_QOS_NDP: The driver (or firmware) doesn't - * support QoS NDP for AP probing - that's most likely a driver bug. - * -+ * @IEEE80211_HW_NEEDS_ALIGNED4_SKBS: Driver need aligned skbs to four-byte. -+ * Padding will be added after ieee80211_hdr, before IV/LLC. -+ * - * @NUM_IEEE80211_HW_FLAGS: number of hardware flags, used for sizing arrays - */ - enum ieee80211_hw_flags { -@@ -2176,6 +2179,7 @@ enum ieee80211_hw_flags { - IEEE80211_HW_SUPPORTS_TDLS_BUFFER_STA, - IEEE80211_HW_DEAUTH_NEED_MGD_TX_PREP, - IEEE80211_HW_DOESNT_SUPPORT_QOS_NDP, -+ IEEE80211_HW_NEEDS_ALIGNED4_SKBS, - - /* keep last, obviously */ - NUM_IEEE80211_HW_FLAGS ---- a/net/mac80211/debugfs.c -+++ b/net/mac80211/debugfs.c -@@ -214,6 +214,7 @@ static const char *hw_flag_names[] = { - FLAG(SUPPORTS_TDLS_BUFFER_STA), - FLAG(DEAUTH_NEED_MGD_TX_PREP), - FLAG(DOESNT_SUPPORT_QOS_NDP), -+ FLAG(NEEDS_ALIGNED4_SKBS), - #undef FLAG - }; - ---- a/net/mac80211/ieee80211_i.h -+++ b/net/mac80211/ieee80211_i.h -@@ -1559,6 +1559,29 @@ ieee80211_vif_get_num_mcast_if(struct ie - return -1; - } - -+static inline unsigned int -+ieee80211_hdr_padsize(struct ieee80211_hw *hw, unsigned int hdrlen) -+{ -+ /* -+ * While hdrlen is already aligned to two-byte boundaries, -+ * simple check with & 2 will return correct padsize. -+ */ -+ if (ieee80211_hw_check(hw, NEEDS_ALIGNED4_SKBS)) -+ return hdrlen & 2; -+ return 0; -+} -+ -+static inline unsigned int -+ieee80211_padded_hdrlen(struct ieee80211_hw *hw, __le16 fc) -+{ -+ unsigned int hdrlen; -+ -+ hdrlen = ieee80211_hdrlen(fc); -+ hdrlen += ieee80211_hdr_padsize(hw, hdrlen); -+ -+ return hdrlen; -+} -+ - u64 ieee80211_calculate_rx_timestamp(struct ieee80211_local *local, - struct ieee80211_rx_status *status, - unsigned int mpdu_len, ---- a/net/mac80211/sta_info.h -+++ b/net/mac80211/sta_info.h -@@ -301,7 +301,7 @@ struct ieee80211_fast_tx { - u8 hdr_len; - u8 sa_offs, da_offs, pn_offs; - u8 band; -- u8 hdr[30 + 2 + IEEE80211_FAST_XMIT_MAX_IV + -+ u8 hdr[30 + 2 + 2 + IEEE80211_FAST_XMIT_MAX_IV + - sizeof(rfc1042_header)] __aligned(2); - - struct rcu_head rcu_head; ---- a/net/mac80211/status.c -+++ b/net/mac80211/status.c -@@ -655,9 +655,22 @@ void ieee80211_tx_monitor(struct ieee802 - struct sk_buff *skb2; - struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); - struct ieee80211_sub_if_data *sdata; -+ struct ieee80211_hdr *hdr = (void *)skb->data; - struct net_device *prev_dev = NULL; -+ unsigned int hdrlen, padsize; - int rtap_len; - -+ /* Remove padding if was added */ -+ if (ieee80211_hw_check(&local->hw, NEEDS_ALIGNED4_SKBS)) { -+ hdrlen = ieee80211_hdrlen(hdr->frame_control); -+ padsize = ieee80211_hdr_padsize(&local->hw, hdrlen); -+ -+ if (padsize && skb->len > hdrlen + padsize) { -+ memmove(skb->data + padsize, skb->data, hdrlen); -+ skb_pull(skb, padsize); -+ } -+ } -+ - /* send frame to monitor interfaces now */ - rtap_len = ieee80211_tx_radiotap_len(info); - if (WARN_ON_ONCE(skb_headroom(skb) < rtap_len)) { ---- a/net/mac80211/tkip.c -+++ b/net/mac80211/tkip.c -@@ -201,10 +201,12 @@ void ieee80211_get_tkip_p2k(struct ieee8 - { - struct ieee80211_key *key = (struct ieee80211_key *) - container_of(keyconf, struct ieee80211_key, conf); -+ struct ieee80211_hw *hw = &key->local->hw; - const u8 *tk = &key->conf.key[NL80211_TKIP_DATA_OFFSET_ENCR_KEY]; - struct tkip_ctx *ctx = &key->u.tkip.tx; - struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; -- const u8 *data = (u8 *)hdr + ieee80211_hdrlen(hdr->frame_control); -+ const u8 *data = (u8 *)hdr + ieee80211_padded_hdrlen(hw, -+ hdr->frame_control); - u32 iv32 = get_unaligned_le32(&data[4]); - u16 iv16 = data[2] | (data[0] << 8); - ---- a/net/mac80211/tx.c -+++ b/net/mac80211/tx.c -@@ -1175,8 +1175,7 @@ ieee80211_tx_prepare(struct ieee80211_su - info->flags &= ~IEEE80211_TX_INTFL_NEED_TXPROCESSING; - - hdr = (struct ieee80211_hdr *) skb->data; -- -- tx->hdrlen = ieee80211_hdrlen(hdr->frame_control); -+ tx->hdrlen = ieee80211_padded_hdrlen(&local->hw, hdr->frame_control); - - if (likely(sta)) { - if (!IS_ERR(sta)) -@@ -2215,7 +2214,7 @@ netdev_tx_t ieee80211_monitor_start_xmit - goto fail; - - hdr = (struct ieee80211_hdr *)(skb->data + len_rthdr); -- hdrlen = ieee80211_hdrlen(hdr->frame_control); -+ hdrlen = ieee80211_padded_hdrlen(&local->hw, hdr->frame_control); - - if (skb->len < len_rthdr + hdrlen) - goto fail; -@@ -2433,7 +2432,7 @@ static struct sk_buff *ieee80211_build_h - struct ieee80211_chanctx_conf *chanctx_conf; - struct ieee80211_sub_if_data *ap_sdata; - enum nl80211_band band; -- int ret; -+ int padsize, ret; - - if (IS_ERR(sta)) - sta = NULL; -@@ -2653,6 +2652,9 @@ static struct sk_buff *ieee80211_build_h - hdrlen += 2; - } - -+ /* Check aligned4 skb required */ -+ padsize = ieee80211_hdr_padsize(&sdata->local->hw, hdrlen); -+ - /* - * Drop unicast frames to unauthorised stations unless they are - * EAPOL frames from the local station. -@@ -2733,6 +2735,7 @@ static struct sk_buff *ieee80211_build_h - - skb_pull(skb, skip_header_bytes); - head_need = hdrlen + encaps_len + meshhdrlen - skb_headroom(skb); -+ head_need += padsize; - - /* - * So we need to modify the skb header and hence need a copy of -@@ -2765,6 +2768,9 @@ static struct sk_buff *ieee80211_build_h - memcpy(skb_push(skb, meshhdrlen), &mesh_hdr, meshhdrlen); - #endif - -+ if (padsize) -+ memset(skb_push(skb, padsize), 0, padsize); -+ - if (ieee80211_is_data_qos(fc)) { - __le16 *qos_control; - -@@ -2940,6 +2946,9 @@ void ieee80211_check_fast_xmit(struct st - fc |= cpu_to_le16(IEEE80211_STYPE_QOS_DATA); - } - -+ /* Check aligned4 skb required */ -+ build.hdr_len += ieee80211_hdr_padsize(&local->hw, build.hdr_len); -+ - /* We store the key here so there's no point in using rcu_dereference() - * but that's fine because the code that changes the pointers will call - * this function after doing so. For a single CPU that would be enough, -@@ -3540,7 +3549,7 @@ begin: - - if (tx.key && - (tx.key->conf.flags & IEEE80211_KEY_FLAG_GENERATE_IV)) -- pn_offs = ieee80211_hdrlen(hdr->frame_control); -+ pn_offs = tx.hdrlen; - - ieee80211_xmit_fast_finish(sta->sdata, sta, pn_offs, - tx.key, skb); ---- a/net/mac80211/util.c -+++ b/net/mac80211/util.c -@@ -1388,6 +1388,7 @@ void ieee80211_send_auth(struct ieee8021 - u32 tx_flags) - { - struct ieee80211_local *local = sdata->local; -+ struct ieee80211_hw *hw = &local->hw; - struct sk_buff *skb; - struct ieee80211_mgmt *mgmt; - unsigned int hdrlen; -@@ -1414,7 +1415,7 @@ void ieee80211_send_auth(struct ieee8021 - skb_put_data(skb, extra, extra_len); - - if (auth_alg == WLAN_AUTH_SHARED_KEY && transaction == 3) { -- hdrlen = ieee80211_hdrlen(mgmt->frame_control); -+ hdrlen = ieee80211_padded_hdrlen(hw, mgmt->frame_control); - mgmt->frame_control |= cpu_to_le16(IEEE80211_FCTL_PROTECTED); - err = ieee80211_wep_encrypt(local, skb, hdrlen, key, - key_len, key_idx); diff --git a/package/kernel/mac80211/patches/subsys/358-mac80211-make-ieee80211_schedule_txq-schedule-empty-.patch b/package/kernel/mac80211/patches/subsys/358-mac80211-make-ieee80211_schedule_txq-schedule-empty-.patch new file mode 100644 index 0000000000..46dd151f11 --- /dev/null +++ b/package/kernel/mac80211/patches/subsys/358-mac80211-make-ieee80211_schedule_txq-schedule-empty-.patch @@ -0,0 +1,105 @@ +From: Felix Fietkau +Date: Sun, 17 Mar 2019 14:26:59 +0100 +Subject: [PATCH] mac80211: make ieee80211_schedule_txq schedule empty TXQs + +Currently there is no way for the driver to signal to mac80211 that it should +schedule a TXQ even if there are no packets on the mac80211 part of that queue. +This is problematic if the driver has an internal retry queue to deal with +software A-MPDU retry. + +This patch changes the behavior of ieee80211_schedule_txq to always schedule +the queue, as its only user (ath9k) seems to expect such behavior already: +it calls this function on tx status and on powersave wakeup whenever its +internal retry queue is not empty. + +Also add an extra argument to ieee80211_return_txq to get the same behavior. + +This fixes an issue on ath9k where tx queues with packets to retry (and no +new packets in mac80211) would not get serviced. + +Fixes: 89cea7493a346 ("ath9k: Switch to mac80211 TXQ scheduling and airtime APIs") +Signed-off-by: Felix Fietkau +--- + +--- a/include/net/mac80211.h ++++ b/include/net/mac80211.h +@@ -6090,26 +6090,42 @@ static inline void ieee80211_txq_schedul + { + } + ++void __ieee80211_schedule_txq(struct ieee80211_hw *hw, ++ struct ieee80211_txq *txq, bool force); ++ + /** + * ieee80211_schedule_txq - schedule a TXQ for transmission + * + * @hw: pointer as obtained from ieee80211_alloc_hw() + * @txq: pointer obtained from station or virtual interface + * +- * Schedules a TXQ for transmission if it is not already scheduled. ++ * Schedules a TXQ for transmission if it is not already scheduled, ++ * even if mac80211 does not have any packets buffered. ++ * ++ * The driver may call this function if it has buffered packets for ++ * this TXQ internally. + */ +-void ieee80211_schedule_txq(struct ieee80211_hw *hw, struct ieee80211_txq *txq); ++static inline void ++ieee80211_schedule_txq(struct ieee80211_hw *hw, struct ieee80211_txq *txq) ++{ ++ __ieee80211_schedule_txq(hw, txq, true); ++} + + /** + * ieee80211_return_txq - return a TXQ previously acquired by ieee80211_next_txq() + * + * @hw: pointer as obtained from ieee80211_alloc_hw() + * @txq: pointer obtained from station or virtual interface ++ * @force: schedule txq even if mac80211 does not have any buffered packets. ++ * ++ * The driver may set force=true if it has buffered packets for this TXQ ++ * internally. + */ + static inline void +-ieee80211_return_txq(struct ieee80211_hw *hw, struct ieee80211_txq *txq) ++ieee80211_return_txq(struct ieee80211_hw *hw, struct ieee80211_txq *txq, ++ bool force) + { +- ieee80211_schedule_txq(hw, txq); ++ __ieee80211_schedule_txq(hw, txq, force); + } + + /** +--- a/net/mac80211/tx.c ++++ b/net/mac80211/tx.c +@@ -3653,8 +3653,9 @@ out: + } + EXPORT_SYMBOL(ieee80211_next_txq); + +-void ieee80211_schedule_txq(struct ieee80211_hw *hw, +- struct ieee80211_txq *txq) ++void __ieee80211_schedule_txq(struct ieee80211_hw *hw, ++ struct ieee80211_txq *txq, ++ bool force) + { + struct ieee80211_local *local = hw_to_local(hw); + struct txq_info *txqi = to_txq_info(txq); +@@ -3662,7 +3663,8 @@ void ieee80211_schedule_txq(struct ieee8 + spin_lock_bh(&local->active_txq_lock[txq->ac]); + + if (list_empty(&txqi->schedule_order) && +- (!skb_queue_empty(&txqi->frags) || txqi->tin.backlog_packets)) { ++ (force || !skb_queue_empty(&txqi->frags) || ++ txqi->tin.backlog_packets)) { + /* If airtime accounting is active, always enqueue STAs at the + * head of the list to ensure that they only get moved to the + * back by the airtime DRR scheduler once they have a negative +@@ -3682,7 +3684,7 @@ void ieee80211_schedule_txq(struct ieee8 + + spin_unlock_bh(&local->active_txq_lock[txq->ac]); + } +-EXPORT_SYMBOL(ieee80211_schedule_txq); ++EXPORT_SYMBOL(__ieee80211_schedule_txq); + + bool ieee80211_txq_may_transmit(struct ieee80211_hw *hw, + struct ieee80211_txq *txq) diff --git a/package/kernel/mac80211/patches/subsys/359-mac80211-un-schedule-TXQs-on-powersave-start.patch b/package/kernel/mac80211/patches/subsys/359-mac80211-un-schedule-TXQs-on-powersave-start.patch new file mode 100644 index 0000000000..1abb2db7c2 --- /dev/null +++ b/package/kernel/mac80211/patches/subsys/359-mac80211-un-schedule-TXQs-on-powersave-start.patch @@ -0,0 +1,31 @@ +From: Felix Fietkau +Date: Tue, 19 Mar 2019 11:36:12 +0100 +Subject: [PATCH] mac80211: un-schedule TXQs on powersave start + +Once a station enters powersave, its queues should not be returned by +ieee80211_next_txq() anymore. They will be re-scheduled again after the +station has woken up again + +Fixes: 1866760096bf4 ("mac80211: Add TXQ scheduling API") +Signed-off-by: Felix Fietkau +--- + +--- a/net/mac80211/rx.c ++++ b/net/mac80211/rx.c +@@ -1508,7 +1508,15 @@ static void sta_ps_start(struct sta_info + return; + + for (tid = 0; tid < ARRAY_SIZE(sta->sta.txq); tid++) { +- if (txq_has_queue(sta->sta.txq[tid])) ++ struct ieee80211_txq *txq = sta->sta.txq[tid]; ++ struct txq_info *txqi = to_txq_info(txq); ++ ++ spin_lock(&local->active_txq_lock[txq->ac]); ++ if (!list_empty(&txqi->schedule_order)) ++ list_del_init(&txqi->schedule_order); ++ spin_unlock(&local->active_txq_lock[txq->ac]); ++ ++ if (txq_has_queue(txq)) + set_bit(tid, &sta->txq_buffered_tids); + else + clear_bit(tid, &sta->txq_buffered_tids); diff --git a/package/kernel/mac80211/patches/subsys/360-mac80211-when-using-iTXQ-select-the-queue-in-ieee802.patch b/package/kernel/mac80211/patches/subsys/360-mac80211-when-using-iTXQ-select-the-queue-in-ieee802.patch new file mode 100644 index 0000000000..6009ab74d8 --- /dev/null +++ b/package/kernel/mac80211/patches/subsys/360-mac80211-when-using-iTXQ-select-the-queue-in-ieee802.patch @@ -0,0 +1,183 @@ +From: Felix Fietkau +Date: Fri, 22 Mar 2019 18:06:03 +0100 +Subject: [PATCH] mac80211: when using iTXQ, select the queue in + ieee80211_subif_start_xmit + +When using iTXQ, the network stack does not need the real queue number, since +mac80211 is using its internal queues anyway. In that case we can defer +selecting the queue and remove a redundant station lookup in the tx path to save +some CPU cycles. + +Signed-off-by: Felix Fietkau +--- + +--- a/net/mac80211/tx.c ++++ b/net/mac80211/tx.c +@@ -3751,6 +3751,7 @@ void __ieee80211_subif_start_xmit(struct + u32 info_flags) + { + struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); ++ struct ieee80211_local *local = sdata->local; + struct sta_info *sta; + struct sk_buff *next; + +@@ -3764,7 +3765,15 @@ void __ieee80211_subif_start_xmit(struct + if (ieee80211_lookup_ra_sta(sdata, skb, &sta)) + goto out_free; + +- if (!IS_ERR_OR_NULL(sta)) { ++ if (IS_ERR(sta)) ++ sta = NULL; ++ ++ if (local->ops->wake_tx_queue) { ++ u16 queue = __ieee80211_select_queue(sdata, sta, skb); ++ skb_set_queue_mapping(skb, queue); ++ } ++ ++ if (sta) { + struct ieee80211_fast_tx *fast_tx; + + /* We need a bit of data queued to build aggregates properly, so +--- a/net/mac80211/wme.c ++++ b/net/mac80211/wme.c +@@ -141,6 +141,42 @@ u16 ieee80211_select_queue_80211(struct + return ieee80211_downgrade_queue(sdata, NULL, skb); + } + ++u16 __ieee80211_select_queue(struct ieee80211_sub_if_data *sdata, ++ struct sta_info *sta, struct sk_buff *skb) ++{ ++ struct mac80211_qos_map *qos_map; ++ bool qos; ++ ++ /* all mesh/ocb stations are required to support WME */ ++ if (sdata->vif.type == NL80211_IFTYPE_MESH_POINT || ++ sdata->vif.type == NL80211_IFTYPE_OCB) ++ qos = true; ++ else if (sta) ++ qos = sta->sta.wme; ++ else ++ qos = false; ++ ++ if (!qos) { ++ skb->priority = 0; /* required for correct WPA/11i MIC */ ++ return IEEE80211_AC_BE; ++ } ++ ++ if (skb->protocol == sdata->control_port_protocol) { ++ skb->priority = 7; ++ goto downgrade; ++ } ++ ++ /* use the data classifier to determine what 802.1d tag the ++ * data frame has */ ++ qos_map = rcu_dereference(sdata->qos_map); ++ skb->priority = cfg80211_classify8021d(skb, qos_map ? ++ &qos_map->qos_map : NULL); ++ ++ downgrade: ++ return ieee80211_downgrade_queue(sdata, sta, skb); ++} ++ ++ + /* Indicate which queue to use. */ + u16 ieee80211_select_queue(struct ieee80211_sub_if_data *sdata, + struct sk_buff *skb) +@@ -148,10 +184,12 @@ u16 ieee80211_select_queue(struct ieee80 + struct ieee80211_local *local = sdata->local; + struct sta_info *sta = NULL; + const u8 *ra = NULL; +- bool qos = false; +- struct mac80211_qos_map *qos_map; + u16 ret; + ++ /* when using iTXQ, we can do this later */ ++ if (local->ops->wake_tx_queue) ++ return 0; ++ + if (local->hw.queues < IEEE80211_NUM_ACS || skb->len < 6) { + skb->priority = 0; /* required for correct WPA/11i MIC */ + return 0; +@@ -161,10 +199,8 @@ u16 ieee80211_select_queue(struct ieee80 + switch (sdata->vif.type) { + case NL80211_IFTYPE_AP_VLAN: + sta = rcu_dereference(sdata->u.vlan.sta); +- if (sta) { +- qos = sta->sta.wme; ++ if (sta) + break; +- } + /* fall through */ + case NL80211_IFTYPE_AP: + ra = skb->data; +@@ -172,56 +208,26 @@ u16 ieee80211_select_queue(struct ieee80 + case NL80211_IFTYPE_WDS: + ra = sdata->u.wds.remote_addr; + break; +-#ifdef CPTCFG_MAC80211_MESH +- case NL80211_IFTYPE_MESH_POINT: +- qos = true; +- break; +-#endif + case NL80211_IFTYPE_STATION: + /* might be a TDLS station */ + sta = sta_info_get(sdata, skb->data); + if (sta) +- qos = sta->sta.wme; ++ break; + + ra = sdata->u.mgd.bssid; + break; + case NL80211_IFTYPE_ADHOC: + ra = skb->data; + break; +- case NL80211_IFTYPE_OCB: +- /* all stations are required to support WME */ +- qos = true; +- break; + default: + break; + } + +- if (!sta && ra && !is_multicast_ether_addr(ra)) { ++ if (!sta && ra && !is_multicast_ether_addr(ra)) + sta = sta_info_get(sdata, ra); +- if (sta) +- qos = sta->sta.wme; +- } + +- if (!qos) { +- skb->priority = 0; /* required for correct WPA/11i MIC */ +- ret = IEEE80211_AC_BE; +- goto out; +- } ++ ret = __ieee80211_select_queue(sdata, sta, skb); + +- if (skb->protocol == sdata->control_port_protocol) { +- skb->priority = 7; +- goto downgrade; +- } +- +- /* use the data classifier to determine what 802.1d tag the +- * data frame has */ +- qos_map = rcu_dereference(sdata->qos_map); +- skb->priority = cfg80211_classify8021d(skb, qos_map ? +- &qos_map->qos_map : NULL); +- +- downgrade: +- ret = ieee80211_downgrade_queue(sdata, sta, skb); +- out: + rcu_read_unlock(); + return ret; + } +--- a/net/mac80211/wme.h ++++ b/net/mac80211/wme.h +@@ -16,6 +16,8 @@ + u16 ieee80211_select_queue_80211(struct ieee80211_sub_if_data *sdata, + struct sk_buff *skb, + struct ieee80211_hdr *hdr); ++u16 __ieee80211_select_queue(struct ieee80211_sub_if_data *sdata, ++ struct sta_info *sta, struct sk_buff *skb); + u16 ieee80211_select_queue(struct ieee80211_sub_if_data *sdata, + struct sk_buff *skb); + void ieee80211_set_qos_hdr(struct ieee80211_sub_if_data *sdata, diff --git a/package/kernel/mac80211/patches/subsys/361-mac80211-add-IEEE80211_KEY_FLAG_GENERATE_MMIE-to-iee.patch b/package/kernel/mac80211/patches/subsys/361-mac80211-add-IEEE80211_KEY_FLAG_GENERATE_MMIE-to-iee.patch new file mode 100644 index 0000000000..f7e022ca0c --- /dev/null +++ b/package/kernel/mac80211/patches/subsys/361-mac80211-add-IEEE80211_KEY_FLAG_GENERATE_MMIE-to-iee.patch @@ -0,0 +1,58 @@ +From: Lorenzo Bianconi +Date: Tue, 16 Jul 2019 00:09:19 +0200 +Subject: [PATCH] mac80211: add IEEE80211_KEY_FLAG_GENERATE_MMIE to + ieee80211_key_flags + +Add IEEE80211_KEY_FLAG_GENERATE_MMIE flag to ieee80211_key_flags in order +to allow the driver to notify mac80211 to generate MMIE and that it +requires sequence number generation only. +This is a preliminary patch to add BIP_CMAC_128 hw support to mt7615 +driver + +Signed-off-by: Lorenzo Bianconi +Link: https://lore.kernel.org/r/dfe275f9aa0f1cc6b33085f9efd5d8447f68ad13.1563228405.git.lorenzo@kernel.org +Signed-off-by: Johannes Berg +--- + +--- a/include/net/mac80211.h ++++ b/include/net/mac80211.h +@@ -1616,6 +1616,9 @@ struct wireless_dev *ieee80211_vif_to_wd + * @IEEE80211_KEY_FLAG_PUT_MIC_SPACE: This flag should be set by the driver for + * a TKIP key if it only requires MIC space. Do not set together with + * @IEEE80211_KEY_FLAG_GENERATE_MMIC on the same key. ++ * @IEEE80211_KEY_FLAG_GENERATE_MMIE: This flag should be set by the driver ++ * for a AES_CMAC key to indicate that it requires sequence number ++ * generation only + */ + enum ieee80211_key_flags { + IEEE80211_KEY_FLAG_GENERATE_IV_MGMT = BIT(0), +@@ -1627,6 +1630,7 @@ enum ieee80211_key_flags { + IEEE80211_KEY_FLAG_RX_MGMT = BIT(6), + IEEE80211_KEY_FLAG_RESERVE_TAILROOM = BIT(7), + IEEE80211_KEY_FLAG_PUT_MIC_SPACE = BIT(8), ++ IEEE80211_KEY_FLAG_GENERATE_MMIE = BIT(10), + }; + + /** +--- a/net/mac80211/wpa.c ++++ b/net/mac80211/wpa.c +@@ -947,7 +947,8 @@ ieee80211_crypto_aes_cmac_encrypt(struct + + info = IEEE80211_SKB_CB(skb); + +- if (info->control.hw_key) ++ if (info->control.hw_key && ++ !(key->conf.flags & IEEE80211_KEY_FLAG_GENERATE_MMIE)) + return TX_CONTINUE; + + if (WARN_ON(skb_tailroom(skb) < sizeof(*mmie))) +@@ -963,6 +964,9 @@ ieee80211_crypto_aes_cmac_encrypt(struct + + bip_ipn_set64(mmie->sequence_number, pn64); + ++ if (info->control.hw_key) ++ return TX_CONTINUE; ++ + bip_aad(skb, aad); + + /* diff --git a/package/kernel/mac80211/patches/subsys/378-mac80211-fix-memory-accounting-with-A-MSDU-aggregati.patch b/package/kernel/mac80211/patches/subsys/378-mac80211-fix-memory-accounting-with-A-MSDU-aggregati.patch deleted file mode 100644 index 4e83ff1ea0..0000000000 --- a/package/kernel/mac80211/patches/subsys/378-mac80211-fix-memory-accounting-with-A-MSDU-aggregati.patch +++ /dev/null @@ -1,58 +0,0 @@ -From: Felix Fietkau -Date: Thu, 8 Mar 2018 21:00:56 +0100 -Subject: [PATCH] mac80211: fix memory accounting with A-MSDU aggregation - -fq uses skb->truesize for memory usage tracking. Increments/decrements -are done on enqueue/dequeue. -When A-MSDU aggregation is performed on tx side, the packet is -aggregated with the last packet in the queue belonging to the same flow. -There are multiple bugs here: -- The truesize field of the aggregated packet isn't updated, so memory -usage is underestimated -- fq->memory_usage isn't adjusted. - -Because of the combination of both bugs, this only causes tx issues in -rare cases, mainly when the A-MSDU head needs to be reallocated. - -Fix this by adjusting both truesize of the A-MSDU head and adding the -truesize delta to fq->memory_usage. - -Signed-off-by: Felix Fietkau ---- - ---- a/net/mac80211/tx.c -+++ b/net/mac80211/tx.c -@@ -3194,6 +3194,7 @@ static bool ieee80211_amsdu_aggregate(st - u8 max_subframes = sta->sta.max_amsdu_subframes; - int max_frags = local->hw.max_tx_fragments; - int max_amsdu_len = sta->sta.max_amsdu_len; -+ int orig_truesize; - __be16 len; - void *data; - bool ret = false; -@@ -3225,12 +3226,13 @@ static bool ieee80211_amsdu_aggregate(st - flow = fq_flow_classify(fq, tin, skb, fq_flow_get_default_func); - head = skb_peek_tail(&flow->queue); - if (!head) -- goto out; -+ goto unlock; - -+ orig_truesize = head->truesize; - orig_len = head->len; - - if (skb->len + head->len > max_amsdu_len) -- goto out; -+ goto unlock; - - nfrags = 1 + skb_shinfo(skb)->nr_frags; - nfrags += 1 + skb_shinfo(head)->nr_frags; -@@ -3288,6 +3290,9 @@ out_recalc: - fq_recalc_backlog(fq, tin, flow); - } - out: -+ fq->memory_usage += head->truesize - orig_truesize; -+ -+unlock: - spin_unlock_bh(&fq->lock); - - return ret; diff --git a/package/kernel/mac80211/patches/subsys/383-mac80211-minstrel_ht-add-flag-to-indicate-missing-in.patch b/package/kernel/mac80211/patches/subsys/383-mac80211-minstrel_ht-add-flag-to-indicate-missing-in.patch deleted file mode 100644 index 5b12e87c84..0000000000 --- a/package/kernel/mac80211/patches/subsys/383-mac80211-minstrel_ht-add-flag-to-indicate-missing-in.patch +++ /dev/null @@ -1,121 +0,0 @@ -From: Felix Fietkau -Date: Wed, 16 Jan 2019 21:47:54 +0100 -Subject: [PATCH] mac80211: minstrel_ht: add flag to indicate - missing/inaccurate tx A-MPDU length - -Some hardware (e.g. MediaTek MT7603) cannot report A-MPDU length in tx status -information. Add support for a flag to indicate that, to allow minstrel_ht -to use a fixed value in its internal calculation (which gives better results -than just defaulting to 1). - -Signed-off-by: Felix Fietkau ---- - ---- a/include/net/mac80211.h -+++ b/include/net/mac80211.h -@@ -2134,6 +2134,9 @@ struct ieee80211_txq { - * @IEEE80211_HW_NEEDS_ALIGNED4_SKBS: Driver need aligned skbs to four-byte. - * Padding will be added after ieee80211_hdr, before IV/LLC. - * -+ * @IEEE80211_HW_TX_STATUS_NO_AMPDU_LEN: Driver does not report accurate A-MPDU -+ * length in tx status information -+ * - * @NUM_IEEE80211_HW_FLAGS: number of hardware flags, used for sizing arrays - */ - enum ieee80211_hw_flags { -@@ -2180,6 +2183,7 @@ enum ieee80211_hw_flags { - IEEE80211_HW_DEAUTH_NEED_MGD_TX_PREP, - IEEE80211_HW_DOESNT_SUPPORT_QOS_NDP, - IEEE80211_HW_NEEDS_ALIGNED4_SKBS, -+ IEEE80211_HW_TX_STATUS_NO_AMPDU_LEN, - - /* keep last, obviously */ - NUM_IEEE80211_HW_FLAGS ---- a/net/mac80211/debugfs.c -+++ b/net/mac80211/debugfs.c -@@ -215,6 +215,7 @@ static const char *hw_flag_names[] = { - FLAG(DEAUTH_NEED_MGD_TX_PREP), - FLAG(DOESNT_SUPPORT_QOS_NDP), - FLAG(NEEDS_ALIGNED4_SKBS), -+ FLAG(TX_STATUS_NO_AMPDU_LEN), - #undef FLAG - }; - ---- a/net/mac80211/rc80211_minstrel_ht.c -+++ b/net/mac80211/rc80211_minstrel_ht.c -@@ -294,6 +294,15 @@ minstrel_get_ratestats(struct minstrel_h - return &mi->groups[index / MCS_GROUP_RATES].rates[index % MCS_GROUP_RATES]; - } - -+static unsigned int -+minstrel_ht_avg_ampdu_len(struct minstrel_ht_sta *mi) -+{ -+ if (!mi->avg_ampdu_len) -+ return AVG_AMPDU_SIZE; -+ -+ return MINSTREL_TRUNC(mi->avg_ampdu_len); -+} -+ - /* - * Return current throughput based on the average A-MPDU length, taking into - * account the expected number of retransmissions and their expected length -@@ -309,7 +318,7 @@ minstrel_ht_get_tp_avg(struct minstrel_h - return 0; - - if (group != MINSTREL_CCK_GROUP) -- nsecs = 1000 * mi->overhead / MINSTREL_TRUNC(mi->avg_ampdu_len); -+ nsecs = 1000 * mi->overhead / minstrel_ht_avg_ampdu_len(mi); - - nsecs += minstrel_mcs_groups[group].duration[rate] << - minstrel_mcs_groups[group].shift; -@@ -503,8 +512,12 @@ minstrel_ht_update_stats(struct minstrel - u16 tmp_cck_tp_rate[MAX_THR_RATES], index; - - if (mi->ampdu_packets > 0) { -- mi->avg_ampdu_len = minstrel_ewma(mi->avg_ampdu_len, -- MINSTREL_FRAC(mi->ampdu_len, mi->ampdu_packets), EWMA_LEVEL); -+ if (!ieee80211_hw_check(mp->hw, TX_STATUS_NO_AMPDU_LEN)) -+ mi->avg_ampdu_len = minstrel_ewma(mi->avg_ampdu_len, -+ MINSTREL_FRAC(mi->ampdu_len, mi->ampdu_packets), -+ EWMA_LEVEL); -+ else -+ mi->avg_ampdu_len = 0; - mi->ampdu_len = 0; - mi->ampdu_packets = 0; - } -@@ -709,7 +722,9 @@ minstrel_ht_tx_status(void *priv, struct - mi->ampdu_len += info->status.ampdu_len; - - if (!mi->sample_wait && !mi->sample_tries && mi->sample_count > 0) { -- mi->sample_wait = 16 + 2 * MINSTREL_TRUNC(mi->avg_ampdu_len); -+ int avg_ampdu_len = minstrel_ht_avg_ampdu_len(mi); -+ -+ mi->sample_wait = 16 + 2 * avg_ampdu_len; - mi->sample_tries = 1; - mi->sample_count--; - } -@@ -777,7 +792,7 @@ minstrel_calc_retransmit(struct minstrel - unsigned int cw = mp->cw_min; - unsigned int ctime = 0; - unsigned int t_slot = 9; /* FIXME */ -- unsigned int ampdu_len = MINSTREL_TRUNC(mi->avg_ampdu_len); -+ unsigned int ampdu_len = minstrel_ht_avg_ampdu_len(mi); - unsigned int overhead = 0, overhead_rtscts = 0; - - mrs = minstrel_get_ratestats(mi, index); ---- a/net/mac80211/rc80211_minstrel_ht_debugfs.c -+++ b/net/mac80211/rc80211_minstrel_ht_debugfs.c -@@ -163,9 +163,10 @@ minstrel_ht_stats_open(struct inode *ino - "lookaround %d\n", - max(0, (int) mi->total_packets - (int) mi->sample_packets), - mi->sample_packets); -- p += sprintf(p, "Average # of aggregated frames per A-MPDU: %d.%d\n", -- MINSTREL_TRUNC(mi->avg_ampdu_len), -- MINSTREL_TRUNC(mi->avg_ampdu_len * 10) % 10); -+ if (mi->avg_ampdu_len) -+ p += sprintf(p, "Average # of aggregated frames per A-MPDU: %d.%d\n", -+ MINSTREL_TRUNC(mi->avg_ampdu_len), -+ MINSTREL_TRUNC(mi->avg_ampdu_len * 10) % 10); - ms->len = p - ms->buf; - WARN_ON(ms->len + sizeof(*ms) > 32768); - diff --git a/package/kernel/mac80211/patches/subsys/390-nl-mac-80211-allow-4addr-AP-operation-on-crypto-cont.patch b/package/kernel/mac80211/patches/subsys/390-nl-mac-80211-allow-4addr-AP-operation-on-crypto-cont.patch deleted file mode 100644 index 3f933f8c3b..0000000000 --- a/package/kernel/mac80211/patches/subsys/390-nl-mac-80211-allow-4addr-AP-operation-on-crypto-cont.patch +++ /dev/null @@ -1,107 +0,0 @@ -From 3ad31f4efe9674a8bda057c79995a9468281e77f Mon Sep 17 00:00:00 2001 -From: Manikanta Pubbisetty -Date: Wed, 21 Nov 2018 16:33:48 +0530 -Subject: [PATCH] {nl,mac}80211: allow 4addr AP operation on crypto controlled - devices - -As per the current design, for sw crypto controlled devices, it is -the device which has to advertise the support for AP/VLAN iftype -based on it's capability to tranmsit packets encrypted in software -(In VLAN functionality, group traffic generated for a specific -VLAN group is always encrypted in software). Commit db3bdcb9c3ff -("mac80211: allow AP_VLAN operation on crypto controlled devices") -has introduced this change. - -Since 4addr AP operation also uses AP/VLAN iftype, this conditional -way of advertising AP/VLAN support has broken 4addr AP mode operation on -crypto controlled devices which do not support VLAN functionality. - -For example: -In the case of ath10k driver, not all firmwares have support for VLAN -functionality but all can support 4addr AP operation. Because AP/VLAN -support is not advertised for these devices, 4addr AP operations are -also blocked. - -Fix this by allowing 4addr opertion on devices which do not advertise -AP/VLAN iftype but which can support 4addr operation (the desicion is -taken based on the wiphy flag WIPHY_FLAG_4ADDR_AP). - -Fixes: Commit db3bdcb9c3ff ("mac80211: allow AP_VLAN operation on -crypto controlled devices") -Signed-off-by: Manikanta Pubbisetty ---- - include/net/cfg80211.h | 3 ++- - net/mac80211/util.c | 4 +++- - net/wireless/core.c | 9 +++++++-- - net/wireless/nl80211.c | 10 ++++++++-- - 4 files changed, 20 insertions(+), 6 deletions(-) - ---- a/include/net/cfg80211.h -+++ b/include/net/cfg80211.h -@@ -3448,7 +3448,8 @@ struct cfg80211_ops { - * on wiphy_new(), but can be changed by the driver if it has a good - * reason to override the default - * @WIPHY_FLAG_4ADDR_AP: supports 4addr mode even on AP (with a single station -- * on a VLAN interface) -+ * on a VLAN interface). This flag also serves an extra purpose of -+ * supporting 4ADDR AP mode on devices which do not support AP/VLAN iftype. - * @WIPHY_FLAG_4ADDR_STATION: supports 4addr mode even as a station - * @WIPHY_FLAG_CONTROL_PORT_PROTOCOL: This device supports setting the - * control port protocol ethertype. The device also honours the ---- a/net/mac80211/util.c -+++ b/net/mac80211/util.c -@@ -3523,7 +3523,9 @@ int ieee80211_check_combinations(struct - } - - /* Always allow software iftypes */ -- if (local->hw.wiphy->software_iftypes & BIT(iftype)) { -+ if (local->hw.wiphy->software_iftypes & BIT(iftype) || -+ (iftype == NL80211_IFTYPE_AP_VLAN && -+ local->hw.wiphy->flags & WIPHY_FLAG_4ADDR_AP)) { - if (radar_detect) - return -EINVAL; - return 0; ---- a/net/wireless/core.c -+++ b/net/wireless/core.c -@@ -1351,8 +1351,13 @@ static int cfg80211_netdev_notifier_call - } - break; - case NETDEV_PRE_UP: -- if (!(wdev->wiphy->interface_modes & BIT(wdev->iftype))) -- return notifier_from_errno(-EOPNOTSUPP); -+ if (!(wdev->wiphy->interface_modes & BIT(wdev->iftype))) { -+ if (!(wdev->iftype == NL80211_IFTYPE_AP_VLAN && -+ rdev->wiphy.flags & WIPHY_FLAG_4ADDR_AP && -+ wdev->use_4addr)) -+ return notifier_from_errno(-EOPNOTSUPP); -+ } -+ - if (rfkill_blocked(rdev->rfkill)) - return notifier_from_errno(-ERFKILL); - break; ---- a/net/wireless/nl80211.c -+++ b/net/wireless/nl80211.c -@@ -3193,8 +3193,7 @@ static int nl80211_new_interface(struct - return -EINVAL; - } - -- if (!rdev->ops->add_virtual_intf || -- !(rdev->wiphy.interface_modes & (1 << type))) -+ if (!rdev->ops->add_virtual_intf) - return -EOPNOTSUPP; - - if ((type == NL80211_IFTYPE_P2P_DEVICE || type == NL80211_IFTYPE_NAN || -@@ -3213,6 +3212,13 @@ static int nl80211_new_interface(struct - return err; - } - -+ if (!(rdev->wiphy.interface_modes & (1 << type))) { -+ if (!(type == NL80211_IFTYPE_AP_VLAN && -+ rdev->wiphy.flags & WIPHY_FLAG_4ADDR_AP && -+ params.use_4addr)) -+ return -EOPNOTSUPP; -+ } -+ - err = nl80211_parse_mon_options(rdev, type, info, ¶ms); - if (err < 0) - return err; diff --git a/package/kernel/mac80211/patches/subsys/522-mac80211_configure_antenna_gain.patch b/package/kernel/mac80211/patches/subsys/522-mac80211_configure_antenna_gain.patch index b68010bfe7..4dcd7b5fcc 100644 --- a/package/kernel/mac80211/patches/subsys/522-mac80211_configure_antenna_gain.patch +++ b/package/kernel/mac80211/patches/subsys/522-mac80211_configure_antenna_gain.patch @@ -1,6 +1,6 @@ --- a/include/net/cfg80211.h +++ b/include/net/cfg80211.h -@@ -2959,6 +2959,7 @@ struct cfg80211_external_auth_params { +@@ -2968,6 +2968,7 @@ struct cfg80211_external_auth_params { * (as advertised by the nl80211 feature flag.) * @get_tx_power: store the current TX power into the dbm variable; * return 0 if successful @@ -8,7 +8,7 @@ * * @set_wds_peer: set the WDS peer for a WDS interface * -@@ -3259,6 +3260,7 @@ struct cfg80211_ops { +@@ -3268,6 +3269,7 @@ struct cfg80211_ops { enum nl80211_tx_power_setting type, int mbm); int (*get_tx_power)(struct wiphy *wiphy, struct wireless_dev *wdev, int *dbm); @@ -18,7 +18,7 @@ const u8 *addr); --- a/include/net/mac80211.h +++ b/include/net/mac80211.h -@@ -1389,6 +1389,7 @@ enum ieee80211_smps_mode { +@@ -1395,6 +1395,7 @@ enum ieee80211_smps_mode { * * @power_level: requested transmit power (in dBm), backward compatibility * value only that is set to the minimum of all interfaces @@ -26,7 +26,7 @@ * * @chandef: the channel definition to tune to * @radar_enabled: whether radar detection is enabled -@@ -1409,6 +1410,7 @@ enum ieee80211_smps_mode { +@@ -1415,6 +1416,7 @@ enum ieee80211_smps_mode { struct ieee80211_conf { u32 flags; int power_level, dynamic_ps_timeout; @@ -36,45 +36,20 @@ u8 ps_dtim_period; --- a/include/uapi/linux/nl80211.h +++ b/include/uapi/linux/nl80211.h -@@ -2241,6 +2241,26 @@ enum nl80211_commands { - * association request when used with NL80211_CMD_NEW_STATION). Can be set - * only if %NL80211_STA_FLAG_WME is set. +@@ -2244,6 +2244,9 @@ enum nl80211_commands { + * @NL80211_ATTR_AIRTIME_WEIGHT: Station's weight when scheduled by the airtime + * scheduler. * -+ * @NL80211_ATTR_FTM_RESPONDER: nested attribute which user-space can include -+ * in %NL80211_CMD_START_AP or %NL80211_CMD_SET_BEACON for fine timing -+ * measurement (FTM) responder functionality and containing parameters as -+ * possible, see &enum nl80211_ftm_responder_attr -+ * -+ * @NL80211_ATTR_FTM_RESPONDER_STATS: Nested attribute with FTM responder -+ * statistics, see &enum nl80211_ftm_responder_stats. -+ * -+ * @NL80211_ATTR_TIMEOUT: Timeout for the given operation in milliseconds (u32), -+ * if the attribute is not given no timeout is requested. Note that 0 is an -+ * invalid value. -+ * -+ * @NL80211_ATTR_PEER_MEASUREMENTS: peer measurements request (and result) -+ * data, uses nested attributes specified in -+ * &enum nl80211_peer_measurement_attrs. -+ * This is also used for capability advertisement in the wiphy information, -+ * with the appropriate sub-attributes. + * @NL80211_ATTR_WIPHY_ANTENNA_GAIN: Configured antenna gain. Used to reduce + * transmit power to stay within regulatory limits. u32, dBi. + * * @NUM_NL80211_ATTR: total number of nl80211_attrs available * @NL80211_ATTR_MAX: highest attribute number currently defined * @__NL80211_ATTR_AFTER_LAST: internal use -@@ -2682,6 +2702,16 @@ enum nl80211_attrs { +@@ -2693,6 +2696,8 @@ enum nl80211_attrs { - NL80211_ATTR_HE_CAPABILITY, + NL80211_ATTR_AIRTIME_WEIGHT, -+ NL80211_ATTR_FTM_RESPONDER, -+ -+ NL80211_ATTR_FTM_RESPONDER_STATS, -+ -+ NL80211_ATTR_TIMEOUT, -+ -+ NL80211_ATTR_PEER_MEASUREMENTS, -+ + NL80211_ATTR_WIPHY_ANTENNA_GAIN, + /* add attributes here, update the policy in nl80211.c */ @@ -82,7 +57,7 @@ __NL80211_ATTR_AFTER_LAST, --- a/net/mac80211/cfg.c +++ b/net/mac80211/cfg.c -@@ -2494,6 +2494,19 @@ static int ieee80211_get_tx_power(struct +@@ -2505,6 +2505,19 @@ static int ieee80211_get_tx_power(struct return 0; } @@ -102,7 +77,7 @@ static int ieee80211_set_wds_peer(struct wiphy *wiphy, struct net_device *dev, const u8 *addr) { -@@ -3861,6 +3874,7 @@ const struct cfg80211_ops mac80211_confi +@@ -3872,6 +3885,7 @@ const struct cfg80211_ops mac80211_confi .set_wiphy_params = ieee80211_set_wiphy_params, .set_tx_power = ieee80211_set_tx_power, .get_tx_power = ieee80211_get_tx_power, @@ -112,7 +87,7 @@ CFG80211_TESTMODE_CMD(ieee80211_testmode_cmd) --- a/net/mac80211/ieee80211_i.h +++ b/net/mac80211/ieee80211_i.h -@@ -1354,6 +1354,7 @@ struct ieee80211_local { +@@ -1365,6 +1365,7 @@ struct ieee80211_local { int dynamic_ps_forced_timeout; int user_power_level; /* in dBm, for all interfaces */ @@ -154,15 +129,15 @@ local->user_power_level = IEEE80211_UNSET_POWER_LEVEL; --- a/net/wireless/nl80211.c +++ b/net/wireless/nl80211.c -@@ -430,6 +430,7 @@ static const struct nla_policy nl80211_p - [NL80211_ATTR_TXQ_QUANTUM] = { .type = NLA_U32 }, +@@ -431,6 +431,7 @@ static const struct nla_policy nl80211_p [NL80211_ATTR_HE_CAPABILITY] = { .type = NLA_BINARY, .len = NL80211_HE_MAX_CAPABILITY_LEN }, + [NL80211_ATTR_AIRTIME_WEIGHT] = NLA_POLICY_MIN(NLA_U16, 1), + [NL80211_ATTR_WIPHY_ANTENNA_GAIN] = { .type = NLA_U32 }, }; /* policy for the key attributes */ -@@ -2587,6 +2588,20 @@ static int nl80211_set_wiphy(struct sk_b +@@ -2588,6 +2589,20 @@ static int nl80211_set_wiphy(struct sk_b if (result) return result; } diff --git a/package/kernel/rotary-gpio-custom/Makefile b/package/kernel/rotary-gpio-custom/Makefile deleted file mode 100644 index 380659025b..0000000000 --- a/package/kernel/rotary-gpio-custom/Makefile +++ /dev/null @@ -1,47 +0,0 @@ -# -# Copyright (C) 2008-2010 OpenWrt.org -# -# This is free software, licensed under the GNU General Public License v2. -# See /LICENSE for more information. -# - -include $(TOPDIR)/rules.mk -include $(INCLUDE_DIR)/kernel.mk - -PKG_NAME:=rotary-gpio-custom -PKG_RELEASE:=1 - -include $(INCLUDE_DIR)/package.mk - -define KernelPackage/rotary-gpio-custom - SUBMENU:=Other modules - TITLE:=Custom GPIO-based rotary encoder device - DEPENDS:=@GPIO_SUPPORT +kmod-input-gpio-encoder @LINUX_3_18 - FILES:=$(PKG_BUILD_DIR)/rotary-gpio-custom.ko - KCONFIG:= -endef - -define KernelPackage/rotary-gpio-custom/description - Kernel module for register a custom rotary-gpio-encoder platform device. -endef - -EXTRA_KCONFIG:= \ - CONFIG_ROTARY_GPIO_CUSTOM=m - -EXTRA_CFLAGS:= \ - $(patsubst CONFIG_%, -DCONFIG_%=1, $(patsubst %=m,%,$(filter %=m,$(EXTRA_KCONFIG)))) \ - $(patsubst CONFIG_%, -DCONFIG_%=1, $(patsubst %=y,%,$(filter %=y,$(EXTRA_KCONFIG)))) \ - -MAKE_OPTS:= \ - $(KERNEL_MAKE_FLAGS) \ - SUBDIRS="$(PKG_BUILD_DIR)" \ - EXTRA_CFLAGS="$(EXTRA_CFLAGS)" \ - $(EXTRA_KCONFIG) - -define Build/Compile - $(MAKE) -C "$(LINUX_DIR)" \ - $(MAKE_OPTS) \ - modules -endef - -$(eval $(call KernelPackage,rotary-gpio-custom)) diff --git a/package/kernel/rotary-gpio-custom/src/Kconfig b/package/kernel/rotary-gpio-custom/src/Kconfig deleted file mode 100644 index b4d55d5354..0000000000 --- a/package/kernel/rotary-gpio-custom/src/Kconfig +++ /dev/null @@ -1,9 +0,0 @@ -config ROTARY_GPIO_CUSTOM - tristate "Custom GPIO-based rotary driver" - depends on GENERIC_GPIO - help - This is a driver to register 1 to 4 custom rotary encoder using - GPIO lines. - - This support is also available as a module. If so, the module - will be called rotary-gpio-custom. diff --git a/package/kernel/rotary-gpio-custom/src/Makefile b/package/kernel/rotary-gpio-custom/src/Makefile deleted file mode 100644 index 133672687b..0000000000 --- a/package/kernel/rotary-gpio-custom/src/Makefile +++ /dev/null @@ -1 +0,0 @@ -obj-${CONFIG_ROTARY_GPIO_CUSTOM} += rotary-gpio-custom.o diff --git a/package/kernel/rotary-gpio-custom/src/rotary-gpio-custom.c b/package/kernel/rotary-gpio-custom/src/rotary-gpio-custom.c deleted file mode 100644 index 9a16e45287..0000000000 --- a/package/kernel/rotary-gpio-custom/src/rotary-gpio-custom.c +++ /dev/null @@ -1,193 +0,0 @@ -/* - * Custom GPIO-based rotary driver - * - * Copyright (C) 2010 Claudio Mignanti - * - * 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. - * - * Strongly based on Custom GPIO-based I2C driver by: - * Copyright (C) 2007-2008 Gabor Juhos - * - * --------------------------------------------------------------------------- - * - * The behaviour of this driver can be altered by setting some parameters - * from the insmod command line. - * - * The following parameters are adjustable: - * - * bus0 These four arguments can be arrays of - * bus1 1-8 unsigned integers as follows: - * bus2 - * bus3 ,,,,, - * - * - * If this driver is built into the kernel, you can use the following kernel - * command line parameters, with the same values as the corresponding module - * parameters listed above: - * - * rotary-gpio-custom.bus0 - * rotary-gpio-custom.bus1 - * rotary-gpio-custom.bus2 - * rotary-gpio-custom.bus3 - */ - -#include -#include -#include -#include -#include -#include - -#define DRV_NAME "rotary-gpio-custom" -#define DRV_DESC "Custom GPIO-based rotary driver" -#define DRV_VERSION "0.1.0" - -#define PFX DRV_NAME ": " - -#define BUS_PARAM_REQUIRED 5 -#define BUS_PARAM_COUNT 6 -#define BUS_COUNT_MAX 4 - -static unsigned int bus0[BUS_PARAM_COUNT] __initdata; -static unsigned int bus1[BUS_PARAM_COUNT] __initdata; -static unsigned int bus2[BUS_PARAM_COUNT] __initdata; -static unsigned int bus3[BUS_PARAM_COUNT] __initdata; - -static unsigned int bus_nump[BUS_COUNT_MAX] __initdata; - -#define BUS_PARM_DESC \ - " config -> id,steps,axis,gpioa,gpiob[,inverted]" - -module_param_array(bus0, uint, &bus_nump[0], 0); -MODULE_PARM_DESC(bus0, "bus0" BUS_PARM_DESC); -module_param_array(bus1, uint, &bus_nump[1], 0); -MODULE_PARM_DESC(bus1, "bus1" BUS_PARM_DESC); -module_param_array(bus2, uint, &bus_nump[2], 0); -MODULE_PARM_DESC(bus2, "bus2" BUS_PARM_DESC); -module_param_array(bus3, uint, &bus_nump[3], 0); -MODULE_PARM_DESC(bus3, "bus3" BUS_PARM_DESC); - -static struct platform_device *devices[BUS_COUNT_MAX]; -static unsigned int nr_devices; - -static void rotary_gpio_custom_cleanup(void) -{ - int i; - - for (i = 0; i < nr_devices; i++) - if (devices[i]) - platform_device_put(devices[i]); -} - -static int __init rotary_gpio_custom_add_one(unsigned int id, - unsigned int *params) -{ - struct platform_device *pdev; - struct rotary_encoder_platform_data pdata; - int err; - - if (!bus_nump[id]) - return 0; - - if (bus_nump[id] < BUS_PARAM_REQUIRED) { - printk(KERN_ERR PFX "not enough parameters for bus%d\n", id); - err = -EINVAL; - goto err; - } - - pdev = platform_device_alloc("rotary-gpio", params[0]); - if (!pdev) { - err = -ENOMEM; - goto err; - } - - pdata.steps = params[1]; - pdata.axis = params[2]; - pdata.relative_axis = false; - pdata.rollover = false; - pdata.gpio_a = params[3]; - pdata.gpio_b = params[4]; - - if (params[5] == 1) { - pdata.inverted_a = 1; - pdata.inverted_b = 1; - } else { - pdata.inverted_a = 0; - pdata.inverted_b = 0; - } - - err = platform_device_add_data(pdev, &pdata, sizeof(pdata)); - if (err) - goto err_put; - - err = platform_device_add(pdev); - if (err) - goto err_put; - - devices[nr_devices++] = pdev; - return 0; - -err_put: - platform_device_put(pdev); -err: - return err; -} - -static int __init rotary_gpio_custom_probe(void) -{ - int err; - - printk(KERN_INFO DRV_DESC " version " DRV_VERSION "\n"); - - err = rotary_gpio_custom_add_one(0, bus0); - if (err) - goto err; - - err = rotary_gpio_custom_add_one(1, bus1); - if (err) - goto err; - - err = rotary_gpio_custom_add_one(2, bus2); - if (err) - goto err; - - err = rotary_gpio_custom_add_one(3, bus3); - if (err) - goto err; - - if (!nr_devices) { - printk(KERN_ERR PFX "no bus parameter(s) specified\n"); - err = -ENODEV; - goto err; - } - - return 0; - -err: - rotary_gpio_custom_cleanup(); - return err; -} - -#ifdef MODULE -static int __init rotary_gpio_custom_init(void) -{ - return rotary_gpio_custom_probe(); -} -module_init(rotary_gpio_custom_init); - -static void __exit rotary_gpio_custom_exit(void) -{ - rotary_gpio_custom_cleanup(); -} -module_exit(rotary_gpio_custom_exit); -#else -subsys_initcall(rotary_gpio_custom_probe); -#endif /* MODULE*/ - -MODULE_LICENSE("GPL v2"); -MODULE_AUTHOR("Gabor Juhos "); -MODULE_AUTHOR("Claudio Mignanti "); -MODULE_DESCRIPTION(DRV_DESC); -MODULE_VERSION(DRV_VERSION); diff --git a/package/libs/elfutils/Makefile b/package/libs/elfutils/Makefile index 0b3cecdfbd..e148df096c 100644 --- a/package/libs/elfutils/Makefile +++ b/package/libs/elfutils/Makefile @@ -8,12 +8,12 @@ include $(TOPDIR)/rules.mk PKG_NAME:=elfutils -PKG_VERSION:=0.175 -PKG_RELEASE:=4 +PKG_VERSION:=0.176 +PKG_RELEASE:=2 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2 PKG_SOURCE_URL:=https://sourceware.org/$(PKG_NAME)/ftp/$(PKG_VERSION) -PKG_HASH:=f7ef925541ee32c6d15ae5cb27da5f119e01a5ccdbe9fe57bf836730d7b7a65b +PKG_HASH:=eb5747c371b0af0f71e86215a5ebb88728533c3a104a43d4231963f308cd1023 PKG_MAINTAINER:=Luiz Angelo Daros de Luca PKG_LICENSE:=GPL-3.0+ PKG_LICENSE_FILES:=COPYING COPYING-GPLV2 COPYING-LGPLV3 diff --git a/package/libs/elfutils/patches/003-libintl-compatibility.patch b/package/libs/elfutils/patches/003-libintl-compatibility.patch index 35a27113eb..32bfaf8e6d 100644 --- a/package/libs/elfutils/patches/003-libintl-compatibility.patch +++ b/package/libs/elfutils/patches/003-libintl-compatibility.patch @@ -60,7 +60,7 @@ Requires.private: zlib --- a/configure.ac +++ b/configure.ac -@@ -538,6 +538,9 @@ AC_CONFIG_FILES([config/libelf.pc config +@@ -543,6 +543,9 @@ AC_CONFIG_FILES([config/libelf.pc config AC_SUBST(USE_NLS, yes) AM_PO_SUBDIRS diff --git a/package/libs/elfutils/patches/200-uclibc-ng-compat.patch b/package/libs/elfutils/patches/200-uclibc-ng-compat.patch new file mode 100644 index 0000000000..cb569428c3 --- /dev/null +++ b/package/libs/elfutils/patches/200-uclibc-ng-compat.patch @@ -0,0 +1,38 @@ +From: Rosen Penev +Date: Fri, 3 May 2019 17:59:55 +0000 (-0700) +Subject: lib/color: Fix compilation with uClibc +X-Git-Url: https://sourceware.org/git/?p=elfutils.git;a=commitdiff_plain;h=b5e8a481d4c9f9cdb26513784c09c57797fa2f46;hp=4628b0ea03a0d029cccbcda1cbfc450b4c5ad1bf + +lib/color: Fix compilation with uClibc + +elfutils passed -Werror and this call errors on uClibc with a mismatching +pointer type. Cast to char * to fix. + +Signed-off-by: Rosen Penev +--- + +diff --git a/lib/ChangeLog b/lib/ChangeLog +index 0914b2c..7381860 100644 +--- a/lib/ChangeLog ++++ b/lib/ChangeLog +@@ -1,3 +1,7 @@ ++2019-05-03 Rosen Penev ++ ++ * color.c (parse_opt): Cast program_invocation_short_name to char *. ++ + 2018-11-04 Mark Wielaard + + * bpf.h: Add BPF_JLT, BPF_JLE, BPF_JSLT and BPF_JSLE. +diff --git a/lib/color.c b/lib/color.c +index 9ffbf55..20b9698 100644 +--- a/lib/color.c ++++ b/lib/color.c +@@ -132,7 +132,7 @@ valid arguments are:\n\ + - 'auto', 'tty', 'if-tty'\n"), + program_invocation_short_name, arg); + argp_help (&color_argp, stderr, ARGP_HELP_SEE, +- program_invocation_short_name); ++ (char *) program_invocation_short_name); + exit (EXIT_FAILURE); + } + } diff --git a/package/libs/libbsd/Makefile b/package/libs/libbsd/Makefile index 4101d5e0ee..63b9ceafc3 100644 --- a/package/libs/libbsd/Makefile +++ b/package/libs/libbsd/Makefile @@ -2,7 +2,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=libbsd PKG_VERSION:=0.8.7 -PKG_RELEASE:=2 +PKG_RELEASE:=3 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz PKG_HASH:=f548f10e5af5a08b1e22889ce84315b1ebe41505b015c9596bad03fd13a12b31 diff --git a/package/libs/libbsd/patches/010-fix-arc.patch b/package/libs/libbsd/patches/010-fix-arc.patch new file mode 100644 index 0000000000..64948c6d67 --- /dev/null +++ b/package/libs/libbsd/patches/010-fix-arc.patch @@ -0,0 +1,30 @@ +From f60b6777cc2047f9845de2c88cf092b045c160c0 Mon Sep 17 00:00:00 2001 +From: Rosen Penev +Date: Fri, 17 May 2019 01:44:56 +0000 +Subject: [PATCH] local-elf: Add ARC support + +Signed-off-by: Rosen Penev +--- + src/local-elf.h | 6 ++++++ + 1 file changed, 6 insertions(+) + +diff --git a/src/local-elf.h b/src/local-elf.h +index 83ca253..b90baf3 100644 +--- a/src/local-elf.h ++++ b/src/local-elf.h +@@ -53,6 +53,12 @@ + #endif + #define ELF_TARG_DATA ELFDATA2LSB + ++#elif defined (__arc__) ++ ++#define ELF_TARG_MACH EM_ARC ++#define ELF_TARG_CLASS ELFCLASS32 ++#define ELF_TARG_DATA ELFDATA2LSB ++ + #elif defined(__arm__) + + #define ELF_TARG_MACH EM_ARM +-- +2.18.1 + diff --git a/package/libs/libnftnl/Makefile b/package/libs/libnftnl/Makefile index e55780e0f6..42aa3381a1 100644 --- a/package/libs/libnftnl/Makefile +++ b/package/libs/libnftnl/Makefile @@ -8,12 +8,12 @@ include $(TOPDIR)/rules.mk PKG_NAME:=libnftnl -PKG_VERSION:=1.1.1 -PKG_RELEASE:=2 +PKG_VERSION:=1.1.2 +PKG_RELEASE:=1 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2 PKG_SOURCE_URL:=https://netfilter.org/projects/$(PKG_NAME)/files -PKG_HASH:=5d6a65413f27ec635eedf6aba033f7cf671d462a2afeacc562ba96b19893aff2 +PKG_HASH:=a5c7b7a6c13c9c5898b13fcb1126fefce2015d5a96d7c354b19aaa40b6aece5d PKG_MAINTAINER:=Steven Barth PKG_LICENSE:=GPL-2.0+ diff --git a/package/libs/libroxml/Makefile b/package/libs/libroxml/Makefile index d4d3e0e02e..f60312b1ed 100644 --- a/package/libs/libroxml/Makefile +++ b/package/libs/libroxml/Makefile @@ -8,12 +8,12 @@ include $(TOPDIR)/rules.mk PKG_NAME:=libroxml -PKG_VERSION:=2.3.0 -PKG_RELEASE:=3 +PKG_VERSION:=3.0.2 +PKG_RELEASE:=1 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz -PKG_SOURCE_URL:=http://download.libroxml.net/pool/v2.x -PKG_HASH:=1da8f20b530eba4409f2b217587d2f1281ff5d9ba45b24aeac71b94c6c621b78 +PKG_SOURCE_URL:=http://download.libroxml.net/pool/v3.x +PKG_HASH:=ed6d68d1bceabf98e5e76907411e2e4d93b2dbd48479ab41dede851f59dad6a3 PKG_MAINTAINER:=Felix Fietkau PKG_INSTALL:=1 @@ -27,7 +27,7 @@ define Package/libroxml CATEGORY:=Libraries TITLE:=Minimum, easy-to-use, C implementation for xml file parsing URL:=http://www.libroxml.net/ - ABI_VERSION:=0 + ABI_VERSION:=3.0.2 endef CONFIGURE_ARGS += \ diff --git a/package/libs/libunwind/Makefile b/package/libs/libunwind/Makefile index 2e4b11b8bc..994ee97a17 100644 --- a/package/libs/libunwind/Makefile +++ b/package/libs/libunwind/Makefile @@ -1,6 +1,6 @@ # # Copyright (C) 2008-2013 OpenWrt.org -# Copyright (C) 2017 Yousong Zhou +# Copyright (C) 2017-2019 Yousong Zhou # # This is free software, licensed under the GNU General Public License v2. # See /LICENSE for more information. @@ -9,12 +9,12 @@ include $(TOPDIR)/rules.mk PKG_NAME:=libunwind -PKG_VERSION:=1.2.1 -PKG_RELEASE:=3 +PKG_VERSION:=1.3.1 +PKG_RELEASE:=1 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz PKG_SOURCE_URL:=@SAVANNAH/$(PKG_NAME) -PKG_HASH:=3f3ecb90e28cbe53fba7a4a27ccce7aad188d3210bb1964a923a731a27a75acb +PKG_HASH:=43997a3939b6ccdf2f669b50fdb8a4d3205374728c2923ddc2354c65260214f8 PKG_FIXUP:=autoreconf PKG_INSTALL:=1 @@ -32,7 +32,7 @@ define Package/libunwind CATEGORY:=Libraries TITLE:=The libunwind project URL:=http://www.nongnu.org/libunwind/ - DEPENDS:=@(mips||mipsel||powerpc||i386||x86_64||arm||aarch64) + DEPENDS:=@((mips||mipsel||x86_64||arm||aarch64)||(USE_GLIBC&&(powerpc||i386))) ABI_VERSION:=8 endef @@ -42,6 +42,7 @@ endef CONFIGURE_ARGS += \ --disable-documentation \ + --disable-tests \ --enable-minidebuginfo=no \ diff --git a/package/libs/libunwind/patches/001-disable-tests.patch b/package/libs/libunwind/patches/001-disable-tests.patch deleted file mode 100644 index 667b6a71e2..0000000000 --- a/package/libs/libunwind/patches/001-disable-tests.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/Makefile.am -+++ b/Makefile.am -@@ -42,7 +42,7 @@ endif - - nodist_include_HEADERS = include/libunwind-common.h - --SUBDIRS = src tests -+SUBDIRS = src - - if CONFIG_DOCS - SUBDIRS += doc diff --git a/package/libs/mbedtls/Makefile b/package/libs/mbedtls/Makefile index de91ff20e9..a0c86592d7 100644 --- a/package/libs/mbedtls/Makefile +++ b/package/libs/mbedtls/Makefile @@ -8,13 +8,13 @@ include $(TOPDIR)/rules.mk PKG_NAME:=mbedtls -PKG_VERSION:=2.16.0 -PKG_RELEASE:=2 +PKG_VERSION:=2.16.1 +PKG_RELEASE:=1 PKG_USE_MIPS16:=0 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-gpl.tgz PKG_SOURCE_URL:=https://tls.mbed.org/download/ -PKG_HASH:=c8d7a4696287cb9533c455bdd65859106dbdd4472c125194387486e6d4df2799 +PKG_HASH:=7ab76eaefab0b02f26ca889230d553facb2598f3a8f077886c41ec1801d2131a PKG_BUILD_PARALLEL:=1 PKG_LICENSE:=GPL-2.0+ @@ -51,10 +51,10 @@ config LIBMBEDTLS_DEBUG_C default n help This option enables mbedtls library's debug functions. - + It increases the uncompressed libmbedtls binary size by around 60 KiB (for an ARMv5 platform). - + Usually, you don't need this, so don't select this if you're unsure. endef diff --git a/package/libs/mbedtls/patches/200-config.patch b/package/libs/mbedtls/patches/200-config.patch index 825d407c6f..da482eb027 100644 --- a/package/libs/mbedtls/patches/200-config.patch +++ b/package/libs/mbedtls/patches/200-config.patch @@ -17,7 +17,7 @@ /** * \def MBEDTLS_CIPHER_NULL_CIPHER -@@ -696,19 +696,19 @@ +@@ -716,19 +716,19 @@ * * Comment macros to disable the curve and functions for it */ @@ -46,7 +46,7 @@ /** * \def MBEDTLS_ECP_NIST_OPTIM -@@ -810,7 +810,7 @@ +@@ -830,7 +830,7 @@ * See dhm.h for more details. * */ @@ -55,7 +55,7 @@ /** * \def MBEDTLS_KEY_EXCHANGE_ECDHE_PSK_ENABLED -@@ -830,7 +830,7 @@ +@@ -850,7 +850,7 @@ * MBEDTLS_TLS_ECDHE_PSK_WITH_3DES_EDE_CBC_SHA * MBEDTLS_TLS_ECDHE_PSK_WITH_RC4_128_SHA */ @@ -64,7 +64,7 @@ /** * \def MBEDTLS_KEY_EXCHANGE_RSA_PSK_ENABLED -@@ -855,7 +855,7 @@ +@@ -875,7 +875,7 @@ * MBEDTLS_TLS_RSA_PSK_WITH_3DES_EDE_CBC_SHA * MBEDTLS_TLS_RSA_PSK_WITH_RC4_128_SHA */ @@ -73,7 +73,7 @@ /** * \def MBEDTLS_KEY_EXCHANGE_RSA_ENABLED -@@ -989,7 +989,7 @@ +@@ -1009,7 +1009,7 @@ * MBEDTLS_TLS_ECDH_ECDSA_WITH_CAMELLIA_128_GCM_SHA256 * MBEDTLS_TLS_ECDH_ECDSA_WITH_CAMELLIA_256_GCM_SHA384 */ @@ -82,7 +82,7 @@ /** * \def MBEDTLS_KEY_EXCHANGE_ECDH_RSA_ENABLED -@@ -1013,7 +1013,7 @@ +@@ -1033,7 +1033,7 @@ * MBEDTLS_TLS_ECDH_RSA_WITH_CAMELLIA_128_GCM_SHA256 * MBEDTLS_TLS_ECDH_RSA_WITH_CAMELLIA_256_GCM_SHA384 */ @@ -91,7 +91,7 @@ /** * \def MBEDTLS_KEY_EXCHANGE_ECJPAKE_ENABLED -@@ -1117,7 +1117,7 @@ +@@ -1137,7 +1137,7 @@ * This option is only useful if both MBEDTLS_SHA256_C and * MBEDTLS_SHA512_C are defined. Otherwise the available hash module is used. */ @@ -100,7 +100,7 @@ /** * \def MBEDTLS_ENTROPY_NV_SEED -@@ -1212,14 +1212,14 @@ +@@ -1232,14 +1232,14 @@ * Uncomment this macro to disable the use of CRT in RSA. * */ @@ -117,7 +117,7 @@ /** * \def MBEDTLS_SHA256_SMALLER -@@ -1373,7 +1373,7 @@ +@@ -1393,7 +1393,7 @@ * configuration of this extension). * */ @@ -126,7 +126,7 @@ /** * \def MBEDTLS_SSL_SRV_SUPPORT_SSLV2_CLIENT_HELLO -@@ -1548,7 +1548,7 @@ +@@ -1568,7 +1568,7 @@ * * Comment this macro to disable support for SSL session tickets */ @@ -135,7 +135,7 @@ /** * \def MBEDTLS_SSL_EXPORT_KEYS -@@ -1578,7 +1578,7 @@ +@@ -1598,7 +1598,7 @@ * * Comment this macro to disable support for truncated HMAC in SSL */ @@ -144,7 +144,7 @@ /** * \def MBEDTLS_SSL_TRUNCATED_HMAC_COMPAT -@@ -1637,7 +1637,7 @@ +@@ -1657,7 +1657,7 @@ * * Comment this to disable run-time checking and save ROM space */ @@ -153,7 +153,7 @@ /** * \def MBEDTLS_X509_ALLOW_EXTENSIONS_NON_V3 -@@ -1967,7 +1967,7 @@ +@@ -1987,7 +1987,7 @@ * MBEDTLS_TLS_PSK_WITH_CAMELLIA_128_GCM_SHA256 * MBEDTLS_TLS_PSK_WITH_CAMELLIA_128_CBC_SHA256 */ @@ -162,7 +162,7 @@ /** * \def MBEDTLS_ARIA_C -@@ -2033,7 +2033,7 @@ +@@ -2053,7 +2053,7 @@ * This module enables the AES-CCM ciphersuites, if other requisites are * enabled as well. */ @@ -171,7 +171,7 @@ /** * \def MBEDTLS_CERTS_C -@@ -2045,7 +2045,7 @@ +@@ -2065,7 +2065,7 @@ * * This module is used for testing (ssl_client/server). */ @@ -180,7 +180,7 @@ /** * \def MBEDTLS_CHACHA20_C -@@ -2149,7 +2149,7 @@ +@@ -2169,7 +2169,7 @@ * \warning DES is considered a weak cipher and its use constitutes a * security risk. We recommend considering stronger ciphers instead. */ @@ -189,7 +189,7 @@ /** * \def MBEDTLS_DHM_C -@@ -2312,7 +2312,7 @@ +@@ -2332,7 +2332,7 @@ * This module adds support for the Hashed Message Authentication Code * (HMAC)-based key derivation function (HKDF). */ @@ -198,7 +198,7 @@ /** * \def MBEDTLS_HMAC_DRBG_C -@@ -2622,7 +2622,7 @@ +@@ -2642,7 +2642,7 @@ * * This module enables abstraction of common (libc) functions. */ @@ -207,7 +207,7 @@ /** * \def MBEDTLS_POLY1305_C -@@ -2643,7 +2643,7 @@ +@@ -2663,7 +2663,7 @@ * Caller: library/md.c * */ @@ -216,7 +216,7 @@ /** * \def MBEDTLS_RSA_C -@@ -2750,7 +2750,7 @@ +@@ -2770,7 +2770,7 @@ * * Requires: MBEDTLS_CIPHER_C */ @@ -225,7 +225,7 @@ /** * \def MBEDTLS_SSL_CLI_C -@@ -2850,7 +2850,7 @@ +@@ -2870,7 +2870,7 @@ * * This module provides run-time version information. */ @@ -234,7 +234,7 @@ /** * \def MBEDTLS_X509_USE_C -@@ -2960,7 +2960,7 @@ +@@ -2980,7 +2980,7 @@ * Module: library/xtea.c * Caller: */ diff --git a/package/libs/mbedtls/patches/300-bn_mul.h-Use-optimized-MULADDC-code-only-on-ARM-6.patch b/package/libs/mbedtls/patches/300-bn_mul.h-Use-optimized-MULADDC-code-only-on-ARM-6.patch index b6c60f0019..757d83f49c 100644 --- a/package/libs/mbedtls/patches/300-bn_mul.h-Use-optimized-MULADDC-code-only-on-ARM-6.patch +++ b/package/libs/mbedtls/patches/300-bn_mul.h-Use-optimized-MULADDC-code-only-on-ARM-6.patch @@ -15,7 +15,7 @@ Signed-off-by: Hauke Mehrtens --- a/include/mbedtls/bn_mul.h +++ b/include/mbedtls/bn_mul.h -@@ -638,7 +638,8 @@ +@@ -644,7 +644,8 @@ "r6", "r7", "r8", "r9", "cc" \ ); diff --git a/package/libs/nghttp2/Makefile b/package/libs/nghttp2/Makefile index 7ebc83042e..14a4f728b4 100644 --- a/package/libs/nghttp2/Makefile +++ b/package/libs/nghttp2/Makefile @@ -1,12 +1,12 @@ include $(TOPDIR)/rules.mk PKG_NAME:=nghttp2 -PKG_VERSION:=1.36.0 -PKG_RELEASE:=2 +PKG_VERSION:=1.38.0 +PKG_RELEASE:=1 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz PKG_SOURCE_URL:=https://github.com/nghttp2/nghttp2/releases/download/v$(PKG_VERSION) -PKG_HASH:=e9bb86157b88eda5a6844a232e039febbb52c1aa44b640acbbfabe729b8287fc +PKG_HASH:=ef75c761858241c6b4372fa6397aa0481a984b84b7b07c4ec7dc2d7b9eee87f8 PKG_LICENSE:=MIT PKG_LICENSE_FILES:=COPYING diff --git a/package/libs/openssl/Config.in b/package/libs/openssl/Config.in index 8946463b7f..d4820c9ede 100644 --- a/package/libs/openssl/Config.in +++ b/package/libs/openssl/Config.in @@ -96,7 +96,6 @@ config OPENSSL_WITH_DTLS config OPENSSL_WITH_NPN bool - default y prompt "Enable NPN support" help NPN is a TLS extension, obsoleted and replaced with ALPN, @@ -246,25 +245,56 @@ comment "Engine/Hardware Support" config OPENSSL_ENGINE bool "Enable engine support" + default y help This enables alternative cryptography implementations, most commonly for interfacing with external crypto devices, or supporting new/alternative ciphers and digests. + If you compile the library with this option disabled, packages built + using an engine-enabled library (i.e. from the official repo) may + fail to run. Compile and install the packages with engine support + disabled, and you should be fine. Note that you need to enable KERNEL_AIO to be able to build the afalg engine package. -config OPENSSL_ENGINE_CRYPTO +config OPENSSL_ENGINE_BUILTIN + bool "Build chosen engines into libcrypto" + depends on OPENSSL_ENGINE + help + This builds all chosen engines into libcrypto.so, instead of building + them as dynamic engines in separate packages. + The benefit of building the engines into libcrypto is that they won't + require any configuration to be used by default. + +config OPENSSL_ENGINE_BUILTIN_AFALG bool - select OPENSSL_ENGINE - select PACKAGE_kmod-cryptodev + prompt "Acceleration support through AF_ALG sockets engine" + depends on OPENSSL_ENGINE_BUILTIN && KERNEL_AIO select PACKAGE_libopenssl-conf + help + This enables use of hardware acceleration through the + AF_ALG kernel interface. + +config OPENSSL_ENGINE_BUILTIN_DEVCRYPTO + bool prompt "Acceleration support through /dev/crypto" + depends on OPENSSL_ENGINE_BUILTIN + select PACKAGE_libopenssl-conf help This enables use of hardware acceleration through OpenBSD Cryptodev API (/dev/crypto) interface. - You must install kmod-cryptodev (under Kernel modules, Cryptographic - API modules) for /dev/crypto to show up and use hardware - acceleration; otherwise it falls back to software. + Even though configuration is not strictly needed, it is worth seeing + https://openwrt.org/docs/techref/hardware/cryptographic.hardware.accelerators + for information on how to configure the engine. + +config OPENSSL_ENGINE_BUILTIN_PADLOCK + bool + prompt "VIA Padlock Acceleration support engine" + depends on OPENSSL_ENGINE_BUILTIN && TARGET_x86 + select PACKAGE_libopenssl-conf + help + This enables use of hardware acceleration through the + VIA Padlock module. config OPENSSL_WITH_ASYNC bool diff --git a/package/libs/openssl/Makefile b/package/libs/openssl/Makefile index 7cde714f04..d16182ee91 100644 --- a/package/libs/openssl/Makefile +++ b/package/libs/openssl/Makefile @@ -9,14 +9,13 @@ include $(TOPDIR)/rules.mk PKG_NAME:=openssl PKG_BASE:=1.1.1 -PKG_BUGFIX:=b +PKG_BUGFIX:=c PKG_VERSION:=$(PKG_BASE)$(PKG_BUGFIX) PKG_RELEASE:=1 PKG_USE_MIPS16:=0 ENGINES_DIR=engines-1.1 -PKG_BUILD_PARALLEL:=0 -PKG_BUILD_DEPENDS:=cryptodev-linux +PKG_BUILD_PARALLEL:=1 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz PKG_SOURCE_URL:= \ @@ -25,14 +24,18 @@ PKG_SOURCE_URL:= \ ftp://ftp.pca.dfn.de/pub/tools/net/openssl/source/ \ http://www.openssl.org/source/ \ http://www.openssl.org/source/old/$(PKG_BASE)/ -PKG_HASH:=5c557b023230413dfb0756f3137a13e6d726838ccd1430888ad15bfb2b43ea4b +PKG_HASH:=f6fb3079ad15076154eda9413fed42877d668e7069d9b87396d0804fdb3f4c90 PKG_LICENSE:=OpenSSL PKG_LICENSE_FILES:=LICENSE +PKG_MAINTAINER:=Eneas U de Queiroz PKG_CPE_ID:=cpe:/a:openssl:openssl PKG_CONFIG_DEPENDS:= \ CONFIG_OPENSSL_ENGINE \ - CONFIG_OPENSSL_ENGINE_CRYPTO \ + CONFIG_OPENSSL_ENGINE_BUILTIN \ + CONFIG_OPENSSL_ENGINE_BUILTIN_AFALG \ + CONFIG_OPENSSL_ENGINE_BUILTIN_DEVCRYPTO \ + CONFIG_OPENSSL_ENGINE_BUILTIN_PADLOCK \ CONFIG_OPENSSL_NO_DEPRECATED \ CONFIG_OPENSSL_OPTIMIZE_SPEED \ CONFIG_OPENSSL_PREFER_CHACHA_OVER_GCM \ @@ -89,7 +92,10 @@ endef define Package/libopenssl $(call Package/openssl/Default) SUBMENU:=SSL - DEPENDS:=+OPENSSL_WITH_COMPRESSION:zlib + DEPENDS:=+OPENSSL_WITH_COMPRESSION:zlib \ + +OPENSSL_ENGINE_BUILTIN_AFALG:kmod-crypto-user \ + +OPENSSL_ENGINE_BUILTIN_DEVCRYPTO:kmod-cryptodev \ + +OPENSSL_ENGINE_BUILTIN_PADLOCK:kmod-crypto-hw-padlock TITLE+= (libraries) ABI_VERSION:=1.1 MENU:=1 @@ -133,8 +139,8 @@ define Package/libopenssl-afalg $(call Package/openssl/Default) SUBMENU:=SSL TITLE:=AFALG hardware acceleration engine - DEPENDS:=libopenssl @OPENSSL_ENGINE @KERNEL_AIO @!LINUX_3_18 +kmod-crypto-user \ - +libopenssl-conf + DEPENDS:=libopenssl @OPENSSL_ENGINE @KERNEL_AIO \ + +PACKAGE_libopenssl-afalg:kmod-crypto-user +libopenssl-conf @!OPENSSL_ENGINE_BUILTIN endef define Package/libopenssl-afalg/description @@ -142,21 +148,40 @@ This package adds an engine that enables hardware acceleration through the AF_ALG kernel interface. To use it, you need to configure the engine in /etc/ssl/openssl.cnf See https://www.openssl.org/docs/man1.1.1/man5/config.html#Engine-Configuration-Module +and https://openwrt.org/docs/techref/hardware/cryptographic.hardware.accelerators The engine_id is "afalg" endef +define Package/libopenssl-devcrypto + $(call Package/openssl/Default) + SUBMENU:=SSL + TITLE:=/dev/crypto hardware acceleration engine + DEPENDS:=libopenssl @OPENSSL_ENGINE +PACKAGE_libopenssl-devcrypto:kmod-cryptodev +libopenssl-conf \ + @!OPENSSL_ENGINE_BUILTIN +endef + +define Package/libopenssl-devcrypto/description +This package adds an engine that enables hardware acceleration +through the /dev/crypto kernel interface. +To use it, you need to configure the engine in /etc/ssl/openssl.cnf +See https://www.openssl.org/docs/man1.1.1/man5/config.html#Engine-Configuration-Module +and https://openwrt.org/docs/techref/hardware/cryptographic.hardware.accelerators +The engine_id is "devcrypto" +endef + define Package/libopenssl-padlock $(call Package/openssl/Default) SUBMENU:=SSL TITLE:=VIA Padlock hardware acceleration engine - DEPENDS:=libopenssl @OPENSSL_ENGINE @TARGET_x86 +kmod-crypto-hw-padlock \ - +libopenssl-conf + DEPENDS:=libopenssl @OPENSSL_ENGINE @TARGET_x86 +PACKAGE_libopenssl-padlock:kmod-crypto-hw-padlock \ + +libopenssl-conf @!OPENSSL_ENGINE_BUILTIN endef define Package/libopenssl-padlock/description This package adds an engine that enables VIA Padlock hardware acceleration. To use it, you need to configure it in /etc/ssl/openssl.cnf. See https://www.openssl.org/docs/man1.1.1/man5/config.html#Engine-Configuration-Module +and https://openwrt.org/docs/techref/hardware/cryptographic.hardware.accelerators The engine_id is "padlock" endef @@ -241,14 +266,27 @@ else endif ifdef CONFIG_OPENSSL_ENGINE - ifdef CONFIG_OPENSSL_ENGINE_CRYPTO - OPENSSL_OPTIONS += enable-devcryptoeng - endif - ifndef CONFIG_PACKAGE_libopenssl-afalg - OPENSSL_OPTIONS += no-afalgeng - endif - ifndef CONFIG_PACKAGE_libopenssl-padlock - OPENSSL_OPTIONS += no-hw-padlock + ifdef CONFIG_OPENSSL_ENGINE_BUILTIN + OPENSSL_OPTIONS += disable-dynamic-engine + ifndef CONFIG_OPENSSL_ENGINE_BUILTIN_AFALG + OPENSSL_OPTIONS += no-afalgeng + endif + ifdef CONFIG_OPENSSL_ENGINE_BUILTIN_DEVCRYPTO + OPENSSL_OPTIONS += enable-devcryptoeng + endif + ifndef CONFIG_OPENSSL_ENGINE_BUILTIN_PADLOCK + OPENSSL_OPTIONS += no-hw-padlock + endif + else + ifdef CONFIG_PACKAGE_libopenssl-devcrypto + OPENSSL_OPTIONS += enable-devcryptoeng + endif + ifndef CONFIG_PACKAGE_libopenssl-afalg + OPENSSL_OPTIONS += no-afalgeng + endif + ifndef CONFIG_PACKAGE_libopenssl-padlock + OPENSSL_OPTIONS += no-hw-padlock + endif endif else OPENSSL_OPTIONS += no-engine @@ -361,6 +399,11 @@ define Package/libopenssl-afalg/install $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/$(ENGINES_DIR)/afalg.so $(1)/usr/lib/$(ENGINES_DIR) endef +define Package/libopenssl-devcrypto/install + $(INSTALL_DIR) $(1)/usr/lib/$(ENGINES_DIR) + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/$(ENGINES_DIR)/devcrypto.so $(1)/usr/lib/$(ENGINES_DIR) +endef + define Package/libopenssl-padlock/install $(INSTALL_DIR) $(1)/usr/lib/$(ENGINES_DIR) $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/$(ENGINES_DIR)/*padlock.so $(1)/usr/lib/$(ENGINES_DIR) @@ -369,5 +412,6 @@ endef $(eval $(call BuildPackage,libopenssl)) $(eval $(call BuildPackage,libopenssl-conf)) $(eval $(call BuildPackage,libopenssl-afalg)) +$(eval $(call BuildPackage,libopenssl-devcrypto)) $(eval $(call BuildPackage,libopenssl-padlock)) $(eval $(call BuildPackage,openssl-util)) diff --git a/package/libs/openssl/patches/100-Configure-afalg-support.patch b/package/libs/openssl/patches/100-Configure-afalg-support.patch index 69b2e7fa77..5cd6ff2e0c 100644 --- a/package/libs/openssl/patches/100-Configure-afalg-support.patch +++ b/package/libs/openssl/patches/100-Configure-afalg-support.patch @@ -10,7 +10,7 @@ Signed-off-by: Eneas U de Queiroz --- a/Configure +++ b/Configure -@@ -1554,7 +1554,9 @@ unless ($disabled{"crypto-mdebug-backtra +@@ -1559,7 +1559,9 @@ unless ($disabled{"crypto-mdebug-backtra unless ($disabled{afalgeng}) { $config{afalgeng}=""; diff --git a/package/libs/openssl/patches/130-dont-build-tests-fuzz.patch b/package/libs/openssl/patches/130-dont-build-tests-fuzz.patch index 7c61b1e292..8b827737cd 100644 --- a/package/libs/openssl/patches/130-dont-build-tests-fuzz.patch +++ b/package/libs/openssl/patches/130-dont-build-tests-fuzz.patch @@ -9,7 +9,7 @@ Signed-off-by: Eneas U de Queiroz --- a/Configure +++ b/Configure -@@ -299,7 +299,7 @@ my $auto_threads=1; # enable threads +@@ -302,7 +302,7 @@ my $auto_threads=1; # enable threads my $default_ranlib; # Top level directories to build @@ -18,7 +18,7 @@ Signed-off-by: Eneas U de Queiroz # crypto/ subdirectories to build $config{sdirs} = [ "objects", -@@ -311,7 +311,7 @@ $config{sdirs} = [ +@@ -314,7 +314,7 @@ $config{sdirs} = [ "cms", "ts", "srp", "cmac", "ct", "async", "kdf", "store" ]; # test/ subdirectories to build diff --git a/package/libs/openssl/patches/140-allow-prefer-chacha20.patch b/package/libs/openssl/patches/140-allow-prefer-chacha20.patch index 9cbe221388..ecbb5c61db 100644 --- a/package/libs/openssl/patches/140-allow-prefer-chacha20.patch +++ b/package/libs/openssl/patches/140-allow-prefer-chacha20.patch @@ -37,7 +37,7 @@ Signed-off-by: Eneas U de Queiroz "TLS_AES_128_GCM_SHA256" --- a/ssl/ssl_ciph.c +++ b/ssl/ssl_ciph.c -@@ -1464,11 +1464,29 @@ STACK_OF(SSL_CIPHER) *ssl_create_cipher_ +@@ -1466,11 +1466,29 @@ STACK_OF(SSL_CIPHER) *ssl_create_cipher_ ssl_cipher_apply_rule(0, SSL_kECDHE, 0, 0, 0, 0, 0, CIPHER_DEL, -1, &head, &tail); @@ -67,7 +67,7 @@ Signed-off-by: Eneas U de Queiroz /* * ...and generally, our preferred cipher is AES. -@@ -1524,7 +1542,7 @@ STACK_OF(SSL_CIPHER) *ssl_create_cipher_ +@@ -1526,7 +1544,7 @@ STACK_OF(SSL_CIPHER) *ssl_create_cipher_ * Within each group, ciphers remain sorted by strength and previous * preference, i.e., * 1) ECDHE > DHE diff --git a/package/libs/openssl/patches/400-eng_devcrypto-save-ioctl-if-EVP_MD_.FLAG_ONESHOT.patch b/package/libs/openssl/patches/400-eng_devcrypto-save-ioctl-if-EVP_MD_.FLAG_ONESHOT.patch new file mode 100644 index 0000000000..ebc4aa988f --- /dev/null +++ b/package/libs/openssl/patches/400-eng_devcrypto-save-ioctl-if-EVP_MD_.FLAG_ONESHOT.patch @@ -0,0 +1,58 @@ +From 48e2c9202ea345347da91f4c583e5915eb010d50 Mon Sep 17 00:00:00 2001 +From: Eneas U de Queiroz +Date: Mon, 5 Nov 2018 15:54:17 -0200 +Subject: [PATCH 1/4] eng_devcrypto: save ioctl if EVP_MD_..FLAG_ONESHOT + +Since each ioctl causes a context switch, slowing things down, if +EVP_MD_CTX_FLAG_ONESHOT is set, then: + - call the ioctl in digest_update, saving the result; and + - just copy the result in digest_final, instead of using another ioctl. + +Signed-off-by: Eneas U de Queiroz + +Reviewed-by: Matthias St. Pierre +Reviewed-by: Richard Levitte +(Merged from https://github.com/openssl/openssl/pull/7585) + +--- a/crypto/engine/eng_devcrypto.c ++++ b/crypto/engine/eng_devcrypto.c +@@ -461,6 +461,7 @@ struct digest_ctx { + struct session_op sess; + /* This signals that the init function was called, not that it succeeded. */ + int init_called; ++ unsigned char digest_res[HASH_MAX_LEN]; + }; + + static const struct digest_data_st { +@@ -564,12 +565,15 @@ static int digest_update(EVP_MD_CTX *ctx + if (digest_ctx == NULL) + return 0; + +- if (digest_op(digest_ctx, data, count, NULL, COP_FLAG_UPDATE) < 0) { +- SYSerr(SYS_F_IOCTL, errno); +- return 0; ++ if (EVP_MD_CTX_test_flags(ctx, EVP_MD_CTX_FLAG_ONESHOT)) { ++ if (digest_op(digest_ctx, data, count, digest_ctx->digest_res, 0) >= 0) ++ return 1; ++ } else if (digest_op(digest_ctx, data, count, NULL, COP_FLAG_UPDATE) >= 0) { ++ return 1; + } + +- return 1; ++ SYSerr(SYS_F_IOCTL, errno); ++ return 0; + } + + static int digest_final(EVP_MD_CTX *ctx, unsigned char *md) +@@ -579,7 +583,10 @@ static int digest_final(EVP_MD_CTX *ctx, + + if (md == NULL || digest_ctx == NULL) + return 0; +- if (digest_op(digest_ctx, NULL, 0, md, COP_FLAG_FINAL) < 0) { ++ ++ if (EVP_MD_CTX_test_flags(ctx, EVP_MD_CTX_FLAG_ONESHOT)) { ++ memcpy(md, digest_ctx->digest_res, EVP_MD_CTX_size(ctx)); ++ } else if (digest_op(digest_ctx, NULL, 0, md, COP_FLAG_FINAL) < 0) { + SYSerr(SYS_F_IOCTL, errno); + return 0; + } diff --git a/package/libs/openssl/patches/410-eng_devcrypto-add-configuration-options.patch b/package/libs/openssl/patches/410-eng_devcrypto-add-configuration-options.patch new file mode 100644 index 0000000000..18a430e83d --- /dev/null +++ b/package/libs/openssl/patches/410-eng_devcrypto-add-configuration-options.patch @@ -0,0 +1,566 @@ +From 800272d22acf95070f22c870eca15bdba0539a6a Mon Sep 17 00:00:00 2001 +From: Eneas U de Queiroz +Date: Sat, 3 Nov 2018 15:41:10 -0300 +Subject: [PATCH 2/4] eng_devcrypto: add configuration options + +USE_SOFTDRIVERS: whether to use software (not accelerated) drivers +CIPHERS: list of ciphers to enable +DIGESTS: list of digests to enable + +Signed-off-by: Eneas U de Queiroz + +Reviewed-by: Matthias St. Pierre +Reviewed-by: Richard Levitte +(Merged from https://github.com/openssl/openssl/pull/7585) + +--- a/crypto/engine/eng_devcrypto.c ++++ b/crypto/engine/eng_devcrypto.c +@@ -16,6 +16,7 @@ + #include + #include + ++#include + #include + #include + #include +@@ -36,6 +37,30 @@ + * saner... why re-open /dev/crypto for every session? + */ + static int cfd; ++#define DEVCRYPTO_REQUIRE_ACCELERATED 0 /* require confirmation of acceleration */ ++#define DEVCRYPTO_USE_SOFTWARE 1 /* allow software drivers */ ++#define DEVCRYPTO_REJECT_SOFTWARE 2 /* only disallow confirmed software drivers */ ++ ++#define DEVCRYPTO_DEFAULT_USE_SOFDTRIVERS DEVCRYPTO_REJECT_SOFTWARE ++static int use_softdrivers = DEVCRYPTO_DEFAULT_USE_SOFDTRIVERS; ++ ++/* ++ * cipher/digest status & acceleration definitions ++ * Make sure the defaults are set to 0 ++ */ ++struct driver_info_st { ++ enum devcrypto_status_t { ++ DEVCRYPTO_STATUS_UNUSABLE = -1, /* session open failed */ ++ DEVCRYPTO_STATUS_UNKNOWN = 0, /* not tested yet */ ++ DEVCRYPTO_STATUS_USABLE = 1 /* algo can be used */ ++ } status; ++ ++ enum devcrypto_accelerated_t { ++ DEVCRYPTO_NOT_ACCELERATED = -1, /* software implemented */ ++ DEVCRYPTO_ACCELERATION_UNKNOWN = 0, /* acceleration support unkown */ ++ DEVCRYPTO_ACCELERATED = 1 /* hardware accelerated */ ++ } accelerated; ++}; + + static int clean_devcrypto_session(struct session_op *sess) { + if (ioctl(cfd, CIOCFSESSION, &sess->ses) < 0) { +@@ -119,13 +144,22 @@ static const struct cipher_data_st { + #endif + }; + +-static size_t get_cipher_data_index(int nid) ++static size_t find_cipher_data_index(int nid) + { + size_t i; + + for (i = 0; i < OSSL_NELEM(cipher_data); i++) + if (nid == cipher_data[i].nid) + return i; ++ return (size_t)-1; ++} ++ ++static size_t get_cipher_data_index(int nid) ++{ ++ size_t i = find_cipher_data_index(nid); ++ ++ if (i != (size_t)-1) ++ return i; + + /* + * Code further down must make sure that only NIDs in the table above +@@ -333,19 +367,40 @@ static int cipher_cleanup(EVP_CIPHER_CTX + } + + /* +- * Keep a table of known nids and associated methods. ++ * Keep tables of known nids, associated methods, selected ciphers, and driver ++ * info. + * Note that known_cipher_nids[] isn't necessarily indexed the same way as +- * cipher_data[] above, which known_cipher_methods[] is. ++ * cipher_data[] above, which the other tables are. + */ + static int known_cipher_nids[OSSL_NELEM(cipher_data)]; + static int known_cipher_nids_amount = -1; /* -1 indicates not yet initialised */ + static EVP_CIPHER *known_cipher_methods[OSSL_NELEM(cipher_data)] = { NULL, }; ++static int selected_ciphers[OSSL_NELEM(cipher_data)]; ++static struct driver_info_st cipher_driver_info[OSSL_NELEM(cipher_data)]; ++ ++ ++static int devcrypto_test_cipher(size_t cipher_data_index) ++{ ++ return (cipher_driver_info[cipher_data_index].status == DEVCRYPTO_STATUS_USABLE ++ && selected_ciphers[cipher_data_index] == 1 ++ && (cipher_driver_info[cipher_data_index].accelerated ++ == DEVCRYPTO_ACCELERATED ++ || use_softdrivers == DEVCRYPTO_USE_SOFTWARE ++ || (cipher_driver_info[cipher_data_index].accelerated ++ != DEVCRYPTO_NOT_ACCELERATED ++ && use_softdrivers == DEVCRYPTO_REJECT_SOFTWARE))); ++} + + static void prepare_cipher_methods(void) + { + size_t i; + struct session_op sess; + unsigned long cipher_mode; ++#ifdef CIOCGSESSINFO ++ struct session_info_op siop; ++#endif ++ ++ memset(&cipher_driver_info, 0, sizeof(cipher_driver_info)); + + memset(&sess, 0, sizeof(sess)); + sess.key = (void *)"01234567890123456789012345678901234567890123456789"; +@@ -353,15 +408,16 @@ static void prepare_cipher_methods(void) + for (i = 0, known_cipher_nids_amount = 0; + i < OSSL_NELEM(cipher_data); i++) { + ++ selected_ciphers[i] = 1; + /* +- * Check that the algo is really availably by trying to open and close +- * a session. ++ * Check that the cipher is usable + */ + sess.cipher = cipher_data[i].devcryptoid; + sess.keylen = cipher_data[i].keylen; +- if (ioctl(cfd, CIOCGSESSION, &sess) < 0 +- || ioctl(cfd, CIOCFSESSION, &sess.ses) < 0) ++ if (ioctl(cfd, CIOCGSESSION, &sess) < 0) { ++ cipher_driver_info[i].status = DEVCRYPTO_STATUS_UNUSABLE; + continue; ++ } + + cipher_mode = cipher_data[i].flags & EVP_CIPH_MODE; + +@@ -387,15 +443,41 @@ static void prepare_cipher_methods(void) + cipher_cleanup) + || !EVP_CIPHER_meth_set_impl_ctx_size(known_cipher_methods[i], + sizeof(struct cipher_ctx))) { ++ cipher_driver_info[i].status = DEVCRYPTO_STATUS_UNUSABLE; + EVP_CIPHER_meth_free(known_cipher_methods[i]); + known_cipher_methods[i] = NULL; + } else { ++ cipher_driver_info[i].status = DEVCRYPTO_STATUS_USABLE; ++#ifdef CIOCGSESSINFO ++ siop.ses = sess.ses; ++ if (ioctl(cfd, CIOCGSESSINFO, &siop) < 0) ++ cipher_driver_info[i].accelerated = DEVCRYPTO_ACCELERATION_UNKNOWN; ++ else if (!(siop.flags & SIOP_FLAG_KERNEL_DRIVER_ONLY)) ++ cipher_driver_info[i].accelerated = DEVCRYPTO_NOT_ACCELERATED; ++ else ++ cipher_driver_info[i].accelerated = DEVCRYPTO_ACCELERATED; ++#endif /* CIOCGSESSINFO */ ++ } ++ ioctl(cfd, CIOCFSESSION, &sess.ses); ++ if (devcrypto_test_cipher(i)) { + known_cipher_nids[known_cipher_nids_amount++] = + cipher_data[i].nid; + } + } + } + ++static void rebuild_known_cipher_nids(ENGINE *e) ++{ ++ size_t i; ++ ++ for (i = 0, known_cipher_nids_amount = 0; i < OSSL_NELEM(cipher_data); i++) { ++ if (devcrypto_test_cipher(i)) ++ known_cipher_nids[known_cipher_nids_amount++] = cipher_data[i].nid; ++ } ++ ENGINE_unregister_ciphers(e); ++ ENGINE_register_ciphers(e); ++} ++ + static const EVP_CIPHER *get_cipher_method(int nid) + { + size_t i = get_cipher_data_index(nid); +@@ -438,6 +520,36 @@ static int devcrypto_ciphers(ENGINE *e, + return *cipher != NULL; + } + ++static void devcrypto_select_all_ciphers(int *cipher_list) ++{ ++ size_t i; ++ ++ for (i = 0; i < OSSL_NELEM(cipher_data); i++) ++ cipher_list[i] = 1; ++} ++ ++static int cryptodev_select_cipher_cb(const char *str, int len, void *usr) ++{ ++ int *cipher_list = (int *)usr; ++ char *name; ++ const EVP_CIPHER *EVP; ++ size_t i; ++ ++ if (len == 0) ++ return 1; ++ if (usr == NULL || (name = OPENSSL_strndup(str, len)) == NULL) ++ return 0; ++ EVP = EVP_get_cipherbyname(name); ++ if (EVP == NULL) ++ fprintf(stderr, "devcrypto: unknown cipher %s\n", name); ++ else if ((i = find_cipher_data_index(EVP_CIPHER_nid(EVP))) != (size_t)-1) ++ cipher_list[i] = 1; ++ else ++ fprintf(stderr, "devcrypto: cipher %s not available\n", name); ++ OPENSSL_free(name); ++ return 1; ++} ++ + /* + * We only support digests if the cryptodev implementation supports multiple + * data updates and session copying. Otherwise, we would be forced to maintain +@@ -493,13 +605,22 @@ static const struct digest_data_st { + #endif + }; + +-static size_t get_digest_data_index(int nid) ++static size_t find_digest_data_index(int nid) + { + size_t i; + + for (i = 0; i < OSSL_NELEM(digest_data); i++) + if (nid == digest_data[i].nid) + return i; ++ return (size_t)-1; ++} ++ ++static size_t get_digest_data_index(int nid) ++{ ++ size_t i = find_digest_data_index(nid); ++ ++ if (i != (size_t)-1) ++ return i; + + /* + * Code further down must make sure that only NIDs in the table above +@@ -516,8 +637,8 @@ static const struct digest_data_st *get_ + } + + /* +- * Following are the four necessary functions to map OpenSSL functionality +- * with cryptodev. ++ * Following are the five necessary functions to map OpenSSL functionality ++ * with cryptodev: init, update, final, cleanup, and copy. + */ + + static int digest_init(EVP_MD_CTX *ctx) +@@ -630,52 +751,94 @@ static int digest_cleanup(EVP_MD_CTX *ct + return clean_devcrypto_session(&digest_ctx->sess); + } + +-static int devcrypto_test_digest(size_t digest_data_index) +-{ +- struct session_op sess1, sess2; +- struct cphash_op cphash; +- int ret=0; +- +- memset(&sess1, 0, sizeof(sess1)); +- memset(&sess2, 0, sizeof(sess2)); +- sess1.mac = digest_data[digest_data_index].devcryptoid; +- if (ioctl(cfd, CIOCGSESSION, &sess1) < 0) +- return 0; +- /* Make sure the driver is capable of hash state copy */ +- sess2.mac = sess1.mac; +- if (ioctl(cfd, CIOCGSESSION, &sess2) >= 0) { +- cphash.src_ses = sess1.ses; +- cphash.dst_ses = sess2.ses; +- if (ioctl(cfd, CIOCCPHASH, &cphash) >= 0) +- ret = 1; +- ioctl(cfd, CIOCFSESSION, &sess2.ses); +- } +- ioctl(cfd, CIOCFSESSION, &sess1.ses); +- return ret; +-} +- + /* +- * Keep a table of known nids and associated methods. ++ * Keep tables of known nids, associated methods, selected digests, and ++ * driver info. + * Note that known_digest_nids[] isn't necessarily indexed the same way as +- * digest_data[] above, which known_digest_methods[] is. ++ * digest_data[] above, which the other tables are. + */ + static int known_digest_nids[OSSL_NELEM(digest_data)]; + static int known_digest_nids_amount = -1; /* -1 indicates not yet initialised */ + static EVP_MD *known_digest_methods[OSSL_NELEM(digest_data)] = { NULL, }; ++static int selected_digests[OSSL_NELEM(digest_data)]; ++static struct driver_info_st digest_driver_info[OSSL_NELEM(digest_data)]; ++ ++static int devcrypto_test_digest(size_t digest_data_index) ++{ ++ return (digest_driver_info[digest_data_index].status == DEVCRYPTO_STATUS_USABLE ++ && selected_digests[digest_data_index] == 1 ++ && (digest_driver_info[digest_data_index].accelerated ++ == DEVCRYPTO_ACCELERATED ++ || use_softdrivers == DEVCRYPTO_USE_SOFTWARE ++ || (digest_driver_info[digest_data_index].accelerated ++ != DEVCRYPTO_NOT_ACCELERATED ++ && use_softdrivers == DEVCRYPTO_REJECT_SOFTWARE))); ++} ++ ++static void rebuild_known_digest_nids(ENGINE *e) ++{ ++ size_t i; ++ ++ for (i = 0, known_digest_nids_amount = 0; i < OSSL_NELEM(digest_data); i++) { ++ if (devcrypto_test_digest(i)) ++ known_digest_nids[known_digest_nids_amount++] = digest_data[i].nid; ++ } ++ ENGINE_unregister_digests(e); ++ ENGINE_register_digests(e); ++} + + static void prepare_digest_methods(void) + { + size_t i; ++ struct session_op sess1, sess2; ++#ifdef CIOCGSESSINFO ++ struct session_info_op siop; ++#endif ++ struct cphash_op cphash; ++ ++ memset(&digest_driver_info, 0, sizeof(digest_driver_info)); ++ ++ memset(&sess1, 0, sizeof(sess1)); ++ memset(&sess2, 0, sizeof(sess2)); + + for (i = 0, known_digest_nids_amount = 0; i < OSSL_NELEM(digest_data); + i++) { + ++ selected_digests[i] = 1; ++ + /* +- * Check that the algo is usable ++ * Check that the digest is usable + */ +- if (!devcrypto_test_digest(i)) +- continue; ++ sess1.mac = digest_data[i].devcryptoid; ++ sess2.ses = 0; ++ if (ioctl(cfd, CIOCGSESSION, &sess1) < 0) { ++ digest_driver_info[i].status = DEVCRYPTO_STATUS_UNUSABLE; ++ goto finish; ++ } + ++#ifdef CIOCGSESSINFO ++ /* gather hardware acceleration info from the driver */ ++ siop.ses = sess1.ses; ++ if (ioctl(cfd, CIOCGSESSINFO, &siop) < 0) ++ digest_driver_info[i].accelerated = DEVCRYPTO_ACCELERATION_UNKNOWN; ++ else if (siop.flags & SIOP_FLAG_KERNEL_DRIVER_ONLY) ++ digest_driver_info[i].accelerated = DEVCRYPTO_ACCELERATED; ++ else ++ digest_driver_info[i].accelerated = DEVCRYPTO_NOT_ACCELERATED; ++#endif ++ ++ /* digest must be capable of hash state copy */ ++ sess2.mac = sess1.mac; ++ if (ioctl(cfd, CIOCGSESSION, &sess2) < 0) { ++ digest_driver_info[i].status = DEVCRYPTO_STATUS_UNUSABLE; ++ goto finish; ++ } ++ cphash.src_ses = sess1.ses; ++ cphash.dst_ses = sess2.ses; ++ if (ioctl(cfd, CIOCCPHASH, &cphash) < 0) { ++ digest_driver_info[i].status = DEVCRYPTO_STATUS_UNUSABLE; ++ goto finish; ++ } + if ((known_digest_methods[i] = EVP_MD_meth_new(digest_data[i].nid, + NID_undef)) == NULL + || !EVP_MD_meth_set_input_blocksize(known_digest_methods[i], +@@ -689,11 +852,18 @@ static void prepare_digest_methods(void) + || !EVP_MD_meth_set_cleanup(known_digest_methods[i], digest_cleanup) + || !EVP_MD_meth_set_app_datasize(known_digest_methods[i], + sizeof(struct digest_ctx))) { ++ digest_driver_info[i].status = DEVCRYPTO_STATUS_UNUSABLE; + EVP_MD_meth_free(known_digest_methods[i]); + known_digest_methods[i] = NULL; +- } else { +- known_digest_nids[known_digest_nids_amount++] = digest_data[i].nid; ++ goto finish; + } ++ digest_driver_info[i].status = DEVCRYPTO_STATUS_USABLE; ++finish: ++ ioctl(cfd, CIOCFSESSION, &sess1.ses); ++ if (sess2.ses != 0) ++ ioctl(cfd, CIOCFSESSION, &sess2.ses); ++ if (devcrypto_test_digest(i)) ++ known_digest_nids[known_digest_nids_amount++] = digest_data[i].nid; + } + } + +@@ -739,7 +909,153 @@ static int devcrypto_digests(ENGINE *e, + return *digest != NULL; + } + ++static void devcrypto_select_all_digests(int *digest_list) ++{ ++ size_t i; ++ ++ for (i = 0; i < OSSL_NELEM(digest_data); i++) ++ digest_list[i] = 1; ++} ++ ++static int cryptodev_select_digest_cb(const char *str, int len, void *usr) ++{ ++ int *digest_list = (int *)usr; ++ char *name; ++ const EVP_MD *EVP; ++ size_t i; ++ ++ if (len == 0) ++ return 1; ++ if (usr == NULL || (name = OPENSSL_strndup(str, len)) == NULL) ++ return 0; ++ EVP = EVP_get_digestbyname(name); ++ if (EVP == NULL) ++ fprintf(stderr, "devcrypto: unknown digest %s\n", name); ++ else if ((i = find_digest_data_index(EVP_MD_type(EVP))) != (size_t)-1) ++ digest_list[i] = 1; ++ else ++ fprintf(stderr, "devcrypto: digest %s not available\n", name); ++ OPENSSL_free(name); ++ return 1; ++} ++ ++#endif ++ ++/****************************************************************************** ++ * ++ * CONTROL COMMANDS ++ * ++ *****/ ++ ++#define DEVCRYPTO_CMD_USE_SOFTDRIVERS ENGINE_CMD_BASE ++#define DEVCRYPTO_CMD_CIPHERS (ENGINE_CMD_BASE + 1) ++#define DEVCRYPTO_CMD_DIGESTS (ENGINE_CMD_BASE + 2) ++#define DEVCRYPTO_CMD_DUMP_INFO (ENGINE_CMD_BASE + 3) ++ ++/* Helper macros for CPP string composition */ ++#ifndef OPENSSL_MSTR ++# define OPENSSL_MSTR_HELPER(x) #x ++# define OPENSSL_MSTR(x) OPENSSL_MSTR_HELPER(x) ++#endif ++ ++static const ENGINE_CMD_DEFN devcrypto_cmds[] = { ++#ifdef CIOCGSESSINFO ++ {DEVCRYPTO_CMD_USE_SOFTDRIVERS, ++ "USE_SOFTDRIVERS", ++ "specifies whether to use software (not accelerated) drivers (" ++ OPENSSL_MSTR(DEVCRYPTO_REQUIRE_ACCELERATED) "=use only accelerated drivers, " ++ OPENSSL_MSTR(DEVCRYPTO_USE_SOFTWARE) "=allow all drivers, " ++ OPENSSL_MSTR(DEVCRYPTO_REJECT_SOFTWARE) ++ "=use if acceleration can't be determined) [default=" ++ OPENSSL_MSTR(DEVCRYPTO_DEFAULT_USE_SOFDTRIVERS) "]", ++ ENGINE_CMD_FLAG_NUMERIC}, ++#endif ++ ++ {DEVCRYPTO_CMD_CIPHERS, ++ "CIPHERS", ++ "either ALL, NONE, or a comma-separated list of ciphers to enable [default=ALL]", ++ ENGINE_CMD_FLAG_STRING}, ++ ++#ifdef IMPLEMENT_DIGEST ++ {DEVCRYPTO_CMD_DIGESTS, ++ "DIGESTS", ++ "either ALL, NONE, or a comma-separated list of digests to enable [default=ALL]", ++ ENGINE_CMD_FLAG_STRING}, ++#endif ++ ++ {0, NULL, NULL, 0} ++}; ++ ++static int devcrypto_ctrl(ENGINE *e, int cmd, long i, void *p, void (*f) (void)) ++{ ++ int *new_list; ++ switch (cmd) { ++#ifdef CIOCGSESSINFO ++ case DEVCRYPTO_CMD_USE_SOFTDRIVERS: ++ switch (i) { ++ case DEVCRYPTO_REQUIRE_ACCELERATED: ++ case DEVCRYPTO_USE_SOFTWARE: ++ case DEVCRYPTO_REJECT_SOFTWARE: ++ break; ++ default: ++ fprintf(stderr, "devcrypto: invalid value (%ld) for USE_SOFTDRIVERS\n", i); ++ return 0; ++ } ++ if (use_softdrivers == i) ++ return 1; ++ use_softdrivers = i; ++#ifdef IMPLEMENT_DIGEST ++ rebuild_known_digest_nids(e); + #endif ++ rebuild_known_cipher_nids(e); ++ return 1; ++#endif /* CIOCGSESSINFO */ ++ ++ case DEVCRYPTO_CMD_CIPHERS: ++ if (p == NULL) ++ return 1; ++ if (strcasecmp((const char *)p, "ALL") == 0) { ++ devcrypto_select_all_ciphers(selected_ciphers); ++ } else if (strcasecmp((const char*)p, "NONE") == 0) { ++ memset(selected_ciphers, 0, sizeof(selected_ciphers)); ++ } else { ++ new_list=OPENSSL_zalloc(sizeof(selected_ciphers)); ++ if (!CONF_parse_list(p, ',', 1, cryptodev_select_cipher_cb, new_list)) { ++ OPENSSL_free(new_list); ++ return 0; ++ } ++ memcpy(selected_ciphers, new_list, sizeof(selected_ciphers)); ++ OPENSSL_free(new_list); ++ } ++ rebuild_known_cipher_nids(e); ++ return 1; ++ ++#ifdef IMPLEMENT_DIGEST ++ case DEVCRYPTO_CMD_DIGESTS: ++ if (p == NULL) ++ return 1; ++ if (strcasecmp((const char *)p, "ALL") == 0) { ++ devcrypto_select_all_digests(selected_digests); ++ } else if (strcasecmp((const char*)p, "NONE") == 0) { ++ memset(selected_digests, 0, sizeof(selected_digests)); ++ } else { ++ new_list=OPENSSL_zalloc(sizeof(selected_digests)); ++ if (!CONF_parse_list(p, ',', 1, cryptodev_select_digest_cb, new_list)) { ++ OPENSSL_free(new_list); ++ return 0; ++ } ++ memcpy(selected_digests, new_list, sizeof(selected_digests)); ++ OPENSSL_free(new_list); ++ } ++ rebuild_known_digest_nids(e); ++ return 1; ++#endif /* IMPLEMENT_DIGEST */ ++ ++ default: ++ break; ++ } ++ return 0; ++} + + /****************************************************************************** + * +@@ -793,6 +1109,8 @@ void engine_load_devcrypto_int() + + if (!ENGINE_set_id(e, "devcrypto") + || !ENGINE_set_name(e, "/dev/crypto engine") ++ || !ENGINE_set_cmd_defns(e, devcrypto_cmds) ++ || !ENGINE_set_ctrl_function(e, devcrypto_ctrl) + + /* + * Asymmetric ciphers aren't well supported with /dev/crypto. Among the BSD diff --git a/package/libs/openssl/patches/420-eng_devcrypto-add-command-to-dump-driver-info.patch b/package/libs/openssl/patches/420-eng_devcrypto-add-command-to-dump-driver-info.patch new file mode 100644 index 0000000000..bb18d71aba --- /dev/null +++ b/package/libs/openssl/patches/420-eng_devcrypto-add-command-to-dump-driver-info.patch @@ -0,0 +1,273 @@ +From ced41f7d44cb8cd3c4523f7271530d9d92e4f064 Mon Sep 17 00:00:00 2001 +From: Eneas U de Queiroz +Date: Tue, 6 Nov 2018 22:54:07 -0200 +Subject: [PATCH 3/4] eng_devcrypto: add command to dump driver info + +This is useful to determine the kernel driver running each algorithm. + +Signed-off-by: Eneas U de Queiroz + +Reviewed-by: Matthias St. Pierre +Reviewed-by: Richard Levitte +(Merged from https://github.com/openssl/openssl/pull/7585) + +--- a/crypto/engine/eng_devcrypto.c ++++ b/crypto/engine/eng_devcrypto.c +@@ -50,16 +50,20 @@ static int use_softdrivers = DEVCRYPTO_D + */ + struct driver_info_st { + enum devcrypto_status_t { +- DEVCRYPTO_STATUS_UNUSABLE = -1, /* session open failed */ +- DEVCRYPTO_STATUS_UNKNOWN = 0, /* not tested yet */ +- DEVCRYPTO_STATUS_USABLE = 1 /* algo can be used */ ++ DEVCRYPTO_STATUS_FAILURE = -3, /* unusable for other reason */ ++ DEVCRYPTO_STATUS_NO_CIOCCPHASH = -2, /* hash state copy not supported */ ++ DEVCRYPTO_STATUS_NO_CIOCGSESSION = -1, /* session open failed */ ++ DEVCRYPTO_STATUS_UNKNOWN = 0, /* not tested yet */ ++ DEVCRYPTO_STATUS_USABLE = 1 /* algo can be used */ + } status; + + enum devcrypto_accelerated_t { +- DEVCRYPTO_NOT_ACCELERATED = -1, /* software implemented */ +- DEVCRYPTO_ACCELERATION_UNKNOWN = 0, /* acceleration support unkown */ +- DEVCRYPTO_ACCELERATED = 1 /* hardware accelerated */ ++ DEVCRYPTO_NOT_ACCELERATED = -1, /* software implemented */ ++ DEVCRYPTO_ACCELERATION_UNKNOWN = 0, /* acceleration support unkown */ ++ DEVCRYPTO_ACCELERATED = 1 /* hardware accelerated */ + } accelerated; ++ ++ char *driver_name; + }; + + static int clean_devcrypto_session(struct session_op *sess) { +@@ -415,7 +419,7 @@ static void prepare_cipher_methods(void) + sess.cipher = cipher_data[i].devcryptoid; + sess.keylen = cipher_data[i].keylen; + if (ioctl(cfd, CIOCGSESSION, &sess) < 0) { +- cipher_driver_info[i].status = DEVCRYPTO_STATUS_UNUSABLE; ++ cipher_driver_info[i].status = DEVCRYPTO_STATUS_NO_CIOCGSESSION; + continue; + } + +@@ -443,19 +447,24 @@ static void prepare_cipher_methods(void) + cipher_cleanup) + || !EVP_CIPHER_meth_set_impl_ctx_size(known_cipher_methods[i], + sizeof(struct cipher_ctx))) { +- cipher_driver_info[i].status = DEVCRYPTO_STATUS_UNUSABLE; ++ cipher_driver_info[i].status = DEVCRYPTO_STATUS_FAILURE; + EVP_CIPHER_meth_free(known_cipher_methods[i]); + known_cipher_methods[i] = NULL; + } else { + cipher_driver_info[i].status = DEVCRYPTO_STATUS_USABLE; + #ifdef CIOCGSESSINFO + siop.ses = sess.ses; +- if (ioctl(cfd, CIOCGSESSINFO, &siop) < 0) ++ if (ioctl(cfd, CIOCGSESSINFO, &siop) < 0) { + cipher_driver_info[i].accelerated = DEVCRYPTO_ACCELERATION_UNKNOWN; +- else if (!(siop.flags & SIOP_FLAG_KERNEL_DRIVER_ONLY)) +- cipher_driver_info[i].accelerated = DEVCRYPTO_NOT_ACCELERATED; +- else +- cipher_driver_info[i].accelerated = DEVCRYPTO_ACCELERATED; ++ } else { ++ cipher_driver_info[i].driver_name = ++ OPENSSL_strndup(siop.cipher_info.cra_driver_name, ++ CRYPTODEV_MAX_ALG_NAME); ++ if (!(siop.flags & SIOP_FLAG_KERNEL_DRIVER_ONLY)) ++ cipher_driver_info[i].accelerated = DEVCRYPTO_NOT_ACCELERATED; ++ else ++ cipher_driver_info[i].accelerated = DEVCRYPTO_ACCELERATED; ++ } + #endif /* CIOCGSESSINFO */ + } + ioctl(cfd, CIOCFSESSION, &sess.ses); +@@ -505,8 +514,11 @@ static void destroy_all_cipher_methods(v + { + size_t i; + +- for (i = 0; i < OSSL_NELEM(cipher_data); i++) ++ for (i = 0; i < OSSL_NELEM(cipher_data); i++) { + destroy_cipher_method(cipher_data[i].nid); ++ OPENSSL_free(cipher_driver_info[i].driver_name); ++ cipher_driver_info[i].driver_name = NULL; ++ } + } + + static int devcrypto_ciphers(ENGINE *e, const EVP_CIPHER **cipher, +@@ -550,6 +562,40 @@ static int cryptodev_select_cipher_cb(co + return 1; + } + ++static void dump_cipher_info(void) ++{ ++ size_t i; ++ const char *name; ++ ++ fprintf (stderr, "Information about ciphers supported by the /dev/crypto" ++ " engine:\n"); ++#ifndef CIOCGSESSINFO ++ fprintf(stderr, "CIOCGSESSINFO (session info call) unavailable\n"); ++#endif ++ for (i = 0; i < OSSL_NELEM(cipher_data); i++) { ++ name = OBJ_nid2sn(cipher_data[i].nid); ++ fprintf (stderr, "Cipher %s, NID=%d, /dev/crypto info: id=%d, ", ++ name ? name : "unknown", cipher_data[i].nid, ++ cipher_data[i].devcryptoid); ++ if (cipher_driver_info[i].status == DEVCRYPTO_STATUS_NO_CIOCGSESSION ) { ++ fprintf (stderr, "CIOCGSESSION (session open call) failed\n"); ++ continue; ++ } ++ fprintf (stderr, "driver=%s ", cipher_driver_info[i].driver_name ? ++ cipher_driver_info[i].driver_name : "unknown"); ++ if (cipher_driver_info[i].accelerated == DEVCRYPTO_ACCELERATED) ++ fprintf(stderr, "(hw accelerated)"); ++ else if (cipher_driver_info[i].accelerated == DEVCRYPTO_NOT_ACCELERATED) ++ fprintf(stderr, "(software)"); ++ else ++ fprintf(stderr, "(acceleration status unknown)"); ++ if (cipher_driver_info[i].status == DEVCRYPTO_STATUS_FAILURE) ++ fprintf (stderr, ". Cipher setup failed"); ++ fprintf(stderr, "\n"); ++ } ++ fprintf(stderr, "\n"); ++} ++ + /* + * We only support digests if the cryptodev implementation supports multiple + * data updates and session copying. Otherwise, we would be forced to maintain +@@ -812,31 +858,36 @@ static void prepare_digest_methods(void) + sess1.mac = digest_data[i].devcryptoid; + sess2.ses = 0; + if (ioctl(cfd, CIOCGSESSION, &sess1) < 0) { +- digest_driver_info[i].status = DEVCRYPTO_STATUS_UNUSABLE; ++ digest_driver_info[i].status = DEVCRYPTO_STATUS_NO_CIOCGSESSION; + goto finish; + } + + #ifdef CIOCGSESSINFO + /* gather hardware acceleration info from the driver */ + siop.ses = sess1.ses; +- if (ioctl(cfd, CIOCGSESSINFO, &siop) < 0) ++ if (ioctl(cfd, CIOCGSESSINFO, &siop) < 0) { + digest_driver_info[i].accelerated = DEVCRYPTO_ACCELERATION_UNKNOWN; +- else if (siop.flags & SIOP_FLAG_KERNEL_DRIVER_ONLY) +- digest_driver_info[i].accelerated = DEVCRYPTO_ACCELERATED; +- else +- digest_driver_info[i].accelerated = DEVCRYPTO_NOT_ACCELERATED; ++ } else { ++ digest_driver_info[i].driver_name = ++ OPENSSL_strndup(siop.hash_info.cra_driver_name, ++ CRYPTODEV_MAX_ALG_NAME); ++ if (siop.flags & SIOP_FLAG_KERNEL_DRIVER_ONLY) ++ digest_driver_info[i].accelerated = DEVCRYPTO_ACCELERATED; ++ else ++ digest_driver_info[i].accelerated = DEVCRYPTO_NOT_ACCELERATED; ++ } + #endif + + /* digest must be capable of hash state copy */ + sess2.mac = sess1.mac; + if (ioctl(cfd, CIOCGSESSION, &sess2) < 0) { +- digest_driver_info[i].status = DEVCRYPTO_STATUS_UNUSABLE; ++ digest_driver_info[i].status = DEVCRYPTO_STATUS_FAILURE; + goto finish; + } + cphash.src_ses = sess1.ses; + cphash.dst_ses = sess2.ses; + if (ioctl(cfd, CIOCCPHASH, &cphash) < 0) { +- digest_driver_info[i].status = DEVCRYPTO_STATUS_UNUSABLE; ++ digest_driver_info[i].status = DEVCRYPTO_STATUS_NO_CIOCCPHASH; + goto finish; + } + if ((known_digest_methods[i] = EVP_MD_meth_new(digest_data[i].nid, +@@ -852,7 +903,7 @@ static void prepare_digest_methods(void) + || !EVP_MD_meth_set_cleanup(known_digest_methods[i], digest_cleanup) + || !EVP_MD_meth_set_app_datasize(known_digest_methods[i], + sizeof(struct digest_ctx))) { +- digest_driver_info[i].status = DEVCRYPTO_STATUS_UNUSABLE; ++ digest_driver_info[i].status = DEVCRYPTO_STATUS_FAILURE; + EVP_MD_meth_free(known_digest_methods[i]); + known_digest_methods[i] = NULL; + goto finish; +@@ -894,8 +945,11 @@ static void destroy_all_digest_methods(v + { + size_t i; + +- for (i = 0; i < OSSL_NELEM(digest_data); i++) ++ for (i = 0; i < OSSL_NELEM(digest_data); i++) { + destroy_digest_method(digest_data[i].nid); ++ OPENSSL_free(digest_driver_info[i].driver_name); ++ digest_driver_info[i].driver_name = NULL; ++ } + } + + static int devcrypto_digests(ENGINE *e, const EVP_MD **digest, +@@ -939,6 +993,43 @@ static int cryptodev_select_digest_cb(co + return 1; + } + ++static void dump_digest_info(void) ++{ ++ size_t i; ++ const char *name; ++ ++ fprintf (stderr, "Information about digests supported by the /dev/crypto" ++ " engine:\n"); ++#ifndef CIOCGSESSINFO ++ fprintf(stderr, "CIOCGSESSINFO (session info call) unavailable\n"); ++#endif ++ ++ for (i = 0; i < OSSL_NELEM(digest_data); i++) { ++ name = OBJ_nid2sn(digest_data[i].nid); ++ fprintf (stderr, "Digest %s, NID=%d, /dev/crypto info: id=%d, driver=%s", ++ name ? name : "unknown", digest_data[i].nid, ++ digest_data[i].devcryptoid, ++ digest_driver_info[i].driver_name ? digest_driver_info[i].driver_name : "unknown"); ++ if (digest_driver_info[i].status == DEVCRYPTO_STATUS_NO_CIOCGSESSION) { ++ fprintf (stderr, ". CIOCGSESSION (session open) failed\n"); ++ continue; ++ } ++ if (digest_driver_info[i].accelerated == DEVCRYPTO_ACCELERATED) ++ fprintf(stderr, " (hw accelerated)"); ++ else if (digest_driver_info[i].accelerated == DEVCRYPTO_NOT_ACCELERATED) ++ fprintf(stderr, " (software)"); ++ else ++ fprintf(stderr, " (acceleration status unknown)"); ++ if (cipher_driver_info[i].status == DEVCRYPTO_STATUS_FAILURE) ++ fprintf (stderr, ". Cipher setup failed\n"); ++ else if (digest_driver_info[i].status == DEVCRYPTO_STATUS_NO_CIOCCPHASH) ++ fprintf(stderr, ", CIOCCPHASH failed\n"); ++ else ++ fprintf(stderr, ", CIOCCPHASH capable\n"); ++ } ++ fprintf(stderr, "\n"); ++} ++ + #endif + + /****************************************************************************** +@@ -983,6 +1074,11 @@ static const ENGINE_CMD_DEFN devcrypto_c + ENGINE_CMD_FLAG_STRING}, + #endif + ++ {DEVCRYPTO_CMD_DUMP_INFO, ++ "DUMP_INFO", ++ "dump info about each algorithm to stderr; use 'openssl engine -pre DUMP_INFO devcrypto'", ++ ENGINE_CMD_FLAG_NO_INPUT}, ++ + {0, NULL, NULL, 0} + }; + +@@ -1051,6 +1147,13 @@ static int devcrypto_ctrl(ENGINE *e, int + return 1; + #endif /* IMPLEMENT_DIGEST */ + ++ case DEVCRYPTO_CMD_DUMP_INFO: ++ dump_cipher_info(); ++#ifdef IMPLEMENT_DIGEST ++ dump_digest_info(); ++#endif ++ return 1; ++ + default: + break; + } diff --git a/package/libs/openssl/patches/430-e_devcrypto-make-the-dev-crypto-engine-dynamic.patch b/package/libs/openssl/patches/430-e_devcrypto-make-the-dev-crypto-engine-dynamic.patch new file mode 100644 index 0000000000..b6d274ad12 --- /dev/null +++ b/package/libs/openssl/patches/430-e_devcrypto-make-the-dev-crypto-engine-dynamic.patch @@ -0,0 +1,2693 @@ +From 37a5c14aad5051201e4bd18faf1a4b25a824cc30 Mon Sep 17 00:00:00 2001 +From: Eneas U de Queiroz +Date: Tue, 6 Nov 2018 10:57:03 -0200 +Subject: [PATCH 4/4] e_devcrypto: make the /dev/crypto engine dynamic + +Engine has been moved from crypto/engine/eng_devcrypto.c to +engines/e_devcrypto.c. + +Signed-off-by: Eneas U de Queiroz + +--- a/crypto/engine/build.info ++++ b/crypto/engine/build.info +@@ -6,6 +6,3 @@ SOURCE[../../libcrypto]=\ + tb_cipher.c tb_digest.c tb_pkmeth.c tb_asnmth.c tb_eckey.c \ + eng_openssl.c eng_cnf.c eng_dyn.c \ + eng_rdrand.c +-IF[{- !$disabled{devcryptoeng} -}] +- SOURCE[../../libcrypto]=eng_devcrypto.c +-ENDIF +--- a/crypto/init.c ++++ b/crypto/init.c +@@ -330,18 +330,6 @@ DEFINE_RUN_ONCE_STATIC(ossl_init_engine_ + engine_load_openssl_int(); + return 1; + } +-# ifndef OPENSSL_NO_DEVCRYPTOENG +-static CRYPTO_ONCE engine_devcrypto = CRYPTO_ONCE_STATIC_INIT; +-DEFINE_RUN_ONCE_STATIC(ossl_init_engine_devcrypto) +-{ +-# ifdef OPENSSL_INIT_DEBUG +- fprintf(stderr, "OPENSSL_INIT: ossl_init_engine_devcrypto: " +- "engine_load_devcrypto_int()\n"); +-# endif +- engine_load_devcrypto_int(); +- return 1; +-} +-# endif + + # ifndef OPENSSL_NO_RDRAND + static CRYPTO_ONCE engine_rdrand = CRYPTO_ONCE_STATIC_INIT; +@@ -366,6 +354,18 @@ DEFINE_RUN_ONCE_STATIC(ossl_init_engine_ + return 1; + } + # ifndef OPENSSL_NO_STATIC_ENGINE ++# ifndef OPENSSL_NO_DEVCRYPTOENG ++static CRYPTO_ONCE engine_devcrypto = CRYPTO_ONCE_STATIC_INIT; ++DEFINE_RUN_ONCE_STATIC(ossl_init_engine_devcrypto) ++{ ++# ifdef OPENSSL_INIT_DEBUG ++ fprintf(stderr, "OPENSSL_INIT: ossl_init_engine_devcrypto: " ++ "engine_load_devcrypto_int()\n"); ++# endif ++ engine_load_devcrypto_int(); ++ return 1; ++} ++# endif + # if !defined(OPENSSL_NO_HW) && !defined(OPENSSL_NO_HW_PADLOCK) + static CRYPTO_ONCE engine_padlock = CRYPTO_ONCE_STATIC_INIT; + DEFINE_RUN_ONCE_STATIC(ossl_init_engine_padlock) +@@ -714,11 +714,6 @@ int OPENSSL_init_crypto(uint64_t opts, c + if ((opts & OPENSSL_INIT_ENGINE_OPENSSL) + && !RUN_ONCE(&engine_openssl, ossl_init_engine_openssl)) + return 0; +-# if !defined(OPENSSL_NO_HW) && !defined(OPENSSL_NO_DEVCRYPTOENG) +- if ((opts & OPENSSL_INIT_ENGINE_CRYPTODEV) +- && !RUN_ONCE(&engine_devcrypto, ossl_init_engine_devcrypto)) +- return 0; +-# endif + # ifndef OPENSSL_NO_RDRAND + if ((opts & OPENSSL_INIT_ENGINE_RDRAND) + && !RUN_ONCE(&engine_rdrand, ossl_init_engine_rdrand)) +@@ -728,6 +723,11 @@ int OPENSSL_init_crypto(uint64_t opts, c + && !RUN_ONCE(&engine_dynamic, ossl_init_engine_dynamic)) + return 0; + # ifndef OPENSSL_NO_STATIC_ENGINE ++# ifndef OPENSSL_NO_DEVCRYPTOENG ++ if ((opts & OPENSSL_INIT_ENGINE_CRYPTODEV) ++ && !RUN_ONCE(&engine_devcrypto, ossl_init_engine_devcrypto)) ++ return 0; ++# endif + # if !defined(OPENSSL_NO_HW) && !defined(OPENSSL_NO_HW_PADLOCK) + if ((opts & OPENSSL_INIT_ENGINE_PADLOCK) + && !RUN_ONCE(&engine_padlock, ossl_init_engine_padlock)) +--- a/engines/build.info ++++ b/engines/build.info +@@ -10,6 +10,9 @@ IF[{- !$disabled{"engine"} -}] + IF[{- !$disabled{afalgeng} -}] + SOURCE[../libcrypto]=e_afalg.c + ENDIF ++ IF[{- !$disabled{"devcryptoeng"} -}] ++ SOURCE[../libcrypto]=e_devcrypto.c ++ ENDIF + ELSE + ENGINES=padlock + SOURCE[padlock]=e_padlock.c {- $target{padlock_asm_src} -} +@@ -27,6 +30,12 @@ IF[{- !$disabled{"engine"} -}] + DEPEND[afalg]=../libcrypto + INCLUDE[afalg]= ../include + ENDIF ++ IF[{- !$disabled{"devcryptoeng"} -}] ++ ENGINES=devcrypto ++ SOURCE[devcrypto]=e_devcrypto.c ++ DEPEND[devcrypto]=../libcrypto ++ INCLUDE[devcrypto]=../include ++ ENDIF + + ENGINES_NO_INST=ossltest dasync + SOURCE[dasync]=e_dasync.c +--- a/crypto/engine/eng_devcrypto.c ++++ /dev/null +@@ -1,1264 +0,0 @@ +-/* +- * Copyright 2017-2019 The OpenSSL Project Authors. All Rights Reserved. +- * +- * Licensed under the OpenSSL license (the "License"). You may not use +- * this file except in compliance with the License. You can obtain a copy +- * in the file LICENSE in the source distribution or at +- * https://www.openssl.org/source/license.html +- */ +- +-#include "e_os.h" +-#include +-#include +-#include +-#include +-#include +-#include +-#include +- +-#include +-#include +-#include +-#include +-#include +-#include +- +-#include "internal/engine.h" +- +-/* #define ENGINE_DEVCRYPTO_DEBUG */ +- +-#ifdef CRYPTO_ALGORITHM_MIN +-# define CHECK_BSD_STYLE_MACROS +-#endif +- +-/* +- * ONE global file descriptor for all sessions. This allows operations +- * such as digest session data copying (see digest_copy()), but is also +- * saner... why re-open /dev/crypto for every session? +- */ +-static int cfd; +-#define DEVCRYPTO_REQUIRE_ACCELERATED 0 /* require confirmation of acceleration */ +-#define DEVCRYPTO_USE_SOFTWARE 1 /* allow software drivers */ +-#define DEVCRYPTO_REJECT_SOFTWARE 2 /* only disallow confirmed software drivers */ +- +-#define DEVCRYPTO_DEFAULT_USE_SOFDTRIVERS DEVCRYPTO_REJECT_SOFTWARE +-static int use_softdrivers = DEVCRYPTO_DEFAULT_USE_SOFDTRIVERS; +- +-/* +- * cipher/digest status & acceleration definitions +- * Make sure the defaults are set to 0 +- */ +-struct driver_info_st { +- enum devcrypto_status_t { +- DEVCRYPTO_STATUS_FAILURE = -3, /* unusable for other reason */ +- DEVCRYPTO_STATUS_NO_CIOCCPHASH = -2, /* hash state copy not supported */ +- DEVCRYPTO_STATUS_NO_CIOCGSESSION = -1, /* session open failed */ +- DEVCRYPTO_STATUS_UNKNOWN = 0, /* not tested yet */ +- DEVCRYPTO_STATUS_USABLE = 1 /* algo can be used */ +- } status; +- +- enum devcrypto_accelerated_t { +- DEVCRYPTO_NOT_ACCELERATED = -1, /* software implemented */ +- DEVCRYPTO_ACCELERATION_UNKNOWN = 0, /* acceleration support unkown */ +- DEVCRYPTO_ACCELERATED = 1 /* hardware accelerated */ +- } accelerated; +- +- char *driver_name; +-}; +- +-static int clean_devcrypto_session(struct session_op *sess) { +- if (ioctl(cfd, CIOCFSESSION, &sess->ses) < 0) { +- SYSerr(SYS_F_IOCTL, errno); +- return 0; +- } +- memset(sess, 0, sizeof(struct session_op)); +- return 1; +-} +- +-/****************************************************************************** +- * +- * Ciphers +- * +- * Because they all do the same basic operation, we have only one set of +- * method functions for them all to share, and a mapping table between +- * NIDs and cryptodev IDs, with all the necessary size data. +- * +- *****/ +- +-struct cipher_ctx { +- struct session_op sess; +- int op; /* COP_ENCRYPT or COP_DECRYPT */ +- unsigned long mode; /* EVP_CIPH_*_MODE */ +- +- /* to handle ctr mode being a stream cipher */ +- unsigned char partial[EVP_MAX_BLOCK_LENGTH]; +- unsigned int blocksize, num; +-}; +- +-static const struct cipher_data_st { +- int nid; +- int blocksize; +- int keylen; +- int ivlen; +- int flags; +- int devcryptoid; +-} cipher_data[] = { +-#ifndef OPENSSL_NO_DES +- { NID_des_cbc, 8, 8, 8, EVP_CIPH_CBC_MODE, CRYPTO_DES_CBC }, +- { NID_des_ede3_cbc, 8, 24, 8, EVP_CIPH_CBC_MODE, CRYPTO_3DES_CBC }, +-#endif +-#ifndef OPENSSL_NO_BF +- { NID_bf_cbc, 8, 16, 8, EVP_CIPH_CBC_MODE, CRYPTO_BLF_CBC }, +-#endif +-#ifndef OPENSSL_NO_CAST +- { NID_cast5_cbc, 8, 16, 8, EVP_CIPH_CBC_MODE, CRYPTO_CAST_CBC }, +-#endif +- { NID_aes_128_cbc, 16, 128 / 8, 16, EVP_CIPH_CBC_MODE, CRYPTO_AES_CBC }, +- { NID_aes_192_cbc, 16, 192 / 8, 16, EVP_CIPH_CBC_MODE, CRYPTO_AES_CBC }, +- { NID_aes_256_cbc, 16, 256 / 8, 16, EVP_CIPH_CBC_MODE, CRYPTO_AES_CBC }, +-#ifndef OPENSSL_NO_RC4 +- { NID_rc4, 1, 16, 0, EVP_CIPH_STREAM_CIPHER, CRYPTO_ARC4 }, +-#endif +-#if !defined(CHECK_BSD_STYLE_MACROS) || defined(CRYPTO_AES_CTR) +- { NID_aes_128_ctr, 16, 128 / 8, 16, EVP_CIPH_CTR_MODE, CRYPTO_AES_CTR }, +- { NID_aes_192_ctr, 16, 192 / 8, 16, EVP_CIPH_CTR_MODE, CRYPTO_AES_CTR }, +- { NID_aes_256_ctr, 16, 256 / 8, 16, EVP_CIPH_CTR_MODE, CRYPTO_AES_CTR }, +-#endif +-#if 0 /* Not yet supported */ +- { NID_aes_128_xts, 16, 128 / 8 * 2, 16, EVP_CIPH_XTS_MODE, CRYPTO_AES_XTS }, +- { NID_aes_256_xts, 16, 256 / 8 * 2, 16, EVP_CIPH_XTS_MODE, CRYPTO_AES_XTS }, +-#endif +-#if !defined(CHECK_BSD_STYLE_MACROS) || defined(CRYPTO_AES_ECB) +- { NID_aes_128_ecb, 16, 128 / 8, 0, EVP_CIPH_ECB_MODE, CRYPTO_AES_ECB }, +- { NID_aes_192_ecb, 16, 192 / 8, 0, EVP_CIPH_ECB_MODE, CRYPTO_AES_ECB }, +- { NID_aes_256_ecb, 16, 256 / 8, 0, EVP_CIPH_ECB_MODE, CRYPTO_AES_ECB }, +-#endif +-#if 0 /* Not yet supported */ +- { NID_aes_128_gcm, 16, 128 / 8, 16, EVP_CIPH_GCM_MODE, CRYPTO_AES_GCM }, +- { NID_aes_192_gcm, 16, 192 / 8, 16, EVP_CIPH_GCM_MODE, CRYPTO_AES_GCM }, +- { NID_aes_256_gcm, 16, 256 / 8, 16, EVP_CIPH_GCM_MODE, CRYPTO_AES_GCM }, +-#endif +-#ifndef OPENSSL_NO_CAMELLIA +- { NID_camellia_128_cbc, 16, 128 / 8, 16, EVP_CIPH_CBC_MODE, +- CRYPTO_CAMELLIA_CBC }, +- { NID_camellia_192_cbc, 16, 192 / 8, 16, EVP_CIPH_CBC_MODE, +- CRYPTO_CAMELLIA_CBC }, +- { NID_camellia_256_cbc, 16, 256 / 8, 16, EVP_CIPH_CBC_MODE, +- CRYPTO_CAMELLIA_CBC }, +-#endif +-}; +- +-static size_t find_cipher_data_index(int nid) +-{ +- size_t i; +- +- for (i = 0; i < OSSL_NELEM(cipher_data); i++) +- if (nid == cipher_data[i].nid) +- return i; +- return (size_t)-1; +-} +- +-static size_t get_cipher_data_index(int nid) +-{ +- size_t i = find_cipher_data_index(nid); +- +- if (i != (size_t)-1) +- return i; +- +- /* +- * Code further down must make sure that only NIDs in the table above +- * are used. If any other NID reaches this function, there's a grave +- * coding error further down. +- */ +- assert("Code that never should be reached" == NULL); +- return -1; +-} +- +-static const struct cipher_data_st *get_cipher_data(int nid) +-{ +- return &cipher_data[get_cipher_data_index(nid)]; +-} +- +-/* +- * Following are the three necessary functions to map OpenSSL functionality +- * with cryptodev. +- */ +- +-static int cipher_init(EVP_CIPHER_CTX *ctx, const unsigned char *key, +- const unsigned char *iv, int enc) +-{ +- struct cipher_ctx *cipher_ctx = +- (struct cipher_ctx *)EVP_CIPHER_CTX_get_cipher_data(ctx); +- const struct cipher_data_st *cipher_d = +- get_cipher_data(EVP_CIPHER_CTX_nid(ctx)); +- +- /* cleanup a previous session */ +- if (cipher_ctx->sess.ses != 0 && +- clean_devcrypto_session(&cipher_ctx->sess) == 0) +- return 0; +- +- cipher_ctx->sess.cipher = cipher_d->devcryptoid; +- cipher_ctx->sess.keylen = cipher_d->keylen; +- cipher_ctx->sess.key = (void *)key; +- cipher_ctx->op = enc ? COP_ENCRYPT : COP_DECRYPT; +- cipher_ctx->mode = cipher_d->flags & EVP_CIPH_MODE; +- cipher_ctx->blocksize = cipher_d->blocksize; +- if (ioctl(cfd, CIOCGSESSION, &cipher_ctx->sess) < 0) { +- SYSerr(SYS_F_IOCTL, errno); +- return 0; +- } +- +- return 1; +-} +- +-static int cipher_do_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, +- const unsigned char *in, size_t inl) +-{ +- struct cipher_ctx *cipher_ctx = +- (struct cipher_ctx *)EVP_CIPHER_CTX_get_cipher_data(ctx); +- struct crypt_op cryp; +- unsigned char *iv = EVP_CIPHER_CTX_iv_noconst(ctx); +-#if !defined(COP_FLAG_WRITE_IV) +- unsigned char saved_iv[EVP_MAX_IV_LENGTH]; +- const unsigned char *ivptr; +- size_t nblocks, ivlen; +-#endif +- +- memset(&cryp, 0, sizeof(cryp)); +- cryp.ses = cipher_ctx->sess.ses; +- cryp.len = inl; +- cryp.src = (void *)in; +- cryp.dst = (void *)out; +- cryp.iv = (void *)iv; +- cryp.op = cipher_ctx->op; +-#if !defined(COP_FLAG_WRITE_IV) +- cryp.flags = 0; +- +- ivlen = EVP_CIPHER_CTX_iv_length(ctx); +- if (ivlen > 0) +- switch (cipher_ctx->mode) { +- case EVP_CIPH_CBC_MODE: +- assert(inl >= ivlen); +- if (!EVP_CIPHER_CTX_encrypting(ctx)) { +- ivptr = in + inl - ivlen; +- memcpy(saved_iv, ivptr, ivlen); +- } +- break; +- +- case EVP_CIPH_CTR_MODE: +- break; +- +- default: /* should not happen */ +- return 0; +- } +-#else +- cryp.flags = COP_FLAG_WRITE_IV; +-#endif +- +- if (ioctl(cfd, CIOCCRYPT, &cryp) < 0) { +- SYSerr(SYS_F_IOCTL, errno); +- return 0; +- } +- +-#if !defined(COP_FLAG_WRITE_IV) +- if (ivlen > 0) +- switch (cipher_ctx->mode) { +- case EVP_CIPH_CBC_MODE: +- assert(inl >= ivlen); +- if (EVP_CIPHER_CTX_encrypting(ctx)) +- ivptr = out + inl - ivlen; +- else +- ivptr = saved_iv; +- +- memcpy(iv, ivptr, ivlen); +- break; +- +- case EVP_CIPH_CTR_MODE: +- nblocks = (inl + cipher_ctx->blocksize - 1) +- / cipher_ctx->blocksize; +- do { +- ivlen--; +- nblocks += iv[ivlen]; +- iv[ivlen] = (uint8_t) nblocks; +- nblocks >>= 8; +- } while (ivlen); +- break; +- +- default: /* should not happen */ +- return 0; +- } +-#endif +- +- return 1; +-} +- +-static int ctr_do_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, +- const unsigned char *in, size_t inl) +-{ +- struct cipher_ctx *cipher_ctx = +- (struct cipher_ctx *)EVP_CIPHER_CTX_get_cipher_data(ctx); +- size_t nblocks, len; +- +- /* initial partial block */ +- while (cipher_ctx->num && inl) { +- (*out++) = *(in++) ^ cipher_ctx->partial[cipher_ctx->num]; +- --inl; +- cipher_ctx->num = (cipher_ctx->num + 1) % cipher_ctx->blocksize; +- } +- +- /* full blocks */ +- if (inl > (unsigned int) cipher_ctx->blocksize) { +- nblocks = inl/cipher_ctx->blocksize; +- len = nblocks * cipher_ctx->blocksize; +- if (cipher_do_cipher(ctx, out, in, len) < 1) +- return 0; +- inl -= len; +- out += len; +- in += len; +- } +- +- /* final partial block */ +- if (inl) { +- memset(cipher_ctx->partial, 0, cipher_ctx->blocksize); +- if (cipher_do_cipher(ctx, cipher_ctx->partial, cipher_ctx->partial, +- cipher_ctx->blocksize) < 1) +- return 0; +- while (inl--) { +- out[cipher_ctx->num] = in[cipher_ctx->num] +- ^ cipher_ctx->partial[cipher_ctx->num]; +- cipher_ctx->num++; +- } +- } +- +- return 1; +-} +- +-static int cipher_ctrl(EVP_CIPHER_CTX *ctx, int type, int p1, void* p2) +-{ +- struct cipher_ctx *cipher_ctx = +- (struct cipher_ctx *)EVP_CIPHER_CTX_get_cipher_data(ctx); +- EVP_CIPHER_CTX *to_ctx = (EVP_CIPHER_CTX *)p2; +- struct cipher_ctx *to_cipher_ctx; +- +- switch (type) { +- case EVP_CTRL_COPY: +- if (cipher_ctx == NULL) +- return 1; +- /* when copying the context, a new session needs to be initialized */ +- to_cipher_ctx = +- (struct cipher_ctx *)EVP_CIPHER_CTX_get_cipher_data(to_ctx); +- memset(&to_cipher_ctx->sess, 0, sizeof(to_cipher_ctx->sess)); +- return cipher_init(to_ctx, cipher_ctx->sess.key, EVP_CIPHER_CTX_iv(ctx), +- (cipher_ctx->op == COP_ENCRYPT)); +- +- case EVP_CTRL_INIT: +- memset(&cipher_ctx->sess, 0, sizeof(cipher_ctx->sess)); +- return 1; +- +- default: +- break; +- } +- +- return -1; +-} +- +-static int cipher_cleanup(EVP_CIPHER_CTX *ctx) +-{ +- struct cipher_ctx *cipher_ctx = +- (struct cipher_ctx *)EVP_CIPHER_CTX_get_cipher_data(ctx); +- +- return clean_devcrypto_session(&cipher_ctx->sess); +-} +- +-/* +- * Keep tables of known nids, associated methods, selected ciphers, and driver +- * info. +- * Note that known_cipher_nids[] isn't necessarily indexed the same way as +- * cipher_data[] above, which the other tables are. +- */ +-static int known_cipher_nids[OSSL_NELEM(cipher_data)]; +-static int known_cipher_nids_amount = -1; /* -1 indicates not yet initialised */ +-static EVP_CIPHER *known_cipher_methods[OSSL_NELEM(cipher_data)] = { NULL, }; +-static int selected_ciphers[OSSL_NELEM(cipher_data)]; +-static struct driver_info_st cipher_driver_info[OSSL_NELEM(cipher_data)]; +- +- +-static int devcrypto_test_cipher(size_t cipher_data_index) +-{ +- return (cipher_driver_info[cipher_data_index].status == DEVCRYPTO_STATUS_USABLE +- && selected_ciphers[cipher_data_index] == 1 +- && (cipher_driver_info[cipher_data_index].accelerated +- == DEVCRYPTO_ACCELERATED +- || use_softdrivers == DEVCRYPTO_USE_SOFTWARE +- || (cipher_driver_info[cipher_data_index].accelerated +- != DEVCRYPTO_NOT_ACCELERATED +- && use_softdrivers == DEVCRYPTO_REJECT_SOFTWARE))); +-} +- +-static void prepare_cipher_methods(void) +-{ +- size_t i; +- struct session_op sess; +- unsigned long cipher_mode; +-#ifdef CIOCGSESSINFO +- struct session_info_op siop; +-#endif +- +- memset(&cipher_driver_info, 0, sizeof(cipher_driver_info)); +- +- memset(&sess, 0, sizeof(sess)); +- sess.key = (void *)"01234567890123456789012345678901234567890123456789"; +- +- for (i = 0, known_cipher_nids_amount = 0; +- i < OSSL_NELEM(cipher_data); i++) { +- +- selected_ciphers[i] = 1; +- /* +- * Check that the cipher is usable +- */ +- sess.cipher = cipher_data[i].devcryptoid; +- sess.keylen = cipher_data[i].keylen; +- if (ioctl(cfd, CIOCGSESSION, &sess) < 0) { +- cipher_driver_info[i].status = DEVCRYPTO_STATUS_NO_CIOCGSESSION; +- continue; +- } +- +- cipher_mode = cipher_data[i].flags & EVP_CIPH_MODE; +- +- if ((known_cipher_methods[i] = +- EVP_CIPHER_meth_new(cipher_data[i].nid, +- cipher_mode == EVP_CIPH_CTR_MODE ? 1 : +- cipher_data[i].blocksize, +- cipher_data[i].keylen)) == NULL +- || !EVP_CIPHER_meth_set_iv_length(known_cipher_methods[i], +- cipher_data[i].ivlen) +- || !EVP_CIPHER_meth_set_flags(known_cipher_methods[i], +- cipher_data[i].flags +- | EVP_CIPH_CUSTOM_COPY +- | EVP_CIPH_CTRL_INIT +- | EVP_CIPH_FLAG_DEFAULT_ASN1) +- || !EVP_CIPHER_meth_set_init(known_cipher_methods[i], cipher_init) +- || !EVP_CIPHER_meth_set_do_cipher(known_cipher_methods[i], +- cipher_mode == EVP_CIPH_CTR_MODE ? +- ctr_do_cipher : +- cipher_do_cipher) +- || !EVP_CIPHER_meth_set_ctrl(known_cipher_methods[i], cipher_ctrl) +- || !EVP_CIPHER_meth_set_cleanup(known_cipher_methods[i], +- cipher_cleanup) +- || !EVP_CIPHER_meth_set_impl_ctx_size(known_cipher_methods[i], +- sizeof(struct cipher_ctx))) { +- cipher_driver_info[i].status = DEVCRYPTO_STATUS_FAILURE; +- EVP_CIPHER_meth_free(known_cipher_methods[i]); +- known_cipher_methods[i] = NULL; +- } else { +- cipher_driver_info[i].status = DEVCRYPTO_STATUS_USABLE; +-#ifdef CIOCGSESSINFO +- siop.ses = sess.ses; +- if (ioctl(cfd, CIOCGSESSINFO, &siop) < 0) { +- cipher_driver_info[i].accelerated = DEVCRYPTO_ACCELERATION_UNKNOWN; +- } else { +- cipher_driver_info[i].driver_name = +- OPENSSL_strndup(siop.cipher_info.cra_driver_name, +- CRYPTODEV_MAX_ALG_NAME); +- if (!(siop.flags & SIOP_FLAG_KERNEL_DRIVER_ONLY)) +- cipher_driver_info[i].accelerated = DEVCRYPTO_NOT_ACCELERATED; +- else +- cipher_driver_info[i].accelerated = DEVCRYPTO_ACCELERATED; +- } +-#endif /* CIOCGSESSINFO */ +- } +- ioctl(cfd, CIOCFSESSION, &sess.ses); +- if (devcrypto_test_cipher(i)) { +- known_cipher_nids[known_cipher_nids_amount++] = +- cipher_data[i].nid; +- } +- } +-} +- +-static void rebuild_known_cipher_nids(ENGINE *e) +-{ +- size_t i; +- +- for (i = 0, known_cipher_nids_amount = 0; i < OSSL_NELEM(cipher_data); i++) { +- if (devcrypto_test_cipher(i)) +- known_cipher_nids[known_cipher_nids_amount++] = cipher_data[i].nid; +- } +- ENGINE_unregister_ciphers(e); +- ENGINE_register_ciphers(e); +-} +- +-static const EVP_CIPHER *get_cipher_method(int nid) +-{ +- size_t i = get_cipher_data_index(nid); +- +- if (i == (size_t)-1) +- return NULL; +- return known_cipher_methods[i]; +-} +- +-static int get_cipher_nids(const int **nids) +-{ +- *nids = known_cipher_nids; +- return known_cipher_nids_amount; +-} +- +-static void destroy_cipher_method(int nid) +-{ +- size_t i = get_cipher_data_index(nid); +- +- EVP_CIPHER_meth_free(known_cipher_methods[i]); +- known_cipher_methods[i] = NULL; +-} +- +-static void destroy_all_cipher_methods(void) +-{ +- size_t i; +- +- for (i = 0; i < OSSL_NELEM(cipher_data); i++) { +- destroy_cipher_method(cipher_data[i].nid); +- OPENSSL_free(cipher_driver_info[i].driver_name); +- cipher_driver_info[i].driver_name = NULL; +- } +-} +- +-static int devcrypto_ciphers(ENGINE *e, const EVP_CIPHER **cipher, +- const int **nids, int nid) +-{ +- if (cipher == NULL) +- return get_cipher_nids(nids); +- +- *cipher = get_cipher_method(nid); +- +- return *cipher != NULL; +-} +- +-static void devcrypto_select_all_ciphers(int *cipher_list) +-{ +- size_t i; +- +- for (i = 0; i < OSSL_NELEM(cipher_data); i++) +- cipher_list[i] = 1; +-} +- +-static int cryptodev_select_cipher_cb(const char *str, int len, void *usr) +-{ +- int *cipher_list = (int *)usr; +- char *name; +- const EVP_CIPHER *EVP; +- size_t i; +- +- if (len == 0) +- return 1; +- if (usr == NULL || (name = OPENSSL_strndup(str, len)) == NULL) +- return 0; +- EVP = EVP_get_cipherbyname(name); +- if (EVP == NULL) +- fprintf(stderr, "devcrypto: unknown cipher %s\n", name); +- else if ((i = find_cipher_data_index(EVP_CIPHER_nid(EVP))) != (size_t)-1) +- cipher_list[i] = 1; +- else +- fprintf(stderr, "devcrypto: cipher %s not available\n", name); +- OPENSSL_free(name); +- return 1; +-} +- +-static void dump_cipher_info(void) +-{ +- size_t i; +- const char *name; +- +- fprintf (stderr, "Information about ciphers supported by the /dev/crypto" +- " engine:\n"); +-#ifndef CIOCGSESSINFO +- fprintf(stderr, "CIOCGSESSINFO (session info call) unavailable\n"); +-#endif +- for (i = 0; i < OSSL_NELEM(cipher_data); i++) { +- name = OBJ_nid2sn(cipher_data[i].nid); +- fprintf (stderr, "Cipher %s, NID=%d, /dev/crypto info: id=%d, ", +- name ? name : "unknown", cipher_data[i].nid, +- cipher_data[i].devcryptoid); +- if (cipher_driver_info[i].status == DEVCRYPTO_STATUS_NO_CIOCGSESSION ) { +- fprintf (stderr, "CIOCGSESSION (session open call) failed\n"); +- continue; +- } +- fprintf (stderr, "driver=%s ", cipher_driver_info[i].driver_name ? +- cipher_driver_info[i].driver_name : "unknown"); +- if (cipher_driver_info[i].accelerated == DEVCRYPTO_ACCELERATED) +- fprintf(stderr, "(hw accelerated)"); +- else if (cipher_driver_info[i].accelerated == DEVCRYPTO_NOT_ACCELERATED) +- fprintf(stderr, "(software)"); +- else +- fprintf(stderr, "(acceleration status unknown)"); +- if (cipher_driver_info[i].status == DEVCRYPTO_STATUS_FAILURE) +- fprintf (stderr, ". Cipher setup failed"); +- fprintf(stderr, "\n"); +- } +- fprintf(stderr, "\n"); +-} +- +-/* +- * We only support digests if the cryptodev implementation supports multiple +- * data updates and session copying. Otherwise, we would be forced to maintain +- * a cache, which is perilous if there's a lot of data coming in (if someone +- * wants to checksum an OpenSSL tarball, for example). +- */ +-#if defined(CIOCCPHASH) && defined(COP_FLAG_UPDATE) && defined(COP_FLAG_FINAL) +-#define IMPLEMENT_DIGEST +- +-/****************************************************************************** +- * +- * Digests +- * +- * Because they all do the same basic operation, we have only one set of +- * method functions for them all to share, and a mapping table between +- * NIDs and cryptodev IDs, with all the necessary size data. +- * +- *****/ +- +-struct digest_ctx { +- struct session_op sess; +- /* This signals that the init function was called, not that it succeeded. */ +- int init_called; +- unsigned char digest_res[HASH_MAX_LEN]; +-}; +- +-static const struct digest_data_st { +- int nid; +- int blocksize; +- int digestlen; +- int devcryptoid; +-} digest_data[] = { +-#ifndef OPENSSL_NO_MD5 +- { NID_md5, /* MD5_CBLOCK */ 64, 16, CRYPTO_MD5 }, +-#endif +- { NID_sha1, SHA_CBLOCK, 20, CRYPTO_SHA1 }, +-#ifndef OPENSSL_NO_RMD160 +-# if !defined(CHECK_BSD_STYLE_MACROS) || defined(CRYPTO_RIPEMD160) +- { NID_ripemd160, /* RIPEMD160_CBLOCK */ 64, 20, CRYPTO_RIPEMD160 }, +-# endif +-#endif +-#if !defined(CHECK_BSD_STYLE_MACROS) || defined(CRYPTO_SHA2_224) +- { NID_sha224, SHA256_CBLOCK, 224 / 8, CRYPTO_SHA2_224 }, +-#endif +-#if !defined(CHECK_BSD_STYLE_MACROS) || defined(CRYPTO_SHA2_256) +- { NID_sha256, SHA256_CBLOCK, 256 / 8, CRYPTO_SHA2_256 }, +-#endif +-#if !defined(CHECK_BSD_STYLE_MACROS) || defined(CRYPTO_SHA2_384) +- { NID_sha384, SHA512_CBLOCK, 384 / 8, CRYPTO_SHA2_384 }, +-#endif +-#if !defined(CHECK_BSD_STYLE_MACROS) || defined(CRYPTO_SHA2_512) +- { NID_sha512, SHA512_CBLOCK, 512 / 8, CRYPTO_SHA2_512 }, +-#endif +-}; +- +-static size_t find_digest_data_index(int nid) +-{ +- size_t i; +- +- for (i = 0; i < OSSL_NELEM(digest_data); i++) +- if (nid == digest_data[i].nid) +- return i; +- return (size_t)-1; +-} +- +-static size_t get_digest_data_index(int nid) +-{ +- size_t i = find_digest_data_index(nid); +- +- if (i != (size_t)-1) +- return i; +- +- /* +- * Code further down must make sure that only NIDs in the table above +- * are used. If any other NID reaches this function, there's a grave +- * coding error further down. +- */ +- assert("Code that never should be reached" == NULL); +- return -1; +-} +- +-static const struct digest_data_st *get_digest_data(int nid) +-{ +- return &digest_data[get_digest_data_index(nid)]; +-} +- +-/* +- * Following are the five necessary functions to map OpenSSL functionality +- * with cryptodev: init, update, final, cleanup, and copy. +- */ +- +-static int digest_init(EVP_MD_CTX *ctx) +-{ +- struct digest_ctx *digest_ctx = +- (struct digest_ctx *)EVP_MD_CTX_md_data(ctx); +- const struct digest_data_st *digest_d = +- get_digest_data(EVP_MD_CTX_type(ctx)); +- +- digest_ctx->init_called = 1; +- +- memset(&digest_ctx->sess, 0, sizeof(digest_ctx->sess)); +- digest_ctx->sess.mac = digest_d->devcryptoid; +- if (ioctl(cfd, CIOCGSESSION, &digest_ctx->sess) < 0) { +- SYSerr(SYS_F_IOCTL, errno); +- return 0; +- } +- +- return 1; +-} +- +-static int digest_op(struct digest_ctx *ctx, const void *src, size_t srclen, +- void *res, unsigned int flags) +-{ +- struct crypt_op cryp; +- +- memset(&cryp, 0, sizeof(cryp)); +- cryp.ses = ctx->sess.ses; +- cryp.len = srclen; +- cryp.src = (void *)src; +- cryp.dst = NULL; +- cryp.mac = res; +- cryp.flags = flags; +- return ioctl(cfd, CIOCCRYPT, &cryp); +-} +- +-static int digest_update(EVP_MD_CTX *ctx, const void *data, size_t count) +-{ +- struct digest_ctx *digest_ctx = +- (struct digest_ctx *)EVP_MD_CTX_md_data(ctx); +- +- if (count == 0) +- return 1; +- +- if (digest_ctx == NULL) +- return 0; +- +- if (EVP_MD_CTX_test_flags(ctx, EVP_MD_CTX_FLAG_ONESHOT)) { +- if (digest_op(digest_ctx, data, count, digest_ctx->digest_res, 0) >= 0) +- return 1; +- } else if (digest_op(digest_ctx, data, count, NULL, COP_FLAG_UPDATE) >= 0) { +- return 1; +- } +- +- SYSerr(SYS_F_IOCTL, errno); +- return 0; +-} +- +-static int digest_final(EVP_MD_CTX *ctx, unsigned char *md) +-{ +- struct digest_ctx *digest_ctx = +- (struct digest_ctx *)EVP_MD_CTX_md_data(ctx); +- +- if (md == NULL || digest_ctx == NULL) +- return 0; +- +- if (EVP_MD_CTX_test_flags(ctx, EVP_MD_CTX_FLAG_ONESHOT)) { +- memcpy(md, digest_ctx->digest_res, EVP_MD_CTX_size(ctx)); +- } else if (digest_op(digest_ctx, NULL, 0, md, COP_FLAG_FINAL) < 0) { +- SYSerr(SYS_F_IOCTL, errno); +- return 0; +- } +- +- return 1; +-} +- +-static int digest_copy(EVP_MD_CTX *to, const EVP_MD_CTX *from) +-{ +- struct digest_ctx *digest_from = +- (struct digest_ctx *)EVP_MD_CTX_md_data(from); +- struct digest_ctx *digest_to = +- (struct digest_ctx *)EVP_MD_CTX_md_data(to); +- struct cphash_op cphash; +- +- if (digest_from == NULL || digest_from->init_called != 1) +- return 1; +- +- if (!digest_init(to)) { +- SYSerr(SYS_F_IOCTL, errno); +- return 0; +- } +- +- cphash.src_ses = digest_from->sess.ses; +- cphash.dst_ses = digest_to->sess.ses; +- if (ioctl(cfd, CIOCCPHASH, &cphash) < 0) { +- SYSerr(SYS_F_IOCTL, errno); +- return 0; +- } +- return 1; +-} +- +-static int digest_cleanup(EVP_MD_CTX *ctx) +-{ +- struct digest_ctx *digest_ctx = +- (struct digest_ctx *)EVP_MD_CTX_md_data(ctx); +- +- if (digest_ctx == NULL) +- return 1; +- +- return clean_devcrypto_session(&digest_ctx->sess); +-} +- +-/* +- * Keep tables of known nids, associated methods, selected digests, and +- * driver info. +- * Note that known_digest_nids[] isn't necessarily indexed the same way as +- * digest_data[] above, which the other tables are. +- */ +-static int known_digest_nids[OSSL_NELEM(digest_data)]; +-static int known_digest_nids_amount = -1; /* -1 indicates not yet initialised */ +-static EVP_MD *known_digest_methods[OSSL_NELEM(digest_data)] = { NULL, }; +-static int selected_digests[OSSL_NELEM(digest_data)]; +-static struct driver_info_st digest_driver_info[OSSL_NELEM(digest_data)]; +- +-static int devcrypto_test_digest(size_t digest_data_index) +-{ +- return (digest_driver_info[digest_data_index].status == DEVCRYPTO_STATUS_USABLE +- && selected_digests[digest_data_index] == 1 +- && (digest_driver_info[digest_data_index].accelerated +- == DEVCRYPTO_ACCELERATED +- || use_softdrivers == DEVCRYPTO_USE_SOFTWARE +- || (digest_driver_info[digest_data_index].accelerated +- != DEVCRYPTO_NOT_ACCELERATED +- && use_softdrivers == DEVCRYPTO_REJECT_SOFTWARE))); +-} +- +-static void rebuild_known_digest_nids(ENGINE *e) +-{ +- size_t i; +- +- for (i = 0, known_digest_nids_amount = 0; i < OSSL_NELEM(digest_data); i++) { +- if (devcrypto_test_digest(i)) +- known_digest_nids[known_digest_nids_amount++] = digest_data[i].nid; +- } +- ENGINE_unregister_digests(e); +- ENGINE_register_digests(e); +-} +- +-static void prepare_digest_methods(void) +-{ +- size_t i; +- struct session_op sess1, sess2; +-#ifdef CIOCGSESSINFO +- struct session_info_op siop; +-#endif +- struct cphash_op cphash; +- +- memset(&digest_driver_info, 0, sizeof(digest_driver_info)); +- +- memset(&sess1, 0, sizeof(sess1)); +- memset(&sess2, 0, sizeof(sess2)); +- +- for (i = 0, known_digest_nids_amount = 0; i < OSSL_NELEM(digest_data); +- i++) { +- +- selected_digests[i] = 1; +- +- /* +- * Check that the digest is usable +- */ +- sess1.mac = digest_data[i].devcryptoid; +- sess2.ses = 0; +- if (ioctl(cfd, CIOCGSESSION, &sess1) < 0) { +- digest_driver_info[i].status = DEVCRYPTO_STATUS_NO_CIOCGSESSION; +- goto finish; +- } +- +-#ifdef CIOCGSESSINFO +- /* gather hardware acceleration info from the driver */ +- siop.ses = sess1.ses; +- if (ioctl(cfd, CIOCGSESSINFO, &siop) < 0) { +- digest_driver_info[i].accelerated = DEVCRYPTO_ACCELERATION_UNKNOWN; +- } else { +- digest_driver_info[i].driver_name = +- OPENSSL_strndup(siop.hash_info.cra_driver_name, +- CRYPTODEV_MAX_ALG_NAME); +- if (siop.flags & SIOP_FLAG_KERNEL_DRIVER_ONLY) +- digest_driver_info[i].accelerated = DEVCRYPTO_ACCELERATED; +- else +- digest_driver_info[i].accelerated = DEVCRYPTO_NOT_ACCELERATED; +- } +-#endif +- +- /* digest must be capable of hash state copy */ +- sess2.mac = sess1.mac; +- if (ioctl(cfd, CIOCGSESSION, &sess2) < 0) { +- digest_driver_info[i].status = DEVCRYPTO_STATUS_FAILURE; +- goto finish; +- } +- cphash.src_ses = sess1.ses; +- cphash.dst_ses = sess2.ses; +- if (ioctl(cfd, CIOCCPHASH, &cphash) < 0) { +- digest_driver_info[i].status = DEVCRYPTO_STATUS_NO_CIOCCPHASH; +- goto finish; +- } +- if ((known_digest_methods[i] = EVP_MD_meth_new(digest_data[i].nid, +- NID_undef)) == NULL +- || !EVP_MD_meth_set_input_blocksize(known_digest_methods[i], +- digest_data[i].blocksize) +- || !EVP_MD_meth_set_result_size(known_digest_methods[i], +- digest_data[i].digestlen) +- || !EVP_MD_meth_set_init(known_digest_methods[i], digest_init) +- || !EVP_MD_meth_set_update(known_digest_methods[i], digest_update) +- || !EVP_MD_meth_set_final(known_digest_methods[i], digest_final) +- || !EVP_MD_meth_set_copy(known_digest_methods[i], digest_copy) +- || !EVP_MD_meth_set_cleanup(known_digest_methods[i], digest_cleanup) +- || !EVP_MD_meth_set_app_datasize(known_digest_methods[i], +- sizeof(struct digest_ctx))) { +- digest_driver_info[i].status = DEVCRYPTO_STATUS_FAILURE; +- EVP_MD_meth_free(known_digest_methods[i]); +- known_digest_methods[i] = NULL; +- goto finish; +- } +- digest_driver_info[i].status = DEVCRYPTO_STATUS_USABLE; +-finish: +- ioctl(cfd, CIOCFSESSION, &sess1.ses); +- if (sess2.ses != 0) +- ioctl(cfd, CIOCFSESSION, &sess2.ses); +- if (devcrypto_test_digest(i)) +- known_digest_nids[known_digest_nids_amount++] = digest_data[i].nid; +- } +-} +- +-static const EVP_MD *get_digest_method(int nid) +-{ +- size_t i = get_digest_data_index(nid); +- +- if (i == (size_t)-1) +- return NULL; +- return known_digest_methods[i]; +-} +- +-static int get_digest_nids(const int **nids) +-{ +- *nids = known_digest_nids; +- return known_digest_nids_amount; +-} +- +-static void destroy_digest_method(int nid) +-{ +- size_t i = get_digest_data_index(nid); +- +- EVP_MD_meth_free(known_digest_methods[i]); +- known_digest_methods[i] = NULL; +-} +- +-static void destroy_all_digest_methods(void) +-{ +- size_t i; +- +- for (i = 0; i < OSSL_NELEM(digest_data); i++) { +- destroy_digest_method(digest_data[i].nid); +- OPENSSL_free(digest_driver_info[i].driver_name); +- digest_driver_info[i].driver_name = NULL; +- } +-} +- +-static int devcrypto_digests(ENGINE *e, const EVP_MD **digest, +- const int **nids, int nid) +-{ +- if (digest == NULL) +- return get_digest_nids(nids); +- +- *digest = get_digest_method(nid); +- +- return *digest != NULL; +-} +- +-static void devcrypto_select_all_digests(int *digest_list) +-{ +- size_t i; +- +- for (i = 0; i < OSSL_NELEM(digest_data); i++) +- digest_list[i] = 1; +-} +- +-static int cryptodev_select_digest_cb(const char *str, int len, void *usr) +-{ +- int *digest_list = (int *)usr; +- char *name; +- const EVP_MD *EVP; +- size_t i; +- +- if (len == 0) +- return 1; +- if (usr == NULL || (name = OPENSSL_strndup(str, len)) == NULL) +- return 0; +- EVP = EVP_get_digestbyname(name); +- if (EVP == NULL) +- fprintf(stderr, "devcrypto: unknown digest %s\n", name); +- else if ((i = find_digest_data_index(EVP_MD_type(EVP))) != (size_t)-1) +- digest_list[i] = 1; +- else +- fprintf(stderr, "devcrypto: digest %s not available\n", name); +- OPENSSL_free(name); +- return 1; +-} +- +-static void dump_digest_info(void) +-{ +- size_t i; +- const char *name; +- +- fprintf (stderr, "Information about digests supported by the /dev/crypto" +- " engine:\n"); +-#ifndef CIOCGSESSINFO +- fprintf(stderr, "CIOCGSESSINFO (session info call) unavailable\n"); +-#endif +- +- for (i = 0; i < OSSL_NELEM(digest_data); i++) { +- name = OBJ_nid2sn(digest_data[i].nid); +- fprintf (stderr, "Digest %s, NID=%d, /dev/crypto info: id=%d, driver=%s", +- name ? name : "unknown", digest_data[i].nid, +- digest_data[i].devcryptoid, +- digest_driver_info[i].driver_name ? digest_driver_info[i].driver_name : "unknown"); +- if (digest_driver_info[i].status == DEVCRYPTO_STATUS_NO_CIOCGSESSION) { +- fprintf (stderr, ". CIOCGSESSION (session open) failed\n"); +- continue; +- } +- if (digest_driver_info[i].accelerated == DEVCRYPTO_ACCELERATED) +- fprintf(stderr, " (hw accelerated)"); +- else if (digest_driver_info[i].accelerated == DEVCRYPTO_NOT_ACCELERATED) +- fprintf(stderr, " (software)"); +- else +- fprintf(stderr, " (acceleration status unknown)"); +- if (cipher_driver_info[i].status == DEVCRYPTO_STATUS_FAILURE) +- fprintf (stderr, ". Cipher setup failed\n"); +- else if (digest_driver_info[i].status == DEVCRYPTO_STATUS_NO_CIOCCPHASH) +- fprintf(stderr, ", CIOCCPHASH failed\n"); +- else +- fprintf(stderr, ", CIOCCPHASH capable\n"); +- } +- fprintf(stderr, "\n"); +-} +- +-#endif +- +-/****************************************************************************** +- * +- * CONTROL COMMANDS +- * +- *****/ +- +-#define DEVCRYPTO_CMD_USE_SOFTDRIVERS ENGINE_CMD_BASE +-#define DEVCRYPTO_CMD_CIPHERS (ENGINE_CMD_BASE + 1) +-#define DEVCRYPTO_CMD_DIGESTS (ENGINE_CMD_BASE + 2) +-#define DEVCRYPTO_CMD_DUMP_INFO (ENGINE_CMD_BASE + 3) +- +-/* Helper macros for CPP string composition */ +-#ifndef OPENSSL_MSTR +-# define OPENSSL_MSTR_HELPER(x) #x +-# define OPENSSL_MSTR(x) OPENSSL_MSTR_HELPER(x) +-#endif +- +-static const ENGINE_CMD_DEFN devcrypto_cmds[] = { +-#ifdef CIOCGSESSINFO +- {DEVCRYPTO_CMD_USE_SOFTDRIVERS, +- "USE_SOFTDRIVERS", +- "specifies whether to use software (not accelerated) drivers (" +- OPENSSL_MSTR(DEVCRYPTO_REQUIRE_ACCELERATED) "=use only accelerated drivers, " +- OPENSSL_MSTR(DEVCRYPTO_USE_SOFTWARE) "=allow all drivers, " +- OPENSSL_MSTR(DEVCRYPTO_REJECT_SOFTWARE) +- "=use if acceleration can't be determined) [default=" +- OPENSSL_MSTR(DEVCRYPTO_DEFAULT_USE_SOFDTRIVERS) "]", +- ENGINE_CMD_FLAG_NUMERIC}, +-#endif +- +- {DEVCRYPTO_CMD_CIPHERS, +- "CIPHERS", +- "either ALL, NONE, or a comma-separated list of ciphers to enable [default=ALL]", +- ENGINE_CMD_FLAG_STRING}, +- +-#ifdef IMPLEMENT_DIGEST +- {DEVCRYPTO_CMD_DIGESTS, +- "DIGESTS", +- "either ALL, NONE, or a comma-separated list of digests to enable [default=ALL]", +- ENGINE_CMD_FLAG_STRING}, +-#endif +- +- {DEVCRYPTO_CMD_DUMP_INFO, +- "DUMP_INFO", +- "dump info about each algorithm to stderr; use 'openssl engine -pre DUMP_INFO devcrypto'", +- ENGINE_CMD_FLAG_NO_INPUT}, +- +- {0, NULL, NULL, 0} +-}; +- +-static int devcrypto_ctrl(ENGINE *e, int cmd, long i, void *p, void (*f) (void)) +-{ +- int *new_list; +- switch (cmd) { +-#ifdef CIOCGSESSINFO +- case DEVCRYPTO_CMD_USE_SOFTDRIVERS: +- switch (i) { +- case DEVCRYPTO_REQUIRE_ACCELERATED: +- case DEVCRYPTO_USE_SOFTWARE: +- case DEVCRYPTO_REJECT_SOFTWARE: +- break; +- default: +- fprintf(stderr, "devcrypto: invalid value (%ld) for USE_SOFTDRIVERS\n", i); +- return 0; +- } +- if (use_softdrivers == i) +- return 1; +- use_softdrivers = i; +-#ifdef IMPLEMENT_DIGEST +- rebuild_known_digest_nids(e); +-#endif +- rebuild_known_cipher_nids(e); +- return 1; +-#endif /* CIOCGSESSINFO */ +- +- case DEVCRYPTO_CMD_CIPHERS: +- if (p == NULL) +- return 1; +- if (strcasecmp((const char *)p, "ALL") == 0) { +- devcrypto_select_all_ciphers(selected_ciphers); +- } else if (strcasecmp((const char*)p, "NONE") == 0) { +- memset(selected_ciphers, 0, sizeof(selected_ciphers)); +- } else { +- new_list=OPENSSL_zalloc(sizeof(selected_ciphers)); +- if (!CONF_parse_list(p, ',', 1, cryptodev_select_cipher_cb, new_list)) { +- OPENSSL_free(new_list); +- return 0; +- } +- memcpy(selected_ciphers, new_list, sizeof(selected_ciphers)); +- OPENSSL_free(new_list); +- } +- rebuild_known_cipher_nids(e); +- return 1; +- +-#ifdef IMPLEMENT_DIGEST +- case DEVCRYPTO_CMD_DIGESTS: +- if (p == NULL) +- return 1; +- if (strcasecmp((const char *)p, "ALL") == 0) { +- devcrypto_select_all_digests(selected_digests); +- } else if (strcasecmp((const char*)p, "NONE") == 0) { +- memset(selected_digests, 0, sizeof(selected_digests)); +- } else { +- new_list=OPENSSL_zalloc(sizeof(selected_digests)); +- if (!CONF_parse_list(p, ',', 1, cryptodev_select_digest_cb, new_list)) { +- OPENSSL_free(new_list); +- return 0; +- } +- memcpy(selected_digests, new_list, sizeof(selected_digests)); +- OPENSSL_free(new_list); +- } +- rebuild_known_digest_nids(e); +- return 1; +-#endif /* IMPLEMENT_DIGEST */ +- +- case DEVCRYPTO_CMD_DUMP_INFO: +- dump_cipher_info(); +-#ifdef IMPLEMENT_DIGEST +- dump_digest_info(); +-#endif +- return 1; +- +- default: +- break; +- } +- return 0; +-} +- +-/****************************************************************************** +- * +- * LOAD / UNLOAD +- * +- *****/ +- +-static int devcrypto_unload(ENGINE *e) +-{ +- destroy_all_cipher_methods(); +-#ifdef IMPLEMENT_DIGEST +- destroy_all_digest_methods(); +-#endif +- +- close(cfd); +- +- return 1; +-} +-/* +- * This engine is always built into libcrypto, so it doesn't offer any +- * ability to be dynamically loadable. +- */ +-void engine_load_devcrypto_int() +-{ +- ENGINE *e = NULL; +- +- if ((cfd = open("/dev/crypto", O_RDWR, 0)) < 0) { +-#ifndef ENGINE_DEVCRYPTO_DEBUG +- if (errno != ENOENT) +-#endif +- fprintf(stderr, "Could not open /dev/crypto: %s\n", strerror(errno)); +- return; +- } +- +- if ((e = ENGINE_new()) == NULL +- || !ENGINE_set_destroy_function(e, devcrypto_unload)) { +- ENGINE_free(e); +- /* +- * We know that devcrypto_unload() won't be called when one of the +- * above two calls have failed, so we close cfd explicitly here to +- * avoid leaking resources. +- */ +- close(cfd); +- return; +- } +- +- prepare_cipher_methods(); +-#ifdef IMPLEMENT_DIGEST +- prepare_digest_methods(); +-#endif +- +- if (!ENGINE_set_id(e, "devcrypto") +- || !ENGINE_set_name(e, "/dev/crypto engine") +- || !ENGINE_set_cmd_defns(e, devcrypto_cmds) +- || !ENGINE_set_ctrl_function(e, devcrypto_ctrl) +- +-/* +- * Asymmetric ciphers aren't well supported with /dev/crypto. Among the BSD +- * implementations, it seems to only exist in FreeBSD, and regarding the +- * parameters in its crypt_kop, the manual crypto(4) has this to say: +- * +- * The semantics of these arguments are currently undocumented. +- * +- * Reading through the FreeBSD source code doesn't give much more than +- * their CRK_MOD_EXP implementation for ubsec. +- * +- * It doesn't look much better with cryptodev-linux. They have the crypt_kop +- * structure as well as the command (CRK_*) in cryptodev.h, but no support +- * seems to be implemented at all for the moment. +- * +- * At the time of writing, it seems impossible to write proper support for +- * FreeBSD's asym features without some very deep knowledge and access to +- * specific kernel modules. +- * +- * /Richard Levitte, 2017-05-11 +- */ +-#if 0 +-# ifndef OPENSSL_NO_RSA +- || !ENGINE_set_RSA(e, devcrypto_rsa) +-# endif +-# ifndef OPENSSL_NO_DSA +- || !ENGINE_set_DSA(e, devcrypto_dsa) +-# endif +-# ifndef OPENSSL_NO_DH +- || !ENGINE_set_DH(e, devcrypto_dh) +-# endif +-# ifndef OPENSSL_NO_EC +- || !ENGINE_set_EC(e, devcrypto_ec) +-# endif +-#endif +- || !ENGINE_set_ciphers(e, devcrypto_ciphers) +-#ifdef IMPLEMENT_DIGEST +- || !ENGINE_set_digests(e, devcrypto_digests) +-#endif +- ) { +- ENGINE_free(e); +- return; +- } +- +- ENGINE_add(e); +- ENGINE_free(e); /* Loose our local reference */ +- ERR_clear_error(); +-} +--- /dev/null ++++ b/engines/e_devcrypto.c +@@ -0,0 +1,1315 @@ ++/* ++ * Copyright 2017-2019 The OpenSSL Project Authors. All Rights Reserved. ++ * ++ * Licensed under the OpenSSL license (the "License"). You may not use ++ * this file except in compliance with the License. You can obtain a copy ++ * in the file LICENSE in the source distribution or at ++ * https://www.openssl.org/source/license.html ++ */ ++ ++#include "../e_os.h" ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#include ++#include ++#include ++#include ++#include ++#include ++ ++/* #define ENGINE_DEVCRYPTO_DEBUG */ ++ ++#ifdef CRYPTO_ALGORITHM_MIN ++# define CHECK_BSD_STYLE_MACROS ++#endif ++ ++#define engine_devcrypto_id "devcrypto" ++ ++/* ++ * ONE global file descriptor for all sessions. This allows operations ++ * such as digest session data copying (see digest_copy()), but is also ++ * saner... why re-open /dev/crypto for every session? ++ */ ++static int cfd = -1; ++#define DEVCRYPTO_REQUIRE_ACCELERATED 0 /* require confirmation of acceleration */ ++#define DEVCRYPTO_USE_SOFTWARE 1 /* allow software drivers */ ++#define DEVCRYPTO_REJECT_SOFTWARE 2 /* only disallow confirmed software drivers */ ++ ++#define DEVCRYPTO_DEFAULT_USE_SOFTDRIVERS DEVCRYPTO_REJECT_SOFTWARE ++static int use_softdrivers = DEVCRYPTO_DEFAULT_USE_SOFTDRIVERS; ++ ++/* ++ * cipher/digest status & acceleration definitions ++ * Make sure the defaults are set to 0 ++ */ ++struct driver_info_st { ++ enum devcrypto_status_t { ++ DEVCRYPTO_STATUS_FAILURE = -3, /* unusable for other reason */ ++ DEVCRYPTO_STATUS_NO_CIOCCPHASH = -2, /* hash state copy not supported */ ++ DEVCRYPTO_STATUS_NO_CIOCGSESSION = -1, /* session open failed */ ++ DEVCRYPTO_STATUS_UNKNOWN = 0, /* not tested yet */ ++ DEVCRYPTO_STATUS_USABLE = 1 /* algo can be used */ ++ } status; ++ ++ enum devcrypto_accelerated_t { ++ DEVCRYPTO_NOT_ACCELERATED = -1, /* software implemented */ ++ DEVCRYPTO_ACCELERATION_UNKNOWN = 0, /* acceleration support unkown */ ++ DEVCRYPTO_ACCELERATED = 1 /* hardware accelerated */ ++ } accelerated; ++ ++ char *driver_name; ++}; ++ ++#ifdef OPENSSL_NO_DYNAMIC_ENGINE ++void engine_load_devcrypto_int(void); ++#endif ++ ++static int clean_devcrypto_session(struct session_op *sess) { ++ if (ioctl(cfd, CIOCFSESSION, &sess->ses) < 0) { ++ SYSerr(SYS_F_IOCTL, errno); ++ return 0; ++ } ++ memset(sess, 0, sizeof(struct session_op)); ++ return 1; ++} ++ ++/****************************************************************************** ++ * ++ * Ciphers ++ * ++ * Because they all do the same basic operation, we have only one set of ++ * method functions for them all to share, and a mapping table between ++ * NIDs and cryptodev IDs, with all the necessary size data. ++ * ++ *****/ ++ ++struct cipher_ctx { ++ struct session_op sess; ++ int op; /* COP_ENCRYPT or COP_DECRYPT */ ++ unsigned long mode; /* EVP_CIPH_*_MODE */ ++ ++ /* to handle ctr mode being a stream cipher */ ++ unsigned char partial[EVP_MAX_BLOCK_LENGTH]; ++ unsigned int blocksize, num; ++}; ++ ++static const struct cipher_data_st { ++ int nid; ++ int blocksize; ++ int keylen; ++ int ivlen; ++ int flags; ++ int devcryptoid; ++} cipher_data[] = { ++#ifndef OPENSSL_NO_DES ++ { NID_des_cbc, 8, 8, 8, EVP_CIPH_CBC_MODE, CRYPTO_DES_CBC }, ++ { NID_des_ede3_cbc, 8, 24, 8, EVP_CIPH_CBC_MODE, CRYPTO_3DES_CBC }, ++#endif ++#ifndef OPENSSL_NO_BF ++ { NID_bf_cbc, 8, 16, 8, EVP_CIPH_CBC_MODE, CRYPTO_BLF_CBC }, ++#endif ++#ifndef OPENSSL_NO_CAST ++ { NID_cast5_cbc, 8, 16, 8, EVP_CIPH_CBC_MODE, CRYPTO_CAST_CBC }, ++#endif ++ { NID_aes_128_cbc, 16, 128 / 8, 16, EVP_CIPH_CBC_MODE, CRYPTO_AES_CBC }, ++ { NID_aes_192_cbc, 16, 192 / 8, 16, EVP_CIPH_CBC_MODE, CRYPTO_AES_CBC }, ++ { NID_aes_256_cbc, 16, 256 / 8, 16, EVP_CIPH_CBC_MODE, CRYPTO_AES_CBC }, ++#ifndef OPENSSL_NO_RC4 ++ { NID_rc4, 1, 16, 0, EVP_CIPH_STREAM_CIPHER, CRYPTO_ARC4 }, ++#endif ++#if !defined(CHECK_BSD_STYLE_MACROS) || defined(CRYPTO_AES_CTR) ++ { NID_aes_128_ctr, 16, 128 / 8, 16, EVP_CIPH_CTR_MODE, CRYPTO_AES_CTR }, ++ { NID_aes_192_ctr, 16, 192 / 8, 16, EVP_CIPH_CTR_MODE, CRYPTO_AES_CTR }, ++ { NID_aes_256_ctr, 16, 256 / 8, 16, EVP_CIPH_CTR_MODE, CRYPTO_AES_CTR }, ++#endif ++#if 0 /* Not yet supported */ ++ { NID_aes_128_xts, 16, 128 / 8 * 2, 16, EVP_CIPH_XTS_MODE, CRYPTO_AES_XTS }, ++ { NID_aes_256_xts, 16, 256 / 8 * 2, 16, EVP_CIPH_XTS_MODE, CRYPTO_AES_XTS }, ++#endif ++#if !defined(CHECK_BSD_STYLE_MACROS) || defined(CRYPTO_AES_ECB) ++ { NID_aes_128_ecb, 16, 128 / 8, 0, EVP_CIPH_ECB_MODE, CRYPTO_AES_ECB }, ++ { NID_aes_192_ecb, 16, 192 / 8, 0, EVP_CIPH_ECB_MODE, CRYPTO_AES_ECB }, ++ { NID_aes_256_ecb, 16, 256 / 8, 0, EVP_CIPH_ECB_MODE, CRYPTO_AES_ECB }, ++#endif ++#if 0 /* Not yet supported */ ++ { NID_aes_128_gcm, 16, 128 / 8, 16, EVP_CIPH_GCM_MODE, CRYPTO_AES_GCM }, ++ { NID_aes_192_gcm, 16, 192 / 8, 16, EVP_CIPH_GCM_MODE, CRYPTO_AES_GCM }, ++ { NID_aes_256_gcm, 16, 256 / 8, 16, EVP_CIPH_GCM_MODE, CRYPTO_AES_GCM }, ++#endif ++#ifndef OPENSSL_NO_CAMELLIA ++ { NID_camellia_128_cbc, 16, 128 / 8, 16, EVP_CIPH_CBC_MODE, ++ CRYPTO_CAMELLIA_CBC }, ++ { NID_camellia_192_cbc, 16, 192 / 8, 16, EVP_CIPH_CBC_MODE, ++ CRYPTO_CAMELLIA_CBC }, ++ { NID_camellia_256_cbc, 16, 256 / 8, 16, EVP_CIPH_CBC_MODE, ++ CRYPTO_CAMELLIA_CBC }, ++#endif ++}; ++ ++static size_t find_cipher_data_index(int nid) ++{ ++ size_t i; ++ ++ for (i = 0; i < OSSL_NELEM(cipher_data); i++) ++ if (nid == cipher_data[i].nid) ++ return i; ++ return (size_t)-1; ++} ++ ++static size_t get_cipher_data_index(int nid) ++{ ++ size_t i = find_cipher_data_index(nid); ++ ++ if (i != (size_t)-1) ++ return i; ++ ++ /* ++ * Code further down must make sure that only NIDs in the table above ++ * are used. If any other NID reaches this function, there's a grave ++ * coding error further down. ++ */ ++ assert("Code that never should be reached" == NULL); ++ return -1; ++} ++ ++static const struct cipher_data_st *get_cipher_data(int nid) ++{ ++ return &cipher_data[get_cipher_data_index(nid)]; ++} ++ ++/* ++ * Following are the three necessary functions to map OpenSSL functionality ++ * with cryptodev. ++ */ ++ ++static int cipher_init(EVP_CIPHER_CTX *ctx, const unsigned char *key, ++ const unsigned char *iv, int enc) ++{ ++ struct cipher_ctx *cipher_ctx = ++ (struct cipher_ctx *)EVP_CIPHER_CTX_get_cipher_data(ctx); ++ const struct cipher_data_st *cipher_d = ++ get_cipher_data(EVP_CIPHER_CTX_nid(ctx)); ++ ++ /* cleanup a previous session */ ++ if (cipher_ctx->sess.ses != 0 && ++ clean_devcrypto_session(&cipher_ctx->sess) == 0) ++ return 0; ++ ++ cipher_ctx->sess.cipher = cipher_d->devcryptoid; ++ cipher_ctx->sess.keylen = cipher_d->keylen; ++ cipher_ctx->sess.key = (void *)key; ++ cipher_ctx->op = enc ? COP_ENCRYPT : COP_DECRYPT; ++ cipher_ctx->mode = cipher_d->flags & EVP_CIPH_MODE; ++ cipher_ctx->blocksize = cipher_d->blocksize; ++ if (ioctl(cfd, CIOCGSESSION, &cipher_ctx->sess) < 0) { ++ SYSerr(SYS_F_IOCTL, errno); ++ return 0; ++ } ++ ++ return 1; ++} ++ ++static int cipher_do_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, ++ const unsigned char *in, size_t inl) ++{ ++ struct cipher_ctx *cipher_ctx = ++ (struct cipher_ctx *)EVP_CIPHER_CTX_get_cipher_data(ctx); ++ struct crypt_op cryp; ++ unsigned char *iv = EVP_CIPHER_CTX_iv_noconst(ctx); ++#if !defined(COP_FLAG_WRITE_IV) ++ unsigned char saved_iv[EVP_MAX_IV_LENGTH]; ++ const unsigned char *ivptr; ++ size_t nblocks, ivlen; ++#endif ++ ++ memset(&cryp, 0, sizeof(cryp)); ++ cryp.ses = cipher_ctx->sess.ses; ++ cryp.len = inl; ++ cryp.src = (void *)in; ++ cryp.dst = (void *)out; ++ cryp.iv = (void *)iv; ++ cryp.op = cipher_ctx->op; ++#if !defined(COP_FLAG_WRITE_IV) ++ cryp.flags = 0; ++ ++ ivlen = EVP_CIPHER_CTX_iv_length(ctx); ++ if (ivlen > 0) ++ switch (cipher_ctx->mode) { ++ case EVP_CIPH_CBC_MODE: ++ assert(inl >= ivlen); ++ if (!EVP_CIPHER_CTX_encrypting(ctx)) { ++ ivptr = in + inl - ivlen; ++ memcpy(saved_iv, ivptr, ivlen); ++ } ++ break; ++ ++ case EVP_CIPH_CTR_MODE: ++ break; ++ ++ default: /* should not happen */ ++ return 0; ++ } ++#else ++ cryp.flags = COP_FLAG_WRITE_IV; ++#endif ++ ++ if (ioctl(cfd, CIOCCRYPT, &cryp) < 0) { ++ SYSerr(SYS_F_IOCTL, errno); ++ return 0; ++ } ++ ++#if !defined(COP_FLAG_WRITE_IV) ++ if (ivlen > 0) ++ switch (cipher_ctx->mode) { ++ case EVP_CIPH_CBC_MODE: ++ assert(inl >= ivlen); ++ if (EVP_CIPHER_CTX_encrypting(ctx)) ++ ivptr = out + inl - ivlen; ++ else ++ ivptr = saved_iv; ++ ++ memcpy(iv, ivptr, ivlen); ++ break; ++ ++ case EVP_CIPH_CTR_MODE: ++ nblocks = (inl + cipher_ctx->blocksize - 1) ++ / cipher_ctx->blocksize; ++ do { ++ ivlen--; ++ nblocks += iv[ivlen]; ++ iv[ivlen] = (uint8_t) nblocks; ++ nblocks >>= 8; ++ } while (ivlen); ++ break; ++ ++ default: /* should not happen */ ++ return 0; ++ } ++#endif ++ ++ return 1; ++} ++ ++static int ctr_do_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, ++ const unsigned char *in, size_t inl) ++{ ++ struct cipher_ctx *cipher_ctx = ++ (struct cipher_ctx *)EVP_CIPHER_CTX_get_cipher_data(ctx); ++ size_t nblocks, len; ++ ++ /* initial partial block */ ++ while (cipher_ctx->num && inl) { ++ (*out++) = *(in++) ^ cipher_ctx->partial[cipher_ctx->num]; ++ --inl; ++ cipher_ctx->num = (cipher_ctx->num + 1) % cipher_ctx->blocksize; ++ } ++ ++ /* full blocks */ ++ if (inl > (unsigned int) cipher_ctx->blocksize) { ++ nblocks = inl/cipher_ctx->blocksize; ++ len = nblocks * cipher_ctx->blocksize; ++ if (cipher_do_cipher(ctx, out, in, len) < 1) ++ return 0; ++ inl -= len; ++ out += len; ++ in += len; ++ } ++ ++ /* final partial block */ ++ if (inl) { ++ memset(cipher_ctx->partial, 0, cipher_ctx->blocksize); ++ if (cipher_do_cipher(ctx, cipher_ctx->partial, cipher_ctx->partial, ++ cipher_ctx->blocksize) < 1) ++ return 0; ++ while (inl--) { ++ out[cipher_ctx->num] = in[cipher_ctx->num] ++ ^ cipher_ctx->partial[cipher_ctx->num]; ++ cipher_ctx->num++; ++ } ++ } ++ ++ return 1; ++} ++ ++static int cipher_ctrl(EVP_CIPHER_CTX *ctx, int type, int p1, void* p2) ++{ ++ struct cipher_ctx *cipher_ctx = ++ (struct cipher_ctx *)EVP_CIPHER_CTX_get_cipher_data(ctx); ++ EVP_CIPHER_CTX *to_ctx = (EVP_CIPHER_CTX *)p2; ++ struct cipher_ctx *to_cipher_ctx; ++ ++ switch (type) { ++ ++ case EVP_CTRL_COPY: ++ if (cipher_ctx == NULL) ++ return 1; ++ /* when copying the context, a new session needs to be initialized */ ++ to_cipher_ctx = ++ (struct cipher_ctx *)EVP_CIPHER_CTX_get_cipher_data(to_ctx); ++ memset(&to_cipher_ctx->sess, 0, sizeof(to_cipher_ctx->sess)); ++ return cipher_init(to_ctx, cipher_ctx->sess.key, EVP_CIPHER_CTX_iv(ctx), ++ (cipher_ctx->op == COP_ENCRYPT)); ++ ++ case EVP_CTRL_INIT: ++ memset(&cipher_ctx->sess, 0, sizeof(cipher_ctx->sess)); ++ return 1; ++ ++ default: ++ break; ++ } ++ ++ return -1; ++} ++ ++static int cipher_cleanup(EVP_CIPHER_CTX *ctx) ++{ ++ struct cipher_ctx *cipher_ctx = ++ (struct cipher_ctx *)EVP_CIPHER_CTX_get_cipher_data(ctx); ++ ++ return clean_devcrypto_session(&cipher_ctx->sess); ++} ++ ++/* ++ * Keep tables of known nids, associated methods, selected ciphers, and driver ++ * info. ++ * Note that known_cipher_nids[] isn't necessarily indexed the same way as ++ * cipher_data[] above, which the other tables are. ++ */ ++static int known_cipher_nids[OSSL_NELEM(cipher_data)]; ++static int known_cipher_nids_amount = -1; /* -1 indicates not yet initialised */ ++static EVP_CIPHER *known_cipher_methods[OSSL_NELEM(cipher_data)] = { NULL, }; ++static int selected_ciphers[OSSL_NELEM(cipher_data)]; ++static struct driver_info_st cipher_driver_info[OSSL_NELEM(cipher_data)]; ++ ++ ++static int devcrypto_test_cipher(size_t cipher_data_index) ++{ ++ return (cipher_driver_info[cipher_data_index].status == DEVCRYPTO_STATUS_USABLE ++ && selected_ciphers[cipher_data_index] == 1 ++ && (cipher_driver_info[cipher_data_index].accelerated ++ == DEVCRYPTO_ACCELERATED ++ || use_softdrivers == DEVCRYPTO_USE_SOFTWARE ++ || (cipher_driver_info[cipher_data_index].accelerated ++ != DEVCRYPTO_NOT_ACCELERATED ++ && use_softdrivers == DEVCRYPTO_REJECT_SOFTWARE))); ++} ++ ++static void prepare_cipher_methods(void) ++{ ++ size_t i; ++ struct session_op sess; ++ unsigned long cipher_mode; ++#ifdef CIOCGSESSINFO ++ struct session_info_op siop; ++#endif ++ ++ memset(&cipher_driver_info, 0, sizeof(cipher_driver_info)); ++ ++ memset(&sess, 0, sizeof(sess)); ++ sess.key = (void *)"01234567890123456789012345678901234567890123456789"; ++ ++ for (i = 0, known_cipher_nids_amount = 0; ++ i < OSSL_NELEM(cipher_data); i++) { ++ ++ selected_ciphers[i] = 1; ++ /* ++ * Check that the cipher is usable ++ */ ++ sess.cipher = cipher_data[i].devcryptoid; ++ sess.keylen = cipher_data[i].keylen; ++ if (ioctl(cfd, CIOCGSESSION, &sess) < 0) { ++ cipher_driver_info[i].status = DEVCRYPTO_STATUS_NO_CIOCGSESSION; ++ continue; ++ } ++ ++ cipher_mode = cipher_data[i].flags & EVP_CIPH_MODE; ++ ++ if ((known_cipher_methods[i] = ++ EVP_CIPHER_meth_new(cipher_data[i].nid, ++ cipher_mode == EVP_CIPH_CTR_MODE ? 1 : ++ cipher_data[i].blocksize, ++ cipher_data[i].keylen)) == NULL ++ || !EVP_CIPHER_meth_set_iv_length(known_cipher_methods[i], ++ cipher_data[i].ivlen) ++ || !EVP_CIPHER_meth_set_flags(known_cipher_methods[i], ++ cipher_data[i].flags ++ | EVP_CIPH_CUSTOM_COPY ++ | EVP_CIPH_CTRL_INIT ++ | EVP_CIPH_FLAG_DEFAULT_ASN1) ++ || !EVP_CIPHER_meth_set_init(known_cipher_methods[i], cipher_init) ++ || !EVP_CIPHER_meth_set_do_cipher(known_cipher_methods[i], ++ cipher_mode == EVP_CIPH_CTR_MODE ? ++ ctr_do_cipher : ++ cipher_do_cipher) ++ || !EVP_CIPHER_meth_set_ctrl(known_cipher_methods[i], cipher_ctrl) ++ || !EVP_CIPHER_meth_set_cleanup(known_cipher_methods[i], ++ cipher_cleanup) ++ || !EVP_CIPHER_meth_set_impl_ctx_size(known_cipher_methods[i], ++ sizeof(struct cipher_ctx))) { ++ cipher_driver_info[i].status = DEVCRYPTO_STATUS_FAILURE; ++ EVP_CIPHER_meth_free(known_cipher_methods[i]); ++ known_cipher_methods[i] = NULL; ++ } else { ++ cipher_driver_info[i].status = DEVCRYPTO_STATUS_USABLE; ++#ifdef CIOCGSESSINFO ++ siop.ses = sess.ses; ++ if (ioctl(cfd, CIOCGSESSINFO, &siop) < 0) { ++ cipher_driver_info[i].accelerated = DEVCRYPTO_ACCELERATION_UNKNOWN; ++ } else { ++ cipher_driver_info[i].driver_name = ++ OPENSSL_strndup(siop.cipher_info.cra_driver_name, ++ CRYPTODEV_MAX_ALG_NAME); ++ if (!(siop.flags & SIOP_FLAG_KERNEL_DRIVER_ONLY)) ++ cipher_driver_info[i].accelerated = DEVCRYPTO_NOT_ACCELERATED; ++ else ++ cipher_driver_info[i].accelerated = DEVCRYPTO_ACCELERATED; ++ } ++#endif /* CIOCGSESSINFO */ ++ } ++ ioctl(cfd, CIOCFSESSION, &sess.ses); ++ if (devcrypto_test_cipher(i)) { ++ known_cipher_nids[known_cipher_nids_amount++] = ++ cipher_data[i].nid; ++ } ++ } ++} ++ ++static void rebuild_known_cipher_nids(ENGINE *e) ++{ ++ size_t i; ++ ++ for (i = 0, known_cipher_nids_amount = 0; i < OSSL_NELEM(cipher_data); i++) { ++ if (devcrypto_test_cipher(i)) ++ known_cipher_nids[known_cipher_nids_amount++] = cipher_data[i].nid; ++ } ++ ENGINE_unregister_ciphers(e); ++ ENGINE_register_ciphers(e); ++} ++ ++static const EVP_CIPHER *get_cipher_method(int nid) ++{ ++ size_t i = get_cipher_data_index(nid); ++ ++ if (i == (size_t)-1) ++ return NULL; ++ return known_cipher_methods[i]; ++} ++ ++static int get_cipher_nids(const int **nids) ++{ ++ *nids = known_cipher_nids; ++ return known_cipher_nids_amount; ++} ++ ++static void destroy_cipher_method(int nid) ++{ ++ size_t i = get_cipher_data_index(nid); ++ ++ EVP_CIPHER_meth_free(known_cipher_methods[i]); ++ known_cipher_methods[i] = NULL; ++} ++ ++static void destroy_all_cipher_methods(void) ++{ ++ size_t i; ++ ++ for (i = 0; i < OSSL_NELEM(cipher_data); i++) { ++ destroy_cipher_method(cipher_data[i].nid); ++ OPENSSL_free(cipher_driver_info[i].driver_name); ++ cipher_driver_info[i].driver_name = NULL; ++ } ++} ++ ++static int devcrypto_ciphers(ENGINE *e, const EVP_CIPHER **cipher, ++ const int **nids, int nid) ++{ ++ if (cipher == NULL) ++ return get_cipher_nids(nids); ++ ++ *cipher = get_cipher_method(nid); ++ ++ return *cipher != NULL; ++} ++ ++static void devcrypto_select_all_ciphers(int *cipher_list) ++{ ++ size_t i; ++ ++ for (i = 0; i < OSSL_NELEM(cipher_data); i++) ++ cipher_list[i] = 1; ++} ++ ++static int cryptodev_select_cipher_cb(const char *str, int len, void *usr) ++{ ++ int *cipher_list = (int *)usr; ++ char *name; ++ const EVP_CIPHER *EVP; ++ size_t i; ++ ++ if (len == 0) ++ return 1; ++ if (usr == NULL || (name = OPENSSL_strndup(str, len)) == NULL) ++ return 0; ++ EVP = EVP_get_cipherbyname(name); ++ if (EVP == NULL) ++ fprintf(stderr, "devcrypto: unknown cipher %s\n", name); ++ else if ((i = find_cipher_data_index(EVP_CIPHER_nid(EVP))) != (size_t)-1) ++ cipher_list[i] = 1; ++ else ++ fprintf(stderr, "devcrypto: cipher %s not available\n", name); ++ OPENSSL_free(name); ++ return 1; ++} ++ ++static void dump_cipher_info(void) ++{ ++ size_t i; ++ const char *name; ++ ++ fprintf (stderr, "Information about ciphers supported by the /dev/crypto" ++ " engine:\n"); ++#ifndef CIOCGSESSINFO ++ fprintf(stderr, "CIOCGSESSINFO (session info call) unavailable\n"); ++#endif ++ for (i = 0; i < OSSL_NELEM(cipher_data); i++) { ++ name = OBJ_nid2sn(cipher_data[i].nid); ++ fprintf (stderr, "Cipher %s, NID=%d, /dev/crypto info: id=%d, ", ++ name ? name : "unknown", cipher_data[i].nid, ++ cipher_data[i].devcryptoid); ++ if (cipher_driver_info[i].status == DEVCRYPTO_STATUS_NO_CIOCGSESSION ) { ++ fprintf (stderr, "CIOCGSESSION (session open call) failed\n"); ++ continue; ++ } ++ fprintf (stderr, "driver=%s ", cipher_driver_info[i].driver_name ? ++ cipher_driver_info[i].driver_name : "unknown"); ++ if (cipher_driver_info[i].accelerated == DEVCRYPTO_ACCELERATED) ++ fprintf(stderr, "(hw accelerated)"); ++ else if (cipher_driver_info[i].accelerated == DEVCRYPTO_NOT_ACCELERATED) ++ fprintf(stderr, "(software)"); ++ else ++ fprintf(stderr, "(acceleration status unknown)"); ++ if (cipher_driver_info[i].status == DEVCRYPTO_STATUS_FAILURE) ++ fprintf (stderr, ". Cipher setup failed"); ++ fprintf(stderr, "\n"); ++ } ++ fprintf(stderr, "\n"); ++} ++ ++/* ++ * We only support digests if the cryptodev implementation supports multiple ++ * data updates and session copying. Otherwise, we would be forced to maintain ++ * a cache, which is perilous if there's a lot of data coming in (if someone ++ * wants to checksum an OpenSSL tarball, for example). ++ */ ++#if defined(CIOCCPHASH) && defined(COP_FLAG_UPDATE) && defined(COP_FLAG_FINAL) ++#define IMPLEMENT_DIGEST ++ ++/****************************************************************************** ++ * ++ * Digests ++ * ++ * Because they all do the same basic operation, we have only one set of ++ * method functions for them all to share, and a mapping table between ++ * NIDs and cryptodev IDs, with all the necessary size data. ++ * ++ *****/ ++ ++struct digest_ctx { ++ struct session_op sess; ++ /* This signals that the init function was called, not that it succeeded. */ ++ int init_called; ++ unsigned char digest_res[HASH_MAX_LEN]; ++}; ++ ++static const struct digest_data_st { ++ int nid; ++ int blocksize; ++ int digestlen; ++ int devcryptoid; ++} digest_data[] = { ++#ifndef OPENSSL_NO_MD5 ++ { NID_md5, /* MD5_CBLOCK */ 64, 16, CRYPTO_MD5 }, ++#endif ++ { NID_sha1, SHA_CBLOCK, 20, CRYPTO_SHA1 }, ++#ifndef OPENSSL_NO_RMD160 ++# if !defined(CHECK_BSD_STYLE_MACROS) || defined(CRYPTO_RIPEMD160) ++ { NID_ripemd160, /* RIPEMD160_CBLOCK */ 64, 20, CRYPTO_RIPEMD160 }, ++# endif ++#endif ++#if !defined(CHECK_BSD_STYLE_MACROS) || defined(CRYPTO_SHA2_224) ++ { NID_sha224, SHA256_CBLOCK, 224 / 8, CRYPTO_SHA2_224 }, ++#endif ++#if !defined(CHECK_BSD_STYLE_MACROS) || defined(CRYPTO_SHA2_256) ++ { NID_sha256, SHA256_CBLOCK, 256 / 8, CRYPTO_SHA2_256 }, ++#endif ++#if !defined(CHECK_BSD_STYLE_MACROS) || defined(CRYPTO_SHA2_384) ++ { NID_sha384, SHA512_CBLOCK, 384 / 8, CRYPTO_SHA2_384 }, ++#endif ++#if !defined(CHECK_BSD_STYLE_MACROS) || defined(CRYPTO_SHA2_512) ++ { NID_sha512, SHA512_CBLOCK, 512 / 8, CRYPTO_SHA2_512 }, ++#endif ++}; ++ ++static size_t find_digest_data_index(int nid) ++{ ++ size_t i; ++ ++ for (i = 0; i < OSSL_NELEM(digest_data); i++) ++ if (nid == digest_data[i].nid) ++ return i; ++ return (size_t)-1; ++} ++ ++static size_t get_digest_data_index(int nid) ++{ ++ size_t i = find_digest_data_index(nid); ++ ++ if (i != (size_t)-1) ++ return i; ++ ++ /* ++ * Code further down must make sure that only NIDs in the table above ++ * are used. If any other NID reaches this function, there's a grave ++ * coding error further down. ++ */ ++ assert("Code that never should be reached" == NULL); ++ return -1; ++} ++ ++static const struct digest_data_st *get_digest_data(int nid) ++{ ++ return &digest_data[get_digest_data_index(nid)]; ++} ++ ++/* ++ * Following are the five necessary functions to map OpenSSL functionality ++ * with cryptodev: init, update, final, cleanup, and copy. ++ */ ++ ++static int digest_init(EVP_MD_CTX *ctx) ++{ ++ struct digest_ctx *digest_ctx = ++ (struct digest_ctx *)EVP_MD_CTX_md_data(ctx); ++ const struct digest_data_st *digest_d = ++ get_digest_data(EVP_MD_CTX_type(ctx)); ++ ++ digest_ctx->init_called = 1; ++ ++ memset(&digest_ctx->sess, 0, sizeof(digest_ctx->sess)); ++ digest_ctx->sess.mac = digest_d->devcryptoid; ++ if (ioctl(cfd, CIOCGSESSION, &digest_ctx->sess) < 0) { ++ SYSerr(SYS_F_IOCTL, errno); ++ return 0; ++ } ++ return 1; ++} ++ ++static int digest_op(struct digest_ctx *ctx, const void *src, size_t srclen, ++ void *res, unsigned int flags) ++{ ++ struct crypt_op cryp; ++ ++ memset(&cryp, 0, sizeof(cryp)); ++ cryp.ses = ctx->sess.ses; ++ cryp.len = srclen; ++ cryp.src = (void *)src; ++ cryp.dst = NULL; ++ cryp.mac = res; ++ cryp.flags = flags; ++ return ioctl(cfd, CIOCCRYPT, &cryp); ++} ++ ++static int digest_update(EVP_MD_CTX *ctx, const void *data, size_t count) ++{ ++ struct digest_ctx *digest_ctx = ++ (struct digest_ctx *)EVP_MD_CTX_md_data(ctx); ++ ++ if (count == 0) ++ return 1; ++ ++ if (digest_ctx == NULL) ++ return 0; ++ ++ if (EVP_MD_CTX_test_flags(ctx, EVP_MD_CTX_FLAG_ONESHOT)) { ++ if (digest_op(digest_ctx, data, count, digest_ctx->digest_res, 0) >= 0) ++ return 1; ++ } else if (digest_op(digest_ctx, data, count, NULL, COP_FLAG_UPDATE) >= 0) { ++ return 1; ++ } ++ ++ SYSerr(SYS_F_IOCTL, errno); ++ return 0; ++} ++ ++static int digest_final(EVP_MD_CTX *ctx, unsigned char *md) ++{ ++ struct digest_ctx *digest_ctx = ++ (struct digest_ctx *)EVP_MD_CTX_md_data(ctx); ++ ++ if (md == NULL || digest_ctx == NULL) ++ return 0; ++ ++ if (EVP_MD_CTX_test_flags(ctx, EVP_MD_CTX_FLAG_ONESHOT)) { ++ memcpy(md, digest_ctx->digest_res, EVP_MD_CTX_size(ctx)); ++ } else if (digest_op(digest_ctx, NULL, 0, md, COP_FLAG_FINAL) < 0) { ++ SYSerr(SYS_F_IOCTL, errno); ++ return 0; ++ } ++ ++ return 1; ++} ++ ++static int digest_copy(EVP_MD_CTX *to, const EVP_MD_CTX *from) ++{ ++ struct digest_ctx *digest_from = ++ (struct digest_ctx *)EVP_MD_CTX_md_data(from); ++ struct digest_ctx *digest_to = ++ (struct digest_ctx *)EVP_MD_CTX_md_data(to); ++ struct cphash_op cphash; ++ ++ if (digest_from == NULL || digest_from->init_called != 1) ++ return 1; ++ ++ if (!digest_init(to)) { ++ SYSerr(SYS_F_IOCTL, errno); ++ return 0; ++ } ++ ++ cphash.src_ses = digest_from->sess.ses; ++ cphash.dst_ses = digest_to->sess.ses; ++ if (ioctl(cfd, CIOCCPHASH, &cphash) < 0) { ++ SYSerr(SYS_F_IOCTL, errno); ++ return 0; ++ } ++ return 1; ++} ++ ++static int digest_cleanup(EVP_MD_CTX *ctx) ++{ ++ struct digest_ctx *digest_ctx = ++ (struct digest_ctx *)EVP_MD_CTX_md_data(ctx); ++ ++ if (digest_ctx == NULL) ++ return 1; ++ ++ return clean_devcrypto_session(&digest_ctx->sess); ++} ++ ++/* ++ * Keep tables of known nids, associated methods, selected digests, and ++ * driver info. ++ * Note that known_digest_nids[] isn't necessarily indexed the same way as ++ * digest_data[] above, which the other tables are. ++ */ ++static int known_digest_nids[OSSL_NELEM(digest_data)]; ++static int known_digest_nids_amount = -1; /* -1 indicates not yet initialised */ ++static EVP_MD *known_digest_methods[OSSL_NELEM(digest_data)] = { NULL, }; ++static int selected_digests[OSSL_NELEM(digest_data)]; ++static struct driver_info_st digest_driver_info[OSSL_NELEM(digest_data)]; ++ ++static int devcrypto_test_digest(size_t digest_data_index) ++{ ++ return (digest_driver_info[digest_data_index].status == DEVCRYPTO_STATUS_USABLE ++ && selected_digests[digest_data_index] == 1 ++ && (digest_driver_info[digest_data_index].accelerated ++ == DEVCRYPTO_ACCELERATED ++ || use_softdrivers == DEVCRYPTO_USE_SOFTWARE ++ || (digest_driver_info[digest_data_index].accelerated ++ != DEVCRYPTO_NOT_ACCELERATED ++ && use_softdrivers == DEVCRYPTO_REJECT_SOFTWARE))); ++} ++ ++static void rebuild_known_digest_nids(ENGINE *e) ++{ ++ size_t i; ++ ++ for (i = 0, known_digest_nids_amount = 0; i < OSSL_NELEM(digest_data); i++) { ++ if (devcrypto_test_digest(i)) ++ known_digest_nids[known_digest_nids_amount++] = digest_data[i].nid; ++ } ++ ENGINE_unregister_digests(e); ++ ENGINE_register_digests(e); ++} ++ ++static void prepare_digest_methods(void) ++{ ++ size_t i; ++ struct session_op sess1, sess2; ++#ifdef CIOCGSESSINFO ++ struct session_info_op siop; ++#endif ++ struct cphash_op cphash; ++ ++ memset(&digest_driver_info, 0, sizeof(digest_driver_info)); ++ ++ memset(&sess1, 0, sizeof(sess1)); ++ memset(&sess2, 0, sizeof(sess2)); ++ ++ for (i = 0, known_digest_nids_amount = 0; i < OSSL_NELEM(digest_data); ++ i++) { ++ ++ selected_digests[i] = 1; ++ ++ /* ++ * Check that the digest is usable ++ */ ++ sess1.mac = digest_data[i].devcryptoid; ++ sess2.ses = 0; ++ if (ioctl(cfd, CIOCGSESSION, &sess1) < 0) { ++ digest_driver_info[i].status = DEVCRYPTO_STATUS_NO_CIOCGSESSION; ++ goto finish; ++ } ++ ++#ifdef CIOCGSESSINFO ++ /* gather hardware acceleration info from the driver */ ++ siop.ses = sess1.ses; ++ if (ioctl(cfd, CIOCGSESSINFO, &siop) < 0) { ++ digest_driver_info[i].accelerated = DEVCRYPTO_ACCELERATION_UNKNOWN; ++ } else { ++ digest_driver_info[i].driver_name = ++ OPENSSL_strndup(siop.hash_info.cra_driver_name, ++ CRYPTODEV_MAX_ALG_NAME); ++ if (siop.flags & SIOP_FLAG_KERNEL_DRIVER_ONLY) ++ digest_driver_info[i].accelerated = DEVCRYPTO_ACCELERATED; ++ else ++ digest_driver_info[i].accelerated = DEVCRYPTO_NOT_ACCELERATED; ++ } ++#endif ++ ++ /* digest must be capable of hash state copy */ ++ sess2.mac = sess1.mac; ++ if (ioctl(cfd, CIOCGSESSION, &sess2) < 0) { ++ digest_driver_info[i].status = DEVCRYPTO_STATUS_FAILURE; ++ goto finish; ++ } ++ cphash.src_ses = sess1.ses; ++ cphash.dst_ses = sess2.ses; ++ if (ioctl(cfd, CIOCCPHASH, &cphash) < 0) { ++ digest_driver_info[i].status = DEVCRYPTO_STATUS_NO_CIOCCPHASH; ++ goto finish; ++ } ++ if ((known_digest_methods[i] = EVP_MD_meth_new(digest_data[i].nid, ++ NID_undef)) == NULL ++ || !EVP_MD_meth_set_input_blocksize(known_digest_methods[i], ++ digest_data[i].blocksize) ++ || !EVP_MD_meth_set_result_size(known_digest_methods[i], ++ digest_data[i].digestlen) ++ || !EVP_MD_meth_set_init(known_digest_methods[i], digest_init) ++ || !EVP_MD_meth_set_update(known_digest_methods[i], digest_update) ++ || !EVP_MD_meth_set_final(known_digest_methods[i], digest_final) ++ || !EVP_MD_meth_set_copy(known_digest_methods[i], digest_copy) ++ || !EVP_MD_meth_set_cleanup(known_digest_methods[i], digest_cleanup) ++ || !EVP_MD_meth_set_app_datasize(known_digest_methods[i], ++ sizeof(struct digest_ctx))) { ++ digest_driver_info[i].status = DEVCRYPTO_STATUS_FAILURE; ++ EVP_MD_meth_free(known_digest_methods[i]); ++ known_digest_methods[i] = NULL; ++ goto finish; ++ } ++ digest_driver_info[i].status = DEVCRYPTO_STATUS_USABLE; ++finish: ++ ioctl(cfd, CIOCFSESSION, &sess1.ses); ++ if (sess2.ses != 0) ++ ioctl(cfd, CIOCFSESSION, &sess2.ses); ++ if (devcrypto_test_digest(i)) ++ known_digest_nids[known_digest_nids_amount++] = digest_data[i].nid; ++ } ++} ++ ++static const EVP_MD *get_digest_method(int nid) ++{ ++ size_t i = get_digest_data_index(nid); ++ ++ if (i == (size_t)-1) ++ return NULL; ++ return known_digest_methods[i]; ++} ++ ++static int get_digest_nids(const int **nids) ++{ ++ *nids = known_digest_nids; ++ return known_digest_nids_amount; ++} ++ ++static void destroy_digest_method(int nid) ++{ ++ size_t i = get_digest_data_index(nid); ++ ++ EVP_MD_meth_free(known_digest_methods[i]); ++ known_digest_methods[i] = NULL; ++} ++ ++static void destroy_all_digest_methods(void) ++{ ++ size_t i; ++ ++ for (i = 0; i < OSSL_NELEM(digest_data); i++) { ++ destroy_digest_method(digest_data[i].nid); ++ OPENSSL_free(digest_driver_info[i].driver_name); ++ digest_driver_info[i].driver_name = NULL; ++ } ++} ++ ++static int devcrypto_digests(ENGINE *e, const EVP_MD **digest, ++ const int **nids, int nid) ++{ ++ if (digest == NULL) ++ return get_digest_nids(nids); ++ ++ *digest = get_digest_method(nid); ++ ++ return *digest != NULL; ++} ++ ++static void devcrypto_select_all_digests(int *digest_list) ++{ ++ size_t i; ++ ++ for (i = 0; i < OSSL_NELEM(digest_data); i++) ++ digest_list[i] = 1; ++} ++ ++static int cryptodev_select_digest_cb(const char *str, int len, void *usr) ++{ ++ int *digest_list = (int *)usr; ++ char *name; ++ const EVP_MD *EVP; ++ size_t i; ++ ++ if (len == 0) ++ return 1; ++ if (usr == NULL || (name = OPENSSL_strndup(str, len)) == NULL) ++ return 0; ++ EVP = EVP_get_digestbyname(name); ++ if (EVP == NULL) ++ fprintf(stderr, "devcrypto: unknown digest %s\n", name); ++ else if ((i = find_digest_data_index(EVP_MD_type(EVP))) != (size_t)-1) ++ digest_list[i] = 1; ++ else ++ fprintf(stderr, "devcrypto: digest %s not available\n", name); ++ OPENSSL_free(name); ++ return 1; ++} ++ ++static void dump_digest_info(void) ++{ ++ size_t i; ++ const char *name; ++ ++ fprintf (stderr, "Information about digests supported by the /dev/crypto" ++ " engine:\n"); ++#ifndef CIOCGSESSINFO ++ fprintf(stderr, "CIOCGSESSINFO (session info call) unavailable\n"); ++#endif ++ ++ for (i = 0; i < OSSL_NELEM(digest_data); i++) { ++ name = OBJ_nid2sn(digest_data[i].nid); ++ fprintf (stderr, "Digest %s, NID=%d, /dev/crypto info: id=%d, driver=%s", ++ name ? name : "unknown", digest_data[i].nid, ++ digest_data[i].devcryptoid, ++ digest_driver_info[i].driver_name ? digest_driver_info[i].driver_name : "unknown"); ++ if (digest_driver_info[i].status == DEVCRYPTO_STATUS_NO_CIOCGSESSION) { ++ fprintf (stderr, ". CIOCGSESSION (session open) failed\n"); ++ continue; ++ } ++ if (digest_driver_info[i].accelerated == DEVCRYPTO_ACCELERATED) ++ fprintf(stderr, " (hw accelerated)"); ++ else if (digest_driver_info[i].accelerated == DEVCRYPTO_NOT_ACCELERATED) ++ fprintf(stderr, " (software)"); ++ else ++ fprintf(stderr, " (acceleration status unknown)"); ++ if (cipher_driver_info[i].status == DEVCRYPTO_STATUS_FAILURE) ++ fprintf (stderr, ". Cipher setup failed\n"); ++ else if (digest_driver_info[i].status == DEVCRYPTO_STATUS_NO_CIOCCPHASH) ++ fprintf(stderr, ", CIOCCPHASH failed\n"); ++ else ++ fprintf(stderr, ", CIOCCPHASH capable\n"); ++ } ++ fprintf(stderr, "\n"); ++} ++ ++#endif ++ ++/****************************************************************************** ++ * ++ * CONTROL COMMANDS ++ * ++ *****/ ++ ++#define DEVCRYPTO_CMD_USE_SOFTDRIVERS ENGINE_CMD_BASE ++#define DEVCRYPTO_CMD_CIPHERS (ENGINE_CMD_BASE + 1) ++#define DEVCRYPTO_CMD_DIGESTS (ENGINE_CMD_BASE + 2) ++#define DEVCRYPTO_CMD_DUMP_INFO (ENGINE_CMD_BASE + 3) ++ ++/* Helper macros for CPP string composition */ ++#ifndef OPENSSL_MSTR ++# define OPENSSL_MSTR_HELPER(x) #x ++# define OPENSSL_MSTR(x) OPENSSL_MSTR_HELPER(x) ++#endif ++ ++static const ENGINE_CMD_DEFN devcrypto_cmds[] = { ++#ifdef CIOCGSESSINFO ++ {DEVCRYPTO_CMD_USE_SOFTDRIVERS, ++ "USE_SOFTDRIVERS", ++ "specifies whether to use software (not accelerated) drivers (" ++ OPENSSL_MSTR(DEVCRYPTO_REQUIRE_ACCELERATED) "=use only accelerated drivers, " ++ OPENSSL_MSTR(DEVCRYPTO_USE_SOFTWARE) "=allow all drivers, " ++ OPENSSL_MSTR(DEVCRYPTO_REJECT_SOFTWARE) ++ "=use if acceleration can't be determined) [default=" ++ OPENSSL_MSTR(DEVCRYPTO_DEFAULT_USE_SOFTDRIVERS) "]", ++ ENGINE_CMD_FLAG_NUMERIC}, ++#endif ++ ++ {DEVCRYPTO_CMD_CIPHERS, ++ "CIPHERS", ++ "either ALL, NONE, or a comma-separated list of ciphers to enable [default=ALL]", ++ ENGINE_CMD_FLAG_STRING}, ++ ++#ifdef IMPLEMENT_DIGEST ++ {DEVCRYPTO_CMD_DIGESTS, ++ "DIGESTS", ++ "either ALL, NONE, or a comma-separated list of digests to enable [default=ALL]", ++ ENGINE_CMD_FLAG_STRING}, ++#endif ++ ++ {DEVCRYPTO_CMD_DUMP_INFO, ++ "DUMP_INFO", ++ "dump info about each algorithm to stderr; use 'openssl engine -pre DUMP_INFO devcrypto'", ++ ENGINE_CMD_FLAG_NO_INPUT}, ++ ++ {0, NULL, NULL, 0} ++}; ++ ++static int devcrypto_ctrl(ENGINE *e, int cmd, long i, void *p, void (*f) (void)) ++{ ++ int *new_list; ++ switch (cmd) { ++#ifdef CIOCGSESSINFO ++ case DEVCRYPTO_CMD_USE_SOFTDRIVERS: ++ switch (i) { ++ case DEVCRYPTO_REQUIRE_ACCELERATED: ++ case DEVCRYPTO_USE_SOFTWARE: ++ case DEVCRYPTO_REJECT_SOFTWARE: ++ break; ++ default: ++ fprintf(stderr, "devcrypto: invalid value (%ld) for USE_SOFTDRIVERS\n", i); ++ return 0; ++ } ++ if (use_softdrivers == i) ++ return 1; ++ use_softdrivers = i; ++#ifdef IMPLEMENT_DIGEST ++ rebuild_known_digest_nids(e); ++#endif ++ rebuild_known_cipher_nids(e); ++ return 1; ++#endif /* CIOCGSESSINFO */ ++ ++ case DEVCRYPTO_CMD_CIPHERS: ++ if (p == NULL) ++ return 1; ++ if (strcasecmp((const char *)p, "ALL") == 0) { ++ devcrypto_select_all_ciphers(selected_ciphers); ++ } else if (strcasecmp((const char*)p, "NONE") == 0) { ++ memset(selected_ciphers, 0, sizeof(selected_ciphers)); ++ } else { ++ new_list=OPENSSL_zalloc(sizeof(selected_ciphers)); ++ if (!CONF_parse_list(p, ',', 1, cryptodev_select_cipher_cb, new_list)) { ++ OPENSSL_free(new_list); ++ return 0; ++ } ++ memcpy(selected_ciphers, new_list, sizeof(selected_ciphers)); ++ OPENSSL_free(new_list); ++ } ++ rebuild_known_cipher_nids(e); ++ return 1; ++ ++#ifdef IMPLEMENT_DIGEST ++ case DEVCRYPTO_CMD_DIGESTS: ++ if (p == NULL) ++ return 1; ++ if (strcasecmp((const char *)p, "ALL") == 0) { ++ devcrypto_select_all_digests(selected_digests); ++ } else if (strcasecmp((const char*)p, "NONE") == 0) { ++ memset(selected_digests, 0, sizeof(selected_digests)); ++ } else { ++ new_list=OPENSSL_zalloc(sizeof(selected_digests)); ++ if (!CONF_parse_list(p, ',', 1, cryptodev_select_digest_cb, new_list)) { ++ OPENSSL_free(new_list); ++ return 0; ++ } ++ memcpy(selected_digests, new_list, sizeof(selected_digests)); ++ OPENSSL_free(new_list); ++ } ++ rebuild_known_digest_nids(e); ++ return 1; ++#endif /* IMPLEMENT_DIGEST */ ++ ++ case DEVCRYPTO_CMD_DUMP_INFO: ++ dump_cipher_info(); ++#ifdef IMPLEMENT_DIGEST ++ dump_digest_info(); ++#endif ++ return 1; ++ ++ default: ++ break; ++ } ++ return 0; ++} ++ ++/****************************************************************************** ++ * ++ * LOAD / UNLOAD ++ * ++ *****/ ++ ++/* ++ * Opens /dev/crypto ++ */ ++static int open_devcrypto(void) ++{ ++ if (cfd >= 0) ++ return 1; ++ ++ if ((cfd = open("/dev/crypto", O_RDWR, 0)) < 0) { ++#ifndef ENGINE_DEVCRYPTO_DEBUG ++ if (errno != ENOENT) ++#endif ++ fprintf(stderr, "Could not open /dev/crypto: %s\n", strerror(errno)); ++ return 0; ++ } ++ ++ return 1; ++} ++ ++static int close_devcrypto(void) ++{ ++ int ret; ++ ++ if (cfd < 0) ++ return 1; ++ ret = close(cfd); ++ cfd = -1; ++ if (ret != 0) { ++ fprintf(stderr, "Error closing /dev/crypto: %s\n", strerror(errno)); ++ return 0; ++ } ++ return 1; ++} ++ ++static int devcrypto_unload(ENGINE *e) ++{ ++ destroy_all_cipher_methods(); ++#ifdef IMPLEMENT_DIGEST ++ destroy_all_digest_methods(); ++#endif ++ ++ close_devcrypto(); ++ ++ return 1; ++} ++ ++static int bind_devcrypto(ENGINE *e) { ++ ++ if (!ENGINE_set_id(e, engine_devcrypto_id) ++ || !ENGINE_set_name(e, "/dev/crypto engine") ++ || !ENGINE_set_destroy_function(e, devcrypto_unload) ++ || !ENGINE_set_cmd_defns(e, devcrypto_cmds) ++ || !ENGINE_set_ctrl_function(e, devcrypto_ctrl)) ++ return 0; ++ ++ prepare_cipher_methods(); ++#ifdef IMPLEMENT_DIGEST ++ prepare_digest_methods(); ++#endif ++ ++ return (ENGINE_set_ciphers(e, devcrypto_ciphers) ++#ifdef IMPLEMENT_DIGEST ++ && ENGINE_set_digests(e, devcrypto_digests) ++#endif ++/* ++ * Asymmetric ciphers aren't well supported with /dev/crypto. Among the BSD ++ * implementations, it seems to only exist in FreeBSD, and regarding the ++ * parameters in its crypt_kop, the manual crypto(4) has this to say: ++ * ++ * The semantics of these arguments are currently undocumented. ++ * ++ * Reading through the FreeBSD source code doesn't give much more than ++ * their CRK_MOD_EXP implementation for ubsec. ++ * ++ * It doesn't look much better with cryptodev-linux. They have the crypt_kop ++ * structure as well as the command (CRK_*) in cryptodev.h, but no support ++ * seems to be implemented at all for the moment. ++ * ++ * At the time of writing, it seems impossible to write proper support for ++ * FreeBSD's asym features without some very deep knowledge and access to ++ * specific kernel modules. ++ * ++ * /Richard Levitte, 2017-05-11 ++ */ ++#if 0 ++# ifndef OPENSSL_NO_RSA ++ && ENGINE_set_RSA(e, devcrypto_rsa) ++# endif ++# ifndef OPENSSL_NO_DSA ++ && ENGINE_set_DSA(e, devcrypto_dsa) ++# endif ++# ifndef OPENSSL_NO_DH ++ && ENGINE_set_DH(e, devcrypto_dh) ++# endif ++# ifndef OPENSSL_NO_EC ++ && ENGINE_set_EC(e, devcrypto_ec) ++# endif ++#endif ++ ); ++} ++ ++#ifdef OPENSSL_NO_DYNAMIC_ENGINE ++/* ++ * In case this engine is built into libcrypto, then it doesn't offer any ++ * ability to be dynamically loadable. ++ */ ++void engine_load_devcrypto_int(void) ++{ ++ ENGINE *e = NULL; ++ ++ if (!open_devcrypto()) ++ return; ++ ++ if ((e = ENGINE_new()) == NULL ++ || !bind_devcrypto(e)) { ++ close_devcrypto(); ++ ENGINE_free(e); ++ return; ++ } ++ ++ ENGINE_add(e); ++ ENGINE_free(e); /* Loose our local reference */ ++ ERR_clear_error(); ++} ++ ++#else ++ ++static int bind_helper(ENGINE *e, const char *id) ++{ ++ if ((id && (strcmp(id, engine_devcrypto_id) != 0)) ++ || !open_devcrypto()) ++ return 0; ++ if (!bind_devcrypto(e)) { ++ close_devcrypto(); ++ return 0; ++ } ++ return 1; ++} ++ ++IMPLEMENT_DYNAMIC_CHECK_FN() ++IMPLEMENT_DYNAMIC_BIND_FN(bind_helper) ++ ++#endif diff --git a/package/libs/openssl/patches/500-e_devcrypto-default-to-not-use-digests-in-engine.patch b/package/libs/openssl/patches/500-e_devcrypto-default-to-not-use-digests-in-engine.patch new file mode 100644 index 0000000000..bca198eb34 --- /dev/null +++ b/package/libs/openssl/patches/500-e_devcrypto-default-to-not-use-digests-in-engine.patch @@ -0,0 +1,41 @@ +From 5d3be6bc8ed7d73ab2c4d389fb0f0a03dacd04b1 Mon Sep 17 00:00:00 2001 +From: Eneas U de Queiroz +Date: Mon, 11 Mar 2019 09:29:13 -0300 +Subject: [PATCH] e_devcrypto: default to not use digests in engine + +Digests are almost always slower when using /dev/crypto because of the +cost of the context switches. Only for large blocks it is worth it. + +Also, when forking, the open context structures are duplicated, but the +internal kernel sessions are still shared between forks, which means an +update/close operation in one fork affects all processes using that +session. + +This affects digests, especially for HMAC, where the session with the +key hash is used as a source for subsequent operations. At least one +popular application does this across a fork. Disabling digests by +default will mitigate the problem, while still allowing the user to +turn them on if it is safe and fast enough. + +Signed-off-by: Eneas U de Queiroz + +--- a/engines/e_devcrypto.c ++++ b/engines/e_devcrypto.c +@@ -854,7 +854,7 @@ static void prepare_digest_methods(void) + for (i = 0, known_digest_nids_amount = 0; i < OSSL_NELEM(digest_data); + i++) { + +- selected_digests[i] = 1; ++ selected_digests[i] = 0; + + /* + * Check that the digest is usable +@@ -1074,7 +1074,7 @@ static const ENGINE_CMD_DEFN devcrypto_c + #ifdef IMPLEMENT_DIGEST + {DEVCRYPTO_CMD_DIGESTS, + "DIGESTS", +- "either ALL, NONE, or a comma-separated list of digests to enable [default=ALL]", ++ "either ALL, NONE, or a comma-separated list of digests to enable [default=NONE]", + ENGINE_CMD_FLAG_STRING}, + #endif + diff --git a/package/libs/openssl/patches/510-e_devcrypto-ignore-error-when-closing-session.patch b/package/libs/openssl/patches/510-e_devcrypto-ignore-error-when-closing-session.patch new file mode 100644 index 0000000000..fb69599aeb --- /dev/null +++ b/package/libs/openssl/patches/510-e_devcrypto-ignore-error-when-closing-session.patch @@ -0,0 +1,24 @@ +From b6e6d157367bae91a8015434769572e430257d40 Mon Sep 17 00:00:00 2001 +From: Eneas U de Queiroz +Date: Mon, 11 Mar 2019 10:15:14 -0300 +Subject: [PATCH] e_devcrypto: ignore error when closing session + +In cipher_init, ignore an eventual error when closing the previous +session. It may have been closed by another process after a fork. + +Signed-off-by: Eneas U de Queiroz + +--- a/engines/e_devcrypto.c ++++ b/engines/e_devcrypto.c +@@ -197,9 +197,8 @@ static int cipher_init(EVP_CIPHER_CTX *c + get_cipher_data(EVP_CIPHER_CTX_nid(ctx)); + + /* cleanup a previous session */ +- if (cipher_ctx->sess.ses != 0 && +- clean_devcrypto_session(&cipher_ctx->sess) == 0) +- return 0; ++ if (cipher_ctx->sess.ses != 0) ++ clean_devcrypto_session(&cipher_ctx->sess); + + cipher_ctx->sess.cipher = cipher_d->devcryptoid; + cipher_ctx->sess.keylen = cipher_d->keylen; diff --git a/package/libs/toolchain/Makefile b/package/libs/toolchain/Makefile index d76b0a875c..a63746c448 100644 --- a/package/libs/toolchain/Makefile +++ b/package/libs/toolchain/Makefile @@ -7,7 +7,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=toolchain -PKG_RELEASE:=1 +PKG_RELEASE:=2 PKG_MAINTAINER:=Felix Fietkau PKG_LICENSE:=GPL-3.0-with-GCC-exception diff --git a/package/libs/uclibc++/Makefile b/package/libs/uclibc++/Makefile index 7133a7ef33..763e0d9e4d 100644 --- a/package/libs/uclibc++/Makefile +++ b/package/libs/uclibc++/Makefile @@ -9,12 +9,12 @@ include $(TOPDIR)/rules.mk PKG_NAME:=uclibc++ -PKG_VERSION:=0.2.4 -PKG_RELEASE:=3 +PKG_VERSION:=0.2.5 +PKG_RELEASE:=1 -PKG_SOURCE:=uClibc++-$(PKG_VERSION).tar.bz2 -PKG_SOURCE_URL:=http://cxx.uclibc.org/src/ -PKG_HASH:=be16fc6a6eb2e59df420ee41e7042f38e27ebaf5c2762d90e75803364a7b00db +PKG_SOURCE:=uClibc++-$(PKG_VERSION).tar.xz +PKG_SOURCE_URL:=https://cxx.uclibc.org/src/ +PKG_HASH:=596fb9ed7295564ce4c70ae6076a18f92e72f70310d70c98520bbca85c77895a PKG_BUILD_DIR:=$(BUILD_DIR)/uClibc++-$(PKG_VERSION) PKG_BUILD_PARALLEL:=1 @@ -30,7 +30,7 @@ define Package/uclibcxx SECTION:=libs CATEGORY:=Libraries TITLE:=C++ library for embedded systems - URL:=http://cxx.uclibc.org/src/ + URL:=https://cxx.uclibc.org/ endef UCLIBC_TARGET_ARCH:=$(shell echo $(ARCH) | sed -e s'/-.*//' \ @@ -45,7 +45,8 @@ UCLIBC_TARGET_ARCH:=$(shell echo $(ARCH) | sed -e s'/-.*//' \ -e 's/mipsel.*/mips/' \ ) -TARGET_CFLAGS += $(FPIC) +TARGET_CFLAGS += $(FPIC) -nostdinc++ +TARGET_LDFLAGS += -Wl,--gc-sections ifneq ($(CONFIG_CCACHE),) TARGET_CXX=$(TARGET_CXX_NOCACHE) @@ -56,24 +57,15 @@ SSP_LIB=-lssp_nonshared endif MAKE_FLAGS:= \ - TOPDIR="$(PKG_BUILD_DIR)/" \ $(TARGET_CONFIGURE_OPTS) \ CPU_CFLAGS="$(TARGET_CFLAGS)" \ - CROSS="$(TARGET_CROSS)" \ - LDFLAGS="-Wl,--warn-common -Wl,--warn-once -Wl,-z,combreloc -Wl,-z,defs $(TARGET_LDFLAGS)" \ - CP="$(CP)" \ + CROSS_COMPILE="$(TARGET_CROSS)" \ + LDFLAGS="$(TARGET_LDFLAGS)" \ GEN_LIBS="-lc $(LIBGCC_S) $(SSP_LIB)" \ - GEN_CFLAGS="-std=gnu++98 -nostdinc++" \ check_as_needed= # check_as_needed overrides dependency on libgcc_s -define Build/Prepare - $(PKG_UNPACK) - $(SED) 's/\r$$$$//' $(PKG_BUILD_DIR)/include/unwind-cxx.h - $(Build/Patch) -endef - define Build/Configure if [ -f ./files/config.$(UCLIBC_TARGET_ARCH) ]; then \ cp ./files/config.$(UCLIBC_TARGET_ARCH) $(PKG_BUILD_DIR)/.config; \ diff --git a/package/libs/uclibc++/files/config.default b/package/libs/uclibc++/files/config.default index 944e1a6cfb..d76670e969 100644 --- a/package/libs/uclibc++/files/config.default +++ b/package/libs/uclibc++/files/config.default @@ -8,7 +8,7 @@ UCLIBCXX_HAS_FLOATS=y # UCLIBCXX_HAS_LONG_DOUBLE is not set # UCLIBCXX_HAS_TLS is not set -WARNINGS="-Wall" +UCLIBCXX_WARNINGS="" BUILD_EXTRA_LIBRARIES="" HAVE_DOT_CONFIG=y @@ -23,10 +23,10 @@ UCLIBCXX_SUPPORT_CIN=y UCLIBCXX_SUPPORT_COUT=y UCLIBCXX_SUPPORT_CERR=y UCLIBCXX_SUPPORT_CLOG=y -UCLIBCXX_SUPPORT_WCIN=y -UCLIBCXX_SUPPORT_WCOUT=y -UCLIBCXX_SUPPORT_WCERR=y -UCLIBCXX_SUPPORT_WCLOG=y +# UCLIBCXX_SUPPORT_WCIN is not set +# UCLIBCXX_SUPPORT_WCOUT is not set +# UCLIBCXX_SUPPORT_WCERR is not set +# UCLIBCXX_SUPPORT_WCLOG is not set # # STL and Code Expansion diff --git a/package/libs/uclibc++/patches/001-no-ansi.patch b/package/libs/uclibc++/patches/001-no-ansi.patch new file mode 100644 index 0000000000..7ddbf52f00 --- /dev/null +++ b/package/libs/uclibc++/patches/001-no-ansi.patch @@ -0,0 +1,10 @@ +--- a/Rules.mak ++++ b/Rules.mak +@@ -232,7 +232,6 @@ endif + GEN_CXXFLAGS:=-nostdinc++ + GEN_CXXFLAGS+=$(if $(CXXFLAG_-fvisibility-inlines-hidden),-DGCC_HASCLASSVISIBILITY) + CXXFLAGS:=$(CFLAGS) +-CFLAGS += -ansi + + LIBGCC:=$(shell $(CC) -print-libgcc-file-name) + LIBGCC_DIR:=$(dir $(LIBGCC)) diff --git a/package/libs/uclibc++/patches/002-path_to_bash.patch b/package/libs/uclibc++/patches/002-path_to_bash.patch deleted file mode 100644 index 26d88ee4dd..0000000000 --- a/package/libs/uclibc++/patches/002-path_to_bash.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/bin/Makefile -+++ b/bin/Makefile -@@ -13,7 +13,7 @@ install: - $(INSTALL) -m 755 $(WRAPPER) $(PREFIX)$(UCLIBCXX_RUNTIME_BINDIR) - - $(WRAPPER): Makefile -- echo '#!/bin/sh' > $@ -+ echo '#!/usr/bin/env bash' > $@ - echo '' >> $@ - echo 'WRAPPER_INCLUDEDIR="$${WRAPPER_INCLUDEDIR:=-I$(UCLIBCXX_RUNTIME_INCLUDEDIR)}"' >> $@ - echo 'WRAPPER_LIBDIR="$${WRAPPER_LIBDIR:=-L$(UCLIBCXX_RUNTIME_LIBDIR)}"' >> $@ diff --git a/package/libs/uclibc++/patches/002-quote-fix.patch b/package/libs/uclibc++/patches/002-quote-fix.patch new file mode 100644 index 0000000000..49e7ac3d14 --- /dev/null +++ b/package/libs/uclibc++/patches/002-quote-fix.patch @@ -0,0 +1,13 @@ +--- a/bin/Makefile.in ++++ b/bin/Makefile.in +@@ -44,8 +44,8 @@ define do_wrapper + $(Q)echo ' WRAPPER_OPTIONS="$$WRAPPER_OPTIONS -nodefaultlibs $$WRAPPER_LIBDIR -l$(LNAME) $$WRAPPER_LIBS"' >> $@.tmp + $(Q)echo 'fi' >> $@.tmp + $(Q)echo '' >> $@.tmp +- $(Q)echo '[ -n "$$V" ] && [ $$V -gt 1 ] && echo $(CXX) $(GEN_CFLAGS) $(GEN_CXXFLAGS) $(EH_CXXFLAGS) $$WRAPPER_INCLUDEDIR "$$@" $$WRAPPER_OPTIONS' >> $@.tmp +- $(Q)echo 'exec $(CXX) $(GEN_CFLAGS) $(GEN_CXXFLAGS) $(EH_CXXFLAGS) $$WRAPPER_INCLUDEDIR "$$@" $$WRAPPER_OPTIONS' >> $@.tmp ++ $(Q)echo '[ -n "$$V" ] && [ $$V -gt 1 ] && echo $(CXX) $(GEN_CFLAGS) $(GEN_CXXFLAGS) $(EH_CXXFLAGS) $$WRAPPER_INCLUDEDIR $$@ $$WRAPPER_OPTIONS' >> $@.tmp ++ $(Q)echo 'exec $(CXX) $(GEN_CFLAGS) $(GEN_CXXFLAGS) $(EH_CXXFLAGS) $$WRAPPER_INCLUDEDIR $$@ $$WRAPPER_OPTIONS' >> $@.tmp + $(Q)echo '' >> $@.tmp + $(Q)chmod 0755 $@.tmp + $(Q)mv $@.tmp $@ diff --git a/package/libs/uclibc++/patches/003-no-fPIC.patch b/package/libs/uclibc++/patches/003-no-fPIC.patch new file mode 100644 index 0000000000..206a00de32 --- /dev/null +++ b/package/libs/uclibc++/patches/003-no-fPIC.patch @@ -0,0 +1,10 @@ +--- a/Rules.mak ++++ b/Rules.mak +@@ -185,7 +185,6 @@ export UCLIBCXX_RUNTIME_PREFIX UCLIBCXX_RUNTIME_LIBDIR UCLIBCXX_RUNTIME_BINDIR U + + WRAPPER = $(top_builddir)bin/g++-uc + OPTIMIZATION:= +-PICFLAG:=-fPIC + + # use '-Os' optimization if available, else use -O2, allow Config to override + $(eval $(call check-gcc-var,-Os)) diff --git a/package/libs/uclibc++/patches/004-no-pedantic.patch b/package/libs/uclibc++/patches/004-no-pedantic.patch new file mode 100644 index 0000000000..5128ca3f83 --- /dev/null +++ b/package/libs/uclibc++/patches/004-no-pedantic.patch @@ -0,0 +1,13 @@ +--- a/Rules.mak ++++ b/Rules.mak +@@ -200,10 +200,6 @@ $(eval $(call check-gxx-var,-std=gnu++14)) + $(eval $(call check-gxx-var,-Wno-sized-deallocation)) + $(eval $(call check-gxx-var,-Wno-tautological-compare)) + +-# Add a bunch of extra pedantic annoyingly strict checks +-XWARNINGS=$(call qstrip,$(UCLIBCXX_WARNINGS)) -Wno-trigraphs -pedantic +-CPU_CFLAGS=$(call qstrip,$(CPU_CFLAGS-y)) +- + # Some nice CFLAGS to work with + GEN_CFLAGS:=-fno-builtin + CFLAGS:=$(XWARNINGS) $(CPU_CFLAGS) diff --git a/package/libs/uclibc++/patches/006-eabi_fix.patch b/package/libs/uclibc++/patches/006-eabi_fix.patch deleted file mode 100644 index 893c2d60b6..0000000000 --- a/package/libs/uclibc++/patches/006-eabi_fix.patch +++ /dev/null @@ -1,38 +0,0 @@ ---- a/include/typeinfo -+++ b/include/typeinfo -@@ -44,6 +44,7 @@ namespace __cxxabiv1 - class __class_type_info; - } // namespace __cxxabiv1 - -+#ifndef __GXX_MERGED_TYPEINFO_NAMES - #if !__GXX_WEAK__ - // If weak symbols are not supported, typeinfo names are not merged. - #define __GXX_MERGED_TYPEINFO_NAMES 0 -@@ -51,6 +52,7 @@ namespace __cxxabiv1 - // On platforms that support weak symbols, typeinfo names are merged. - #define __GXX_MERGED_TYPEINFO_NAMES 1 - #endif -+#endif - - namespace std - { ---- a/include/unwind-cxx.h -+++ b/include/unwind-cxx.h -@@ -173,6 +173,7 @@ extern std::unexpected_handler __unexpec - - // This is the exception class we report -- "GNUCC++\0". - const _Unwind_Exception_Class __gxx_exception_class -+#ifndef __ARM_EABI_UNWINDER__ - = ((((((((_Unwind_Exception_Class) 'G' - << 8 | (_Unwind_Exception_Class) 'N') - << 8 | (_Unwind_Exception_Class) 'U') -@@ -181,6 +182,9 @@ const _Unwind_Exception_Class __gxx_exce - << 8 | (_Unwind_Exception_Class) '+') - << 8 | (_Unwind_Exception_Class) '+') - << 8 | (_Unwind_Exception_Class) '\0'); -+#else -+= "GNUC++"; -+#endif - - // GNU C++ personality routine, Version 0. - extern "C" _Unwind_Reason_Code __gxx_personality_v0 diff --git a/package/libs/uclibc++/patches/010-honor-ldflags.patch b/package/libs/uclibc++/patches/010-honor-ldflags.patch deleted file mode 100644 index b1050cb1bd..0000000000 --- a/package/libs/uclibc++/patches/010-honor-ldflags.patch +++ /dev/null @@ -1,23 +0,0 @@ ---- a/src/Makefile -+++ b/src/Makefile -@@ -3,9 +3,9 @@ include $(TOPDIR)Rules.mak - - WR_CXX := WRAPPER_INCLUDEDIR=-I$(TOPDIR)include $(TOPDIR)bin/g++-uc - --LDFLAGS += -nodefaultlibs -shared -Wl,-soname,$(SHARED_MAJORNAME) $(BUILD_EXTRA_LIBRARIES) -+EXTRA_LDFLAGS += -nodefaultlibs -shared -Wl,-soname,$(SHARED_MAJORNAME) $(BUILD_EXTRA_LIBRARIES) - ifneq ($(DODEBUG),y) --LDFLAGS += -Wl,-s -+EXTRA_LDFLAGS += -Wl,-s - endif - - SRCS = $(wildcard *.cpp) -@@ -60,7 +60,7 @@ $(LIBNAME).a: libgcc_eh libsupc $(EXOBJS - $(RANLIB) $@ - - $(SHARED_FULLNAME): libgcc_eh libsupc $(EXOBJS) -- $(CC) $(LDFLAGS) -o $@ $(EXOBJS) $(SUPOBJS) $(GCCOBJS) $(LIBS) -+ $(CC) $(LDFLAGS) $(EXTRA_LDFLAGS) -o $@ $(EXOBJS) $(SUPOBJS) $(GCCOBJS) $(LIBS) - $(LN) $@ $(SHARED_MAJORNAME) - $(LN) $(SHARED_MAJORNAME) $(LIBNAME).so - diff --git a/package/libs/uclibc++/patches/020-template-fix.patch b/package/libs/uclibc++/patches/020-template-fix.patch deleted file mode 100644 index f7cc09e140..0000000000 --- a/package/libs/uclibc++/patches/020-template-fix.patch +++ /dev/null @@ -1,22 +0,0 @@ ---- a/include/ostream -+++ b/include/ostream -@@ -294,7 +294,7 @@ namespace std { - #endif - #endif - -- template > -+ template - class _UCXXEXPORT basic_ostream::sentry - { - bool ok; ---- a/include/istream -+++ b/include/istream -@@ -340,7 +340,7 @@ namespace std{ - - }; - -- template > class _UCXXEXPORT basic_istream::sentry { -+ template class _UCXXEXPORT basic_istream::sentry { - bool ok; - public: - explicit _UCXXEXPORT sentry(basic_istream& os, bool noskipws = false){ diff --git a/package/libs/uclibc++/patches/030-memory_corruption_fix.patch b/package/libs/uclibc++/patches/030-memory_corruption_fix.patch deleted file mode 100644 index e34efdbb15..0000000000 --- a/package/libs/uclibc++/patches/030-memory_corruption_fix.patch +++ /dev/null @@ -1,114 +0,0 @@ -From 1dc865b8bbb3911abc8ce53c7ae8a59dc90f6fc3 Mon Sep 17 00:00:00 2001 -From: Ivan Kold -Date: Thu, 3 Mar 2016 12:56:30 -0800 -Subject: [PATCH] Fix throw statement causing memory corruption - -The __cxxabiv1::__cxa_throw in the GCC's libsupc++ expects -sizeof(__cxa_refcounted_exception) bytes be allocated before -exception object. -uClibc++ allocates only sizeof(__cxa_exception) before an -exception object. -The __cxxabiv1::__cxa_throw writes in memory before allocated: -// gcc-5.2.0/libstdc++-v3/libsupc++/eh_throw.cc:69 -__cxa_refcounted_exception *header - = __get_refcounted_exception_header_from_obj (obj); -header->referenceCount = 1; - -Signed-off-by: Ivan Kold ---- - include/unwind-cxx.h | 34 +++++++++++++++++++++++++++++++++- - src/eh_alloc.cpp | 8 ++++---- - 2 files changed, 37 insertions(+), 5 deletions(-) - ---- a/include/unwind-cxx.h -+++ b/include/unwind-cxx.h -@@ -1,5 +1,5 @@ - // -*- C++ -*- Exception handling and frame unwind runtime interface routines. --// Copyright (C) 2001 Free Software Foundation, Inc. -+// Copyright (C) 2001-2015 Free Software Foundation, Inc. - // - // This file is part of GCC. - // -@@ -13,6 +13,10 @@ - // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - // GNU General Public License for more details. - // -+// Under Section 7 of GPL version 3, you are granted additional -+// permissions described in the GCC Runtime Library Exception, version -+// 3.1, as published by the Free Software Foundation. -+// - // You should have received a copy of the GNU General Public License - // along with GCC; see the file COPYING. If not, write to - // the Free Software Foundation, 59 Temple Place - Suite 330, -@@ -40,6 +44,12 @@ - #include - #include "unwind.h" - -+// Original unwind-cxx.h also includes bits/atomic_word.h which is CPU-specific, -+// but always defines _Atomic_word as typedef int . -+// Only thing that differs is memory-barrier macroses. -+typedef int _Atomic_word; -+ -+ - #pragma GCC visibility push(default) - - namespace __cxxabiv1 -@@ -79,6 +89,13 @@ struct __cxa_exception - _Unwind_Exception unwindHeader; - }; - -+struct __cxa_refcounted_exception -+{ -+ // Manage this header. -+ _Atomic_word referenceCount; -+ // __cxa_exception must be last, and no padding can be after it. -+ __cxa_exception exc; -+}; - - // A dependent C++ exception object consists of a header, which is a wrapper - // around an unwind object header with additional C++ specific information, -@@ -210,6 +227,21 @@ __get_exception_header_from_ue (_Unwind_ - return reinterpret_cast<__cxa_exception *>(exc + 1) - 1; - } - -+// Acquire the C++ refcounted exception header from the C++ object. -+static inline __cxa_refcounted_exception * -+__get_refcounted_exception_header_from_obj (void *ptr) -+{ -+ return reinterpret_cast<__cxa_refcounted_exception *>(ptr) - 1; -+} -+ -+// Acquire the C++ refcounted exception header from the generic exception -+// header. -+static inline __cxa_refcounted_exception * -+__get_refcounted_exception_header_from_ue (_Unwind_Exception *exc) -+{ -+ return reinterpret_cast<__cxa_refcounted_exception *>(exc + 1) - 1; -+} -+ - } /* namespace __cxxabiv1 */ - - #pragma GCC visibility pop ---- a/src/eh_alloc.cpp -+++ b/src/eh_alloc.cpp -@@ -30,16 +30,16 @@ extern "C" void * __cxa_allocate_excepti - void *retval; - //The sizeof crap is required by Itanium ABI because we need to provide space for - //accounting information which is implementaion (gcc) specified -- retval = malloc (thrown_size + sizeof(__cxa_exception)); -+ retval = malloc (thrown_size + sizeof(__cxa_refcounted_exception)); - if (0 == retval){ - std::terminate(); - } -- memset (retval, 0, sizeof(__cxa_exception)); -- return (void *)((unsigned char *)retval + sizeof(__cxa_exception)); -+ memset (retval, 0, sizeof(__cxa_refcounted_exception)); -+ return (void *)((unsigned char *)retval + sizeof(__cxa_refcounted_exception)); - } - - extern "C" void __cxa_free_exception(void *vptr) throw(){ -- free( (char *)(vptr) - sizeof(__cxa_exception) ); -+ free( (char *)(vptr) - sizeof(__cxa_refcounted_exception) ); - } - - diff --git a/package/libs/uclibc++/patches/040-delete-c++14.patch b/package/libs/uclibc++/patches/040-delete-c++14.patch deleted file mode 100644 index f48a78f0a4..0000000000 --- a/package/libs/uclibc++/patches/040-delete-c++14.patch +++ /dev/null @@ -1,20 +0,0 @@ ---- a/src/del_op.cpp -+++ b/src/del_op.cpp -@@ -24,3 +24,7 @@ - _UCXXEXPORT void operator delete(void* ptr) throw(){ - free(ptr); - } -+ -+_UCXXEXPORT void operator delete(void* ptr, size_t size) throw(){ -+ free(ptr); -+} ---- a/src/del_opv.cpp -+++ b/src/del_opv.cpp -@@ -24,3 +24,7 @@ - _UCXXEXPORT void operator delete[](void * ptr) throw(){ - free(ptr); - } -+ -+_UCXXEXPORT void operator delete[](void * ptr, size_t size) throw(){ -+ free(ptr); -+} diff --git a/package/libs/uclibc++/patches/050-Bugfix-erase-on-derived-__base_associative.patch b/package/libs/uclibc++/patches/050-Bugfix-erase-on-derived-__base_associative.patch deleted file mode 100644 index 2ddb8a984e..0000000000 --- a/package/libs/uclibc++/patches/050-Bugfix-erase-on-derived-__base_associative.patch +++ /dev/null @@ -1,40 +0,0 @@ -From 946b29e62927eadfc4e87f27b8d30e5974b78c4c Mon Sep 17 00:00:00 2001 -From: Ben Kelly -Date: Mon, 6 Feb 2017 13:08:25 +0200 -Subject: [PATCH] Bugfix erase() on derived __base_associative - -When calling erase() on a containers derived from __base_associative -(e.g. multimap) and providing a pair of iterators a segfault will -occur. - -Example code to reproduce: - - typedef std::multimap testmap; - testmap t; - t.insert(std::pair(1, 1)); - t.insert(std::pair(2, 1)); - t.insert(std::pair(3, 1)); - t.erase(t.begin(), t.end()); - -Signed-off-by: Ben Kelly ---- - include/associative_base | 3 +-- - 1 file changed, 1 insertion(+), 2 deletions(-) - -diff --git a/include/associative_base b/include/associative_base -index 27ae0ef..be8b27f 100644 ---- a/include/associative_base -+++ b/include/associative_base -@@ -200,8 +200,7 @@ public: - } - void erase(iterator first, iterator last){ - while(first != last){ -- backing.erase(first.base_iterator()); -- ++first; -+ first = backing.erase(first.base_iterator()); - } - } - --- -2.7.4 - diff --git a/package/libs/uclient/Makefile b/package/libs/uclient/Makefile index 1e41298658..8fdb4805e7 100644 --- a/package/libs/uclient/Makefile +++ b/package/libs/uclient/Makefile @@ -5,9 +5,9 @@ PKG_RELEASE=1 PKG_SOURCE_PROTO:=git PKG_SOURCE_URL=$(PROJECT_GIT)/uclient.git -PKG_SOURCE_DATE:=2018-11-24 -PKG_SOURCE_VERSION:=3ba74ebc9363993ea2a83fd73b4c1b1a96e73940 -PKG_MIRROR_HASH:=3c456a8ab965ed8db216ac1bfaf2b974e2f689137a7c35d0220e5b7d9c42a994 +PKG_MIRROR_HASH:=b1127b28f98c9b45e046a76086b281b35c094fad1dc511ce0af095b733c86359 +PKG_SOURCE_DATE:=2019-05-30 +PKG_SOURCE_VERSION:=3b3e368dead01979e985cb167873fe9868b15d19 CMAKE_INSTALL:=1 PKG_BUILD_DEPENDS:=ustream-ssl diff --git a/package/libs/wolfssl/Config.in b/package/libs/wolfssl/Config.in index 50b0bb9cdf..a729f73a1d 100644 --- a/package/libs/wolfssl/Config.in +++ b/package/libs/wolfssl/Config.in @@ -4,16 +4,8 @@ config WOLFSSL_HAS_AES_CCM bool "Include AES-CCM support" default y -config WOLFSSL_HAS_AES_GCM - bool "Include AES-GCM support" - default y - -config WOLFSSL_HAS_CHACHA - bool "Include ChaCha cipher suite support" - default n - -config WOLFSSL_HAS_ECC - bool "Include ECC (Elliptic Curve Cryptography) support" +config WOLFSSL_HAS_CHACHA_POLY + bool "Include ChaCha20-Poly1305 cipher suite support" default y config WOLFSSL_HAS_DH @@ -24,12 +16,12 @@ config WOLFSSL_HAS_ARC4 bool "Include ARC4 support" default y -config WOLFSSL_HAS_DES3 - bool "Include DES3 (Tripple-DES) support" +config WOLFSSL_HAS_TLSV10 + bool "Include TLS 1.0 support" default y -config WOLFSSL_HAS_PSK - bool "Include PKS (Pre Share Key) support" +config WOLFSSL_HAS_TLSV13 + bool "Include TLS 1.3 support" default y config WOLFSSL_HAS_SESSION_TICKET @@ -41,20 +33,45 @@ config WOLFSSL_HAS_DTLS default n config WOLFSSL_HAS_OCSP - bool "Include OSCP support" + bool "Include OSCP stapling support" default y config WOLFSSL_HAS_WPAS bool "Include wpa_supplicant support" + select WOLFSSL_HAS_ARC4 + select WOLFSSL_HAS_OCSP + select WOLFSSL_HAS_SESSION_TICKET default y config WOLFSSL_HAS_ECC25519 bool "Include ECC Curve 22519 support" - depends on WOLFSSL_HAS_ECC default n -config WOLFSSL_HAS_POLY_1305 - bool "Include Poly-1305 support" - default n +config WOLFSSL_HAS_DEVCRYPTO + bool + +if WOLFSSL_HAS_AES_CCM + comment "! Hardware Acceleration does not build with AES-CCM enabled" +endif +if !WOLFSSL_HAS_AES_CCM + choice + prompt "Hardware Acceleration" + default WOLFSSL_HAS_NO_HW + + config WOLFSSL_HAS_NO_HW + bool "None" + + config WOLFSSL_HAS_AFALG + bool "AF_ALG" + + config WOLFSSL_HAS_DEVCRYPTO_AES + bool "/dev/crypto - AES-only" + select WOLFSSL_HAS_DEVCRYPTO + + config WOLFSSL_HAS_DEVCRYPTO_FULL + bool "/dev/crypto - full" + select WOLFSSL_HAS_DEVCRYPTO + endchoice +endif endif diff --git a/package/libs/wolfssl/Makefile b/package/libs/wolfssl/Makefile index 23bb1c5220..2ad03a5aca 100644 --- a/package/libs/wolfssl/Makefile +++ b/package/libs/wolfssl/Makefile @@ -8,29 +8,30 @@ include $(TOPDIR)/rules.mk PKG_NAME:=wolfssl -PKG_VERSION:=3.15.3-stable -PKG_RELEASE:=2 +PKG_VERSION:=4.1.0-stable +PKG_RELEASE:=1 -PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).zip -# PKG_SOURCE_URL:=https://www.wolfssl.com/ +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz PKG_SOURCE_URL:=https://github.com/wolfSSL/wolfssl/archive/v$(PKG_VERSION) -PKG_HASH:=dc97c07a7667b39a890e14f4b4a209f51524a4cabee7adb6c80822ee78c1f62a +PKG_HASH:=f0d630c3ddfeb692b8ae38cc739f47d5e9f0fb708662aa241ede0c42a5eb3dd8 PKG_FIXUP:=libtool PKG_INSTALL:=1 PKG_USE_MIPS16:=0 PKG_BUILD_PARALLEL:=1 -PKG_LICENSE:=GPL-2.0+ -PKG_CPE_ID:=cpe:/a:yassl:cyassl +PKG_LICENSE:=GPL-2.0-or-later +PKG_LICENSE_FILES:=LICENSING COPYING +PKG_MAINTAINER:=Eneas U de Queiroz +PKG_CPE_ID:=cpe:/a:wolfssl:wolfssl PKG_CONFIG_DEPENDS:=\ - CONFIG_WOLFSSL_HAS_AES_CCM CONFIG_WOLFSSL_HAS_AES_GCM \ - CONFIG_WOLFSSL_HAS_ARC4 CONFIG_WOLFSSL_HAS_CHACHA \ - CONFIG_WOLFSSL_HAS_DES3 CONFIG_WOLFSSL_HAS_DH CONFIG_WOLFSSL_HAS_DTLS \ - CONFIG_WOLFSSL_HAS_ECC CONFIG_WOLFSSL_HAS_ECC25519 \ - CONFIG_WOLFSSL_HAS_OCSP CONFIG_WOLFSSL_HAS_POLY_1305 \ - CONFIG_WOLFSSL_HAS_PSK CONFIG_WOLFSSL_HAS_SESSION_TICKET \ - CONFIG_WOLFSSL_HAS_WPAS + CONFIG_WOLFSSL_HAS_AES_CCM CONFIG_WOLFSSL_HAS_AFALG \ + CONFIG_WOLFSSL_HAS_ARC4 CONFIG_WOLFSSL_HAS_CHACHA_POLY \ + CONFIG_WOLFSSL_HAS_DEVCRYPTO_AES CONFIG_WOLFSSL_HAS_DEVCRYPTO_FULL \ + CONFIG_WOLFSSL_HAS_DH CONFIG_WOLFSSL_HAS_DTLS \ + CONFIG_WOLFSSL_HAS_ECC25519 CONFIG_WOLFSSL_HAS_OCSP \ + CONFIG_WOLFSSL_HAS_SESSION_TICKET CONFIG_WOLFSSL_HAS_TLSV10 \ + CONFIG_WOLFSSL_HAS_TLSV13 CONFIG_WOLFSSL_HAS_WPAS include $(INCLUDE_DIR)/package.mk @@ -42,7 +43,8 @@ define Package/libwolfssl URL:=http://www.wolfssl.com/ MENU:=1 PROVIDES:=libcyassl - ABI_VERSION:=18 + DEPENDS:=+WOLFSSL_HAS_DEVCRYPTO:kmod-cryptodev +WOLFSSL_HAS_AFALG:kmod-crypto-user + ABI_VERSION:=19 endef define Package/libwolfssl/description @@ -54,7 +56,7 @@ define Package/libwolfssl/config source "$(SOURCE)/Config.in" endef -TARGET_CFLAGS += $(FPIC) +TARGET_CFLAGS += $(FPIC) -DFP_MAX_BITS=8192 # --enable-stunnel needed for OpenSSL API compatibility bits CONFIGURE_ARGS += \ @@ -62,70 +64,20 @@ CONFIGURE_ARGS += \ --enable-sni \ --enable-stunnel \ --disable-examples \ - --disable-leanpsk \ - --disable-leantls \ - -ifeq ($(CONFIG_IPV6),y) -CONFIGURE_ARGS += \ - --enable-ipv6 -endif - -ifeq ($(CONFIG_WOLFSSL_HAS_AES_CCM),y) -CONFIGURE_ARGS += \ - --enable-aesccm -endif - -ifneq ($(CONFIG_WOLFSSL_HAS_AES_GCM),y) -CONFIGURE_ARGS += \ - --disable-aesgcm -endif - -ifneq ($(CONFIG_WOLFSSL_HAS_CHACHA),y) -CONFIGURE_ARGS += \ - --disable-chacha -endif - -ifeq ($(CONFIG_WOLFSSL_HAS_ECC),y) -CONFIGURE_ARGS += \ - --enable-ecc \ - --enable-supportedcurves -endif - -ifeq ($(CONFIG_WOLFSSL_HAS_DH),y) -CONFIGURE_ARGS += \ - --enable-dh -endif - -ifneq ($(CONFIG_WOLFSSL_HAS_ARC4),y) -CONFIGURE_ARGS += \ - --disable-arc4 -else -CONFIGURE_ARGS += \ - --enable-arc4 -endif - -ifneq ($(CONFIG_WOLFSSL_HAS_DES3),y) -CONFIGURE_ARGS += \ - --disable-des3 -else -CONFIGURE_ARGS += \ - --enable-des3 -endif - -ifeq ($(CONFIG_WOLFSSL_HAS_PSK),y) -CONFIGURE_ARGS += \ - --enable-psk -endif - -ifeq ($(CONFIG_WOLFSSL_HAS_SESSION_TICKET),y) -CONFIGURE_ARGS += \ - --enable-session-ticket -endif - -ifeq ($(CONFIG_WOLFSSL_HAS_DTLS),y) -CONFIGURE_ARGS += \ - --enable-dtls -endif + --disable-jobserver \ + --$(if $(CONFIG_IPV6),enable,disable)-ipv6 \ + --$(if $(CONFIG_WOLFSSL_HAS_AES_CCM),enable,disable)-aesccm \ + --$(if $(CONFIG_WOLFSSL_HAS_CHACHA_POLY),enable,disable)-chacha \ + --$(if $(CONFIG_WOLFSSL_HAS_CHACHA_POLY),enable,disable)-poly1305 \ + --$(if $(CONFIG_WOLFSSL_HAS_DH),enable,disable)-dh \ + --$(if $(CONFIG_WOLFSSL_HAS_ARC4),enable,disable)-arc4 \ + --$(if $(CONFIG_WOLFSSL_HAS_TLSV10),enable,disable)-tlsv10 \ + --$(if $(CONFIG_WOLFSSL_HAS_TLSV13),enable,disable)-tls13 \ + --$(if $(CONFIG_WOLFSSL_HAS_SESSION_TICKET),enable,disable)-session-ticket \ + --$(if $(CONFIG_WOLFSSL_HAS_DTLS),enable,disable)-dtls \ + --$(if $(CONFIG_WOLFSSL_HAS_ECC25519),enable,disable)-curve25519 \ + --$(if $(CONFIG_WOLFSSL_HAS_AFALG),enable,disable)-afalg \ + --enable-devcrypto=$(if $(CONFIG_WOLFSSL_HAS_DEVCRYPTO_AES),aes,$(if $(CONFIG_WOLFSSL_HAS_DEVCRYPTO_FULL),yes,no)) ifeq ($(CONFIG_WOLFSSL_HAS_OCSP),y) CONFIGURE_ARGS += \ @@ -137,23 +89,6 @@ CONFIGURE_ARGS += \ --enable-wpas --enable-sha512 --enable-fortress --enable-fastmath endif -ifeq ($(CONFIG_WOLFSSL_HAS_ECC25519),y) -CONFIGURE_ARGS += \ - --enable-curve25519 -endif - -ifneq ($(CONFIG_WOLFSSL_HAS_POLY1305),y) -CONFIGURE_ARGS += \ - --enable-poly1305 -endif - -#ifneq ($(CONFIG_TARGET_x86),) -# CONFIGURE_ARGS += --enable-intelasm -#endif -#ifneq ($(CONFIG_TARGET_x86_64),) -# CONFIGURE_ARGS += --enable-intelasm -#endif - define Build/InstallDev $(INSTALL_DIR) $(1)/usr/include $(1)/usr/lib/pkgconfig $(CP) $(PKG_INSTALL_DIR)/usr/include/* $(1)/usr/include/ diff --git a/package/libs/wolfssl/patches/100-disable-hardening-check.patch b/package/libs/wolfssl/patches/100-disable-hardening-check.patch index d913b5fdea..5d83eca770 100644 --- a/package/libs/wolfssl/patches/100-disable-hardening-check.patch +++ b/package/libs/wolfssl/patches/100-disable-hardening-check.patch @@ -1,6 +1,6 @@ --- a/wolfssl/wolfcrypt/settings.h +++ b/wolfssl/wolfcrypt/settings.h -@@ -1624,7 +1624,7 @@ extern void uITRON4_free(void *p) ; +@@ -1930,7 +1930,7 @@ extern void uITRON4_free(void *p) ; #endif /* warning for not using harden build options (default with ./configure) */ @@ -8,4 +8,4 @@ +#if 0 #if (defined(USE_FAST_MATH) && !defined(TFM_TIMING_RESISTANT)) || \ (defined(HAVE_ECC) && !defined(ECC_TIMING_RESISTANT)) || \ - (!defined(NO_RSA) && !defined(WC_RSA_BLINDING) && !defined(HAVE_FIPS)) + (!defined(NO_RSA) && !defined(WC_RSA_BLINDING) && !defined(HAVE_FIPS) && \ diff --git a/package/libs/wolfssl/patches/400-additional_compatibility.patch b/package/libs/wolfssl/patches/400-additional_compatibility.patch deleted file mode 100644 index 1464e9d2a8..0000000000 --- a/package/libs/wolfssl/patches/400-additional_compatibility.patch +++ /dev/null @@ -1,12 +0,0 @@ ---- a/cyassl/openssl/ssl.h -+++ b/cyassl/openssl/ssl.h -@@ -28,6 +28,9 @@ - #define CYASSL_OPENSSL_H_ - - #include -+#ifndef HAVE_SNI -+#undef CYASSL_SNI_HOST_NAME -+#endif - #include - - #endif diff --git a/package/libs/wolfssl/patches/900-remove-broken-autoconf-macros.patch b/package/libs/wolfssl/patches/900-remove-broken-autoconf-macros.patch deleted file mode 100644 index f7756b11c6..0000000000 --- a/package/libs/wolfssl/patches/900-remove-broken-autoconf-macros.patch +++ /dev/null @@ -1,21 +0,0 @@ ---- a/configure.ac -+++ b/configure.ac -@@ -4140,7 +4140,6 @@ AC_CONFIG_FILES([support/wolfssl.pc]) - AC_CONFIG_FILES([rpm/spec]) - - AX_CREATE_GENERIC_CONFIG --AX_AM_JOBSERVER([yes]) - - AC_OUTPUT - ---- a/Makefile.am -+++ b/Makefile.am -@@ -20,8 +20,6 @@ dist_noinst_SCRIPTS = - noinst_SCRIPTS = - check_SCRIPTS = - --#includes additional rules from aminclude.am --@INC_AMINCLUDE@ - DISTCLEANFILES+= aminclude.am - - CLEANFILES+= cert.der \ diff --git a/package/libs/zlib/Makefile b/package/libs/zlib/Makefile index 4a2a0e53b0..c7a8415c79 100644 --- a/package/libs/zlib/Makefile +++ b/package/libs/zlib/Makefile @@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=zlib PKG_VERSION:=1.2.11 -PKG_RELEASE:=2 +PKG_RELEASE:=3 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz PKG_SOURCE_URL:=@SF/libpng http://www.zlib.net diff --git a/package/libs/zlib/patches/004-relative-pkg-config-paths.patch b/package/libs/zlib/patches/004-relative-pkg-config-paths.patch new file mode 100644 index 0000000000..c86d19b412 --- /dev/null +++ b/package/libs/zlib/patches/004-relative-pkg-config-paths.patch @@ -0,0 +1,14 @@ +--- a/zlib.pc.cmakein ++++ b/zlib.pc.cmakein +@@ -1,8 +1,8 @@ + prefix=@CMAKE_INSTALL_PREFIX@ + exec_prefix=@CMAKE_INSTALL_PREFIX@ +-libdir=@INSTALL_LIB_DIR@ +-sharedlibdir=@INSTALL_LIB_DIR@ +-includedir=@INSTALL_INC_DIR@ ++libdir=${exec_prefix}/lib ++sharedlibdir=${exec_prefix}/lib ++includedir=${prefix}/include + + Name: zlib + Description: zlib compression library diff --git a/package/network/config/gre/Makefile b/package/network/config/gre/Makefile index 6fe6d567b9..83ec8988af 100644 --- a/package/network/config/gre/Makefile +++ b/package/network/config/gre/Makefile @@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=gre PKG_VERSION:=1 -PKG_RELEASE:=10 +PKG_RELEASE:=11 PKG_LICENSE:=GPL-2.0 include $(INCLUDE_DIR)/package.mk diff --git a/package/network/config/gre/files/gre.sh b/package/network/config/gre/files/gre.sh index 2bb1010b76..3414ed3047 100755 --- a/package/network/config/gre/files/gre.sh +++ b/package/network/config/gre/files/gre.sh @@ -56,7 +56,7 @@ gre_setup() { local remoteip local ipaddr peeraddr - json_get_vars df ipaddr peeraddr tunlink + json_get_vars df ipaddr peeraddr tunlink nohostroute [ -z "$peeraddr" ] && { proto_notify_error "$cfg" "MISSING_PEER_ADDRESS" @@ -76,7 +76,9 @@ gre_setup() { break done - ( proto_add_host_dependency "$cfg" "$peeraddr" "$tunlink" ) + if [ "${nohostroute}" != "1" ]; then + ( proto_add_host_dependency "$cfg" "$peeraddr" "$tunlink" ) + fi [ -z "$ipaddr" ] && { local wanif="$tunlink" @@ -133,7 +135,7 @@ grev6_setup() { local remoteip6 local ip6addr peer6addr weakif - json_get_vars ip6addr peer6addr tunlink weakif encaplimit + json_get_vars ip6addr peer6addr tunlink weakif encaplimit nohostroute [ -z "$peer6addr" ] && { proto_notify_error "$cfg" "MISSING_PEER_ADDRESS" @@ -153,7 +155,9 @@ grev6_setup() { break done - ( proto_add_host_dependency "$cfg" "$peer6addr" "$tunlink" ) + if [ "${nohostroute}" != "1" ]; then + ( proto_add_host_dependency "$cfg" "$peer6addr" "$tunlink" ) + fi [ -z "$ip6addr" ] && { local wanif="$tunlink" @@ -262,6 +266,7 @@ proto_gre_init_config() { proto_config_add_string "ipaddr" proto_config_add_string "peeraddr" proto_config_add_boolean "df" + proto_config_add_boolean "nohostroute" } proto_gretap_init_config() { @@ -275,6 +280,7 @@ proto_grev6_init_config() { proto_config_add_string "peer6addr" proto_config_add_string "weakif" proto_config_add_string "encaplimit" + proto_config_add_boolean "nohostroute" } proto_grev6tap_init_config() { diff --git a/package/network/config/netifd/Makefile b/package/network/config/netifd/Makefile index a2c3f7e83b..67b3757744 100644 --- a/package/network/config/netifd/Makefile +++ b/package/network/config/netifd/Makefile @@ -1,13 +1,13 @@ include $(TOPDIR)/rules.mk PKG_NAME:=netifd -PKG_RELEASE:=1 +PKG_RELEASE:=2 PKG_SOURCE_PROTO:=git PKG_SOURCE_URL=$(PROJECT_GIT)/netifd.git -PKG_SOURCE_DATE:=2019-01-31 -PKG_SOURCE_VERSION:=5cd7215a09ad440f0d1b1d05df8deb403f945898 -PKG_MIRROR_HASH:=d5d048c76eb6e2aa607f8c4ef0139bbd6d13f263a624334007dccfeb6bc33eec +PKG_SOURCE_DATE:=2019-06-08 +PKG_SOURCE_VERSION:=8c6358b5d42fe3ca05801823552ca5a2003bf792 +PKG_MIRROR_HASH:=475601fa735e17f51f86e222808018011b504bf3dbb97b436c1a171e245b17a1 PKG_MAINTAINER:=Felix Fietkau PKG_LICENSE:=GPL-2.0 diff --git a/package/network/config/netifd/files/etc/init.d/network b/package/network/config/netifd/files/etc/init.d/network index 99d9f6582f..2321a309a5 100755 --- a/package/network/config/netifd/files/etc/init.d/network +++ b/package/network/config/netifd/files/etc/init.d/network @@ -115,7 +115,9 @@ validate_switch_section() 'name:string' \ 'enable:bool' \ 'enable_vlan:bool' \ - 'reset:bool' + 'reset:bool' \ + 'ar8xxx_mib_poll_interval:uinteger' \ + 'ar8xxx_mib_type:range(0,1)' } validate_switch_vlan() diff --git a/package/network/config/netifd/files/lib/netifd/proto/dhcp.sh b/package/network/config/netifd/files/lib/netifd/proto/dhcp.sh index a2b0ccedbf..0d06eba06e 100755 --- a/package/network/config/netifd/files/lib/netifd/proto/dhcp.sh +++ b/package/network/config/netifd/files/lib/netifd/proto/dhcp.sh @@ -46,6 +46,8 @@ proto_dhcp_setup() { json_for_each_item proto_dhcp_add_sendopts sendopts dhcpopts [ -z "$hostname" ] && hostname="$(cat /proc/sys/kernel/hostname)" + [ "$hostname" = "*" ] && hostname= + [ "$defaultreqopts" = 0 ] && defaultreqopts="-o" || defaultreqopts= [ "$broadcast" = 1 ] && broadcast="-B" || broadcast= [ "$release" = 1 ] && release="-R" || release= diff --git a/package/network/config/xfrm/Makefile b/package/network/config/xfrm/Makefile new file mode 100644 index 0000000000..efc90cf318 --- /dev/null +++ b/package/network/config/xfrm/Makefile @@ -0,0 +1,38 @@ + +include $(TOPDIR)/rules.mk + +PKG_NAME:=xfrm +PKG_VERSION:=1 +PKG_RELEASE:=1 +PKG_LICENSE:=GPL-2.0 + +include $(INCLUDE_DIR)/package.mk + +define Package/xfrm/Default + SECTION:=net + CATEGORY:=Network + MAINTAINER:=Andre Valentin +endef + +define Package/xfrm +$(call Package/xfrm/Default) + TITLE:=XFRM IPsec Tunnel Interface config support + DEPENDS:=+kmod-xfrm-interface +endef + +define Package/xfrm/description + XFRM IPsec Tunnel Interface config support (IPv4 and IPv6) in /etc/config/network. +endef + +define Build/Compile +endef + +define Build/Configure +endef + +define Package/xfrm/install + $(INSTALL_DIR) $(1)/lib/netifd/proto + $(INSTALL_BIN) ./files/xfrm.sh $(1)/lib/netifd/proto/xfrm.sh +endef + +$(eval $(call BuildPackage,xfrm)) diff --git a/package/network/config/xfrm/files/xfrm.sh b/package/network/config/xfrm/files/xfrm.sh new file mode 100755 index 0000000000..df28d38613 --- /dev/null +++ b/package/network/config/xfrm/files/xfrm.sh @@ -0,0 +1,65 @@ +#!/bin/sh + +[ -n "$INCLUDE_ONLY" ] || { + . /lib/functions.sh + . /lib/functions/network.sh + . ../netifd-proto.sh + init_proto "$@" +} + +proto_xfrm_setup() { + local cfg="$1" + local mode="xfrm" + + local tunlink ifid mtu zone + json_get_vars tunlink ifid mtu zone + + proto_init_update "$cfg" 1 + + proto_add_tunnel + json_add_string mode "$mode" + json_add_int mtu "${mtu:-1280}" + + [ -z "$tunlink" ] && { + proto_notify_error "$cfg" NO_TUNLINK + proto_block_restart "$cfg" + exit + } + json_add_string link "$tunlink" + + [ -z "$ifid" ] && { + proto_notify_error "$cfg" NO_IFID + proto_block_restart "$cfg" + exit + } + json_add_object 'data' + [ -n "$ifid" ] && json_add_int ifid "$ifid" + json_close_object + + proto_close_tunnel + + proto_add_data + [ -n "$zone" ] && json_add_string zone "$zone" + proto_close_data + + proto_send_update "$cfg" +} + +proto_xfrm_teardown() { + local cfg="$1" +} + +proto_xfrm_init_config() { + no_device=1 + available=1 + + proto_config_add_int "mtu" + proto_config_add_string "tunlink" + proto_config_add_string "zone" + proto_config_add_int "ifid" +} + + +[ -n "$INCLUDE_ONLY" ] || { + [ -f /lib/modules/$(uname -r)/xfrm_interface.ko -o -d /sys/module/xfrm_interface ] && add_protocol xfrm +} diff --git a/package/network/ipv6/464xlat/Makefile b/package/network/ipv6/464xlat/Makefile index 9be09fa916..f4dce2e77d 100644 --- a/package/network/ipv6/464xlat/Makefile +++ b/package/network/ipv6/464xlat/Makefile @@ -1,7 +1,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=464xlat -PKG_VERSION:=11 +PKG_VERSION:=12 PKG_SOURCE_DATE:=2018-01-16 PKG_MAINTAINER:=Hans Dedecker diff --git a/package/network/ipv6/464xlat/files/464xlat.sh b/package/network/ipv6/464xlat/files/464xlat.sh index e5fcf7db96..c90ac1af59 100755 --- a/package/network/ipv6/464xlat/files/464xlat.sh +++ b/package/network/ipv6/464xlat/files/464xlat.sh @@ -27,7 +27,7 @@ proto_464xlat_setup() { local ip6addr ip6prefix tunlink zone json_get_vars ip6addr ip6prefix tunlink zone - [ -z "$zone" ] && zone="wan" + [ "$zone" = "-" ] && zone="" ( proto_add_host_dependency "$cfg" "::" "$tunlink" ) @@ -53,25 +53,29 @@ proto_464xlat_setup() { proto_add_ipv6_route $ip6addr 128 "" "" "" "" 128 proto_add_data - [ "$zone" != "-" ] && json_add_string zone "$zone" + [ -n "$zone" ] && json_add_string zone "$zone" json_add_array firewall + [ -z "$zone" ] && zone=$(fw3 -q network $iface 2>/dev/null) + json_add_object "" json_add_string type nat json_add_string target SNAT json_add_string family inet json_add_string snat_ip 192.0.0.1 json_close_object - json_add_object "" - json_add_string type rule - json_add_string family inet6 - json_add_string proto all - json_add_string direction in - json_add_string dest "$zone" - json_add_string src "$zone" - json_add_string src_ip $ip6addr - json_add_string target ACCEPT - json_close_object + [ -n "$zone" ] && { + json_add_object "" + json_add_string type rule + json_add_string family inet6 + json_add_string proto all + json_add_string direction in + json_add_string dest "$zone" + json_add_string src "$zone" + json_add_string src_ip $ip6addr + json_add_string target ACCEPT + json_close_object + } json_close_array proto_close_data diff --git a/package/network/ipv6/6to4/Makefile b/package/network/ipv6/6to4/Makefile index 20605f6588..32d7b325aa 100644 --- a/package/network/ipv6/6to4/Makefile +++ b/package/network/ipv6/6to4/Makefile @@ -25,7 +25,7 @@ endef define Package/6to4/description Provides support for 6to4 tunnels in /etc/config/network. -Refer to http://wiki.openwrt.org/doc/uci/network for +Refer to https://openwrt.org/docs/guide-user/base-system/basic-networking configuration details. endef diff --git a/package/network/ipv6/map/Makefile b/package/network/ipv6/map/Makefile index 5a18c7b01f..f05f216a4c 100644 --- a/package/network/ipv6/map/Makefile +++ b/package/network/ipv6/map/Makefile @@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=map PKG_VERSION:=4 -PKG_RELEASE:=12 +PKG_RELEASE:=13 PKG_LICENSE:=GPL-2.0 include $(INCLUDE_DIR)/package.mk diff --git a/package/network/ipv6/map/files/map.sh b/package/network/ipv6/map/files/map.sh index 70dc72326c..6462e810cc 100755 --- a/package/network/ipv6/map/files/map.sh +++ b/package/network/ipv6/map/files/map.sh @@ -33,7 +33,7 @@ proto_map_setup() { json_get_vars type mtu ttl tunlink zone encaplimit json_get_vars rule ipaddr ip4prefixlen ip6prefix ip6prefixlen peeraddr ealen psidlen psid offset - [ -z "$zone" ] && zone="wan" + [ "$zone" = "-" ] && zone="" [ -z "$type" ] && type="map-e" [ -z "$ip4prefixlen" ] && ip4prefixlen=32 @@ -129,7 +129,7 @@ proto_map_setup() { proto_add_ipv4_route "0.0.0.0" 0 proto_add_data - [ "$zone" != "-" ] && json_add_string zone "$zone" + [ -n "$zone" ] && json_add_string zone "$zone" json_add_array firewall if [ -z "$(eval "echo \$RULE_${k}_PORTSETS")" ]; then @@ -155,26 +155,30 @@ proto_map_setup() { done fi if [ "$type" = "map-t" ]; then - json_add_object "" - json_add_string type rule - json_add_string family inet6 - json_add_string proto all - json_add_string direction in - json_add_string dest "$zone" - json_add_string src "$zone" - json_add_string src_ip $(eval "echo \$RULE_${k}_IPV6ADDR") - json_add_string target ACCEPT - json_close_object - json_add_object "" - json_add_string type rule - json_add_string family inet6 - json_add_string proto all - json_add_string direction out - json_add_string dest "$zone" - json_add_string src "$zone" - json_add_string dest_ip $(eval "echo \$RULE_${k}_IPV6ADDR") - json_add_string target ACCEPT - json_close_object + [ -z "$zone" ] && zone=$(fw3 -q network $iface 2>/dev/null) + + [ -n "$zone" ] && { + json_add_object "" + json_add_string type rule + json_add_string family inet6 + json_add_string proto all + json_add_string direction in + json_add_string dest "$zone" + json_add_string src "$zone" + json_add_string src_ip $(eval "echo \$RULE_${k}_IPV6ADDR") + json_add_string target ACCEPT + json_close_object + json_add_object "" + json_add_string type rule + json_add_string family inet6 + json_add_string proto all + json_add_string direction out + json_add_string dest "$zone" + json_add_string src "$zone" + json_add_string dest_ip $(eval "echo \$RULE_${k}_IPV6ADDR") + json_add_string target ACCEPT + json_close_object + } proto_add_ipv6_route $(eval "echo \$RULE_${k}_IPV6ADDR") 128 fi json_close_array diff --git a/package/network/ipv6/thc-ipv6/Makefile b/package/network/ipv6/thc-ipv6/Makefile new file mode 100644 index 0000000000..91bacf625e --- /dev/null +++ b/package/network/ipv6/thc-ipv6/Makefile @@ -0,0 +1,61 @@ +# +# Copyright (C) 2009-2015 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +include $(TOPDIR)/rules.mk + +PKG_NAME:=thc-ipv6 +PKG_VERSION:=2.7 +PKG_RELEASE:=1 +PKG_LICENSE:=GPL-3.0 + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=@GITHUB/vanhauser-thc/THC-Archive/master/Tools +PKG_HASH:=440a3ae98b57100c397ec4f8634468dbbb0c3b48788c6b74af2a597a90544a96 + +PKG_MAINTAINER:=Jo-Philipp Wich + +include $(INCLUDE_DIR)/package.mk + +THC_APPLETS := \ + address6 alive6 covert_send6 covert_send6d denial6 detect-new-ip6 \ + detect_sniffer6 dnsdict6 dnsrevenum6 dos-new-ip6 \ + dump_router6 exploit6 fake_advertise6 fake_dhcps6 fake_dns6d \ + fake_dnsupdate6 fake_mipv6 fake_mld26 fake_mld6 fake_mldrouter6 \ + fake_router26 fake_router6 fake_solicitate6 flood_advertise6 \ + flood_dhcpc6 flood_mld26 flood_mld6 flood_mldrouter6 flood_router26 \ + flood_router6 flood_solicitate6 fragmentation6 fuzz_ip6 fuzz_dhcpc6 \ + fuzz_dhcps6 implementation6 implementation6d inverse_lookup6 \ + kill_router6 ndpexhaust6 node_query6 parasite6 passive_discovery6 \ + randicmp6 redir6 rsmurf6 sendpees6 sendpeesmp6 smurf6 thcping6 \ + toobig6 trace6 + +THC_DEPENDS_dnsdict6 := +libpthread +THC_DEPENDS_thcping6 := +librt + +define BuildTool + define Package/thc-ipv6-$(subst _,-,$(1)) + TITLE:=THC-IPv6 $(1) utility + SECTION:=net + CATEGORY:=Network + DEPENDS:=+libpcap $(THC_DEPENDS_$(1)) + URL:=https://github.com/vanhauser-thc/thc-ipv6 + SUBMENU:=THC-IPv6 attack and analyzing toolkit + endef + + define Package/thc-ipv6-$(subst _,-,$(1))/description + This package contains the $(1) utility of the THC-IPv6 toolkit. + endef + + define Package/thc-ipv6-$(subst _,-,$(1))/install + $(INSTALL_DIR) $$(1)/usr/sbin + $(INSTALL_BIN) $(PKG_BUILD_DIR)/$(1) $$(1)/usr/sbin/$(1) + endef + + $$(eval $$(call BuildPackage,thc-ipv6-$(subst _,-,$(1)))) +endef + +$(foreach a,$(THC_APPLETS),$(eval $(call BuildTool,$(a)))) diff --git a/package/network/ipv6/thc-ipv6/patches/000-cflags_override.patch b/package/network/ipv6/thc-ipv6/patches/000-cflags_override.patch new file mode 100644 index 0000000000..e1c36b6c6c --- /dev/null +++ b/package/network/ipv6/thc-ipv6/patches/000-cflags_override.patch @@ -0,0 +1,12 @@ +diff -urN thc-ipv6-2.7/Makefile thc-ipv6-2.7.new/Makefile +--- thc-ipv6-2.7/Makefile 2014-12-27 05:05:30.000000000 -0800 ++++ thc-ipv6-2.7.new/Makefile 2017-02-04 20:55:51.679898101 -0800 +@@ -3,7 +3,7 @@ + + CC=gcc + #CFLAGS=-g +-CFLAGS=-O2 ++CFLAGS?=-O2 + CFLAGS+=$(if $(HAVE_SSL),-D_HAVE_SSL,) + LDFLAGS+=-lpcap $(if $(HAVE_SSL),-lssl -lcrypto,) + PROGRAMS=parasite6 dos-new-ip6 detect-new-ip6 fake_router6 fake_advertise6 fake_solicitate6 fake_mld6 fake_mld26 fake_mldrouter6 flood_mldrouter6 fake_mipv6 redir6 smurf6 alive6 toobig6 rsmurf6 implementation6 implementation6d sendpees6 sendpeesmp6 randicmp6 fuzz_ip6 flood_mld6 flood_mld26 flood_router6 flood_advertise6 flood_solicitate6 trace6 exploit6 denial6 fake_dhcps6 flood_dhcpc6 fake_dns6d fragmentation6 kill_router6 fake_dnsupdate6 ndpexhaust6 detect_sniffer6 dump_router6 fake_router26 flood_router26 passive_discovery6 dnsrevenum6 inverse_lookup6 node_query6 address6 covert_send6 covert_send6d inject_alive6 firewall6 ndpexhaust26 fake_pim6 thcsyn6 redirsniff6 flood_redir6 four2six dump_dhcp6 fuzz_dhcps6 flood_rs6 fuzz_dhcpc6 diff --git a/package/network/ipv6/thc-ipv6/patches/100-no-ssl.patch b/package/network/ipv6/thc-ipv6/patches/100-no-ssl.patch new file mode 100644 index 0000000000..1ef1f66be8 --- /dev/null +++ b/package/network/ipv6/thc-ipv6/patches/100-no-ssl.patch @@ -0,0 +1,9 @@ +--- a/Makefile ++++ b/Makefile +@@ -1,5 +1,5 @@ + # Comment out if openssl-dev is not present +-HAVE_SSL=yes ++#HAVE_SSL=yes + + CC=gcc + #CFLAGS=-g diff --git a/package/network/services/dnsmasq/Makefile b/package/network/services/dnsmasq/Makefile index 1710ded5f8..c04d96fff2 100644 --- a/package/network/services/dnsmasq/Makefile +++ b/package/network/services/dnsmasq/Makefile @@ -10,7 +10,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=dnsmasq PKG_UPSTREAM_VERSION:=2.80 PKG_VERSION:=$(subst test,~~test,$(subst rc,~rc,$(PKG_UPSTREAM_VERSION))) -PKG_RELEASE:=11 +PKG_RELEASE:=13 PKG_SOURCE:=$(PKG_NAME)-$(PKG_UPSTREAM_VERSION).tar.xz PKG_SOURCE_URL:=http://thekelleys.org.uk/dnsmasq diff --git a/package/network/services/dnsmasq/files/dnsmasq.init b/package/network/services/dnsmasq/files/dnsmasq.init index 93a8f9a108..1054f7a12a 100644 --- a/package/network/services/dnsmasq/files/dnsmasq.init +++ b/package/network/services/dnsmasq/files/dnsmasq.init @@ -22,10 +22,45 @@ DHCPSCRIPT="/usr/lib/dnsmasq/dhcp-script.sh" DNSMASQ_DHCP_VER=4 +dnsmasq_ignore_opt() { + local opt="$1" + + if [ -z "$dnsmasq_features" ]; then + dnsmasq_features="$(dnsmasq --version | grep -m1 'Compile time options:' | cut -d: -f2) " + [ "${dnsmasq_features#* DHCP }" = "$dnsmasq_features" ] || dnsmasq_has_dhcp=1 + [ "${dnsmasq_features#* DHCPv6 }" = "$dnsmasq_features" ] || dnsmasq_has_dhcp6=1 + [ "${dnsmasq_features#* DNSSEC }" = "$dnsmasq_features" ] || dnsmasq_has_dnssec=1 + [ "${dnsmasq_features#* TFTP }" = "$dnsmasq_features" ] || dnsmasq_has_tftp=1 + [ "${dnsmasq_features#* ipset }" = "$dnsmasq_features" ] || dnsmasq_has_ipset=1 + fi + + case "$opt" in + dhcp-duid|\ + ra-param) + [ -z "$dnsmasq_has_dhcp6" ] ;; + dhcp-*|\ + bootp-*|\ + pxe-*) + [ -z "$dnsmasq_has_dhcp" ] ;; + dnssec-*|\ + trust-anchor) + [ -z "$dnsmasq_has_dnssec" ] ;; + tftp-*) + [ -z "$dnsmasq_has_tftp" ] ;; + ipset) + [ -z "$dnsmasq_has_ipset" ] ;; + *) + return 1 + esac +} + xappend() { - local value="$1" + local value="${1#--}" + local opt="${value%%=*}" - echo "${value#--}" >> $CONFIGFILE_TMP + if ! dnsmasq_ignore_opt "$opt"; then + echo "$value" >>$CONFIGFILE_TMP + fi } hex_to_hostid() { diff --git a/package/network/services/dropbear/Config.in b/package/network/services/dropbear/Config.in index ca0af9d5e0..61a04ec876 100644 --- a/package/network/services/dropbear/Config.in +++ b/package/network/services/dropbear/Config.in @@ -8,29 +8,46 @@ config DROPBEAR_CURVE25519 This enables the following key exchange algorithm: curve25519-sha256@libssh.org - Increases binary size by about 13 kB uncompressed (MIPS). + Increases binary size by about 8 kB uncompressed (MIPS). config DROPBEAR_ECC bool "Elliptic curve cryptography (ECC)" default n help - Enables elliptic curve cryptography (ECC) support in key exchange and public key - authentication. + Enables basic support for elliptic curve cryptography (ECC) + in key exchange and public key authentication. Key exchange algorithms: ecdh-sha2-nistp256 + + Public key algorithms: + ecdsa-sha2-nistp256 + + Increases binary size by about 24 kB (MIPS). + + If full ECC support is required, also select DROPBEAR_ECC_FULL. + +config DROPBEAR_ECC_FULL + bool "Elliptic curve cryptography (ECC), full support" + default n + depends on DROPBEAR_ECC + help + Enables full support for elliptic curve cryptography (ECC) + in key exchange and public key authentication. + + Key exchange algorithms: + ecdh-sha2-nistp256 (*) ecdh-sha2-nistp384 ecdh-sha2-nistp521 Public key algorithms: - ecdsa-sha2-nistp256 + ecdsa-sha2-nistp256 (*) ecdsa-sha2-nistp384 ecdsa-sha2-nistp521 - Does not generate ECC host keys by default (ECC key exchange will not be used, - only ECC public key auth). + (*) - basic ECC support; provided by DROPBEAR_ECC. - Increases binary size by about 23 kB (MIPS). + Increases binary size by about 4 kB (MIPS). config DROPBEAR_ZLIB bool "Enable compression" @@ -56,4 +73,8 @@ config DROPBEAR_PUTUTLINE help Dropbear will use pututline() to write the utmp structure into the utmp file. +config DROPBEAR_DBCLIENT + bool "Build dropbear with dbclient" + default y + endmenu diff --git a/package/network/services/dropbear/Makefile b/package/network/services/dropbear/Makefile index 0ed7199e68..63204042f7 100644 --- a/package/network/services/dropbear/Makefile +++ b/package/network/services/dropbear/Makefile @@ -8,14 +8,14 @@ include $(TOPDIR)/rules.mk PKG_NAME:=dropbear -PKG_VERSION:=2017.75 -PKG_RELEASE:=9 +PKG_VERSION:=2019.78 +PKG_RELEASE:=2 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2 PKG_SOURCE_URL:= \ http://matt.ucc.asn.au/dropbear/releases/ \ https://dropbear.nl/mirror/releases/ -PKG_HASH:=6cbc1dcb1c9709d226dff669e5604172a18cf5dbf9a201474d5618ae4465098c +PKG_HASH:=525965971272270995364a0eb01f35180d793182e63dd0b0c3eb0292291644a4 PKG_LICENSE:=MIT PKG_LICENSE_FILES:=LICENSE libtomcrypt/LICENSE libtommath/LICENSE @@ -23,11 +23,13 @@ PKG_CPE_ID:=cpe:/a:matt_johnston:dropbear_ssh_server PKG_BUILD_PARALLEL:=1 PKG_USE_MIPS16:=0 +PKG_FIXUP:=autoreconf PKG_CONFIG_DEPENDS:= \ - CONFIG_TARGET_INIT_PATH CONFIG_DROPBEAR_ECC \ + CONFIG_TARGET_INIT_PATH CONFIG_DROPBEAR_ECC CONFIG_DROPBEAR_ECC_FULL \ CONFIG_DROPBEAR_CURVE25519 CONFIG_DROPBEAR_ZLIB \ - CONFIG_DROPBEAR_UTMP CONFIG_DROPBEAR_PUTUTLINE + CONFIG_DROPBEAR_UTMP CONFIG_DROPBEAR_PUTUTLINE \ + CONFIG_DROPBEAR_DBCLIENT include $(INCLUDE_DIR)/package.mk @@ -60,6 +62,7 @@ define Package/dropbear/description endef define Package/dropbear/conffiles +$(if $(CONFIG_DROPBEAR_ECC),/etc/dropbear/dropbear_ecdsa_host_key) /etc/dropbear/dropbear_rsa_host_key /etc/config/dropbear endef @@ -90,33 +93,39 @@ TARGET_CFLAGS += -DARGTYPE=3 -ffunction-sections -fdata-sections -flto TARGET_LDFLAGS += -Wl,--gc-sections -flto=jobserver define Build/Configure + : > $(PKG_BUILD_DIR)/localoptions.h + $(Build/Configure/Default) - $(SED) 's,^#define DEFAULT_PATH .*$$$$,#define DEFAULT_PATH "$(TARGET_INIT_PATH)",g' \ - $(PKG_BUILD_DIR)/options.h + echo '#define DEFAULT_PATH "$(TARGET_INIT_PATH)"' >> \ + $(PKG_BUILD_DIR)/localoptions.h - awk 'BEGIN { rc = 1 } \ - /'DROPBEAR_CURVE25519'/ { $$$$0 = "$(if $(CONFIG_DROPBEAR_CURVE25519),,// )#define 'DROPBEAR_CURVE25519'"; rc = 0 } \ - { print } \ - END { exit(rc) }' $(PKG_BUILD_DIR)/options.h \ - >$(PKG_BUILD_DIR)/options.h.new && \ - mv $(PKG_BUILD_DIR)/options.h.new $(PKG_BUILD_DIR)/options.h + echo '#define DROPBEAR_CURVE25519 $(if $(CONFIG_DROPBEAR_CURVE25519),1,0)' >> \ + $(PKG_BUILD_DIR)/localoptions.h - # Enforce that all replacements are made, otherwise options.h has changed - # format and this logic is broken. for OPTION in DROPBEAR_ECDSA DROPBEAR_ECDH; do \ - awk 'BEGIN { rc = 1 } \ - /'$$$$OPTION'/ { $$$$0 = "$(if $(CONFIG_DROPBEAR_ECC),,// )#define '$$$$OPTION'"; rc = 0 } \ - { print } \ - END { exit(rc) }' $(PKG_BUILD_DIR)/options.h \ - >$(PKG_BUILD_DIR)/options.h.new && \ - mv $(PKG_BUILD_DIR)/options.h.new $(PKG_BUILD_DIR)/options.h || exit 1; \ + echo "#define $$$$OPTION $(if $(CONFIG_DROPBEAR_ECC),1,0)" >> \ + $(PKG_BUILD_DIR)/localoptions.h; \ done # remove protocol idented software version number - $(SED) 's,^#define LOCAL_IDENT .*$$$$,#define LOCAL_IDENT "SSH-2.0-dropbear",g' \ + $(ESED) 's,^(#define LOCAL_IDENT) .*$$$$,\1 "SSH-2.0-dropbear",g' \ $(PKG_BUILD_DIR)/sysoptions.h + # disable legacy/unsafe methods and unused functionality + for OPTION in INETD_MODE DROPBEAR_CLI_NETCAT \ + DROPBEAR_3DES DROPBEAR_DSS DROPBEAR_ENABLE_CBC_MODE \ + DROPBEAR_SHA1_96_HMAC DROPBEAR_USE_PASSWORD_ENV; do \ + echo "#define $$$$OPTION 0" >> \ + $(PKG_BUILD_DIR)/localoptions.h; \ + done + + # enable nistp384 and nistp521 only if full ECC support was requested + for OPTION in DROPBEAR_ECC_384 DROPBEAR_ECC_521; do \ + $(ESED) 's,^(#define '$$$$OPTION') .*$$$$,\1 $(if $(CONFIG_DROPBEAR_ECC_FULL),1,0),g' \ + $(PKG_BUILD_DIR)/sysoptions.h; \ + done + # Enforce rebuild of svr-chansession.c rm -f $(PKG_BUILD_DIR)/svr-chansession.o endef @@ -124,7 +133,7 @@ endef define Build/Compile +$(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR) \ $(TARGET_CONFIGURE_OPTS) \ - PROGRAMS="dropbear dbclient dropbearkey scp" \ + PROGRAMS="dropbear $(if $(CONFIG_DROPBEAR_DBCLIENT),dbclient,) dropbearkey scp" \ MULTI=1 SCPPROGRESS=1 +$(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR) \ $(TARGET_CONFIGURE_OPTS) \ @@ -135,7 +144,7 @@ define Package/dropbear/install $(INSTALL_DIR) $(1)/usr/sbin $(INSTALL_BIN) $(PKG_BUILD_DIR)/dropbearmulti $(1)/usr/sbin/dropbear $(INSTALL_DIR) $(1)/usr/bin - $(LN) ../sbin/dropbear $(1)/usr/bin/dbclient + $(if $(CONFIG_DROPBEAR_DBCLIENT),$(LN) ../sbin/dropbear $(1)/usr/bin/dbclient,) $(LN) ../sbin/dropbear $(1)/usr/bin/dropbearkey $(INSTALL_DIR) $(1)/etc/config $(INSTALL_CONF) ./files/dropbear.config $(1)/etc/config/dropbear @@ -143,6 +152,7 @@ define Package/dropbear/install $(INSTALL_BIN) ./files/dropbear.init $(1)/etc/init.d/dropbear $(INSTALL_DIR) $(1)/usr/lib/opkg/info $(INSTALL_DIR) $(1)/etc/dropbear + $(if $(CONFIG_DROPBEAR_ECC),touch $(1)/etc/dropbear/dropbear_ecdsa_host_key) touch $(1)/etc/dropbear/dropbear_rsa_host_key endef diff --git a/package/network/services/dropbear/files/dropbear.init b/package/network/services/dropbear/files/dropbear.init index 2ea637ee1a..173ab09285 100755 --- a/package/network/services/dropbear/files/dropbear.init +++ b/package/network/services/dropbear/files/dropbear.init @@ -12,6 +12,91 @@ PIDCOUNT=0 EXTRA_COMMANDS="killclients" EXTRA_HELP=" killclients Kill ${NAME} processes except servers and yourself" +_dropbearkey() +{ + /usr/bin/dropbearkey "$@" 0<&- 1>&- 2>&- +} + +# $1 - host key file name +hk_verify() +{ + [ -f "$1" ] || return 1 + [ -s "$1" ] || return 2 + _dropbearkey -y -f "$1" || return 3 + return 0 +} + +# $1 - hk_verify() return code +hk_errmsg() +{ + case "$1" in + 0) ;; + 1) echo "file does not exist" ;; + 2) echo "file has zero length" ;; + 3) echo "file is not valid host key or not supported" ;; + *) echo "unknown error" ;; + esac +} + +# $1 - config option +# $2 - host key file name +hk_config() +{ + local x m + hk_verify "$2"; x=$? + case "$x" in + 0) procd_append_param command -r "$2" + ;; + *) m=$(hk_errmsg "$x") + logger -t "${NAME}" -p daemon.warn \ + "option '$1', value '$2': $m, skipping" + ;; + esac +} + +# $1 - host key file name +hk_config__keyfile() +{ + hk_config 'keyfile' "$1" +} + +hk_generate_as_needed() +{ + local kdir kgen ktype tdir kcount tfile + kdir='/etc/dropbear' + + kgen='' + for ktype in ecdsa rsa; do + hk_verify "${kdir}/dropbear_${ktype}_host_key" && continue + + kgen="${kgen} ${ktype}" + done + + [ -z "${kgen}" ] && return + + tdir=$(mktemp -d); chmod 0700 "${tdir}" + + kcount=0 + for ktype in ${kgen}; do + tfile="${tdir}/dropbear_${ktype}_host_key" + + if ! _dropbearkey -t ${ktype} -f "${tfile}"; then + # unsupported key type + rm -f "${tfile}" + continue + fi + + kcount=$((kcount+1)) + done + + if [ ${kcount} -ne 0 ]; then + mkdir -p "${kdir}"; chmod 0700 "${kdir}"; chown root "${kdir}" + mv -f "${tdir}/"* "${kdir}/" + fi + + rm -rf "${tdir}" +} + append_ports() { local ipaddrs="$1" @@ -37,8 +122,9 @@ validate_section_dropbear() 'RootPasswordAuth:bool:1' \ 'RootLogin:bool:1' \ 'rsakeyfile:file' \ + 'keyfile:list(file)' \ 'BannerFile:file' \ - 'Port:list(port):22' \ + 'Port:port:22' \ 'SSHKeepAlive:uinteger:300' \ 'IdleTimeout:uinteger:0' \ 'MaxAuthTries:uinteger:3' \ @@ -74,7 +160,13 @@ dropbear_instance() [ "${GatewayPorts}" -eq 1 ] && procd_append_param command -a [ "${RootPasswordAuth}" -eq 0 ] && procd_append_param command -g [ "${RootLogin}" -eq 0 ] && procd_append_param command -w - [ -n "${rsakeyfile}" ] && procd_append_param command -r "${rsakeyfile}" + if [ -n "${rsakeyfile}" ]; then + logger -t ${NAME} -p daemon.warn \ + "option 'rsakeyfile' is considered to be deprecated and" \ + "will be removed in future releases, use 'keyfile' instead" + hk_config 'rsakeyfile' "${rsakeyfile}" + fi + config_list_foreach "$1" "keyfile" hk_config__keyfile [ -n "${BannerFile}" ] && procd_append_param command -b "${BannerFile}" append_ports "${ipaddrs}" "${Port}" [ "${IdleTimeout}" -ne 0 ] && procd_append_param command -I "${IdleTimeout}" @@ -87,29 +179,6 @@ dropbear_instance() procd_close_instance } -keygen() -{ - for keytype in rsa; do - # check for keys - key=dropbear/dropbear_${keytype}_host_key - [ -f /tmp/$key -o -s /etc/$key ] || { - # generate missing keys - mkdir -p /tmp/dropbear - [ -x /usr/bin/dropbearkey ] && { - /usr/bin/dropbearkey -t $keytype -f /tmp/$key 2>&- >&- && exec /etc/rc.common "$initscript" start - } & - exit 0 - } - done - - lock /tmp/.switch2jffs - mkdir -p /etc/dropbear - mv /tmp/dropbear/dropbear_* /etc/dropbear/ - lock -u /tmp/.switch2jffs - chown root /etc/dropbear - chmod 0700 /etc/dropbear -} - load_interfaces() { config_get interface "$1" Interface @@ -126,7 +195,7 @@ boot() start_service() { - [ -s /etc/dropbear/dropbear_rsa_host_key ] || keygen + hk_generate_as_needed . /lib/functions.sh . /lib/functions/network.sh diff --git a/package/network/services/dropbear/patches/010-runtime-maxauthtries.patch b/package/network/services/dropbear/patches/010-runtime-maxauthtries.patch deleted file mode 100644 index 26db3181f2..0000000000 --- a/package/network/services/dropbear/patches/010-runtime-maxauthtries.patch +++ /dev/null @@ -1,130 +0,0 @@ -From 46b22e57d91e33a591d0fba97da52672af4d6ed2 Mon Sep 17 00:00:00 2001 -From: Kevin Darbyshire-Bryant -Date: Mon, 29 May 2017 10:25:09 +0100 -Subject: [PATCH] dropbear server: support -T max auth tries - -Add support for '-T n' for a run-time specification for maximum number -of authentication attempts where 'n' is between 1 and compile time -option MAX_AUTH_TRIES. - -A default number of tries can be specified at compile time using -'DEFAULT_AUTH_TRIES' which itself defaults to MAX_AUTH_TRIES for -backwards compatibility. - -Signed-off-by: Kevin Darbyshire-Bryant ---- - options.h | 7 +++++++ - runopts.h | 1 + - svr-auth.c | 2 +- - svr-runopts.c | 17 +++++++++++++++++ - 4 files changed, 26 insertions(+), 1 deletion(-) - -diff --git a/options.h b/options.h -index 0c51bb1..4d22704 100644 ---- a/options.h -+++ b/options.h -@@ -284,6 +284,13 @@ Homedir is prepended unless path begins with / */ - #define MAX_AUTH_TRIES 10 - #endif - -+/* Default maximum number of failed authentication tries. -+ * defaults to MAX_AUTH_TRIES */ -+ -+#ifndef DEFAULT_AUTH_TRIES -+#define DEFAULT_AUTH_TRIES MAX_AUTH_TRIES -+#endif -+ - /* The default file to store the daemon's process ID, for shutdown - scripts etc. This can be overridden with the -P flag */ - #ifndef DROPBEAR_PIDFILE -diff --git a/runopts.h b/runopts.h -index f7c869d..2f7da63 100644 ---- a/runopts.h -+++ b/runopts.h -@@ -96,6 +96,7 @@ typedef struct svr_runopts { - int noauthpass; - int norootpass; - int allowblankpass; -+ unsigned int maxauthtries; - - #ifdef ENABLE_SVR_REMOTETCPFWD - int noremotetcp; -diff --git a/svr-auth.c b/svr-auth.c -index 577ea88..6a7ce0b 100644 ---- a/svr-auth.c -+++ b/svr-auth.c -@@ -362,7 +362,7 @@ void send_msg_userauth_failure(int partial, int incrfail) { - ses.authstate.failcount++; - } - -- if (ses.authstate.failcount >= MAX_AUTH_TRIES) { -+ if (ses.authstate.failcount >= svr_opts.maxauthtries) { - char * userstr; - /* XXX - send disconnect ? */ - TRACE(("Max auth tries reached, exiting")) -diff --git a/svr-runopts.c b/svr-runopts.c -index 8f60059..1e7440f 100644 ---- a/svr-runopts.c -+++ b/svr-runopts.c -@@ -73,6 +73,7 @@ static void printhelp(const char * progname) { - "-g Disable password logins for root\n" - "-B Allow blank password logins\n" - #endif -+ "-T <1 to %d> Maximum authentication tries (default %d)\n" - #ifdef ENABLE_SVR_LOCALTCPFWD - "-j Disable local port forwarding\n" - #endif -@@ -106,6 +107,7 @@ static void printhelp(const char * progname) { - #ifdef DROPBEAR_ECDSA - ECDSA_PRIV_FILENAME, - #endif -+ MAX_AUTH_TRIES, DEFAULT_AUTH_TRIES, - DROPBEAR_MAX_PORTS, DROPBEAR_DEFPORT, DROPBEAR_PIDFILE, - DEFAULT_RECV_WINDOW, DEFAULT_KEEPALIVE, DEFAULT_IDLE_TIMEOUT); - } -@@ -118,6 +120,7 @@ void svr_getopts(int argc, char ** argv) { - char* recv_window_arg = NULL; - char* keepalive_arg = NULL; - char* idle_timeout_arg = NULL; -+ char* maxauthtries_arg = NULL; - char* keyfile = NULL; - char c; - -@@ -130,6 +133,7 @@ void svr_getopts(int argc, char ** argv) { - svr_opts.noauthpass = 0; - svr_opts.norootpass = 0; - svr_opts.allowblankpass = 0; -+ svr_opts.maxauthtries = DEFAULT_AUTH_TRIES; - svr_opts.inetdmode = 0; - svr_opts.portcount = 0; - svr_opts.hostkey = NULL; -@@ -234,6 +238,9 @@ void svr_getopts(int argc, char ** argv) { - case 'I': - next = &idle_timeout_arg; - break; -+ case 'T': -+ next = &maxauthtries_arg; -+ break; - #if defined(ENABLE_SVR_PASSWORD_AUTH) || defined(ENABLE_SVR_PAM_AUTH) - case 's': - svr_opts.noauthpass = 1; -@@ -330,6 +337,16 @@ void svr_getopts(int argc, char ** argv) { - dropbear_exit("Bad recv window '%s'", recv_window_arg); - } - } -+ -+ if (maxauthtries_arg) { -+ unsigned int val = 0; -+ if (m_str_to_uint(maxauthtries_arg, &val) == DROPBEAR_FAILURE || -+ val == 0 || val > MAX_AUTH_TRIES) { -+ dropbear_exit("Bad maxauthtries '%s'", maxauthtries_arg); -+ } -+ svr_opts.maxauthtries = val; -+ } -+ - - if (keepalive_arg) { - unsigned int val; --- -2.7.4 - diff --git a/package/network/services/dropbear/patches/020-Wait-to-fail-invalid-usernames.patch b/package/network/services/dropbear/patches/020-Wait-to-fail-invalid-usernames.patch deleted file mode 100644 index 593dca930d..0000000000 --- a/package/network/services/dropbear/patches/020-Wait-to-fail-invalid-usernames.patch +++ /dev/null @@ -1,221 +0,0 @@ -From 52adbb34c32d3e2e1bcdb941e20a6f81138b8248 Mon Sep 17 00:00:00 2001 -From: Matt Johnston -Date: Thu, 23 Aug 2018 23:43:12 +0800 -Subject: [PATCH 2/2] Wait to fail invalid usernames - ---- - auth.h | 6 +++--- - svr-auth.c | 19 +++++-------------- - svr-authpam.c | 26 ++++++++++++++++++++++---- - svr-authpasswd.c | 27 ++++++++++++++------------- - svr-authpubkey.c | 11 ++++++++++- - 5 files changed, 54 insertions(+), 35 deletions(-) - ---- a/auth.h -+++ b/auth.h -@@ -37,9 +37,9 @@ void recv_msg_userauth_request(void); - void send_msg_userauth_failure(int partial, int incrfail); - void send_msg_userauth_success(void); - void send_msg_userauth_banner(buffer *msg); --void svr_auth_password(void); --void svr_auth_pubkey(void); --void svr_auth_pam(void); -+void svr_auth_password(int valid_user); -+void svr_auth_pubkey(int valid_user); -+void svr_auth_pam(int valid_user); - - #ifdef ENABLE_SVR_PUBKEY_OPTIONS - int svr_pubkey_allows_agentfwd(void); ---- a/svr-auth.c -+++ b/svr-auth.c -@@ -176,10 +176,8 @@ void recv_msg_userauth_request() { - if (methodlen == AUTH_METHOD_PASSWORD_LEN && - strncmp(methodname, AUTH_METHOD_PASSWORD, - AUTH_METHOD_PASSWORD_LEN) == 0) { -- if (valid_user) { -- svr_auth_password(); -- goto out; -- } -+ svr_auth_password(valid_user); -+ goto out; - } - } - #endif -@@ -191,10 +189,8 @@ void recv_msg_userauth_request() { - if (methodlen == AUTH_METHOD_PASSWORD_LEN && - strncmp(methodname, AUTH_METHOD_PASSWORD, - AUTH_METHOD_PASSWORD_LEN) == 0) { -- if (valid_user) { -- svr_auth_pam(); -- goto out; -- } -+ svr_auth_pam(valid_user); -+ goto out; - } - } - #endif -@@ -204,12 +200,7 @@ void recv_msg_userauth_request() { - if (methodlen == AUTH_METHOD_PUBKEY_LEN && - strncmp(methodname, AUTH_METHOD_PUBKEY, - AUTH_METHOD_PUBKEY_LEN) == 0) { -- if (valid_user) { -- svr_auth_pubkey(); -- } else { -- /* pubkey has no failure delay */ -- send_msg_userauth_failure(0, 0); -- } -+ svr_auth_pubkey(valid_user); - goto out; - } - #endif ---- a/svr-authpam.c -+++ b/svr-authpam.c -@@ -178,13 +178,14 @@ pamConvFunc(int num_msg, - * Keyboard interactive would be a lot nicer, but since PAM is synchronous, it - * gets very messy trying to send the interactive challenges, and read the - * interactive responses, over the network. */ --void svr_auth_pam() { -+void svr_auth_pam(int valid_user) { - - struct UserDataS userData = {NULL, NULL}; - struct pam_conv pamConv = { - pamConvFunc, - &userData /* submitted to pamvConvFunc as appdata_ptr */ - }; -+ const char* printable_user = NULL; - - pam_handle_t* pamHandlep = NULL; - -@@ -204,12 +205,23 @@ void svr_auth_pam() { - - password = buf_getstring(ses.payload, &passwordlen); - -+ /* We run the PAM conversation regardless of whether the username is valid -+ in case the conversation function has an inherent delay. -+ Use ses.authstate.username rather than ses.authstate.pw_name. -+ After PAM succeeds we then check the valid_user flag too */ -+ - /* used to pass data to the PAM conversation function - don't bother with - * strdup() etc since these are touched only by our own conversation - * function (above) which takes care of it */ -- userData.user = ses.authstate.pw_name; -+ userData.user = ses.authstate.username; - userData.passwd = password; - -+ if (ses.authstate.pw_name) { -+ printable_user = ses.authstate.pw_name; -+ } else { -+ printable_user = ""; -+ } -+ - /* Init pam */ - if ((rc = pam_start("sshd", NULL, &pamConv, &pamHandlep)) != PAM_SUCCESS) { - dropbear_log(LOG_WARNING, "pam_start() failed, rc=%d, %s", -@@ -236,7 +248,7 @@ void svr_auth_pam() { - rc, pam_strerror(pamHandlep, rc)); - dropbear_log(LOG_WARNING, - "Bad PAM password attempt for '%s' from %s", -- ses.authstate.pw_name, -+ printable_user, - svr_ses.addrstring); - send_msg_userauth_failure(0, 1); - goto cleanup; -@@ -247,12 +259,18 @@ void svr_auth_pam() { - rc, pam_strerror(pamHandlep, rc)); - dropbear_log(LOG_WARNING, - "Bad PAM password attempt for '%s' from %s", -- ses.authstate.pw_name, -+ printable_user, - svr_ses.addrstring); - send_msg_userauth_failure(0, 1); - goto cleanup; - } - -+ if (!valid_user) { -+ /* PAM auth succeeded but the username isn't allowed in for another reason -+ (checkusername() failed) */ -+ send_msg_userauth_failure(0, 1); -+ } -+ - /* successful authentication */ - dropbear_log(LOG_NOTICE, "PAM password auth succeeded for '%s' from %s", - ses.authstate.pw_name, ---- a/svr-authpasswd.c -+++ b/svr-authpasswd.c -@@ -48,22 +48,14 @@ static int constant_time_strcmp(const ch - - /* Process a password auth request, sending success or failure messages as - * appropriate */ --void svr_auth_password() { -+void svr_auth_password(int valid_user) { - - char * passwdcrypt = NULL; /* the crypt from /etc/passwd or /etc/shadow */ - char * testcrypt = NULL; /* crypt generated from the user's password sent */ -- char * password; -+ char * password = NULL; - unsigned int passwordlen; -- - unsigned int changepw; - -- passwdcrypt = ses.authstate.pw_passwd; -- --#ifdef DEBUG_HACKCRYPT -- /* debugging crypt for non-root testing with shadows */ -- passwdcrypt = DEBUG_HACKCRYPT; --#endif -- - /* check if client wants to change password */ - changepw = buf_getbool(ses.payload); - if (changepw) { -@@ -73,12 +65,21 @@ void svr_auth_password() { - } - - password = buf_getstring(ses.payload, &passwordlen); -- -- /* the first bytes of passwdcrypt are the salt */ -- testcrypt = crypt(password, passwdcrypt); -+ if (valid_user) { -+ /* the first bytes of passwdcrypt are the salt */ -+ passwdcrypt = ses.authstate.pw_passwd; -+ testcrypt = crypt(password, passwdcrypt); -+ } - m_burn(password, passwordlen); - m_free(password); - -+ /* After we have got the payload contents we can exit if the username -+ is invalid. Invalid users have already been logged. */ -+ if (!valid_user) { -+ send_msg_userauth_failure(0, 1); -+ return; -+ } -+ - if (testcrypt == NULL) { - /* crypt() with an invalid salt like "!!" */ - dropbear_log(LOG_WARNING, "User account '%s' is locked", ---- a/svr-authpubkey.c -+++ b/svr-authpubkey.c -@@ -79,7 +79,7 @@ static int checkfileperm(char * filename - - /* process a pubkey auth request, sending success or failure message as - * appropriate */ --void svr_auth_pubkey() { -+void svr_auth_pubkey(int valid_user) { - - unsigned char testkey; /* whether we're just checking if a key is usable */ - char* algo = NULL; /* pubkey algo */ -@@ -102,6 +102,15 @@ void svr_auth_pubkey() { - keybloblen = buf_getint(ses.payload); - keyblob = buf_getptr(ses.payload, keybloblen); - -+ if (!valid_user) { -+ /* Return failure once we have read the contents of the packet -+ required to validate a public key. -+ Avoids blind user enumeration though it isn't possible to prevent -+ testing for user existence if the public key is known */ -+ send_msg_userauth_failure(0, 0); -+ goto out; -+ } -+ - /* check if the key is valid */ - if (checkpubkey(algo, algolen, keyblob, keybloblen) == DROPBEAR_FAILURE) { - send_msg_userauth_failure(0, 0); diff --git a/package/network/services/dropbear/patches/100-pubkey_path.patch b/package/network/services/dropbear/patches/100-pubkey_path.patch index 274d3af46a..732d84078f 100644 --- a/package/network/services/dropbear/patches/100-pubkey_path.patch +++ b/package/network/services/dropbear/patches/100-pubkey_path.patch @@ -1,6 +1,6 @@ --- a/svr-authpubkey.c +++ b/svr-authpubkey.c -@@ -229,14 +229,20 @@ static int checkpubkey(char* algo, unsig +@@ -338,14 +338,19 @@ static int checkpubkey(const char* algo, goto out; } @@ -25,34 +25,23 @@ + filename = m_malloc(30); + strncpy(filename, "/etc/dropbear/authorized_keys", 30); + } -+ + #if DROPBEAR_SVR_MULTIUSER /* open the file as the authenticating user. */ - origuid = getuid(); -@@ -405,26 +411,35 @@ static int checkpubkeyperms() { +@@ -426,27 +431,36 @@ static int checkpubkeyperms() { goto out; } - /* allocate max required pathname storage, - * = path + "/.ssh/authorized_keys" + '\0' = pathlen + 22 */ -- filename = m_malloc(len + 22); -- strncpy(filename, ses.authstate.pw_dir, len+1); +- len += 22; +- filename = m_malloc(len); +- strlcpy(filename, ses.authstate.pw_dir, len); - - /* check ~ */ - if (checkfileperm(filename) != DROPBEAR_SUCCESS) { - goto out; - } -- -- /* check ~/.ssh */ -- strncat(filename, "/.ssh", 5); /* strlen("/.ssh") == 5 */ -- if (checkfileperm(filename) != DROPBEAR_SUCCESS) { -- goto out; -- } -- -- /* now check ~/.ssh/authorized_keys */ -- strncat(filename, "/authorized_keys", 16); -- if (checkfileperm(filename) != DROPBEAR_SUCCESS) { -- goto out; + if (ses.authstate.pw_uid == 0) { + if (checkfileperm("/etc/dropbear") != DROPBEAR_SUCCESS) { + goto out; @@ -63,22 +52,32 @@ + } else { + /* allocate max required pathname storage, + * = path + "/.ssh/authorized_keys" + '\0' = pathlen + 22 */ -+ filename = m_malloc(len + 22); -+ strncpy(filename, ses.authstate.pw_dir, len+1); ++ len += 22; ++ filename = m_malloc(len); ++ strlcpy(filename, ses.authstate.pw_dir, len); + + /* check ~ */ + if (checkfileperm(filename) != DROPBEAR_SUCCESS) { + goto out; + } -+ + +- /* check ~/.ssh */ +- strlcat(filename, "/.ssh", len); +- if (checkfileperm(filename) != DROPBEAR_SUCCESS) { +- goto out; +- } + /* check ~/.ssh */ -+ strncat(filename, "/.ssh", 5); /* strlen("/.ssh") == 5 */ ++ strlcat(filename, "/.ssh", len); + if (checkfileperm(filename) != DROPBEAR_SUCCESS) { + goto out; + } -+ + +- /* now check ~/.ssh/authorized_keys */ +- strlcat(filename, "/authorized_keys", len); +- if (checkfileperm(filename) != DROPBEAR_SUCCESS) { +- goto out; + /* now check ~/.ssh/authorized_keys */ -+ strncat(filename, "/authorized_keys", 16); ++ strlcat(filename, "/authorized_keys", len); + if (checkfileperm(filename) != DROPBEAR_SUCCESS) { + goto out; + } diff --git a/package/network/services/dropbear/patches/110-change_user.patch b/package/network/services/dropbear/patches/110-change_user.patch index 4b5c1cb51b..27e7fbaf4f 100644 --- a/package/network/services/dropbear/patches/110-change_user.patch +++ b/package/network/services/dropbear/patches/110-change_user.patch @@ -1,6 +1,6 @@ --- a/svr-chansession.c +++ b/svr-chansession.c -@@ -922,12 +922,12 @@ static void execchild(void *user_data) { +@@ -953,12 +953,12 @@ static void execchild(const void *user_d /* We can only change uid/gid as root ... */ if (getuid() == 0) { diff --git a/package/network/services/dropbear/patches/120-openwrt_options.patch b/package/network/services/dropbear/patches/120-openwrt_options.patch deleted file mode 100644 index 7f47a74304..0000000000 --- a/package/network/services/dropbear/patches/120-openwrt_options.patch +++ /dev/null @@ -1,82 +0,0 @@ ---- a/options.h -+++ b/options.h -@@ -41,7 +41,7 @@ - * Both of these flags can be defined at once, don't compile without at least - * one of them. */ - #define NON_INETD_MODE --#define INETD_MODE -+/*#define INETD_MODE*/ - - /* Setting this disables the fast exptmod bignum code. It saves ~5kB, but is - * perhaps 20% slower for pubkey operations (it is probably worth experimenting -@@ -81,7 +81,7 @@ much traffic. */ - - /* Enable "Netcat mode" option. This will forward standard input/output - * to a remote TCP-forwarded connection */ --#define ENABLE_CLI_NETCAT -+/*#define ENABLE_CLI_NETCAT*/ - - /* Whether to support "-c" and "-m" flags to choose ciphers/MACs at runtime */ - #define ENABLE_USER_ALGO_LIST -@@ -91,16 +91,16 @@ much traffic. */ - * Including multiple keysize variants the same cipher - * (eg AES256 as well as AES128) will result in a minimal size increase.*/ - #define DROPBEAR_AES128 --#define DROPBEAR_3DES -+/*#define DROPBEAR_3DES*/ - #define DROPBEAR_AES256 - /* Compiling in Blowfish will add ~6kB to runtime heap memory usage */ - /*#define DROPBEAR_BLOWFISH*/ --#define DROPBEAR_TWOFISH256 --#define DROPBEAR_TWOFISH128 -+/*#define DROPBEAR_TWOFISH256*/ -+/*#define DROPBEAR_TWOFISH128*/ - - /* Enable CBC mode for ciphers. This has security issues though - * is the most compatible with older SSH implementations */ --#define DROPBEAR_ENABLE_CBC_MODE -+/*#define DROPBEAR_ENABLE_CBC_MODE*/ - - /* Enable "Counter Mode" for ciphers. This is more secure than normal - * CBC mode against certain attacks. It is recommended for security -@@ -131,10 +131,10 @@ If you test it please contact the Dropbe - * If you disable MD5, Dropbear will fall back to SHA1 fingerprints, - * which are not the standard form. */ - #define DROPBEAR_SHA1_HMAC --#define DROPBEAR_SHA1_96_HMAC -+/*#define DROPBEAR_SHA1_96_HMAC*/ - #define DROPBEAR_SHA2_256_HMAC --#define DROPBEAR_SHA2_512_HMAC --#define DROPBEAR_MD5_HMAC -+/*#define DROPBEAR_SHA2_512_HMAC*/ -+/*#define DROPBEAR_MD5_HMAC*/ - - /* You can also disable integrity. Don't bother disabling this if you're - * still using a cipher, it's relatively cheap. If you disable this it's dead -@@ -146,7 +146,7 @@ If you test it please contact the Dropbe - * Removing either of these won't save very much space. - * SSH2 RFC Draft requires dss, recommends rsa */ - #define DROPBEAR_RSA --#define DROPBEAR_DSS -+/*#define DROPBEAR_DSS*/ - /* ECDSA is significantly faster than RSA or DSS. Compiling in ECC - * code (either ECDSA or ECDH) increases binary size - around 30kB - * on x86-64 */ -@@ -194,7 +194,7 @@ If you test it please contact the Dropbe - - /* Whether to print the message of the day (MOTD). This doesn't add much code - * size */ --#define DO_MOTD -+/*#define DO_MOTD*/ - - /* The MOTD file path */ - #ifndef MOTD_FILENAME -@@ -242,7 +242,7 @@ Homedir is prepended unless path begins - * note that it will be provided for all "hidden" client-interactive - * style prompts - if you want something more sophisticated, use - * SSH_ASKPASS instead. Comment out this var to remove this functionality.*/ --#define DROPBEAR_PASSWORD_ENV "DROPBEAR_PASSWORD" -+/*#define DROPBEAR_PASSWORD_ENV "DROPBEAR_PASSWORD"*/ - - /* Define this (as well as ENABLE_CLI_PASSWORD_AUTH) to allow the use of - * a helper program for the ssh client. The helper program should be diff --git a/package/network/services/dropbear/patches/130-ssh_ignore_x_args.patch b/package/network/services/dropbear/patches/130-ssh_ignore_x_args.patch index ab09c2f3dc..5e736320cc 100644 --- a/package/network/services/dropbear/patches/130-ssh_ignore_x_args.patch +++ b/package/network/services/dropbear/patches/130-ssh_ignore_x_args.patch @@ -1,6 +1,6 @@ --- a/cli-runopts.c +++ b/cli-runopts.c -@@ -296,6 +296,8 @@ void cli_getopts(int argc, char ** argv) +@@ -299,6 +299,8 @@ void cli_getopts(int argc, char ** argv) debug_trace = 1; break; #endif @@ -8,4 +8,4 @@ + break; case 'F': case 'e': - #ifndef ENABLE_USER_ALGO_LIST + #if !DROPBEAR_USER_ALGO_LIST diff --git a/package/network/services/dropbear/patches/140-disable_assert.patch b/package/network/services/dropbear/patches/140-disable_assert.patch index 78b54acfa0..8c3ae7f119 100644 --- a/package/network/services/dropbear/patches/140-disable_assert.patch +++ b/package/network/services/dropbear/patches/140-disable_assert.patch @@ -1,6 +1,6 @@ --- a/dbutil.h +++ b/dbutil.h -@@ -78,7 +78,11 @@ int m_str_to_uint(const char* str, unsig +@@ -75,7 +75,11 @@ int m_str_to_uint(const char* str, unsig #define DEF_MP_INT(X) mp_int X = {0, 0, 0, NULL} /* Dropbear assertion */ diff --git a/package/network/services/dropbear/patches/150-dbconvert_standalone.patch b/package/network/services/dropbear/patches/150-dbconvert_standalone.patch deleted file mode 100644 index ccc2cb7925..0000000000 --- a/package/network/services/dropbear/patches/150-dbconvert_standalone.patch +++ /dev/null @@ -1,14 +0,0 @@ ---- a/options.h -+++ b/options.h -@@ -5,6 +5,11 @@ - #ifndef DROPBEAR_OPTIONS_H_ - #define DROPBEAR_OPTIONS_H_ - -+#if !defined(DROPBEAR_CLIENT) && !defined(DROPBEAR_SERVER) -+#define DROPBEAR_SERVER -+#define DROPBEAR_CLIENT -+#endif -+ - /* Define compile-time options below - the "#ifndef DROPBEAR_XXX .... #endif" - * parts are to allow for commandline -DDROPBEAR_XXX options etc. */ - diff --git a/package/network/services/dropbear/patches/160-lto-jobserver.patch b/package/network/services/dropbear/patches/160-lto-jobserver.patch index bb94492833..02765335d3 100644 --- a/package/network/services/dropbear/patches/160-lto-jobserver.patch +++ b/package/network/services/dropbear/patches/160-lto-jobserver.patch @@ -1,6 +1,6 @@ --- a/Makefile.in +++ b/Makefile.in -@@ -163,17 +163,17 @@ dropbearkey: $(dropbearkeyobjs) +@@ -189,17 +189,17 @@ dropbearkey: $(dropbearkeyobjs) dropbearconvert: $(dropbearconvertobjs) dropbear: $(HEADERS) $(LIBTOM_DEPS) Makefile @@ -12,8 +12,8 @@ + +$(CC) $(LDFLAGS) -o $@$(EXEEXT) $($@objs) $(LIBTOM_LIBS) $(LIBS) dropbearkey dropbearconvert: $(HEADERS) $(LIBTOM_DEPS) Makefile -- $(CC) $(LDFLAGS) -o $@$(EXEEXT) $($@objs) $(LIBTOM_LIBS) -+ +$(CC) $(LDFLAGS) -o $@$(EXEEXT) $($@objs) $(LIBTOM_LIBS) +- $(CC) $(LDFLAGS) -o $@$(EXEEXT) $($@objs) $(LIBTOM_LIBS) $(LIBS) ++ +$(CC) $(LDFLAGS) -o $@$(EXEEXT) $($@objs) $(LIBTOM_LIBS) $(LIBS) # scp doesn't use the libs so is special. scp: $(SCPOBJS) $(HEADERS) Makefile @@ -22,7 +22,7 @@ # multi-binary compilation. -@@ -184,7 +184,7 @@ ifeq ($(MULTI),1) +@@ -210,7 +210,7 @@ ifeq ($(MULTI),1) endif dropbearmulti$(EXEEXT): $(HEADERS) $(MULTIOBJS) $(LIBTOM_DEPS) Makefile diff --git a/package/network/services/dropbear/patches/600-allow-blank-root-password.patch b/package/network/services/dropbear/patches/600-allow-blank-root-password.patch index 7c67b086bb..b138862ca3 100644 --- a/package/network/services/dropbear/patches/600-allow-blank-root-password.patch +++ b/package/network/services/dropbear/patches/600-allow-blank-root-password.patch @@ -1,6 +1,6 @@ --- a/svr-auth.c +++ b/svr-auth.c -@@ -149,7 +149,7 @@ void recv_msg_userauth_request() { +@@ -125,7 +125,7 @@ void recv_msg_userauth_request() { AUTH_METHOD_NONE_LEN) == 0) { TRACE(("recv_msg_userauth_request: 'none' request")) if (valid_user diff --git a/package/network/services/dropbear/patches/610-skip-default-keys-in-custom-runs.patch b/package/network/services/dropbear/patches/610-skip-default-keys-in-custom-runs.patch deleted file mode 100644 index a555a9e498..0000000000 --- a/package/network/services/dropbear/patches/610-skip-default-keys-in-custom-runs.patch +++ /dev/null @@ -1,18 +0,0 @@ ---- a/svr-runopts.c -+++ b/svr-runopts.c -@@ -505,6 +505,7 @@ void load_all_hostkeys() { - m_free(hostkey_file); - } - -+ if (svr_opts.num_hostkey_files <= 0) { - #ifdef DROPBEAR_RSA - loadhostkey(RSA_PRIV_FILENAME, 0); - #endif -@@ -516,6 +517,7 @@ void load_all_hostkeys() { - #ifdef DROPBEAR_ECDSA - loadhostkey(ECDSA_PRIV_FILENAME, 0); - #endif -+ } - - #ifdef DROPBEAR_DELAY_HOSTKEY - if (svr_opts.delay_hostkey) { diff --git a/package/network/services/dropbear/patches/900-configure-hardening.patch b/package/network/services/dropbear/patches/900-configure-hardening.patch new file mode 100644 index 0000000000..ab1361f6ae --- /dev/null +++ b/package/network/services/dropbear/patches/900-configure-hardening.patch @@ -0,0 +1,56 @@ +--- a/configure.ac ++++ b/configure.ac +@@ -70,53 +70,6 @@ AC_ARG_ENABLE(harden, + + if test "$hardenbuild" -eq 1; then + AC_MSG_NOTICE(Checking for available hardened build flags:) +- # relocation flags don't make sense for static builds +- if test "$STATIC" -ne 1; then +- # pie +- DB_TRYADDCFLAGS([-fPIE]) +- +- OLDLDFLAGS="$LDFLAGS" +- TESTFLAGS="-Wl,-pie" +- LDFLAGS="$LDFLAGS $TESTFLAGS" +- AC_LINK_IFELSE([AC_LANG_PROGRAM([])], +- [AC_MSG_NOTICE([Setting $TESTFLAGS])], +- [ +- LDFLAGS="$OLDLDFLAGS" +- TESTFLAGS="-pie" +- LDFLAGS="$LDFLAGS $TESTFLAGS" +- AC_LINK_IFELSE([AC_LANG_PROGRAM([])], +- [AC_MSG_NOTICE([Setting $TESTFLAGS])], +- [AC_MSG_NOTICE([Not setting $TESTFLAGS]); LDFLAGS="$OLDLDFLAGS" ] +- ) +- ] +- ) +- # readonly elf relocation sections (relro) +- OLDLDFLAGS="$LDFLAGS" +- TESTFLAGS="-Wl,-z,now -Wl,-z,relro" +- LDFLAGS="$LDFLAGS $TESTFLAGS" +- AC_LINK_IFELSE([AC_LANG_PROGRAM([])], +- [AC_MSG_NOTICE([Setting $TESTFLAGS])], +- [AC_MSG_NOTICE([Not setting $TESTFLAGS]); LDFLAGS="$OLDLDFLAGS" ] +- ) +- fi # non-static +- # stack protector. -strong is good but only in gcc 4.9 or later +- OLDCFLAGS="$CFLAGS" +- TESTFLAGS="-fstack-protector-strong" +- CFLAGS="$CFLAGS $TESTFLAGS" +- AC_COMPILE_IFELSE([AC_LANG_PROGRAM([])], +- [AC_MSG_NOTICE([Setting $TESTFLAGS])], +- [ +- CFLAGS="$OLDCFLAGS" +- TESTFLAGS="-fstack-protector --param=ssp-buffer-size=4" +- CFLAGS="$CFLAGS $TESTFLAGS" +- AC_COMPILE_IFELSE([AC_LANG_PROGRAM([])], +- [AC_MSG_NOTICE([Setting $TESTFLAGS])], +- [AC_MSG_NOTICE([Not setting $TESTFLAGS]); CFLAGS="$OLDCFLAGS" ] +- ) +- ] +- ) +- # FORTIFY_SOURCE +- DB_TRYADDCFLAGS([-D_FORTIFY_SOURCE=2]) + + # Spectre v2 mitigations + DB_TRYADDCFLAGS([-mfunction-return=thunk]) diff --git a/package/network/services/dropbear/patches/901-bundled-libs-cflags.patch b/package/network/services/dropbear/patches/901-bundled-libs-cflags.patch new file mode 100644 index 0000000000..a249a655db --- /dev/null +++ b/package/network/services/dropbear/patches/901-bundled-libs-cflags.patch @@ -0,0 +1,48 @@ +--- a/libtomcrypt/makefile_include.mk ++++ b/libtomcrypt/makefile_include.mk +@@ -75,6 +75,13 @@ endif + + LTC_CFLAGS += -Wno-type-limits + ++ifdef LIBRECMC_BUILD ++ ifeq (-Os,$(filter -Os,$(CFLAGS))) ++ LTC_CFLAGS += -DLTC_SMALL_CODE ++ endif ++else ++ ### ! LIBRECMC_BUILD ++ + ifdef LTC_DEBUG + $(info Debug build) + # compile for DEBUGGING (required for ccmalloc checking!!!) +@@ -102,6 +109,9 @@ endif + endif # COMPILE_SMALL + endif # COMPILE_DEBUG + ++ ### ! LIBRECMC_BUILD ++endif ++ + + ifneq ($(findstring clang,$(CC)),) + LTC_CFLAGS += -Wno-typedef-redefinition -Wno-tautological-compare -Wno-builtin-requires-header -Wno-missing-field-initializers +--- a/libtommath/makefile_include.mk ++++ b/libtommath/makefile_include.mk +@@ -37,6 +37,9 @@ CFLAGS += -Wsystem-headers -Wdeclaration + CFLAGS += -Wstrict-prototypes -Wpointer-arith + endif + ++ifndef LIBRECMC_BUILD ++ ### ! LIBRECMC_BUILD ++ + ifdef COMPILE_DEBUG + #debug + CFLAGS += -g3 +@@ -58,6 +61,9 @@ endif + endif # COMPILE_SIZE + endif # COMPILE_DEBUG + ++ ### ! LIBRECMC_BUILD ++endif ++ + ifneq ($(findstring clang,$(CC)),) + CFLAGS += -Wno-typedef-redefinition -Wno-tautological-compare -Wno-builtin-requires-header + endif diff --git a/package/network/services/ead/Makefile b/package/network/services/ead/Makefile new file mode 100644 index 0000000000..9a34561834 --- /dev/null +++ b/package/network/services/ead/Makefile @@ -0,0 +1,52 @@ +# +# Copyright (C) 2006-2008 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +include $(TOPDIR)/rules.mk + +PKG_NAME:=ead +PKG_RELEASE:=1 + +PKG_BUILD_DEPENDS:=libpcap +PKG_BUILD_DIR:=$(BUILD_DIR)/ead + +PKG_MAINTAINER:=Felix Fietkau +PKG_LICENSE:=GPL-2.0 + +include $(INCLUDE_DIR)/package.mk +include $(INCLUDE_DIR)/kernel.mk + +define Package/ead + SECTION:=net + CATEGORY:=Base system + TITLE:=Emergency Access Daemon + URL:=http://bridge.sourceforge.net/ +endef + +define Package/ead/description + Provides remote access to your device even if IP and firewall + configuration settings are defunct +endef + +CONFIGURE_PATH = tinysrp + +TARGET_CFLAGS += \ + -I$(PKG_BUILD_DIR) \ + -I$(PKG_BUILD_DIR)/tinysrp \ + $(TARGET_CPPFLAGS) + +MAKE_FLAGS += \ + CONFIGURE_ARGS="$(CONFIGURE_ARGS)" \ + LIBS_EADCLIENT="$(PKG_BUILD_DIR)/tinysrp/libtinysrp.a" \ + LIBS_EAD="$(PKG_BUILD_DIR)/tinysrp/libtinysrp.a $(STAGING_DIR)/usr/lib/libpcap.a" \ + CFLAGS="$(TARGET_CFLAGS)" + +define Package/ead/install + $(INSTALL_DIR) $(1)/sbin + $(INSTALL_BIN) $(PKG_BUILD_DIR)/ead $(1)/sbin/ +endef + +$(eval $(call BuildPackage,ead)) diff --git a/package/network/services/ead/src/Makefile b/package/network/services/ead/src/Makefile new file mode 100644 index 0000000000..eb755169f8 --- /dev/null +++ b/package/network/services/ead/src/Makefile @@ -0,0 +1,33 @@ +CC = gcc +CPPFLAGS = -I. -Itinysrp +CFLAGS = -Os -Wall +LDFLAGS = +LIBS_EADCLIENT = tinysrp/libtinysrp.a +LIBS_EAD = tinysrp/libtinysrp.a -lpcap +CONFIGURE_ARGS = + +all: ead ead-client + +obj = ead-crypt.o libbridge_init.o + +tinysrp/Makefile: + cd tinysrp; ./configure $(CONFIGURE_ARGS) + +tinysrp/libtinysrp.a: tinysrp/Makefile + -$(MAKE) -C tinysrp CFLAGS="$(CFLAGS)" + +%.o: %.c $(wildcard *.h) tinysrp/libtinysrp.a + $(CC) $(CPPFLAGS) $(CFLAGS) -c $< -o $@ + +ead.o: filter.c +ead-crypt.o: aes.c sha1.c + +ead: ead.o $(obj) tinysrp/libtinysrp.a + $(CC) -o $@ $< $(obj) $(LDFLAGS) $(LIBS_EAD) + +ead-client: ead-client.o $(obj) + $(CC) -o $@ $< $(obj) $(LDFLAGS) $(LIBS_EADCLIENT) + +clean: + rm -f *.o ead ead-client + if [ -f tinysrp/Makefile ]; then $(MAKE) -C tinysrp distclean; fi diff --git a/package/network/services/ead/src/aes.c b/package/network/services/ead/src/aes.c new file mode 100644 index 0000000000..6f9db345fb --- /dev/null +++ b/package/network/services/ead/src/aes.c @@ -0,0 +1,1061 @@ +/* + * AES (Rijndael) cipher + * + * Modifications to public domain implementation: + * - support only 128-bit keys + * - cleanup + * - use C pre-processor to make it easier to change S table access + * - added option (AES_SMALL_TABLES) for reducing code size by about 8 kB at + * cost of reduced throughput (quite small difference on Pentium 4, + * 10-25% when using -O1 or -O2 optimization) + * + * Copyright (c) 2003-2005, Jouni Malinen + * + * 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. + * + * Alternatively, this software may be distributed under the terms of BSD + * license. + * + * See README and COPYING for more details. + */ + +/* + * rijndael-alg-fst.c + * + * @version 3.0 (December 2000) + * + * Optimised ANSI C code for the Rijndael cipher (now AES) + * + * @author Vincent Rijmen + * @author Antoon Bosselaers + * @author Paulo Barreto + * + * This code is hereby placed in the public domain. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHORS ''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 AUTHORS 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. + */ + +/* #define FULL_UNROLL */ +#define AES_SMALL_TABLES + +typedef uint8_t u8; +typedef uint16_t u16; +typedef uint32_t u32; + +/* +Te0[x] = S [x].[02, 01, 01, 03]; +Te1[x] = S [x].[03, 02, 01, 01]; +Te2[x] = S [x].[01, 03, 02, 01]; +Te3[x] = S [x].[01, 01, 03, 02]; +Te4[x] = S [x].[01, 01, 01, 01]; + +Td0[x] = Si[x].[0e, 09, 0d, 0b]; +Td1[x] = Si[x].[0b, 0e, 09, 0d]; +Td2[x] = Si[x].[0d, 0b, 0e, 09]; +Td3[x] = Si[x].[09, 0d, 0b, 0e]; +Td4[x] = Si[x].[01, 01, 01, 01]; +*/ + +static const u32 Te0[256] = { + 0xc66363a5U, 0xf87c7c84U, 0xee777799U, 0xf67b7b8dU, + 0xfff2f20dU, 0xd66b6bbdU, 0xde6f6fb1U, 0x91c5c554U, + 0x60303050U, 0x02010103U, 0xce6767a9U, 0x562b2b7dU, + 0xe7fefe19U, 0xb5d7d762U, 0x4dababe6U, 0xec76769aU, + 0x8fcaca45U, 0x1f82829dU, 0x89c9c940U, 0xfa7d7d87U, + 0xeffafa15U, 0xb25959ebU, 0x8e4747c9U, 0xfbf0f00bU, + 0x41adadecU, 0xb3d4d467U, 0x5fa2a2fdU, 0x45afafeaU, + 0x239c9cbfU, 0x53a4a4f7U, 0xe4727296U, 0x9bc0c05bU, + 0x75b7b7c2U, 0xe1fdfd1cU, 0x3d9393aeU, 0x4c26266aU, + 0x6c36365aU, 0x7e3f3f41U, 0xf5f7f702U, 0x83cccc4fU, + 0x6834345cU, 0x51a5a5f4U, 0xd1e5e534U, 0xf9f1f108U, + 0xe2717193U, 0xabd8d873U, 0x62313153U, 0x2a15153fU, + 0x0804040cU, 0x95c7c752U, 0x46232365U, 0x9dc3c35eU, + 0x30181828U, 0x379696a1U, 0x0a05050fU, 0x2f9a9ab5U, + 0x0e070709U, 0x24121236U, 0x1b80809bU, 0xdfe2e23dU, + 0xcdebeb26U, 0x4e272769U, 0x7fb2b2cdU, 0xea75759fU, + 0x1209091bU, 0x1d83839eU, 0x582c2c74U, 0x341a1a2eU, + 0x361b1b2dU, 0xdc6e6eb2U, 0xb45a5aeeU, 0x5ba0a0fbU, + 0xa45252f6U, 0x763b3b4dU, 0xb7d6d661U, 0x7db3b3ceU, + 0x5229297bU, 0xdde3e33eU, 0x5e2f2f71U, 0x13848497U, + 0xa65353f5U, 0xb9d1d168U, 0x00000000U, 0xc1eded2cU, + 0x40202060U, 0xe3fcfc1fU, 0x79b1b1c8U, 0xb65b5bedU, + 0xd46a6abeU, 0x8dcbcb46U, 0x67bebed9U, 0x7239394bU, + 0x944a4adeU, 0x984c4cd4U, 0xb05858e8U, 0x85cfcf4aU, + 0xbbd0d06bU, 0xc5efef2aU, 0x4faaaae5U, 0xedfbfb16U, + 0x864343c5U, 0x9a4d4dd7U, 0x66333355U, 0x11858594U, + 0x8a4545cfU, 0xe9f9f910U, 0x04020206U, 0xfe7f7f81U, + 0xa05050f0U, 0x783c3c44U, 0x259f9fbaU, 0x4ba8a8e3U, + 0xa25151f3U, 0x5da3a3feU, 0x804040c0U, 0x058f8f8aU, + 0x3f9292adU, 0x219d9dbcU, 0x70383848U, 0xf1f5f504U, + 0x63bcbcdfU, 0x77b6b6c1U, 0xafdada75U, 0x42212163U, + 0x20101030U, 0xe5ffff1aU, 0xfdf3f30eU, 0xbfd2d26dU, + 0x81cdcd4cU, 0x180c0c14U, 0x26131335U, 0xc3ecec2fU, + 0xbe5f5fe1U, 0x359797a2U, 0x884444ccU, 0x2e171739U, + 0x93c4c457U, 0x55a7a7f2U, 0xfc7e7e82U, 0x7a3d3d47U, + 0xc86464acU, 0xba5d5de7U, 0x3219192bU, 0xe6737395U, + 0xc06060a0U, 0x19818198U, 0x9e4f4fd1U, 0xa3dcdc7fU, + 0x44222266U, 0x542a2a7eU, 0x3b9090abU, 0x0b888883U, + 0x8c4646caU, 0xc7eeee29U, 0x6bb8b8d3U, 0x2814143cU, + 0xa7dede79U, 0xbc5e5ee2U, 0x160b0b1dU, 0xaddbdb76U, + 0xdbe0e03bU, 0x64323256U, 0x743a3a4eU, 0x140a0a1eU, + 0x924949dbU, 0x0c06060aU, 0x4824246cU, 0xb85c5ce4U, + 0x9fc2c25dU, 0xbdd3d36eU, 0x43acacefU, 0xc46262a6U, + 0x399191a8U, 0x319595a4U, 0xd3e4e437U, 0xf279798bU, + 0xd5e7e732U, 0x8bc8c843U, 0x6e373759U, 0xda6d6db7U, + 0x018d8d8cU, 0xb1d5d564U, 0x9c4e4ed2U, 0x49a9a9e0U, + 0xd86c6cb4U, 0xac5656faU, 0xf3f4f407U, 0xcfeaea25U, + 0xca6565afU, 0xf47a7a8eU, 0x47aeaee9U, 0x10080818U, + 0x6fbabad5U, 0xf0787888U, 0x4a25256fU, 0x5c2e2e72U, + 0x381c1c24U, 0x57a6a6f1U, 0x73b4b4c7U, 0x97c6c651U, + 0xcbe8e823U, 0xa1dddd7cU, 0xe874749cU, 0x3e1f1f21U, + 0x964b4bddU, 0x61bdbddcU, 0x0d8b8b86U, 0x0f8a8a85U, + 0xe0707090U, 0x7c3e3e42U, 0x71b5b5c4U, 0xcc6666aaU, + 0x904848d8U, 0x06030305U, 0xf7f6f601U, 0x1c0e0e12U, + 0xc26161a3U, 0x6a35355fU, 0xae5757f9U, 0x69b9b9d0U, + 0x17868691U, 0x99c1c158U, 0x3a1d1d27U, 0x279e9eb9U, + 0xd9e1e138U, 0xebf8f813U, 0x2b9898b3U, 0x22111133U, + 0xd26969bbU, 0xa9d9d970U, 0x078e8e89U, 0x339494a7U, + 0x2d9b9bb6U, 0x3c1e1e22U, 0x15878792U, 0xc9e9e920U, + 0x87cece49U, 0xaa5555ffU, 0x50282878U, 0xa5dfdf7aU, + 0x038c8c8fU, 0x59a1a1f8U, 0x09898980U, 0x1a0d0d17U, + 0x65bfbfdaU, 0xd7e6e631U, 0x844242c6U, 0xd06868b8U, + 0x824141c3U, 0x299999b0U, 0x5a2d2d77U, 0x1e0f0f11U, + 0x7bb0b0cbU, 0xa85454fcU, 0x6dbbbbd6U, 0x2c16163aU, +}; +#ifndef AES_SMALL_TABLES +static const u32 Te1[256] = { + 0xa5c66363U, 0x84f87c7cU, 0x99ee7777U, 0x8df67b7bU, + 0x0dfff2f2U, 0xbdd66b6bU, 0xb1de6f6fU, 0x5491c5c5U, + 0x50603030U, 0x03020101U, 0xa9ce6767U, 0x7d562b2bU, + 0x19e7fefeU, 0x62b5d7d7U, 0xe64dababU, 0x9aec7676U, + 0x458fcacaU, 0x9d1f8282U, 0x4089c9c9U, 0x87fa7d7dU, + 0x15effafaU, 0xebb25959U, 0xc98e4747U, 0x0bfbf0f0U, + 0xec41adadU, 0x67b3d4d4U, 0xfd5fa2a2U, 0xea45afafU, + 0xbf239c9cU, 0xf753a4a4U, 0x96e47272U, 0x5b9bc0c0U, + 0xc275b7b7U, 0x1ce1fdfdU, 0xae3d9393U, 0x6a4c2626U, + 0x5a6c3636U, 0x417e3f3fU, 0x02f5f7f7U, 0x4f83ccccU, + 0x5c683434U, 0xf451a5a5U, 0x34d1e5e5U, 0x08f9f1f1U, + 0x93e27171U, 0x73abd8d8U, 0x53623131U, 0x3f2a1515U, + 0x0c080404U, 0x5295c7c7U, 0x65462323U, 0x5e9dc3c3U, + 0x28301818U, 0xa1379696U, 0x0f0a0505U, 0xb52f9a9aU, + 0x090e0707U, 0x36241212U, 0x9b1b8080U, 0x3ddfe2e2U, + 0x26cdebebU, 0x694e2727U, 0xcd7fb2b2U, 0x9fea7575U, + 0x1b120909U, 0x9e1d8383U, 0x74582c2cU, 0x2e341a1aU, + 0x2d361b1bU, 0xb2dc6e6eU, 0xeeb45a5aU, 0xfb5ba0a0U, + 0xf6a45252U, 0x4d763b3bU, 0x61b7d6d6U, 0xce7db3b3U, + 0x7b522929U, 0x3edde3e3U, 0x715e2f2fU, 0x97138484U, + 0xf5a65353U, 0x68b9d1d1U, 0x00000000U, 0x2cc1ededU, + 0x60402020U, 0x1fe3fcfcU, 0xc879b1b1U, 0xedb65b5bU, + 0xbed46a6aU, 0x468dcbcbU, 0xd967bebeU, 0x4b723939U, + 0xde944a4aU, 0xd4984c4cU, 0xe8b05858U, 0x4a85cfcfU, + 0x6bbbd0d0U, 0x2ac5efefU, 0xe54faaaaU, 0x16edfbfbU, + 0xc5864343U, 0xd79a4d4dU, 0x55663333U, 0x94118585U, + 0xcf8a4545U, 0x10e9f9f9U, 0x06040202U, 0x81fe7f7fU, + 0xf0a05050U, 0x44783c3cU, 0xba259f9fU, 0xe34ba8a8U, + 0xf3a25151U, 0xfe5da3a3U, 0xc0804040U, 0x8a058f8fU, + 0xad3f9292U, 0xbc219d9dU, 0x48703838U, 0x04f1f5f5U, + 0xdf63bcbcU, 0xc177b6b6U, 0x75afdadaU, 0x63422121U, + 0x30201010U, 0x1ae5ffffU, 0x0efdf3f3U, 0x6dbfd2d2U, + 0x4c81cdcdU, 0x14180c0cU, 0x35261313U, 0x2fc3ececU, + 0xe1be5f5fU, 0xa2359797U, 0xcc884444U, 0x392e1717U, + 0x5793c4c4U, 0xf255a7a7U, 0x82fc7e7eU, 0x477a3d3dU, + 0xacc86464U, 0xe7ba5d5dU, 0x2b321919U, 0x95e67373U, + 0xa0c06060U, 0x98198181U, 0xd19e4f4fU, 0x7fa3dcdcU, + 0x66442222U, 0x7e542a2aU, 0xab3b9090U, 0x830b8888U, + 0xca8c4646U, 0x29c7eeeeU, 0xd36bb8b8U, 0x3c281414U, + 0x79a7dedeU, 0xe2bc5e5eU, 0x1d160b0bU, 0x76addbdbU, + 0x3bdbe0e0U, 0x56643232U, 0x4e743a3aU, 0x1e140a0aU, + 0xdb924949U, 0x0a0c0606U, 0x6c482424U, 0xe4b85c5cU, + 0x5d9fc2c2U, 0x6ebdd3d3U, 0xef43acacU, 0xa6c46262U, + 0xa8399191U, 0xa4319595U, 0x37d3e4e4U, 0x8bf27979U, + 0x32d5e7e7U, 0x438bc8c8U, 0x596e3737U, 0xb7da6d6dU, + 0x8c018d8dU, 0x64b1d5d5U, 0xd29c4e4eU, 0xe049a9a9U, + 0xb4d86c6cU, 0xfaac5656U, 0x07f3f4f4U, 0x25cfeaeaU, + 0xafca6565U, 0x8ef47a7aU, 0xe947aeaeU, 0x18100808U, + 0xd56fbabaU, 0x88f07878U, 0x6f4a2525U, 0x725c2e2eU, + 0x24381c1cU, 0xf157a6a6U, 0xc773b4b4U, 0x5197c6c6U, + 0x23cbe8e8U, 0x7ca1ddddU, 0x9ce87474U, 0x213e1f1fU, + 0xdd964b4bU, 0xdc61bdbdU, 0x860d8b8bU, 0x850f8a8aU, + 0x90e07070U, 0x427c3e3eU, 0xc471b5b5U, 0xaacc6666U, + 0xd8904848U, 0x05060303U, 0x01f7f6f6U, 0x121c0e0eU, + 0xa3c26161U, 0x5f6a3535U, 0xf9ae5757U, 0xd069b9b9U, + 0x91178686U, 0x5899c1c1U, 0x273a1d1dU, 0xb9279e9eU, + 0x38d9e1e1U, 0x13ebf8f8U, 0xb32b9898U, 0x33221111U, + 0xbbd26969U, 0x70a9d9d9U, 0x89078e8eU, 0xa7339494U, + 0xb62d9b9bU, 0x223c1e1eU, 0x92158787U, 0x20c9e9e9U, + 0x4987ceceU, 0xffaa5555U, 0x78502828U, 0x7aa5dfdfU, + 0x8f038c8cU, 0xf859a1a1U, 0x80098989U, 0x171a0d0dU, + 0xda65bfbfU, 0x31d7e6e6U, 0xc6844242U, 0xb8d06868U, + 0xc3824141U, 0xb0299999U, 0x775a2d2dU, 0x111e0f0fU, + 0xcb7bb0b0U, 0xfca85454U, 0xd66dbbbbU, 0x3a2c1616U, +}; +static const u32 Te2[256] = { + 0x63a5c663U, 0x7c84f87cU, 0x7799ee77U, 0x7b8df67bU, + 0xf20dfff2U, 0x6bbdd66bU, 0x6fb1de6fU, 0xc55491c5U, + 0x30506030U, 0x01030201U, 0x67a9ce67U, 0x2b7d562bU, + 0xfe19e7feU, 0xd762b5d7U, 0xabe64dabU, 0x769aec76U, + 0xca458fcaU, 0x829d1f82U, 0xc94089c9U, 0x7d87fa7dU, + 0xfa15effaU, 0x59ebb259U, 0x47c98e47U, 0xf00bfbf0U, + 0xadec41adU, 0xd467b3d4U, 0xa2fd5fa2U, 0xafea45afU, + 0x9cbf239cU, 0xa4f753a4U, 0x7296e472U, 0xc05b9bc0U, + 0xb7c275b7U, 0xfd1ce1fdU, 0x93ae3d93U, 0x266a4c26U, + 0x365a6c36U, 0x3f417e3fU, 0xf702f5f7U, 0xcc4f83ccU, + 0x345c6834U, 0xa5f451a5U, 0xe534d1e5U, 0xf108f9f1U, + 0x7193e271U, 0xd873abd8U, 0x31536231U, 0x153f2a15U, + 0x040c0804U, 0xc75295c7U, 0x23654623U, 0xc35e9dc3U, + 0x18283018U, 0x96a13796U, 0x050f0a05U, 0x9ab52f9aU, + 0x07090e07U, 0x12362412U, 0x809b1b80U, 0xe23ddfe2U, + 0xeb26cdebU, 0x27694e27U, 0xb2cd7fb2U, 0x759fea75U, + 0x091b1209U, 0x839e1d83U, 0x2c74582cU, 0x1a2e341aU, + 0x1b2d361bU, 0x6eb2dc6eU, 0x5aeeb45aU, 0xa0fb5ba0U, + 0x52f6a452U, 0x3b4d763bU, 0xd661b7d6U, 0xb3ce7db3U, + 0x297b5229U, 0xe33edde3U, 0x2f715e2fU, 0x84971384U, + 0x53f5a653U, 0xd168b9d1U, 0x00000000U, 0xed2cc1edU, + 0x20604020U, 0xfc1fe3fcU, 0xb1c879b1U, 0x5bedb65bU, + 0x6abed46aU, 0xcb468dcbU, 0xbed967beU, 0x394b7239U, + 0x4ade944aU, 0x4cd4984cU, 0x58e8b058U, 0xcf4a85cfU, + 0xd06bbbd0U, 0xef2ac5efU, 0xaae54faaU, 0xfb16edfbU, + 0x43c58643U, 0x4dd79a4dU, 0x33556633U, 0x85941185U, + 0x45cf8a45U, 0xf910e9f9U, 0x02060402U, 0x7f81fe7fU, + 0x50f0a050U, 0x3c44783cU, 0x9fba259fU, 0xa8e34ba8U, + 0x51f3a251U, 0xa3fe5da3U, 0x40c08040U, 0x8f8a058fU, + 0x92ad3f92U, 0x9dbc219dU, 0x38487038U, 0xf504f1f5U, + 0xbcdf63bcU, 0xb6c177b6U, 0xda75afdaU, 0x21634221U, + 0x10302010U, 0xff1ae5ffU, 0xf30efdf3U, 0xd26dbfd2U, + 0xcd4c81cdU, 0x0c14180cU, 0x13352613U, 0xec2fc3ecU, + 0x5fe1be5fU, 0x97a23597U, 0x44cc8844U, 0x17392e17U, + 0xc45793c4U, 0xa7f255a7U, 0x7e82fc7eU, 0x3d477a3dU, + 0x64acc864U, 0x5de7ba5dU, 0x192b3219U, 0x7395e673U, + 0x60a0c060U, 0x81981981U, 0x4fd19e4fU, 0xdc7fa3dcU, + 0x22664422U, 0x2a7e542aU, 0x90ab3b90U, 0x88830b88U, + 0x46ca8c46U, 0xee29c7eeU, 0xb8d36bb8U, 0x143c2814U, + 0xde79a7deU, 0x5ee2bc5eU, 0x0b1d160bU, 0xdb76addbU, + 0xe03bdbe0U, 0x32566432U, 0x3a4e743aU, 0x0a1e140aU, + 0x49db9249U, 0x060a0c06U, 0x246c4824U, 0x5ce4b85cU, + 0xc25d9fc2U, 0xd36ebdd3U, 0xacef43acU, 0x62a6c462U, + 0x91a83991U, 0x95a43195U, 0xe437d3e4U, 0x798bf279U, + 0xe732d5e7U, 0xc8438bc8U, 0x37596e37U, 0x6db7da6dU, + 0x8d8c018dU, 0xd564b1d5U, 0x4ed29c4eU, 0xa9e049a9U, + 0x6cb4d86cU, 0x56faac56U, 0xf407f3f4U, 0xea25cfeaU, + 0x65afca65U, 0x7a8ef47aU, 0xaee947aeU, 0x08181008U, + 0xbad56fbaU, 0x7888f078U, 0x256f4a25U, 0x2e725c2eU, + 0x1c24381cU, 0xa6f157a6U, 0xb4c773b4U, 0xc65197c6U, + 0xe823cbe8U, 0xdd7ca1ddU, 0x749ce874U, 0x1f213e1fU, + 0x4bdd964bU, 0xbddc61bdU, 0x8b860d8bU, 0x8a850f8aU, + 0x7090e070U, 0x3e427c3eU, 0xb5c471b5U, 0x66aacc66U, + 0x48d89048U, 0x03050603U, 0xf601f7f6U, 0x0e121c0eU, + 0x61a3c261U, 0x355f6a35U, 0x57f9ae57U, 0xb9d069b9U, + 0x86911786U, 0xc15899c1U, 0x1d273a1dU, 0x9eb9279eU, + 0xe138d9e1U, 0xf813ebf8U, 0x98b32b98U, 0x11332211U, + 0x69bbd269U, 0xd970a9d9U, 0x8e89078eU, 0x94a73394U, + 0x9bb62d9bU, 0x1e223c1eU, 0x87921587U, 0xe920c9e9U, + 0xce4987ceU, 0x55ffaa55U, 0x28785028U, 0xdf7aa5dfU, + 0x8c8f038cU, 0xa1f859a1U, 0x89800989U, 0x0d171a0dU, + 0xbfda65bfU, 0xe631d7e6U, 0x42c68442U, 0x68b8d068U, + 0x41c38241U, 0x99b02999U, 0x2d775a2dU, 0x0f111e0fU, + 0xb0cb7bb0U, 0x54fca854U, 0xbbd66dbbU, 0x163a2c16U, +}; +static const u32 Te3[256] = { + + 0x6363a5c6U, 0x7c7c84f8U, 0x777799eeU, 0x7b7b8df6U, + 0xf2f20dffU, 0x6b6bbdd6U, 0x6f6fb1deU, 0xc5c55491U, + 0x30305060U, 0x01010302U, 0x6767a9ceU, 0x2b2b7d56U, + 0xfefe19e7U, 0xd7d762b5U, 0xababe64dU, 0x76769aecU, + 0xcaca458fU, 0x82829d1fU, 0xc9c94089U, 0x7d7d87faU, + 0xfafa15efU, 0x5959ebb2U, 0x4747c98eU, 0xf0f00bfbU, + 0xadadec41U, 0xd4d467b3U, 0xa2a2fd5fU, 0xafafea45U, + 0x9c9cbf23U, 0xa4a4f753U, 0x727296e4U, 0xc0c05b9bU, + 0xb7b7c275U, 0xfdfd1ce1U, 0x9393ae3dU, 0x26266a4cU, + 0x36365a6cU, 0x3f3f417eU, 0xf7f702f5U, 0xcccc4f83U, + 0x34345c68U, 0xa5a5f451U, 0xe5e534d1U, 0xf1f108f9U, + 0x717193e2U, 0xd8d873abU, 0x31315362U, 0x15153f2aU, + 0x04040c08U, 0xc7c75295U, 0x23236546U, 0xc3c35e9dU, + 0x18182830U, 0x9696a137U, 0x05050f0aU, 0x9a9ab52fU, + 0x0707090eU, 0x12123624U, 0x80809b1bU, 0xe2e23ddfU, + 0xebeb26cdU, 0x2727694eU, 0xb2b2cd7fU, 0x75759feaU, + 0x09091b12U, 0x83839e1dU, 0x2c2c7458U, 0x1a1a2e34U, + 0x1b1b2d36U, 0x6e6eb2dcU, 0x5a5aeeb4U, 0xa0a0fb5bU, + 0x5252f6a4U, 0x3b3b4d76U, 0xd6d661b7U, 0xb3b3ce7dU, + 0x29297b52U, 0xe3e33eddU, 0x2f2f715eU, 0x84849713U, + 0x5353f5a6U, 0xd1d168b9U, 0x00000000U, 0xeded2cc1U, + 0x20206040U, 0xfcfc1fe3U, 0xb1b1c879U, 0x5b5bedb6U, + 0x6a6abed4U, 0xcbcb468dU, 0xbebed967U, 0x39394b72U, + 0x4a4ade94U, 0x4c4cd498U, 0x5858e8b0U, 0xcfcf4a85U, + 0xd0d06bbbU, 0xefef2ac5U, 0xaaaae54fU, 0xfbfb16edU, + 0x4343c586U, 0x4d4dd79aU, 0x33335566U, 0x85859411U, + 0x4545cf8aU, 0xf9f910e9U, 0x02020604U, 0x7f7f81feU, + 0x5050f0a0U, 0x3c3c4478U, 0x9f9fba25U, 0xa8a8e34bU, + 0x5151f3a2U, 0xa3a3fe5dU, 0x4040c080U, 0x8f8f8a05U, + 0x9292ad3fU, 0x9d9dbc21U, 0x38384870U, 0xf5f504f1U, + 0xbcbcdf63U, 0xb6b6c177U, 0xdada75afU, 0x21216342U, + 0x10103020U, 0xffff1ae5U, 0xf3f30efdU, 0xd2d26dbfU, + 0xcdcd4c81U, 0x0c0c1418U, 0x13133526U, 0xecec2fc3U, + 0x5f5fe1beU, 0x9797a235U, 0x4444cc88U, 0x1717392eU, + 0xc4c45793U, 0xa7a7f255U, 0x7e7e82fcU, 0x3d3d477aU, + 0x6464acc8U, 0x5d5de7baU, 0x19192b32U, 0x737395e6U, + 0x6060a0c0U, 0x81819819U, 0x4f4fd19eU, 0xdcdc7fa3U, + 0x22226644U, 0x2a2a7e54U, 0x9090ab3bU, 0x8888830bU, + 0x4646ca8cU, 0xeeee29c7U, 0xb8b8d36bU, 0x14143c28U, + 0xdede79a7U, 0x5e5ee2bcU, 0x0b0b1d16U, 0xdbdb76adU, + 0xe0e03bdbU, 0x32325664U, 0x3a3a4e74U, 0x0a0a1e14U, + 0x4949db92U, 0x06060a0cU, 0x24246c48U, 0x5c5ce4b8U, + 0xc2c25d9fU, 0xd3d36ebdU, 0xacacef43U, 0x6262a6c4U, + 0x9191a839U, 0x9595a431U, 0xe4e437d3U, 0x79798bf2U, + 0xe7e732d5U, 0xc8c8438bU, 0x3737596eU, 0x6d6db7daU, + 0x8d8d8c01U, 0xd5d564b1U, 0x4e4ed29cU, 0xa9a9e049U, + 0x6c6cb4d8U, 0x5656faacU, 0xf4f407f3U, 0xeaea25cfU, + 0x6565afcaU, 0x7a7a8ef4U, 0xaeaee947U, 0x08081810U, + 0xbabad56fU, 0x787888f0U, 0x25256f4aU, 0x2e2e725cU, + 0x1c1c2438U, 0xa6a6f157U, 0xb4b4c773U, 0xc6c65197U, + 0xe8e823cbU, 0xdddd7ca1U, 0x74749ce8U, 0x1f1f213eU, + 0x4b4bdd96U, 0xbdbddc61U, 0x8b8b860dU, 0x8a8a850fU, + 0x707090e0U, 0x3e3e427cU, 0xb5b5c471U, 0x6666aaccU, + 0x4848d890U, 0x03030506U, 0xf6f601f7U, 0x0e0e121cU, + 0x6161a3c2U, 0x35355f6aU, 0x5757f9aeU, 0xb9b9d069U, + 0x86869117U, 0xc1c15899U, 0x1d1d273aU, 0x9e9eb927U, + 0xe1e138d9U, 0xf8f813ebU, 0x9898b32bU, 0x11113322U, + 0x6969bbd2U, 0xd9d970a9U, 0x8e8e8907U, 0x9494a733U, + 0x9b9bb62dU, 0x1e1e223cU, 0x87879215U, 0xe9e920c9U, + 0xcece4987U, 0x5555ffaaU, 0x28287850U, 0xdfdf7aa5U, + 0x8c8c8f03U, 0xa1a1f859U, 0x89898009U, 0x0d0d171aU, + 0xbfbfda65U, 0xe6e631d7U, 0x4242c684U, 0x6868b8d0U, + 0x4141c382U, 0x9999b029U, 0x2d2d775aU, 0x0f0f111eU, + 0xb0b0cb7bU, 0x5454fca8U, 0xbbbbd66dU, 0x16163a2cU, +}; +static const u32 Te4[256] = { + 0x63636363U, 0x7c7c7c7cU, 0x77777777U, 0x7b7b7b7bU, + 0xf2f2f2f2U, 0x6b6b6b6bU, 0x6f6f6f6fU, 0xc5c5c5c5U, + 0x30303030U, 0x01010101U, 0x67676767U, 0x2b2b2b2bU, + 0xfefefefeU, 0xd7d7d7d7U, 0xababababU, 0x76767676U, + 0xcacacacaU, 0x82828282U, 0xc9c9c9c9U, 0x7d7d7d7dU, + 0xfafafafaU, 0x59595959U, 0x47474747U, 0xf0f0f0f0U, + 0xadadadadU, 0xd4d4d4d4U, 0xa2a2a2a2U, 0xafafafafU, + 0x9c9c9c9cU, 0xa4a4a4a4U, 0x72727272U, 0xc0c0c0c0U, + 0xb7b7b7b7U, 0xfdfdfdfdU, 0x93939393U, 0x26262626U, + 0x36363636U, 0x3f3f3f3fU, 0xf7f7f7f7U, 0xccccccccU, + 0x34343434U, 0xa5a5a5a5U, 0xe5e5e5e5U, 0xf1f1f1f1U, + 0x71717171U, 0xd8d8d8d8U, 0x31313131U, 0x15151515U, + 0x04040404U, 0xc7c7c7c7U, 0x23232323U, 0xc3c3c3c3U, + 0x18181818U, 0x96969696U, 0x05050505U, 0x9a9a9a9aU, + 0x07070707U, 0x12121212U, 0x80808080U, 0xe2e2e2e2U, + 0xebebebebU, 0x27272727U, 0xb2b2b2b2U, 0x75757575U, + 0x09090909U, 0x83838383U, 0x2c2c2c2cU, 0x1a1a1a1aU, + 0x1b1b1b1bU, 0x6e6e6e6eU, 0x5a5a5a5aU, 0xa0a0a0a0U, + 0x52525252U, 0x3b3b3b3bU, 0xd6d6d6d6U, 0xb3b3b3b3U, + 0x29292929U, 0xe3e3e3e3U, 0x2f2f2f2fU, 0x84848484U, + 0x53535353U, 0xd1d1d1d1U, 0x00000000U, 0xededededU, + 0x20202020U, 0xfcfcfcfcU, 0xb1b1b1b1U, 0x5b5b5b5bU, + 0x6a6a6a6aU, 0xcbcbcbcbU, 0xbebebebeU, 0x39393939U, + 0x4a4a4a4aU, 0x4c4c4c4cU, 0x58585858U, 0xcfcfcfcfU, + 0xd0d0d0d0U, 0xefefefefU, 0xaaaaaaaaU, 0xfbfbfbfbU, + 0x43434343U, 0x4d4d4d4dU, 0x33333333U, 0x85858585U, + 0x45454545U, 0xf9f9f9f9U, 0x02020202U, 0x7f7f7f7fU, + 0x50505050U, 0x3c3c3c3cU, 0x9f9f9f9fU, 0xa8a8a8a8U, + 0x51515151U, 0xa3a3a3a3U, 0x40404040U, 0x8f8f8f8fU, + 0x92929292U, 0x9d9d9d9dU, 0x38383838U, 0xf5f5f5f5U, + 0xbcbcbcbcU, 0xb6b6b6b6U, 0xdadadadaU, 0x21212121U, + 0x10101010U, 0xffffffffU, 0xf3f3f3f3U, 0xd2d2d2d2U, + 0xcdcdcdcdU, 0x0c0c0c0cU, 0x13131313U, 0xececececU, + 0x5f5f5f5fU, 0x97979797U, 0x44444444U, 0x17171717U, + 0xc4c4c4c4U, 0xa7a7a7a7U, 0x7e7e7e7eU, 0x3d3d3d3dU, + 0x64646464U, 0x5d5d5d5dU, 0x19191919U, 0x73737373U, + 0x60606060U, 0x81818181U, 0x4f4f4f4fU, 0xdcdcdcdcU, + 0x22222222U, 0x2a2a2a2aU, 0x90909090U, 0x88888888U, + 0x46464646U, 0xeeeeeeeeU, 0xb8b8b8b8U, 0x14141414U, + 0xdedededeU, 0x5e5e5e5eU, 0x0b0b0b0bU, 0xdbdbdbdbU, + 0xe0e0e0e0U, 0x32323232U, 0x3a3a3a3aU, 0x0a0a0a0aU, + 0x49494949U, 0x06060606U, 0x24242424U, 0x5c5c5c5cU, + 0xc2c2c2c2U, 0xd3d3d3d3U, 0xacacacacU, 0x62626262U, + 0x91919191U, 0x95959595U, 0xe4e4e4e4U, 0x79797979U, + 0xe7e7e7e7U, 0xc8c8c8c8U, 0x37373737U, 0x6d6d6d6dU, + 0x8d8d8d8dU, 0xd5d5d5d5U, 0x4e4e4e4eU, 0xa9a9a9a9U, + 0x6c6c6c6cU, 0x56565656U, 0xf4f4f4f4U, 0xeaeaeaeaU, + 0x65656565U, 0x7a7a7a7aU, 0xaeaeaeaeU, 0x08080808U, + 0xbabababaU, 0x78787878U, 0x25252525U, 0x2e2e2e2eU, + 0x1c1c1c1cU, 0xa6a6a6a6U, 0xb4b4b4b4U, 0xc6c6c6c6U, + 0xe8e8e8e8U, 0xddddddddU, 0x74747474U, 0x1f1f1f1fU, + 0x4b4b4b4bU, 0xbdbdbdbdU, 0x8b8b8b8bU, 0x8a8a8a8aU, + 0x70707070U, 0x3e3e3e3eU, 0xb5b5b5b5U, 0x66666666U, + 0x48484848U, 0x03030303U, 0xf6f6f6f6U, 0x0e0e0e0eU, + 0x61616161U, 0x35353535U, 0x57575757U, 0xb9b9b9b9U, + 0x86868686U, 0xc1c1c1c1U, 0x1d1d1d1dU, 0x9e9e9e9eU, + 0xe1e1e1e1U, 0xf8f8f8f8U, 0x98989898U, 0x11111111U, + 0x69696969U, 0xd9d9d9d9U, 0x8e8e8e8eU, 0x94949494U, + 0x9b9b9b9bU, 0x1e1e1e1eU, 0x87878787U, 0xe9e9e9e9U, + 0xcecececeU, 0x55555555U, 0x28282828U, 0xdfdfdfdfU, + 0x8c8c8c8cU, 0xa1a1a1a1U, 0x89898989U, 0x0d0d0d0dU, + 0xbfbfbfbfU, 0xe6e6e6e6U, 0x42424242U, 0x68686868U, + 0x41414141U, 0x99999999U, 0x2d2d2d2dU, 0x0f0f0f0fU, + 0xb0b0b0b0U, 0x54545454U, 0xbbbbbbbbU, 0x16161616U, +}; +#endif /* AES_SMALL_TABLES */ +static const u32 Td0[256] = { + 0x51f4a750U, 0x7e416553U, 0x1a17a4c3U, 0x3a275e96U, + 0x3bab6bcbU, 0x1f9d45f1U, 0xacfa58abU, 0x4be30393U, + 0x2030fa55U, 0xad766df6U, 0x88cc7691U, 0xf5024c25U, + 0x4fe5d7fcU, 0xc52acbd7U, 0x26354480U, 0xb562a38fU, + 0xdeb15a49U, 0x25ba1b67U, 0x45ea0e98U, 0x5dfec0e1U, + 0xc32f7502U, 0x814cf012U, 0x8d4697a3U, 0x6bd3f9c6U, + 0x038f5fe7U, 0x15929c95U, 0xbf6d7aebU, 0x955259daU, + 0xd4be832dU, 0x587421d3U, 0x49e06929U, 0x8ec9c844U, + 0x75c2896aU, 0xf48e7978U, 0x99583e6bU, 0x27b971ddU, + 0xbee14fb6U, 0xf088ad17U, 0xc920ac66U, 0x7dce3ab4U, + 0x63df4a18U, 0xe51a3182U, 0x97513360U, 0x62537f45U, + 0xb16477e0U, 0xbb6bae84U, 0xfe81a01cU, 0xf9082b94U, + 0x70486858U, 0x8f45fd19U, 0x94de6c87U, 0x527bf8b7U, + 0xab73d323U, 0x724b02e2U, 0xe31f8f57U, 0x6655ab2aU, + 0xb2eb2807U, 0x2fb5c203U, 0x86c57b9aU, 0xd33708a5U, + 0x302887f2U, 0x23bfa5b2U, 0x02036abaU, 0xed16825cU, + 0x8acf1c2bU, 0xa779b492U, 0xf307f2f0U, 0x4e69e2a1U, + 0x65daf4cdU, 0x0605bed5U, 0xd134621fU, 0xc4a6fe8aU, + 0x342e539dU, 0xa2f355a0U, 0x058ae132U, 0xa4f6eb75U, + 0x0b83ec39U, 0x4060efaaU, 0x5e719f06U, 0xbd6e1051U, + 0x3e218af9U, 0x96dd063dU, 0xdd3e05aeU, 0x4de6bd46U, + 0x91548db5U, 0x71c45d05U, 0x0406d46fU, 0x605015ffU, + 0x1998fb24U, 0xd6bde997U, 0x894043ccU, 0x67d99e77U, + 0xb0e842bdU, 0x07898b88U, 0xe7195b38U, 0x79c8eedbU, + 0xa17c0a47U, 0x7c420fe9U, 0xf8841ec9U, 0x00000000U, + 0x09808683U, 0x322bed48U, 0x1e1170acU, 0x6c5a724eU, + 0xfd0efffbU, 0x0f853856U, 0x3daed51eU, 0x362d3927U, + 0x0a0fd964U, 0x685ca621U, 0x9b5b54d1U, 0x24362e3aU, + 0x0c0a67b1U, 0x9357e70fU, 0xb4ee96d2U, 0x1b9b919eU, + 0x80c0c54fU, 0x61dc20a2U, 0x5a774b69U, 0x1c121a16U, + 0xe293ba0aU, 0xc0a02ae5U, 0x3c22e043U, 0x121b171dU, + 0x0e090d0bU, 0xf28bc7adU, 0x2db6a8b9U, 0x141ea9c8U, + 0x57f11985U, 0xaf75074cU, 0xee99ddbbU, 0xa37f60fdU, + 0xf701269fU, 0x5c72f5bcU, 0x44663bc5U, 0x5bfb7e34U, + 0x8b432976U, 0xcb23c6dcU, 0xb6edfc68U, 0xb8e4f163U, + 0xd731dccaU, 0x42638510U, 0x13972240U, 0x84c61120U, + 0x854a247dU, 0xd2bb3df8U, 0xaef93211U, 0xc729a16dU, + 0x1d9e2f4bU, 0xdcb230f3U, 0x0d8652ecU, 0x77c1e3d0U, + 0x2bb3166cU, 0xa970b999U, 0x119448faU, 0x47e96422U, + 0xa8fc8cc4U, 0xa0f03f1aU, 0x567d2cd8U, 0x223390efU, + 0x87494ec7U, 0xd938d1c1U, 0x8ccaa2feU, 0x98d40b36U, + 0xa6f581cfU, 0xa57ade28U, 0xdab78e26U, 0x3fadbfa4U, + 0x2c3a9de4U, 0x5078920dU, 0x6a5fcc9bU, 0x547e4662U, + 0xf68d13c2U, 0x90d8b8e8U, 0x2e39f75eU, 0x82c3aff5U, + 0x9f5d80beU, 0x69d0937cU, 0x6fd52da9U, 0xcf2512b3U, + 0xc8ac993bU, 0x10187da7U, 0xe89c636eU, 0xdb3bbb7bU, + 0xcd267809U, 0x6e5918f4U, 0xec9ab701U, 0x834f9aa8U, + 0xe6956e65U, 0xaaffe67eU, 0x21bccf08U, 0xef15e8e6U, + 0xbae79bd9U, 0x4a6f36ceU, 0xea9f09d4U, 0x29b07cd6U, + 0x31a4b2afU, 0x2a3f2331U, 0xc6a59430U, 0x35a266c0U, + 0x744ebc37U, 0xfc82caa6U, 0xe090d0b0U, 0x33a7d815U, + 0xf104984aU, 0x41ecdaf7U, 0x7fcd500eU, 0x1791f62fU, + 0x764dd68dU, 0x43efb04dU, 0xccaa4d54U, 0xe49604dfU, + 0x9ed1b5e3U, 0x4c6a881bU, 0xc12c1fb8U, 0x4665517fU, + 0x9d5eea04U, 0x018c355dU, 0xfa877473U, 0xfb0b412eU, + 0xb3671d5aU, 0x92dbd252U, 0xe9105633U, 0x6dd64713U, + 0x9ad7618cU, 0x37a10c7aU, 0x59f8148eU, 0xeb133c89U, + 0xcea927eeU, 0xb761c935U, 0xe11ce5edU, 0x7a47b13cU, + 0x9cd2df59U, 0x55f2733fU, 0x1814ce79U, 0x73c737bfU, + 0x53f7cdeaU, 0x5ffdaa5bU, 0xdf3d6f14U, 0x7844db86U, + 0xcaaff381U, 0xb968c43eU, 0x3824342cU, 0xc2a3405fU, + 0x161dc372U, 0xbce2250cU, 0x283c498bU, 0xff0d9541U, + 0x39a80171U, 0x080cb3deU, 0xd8b4e49cU, 0x6456c190U, + 0x7bcb8461U, 0xd532b670U, 0x486c5c74U, 0xd0b85742U, +}; +#ifndef AES_SMALL_TABLES +static const u32 Td1[256] = { + 0x5051f4a7U, 0x537e4165U, 0xc31a17a4U, 0x963a275eU, + 0xcb3bab6bU, 0xf11f9d45U, 0xabacfa58U, 0x934be303U, + 0x552030faU, 0xf6ad766dU, 0x9188cc76U, 0x25f5024cU, + 0xfc4fe5d7U, 0xd7c52acbU, 0x80263544U, 0x8fb562a3U, + 0x49deb15aU, 0x6725ba1bU, 0x9845ea0eU, 0xe15dfec0U, + 0x02c32f75U, 0x12814cf0U, 0xa38d4697U, 0xc66bd3f9U, + 0xe7038f5fU, 0x9515929cU, 0xebbf6d7aU, 0xda955259U, + 0x2dd4be83U, 0xd3587421U, 0x2949e069U, 0x448ec9c8U, + 0x6a75c289U, 0x78f48e79U, 0x6b99583eU, 0xdd27b971U, + 0xb6bee14fU, 0x17f088adU, 0x66c920acU, 0xb47dce3aU, + 0x1863df4aU, 0x82e51a31U, 0x60975133U, 0x4562537fU, + 0xe0b16477U, 0x84bb6baeU, 0x1cfe81a0U, 0x94f9082bU, + 0x58704868U, 0x198f45fdU, 0x8794de6cU, 0xb7527bf8U, + 0x23ab73d3U, 0xe2724b02U, 0x57e31f8fU, 0x2a6655abU, + 0x07b2eb28U, 0x032fb5c2U, 0x9a86c57bU, 0xa5d33708U, + 0xf2302887U, 0xb223bfa5U, 0xba02036aU, 0x5ced1682U, + 0x2b8acf1cU, 0x92a779b4U, 0xf0f307f2U, 0xa14e69e2U, + 0xcd65daf4U, 0xd50605beU, 0x1fd13462U, 0x8ac4a6feU, + 0x9d342e53U, 0xa0a2f355U, 0x32058ae1U, 0x75a4f6ebU, + 0x390b83ecU, 0xaa4060efU, 0x065e719fU, 0x51bd6e10U, + 0xf93e218aU, 0x3d96dd06U, 0xaedd3e05U, 0x464de6bdU, + 0xb591548dU, 0x0571c45dU, 0x6f0406d4U, 0xff605015U, + 0x241998fbU, 0x97d6bde9U, 0xcc894043U, 0x7767d99eU, + 0xbdb0e842U, 0x8807898bU, 0x38e7195bU, 0xdb79c8eeU, + 0x47a17c0aU, 0xe97c420fU, 0xc9f8841eU, 0x00000000U, + 0x83098086U, 0x48322bedU, 0xac1e1170U, 0x4e6c5a72U, + 0xfbfd0effU, 0x560f8538U, 0x1e3daed5U, 0x27362d39U, + 0x640a0fd9U, 0x21685ca6U, 0xd19b5b54U, 0x3a24362eU, + 0xb10c0a67U, 0x0f9357e7U, 0xd2b4ee96U, 0x9e1b9b91U, + 0x4f80c0c5U, 0xa261dc20U, 0x695a774bU, 0x161c121aU, + 0x0ae293baU, 0xe5c0a02aU, 0x433c22e0U, 0x1d121b17U, + 0x0b0e090dU, 0xadf28bc7U, 0xb92db6a8U, 0xc8141ea9U, + 0x8557f119U, 0x4caf7507U, 0xbbee99ddU, 0xfda37f60U, + 0x9ff70126U, 0xbc5c72f5U, 0xc544663bU, 0x345bfb7eU, + 0x768b4329U, 0xdccb23c6U, 0x68b6edfcU, 0x63b8e4f1U, + 0xcad731dcU, 0x10426385U, 0x40139722U, 0x2084c611U, + 0x7d854a24U, 0xf8d2bb3dU, 0x11aef932U, 0x6dc729a1U, + 0x4b1d9e2fU, 0xf3dcb230U, 0xec0d8652U, 0xd077c1e3U, + 0x6c2bb316U, 0x99a970b9U, 0xfa119448U, 0x2247e964U, + 0xc4a8fc8cU, 0x1aa0f03fU, 0xd8567d2cU, 0xef223390U, + 0xc787494eU, 0xc1d938d1U, 0xfe8ccaa2U, 0x3698d40bU, + 0xcfa6f581U, 0x28a57adeU, 0x26dab78eU, 0xa43fadbfU, + 0xe42c3a9dU, 0x0d507892U, 0x9b6a5fccU, 0x62547e46U, + 0xc2f68d13U, 0xe890d8b8U, 0x5e2e39f7U, 0xf582c3afU, + 0xbe9f5d80U, 0x7c69d093U, 0xa96fd52dU, 0xb3cf2512U, + 0x3bc8ac99U, 0xa710187dU, 0x6ee89c63U, 0x7bdb3bbbU, + 0x09cd2678U, 0xf46e5918U, 0x01ec9ab7U, 0xa8834f9aU, + 0x65e6956eU, 0x7eaaffe6U, 0x0821bccfU, 0xe6ef15e8U, + 0xd9bae79bU, 0xce4a6f36U, 0xd4ea9f09U, 0xd629b07cU, + 0xaf31a4b2U, 0x312a3f23U, 0x30c6a594U, 0xc035a266U, + 0x37744ebcU, 0xa6fc82caU, 0xb0e090d0U, 0x1533a7d8U, + 0x4af10498U, 0xf741ecdaU, 0x0e7fcd50U, 0x2f1791f6U, + 0x8d764dd6U, 0x4d43efb0U, 0x54ccaa4dU, 0xdfe49604U, + 0xe39ed1b5U, 0x1b4c6a88U, 0xb8c12c1fU, 0x7f466551U, + 0x049d5eeaU, 0x5d018c35U, 0x73fa8774U, 0x2efb0b41U, + 0x5ab3671dU, 0x5292dbd2U, 0x33e91056U, 0x136dd647U, + 0x8c9ad761U, 0x7a37a10cU, 0x8e59f814U, 0x89eb133cU, + 0xeecea927U, 0x35b761c9U, 0xede11ce5U, 0x3c7a47b1U, + 0x599cd2dfU, 0x3f55f273U, 0x791814ceU, 0xbf73c737U, + 0xea53f7cdU, 0x5b5ffdaaU, 0x14df3d6fU, 0x867844dbU, + 0x81caaff3U, 0x3eb968c4U, 0x2c382434U, 0x5fc2a340U, + 0x72161dc3U, 0x0cbce225U, 0x8b283c49U, 0x41ff0d95U, + 0x7139a801U, 0xde080cb3U, 0x9cd8b4e4U, 0x906456c1U, + 0x617bcb84U, 0x70d532b6U, 0x74486c5cU, 0x42d0b857U, +}; +static const u32 Td2[256] = { + 0xa75051f4U, 0x65537e41U, 0xa4c31a17U, 0x5e963a27U, + 0x6bcb3babU, 0x45f11f9dU, 0x58abacfaU, 0x03934be3U, + 0xfa552030U, 0x6df6ad76U, 0x769188ccU, 0x4c25f502U, + 0xd7fc4fe5U, 0xcbd7c52aU, 0x44802635U, 0xa38fb562U, + 0x5a49deb1U, 0x1b6725baU, 0x0e9845eaU, 0xc0e15dfeU, + 0x7502c32fU, 0xf012814cU, 0x97a38d46U, 0xf9c66bd3U, + 0x5fe7038fU, 0x9c951592U, 0x7aebbf6dU, 0x59da9552U, + 0x832dd4beU, 0x21d35874U, 0x692949e0U, 0xc8448ec9U, + 0x896a75c2U, 0x7978f48eU, 0x3e6b9958U, 0x71dd27b9U, + 0x4fb6bee1U, 0xad17f088U, 0xac66c920U, 0x3ab47dceU, + 0x4a1863dfU, 0x3182e51aU, 0x33609751U, 0x7f456253U, + 0x77e0b164U, 0xae84bb6bU, 0xa01cfe81U, 0x2b94f908U, + 0x68587048U, 0xfd198f45U, 0x6c8794deU, 0xf8b7527bU, + 0xd323ab73U, 0x02e2724bU, 0x8f57e31fU, 0xab2a6655U, + 0x2807b2ebU, 0xc2032fb5U, 0x7b9a86c5U, 0x08a5d337U, + 0x87f23028U, 0xa5b223bfU, 0x6aba0203U, 0x825ced16U, + 0x1c2b8acfU, 0xb492a779U, 0xf2f0f307U, 0xe2a14e69U, + 0xf4cd65daU, 0xbed50605U, 0x621fd134U, 0xfe8ac4a6U, + 0x539d342eU, 0x55a0a2f3U, 0xe132058aU, 0xeb75a4f6U, + 0xec390b83U, 0xefaa4060U, 0x9f065e71U, 0x1051bd6eU, + + 0x8af93e21U, 0x063d96ddU, 0x05aedd3eU, 0xbd464de6U, + 0x8db59154U, 0x5d0571c4U, 0xd46f0406U, 0x15ff6050U, + 0xfb241998U, 0xe997d6bdU, 0x43cc8940U, 0x9e7767d9U, + 0x42bdb0e8U, 0x8b880789U, 0x5b38e719U, 0xeedb79c8U, + 0x0a47a17cU, 0x0fe97c42U, 0x1ec9f884U, 0x00000000U, + 0x86830980U, 0xed48322bU, 0x70ac1e11U, 0x724e6c5aU, + 0xfffbfd0eU, 0x38560f85U, 0xd51e3daeU, 0x3927362dU, + 0xd9640a0fU, 0xa621685cU, 0x54d19b5bU, 0x2e3a2436U, + 0x67b10c0aU, 0xe70f9357U, 0x96d2b4eeU, 0x919e1b9bU, + 0xc54f80c0U, 0x20a261dcU, 0x4b695a77U, 0x1a161c12U, + 0xba0ae293U, 0x2ae5c0a0U, 0xe0433c22U, 0x171d121bU, + 0x0d0b0e09U, 0xc7adf28bU, 0xa8b92db6U, 0xa9c8141eU, + 0x198557f1U, 0x074caf75U, 0xddbbee99U, 0x60fda37fU, + 0x269ff701U, 0xf5bc5c72U, 0x3bc54466U, 0x7e345bfbU, + 0x29768b43U, 0xc6dccb23U, 0xfc68b6edU, 0xf163b8e4U, + 0xdccad731U, 0x85104263U, 0x22401397U, 0x112084c6U, + 0x247d854aU, 0x3df8d2bbU, 0x3211aef9U, 0xa16dc729U, + 0x2f4b1d9eU, 0x30f3dcb2U, 0x52ec0d86U, 0xe3d077c1U, + 0x166c2bb3U, 0xb999a970U, 0x48fa1194U, 0x642247e9U, + 0x8cc4a8fcU, 0x3f1aa0f0U, 0x2cd8567dU, 0x90ef2233U, + 0x4ec78749U, 0xd1c1d938U, 0xa2fe8ccaU, 0x0b3698d4U, + 0x81cfa6f5U, 0xde28a57aU, 0x8e26dab7U, 0xbfa43fadU, + 0x9de42c3aU, 0x920d5078U, 0xcc9b6a5fU, 0x4662547eU, + 0x13c2f68dU, 0xb8e890d8U, 0xf75e2e39U, 0xaff582c3U, + 0x80be9f5dU, 0x937c69d0U, 0x2da96fd5U, 0x12b3cf25U, + 0x993bc8acU, 0x7da71018U, 0x636ee89cU, 0xbb7bdb3bU, + 0x7809cd26U, 0x18f46e59U, 0xb701ec9aU, 0x9aa8834fU, + 0x6e65e695U, 0xe67eaaffU, 0xcf0821bcU, 0xe8e6ef15U, + 0x9bd9bae7U, 0x36ce4a6fU, 0x09d4ea9fU, 0x7cd629b0U, + 0xb2af31a4U, 0x23312a3fU, 0x9430c6a5U, 0x66c035a2U, + 0xbc37744eU, 0xcaa6fc82U, 0xd0b0e090U, 0xd81533a7U, + 0x984af104U, 0xdaf741ecU, 0x500e7fcdU, 0xf62f1791U, + 0xd68d764dU, 0xb04d43efU, 0x4d54ccaaU, 0x04dfe496U, + 0xb5e39ed1U, 0x881b4c6aU, 0x1fb8c12cU, 0x517f4665U, + 0xea049d5eU, 0x355d018cU, 0x7473fa87U, 0x412efb0bU, + 0x1d5ab367U, 0xd25292dbU, 0x5633e910U, 0x47136dd6U, + 0x618c9ad7U, 0x0c7a37a1U, 0x148e59f8U, 0x3c89eb13U, + 0x27eecea9U, 0xc935b761U, 0xe5ede11cU, 0xb13c7a47U, + 0xdf599cd2U, 0x733f55f2U, 0xce791814U, 0x37bf73c7U, + 0xcdea53f7U, 0xaa5b5ffdU, 0x6f14df3dU, 0xdb867844U, + 0xf381caafU, 0xc43eb968U, 0x342c3824U, 0x405fc2a3U, + 0xc372161dU, 0x250cbce2U, 0x498b283cU, 0x9541ff0dU, + 0x017139a8U, 0xb3de080cU, 0xe49cd8b4U, 0xc1906456U, + 0x84617bcbU, 0xb670d532U, 0x5c74486cU, 0x5742d0b8U, +}; +static const u32 Td3[256] = { + 0xf4a75051U, 0x4165537eU, 0x17a4c31aU, 0x275e963aU, + 0xab6bcb3bU, 0x9d45f11fU, 0xfa58abacU, 0xe303934bU, + 0x30fa5520U, 0x766df6adU, 0xcc769188U, 0x024c25f5U, + 0xe5d7fc4fU, 0x2acbd7c5U, 0x35448026U, 0x62a38fb5U, + 0xb15a49deU, 0xba1b6725U, 0xea0e9845U, 0xfec0e15dU, + 0x2f7502c3U, 0x4cf01281U, 0x4697a38dU, 0xd3f9c66bU, + 0x8f5fe703U, 0x929c9515U, 0x6d7aebbfU, 0x5259da95U, + 0xbe832dd4U, 0x7421d358U, 0xe0692949U, 0xc9c8448eU, + 0xc2896a75U, 0x8e7978f4U, 0x583e6b99U, 0xb971dd27U, + 0xe14fb6beU, 0x88ad17f0U, 0x20ac66c9U, 0xce3ab47dU, + 0xdf4a1863U, 0x1a3182e5U, 0x51336097U, 0x537f4562U, + 0x6477e0b1U, 0x6bae84bbU, 0x81a01cfeU, 0x082b94f9U, + 0x48685870U, 0x45fd198fU, 0xde6c8794U, 0x7bf8b752U, + 0x73d323abU, 0x4b02e272U, 0x1f8f57e3U, 0x55ab2a66U, + 0xeb2807b2U, 0xb5c2032fU, 0xc57b9a86U, 0x3708a5d3U, + 0x2887f230U, 0xbfa5b223U, 0x036aba02U, 0x16825cedU, + 0xcf1c2b8aU, 0x79b492a7U, 0x07f2f0f3U, 0x69e2a14eU, + 0xdaf4cd65U, 0x05bed506U, 0x34621fd1U, 0xa6fe8ac4U, + 0x2e539d34U, 0xf355a0a2U, 0x8ae13205U, 0xf6eb75a4U, + 0x83ec390bU, 0x60efaa40U, 0x719f065eU, 0x6e1051bdU, + 0x218af93eU, 0xdd063d96U, 0x3e05aeddU, 0xe6bd464dU, + 0x548db591U, 0xc45d0571U, 0x06d46f04U, 0x5015ff60U, + 0x98fb2419U, 0xbde997d6U, 0x4043cc89U, 0xd99e7767U, + 0xe842bdb0U, 0x898b8807U, 0x195b38e7U, 0xc8eedb79U, + 0x7c0a47a1U, 0x420fe97cU, 0x841ec9f8U, 0x00000000U, + 0x80868309U, 0x2bed4832U, 0x1170ac1eU, 0x5a724e6cU, + 0x0efffbfdU, 0x8538560fU, 0xaed51e3dU, 0x2d392736U, + 0x0fd9640aU, 0x5ca62168U, 0x5b54d19bU, 0x362e3a24U, + 0x0a67b10cU, 0x57e70f93U, 0xee96d2b4U, 0x9b919e1bU, + 0xc0c54f80U, 0xdc20a261U, 0x774b695aU, 0x121a161cU, + 0x93ba0ae2U, 0xa02ae5c0U, 0x22e0433cU, 0x1b171d12U, + 0x090d0b0eU, 0x8bc7adf2U, 0xb6a8b92dU, 0x1ea9c814U, + 0xf1198557U, 0x75074cafU, 0x99ddbbeeU, 0x7f60fda3U, + 0x01269ff7U, 0x72f5bc5cU, 0x663bc544U, 0xfb7e345bU, + 0x4329768bU, 0x23c6dccbU, 0xedfc68b6U, 0xe4f163b8U, + 0x31dccad7U, 0x63851042U, 0x97224013U, 0xc6112084U, + 0x4a247d85U, 0xbb3df8d2U, 0xf93211aeU, 0x29a16dc7U, + 0x9e2f4b1dU, 0xb230f3dcU, 0x8652ec0dU, 0xc1e3d077U, + 0xb3166c2bU, 0x70b999a9U, 0x9448fa11U, 0xe9642247U, + 0xfc8cc4a8U, 0xf03f1aa0U, 0x7d2cd856U, 0x3390ef22U, + 0x494ec787U, 0x38d1c1d9U, 0xcaa2fe8cU, 0xd40b3698U, + 0xf581cfa6U, 0x7ade28a5U, 0xb78e26daU, 0xadbfa43fU, + 0x3a9de42cU, 0x78920d50U, 0x5fcc9b6aU, 0x7e466254U, + 0x8d13c2f6U, 0xd8b8e890U, 0x39f75e2eU, 0xc3aff582U, + 0x5d80be9fU, 0xd0937c69U, 0xd52da96fU, 0x2512b3cfU, + 0xac993bc8U, 0x187da710U, 0x9c636ee8U, 0x3bbb7bdbU, + 0x267809cdU, 0x5918f46eU, 0x9ab701ecU, 0x4f9aa883U, + 0x956e65e6U, 0xffe67eaaU, 0xbccf0821U, 0x15e8e6efU, + 0xe79bd9baU, 0x6f36ce4aU, 0x9f09d4eaU, 0xb07cd629U, + 0xa4b2af31U, 0x3f23312aU, 0xa59430c6U, 0xa266c035U, + 0x4ebc3774U, 0x82caa6fcU, 0x90d0b0e0U, 0xa7d81533U, + 0x04984af1U, 0xecdaf741U, 0xcd500e7fU, 0x91f62f17U, + 0x4dd68d76U, 0xefb04d43U, 0xaa4d54ccU, 0x9604dfe4U, + 0xd1b5e39eU, 0x6a881b4cU, 0x2c1fb8c1U, 0x65517f46U, + 0x5eea049dU, 0x8c355d01U, 0x877473faU, 0x0b412efbU, + 0x671d5ab3U, 0xdbd25292U, 0x105633e9U, 0xd647136dU, + 0xd7618c9aU, 0xa10c7a37U, 0xf8148e59U, 0x133c89ebU, + 0xa927eeceU, 0x61c935b7U, 0x1ce5ede1U, 0x47b13c7aU, + 0xd2df599cU, 0xf2733f55U, 0x14ce7918U, 0xc737bf73U, + 0xf7cdea53U, 0xfdaa5b5fU, 0x3d6f14dfU, 0x44db8678U, + 0xaff381caU, 0x68c43eb9U, 0x24342c38U, 0xa3405fc2U, + 0x1dc37216U, 0xe2250cbcU, 0x3c498b28U, 0x0d9541ffU, + 0xa8017139U, 0x0cb3de08U, 0xb4e49cd8U, 0x56c19064U, + 0xcb84617bU, 0x32b670d5U, 0x6c5c7448U, 0xb85742d0U, +}; +static const u32 Td4[256] = { + 0x52525252U, 0x09090909U, 0x6a6a6a6aU, 0xd5d5d5d5U, + 0x30303030U, 0x36363636U, 0xa5a5a5a5U, 0x38383838U, + 0xbfbfbfbfU, 0x40404040U, 0xa3a3a3a3U, 0x9e9e9e9eU, + 0x81818181U, 0xf3f3f3f3U, 0xd7d7d7d7U, 0xfbfbfbfbU, + 0x7c7c7c7cU, 0xe3e3e3e3U, 0x39393939U, 0x82828282U, + 0x9b9b9b9bU, 0x2f2f2f2fU, 0xffffffffU, 0x87878787U, + 0x34343434U, 0x8e8e8e8eU, 0x43434343U, 0x44444444U, + 0xc4c4c4c4U, 0xdedededeU, 0xe9e9e9e9U, 0xcbcbcbcbU, + 0x54545454U, 0x7b7b7b7bU, 0x94949494U, 0x32323232U, + 0xa6a6a6a6U, 0xc2c2c2c2U, 0x23232323U, 0x3d3d3d3dU, + 0xeeeeeeeeU, 0x4c4c4c4cU, 0x95959595U, 0x0b0b0b0bU, + 0x42424242U, 0xfafafafaU, 0xc3c3c3c3U, 0x4e4e4e4eU, + 0x08080808U, 0x2e2e2e2eU, 0xa1a1a1a1U, 0x66666666U, + 0x28282828U, 0xd9d9d9d9U, 0x24242424U, 0xb2b2b2b2U, + 0x76767676U, 0x5b5b5b5bU, 0xa2a2a2a2U, 0x49494949U, + 0x6d6d6d6dU, 0x8b8b8b8bU, 0xd1d1d1d1U, 0x25252525U, + 0x72727272U, 0xf8f8f8f8U, 0xf6f6f6f6U, 0x64646464U, + 0x86868686U, 0x68686868U, 0x98989898U, 0x16161616U, + 0xd4d4d4d4U, 0xa4a4a4a4U, 0x5c5c5c5cU, 0xccccccccU, + 0x5d5d5d5dU, 0x65656565U, 0xb6b6b6b6U, 0x92929292U, + 0x6c6c6c6cU, 0x70707070U, 0x48484848U, 0x50505050U, + 0xfdfdfdfdU, 0xededededU, 0xb9b9b9b9U, 0xdadadadaU, + 0x5e5e5e5eU, 0x15151515U, 0x46464646U, 0x57575757U, + 0xa7a7a7a7U, 0x8d8d8d8dU, 0x9d9d9d9dU, 0x84848484U, + 0x90909090U, 0xd8d8d8d8U, 0xababababU, 0x00000000U, + 0x8c8c8c8cU, 0xbcbcbcbcU, 0xd3d3d3d3U, 0x0a0a0a0aU, + 0xf7f7f7f7U, 0xe4e4e4e4U, 0x58585858U, 0x05050505U, + 0xb8b8b8b8U, 0xb3b3b3b3U, 0x45454545U, 0x06060606U, + 0xd0d0d0d0U, 0x2c2c2c2cU, 0x1e1e1e1eU, 0x8f8f8f8fU, + 0xcacacacaU, 0x3f3f3f3fU, 0x0f0f0f0fU, 0x02020202U, + 0xc1c1c1c1U, 0xafafafafU, 0xbdbdbdbdU, 0x03030303U, + 0x01010101U, 0x13131313U, 0x8a8a8a8aU, 0x6b6b6b6bU, + 0x3a3a3a3aU, 0x91919191U, 0x11111111U, 0x41414141U, + 0x4f4f4f4fU, 0x67676767U, 0xdcdcdcdcU, 0xeaeaeaeaU, + 0x97979797U, 0xf2f2f2f2U, 0xcfcfcfcfU, 0xcecececeU, + 0xf0f0f0f0U, 0xb4b4b4b4U, 0xe6e6e6e6U, 0x73737373U, + 0x96969696U, 0xacacacacU, 0x74747474U, 0x22222222U, + 0xe7e7e7e7U, 0xadadadadU, 0x35353535U, 0x85858585U, + 0xe2e2e2e2U, 0xf9f9f9f9U, 0x37373737U, 0xe8e8e8e8U, + 0x1c1c1c1cU, 0x75757575U, 0xdfdfdfdfU, 0x6e6e6e6eU, + 0x47474747U, 0xf1f1f1f1U, 0x1a1a1a1aU, 0x71717171U, + 0x1d1d1d1dU, 0x29292929U, 0xc5c5c5c5U, 0x89898989U, + 0x6f6f6f6fU, 0xb7b7b7b7U, 0x62626262U, 0x0e0e0e0eU, + 0xaaaaaaaaU, 0x18181818U, 0xbebebebeU, 0x1b1b1b1bU, + 0xfcfcfcfcU, 0x56565656U, 0x3e3e3e3eU, 0x4b4b4b4bU, + 0xc6c6c6c6U, 0xd2d2d2d2U, 0x79797979U, 0x20202020U, + 0x9a9a9a9aU, 0xdbdbdbdbU, 0xc0c0c0c0U, 0xfefefefeU, + 0x78787878U, 0xcdcdcdcdU, 0x5a5a5a5aU, 0xf4f4f4f4U, + 0x1f1f1f1fU, 0xddddddddU, 0xa8a8a8a8U, 0x33333333U, + 0x88888888U, 0x07070707U, 0xc7c7c7c7U, 0x31313131U, + 0xb1b1b1b1U, 0x12121212U, 0x10101010U, 0x59595959U, + 0x27272727U, 0x80808080U, 0xececececU, 0x5f5f5f5fU, + 0x60606060U, 0x51515151U, 0x7f7f7f7fU, 0xa9a9a9a9U, + 0x19191919U, 0xb5b5b5b5U, 0x4a4a4a4aU, 0x0d0d0d0dU, + 0x2d2d2d2dU, 0xe5e5e5e5U, 0x7a7a7a7aU, 0x9f9f9f9fU, + 0x93939393U, 0xc9c9c9c9U, 0x9c9c9c9cU, 0xefefefefU, + 0xa0a0a0a0U, 0xe0e0e0e0U, 0x3b3b3b3bU, 0x4d4d4d4dU, + 0xaeaeaeaeU, 0x2a2a2a2aU, 0xf5f5f5f5U, 0xb0b0b0b0U, + 0xc8c8c8c8U, 0xebebebebU, 0xbbbbbbbbU, 0x3c3c3c3cU, + 0x83838383U, 0x53535353U, 0x99999999U, 0x61616161U, + 0x17171717U, 0x2b2b2b2bU, 0x04040404U, 0x7e7e7e7eU, + 0xbabababaU, 0x77777777U, 0xd6d6d6d6U, 0x26262626U, + 0xe1e1e1e1U, 0x69696969U, 0x14141414U, 0x63636363U, + 0x55555555U, 0x21212121U, 0x0c0c0c0cU, 0x7d7d7d7dU, +}; +static const u32 rcon[] = { + 0x01000000, 0x02000000, 0x04000000, 0x08000000, + 0x10000000, 0x20000000, 0x40000000, 0x80000000, + 0x1B000000, 0x36000000, /* for 128-bit blocks, Rijndael never uses more than 10 rcon values */ +}; +#else /* AES_SMALL_TABLES */ +static const u8 Td4s[256] = { + 0x52U, 0x09U, 0x6aU, 0xd5U, 0x30U, 0x36U, 0xa5U, 0x38U, + 0xbfU, 0x40U, 0xa3U, 0x9eU, 0x81U, 0xf3U, 0xd7U, 0xfbU, + 0x7cU, 0xe3U, 0x39U, 0x82U, 0x9bU, 0x2fU, 0xffU, 0x87U, + 0x34U, 0x8eU, 0x43U, 0x44U, 0xc4U, 0xdeU, 0xe9U, 0xcbU, + 0x54U, 0x7bU, 0x94U, 0x32U, 0xa6U, 0xc2U, 0x23U, 0x3dU, + 0xeeU, 0x4cU, 0x95U, 0x0bU, 0x42U, 0xfaU, 0xc3U, 0x4eU, + 0x08U, 0x2eU, 0xa1U, 0x66U, 0x28U, 0xd9U, 0x24U, 0xb2U, + 0x76U, 0x5bU, 0xa2U, 0x49U, 0x6dU, 0x8bU, 0xd1U, 0x25U, + 0x72U, 0xf8U, 0xf6U, 0x64U, 0x86U, 0x68U, 0x98U, 0x16U, + 0xd4U, 0xa4U, 0x5cU, 0xccU, 0x5dU, 0x65U, 0xb6U, 0x92U, + 0x6cU, 0x70U, 0x48U, 0x50U, 0xfdU, 0xedU, 0xb9U, 0xdaU, + 0x5eU, 0x15U, 0x46U, 0x57U, 0xa7U, 0x8dU, 0x9dU, 0x84U, + 0x90U, 0xd8U, 0xabU, 0x00U, 0x8cU, 0xbcU, 0xd3U, 0x0aU, + 0xf7U, 0xe4U, 0x58U, 0x05U, 0xb8U, 0xb3U, 0x45U, 0x06U, + 0xd0U, 0x2cU, 0x1eU, 0x8fU, 0xcaU, 0x3fU, 0x0fU, 0x02U, + 0xc1U, 0xafU, 0xbdU, 0x03U, 0x01U, 0x13U, 0x8aU, 0x6bU, + 0x3aU, 0x91U, 0x11U, 0x41U, 0x4fU, 0x67U, 0xdcU, 0xeaU, + 0x97U, 0xf2U, 0xcfU, 0xceU, 0xf0U, 0xb4U, 0xe6U, 0x73U, + 0x96U, 0xacU, 0x74U, 0x22U, 0xe7U, 0xadU, 0x35U, 0x85U, + 0xe2U, 0xf9U, 0x37U, 0xe8U, 0x1cU, 0x75U, 0xdfU, 0x6eU, + 0x47U, 0xf1U, 0x1aU, 0x71U, 0x1dU, 0x29U, 0xc5U, 0x89U, + 0x6fU, 0xb7U, 0x62U, 0x0eU, 0xaaU, 0x18U, 0xbeU, 0x1bU, + 0xfcU, 0x56U, 0x3eU, 0x4bU, 0xc6U, 0xd2U, 0x79U, 0x20U, + 0x9aU, 0xdbU, 0xc0U, 0xfeU, 0x78U, 0xcdU, 0x5aU, 0xf4U, + 0x1fU, 0xddU, 0xa8U, 0x33U, 0x88U, 0x07U, 0xc7U, 0x31U, + 0xb1U, 0x12U, 0x10U, 0x59U, 0x27U, 0x80U, 0xecU, 0x5fU, + 0x60U, 0x51U, 0x7fU, 0xa9U, 0x19U, 0xb5U, 0x4aU, 0x0dU, + 0x2dU, 0xe5U, 0x7aU, 0x9fU, 0x93U, 0xc9U, 0x9cU, 0xefU, + 0xa0U, 0xe0U, 0x3bU, 0x4dU, 0xaeU, 0x2aU, 0xf5U, 0xb0U, + 0xc8U, 0xebU, 0xbbU, 0x3cU, 0x83U, 0x53U, 0x99U, 0x61U, + 0x17U, 0x2bU, 0x04U, 0x7eU, 0xbaU, 0x77U, 0xd6U, 0x26U, + 0xe1U, 0x69U, 0x14U, 0x63U, 0x55U, 0x21U, 0x0cU, 0x7dU, +}; +static const u8 rcons[] = { + 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x1B, 0x36 + /* for 128-bit blocks, Rijndael never uses more than 10 rcon values */ +}; +#endif /* AES_SMALL_TABLES */ + + +#ifndef AES_SMALL_TABLES + +#define RCON(i) rcon[(i)] + +#define TE0(i) Te0[((i) >> 24) & 0xff] +#define TE1(i) Te1[((i) >> 16) & 0xff] +#define TE2(i) Te2[((i) >> 8) & 0xff] +#define TE3(i) Te3[(i) & 0xff] +#define TE41(i) (Te4[((i) >> 24) & 0xff] & 0xff000000) +#define TE42(i) (Te4[((i) >> 16) & 0xff] & 0x00ff0000) +#define TE43(i) (Te4[((i) >> 8) & 0xff] & 0x0000ff00) +#define TE44(i) (Te4[(i) & 0xff] & 0x000000ff) +#define TE421(i) (Te4[((i) >> 16) & 0xff] & 0xff000000) +#define TE432(i) (Te4[((i) >> 8) & 0xff] & 0x00ff0000) +#define TE443(i) (Te4[(i) & 0xff] & 0x0000ff00) +#define TE414(i) (Te4[((i) >> 24) & 0xff] & 0x000000ff) +#define TE4(i) (Te4[(i)] & 0x000000ff) + +#define TD0(i) Td0[((i) >> 24) & 0xff] +#define TD1(i) Td1[((i) >> 16) & 0xff] +#define TD2(i) Td2[((i) >> 8) & 0xff] +#define TD3(i) Td3[(i) & 0xff] +#define TD41(i) (Td4[((i) >> 24) & 0xff] & 0xff000000) +#define TD42(i) (Td4[((i) >> 16) & 0xff] & 0x00ff0000) +#define TD43(i) (Td4[((i) >> 8) & 0xff] & 0x0000ff00) +#define TD44(i) (Td4[(i) & 0xff] & 0x000000ff) +#define TD0_(i) Td0[(i) & 0xff] +#define TD1_(i) Td1[(i) & 0xff] +#define TD2_(i) Td2[(i) & 0xff] +#define TD3_(i) Td3[(i) & 0xff] + +#else /* AES_SMALL_TABLES */ + +#define RCON(i) (rcons[(i)] << 24) + +static inline u32 rotr(u32 val, int bits) +{ + return (val >> bits) | (val << (32 - bits)); +} + +#define TE0(i) Te0[((i) >> 24) & 0xff] +#define TE1(i) rotr(Te0[((i) >> 16) & 0xff], 8) +#define TE2(i) rotr(Te0[((i) >> 8) & 0xff], 16) +#define TE3(i) rotr(Te0[(i) & 0xff], 24) +#define TE41(i) ((Te0[((i) >> 24) & 0xff] << 8) & 0xff000000) +#define TE42(i) (Te0[((i) >> 16) & 0xff] & 0x00ff0000) +#define TE43(i) (Te0[((i) >> 8) & 0xff] & 0x0000ff00) +#define TE44(i) ((Te0[(i) & 0xff] >> 8) & 0x000000ff) +#define TE421(i) ((Te0[((i) >> 16) & 0xff] << 8) & 0xff000000) +#define TE432(i) (Te0[((i) >> 8) & 0xff] & 0x00ff0000) +#define TE443(i) (Te0[(i) & 0xff] & 0x0000ff00) +#define TE414(i) ((Te0[((i) >> 24) & 0xff] >> 8) & 0x000000ff) +#define TE4(i) ((Te0[(i)] >> 8) & 0x000000ff) + +#define TD0(i) Td0[((i) >> 24) & 0xff] +#define TD1(i) rotr(Td0[((i) >> 16) & 0xff], 8) +#define TD2(i) rotr(Td0[((i) >> 8) & 0xff], 16) +#define TD3(i) rotr(Td0[(i) & 0xff], 24) +#define TD41(i) (Td4s[((i) >> 24) & 0xff] << 24) +#define TD42(i) (Td4s[((i) >> 16) & 0xff] << 16) +#define TD43(i) (Td4s[((i) >> 8) & 0xff] << 8) +#define TD44(i) (Td4s[(i) & 0xff]) +#define TD0_(i) Td0[(i) & 0xff] +#define TD1_(i) rotr(Td0[(i) & 0xff], 8) +#define TD2_(i) rotr(Td0[(i) & 0xff], 16) +#define TD3_(i) rotr(Td0[(i) & 0xff], 24) + +#endif /* AES_SMALL_TABLES */ + +#define SWAP(x) (_lrotl(x, 8) & 0x00ff00ff | _lrotr(x, 8) & 0xff00ff00) + +#ifdef _MSC_VER +#define GETU32(p) SWAP(*((u32 *)(p))) +#define PUTU32(ct, st) { *((u32 *)(ct)) = SWAP((st)); } +#else +#define GETU32(pt) (((u32)(pt)[0] << 24) ^ ((u32)(pt)[1] << 16) ^ \ +((u32)(pt)[2] << 8) ^ ((u32)(pt)[3])) +#define PUTU32(ct, st) { \ +(ct)[0] = (u8)((st) >> 24); (ct)[1] = (u8)((st) >> 16); \ +(ct)[2] = (u8)((st) >> 8); (ct)[3] = (u8)(st); } +#endif + +/** + * Expand the cipher key into the encryption key schedule. + * + * @return the number of rounds for the given cipher key size. + */ +static void rijndaelKeySetupEnc(u32 rk[/*44*/], const u8 cipherKey[]) +{ + int i; + u32 temp; + + rk[0] = GETU32(cipherKey ); + rk[1] = GETU32(cipherKey + 4); + rk[2] = GETU32(cipherKey + 8); + rk[3] = GETU32(cipherKey + 12); + for (i = 0; i < 10; i++) { + temp = rk[3]; + rk[4] = rk[0] ^ + TE421(temp) ^ TE432(temp) ^ TE443(temp) ^ TE414(temp) ^ + RCON(i); + rk[5] = rk[1] ^ rk[4]; + rk[6] = rk[2] ^ rk[5]; + rk[7] = rk[3] ^ rk[6]; + rk += 4; + } +} + +#ifndef CONFIG_NO_AES_DECRYPT +/** + * Expand the cipher key into the decryption key schedule. + * + * @return the number of rounds for the given cipher key size. + */ +static void rijndaelKeySetupDec(u32 rk[/*44*/], const u8 cipherKey[]) +{ + int Nr = 10, i, j; + u32 temp; + + /* expand the cipher key: */ + rijndaelKeySetupEnc(rk, cipherKey); + /* invert the order of the round keys: */ + for (i = 0, j = 4*Nr; i < j; i += 4, j -= 4) { + temp = rk[i ]; rk[i ] = rk[j ]; rk[j ] = temp; + temp = rk[i + 1]; rk[i + 1] = rk[j + 1]; rk[j + 1] = temp; + temp = rk[i + 2]; rk[i + 2] = rk[j + 2]; rk[j + 2] = temp; + temp = rk[i + 3]; rk[i + 3] = rk[j + 3]; rk[j + 3] = temp; + } + /* apply the inverse MixColumn transform to all round keys but the + * first and the last: */ + for (i = 1; i < Nr; i++) { + rk += 4; + for (j = 0; j < 4; j++) { + rk[j] = TD0_(TE4((rk[j] >> 24) )) ^ + TD1_(TE4((rk[j] >> 16) & 0xff)) ^ + TD2_(TE4((rk[j] >> 8) & 0xff)) ^ + TD3_(TE4((rk[j] ) & 0xff)); + } + } +} +#endif /* CONFIG_NO_AES_DECRYPT */ + +#ifndef CONFIG_NO_AES_ENCRYPT +static void rijndaelEncrypt(const u32 rk[/*44*/], const u8 pt[16], u8 ct[16]) +{ + u32 s0, s1, s2, s3, t0, t1, t2, t3; + const int Nr = 10; +#ifndef FULL_UNROLL + int r; +#endif /* ?FULL_UNROLL */ + + /* + * map byte array block to cipher state + * and add initial round key: + */ + s0 = GETU32(pt ) ^ rk[0]; + s1 = GETU32(pt + 4) ^ rk[1]; + s2 = GETU32(pt + 8) ^ rk[2]; + s3 = GETU32(pt + 12) ^ rk[3]; + +#define ROUND(i,d,s) \ +d##0 = TE0(s##0) ^ TE1(s##1) ^ TE2(s##2) ^ TE3(s##3) ^ rk[4 * i]; \ +d##1 = TE0(s##1) ^ TE1(s##2) ^ TE2(s##3) ^ TE3(s##0) ^ rk[4 * i + 1]; \ +d##2 = TE0(s##2) ^ TE1(s##3) ^ TE2(s##0) ^ TE3(s##1) ^ rk[4 * i + 2]; \ +d##3 = TE0(s##3) ^ TE1(s##0) ^ TE2(s##1) ^ TE3(s##2) ^ rk[4 * i + 3] + +#ifdef FULL_UNROLL + + ROUND(1,t,s); + ROUND(2,s,t); + ROUND(3,t,s); + ROUND(4,s,t); + ROUND(5,t,s); + ROUND(6,s,t); + ROUND(7,t,s); + ROUND(8,s,t); + ROUND(9,t,s); + + rk += Nr << 2; + +#else /* !FULL_UNROLL */ + + /* Nr - 1 full rounds: */ + r = Nr >> 1; + for (;;) { + ROUND(1,t,s); + rk += 8; + if (--r == 0) + break; + ROUND(0,s,t); + } + +#endif /* ?FULL_UNROLL */ + +#undef ROUND + + /* + * apply last round and + * map cipher state to byte array block: + */ + s0 = TE41(t0) ^ TE42(t1) ^ TE43(t2) ^ TE44(t3) ^ rk[0]; + PUTU32(ct , s0); + s1 = TE41(t1) ^ TE42(t2) ^ TE43(t3) ^ TE44(t0) ^ rk[1]; + PUTU32(ct + 4, s1); + s2 = TE41(t2) ^ TE42(t3) ^ TE43(t0) ^ TE44(t1) ^ rk[2]; + PUTU32(ct + 8, s2); + s3 = TE41(t3) ^ TE42(t0) ^ TE43(t1) ^ TE44(t2) ^ rk[3]; + PUTU32(ct + 12, s3); +} +#endif /* CONFIG_NO_AES_ENCRYPT */ + +static void rijndaelDecrypt(const u32 rk[/*44*/], const u8 ct[16], u8 pt[16]) +{ + u32 s0, s1, s2, s3, t0, t1, t2, t3; + const int Nr = 10; +#ifndef FULL_UNROLL + int r; +#endif /* ?FULL_UNROLL */ + + /* + * map byte array block to cipher state + * and add initial round key: + */ + s0 = GETU32(ct ) ^ rk[0]; + s1 = GETU32(ct + 4) ^ rk[1]; + s2 = GETU32(ct + 8) ^ rk[2]; + s3 = GETU32(ct + 12) ^ rk[3]; + +#define ROUND(i,d,s) \ +d##0 = TD0(s##0) ^ TD1(s##3) ^ TD2(s##2) ^ TD3(s##1) ^ rk[4 * i]; \ +d##1 = TD0(s##1) ^ TD1(s##0) ^ TD2(s##3) ^ TD3(s##2) ^ rk[4 * i + 1]; \ +d##2 = TD0(s##2) ^ TD1(s##1) ^ TD2(s##0) ^ TD3(s##3) ^ rk[4 * i + 2]; \ +d##3 = TD0(s##3) ^ TD1(s##2) ^ TD2(s##1) ^ TD3(s##0) ^ rk[4 * i + 3] + +#ifdef FULL_UNROLL + + ROUND(1,t,s); + ROUND(2,s,t); + ROUND(3,t,s); + ROUND(4,s,t); + ROUND(5,t,s); + ROUND(6,s,t); + ROUND(7,t,s); + ROUND(8,s,t); + ROUND(9,t,s); + + rk += Nr << 2; + +#else /* !FULL_UNROLL */ + + /* Nr - 1 full rounds: */ + r = Nr >> 1; + for (;;) { + ROUND(1,t,s); + rk += 8; + if (--r == 0) + break; + ROUND(0,s,t); + } + +#endif /* ?FULL_UNROLL */ + +#undef ROUND + + /* + * apply last round and + * map cipher state to byte array block: + */ + s0 = TD41(t0) ^ TD42(t3) ^ TD43(t2) ^ TD44(t1) ^ rk[0]; + PUTU32(pt , s0); + s1 = TD41(t1) ^ TD42(t0) ^ TD43(t3) ^ TD44(t2) ^ rk[1]; + PUTU32(pt + 4, s1); + s2 = TD41(t2) ^ TD42(t1) ^ TD43(t0) ^ TD44(t3) ^ rk[2]; + PUTU32(pt + 8, s2); + s3 = TD41(t3) ^ TD42(t2) ^ TD43(t1) ^ TD44(t0) ^ rk[3]; + PUTU32(pt + 12, s3); +} + +#define AES_PRIV_SIZE 44 diff --git a/package/network/services/ead/src/ead-client.c b/package/network/services/ead/src/ead-client.c new file mode 100644 index 0000000000..35b67e3568 --- /dev/null +++ b/package/network/services/ead/src/ead-client.c @@ -0,0 +1,433 @@ +/* + * Client for the Emergency Access Daemon + * Copyright (C) 2008 Felix Fietkau + * + * 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 +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "ead.h" +#include "ead-crypt.h" + +#include "pw_encrypt_md5.c" + +#define EAD_TIMEOUT 400 +#define EAD_TIMEOUT_LONG 2000 + +static char msgbuf[1500]; +static struct ead_msg *msg = (struct ead_msg *) msgbuf; +static uint16_t nid = 0xffff; +struct sockaddr_in local, remote; +static int s = 0; +static int sockflags; +static struct in_addr serverip = { + .s_addr = 0x01010101 /* dummy */ +}; + +static unsigned char *skey = NULL; +static unsigned char bbuf[MAXPARAMLEN]; +static unsigned char saltbuf[MAXSALTLEN]; +static char *username = NULL; +static char password[MAXPARAMLEN] = ""; +static char pw_md5[MD5_OUT_BUFSIZE]; +static char pw_salt[MAXSALTLEN]; + +static struct t_client *tc = NULL; +static struct t_num salt = { .data = saltbuf }; +static struct t_num *A, B; +static struct t_preconf *tcp; +static int auth_type = EAD_AUTH_DEFAULT; +static int timeout = EAD_TIMEOUT; +static uint16_t sid = 0; + +static void +set_nonblock(int enable) +{ + if (enable == !!(sockflags & O_NONBLOCK)) + return; + + sockflags ^= O_NONBLOCK; + fcntl(s, F_SETFL, sockflags); +} + +static int +send_packet(int type, bool (*handler)(void), unsigned int max) +{ + struct timeval tv; + fd_set fds; + int nfds; + int len; + int res = 0; + + type = htonl(type); + memcpy(&msg->ip, &serverip.s_addr, sizeof(msg->ip)); + set_nonblock(0); + sendto(s, msgbuf, sizeof(struct ead_msg) + ntohl(msg->len), 0, (struct sockaddr *) &remote, sizeof(remote)); + set_nonblock(1); + + tv.tv_sec = timeout / 1000; + tv.tv_usec = (timeout % 1000) * 1000; + + FD_ZERO(&fds); + do { + FD_SET(s, &fds); + nfds = select(s + 1, &fds, NULL, NULL, &tv); + + if (nfds <= 0) + break; + + if (!FD_ISSET(s, &fds)) + break; + + len = read(s, msgbuf, sizeof(msgbuf)); + if (len < 0) + break; + + if (len < sizeof(struct ead_msg)) + continue; + + if (len < sizeof(struct ead_msg) + ntohl(msg->len)) + continue; + + if (msg->magic != htonl(EAD_MAGIC)) + continue; + + if ((nid != 0xffff) && (ntohs(msg->nid) != nid)) + continue; + + if (msg->type != type) + continue; + + if (handler()) + res++; + + if ((max > 0) && (res >= max)) + break; + } while (1); + + return res; +} + +static void +prepare_password(void) +{ + switch(auth_type) { + case EAD_AUTH_DEFAULT: + break; + case EAD_AUTH_MD5: + md5_crypt(pw_md5, (unsigned char *) password, (unsigned char *) pw_salt); + strncpy(password, pw_md5, sizeof(password)); + break; + } +} + +static bool +handle_pong(void) +{ + struct ead_msg_pong *pong = EAD_DATA(msg, pong); + int len = ntohl(msg->len) - sizeof(struct ead_msg_pong); + + if (len <= 0) + return false; + + pong->name[len] = 0; + auth_type = ntohs(pong->auth_type); + if (nid == 0xffff) + printf("%04x: %s\n", ntohs(msg->nid), pong->name); + sid = msg->sid; + return true; +} + +static bool +handle_prime(void) +{ + struct ead_msg_salt *sb = EAD_DATA(msg, salt); + + salt.len = sb->len; + memcpy(salt.data, sb->salt, salt.len); + + if (auth_type == EAD_AUTH_MD5) { + memcpy(pw_salt, sb->ext_salt, MAXSALTLEN); + pw_salt[MAXSALTLEN - 1] = 0; + } + + tcp = t_getpreparam(sb->prime); + tc = t_clientopen(username, &tcp->modulus, &tcp->generator, &salt); + if (!tc) { + fprintf(stderr, "Client open failed\n"); + return false; + } + + return true; +} + +static bool +handle_b(void) +{ + struct ead_msg_number *num = EAD_DATA(msg, number); + int len = ntohl(msg->len) - sizeof(struct ead_msg_number); + + B.data = bbuf; + B.len = len; + memcpy(bbuf, num->data, len); + return true; +} + +static bool +handle_none(void) +{ + return true; +} + +static bool +handle_done_auth(void) +{ + struct ead_msg_auth *auth = EAD_DATA(msg, auth); + if (t_clientverify(tc, auth->data) != 0) { + fprintf(stderr, "Client auth verify failed\n"); + return false; + } + return true; +} + +static bool +handle_cmd_data(void) +{ + struct ead_msg_cmd_data *cmd = EAD_ENC_DATA(msg, cmd_data); + int datalen = ead_decrypt_message(msg) - sizeof(struct ead_msg_cmd_data); + + if (datalen < 0) + return false; + + if (datalen > 0) { + write(1, cmd->data, datalen); + } + + return !!cmd->done; +} +static int +send_ping(void) +{ + msg->type = htonl(EAD_TYPE_PING); + msg->len = 0; + return send_packet(EAD_TYPE_PONG, handle_pong, (nid == 0xffff ? 0 : 1)); +} + +static int +send_username(void) +{ + msg->type = htonl(EAD_TYPE_SET_USERNAME); + msg->len = htonl(sizeof(struct ead_msg_user)); + strcpy(EAD_DATA(msg, user)->username, username); + return send_packet(EAD_TYPE_ACK_USERNAME, handle_none, 1); +} + +static int +get_prime(void) +{ + msg->type = htonl(EAD_TYPE_GET_PRIME); + msg->len = 0; + return send_packet(EAD_TYPE_PRIME, handle_prime, 1); +} + +static int +send_a(void) +{ + struct ead_msg_number *num = EAD_DATA(msg, number); + A = t_clientgenexp(tc); + msg->type = htonl(EAD_TYPE_SEND_A); + msg->len = htonl(sizeof(struct ead_msg_number) + A->len); + memcpy(num->data, A->data, A->len); + return send_packet(EAD_TYPE_SEND_B, handle_b, 1); +} + +static int +send_auth(void) +{ + struct ead_msg_auth *auth = EAD_DATA(msg, auth); + + prepare_password(); + t_clientpasswd(tc, password); + skey = t_clientgetkey(tc, &B); + if (!skey) + return 0; + + ead_set_key(skey); + msg->type = htonl(EAD_TYPE_SEND_AUTH); + msg->len = htonl(sizeof(struct ead_msg_auth)); + memcpy(auth->data, t_clientresponse(tc), sizeof(auth->data)); + return send_packet(EAD_TYPE_DONE_AUTH, handle_done_auth, 1); +} + +static int +send_command(const char *command) +{ + struct ead_msg_cmd *cmd = EAD_ENC_DATA(msg, cmd); + + msg->type = htonl(EAD_TYPE_SEND_CMD); + cmd->type = htons(EAD_CMD_NORMAL); + cmd->timeout = htons(10); + strncpy((char *)cmd->data, command, 1024); + ead_encrypt_message(msg, sizeof(struct ead_msg_cmd) + strlen(command) + 1); + return send_packet(EAD_TYPE_RESULT_CMD, handle_cmd_data, 1); +} + + +static int +usage(const char *prog) +{ + fprintf(stderr, "Usage: %s [-s ] [-b ] [:] \n" + "\n" + "\t-s : Set the server's source address to \n" + "\t-b : Set the broadcast address to \n" + "\t: Node ID (4 digits hex)\n" + "\t: Username to authenticate with\n" + "\n" + "\tPassing no arguments shows a list of active nodes on the network\n" + "\n", prog); + return -1; +} + + +int main(int argc, char **argv) +{ + int val = 1; + char *st = NULL; + const char *command = NULL; + const char *prog = argv[0]; + int ch; + + msg->magic = htonl(EAD_MAGIC); + msg->sid = 0; + + memset(&local, 0, sizeof(local)); + memset(&remote, 0, sizeof(remote)); + + remote.sin_family = AF_INET; + remote.sin_addr.s_addr = 0xffffffff; + remote.sin_port = htons(EAD_PORT); + + local.sin_family = AF_INET; + local.sin_addr.s_addr = INADDR_ANY; + local.sin_port = 0; + + while ((ch = getopt(argc, argv, "b:s:h")) != -1) { + switch(ch) { + case 's': + inet_aton(optarg, &serverip); + break; + case 'b': + inet_aton(optarg, &remote.sin_addr); + break; + case 'h': + return usage(prog); + } + } + argv += optind; + argc -= optind; + + switch(argc) { + case 3: + command = argv[2]; + /* fall through */ + case 2: + username = argv[1]; + st = strchr(username, ':'); + if (st) { + *st = 0; + st++; + strncpy(password, st, sizeof(password)); + password[sizeof(password) - 1] = 0; + /* hide command line password */ + memset(st, 0, strlen(st)); + } + /* fall through */ + case 1: + nid = strtoul(argv[0], &st, 16); + if (st && st[0] != 0) + return usage(prog); + /* fall through */ + case 0: + break; + default: + return usage(prog); + } + + msg->nid = htons(nid); + s = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP); + if (s < 0) { + perror("socket"); + return -1; + } + + setsockopt(s, SOL_SOCKET, SO_BROADCAST, &val, sizeof(val)); + + if (bind(s, (struct sockaddr *)&local, sizeof(local)) < 0) { + perror("bind"); + return -1; + } + sockflags = fcntl(s, F_GETFL); + + if (!send_ping()) { + fprintf(stderr, "No devices found\n"); + return 1; + } + + if (nid == 0xffff) + return 0; + + if (!username || !password[0]) + return 0; + + if (!send_username()) { + fprintf(stderr, "Device did not accept user name\n"); + return 1; + } + timeout = EAD_TIMEOUT_LONG; + if (!get_prime()) { + fprintf(stderr, "Failed to get user password info\n"); + return 1; + } + if (!send_a()) { + fprintf(stderr, "Failed to send local authentication data\n"); + return 1; + } + if (!send_auth()) { + fprintf(stderr, "Authentication failed\n"); + return 1; + } + if (!command) { + fprintf(stderr, "Authentication succesful\n"); + return 0; + } + if (!send_command(command)) { + fprintf(stderr, "Command failed\n"); + return 1; + } + + return 0; +} diff --git a/package/network/services/ead/src/ead-crypt.c b/package/network/services/ead/src/ead-crypt.c new file mode 100644 index 0000000000..70d2b83b06 --- /dev/null +++ b/package/network/services/ead/src/ead-crypt.c @@ -0,0 +1,179 @@ +/* + * Copyright (C) 2008 Felix Fietkau + * + * 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 +#include +#include +#include +#include +#include +#include +#include "ead.h" + +#include "sha1.c" +#include "aes.c" + +#if EAD_DEBUGLEVEL >= 1 +#define DEBUG(n, format, ...) do { \ + if (EAD_DEBUGLEVEL >= n) \ + fprintf(stderr, format, ##__VA_ARGS__); \ +} while (0); + +#else +#define DEBUG(n, format, ...) do {} while(0) +#endif + + +static uint32_t aes_enc_ctx[AES_PRIV_SIZE]; +static uint32_t aes_dec_ctx[AES_PRIV_SIZE]; +static uint32_t ead_rx_iv; +static uint32_t ead_tx_iv; +static uint32_t ivofs_vec; +static unsigned int ivofs_idx = 0; +static uint32_t W[80]; /* work space for sha1 */ + +#define EAD_ENC_PAD 64 + +void +ead_set_key(unsigned char *skey) +{ + uint32_t *ivp = (uint32_t *)skey; + + memset(aes_enc_ctx, 0, sizeof(aes_enc_ctx)); + memset(aes_dec_ctx, 0, sizeof(aes_dec_ctx)); + + /* first 32 bytes of skey are used as aes key for + * encryption and decryption */ + rijndaelKeySetupEnc(aes_enc_ctx, skey); + rijndaelKeySetupDec(aes_dec_ctx, skey); + + /* the following bytes are used as initialization vector for messages + * (highest byte cleared to avoid overflow) */ + ivp += 8; + ead_rx_iv = ntohl(*ivp) & 0x00ffffff; + ead_tx_iv = ead_rx_iv; + + /* the last bytes are used to feed the random iv increment */ + ivp++; + ivofs_vec = *ivp; +} + + +static bool +ead_check_rx_iv(uint32_t iv) +{ + if (iv <= ead_rx_iv) + return false; + + if (iv > ead_rx_iv + EAD_MAX_IV_INCR) + return false; + + ead_rx_iv = iv; + return true; +} + + +static uint32_t +ead_get_tx_iv(void) +{ + unsigned int ofs; + + ofs = 1 + ((ivofs_vec >> 2 * ivofs_idx) & 0x3); + ivofs_idx = (ivofs_idx + 1) % 16; + ead_tx_iv += ofs; + + return ead_tx_iv; +} + +static void +ead_hash_message(struct ead_msg_encrypted *enc, uint32_t *hash, int len) +{ + unsigned char *data = (unsigned char *) enc; + + /* hash the packet with the stored hash part initialized to zero */ + sha_init(hash); + memset(enc->hash, 0, sizeof(enc->hash)); + while (len > 0) { + sha_transform(hash, data, W); + len -= 64; + data += 64; + } +} + +void +ead_encrypt_message(struct ead_msg *msg, unsigned int len) +{ + struct ead_msg_encrypted *enc = EAD_DATA(msg, enc); + unsigned char *data = (unsigned char *) enc; + uint32_t hash[5]; + int enclen, i; + + len += sizeof(struct ead_msg_encrypted); + enc->pad = (EAD_ENC_PAD - (len % EAD_ENC_PAD)) % EAD_ENC_PAD; + enclen = len + enc->pad; + msg->len = htonl(enclen); + enc->iv = htonl(ead_get_tx_iv()); + + ead_hash_message(enc, hash, enclen); + for (i = 0; i < 5; i++) + enc->hash[i] = htonl(hash[i]); + DEBUG(2, "SHA1 generate (0x%08x), len=%d\n", enc->hash[0], enclen); + + while (enclen > 0) { + rijndaelEncrypt(aes_enc_ctx, data, data); + data += 16; + enclen -= 16; + } +} + +int +ead_decrypt_message(struct ead_msg *msg) +{ + struct ead_msg_encrypted *enc = EAD_DATA(msg, enc); + unsigned char *data = (unsigned char *) enc; + uint32_t hash_old[5], hash_new[5]; + int len = ntohl(msg->len); + int i, enclen = len; + + if (!len || (len % EAD_ENC_PAD > 0)) + return 0; + + while (len > 0) { + rijndaelDecrypt(aes_dec_ctx, data, data); + data += 16; + len -= 16; + } + + data = (unsigned char *) enc; + + if (enc->pad >= EAD_ENC_PAD) { + DEBUG(2, "Invalid padding length\n"); + return 0; + } + + if (!ead_check_rx_iv(ntohl(enc->iv))) { + DEBUG(2, "RX IV mismatch (0x%08x <> 0x%08x)\n", ead_rx_iv, ntohl(enc->iv)); + return 0; + } + + for (i = 0; i < 5; i++) + hash_old[i] = ntohl(enc->hash[i]); + ead_hash_message(enc, hash_new, enclen); + if (memcmp(hash_old, hash_new, sizeof(hash_old)) != 0) { + DEBUG(2, "SHA1 mismatch (0x%08x != 0x%08x), len=%d\n", hash_old[0], hash_new[0], enclen); + return 0; + } + + enclen -= enc->pad + sizeof(struct ead_msg_encrypted); + return enclen; +} diff --git a/package/network/services/ead/src/ead-crypt.h b/package/network/services/ead/src/ead-crypt.h new file mode 100644 index 0000000000..2627d14162 --- /dev/null +++ b/package/network/services/ead/src/ead-crypt.h @@ -0,0 +1,21 @@ +/* + * Copyright (C) 2008 Felix Fietkau + * + * 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 __EAD_CRYPT_H +#define __EAD_CRYPT_H + +extern void ead_set_key(unsigned char *skey); +extern void ead_encrypt_message(struct ead_msg *msg, unsigned int len); +extern int ead_decrypt_message(struct ead_msg *msg); + +#endif diff --git a/package/network/services/ead/src/ead-pcap.h b/package/network/services/ead/src/ead-pcap.h new file mode 100644 index 0000000000..0652ab48fd --- /dev/null +++ b/package/network/services/ead/src/ead-pcap.h @@ -0,0 +1,71 @@ +/* + * Copyright (c) 2001-2003, Adam Dunkels. + * 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. The name of the author may not be used to endorse or promote + * products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS + * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR 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 file was part of the uIP TCP/IP stack. + * + */ +#ifndef __EAD_PCAP_H +#define __EAD_PCAP_H + +#include +#include +#include "ead.h" + +typedef uint8_t u8_t; +typedef uint16_t u16_t; + +/* The UDP and IP headers. */ +struct ead_packet { + struct ether_header eh; + /* IP header. */ + u8_t vhl, + tos, + len[2], + ipid[2], + ipoffset[2], + ttl, + proto; + u16_t ipchksum; + u16_t srcipaddr[2], + destipaddr[2]; + + /* UDP header. */ + u16_t srcport, + destport; + u16_t udplen; + u16_t udpchksum; + + struct ead_msg msg; +} __attribute__((packed)); + +#define UIP_PROTO_UDP 17 +#define UIP_IPH_LEN 20 /* Size of IP header */ +#define UIP_UDPH_LEN 8 /* Size of UDP header */ +#define UIP_IPUDPH_LEN (UIP_UDPH_LEN + UIP_IPH_LEN) + +#endif diff --git a/package/network/services/ead/src/ead.c b/package/network/services/ead/src/ead.c new file mode 100644 index 0000000000..ad97c543c5 --- /dev/null +++ b/package/network/services/ead/src/ead.c @@ -0,0 +1,974 @@ +/* + * Emergency Access Daemon + * Copyright (C) 2008 Felix Fietkau + * + * 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 +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "list.h" +#include "ead.h" +#include "ead-pcap.h" +#include "ead-crypt.h" +#include "libbridge.h" + +#include "filter.c" + +#ifdef linux +#include +#endif + +#define PASSWD_FILE "/etc/passwd" + +#ifndef DEFAULT_IFNAME +#define DEFAULT_IFNAME "eth0" +#endif + +#ifndef DEFAULT_DEVNAME +#define DEFAULT_DEVNAME "Unknown" +#endif + +#define PCAP_MRU 1600 +#define PCAP_TIMEOUT 200 + +#if EAD_DEBUGLEVEL >= 1 +#define DEBUG(n, format, ...) do { \ + if (EAD_DEBUGLEVEL >= n) \ + fprintf(stderr, format, ##__VA_ARGS__); \ +} while (0); + +#else +#define DEBUG(n, format, ...) do {} while(0) +#endif + +struct ead_instance { + struct list_head list; + char ifname[16]; + int pid; + char id; + char bridge[16]; + bool br_check; +}; + +static char ethmac[6] = "\x00\x13\x37\x00\x00\x00"; /* last 3 bytes will be randomized */ +static pcap_t *pcap_fp = NULL; +static pcap_t *pcap_fp_rx = NULL; +static char pktbuf_b[PCAP_MRU]; +static struct ead_packet *pktbuf = (struct ead_packet *)pktbuf_b; +static u16_t nid = 0xffff; /* node id */ +static char username[32] = ""; +static int state = EAD_TYPE_SET_USERNAME; +static const char *passwd_file = PASSWD_FILE; +static const char password[MAXPARAMLEN]; +static bool child_pending = false; + +static unsigned char abuf[MAXPARAMLEN + 1]; +static unsigned char pwbuf[MAXPARAMLEN]; +static unsigned char saltbuf[MAXSALTLEN]; +static unsigned char pw_saltbuf[MAXSALTLEN]; +static struct list_head instances; +static const char *dev_name = DEFAULT_DEVNAME; +static bool nonfork = false; +static struct ead_instance *instance = NULL; + +static struct t_pwent tpe = { + .name = username, + .index = 1, + .password.data = pwbuf, + .password.len = 0, + .salt.data = saltbuf, + .salt.len = 0, +}; +struct t_confent *tce = NULL; +static struct t_server *ts = NULL; +static struct t_num A, *B = NULL; +unsigned char *skey; + +static void +set_recv_type(pcap_t *p, bool rx) +{ +#ifdef PACKET_RECV_TYPE + struct sockaddr_ll sll; + struct ifreq ifr; + int mask; + int fd; + + fd = pcap_get_selectable_fd(p); + if (fd < 0) + return; + + if (rx) + mask = 1 << PACKET_BROADCAST; + else + mask = 0; + + setsockopt(fd, SOL_PACKET, PACKET_RECV_TYPE, &mask, sizeof(mask)); +#endif +} + + +static pcap_t * +ead_open_pcap(const char *ifname, char *errbuf, bool rx) +{ + pcap_t *p; + + p = pcap_create(ifname, errbuf); + if (p == NULL) + goto out; + + pcap_set_snaplen(p, PCAP_MRU); + pcap_set_promisc(p, rx); + pcap_set_timeout(p, PCAP_TIMEOUT); + pcap_set_protocol_linux(p, (rx ? htons(ETH_P_IP) : 0)); + pcap_set_buffer_size(p, (rx ? 10 : 1) * PCAP_MRU); + pcap_activate(p); + set_recv_type(p, rx); +out: + return p; +} + +static void +get_random_bytes(void *ptr, int len) +{ + int fd; + + fd = open("/dev/urandom", O_RDONLY); + if (fd < 0) { + perror("open"); + exit(1); + } + read(fd, ptr, len); + close(fd); +} + +static bool +prepare_password(void) +{ + static char lbuf[1024]; + unsigned char dig[SHA_DIGESTSIZE]; + BigInteger x, v, n, g; + SHA1_CTX ctxt; + int ulen = strlen(username); + FILE *f; + + lbuf[sizeof(lbuf) - 1] = 0; + + f = fopen(passwd_file, "r"); + if (!f) + return false; + + while (fgets(lbuf, sizeof(lbuf) - 1, f) != NULL) { + char *str, *s2; + + if (strncmp(lbuf, username, ulen) != 0) + continue; + + if (lbuf[ulen] != ':') + continue; + + str = &lbuf[ulen + 1]; + + if (strncmp(str, "$1$", 3) != 0) + continue; + + s2 = strchr(str + 3, '$'); + if (!s2) + continue; + + if (s2 - str >= MAXSALTLEN) + continue; + + strncpy((char *) pw_saltbuf, str, s2 - str); + pw_saltbuf[s2 - str] = 0; + + s2 = strchr(s2, ':'); + if (!s2) + continue; + + *s2 = 0; + if (s2 - str >= MAXPARAMLEN) + continue; + + strncpy((char *)password, str, MAXPARAMLEN); + fclose(f); + goto hash_password; + } + + /* not found */ + fclose(f); + return false; + +hash_password: + tce = gettcid(tpe.index); + do { + t_random(tpe.password.data, SALTLEN); + } while (memcmp(saltbuf, (char *)dig, sizeof(saltbuf)) == 0); + if (saltbuf[0] == 0) + saltbuf[0] = 0xff; + + n = BigIntegerFromBytes(tce->modulus.data, tce->modulus.len); + g = BigIntegerFromBytes(tce->generator.data, tce->generator.len); + v = BigIntegerFromInt(0); + + SHA1Init(&ctxt); + SHA1Update(&ctxt, (unsigned char *) username, strlen(username)); + SHA1Update(&ctxt, (unsigned char *) ":", 1); + SHA1Update(&ctxt, (unsigned char *) password, strlen(password)); + SHA1Final(dig, &ctxt); + + SHA1Init(&ctxt); + SHA1Update(&ctxt, saltbuf, tpe.salt.len); + SHA1Update(&ctxt, dig, sizeof(dig)); + SHA1Final(dig, &ctxt); + + /* x = H(s, H(u, ':', p)) */ + x = BigIntegerFromBytes(dig, sizeof(dig)); + + BigIntegerModExp(v, g, x, n); + tpe.password.len = BigIntegerToBytes(v, (unsigned char *)pwbuf); + + BigIntegerFree(v); + BigIntegerFree(x); + BigIntegerFree(g); + BigIntegerFree(n); + return true; +} + +static u16_t +chksum(u16_t sum, const u8_t *data, u16_t len) +{ + u16_t t; + const u8_t *dataptr; + const u8_t *last_byte; + + dataptr = data; + last_byte = data + len - 1; + + while(dataptr < last_byte) { /* At least two more bytes */ + t = (dataptr[0] << 8) + dataptr[1]; + sum += t; + if(sum < t) { + sum++; /* carry */ + } + dataptr += 2; + } + + if(dataptr == last_byte) { + t = (dataptr[0] << 8) + 0; + sum += t; + if(sum < t) { + sum++; /* carry */ + } + } + + /* Return sum in host byte order. */ + return sum; +} + +static void +ead_send_packet_clone(struct ead_packet *pkt) +{ + u16_t len, sum; + + memcpy(pktbuf, pkt, offsetof(struct ead_packet, msg)); + memcpy(pktbuf->eh.ether_shost, ethmac, 6); + memcpy(pktbuf->eh.ether_dhost, pkt->eh.ether_shost, 6); + + /* ip header */ + len = sizeof(struct ead_packet) - sizeof(struct ether_header) + ntohl(pktbuf->msg.len); + pktbuf->len[0] = len >> 8; + pktbuf->len[1] = len & 0xff; + memcpy(pktbuf->srcipaddr, &pkt->msg.ip, 4); + memcpy(pktbuf->destipaddr, pkt->srcipaddr, 4); + + /* ip checksum */ + pktbuf->ipchksum = 0; + sum = chksum(0, (void *) &pktbuf->vhl, UIP_IPH_LEN); + if (sum == 0) + sum = 0xffff; + pktbuf->ipchksum = htons(~sum); + + /* udp header */ + pktbuf->srcport = pkt->destport; + pktbuf->destport = pkt->srcport; + + /* udp checksum */ + len -= UIP_IPH_LEN; + pktbuf->udplen = htons(len); + pktbuf->udpchksum = 0; + sum = len + UIP_PROTO_UDP; + sum = chksum(sum, (void *) &pktbuf->srcipaddr[0], 8); /* src, dest ip */ + sum = chksum(sum, (void *) &pktbuf->srcport, len); + if (sum == 0) + sum = 0xffff; + pktbuf->udpchksum = htons(~sum); + pcap_sendpacket(pcap_fp, (void *) pktbuf, sizeof(struct ead_packet) + ntohl(pktbuf->msg.len)); +} + +static void +set_state(int nstate) +{ + if (state == nstate) + return; + + if (nstate < state) { + if ((nstate < EAD_TYPE_GET_PRIME) && + (state >= EAD_TYPE_GET_PRIME)) { + t_serverclose(ts); + ts = NULL; + } + goto done; + } + + switch(state) { + case EAD_TYPE_SET_USERNAME: + if (!prepare_password()) + goto error; + ts = t_serveropenraw(&tpe, tce); + if (!ts) + goto error; + break; + case EAD_TYPE_GET_PRIME: + B = t_servergenexp(ts); + break; + case EAD_TYPE_SEND_A: + skey = t_servergetkey(ts, &A); + if (!skey) + goto error; + + ead_set_key(skey); + break; + } +done: + state = nstate; +error: + return; +} + +static bool +handle_ping(struct ead_packet *pkt, int len, int *nstate) +{ + struct ead_msg *msg = &pktbuf->msg; + struct ead_msg_pong *pong = EAD_DATA(msg, pong); + int slen; + + slen = strlen(dev_name); + if (slen > 1024) + slen = 1024; + + msg->len = htonl(sizeof(struct ead_msg_pong) + slen); + strncpy(pong->name, dev_name, slen); + pong->name[slen] = 0; + pong->auth_type = htons(EAD_AUTH_MD5); + + return true; +} + +static bool +handle_set_username(struct ead_packet *pkt, int len, int *nstate) +{ + struct ead_msg *msg = &pkt->msg; + struct ead_msg_user *user = EAD_DATA(msg, user); + + set_state(EAD_TYPE_SET_USERNAME); /* clear old state */ + strncpy(username, user->username, sizeof(username)); + username[sizeof(username) - 1] = 0; + + msg = &pktbuf->msg; + msg->len = 0; + + *nstate = EAD_TYPE_GET_PRIME; + return true; +} + +static bool +handle_get_prime(struct ead_packet *pkt, int len, int *nstate) +{ + struct ead_msg *msg = &pktbuf->msg; + struct ead_msg_salt *salt = EAD_DATA(msg, salt); + + msg->len = htonl(sizeof(struct ead_msg_salt)); + salt->prime = tce->index - 1; + salt->len = ts->s.len; + memcpy(salt->salt, ts->s.data, ts->s.len); + memcpy(salt->ext_salt, pw_saltbuf, MAXSALTLEN); + + *nstate = EAD_TYPE_SEND_A; + return true; +} + +static bool +handle_send_a(struct ead_packet *pkt, int len, int *nstate) +{ + struct ead_msg *msg = &pkt->msg; + struct ead_msg_number *number = EAD_DATA(msg, number); + len = ntohl(msg->len) - sizeof(struct ead_msg_number); + + if (len > MAXPARAMLEN + 1) + return false; + + A.len = len; + A.data = abuf; + memcpy(A.data, number->data, len); + + msg = &pktbuf->msg; + number = EAD_DATA(msg, number); + msg->len = htonl(sizeof(struct ead_msg_number) + B->len); + memcpy(number->data, B->data, B->len); + + *nstate = EAD_TYPE_SEND_AUTH; + return true; +} + +static bool +handle_send_auth(struct ead_packet *pkt, int len, int *nstate) +{ + struct ead_msg *msg = &pkt->msg; + struct ead_msg_auth *auth = EAD_DATA(msg, auth); + + if (t_serververify(ts, auth->data) != 0) { + DEBUG(2, "Client authentication failed\n"); + *nstate = EAD_TYPE_SET_USERNAME; + return false; + } + + msg = &pktbuf->msg; + auth = EAD_DATA(msg, auth); + msg->len = htonl(sizeof(struct ead_msg_auth)); + + DEBUG(2, "Client authentication successful\n"); + memcpy(auth->data, t_serverresponse(ts), sizeof(auth->data)); + + *nstate = EAD_TYPE_SEND_CMD; + return true; +} + +static bool +handle_send_cmd(struct ead_packet *pkt, int len, int *nstate) +{ + struct ead_msg *msg = &pkt->msg; + struct ead_msg_cmd *cmd = EAD_ENC_DATA(msg, cmd); + struct ead_msg_cmd_data *cmddata; + struct timeval tv, to, tn; + int pfd[2], fd; + fd_set fds; + pid_t pid; + bool stream = false; + int timeout; + int type; + int datalen; + + datalen = ead_decrypt_message(msg) - sizeof(struct ead_msg_cmd); + if (datalen <= 0) + return false; + + type = ntohs(cmd->type); + timeout = ntohs(cmd->timeout); + + FD_ZERO(&fds); + cmd->data[datalen] = 0; + switch(type) { + case EAD_CMD_NORMAL: + if (pipe(pfd) < 0) + return false; + + fcntl(pfd[0], F_SETFL, O_NONBLOCK | fcntl(pfd[0], F_GETFL)); + child_pending = true; + pid = fork(); + if (pid == 0) { + close(pfd[0]); + fd = open("/dev/null", O_RDWR); + if (fd > 0) { + dup2(fd, 0); + dup2(pfd[1], 1); + dup2(pfd[1], 2); + } + system((char *)cmd->data); + exit(0); + } else if (pid > 0) { + close(pfd[1]); + if (!timeout) + timeout = EAD_CMD_TIMEOUT; + + stream = true; + break; + } + return false; + case EAD_CMD_BACKGROUND: + pid = fork(); + if (pid == 0) { + /* close stdin, stdout, stderr, replace with fd to /dev/null */ + fd = open("/dev/null", O_RDWR); + if (fd > 0) { + dup2(fd, 0); + dup2(fd, 1); + dup2(fd, 2); + } + system((char *)cmd->data); + exit(0); + } else if (pid > 0) { + break; + } + return false; + default: + return false; + } + + msg = &pktbuf->msg; + cmddata = EAD_ENC_DATA(msg, cmd_data); + + if (stream) { + int nfds, bytes; + + /* send keepalive packets every 200 ms so that the client doesn't timeout */ + gettimeofday(&to, NULL); + memcpy(&tn, &to, sizeof(tn)); + tv.tv_usec = PCAP_TIMEOUT * 1000; + tv.tv_sec = 0; + do { + cmddata->done = 0; + FD_SET(pfd[0], &fds); + nfds = select(pfd[0] + 1, &fds, NULL, NULL, &tv); + bytes = 0; + if (nfds > 0) { + bytes = read(pfd[0], cmddata->data, 1024); + if (bytes < 0) + bytes = 0; + } + if (!bytes && !child_pending) + break; + DEBUG(3, "Sending %d bytes of console data, type=%d, timeout=%d\n", bytes, ntohl(msg->type), timeout); + ead_encrypt_message(msg, sizeof(struct ead_msg_cmd_data) + bytes); + ead_send_packet_clone(pkt); + gettimeofday(&tn, NULL); + } while (tn.tv_sec < to.tv_sec + timeout); + if (child_pending) { + kill(pid, SIGKILL); + return false; + } + } + cmddata->done = 1; + ead_encrypt_message(msg, sizeof(struct ead_msg_cmd_data)); + + return true; +} + + + +static void +parse_message(struct ead_packet *pkt, int len) +{ + bool (*handler)(struct ead_packet *pkt, int len, int *nstate); + int min_len = sizeof(struct ead_packet); + int nstate = state; + int type = ntohl(pkt->msg.type); + + if ((type >= EAD_TYPE_GET_PRIME) && + (state != type)) + return; + + if ((type != EAD_TYPE_PING) && + ((ntohs(pkt->msg.sid) & EAD_INSTANCE_MASK) >> + EAD_INSTANCE_SHIFT) != instance->id) + return; + + switch(type) { + case EAD_TYPE_PING: + handler = handle_ping; + break; + case EAD_TYPE_SET_USERNAME: + handler = handle_set_username; + min_len += sizeof(struct ead_msg_user); + break; + case EAD_TYPE_GET_PRIME: + handler = handle_get_prime; + break; + case EAD_TYPE_SEND_A: + handler = handle_send_a; + min_len += sizeof(struct ead_msg_number); + break; + case EAD_TYPE_SEND_AUTH: + handler = handle_send_auth; + min_len += sizeof(struct ead_msg_auth); + break; + case EAD_TYPE_SEND_CMD: + handler = handle_send_cmd; + min_len += sizeof(struct ead_msg_cmd) + sizeof(struct ead_msg_encrypted); + break; + default: + return; + } + + if (len < min_len) { + DEBUG(2, "discarding packet: message too small\n"); + return; + } + + pktbuf->msg.magic = htonl(EAD_MAGIC); + pktbuf->msg.type = htonl(type + 1); + pktbuf->msg.nid = htons(nid); + pktbuf->msg.sid = pkt->msg.sid; + pktbuf->msg.len = 0; + + if (handler(pkt, len, &nstate)) { + DEBUG(2, "sending response to packet type %d: %d\n", type + 1, ntohl(pktbuf->msg.len)); + /* format response packet */ + ead_send_packet_clone(pkt); + } + set_state(nstate); +} + +static void +handle_packet(u_char *user, const struct pcap_pkthdr *h, const u_char *bytes) +{ + struct ead_packet *pkt = (struct ead_packet *) bytes; + + if (h->len < sizeof(struct ead_packet)) + return; + + if (pkt->eh.ether_type != htons(ETHERTYPE_IP)) + return; + + if (memcmp(pkt->eh.ether_dhost, "\xff\xff\xff\xff\xff\xff", 6) != 0) + return; + + if (pkt->proto != UIP_PROTO_UDP) + return; + + if (pkt->destport != htons(EAD_PORT)) + return; + + if (pkt->msg.magic != htonl(EAD_MAGIC)) + return; + + if (h->len < sizeof(struct ead_packet) + ntohl(pkt->msg.len)) + return; + + if ((pkt->msg.nid != 0xffff) && + (pkt->msg.nid != htons(nid))) + return; + + parse_message(pkt, h->len); +} + +static void +ead_pcap_reopen(bool first) +{ + static char errbuf[PCAP_ERRBUF_SIZE] = ""; + + if (pcap_fp_rx && (pcap_fp_rx != pcap_fp)) + pcap_close(pcap_fp_rx); + + if (pcap_fp) + pcap_close(pcap_fp); + + pcap_fp_rx = NULL; + do { + if (instance->bridge[0]) { + pcap_fp_rx = ead_open_pcap(instance->bridge, errbuf, 1); + pcap_fp = ead_open_pcap(instance->ifname, errbuf, 0); + } else { + pcap_fp = ead_open_pcap(instance->ifname, errbuf, 1); + } + + if (!pcap_fp_rx) + pcap_fp_rx = pcap_fp; + if (first && !pcap_fp) { + DEBUG(1, "WARNING: unable to open interface '%s'\n", instance->ifname); + first = false; + } + if (!pcap_fp) + sleep(1); + } while (!pcap_fp); + pcap_setfilter(pcap_fp_rx, &pktfilter); +} + + +static void +ead_pktloop(void) +{ + while (1) { + if (pcap_dispatch(pcap_fp_rx, 1, handle_packet, NULL) < 0) { + ead_pcap_reopen(false); + continue; + } + } +} + + +static int +usage(const char *prog) +{ + fprintf(stderr, "Usage: %s []\n" + "Options:\n" + "\t-B Run in background mode\n" + "\t-d Set the device to listen on\n" + "\t-D Set the name of the device visible to clients\n" + "\t-p Set the password file for authenticating\n" + "\t-P Write a pidfile\n" + "\n", prog); + return -1; +} + +static void +server_handle_sigchld(int sig) +{ + struct ead_instance *in; + struct list_head *p; + int pid = 0; + wait(&pid); + + list_for_each(p, &instances) { + in = list_entry(p, struct ead_instance, list); + if (pid != in->pid) + continue; + + in->pid = 0; + break; + } +} + +static void +instance_handle_sigchld(int sig) +{ + int pid = 0; + wait(&pid); + child_pending = false; +} + +static void +start_server(struct ead_instance *i) +{ + if (!nonfork) { + i->pid = fork(); + if (i->pid != 0) { + if (i->pid < 0) + i->pid = 0; + return; + } + } + + instance = i; + signal(SIGCHLD, instance_handle_sigchld); + ead_pcap_reopen(true); + ead_pktloop(); + pcap_close(pcap_fp); + if (pcap_fp_rx != pcap_fp) + pcap_close(pcap_fp_rx); + + exit(0); +} + + +static void +start_servers(bool restart) +{ + struct ead_instance *in; + struct list_head *p; + + list_for_each(p, &instances) { + in = list_entry(p, struct ead_instance, list); + if (in->pid > 0) + continue; + + sleep(1); + start_server(in); + } +} + +static void +stop_server(struct ead_instance *in, bool do_free) +{ + if (in->pid > 0) + kill(in->pid, SIGKILL); + in->pid = 0; + if (do_free) { + list_del(&in->list); + free(in); + } +} + +static void +server_handle_sigint(int sig) +{ + struct ead_instance *in; + struct list_head *p, *tmp; + + list_for_each_safe(p, tmp, &instances) { + in = list_entry(p, struct ead_instance, list); + stop_server(in, true); + } + exit(1); +} + +static int +check_bridge_port(const char *br, const char *port, void *arg) +{ + struct ead_instance *in; + struct list_head *p; + + list_for_each(p, &instances) { + in = list_entry(p, struct ead_instance, list); + + if (strcmp(in->ifname, port) != 0) + continue; + + in->br_check = true; + if (strcmp(in->bridge, br) == 0) + break; + + strncpy(in->bridge, br, sizeof(in->bridge)); + DEBUG(2, "assigning port %s to bridge %s\n", in->ifname, in->bridge); + stop_server(in, false); + } + return 0; +} + +static int +check_bridge(const char *name, void *arg) +{ + br_foreach_port(name, check_bridge_port, arg); + return 0; +} + +static void +check_all_interfaces(void) +{ + struct ead_instance *in; + struct list_head *p; + + br_foreach_bridge(check_bridge, NULL); + + /* look for interfaces that are no longer part of a bridge */ + list_for_each(p, &instances) { + in = list_entry(p, struct ead_instance, list); + + if (in->br_check) { + in->br_check = false; + } else if (in->bridge[0]) { + DEBUG(2, "removing port %s from bridge %s\n", in->ifname, in->bridge); + in->bridge[0] = 0; + stop_server(in, false); + } + } +} + + +int main(int argc, char **argv) +{ + struct ead_instance *in; + struct timeval tv; + const char *pidfile = NULL; + bool background = false; + int n_iface = 0; + int fd, ch; + + if (argc == 1) + return usage(argv[0]); + + INIT_LIST_HEAD(&instances); + while ((ch = getopt(argc, argv, "Bd:D:fhp:P:")) != -1) { + switch(ch) { + case 'B': + background = true; + break; + case 'f': + nonfork = true; + break; + case 'h': + return usage(argv[0]); + case 'd': + in = malloc(sizeof(struct ead_instance)); + memset(in, 0, sizeof(struct ead_instance)); + INIT_LIST_HEAD(&in->list); + strncpy(in->ifname, optarg, sizeof(in->ifname) - 1); + list_add(&in->list, &instances); + in->id = n_iface++; + break; + case 'D': + dev_name = optarg; + break; + case 'p': + passwd_file = optarg; + break; + case 'P': + pidfile = optarg; + break; + } + } + signal(SIGCHLD, server_handle_sigchld); + signal(SIGINT, server_handle_sigint); + signal(SIGTERM, server_handle_sigint); + signal(SIGKILL, server_handle_sigint); + + if (!n_iface) { + fprintf(stderr, "Error: ead needs at least one interface\n"); + return -1; + } + + if (background) { + if (fork() > 0) + exit(0); + + fd = open("/dev/null", O_RDWR); + dup2(fd, 0); + dup2(fd, 1); + dup2(fd, 2); + } + + if (pidfile) { + char pid[8]; + int len; + + unlink(pidfile); + fd = open(pidfile, O_CREAT|O_WRONLY|O_EXCL, 0644); + if (fd > 0) { + len = sprintf(pid, "%d\n", getpid()); + write(fd, pid, len); + close(fd); + } + } + + /* randomize the mac address */ + get_random_bytes(ethmac + 3, 3); + nid = *(((u16_t *) ethmac) + 2); + + start_servers(false); + br_init(); + tv.tv_sec = 1; + tv.tv_usec = 0; + while (1) { + check_all_interfaces(); + start_servers(true); + sleep(1); + } + br_shutdown(); + + return 0; +} diff --git a/package/network/services/ead/src/ead.h b/package/network/services/ead/src/ead.h new file mode 100644 index 0000000000..515ac21bdb --- /dev/null +++ b/package/network/services/ead/src/ead.h @@ -0,0 +1,139 @@ +/* + * Copyright (C) 2008 Felix Fietkau + * + * 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 __EAD_H +#define __EAD_H + +#define EAD_DEBUGLEVEL 1 + +#include +#include + +#ifndef MAXSALTLEN +#define MAXSALTLEN 32 +#endif + +#define EAD_PORT 56026UL +#define EAD_MAGIC 3671771902UL +#define EAD_CMD_TIMEOUT 10 + +#define EAD_MAX_IV_INCR 128 + +/* request/response types */ +/* response id == request id + 1 */ +enum ead_type { + EAD_TYPE_PING, + EAD_TYPE_PONG, + + EAD_TYPE_SET_USERNAME, + EAD_TYPE_ACK_USERNAME, + + EAD_TYPE_GET_PRIME, + EAD_TYPE_PRIME, + + EAD_TYPE_SEND_A, + EAD_TYPE_SEND_B, + + EAD_TYPE_SEND_AUTH, + EAD_TYPE_DONE_AUTH, + + EAD_TYPE_SEND_CMD, + EAD_TYPE_RESULT_CMD, + + EAD_TYPE_LAST +}; + +enum ead_auth_type { + EAD_AUTH_DEFAULT, + EAD_AUTH_MD5 +}; + +enum ead_cmd_type { + EAD_CMD_NORMAL, + EAD_CMD_BACKGROUND, + EAD_CMD_LAST +}; + +struct ead_msg_pong { + uint16_t auth_type; + char name[]; +} __attribute__((packed)); + +struct ead_msg_number { + uint8_t id; + unsigned char data[]; +} __attribute__((packed)); + +struct ead_msg_salt { + uint8_t prime; + uint8_t len; + unsigned char salt[MAXSALTLEN]; + unsigned char ext_salt[MAXSALTLEN]; +} __attribute__((packed)); + +struct ead_msg_user { + char username[32]; +} __attribute__((packed)); + +struct ead_msg_auth { + unsigned char data[20]; +} __attribute__((packed)); + +struct ead_msg_cmd { + uint8_t type; + uint16_t timeout; + unsigned char data[]; +} __attribute__((packed)); + +struct ead_msg_cmd_data { + uint8_t done; + unsigned char data[]; +} __attribute__((packed)); + +struct ead_msg_encrypted { + uint32_t hash[5]; + uint32_t iv; + uint8_t pad; + union { + struct ead_msg_cmd cmd; + struct ead_msg_cmd_data cmd_data; + } data[]; +} __attribute__((packed)); + + +#define EAD_DATA(_msg, _type) (&((_msg)->data[0]._type)) +#define EAD_ENC_DATA(_msg, _type) (&((_msg)->data[0].enc.data[0]._type)) + +/* for ead_msg::sid */ +#define EAD_INSTANCE_MASK 0xf000 +#define EAD_INSTANCE_SHIFT 12 + +struct ead_msg { + uint32_t magic; + uint32_t len; + uint32_t type; + uint16_t nid; /* node id */ + uint16_t sid; /* session id */ + uint32_t ip; /* source ip for responses from the server */ + union { + struct ead_msg_pong pong; + struct ead_msg_user user; + struct ead_msg_number number; + struct ead_msg_auth auth; + struct ead_msg_salt salt; + struct ead_msg_encrypted enc; + } data[]; +} __attribute__((packed)); + + +#endif diff --git a/package/network/services/ead/src/filter.c b/package/network/services/ead/src/filter.c new file mode 100644 index 0000000000..0759dc330f --- /dev/null +++ b/package/network/services/ead/src/filter.c @@ -0,0 +1,25 @@ +/* precompiled expression: udp and dst port 56026 */ + +static struct bpf_insn pktfilter_insns[] = { + { .code = 0x0028, .jt = 0x00, .jf = 0x00, .k = 0x0000000c }, + { .code = 0x0015, .jt = 0x00, .jf = 0x04, .k = 0x000086dd }, + { .code = 0x0030, .jt = 0x00, .jf = 0x00, .k = 0x00000014 }, + { .code = 0x0015, .jt = 0x00, .jf = 0x0b, .k = 0x00000011 }, + { .code = 0x0028, .jt = 0x00, .jf = 0x00, .k = 0x00000038 }, + { .code = 0x0015, .jt = 0x08, .jf = 0x09, .k = 0x0000dada }, + { .code = 0x0015, .jt = 0x00, .jf = 0x08, .k = 0x00000800 }, + { .code = 0x0030, .jt = 0x00, .jf = 0x00, .k = 0x00000017 }, + { .code = 0x0015, .jt = 0x00, .jf = 0x06, .k = 0x00000011 }, + { .code = 0x0028, .jt = 0x00, .jf = 0x00, .k = 0x00000014 }, + { .code = 0x0045, .jt = 0x04, .jf = 0x00, .k = 0x00001fff }, + { .code = 0x00b1, .jt = 0x00, .jf = 0x00, .k = 0x0000000e }, + { .code = 0x0048, .jt = 0x00, .jf = 0x00, .k = 0x00000010 }, + { .code = 0x0015, .jt = 0x00, .jf = 0x01, .k = 0x0000dada }, + { .code = 0x0006, .jt = 0x00, .jf = 0x00, .k = 0x000005dc }, + { .code = 0x0006, .jt = 0x00, .jf = 0x00, .k = 0x00000000 }, +}; + +static struct bpf_program pktfilter = { + .bf_len = 16, + .bf_insns = pktfilter_insns, +}; diff --git a/package/network/services/ead/src/libbridge.h b/package/network/services/ead/src/libbridge.h new file mode 100644 index 0000000000..d7bbdc4162 --- /dev/null +++ b/package/network/services/ead/src/libbridge.h @@ -0,0 +1,60 @@ +/* + * Copyright (C) 2000 Lennert Buytenhek + * + * 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. + */ + +#ifndef _LIBBRIDGE_H +#define _LIBBRIDGE_H + +#ifdef linux + +int br_init(void); +void br_shutdown(void); + +int br_foreach_port(const char *brname, + int (*iterator)(const char *br, const char *port, void *arg), + void *arg); + +int br_foreach_bridge(int (*iterator)(const char *, void *), void *arg); + +#else + +static inline int br_init(void) +{ + return 0; +} + +static inline void br_shutdown(void) +{ +} + +static inline int +br_foreach_port(const char *brname, + int (*iterator)(const char *br, const char *port, void *arg), + void *arg) +{ + return 0; +} + +static inline int +br_foreach_bridge(int (*iterator)(const char *, void *), void *arg) +{ + return 0; +} + +#endif + +#endif diff --git a/package/network/services/ead/src/libbridge_init.c b/package/network/services/ead/src/libbridge_init.c new file mode 100644 index 0000000000..687ef62113 --- /dev/null +++ b/package/network/services/ead/src/libbridge_init.c @@ -0,0 +1,127 @@ +/* + * Copyright (C) 2000 Lennert Buytenhek + * + * 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. + */ + +#ifdef linux + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "libbridge.h" +#include "libbridge_private.h" + +static int br_socket_fd = -1; + +int br_init(void) +{ + if ((br_socket_fd = socket(AF_LOCAL, SOCK_STREAM, 0)) < 0) + return errno; + return 0; +} + +void br_shutdown(void) +{ + close(br_socket_fd); + br_socket_fd = -1; +} + +/* If /sys/class/net/XXX/bridge exists then it must be a bridge */ +static int isbridge(const struct dirent *entry) +{ + char path[SYSFS_PATH_MAX]; + struct stat st; + + snprintf(path, SYSFS_PATH_MAX, SYSFS_CLASS_NET "%s/bridge", entry->d_name); + return stat(path, &st) == 0 && S_ISDIR(st.st_mode); +} + +/* + * New interface uses sysfs to find bridges + */ +static int new_foreach_bridge(int (*iterator)(const char *name, void *), + void *arg) +{ + struct dirent **namelist; + int i, count = 0; + + count = scandir(SYSFS_CLASS_NET, &namelist, isbridge, alphasort); + if (count < 0) + return -1; + + for (i = 0; i < count; i++) { + if (iterator(namelist[i]->d_name, arg)) + break; + } + + for (i = 0; i < count; i++) + free(namelist[i]); + free(namelist); + + return count; +} + +/* + * Go over all bridges and call iterator function. + * if iterator returns non-zero then stop. + */ +int br_foreach_bridge(int (*iterator)(const char *, void *), void *arg) +{ + return new_foreach_bridge(iterator, arg); +} + +/* + * Iterate over all ports in bridge (using sysfs). + */ +int br_foreach_port(const char *brname, + int (*iterator)(const char *br, const char *port, void *arg), + void *arg) +{ + int i, count; + struct dirent **namelist; + char path[SYSFS_PATH_MAX]; + + snprintf(path, SYSFS_PATH_MAX, SYSFS_CLASS_NET "%s/brif", brname); + count = scandir(path, &namelist, 0, alphasort); + + for (i = 0; i < count; i++) { + if (namelist[i]->d_name[0] == '.' + && (namelist[i]->d_name[1] == '\0' + || (namelist[i]->d_name[1] == '.' + && namelist[i]->d_name[2] == '\0'))) + continue; + + if (iterator(brname, namelist[i]->d_name, arg)) + break; + } + for (i = 0; i < count; i++) + free(namelist[i]); + free(namelist); + + return count; +} + +#endif diff --git a/package/network/services/ead/src/libbridge_private.h b/package/network/services/ead/src/libbridge_private.h new file mode 100644 index 0000000000..38fd60ed9b --- /dev/null +++ b/package/network/services/ead/src/libbridge_private.h @@ -0,0 +1,35 @@ +/* + * Copyright (C) 2000 Lennert Buytenhek + * + * 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. + */ + +#ifndef _LIBBRIDGE_PRIVATE_H +#define _LIBBRIDGE_PRIVATE_H + +#include +#include +#include +#include + +#define MAX_BRIDGES 1024 +#define MAX_PORTS 1024 + +#define SYSFS_CLASS_NET "/sys/class/net/" +#define SYSFS_PATH_MAX 256 + +#define dprintf(fmt,arg...) + +#endif diff --git a/package/network/services/ead/src/list.h b/package/network/services/ead/src/list.h new file mode 100644 index 0000000000..ac429c862f --- /dev/null +++ b/package/network/services/ead/src/list.h @@ -0,0 +1,602 @@ +/* GPL v2, adapted from the Linux kernel */ +#ifndef _LINUX_LIST_H +#define _LINUX_LIST_H + +#include +/** + * container_of - cast a member of a structure out to the containing structure + * @ptr: the pointer to the member. + * @type: the type of the container struct this is embedded in. + * @member: the name of the member within the struct. + * + */ +#ifndef container_of +#define container_of(ptr, type, member) ( \ + (type *)( (char *)ptr - offsetof(type,member) )) +#endif + + +/* + * Simple doubly linked list implementation. + * + * Some of the internal functions ("__xxx") are useful when + * manipulating whole lists rather than single entries, as + * sometimes we already know the next/prev entries and we can + * generate better code by using them directly rather than + * using the generic single-entry routines. + */ + +struct list_head { + struct list_head *next, *prev; +}; + +#define LIST_HEAD_INIT(name) { &(name), &(name) } + +#define LIST_HEAD(name) \ + struct list_head name = LIST_HEAD_INIT(name) + +static inline void INIT_LIST_HEAD(struct list_head *list) +{ + list->next = list; + list->prev = list; +} + +/* + * Insert a new entry between two known consecutive entries. + * + * This is only for internal list manipulation where we know + * the prev/next entries already! + */ +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; +} + +/** + * list_add - add a new entry + * @new: new entry to be added + * @head: list head to add it after + * + * Insert a new entry after the specified head. + * This is good for implementing stacks. + */ +static inline void list_add(struct list_head *new, struct list_head *head) +{ + __list_add(new, head, head->next); +} + + +/** + * list_add_tail - add a new entry + * @new: new entry to be added + * @head: list head to add it before + * + * Insert a new entry before the specified head. + * This is useful for implementing queues. + */ +static inline void list_add_tail(struct list_head *new, struct list_head *head) +{ + __list_add(new, head->prev, head); +} + + +/* + * Delete a list entry by making the prev/next entries + * point to each other. + * + * This is only for internal list manipulation where we know + * the prev/next entries already! + */ +static inline void __list_del(struct list_head * prev, struct list_head * next) +{ + next->prev = prev; + prev->next = next; +} + +/** + * list_del - deletes entry from list. + * @entry: the element to delete from the list. + * Note: list_empty() on entry does not return true after this, the entry is + * in an undefined state. + */ +static inline void list_del(struct list_head *entry) +{ + __list_del(entry->prev, entry->next); + entry->next = NULL; + entry->prev = NULL; +} + +/** + * list_replace - replace old entry by new one + * @old : the element to be replaced + * @new : the new element to insert + * + * If @old was empty, it will be overwritten. + */ +static inline void list_replace(struct list_head *old, + struct list_head *new) +{ + new->next = old->next; + new->next->prev = new; + new->prev = old->prev; + new->prev->next = new; +} + +static inline void list_replace_init(struct list_head *old, + struct list_head *new) +{ + list_replace(old, new); + INIT_LIST_HEAD(old); +} + +/** + * list_del_init - deletes entry from list and reinitialize it. + * @entry: the element to delete from the list. + */ +static inline void list_del_init(struct list_head *entry) +{ + __list_del(entry->prev, entry->next); + INIT_LIST_HEAD(entry); +} + +/** + * list_move - delete from one list and add as another's head + * @list: the entry to move + * @head: the head that will precede our entry + */ +static inline void list_move(struct list_head *list, struct list_head *head) +{ + __list_del(list->prev, list->next); + list_add(list, head); +} + +/** + * list_move_tail - delete from one list and add as another's tail + * @list: the entry to move + * @head: the head that will follow our entry + */ +static inline void list_move_tail(struct list_head *list, + struct list_head *head) +{ + __list_del(list->prev, list->next); + list_add_tail(list, head); +} + +/** + * list_is_last - tests whether @list is the last entry in list @head + * @list: the entry to test + * @head: the head of the list + */ +static inline int list_is_last(const struct list_head *list, + const struct list_head *head) +{ + return list->next == head; +} + +/** + * list_empty - tests whether a list is empty + * @head: the list to test. + */ +static inline int list_empty(const struct list_head *head) +{ + return head->next == head; +} + +/** + * list_empty_careful - tests whether a list is empty and not being modified + * @head: the list to test + * + * Description: + * tests whether a list is empty _and_ checks that no other CPU might be + * in the process of modifying either member (next or prev) + * + * NOTE: using list_empty_careful() without synchronization + * can only be safe if the only activity that can happen + * to the list entry is list_del_init(). Eg. it cannot be used + * if another CPU could re-list_add() it. + */ +static inline int list_empty_careful(const struct list_head *head) +{ + struct list_head *next = head->next; + return (next == head) && (next == head->prev); +} + +static inline void __list_splice(struct list_head *list, + struct list_head *head) +{ + struct list_head *first = list->next; + struct list_head *last = list->prev; + struct list_head *at = head->next; + + first->prev = head; + head->next = first; + + last->next = at; + at->prev = last; +} + +/** + * list_splice - join two lists + * @list: the new list to add. + * @head: the place to add it in the first list. + */ +static inline void list_splice(struct list_head *list, struct list_head *head) +{ + if (!list_empty(list)) + __list_splice(list, head); +} + +/** + * list_splice_init - join two lists and reinitialise the emptied list. + * @list: the new list to add. + * @head: the place to add it in the first list. + * + * The list at @list is reinitialised + */ +static inline void list_splice_init(struct list_head *list, + struct list_head *head) +{ + if (!list_empty(list)) { + __list_splice(list, head); + INIT_LIST_HEAD(list); + } +} + +/** + * list_entry - get the struct for this entry + * @ptr: the &struct list_head pointer. + * @type: the type of the struct this is embedded in. + * @member: the name of the list_struct within the struct. + */ +#define list_entry(ptr, type, member) \ + container_of(ptr, type, member) + +/** + * list_first_entry - get the first element from a list + * @ptr: the list head to take the element from. + * @type: the type of the struct this is embedded in. + * @member: the name of the list_struct within the struct. + * + * Note, that list is expected to be not empty. + */ +#define list_first_entry(ptr, type, member) \ + list_entry((ptr)->next, type, member) + +/** + * list_for_each - iterate over a list + * @pos: the &struct list_head to use as a loop cursor. + * @head: the head for your list. + */ +#define list_for_each(pos, head) \ + for (pos = (head)->next; pos != (head); \ + pos = pos->next) + +/** + * __list_for_each - iterate over a list + * @pos: the &struct list_head to use as a loop cursor. + * @head: the head for your list. + * + * This variant differs from list_for_each() in that it's the + * simplest possible list iteration code, no prefetching is done. + * Use this for code that knows the list to be very short (empty + * or 1 entry) most of the time. + */ +#define __list_for_each(pos, head) \ + for (pos = (head)->next; pos != (head); pos = pos->next) + +/** + * list_for_each_prev - iterate over a list backwards + * @pos: the &struct list_head to use as a loop cursor. + * @head: the head for your list. + */ +#define list_for_each_prev(pos, head) \ + for (pos = (head)->prev; pos != (head); \ + pos = pos->prev) + +/** + * list_for_each_safe - iterate over a list safe against removal of list entry + * @pos: the &struct list_head to use as a loop cursor. + * @n: another &struct list_head to use as temporary storage + * @head: the head for your list. + */ +#define list_for_each_safe(pos, n, head) \ + for (pos = (head)->next, n = pos->next; pos != (head); \ + pos = n, n = pos->next) + +/** + * list_for_each_prev_safe - iterate over a list backwards safe against removal of list entry + * @pos: the &struct list_head to use as a loop cursor. + * @n: another &struct list_head to use as temporary storage + * @head: the head for your list. + */ +#define list_for_each_prev_safe(pos, n, head) \ + for (pos = (head)->prev, n = pos->prev; \ + pos != (head); \ + pos = n, n = pos->prev) + +/** + * list_for_each_entry - iterate over list of given type + * @pos: the type * to use as a loop cursor. + * @head: the head for your list. + * @member: the name of the list_struct within the struct. + */ +#define list_for_each_entry(pos, head, member) \ + for (pos = list_entry((head)->next, typeof(*pos), member); \ + &pos->member != (head); \ + pos = list_entry(pos->member.next, typeof(*pos), member)) + +/** + * list_for_each_entry_reverse - iterate backwards over list of given type. + * @pos: the type * to use as a loop cursor. + * @head: the head for your list. + * @member: the name of the list_struct within the struct. + */ +#define list_for_each_entry_reverse(pos, head, member) \ + for (pos = list_entry((head)->prev, typeof(*pos), member); \ + &pos->member != (head); \ + pos = list_entry(pos->member.prev, typeof(*pos), member)) + +/** + * list_prepare_entry - prepare a pos entry for use in list_for_each_entry_continue() + * @pos: the type * to use as a start point + * @head: the head of the list + * @member: the name of the list_struct within the struct. + * + * Prepares a pos entry for use as a start point in list_for_each_entry_continue(). + */ +#define list_prepare_entry(pos, head, member) \ + ((pos) ? : list_entry(head, typeof(*pos), member)) + +/** + * list_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. + * @member: the name of the list_struct within the struct. + * + * Continue to iterate over list of given type, continuing after + * the current position. + */ +#define list_for_each_entry_continue(pos, head, member) \ + for (pos = list_entry(pos->member.next, typeof(*pos), member); \ + &pos->member != (head); \ + pos = list_entry(pos->member.next, typeof(*pos), member)) + +/** + * list_for_each_entry_continue_reverse - iterate backwards from the given point + * @pos: the type * to use as a loop cursor. + * @head: the head for your list. + * @member: the name of the list_struct within the struct. + * + * Start to iterate over list of given type backwards, continuing after + * the current position. + */ +#define list_for_each_entry_continue_reverse(pos, head, member) \ + for (pos = list_entry(pos->member.prev, typeof(*pos), member); \ + &pos->member != (head); \ + pos = list_entry(pos->member.prev, typeof(*pos), member)) + +/** + * list_for_each_entry_from - iterate over list of given type from the current point + * @pos: the type * to use as a loop cursor. + * @head: the head for your list. + * @member: the name of the list_struct within the struct. + * + * Iterate over list of given type, continuing from current position. + */ +#define list_for_each_entry_from(pos, head, member) \ + for (; &pos->member != (head); \ + pos = list_entry(pos->member.next, typeof(*pos), member)) + +/** + * list_for_each_entry_safe - iterate over list of given type safe against removal of list entry + * @pos: the type * to use as a loop cursor. + * @n: another type * to use as temporary storage + * @head: the head for your list. + * @member: the name of the list_struct within the struct. + */ +#define list_for_each_entry_safe(pos, n, head, member) \ + for (pos = list_entry((head)->next, typeof(*pos), member), \ + n = list_entry(pos->member.next, typeof(*pos), member); \ + &pos->member != (head); \ + pos = n, n = list_entry(n->member.next, typeof(*n), member)) + +/** + * list_for_each_entry_safe_continue + * @pos: the type * to use as a loop cursor. + * @n: another type * to use as temporary storage + * @head: the head for your list. + * @member: the name of the list_struct within the struct. + * + * Iterate over list of given type, continuing after current point, + * safe against removal of list entry. + */ +#define list_for_each_entry_safe_continue(pos, n, head, member) \ + for (pos = list_entry(pos->member.next, typeof(*pos), member), \ + n = list_entry(pos->member.next, typeof(*pos), member); \ + &pos->member != (head); \ + pos = n, n = list_entry(n->member.next, typeof(*n), member)) + +/** + * list_for_each_entry_safe_from + * @pos: the type * to use as a loop cursor. + * @n: another type * to use as temporary storage + * @head: the head for your list. + * @member: the name of the list_struct within the struct. + * + * Iterate over list of given type from current point, safe against + * removal of list entry. + */ +#define list_for_each_entry_safe_from(pos, n, head, member) \ + for (n = list_entry(pos->member.next, typeof(*pos), member); \ + &pos->member != (head); \ + pos = n, n = list_entry(n->member.next, typeof(*n), member)) + +/** + * list_for_each_entry_safe_reverse + * @pos: the type * to use as a loop cursor. + * @n: another type * to use as temporary storage + * @head: the head for your list. + * @member: the name of the list_struct within the struct. + * + * Iterate backwards over list of given type, safe against removal + * of list entry. + */ +#define list_for_each_entry_safe_reverse(pos, n, head, member) \ + for (pos = list_entry((head)->prev, typeof(*pos), member), \ + n = list_entry(pos->member.prev, typeof(*pos), member); \ + &pos->member != (head); \ + pos = n, n = list_entry(n->member.prev, typeof(*n), member)) + +/* + * Double linked lists with a single pointer list head. + * Mostly useful for hash tables where the two pointer list head is + * too wasteful. + * You lose the ability to access the tail in O(1). + */ + +struct hlist_head { + struct hlist_node *first; +}; + +struct hlist_node { + struct hlist_node *next, **pprev; +}; + +#define HLIST_HEAD_INIT { .first = NULL } +#define HLIST_HEAD(name) struct hlist_head name = { .first = NULL } +#define INIT_HLIST_HEAD(ptr) ((ptr)->first = NULL) +static inline void INIT_HLIST_NODE(struct hlist_node *h) +{ + h->next = NULL; + h->pprev = NULL; +} + +static inline int hlist_unhashed(const struct hlist_node *h) +{ + return !h->pprev; +} + +static inline int hlist_empty(const struct hlist_head *h) +{ + return !h->first; +} + +static inline void __hlist_del(struct hlist_node *n) +{ + struct hlist_node *next = n->next; + struct hlist_node **pprev = n->pprev; + *pprev = next; + if (next) + next->pprev = pprev; +} + +static inline void hlist_del(struct hlist_node *n) +{ + __hlist_del(n); + n->next = NULL; + n->pprev = NULL; +} + +static inline void hlist_del_init(struct hlist_node *n) +{ + if (!hlist_unhashed(n)) { + __hlist_del(n); + INIT_HLIST_NODE(n); + } +} + + +static inline void hlist_add_head(struct hlist_node *n, struct hlist_head *h) +{ + struct hlist_node *first = h->first; + n->next = first; + if (first) + first->pprev = &n->next; + h->first = n; + n->pprev = &h->first; +} + + +/* next must be != NULL */ +static inline void hlist_add_before(struct hlist_node *n, + struct hlist_node *next) +{ + n->pprev = next->pprev; + n->next = next; + next->pprev = &n->next; + *(n->pprev) = n; +} + +static inline void hlist_add_after(struct hlist_node *n, + struct hlist_node *next) +{ + next->next = n->next; + n->next = next; + next->pprev = &n->next; + + if(next->next) + next->next->pprev = &next->next; +} + +#define hlist_entry(ptr, type, member) container_of(ptr,type,member) + +#define hlist_for_each(pos, head) \ + for (pos = (head)->first; pos; pos = pos->next) + +#define hlist_for_each_safe(pos, n, head) \ + for (pos = (head)->first; pos; pos = n) + +/** + * hlist_for_each_entry - iterate over list of given type + * @tpos: the type * to use as a loop cursor. + * @pos: the &struct hlist_node to use as a loop cursor. + * @head: the head for your list. + * @member: the name of the hlist_node within the struct. + */ +#define hlist_for_each_entry(tpos, pos, head, member) \ + for (pos = (head)->first; pos && \ + ({ tpos = hlist_entry(pos, typeof(*tpos), member); 1;}); \ + pos = pos->next) + +/** + * hlist_for_each_entry_continue - iterate over a hlist continuing after current point + * @tpos: the type * to use as a loop cursor. + * @pos: the &struct hlist_node to use as a loop cursor. + * @member: the name of the hlist_node within the struct. + */ +#define hlist_for_each_entry_continue(tpos, pos, member) \ + for (pos = (pos)->next; pos && \ + ({ tpos = hlist_entry(pos, typeof(*tpos), member); 1;}); \ + pos = pos->next) + +/** + * hlist_for_each_entry_from - iterate over a hlist continuing from current point + * @tpos: the type * to use as a loop cursor. + * @pos: the &struct hlist_node to use as a loop cursor. + * @member: the name of the hlist_node within the struct. + */ +#define hlist_for_each_entry_from(tpos, pos, member) \ + for (; pos && \ + ({ tpos = hlist_entry(pos, typeof(*tpos), member); 1;}); \ + pos = pos->next) + +/** + * hlist_for_each_entry_safe - iterate over list of given type safe against removal of list entry + * @tpos: the type * to use as a loop cursor. + * @pos: the &struct hlist_node to use as a loop cursor. + * @n: another &struct hlist_node to use as temporary storage + * @head: the head for your list. + * @member: the name of the hlist_node within the struct. + */ +#define hlist_for_each_entry_safe(tpos, pos, n, head, member) \ + for (pos = (head)->first; \ + pos && ({ n = pos->next; 1; }) && \ + ({ tpos = hlist_entry(pos, typeof(*tpos), member); 1;}); \ + pos = n) + +#endif diff --git a/package/network/services/ead/src/passwd b/package/network/services/ead/src/passwd new file mode 100644 index 0000000000..eee7a89486 --- /dev/null +++ b/package/network/services/ead/src/passwd @@ -0,0 +1,3 @@ +root:$1$MCGAgYw.$Ip1GcyeUliId3wzVcKR/e/:0:0:root:/root:/bin/ash +nobody:*:65534:65534:nobody:/var:/bin/false +daemon:*:65534:65534:daemon:/var:/bin/false diff --git a/package/network/services/ead/src/pfc.c b/package/network/services/ead/src/pfc.c new file mode 100644 index 0000000000..e53cbd1524 --- /dev/null +++ b/package/network/services/ead/src/pfc.c @@ -0,0 +1,54 @@ +/* + * Small pcap precompiler + * Copyright (C) 2008 Felix Fietkau + * + * 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 +#include +#include +#include +#include + +int main (int argc, char ** argv) +{ + struct bpf_program filter; + pcap_t *pc; + int i; + + if (argc != 2) + { + printf ("Usage: %s \n", argv[0]); + return 1; + } + + pc = pcap_open_dead(DLT_EN10MB, 1500); + if (pcap_compile(pc, &filter, argv[1], 1, 0) != 0) { + printf("error in active-filter expression: %s\n", pcap_geterr(pc)); + return 1; + } + + printf("/* precompiled expression: %s */\n\n" + "static struct bpf_insn pktfilter_insns[] = {\n", + argv[1]); + + for (i = 0; i < filter.bf_len; i++) { + struct bpf_insn *in = &filter.bf_insns[i]; + printf("\t{ .code = 0x%04x, .jt = 0x%02x, .jf = 0x%02x, .k = 0x%08x },\n", in->code, in->jt, in->jf, in->k); + } + printf("};\n\n" + "static struct bpf_program pktfilter = {\n" + "\t.bf_len = %d,\n" + "\t.bf_insns = pktfilter_insns,\n" + "};\n", filter.bf_len); + return 0; + +} diff --git a/package/network/services/ead/src/pw_encrypt_md5.c b/package/network/services/ead/src/pw_encrypt_md5.c new file mode 100644 index 0000000000..bc9f249fda --- /dev/null +++ b/package/network/services/ead/src/pw_encrypt_md5.c @@ -0,0 +1,646 @@ +/* + * MD5C.C - RSA Data Security, Inc., MD5 message-digest algorithm + * + * Copyright (C) 1991-2, RSA Data Security, Inc. Created 1991. All + * rights reserved. + * + * License to copy and use this software is granted provided that it + * is identified as the "RSA Data Security, Inc. MD5 Message-Digest + * Algorithm" in all material mentioning or referencing this software + * or this function. + * + * License is also granted to make and use derivative works provided + * that such works are identified as "derived from the RSA Data + * Security, Inc. MD5 Message-Digest Algorithm" in all material + * mentioning or referencing the derived work. + * + * RSA Data Security, Inc. makes no representations concerning either + * the merchantability of this software or the suitability of this + * software for any particular purpose. It is provided "as is" + * without express or implied warranty of any kind. + * + * These notices must be retained in any copies of any part of this + * documentation and/or software. + * + * $FreeBSD: src/lib/libmd/md5c.c,v 1.9.2.1 1999/08/29 14:57:12 peter Exp $ + * + * This code is the same as the code published by RSA Inc. It has been + * edited for clarity and style only. + * + * ---------------------------------------------------------------------------- + * The md5_crypt() function was taken from freeBSD's libcrypt and contains + * this license: + * "THE BEER-WARE LICENSE" (Revision 42): + * wrote this file. As long as you retain this notice you + * can do whatever you want with this stuff. If we meet some day, and you think + * this stuff is worth it, you can buy me a beer in return. Poul-Henning Kamp + * + * $FreeBSD: src/lib/libcrypt/crypt.c,v 1.7.2.1 1999/08/29 14:56:33 peter Exp $ + * + * ---------------------------------------------------------------------------- + * On April 19th, 2001 md5_crypt() was modified to make it reentrant + * by Erik Andersen + * + * + * June 28, 2001 Manuel Novoa III + * + * "Un-inlined" code using loops and static const tables in order to + * reduce generated code size (on i386 from approx 4k to approx 2.5k). + * + * June 29, 2001 Manuel Novoa III + * + * Completely removed static PADDING array. + * + * Reintroduced the loop unrolling in MD5_Transform and added the + * MD5_SIZE_OVER_SPEED option for configurability. Define below as: + * 0 fully unrolled loops + * 1 partially unrolled (4 ops per loop) + * 2 no unrolling -- introduces the need to swap 4 variables (slow) + * 3 no unrolling and all 4 loops merged into one with switch + * in each loop (glacial) + * On i386, sizes are roughly (-Os -fno-builtin): + * 0: 3k 1: 2.5k 2: 2.2k 3: 2k + * + * + * Since SuSv3 does not require crypt_r, modified again August 7, 2002 + * by Erik Andersen to remove reentrance stuff... + */ + +static const uint8_t ascii64[] = "./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"; + +/* + * Valid values are 1 (fastest/largest) to 3 (smallest/slowest). + */ +#define MD5_SIZE_OVER_SPEED 3 + +/**********************************************************************/ + +/* MD5 context. */ +struct MD5Context { + uint32_t state[4]; /* state (ABCD) */ + uint32_t count[2]; /* number of bits, modulo 2^64 (lsb first) */ + unsigned char buffer[64]; /* input buffer */ +}; + +static void __md5_Init(struct MD5Context *); +static void __md5_Update(struct MD5Context *, const unsigned char *, unsigned int); +static void __md5_Pad(struct MD5Context *); +static void __md5_Final(unsigned char [16], struct MD5Context *); +static void __md5_Transform(uint32_t [4], const unsigned char [64]); + + +#define MD5_MAGIC_STR "$1$" +#define MD5_MAGIC_LEN (sizeof(MD5_MAGIC_STR) - 1) +static const unsigned char __md5__magic[] = MD5_MAGIC_STR; + + +#ifdef i386 +#define __md5_Encode memcpy +#define __md5_Decode memcpy +#else /* i386 */ + +/* + * __md5_Encodes input (uint32_t) into output (unsigned char). Assumes len is + * a multiple of 4. + */ +static void +__md5_Encode(unsigned char *output, uint32_t *input, unsigned int len) +{ + unsigned int i, j; + + for (i = 0, j = 0; j < len; i++, j += 4) { + output[j] = input[i]; + output[j+1] = (input[i] >> 8); + output[j+2] = (input[i] >> 16); + output[j+3] = (input[i] >> 24); + } +} + +/* + * __md5_Decodes input (unsigned char) into output (uint32_t). Assumes len is + * a multiple of 4. + */ +static void +__md5_Decode(uint32_t *output, const unsigned char *input, unsigned int len) +{ + unsigned int i, j; + + for (i = 0, j = 0; j < len; i++, j += 4) + output[i] = ((uint32_t)input[j]) | (((uint32_t)input[j+1]) << 8) | + (((uint32_t)input[j+2]) << 16) | (((uint32_t)input[j+3]) << 24); +} +#endif /* i386 */ + +/* F, G, H and I are basic MD5 functions. */ +#define F(x, y, z) (((x) & (y)) | (~(x) & (z))) +#define G(x, y, z) (((x) & (z)) | ((y) & ~(z))) +#define H(x, y, z) ((x) ^ (y) ^ (z)) +#define I(x, y, z) ((y) ^ ((x) | ~(z))) + +/* ROTATE_LEFT rotates x left n bits. */ +#define ROTATE_LEFT(x, n) (((x) << (n)) | ((x) >> (32-(n)))) + +/* + * FF, GG, HH, and II transformations for rounds 1, 2, 3, and 4. + * Rotation is separate from addition to prevent recomputation. + */ +#define FF(a, b, c, d, x, s, ac) { \ + (a) += F ((b), (c), (d)) + (x) + (uint32_t)(ac); \ + (a) = ROTATE_LEFT((a), (s)); \ + (a) += (b); \ + } +#define GG(a, b, c, d, x, s, ac) { \ + (a) += G ((b), (c), (d)) + (x) + (uint32_t)(ac); \ + (a) = ROTATE_LEFT((a), (s)); \ + (a) += (b); \ + } +#define HH(a, b, c, d, x, s, ac) { \ + (a) += H ((b), (c), (d)) + (x) + (uint32_t)(ac); \ + (a) = ROTATE_LEFT((a), (s)); \ + (a) += (b); \ + } +#define II(a, b, c, d, x, s, ac) { \ + (a) += I ((b), (c), (d)) + (x) + (uint32_t)(ac); \ + (a) = ROTATE_LEFT((a), (s)); \ + (a) += (b); \ + } + +/* MD5 initialization. Begins an MD5 operation, writing a new context. */ +static void __md5_Init(struct MD5Context *context) +{ + context->count[0] = context->count[1] = 0; + + /* Load magic initialization constants. */ + context->state[0] = 0x67452301; + context->state[1] = 0xefcdab89; + context->state[2] = 0x98badcfe; + context->state[3] = 0x10325476; +} + +/* + * MD5 block update operation. Continues an MD5 message-digest + * operation, processing another message block, and updating the + * context. + */ +static void __md5_Update(struct MD5Context *context, const unsigned char *input, unsigned int inputLen) +{ + unsigned int i, idx, partLen; + + /* Compute number of bytes mod 64 */ + idx = (context->count[0] >> 3) & 0x3F; + + /* Update number of bits */ + context->count[0] += (inputLen << 3); + if (context->count[0] < (inputLen << 3)) + context->count[1]++; + context->count[1] += (inputLen >> 29); + + partLen = 64 - idx; + + /* Transform as many times as possible. */ + if (inputLen >= partLen) { + memcpy(&context->buffer[idx], input, partLen); + __md5_Transform(context->state, context->buffer); + + for (i = partLen; i + 63 < inputLen; i += 64) + __md5_Transform(context->state, &input[i]); + + idx = 0; + } else + i = 0; + + /* Buffer remaining input */ + memcpy(&context->buffer[idx], &input[i], inputLen - i); +} + +/* + * MD5 padding. Adds padding followed by original length. + */ +static void __md5_Pad(struct MD5Context *context) +{ + unsigned char bits[8]; + unsigned int idx, padLen; + unsigned char PADDING[64]; + + memset(PADDING, 0, sizeof(PADDING)); + PADDING[0] = 0x80; + + /* Save number of bits */ + __md5_Encode(bits, context->count, 8); + + /* Pad out to 56 mod 64. */ + idx = (context->count[0] >> 3) & 0x3f; + padLen = (idx < 56) ? (56 - idx) : (120 - idx); + __md5_Update(context, PADDING, padLen); + + /* Append length (before padding) */ + __md5_Update(context, bits, 8); +} + +/* + * MD5 finalization. Ends an MD5 message-digest operation, writing the + * the message digest and zeroizing the context. + */ +static void __md5_Final(unsigned char digest[16], struct MD5Context *context) +{ + /* Do padding. */ + __md5_Pad(context); + + /* Store state in digest */ + __md5_Encode(digest, context->state, 16); + + /* Zeroize sensitive information. */ + memset(context, 0, sizeof(*context)); +} + +/* MD5 basic transformation. Transforms state based on block. */ +static void __md5_Transform(uint32_t state[4], const unsigned char block[64]) +{ + uint32_t a, b, c, d, x[16]; +#if MD5_SIZE_OVER_SPEED > 1 + uint32_t temp; + const unsigned char *ps; + + static const unsigned char S[] = { + 7, 12, 17, 22, + 5, 9, 14, 20, + 4, 11, 16, 23, + 6, 10, 15, 21 + }; +#endif /* MD5_SIZE_OVER_SPEED > 1 */ + +#if MD5_SIZE_OVER_SPEED > 0 + const uint32_t *pc; + const unsigned char *pp; + int i; + + static const uint32_t C[] = { + /* round 1 */ + 0xd76aa478, 0xe8c7b756, 0x242070db, 0xc1bdceee, + 0xf57c0faf, 0x4787c62a, 0xa8304613, 0xfd469501, + 0x698098d8, 0x8b44f7af, 0xffff5bb1, 0x895cd7be, + 0x6b901122, 0xfd987193, 0xa679438e, 0x49b40821, + /* round 2 */ + 0xf61e2562, 0xc040b340, 0x265e5a51, 0xe9b6c7aa, + 0xd62f105d, 0x2441453, 0xd8a1e681, 0xe7d3fbc8, + 0x21e1cde6, 0xc33707d6, 0xf4d50d87, 0x455a14ed, + 0xa9e3e905, 0xfcefa3f8, 0x676f02d9, 0x8d2a4c8a, + /* round 3 */ + 0xfffa3942, 0x8771f681, 0x6d9d6122, 0xfde5380c, + 0xa4beea44, 0x4bdecfa9, 0xf6bb4b60, 0xbebfbc70, + 0x289b7ec6, 0xeaa127fa, 0xd4ef3085, 0x4881d05, + 0xd9d4d039, 0xe6db99e5, 0x1fa27cf8, 0xc4ac5665, + /* round 4 */ + 0xf4292244, 0x432aff97, 0xab9423a7, 0xfc93a039, + 0x655b59c3, 0x8f0ccc92, 0xffeff47d, 0x85845dd1, + 0x6fa87e4f, 0xfe2ce6e0, 0xa3014314, 0x4e0811a1, + 0xf7537e82, 0xbd3af235, 0x2ad7d2bb, 0xeb86d391 + }; + + static const unsigned char P[] = { + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, /* 1 */ + 1, 6, 11, 0, 5, 10, 15, 4, 9, 14, 3, 8, 13, 2, 7, 12, /* 2 */ + 5, 8, 11, 14, 1, 4, 7, 10, 13, 0, 3, 6, 9, 12, 15, 2, /* 3 */ + 0, 7, 14, 5, 12, 3, 10, 1, 8, 15, 6, 13, 4, 11, 2, 9 /* 4 */ + }; + +#endif /* MD5_SIZE_OVER_SPEED > 0 */ + + __md5_Decode(x, block, 64); + + a = state[0]; b = state[1]; c = state[2]; d = state[3]; + +#if MD5_SIZE_OVER_SPEED > 2 + pc = C; pp = P; ps = S - 4; + + for (i = 0; i < 64; i++) { + if ((i & 0x0f) == 0) ps += 4; + temp = a; + switch (i>>4) { + case 0: + temp += F(b, c, d); + break; + case 1: + temp += G(b, c, d); + break; + case 2: + temp += H(b, c, d); + break; + case 3: + temp += I(b, c, d); + break; + } + temp += x[*pp++] + *pc++; + temp = ROTATE_LEFT(temp, ps[i & 3]); + temp += b; + a = d; d = c; c = b; b = temp; + } +#elif MD5_SIZE_OVER_SPEED > 1 + pc = C; pp = P; ps = S; + + /* Round 1 */ + for (i = 0; i < 16; i++) { + FF(a, b, c, d, x[*pp], ps[i & 0x3], *pc); pp++; pc++; + temp = d; d = c; c = b; b = a; a = temp; + } + + /* Round 2 */ + ps += 4; + for (; i < 32; i++) { + GG(a, b, c, d, x[*pp], ps[i & 0x3], *pc); pp++; pc++; + temp = d; d = c; c = b; b = a; a = temp; + } + /* Round 3 */ + ps += 4; + for (; i < 48; i++) { + HH(a, b, c, d, x[*pp], ps[i & 0x3], *pc); pp++; pc++; + temp = d; d = c; c = b; b = a; a = temp; + } + + /* Round 4 */ + ps += 4; + for (; i < 64; i++) { + II(a, b, c, d, x[*pp], ps[i & 0x3], *pc); pp++; pc++; + temp = d; d = c; c = b; b = a; a = temp; + } +#elif MD5_SIZE_OVER_SPEED > 0 + pc = C; pp = P; + + /* Round 1 */ + for (i = 0; i < 4; i++) { + FF(a, b, c, d, x[*pp], 7, *pc); pp++; pc++; + FF(d, a, b, c, x[*pp], 12, *pc); pp++; pc++; + FF(c, d, a, b, x[*pp], 17, *pc); pp++; pc++; + FF(b, c, d, a, x[*pp], 22, *pc); pp++; pc++; + } + + /* Round 2 */ + for (i = 0; i < 4; i++) { + GG(a, b, c, d, x[*pp], 5, *pc); pp++; pc++; + GG(d, a, b, c, x[*pp], 9, *pc); pp++; pc++; + GG(c, d, a, b, x[*pp], 14, *pc); pp++; pc++; + GG(b, c, d, a, x[*pp], 20, *pc); pp++; pc++; + } + /* Round 3 */ + for (i = 0; i < 4; i++) { + HH(a, b, c, d, x[*pp], 4, *pc); pp++; pc++; + HH(d, a, b, c, x[*pp], 11, *pc); pp++; pc++; + HH(c, d, a, b, x[*pp], 16, *pc); pp++; pc++; + HH(b, c, d, a, x[*pp], 23, *pc); pp++; pc++; + } + + /* Round 4 */ + for (i = 0; i < 4; i++) { + II(a, b, c, d, x[*pp], 6, *pc); pp++; pc++; + II(d, a, b, c, x[*pp], 10, *pc); pp++; pc++; + II(c, d, a, b, x[*pp], 15, *pc); pp++; pc++; + II(b, c, d, a, x[*pp], 21, *pc); pp++; pc++; + } +#else + /* Round 1 */ +#define S11 7 +#define S12 12 +#define S13 17 +#define S14 22 + FF(a, b, c, d, x[ 0], S11, 0xd76aa478); /* 1 */ + FF(d, a, b, c, x[ 1], S12, 0xe8c7b756); /* 2 */ + FF(c, d, a, b, x[ 2], S13, 0x242070db); /* 3 */ + FF(b, c, d, a, x[ 3], S14, 0xc1bdceee); /* 4 */ + FF(a, b, c, d, x[ 4], S11, 0xf57c0faf); /* 5 */ + FF(d, a, b, c, x[ 5], S12, 0x4787c62a); /* 6 */ + FF(c, d, a, b, x[ 6], S13, 0xa8304613); /* 7 */ + FF(b, c, d, a, x[ 7], S14, 0xfd469501); /* 8 */ + FF(a, b, c, d, x[ 8], S11, 0x698098d8); /* 9 */ + FF(d, a, b, c, x[ 9], S12, 0x8b44f7af); /* 10 */ + FF(c, d, a, b, x[10], S13, 0xffff5bb1); /* 11 */ + FF(b, c, d, a, x[11], S14, 0x895cd7be); /* 12 */ + FF(a, b, c, d, x[12], S11, 0x6b901122); /* 13 */ + FF(d, a, b, c, x[13], S12, 0xfd987193); /* 14 */ + FF(c, d, a, b, x[14], S13, 0xa679438e); /* 15 */ + FF(b, c, d, a, x[15], S14, 0x49b40821); /* 16 */ + + /* Round 2 */ +#define S21 5 +#define S22 9 +#define S23 14 +#define S24 20 + GG(a, b, c, d, x[ 1], S21, 0xf61e2562); /* 17 */ + GG(d, a, b, c, x[ 6], S22, 0xc040b340); /* 18 */ + GG(c, d, a, b, x[11], S23, 0x265e5a51); /* 19 */ + GG(b, c, d, a, x[ 0], S24, 0xe9b6c7aa); /* 20 */ + GG(a, b, c, d, x[ 5], S21, 0xd62f105d); /* 21 */ + GG(d, a, b, c, x[10], S22, 0x2441453); /* 22 */ + GG(c, d, a, b, x[15], S23, 0xd8a1e681); /* 23 */ + GG(b, c, d, a, x[ 4], S24, 0xe7d3fbc8); /* 24 */ + GG(a, b, c, d, x[ 9], S21, 0x21e1cde6); /* 25 */ + GG(d, a, b, c, x[14], S22, 0xc33707d6); /* 26 */ + GG(c, d, a, b, x[ 3], S23, 0xf4d50d87); /* 27 */ + GG(b, c, d, a, x[ 8], S24, 0x455a14ed); /* 28 */ + GG(a, b, c, d, x[13], S21, 0xa9e3e905); /* 29 */ + GG(d, a, b, c, x[ 2], S22, 0xfcefa3f8); /* 30 */ + GG(c, d, a, b, x[ 7], S23, 0x676f02d9); /* 31 */ + GG(b, c, d, a, x[12], S24, 0x8d2a4c8a); /* 32 */ + + /* Round 3 */ +#define S31 4 +#define S32 11 +#define S33 16 +#define S34 23 + HH(a, b, c, d, x[ 5], S31, 0xfffa3942); /* 33 */ + HH(d, a, b, c, x[ 8], S32, 0x8771f681); /* 34 */ + HH(c, d, a, b, x[11], S33, 0x6d9d6122); /* 35 */ + HH(b, c, d, a, x[14], S34, 0xfde5380c); /* 36 */ + HH(a, b, c, d, x[ 1], S31, 0xa4beea44); /* 37 */ + HH(d, a, b, c, x[ 4], S32, 0x4bdecfa9); /* 38 */ + HH(c, d, a, b, x[ 7], S33, 0xf6bb4b60); /* 39 */ + HH(b, c, d, a, x[10], S34, 0xbebfbc70); /* 40 */ + HH(a, b, c, d, x[13], S31, 0x289b7ec6); /* 41 */ + HH(d, a, b, c, x[ 0], S32, 0xeaa127fa); /* 42 */ + HH(c, d, a, b, x[ 3], S33, 0xd4ef3085); /* 43 */ + HH(b, c, d, a, x[ 6], S34, 0x4881d05); /* 44 */ + HH(a, b, c, d, x[ 9], S31, 0xd9d4d039); /* 45 */ + HH(d, a, b, c, x[12], S32, 0xe6db99e5); /* 46 */ + HH(c, d, a, b, x[15], S33, 0x1fa27cf8); /* 47 */ + HH(b, c, d, a, x[ 2], S34, 0xc4ac5665); /* 48 */ + + /* Round 4 */ +#define S41 6 +#define S42 10 +#define S43 15 +#define S44 21 + II(a, b, c, d, x[ 0], S41, 0xf4292244); /* 49 */ + II(d, a, b, c, x[ 7], S42, 0x432aff97); /* 50 */ + II(c, d, a, b, x[14], S43, 0xab9423a7); /* 51 */ + II(b, c, d, a, x[ 5], S44, 0xfc93a039); /* 52 */ + II(a, b, c, d, x[12], S41, 0x655b59c3); /* 53 */ + II(d, a, b, c, x[ 3], S42, 0x8f0ccc92); /* 54 */ + II(c, d, a, b, x[10], S43, 0xffeff47d); /* 55 */ + II(b, c, d, a, x[ 1], S44, 0x85845dd1); /* 56 */ + II(a, b, c, d, x[ 8], S41, 0x6fa87e4f); /* 57 */ + II(d, a, b, c, x[15], S42, 0xfe2ce6e0); /* 58 */ + II(c, d, a, b, x[ 6], S43, 0xa3014314); /* 59 */ + II(b, c, d, a, x[13], S44, 0x4e0811a1); /* 60 */ + II(a, b, c, d, x[ 4], S41, 0xf7537e82); /* 61 */ + II(d, a, b, c, x[11], S42, 0xbd3af235); /* 62 */ + II(c, d, a, b, x[ 2], S43, 0x2ad7d2bb); /* 63 */ + II(b, c, d, a, x[ 9], S44, 0xeb86d391); /* 64 */ +#endif + + state[0] += a; + state[1] += b; + state[2] += c; + state[3] += d; + + /* Zeroize sensitive information. */ + memset(x, 0, sizeof(x)); +} + + +static char* +__md5_to64(char *s, unsigned v, int n) +{ + while (--n >= 0) { + *s++ = ascii64[v & 0x3f]; + v >>= 6; + } + return s; +} + +/* + * UNIX password + * + * Use MD5 for what it is best at... + */ +#define MD5_OUT_BUFSIZE 36 +static char * +md5_crypt(char passwd[MD5_OUT_BUFSIZE], const unsigned char *pw, const unsigned char *salt) +{ + const unsigned char *sp, *ep; + char *p; + unsigned char final[17]; /* final[16] exists only to aid in looping */ + int sl, pl, i, pw_len; + struct MD5Context ctx, ctx1; + + /* Refine the Salt first */ + sp = salt; + + sp += MD5_MAGIC_LEN; + + /* It stops at the first '$', max 8 chars */ + for (ep = sp; *ep && *ep != '$' && ep < (sp+8); ep++) + continue; + + /* get the length of the true salt */ + sl = ep - sp; + + __md5_Init(&ctx); + + /* The password first, since that is what is most unknown */ + pw_len = strlen((char*)pw); + __md5_Update(&ctx, pw, pw_len); + + /* Then our magic string */ + __md5_Update(&ctx, __md5__magic, MD5_MAGIC_LEN); + + /* Then the raw salt */ + __md5_Update(&ctx, sp, sl); + + /* Then just as many characters of the MD5(pw, salt, pw) */ + __md5_Init(&ctx1); + __md5_Update(&ctx1, pw, pw_len); + __md5_Update(&ctx1, sp, sl); + __md5_Update(&ctx1, pw, pw_len); + __md5_Final(final, &ctx1); + for (pl = pw_len; pl > 0; pl -= 16) + __md5_Update(&ctx, final, pl > 16 ? 16 : pl); + + /* Don't leave anything around in vm they could use. */ +//TODO: the above comment seems to be wrong. final is used later. + memset(final, 0, sizeof(final)); + + /* Then something really weird... */ + for (i = pw_len; i; i >>= 1) { + __md5_Update(&ctx, ((i & 1) ? final : (const unsigned char *) pw), 1); + } + + /* Now make the output string */ + passwd[0] = '$'; + passwd[1] = '1'; + passwd[2] = '$'; + strncpy(passwd + 3, (char*)sp, sl); + passwd[sl + 3] = '$'; + + __md5_Final(final, &ctx); + + /* + * and now, just to make sure things don't run too fast + * On a 60 Mhz Pentium this takes 34 msec, so you would + * need 30 seconds to build a 1000 entry dictionary... + */ + for (i = 0; i < 1000; i++) { + __md5_Init(&ctx1); + if (i & 1) + __md5_Update(&ctx1, pw, pw_len); + else + __md5_Update(&ctx1, final, 16); + + if (i % 3) + __md5_Update(&ctx1, sp, sl); + + if (i % 7) + __md5_Update(&ctx1, pw, pw_len); + + if (i & 1) + __md5_Update(&ctx1, final, 16); + else + __md5_Update(&ctx1, pw, pw_len); + __md5_Final(final, &ctx1); + } + + p = passwd + sl + 4; /* 12 bytes max (sl is up to 8 bytes) */ + + /* Add 5*4+2 = 22 bytes of hash, + NUL byte. */ + final[16] = final[5]; + for (i = 0; i < 5; i++) { + unsigned l = (final[i] << 16) | (final[i+6] << 8) | final[i+12]; + p = __md5_to64(p, l, 4); + } + p = __md5_to64(p, final[11], 2); + *p = '\0'; + + /* Don't leave anything around in vm they could use. */ + memset(final, 0, sizeof(final)); + + return passwd; +} + +#undef MD5_SIZE_OVER_SPEED +#undef MD5_MAGIC_STR +#undef MD5_MAGIC_LEN +#undef __md5_Encode +#undef __md5_Decode +#undef F +#undef G +#undef H +#undef I +#undef ROTATE_LEFT +#undef FF +#undef GG +#undef HH +#undef II +#undef S11 +#undef S12 +#undef S13 +#undef S14 +#undef S21 +#undef S22 +#undef S23 +#undef S24 +#undef S31 +#undef S32 +#undef S33 +#undef S34 +#undef S41 +#undef S42 +#undef S43 +#undef S44 diff --git a/package/network/services/ead/src/sha1.c b/package/network/services/ead/src/sha1.c new file mode 100644 index 0000000000..3683a7da71 --- /dev/null +++ b/package/network/services/ead/src/sha1.c @@ -0,0 +1,104 @@ +/* + * SHA transform algorithm, originally taken from code written by + * Peter Gutmann, and placed in the public domain. + */ + +static uint32_t +rol32(uint32_t word, int shift) +{ + return (word << shift) | (word >> (32 - shift)); +} + +/* The SHA f()-functions. */ + +#define f1(x,y,z) (z ^ (x & (y ^ z))) /* x ? y : z */ +#define f2(x,y,z) (x ^ y ^ z) /* XOR */ +#define f3(x,y,z) ((x & y) + (z & (x ^ y))) /* majority */ + +/* The SHA Mysterious Constants */ + +#define K1 0x5A827999L /* Rounds 0-19: sqrt(2) * 2^30 */ +#define K2 0x6ED9EBA1L /* Rounds 20-39: sqrt(3) * 2^30 */ +#define K3 0x8F1BBCDCL /* Rounds 40-59: sqrt(5) * 2^30 */ +#define K4 0xCA62C1D6L /* Rounds 60-79: sqrt(10) * 2^30 */ + +/** + * sha_transform - single block SHA1 transform + * + * @digest: 160 bit digest to update + * @data: 512 bits of data to hash + * @W: 80 words of workspace (see note) + * + * This function generates a SHA1 digest for a single 512-bit block. + * Be warned, it does not handle padding and message digest, do not + * confuse it with the full FIPS 180-1 digest algorithm for variable + * length messages. + * + * Note: If the hash is security sensitive, the caller should be sure + * to clear the workspace. This is left to the caller to avoid + * unnecessary clears between chained hashing operations. + */ +static void sha_transform(uint32_t *digest, const unsigned char *in, uint32_t *W) +{ + uint32_t a, b, c, d, e, t, i; + + for (i = 0; i < 16; i++) { + int ofs = 4 * i; + + /* word load/store may be unaligned here, so use bytes instead */ + W[i] = + (in[ofs+0] << 24) | + (in[ofs+1] << 16) | + (in[ofs+2] << 8) | + in[ofs+3]; + } + + for (i = 0; i < 64; i++) + W[i+16] = rol32(W[i+13] ^ W[i+8] ^ W[i+2] ^ W[i], 1); + + a = digest[0]; + b = digest[1]; + c = digest[2]; + d = digest[3]; + e = digest[4]; + + for (i = 0; i < 20; i++) { + t = f1(b, c, d) + K1 + rol32(a, 5) + e + W[i]; + e = d; d = c; c = rol32(b, 30); b = a; a = t; + } + + for (; i < 40; i ++) { + t = f2(b, c, d) + K2 + rol32(a, 5) + e + W[i]; + e = d; d = c; c = rol32(b, 30); b = a; a = t; + } + + for (; i < 60; i ++) { + t = f3(b, c, d) + K3 + rol32(a, 5) + e + W[i]; + e = d; d = c; c = rol32(b, 30); b = a; a = t; + } + + for (; i < 80; i ++) { + t = f2(b, c, d) + K4 + rol32(a, 5) + e + W[i]; + e = d; d = c; c = rol32(b, 30); b = a; a = t; + } + + digest[0] += a; + digest[1] += b; + digest[2] += c; + digest[3] += d; + digest[4] += e; +} + +/** + * sha_init - initialize the vectors for a SHA1 digest + * @buf: vector to initialize + */ +static void sha_init(uint32_t *buf) +{ + buf[0] = 0x67452301; + buf[1] = 0xefcdab89; + buf[2] = 0x98badcfe; + buf[3] = 0x10325476; + buf[4] = 0xc3d2e1f0; +} + diff --git a/package/network/services/ead/src/tinysrp/Makefile.am b/package/network/services/ead/src/tinysrp/Makefile.am new file mode 100644 index 0000000000..a8f899fe2c --- /dev/null +++ b/package/network/services/ead/src/tinysrp/Makefile.am @@ -0,0 +1,28 @@ +AUTOMAKE_OPTIONS = foreign no-dependencies + +noinst_HEADERS = t_client.h t_pwd.h t_server.h t_sha.h \ + bn.h bn_lcl.h bn_prime.h t_defines.h t_read.h + +include_HEADERS = tinysrp.h + +lib_LIBRARIES = libtinysrp.a + +CFLAGS = -O2 @signed@ + +libtinysrp_a_SOURCES = \ + tinysrp.c t_client.c t_getconf.c t_conv.c t_getpass.c t_sha.c t_math.c \ + t_misc.c t_pw.c t_read.c t_server.c t_truerand.c \ + bn_add.c bn_ctx.c bn_div.c bn_exp.c bn_mul.c bn_word.c bn_asm.c bn_lib.c \ + bn_shift.c bn_sqr.c + +noinst_PROGRAMS = srvtest clitest +srvtest_SOURCES = srvtest.c +clitest_SOURCES = clitest.c + +bin_PROGRAMS = tconf tphrase +tconf_SOURCES = tconf.c t_conf.c +tphrase_SOURCES = tphrase.c + +LDADD = libtinysrp.a + +EXTRA_DIST = tpasswd Notes diff --git a/package/network/services/ead/src/tinysrp/Makefile.in b/package/network/services/ead/src/tinysrp/Makefile.in new file mode 100644 index 0000000000..4701cd5238 --- /dev/null +++ b/package/network/services/ead/src/tinysrp/Makefile.in @@ -0,0 +1,477 @@ +# Makefile.in generated automatically by automake 1.4a from Makefile.am + +# Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + + +SHELL = @SHELL@ + +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +VPATH = @srcdir@ +prefix = @prefix@ +exec_prefix = @exec_prefix@ + +bindir = @bindir@ +sbindir = @sbindir@ +libexecdir = @libexecdir@ +datadir = @datadir@ +sysconfdir = @sysconfdir@ +sharedstatedir = @sharedstatedir@ +localstatedir = @localstatedir@ +libdir = @libdir@ +infodir = @infodir@ +mandir = @mandir@ +includedir = @includedir@ +oldincludedir = /usr/include + +DESTDIR = + +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ + +top_builddir = . + +ACLOCAL = @ACLOCAL@ +AUTOCONF = @AUTOCONF@ +AUTOMAKE = @AUTOMAKE@ +AUTOHEADER = @AUTOHEADER@ + +INSTALL = @INSTALL@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_FLAG = +transform = @program_transform_name@ + +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +CC = @CC@ +LN_S = @LN_S@ +MAKEINFO = @MAKEINFO@ +PACKAGE = @PACKAGE@ +RANLIB = @RANLIB@ +VERSION = @VERSION@ +signed = @signed@ + +AUTOMAKE_OPTIONS = foreign no-dependencies + +noinst_HEADERS = t_client.h t_pwd.h t_server.h t_sha.h bn.h bn_lcl.h bn_prime.h t_defines.h t_read.h + + +include_HEADERS = tinysrp.h + +lib_LIBRARIES = libtinysrp.a + +CFLAGS = -O2 @signed@ + +libtinysrp_a_SOURCES = tinysrp.c t_client.c t_getconf.c t_conv.c t_getpass.c t_sha.c t_math.c t_misc.c t_pw.c t_read.c t_server.c t_truerand.c bn_add.c bn_ctx.c bn_div.c bn_exp.c bn_mul.c bn_word.c bn_asm.c bn_lib.c bn_shift.c bn_sqr.c + + +noinst_PROGRAMS = srvtest clitest +srvtest_SOURCES = srvtest.c +clitest_SOURCES = clitest.c + +bin_PROGRAMS = tconf tphrase +tconf_SOURCES = tconf.c t_conf.c +tphrase_SOURCES = tphrase.c + +LDADD = libtinysrp.a + +EXTRA_DIST = tpasswd Notes +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +CONFIG_HEADER = config.h +CONFIG_CLEAN_FILES = +LIBRARIES = $(lib_LIBRARIES) + + +DEFS = @DEFS@ -I. -I$(srcdir) -I. +CPPFLAGS = @CPPFLAGS@ +LDFLAGS = @LDFLAGS@ +LIBS = @LIBS@ +libtinysrp_a_LIBADD = +libtinysrp_a_OBJECTS = tinysrp.o t_client.o t_getconf.o t_conv.o \ +t_getpass.o t_sha.o t_math.o t_misc.o t_pw.o t_read.o t_server.o \ +t_truerand.o bn_add.o bn_ctx.o bn_div.o bn_exp.o bn_mul.o bn_word.o \ +bn_asm.o bn_lib.o bn_shift.o bn_sqr.o +AR = ar +PROGRAMS = $(bin_PROGRAMS) $(noinst_PROGRAMS) + +tconf_OBJECTS = tconf.o t_conf.o +tconf_LDADD = $(LDADD) +tconf_DEPENDENCIES = libtinysrp.a +tconf_LDFLAGS = +tphrase_OBJECTS = tphrase.o +tphrase_LDADD = $(LDADD) +tphrase_DEPENDENCIES = libtinysrp.a +tphrase_LDFLAGS = +srvtest_OBJECTS = srvtest.o +srvtest_LDADD = $(LDADD) +srvtest_DEPENDENCIES = libtinysrp.a +srvtest_LDFLAGS = +clitest_OBJECTS = clitest.o +clitest_LDADD = $(LDADD) +clitest_DEPENDENCIES = libtinysrp.a +clitest_LDFLAGS = +COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +CCLD = $(CC) +LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@ +HEADERS = $(include_HEADERS) $(noinst_HEADERS) + +DIST_COMMON = ./stamp-h.in Makefile.am Makefile.in acconfig.h \ +acinclude.m4 aclocal.m4 config.h.in configure configure.in install-sh \ +missing mkinstalldirs + + +DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST) + +TAR = gtar +GZIP_ENV = --best +SOURCES = $(libtinysrp_a_SOURCES) $(tconf_SOURCES) $(tphrase_SOURCES) $(srvtest_SOURCES) $(clitest_SOURCES) +OBJECTS = $(libtinysrp_a_OBJECTS) $(tconf_OBJECTS) $(tphrase_OBJECTS) $(srvtest_OBJECTS) $(clitest_OBJECTS) + +all: all-redirect +.SUFFIXES: +.SUFFIXES: .S .c .o .s + +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + cd $(top_builddir) \ + && CONFIG_FILES=$@ CONFIG_HEADERS= $(SHELL) ./config.status + +$(ACLOCAL_M4): configure.in acinclude.m4 + cd $(srcdir) && $(ACLOCAL) + +$(srcdir)/configure: $(srcdir)/configure.in $(ACLOCAL_M4) $(CONFIGURE_DEPENDENCIES) + cd $(srcdir) && $(AUTOCONF) + +config.h: stamp-h + @if test ! -f $@; then \ + rm -f stamp-h; \ + $(MAKE) stamp-h; \ + else :; fi +stamp-h: $(srcdir)/config.h.in $(top_builddir)/config.status + cd $(top_builddir) \ + && CONFIG_FILES= CONFIG_HEADERS=config.h \ + $(SHELL) ./config.status + @echo timestamp > stamp-h 2> /dev/null +$(srcdir)/config.h.in: $(srcdir)/stamp-h.in + @if test ! -f $@; then \ + rm -f $(srcdir)/stamp-h.in; \ + $(MAKE) $(srcdir)/stamp-h.in; \ + else :; fi +$(srcdir)/stamp-h.in: $(top_srcdir)/configure.in $(ACLOCAL_M4) acconfig.h + cd $(top_srcdir) && $(AUTOHEADER) + @echo timestamp > $(srcdir)/stamp-h.in 2> /dev/null + +mostlyclean-hdr: + +clean-hdr: + +distclean-hdr: + -rm -f config.h + +maintainer-clean-hdr: + +mostlyclean-libLIBRARIES: + +clean-libLIBRARIES: + -test -z "$(lib_LIBRARIES)" || rm -f $(lib_LIBRARIES) + +distclean-libLIBRARIES: + +maintainer-clean-libLIBRARIES: + +install-libLIBRARIES: $(lib_LIBRARIES) + @$(NORMAL_INSTALL) + $(mkinstalldirs) $(DESTDIR)$(libdir) + @list='$(lib_LIBRARIES)'; for p in $$list; do \ + if test -f $$p; then \ + echo " $(INSTALL_DATA) $$p $(DESTDIR)$(libdir)/$$p"; \ + $(INSTALL_DATA) $$p $(DESTDIR)$(libdir)/$$p; \ + else :; fi; \ + done + @$(POST_INSTALL) + @list='$(lib_LIBRARIES)'; for p in $$list; do \ + if test -f $$p; then \ + echo " $(RANLIB) $(DESTDIR)$(libdir)/$$p"; \ + $(RANLIB) $(DESTDIR)$(libdir)/$$p; \ + else :; fi; \ + done + +uninstall-libLIBRARIES: + @$(NORMAL_UNINSTALL) + list='$(lib_LIBRARIES)'; for p in $$list; do \ + rm -f $(DESTDIR)$(libdir)/$$p; \ + done + +.c.o: + $(COMPILE) -c $< + +.s.o: + $(COMPILE) -c $< + +.S.o: + $(COMPILE) -c $< + +mostlyclean-compile: + -rm -f *.o core *.core + +clean-compile: + +distclean-compile: + -rm -f *.tab.c + +maintainer-clean-compile: + +libtinysrp.a: $(libtinysrp_a_OBJECTS) $(libtinysrp_a_DEPENDENCIES) + -rm -f libtinysrp.a + $(AR) cru libtinysrp.a $(libtinysrp_a_OBJECTS) $(libtinysrp_a_LIBADD) + $(RANLIB) libtinysrp.a + +mostlyclean-binPROGRAMS: + +clean-binPROGRAMS: + -test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS) + +distclean-binPROGRAMS: + +maintainer-clean-binPROGRAMS: + +install-binPROGRAMS: $(bin_PROGRAMS) + @$(NORMAL_INSTALL) + $(mkinstalldirs) $(DESTDIR)$(bindir) + @list='$(bin_PROGRAMS)'; for p in $$list; do \ + if test -f $$p; then \ + echo " $(INSTALL_PROGRAM) $(INSTALL_STRIP_FLAG) $$p $(DESTDIR)$(bindir)/`echo $$p|sed 's/$(EXEEXT)$$//'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`"; \ + $(INSTALL_PROGRAM) $(INSTALL_STRIP_FLAG) $$p $(DESTDIR)$(bindir)/`echo $$p|sed 's/$(EXEEXT)$$//'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`; \ + else :; fi; \ + done + +uninstall-binPROGRAMS: + @$(NORMAL_UNINSTALL) + list='$(bin_PROGRAMS)'; for p in $$list; do \ + rm -f $(DESTDIR)$(bindir)/`echo $$p|sed 's/$(EXEEXT)$$//'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`; \ + done + +mostlyclean-noinstPROGRAMS: + +clean-noinstPROGRAMS: + -test -z "$(noinst_PROGRAMS)" || rm -f $(noinst_PROGRAMS) + +distclean-noinstPROGRAMS: + +maintainer-clean-noinstPROGRAMS: + +tconf: $(tconf_OBJECTS) $(tconf_DEPENDENCIES) + @rm -f tconf + $(LINK) $(tconf_LDFLAGS) $(tconf_OBJECTS) $(tconf_LDADD) $(LIBS) + +tphrase: $(tphrase_OBJECTS) $(tphrase_DEPENDENCIES) + @rm -f tphrase + $(LINK) $(tphrase_LDFLAGS) $(tphrase_OBJECTS) $(tphrase_LDADD) $(LIBS) + +srvtest: $(srvtest_OBJECTS) $(srvtest_DEPENDENCIES) + @rm -f srvtest + $(LINK) $(srvtest_LDFLAGS) $(srvtest_OBJECTS) $(srvtest_LDADD) $(LIBS) + +clitest: $(clitest_OBJECTS) $(clitest_DEPENDENCIES) + @rm -f clitest + $(LINK) $(clitest_LDFLAGS) $(clitest_OBJECTS) $(clitest_LDADD) $(LIBS) + +install-includeHEADERS: $(include_HEADERS) + @$(NORMAL_INSTALL) + $(mkinstalldirs) $(DESTDIR)$(includedir) + @list='$(include_HEADERS)'; for p in $$list; do \ + if test -f "$$p"; then d= ; else d="$(srcdir)/"; fi; \ + echo " $(INSTALL_DATA) $$d$$p $(DESTDIR)$(includedir)/$$p"; \ + $(INSTALL_DATA) $$d$$p $(DESTDIR)$(includedir)/$$p; \ + done + +uninstall-includeHEADERS: + @$(NORMAL_UNINSTALL) + list='$(include_HEADERS)'; for p in $$list; do \ + rm -f $(DESTDIR)$(includedir)/$$p; \ + done + +tags: TAGS + +ID: $(HEADERS) $(SOURCES) $(LISP) + list='$(SOURCES) $(HEADERS)'; \ + unique=`for i in $$list; do echo $$i; done | \ + awk ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + here=`pwd` && cd $(srcdir) \ + && mkid -f$$here/ID $$unique $(LISP) + +TAGS: $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS)'; \ + unique=`for i in $$list; do echo $$i; done | \ + awk ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(ETAGS_ARGS)config.h.in$$unique$(LISP)$$tags" \ + || (cd $(srcdir) && etags $(ETAGS_ARGS) $$tags config.h.in $$unique $(LISP) -o $$here/TAGS) + +mostlyclean-tags: + +clean-tags: + +distclean-tags: + -rm -f TAGS ID + +maintainer-clean-tags: + +distdir = $(PACKAGE)-$(VERSION) +top_distdir = $(distdir) + +# This target untars the dist file and tries a VPATH configuration. Then +# it guarantees that the distribution is self-contained by making another +# tarfile. +distcheck: dist + -rm -rf $(distdir) + GZIP=$(GZIP_ENV) $(TAR) zxf $(distdir).tar.gz + mkdir $(distdir)/=build + mkdir $(distdir)/=inst + dc_install_base=`cd $(distdir)/=inst && pwd`; \ + cd $(distdir)/=build \ + && ../configure --srcdir=.. --prefix=$$dc_install_base \ + && $(MAKE) $(AM_MAKEFLAGS) \ + && $(MAKE) $(AM_MAKEFLAGS) dvi \ + && $(MAKE) $(AM_MAKEFLAGS) check \ + && $(MAKE) $(AM_MAKEFLAGS) install \ + && $(MAKE) $(AM_MAKEFLAGS) installcheck \ + && $(MAKE) $(AM_MAKEFLAGS) dist + -rm -rf $(distdir) + @banner="$(distdir).tar.gz is ready for distribution"; \ + dashes=`echo "$$banner" | sed s/./=/g`; \ + echo "$$dashes"; \ + echo "$$banner"; \ + echo "$$dashes" +dist: distdir + -chmod -R a+r $(distdir) + GZIP=$(GZIP_ENV) $(TAR) chozf $(distdir).tar.gz $(distdir) + -rm -rf $(distdir) +dist-all: distdir + -chmod -R a+r $(distdir) + GZIP=$(GZIP_ENV) $(TAR) chozf $(distdir).tar.gz $(distdir) + -rm -rf $(distdir) +distdir: $(DISTFILES) + -rm -rf $(distdir) + mkdir $(distdir) + -chmod 777 $(distdir) + @for file in $(DISTFILES); do \ + d=$(srcdir); \ + if test -d $$d/$$file; then \ + cp -pr $$d/$$file $(distdir)/$$file; \ + else \ + test -f $(distdir)/$$file \ + || ln $$d/$$file $(distdir)/$$file 2> /dev/null \ + || cp -p $$d/$$file $(distdir)/$$file || :; \ + fi; \ + done +info-am: +info: info-am +dvi-am: +dvi: dvi-am +check-am: all-am +check: check-am +installcheck-am: +installcheck: installcheck-am +all-recursive-am: config.h + $(MAKE) $(AM_MAKEFLAGS) all-recursive + +install-exec-am: install-libLIBRARIES install-binPROGRAMS +install-exec: install-exec-am + +install-data-am: install-includeHEADERS +install-data: install-data-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am +install: install-am +uninstall-am: uninstall-libLIBRARIES uninstall-binPROGRAMS \ + uninstall-includeHEADERS +uninstall: uninstall-am +all-am: Makefile $(LIBRARIES) $(PROGRAMS) $(HEADERS) config.h +all-redirect: all-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_STRIP_FLAG=-s install +installdirs: + $(mkinstalldirs) $(DESTDIR)$(libdir) $(DESTDIR)$(bindir) \ + $(DESTDIR)$(includedir) + + +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -rm -f Makefile $(CONFIG_CLEAN_FILES) + -rm -f config.cache config.log stamp-h stamp-h[0-9]* + +maintainer-clean-generic: +mostlyclean-am: mostlyclean-hdr mostlyclean-libLIBRARIES \ + mostlyclean-compile mostlyclean-binPROGRAMS \ + mostlyclean-noinstPROGRAMS mostlyclean-tags \ + mostlyclean-generic + +mostlyclean: mostlyclean-am + +clean-am: clean-hdr clean-libLIBRARIES clean-compile clean-binPROGRAMS \ + clean-noinstPROGRAMS clean-tags clean-generic \ + mostlyclean-am + +clean: clean-am + +distclean-am: distclean-hdr distclean-libLIBRARIES distclean-compile \ + distclean-binPROGRAMS distclean-noinstPROGRAMS \ + distclean-tags distclean-generic clean-am + +distclean: distclean-am + -rm -f config.status + +maintainer-clean-am: maintainer-clean-hdr maintainer-clean-libLIBRARIES \ + maintainer-clean-compile maintainer-clean-binPROGRAMS \ + maintainer-clean-noinstPROGRAMS maintainer-clean-tags \ + maintainer-clean-generic distclean-am + @echo "This command is intended for maintainers to use;" + @echo "it deletes files that may require special tools to rebuild." + +maintainer-clean: maintainer-clean-am + -rm -f config.status + +.PHONY: mostlyclean-hdr distclean-hdr clean-hdr maintainer-clean-hdr \ +mostlyclean-libLIBRARIES distclean-libLIBRARIES clean-libLIBRARIES \ +maintainer-clean-libLIBRARIES uninstall-libLIBRARIES \ +install-libLIBRARIES mostlyclean-compile distclean-compile \ +clean-compile maintainer-clean-compile mostlyclean-binPROGRAMS \ +distclean-binPROGRAMS clean-binPROGRAMS maintainer-clean-binPROGRAMS \ +uninstall-binPROGRAMS install-binPROGRAMS mostlyclean-noinstPROGRAMS \ +distclean-noinstPROGRAMS clean-noinstPROGRAMS \ +maintainer-clean-noinstPROGRAMS uninstall-includeHEADERS \ +install-includeHEADERS tags mostlyclean-tags distclean-tags clean-tags \ +maintainer-clean-tags distdir info-am info dvi-am dvi check check-am \ +installcheck-am installcheck all-recursive-am install-exec-am \ +install-exec install-data-am install-data install-am install \ +uninstall-am uninstall all-redirect all-am all installdirs \ +mostlyclean-generic distclean-generic clean-generic \ +maintainer-clean-generic clean mostlyclean distclean maintainer-clean + + +# 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/package/network/services/ead/src/tinysrp/Notes b/package/network/services/ead/src/tinysrp/Notes new file mode 100644 index 0000000000..a8620aa700 --- /dev/null +++ b/package/network/services/ead/src/tinysrp/Notes @@ -0,0 +1,110 @@ +t_* stuff is from the srp 1.7.1 dist +bn_* stuff is from openssl 0.9.6 + +(The 7 in libtinysrp's version number reflects the srp version.) + +Licensing and copyright for srp and openssl are as indicated in the relevant +source files. Everything else here is GPL, including the tinysrp protocol. + +Changelog since initial release: + +0.7.4 more robust terminal modes in t_getpass + a potential buffer overflow in tinysrp +0.7.5 uninitialized pointer bug in tconf + +Changes from the base srp and openssl distributions: + +I've removed everything that's not needed for client/server operations, and +all the bn_* stuff that's only used for prime generation has been moved to +t_conf.c, which isn't part of the library anymore. Also, all the routines +used for passphrase file maintenance have been moved to tphrase.c. + +The library has been optimized (a bit) for space instead of speed. Since +authentication is usually only done once, this isn't a big problem. Modern +CPUs are plenty fast for this task, and even 100 MHz CPUs are fine. If you +really need the speed, get the regular distributions. + +Note that if the server sends the client a prime that the client doesn't +know about, the client MUST test for primality. Since this is pretty +expensive, and takes 30 seconds on a 100 MHz machine, and uses lots of code, +I've removed that ability from the client. So only KNOWN primes can be +used. You can still generate new ones with tconf, but you have to install +them in the table of known primes (pre_params) in t_getconf.c that's common +to the client and server, and recompile. The configuration file is gone. + +The default prime (the last entry in the table) is 1024 bits; there are +others with more bits but they will be correspondingly slower. + +The default tpasswd file (which is an ascii file that may be editted with a +regular text editor) contains two users: moo (passphrase "glub glub") and +"new user" (passphrase "this is a test"). Passphrases may be added or +changed with tphrase; you can also change the user's prime. To delete a +user, edit the tpasswd file and remove that line. The tpasswd file's +default name is DEFAULT_PASSWD in t_pwd.h. Note that you can't change a +user's username by editting the file: the username is encoded in the +verifier. If you change a username you must set a new passphrase with +tphrase. + +Here is an example session, using the supplied srvtest and clitest. First, +start both programs in different windows, and enter the user names. Normally, +the client would send the username to the server. Server lines are marked +with S>, client lines with C>. + +S> % srvtest +S> Enter username: moo +S> index (to client): 5 +S> salt (to client): 19AI0Hc9jEkdFc + +C> % clitest +C> Enter username: moo +C> Enter index (from server): 5 +C> Enter salt (from server): 19AI0Hc9jEkdFc + +The server reports the index and salt values used for that user. They +are sent over the network to the client. (Simulate this by cutting and +pasting from one window to the other.) + +C> A (to server): 5wCDXRxLIv/zLazYfKupV/OY3BlhTZuJ71wVgI0HcL1kSJEpkMuWF.xEz/BV2wlJl7vk5Eoz9KMS1ccnaatsVP5D6CBm7UA.yVB59EQFN0dNBirvX29NAFdtdMsMppo5tHRy987XjJWrWSLpeibq6emr.gP8nYyX75GQqSiMY1j +C> Enter password: + +S> Enter A (from client): 5wCDXRxLIv/zLazYfKupV/OY3BlhTZuJ71wVgI0HcL1kSJEpkMuWF.xEz/BV2wlJl7vk5Eoz9KMS1ccnaatsVP5D6CBm7UA.yVB59EQFN0dNBirvX29NAFdtdMsMppo5tHRy987XjJWrWSLpeibq6emr.gP8nYyX75GQqSiMY1j + +Now the client calculates A and sends it to the server, and while the +server is munching on that, the client gets the password from the user. + +S> B (to client): 9dcCpulxQAbaDXI0NHWY6B.QH6B9fsoXs/x/5SCNBNJm/6H6bYfbVrwNmdquhLZjYMvpcgGc2mBYqL77RNfw1kVQo17//GfsByECBIjRnrAn02ffX9Y/llJcfscAQiii0hyZhJf9PT5wE7pC7WUjIgSqckIZ0JLNDbSr7fJcrgw +S> Session key: ebbcf3a45c968defdcfff6e144ad8d4f5412167c9716e79cbf7cacfe18257947ad46fa5d6418a1fd + +The server now calculates B and sends it to the client. The session key +is not sent -- it is a shared secret that can be used for encryption. + +C> Enter B (from server): 9dcCpulxQAbaDXI0NHWY6B.QH6B9fsoXs/x/5SCNBNJm/6H6bYfbVrwNmdquhLZjYMvpcgGc2mBYqL77RNfw1kVQo17//GfsByECBIjRnrAn02ffX9Y/llJcfscAQiii0hyZhJf9PT5wE7pC7WUjIgSqckIZ0JLNDbSr7fJcrgw +C> Session key: ebbcf3a45c968defdcfff6e144ad8d4f5412167c9716e79cbf7cacfe18257947ad46fa5d6418a1fd +C> Response (to server): b9ea99094a176c4be28eb469982066cc7146d180 + +The client uses the B value to calculate its own copy of the shared secret +session key, and sends a response to the server proving that it does know +the correct key. + +S> Enter response (from client): b9ea99094a176c4be28eb469982066cc7146d180 +S> Authentication successful. +S> Response (to client): cd46c839ccad2d0c76f3ca1905ae8ceda8d1c1dc + +The server authenticates the client. (You're in!) + +C> Enter server response: cd46c839ccad2d0c76f3ca1905ae8ceda8d1c1dc +C> Server authentication successful. + +The client authenticates the server (prevents server spoofing in the case +where the session key isn't used to encrypt the channel -- a spoofed server +might just respond with random values and _pretend_ to authenticate the +client; but the spoofed server won't know the session key and this check +catches that). + +Final note: + +Remember that many breaches of security involve buggy software, such as +servers susceptible to buffer overflow exploits that totally bypass any +passphrase, secure or not. If an attacker roots your client, or the server, +no form of authentication will work. Consider MAC-based schemes if this +worries you. diff --git a/package/network/services/ead/src/tinysrp/acconfig.h b/package/network/services/ead/src/tinysrp/acconfig.h new file mode 100644 index 0000000000..b74aed08f3 --- /dev/null +++ b/package/network/services/ead/src/tinysrp/acconfig.h @@ -0,0 +1,9 @@ +#undef SHA1HANDSOFF + +#undef POSIX_TERMIOS + +#undef POSIX_SIGTYPE + +#undef VERSION + +#undef volatile diff --git a/package/network/services/ead/src/tinysrp/acinclude.m4 b/package/network/services/ead/src/tinysrp/acinclude.m4 new file mode 100644 index 0000000000..e0d0d04df5 --- /dev/null +++ b/package/network/services/ead/src/tinysrp/acinclude.m4 @@ -0,0 +1,27 @@ +dnl +dnl check for signal type +dnl +dnl AC_RETSIGTYPE isn't quite right, but almost. +dnl +define(TYPE_SIGNAL,[ +AC_MSG_CHECKING([POSIX signal handlers]) +AC_CACHE_VAL(cv_has_posix_signals, +[AC_TRY_COMPILE( +[#include +#include +#ifdef signal +#undef signal +#endif +extern void (*signal ()) ();], [], +cv_has_posix_signals=yes, cv_has_posix_signals=no)]) +AC_MSG_RESULT($cv_has_posix_signals) +if test $cv_has_posix_signals = yes; then + AC_DEFINE(RETSIGTYPE, void, [Return type is void]) + AC_DEFINE(POSIX_SIGTYPE, [], [Have POSIX signals]) +else + if test $ac_cv_type_signal = void; then + AC_DEFINE(RETSIGTYPE, void, [Return type is void]) + else + AC_DEFINE(RETSIGTYPE, int, [Return type is int]) + fi +fi])dnl diff --git a/package/network/services/ead/src/tinysrp/aclocal.m4 b/package/network/services/ead/src/tinysrp/aclocal.m4 new file mode 100644 index 0000000000..703fce4b77 --- /dev/null +++ b/package/network/services/ead/src/tinysrp/aclocal.m4 @@ -0,0 +1,157 @@ +dnl aclocal.m4 generated automatically by aclocal 1.4a + +dnl Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +dnl This program is distributed in the hope that it will be useful, +dnl but WITHOUT ANY WARRANTY, to the extent permitted by law; without +dnl even the implied warranty of MERCHANTABILITY or FITNESS FOR A +dnl PARTICULAR PURPOSE. + +dnl +dnl check for signal type +dnl +dnl AC_RETSIGTYPE isn't quite right, but almost. +dnl +define(TYPE_SIGNAL,[ +AC_MSG_CHECKING([POSIX signal handlers]) +AC_CACHE_VAL(cv_has_posix_signals, +[AC_TRY_COMPILE( +[#include +#include +#ifdef signal +#undef signal +#endif +extern void (*signal ()) ();], [], +cv_has_posix_signals=yes, cv_has_posix_signals=no)]) +AC_MSG_RESULT($cv_has_posix_signals) +if test $cv_has_posix_signals = yes; then + AC_DEFINE(RETSIGTYPE, void, [Return type is void]) + AC_DEFINE(POSIX_SIGTYPE, [], [Have POSIX signals]) +else + if test $ac_cv_type_signal = void; then + AC_DEFINE(RETSIGTYPE, void, [Return type is void]) + else + AC_DEFINE(RETSIGTYPE, int, [Return type is int]) + fi +fi])dnl + +# Like AC_CONFIG_HEADER, but automatically create stamp file. + +AC_DEFUN(AM_CONFIG_HEADER, +[AC_PREREQ([2.12]) +AC_CONFIG_HEADER([$1]) +dnl When config.status generates a header, we must update the stamp-h file. +dnl This file resides in the same directory as the config header +dnl that is generated. We must strip everything past the first ":", +dnl and everything past the last "/". +AC_OUTPUT_COMMANDS(changequote(<<,>>)dnl +ifelse(patsubst(<<$1>>, <<[^ ]>>, <<>>), <<>>, +<>CONFIG_HEADERS" || echo timestamp > patsubst(<<$1>>, <<^\([^:]*/\)?.*>>, <<\1>>)stamp-h<<>>dnl>>, +<>; do + case " <<$>>CONFIG_HEADERS " in + *" <<$>>am_file "*<<)>> + echo timestamp > `echo <<$>>am_file | sed -e 's%:.*%%' -e 's%[^/]*$%%'`stamp-h$am_indx + ;; + esac + am_indx=`expr "<<$>>am_indx" + 1` +done<<>>dnl>>) +changequote([,]))]) + +# Do all the work for Automake. This macro actually does too much -- +# some checks are only needed if your package does certain things. +# But this isn't really a big deal. + +# serial 1 + +dnl Usage: +dnl AM_INIT_AUTOMAKE(package,version, [no-define]) + +AC_DEFUN(AM_INIT_AUTOMAKE, +[AC_REQUIRE([AC_PROG_INSTALL]) +dnl We require 2.13 because we rely on SHELL being computed by configure. +AC_PREREQ([2.13]) +PACKAGE=[$1] +AC_SUBST(PACKAGE) +VERSION=[$2] +AC_SUBST(VERSION) +dnl test to see if srcdir already configured +if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then + AC_MSG_ERROR([source directory already configured; run "make distclean" there first]) +fi +ifelse([$3],, +AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package]) +AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])) +AC_REQUIRE([AM_SANITY_CHECK]) +AC_REQUIRE([AC_ARG_PROGRAM]) +dnl FIXME This is truly gross. +missing_dir=`cd $ac_aux_dir && pwd` +AM_MISSING_PROG(ACLOCAL, aclocal, $missing_dir) +AM_MISSING_PROG(AUTOCONF, autoconf, $missing_dir) +AM_MISSING_PROG(AUTOMAKE, automake, $missing_dir) +AM_MISSING_PROG(AUTOHEADER, autoheader, $missing_dir) +AM_MISSING_PROG(MAKEINFO, makeinfo, $missing_dir) +AC_REQUIRE([AC_PROG_MAKE_SET])]) + +# +# Check to make sure that the build environment is sane. +# + +AC_DEFUN(AM_SANITY_CHECK, +[AC_MSG_CHECKING([whether build environment is sane]) +# Just in case +sleep 1 +echo timestamp > conftestfile +# Do `set' in a subshell so we don't clobber the current shell's +# arguments. Must try -L first in case configure is actually a +# symlink; some systems play weird games with the mod time of symlinks +# (eg FreeBSD returns the mod time of the symlink's containing +# directory). +if ( + set X `ls -Lt $srcdir/configure conftestfile 2> /dev/null` + if test "[$]*" = "X"; then + # -L didn't work. + set X `ls -t $srcdir/configure conftestfile` + fi + if test "[$]*" != "X $srcdir/configure conftestfile" \ + && test "[$]*" != "X conftestfile $srcdir/configure"; then + + # If neither matched, then we have a broken ls. This can happen + # if, for instance, CONFIG_SHELL is bash and it inherits a + # broken ls alias from the environment. This has actually + # happened. Such a system could not be considered "sane". + AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken +alias in your environment]) + fi + + test "[$]2" = conftestfile + ) +then + # Ok. + : +else + AC_MSG_ERROR([newly created file is older than distributed files! +Check your system clock]) +fi +rm -f conftest* +AC_MSG_RESULT(yes)]) + +dnl AM_MISSING_PROG(NAME, PROGRAM, DIRECTORY) +dnl The program must properly implement --version. +AC_DEFUN(AM_MISSING_PROG, +[AC_MSG_CHECKING(for working $2) +# Run test in a subshell; some versions of sh will print an error if +# an executable is not found, even if stderr is redirected. +# Redirect stdin to placate older versions of autoconf. Sigh. +if ($2 --version) < /dev/null > /dev/null 2>&1; then + $1=$2 + AC_MSG_RESULT(found) +else + $1="$3/missing $2" + AC_MSG_RESULT(missing) +fi +AC_SUBST($1)]) + diff --git a/package/network/services/ead/src/tinysrp/bn.h b/package/network/services/ead/src/tinysrp/bn.h new file mode 100644 index 0000000000..0144dd9617 --- /dev/null +++ b/package/network/services/ead/src/tinysrp/bn.h @@ -0,0 +1,471 @@ +/* crypto/bn/bn.h */ +/* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * 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 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 cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + +#ifndef HEADER_BN_H +#define HEADER_BN_H + +#include /* FILE */ +#include "config.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef VMS +#undef BN_LLONG /* experimental, so far... */ +#endif + +#undef BN_MUL_COMBA +#undef BN_SQR_COMBA +#undef BN_RECURSION +#undef RECP_MUL_MOD +#undef MONT_MUL_MOD + +#if defined(SIZEOF_LONG_LONG) && SIZEOF_LONG_LONG == 8 +# if SIZEOF_LONG == 4 +# define THIRTY_TWO_BIT +# else +# define SIXTY_FOUR_BIT_LONG +# endif +#else +# if SIZEOF_LONG == 4 +# define THIRTY_TWO_BIT +# endif +#endif + +#undef BN_LLONG + +/* assuming long is 64bit - this is the DEC Alpha + * unsigned long long is only 64 bits :-(, don't define + * BN_LLONG for the DEC Alpha */ +#ifdef SIXTY_FOUR_BIT_LONG +#define BN_ULLONG unsigned long long +#define BN_ULONG unsigned long +#define BN_LONG long +#define BN_BITS 128 +#define BN_BYTES 8 +#define BN_BITS2 64 +#define BN_BITS4 32 +#define BN_MASK (0xffffffffffffffffffffffffffffffffLL) +#define BN_MASK2 (0xffffffffffffffffL) +#define BN_MASK2l (0xffffffffL) +#define BN_MASK2h (0xffffffff00000000L) +#define BN_MASK2h1 (0xffffffff80000000L) +#define BN_TBIT (0x8000000000000000L) +#define BN_DEC_CONV (10000000000000000000UL) +#define BN_DEC_FMT1 "%lu" +#define BN_DEC_FMT2 "%019lu" +#define BN_DEC_NUM 19 +#endif + +/* This is where the long long data type is 64 bits, but long is 32. + * For machines where there are 64bit registers, this is the mode to use. + * IRIX, on R4000 and above should use this mode, along with the relevant + * assembler code :-). Do NOT define BN_LLONG. + */ +#ifdef SIXTY_FOUR_BIT +#undef BN_LLONG +#undef BN_ULLONG +#define BN_ULONG unsigned long long +#define BN_LONG long long +#define BN_BITS 128 +#define BN_BYTES 8 +#define BN_BITS2 64 +#define BN_BITS4 32 +#define BN_MASK2 (0xffffffffffffffffLL) +#define BN_MASK2l (0xffffffffL) +#define BN_MASK2h (0xffffffff00000000LL) +#define BN_MASK2h1 (0xffffffff80000000LL) +#define BN_TBIT (0x8000000000000000LL) +#define BN_DEC_CONV (10000000000000000000LL) +#define BN_DEC_FMT1 "%llu" +#define BN_DEC_FMT2 "%019llu" +#define BN_DEC_NUM 19 +#endif + +#ifdef THIRTY_TWO_BIT +#if defined(WIN32) && !defined(__GNUC__) +#define BN_ULLONG unsigned _int64 +#else +#define BN_ULLONG unsigned long long +#endif +#define BN_ULONG unsigned long +#define BN_LONG long +#define BN_BITS 64 +#define BN_BYTES 4 +#define BN_BITS2 32 +#define BN_BITS4 16 +#ifdef WIN32 +/* VC++ doesn't like the LL suffix */ +#define BN_MASK (0xffffffffffffffffL) +#else +#define BN_MASK (0xffffffffffffffffLL) +#endif +#define BN_MASK2 (0xffffffffL) +#define BN_MASK2l (0xffff) +#define BN_MASK2h1 (0xffff8000L) +#define BN_MASK2h (0xffff0000L) +#define BN_TBIT (0x80000000L) +#define BN_DEC_CONV (1000000000L) +#define BN_DEC_FMT1 "%lu" +#define BN_DEC_FMT2 "%09lu" +#define BN_DEC_NUM 9 +#endif + +#ifdef SIXTEEN_BIT +#ifndef BN_DIV2W +#define BN_DIV2W +#endif +#define BN_ULLONG unsigned long +#define BN_ULONG unsigned short +#define BN_LONG short +#define BN_BITS 32 +#define BN_BYTES 2 +#define BN_BITS2 16 +#define BN_BITS4 8 +#define BN_MASK (0xffffffff) +#define BN_MASK2 (0xffff) +#define BN_MASK2l (0xff) +#define BN_MASK2h1 (0xff80) +#define BN_MASK2h (0xff00) +#define BN_TBIT (0x8000) +#define BN_DEC_CONV (100000) +#define BN_DEC_FMT1 "%u" +#define BN_DEC_FMT2 "%05u" +#define BN_DEC_NUM 5 +#endif + +#ifdef EIGHT_BIT +#ifndef BN_DIV2W +#define BN_DIV2W +#endif +#define BN_ULLONG unsigned short +#define BN_ULONG unsigned char +#define BN_LONG char +#define BN_BITS 16 +#define BN_BYTES 1 +#define BN_BITS2 8 +#define BN_BITS4 4 +#define BN_MASK (0xffff) +#define BN_MASK2 (0xff) +#define BN_MASK2l (0xf) +#define BN_MASK2h1 (0xf8) +#define BN_MASK2h (0xf0) +#define BN_TBIT (0x80) +#define BN_DEC_CONV (100) +#define BN_DEC_FMT1 "%u" +#define BN_DEC_FMT2 "%02u" +#define BN_DEC_NUM 2 +#endif + +#define BN_DEFAULT_BITS 1280 + +#ifdef BIGNUM +#undef BIGNUM +#endif + +#define BN_FLG_MALLOCED 0x01 +#define BN_FLG_STATIC_DATA 0x02 +#define BN_FLG_FREE 0x8000 /* used for debuging */ +#define BN_set_flags(b,n) ((b)->flags|=(n)) +#define BN_get_flags(b,n) ((b)->flags&(n)) + +typedef struct bignum_st + { + BN_ULONG *d; /* Pointer to an array of 'BN_BITS2' bit chunks. */ + int top; /* Index of last used d +1. */ + /* The next are internal book keeping for bn_expand. */ + int dmax; /* Size of the d array. */ + int neg; /* one if the number is negative */ + int flags; + } BIGNUM; + +/* Used for temp variables */ +#define BN_CTX_NUM 12 +#define BN_CTX_NUM_POS 12 +typedef struct bignum_ctx + { + int tos; + BIGNUM bn[BN_CTX_NUM]; + int flags; + int depth; + int pos[BN_CTX_NUM_POS]; + int too_many; + } BN_CTX; + +/* Used for montgomery multiplication */ +typedef struct bn_mont_ctx_st + { + int ri; /* number of bits in R */ + BIGNUM RR; /* used to convert to montgomery form */ + BIGNUM N; /* The modulus */ + BIGNUM Ni; /* R*(1/R mod N) - N*Ni = 1 + * (Ni is only stored for bignum algorithm) */ + BN_ULONG n0; /* least significant word of Ni */ + int flags; + } BN_MONT_CTX; + +/* Used for reciprocal division/mod functions + * It cannot be shared between threads + */ +typedef struct bn_recp_ctx_st + { + BIGNUM N; /* the divisor */ + BIGNUM Nr; /* the reciprocal */ + int num_bits; + int shift; + int flags; + } BN_RECP_CTX; + +#define BN_to_montgomery(r,a,mont,ctx) BN_mod_mul_montgomery(\ + r,a,&((mont)->RR),(mont),ctx) + +#define BN_prime_checks 0 /* default: select number of iterations + based on the size of the number */ + +/* number of Miller-Rabin iterations for an error rate of less than 2^-80 + * for random 'b'-bit input, b >= 100 (taken from table 4.4 in the Handbook + * of Applied Cryptography [Menezes, van Oorschot, Vanstone; CRC Press 1996]; + * original paper: Damgaard, Landrock, Pomerance: Average case error estimates + * for the strong probable prime test. -- Math. Comp. 61 (1993) 177-194) */ +#define BN_prime_checks_for_size(b) ((b) >= 1300 ? 2 : \ + (b) >= 850 ? 3 : \ + (b) >= 650 ? 4 : \ + (b) >= 550 ? 5 : \ + (b) >= 450 ? 6 : \ + (b) >= 400 ? 7 : \ + (b) >= 350 ? 8 : \ + (b) >= 300 ? 9 : \ + (b) >= 250 ? 12 : \ + (b) >= 200 ? 15 : \ + (b) >= 150 ? 18 : \ + /* b >= 100 */ 27) + +#define BN_num_bytes(a) ((BN_num_bits(a)+7)/8) +#define BN_is_word(a,w) (((a)->top == 1) && ((a)->d[0] == (BN_ULONG)(w))) +#define BN_is_zero(a) (((a)->top == 0) || BN_is_word(a,0)) +#define BN_is_one(a) (BN_is_word((a),1)) +#define BN_is_odd(a) (((a)->top > 0) && ((a)->d[0] & 1)) +#define BN_one(a) (BN_set_word((a),1)) +#define BN_zero(a) (BN_set_word((a),0)) + +BIGNUM *BN_value_one(void); +char * BN_options(void); +BN_CTX *BN_CTX_new(void); +void BN_CTX_init(BN_CTX *c); +void BN_CTX_free(BN_CTX *c); +void BN_CTX_start(BN_CTX *ctx); +BIGNUM *BN_CTX_get(BN_CTX *ctx); +void BN_CTX_end(BN_CTX *ctx); +int BN_rand(BIGNUM *rnd, int bits, int top,int bottom); +int BN_pseudo_rand(BIGNUM *rnd, int bits, int top,int bottom); +int BN_num_bits(const BIGNUM *a); +int BN_num_bits_word(BN_ULONG); +BIGNUM *BN_new(void); +void BN_init(BIGNUM *); +void BN_clear_free(BIGNUM *a); +BIGNUM *BN_copy(BIGNUM *a, const BIGNUM *b); +BIGNUM *BN_bin2bn(const unsigned char *s,int len,BIGNUM *ret); +int BN_bn2bin(const BIGNUM *a, unsigned char *to); +int BN_sub(BIGNUM *r, const BIGNUM *a, const BIGNUM *b); +int BN_usub(BIGNUM *r, const BIGNUM *a, const BIGNUM *b); +int BN_uadd(BIGNUM *r, const BIGNUM *a, const BIGNUM *b); +int BN_add(BIGNUM *r, const BIGNUM *a, const BIGNUM *b); +int BN_mod(BIGNUM *rem, const BIGNUM *m, const BIGNUM *d, BN_CTX *ctx); +int BN_div(BIGNUM *dv, BIGNUM *rem, const BIGNUM *m, const BIGNUM *d, + BN_CTX *ctx); +int BN_mul(BIGNUM *r, BIGNUM *a, BIGNUM *b, BN_CTX *ctx); +int BN_sqr(BIGNUM *r, BIGNUM *a,BN_CTX *ctx); +BN_ULONG BN_mod_word(const BIGNUM *a, BN_ULONG w); +BN_ULONG BN_div_word(BIGNUM *a, BN_ULONG w); +int BN_mul_word(BIGNUM *a, BN_ULONG w); +int BN_add_word(BIGNUM *a, BN_ULONG w); +int BN_sub_word(BIGNUM *a, BN_ULONG w); +int BN_set_word(BIGNUM *a, BN_ULONG w); +BN_ULONG BN_get_word(BIGNUM *a); +int BN_cmp(const BIGNUM *a, const BIGNUM *b); +void BN_free(BIGNUM *a); +int BN_is_bit_set(const BIGNUM *a, int n); +int BN_lshift(BIGNUM *r, const BIGNUM *a, int n); +int BN_lshift1(BIGNUM *r, BIGNUM *a); +int BN_exp(BIGNUM *r, BIGNUM *a, BIGNUM *p,BN_CTX *ctx); +int BN_mod_exp(BIGNUM *r, BIGNUM *a, const BIGNUM *p, + const BIGNUM *m,BN_CTX *ctx); +int BN_mod_exp_mont(BIGNUM *r, BIGNUM *a, const BIGNUM *p, + const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *m_ctx); +int BN_mod_exp_mont_word(BIGNUM *r, BN_ULONG a, const BIGNUM *p, + const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *m_ctx); +int BN_mod_exp_simple(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, + const BIGNUM *m,BN_CTX *ctx); +int BN_mask_bits(BIGNUM *a,int n); +int BN_mod_mul(BIGNUM *ret, BIGNUM *a, BIGNUM *b, const BIGNUM *m, BN_CTX *ctx); +int BN_reciprocal(BIGNUM *r, BIGNUM *m, int len, BN_CTX *ctx); +int BN_rshift(BIGNUM *r, BIGNUM *a, int n); +int BN_rshift1(BIGNUM *r, BIGNUM *a); +void BN_clear(BIGNUM *a); +BIGNUM *BN_dup(const BIGNUM *a); +int BN_ucmp(const BIGNUM *a, const BIGNUM *b); +int BN_set_bit(BIGNUM *a, int n); +int BN_clear_bit(BIGNUM *a, int n); +int BN_gcd(BIGNUM *r,BIGNUM *in_a,BIGNUM *in_b,BN_CTX *ctx); +BIGNUM *BN_mod_inverse(BIGNUM *ret,BIGNUM *a, const BIGNUM *n,BN_CTX *ctx); +BIGNUM *BN_generate_prime(BIGNUM *ret,int bits,int safe,BIGNUM *add, + BIGNUM *rem,void (*callback)(int,int,void *),void *cb_arg); +int BN_is_prime(const BIGNUM *p,int nchecks, + void (*callback)(int,int,void *), + BN_CTX *ctx,void *cb_arg); +int BN_is_prime_fasttest(const BIGNUM *p,int nchecks, + void (*callback)(int,int,void *),BN_CTX *ctx,void *cb_arg, + int do_trial_division); + +BN_MONT_CTX *BN_MONT_CTX_new(void ); +void BN_MONT_CTX_init(BN_MONT_CTX *ctx); +int BN_mod_mul_montgomery(BIGNUM *r,BIGNUM *a,BIGNUM *b,BN_MONT_CTX *mont, + BN_CTX *ctx); +int BN_from_montgomery(BIGNUM *r,BIGNUM *a,BN_MONT_CTX *mont,BN_CTX *ctx); +void BN_MONT_CTX_free(BN_MONT_CTX *mont); +int BN_MONT_CTX_set(BN_MONT_CTX *mont,const BIGNUM *modulus,BN_CTX *ctx); +BN_MONT_CTX *BN_MONT_CTX_copy(BN_MONT_CTX *to,BN_MONT_CTX *from); + +void BN_set_params(int mul,int high,int low,int mont); +int BN_get_params(int which); /* 0, mul, 1 high, 2 low, 3 mont */ + +void BN_RECP_CTX_init(BN_RECP_CTX *recp); +BN_RECP_CTX *BN_RECP_CTX_new(void); +void BN_RECP_CTX_free(BN_RECP_CTX *recp); +int BN_RECP_CTX_set(BN_RECP_CTX *recp,const BIGNUM *rdiv,BN_CTX *ctx); +int BN_mod_mul_reciprocal(BIGNUM *r, BIGNUM *x, BIGNUM *y, + BN_RECP_CTX *recp,BN_CTX *ctx); +int BN_mod_exp_recp(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, + const BIGNUM *m, BN_CTX *ctx); +int BN_div_recp(BIGNUM *dv, BIGNUM *rem, BIGNUM *m, + BN_RECP_CTX *recp, BN_CTX *ctx); + +/* library internal functions */ + +#define bn_expand(a,bits) ((((((bits+BN_BITS2-1))/BN_BITS2)) <= (a)->dmax)?\ + (a):bn_expand2((a),(bits)/BN_BITS2+1)) +#define bn_wexpand(a,words) (((words) <= (a)->dmax)?(a):bn_expand2((a),(words))) +BIGNUM *bn_expand2(BIGNUM *a, int words); + +#define bn_fix_top(a) \ + { \ + BN_ULONG *ftl; \ + if ((a)->top > 0) \ + { \ + for (ftl= &((a)->d[(a)->top-1]); (a)->top > 0; (a)->top--) \ + if (*(ftl--)) break; \ + } \ + } + +BN_ULONG bn_mul_add_words(BN_ULONG *rp, BN_ULONG *ap, int num, BN_ULONG w); +BN_ULONG bn_mul_words(BN_ULONG *rp, BN_ULONG *ap, int num, BN_ULONG w); +void bn_sqr_words(BN_ULONG *rp, BN_ULONG *ap, int num); +BN_ULONG bn_div_words(BN_ULONG h, BN_ULONG l, BN_ULONG d); +BN_ULONG bn_add_words(BN_ULONG *rp, BN_ULONG *ap, BN_ULONG *bp,int num); +BN_ULONG bn_sub_words(BN_ULONG *rp, BN_ULONG *ap, BN_ULONG *bp,int num); + +#ifdef BN_DEBUG + void bn_dump1(FILE *o, const char *a, BN_ULONG *b,int n); +# define bn_print(a) {fprintf(stderr, #a "="); BN_print_fp(stderr,a); \ + fprintf(stderr,"\n");} +# define bn_dump(a,n) bn_dump1(stderr,#a,a,n); +#else +# define bn_print(a) +# define bn_dump(a,b) +#endif + +/* BEGIN ERROR CODES */ +/* The following lines are auto generated by the script mkerr.pl. Any changes + * made after this point may be overwritten when the script is next run. + */ + +/* Error codes for the BN functions. */ + +/* Function codes. */ +#define BN_F_BN_CTX_GET 116 +#define BN_F_BN_CTX_NEW 106 +#define BN_F_BN_DIV 107 +#define BN_F_BN_EXPAND2 108 +#define BN_F_BN_MOD_EXP2_MONT 118 +#define BN_F_BN_MOD_EXP_MONT 109 +#define BN_F_BN_MOD_EXP_MONT_WORD 117 +#define BN_F_BN_MOD_INVERSE 110 +#define BN_F_BN_MOD_MUL_RECIPROCAL 111 +#define BN_F_BN_MPI2BN 112 +#define BN_F_BN_NEW 113 +#define BN_F_BN_RAND 114 +#define BN_F_BN_USUB 115 + +/* Reason codes. */ +#define BN_R_ARG2_LT_ARG3 100 +#define BN_R_BAD_RECIPROCAL 101 +#define BN_R_CALLED_WITH_EVEN_MODULUS 102 +#define BN_R_DIV_BY_ZERO 103 +#define BN_R_ENCODING_ERROR 104 +#define BN_R_EXPAND_ON_STATIC_BIGNUM_DATA 105 +#define BN_R_INVALID_LENGTH 106 +#define BN_R_NOT_INITIALIZED 107 +#define BN_R_NO_INVERSE 108 +#define BN_R_TOO_MANY_TEMPORARY_VARIABLES 109 + +#ifdef __cplusplus +} +#endif +#endif + diff --git a/package/network/services/ead/src/tinysrp/bn_add.c b/package/network/services/ead/src/tinysrp/bn_add.c new file mode 100644 index 0000000000..aae4f2b938 --- /dev/null +++ b/package/network/services/ead/src/tinysrp/bn_add.c @@ -0,0 +1,305 @@ +/* crypto/bn/bn_add.c */ +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * 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 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 cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + +#include +#include "bn_lcl.h" + +/* r can == a or b */ +int BN_add(BIGNUM *r, const BIGNUM *a, const BIGNUM *b) + { + const BIGNUM *tmp; + + bn_check_top(a); + bn_check_top(b); + + /* a + b a+b + * a + -b a-b + * -a + b b-a + * -a + -b -(a+b) + */ + if (a->neg ^ b->neg) + { + /* only one is negative */ + if (a->neg) + { tmp=a; a=b; b=tmp; } + + /* we are now a - b */ + + if (BN_ucmp(a,b) < 0) + { + if (!BN_usub(r,b,a)) return(0); + r->neg=1; + } + else + { + if (!BN_usub(r,a,b)) return(0); + r->neg=0; + } + return(1); + } + + if (a->neg) /* both are neg */ + r->neg=1; + else + r->neg=0; + + if (!BN_uadd(r,a,b)) return(0); + return(1); + } + +/* unsigned add of b to a, r must be large enough */ +int BN_uadd(BIGNUM *r, const BIGNUM *a, const BIGNUM *b) + { + register int i; + int max,min; + BN_ULONG *ap,*bp,*rp,carry,t1; + const BIGNUM *tmp; + + bn_check_top(a); + bn_check_top(b); + + if (a->top < b->top) + { tmp=a; a=b; b=tmp; } + max=a->top; + min=b->top; + + if (bn_wexpand(r,max+1) == NULL) + return(0); + + r->top=max; + + + ap=a->d; + bp=b->d; + rp=r->d; + carry=0; + + carry=bn_add_words(rp,ap,bp,min); + rp+=min; + ap+=min; + bp+=min; + i=min; + + if (carry) + { + while (i < max) + { + i++; + t1= *(ap++); + if ((*(rp++)=(t1+1)&BN_MASK2) >= t1) + { + carry=0; + break; + } + } + if ((i >= max) && carry) + { + *(rp++)=1; + r->top++; + } + } + if (rp != ap) + { + for (; itop < b->top) /* hmm... should not be happening */ + { + return(0); + } + + max=a->top; + min=b->top; + if (bn_wexpand(r,max) == NULL) return(0); + + ap=a->d; + bp=b->d; + rp=r->d; + +#if 1 + carry=0; + for (i=0; i t2) break; + } + } +#if 0 + memcpy(rp,ap,sizeof(*rp)*(max-i)); +#else + if (rp != ap) + { + for (;;) + { + if (i++ >= max) break; + rp[0]=ap[0]; + if (i++ >= max) break; + rp[1]=ap[1]; + if (i++ >= max) break; + rp[2]=ap[2]; + if (i++ >= max) break; + rp[3]=ap[3]; + rp+=4; + ap+=4; + } + } +#endif + + r->top=max; + bn_fix_top(r); + return(1); + } + +int BN_sub(BIGNUM *r, const BIGNUM *a, const BIGNUM *b) + { + int max; + int add=0,neg=0; + const BIGNUM *tmp; + + bn_check_top(a); + bn_check_top(b); + + /* a - b a-b + * a - -b a+b + * -a - b -(a+b) + * -a - -b b-a + */ + if (a->neg) + { + if (b->neg) + { tmp=a; a=b; b=tmp; } + else + { add=1; neg=1; } + } + else + { + if (b->neg) { add=1; neg=0; } + } + + if (add) + { + if (!BN_uadd(r,a,b)) return(0); + r->neg=neg; + return(1); + } + + /* We are actually doing a - b :-) */ + + max=(a->top > b->top)?a->top:b->top; + if (bn_wexpand(r,max) == NULL) return(0); + if (BN_ucmp(a,b) < 0) + { + if (!BN_usub(r,b,a)) return(0); + r->neg=1; + } + else + { + if (!BN_usub(r,a,b)) return(0); + r->neg=0; + } + return(1); + } + diff --git a/package/network/services/ead/src/tinysrp/bn_asm.c b/package/network/services/ead/src/tinysrp/bn_asm.c new file mode 100644 index 0000000000..b24c9af7c4 --- /dev/null +++ b/package/network/services/ead/src/tinysrp/bn_asm.c @@ -0,0 +1,382 @@ +/* crypto/bn/bn_asm.c */ +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * 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 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 cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + +#ifndef BN_DEBUG +# undef NDEBUG /* avoid conflicting definitions */ +# define NDEBUG +#endif + +#include +#include +#include "bn_lcl.h" + +#if defined(BN_LLONG) || defined(BN_UMULT_HIGH) + +BN_ULONG bn_mul_add_words(BN_ULONG *rp, BN_ULONG *ap, int num, BN_ULONG w) + { + BN_ULONG c1=0; + + assert(num >= 0); + if (num <= 0) return(c1); + + while (num&~3) + { + mul_add(rp[0],ap[0],w,c1); + mul_add(rp[1],ap[1],w,c1); + mul_add(rp[2],ap[2],w,c1); + mul_add(rp[3],ap[3],w,c1); + ap+=4; rp+=4; num-=4; + } + if (num) + { + mul_add(rp[0],ap[0],w,c1); if (--num==0) return c1; + mul_add(rp[1],ap[1],w,c1); if (--num==0) return c1; + mul_add(rp[2],ap[2],w,c1); return c1; + } + + return(c1); + } + +BN_ULONG bn_mul_words(BN_ULONG *rp, BN_ULONG *ap, int num, BN_ULONG w) + { + BN_ULONG c1=0; + + assert(num >= 0); + if (num <= 0) return(c1); + + while (num&~3) + { + mul(rp[0],ap[0],w,c1); + mul(rp[1],ap[1],w,c1); + mul(rp[2],ap[2],w,c1); + mul(rp[3],ap[3],w,c1); + ap+=4; rp+=4; num-=4; + } + if (num) + { + mul(rp[0],ap[0],w,c1); if (--num == 0) return c1; + mul(rp[1],ap[1],w,c1); if (--num == 0) return c1; + mul(rp[2],ap[2],w,c1); + } + return(c1); + } + +void bn_sqr_words(BN_ULONG *r, BN_ULONG *a, int n) + { + assert(n >= 0); + if (n <= 0) return; + while (n&~3) + { + sqr(r[0],r[1],a[0]); + sqr(r[2],r[3],a[1]); + sqr(r[4],r[5],a[2]); + sqr(r[6],r[7],a[3]); + a+=4; r+=8; n-=4; + } + if (n) + { + sqr(r[0],r[1],a[0]); if (--n == 0) return; + sqr(r[2],r[3],a[1]); if (--n == 0) return; + sqr(r[4],r[5],a[2]); + } + } + +#else /* !(defined(BN_LLONG) || defined(BN_UMULT_HIGH)) */ + +BN_ULONG bn_mul_add_words(BN_ULONG *rp, BN_ULONG *ap, int num, BN_ULONG w) + { + BN_ULONG c=0; + BN_ULONG bl,bh; + + assert(num >= 0); + if (num <= 0) return((BN_ULONG)0); + + bl=LBITS(w); + bh=HBITS(w); + + for (;;) + { + mul_add(rp[0],ap[0],bl,bh,c); + if (--num == 0) break; + mul_add(rp[1],ap[1],bl,bh,c); + if (--num == 0) break; + mul_add(rp[2],ap[2],bl,bh,c); + if (--num == 0) break; + mul_add(rp[3],ap[3],bl,bh,c); + if (--num == 0) break; + ap+=4; + rp+=4; + } + return(c); + } + +BN_ULONG bn_mul_words(BN_ULONG *rp, BN_ULONG *ap, int num, BN_ULONG w) + { + BN_ULONG carry=0; + BN_ULONG bl,bh; + + assert(num >= 0); + if (num <= 0) return((BN_ULONG)0); + + bl=LBITS(w); + bh=HBITS(w); + + for (;;) + { + mul(rp[0],ap[0],bl,bh,carry); + if (--num == 0) break; + mul(rp[1],ap[1],bl,bh,carry); + if (--num == 0) break; + mul(rp[2],ap[2],bl,bh,carry); + if (--num == 0) break; + mul(rp[3],ap[3],bl,bh,carry); + if (--num == 0) break; + ap+=4; + rp+=4; + } + return(carry); + } + +void bn_sqr_words(BN_ULONG *r, BN_ULONG *a, int n) + { + assert(n >= 0); + if (n <= 0) return; + for (;;) + { + sqr64(r[0],r[1],a[0]); + if (--n == 0) break; + + sqr64(r[2],r[3],a[1]); + if (--n == 0) break; + + sqr64(r[4],r[5],a[2]); + if (--n == 0) break; + + sqr64(r[6],r[7],a[3]); + if (--n == 0) break; + + a+=4; + r+=8; + } + } + +#endif /* !(defined(BN_LLONG) || defined(BN_UMULT_HIGH)) */ + +#if defined(BN_LLONG) && defined(BN_DIV2W) + +BN_ULONG bn_div_words(BN_ULONG h, BN_ULONG l, BN_ULONG d) + { + return((BN_ULONG)(((((BN_ULLONG)h)< (BN_ULONG)1<= d) h-=d; + + if (i) + { + d<<=i; + h=(h<>(BN_BITS2-i)); + l<<=i; + } + dh=(d&BN_MASK2h)>>BN_BITS4; + dl=(d&BN_MASK2l); + for (;;) + { + if ((h>>BN_BITS4) == dh) + q=BN_MASK2l; + else + q=h/dh; + + th=q*dh; + tl=dl*q; + for (;;) + { + t=h-th; + if ((t&BN_MASK2h) || + ((tl) <= ( + (t<>BN_BITS4)))) + break; + q--; + th-=dh; + tl-=dl; + } + t=(tl>>BN_BITS4); + tl=(tl<>BN_BITS4))&BN_MASK2; + l=(l&BN_MASK2l)<= 0); + if (n <= 0) return((BN_ULONG)0); + + for (;;) + { + ll+=(BN_ULLONG)a[0]+b[0]; + r[0]=(BN_ULONG)ll&BN_MASK2; + ll>>=BN_BITS2; + if (--n <= 0) break; + + ll+=(BN_ULLONG)a[1]+b[1]; + r[1]=(BN_ULONG)ll&BN_MASK2; + ll>>=BN_BITS2; + if (--n <= 0) break; + + ll+=(BN_ULLONG)a[2]+b[2]; + r[2]=(BN_ULONG)ll&BN_MASK2; + ll>>=BN_BITS2; + if (--n <= 0) break; + + ll+=(BN_ULLONG)a[3]+b[3]; + r[3]=(BN_ULONG)ll&BN_MASK2; + ll>>=BN_BITS2; + if (--n <= 0) break; + + a+=4; + b+=4; + r+=4; + } + return((BN_ULONG)ll); + } +#else /* !BN_LLONG */ +BN_ULONG bn_add_words(BN_ULONG *r, BN_ULONG *a, BN_ULONG *b, int n) + { + BN_ULONG c,l,t; + + assert(n >= 0); + if (n <= 0) return((BN_ULONG)0); + + c=0; + for (;;) + { + t=a[0]; + t=(t+c)&BN_MASK2; + c=(t < c); + l=(t+b[0])&BN_MASK2; + c+=(l < t); + r[0]=l; + if (--n <= 0) break; + + t=a[1]; + t=(t+c)&BN_MASK2; + c=(t < c); + l=(t+b[1])&BN_MASK2; + c+=(l < t); + r[1]=l; + if (--n <= 0) break; + + t=a[2]; + t=(t+c)&BN_MASK2; + c=(t < c); + l=(t+b[2])&BN_MASK2; + c+=(l < t); + r[2]=l; + if (--n <= 0) break; + + t=a[3]; + t=(t+c)&BN_MASK2; + c=(t < c); + l=(t+b[3])&BN_MASK2; + c+=(l < t); + r[3]=l; + if (--n <= 0) break; + + a+=4; + b+=4; + r+=4; + } + return((BN_ULONG)c); + } +#endif /* !BN_LLONG */ diff --git a/package/network/services/ead/src/tinysrp/bn_ctx.c b/package/network/services/ead/src/tinysrp/bn_ctx.c new file mode 100644 index 0000000000..20a6605ab8 --- /dev/null +++ b/package/network/services/ead/src/tinysrp/bn_ctx.c @@ -0,0 +1,142 @@ +/* crypto/bn/bn_ctx.c */ +/* Written by Ulf Moeller for the OpenSSL project. */ +/* ==================================================================== + * Copyright (c) 1998-2000 The OpenSSL Project. 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. All advertising materials mentioning features or use of this + * software must display the following acknowledgment: + * "This product includes software developed by the OpenSSL Project + * for use in the OpenSSL Toolkit. (http://www.openssl.org/)" + * + * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to + * endorse or promote products derived from this software without + * prior written permission. For written permission, please contact + * openssl-core@openssl.org. + * + * 5. Products derived from this software may not be called "OpenSSL" + * nor may "OpenSSL" appear in their names without prior written + * permission of the OpenSSL Project. + * + * 6. Redistributions of any form whatsoever must retain the following + * acknowledgment: + * "This product includes software developed by the OpenSSL Project + * for use in the OpenSSL Toolkit (http://www.openssl.org/)" + * + * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY + * EXPRESSED 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 OpenSSL PROJECT OR + * ITS 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. + * ==================================================================== + * + * This product includes cryptographic software written by Eric Young + * (eay@cryptsoft.com). This product includes software written by Tim + * Hudson (tjh@cryptsoft.com). + * + */ + +#ifndef BN_CTX_DEBUG +# undef NDEBUG /* avoid conflicting definitions */ +# define NDEBUG +#endif + +#include +#include +#include +#include + + +BN_CTX *BN_CTX_new(void) + { + BN_CTX *ret; + + ret=(BN_CTX *)malloc(sizeof(BN_CTX)); + if (ret == NULL) + { + return(NULL); + } + + BN_CTX_init(ret); + ret->flags=BN_FLG_MALLOCED; + return(ret); + } + +void BN_CTX_init(BN_CTX *ctx) + { + int i; + ctx->tos = 0; + ctx->flags = 0; + ctx->depth = 0; + ctx->too_many = 0; + for (i = 0; i < BN_CTX_NUM; i++) + BN_init(&(ctx->bn[i])); + } + +void BN_CTX_free(BN_CTX *ctx) + { + int i; + + if (ctx == NULL) return; + assert(ctx->depth == 0); + + for (i=0; i < BN_CTX_NUM; i++) + BN_clear_free(&(ctx->bn[i])); + if (ctx->flags & BN_FLG_MALLOCED) + free(ctx); + } + +void BN_CTX_start(BN_CTX *ctx) + { + if (ctx->depth < BN_CTX_NUM_POS) + ctx->pos[ctx->depth] = ctx->tos; + ctx->depth++; + } + +BIGNUM *BN_CTX_get(BN_CTX *ctx) + { + if (ctx->depth > BN_CTX_NUM_POS || ctx->tos >= BN_CTX_NUM) + { + if (!ctx->too_many) + { + /* disable error code until BN_CTX_end is called: */ + ctx->too_many = 1; + } + return NULL; + } + return (&(ctx->bn[ctx->tos++])); + } + +void BN_CTX_end(BN_CTX *ctx) + { + if (ctx == NULL) return; + assert(ctx->depth > 0); + if (ctx->depth == 0) + /* should never happen, but we can tolerate it if not in + * debug mode (could be a 'goto err' in the calling function + * before BN_CTX_start was reached) */ + BN_CTX_start(ctx); + + ctx->too_many = 0; + ctx->depth--; + if (ctx->depth < BN_CTX_NUM_POS) + ctx->tos = ctx->pos[ctx->depth]; + } diff --git a/package/network/services/ead/src/tinysrp/bn_div.c b/package/network/services/ead/src/tinysrp/bn_div.c new file mode 100644 index 0000000000..fd21913d1e --- /dev/null +++ b/package/network/services/ead/src/tinysrp/bn_div.c @@ -0,0 +1,378 @@ +/* crypto/bn/bn_div.c */ +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * 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 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 cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + +#include +#include "bn_lcl.h" + +#define NO_ASM + +/* The old slow way */ +#if 0 +int BN_div(BIGNUM *dv, BIGNUM *rem, const BIGNUM *m, const BIGNUM *d, + BN_CTX *ctx) + { + int i,nm,nd; + int ret = 0; + BIGNUM *D; + + bn_check_top(m); + bn_check_top(d); + if (BN_is_zero(d)) + { + return(0); + } + + if (BN_ucmp(m,d) < 0) + { + if (rem != NULL) + { if (BN_copy(rem,m) == NULL) return(0); } + if (dv != NULL) BN_zero(dv); + return(1); + } + + BN_CTX_start(ctx); + D = BN_CTX_get(ctx); + if (dv == NULL) dv = BN_CTX_get(ctx); + if (rem == NULL) rem = BN_CTX_get(ctx); + if (D == NULL || dv == NULL || rem == NULL) + goto end; + + nd=BN_num_bits(d); + nm=BN_num_bits(m); + if (BN_copy(D,d) == NULL) goto end; + if (BN_copy(rem,m) == NULL) goto end; + + /* The next 2 are needed so we can do a dv->d[0]|=1 later + * since BN_lshift1 will only work once there is a value :-) */ + BN_zero(dv); + bn_wexpand(dv,1); + dv->top=1; + + if (!BN_lshift(D,D,nm-nd)) goto end; + for (i=nm-nd; i>=0; i--) + { + if (!BN_lshift1(dv,dv)) goto end; + if (BN_ucmp(rem,D) >= 0) + { + dv->d[0]|=1; + if (!BN_usub(rem,rem,D)) goto end; + } +/* CAN IMPROVE (and have now :=) */ + if (!BN_rshift1(D,D)) goto end; + } + rem->neg=BN_is_zero(rem)?0:m->neg; + dv->neg=m->neg^d->neg; + ret = 1; + end: + BN_CTX_end(ctx); + return(ret); + } + +#else + +#if !defined(NO_ASM) && !defined(NO_INLINE_ASM) && !defined(PEDANTIC) && !defined(BN_DIV3W) +# if defined(__GNUC__) && __GNUC__>=2 +# if defined(__i386) + /* + * There were two reasons for implementing this template: + * - GNU C generates a call to a function (__udivdi3 to be exact) + * in reply to ((((BN_ULLONG)n0)< + */ +# define bn_div_words(n0,n1,d0) \ + ({ asm volatile ( \ + "divl %4" \ + : "=a"(q), "=d"(rem) \ + : "a"(n1), "d"(n0), "g"(d0) \ + : "cc"); \ + q; \ + }) +# define REMAINDER_IS_ALREADY_CALCULATED +# endif /* __ */ +# endif /* __GNUC__ */ +#endif /* NO_ASM */ + +int BN_div(BIGNUM *dv, BIGNUM *rm, const BIGNUM *num, const BIGNUM *divisor, + BN_CTX *ctx) + { + int norm_shift,i,j,loop; + BIGNUM *tmp,wnum,*snum,*sdiv,*res; + BN_ULONG *resp,*wnump; + BN_ULONG d0,d1; + int num_n,div_n; + + bn_check_top(num); + bn_check_top(divisor); + + if (BN_is_zero(divisor)) + { + return(0); + } + + if (BN_ucmp(num,divisor) < 0) + { + if (rm != NULL) + { if (BN_copy(rm,num) == NULL) return(0); } + if (dv != NULL) BN_zero(dv); + return(1); + } + + BN_CTX_start(ctx); + tmp=BN_CTX_get(ctx); + tmp->neg=0; + snum=BN_CTX_get(ctx); + sdiv=BN_CTX_get(ctx); + if (dv == NULL) + res=BN_CTX_get(ctx); + else res=dv; + if (res == NULL) goto err; + + /* First we normalise the numbers */ + norm_shift=BN_BITS2-((BN_num_bits(divisor))%BN_BITS2); + BN_lshift(sdiv,divisor,norm_shift); + sdiv->neg=0; + norm_shift+=BN_BITS2; + BN_lshift(snum,num,norm_shift); + snum->neg=0; + div_n=sdiv->top; + num_n=snum->top; + loop=num_n-div_n; + + /* Lets setup a 'window' into snum + * This is the part that corresponds to the current + * 'area' being divided */ + BN_init(&wnum); + wnum.d= &(snum->d[loop]); + wnum.top= div_n; + wnum.dmax= snum->dmax+1; /* a bit of a lie */ + + /* Get the top 2 words of sdiv */ + /* i=sdiv->top; */ + d0=sdiv->d[div_n-1]; + d1=(div_n == 1)?0:sdiv->d[div_n-2]; + + /* pointer to the 'top' of snum */ + wnump= &(snum->d[num_n-1]); + + /* Setup to 'res' */ + res->neg= (num->neg^divisor->neg); + if (!bn_wexpand(res,(loop+1))) goto err; + res->top=loop; + resp= &(res->d[loop-1]); + + /* space for temp */ + if (!bn_wexpand(tmp,(div_n+1))) goto err; + + if (BN_ucmp(&wnum,sdiv) >= 0) + { + if (!BN_usub(&wnum,&wnum,sdiv)) goto err; + *resp=1; + res->d[res->top-1]=1; + } + else + res->top--; + resp--; + + for (i=0; id,sdiv->d,div_n,q); + wnum.d--; wnum.top++; + tmp->d[div_n]=l0; + for (j=div_n+1; j>0; j--) + if (tmp->d[j-1]) break; + tmp->top=j; + + j=wnum.top; + BN_sub(&wnum,&wnum,tmp); + + snum->top=snum->top+wnum.top-j; + + if (wnum.neg) + { + q--; + j=wnum.top; + BN_add(&wnum,&wnum,sdiv); + snum->top+=wnum.top-j; + } + *(resp--)=q; + wnump--; + } + if (rm != NULL) + { + BN_rshift(rm,snum,norm_shift); + rm->neg=num->neg; + } + BN_CTX_end(ctx); + return(1); +err: + BN_CTX_end(ctx); + return(0); + } + +#endif + +/* rem != m */ +int BN_mod(BIGNUM *rem, const BIGNUM *m, const BIGNUM *d, BN_CTX *ctx) + { +#if 0 /* The old slow way */ + int i,nm,nd; + BIGNUM *dv; + + if (BN_ucmp(m,d) < 0) + return((BN_copy(rem,m) == NULL)?0:1); + + BN_CTX_start(ctx); + dv=BN_CTX_get(ctx); + + if (!BN_copy(rem,m)) goto err; + + nm=BN_num_bits(rem); + nd=BN_num_bits(d); + if (!BN_lshift(dv,d,nm-nd)) goto err; + for (i=nm-nd; i>=0; i--) + { + if (BN_cmp(rem,dv) >= 0) + { + if (!BN_sub(rem,rem,dv)) goto err; + } + if (!BN_rshift1(dv,dv)) goto err; + } + BN_CTX_end(ctx); + return(1); + err: + BN_CTX_end(ctx); + return(0); +#else + return(BN_div(NULL,rem,m,d,ctx)); +#endif + } + diff --git a/package/network/services/ead/src/tinysrp/bn_exp.c b/package/network/services/ead/src/tinysrp/bn_exp.c new file mode 100644 index 0000000000..09afb79f6d --- /dev/null +++ b/package/network/services/ead/src/tinysrp/bn_exp.c @@ -0,0 +1,395 @@ +/* crypto/bn/bn_exp.c */ +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * 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 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 cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ +/* ==================================================================== + * Copyright (c) 1998-2000 The OpenSSL Project. 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. All advertising materials mentioning features or use of this + * software must display the following acknowledgment: + * "This product includes software developed by the OpenSSL Project + * for use in the OpenSSL Toolkit. (http://www.openssl.org/)" + * + * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to + * endorse or promote products derived from this software without + * prior written permission. For written permission, please contact + * openssl-core@openssl.org. + * + * 5. Products derived from this software may not be called "OpenSSL" + * nor may "OpenSSL" appear in their names without prior written + * permission of the OpenSSL Project. + * + * 6. Redistributions of any form whatsoever must retain the following + * acknowledgment: + * "This product includes software developed by the OpenSSL Project + * for use in the OpenSSL Toolkit (http://www.openssl.org/)" + * + * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY + * EXPRESSED 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 OpenSSL PROJECT OR + * ITS 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. + * ==================================================================== + * + * This product includes cryptographic software written by Eric Young + * (eay@cryptsoft.com). This product includes software written by Tim + * Hudson (tjh@cryptsoft.com). + * + */ + + +#include +#include "bn_lcl.h" + +#define TABLE_SIZE 32 + +/* slow but works */ +int BN_mod_mul(BIGNUM *ret, BIGNUM *a, BIGNUM *b, const BIGNUM *m, BN_CTX *ctx) + { + BIGNUM *t; + int r=0; + + bn_check_top(a); + bn_check_top(b); + bn_check_top(m); + + BN_CTX_start(ctx); + if ((t = BN_CTX_get(ctx)) == NULL) goto err; + if (a == b) + { if (!BN_sqr(t,a,ctx)) goto err; } + else + { if (!BN_mul(t,a,b,ctx)) goto err; } + if (!BN_mod(ret,t,m,ctx)) goto err; + r=1; +err: + BN_CTX_end(ctx); + return(r); + } + +int BN_mod_exp(BIGNUM *r, BIGNUM *a, const BIGNUM *p, const BIGNUM *m, + BN_CTX *ctx) + { + int ret; + + bn_check_top(a); + bn_check_top(p); + bn_check_top(m); + +#ifdef MONT_MUL_MOD + /* I have finally been able to take out this pre-condition of + * the top bit being set. It was caused by an error in BN_div + * with negatives. There was also another problem when for a^b%m + * a >= m. eay 07-May-97 */ +/* if ((m->d[m->top-1]&BN_TBIT) && BN_is_odd(m)) */ + + if (BN_is_odd(m)) + { + if (a->top == 1) + { + BN_ULONG A = a->d[0]; + ret=BN_mod_exp_mont_word(r,A,p,m,ctx,NULL); + } + else + ret=BN_mod_exp_mont(r,a,p,m,ctx,NULL); + } + else +#endif +#ifdef RECP_MUL_MOD + { ret=BN_mod_exp_recp(r,a,p,m,ctx); } +#else + { ret=BN_mod_exp_simple(r,a,p,m,ctx); } +#endif + + return(ret); + } + + +#ifdef RECP_MUL_MOD +int BN_mod_exp_recp(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, + const BIGNUM *m, BN_CTX *ctx) + { + int i,j,bits,ret=0,wstart,wend,window,wvalue; + int start=1,ts=0; + BIGNUM *aa; + BIGNUM val[TABLE_SIZE]; + BN_RECP_CTX recp; + + bits=BN_num_bits(p); + + if (bits == 0) + { + BN_one(r); + return(1); + } + + BN_CTX_start(ctx); + if ((aa = BN_CTX_get(ctx)) == NULL) goto err; + + BN_RECP_CTX_init(&recp); + if (BN_RECP_CTX_set(&recp,m,ctx) <= 0) goto err; + + BN_init(&(val[0])); + ts=1; + + if (!BN_mod(&(val[0]),a,m,ctx)) goto err; /* 1 */ + + window = BN_window_bits_for_exponent_size(bits); + if (window > 1) + { + if (!BN_mod_mul_reciprocal(aa,&(val[0]),&(val[0]),&recp,ctx)) + goto err; /* 2 */ + j=1<<(window-1); + for (i=1; i>1]),&recp,ctx)) + goto err; + + /* move the 'window' down further */ + wstart-=wend+1; + wvalue=0; + start=0; + if (wstart < 0) break; + } + ret=1; +err: + BN_CTX_end(ctx); + for (i=0; i 1) + { + if (!BN_mod_mul(d,&(val[0]),&(val[0]),m,ctx)) + goto err; /* 2 */ + j=1<<(window-1); + for (i=1; i>1]),m,ctx)) + goto err; + + /* move the 'window' down further */ + wstart-=wend+1; + wvalue=0; + start=0; + if (wstart < 0) break; + } + ret=1; +err: + BN_CTX_end(ctx); + for (i=0; i + +#ifdef __cplusplus +extern "C" { +#endif + + +/* + * BN_window_bits_for_exponent_size -- macro for sliding window mod_exp functions + * + * + * For window size 'w' (w >= 2) and a random 'b' bits exponent, + * the number of multiplications is a constant plus on average + * + * 2^(w-1) + (b-w)/(w+1); + * + * here 2^(w-1) is for precomputing the table (we actually need + * entries only for windows that have the lowest bit set), and + * (b-w)/(w+1) is an approximation for the expected number of + * w-bit windows, not counting the first one. + * + * Thus we should use + * + * w >= 6 if b > 671 + * w = 5 if 671 > b > 239 + * w = 4 if 239 > b > 79 + * w = 3 if 79 > b > 23 + * w <= 2 if 23 > b + * + * (with draws in between). Very small exponents are often selected + * with low Hamming weight, so we use w = 1 for b <= 23. + */ +#if 1 +#define BN_window_bits_for_exponent_size(b) \ + ((b) > 671 ? 6 : \ + (b) > 239 ? 5 : \ + (b) > 79 ? 4 : \ + (b) > 23 ? 3 : 1) +#else +/* Old SSLeay/OpenSSL table. + * Maximum window size was 5, so this table differs for b==1024; + * but it coincides for other interesting values (b==160, b==512). + */ +#define BN_window_bits_for_exponent_size(b) \ + ((b) > 255 ? 5 : \ + (b) > 127 ? 4 : \ + (b) > 17 ? 3 : 1) +#endif + + + +/* Pentium pro 16,16,16,32,64 */ +/* Alpha 16,16,16,16.64 */ +#define BN_MULL_SIZE_NORMAL (16) /* 32 */ +#define BN_MUL_RECURSIVE_SIZE_NORMAL (16) /* 32 less than */ +#define BN_SQR_RECURSIVE_SIZE_NORMAL (16) /* 32 */ +#define BN_MUL_LOW_RECURSIVE_SIZE_NORMAL (32) /* 32 */ +#define BN_MONT_CTX_SET_SIZE_WORD (64) /* 32 */ + +#if !defined(NO_ASM) && !defined(NO_INLINE_ASM) && !defined(PEDANTIC) +/* + * BN_UMULT_HIGH section. + * + * No, I'm not trying to overwhelm you when stating that the + * product of N-bit numbers is 2*N bits wide:-) No, I don't expect + * you to be impressed when I say that if the compiler doesn't + * support 2*N integer type, then you have to replace every N*N + * multiplication with 4 (N/2)*(N/2) accompanied by some shifts + * and additions which unavoidably results in severe performance + * penalties. Of course provided that the hardware is capable of + * producing 2*N result... That's when you normally start + * considering assembler implementation. However! It should be + * pointed out that some CPUs (most notably Alpha, PowerPC and + * upcoming IA-64 family:-) provide *separate* instruction + * calculating the upper half of the product placing the result + * into a general purpose register. Now *if* the compiler supports + * inline assembler, then it's not impossible to implement the + * "bignum" routines (and have the compiler optimize 'em) + * exhibiting "native" performance in C. That's what BN_UMULT_HIGH + * macro is about:-) + * + * + */ +# if defined(__alpha) && (defined(SIXTY_FOUR_BIT_LONG) || defined(SIXTY_FOUR_BIT)) +# if defined(__DECC) +# include +# define BN_UMULT_HIGH(a,b) (BN_ULONG)asm("umulh %a0,%a1,%v0",(a),(b)) +# elif defined(__GNUC__) +# define BN_UMULT_HIGH(a,b) ({ \ + register BN_ULONG ret; \ + asm ("umulh %1,%2,%0" \ + : "=r"(ret) \ + : "r"(a), "r"(b)); \ + ret; }) +# endif /* compiler */ +# elif defined(_ARCH_PPC) && defined(__64BIT__) && defined(SIXTY_FOUR_BIT_LONG) +# if defined(__GNUC__) +# define BN_UMULT_HIGH(a,b) ({ \ + register BN_ULONG ret; \ + asm ("mulhdu %0,%1,%2" \ + : "=r"(ret) \ + : "r"(a), "r"(b)); \ + ret; }) +# endif /* compiler */ +# endif /* cpu */ +#endif /* NO_ASM */ + +/************************************************************* + * Using the long long type + */ +#define Lw(t) (((BN_ULONG)(t))&BN_MASK2) +#define Hw(t) (((BN_ULONG)((t)>>BN_BITS2))&BN_MASK2) + +/* This is used for internal error checking and is not normally used */ +#ifdef BN_DEBUG +# include +# define bn_check_top(a) assert ((a)->top >= 0 && (a)->top <= (a)->dmax); +#else +# define bn_check_top(a) +#endif + +/* This macro is to add extra stuff for development checking */ +#ifdef BN_DEBUG +#define bn_set_max(r) ((r)->max=(r)->top,BN_set_flags((r),BN_FLG_STATIC_DATA)) +#else +#define bn_set_max(r) +#endif + +/* These macros are used to 'take' a section of a bignum for read only use */ +#define bn_set_low(r,a,n) \ + { \ + (r)->top=((a)->top > (n))?(n):(a)->top; \ + (r)->d=(a)->d; \ + (r)->neg=(a)->neg; \ + (r)->flags|=BN_FLG_STATIC_DATA; \ + bn_set_max(r); \ + } + +#define bn_set_high(r,a,n) \ + { \ + if ((a)->top > (n)) \ + { \ + (r)->top=(a)->top-n; \ + (r)->d= &((a)->d[n]); \ + } \ + else \ + (r)->top=0; \ + (r)->neg=(a)->neg; \ + (r)->flags|=BN_FLG_STATIC_DATA; \ + bn_set_max(r); \ + } + +#ifdef BN_LLONG +#define mul_add(r,a,w,c) { \ + BN_ULLONG t; \ + t=(BN_ULLONG)w * (a) + (r) + (c); \ + (r)= Lw(t); \ + (c)= Hw(t); \ + } + +#define mul(r,a,w,c) { \ + BN_ULLONG t; \ + t=(BN_ULLONG)w * (a) + (c); \ + (r)= Lw(t); \ + (c)= Hw(t); \ + } + +#define sqr(r0,r1,a) { \ + BN_ULLONG t; \ + t=(BN_ULLONG)(a)*(a); \ + (r0)=Lw(t); \ + (r1)=Hw(t); \ + } + +#elif defined(BN_UMULT_HIGH) +#define mul_add(r,a,w,c) { \ + BN_ULONG high,low,ret,tmp=(a); \ + ret = (r); \ + high= BN_UMULT_HIGH(w,tmp); \ + ret += (c); \ + low = (w) * tmp; \ + (c) = (ret<(c))?1:0; \ + (c) += high; \ + ret += low; \ + (c) += (ret>BN_BITS4)&BN_MASK2l) +#define L2HBITS(a) ((BN_ULONG)((a)&BN_MASK2l)<>BN_BITS2)&BN_MASKl) +#define LL2HBITS(a) ((BN_ULLONG)((a)&BN_MASKl)<>(BN_BITS4-1); \ + m =(m&BN_MASK2l)<<(BN_BITS4+1); \ + l=(l+m)&BN_MASK2; if (l < m) h++; \ + (lo)=l; \ + (ho)=h; \ + } + +#define mul_add(r,a,bl,bh,c) { \ + BN_ULONG l,h; \ + \ + h= (a); \ + l=LBITS(h); \ + h=HBITS(h); \ + mul64(l,h,(bl),(bh)); \ + \ + /* non-multiply part */ \ + l=(l+(c))&BN_MASK2; if (l < (c)) h++; \ + (c)=(r); \ + l=(l+(c))&BN_MASK2; if (l < (c)) h++; \ + (c)=h&BN_MASK2; \ + (r)=l; \ + } + +#define mul(r,a,bl,bh,c) { \ + BN_ULONG l,h; \ + \ + h= (a); \ + l=LBITS(h); \ + h=HBITS(h); \ + mul64(l,h,(bl),(bh)); \ + \ + /* non-multiply part */ \ + l+=(c); if ((l&BN_MASK2) < (c)) h++; \ + (c)=h&BN_MASK2; \ + (r)=l&BN_MASK2; \ + } +#endif /* !BN_LLONG */ + +void bn_mul_normal(BN_ULONG *r,BN_ULONG *a,int na,BN_ULONG *b,int nb); +void bn_mul_comba8(BN_ULONG *r,BN_ULONG *a,BN_ULONG *b); +void bn_mul_comba4(BN_ULONG *r,BN_ULONG *a,BN_ULONG *b); +void bn_sqr_normal(BN_ULONG *r, BN_ULONG *a, int n, BN_ULONG *tmp); +void bn_sqr_comba8(BN_ULONG *r,BN_ULONG *a); +void bn_sqr_comba4(BN_ULONG *r,BN_ULONG *a); +int bn_cmp_words(BN_ULONG *a,BN_ULONG *b,int n); +void bn_mul_recursive(BN_ULONG *r,BN_ULONG *a,BN_ULONG *b,int n2,BN_ULONG *t); +void bn_mul_part_recursive(BN_ULONG *r,BN_ULONG *a,BN_ULONG *b, + int tn, int n,BN_ULONG *t); +void bn_sqr_recursive(BN_ULONG *r,BN_ULONG *a, int n2, BN_ULONG *t); +void bn_mul_low_normal(BN_ULONG *r,BN_ULONG *a,BN_ULONG *b, int n); +void bn_mul_low_recursive(BN_ULONG *r,BN_ULONG *a,BN_ULONG *b,int n2, + BN_ULONG *t); +void bn_mul_high(BN_ULONG *r,BN_ULONG *a,BN_ULONG *b,BN_ULONG *l,int n2, + BN_ULONG *t); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/package/network/services/ead/src/tinysrp/bn_lib.c b/package/network/services/ead/src/tinysrp/bn_lib.c new file mode 100644 index 0000000000..cfa0d75665 --- /dev/null +++ b/package/network/services/ead/src/tinysrp/bn_lib.c @@ -0,0 +1,576 @@ +/* crypto/bn/bn_lib.c */ +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * 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 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 cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + +#ifndef BN_DEBUG +# undef NDEBUG /* avoid conflicting definitions */ +# define NDEBUG +#endif + +#include +#include +#include +#include +#include "bn_lcl.h" + +const char *BN_version="Big Number"; + +/* For a 32 bit machine + * 2 - 4 == 128 + * 3 - 8 == 256 + * 4 - 16 == 512 + * 5 - 32 == 1024 + * 6 - 64 == 2048 + * 7 - 128 == 4096 + * 8 - 256 == 8192 + */ +static int bn_limit_bits=0; +static int bn_limit_num=8; /* (1<>56)]+56); + } + else return(bits[(int)(l>>48)]+48); + } + else + { + if (l & 0x0000ff0000000000L) + { + return(bits[(int)(l>>40)]+40); + } + else return(bits[(int)(l>>32)]+32); + } + } + else +#else +#ifdef SIXTY_FOUR_BIT + if (l & 0xffffffff00000000LL) + { + if (l & 0xffff000000000000LL) + { + if (l & 0xff00000000000000LL) + { + return(bits[(int)(l>>56)]+56); + } + else return(bits[(int)(l>>48)]+48); + } + else + { + if (l & 0x0000ff0000000000LL) + { + return(bits[(int)(l>>40)]+40); + } + else return(bits[(int)(l>>32)]+32); + } + } + else +#endif +#endif + { +#if defined(THIRTY_TWO_BIT) || defined(SIXTY_FOUR_BIT) || defined(SIXTY_FOUR_BIT_LONG) + if (l & 0xffff0000L) + { + if (l & 0xff000000L) + return(bits[(int)(l>>24L)]+24); + else return(bits[(int)(l>>16L)]+16); + } + else +#endif + { +#if defined(SIXTEEN_BIT) || defined(THIRTY_TWO_BIT) || defined(SIXTY_FOUR_BIT) || defined(SIXTY_FOUR_BIT_LONG) + if (l & 0xff00L) + return(bits[(int)(l>>8)]+8); + else +#endif + return(bits[(int)(l )] ); + } + } + } + +int BN_num_bits(const BIGNUM *a) + { + BN_ULONG l; + int i; + + bn_check_top(a); + + if (a->top == 0) return(0); + l=a->d[a->top-1]; + assert(l != 0); + i=(a->top-1)*BN_BITS2; + return(i+BN_num_bits_word(l)); + } + +void BN_clear_free(BIGNUM *a) + { + int i; + + if (a == NULL) return; + if (a->d != NULL) + { + memset(a->d,0,a->dmax*sizeof(a->d[0])); + if (!(BN_get_flags(a,BN_FLG_STATIC_DATA))) + free(a->d); + } + i=BN_get_flags(a,BN_FLG_MALLOCED); + memset(a,0,sizeof(BIGNUM)); + if (i) + free(a); + } + +void BN_free(BIGNUM *a) + { + if (a == NULL) return; + if ((a->d != NULL) && !(BN_get_flags(a,BN_FLG_STATIC_DATA))) + free(a->d); + a->flags|=BN_FLG_FREE; /* REMOVE? */ + if (a->flags & BN_FLG_MALLOCED) + free(a); + } + +void BN_init(BIGNUM *a) + { + memset(a,0,sizeof(BIGNUM)); + } + +BIGNUM *BN_new(void) + { + BIGNUM *ret; + + if ((ret=(BIGNUM *)malloc(sizeof(BIGNUM))) == NULL) + { + return(NULL); + } + ret->flags=BN_FLG_MALLOCED; + ret->top=0; + ret->neg=0; + ret->dmax=0; + ret->d=NULL; + return(ret); + } + +/* This is an internal function that should not be used in applications. + * It ensures that 'b' has enough room for a 'words' word number number. + * It is mostly used by the various BIGNUM routines. If there is an error, + * NULL is returned. If not, 'b' is returned. */ + +BIGNUM *bn_expand2(BIGNUM *b, int words) + { + BN_ULONG *A,*a; + const BN_ULONG *B; + int i; + + bn_check_top(b); + + if (words > b->dmax) + { + bn_check_top(b); + if (BN_get_flags(b,BN_FLG_STATIC_DATA)) + { + return(NULL); + } + a=A=(BN_ULONG *)malloc(sizeof(BN_ULONG)*(words+1)); + if (A == NULL) + { + return(NULL); + } +#if 1 + B=b->d; + /* Check if the previous number needs to be copied */ + if (B != NULL) + { +#if 0 + /* This lot is an unrolled loop to copy b->top + * BN_ULONGs from B to A + */ +/* + * I have nothing against unrolling but it's usually done for + * several reasons, namely: + * - minimize percentage of decision making code, i.e. branches; + * - avoid cache trashing; + * - make it possible to schedule loads earlier; + * Now let's examine the code below. The cornerstone of C is + * "programmer is always right" and that's what we love it for:-) + * For this very reason C compilers have to be paranoid when it + * comes to data aliasing and assume the worst. Yeah, but what + * does it mean in real life? This means that loop body below will + * be compiled to sequence of loads immediately followed by stores + * as compiler assumes the worst, something in A==B+1 style. As a + * result CPU pipeline is going to starve for incoming data. Secondly + * if A and B happen to share same cache line such code is going to + * cause severe cache trashing. Both factors have severe impact on + * performance of modern CPUs and this is the reason why this + * particular piece of code is #ifdefed away and replaced by more + * "friendly" version found in #else section below. This comment + * also applies to BN_copy function. + * + * + */ + for (i=b->top&(~7); i>0; i-=8) + { + A[0]=B[0]; A[1]=B[1]; A[2]=B[2]; A[3]=B[3]; + A[4]=B[4]; A[5]=B[5]; A[6]=B[6]; A[7]=B[7]; + A+=8; + B+=8; + } + switch (b->top&7) + { + case 7: + A[6]=B[6]; + case 6: + A[5]=B[5]; + case 5: + A[4]=B[4]; + case 4: + A[3]=B[3]; + case 3: + A[2]=B[2]; + case 2: + A[1]=B[1]; + case 1: + A[0]=B[0]; + case 0: + /* I need the 'case 0' entry for utrix cc. + * If the optimizer is turned on, it does the + * switch table by doing + * a=top&7 + * a--; + * goto jump_table[a]; + * If top is 0, this makes us jump to 0xffffffc + * which is rather bad :-(. + * eric 23-Apr-1998 + */ + ; + } +#else + for (i=b->top>>2; i>0; i--,A+=4,B+=4) + { + /* + * The fact that the loop is unrolled + * 4-wise is a tribute to Intel. It's + * the one that doesn't have enough + * registers to accomodate more data. + * I'd unroll it 8-wise otherwise:-) + * + * + */ + BN_ULONG a0,a1,a2,a3; + a0=B[0]; a1=B[1]; a2=B[2]; a3=B[3]; + A[0]=a0; A[1]=a1; A[2]=a2; A[3]=a3; + } + switch (b->top&3) + { + case 3: A[2]=B[2]; + case 2: A[1]=B[1]; + case 1: A[0]=B[0]; + case 0: ; /* ultrix cc workaround, see above */ + } +#endif + free(b->d); + } + + b->d=a; + b->dmax=words; + + /* Now need to zero any data between b->top and b->max */ + + A= &(b->d[b->top]); + for (i=(b->dmax - b->top)>>3; i>0; i--,A+=8) + { + A[0]=0; A[1]=0; A[2]=0; A[3]=0; + A[4]=0; A[5]=0; A[6]=0; A[7]=0; + } + for (i=(b->dmax - b->top)&7; i>0; i--,A++) + A[0]=0; +#else + memset(A,0,sizeof(BN_ULONG)*(words+1)); + memcpy(A,b->d,sizeof(b->d[0])*b->top); + b->d=a; + b->max=words; +#endif + +/* memset(&(p[b->max]),0,((words+1)-b->max)*sizeof(BN_ULONG)); */ +/* { int i; for (i=b->max; itop) == NULL) return(NULL); + +#if 1 + A=a->d; + B=b->d; + for (i=b->top>>2; i>0; i--,A+=4,B+=4) + { + BN_ULONG a0,a1,a2,a3; + a0=B[0]; a1=B[1]; a2=B[2]; a3=B[3]; + A[0]=a0; A[1]=a1; A[2]=a2; A[3]=a3; + } + switch (b->top&3) + { + case 3: A[2]=B[2]; + case 2: A[1]=B[1]; + case 1: A[0]=B[0]; + case 0: ; /* ultrix cc workaround, see comments in bn_expand2 */ + } +#else + memcpy(a->d,b->d,sizeof(b->d[0])*b->top); +#endif + +/* memset(&(a->d[b->top]),0,sizeof(a->d[0])*(a->max-b->top));*/ + a->top=b->top; + if ((a->top == 0) && (a->d != NULL)) + a->d[0]=0; + a->neg=b->neg; + return(a); + } + +int BN_set_word(BIGNUM *a, BN_ULONG w) + { + int i,n; + if (bn_expand(a,sizeof(BN_ULONG)*8) == NULL) return(0); + + n=sizeof(BN_ULONG)/BN_BYTES; + a->neg=0; + a->top=0; + a->d[0]=(BN_ULONG)w&BN_MASK2; + if (a->d[0] != 0) a->top=1; + for (i=1; i>=BN_BITS2 so compilers don't complain + * on builds where sizeof(long) == BN_TYPES */ +#ifndef SIXTY_FOUR_BIT /* the data item > unsigned long */ + w>>=BN_BITS4; + w>>=BN_BITS4; +#else + w=0; +#endif + a->d[i]=(BN_ULONG)w&BN_MASK2; + if (a->d[i] != 0) a->top=i+1; + } + return(1); + } + +/* ignore negative */ +BIGNUM *BN_bin2bn(const unsigned char *s, int len, BIGNUM *ret) + { + unsigned int i,m; + unsigned int n; + BN_ULONG l; + + if (ret == NULL) ret=BN_new(); + if (ret == NULL) return(NULL); + l=0; + n=len; + if (n == 0) + { + ret->top=0; + return(ret); + } + if (bn_expand(ret,(int)(n+2)*8) == NULL) + return(NULL); + i=((n-1)/BN_BYTES)+1; + m=((n-1)%(BN_BYTES)); + ret->top=i; + while (n-- > 0) + { + l=(l<<8L)| *(s++); + if (m-- == 0) + { + ret->d[--i]=l; + l=0; + m=BN_BYTES-1; + } + } + /* need to call this due to clear byte at top if avoiding + * having the top bit set (-ve number) */ + bn_fix_top(ret); + return(ret); + } + +/* ignore negative */ +int BN_bn2bin(const BIGNUM *a, unsigned char *to) + { + int n,i; + BN_ULONG l; + + n=i=BN_num_bytes(a); + while (i-- > 0) + { + l=a->d[i/BN_BYTES]; + *(to++)=(unsigned char)(l>>(8*(i%BN_BYTES)))&0xff; + } + return(n); + } + +int BN_ucmp(const BIGNUM *a, const BIGNUM *b) + { + int i; + BN_ULONG t1,t2,*ap,*bp; + + bn_check_top(a); + bn_check_top(b); + + i=a->top-b->top; + if (i != 0) return(i); + ap=a->d; + bp=b->d; + for (i=a->top-1; i>=0; i--) + { + t1= ap[i]; + t2= bp[i]; + if (t1 != t2) + return(t1 > t2?1:-1); + } + return(0); + } + +int BN_cmp(const BIGNUM *a, const BIGNUM *b) + { + int i; + int gt,lt; + BN_ULONG t1,t2; + + if ((a == NULL) || (b == NULL)) + { + if (a != NULL) + return(-1); + else if (b != NULL) + return(1); + else + return(0); + } + + bn_check_top(a); + bn_check_top(b); + + if (a->neg != b->neg) + { + if (a->neg) + return(-1); + else return(1); + } + if (a->neg == 0) + { gt=1; lt= -1; } + else { gt= -1; lt=1; } + + if (a->top > b->top) return(gt); + if (a->top < b->top) return(lt); + for (i=a->top-1; i>=0; i--) + { + t1=a->d[i]; + t2=b->d[i]; + if (t1 > t2) return(gt); + if (t1 < t2) return(lt); + } + return(0); + } + +int BN_is_bit_set(const BIGNUM *a, int n) + { + int i,j; + + if (n < 0) return(0); + i=n/BN_BITS2; + j=n%BN_BITS2; + if (a->top <= i) return(0); + return((a->d[i]&(((BN_ULONG)1)< +#include +#include "bn_lcl.h" + +int BN_mul(BIGNUM *r, BIGNUM *a, BIGNUM *b, BN_CTX *ctx) + { + int top,al,bl; + BIGNUM *rr; + int ret = 0; +#if defined(BN_MUL_COMBA) || defined(BN_RECURSION) + int i; +#endif + +#ifdef BN_COUNT + printf("BN_mul %d * %d\n",a->top,b->top); +#endif + + bn_check_top(a); + bn_check_top(b); + bn_check_top(r); + + al=a->top; + bl=b->top; + + if ((al == 0) || (bl == 0)) + { + BN_zero(r); + return(1); + } + top=al+bl; + + BN_CTX_start(ctx); + if ((r == a) || (r == b)) + { + if ((rr = BN_CTX_get(ctx)) == NULL) goto err; + } + else + rr = r; + rr->neg=a->neg^b->neg; + +#if defined(BN_MUL_COMBA) || defined(BN_RECURSION) + i = al-bl; +#endif +#ifdef BN_MUL_COMBA + if (i == 0) + { +# if 0 + if (al == 4) + { + if (bn_wexpand(rr,8) == NULL) goto err; + rr->top=8; + bn_mul_comba4(rr->d,a->d,b->d); + goto end; + } +# endif + if (al == 8) + { + if (bn_wexpand(rr,16) == NULL) goto err; + rr->top=16; + bn_mul_comba8(rr->d,a->d,b->d); + goto end; + } + } +#endif /* BN_MUL_COMBA */ + if (bn_wexpand(rr,top) == NULL) goto err; + rr->top=top; + bn_mul_normal(rr->d,a->d,al,b->d,bl); + +#if defined(BN_MUL_COMBA) || defined(BN_RECURSION) +end: +#endif + bn_fix_top(rr); + if (r != rr) BN_copy(r,rr); + ret=1; +err: + BN_CTX_end(ctx); + return(ret); + } + +void bn_mul_normal(BN_ULONG *r, BN_ULONG *a, int na, BN_ULONG *b, int nb) + { + BN_ULONG *rr; + +#ifdef BN_COUNT + printf(" bn_mul_normal %d * %d\n",na,nb); +#endif + + if (na < nb) + { + int itmp; + BN_ULONG *ltmp; + + itmp=na; na=nb; nb=itmp; + ltmp=a; a=b; b=ltmp; + + } + rr= &(r[na]); + rr[0]=bn_mul_words(r,a,na,b[0]); + + for (;;) + { + if (--nb <= 0) return; + rr[1]=bn_mul_add_words(&(r[1]),a,na,b[1]); + if (--nb <= 0) return; + rr[2]=bn_mul_add_words(&(r[2]),a,na,b[2]); + if (--nb <= 0) return; + rr[3]=bn_mul_add_words(&(r[3]),a,na,b[3]); + if (--nb <= 0) return; + rr[4]=bn_mul_add_words(&(r[4]),a,na,b[4]); + rr+=4; + r+=4; + b+=4; + } + } diff --git a/package/network/services/ead/src/tinysrp/bn_prime.h b/package/network/services/ead/src/tinysrp/bn_prime.h new file mode 100644 index 0000000000..b7cf9a9bfe --- /dev/null +++ b/package/network/services/ead/src/tinysrp/bn_prime.h @@ -0,0 +1,325 @@ +/* Auto generated by bn_prime.pl */ +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * 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 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 cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + +#ifndef EIGHT_BIT +#define NUMPRIMES 2048 +#else +#define NUMPRIMES 54 +#endif +static const unsigned int primes[NUMPRIMES]= + { + 2, 3, 5, 7, 11, 13, 17, 19, + 23, 29, 31, 37, 41, 43, 47, 53, + 59, 61, 67, 71, 73, 79, 83, 89, + 97, 101, 103, 107, 109, 113, 127, 131, + 137, 139, 149, 151, 157, 163, 167, 173, + 179, 181, 191, 193, 197, 199, 211, 223, + 227, 229, 233, 239, 241, 251, +#ifndef EIGHT_BIT + 257, 263, + 269, 271, 277, 281, 283, 293, 307, 311, + 313, 317, 331, 337, 347, 349, 353, 359, + 367, 373, 379, 383, 389, 397, 401, 409, + 419, 421, 431, 433, 439, 443, 449, 457, + 461, 463, 467, 479, 487, 491, 499, 503, + 509, 521, 523, 541, 547, 557, 563, 569, + 571, 577, 587, 593, 599, 601, 607, 613, + 617, 619, 631, 641, 643, 647, 653, 659, + 661, 673, 677, 683, 691, 701, 709, 719, + 727, 733, 739, 743, 751, 757, 761, 769, + 773, 787, 797, 809, 811, 821, 823, 827, + 829, 839, 853, 857, 859, 863, 877, 881, + 883, 887, 907, 911, 919, 929, 937, 941, + 947, 953, 967, 971, 977, 983, 991, 997, + 1009,1013,1019,1021,1031,1033,1039,1049, + 1051,1061,1063,1069,1087,1091,1093,1097, + 1103,1109,1117,1123,1129,1151,1153,1163, + 1171,1181,1187,1193,1201,1213,1217,1223, + 1229,1231,1237,1249,1259,1277,1279,1283, + 1289,1291,1297,1301,1303,1307,1319,1321, + 1327,1361,1367,1373,1381,1399,1409,1423, + 1427,1429,1433,1439,1447,1451,1453,1459, + 1471,1481,1483,1487,1489,1493,1499,1511, + 1523,1531,1543,1549,1553,1559,1567,1571, + 1579,1583,1597,1601,1607,1609,1613,1619, + 1621,1627,1637,1657,1663,1667,1669,1693, + 1697,1699,1709,1721,1723,1733,1741,1747, + 1753,1759,1777,1783,1787,1789,1801,1811, + 1823,1831,1847,1861,1867,1871,1873,1877, + 1879,1889,1901,1907,1913,1931,1933,1949, + 1951,1973,1979,1987,1993,1997,1999,2003, + 2011,2017,2027,2029,2039,2053,2063,2069, + 2081,2083,2087,2089,2099,2111,2113,2129, + 2131,2137,2141,2143,2153,2161,2179,2203, + 2207,2213,2221,2237,2239,2243,2251,2267, + 2269,2273,2281,2287,2293,2297,2309,2311, + 2333,2339,2341,2347,2351,2357,2371,2377, + 2381,2383,2389,2393,2399,2411,2417,2423, + 2437,2441,2447,2459,2467,2473,2477,2503, + 2521,2531,2539,2543,2549,2551,2557,2579, + 2591,2593,2609,2617,2621,2633,2647,2657, + 2659,2663,2671,2677,2683,2687,2689,2693, + 2699,2707,2711,2713,2719,2729,2731,2741, + 2749,2753,2767,2777,2789,2791,2797,2801, + 2803,2819,2833,2837,2843,2851,2857,2861, + 2879,2887,2897,2903,2909,2917,2927,2939, + 2953,2957,2963,2969,2971,2999,3001,3011, + 3019,3023,3037,3041,3049,3061,3067,3079, + 3083,3089,3109,3119,3121,3137,3163,3167, + 3169,3181,3187,3191,3203,3209,3217,3221, + 3229,3251,3253,3257,3259,3271,3299,3301, + 3307,3313,3319,3323,3329,3331,3343,3347, + 3359,3361,3371,3373,3389,3391,3407,3413, + 3433,3449,3457,3461,3463,3467,3469,3491, + 3499,3511,3517,3527,3529,3533,3539,3541, + 3547,3557,3559,3571,3581,3583,3593,3607, + 3613,3617,3623,3631,3637,3643,3659,3671, + 3673,3677,3691,3697,3701,3709,3719,3727, + 3733,3739,3761,3767,3769,3779,3793,3797, + 3803,3821,3823,3833,3847,3851,3853,3863, + 3877,3881,3889,3907,3911,3917,3919,3923, + 3929,3931,3943,3947,3967,3989,4001,4003, + 4007,4013,4019,4021,4027,4049,4051,4057, + 4073,4079,4091,4093,4099,4111,4127,4129, + 4133,4139,4153,4157,4159,4177,4201,4211, + 4217,4219,4229,4231,4241,4243,4253,4259, + 4261,4271,4273,4283,4289,4297,4327,4337, + 4339,4349,4357,4363,4373,4391,4397,4409, + 4421,4423,4441,4447,4451,4457,4463,4481, + 4483,4493,4507,4513,4517,4519,4523,4547, + 4549,4561,4567,4583,4591,4597,4603,4621, + 4637,4639,4643,4649,4651,4657,4663,4673, + 4679,4691,4703,4721,4723,4729,4733,4751, + 4759,4783,4787,4789,4793,4799,4801,4813, + 4817,4831,4861,4871,4877,4889,4903,4909, + 4919,4931,4933,4937,4943,4951,4957,4967, + 4969,4973,4987,4993,4999,5003,5009,5011, + 5021,5023,5039,5051,5059,5077,5081,5087, + 5099,5101,5107,5113,5119,5147,5153,5167, + 5171,5179,5189,5197,5209,5227,5231,5233, + 5237,5261,5273,5279,5281,5297,5303,5309, + 5323,5333,5347,5351,5381,5387,5393,5399, + 5407,5413,5417,5419,5431,5437,5441,5443, + 5449,5471,5477,5479,5483,5501,5503,5507, + 5519,5521,5527,5531,5557,5563,5569,5573, + 5581,5591,5623,5639,5641,5647,5651,5653, + 5657,5659,5669,5683,5689,5693,5701,5711, + 5717,5737,5741,5743,5749,5779,5783,5791, + 5801,5807,5813,5821,5827,5839,5843,5849, + 5851,5857,5861,5867,5869,5879,5881,5897, + 5903,5923,5927,5939,5953,5981,5987,6007, + 6011,6029,6037,6043,6047,6053,6067,6073, + 6079,6089,6091,6101,6113,6121,6131,6133, + 6143,6151,6163,6173,6197,6199,6203,6211, + 6217,6221,6229,6247,6257,6263,6269,6271, + 6277,6287,6299,6301,6311,6317,6323,6329, + 6337,6343,6353,6359,6361,6367,6373,6379, + 6389,6397,6421,6427,6449,6451,6469,6473, + 6481,6491,6521,6529,6547,6551,6553,6563, + 6569,6571,6577,6581,6599,6607,6619,6637, + 6653,6659,6661,6673,6679,6689,6691,6701, + 6703,6709,6719,6733,6737,6761,6763,6779, + 6781,6791,6793,6803,6823,6827,6829,6833, + 6841,6857,6863,6869,6871,6883,6899,6907, + 6911,6917,6947,6949,6959,6961,6967,6971, + 6977,6983,6991,6997,7001,7013,7019,7027, + 7039,7043,7057,7069,7079,7103,7109,7121, + 7127,7129,7151,7159,7177,7187,7193,7207, + 7211,7213,7219,7229,7237,7243,7247,7253, + 7283,7297,7307,7309,7321,7331,7333,7349, + 7351,7369,7393,7411,7417,7433,7451,7457, + 7459,7477,7481,7487,7489,7499,7507,7517, + 7523,7529,7537,7541,7547,7549,7559,7561, + 7573,7577,7583,7589,7591,7603,7607,7621, + 7639,7643,7649,7669,7673,7681,7687,7691, + 7699,7703,7717,7723,7727,7741,7753,7757, + 7759,7789,7793,7817,7823,7829,7841,7853, + 7867,7873,7877,7879,7883,7901,7907,7919, + 7927,7933,7937,7949,7951,7963,7993,8009, + 8011,8017,8039,8053,8059,8069,8081,8087, + 8089,8093,8101,8111,8117,8123,8147,8161, + 8167,8171,8179,8191,8209,8219,8221,8231, + 8233,8237,8243,8263,8269,8273,8287,8291, + 8293,8297,8311,8317,8329,8353,8363,8369, + 8377,8387,8389,8419,8423,8429,8431,8443, + 8447,8461,8467,8501,8513,8521,8527,8537, + 8539,8543,8563,8573,8581,8597,8599,8609, + 8623,8627,8629,8641,8647,8663,8669,8677, + 8681,8689,8693,8699,8707,8713,8719,8731, + 8737,8741,8747,8753,8761,8779,8783,8803, + 8807,8819,8821,8831,8837,8839,8849,8861, + 8863,8867,8887,8893,8923,8929,8933,8941, + 8951,8963,8969,8971,8999,9001,9007,9011, + 9013,9029,9041,9043,9049,9059,9067,9091, + 9103,9109,9127,9133,9137,9151,9157,9161, + 9173,9181,9187,9199,9203,9209,9221,9227, + 9239,9241,9257,9277,9281,9283,9293,9311, + 9319,9323,9337,9341,9343,9349,9371,9377, + 9391,9397,9403,9413,9419,9421,9431,9433, + 9437,9439,9461,9463,9467,9473,9479,9491, + 9497,9511,9521,9533,9539,9547,9551,9587, + 9601,9613,9619,9623,9629,9631,9643,9649, + 9661,9677,9679,9689,9697,9719,9721,9733, + 9739,9743,9749,9767,9769,9781,9787,9791, + 9803,9811,9817,9829,9833,9839,9851,9857, + 9859,9871,9883,9887,9901,9907,9923,9929, + 9931,9941,9949,9967,9973,10007,10009,10037, + 10039,10061,10067,10069,10079,10091,10093,10099, + 10103,10111,10133,10139,10141,10151,10159,10163, + 10169,10177,10181,10193,10211,10223,10243,10247, + 10253,10259,10267,10271,10273,10289,10301,10303, + 10313,10321,10331,10333,10337,10343,10357,10369, + 10391,10399,10427,10429,10433,10453,10457,10459, + 10463,10477,10487,10499,10501,10513,10529,10531, + 10559,10567,10589,10597,10601,10607,10613,10627, + 10631,10639,10651,10657,10663,10667,10687,10691, + 10709,10711,10723,10729,10733,10739,10753,10771, + 10781,10789,10799,10831,10837,10847,10853,10859, + 10861,10867,10883,10889,10891,10903,10909,10937, + 10939,10949,10957,10973,10979,10987,10993,11003, + 11027,11047,11057,11059,11069,11071,11083,11087, + 11093,11113,11117,11119,11131,11149,11159,11161, + 11171,11173,11177,11197,11213,11239,11243,11251, + 11257,11261,11273,11279,11287,11299,11311,11317, + 11321,11329,11351,11353,11369,11383,11393,11399, + 11411,11423,11437,11443,11447,11467,11471,11483, + 11489,11491,11497,11503,11519,11527,11549,11551, + 11579,11587,11593,11597,11617,11621,11633,11657, + 11677,11681,11689,11699,11701,11717,11719,11731, + 11743,11777,11779,11783,11789,11801,11807,11813, + 11821,11827,11831,11833,11839,11863,11867,11887, + 11897,11903,11909,11923,11927,11933,11939,11941, + 11953,11959,11969,11971,11981,11987,12007,12011, + 12037,12041,12043,12049,12071,12073,12097,12101, + 12107,12109,12113,12119,12143,12149,12157,12161, + 12163,12197,12203,12211,12227,12239,12241,12251, + 12253,12263,12269,12277,12281,12289,12301,12323, + 12329,12343,12347,12373,12377,12379,12391,12401, + 12409,12413,12421,12433,12437,12451,12457,12473, + 12479,12487,12491,12497,12503,12511,12517,12527, + 12539,12541,12547,12553,12569,12577,12583,12589, + 12601,12611,12613,12619,12637,12641,12647,12653, + 12659,12671,12689,12697,12703,12713,12721,12739, + 12743,12757,12763,12781,12791,12799,12809,12821, + 12823,12829,12841,12853,12889,12893,12899,12907, + 12911,12917,12919,12923,12941,12953,12959,12967, + 12973,12979,12983,13001,13003,13007,13009,13033, + 13037,13043,13049,13063,13093,13099,13103,13109, + 13121,13127,13147,13151,13159,13163,13171,13177, + 13183,13187,13217,13219,13229,13241,13249,13259, + 13267,13291,13297,13309,13313,13327,13331,13337, + 13339,13367,13381,13397,13399,13411,13417,13421, + 13441,13451,13457,13463,13469,13477,13487,13499, + 13513,13523,13537,13553,13567,13577,13591,13597, + 13613,13619,13627,13633,13649,13669,13679,13681, + 13687,13691,13693,13697,13709,13711,13721,13723, + 13729,13751,13757,13759,13763,13781,13789,13799, + 13807,13829,13831,13841,13859,13873,13877,13879, + 13883,13901,13903,13907,13913,13921,13931,13933, + 13963,13967,13997,13999,14009,14011,14029,14033, + 14051,14057,14071,14081,14083,14087,14107,14143, + 14149,14153,14159,14173,14177,14197,14207,14221, + 14243,14249,14251,14281,14293,14303,14321,14323, + 14327,14341,14347,14369,14387,14389,14401,14407, + 14411,14419,14423,14431,14437,14447,14449,14461, + 14479,14489,14503,14519,14533,14537,14543,14549, + 14551,14557,14561,14563,14591,14593,14621,14627, + 14629,14633,14639,14653,14657,14669,14683,14699, + 14713,14717,14723,14731,14737,14741,14747,14753, + 14759,14767,14771,14779,14783,14797,14813,14821, + 14827,14831,14843,14851,14867,14869,14879,14887, + 14891,14897,14923,14929,14939,14947,14951,14957, + 14969,14983,15013,15017,15031,15053,15061,15073, + 15077,15083,15091,15101,15107,15121,15131,15137, + 15139,15149,15161,15173,15187,15193,15199,15217, + 15227,15233,15241,15259,15263,15269,15271,15277, + 15287,15289,15299,15307,15313,15319,15329,15331, + 15349,15359,15361,15373,15377,15383,15391,15401, + 15413,15427,15439,15443,15451,15461,15467,15473, + 15493,15497,15511,15527,15541,15551,15559,15569, + 15581,15583,15601,15607,15619,15629,15641,15643, + 15647,15649,15661,15667,15671,15679,15683,15727, + 15731,15733,15737,15739,15749,15761,15767,15773, + 15787,15791,15797,15803,15809,15817,15823,15859, + 15877,15881,15887,15889,15901,15907,15913,15919, + 15923,15937,15959,15971,15973,15991,16001,16007, + 16033,16057,16061,16063,16067,16069,16073,16087, + 16091,16097,16103,16111,16127,16139,16141,16183, + 16187,16189,16193,16217,16223,16229,16231,16249, + 16253,16267,16273,16301,16319,16333,16339,16349, + 16361,16363,16369,16381,16411,16417,16421,16427, + 16433,16447,16451,16453,16477,16481,16487,16493, + 16519,16529,16547,16553,16561,16567,16573,16603, + 16607,16619,16631,16633,16649,16651,16657,16661, + 16673,16691,16693,16699,16703,16729,16741,16747, + 16759,16763,16787,16811,16823,16829,16831,16843, + 16871,16879,16883,16889,16901,16903,16921,16927, + 16931,16937,16943,16963,16979,16981,16987,16993, + 17011,17021,17027,17029,17033,17041,17047,17053, + 17077,17093,17099,17107,17117,17123,17137,17159, + 17167,17183,17189,17191,17203,17207,17209,17231, + 17239,17257,17291,17293,17299,17317,17321,17327, + 17333,17341,17351,17359,17377,17383,17387,17389, + 17393,17401,17417,17419,17431,17443,17449,17467, + 17471,17477,17483,17489,17491,17497,17509,17519, + 17539,17551,17569,17573,17579,17581,17597,17599, + 17609,17623,17627,17657,17659,17669,17681,17683, + 17707,17713,17729,17737,17747,17749,17761,17783, + 17789,17791,17807,17827,17837,17839,17851,17863, +#endif + }; diff --git a/package/network/services/ead/src/tinysrp/bn_shift.c b/package/network/services/ead/src/tinysrp/bn_shift.c new file mode 100644 index 0000000000..f403720ecc --- /dev/null +++ b/package/network/services/ead/src/tinysrp/bn_shift.c @@ -0,0 +1,139 @@ +/* crypto/bn/bn_shift.c */ +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * 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 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 cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + +#include +#include +#include "bn_lcl.h" + +int BN_lshift(BIGNUM *r, const BIGNUM *a, int n) + { + int i,nw,lb,rb; + BN_ULONG *t,*f; + BN_ULONG l; + + r->neg=a->neg; + if (bn_wexpand(r,a->top+(n/BN_BITS2)+1) == NULL) return(0); + nw=n/BN_BITS2; + lb=n%BN_BITS2; + rb=BN_BITS2-lb; + f=a->d; + t=r->d; + t[a->top+nw]=0; + if (lb == 0) + for (i=a->top-1; i>=0; i--) + t[nw+i]=f[i]; + else + for (i=a->top-1; i>=0; i--) + { + l=f[i]; + t[nw+i+1]|=(l>>rb)&BN_MASK2; + t[nw+i]=(l<top=a->top+nw+1; + bn_fix_top(r); + return(1); + } + +int BN_rshift(BIGNUM *r, BIGNUM *a, int n) + { + int i,j,nw,lb,rb; + BN_ULONG *t,*f; + BN_ULONG l,tmp; + + nw=n/BN_BITS2; + rb=n%BN_BITS2; + lb=BN_BITS2-rb; + if (nw > a->top || a->top == 0) + { + BN_zero(r); + return(1); + } + if (r != a) + { + r->neg=a->neg; + if (bn_wexpand(r,a->top-nw+1) == NULL) return(0); + } + + f= &(a->d[nw]); + t=r->d; + j=a->top-nw; + r->top=j; + + if (rb == 0) + { + for (i=j+1; i > 0; i--) + *(t++)= *(f++); + } + else + { + l= *(f++); + for (i=1; i>rb)&BN_MASK2; + l= *(f++); + *(t++) =(tmp|(l<>rb)&BN_MASK2; + } + *t=0; + bn_fix_top(r); + return(1); + } diff --git a/package/network/services/ead/src/tinysrp/bn_sqr.c b/package/network/services/ead/src/tinysrp/bn_sqr.c new file mode 100644 index 0000000000..2d3db70e35 --- /dev/null +++ b/package/network/services/ead/src/tinysrp/bn_sqr.c @@ -0,0 +1,160 @@ +/* crypto/bn/bn_sqr.c */ +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * 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 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 cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + +#include +#include +#include "bn_lcl.h" + +/* r must not be a */ +/* I've just gone over this and it is now %20 faster on x86 - eay - 27 Jun 96 */ +int BN_sqr(BIGNUM *r, BIGNUM *a, BN_CTX *ctx) + { + int max,al; + int ret = 0; + BIGNUM *tmp,*rr; + +#ifdef BN_COUNT +printf("BN_sqr %d * %d\n",a->top,a->top); +#endif + bn_check_top(a); + + al=a->top; + if (al <= 0) + { + r->top=0; + return(1); + } + + BN_CTX_start(ctx); + rr=(a != r) ? r : BN_CTX_get(ctx); + tmp=BN_CTX_get(ctx); + if (tmp == NULL) goto err; + + max=(al+al); + if (bn_wexpand(rr,max+1) == NULL) goto err; + + r->neg=0; + if (al == 4) + { +#ifndef BN_SQR_COMBA + BN_ULONG t[8]; + bn_sqr_normal(rr->d,a->d,4,t); +#else + bn_sqr_comba4(rr->d,a->d); +#endif + } + else if (al == 8) + { +#ifndef BN_SQR_COMBA + BN_ULONG t[16]; + bn_sqr_normal(rr->d,a->d,8,t); +#else + bn_sqr_comba8(rr->d,a->d); +#endif + } + else + { + if (bn_wexpand(tmp,max) == NULL) goto err; + bn_sqr_normal(rr->d,a->d,al,tmp->d); + } + + rr->top=max; + if ((max > 0) && (rr->d[max-1] == 0)) rr->top--; + if (rr != r) BN_copy(r,rr); + ret = 1; + err: + BN_CTX_end(ctx); + return(ret); + } + +/* tmp must have 2*n words */ +void bn_sqr_normal(BN_ULONG *r, BN_ULONG *a, int n, BN_ULONG *tmp) + { + int i,j,max; + BN_ULONG *ap,*rp; + + max=n*2; + ap=a; + rp=r; + rp[0]=rp[max-1]=0; + rp++; + j=n; + + if (--j > 0) + { + ap++; + rp[j]=bn_mul_words(rp,ap,j,ap[-1]); + rp+=2; + } + + for (i=n-2; i>0; i--) + { + j--; + ap++; + rp[j]=bn_mul_add_words(rp,ap,j,ap[-1]); + rp+=2; + } + + bn_add_words(r,r,r,max); + + /* There will not be a carry */ + + bn_sqr_words(tmp,a,n); + + bn_add_words(r,r,tmp,max); + } diff --git a/package/network/services/ead/src/tinysrp/bn_word.c b/package/network/services/ead/src/tinysrp/bn_word.c new file mode 100644 index 0000000000..7820e08a8a --- /dev/null +++ b/package/network/services/ead/src/tinysrp/bn_word.c @@ -0,0 +1,130 @@ +/* crypto/bn/bn_word.c */ +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * 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 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 cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + +#include +#include "bn_lcl.h" + +int BN_add_word(BIGNUM *a, BN_ULONG w) + { + BN_ULONG l; + int i; + + if (a->neg) + { + a->neg=0; + i=BN_sub_word(a,w); + if (!BN_is_zero(a)) + a->neg=!(a->neg); + return(i); + } + w&=BN_MASK2; + if (bn_wexpand(a,a->top+1) == NULL) return(0); + i=0; + for (;;) + { + l=(a->d[i]+(BN_ULONG)w)&BN_MASK2; + a->d[i]=l; + if (w > l) + w=1; + else + break; + i++; + } + if (i >= a->top) + a->top++; + return(1); + } + +int BN_sub_word(BIGNUM *a, BN_ULONG w) + { + int i; + + if (BN_is_zero(a) || a->neg) + { + a->neg=0; + i=BN_add_word(a,w); + a->neg=1; + return(i); + } + + w&=BN_MASK2; + if ((a->top == 1) && (a->d[0] < w)) + { + a->d[0]=w-a->d[0]; + a->neg=1; + return(1); + } + i=0; + for (;;) + { + if (a->d[i] >= w) + { + a->d[i]-=w; + break; + } + else + { + a->d[i]=(a->d[i]-w)&BN_MASK2; + i++; + w=1; + } + } + if ((a->d[i] == 0) && (i == (a->top-1))) + a->top--; + return(1); + } diff --git a/package/network/services/ead/src/tinysrp/clitest.c b/package/network/services/ead/src/tinysrp/clitest.c new file mode 100644 index 0000000000..338f41ff4e --- /dev/null +++ b/package/network/services/ead/src/tinysrp/clitest.c @@ -0,0 +1,110 @@ +/* + * Copyright (c) 1997-1999 The Stanford SRP Authentication Project + * 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" AND WITHOUT WARRANTY OF ANY KIND, + * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY + * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. + * + * IN NO EVENT SHALL STANFORD BE LIABLE FOR ANY SPECIAL, INCIDENTAL, + * INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, OR ANY DAMAGES WHATSOEVER + * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER OR NOT ADVISED OF + * THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF LIABILITY, ARISING OUT + * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + * In addition, the following conditions apply: + * + * 1. Any software that incorporates the SRP authentication technology + * must display the following acknowlegment: + * "This product uses the 'Secure Remote Password' cryptographic + * authentication system developed by Tom Wu (tjw@CS.Stanford.EDU)." + * + * 2. Any software that incorporates all or part of the SRP distribution + * itself must also display the following acknowledgment: + * "This product includes software developed by Tom Wu and Eugene + * Jhong for the SRP Distribution (http://srp.stanford.edu/srp/)." + * + * 3. Redistributions in source or binary form must retain an intact copy + * of this copyright notice and list of conditions. + */ + +#include +#include "t_defines.h" +#include "t_pwd.h" +#include "t_client.h" + +int +main() +{ + int index; + struct t_client * tc; + struct t_preconf *tcp; + struct t_num s; + struct t_num B; + char username[MAXUSERLEN]; + char hexbuf[MAXHEXPARAMLEN]; + char buf1[MAXPARAMLEN], buf2[MAXPARAMLEN], buf3[MAXSALTLEN]; + unsigned char cbuf[20]; + struct t_num * A; + unsigned char * skey; + char pass[128]; + + printf("Enter username: "); + fgets(username, sizeof(username), stdin); + username[strlen(username) - 1] = '\0'; + printf("Enter index (from server): "); + fgets(hexbuf, sizeof(hexbuf), stdin); + index = atoi(hexbuf); + tcp = t_getpreparam(index - 1); + printf("Enter salt (from server): "); + fgets(hexbuf, sizeof(hexbuf), stdin); + s.data = buf3; + s.len = t_fromb64(s.data, hexbuf); + + tc = t_clientopen(username, &tcp->modulus, &tcp->generator, &s); + if (tc == 0) { + printf("invalid n, g\n"); + exit(1); + } + + A = t_clientgenexp(tc); + printf("A (to server): %s\n", t_tob64(hexbuf, A->data, A->len)); + + t_getpass(pass, 128, "Enter password:"); + t_clientpasswd(tc, pass); + + printf("Enter B (from server): "); + fgets(hexbuf, sizeof(hexbuf), stdin); + B.data = buf1; + B.len = t_fromb64(B.data, hexbuf); + + skey = t_clientgetkey(tc, &B); + printf("Session key: %s\n", t_tohex(hexbuf, skey, 40)); + printf("Response (to server): %s\n", + t_tohex(hexbuf, t_clientresponse(tc), RESPONSE_LEN)); + + printf("Enter server response: "); + fgets(hexbuf, sizeof(hexbuf), stdin); + hexbuf[strlen(hexbuf) - 1] = '\0'; + t_fromhex(cbuf, hexbuf); + + if (t_clientverify(tc, cbuf) == 0) + printf("Server authentication successful.\n"); + else + printf("Server authentication failed.\n"); + + t_clientclose(tc); + + return 0; +} diff --git a/package/network/services/ead/src/tinysrp/config.h.in b/package/network/services/ead/src/tinysrp/config.h.in new file mode 100644 index 0000000000..a4b50c714a --- /dev/null +++ b/package/network/services/ead/src/tinysrp/config.h.in @@ -0,0 +1,79 @@ +/* config.h.in. Generated automatically from configure.in by autoheader. */ + +/* Define if type char is unsigned and you are not using gcc. */ +#ifndef __CHAR_UNSIGNED__ +#undef __CHAR_UNSIGNED__ +#endif + +/* Define to empty if the keyword does not work. */ +#undef const + +/* Define as __inline if that's what the C compiler calls it. */ +#undef inline + +/* Define as the return type of signal handlers (int or void). */ +#undef RETSIGTYPE + +/* Define if you have the ANSI C header files. */ +#undef STDC_HEADERS + +/* Define if you can safely include both and . */ +#undef TIME_WITH_SYS_TIME + +/* Define if your processor stores words with the most significant + byte first (like Motorola and SPARC, unlike Intel and VAX). */ +#undef WORDS_BIGENDIAN + +#undef SHA1HANDSOFF + +#undef POSIX_TERMIOS + +#undef POSIX_SIGTYPE + +#undef volatile + +/* The number of bytes in a int. */ +#undef SIZEOF_INT + +/* The number of bytes in a long. */ +#undef SIZEOF_LONG + +/* The number of bytes in a long long. */ +#undef SIZEOF_LONG_LONG + +/* The number of bytes in a short. */ +#undef SIZEOF_SHORT + +/* Define if you have the memcpy function. */ +#undef HAVE_MEMCPY + +/* Define if you have the sigaction function. */ +#undef HAVE_SIGACTION + +/* Define if you have the strchr function. */ +#undef HAVE_STRCHR + +/* Define if you have the header file. */ +#undef HAVE_SGTTY_H + +/* Define if you have the header file. */ +#undef HAVE_SYS_IOCTL_H + +/* Define if you have the header file. */ +#undef HAVE_SYS_TIME_H + +/* Define if you have the header file. */ +#undef HAVE_TERMIO_H + +/* Define if you have the header file. */ +#undef HAVE_TERMIOS_H + +/* Define if you have the header file. */ +#undef HAVE_UNISTD_H + +/* Name of package */ +#undef PACKAGE + +/* Version number of package */ +#undef VERSION + diff --git a/package/network/services/ead/src/tinysrp/configure b/package/network/services/ead/src/tinysrp/configure new file mode 100755 index 0000000000..6ee76bf436 --- /dev/null +++ b/package/network/services/ead/src/tinysrp/configure @@ -0,0 +1,2421 @@ +#! /bin/sh + +# Guess values for system-dependent variables and create Makefiles. +# Generated automatically using autoconf version 2.13 +# Copyright (C) 1992, 93, 94, 95, 96 Free Software Foundation, Inc. +# +# This configure script is free software; the Free Software Foundation +# gives unlimited permission to copy, distribute and modify it. + +# Defaults: +ac_help= +ac_default_prefix=/usr/local +# Any additions from configure.in: + +# Initialize some variables set by options. +# The variables have the same names as the options, with +# dashes changed to underlines. +build=NONE +cache_file=./config.cache +exec_prefix=NONE +host=NONE +no_create= +nonopt=NONE +no_recursion= +prefix=NONE +program_prefix=NONE +program_suffix=NONE +program_transform_name=s,x,x, +silent= +site= +srcdir= +target=NONE +verbose= +x_includes=NONE +x_libraries=NONE +bindir='${exec_prefix}/bin' +sbindir='${exec_prefix}/sbin' +libexecdir='${exec_prefix}/libexec' +datadir='${prefix}/share' +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' + +# Initialize some other variables. +subdirs= +MFLAGS= MAKEFLAGS= +SHELL=${CONFIG_SHELL-/bin/sh} +# Maximum number of lines to put in a shell here document. +ac_max_here_lines=12 + +ac_prev= +for ac_option +do + + # If the previous option needs an argument, assign it. + if test -n "$ac_prev"; then + eval "$ac_prev=\$ac_option" + ac_prev= + continue + fi + + case "$ac_option" in + -*=*) ac_optarg=`echo "$ac_option" | sed 's/[-_a-zA-Z0-9]*=//'` ;; + *) ac_optarg= ;; + esac + + # Accept the important Cygnus configure options, so we can diagnose typos. + + case "$ac_option" in + + -bindir | --bindir | --bindi | --bind | --bin | --bi) + ac_prev=bindir ;; + -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) + bindir="$ac_optarg" ;; + + -build | --build | --buil | --bui | --bu) + ac_prev=build ;; + -build=* | --build=* | --buil=* | --bui=* | --bu=*) + build="$ac_optarg" ;; + + -cache-file | --cache-file | --cache-fil | --cache-fi \ + | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) + ac_prev=cache_file ;; + -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ + | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) + cache_file="$ac_optarg" ;; + + -datadir | --datadir | --datadi | --datad | --data | --dat | --da) + ac_prev=datadir ;; + -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \ + | --da=*) + datadir="$ac_optarg" ;; + + -disable-* | --disable-*) + ac_feature=`echo $ac_option|sed -e 's/-*disable-//'` + # Reject names that are not valid shell variable names. + if test -n "`echo $ac_feature| sed 's/[-a-zA-Z0-9_]//g'`"; then + { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; } + fi + ac_feature=`echo $ac_feature| sed 's/-/_/g'` + eval "enable_${ac_feature}=no" ;; + + -enable-* | --enable-*) + ac_feature=`echo $ac_option|sed -e 's/-*enable-//' -e 's/=.*//'` + # Reject names that are not valid shell variable names. + if test -n "`echo $ac_feature| sed 's/[-_a-zA-Z0-9]//g'`"; then + { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; } + fi + ac_feature=`echo $ac_feature| sed 's/-/_/g'` + case "$ac_option" in + *=*) ;; + *) ac_optarg=yes ;; + esac + eval "enable_${ac_feature}='$ac_optarg'" ;; + + -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ + | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ + | --exec | --exe | --ex) + ac_prev=exec_prefix ;; + -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ + | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ + | --exec=* | --exe=* | --ex=*) + exec_prefix="$ac_optarg" ;; + + -gas | --gas | --ga | --g) + # Obsolete; use --with-gas. + with_gas=yes ;; + + -help | --help | --hel | --he) + # Omit some internal or obsolete options to make the list less imposing. + # This message is too long to be a string in the A/UX 3.1 sh. + cat << EOF +Usage: configure [options] [host] +Options: [defaults in brackets after descriptions] +Configuration: + --cache-file=FILE cache test results in FILE + --help print this message + --no-create do not create output files + --quiet, --silent do not print \`checking...' messages + --version print the version of autoconf that created configure +Directory and file names: + --prefix=PREFIX install architecture-independent files in PREFIX + [$ac_default_prefix] + --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX + [same as prefix] + --bindir=DIR user executables in DIR [EPREFIX/bin] + --sbindir=DIR system admin executables in DIR [EPREFIX/sbin] + --libexecdir=DIR program executables in DIR [EPREFIX/libexec] + --datadir=DIR read-only architecture-independent data in DIR + [PREFIX/share] + --sysconfdir=DIR read-only single-machine data in DIR [PREFIX/etc] + --sharedstatedir=DIR modifiable architecture-independent data in DIR + [PREFIX/com] + --localstatedir=DIR modifiable single-machine data in DIR [PREFIX/var] + --libdir=DIR object code libraries in DIR [EPREFIX/lib] + --includedir=DIR C header files in DIR [PREFIX/include] + --oldincludedir=DIR C header files for non-gcc in DIR [/usr/include] + --infodir=DIR info documentation in DIR [PREFIX/info] + --mandir=DIR man documentation in DIR [PREFIX/man] + --srcdir=DIR find the sources in DIR [configure dir or ..] + --program-prefix=PREFIX prepend PREFIX to installed program names + --program-suffix=SUFFIX append SUFFIX to installed program names + --program-transform-name=PROGRAM + run sed PROGRAM on installed program names +EOF + cat << EOF +Host type: + --build=BUILD configure for building on BUILD [BUILD=HOST] + --host=HOST configure for HOST [guessed] + --target=TARGET configure for TARGET [TARGET=HOST] +Features and packages: + --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) + --enable-FEATURE[=ARG] include FEATURE [ARG=yes] + --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] + --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) + --x-includes=DIR X include files are in DIR + --x-libraries=DIR X library files are in DIR +EOF + if test -n "$ac_help"; then + echo "--enable and --with options recognized:$ac_help" + fi + exit 0 ;; + + -host | --host | --hos | --ho) + ac_prev=host ;; + -host=* | --host=* | --hos=* | --ho=*) + host="$ac_optarg" ;; + + -includedir | --includedir | --includedi | --included | --include \ + | --includ | --inclu | --incl | --inc) + ac_prev=includedir ;; + -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ + | --includ=* | --inclu=* | --incl=* | --inc=*) + includedir="$ac_optarg" ;; + + -infodir | --infodir | --infodi | --infod | --info | --inf) + ac_prev=infodir ;; + -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) + infodir="$ac_optarg" ;; + + -libdir | --libdir | --libdi | --libd) + ac_prev=libdir ;; + -libdir=* | --libdir=* | --libdi=* | --libd=*) + libdir="$ac_optarg" ;; + + -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ + | --libexe | --libex | --libe) + ac_prev=libexecdir ;; + -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ + | --libexe=* | --libex=* | --libe=*) + libexecdir="$ac_optarg" ;; + + -localstatedir | --localstatedir | --localstatedi | --localstated \ + | --localstate | --localstat | --localsta | --localst \ + | --locals | --local | --loca | --loc | --lo) + ac_prev=localstatedir ;; + -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ + | --localstate=* | --localstat=* | --localsta=* | --localst=* \ + | --locals=* | --local=* | --loca=* | --loc=* | --lo=*) + localstatedir="$ac_optarg" ;; + + -mandir | --mandir | --mandi | --mand | --man | --ma | --m) + ac_prev=mandir ;; + -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) + mandir="$ac_optarg" ;; + + -nfp | --nfp | --nf) + # Obsolete; use --without-fp. + with_fp=no ;; + + -no-create | --no-create | --no-creat | --no-crea | --no-cre \ + | --no-cr | --no-c) + no_create=yes ;; + + -no-recursion | --no-recursion | --no-recursio | --no-recursi \ + | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) + no_recursion=yes ;; + + -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ + | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ + | --oldin | --oldi | --old | --ol | --o) + ac_prev=oldincludedir ;; + -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ + | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ + | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) + oldincludedir="$ac_optarg" ;; + + -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) + ac_prev=prefix ;; + -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) + prefix="$ac_optarg" ;; + + -program-prefix | --program-prefix | --program-prefi | --program-pref \ + | --program-pre | --program-pr | --program-p) + ac_prev=program_prefix ;; + -program-prefix=* | --program-prefix=* | --program-prefi=* \ + | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) + program_prefix="$ac_optarg" ;; + + -program-suffix | --program-suffix | --program-suffi | --program-suff \ + | --program-suf | --program-su | --program-s) + ac_prev=program_suffix ;; + -program-suffix=* | --program-suffix=* | --program-suffi=* \ + | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) + program_suffix="$ac_optarg" ;; + + -program-transform-name | --program-transform-name \ + | --program-transform-nam | --program-transform-na \ + | --program-transform-n | --program-transform- \ + | --program-transform | --program-transfor \ + | --program-transfo | --program-transf \ + | --program-trans | --program-tran \ + | --progr-tra | --program-tr | --program-t) + ac_prev=program_transform_name ;; + -program-transform-name=* | --program-transform-name=* \ + | --program-transform-nam=* | --program-transform-na=* \ + | --program-transform-n=* | --program-transform-=* \ + | --program-transform=* | --program-transfor=* \ + | --program-transfo=* | --program-transf=* \ + | --program-trans=* | --program-tran=* \ + | --progr-tra=* | --program-tr=* | --program-t=*) + program_transform_name="$ac_optarg" ;; + + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil) + silent=yes ;; + + -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) + ac_prev=sbindir ;; + -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ + | --sbi=* | --sb=*) + sbindir="$ac_optarg" ;; + + -sharedstatedir | --sharedstatedir | --sharedstatedi \ + | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ + | --sharedst | --shareds | --shared | --share | --shar \ + | --sha | --sh) + ac_prev=sharedstatedir ;; + -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ + | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ + | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ + | --sha=* | --sh=*) + sharedstatedir="$ac_optarg" ;; + + -site | --site | --sit) + ac_prev=site ;; + -site=* | --site=* | --sit=*) + site="$ac_optarg" ;; + + -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) + ac_prev=srcdir ;; + -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) + srcdir="$ac_optarg" ;; + + -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ + | --syscon | --sysco | --sysc | --sys | --sy) + ac_prev=sysconfdir ;; + -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ + | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) + sysconfdir="$ac_optarg" ;; + + -target | --target | --targe | --targ | --tar | --ta | --t) + ac_prev=target ;; + -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) + target="$ac_optarg" ;; + + -v | -verbose | --verbose | --verbos | --verbo | --verb) + verbose=yes ;; + + -version | --version | --versio | --versi | --vers) + echo "configure generated by autoconf version 2.13" + exit 0 ;; + + -with-* | --with-*) + ac_package=`echo $ac_option|sed -e 's/-*with-//' -e 's/=.*//'` + # Reject names that are not valid shell variable names. + if test -n "`echo $ac_package| sed 's/[-_a-zA-Z0-9]//g'`"; then + { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; } + fi + ac_package=`echo $ac_package| sed 's/-/_/g'` + case "$ac_option" in + *=*) ;; + *) ac_optarg=yes ;; + esac + eval "with_${ac_package}='$ac_optarg'" ;; + + -without-* | --without-*) + ac_package=`echo $ac_option|sed -e 's/-*without-//'` + # Reject names that are not valid shell variable names. + if test -n "`echo $ac_package| sed 's/[-a-zA-Z0-9_]//g'`"; then + { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; } + fi + ac_package=`echo $ac_package| sed 's/-/_/g'` + eval "with_${ac_package}=no" ;; + + --x) + # Obsolete; use --with-x. + with_x=yes ;; + + -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ + | --x-incl | --x-inc | --x-in | --x-i) + ac_prev=x_includes ;; + -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ + | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) + x_includes="$ac_optarg" ;; + + -x-libraries | --x-libraries | --x-librarie | --x-librari \ + | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) + ac_prev=x_libraries ;; + -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ + | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) + x_libraries="$ac_optarg" ;; + + -*) { echo "configure: error: $ac_option: invalid option; use --help to show usage" 1>&2; exit 1; } + ;; + + *) + if test -n "`echo $ac_option| sed 's/[-a-z0-9.]//g'`"; then + echo "configure: warning: $ac_option: invalid host type" 1>&2 + fi + if test "x$nonopt" != xNONE; then + { echo "configure: error: can only configure for one host and one target at a time" 1>&2; exit 1; } + fi + nonopt="$ac_option" + ;; + + esac +done + +if test -n "$ac_prev"; then + { echo "configure: error: missing argument to --`echo $ac_prev | sed 's/_/-/g'`" 1>&2; exit 1; } +fi + +trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15 + +# File descriptor usage: +# 0 standard input +# 1 file creation +# 2 errors and warnings +# 3 some systems may open it to /dev/tty +# 4 used on the Kubota Titan +# 6 checking for... messages and results +# 5 compiler messages saved in config.log +if test "$silent" = yes; then + exec 6>/dev/null +else + exec 6>&1 +fi +exec 5>./config.log + +echo "\ +This file contains any messages produced by compilers while +running configure, to aid debugging if configure makes a mistake. +" 1>&5 + +# Strip out --no-create and --no-recursion so they do not pile up. +# Also quote any args containing shell metacharacters. +ac_configure_args= +for ac_arg +do + case "$ac_arg" in + -no-create | --no-create | --no-creat | --no-crea | --no-cre \ + | --no-cr | --no-c) ;; + -no-recursion | --no-recursion | --no-recursio | --no-recursi \ + | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) ;; + *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?]*) + ac_configure_args="$ac_configure_args '$ac_arg'" ;; + *) ac_configure_args="$ac_configure_args $ac_arg" ;; + esac +done + +# NLS nuisances. +# Only set these to C if already set. These must not be set unconditionally +# because not all systems understand e.g. LANG=C (notably SCO). +# Fixing LC_MESSAGES prevents Solaris sh from translating var values in `set'! +# Non-C LC_CTYPE values break the ctype check. +if test "${LANG+set}" = set; then LANG=C; export LANG; fi +if test "${LC_ALL+set}" = set; then LC_ALL=C; export LC_ALL; fi +if test "${LC_MESSAGES+set}" = set; then LC_MESSAGES=C; export LC_MESSAGES; fi +if test "${LC_CTYPE+set}" = set; then LC_CTYPE=C; export LC_CTYPE; fi + +# confdefs.h avoids OS command line length limits that DEFS can exceed. +rm -rf conftest* confdefs.h +# AIX cpp loses on an empty file, so make sure it contains at least a newline. +echo > confdefs.h + +# A filename unique to this package, relative to the directory that +# configure is in, which we can look for to find out if srcdir is correct. +ac_unique_file=t_pwd.h + +# Find the source files, if location was not specified. +if test -z "$srcdir"; then + ac_srcdir_defaulted=yes + # Try the directory containing this script, then its parent. + ac_prog=$0 + ac_confdir=`echo $ac_prog|sed 's%/[^/][^/]*$%%'` + test "x$ac_confdir" = "x$ac_prog" && ac_confdir=. + srcdir=$ac_confdir + if test ! -r $srcdir/$ac_unique_file; then + srcdir=.. + fi +else + ac_srcdir_defaulted=no +fi +if test ! -r $srcdir/$ac_unique_file; then + if test "$ac_srcdir_defaulted" = yes; then + { echo "configure: error: can not find sources in $ac_confdir or .." 1>&2; exit 1; } + else + { echo "configure: error: can not find sources in $srcdir" 1>&2; exit 1; } + fi +fi +srcdir=`echo "${srcdir}" | sed 's%\([^/]\)/*$%\1%'` + +# Prefer explicitly selected file to automatically selected ones. +if test -z "$CONFIG_SITE"; then + if test "x$prefix" != xNONE; then + CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site" + else + CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site" + fi +fi +for ac_site_file in $CONFIG_SITE; do + if test -r "$ac_site_file"; then + echo "loading site script $ac_site_file" + . "$ac_site_file" + fi +done + +if test -r "$cache_file"; then + echo "loading cache $cache_file" + . $cache_file +else + echo "creating cache $cache_file" + > $cache_file +fi + +ac_ext=c +# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. +ac_cpp='$CPP $CPPFLAGS' +ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' +ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' +cross_compiling=$ac_cv_prog_cc_cross + +ac_exeext= +ac_objext=o +if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then + # Stardent Vistra SVR4 grep lacks -e, says ghazi@caip.rutgers.edu. + if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then + ac_n= ac_c=' +' ac_t=' ' + else + ac_n=-n ac_c= ac_t= + fi +else + ac_n= ac_c='\c' ac_t= +fi + + + + + +ac_aux_dir= +for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do + if test -f $ac_dir/install-sh; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install-sh -c" + break + elif test -f $ac_dir/install.sh; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install.sh -c" + break + fi +done +if test -z "$ac_aux_dir"; then + { echo "configure: error: can not find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." 1>&2; exit 1; } +fi +ac_config_guess=$ac_aux_dir/config.guess +ac_config_sub=$ac_aux_dir/config.sub +ac_configure=$ac_aux_dir/configure # This should be Cygnus configure. + +# Find a good install program. We prefer a C program (faster), +# so one script is as good as another. But avoid the broken or +# incompatible versions: +# SysV /etc/install, /usr/sbin/install +# SunOS /usr/etc/install +# IRIX /sbin/install +# AIX /bin/install +# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag +# 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 $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6 +echo "configure:559: checking for a BSD compatible install" >&5 +if test -z "$INSTALL"; then +if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + IFS="${IFS= }"; ac_save_IFS="$IFS"; IFS=":" + for ac_dir in $PATH; do + # Account for people who put trailing slashes in PATH elements. + case "$ac_dir/" in + /|./|.//|/etc/*|/usr/sbin/*|/usr/etc/*|/sbin/*|/usr/afsws/bin/*|/usr/ucb/*) ;; + *) + # OSF1 and SCO ODT 3.0 have their own names for install. + # Don't use installbsd from OSF since it installs stuff as root + # by default. + for ac_prog in ginstall scoinst install; do + if test -f $ac_dir/$ac_prog; then + if test $ac_prog = install && + grep dspmsg $ac_dir/$ac_prog >/dev/null 2>&1; then + # AIX install. It has an incompatible calling convention. + : + else + ac_cv_path_install="$ac_dir/$ac_prog -c" + break 2 + fi + fi + done + ;; + esac + done + IFS="$ac_save_IFS" + +fi + if test "${ac_cv_path_install+set}" = set; then + INSTALL="$ac_cv_path_install" + else + # As a last resort, use the slow shell script. We don't cache a + # path for INSTALL within a source directory, because that will + # break other packages using the cache if that directory is + # removed, or if the path is relative. + INSTALL="$ac_install_sh" + fi +fi +echo "$ac_t""$INSTALL" 1>&6 + +# Use test -z because SunOS4 sh mishandles braces in ${var-val}. +# It thinks the first close brace ends the variable substitution. +test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' + +test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}' + +test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' + +echo $ac_n "checking whether build environment is sane""... $ac_c" 1>&6 +echo "configure:612: checking whether build environment is sane" >&5 +# Just in case +sleep 1 +echo timestamp > conftestfile +# Do `set' in a subshell so we don't clobber the current shell's +# arguments. Must try -L first in case configure is actually a +# symlink; some systems play weird games with the mod time of symlinks +# (eg FreeBSD returns the mod time of the symlink's containing +# directory). +if ( + set X `ls -Lt $srcdir/configure conftestfile 2> /dev/null` + if test "$*" = "X"; then + # -L didn't work. + set X `ls -t $srcdir/configure conftestfile` + fi + if test "$*" != "X $srcdir/configure conftestfile" \ + && test "$*" != "X conftestfile $srcdir/configure"; then + + # If neither matched, then we have a broken ls. This can happen + # if, for instance, CONFIG_SHELL is bash and it inherits a + # broken ls alias from the environment. This has actually + # happened. Such a system could not be considered "sane". + { echo "configure: error: ls -t appears to fail. Make sure there is not a broken +alias in your environment" 1>&2; exit 1; } + fi + + test "$2" = conftestfile + ) +then + # Ok. + : +else + { echo "configure: error: newly created file is older than distributed files! +Check your system clock" 1>&2; exit 1; } +fi +rm -f conftest* +echo "$ac_t""yes" 1>&6 +if test "$program_transform_name" = s,x,x,; then + program_transform_name= +else + # Double any \ or $. echo might interpret backslashes. + cat <<\EOF_SED > conftestsed +s,\\,\\\\,g; s,\$,$$,g +EOF_SED + program_transform_name="`echo $program_transform_name|sed -f conftestsed`" + rm -f conftestsed +fi +test "$program_prefix" != NONE && + program_transform_name="s,^,${program_prefix},; $program_transform_name" +# Use a double $ so make ignores it. +test "$program_suffix" != NONE && + program_transform_name="s,\$\$,${program_suffix},; $program_transform_name" + +# sed with no file args requires a program. +test "$program_transform_name" = "" && program_transform_name="s,x,x," + +echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6 +echo "configure:669: checking whether ${MAKE-make} sets \${MAKE}" >&5 +set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y%./+-%__p_%'` +if eval "test \"`echo '$''{'ac_cv_prog_make_${ac_make}_set'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftestmake <<\EOF +all: + @echo 'ac_maketemp="${MAKE}"' +EOF +# GNU make sometimes prints "make[1]: Entering...", which would confuse us. +eval `${MAKE-make} -f conftestmake 2>/dev/null | grep temp=` +if test -n "$ac_maketemp"; then + eval ac_cv_prog_make_${ac_make}_set=yes +else + eval ac_cv_prog_make_${ac_make}_set=no +fi +rm -f conftestmake +fi +if eval "test \"`echo '$ac_cv_prog_make_'${ac_make}_set`\" = yes"; then + echo "$ac_t""yes" 1>&6 + SET_MAKE= +else + echo "$ac_t""no" 1>&6 + SET_MAKE="MAKE=${MAKE-make}" +fi + + + +PACKAGE=libtinysrp + +VERSION=0.7.5 + +if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then + { echo "configure: error: source directory already configured; run "make distclean" there first" 1>&2; exit 1; } +fi +cat >> confdefs.h <> confdefs.h <&6 +echo "configure:716: checking for working aclocal" >&5 +# Run test in a subshell; some versions of sh will print an error if +# an executable is not found, even if stderr is redirected. +# Redirect stdin to placate older versions of autoconf. Sigh. +if (aclocal --version) < /dev/null > /dev/null 2>&1; then + ACLOCAL=aclocal + echo "$ac_t""found" 1>&6 +else + ACLOCAL="$missing_dir/missing aclocal" + echo "$ac_t""missing" 1>&6 +fi + +echo $ac_n "checking for working autoconf""... $ac_c" 1>&6 +echo "configure:729: checking for working autoconf" >&5 +# Run test in a subshell; some versions of sh will print an error if +# an executable is not found, even if stderr is redirected. +# Redirect stdin to placate older versions of autoconf. Sigh. +if (autoconf --version) < /dev/null > /dev/null 2>&1; then + AUTOCONF=autoconf + echo "$ac_t""found" 1>&6 +else + AUTOCONF="$missing_dir/missing autoconf" + echo "$ac_t""missing" 1>&6 +fi + +echo $ac_n "checking for working automake""... $ac_c" 1>&6 +echo "configure:742: checking for working automake" >&5 +# Run test in a subshell; some versions of sh will print an error if +# an executable is not found, even if stderr is redirected. +# Redirect stdin to placate older versions of autoconf. Sigh. +if (automake --version) < /dev/null > /dev/null 2>&1; then + AUTOMAKE=automake + echo "$ac_t""found" 1>&6 +else + AUTOMAKE="$missing_dir/missing automake" + echo "$ac_t""missing" 1>&6 +fi + +echo $ac_n "checking for working autoheader""... $ac_c" 1>&6 +echo "configure:755: checking for working autoheader" >&5 +# Run test in a subshell; some versions of sh will print an error if +# an executable is not found, even if stderr is redirected. +# Redirect stdin to placate older versions of autoconf. Sigh. +if (autoheader --version) < /dev/null > /dev/null 2>&1; then + AUTOHEADER=autoheader + echo "$ac_t""found" 1>&6 +else + AUTOHEADER="$missing_dir/missing autoheader" + echo "$ac_t""missing" 1>&6 +fi + +echo $ac_n "checking for working makeinfo""... $ac_c" 1>&6 +echo "configure:768: checking for working makeinfo" >&5 +# Run test in a subshell; some versions of sh will print an error if +# an executable is not found, even if stderr is redirected. +# Redirect stdin to placate older versions of autoconf. Sigh. +if (makeinfo --version) < /dev/null > /dev/null 2>&1; then + MAKEINFO=makeinfo + echo "$ac_t""found" 1>&6 +else + MAKEINFO="$missing_dir/missing makeinfo" + echo "$ac_t""missing" 1>&6 +fi + + + +test "$CFLAGS" = "" && CFLAGS="-O2" + + +# Extract the first word of "gcc", so it can be a program name with args. +set dummy gcc; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:788: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_prog_CC="gcc" + break + fi + done + IFS="$ac_save_ifs" +fi +fi +CC="$ac_cv_prog_CC" +if test -n "$CC"; then + echo "$ac_t""$CC" 1>&6 +else + echo "$ac_t""no" 1>&6 +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 $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:818: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_prog_rejected=no + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + if test "$ac_dir/$ac_word" = "/usr/ucb/cc"; then + ac_prog_rejected=yes + continue + fi + ac_cv_prog_CC="cc" + break + fi + done + IFS="$ac_save_ifs" +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 $# -gt 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" "$@" + shift + ac_cv_prog_CC="$@" + fi +fi +fi +fi +CC="$ac_cv_prog_CC" +if test -n "$CC"; then + echo "$ac_t""$CC" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + + if test -z "$CC"; then + case "`uname -s`" in + *win32* | *WIN32*) + # Extract the first word of "cl", so it can be a program name with args. +set dummy cl; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:869: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_prog_CC="cl" + break + fi + done + IFS="$ac_save_ifs" +fi +fi +CC="$ac_cv_prog_CC" +if test -n "$CC"; then + echo "$ac_t""$CC" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + ;; + esac + fi + test -z "$CC" && { echo "configure: error: no acceptable cc found in \$PATH" 1>&2; exit 1; } +fi + +echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6 +echo "configure:901: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 + +ac_ext=c +# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. +ac_cpp='$CPP $CPPFLAGS' +ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' +ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' +cross_compiling=$ac_cv_prog_cc_cross + +cat > conftest.$ac_ext << EOF + +#line 912 "configure" +#include "confdefs.h" + +main(){return(0);} +EOF +if { (eval echo configure:917: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + ac_cv_prog_cc_works=yes + # If we can't run a trivial program, we are probably using a cross compiler. + if (./conftest; exit) 2>/dev/null; then + ac_cv_prog_cc_cross=no + else + ac_cv_prog_cc_cross=yes + fi +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + ac_cv_prog_cc_works=no +fi +rm -fr conftest* +ac_ext=c +# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. +ac_cpp='$CPP $CPPFLAGS' +ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' +ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' +cross_compiling=$ac_cv_prog_cc_cross + +echo "$ac_t""$ac_cv_prog_cc_works" 1>&6 +if test $ac_cv_prog_cc_works = no; then + { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; } +fi +echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6 +echo "configure:943: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 +echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6 +cross_compiling=$ac_cv_prog_cc_cross + +echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6 +echo "configure:948: checking whether we are using GNU C" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.c <&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then + ac_cv_prog_gcc=yes +else + ac_cv_prog_gcc=no +fi +fi + +echo "$ac_t""$ac_cv_prog_gcc" 1>&6 + +if test $ac_cv_prog_gcc = yes; then + GCC=yes +else + GCC= +fi + +ac_test_CFLAGS="${CFLAGS+set}" +ac_save_CFLAGS="$CFLAGS" +CFLAGS= +echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6 +echo "configure:976: checking whether ${CC-cc} accepts -g" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + echo 'void f(){}' > conftest.c +if test -z "`${CC-cc} -g -c conftest.c 2>&1`"; then + ac_cv_prog_cc_g=yes +else + ac_cv_prog_cc_g=no +fi +rm -f conftest* + +fi + +echo "$ac_t""$ac_cv_prog_cc_g" 1>&6 +if test "$ac_test_CFLAGS" = set; then + CFLAGS="$ac_save_CFLAGS" +elif test $ac_cv_prog_cc_g = yes; then + if test "$GCC" = yes; then + CFLAGS="-g -O2" + else + CFLAGS="-g" + fi +else + if test "$GCC" = yes; then + CFLAGS="-O2" + else + CFLAGS= + fi +fi + +# Find a good install program. We prefer a C program (faster), +# so one script is as good as another. But avoid the broken or +# incompatible versions: +# SysV /etc/install, /usr/sbin/install +# SunOS /usr/etc/install +# IRIX /sbin/install +# AIX /bin/install +# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag +# 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 $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6 +echo "configure:1019: checking for a BSD compatible install" >&5 +if test -z "$INSTALL"; then +if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + IFS="${IFS= }"; ac_save_IFS="$IFS"; IFS=":" + for ac_dir in $PATH; do + # Account for people who put trailing slashes in PATH elements. + case "$ac_dir/" in + /|./|.//|/etc/*|/usr/sbin/*|/usr/etc/*|/sbin/*|/usr/afsws/bin/*|/usr/ucb/*) ;; + *) + # OSF1 and SCO ODT 3.0 have their own names for install. + # Don't use installbsd from OSF since it installs stuff as root + # by default. + for ac_prog in ginstall scoinst install; do + if test -f $ac_dir/$ac_prog; then + if test $ac_prog = install && + grep dspmsg $ac_dir/$ac_prog >/dev/null 2>&1; then + # AIX install. It has an incompatible calling convention. + : + else + ac_cv_path_install="$ac_dir/$ac_prog -c" + break 2 + fi + fi + done + ;; + esac + done + IFS="$ac_save_IFS" + +fi + if test "${ac_cv_path_install+set}" = set; then + INSTALL="$ac_cv_path_install" + else + # As a last resort, use the slow shell script. We don't cache a + # path for INSTALL within a source directory, because that will + # break other packages using the cache if that directory is + # removed, or if the path is relative. + INSTALL="$ac_install_sh" + fi +fi +echo "$ac_t""$INSTALL" 1>&6 + +# Use test -z because SunOS4 sh mishandles braces in ${var-val}. +# It thinks the first close brace ends the variable substitution. +test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' + +test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}' + +test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' + +echo $ac_n "checking whether ln -s works""... $ac_c" 1>&6 +echo "configure:1072: checking whether ln -s works" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_LN_S'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + rm -f conftestdata +if ln -s X conftestdata 2>/dev/null +then + rm -f conftestdata + ac_cv_prog_LN_S="ln -s" +else + ac_cv_prog_LN_S=ln +fi +fi +LN_S="$ac_cv_prog_LN_S" +if test "$ac_cv_prog_LN_S" = "ln -s"; then + echo "$ac_t""yes" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + +# Extract the first word of "ranlib", so it can be a program name with args. +set dummy ranlib; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:1095: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$RANLIB"; then + ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_prog_RANLIB="ranlib" + break + fi + done + IFS="$ac_save_ifs" + test -z "$ac_cv_prog_RANLIB" && ac_cv_prog_RANLIB=":" +fi +fi +RANLIB="$ac_cv_prog_RANLIB" +if test -n "$RANLIB"; then + echo "$ac_t""$RANLIB" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + +if test "$program_transform_name" = s,x,x,; then + program_transform_name= +else + # Double any \ or $. echo might interpret backslashes. + cat <<\EOF_SED > conftestsed +s,\\,\\\\,g; s,\$,$$,g +EOF_SED + program_transform_name="`echo $program_transform_name|sed -f conftestsed`" + rm -f conftestsed +fi +test "$program_prefix" != NONE && + program_transform_name="s,^,${program_prefix},; $program_transform_name" +# Use a double $ so make ignores it. +test "$program_suffix" != NONE && + program_transform_name="s,\$\$,${program_suffix},; $program_transform_name" + +# sed with no file args requires a program. +test "$program_transform_name" = "" && program_transform_name="s,x,x," + + + +echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6 +echo "configure:1144: checking how to run the C preprocessor" >&5 +# On Suns, sometimes $CPP names a directory. +if test -n "$CPP" && test -d "$CPP"; then + CPP= +fi +if test -z "$CPP"; then +if eval "test \"`echo '$''{'ac_cv_prog_CPP'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + # This must be in double quotes, not single quotes, because CPP may get + # substituted into the Makefile and "${CC-cc}" will confuse make. + CPP="${CC-cc} -E" + # On the NeXT, cc -E runs the code through the compiler's parser, + # not just through cpp. + cat > conftest.$ac_ext < +Syntax Error +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:1165: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` +if test -z "$ac_err"; then + : +else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + CPP="${CC-cc} -E -traditional-cpp" + cat > conftest.$ac_ext < +Syntax Error +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:1182: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` +if test -z "$ac_err"; then + : +else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + CPP="${CC-cc} -nologo -E" + cat > conftest.$ac_ext < +Syntax Error +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:1199: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` +if test -z "$ac_err"; then + : +else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + CPP=/lib/cpp +fi +rm -f conftest* +fi +rm -f conftest* +fi +rm -f conftest* + ac_cv_prog_CPP="$CPP" +fi + CPP="$ac_cv_prog_CPP" +else + ac_cv_prog_CPP="$CPP" +fi +echo "$ac_t""$CPP" 1>&6 + +echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6 +echo "configure:1224: checking for ANSI C header files" >&5 +if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +#include +#include +#include +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:1237: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` +if test -z "$ac_err"; then + rm -rf conftest* + ac_cv_header_stdc=yes +else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + ac_cv_header_stdc=no +fi +rm -f conftest* + +if test $ac_cv_header_stdc = yes; then + # SunOS 4.x string.h does not declare mem*, contrary to ANSI. +cat > conftest.$ac_ext < +EOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + egrep "memchr" >/dev/null 2>&1; then + : +else + rm -rf conftest* + ac_cv_header_stdc=no +fi +rm -f 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 < +EOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + egrep "free" >/dev/null 2>&1; then + : +else + rm -rf conftest* + ac_cv_header_stdc=no +fi +rm -f 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 < +#define ISLOWER(c) ('a' <= (c) && (c) <= 'z') +#define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) +#define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) +int main () { int i; for (i = 0; i < 256; i++) +if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2); +exit (0); } + +EOF +if { (eval echo configure:1304: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +then + : +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -fr conftest* + ac_cv_header_stdc=no +fi +rm -fr conftest* +fi + +fi +fi + +echo "$ac_t""$ac_cv_header_stdc" 1>&6 +if test $ac_cv_header_stdc = yes; then + cat >> confdefs.h <<\EOF +#define STDC_HEADERS 1 +EOF + +fi + +for ac_hdr in sgtty.h sys/ioctl.h sys/time.h termio.h termios.h unistd.h +do +ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` +echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 +echo "configure:1331: checking for $ac_hdr" >&5 +if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:1341: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` +if test -z "$ac_err"; then + rm -rf conftest* + eval "ac_cv_header_$ac_safe=yes" +else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_header_$ac_safe=no" +fi +rm -f conftest* +fi +if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'` + cat >> confdefs.h <&6 +fi +done + + + +echo $ac_n "checking for working const""... $ac_c" 1>&6 +echo "configure:1370: checking for working const" >&5 +if eval "test \"`echo '$''{'ac_cv_c_const'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <j = 5; +} +{ /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */ + const int foo = 10; +} + +; return 0; } +EOF +if { (eval echo configure:1424: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + ac_cv_c_const=yes +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + ac_cv_c_const=no +fi +rm -f conftest* +fi + +echo "$ac_t""$ac_cv_c_const" 1>&6 +if test $ac_cv_c_const = no; then + cat >> confdefs.h <<\EOF +#define const +EOF + +fi + +echo $ac_n "checking for inline""... $ac_c" 1>&6 +echo "configure:1445: checking for inline" >&5 +if eval "test \"`echo '$''{'ac_cv_c_inline'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + ac_cv_c_inline=no +for ac_kw in inline __inline__ __inline; do + cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + ac_cv_c_inline=$ac_kw; break +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 +fi +rm -f conftest* +done + +fi + +echo "$ac_t""$ac_cv_c_inline" 1>&6 +case "$ac_cv_c_inline" in + inline | yes) ;; + no) cat >> confdefs.h <<\EOF +#define inline +EOF + ;; + *) cat >> confdefs.h <&6 +echo "configure:1485: checking whether time.h and sys/time.h may both be included" >&5 +if eval "test \"`echo '$''{'ac_cv_header_time'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +#include +#include +int main() { +struct tm *tp; +; return 0; } +EOF +if { (eval echo configure:1499: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + ac_cv_header_time=yes +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + ac_cv_header_time=no +fi +rm -f conftest* +fi + +echo "$ac_t""$ac_cv_header_time" 1>&6 +if test $ac_cv_header_time = yes; then + cat >> confdefs.h <<\EOF +#define TIME_WITH_SYS_TIME 1 +EOF + +fi + +echo $ac_n "checking whether byte ordering is bigendian""... $ac_c" 1>&6 +echo "configure:1520: checking whether byte ordering is bigendian" >&5 +if eval "test \"`echo '$''{'ac_cv_c_bigendian'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + ac_cv_c_bigendian=unknown +# See if sys/param.h defines the BYTE_ORDER macro. +cat > conftest.$ac_ext < +#include +int main() { + +#if !BYTE_ORDER || !BIG_ENDIAN || !LITTLE_ENDIAN + bogus endian macros +#endif +; return 0; } +EOF +if { (eval echo configure:1538: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + # It does; now see whether it defined to BIG_ENDIAN or not. +cat > conftest.$ac_ext < +#include +int main() { + +#if BYTE_ORDER != BIG_ENDIAN + not big endian +#endif +; return 0; } +EOF +if { (eval echo configure:1553: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + ac_cv_c_bigendian=yes +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + ac_cv_c_bigendian=no +fi +rm -f conftest* +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 +fi +rm -f conftest* +if test $ac_cv_c_bigendian = unknown; then +if test "$cross_compiling" = yes; then + { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; } +else + cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +then + ac_cv_c_bigendian=no +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -fr conftest* + ac_cv_c_bigendian=yes +fi +rm -fr conftest* +fi + +fi +fi + +echo "$ac_t""$ac_cv_c_bigendian" 1>&6 +if test $ac_cv_c_bigendian = yes; then + cat >> confdefs.h <<\EOF +#define WORDS_BIGENDIAN 1 +EOF + +fi + +echo $ac_n "checking size of short""... $ac_c" 1>&6 +echo "configure:1610: checking size of short" >&5 +if eval "test \"`echo '$''{'ac_cv_sizeof_short'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test "$cross_compiling" = yes; then + { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; } +else + cat > conftest.$ac_ext < +main() +{ + FILE *f=fopen("conftestval", "w"); + if (!f) exit(1); + fprintf(f, "%d\n", sizeof(short)); + exit(0); +} +EOF +if { (eval echo configure:1629: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +then + ac_cv_sizeof_short=`cat conftestval` +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -fr conftest* + ac_cv_sizeof_short=0 +fi +rm -fr conftest* +fi + +fi +echo "$ac_t""$ac_cv_sizeof_short" 1>&6 +cat >> confdefs.h <&6 +echo "configure:1649: checking size of int" >&5 +if eval "test \"`echo '$''{'ac_cv_sizeof_int'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test "$cross_compiling" = yes; then + { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; } +else + cat > conftest.$ac_ext < +main() +{ + FILE *f=fopen("conftestval", "w"); + if (!f) exit(1); + fprintf(f, "%d\n", sizeof(int)); + exit(0); +} +EOF +if { (eval echo configure:1668: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +then + ac_cv_sizeof_int=`cat conftestval` +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -fr conftest* + ac_cv_sizeof_int=0 +fi +rm -fr conftest* +fi + +fi +echo "$ac_t""$ac_cv_sizeof_int" 1>&6 +cat >> confdefs.h <&6 +echo "configure:1688: checking size of long" >&5 +if eval "test \"`echo '$''{'ac_cv_sizeof_long'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test "$cross_compiling" = yes; then + { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; } +else + cat > conftest.$ac_ext < +main() +{ + FILE *f=fopen("conftestval", "w"); + if (!f) exit(1); + fprintf(f, "%d\n", sizeof(long)); + exit(0); +} +EOF +if { (eval echo configure:1707: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +then + ac_cv_sizeof_long=`cat conftestval` +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -fr conftest* + ac_cv_sizeof_long=0 +fi +rm -fr conftest* +fi + +fi +echo "$ac_t""$ac_cv_sizeof_long" 1>&6 +cat >> confdefs.h <&6 +echo "configure:1727: checking size of long long" >&5 +if eval "test \"`echo '$''{'ac_cv_sizeof_long_long'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test "$cross_compiling" = yes; then + { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; } +else + cat > conftest.$ac_ext < +main() +{ + FILE *f=fopen("conftestval", "w"); + if (!f) exit(1); + fprintf(f, "%d\n", sizeof(long long)); + exit(0); +} +EOF +if { (eval echo configure:1746: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +then + ac_cv_sizeof_long_long=`cat conftestval` +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -fr conftest* + ac_cv_sizeof_long_long=0 +fi +rm -fr conftest* +fi + +fi +echo "$ac_t""$ac_cv_sizeof_long_long" 1>&6 +cat >> confdefs.h < conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then + : +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + cat >> confdefs.h <<\EOF +#define volatile +EOF + +fi +rm -f conftest* +echo $ac_n "checking whether char is unsigned""... $ac_c" 1>&6 +echo "configure:1786: checking whether char is unsigned" >&5 +if eval "test \"`echo '$''{'ac_cv_c_char_unsigned'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test "$GCC" = yes; then + # GCC predefines this symbol on systems where it applies. +cat > conftest.$ac_ext <&5 | + egrep "yes" >/dev/null 2>&1; then + rm -rf conftest* + ac_cv_c_char_unsigned=yes +else + rm -rf conftest* + ac_cv_c_char_unsigned=no +fi +rm -f conftest* + +else +if test "$cross_compiling" = yes; then + { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; } +else + cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +then + ac_cv_c_char_unsigned=yes +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -fr conftest* + ac_cv_c_char_unsigned=no +fi +rm -fr conftest* +fi + +fi +fi + +echo "$ac_t""$ac_cv_c_char_unsigned" 1>&6 +if test $ac_cv_c_char_unsigned = yes && test "$GCC" != yes; then + cat >> confdefs.h <<\EOF +#define __CHAR_UNSIGNED__ 1 +EOF + +fi + + +if test "$ac_cv_c_char_unsigned" = "yes"; then + signed=-signed +fi + + +for ac_func in sigaction strchr memcpy +do +echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 +echo "configure:1857: checking for $ac_func" >&5 +if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +/* Override any gcc2 internal prototype to avoid an error. */ +/* 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(); + +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 +$ac_func(); +#endif + +; return 0; } +EOF +if { (eval echo configure:1885: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_func_$ac_func=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_func_$ac_func=no" +fi +rm -f conftest* +fi + +if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` + cat >> confdefs.h <&6 +fi +done + + +echo $ac_n "checking POSIX signal handlers""... $ac_c" 1>&6 +echo "configure:1911: checking POSIX signal handlers" >&5 +if eval "test \"`echo '$''{'ac_cv_has_posix_signals'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +#include +#ifdef signal +#undef signal +#endif +extern void (*signal ()) (); +int main() { + +; return 0; } +EOF +if { (eval echo configure:1928: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + ac_cv_has_posix_signals=yes +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + ac_cv_has_posix_signals=no +fi +rm -f conftest* +fi + +echo "$ac_t""$ac_cv_has_posix_signals" 1>&6 +if test $ac_cv_has_posix_signals = yes; then + cat >> confdefs.h <<\EOF +#define RETSIGTYPE void +EOF + cat >> confdefs.h <<\EOF +#define POSIX_SIGTYPE 1 +EOF + +else + if test $ac_cv_type_signal = void; then + cat >> confdefs.h <<\EOF +#define RETSIGTYPE void +EOF + + else + cat >> confdefs.h <<\EOF +#define RETSIGTYPE int +EOF + + fi +fi +ac_safe=`echo "termios.h" | sed 'y%./+-%__p_%'` +echo $ac_n "checking for termios.h""... $ac_c" 1>&6 +echo "configure:1964: checking for termios.h" >&5 +if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:1974: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` +if test -z "$ac_err"; then + rm -rf conftest* + eval "ac_cv_header_$ac_safe=yes" +else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_header_$ac_safe=no" +fi +rm -f conftest* +fi +if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then + echo "$ac_t""yes" 1>&6 + echo $ac_n "checking for cfsetispeed""... $ac_c" 1>&6 +echo "configure:1991: checking for cfsetispeed" >&5 +if eval "test \"`echo '$''{'ac_cv_func_cfsetispeed'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +/* Override any gcc2 internal prototype to avoid an error. */ +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char cfsetispeed(); + +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_cfsetispeed) || defined (__stub___cfsetispeed) +choke me +#else +cfsetispeed(); +#endif + +; return 0; } +EOF +if { (eval echo configure:2019: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_func_cfsetispeed=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_func_cfsetispeed=no" +fi +rm -f conftest* +fi + +if eval "test \"`echo '$ac_cv_func_'cfsetispeed`\" = yes"; then + echo "$ac_t""yes" 1>&6 + cat >> confdefs.h <<\EOF +#define POSIX_TERMIOS 1 +EOF + +else + echo "$ac_t""no" 1>&6 +fi + +else + echo "$ac_t""no" 1>&6 +fi + + + + +cat >> confdefs.h <<\EOF +#define SHA1HANDSOFF 1 +EOF + + +trap '' 1 2 15 +cat > confcache <<\EOF +# This file is a shell script that caches the results of configure +# tests run on this system so they can be shared between configure +# scripts and configure runs. It is not useful on other systems. +# If it contains results you don't want to keep, you may remove or edit it. +# +# By default, configure uses ./config.cache as the cache file, +# creating it if it does not exist already. You can give configure +# the --cache-file=FILE option to use a different cache file; that is +# what configure does when it calls configure scripts in +# subdirectories, so they share the cache. +# Giving --cache-file=/dev/null disables caching, for debugging configure. +# config.status only pays attention to the cache file if you give it the +# --recheck option to rerun configure. +# +EOF +# The following way of writing the cache mishandles newlines in values, +# but we know of no workaround that is simple, portable, and efficient. +# So, don't put newlines in cache variables' values. +# Ultrix sh set writes to stderr and can't be redirected directly, +# and sets the high bit in the cache file unless we assign to the vars. +(set) 2>&1 | + case `(ac_space=' '; set | grep ac_space) 2>&1` in + *ac_space=\ *) + # `set' does not quote correctly, so add quotes (double-quote substitution + # turns \\\\ into \\, and sed turns \\ into \). + sed -n \ + -e "s/'/'\\\\''/g" \ + -e "s/^\\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\\)=\\(.*\\)/\\1=\${\\1='\\2'}/p" + ;; + *) + # `set' quotes correctly as required by POSIX, so do not add quotes. + sed -n -e 's/^\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\)=\(.*\)/\1=${\1=\2}/p' + ;; + esac >> confcache +if cmp -s $cache_file confcache; then + : +else + if test -w $cache_file; then + echo "updating cache $cache_file" + cat confcache > $cache_file + else + echo "not updating unwritable cache $cache_file" + fi +fi +rm -f confcache + +trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15 + +test "x$prefix" = xNONE && prefix=$ac_default_prefix +# Let make expand exec_prefix. +test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' + +# Any assignment to VPATH causes Sun make to only execute +# the first set of double-colon rules, so remove it if not needed. +# If there is a colon in the path, we need to keep it. +if test "x$srcdir" = x.; then + ac_vpsub='/^[ ]*VPATH[ ]*=[^:]*$/d' +fi + +trap 'rm -f $CONFIG_STATUS conftest*; exit 1' 1 2 15 + +DEFS=-DHAVE_CONFIG_H + +# Without the "./", some shells look in PATH for config.status. +: ${CONFIG_STATUS=./config.status} + +echo creating $CONFIG_STATUS +rm -f $CONFIG_STATUS +cat > $CONFIG_STATUS </dev/null | sed 1q`: +# +# $0 $ac_configure_args +# +# Compiler output produced by configure, useful for debugging +# configure, is in ./config.log if it exists. + +ac_cs_usage="Usage: $CONFIG_STATUS [--recheck] [--version] [--help]" +for ac_option +do + case "\$ac_option" in + -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) + echo "running \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion" + exec \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion ;; + -version | --version | --versio | --versi | --vers | --ver | --ve | --v) + echo "$CONFIG_STATUS generated by autoconf version 2.13" + exit 0 ;; + -help | --help | --hel | --he | --h) + echo "\$ac_cs_usage"; exit 0 ;; + *) echo "\$ac_cs_usage"; exit 1 ;; + esac +done + +ac_given_srcdir=$srcdir +ac_given_INSTALL="$INSTALL" + +trap 'rm -fr `echo "Makefile config.h" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15 +EOF +cat >> $CONFIG_STATUS < conftest.subs <<\\CEOF +$ac_vpsub +$extrasub +s%@SHELL@%$SHELL%g +s%@CFLAGS@%$CFLAGS%g +s%@CPPFLAGS@%$CPPFLAGS%g +s%@CXXFLAGS@%$CXXFLAGS%g +s%@FFLAGS@%$FFLAGS%g +s%@DEFS@%$DEFS%g +s%@LDFLAGS@%$LDFLAGS%g +s%@LIBS@%$LIBS%g +s%@exec_prefix@%$exec_prefix%g +s%@prefix@%$prefix%g +s%@program_transform_name@%$program_transform_name%g +s%@bindir@%$bindir%g +s%@sbindir@%$sbindir%g +s%@libexecdir@%$libexecdir%g +s%@datadir@%$datadir%g +s%@sysconfdir@%$sysconfdir%g +s%@sharedstatedir@%$sharedstatedir%g +s%@localstatedir@%$localstatedir%g +s%@libdir@%$libdir%g +s%@includedir@%$includedir%g +s%@oldincludedir@%$oldincludedir%g +s%@infodir@%$infodir%g +s%@mandir@%$mandir%g +s%@INSTALL_PROGRAM@%$INSTALL_PROGRAM%g +s%@INSTALL_SCRIPT@%$INSTALL_SCRIPT%g +s%@INSTALL_DATA@%$INSTALL_DATA%g +s%@PACKAGE@%$PACKAGE%g +s%@VERSION@%$VERSION%g +s%@ACLOCAL@%$ACLOCAL%g +s%@AUTOCONF@%$AUTOCONF%g +s%@AUTOMAKE@%$AUTOMAKE%g +s%@AUTOHEADER@%$AUTOHEADER%g +s%@MAKEINFO@%$MAKEINFO%g +s%@SET_MAKE@%$SET_MAKE%g +s%@CC@%$CC%g +s%@LN_S@%$LN_S%g +s%@RANLIB@%$RANLIB%g +s%@CPP@%$CPP%g +s%@signed@%$signed%g + +CEOF +EOF + +cat >> $CONFIG_STATUS <<\EOF + +# Split the substitutions into bite-sized pieces for seds with +# small command number limits, like on Digital OSF/1 and HP-UX. +ac_max_sed_cmds=90 # Maximum number of lines to put in a sed script. +ac_file=1 # Number of current file. +ac_beg=1 # First line for current file. +ac_end=$ac_max_sed_cmds # Line after last line for current file. +ac_more_lines=: +ac_sed_cmds="" +while $ac_more_lines; do + if test $ac_beg -gt 1; then + sed "1,${ac_beg}d; ${ac_end}q" conftest.subs > conftest.s$ac_file + else + sed "${ac_end}q" conftest.subs > conftest.s$ac_file + fi + if test ! -s conftest.s$ac_file; then + ac_more_lines=false + rm -f conftest.s$ac_file + else + if test -z "$ac_sed_cmds"; then + ac_sed_cmds="sed -f conftest.s$ac_file" + else + ac_sed_cmds="$ac_sed_cmds | sed -f conftest.s$ac_file" + fi + ac_file=`expr $ac_file + 1` + ac_beg=$ac_end + ac_end=`expr $ac_end + $ac_max_sed_cmds` + fi +done +if test -z "$ac_sed_cmds"; then + ac_sed_cmds=cat +fi +EOF + +cat >> $CONFIG_STATUS <> $CONFIG_STATUS <<\EOF +for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then + # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". + case "$ac_file" in + *:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'` + ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;; + *) ac_file_in="${ac_file}.in" ;; + esac + + # Adjust a relative srcdir, top_srcdir, and INSTALL for subdirectories. + + # Remove last slash and all that follows it. Not all systems have dirname. + ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'` + if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then + # The file is in a subdirectory. + test ! -d "$ac_dir" && mkdir "$ac_dir" + ac_dir_suffix="/`echo $ac_dir|sed 's%^\./%%'`" + # A "../" for each directory in $ac_dir_suffix. + ac_dots=`echo $ac_dir_suffix|sed 's%/[^/]*%../%g'` + else + ac_dir_suffix= ac_dots= + fi + + case "$ac_given_srcdir" in + .) srcdir=. + if test -z "$ac_dots"; then top_srcdir=. + else top_srcdir=`echo $ac_dots|sed 's%/$%%'`; fi ;; + /*) srcdir="$ac_given_srcdir$ac_dir_suffix"; top_srcdir="$ac_given_srcdir" ;; + *) # Relative path. + srcdir="$ac_dots$ac_given_srcdir$ac_dir_suffix" + top_srcdir="$ac_dots$ac_given_srcdir" ;; + esac + + case "$ac_given_INSTALL" in + [/$]*) INSTALL="$ac_given_INSTALL" ;; + *) INSTALL="$ac_dots$ac_given_INSTALL" ;; + esac + + echo creating "$ac_file" + rm -f "$ac_file" + configure_input="Generated automatically from `echo $ac_file_in|sed 's%.*/%%'` by configure." + case "$ac_file" in + *Makefile*) ac_comsub="1i\\ +# $configure_input" ;; + *) ac_comsub= ;; + esac + + ac_file_inputs=`echo $ac_file_in|sed -e "s%^%$ac_given_srcdir/%" -e "s%:% $ac_given_srcdir/%g"` + sed -e "$ac_comsub +s%@configure_input@%$configure_input%g +s%@srcdir@%$srcdir%g +s%@top_srcdir@%$top_srcdir%g +s%@INSTALL@%$INSTALL%g +" $ac_file_inputs | (eval "$ac_sed_cmds") > $ac_file +fi; done +rm -f conftest.s* + +# These sed commands are passed to sed as "A NAME B NAME C VALUE D", where +# NAME is the cpp macro being defined and VALUE is the value it is being given. +# +# ac_d sets the value in "#define NAME VALUE" lines. +ac_dA='s%^\([ ]*\)#\([ ]*define[ ][ ]*\)' +ac_dB='\([ ][ ]*\)[^ ]*%\1#\2' +ac_dC='\3' +ac_dD='%g' +# ac_u turns "#undef NAME" with trailing blanks into "#define NAME VALUE". +ac_uA='s%^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)' +ac_uB='\([ ]\)%\1#\2define\3' +ac_uC=' ' +ac_uD='\4%g' +# ac_e turns "#undef NAME" without trailing blanks into "#define NAME VALUE". +ac_eA='s%^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)' +ac_eB='$%\1#\2define\3' +ac_eC=' ' +ac_eD='%g' + +if test "${CONFIG_HEADERS+set}" != set; then +EOF +cat >> $CONFIG_STATUS <> $CONFIG_STATUS <<\EOF +fi +for ac_file in .. $CONFIG_HEADERS; do if test "x$ac_file" != x..; then + # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". + case "$ac_file" in + *:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'` + ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;; + *) ac_file_in="${ac_file}.in" ;; + esac + + echo creating $ac_file + + rm -f conftest.frag conftest.in conftest.out + ac_file_inputs=`echo $ac_file_in|sed -e "s%^%$ac_given_srcdir/%" -e "s%:% $ac_given_srcdir/%g"` + cat $ac_file_inputs > conftest.in + +EOF + +# Transform confdefs.h into a sed script conftest.vals that substitutes +# the proper values into config.h.in to produce config.h. And first: +# Protect against being on the right side of a sed subst in config.status. +# Protect against being in an unquoted here document in config.status. +rm -f conftest.vals +cat > conftest.hdr <<\EOF +s/[\\&%]/\\&/g +s%[\\$`]%\\&%g +s%#define \([A-Za-z_][A-Za-z0-9_]*\) *\(.*\)%${ac_dA}\1${ac_dB}\1${ac_dC}\2${ac_dD}%gp +s%ac_d%ac_u%gp +s%ac_u%ac_e%gp +EOF +sed -n -f conftest.hdr confdefs.h > conftest.vals +rm -f conftest.hdr + +# This sed command replaces #undef with comments. This is necessary, for +# example, in the case of _POSIX_SOURCE, which is predefined and required +# on some systems where configure will not decide to define it. +cat >> conftest.vals <<\EOF +s%^[ ]*#[ ]*undef[ ][ ]*[a-zA-Z_][a-zA-Z_0-9]*%/* & */% +EOF + +# Break up conftest.vals because some shells have a limit on +# the size of here documents, and old seds have small limits too. + +rm -f conftest.tail +while : +do + ac_lines=`grep -c . conftest.vals` + # grep -c gives empty output for an empty file on some AIX systems. + if test -z "$ac_lines" || test "$ac_lines" -eq 0; then break; fi + # Write a limited-size here document to conftest.frag. + echo ' cat > conftest.frag <> $CONFIG_STATUS + sed ${ac_max_here_lines}q conftest.vals >> $CONFIG_STATUS + echo 'CEOF + sed -f conftest.frag conftest.in > conftest.out + rm -f conftest.in + mv conftest.out conftest.in +' >> $CONFIG_STATUS + sed 1,${ac_max_here_lines}d conftest.vals > conftest.tail + rm -f conftest.vals + mv conftest.tail conftest.vals +done +rm -f conftest.vals + +cat >> $CONFIG_STATUS <<\EOF + rm -f conftest.frag conftest.h + echo "/* $ac_file. Generated automatically by configure. */" > conftest.h + cat conftest.in >> conftest.h + rm -f conftest.in + if cmp -s $ac_file conftest.h 2>/dev/null; then + echo "$ac_file is unchanged" + rm -f conftest.h + else + # Remove last slash and all that follows it. Not all systems have dirname. + ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'` + if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then + # The file is in a subdirectory. + test ! -d "$ac_dir" && mkdir "$ac_dir" + fi + rm -f $ac_file + mv conftest.h $ac_file + fi +fi; done + +EOF +cat >> $CONFIG_STATUS <> $CONFIG_STATUS <<\EOF +test -z "$CONFIG_HEADERS" || echo timestamp > stamp-h + +exit 0 +EOF +chmod +x $CONFIG_STATUS +rm -fr confdefs* $ac_clean_files +test "$no_create" = yes || ${CONFIG_SHELL-/bin/sh} $CONFIG_STATUS || exit 1 + diff --git a/package/network/services/ead/src/tinysrp/configure.in b/package/network/services/ead/src/tinysrp/configure.in new file mode 100644 index 0000000000..627d15a8c7 --- /dev/null +++ b/package/network/services/ead/src/tinysrp/configure.in @@ -0,0 +1,52 @@ +dnl Process this file with autoconf to produce a configure script. + +AC_INIT(t_pwd.h) +AM_CONFIG_HEADER(config.h) +AM_INIT_AUTOMAKE(libtinysrp, 0.7.5) + +test "$CFLAGS" = "" && CFLAGS="-O2" + +dnl Checks for programs. + +AC_PROG_CC +AC_PROG_INSTALL +AC_PROG_LN_S +AC_PROG_RANLIB +AC_ARG_PROGRAM + +dnl Checks for header files. + +AC_HEADER_STDC +AC_CHECK_HEADERS(sgtty.h sys/ioctl.h sys/time.h termio.h termios.h unistd.h) + +dnl Checks for typedefs, structures, and compiler characteristics. + +AC_C_CONST +AC_C_INLINE +AC_HEADER_TIME +AC_C_BIGENDIAN +AC_CHECK_SIZEOF(short) +AC_CHECK_SIZEOF(int) +AC_CHECK_SIZEOF(long) +AC_CHECK_SIZEOF(long long) +AC_TRY_COMPILE(, [volatile int i;], , AC_DEFINE(volatile, )) +AC_C_CHAR_UNSIGNED + +AC_SUBST(signed)dnl +if test "$ac_cv_c_char_unsigned" = "yes"; then + signed=-signed +fi + +dnl Checks for library functions. + +AC_CHECK_FUNCS(sigaction strchr memcpy) +TYPE_SIGNAL +AC_HEADER_CHECK(termios.h,AC_FUNC_CHECK(cfsetispeed,AC_DEFINE(POSIX_TERMIOS))) + +dnl User options + +dnl Some defines for now. + +AC_DEFINE(SHA1HANDSOFF) + +AC_OUTPUT(Makefile) diff --git a/package/network/services/ead/src/tinysrp/install-sh b/package/network/services/ead/src/tinysrp/install-sh new file mode 100755 index 0000000000..e8436696c1 --- /dev/null +++ b/package/network/services/ead/src/tinysrp/install-sh @@ -0,0 +1,250 @@ +#!/bin/sh +# +# install - install a program, script, or datafile +# This comes from X11R5 (mit/util/scripts/install.sh). +# +# Copyright 1991 by the Massachusetts Institute of Technology +# +# Permission to use, copy, modify, distribute, and sell this software and its +# documentation for any purpose is hereby granted without fee, provided that +# the above copyright notice appear in all copies and that both that +# copyright notice and this permission notice appear in supporting +# documentation, and that the name of M.I.T. not be used in advertising or +# publicity pertaining to distribution of the software without specific, +# written prior permission. M.I.T. makes no representations about the +# suitability of this software for any purpose. It is provided "as is" +# without express or implied warranty. +# +# Calling this script install-sh is preferred over install.sh, to prevent +# `make' implicit rules from creating a file called install from it +# when there is no Makefile. +# +# This script is compatible with the BSD install script, but was written +# from scratch. It can only install one file at a time, a restriction +# shared with many OS's install programs. + + +# set DOITPROG to echo to test this script + +# Don't use :- since 4.3BSD and earlier shells don't like it. +doit="${DOITPROG-}" + + +# put in absolute paths if you don't have them in your path; or use env. vars. + +mvprog="${MVPROG-mv}" +cpprog="${CPPROG-cp}" +chmodprog="${CHMODPROG-chmod}" +chownprog="${CHOWNPROG-chown}" +chgrpprog="${CHGRPPROG-chgrp}" +stripprog="${STRIPPROG-strip}" +rmprog="${RMPROG-rm}" +mkdirprog="${MKDIRPROG-mkdir}" + +transformbasename="" +transform_arg="" +instcmd="$mvprog" +chmodcmd="$chmodprog 0755" +chowncmd="" +chgrpcmd="" +stripcmd="" +rmcmd="$rmprog -f" +mvcmd="$mvprog" +src="" +dst="" +dir_arg="" + +while [ x"$1" != x ]; do + case $1 in + -c) instcmd="$cpprog" + shift + continue;; + + -d) dir_arg=true + shift + continue;; + + -m) chmodcmd="$chmodprog $2" + shift + shift + continue;; + + -o) chowncmd="$chownprog $2" + shift + shift + continue;; + + -g) chgrpcmd="$chgrpprog $2" + shift + shift + continue;; + + -s) stripcmd="$stripprog" + shift + continue;; + + -t=*) transformarg=`echo $1 | sed 's/-t=//'` + shift + continue;; + + -b=*) transformbasename=`echo $1 | sed 's/-b=//'` + shift + continue;; + + *) if [ x"$src" = x ] + then + src=$1 + else + # this colon is to work around a 386BSD /bin/sh bug + : + dst=$1 + fi + shift + continue;; + esac +done + +if [ x"$src" = x ] +then + echo "install: no input file specified" + exit 1 +else + true +fi + +if [ x"$dir_arg" != x ]; then + dst=$src + src="" + + if [ -d $dst ]; then + instcmd=: + else + instcmd=mkdir + fi +else + +# Waiting for this to be detected by the "$instcmd $src $dsttmp" command +# might cause directories to be created, which would be especially bad +# if $src (and thus $dsttmp) contains '*'. + + if [ -f $src -o -d $src ] + then + true + else + echo "install: $src does not exist" + exit 1 + fi + + if [ x"$dst" = x ] + then + echo "install: no destination specified" + exit 1 + else + true + fi + +# If destination is a directory, append the input filename; if your system +# does not like double slashes in filenames, you may need to add some logic + + if [ -d $dst ] + then + dst="$dst"/`basename $src` + else + true + fi +fi + +## this sed command emulates the dirname command +dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'` + +# Make sure that the destination directory exists. +# this part is taken from Noah Friedman's mkinstalldirs script + +# Skip lots of stat calls in the usual case. +if [ ! -d "$dstdir" ]; then +defaultIFS=' +' +IFS="${IFS-${defaultIFS}}" + +oIFS="${IFS}" +# Some sh's can't handle IFS=/ for some reason. +IFS='%' +set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'` +IFS="${oIFS}" + +pathcomp='' + +while [ $# -ne 0 ] ; do + pathcomp="${pathcomp}${1}" + shift + + if [ ! -d "${pathcomp}" ] ; + then + $mkdirprog "${pathcomp}" + else + true + fi + + pathcomp="${pathcomp}/" +done +fi + +if [ x"$dir_arg" != x ] +then + $doit $instcmd $dst && + + if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else true ; fi && + if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else true ; fi && + if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else true ; fi && + if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else true ; fi +else + +# If we're going to rename the final executable, determine the name now. + + if [ x"$transformarg" = x ] + then + dstfile=`basename $dst` + else + dstfile=`basename $dst $transformbasename | + sed $transformarg`$transformbasename + fi + +# don't allow the sed command to completely eliminate the filename + + if [ x"$dstfile" = x ] + then + dstfile=`basename $dst` + else + true + fi + +# Make a temp file name in the proper directory. + + dsttmp=$dstdir/#inst.$$# + +# Move or copy the file name to the temp name + + $doit $instcmd $src $dsttmp && + + trap "rm -f ${dsttmp}" 0 && + +# and set any options; do chmod last to preserve setuid bits + +# If any of these fail, we abort the whole thing. If we want to +# ignore errors from any of these, just make sure not to ignore +# errors from the above "$doit $instcmd $src $dsttmp" command. + + if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else true;fi && + if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else true;fi && + if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else true;fi && + if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else true;fi && + +# Now rename the file to the real destination. + + $doit $rmcmd -f $dstdir/$dstfile && + $doit $mvcmd $dsttmp $dstdir/$dstfile + +fi && + + +exit 0 diff --git a/package/network/services/ead/src/tinysrp/missing b/package/network/services/ead/src/tinysrp/missing new file mode 100755 index 0000000000..a6abd06980 --- /dev/null +++ b/package/network/services/ead/src/tinysrp/missing @@ -0,0 +1,134 @@ +#! /bin/sh +# Common stub for a few missing GNU programs while installing. +# Copyright (C) 1996, 1997 Free Software Foundation, Inc. +# Franc,ois Pinard , 1996. + +# 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 this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +# 02111-1307, USA. + +if test $# -eq 0; then + echo 1>&2 "Try \`$0 --help' for more information" + exit 1 +fi + +case "$1" in + + -h|--h|--he|--hel|--help) + echo "\ +$0 [OPTION]... PROGRAM [ARGUMENT]... + +Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an +error status if there is no known handling for PROGRAM. + +Options: + -h, --help display this help and exit + -v, --version output version information and exit + +Supported PROGRAM values: + aclocal touch file \`aclocal.m4' + autoconf touch file \`configure' + autoheader touch file \`config.h.in' + automake touch all \`Makefile.in' files + bison touch file \`y.tab.c' + makeinfo touch the output file + yacc touch file \`y.tab.c'" + ;; + + -v|--v|--ve|--ver|--vers|--versi|--versio|--version) + echo "missing - GNU libit 0.0" + ;; + + -*) + echo 1>&2 "$0: Unknown \`$1' option" + echo 1>&2 "Try \`$0 --help' for more information" + exit 1 + ;; + + aclocal) + echo 1>&2 "\ +WARNING: \`$1' is missing on your system. You should only need it if + you modified \`acinclude.m4' or \`configure.in'. You might want + to install the \`Automake' and \`Perl' packages. Grab them from + any GNU archive site." + touch aclocal.m4 + ;; + + autoconf) + echo 1>&2 "\ +WARNING: \`$1' is missing on your system. You should only need it if + you modified \`configure.in'. You might want to install the + \`Autoconf' and \`GNU m4' packages. Grab them from any GNU + archive site." + touch configure + ;; + + autoheader) + echo 1>&2 "\ +WARNING: \`$1' is missing on your system. You should only need it if + you modified \`acconfig.h' or \`configure.in'. You might want + to install the \`Autoconf' and \`GNU m4' packages. Grab them + from any GNU archive site." + touch config.h.in + ;; + + automake) + echo 1>&2 "\ +WARNING: \`$1' is missing on your system. You should only need it if + you modified \`Makefile.am', \`acinclude.m4' or \`configure.in'. + You might want to install the \`Automake' and \`Perl' packages. + Grab them from any GNU archive site." + find . -type f -name Makefile.am -print \ + | sed 's/^\(.*\).am$/touch \1.in/' \ + | sh + ;; + + bison|yacc) + echo 1>&2 "\ +WARNING: \`$1' is missing on your system. You should only need it if + you modified a \`.y' file. You may need the \`Bison' package + in order for those modifications to take effect. You can get + \`Bison' from any GNU archive site." + touch y.tab.c + ;; + + makeinfo) + echo 1>&2 "\ +WARNING: \`$1' is missing on your system. You should only need it if + you modified a \`.texi' or \`.texinfo' file, or any other file + indirectly affecting the aspect of the manual. The spurious + call might also be the consequence of using a buggy \`make' (AIX, + DU, IRIX). You might want to install the \`Texinfo' package or + the \`GNU make' package. Grab either from any GNU archive site." + file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'` + if test -z "$file"; then + file=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'` + file=`sed -n '/^@setfilename/ { s/.* \([^ ]*\) *$/\1/; p; q; }' $file` + fi + touch $file + ;; + + *) + echo 1>&2 "\ +WARNING: \`$1' is needed, and you do not seem to have it handy on your + system. You might have modified some files without having the + proper tools for further handling them. Check the \`README' file, + it often tells you about the needed prerequirements for installing + this package. You may also peek at any GNU archive site, in case + some other package would contain this missing \`$1' program." + exit 1 + ;; +esac + +exit 0 diff --git a/package/network/services/ead/src/tinysrp/mkinstalldirs b/package/network/services/ead/src/tinysrp/mkinstalldirs new file mode 100755 index 0000000000..3bc183603e --- /dev/null +++ b/package/network/services/ead/src/tinysrp/mkinstalldirs @@ -0,0 +1,39 @@ +#! /bin/sh +# mkinstalldirs --- make directory hierarchy +# Author: Noah Friedman +# Created: 1993-05-16 +# Public domain + + +errstatus=0 + +for file +do + set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'` + shift + + pathcomp= + for d + do + pathcomp="$pathcomp$d" + case "$pathcomp" in + -* ) pathcomp=./$pathcomp ;; + esac + + if test ! -d "$pathcomp"; then + echo "mkdir $pathcomp" 1>&2 + + mkdir "$pathcomp" || lasterr=$? + + if test ! -d "$pathcomp"; then + errstatus=$lasterr + fi + fi + + pathcomp="$pathcomp/" + done +done + +exit $errstatus + +# mkinstalldirs ends here diff --git a/package/network/services/ead/src/tinysrp/srvtest.c b/package/network/services/ead/src/tinysrp/srvtest.c new file mode 100644 index 0000000000..e09d501ad3 --- /dev/null +++ b/package/network/services/ead/src/tinysrp/srvtest.c @@ -0,0 +1,111 @@ +/* + * Copyright (c) 1997-1999 The Stanford SRP Authentication Project + * 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" AND WITHOUT WARRANTY OF ANY KIND, + * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY + * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. + * + * IN NO EVENT SHALL STANFORD BE LIABLE FOR ANY SPECIAL, INCIDENTAL, + * INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, OR ANY DAMAGES WHATSOEVER + * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER OR NOT ADVISED OF + * THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF LIABILITY, ARISING OUT + * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + * In addition, the following conditions apply: + * + * 1. Any software that incorporates the SRP authentication technology + * must display the following acknowlegment: + * "This product uses the 'Secure Remote Password' cryptographic + * authentication system developed by Tom Wu (tjw@CS.Stanford.EDU)." + * + * 2. Any software that incorporates all or part of the SRP distribution + * itself must also display the following acknowledgment: + * "This product includes software developed by Tom Wu and Eugene + * Jhong for the SRP Distribution (http://srp.stanford.edu/srp/)." + * + * 3. Redistributions in source or binary form must retain an intact copy + * of this copyright notice and list of conditions. + */ + +#include +#include "t_defines.h" +#include "t_pwd.h" +#include "t_server.h" + +int +main(argc, argv) + int argc; + char * argv[]; +{ + struct t_server * ts; + struct t_pw * tpw; + struct t_conf * tcnf; + struct t_num * B; + char username[MAXUSERLEN]; + char hexbuf[MAXHEXPARAMLEN]; + char buf[MAXPARAMLEN]; + struct t_num A; + unsigned char * skey; + unsigned char cbuf[20]; + FILE * fp; + FILE * fp2; + char confname[256]; + + printf("Enter username: "); + fgets(username, sizeof(username), stdin); + username[strlen(username) - 1] = '\0'; + ts = t_serveropen(username); + + if(ts == NULL) { + fprintf(stderr, "User %s not found\n", username); + exit(1); + } + +#if 0 + printf("n: %s\n", t_tob64(hexbuf, ts->n.data, ts->n.len)); + printf("g: %s\n", t_tob64(hexbuf, ts->g.data, ts->g.len)); +#endif + printf("index (to client): %d\n", ts->index); + printf("salt (to client): %s\n", t_tob64(hexbuf, ts->s.data, ts->s.len)); + + B = t_servergenexp(ts); + printf("Enter A (from client): "); + fgets(hexbuf, sizeof(hexbuf), stdin); + A.data = buf; + A.len = t_fromb64(A.data, hexbuf); + + printf("B (to client): %s\n", t_tob64(hexbuf, B->data, B->len)); + + skey = t_servergetkey(ts, &A); + printf("Session key: %s\n", t_tohex(hexbuf, skey, 40)); + + /* printf("[Expected response: %s]\n", t_tohex(hexbuf, cbuf, 16)); */ + + printf("Enter response (from client): "); + fgets(hexbuf, sizeof(hexbuf), stdin); + hexbuf[strlen(hexbuf) - 1] = '\0'; + t_fromhex(cbuf, hexbuf); + + if(t_serververify(ts, cbuf) == 0) { + printf("Authentication successful.\n"); + printf("Response (to client): %s\n", + t_tohex(hexbuf, t_serverresponse(ts), RESPONSE_LEN)); + } else + printf("Authentication failed.\n"); + + t_serverclose(ts); + + return 0; +} diff --git a/package/network/services/ead/src/tinysrp/stamp-h.in b/package/network/services/ead/src/tinysrp/stamp-h.in new file mode 100644 index 0000000000..9788f70238 --- /dev/null +++ b/package/network/services/ead/src/tinysrp/stamp-h.in @@ -0,0 +1 @@ +timestamp diff --git a/package/network/services/ead/src/tinysrp/t_client.c b/package/network/services/ead/src/tinysrp/t_client.c new file mode 100644 index 0000000000..692215a369 --- /dev/null +++ b/package/network/services/ead/src/tinysrp/t_client.c @@ -0,0 +1,285 @@ +/* + * Copyright (c) 1997-1999 The Stanford SRP Authentication Project + * 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" AND WITHOUT WARRANTY OF ANY KIND, + * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY + * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. + * + * IN NO EVENT SHALL STANFORD BE LIABLE FOR ANY SPECIAL, INCIDENTAL, + * INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, OR ANY DAMAGES WHATSOEVER + * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER OR NOT ADVISED OF + * THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF LIABILITY, ARISING OUT + * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + * In addition, the following conditions apply: + * + * 1. Any software that incorporates the SRP authentication technology + * must display the following acknowlegment: + * "This product uses the 'Secure Remote Password' cryptographic + * authentication system developed by Tom Wu (tjw@CS.Stanford.EDU)." + * + * 2. Any software that incorporates all or part of the SRP distribution + * itself must also display the following acknowledgment: + * "This product includes software developed by Tom Wu and Eugene + * Jhong for the SRP Distribution (http://srp.stanford.edu/srp/)." + * + * 3. Redistributions in source or binary form must retain an intact copy + * of this copyright notice and list of conditions. + */ + +#include +#include "t_defines.h" +#include "t_pwd.h" +#include "t_client.h" +#include "t_sha.h" + +_TYPE( struct t_client * ) +t_clientopen(u, n, g, s) + const char * u; + struct t_num * n; + struct t_num * g; + struct t_num * s; +{ + struct t_client * tc; + unsigned char buf1[SHA_DIGESTSIZE], buf2[SHA_DIGESTSIZE]; + SHA1_CTX ctxt; + int i, validated; + struct t_preconf * tpc; + + validated = 0; + if(n->len < MIN_MOD_BYTES) + return 0; + for(i = 0; i < t_getprecount(); ++i) { + tpc = t_getpreparam(i); + if(tpc->modulus.len == n->len && tpc->generator.len == g->len && + memcmp(tpc->modulus.data, n->data, n->len) == 0 && + memcmp(tpc->generator.data, g->data, g->len) == 0) { + validated = 1; /* Match found, done */ + break; + } + } + + if(validated == 0) + return 0; + + if((tc = malloc(sizeof(struct t_client))) == 0) + return 0; + + strncpy(tc->username, u, MAXUSERLEN); + + SHA1Init(&tc->hash); + + tc->n.len = n->len; + tc->n.data = tc->nbuf; + memcpy(tc->n.data, n->data, tc->n.len); + + SHA1Init(&ctxt); + SHA1Update(&ctxt, tc->n.data, tc->n.len); + SHA1Final(buf1, &ctxt); + + tc->g.len = g->len; + tc->g.data = tc->gbuf; + memcpy(tc->g.data, g->data, tc->g.len); + + SHA1Init(&ctxt); + SHA1Update(&ctxt, tc->g.data, tc->g.len); + SHA1Final(buf2, &ctxt); + + for(i = 0; i < sizeof(buf1); ++i) + buf1[i] ^= buf2[i]; + + SHA1Update(&tc->hash, buf1, sizeof(buf1)); + + SHA1Init(&ctxt); + SHA1Update(&ctxt, tc->username, strlen(tc->username)); + SHA1Final(buf1, &ctxt); + + SHA1Update(&tc->hash, buf1, sizeof(buf1)); + + tc->s.len = s->len; + tc->s.data = tc->sbuf; + memcpy(tc->s.data, s->data, tc->s.len); + + SHA1Update(&tc->hash, tc->s.data, tc->s.len); + + tc->a.data = tc->abuf; + tc->A.data = tc->Abuf; + tc->p.data = tc->pbuf; + tc->v.data = tc->vbuf; + + SHA1Init(&tc->ckhash); + + return tc; +} + +_TYPE( struct t_num * ) +t_clientgenexp(tc) + struct t_client * tc; +{ + BigInteger a, A, n, g; + + if(tc->n.len < ALEN) + tc->a.len = tc->n.len; + else + tc->a.len = ALEN; + + t_random(tc->a.data, tc->a.len); + a = BigIntegerFromBytes(tc->a.data, tc->a.len); + n = BigIntegerFromBytes(tc->n.data, tc->n.len); + g = BigIntegerFromBytes(tc->g.data, tc->g.len); + A = BigIntegerFromInt(0); + BigIntegerModExp(A, g, a, n); + tc->A.len = BigIntegerToBytes(A, tc->A.data); + + BigIntegerFree(A); + BigIntegerFree(a); + BigIntegerFree(g); + BigIntegerFree(n); + + SHA1Update(&tc->hash, tc->A.data, tc->A.len); + SHA1Update(&tc->ckhash, tc->A.data, tc->A.len); + + return &tc->A; +} + +_TYPE( void ) +t_clientpasswd(tc, password) + struct t_client * tc; + char * password; +{ + BigInteger n, g, p, v; + SHA1_CTX ctxt; + unsigned char dig[SHA_DIGESTSIZE]; + + n = BigIntegerFromBytes(tc->n.data, tc->n.len); + g = BigIntegerFromBytes(tc->g.data, tc->g.len); + + SHA1Init(&ctxt); + SHA1Update(&ctxt, tc->username, strlen(tc->username)); + SHA1Update(&ctxt, ":", 1); + SHA1Update(&ctxt, password, strlen(password)); + SHA1Final(dig, &ctxt); + + SHA1Init(&ctxt); + SHA1Update(&ctxt, tc->s.data, tc->s.len); + SHA1Update(&ctxt, dig, sizeof(dig)); + SHA1Final(dig, &ctxt); + + p = BigIntegerFromBytes(dig, sizeof(dig)); + + v = BigIntegerFromInt(0); + BigIntegerModExp(v, g, p, n); + + tc->p.len = BigIntegerToBytes(p, tc->p.data); + BigIntegerFree(p); + + tc->v.len = BigIntegerToBytes(v, tc->v.data); + BigIntegerFree(v); +} + +_TYPE( unsigned char * ) +t_clientgetkey(tc, serverval) + struct t_client * tc; + struct t_num * serverval; +{ + BigInteger n, B, v, p, a, sum, S; + unsigned char sbuf[MAXPARAMLEN]; + unsigned char dig[SHA_DIGESTSIZE]; + unsigned slen; + unsigned int u; + SHA1_CTX ctxt; + + SHA1Init(&ctxt); + SHA1Update(&ctxt, serverval->data, serverval->len); + SHA1Final(dig, &ctxt); + u = (dig[0] << 24) | (dig[1] << 16) | (dig[2] << 8) | dig[3]; + if(u == 0) + return NULL; + + SHA1Update(&tc->hash, serverval->data, serverval->len); + + B = BigIntegerFromBytes(serverval->data, serverval->len); + n = BigIntegerFromBytes(tc->n.data, tc->n.len); + + if(BigIntegerCmp(B, n) >= 0 || BigIntegerCmpInt(B, 0) == 0) { + BigIntegerFree(B); + BigIntegerFree(n); + return NULL; + } + v = BigIntegerFromBytes(tc->v.data, tc->v.len); + if(BigIntegerCmp(B, v) < 0) + BigIntegerAdd(B, B, n); + BigIntegerSub(B, B, v); + BigIntegerFree(v); + + a = BigIntegerFromBytes(tc->a.data, tc->a.len); + p = BigIntegerFromBytes(tc->p.data, tc->p.len); + + sum = BigIntegerFromInt(0); + BigIntegerMulInt(sum, p, u); + BigIntegerAdd(sum, sum, a); + + BigIntegerFree(p); + BigIntegerFree(a); + + S = BigIntegerFromInt(0); + BigIntegerModExp(S, B, sum, n); + slen = BigIntegerToBytes(S, sbuf); + + BigIntegerFree(S); + BigIntegerFree(sum); + BigIntegerFree(B); + BigIntegerFree(n); + + t_sessionkey(tc->session_key, sbuf, slen); + memset(sbuf, 0, slen); + + SHA1Update(&tc->hash, tc->session_key, sizeof(tc->session_key)); + + SHA1Final(tc->session_response, &tc->hash); + SHA1Update(&tc->ckhash, tc->session_response, sizeof(tc->session_response)); + SHA1Update(&tc->ckhash, tc->session_key, sizeof(tc->session_key)); + + return tc->session_key; +} + +_TYPE( int ) +t_clientverify(tc, resp) + struct t_client * tc; + unsigned char * resp; +{ + unsigned char expected[SHA_DIGESTSIZE]; + + SHA1Final(expected, &tc->ckhash); + return memcmp(expected, resp, sizeof(expected)); +} + +_TYPE( unsigned char * ) +t_clientresponse(tc) + struct t_client * tc; +{ + return tc->session_response; +} + +_TYPE( void ) +t_clientclose(tc) + struct t_client * tc; +{ + memset(tc->abuf, 0, sizeof(tc->abuf)); + memset(tc->pbuf, 0, sizeof(tc->pbuf)); + memset(tc->vbuf, 0, sizeof(tc->vbuf)); + memset(tc->session_key, 0, sizeof(tc->session_key)); + free(tc); +} diff --git a/package/network/services/ead/src/tinysrp/t_client.h b/package/network/services/ead/src/tinysrp/t_client.h new file mode 100644 index 0000000000..42922aff1b --- /dev/null +++ b/package/network/services/ead/src/tinysrp/t_client.h @@ -0,0 +1,148 @@ +/* + * Copyright (c) 1997-1999 The Stanford SRP Authentication Project + * 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" AND WITHOUT WARRANTY OF ANY KIND, + * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY + * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. + * + * IN NO EVENT SHALL STANFORD BE LIABLE FOR ANY SPECIAL, INCIDENTAL, + * INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, OR ANY DAMAGES WHATSOEVER + * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER OR NOT ADVISED OF + * THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF LIABILITY, ARISING OUT + * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + * In addition, the following conditions apply: + * + * 1. Any software that incorporates the SRP authentication technology + * must display the following acknowlegment: + * "This product uses the 'Secure Remote Password' cryptographic + * authentication system developed by Tom Wu (tjw@CS.Stanford.EDU)." + * + * 2. Any software that incorporates all or part of the SRP distribution + * itself must also display the following acknowledgment: + * "This product includes software developed by Tom Wu and Eugene + * Jhong for the SRP Distribution (http://srp.stanford.edu/srp/)." + * + * 3. Redistributions in source or binary form must retain an intact copy + * of this copyright notice and list of conditions. + */ + +#ifndef T_CLIENT_H +#define T_CLIENT_H + +#include "t_sha.h" + +#if !defined(P) +#ifdef __STDC__ +#define P(x) x +#else +#define P(x) () +#endif +#endif + +/* For building dynamic link libraries under windows, windows NT + * using MSVC1.5 or MSVC2.0 + */ + +#ifndef _DLLDECL +#define _DLLDECL + +#ifdef MSVC15 /* MSVC1.5 support for 16 bit apps */ +#define _MSVC15EXPORT _export +#define _MSVC20EXPORT +#define _DLLAPI _export _pascal +#define _TYPE(a) a _MSVC15EXPORT +#define DLLEXPORT 1 + +#elif MSVC20 +#define _MSVC15EXPORT +#define _MSVC20EXPORT _declspec(dllexport) +#define _DLLAPI +#define _TYPE(a) _MSVC20EXPORT a +#define DLLEXPORT 1 + +#else /* Default, non-dll. Use this for Unix or DOS */ +#define _MSVC15DEXPORT +#define _MSVC20EXPORT +#define _DLLAPI +#define _TYPE(a) a +#endif +#endif + +#define ALEN 32 +#define MIN_MOD_BYTES 64 /* 512 bits */ + +struct t_client { + struct t_num n; + struct t_num g; + struct t_num s; + + struct t_num a; + struct t_num A; + + struct t_num p; + struct t_num v; + + SHA1_CTX hash, ckhash; + + char username[MAXUSERLEN]; + unsigned char session_key[SESSION_KEY_LEN]; + unsigned char session_response[RESPONSE_LEN]; + + unsigned char nbuf[MAXPARAMLEN], gbuf[MAXPARAMLEN], sbuf[MAXSALTLEN]; + unsigned char pbuf[MAXPARAMLEN], vbuf[MAXPARAMLEN]; + unsigned char abuf[ALEN], Abuf[MAXPARAMLEN]; +}; + +/* + * SRP client-side negotiation + * + * This code negotiates the client side of an SRP exchange. + * "t_clientopen" accepts a username, and N, g, and s parameters, + * which are usually sent by the server in the first round. + * The client should then call... + * "t_clientgenexp" will generate a random 256-bit exponent and + * raise g to that power, returning the result. This result + * should be sent to the server as w(p). + * "t_clientpasswd" accepts the user's password, which should be + * entered locally and updates the client's state. + * "t_clientgetkey" accepts the exponential y(p), which should + * be sent by the server in the next round and computes the + * 256-bit session key. This data should be saved before the + * session is closed. + * "t_clientresponse" computes the session key proof as SHA(y(p), K). + * "t_clientclose" closes the session and frees its memory. + * + * Note that authentication is not performed per se; it is up + * to either/both sides of the protocol to now verify securely + * that their session keys agree in order to establish authenticity. + * One possible way is through "oracle hashing"; one side sends + * r, the other replies with H(r,K), where H() is a hash function. + * + * t_clientresponse and t_clientverify now implement a version of + * the session-key verification described above. + */ +_TYPE( struct t_client * ) + t_clientopen P((const char *, struct t_num *, struct t_num *, + struct t_num *)); +_TYPE( struct t_num * ) t_clientgenexp P((struct t_client *)); +_TYPE( void ) t_clientpasswd P((struct t_client *, char *)); +_TYPE( unsigned char * ) + t_clientgetkey P((struct t_client *, struct t_num *)); +_TYPE( int ) t_clientverify P((struct t_client *, unsigned char *)); +_TYPE( unsigned char * ) t_clientresponse P((struct t_client *)); +_TYPE( void ) t_clientclose P((struct t_client *)); + +#endif diff --git a/package/network/services/ead/src/tinysrp/t_conf.c b/package/network/services/ead/src/tinysrp/t_conf.c new file mode 100644 index 0000000000..fbe6f410e2 --- /dev/null +++ b/package/network/services/ead/src/tinysrp/t_conf.c @@ -0,0 +1,1080 @@ +/* + * Copyright (c) 1997-1999 The Stanford SRP Authentication Project + * 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" AND WITHOUT WARRANTY OF ANY KIND, + * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY + * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. + * + * IN NO EVENT SHALL STANFORD BE LIABLE FOR ANY SPECIAL, INCIDENTAL, + * INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, OR ANY DAMAGES WHATSOEVER + * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER OR NOT ADVISED OF + * THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF LIABILITY, ARISING OUT + * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + * In addition, the following conditions apply: + * + * 1. Any software that incorporates the SRP authentication technology + * must display the following acknowlegment: + * "This product uses the 'Secure Remote Password' cryptographic + * authentication system developed by Tom Wu (tjw@CS.Stanford.EDU)." + * + * 2. Any software that incorporates all or part of the SRP distribution + * itself must also display the following acknowledgment: + * "This product includes software developed by Tom Wu and Eugene + * Jhong for the SRP Distribution (http://srp.stanford.edu/srp/)." + * + * 3. Redistributions in source or binary form must retain an intact copy + * of this copyright notice and list of conditions. + */ + +#include + +#include "t_defines.h" +#include "t_pwd.h" +#include "t_read.h" +#include "bn.h" +#include "bn_lcl.h" +#include "bn_prime.h" + +#define TABLE_SIZE 32 + +static int witness(BIGNUM *w, const BIGNUM *a, const BIGNUM *a1, + const BIGNUM *a1_odd, int k, BN_CTX *ctx, BN_MONT_CTX *mont); + +/* + * This is the safe prime generation logic. + * To generate a safe prime p (where p = 2q+1 and q is prime), we start + * with a random odd q that is one bit shorter than the desired length + * of p. We use a simple 30-element sieve to filter the values of q + * and consider only those that are 11, 23, or 29 (mod 30). (If q were + * anything else, either q or p would be divisible by 2, 3, or 5). + * For the values of q that are left, we apply the following tests in + * this order: + * + * trial divide q + * let p = 2q + 1 + * trial divide p + * apply Fermat test to q (2^q == 2 (mod q)) + * apply Fermat test to p (2^p == 2 (mod p)) + * apply real probablistic primality test to q + * apply real probablistic primality test to p + * + * A number that passes all these tests is considered a safe prime for + * our purposes. The tests are ordered this way for efficiency; the + * slower tests are run rarely if ever at all. + */ + +static int +trialdiv(x) + const BigInteger x; +{ + static int primes[] = { /* All odd primes < 256 */ + 3, 5, 7, 11, 13, 17, 19, 23, 29, + 31, 37, 41, 43, 47, 53, 59, 61, 67, + 71, 73, 79, 83, 89, 97, 101, 103, + 107, 109, 113, 127, 131, 137, 139, 149, 151, + 157, 163, 167, 173, 179, 181, 191, 193, 197, + 199, 211, 223, 227, 229, 233, 239, 241, 251 + }; + static int nprimes = sizeof(primes) / sizeof(int); + int i; + + for(i = 0; i < nprimes; ++i) { + if(BigIntegerModInt(x, primes[i]) == 0) + return primes[i]; + } + return 1; +} + +/* x + sieve30[x%30] == 11, 23, or 29 (mod 30) */ + +static int sieve30[] = +{ 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, + 1, 12, 11, 10, 9, 8, 7, 6, 5, 4, + 3, 2, 1, 6, 5, 4, 3, 2, 1, 12 +}; + +/* Find a Sophie-Germain prime between "lo" and "hi". NOTE: this is not + a "safe prime", but the smaller prime. Take 2q+1 to get the safe prime. */ + +static void +sophie_germain(q, lo, hi) + BigInteger q; /* assumed initialized */ + const BigInteger lo; + const BigInteger hi; +{ + BigInteger m, p, r; + char parambuf[MAXPARAMLEN]; + int foundprime = 0; + int i, mod30; + + m = BigIntegerFromInt(0); + BigIntegerSub(m, hi, lo); + i = (BigIntegerBitLen(m) + 7) / 8; + t_random(parambuf, i); + r = BigIntegerFromBytes(parambuf, i); + BigIntegerMod(r, r, m); + + BigIntegerAdd(q, r, lo); + if(BigIntegerModInt(q, 2) == 0) + BigIntegerAddInt(q, q, 1); /* make q odd */ + + mod30 = BigIntegerModInt(q, 30); /* mod30 = q % 30 */ + + BigIntegerFree(m); + m = BigIntegerFromInt(2); /* m = 2 */ + p = BigIntegerFromInt(0); + + while(BigIntegerCmp(q, hi) < 0) { + if(trialdiv(q) < 2) { + BigIntegerMulInt(p, q, 2); /* p = 2 * q */ + BigIntegerAddInt(p, p, 1); /* p += 1 */ + if(trialdiv(p) < 2) { + BigIntegerModExp(r, m, q, q); /* r = 2^q % q */ + if(BigIntegerCmpInt(r, 2) == 0) { /* if(r == 2) */ + BigIntegerModExp(r, m, p, p); /* r = 2^p % p */ + if(BigIntegerCmpInt(r, 2) == 0) { /* if(r == 2) */ + if(BigIntegerCheckPrime(q) && BigIntegerCheckPrime(p)) { + ++foundprime; + break; + } + } + } + } + } + + i = sieve30[mod30]; + BigIntegerAddInt(q, q, i); /* q += i */ + mod30 = (mod30 + i) % 30; + } + + /* should wrap around on failure */ + if(!foundprime) { + fprintf(stderr, "Prime generation failed!\n"); + exit(1); + } + + BigIntegerFree(r); + BigIntegerFree(m); + BigIntegerFree(p); +} + +_TYPE( struct t_confent * ) +t_makeconfent(tc, nsize) + struct t_conf * tc; + int nsize; +{ + BigInteger n, g, q, t, u; + + t = BigIntegerFromInt(0); + u = BigIntegerFromInt(1); /* u = 1 */ + BigIntegerLShift(t, u, nsize - 2); /* t = 2^(nsize-2) */ + BigIntegerMulInt(u, t, 2); /* u = 2^(nsize-1) */ + + q = BigIntegerFromInt(0); + sophie_germain(q, t, u); + + n = BigIntegerFromInt(0); + BigIntegerMulInt(n, q, 2); + BigIntegerAddInt(n, n, 1); + + /* Look for a generator mod n */ + g = BigIntegerFromInt(2); + while(1) { + BigIntegerModExp(t, g, q, n); /* t = g^q % n */ + if(BigIntegerCmpInt(t, 1) == 0) /* if(t == 1) */ + BigIntegerAddInt(g, g, 1); /* ++g */ + else + break; + } + BigIntegerFree(t); + BigIntegerFree(u); + BigIntegerFree(q); + + tc->tcbuf.modulus.data = tc->modbuf; + tc->tcbuf.modulus.len = BigIntegerToBytes(n, tc->tcbuf.modulus.data); + BigIntegerFree(n); + + tc->tcbuf.generator.data = tc->genbuf; + tc->tcbuf.generator.len = BigIntegerToBytes(g, tc->tcbuf.generator.data); + BigIntegerFree(g); + + tc->tcbuf.index = 1; + return &tc->tcbuf; +} + +_TYPE( struct t_confent * ) +t_makeconfent_c(tc, nsize) + struct t_conf * tc; + int nsize; +{ + BigInteger g, n, p, q, j, k, t, u; + int psize, qsize; + + psize = nsize / 2; + qsize = nsize - psize; + + t = BigIntegerFromInt(1); /* t = 1 */ + u = BigIntegerFromInt(0); + BigIntegerLShift(u, t, psize - 3); /* u = t*2^(psize-3) = 2^(psize-3) */ + BigIntegerMulInt(t, u, 3); /* t = 3*u = 1.5*2^(psize-2) */ + BigIntegerAdd(u, u, t); /* u += t [u = 2^(psize-1)] */ + j = BigIntegerFromInt(0); + sophie_germain(j, t, u); + + k = BigIntegerFromInt(0); + if(qsize != psize) { + BigIntegerFree(t); + t = BigIntegerFromInt(1); /* t = 1 */ + BigIntegerLShift(u, t, qsize - 3); /* u = t*2^(qsize-3) = 2^(qsize-3) */ + BigIntegerMulInt(t, u, 3); /* t = 3*u = 1.5*2^(qsize-2) */ + BigIntegerAdd(u, u, t); /* u += t [u = 2^(qsize-1)] */ + } + sophie_germain(k, t, u); + + p = BigIntegerFromInt(0); + BigIntegerMulInt(p, j, 2); /* p = 2 * j */ + BigIntegerAddInt(p, p, 1); /* p += 1 */ + + q = BigIntegerFromInt(0); + BigIntegerMulInt(q, k, 2); /* q = 2 * k */ + BigIntegerAddInt(q, q, 1); /* q += 1 */ + + n = BigIntegerFromInt(0); + BigIntegerMul(n, p, q); /* n = p * q */ + BigIntegerMul(u, j, k); /* u = j * k */ + + BigIntegerFree(p); + BigIntegerFree(q); + BigIntegerFree(j); + BigIntegerFree(k); + + g = BigIntegerFromInt(2); /* g = 2 */ + + /* Look for a generator mod n */ + while(1) { + BigIntegerModExp(t, g, u, n); /* t = g^u % n */ + if(BigIntegerCmpInt(t, 1) == 0) + BigIntegerAddInt(g, g, 1); /* ++g */ + else + break; + } + + BigIntegerFree(u); + BigIntegerFree(t); + + tc->tcbuf.modulus.data = tc->modbuf; + tc->tcbuf.modulus.len = BigIntegerToBytes(n, tc->tcbuf.modulus.data); + BigIntegerFree(n); + + tc->tcbuf.generator.data = tc->genbuf; + tc->tcbuf.generator.len = BigIntegerToBytes(g, tc->tcbuf.generator.data); + BigIntegerFree(g); + + tc->tcbuf.index = 1; + return &tc->tcbuf; +} + +_TYPE( struct t_confent * ) +t_newconfent(tc) + struct t_conf * tc; +{ + tc->tcbuf.index = 0; + tc->tcbuf.modulus.data = tc->modbuf; + tc->tcbuf.modulus.len = 0; + tc->tcbuf.generator.data = tc->genbuf; + tc->tcbuf.generator.len = 0; + return &tc->tcbuf; +} + +_TYPE( void ) +t_putconfent(ent, fp) + const struct t_confent * ent; + FILE * fp; +{ + char strbuf[MAXB64PARAMLEN]; + + fprintf(fp, "%d:%s:", ent->index, + t_tob64(strbuf, ent->modulus.data, ent->modulus.len)); + fprintf(fp, "%s\n", + t_tob64(strbuf, ent->generator.data, ent->generator.len)); +} + +int +BigIntegerBitLen(b) + BigInteger b; +{ + return BN_num_bits(b); +} + +int +BigIntegerCheckPrime(n) + BigInteger n; +{ + BN_CTX * ctx = BN_CTX_new(); + int rv = BN_is_prime(n, 25, NULL, ctx, NULL); + BN_CTX_free(ctx); + return rv; +} + +unsigned int +BigIntegerModInt(d, m) + BigInteger d; + unsigned int m; +{ + return BN_mod_word(d, m); +} + +void +BigIntegerMod(result, d, m) + BigInteger result, d, m; +{ + BN_CTX * ctx = BN_CTX_new(); + BN_mod(result, d, m, ctx); + BN_CTX_free(ctx); +} + +void +BigIntegerMul(result, m1, m2) + BigInteger result, m1, m2; +{ + BN_CTX * ctx = BN_CTX_new(); + BN_mul(result, m1, m2, ctx); + BN_CTX_free(ctx); +} + +void +BigIntegerLShift(result, x, bits) + BigInteger result, x; + unsigned int bits; +{ + BN_lshift(result, x, bits); +} + +int BN_is_prime(const BIGNUM *a, int checks, void (*callback)(int,int,void *), + BN_CTX *ctx_passed, void *cb_arg) + { + return BN_is_prime_fasttest(a, checks, callback, ctx_passed, cb_arg, 0); + } + +int BN_is_prime_fasttest(const BIGNUM *a, int checks, + void (*callback)(int,int,void *), + BN_CTX *ctx_passed, void *cb_arg, + int do_trial_division) + { + int i, j, ret = -1; + int k; + BN_CTX *ctx = NULL; + BIGNUM *A1, *A1_odd, *check; /* taken from ctx */ + BN_MONT_CTX *mont = NULL; + const BIGNUM *A = NULL; + + if (checks == BN_prime_checks) + checks = BN_prime_checks_for_size(BN_num_bits(a)); + + /* first look for small factors */ + if (!BN_is_odd(a)) + return(0); + if (do_trial_division) + { + for (i = 1; i < NUMPRIMES; i++) + if (BN_mod_word(a, primes[i]) == 0) + return 0; + if (callback != NULL) callback(1, -1, cb_arg); + } + + if (ctx_passed != NULL) + ctx = ctx_passed; + else + if ((ctx=BN_CTX_new()) == NULL) + goto err; + BN_CTX_start(ctx); + + /* A := abs(a) */ + if (a->neg) + { + BIGNUM *t; + if ((t = BN_CTX_get(ctx)) == NULL) goto err; + BN_copy(t, a); + t->neg = 0; + A = t; + } + else + A = a; + A1 = BN_CTX_get(ctx); + A1_odd = BN_CTX_get(ctx); + check = BN_CTX_get(ctx); + if (check == NULL) goto err; + + /* compute A1 := A - 1 */ + if (!BN_copy(A1, A)) + goto err; + if (!BN_sub_word(A1, 1)) + goto err; + if (BN_is_zero(A1)) + { + ret = 0; + goto err; + } + + /* write A1 as A1_odd * 2^k */ + k = 1; + while (!BN_is_bit_set(A1, k)) + k++; + if (!BN_rshift(A1_odd, A1, k)) + goto err; + + /* Montgomery setup for computations mod A */ + mont = BN_MONT_CTX_new(); + if (mont == NULL) + goto err; + if (!BN_MONT_CTX_set(mont, A, ctx)) + goto err; + + for (i = 0; i < checks; i++) + { + if (!BN_pseudo_rand(check, BN_num_bits(A1), 0, 0)) + goto err; + if (BN_cmp(check, A1) >= 0) + if (!BN_sub(check, check, A1)) + goto err; + if (!BN_add_word(check, 1)) + goto err; + /* now 1 <= check < A */ + + j = witness(check, A, A1, A1_odd, k, ctx, mont); + if (j == -1) goto err; + if (j) + { + ret=0; + goto err; + } + if (callback != NULL) callback(1,i,cb_arg); + } + ret=1; +err: + if (ctx != NULL) + { + BN_CTX_end(ctx); + if (ctx_passed == NULL) + BN_CTX_free(ctx); + } + if (mont != NULL) + BN_MONT_CTX_free(mont); + + return(ret); + } + +static int witness(BIGNUM *w, const BIGNUM *a, const BIGNUM *a1, + const BIGNUM *a1_odd, int k, BN_CTX *ctx, BN_MONT_CTX *mont) + { + if (!BN_mod_exp_mont(w, w, a1_odd, a, ctx, mont)) /* w := w^a1_odd mod a */ + return -1; + if (BN_is_one(w)) + return 0; /* probably prime */ + if (BN_cmp(w, a1) == 0) + return 0; /* w == -1 (mod a), 'a' is probably prime */ + while (--k) + { + if (!BN_mod_mul(w, w, w, a, ctx)) /* w := w^2 mod a */ + return -1; + if (BN_is_one(w)) + return 1; /* 'a' is composite, otherwise a previous 'w' would + * have been == -1 (mod 'a') */ + if (BN_cmp(w, a1) == 0) + return 0; /* w == -1 (mod a), 'a' is probably prime */ + } + /* If we get here, 'w' is the (a-1)/2-th power of the original 'w', + * and it is neither -1 nor +1 -- so 'a' cannot be prime */ + return 1; + } + +int BN_mod_exp_mont(BIGNUM *rr, BIGNUM *a, const BIGNUM *p, + const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *in_mont) + { + int i,j,bits,ret=0,wstart,wend,window,wvalue; + int start=1,ts=0; + BIGNUM *d,*r; + BIGNUM *aa; + BIGNUM val[TABLE_SIZE]; + BN_MONT_CTX *mont=NULL; + + bn_check_top(a); + bn_check_top(p); + bn_check_top(m); + + if (!(m->d[0] & 1)) + { + return(0); + } + bits=BN_num_bits(p); + if (bits == 0) + { + BN_one(rr); + return(1); + } + BN_CTX_start(ctx); + d = BN_CTX_get(ctx); + r = BN_CTX_get(ctx); + if (d == NULL || r == NULL) goto err; + + /* If this is not done, things will break in the montgomery + * part */ + + if (in_mont != NULL) + mont=in_mont; + else + { + if ((mont=BN_MONT_CTX_new()) == NULL) goto err; + if (!BN_MONT_CTX_set(mont,m,ctx)) goto err; + } + + BN_init(&val[0]); + ts=1; + if (BN_ucmp(a,m) >= 0) + { + if (!BN_mod(&(val[0]),a,m,ctx)) + goto err; + aa= &(val[0]); + } + else + aa=a; + if (!BN_to_montgomery(&(val[0]),aa,mont,ctx)) goto err; /* 1 */ + + window = BN_window_bits_for_exponent_size(bits); + if (window > 1) + { + if (!BN_mod_mul_montgomery(d,&(val[0]),&(val[0]),mont,ctx)) goto err; /* 2 */ + j=1<<(window-1); + for (i=1; i>1]),mont,ctx)) + goto err; + + /* move the 'window' down further */ + wstart-=wend+1; + wvalue=0; + start=0; + if (wstart < 0) break; + } + if (!BN_from_montgomery(rr,r,mont,ctx)) goto err; + ret=1; +err: + if ((in_mont == NULL) && (mont != NULL)) BN_MONT_CTX_free(mont); + BN_CTX_end(ctx); + for (i=0; itop-1; i>=0; i--) + { +#ifndef BN_LLONG + ret=((ret<d[i]>>BN_BITS4)&BN_MASK2l))%w; + ret=((ret<d[i]&BN_MASK2l))%w; +#else + ret=(BN_ULLONG)(((ret<<(BN_ULLONG)BN_BITS2)|a->d[i])% + (BN_ULLONG)w); +#endif + } + return((BN_ULONG)ret); + } + +static int bnrand(int pseudorand, BIGNUM *rnd, int bits, int top, int bottom) + { + unsigned char *buf=NULL; + int ret=0,bit,bytes,mask; + + if (bits == 0) + { + BN_zero(rnd); + return 1; + } + + bytes=(bits+7)/8; + bit=(bits-1)%8; + mask=0xff<N); + + ap=a->d; + /* mont->ri is the size of mont->N in bits (rounded up + to the word size) */ + al=ri=mont->ri/BN_BITS2; + + nl=n->top; + if ((al == 0) || (nl == 0)) { r->top=0; return(1); } + + max=(nl+al+1); /* allow for overflow (no?) XXX */ + if (bn_wexpand(r,max) == NULL) goto err; + if (bn_wexpand(ret,max) == NULL) goto err; + + r->neg=a->neg^n->neg; + np=n->d; + rp=r->d; + nrp= &(r->d[nl]); + + /* clear the top words of T */ +#if 1 + for (i=r->top; id[i]=0; +#else + memset(&(r->d[r->top]),0,(max-r->top)*sizeof(BN_ULONG)); +#endif + + r->top=max; + n0=mont->n0; + +#ifdef BN_COUNT + printf("word BN_from_montgomery %d * %d\n",nl,nl); +#endif + for (i=0; i= v) + continue; + else + { + if (((++nrp[0])&BN_MASK2) != 0) continue; + if (((++nrp[1])&BN_MASK2) != 0) continue; + for (x=2; (((++nrp[x])&BN_MASK2) == 0); x++) ; + } + } + bn_fix_top(r); + + /* mont->ri will be a multiple of the word size */ +#if 0 + BN_rshift(ret,r,mont->ri); +#else + ret->neg = r->neg; + x=ri; + rp=ret->d; + ap= &(r->d[x]); + if (r->top < x) + al=0; + else + al=r->top-x; + ret->top=al; + al-=4; + for (i=0; iri); + + if (!BN_mul(t2,t1,&mont->Ni,ctx)) goto err; + BN_mask_bits(t2,mont->ri); + + if (!BN_mul(t1,t2,&mont->N,ctx)) goto err; + if (!BN_add(t2,a,t1)) goto err; + BN_rshift(ret,t2,mont->ri); +#endif /* MONT_WORD */ + + if (BN_ucmp(ret, &(mont->N)) >= 0) + { + BN_usub(ret,ret,&(mont->N)); + } + retn=1; + err: + BN_CTX_end(ctx); + return(retn); + } + +void BN_MONT_CTX_init(BN_MONT_CTX *ctx) + { + ctx->ri=0; + BN_init(&(ctx->RR)); + BN_init(&(ctx->N)); + BN_init(&(ctx->Ni)); + ctx->flags=0; + } + +BN_MONT_CTX *BN_MONT_CTX_new(void) + { + BN_MONT_CTX *ret; + + if ((ret=(BN_MONT_CTX *)malloc(sizeof(BN_MONT_CTX))) == NULL) + return(NULL); + + BN_MONT_CTX_init(ret); + ret->flags=BN_FLG_MALLOCED; + return(ret); + } + +void BN_MONT_CTX_free(BN_MONT_CTX *mont) + { + if(mont == NULL) + return; + + BN_free(&(mont->RR)); + BN_free(&(mont->N)); + BN_free(&(mont->Ni)); + if (mont->flags & BN_FLG_MALLOCED) + free(mont); + } + +int BN_MONT_CTX_set(BN_MONT_CTX *mont, const BIGNUM *mod, BN_CTX *ctx) + { + BIGNUM Ri,*R; + + BN_init(&Ri); + R= &(mont->RR); /* grab RR as a temp */ + BN_copy(&(mont->N),mod); /* Set N */ + +#ifdef MONT_WORD + { + BIGNUM tmod; + BN_ULONG buf[2]; + + mont->ri=(BN_num_bits(mod)+(BN_BITS2-1))/BN_BITS2*BN_BITS2; + BN_zero(R); + BN_set_bit(R,BN_BITS2); /* R */ + + buf[0]=mod->d[0]; /* tmod = N mod word size */ + buf[1]=0; + tmod.d=buf; + tmod.top=1; + tmod.dmax=2; + tmod.neg=mod->neg; + /* Ri = R^-1 mod N*/ + if ((BN_mod_inverse(&Ri,R,&tmod,ctx)) == NULL) + goto err; + BN_lshift(&Ri,&Ri,BN_BITS2); /* R*Ri */ + if (!BN_is_zero(&Ri)) + BN_sub_word(&Ri,1); + else /* if N mod word size == 1 */ + BN_set_word(&Ri,BN_MASK2); /* Ri-- (mod word size) */ + BN_div(&Ri,NULL,&Ri,&tmod,ctx); /* Ni = (R*Ri-1)/N, + * keep only least significant word: */ + mont->n0=Ri.d[0]; + BN_free(&Ri); + } +#else /* !MONT_WORD */ + { /* bignum version */ + mont->ri=BN_num_bits(mod); + BN_zero(R); + BN_set_bit(R,mont->ri); /* R = 2^ri */ + /* Ri = R^-1 mod N*/ + if ((BN_mod_inverse(&Ri,R,mod,ctx)) == NULL) + goto err; + BN_lshift(&Ri,&Ri,mont->ri); /* R*Ri */ + BN_sub_word(&Ri,1); + /* Ni = (R*Ri-1) / N */ + BN_div(&(mont->Ni),NULL,&Ri,mod,ctx); + BN_free(&Ri); + } +#endif + + /* setup RR for conversions */ + BN_zero(&(mont->RR)); + BN_set_bit(&(mont->RR),mont->ri*2); + BN_mod(&(mont->RR),&(mont->RR),&(mont->N),ctx); + + return(1); +err: + return(0); + } + +BIGNUM *BN_value_one(void) + { + static BN_ULONG data_one=1L; + static BIGNUM const_one={&data_one,1,1,0}; + + return(&const_one); + } + +/* solves ax == 1 (mod n) */ +BIGNUM *BN_mod_inverse(BIGNUM *in, BIGNUM *a, const BIGNUM *n, BN_CTX *ctx) + { + BIGNUM *A,*B,*X,*Y,*M,*D,*R=NULL; + BIGNUM *T,*ret=NULL; + int sign; + + bn_check_top(a); + bn_check_top(n); + + BN_CTX_start(ctx); + A = BN_CTX_get(ctx); + B = BN_CTX_get(ctx); + X = BN_CTX_get(ctx); + D = BN_CTX_get(ctx); + M = BN_CTX_get(ctx); + Y = BN_CTX_get(ctx); + if (Y == NULL) goto err; + + if (in == NULL) + R=BN_new(); + else + R=in; + if (R == NULL) goto err; + + BN_zero(X); + BN_one(Y); + if (BN_copy(A,a) == NULL) goto err; + if (BN_copy(B,n) == NULL) goto err; + sign=1; + + while (!BN_is_zero(B)) + { + if (!BN_div(D,M,A,B,ctx)) goto err; + T=A; + A=B; + B=M; + /* T has a struct, M does not */ + + if (!BN_mul(T,D,X,ctx)) goto err; + if (!BN_add(T,T,Y)) goto err; + M=Y; + Y=X; + X=T; + sign= -sign; + } + if (sign < 0) + { + if (!BN_sub(Y,n,Y)) goto err; + } + + if (BN_is_one(A)) + { if (!BN_mod(R,Y,n,ctx)) goto err; } + else + { + goto err; + } + ret=R; +err: + if ((ret == NULL) && (in == NULL)) BN_free(R); + BN_CTX_end(ctx); + return(ret); + } + +int BN_set_bit(BIGNUM *a, int n) + { + int i,j,k; + + i=n/BN_BITS2; + j=n%BN_BITS2; + if (a->top <= i) + { + if (bn_wexpand(a,i+1) == NULL) return(0); + for(k=a->top; kd[k]=0; + a->top=i+1; + } + + a->d[i]|=(((BN_ULONG)1)< +#include "t_defines.h" + +static int +hexDigitToInt(c) + char c; +{ + if(c >= '0' && c <= '9') + return c - '0'; + else if(c >= 'a' && c <= 'f') + return c - 'a' + 10; + else if(c >= 'A' && c <= 'F') + return c - 'A' + 10; + else + return 0; +} + +/* + * Convert a hex string to a string of bytes; return size of dst + */ +_TYPE( int ) +t_fromhex(dst, src) + register char *dst, *src; +{ + register char *chp = dst; + register unsigned size = strlen(src); + + /* FIXME: handle whitespace and non-hex digits by setting size and src + appropriately. */ + + if(size % 2 == 1) { + *chp++ = hexDigitToInt(*src++); + --size; + } + while(size > 0) { + *chp++ = (hexDigitToInt(*src) << 4) | hexDigitToInt(*(src + 1)); + src += 2; + size -= 2; + } + return chp - dst; +} + +/* + * Convert a string of bytes to their hex representation + */ +_TYPE( char * ) +t_tohex(dst, src, size) + register char *dst, *src; + register unsigned size; +{ + int notleading = 0; + + register char *chp = dst; + if (size != 0) do { + if(notleading || *src != '\0') { + notleading = 1; + sprintf(chp, "%.2x", * (unsigned char *) src); + chp += 2; + } + ++src; + } while (--size != 0); + return dst; +} + +static char b64table[] = + "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz./"; + +/* + * Convert a base64 string into raw byte array representation. + */ +_TYPE( int ) +t_fromb64(dst, src) + register char *dst, *src; +{ + unsigned char *a; + char *loc; + int i, j; + unsigned int size; + + while(*src && (*src == ' ' || *src == '\t' || *src == '\n')) + ++src; + size = strlen(src); + + a = malloc((size + 1) * sizeof(unsigned char)); + if(a == (unsigned char *) 0) + return -1; + + i = 0; + while(i < size) { + loc = strchr(b64table, src[i]); + if(loc == (char *) 0) + break; + else + a[i] = loc - b64table; + ++i; + } + size = i; + + i = size - 1; + j = size; + while(1) { + a[j] = a[i]; + if(--i < 0) + break; + a[j] |= (a[i] & 3) << 6; + --j; + a[j] = (unsigned char) ((a[i] & 0x3c) >> 2); + if(--i < 0) + break; + a[j] |= (a[i] & 0xf) << 4; + --j; + a[j] = (unsigned char) ((a[i] & 0x30) >> 4); + if(--i < 0) + break; + a[j] |= (a[i] << 2); + + a[--j] = 0; + if(--i < 0) + break; + } + + while(j <= size && a[j] == 0) + ++j; + + memcpy(dst, a + j, size - j + 1); + free(a); + return size - j + 1; +} + +/* + * Convert a raw byte string into a null-terminated base64 ASCII string. + */ +_TYPE( char * ) +t_tob64(dst, src, size) + register char *dst, *src; + register unsigned size; +{ + int c, pos = size % 3; + unsigned char b0 = 0, b1 = 0, b2 = 0, notleading = 0; + char *olddst = dst; + + switch(pos) { + case 1: + b2 = src[0]; + break; + case 2: + b1 = src[0]; + b2 = src[1]; + break; + } + + while(1) { + c = (b0 & 0xfc) >> 2; + if(notleading || c != 0) { + *dst++ = b64table[c]; + notleading = 1; + } + c = ((b0 & 3) << 4) | ((b1 & 0xf0) >> 4); + if(notleading || c != 0) { + *dst++ = b64table[c]; + notleading = 1; + } + c = ((b1 & 0xf) << 2) | ((b2 & 0xc0) >> 6); + if(notleading || c != 0) { + *dst++ = b64table[c]; + notleading = 1; + } + c = b2 & 0x3f; + if(notleading || c != 0) { + *dst++ = b64table[c]; + notleading = 1; + } + if(pos >= size) + break; + else { + b0 = src[pos++]; + b1 = src[pos++]; + b2 = src[pos++]; + } + } + + *dst++ = '\0'; + return olddst; +} diff --git a/package/network/services/ead/src/tinysrp/t_defines.h b/package/network/services/ead/src/tinysrp/t_defines.h new file mode 100644 index 0000000000..4128093f60 --- /dev/null +++ b/package/network/services/ead/src/tinysrp/t_defines.h @@ -0,0 +1,169 @@ +/* + * Copyright (c) 1997-1999 The Stanford SRP Authentication Project + * 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" AND WITHOUT WARRANTY OF ANY KIND, + * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY + * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. + * + * IN NO EVENT SHALL STANFORD BE LIABLE FOR ANY SPECIAL, INCIDENTAL, + * INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, OR ANY DAMAGES WHATSOEVER + * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER OR NOT ADVISED OF + * THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF LIABILITY, ARISING OUT + * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + * In addition, the following conditions apply: + * + * 1. Any software that incorporates the SRP authentication technology + * must display the following acknowlegment: + * "This product uses the 'Secure Remote Password' cryptographic + * authentication system developed by Tom Wu (tjw@CS.Stanford.EDU)." + * + * 2. Any software that incorporates all or part of the SRP distribution + * itself must also display the following acknowledgment: + * "This product includes software developed by Tom Wu and Eugene + * Jhong for the SRP Distribution (http://srp.stanford.edu/srp/)." + * + * 3. Redistributions in source or binary form must retain an intact copy + * of this copyright notice and list of conditions. + */ + +#ifndef T_DEFINES_H +#define T_DEFINES_H + +#ifndef P +#if defined(__STDC__) || defined(__cplusplus) +#define P(x) x +#else +#define P(x) () +#endif +#endif + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif /* HAVE_CONFIG_H */ + +#ifndef _DLLDECL +#define _DLLDECL + +#ifdef MSVC15 /* MSVC1.5 support for 16 bit apps */ +#define _MSVC15EXPORT _export +#define _MSVC20EXPORT +#define _DLLAPI _export _pascal +#define _TYPE(a) a _MSVC15EXPORT +#define DLLEXPORT 1 + +#elif MSVC20 +#define _MSVC15EXPORT +#define _MSVC20EXPORT _declspec(dllexport) +#define _DLLAPI +#define _TYPE(a) _MSVC20EXPORT a +#define DLLEXPORT 1 + +#else /* Default, non-dll. Use this for Unix or DOS */ +#define _MSVC15DEXPORT +#define _MSVC20EXPORT +#define _DLLAPI +#define _TYPE(a) a +#endif +#endif + +#if STDC_HEADERS +#include +#include +#else /* not STDC_HEADERS */ +#ifndef HAVE_STRCHR +#define strchr index +#define strrchr rindex +#endif +char *strchr(), *strrchr(), *strtok(); +#ifndef HAVE_MEMCPY +#define memcpy(d, s, n) bcopy((s), (d), (n)) +#endif +#endif /* not STDC_HEADERS */ + +#include + +#if TIME_WITH_SYS_TIME +#include +#include +#else /* not TIME_WITH_SYS_TIME */ +#if HAVE_SYS_TIME_H +#include +#else +#include +#endif +#endif /* not TIME_WITH_SYS_TIME */ + +#if HAVE_TERMIOS_H +#include +#define STTY(fd, termio) tcsetattr(fd, TCSANOW, termio) +#define GTTY(fd, termio) tcgetattr(fd, termio) +#define TERMIO struct termios +#define USE_TERMIOS +#elif HAVE_TERMIO_H +#include +#include +#define STTY(fd, termio) ioctl(fd, TCSETA, termio) +#define GTTY(fd, termio) ioctl(fd, TCGETA, termio) +#define TEMRIO struct termio +#define USE_TERMIO +#elif HAVE_SGTTY_H +#include +#define STTY(fd, termio) stty(fd, termio) +#define GTTY(fd, termio) gtty(fd, termio) +#define TERMIO struct sgttyb +#define USE_SGTTY +#endif + +#ifdef USE_FTIME +#include +#endif + +#ifndef MATH_PRIV +typedef void * BigInteger; +#endif + +_TYPE( BigInteger ) BigIntegerFromInt P((unsigned int number)); +_TYPE( BigInteger ) BigIntegerFromBytes P((unsigned char * bytes, int length)); +_TYPE( int ) BigIntegerToBytes P((BigInteger src, unsigned char * dest)); +_TYPE( int ) BigIntegerBitLen P((BigInteger b)); +_TYPE( int ) BigIntegerCmp P((BigInteger c1, BigInteger c2)); +_TYPE( int ) BigIntegerCmpInt P((BigInteger c1, unsigned int c2)); +_TYPE( void ) BigIntegerLShift P((BigInteger result, BigInteger x, + unsigned int bits)); +_TYPE( void ) BigIntegerAdd P((BigInteger result, BigInteger a1, BigInteger a2)); +_TYPE( void ) BigIntegerAddInt P((BigInteger result, + BigInteger a1, unsigned int a2)); +_TYPE( void ) BigIntegerSub P((BigInteger result, BigInteger s1, BigInteger s2)); +_TYPE( void ) BigIntegerSubInt P((BigInteger result, + BigInteger s1, unsigned int s2)); +/* For BigIntegerMul{,Int}: result != m1, m2 */ +_TYPE( void ) BigIntegerMul P((BigInteger result, BigInteger m1, BigInteger m2)); +_TYPE( void ) BigIntegerMulInt P((BigInteger result, + BigInteger m1, unsigned int m2)); +_TYPE( void ) BigIntegerDivInt P((BigInteger result, + BigInteger d, unsigned int m)); +_TYPE( void ) BigIntegerMod P((BigInteger result, BigInteger d, BigInteger m)); +_TYPE( unsigned int ) BigIntegerModInt P((BigInteger d, unsigned int m)); +_TYPE( void ) BigIntegerModMul P((BigInteger result, + BigInteger m1, BigInteger m2, BigInteger m)); +_TYPE( void ) BigIntegerModExp P((BigInteger result, BigInteger base, + BigInteger expt, BigInteger modulus)); +_TYPE( void ) BigIntegerModExpInt P((BigInteger result, BigInteger base, + unsigned int expt, BigInteger modulus)); +_TYPE( int ) BigIntegerCheckPrime P((BigInteger n)); +_TYPE( void ) BigIntegerFree P((BigInteger b)); + +#endif diff --git a/package/network/services/ead/src/tinysrp/t_getconf.c b/package/network/services/ead/src/tinysrp/t_getconf.c new file mode 100644 index 0000000000..db6de6171f --- /dev/null +++ b/package/network/services/ead/src/tinysrp/t_getconf.c @@ -0,0 +1,118 @@ +/* + * Copyright (c) 1997-1999 The Stanford SRP Authentication Project + * 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" AND WITHOUT WARRANTY OF ANY KIND, + * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY + * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. + * + * IN NO EVENT SHALL STANFORD BE LIABLE FOR ANY SPECIAL, INCIDENTAL, + * INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, OR ANY DAMAGES WHATSOEVER + * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER OR NOT ADVISED OF + * THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF LIABILITY, ARISING OUT + * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + * In addition, the following conditions apply: + * + * 1. Any software that incorporates the SRP authentication technology + * must display the following acknowlegment: + * "This product uses the 'Secure Remote Password' cryptographic + * authentication system developed by Tom Wu (tjw@CS.Stanford.EDU)." + * + * 2. Any software that incorporates all or part of the SRP distribution + * itself must also display the following acknowledgment: + * "This product includes software developed by Tom Wu and Eugene + * Jhong for the SRP Distribution (http://srp.stanford.edu/srp/)." + * + * 3. Redistributions in source or binary form must retain an intact copy + * of this copyright notice and list of conditions. + */ + +#include + +#include "t_defines.h" +#include "t_pwd.h" +#include "t_read.h" + +/* Master builtin parameter storage object. The default that tphrase +uses is the last one. */ + +static struct pre_struct { + struct t_preconf preconf; + int state; /* 0 == uninitialized/first time */ + unsigned char modbuf[MAXPARAMLEN]; + unsigned char genbuf[MAXPARAMLEN]; +} pre_params[] = { + { { "2iQzj1CagQc/5ctbuJYLWlhtAsPHc7xWVyCPAKFRLWKADpASkqe9djWPFWTNTdeJtL8nAhImCn3Sr/IAdQ1FrGw0WvQUstPx3FO9KNcXOwisOQ1VlL.gheAHYfbYyBaxXL.NcJx9TUwgWDT0hRzFzqSrdGGTN3FgSTA1v4QnHtEygNj3eZ.u0MThqWUaDiP87nqha7XnT66bkTCkQ8.7T8L4KZjIImrNrUftedTTBi.WCi.zlrBxDuOM0da0JbUkQlXqvp0yvJAPpC11nxmmZOAbQOywZGmu9nhZNuwTlxjfIro0FOdthaDTuZRL9VL7MRPUDo/DQEyW.d4H.UIlzp", + "2", + NULL }, 0 }, + { { "dUyyhxav9tgnyIg65wHxkzkb7VIPh4o0lkwfOKiPp4rVJrzLRYVBtb76gKlaO7ef5LYGEw3G.4E0jbMxcYBetDy2YdpiP/3GWJInoBbvYHIRO9uBuxgsFKTKWu7RnR7yTau/IrFTdQ4LY/q.AvoCzMxV0PKvD9Odso/LFIItn8PbTov3VMn/ZEH2SqhtpBUkWtmcIkEflhX/YY/fkBKfBbe27/zUaKUUZEUYZ2H2nlCL60.JIPeZJSzsu/xHDVcx", + "2", + NULL }, 0 }, + { { "3NUKQ2Re4P5BEK0TLg2dX3gETNNNECPoe92h4OVMaDn3Xo/0QdjgG/EvM.hiVV1BdIGklSI14HA38Mpe5k04juR5/EXMU0r1WtsLhNXwKBlf2zEfoOh0zVmDvqInpU695f29Iy7sNW3U5RIogcs740oUp2Kdv5wuITwnIx84cnO.e467/IV1lPnvMCr0pd1dgS0a.RV5eBJr03Q65Xy61R", + "2", + NULL }, 0 }, + { { "F//////////oG/QeY5emZJ4ncABWDmSqIa2JWYAPynq0Wk.fZiJco9HIWXvZZG4tU.L6RFDEaCRC2iARV9V53TFuJLjRL72HUI5jNPYNdx6z4n2wQOtxMiB/rosz0QtxUuuQ/jQYP.bhfya4NnB7.P9A6PHxEPJWV//////////", + "5", + "oakley prime 2" }, 0 }, + { { "Ewl2hcjiutMd3Fu2lgFnUXWSc67TVyy2vwYCKoS9MLsrdJVT9RgWTCuEqWJrfB6uE3LsE9GkOlaZabS7M29sj5TnzUqOLJMjiwEzArfiLr9WbMRANlF68N5AVLcPWvNx6Zjl3m5Scp0BzJBz9TkgfhzKJZ.WtP3Mv/67I/0wmRZ", + "2", + NULL }, 0 }, +}; + +_TYPE( int ) +t_getprecount() +{ + return (sizeof(pre_params) / sizeof(struct pre_struct)); +} + +static struct t_confent sysconf; + +/* id is index origin 1 */ + +_TYPE( struct t_confent * ) +gettcid +(id) + int id; +{ + struct t_preconf *tcp; + + if (id <= 0 || id > t_getprecount()) { + return NULL; + } + tcp = t_getpreparam(id - 1); + sysconf.index = id; + sysconf.modulus = tcp->modulus; + sysconf.generator = tcp->generator; + + return &sysconf; +} + +_TYPE( struct t_preconf * ) +t_getpreparam(idx) + int idx; +{ + if(pre_params[idx].state == 0) { + /* Wire up storage */ + pre_params[idx].preconf.modulus.data = pre_params[idx].modbuf; + pre_params[idx].preconf.generator.data = pre_params[idx].genbuf; + + /* Convert from b64 to t_num */ + pre_params[idx].preconf.modulus.len = t_fromb64(pre_params[idx].preconf.modulus.data, pre_params[idx].preconf.mod_b64); + pre_params[idx].preconf.generator.len = t_fromb64(pre_params[idx].preconf.generator.data, pre_params[idx].preconf.gen_b64); + + pre_params[idx].state = 1; + } + return &(pre_params[idx].preconf); +} diff --git a/package/network/services/ead/src/tinysrp/t_getpass.c b/package/network/services/ead/src/tinysrp/t_getpass.c new file mode 100644 index 0000000000..6ae7fca4de --- /dev/null +++ b/package/network/services/ead/src/tinysrp/t_getpass.c @@ -0,0 +1,191 @@ +/* + * Copyright 1990 - 1995, Julianne Frances Haugh + * 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 Julianne F. Haugh 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 JULIE HAUGH 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 JULIE HAUGH 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 "t_defines.h" +#ifdef _WIN32 +#include +#include +#endif /* _WIN32 */ +#ifdef HAVE_UNISTD_H +#include +#endif /* HAVE_UNISTD_H */ +#include +#include + +static int sig_caught; +#ifdef HAVE_SIGACTION +static struct sigaction sigact; +#endif + +/*ARGSUSED*/ +static RETSIGTYPE +sig_catch (sig) +int sig; +{ + sig_caught = 1; +} + +_TYPE( int ) +t_getpass (buf, maxlen, prompt) + char *buf; + unsigned maxlen; + const char *prompt; +{ + char *cp; +#ifdef _WIN32 + HANDLE handle = (HANDLE) _get_osfhandle(_fileno(stdin)); + DWORD mode; + + GetConsoleMode( handle, &mode ); + SetConsoleMode( handle, mode & ~ENABLE_ECHO_INPUT ); + + if(fputs(prompt, stdout) == EOF || + fgets(buf, maxlen, stdin) == NULL) { + SetConsoleMode(handle,mode); + return -1; + } + cp = buf + strlen(buf) - 1; + if ( *cp == 0x0a ) + *cp = '\0'; + printf("\n"); + SetConsoleMode(handle,mode); +#else + FILE *fp; + int tty_opened = 0; + +#ifdef HAVE_SIGACTION + struct sigaction old_sigact; +#else + RETSIGTYPE (*old_signal)(); +#endif + TERMIO new_modes; + TERMIO old_modes; + + /* + * set a flag so the SIGINT signal can be re-sent if it + * is caught + */ + + sig_caught = 0; + + /* + * if /dev/tty can't be opened, getpass() needs to read + * from stdin instead. + */ + + if ((fp = fopen ("/dev/tty", "r")) == 0) { + fp = stdin; + setbuf (fp, (char *) 0); + } else { + tty_opened = 1; + } + + /* + * the current tty modes must be saved so they can be + * restored later on. echo will be turned off, except + * for the newline character (BSD has to punt on this) + */ + + if (GTTY (fileno (fp), &new_modes)) + return -1; + + old_modes = new_modes; + +#ifdef HAVE_SIGACTION + sigact.sa_handler = sig_catch; + (void) sigaction (SIGINT, &sigact, &old_sigact); +#else + old_signal = signal (SIGINT, sig_catch); +#endif + +#ifdef USE_SGTTY + new_modes.sg_flags &= ~ECHO; +#else + new_modes.c_iflag &= ~IGNCR; + new_modes.c_iflag |= ICRNL; + new_modes.c_oflag |= OPOST|ONLCR; + new_modes.c_lflag &= ~(ECHO|ECHOE|ECHOK); + new_modes.c_lflag |= ICANON|ECHONL; +#endif + + if (STTY (fileno (fp), &new_modes)) + goto out; + + /* + * the prompt is output, and the response read without + * echoing. the trailing newline must be removed. if + * the fgets() returns an error, a NULL pointer is + * returned. + */ + + if (fputs (prompt, stdout) == EOF) + goto out; + + (void) fflush (stdout); + + if (fgets (buf, maxlen, fp) == buf) { + if ((cp = strchr (buf, '\n'))) + *cp = '\0'; + else + buf[maxlen - 1] = '\0'; + +#ifdef USE_SGTTY + putc ('\n', stdout); +#endif + } + else buf[0] = '\0'; +out: + /* + * the old SIGINT handler is restored after the tty + * modes. then /dev/tty is closed if it was opened in + * the beginning. finally, if a signal was caught it + * is sent to this process for normal processing. + */ + + if (STTY (fileno (fp), &old_modes)) + { memset (buf, 0, maxlen); return -1; } + +#ifdef HAVE_SIGACTION + (void) sigaction (SIGINT, &old_sigact, NULL); +#else + (void) signal (SIGINT, old_signal); +#endif + + if (tty_opened) + (void) fclose (fp); + + if (sig_caught) { + kill (getpid (), SIGINT); + memset (buf, 0, maxlen); + return -1; + } +#endif + + return 0; +} diff --git a/package/network/services/ead/src/tinysrp/t_math.c b/package/network/services/ead/src/tinysrp/t_math.c new file mode 100644 index 0000000000..20161a0112 --- /dev/null +++ b/package/network/services/ead/src/tinysrp/t_math.c @@ -0,0 +1,177 @@ +/* + * Copyright (c) 1997-1999 The Stanford SRP Authentication Project + * 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" AND WITHOUT WARRANTY OF ANY KIND, + * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY + * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. + * + * IN NO EVENT SHALL STANFORD BE LIABLE FOR ANY SPECIAL, INCIDENTAL, + * INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, OR ANY DAMAGES WHATSOEVER + * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER OR NOT ADVISED OF + * THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF LIABILITY, ARISING OUT + * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + * In addition, the following conditions apply: + * + * 1. Any software that incorporates the SRP authentication technology + * must display the following acknowlegment: + * "This product uses the 'Secure Remote Password' cryptographic + * authentication system developed by Tom Wu (tjw@CS.Stanford.EDU)." + * + * 2. Any software that incorporates all or part of the SRP distribution + * itself must also display the following acknowledgment: + * "This product includes software developed by Tom Wu and Eugene + * Jhong for the SRP Distribution (http://srp.stanford.edu/srp/)." + * + * 3. Redistributions in source or binary form must retain an intact copy + * of this copyright notice and list of conditions. + */ + +#include +#include + +#include "config.h" + +#include "bn.h" +typedef BIGNUM * BigInteger; +#define MATH_PRIV + +#include "t_defines.h" +#include "t_pwd.h" + +/* Math library interface stubs */ + +BigInteger +BigIntegerFromInt(n) + unsigned int n; +{ + BIGNUM * a = BN_new(); + BN_set_word(a, n); + return a; +} + +BigInteger +BigIntegerFromBytes(bytes, length) + unsigned char * bytes; + int length; +{ + BIGNUM * a = BN_new(); + BN_bin2bn(bytes, length, a); + return a; +} + +int +BigIntegerToBytes(src, dest) + BigInteger src; + unsigned char * dest; +{ + return BN_bn2bin(src, dest); +} + +int +BigIntegerCmp(c1, c2) + BigInteger c1, c2; +{ + return BN_cmp(c1, c2); +} + +int +BigIntegerCmpInt(c1, c2) + BigInteger c1; + unsigned int c2; +{ + BIGNUM * a = BN_new(); + int rv; + BN_set_word(a, c2); + rv = BN_cmp(c1, a); + BN_free(a); + return rv; +} + +void +BigIntegerAdd(result, a1, a2) + BigInteger result, a1, a2; +{ + BN_add(result, a1, a2); +} + +void +BigIntegerAddInt(result, a1, a2) + BigInteger result, a1; + unsigned int a2; +{ + BIGNUM * a = BN_new(); + BN_set_word(a, a2); + BN_add(result, a1, a); + BN_free(a); +} + +void +BigIntegerSub(result, s1, s2) + BigInteger result, s1, s2; +{ + BN_sub(result, s1, s2); +} + +void +BigIntegerMulInt(result, m1, m2) + BigInteger result, m1; + unsigned int m2; +{ + BN_CTX * ctx = BN_CTX_new(); + BIGNUM * m = BN_new(); + BN_set_word(m, m2); + BN_mul(result, m1, m, ctx); + BN_CTX_free(ctx); +} + +void +BigIntegerModMul(r, m1, m2, modulus) + BigInteger r, m1, m2, modulus; +{ + BN_CTX * ctx = BN_CTX_new(); + BN_mod_mul(r, m1, m2, modulus, ctx); + BN_CTX_free(ctx); +} + +void +BigIntegerModExp(r, b, e, m) + BigInteger r, b, e, m; +{ + BN_CTX * ctx = BN_CTX_new(); + BN_mod_exp(r, b, e, m, ctx); + BN_CTX_free(ctx); +} + +void +BigIntegerModExpInt(r, b, e, m) + BigInteger r, b; + unsigned int e; + BigInteger m; +{ + BN_CTX * ctx = BN_CTX_new(); + BIGNUM * p = BN_new(); + BN_set_word(p, e); + BN_mod_exp(r, b, p, m, ctx); + BN_free(p); + BN_CTX_free(ctx); +} + +void +BigIntegerFree(b) + BigInteger b; +{ + BN_free(b); +} diff --git a/package/network/services/ead/src/tinysrp/t_misc.c b/package/network/services/ead/src/tinysrp/t_misc.c new file mode 100644 index 0000000000..a23986f90f --- /dev/null +++ b/package/network/services/ead/src/tinysrp/t_misc.c @@ -0,0 +1,338 @@ +/* + * Copyright (c) 1997-1999 The Stanford SRP Authentication Project + * 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" AND WITHOUT WARRANTY OF ANY KIND, + * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY + * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. + * + * IN NO EVENT SHALL STANFORD BE LIABLE FOR ANY SPECIAL, INCIDENTAL, + * INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, OR ANY DAMAGES WHATSOEVER + * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER OR NOT ADVISED OF + * THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF LIABILITY, ARISING OUT + * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + * In addition, the following conditions apply: + * + * 1. Any software that incorporates the SRP authentication technology + * must display the following acknowlegment: + * "This product uses the 'Secure Remote Password' cryptographic + * authentication system developed by Tom Wu (tjw@CS.Stanford.EDU)." + * + * 2. Any software that incorporates all or part of the SRP distribution + * itself must also display the following acknowledgment: + * "This product includes software developed by Tom Wu and Eugene + * Jhong for the SRP Distribution (http://srp.stanford.edu/srp/)." + * + * 3. Redistributions in source or binary form must retain an intact copy + * of this copyright notice and list of conditions. + */ + +#include "t_defines.h" + +#ifdef HAVE_UNISTD_H +#include +#endif /* HAVE_UNISTD_H */ + +#include +#include +#include +#include + +#include "t_sha.h" + +#ifndef NULL +#define NULL 0 +#endif + +static unsigned char randpool[SHA_DIGESTSIZE], randout[SHA_DIGESTSIZE]; +static unsigned long randcnt = 0; +static unsigned int outpos = 0; +SHA1_CTX randctxt; + +/* + * t_envhash - Generate a 160-bit SHA hash of the environment + * + * This routine performs an SHA hash of all the "name=value" pairs + * in the environment concatenated together and dumps them in the + * output. While it is true that anyone on the system can see + * your environment, someone not on the system will have a very + * difficult time guessing it, especially since some systems play + * tricks with variable ordering and sometimes define quirky + * environment variables like $WINDOWID or $_. + */ +extern char ** environ; + +static void +t_envhash(out) + unsigned char * out; +{ + char ** ptr; + char ebuf[256]; + SHA1_CTX ctxt; + + SHA1Init(&ctxt); + for(ptr = environ; *ptr; ++ptr) { + strncpy(ebuf, *ptr, 255); + ebuf[255] = '\0'; + SHA1Update(&ctxt, ebuf, strlen(ebuf)); + } + SHA1Final(out, &ctxt); +} + +/* + * t_fshash - Generate a 160-bit SHA hash from the file system + * + * This routine climbs up the directory tree from the current + * directory, running stat() on each directory until it hits the + * root directory. This information is sensitive to the last + * access/modification times of all the directories above you, + * so someone who lists one of those directories injects some + * entropy into the system. Obviously, this hash is very sensitive + * to your current directory when the program is run. + * + * For good measure, it also performs an fstat on the standard input, + * usually your tty, throws that into the buffer, creates a file in + * /tmp (the inode is unpredictable on a busy system), and runs stat() + * on that before deleting it. + * + * The entire buffer is run once through SHA to obtain the final result. + */ +static void +t_fshash(out) + unsigned char * out; +{ + char dotpath[128]; + struct stat st; + SHA1_CTX ctxt; + int i, pinode; + dev_t pdev; + + SHA1Init(&ctxt); + if(stat(".", &st) >= 0) { + SHA1Update(&ctxt, (unsigned char *) &st, sizeof(st)); + pinode = st.st_ino; + pdev = st.st_dev; + strcpy(dotpath, ".."); + for(i = 0; i < 40; ++i) { + if(stat(dotpath, &st) < 0) + break; + if(st.st_ino == pinode && st.st_dev == pdev) + break; + SHA1Update(&ctxt, (unsigned char *) &st, sizeof(st)); + pinode = st.st_ino; + pdev = st.st_dev; + strcat(dotpath, "/.."); + } + } + + if(fstat(0, &st) >= 0) + SHA1Update(&ctxt, (unsigned char *) &st, sizeof(st)); + + sprintf(dotpath, "/tmp/rnd.%d", getpid()); + if(creat(dotpath, 0600) >= 0 && stat(dotpath, &st) >= 0) + SHA1Update(&ctxt, (unsigned char *) &st, sizeof(st)); + unlink(dotpath); + + SHA1Final(out, &ctxt); +} + +/* + * Generate a high-entropy seed for the strong random number generator. + * This uses a wide variety of quickly gathered and somewhat unpredictable + * system information. The 'preseed' structure is assembled from: + * + * The system time in seconds + * The system time in microseconds + * The current process ID + * The parent process ID + * A hash of the user's environment + * A hash gathered from the file system + * Input from a random device, if available + * Timings of system interrupts + * + * The entire structure (60 bytes on most systems) is fed to SHA to produce + * a 160-bit seed for the strong random number generator. It is believed + * that in the worst case (on a quiet system with no random device versus + * an attacker who has access to the system already), the seed contains at + * least about 80 bits of entropy. Versus an attacker who does not have + * access to the system, the entropy should be slightly over 128 bits. + */ +static char initialized = 0; + +static struct { + unsigned int trand1; + time_t sec; + time_t usec; + short pid; + short ppid; + unsigned char envh[SHA_DIGESTSIZE]; + unsigned char fsh[SHA_DIGESTSIZE]; + unsigned char devrand[20]; + unsigned int trand2; +} preseed; + +unsigned long raw_truerand(); + +void +t_initrand() +{ + SHA1_CTX ctxt; +#ifdef USE_FTIME + struct timeb t; +#else + struct timeval t; +#endif + int i, r=0; + + if(initialized) + return; + + initialized = 1; + + i = open("/dev/urandom", O_RDONLY); + if(i > 0) { + r += read(i, preseed.devrand, sizeof(preseed.devrand)); + close(i); + } + + /* Resort to truerand only if desperate for some Real entropy */ + if(r == 0) + preseed.trand1 = raw_truerand(); + +#ifdef USE_FTIME + ftime(&t); +#else + gettimeofday(&t, NULL); +#endif + +#ifdef USE_FTIME + preseed.sec = t.time; + preseed.usec = t.millitm; +#else + preseed.sec = t.tv_sec; + preseed.usec = t.tv_usec; +#endif + preseed.pid = getpid(); + preseed.ppid = getppid(); + t_envhash(preseed.envh); + t_fshash(preseed.fsh); + + if(r == 0) + preseed.trand2 = raw_truerand(); + + SHA1Init(&ctxt); + SHA1Update(&ctxt, (unsigned char *) &preseed, sizeof(preseed)); + SHA1Final(randpool, &ctxt); + outpos = 0; + memset((unsigned char *) &preseed, 0, sizeof(preseed)); + memset((unsigned char *) &ctxt, 0, sizeof(ctxt)); +} + +#define NUM_RANDOMS 12 + +/* + * The strong random number generator. This uses a 160-bit seed + * and uses SHA-1 in a feedback configuration to generate successive + * outputs. If S[0] is set to the initial seed, then: + * + * S[i+1] = SHA-1(i || S[i]) + * A[i] = SHA-1(S[i]) + * + * where the A[i] are the output blocks starting with i=0. + * Each cycle generates 20 bytes of new output. + */ +_TYPE( void ) +t_random(data, size) + unsigned char * data; + unsigned size; +{ + if(!initialized) + t_initrand(); + + if(size <= 0) /* t_random(NULL, 0) forces seed initialization */ + return; + + while(size > outpos) { + if(outpos > 0) { + memcpy(data, randout + (sizeof(randout) - outpos), outpos); + data += outpos; + size -= outpos; + } + + /* Recycle */ + SHA1Init(&randctxt); + SHA1Update(&randctxt, randpool, sizeof(randpool)); + SHA1Final(randout, &randctxt); + SHA1Init(&randctxt); + SHA1Update(&randctxt, (unsigned char *) &randcnt, sizeof(randcnt)); + SHA1Update(&randctxt, randpool, sizeof(randpool)); + SHA1Final(randpool, &randctxt); + ++randcnt; + outpos = sizeof(randout); + } + + if(size > 0) { + memcpy(data, randout + (sizeof(randout) - outpos), size); + outpos -= size; + } +} + +/* + * The interleaved session-key hash. This separates the even and the odd + * bytes of the input (ignoring the first byte if the input length is odd), + * hashes them separately, and re-interleaves the two outputs to form a + * single 320-bit value. + */ +_TYPE( unsigned char * ) +t_sessionkey(key, sk, sklen) + unsigned char * key; + unsigned char * sk; + unsigned sklen; +{ + unsigned i, klen; + unsigned char * hbuf; + unsigned char hout[SHA_DIGESTSIZE]; + SHA1_CTX ctxt; + + while(sklen > 0 && *sk == 0) { /* Skip leading 0's */ + --sklen; + ++sk; + } + + klen = sklen / 2; + if((hbuf = malloc(klen * sizeof(char))) == 0) + return 0; + + for(i = 0; i < klen; ++i) + hbuf[i] = sk[sklen - 2 * i - 1]; + SHA1Init(&ctxt); + SHA1Update(&ctxt, hbuf, klen); + SHA1Final(hout, &ctxt); + for(i = 0; i < sizeof(hout); ++i) + key[2 * i] = hout[i]; + + for(i = 0; i < klen; ++i) + hbuf[i] = sk[sklen - 2 * i - 2]; + SHA1Init(&ctxt); + SHA1Update(&ctxt, hbuf, klen); + SHA1Final(hout, &ctxt); + for(i = 0; i < sizeof(hout); ++i) + key[2 * i + 1] = hout[i]; + + memset(hout, 0, sizeof(hout)); + memset(hbuf, 0, klen); + free(hbuf); + return key; +} diff --git a/package/network/services/ead/src/tinysrp/t_pw.c b/package/network/services/ead/src/tinysrp/t_pw.c new file mode 100644 index 0000000000..18e929bb79 --- /dev/null +++ b/package/network/services/ead/src/tinysrp/t_pw.c @@ -0,0 +1,262 @@ +/* + * Copyright (c) 1997-2000 The Stanford SRP Authentication Project + * 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" AND WITHOUT WARRANTY OF ANY KIND, + * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY + * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. + * + * IN NO EVENT SHALL STANFORD BE LIABLE FOR ANY SPECIAL, INCIDENTAL, + * INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, OR ANY DAMAGES WHATSOEVER + * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER OR NOT ADVISED OF + * THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF LIABILITY, ARISING OUT + * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + * In addition, the following conditions apply: + * + * 1. Any software that incorporates the SRP authentication technology + * must display the following acknowlegment: + * "This product uses the 'Secure Remote Password' cryptographic + * authentication system developed by Tom Wu (tjw@CS.Stanford.EDU)." + * + * 2. Any software that incorporates all or part of the SRP distribution + * itself must also display the following acknowledgment: + * "This product includes software developed by Tom Wu and Eugene + * Jhong for the SRP Distribution (http://srp.stanford.edu/srp/)." + * + * 3. Redistributions in source or binary form must retain an intact copy + * of this copyright notice and list of conditions. + */ + +#include "t_defines.h" + +#ifdef HAVE_UNISTD_H +#include +#endif /* HAVE_UNISTD_H */ + +#include +#include +#include +#ifdef USE_HOMEDIR +#include +#endif +#ifdef WIN32 +#include +#endif + +#include "t_pwd.h" +#include "t_read.h" +#include "t_sha.h" +#include "t_server.h" + +static struct t_pw * syspw = NULL; +static struct t_passwd tpass; + +_TYPE( struct t_server * ) +t_serveropen(username) + const char * username; +{ + struct t_passwd * p; + p = gettpnam(username); + if(p == NULL) { + return NULL; + } else { + return t_serveropenraw(&p->tp, &p->tc); + } +} + + +/* t_openpw(NULL) is deprecated - use settpent()/gettpnam() instead */ + +_TYPE( struct t_pw * ) +t_openpw(fp) + FILE * fp; +{ + struct t_pw * tpw; + char close_flag = 0; + + if(fp == NULL) { /* Deprecated */ + if((fp = fopen(DEFAULT_PASSWD, "r")) == NULL) + return NULL; + close_flag = 1; + } + else + close_flag = 0; + + if((tpw = malloc(sizeof(struct t_pw))) == NULL) + return NULL; + tpw->instream = fp; + tpw->close_on_exit = close_flag; + tpw->state = FILE_ONLY; + + return tpw; +} + +_TYPE( struct t_pw * ) +t_openpwbyname(pwname) + const char * pwname; +{ + FILE * fp; + struct t_pw * t; + + if(pwname == NULL) /* Deprecated */ + return t_openpw(NULL); + + if((fp = fopen(pwname, "r")) == NULL) + return NULL; + + t = t_openpw(fp); + t->close_on_exit = 1; + return t; +} + +_TYPE( void ) +t_closepw(tpw) + struct t_pw * tpw; +{ + if(tpw->close_on_exit) + fclose(tpw->instream); + free(tpw); +} + +_TYPE( void ) +t_rewindpw(tpw) + struct t_pw * tpw; +{ +#ifdef ENABLE_YP + if(tpw->state == IN_NIS) + tpw->state = FILE_NIS; +#endif + rewind(tpw->instream); +} + +#ifdef ENABLE_YP +static void +savepwent(tpw, pwent) + struct t_pw * tpw; + struct t_pwent *pwent; +{ + tpw->pebuf.name = tpw->userbuf; + tpw->pebuf.password.data = tpw->pwbuf; + tpw->pebuf.salt.data = tpw->saltbuf; + strcpy(tpw->pebuf.name, pwent->name); + tpw->pebuf.password.len = pwent->password.len; + memcpy(tpw->pebuf.password.data, pwent->password.data, pwent->password.len); + tpw->pebuf.salt.len = pwent->salt.len; + memcpy(tpw->pebuf.salt.data, pwent->salt.data, pwent->salt.len); + tpw->pebuf.index = pwent->index; +} +#endif /* ENABLE_YP */ + +_TYPE( struct t_pwent * ) +t_getpwbyname(tpw, user) + struct t_pw * tpw; + const char * user; +{ + char indexbuf[16]; + char passbuf[MAXB64PARAMLEN]; + char saltstr[MAXB64SALTLEN]; + char username[MAXUSERLEN]; +#ifdef ENABLE_YP + struct t_passwd * nisent; +#endif + + t_rewindpw(tpw); + + while(t_nextfield(tpw->instream, username, MAXUSERLEN) > 0) { +#ifdef ENABLE_YP + if(tpw->state == FILE_NIS && *username == '+') { + if(strlen(username) == 1 || strcmp(user, username+1) == 0) { + nisent = _yp_gettpnam(user); /* Entry is +username or + */ + if(nisent != NULL) { + savepwent(tpw, &nisent->tp); + return &tpw->pebuf; + } + } + } +#endif + if(strcmp(user, username) == 0) + if(t_nextfield(tpw->instream, passbuf, MAXB64PARAMLEN) > 0 && + (tpw->pebuf.password.len = t_fromb64(tpw->pwbuf, passbuf)) > 0 && + t_nextfield(tpw->instream, saltstr, MAXB64SALTLEN) > 0 && + (tpw->pebuf.salt.len = t_fromb64(tpw->saltbuf, saltstr)) > 0 && + t_nextfield(tpw->instream, indexbuf, 16) > 0 && + (tpw->pebuf.index = atoi(indexbuf)) > 0) { + strcpy(tpw->userbuf, username); + tpw->pebuf.name = tpw->userbuf; + tpw->pebuf.password.data = tpw->pwbuf; + tpw->pebuf.salt.data = tpw->saltbuf; + t_nextline(tpw->instream); + return &tpw->pebuf; + } + if(t_nextline(tpw->instream) < 0) + return NULL; + } + return NULL; +} + +/* System password file accessors */ + +static int +pwinit() +{ + if(syspw == NULL) { + if((syspw = t_openpwbyname(DEFAULT_PASSWD)) == NULL) + return -1; + syspw->state = FILE_NIS; + } + return 0; +} + +static void +pwsetup(out, tpwd, tcnf) + struct t_passwd * out; + struct t_pwent * tpwd; + struct t_confent * tcnf; +{ + out->tp.name = tpwd->name; + out->tp.password.len = tpwd->password.len; + out->tp.password.data = tpwd->password.data; + out->tp.salt.len = tpwd->salt.len; + out->tp.salt.data = tpwd->salt.data; + out->tp.index = tpwd->index; + + out->tc.index = tcnf->index; + out->tc.modulus.len = tcnf->modulus.len; + out->tc.modulus.data = tcnf->modulus.data; + out->tc.generator.len = tcnf->generator.len; + out->tc.generator.data = tcnf->generator.data; +} + +_TYPE( struct t_passwd * ) +gettpnam +(user) + const char * user; +{ + struct t_pwent * tpptr; + struct t_confent * tcptr; + + if(pwinit() < 0) + return NULL; + tpptr = t_getpwbyname(syspw, user); + if(tpptr == NULL) + return NULL; + tcptr = + gettcid + (tpptr->index); + if(tcptr == NULL) + return NULL; + pwsetup(&tpass, tpptr, tcptr); + return &tpass; +} diff --git a/package/network/services/ead/src/tinysrp/t_pwd.h b/package/network/services/ead/src/tinysrp/t_pwd.h new file mode 100644 index 0000000000..73697bef3e --- /dev/null +++ b/package/network/services/ead/src/tinysrp/t_pwd.h @@ -0,0 +1,310 @@ +/* + * Copyright (c) 1997-1999 The Stanford SRP Authentication Project + * 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" AND WITHOUT WARRANTY OF ANY KIND, + * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY + * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. + * + * IN NO EVENT SHALL STANFORD BE LIABLE FOR ANY SPECIAL, INCIDENTAL, + * INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, OR ANY DAMAGES WHATSOEVER + * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER OR NOT ADVISED OF + * THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF LIABILITY, ARISING OUT + * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + * In addition, the following conditions apply: + * + * 1. Any software that incorporates the SRP authentication technology + * must display the following acknowlegment: + * "This product uses the 'Secure Remote Password' cryptographic + * authentication system developed by Tom Wu (tjw@CS.Stanford.EDU)." + * + * 2. Any software that incorporates all or part of the SRP distribution + * itself must also display the following acknowledgment: + * "This product includes software developed by Tom Wu and Eugene + * Jhong for the SRP Distribution (http://srp.stanford.edu/srp/)." + * + * 3. Redistributions in source or binary form must retain an intact copy + * of this copyright notice and list of conditions. + */ + +#ifndef T_PWD_H +#define T_PWD_H + +#ifndef P +#if defined (__STDC__) || defined (__cplusplus) +#define P(x) x +#else +#define P(x) () +#endif +#endif + +/* For building dynamic link libraries under windows, windows NT + * using MSVC1.5 or MSVC2.0 + */ + +#ifndef _DLLDECL +#define _DLLDECL + +#ifdef MSVC15 /* MSVC1.5 support for 16 bit apps */ +#define _MSVC15EXPORT _export +#define _MSVC20EXPORT +#define _DLLAPI _export _pascal +#define _TYPE(a) a _MSVC15EXPORT +#define DLLEXPORT 1 + +#elif MSVC20 +#define _MSVC15EXPORT +#define _MSVC20EXPORT _declspec(dllexport) +#define _DLLAPI +#define _TYPE(a) _MSVC20EXPORT a +#define DLLEXPORT 1 + +#else /* Default, non-dll. Use this for Unix or DOS */ +#define _MSVC15DEXPORT +#define _MSVC20EXPORT +#define _DLLAPI +#define _TYPE(a) a +#endif +#endif + +#define MAXPARAMBITS 2048 +#define MAXPARAMLEN ((MAXPARAMBITS + 7) / 8) +#define MAXB64PARAMLEN ((MAXPARAMBITS + 5) / 6 + 1) +#define MAXHEXPARAMLEN ((MAXPARAMBITS + 3) / 4 + 1) +#define MAXOCTPARAMLEN ((MAXPARAMBITS + 2) / 3 + 1) + +#define MAXUSERLEN 32 +#define MAXSALTLEN 32 +#define MAXB64SALTLEN 44 /* 256 bits in b64 + null */ +#define SALTLEN 10 /* Normally 80 bits */ + +#define RESPONSE_LEN 20 /* 160-bit proof hashes */ +#define SESSION_KEY_LEN (2 * RESPONSE_LEN) /* 320-bit session key */ + +#define DEFAULT_PASSWD "tpasswd" + +struct t_num { /* Standard byte-oriented integer representation */ + int len; + unsigned char * data; +}; + +struct t_preconf { /* Structure returned by t_getpreparam() */ + char * mod_b64; + char * gen_b64; + char * comment; + + struct t_num modulus; + struct t_num generator; +}; + +/* + * The built-in (known good) parameters access routines + * + * "t_getprecount" returns the number of precompiled parameter sets. + * "t_getpreparam" returns the indicated parameter set. + * Memory is statically allocated - callers need not perform any memory mgmt. + */ +_TYPE( int ) t_getprecount(); +_TYPE( struct t_preconf * ) t_getpreparam P((int)); + +struct t_confent { /* One configuration file entry (index, N, g) */ + int index; + struct t_num modulus; + struct t_num generator; +}; + +struct t_conf { /* An open configuration file */ + FILE * instream; + char close_on_exit; + unsigned char modbuf[MAXPARAMLEN]; + unsigned char genbuf[MAXPARAMLEN]; + struct t_confent tcbuf; +}; + +/* + * The configuration file routines are designed along the lines of the + * "getpw" functions in the standard C library. + * + * "t_openconf" accepts a stdio stream and interprets it as a config file. + * "t_openconfbyname" accepts a filename and does the same thing. + * "t_closeconf" closes the config file. + * "t_getconfent" fetches the next sequential configuration entry. + * "t_getconfbyindex" fetches the configuration entry whose index + * matches the one supplied, or NULL if one can't be found. + * "t_getconflast" fetches the last configuration entry in the file. + * "t_makeconfent" generates a set of configuration entry parameters + * randomly. + * "t_newconfent" returns an empty configuration entry. + * "t_cmpconfent" compares two configuration entries a la strcmp. + * "t_checkconfent" verifies that a set of configuration parameters + * are suitable. N must be prime and should be a safe prime. + * "t_putconfent" writes a configuration entry to a stream. + */ +_TYPE( struct t_conf * ) t_openconf P((FILE *)); +_TYPE( struct t_conf * ) t_openconfbyname P((const char *)); +_TYPE( void ) t_closeconf P((struct t_conf *)); +_TYPE( void ) t_rewindconf P((struct t_conf *)); +_TYPE( struct t_confent * ) t_getconfent P((struct t_conf *)); +_TYPE( struct t_confent * ) t_getconfbyindex P((struct t_conf *, int)); +_TYPE( struct t_confent * ) t_getconflast P((struct t_conf *)); +_TYPE( struct t_confent * ) t_makeconfent P((struct t_conf *, int)); +_TYPE( struct t_confent * ) t_makeconfent_c P((struct t_conf *, int)); +_TYPE( struct t_confent * ) t_newconfent P((struct t_conf *)); +_TYPE( int ) t_cmpconfent P((const struct t_confent *, const struct t_confent *)); +_TYPE( int ) t_checkconfent P((const struct t_confent *)); +_TYPE( void ) t_putconfent P((const struct t_confent *, FILE *)); + +/* libc-style system conf file access */ +_TYPE( struct t_confent *) gettcent(); +_TYPE( struct t_confent *) gettcid P((int)); +_TYPE( void ) settcent(); +_TYPE( void ) endtcent(); + +#ifdef ENABLE_NSW +extern struct t_confent * _gettcent(); +extern struct t_confent * _gettcid P((int)); +extern void _settcent(); +extern void _endtcent(); +#endif + +/* A hack to support '+'-style entries in the passwd file */ + +typedef enum fstate { + FILE_ONLY, /* Ordinary file, don't consult NIS ever */ + FILE_NIS, /* Currently accessing file, use NIS if encountered */ + IN_NIS, /* Currently in a '+' entry; use NIS for getXXent */ +} FILE_STATE; + +struct t_pwent { /* A single password file entry */ + char * name; + struct t_num password; + struct t_num salt; + int index; +}; + +struct t_pw { /* An open password file */ + FILE * instream; + char close_on_exit; + FILE_STATE state; + char userbuf[MAXUSERLEN]; + unsigned char pwbuf[MAXPARAMLEN]; + unsigned char saltbuf[SALTLEN]; + struct t_pwent pebuf; +}; + +/* + * The password manipulation routines are patterned after the getpw* + * standard C library function calls. + * + * "t_openpw" reads a stream as if it were a password file. + * "t_openpwbyname" opens the named file as a password file. + * "t_closepw" closes an open password file. + * "t_rewindpw" starts the internal file pointer from the beginning + * of the password file. + * "t_getpwent" retrieves the next sequential password entry. + * "t_getpwbyname" looks up the password entry corresponding to the + * specified user. + * "t_makepwent" constructs a password entry from a username, password, + * numeric salt, and configuration entry. + * "t_putpwent" writes a password entry to a stream. + */ +_TYPE( struct t_pw * ) t_openpw P((FILE *)); +_TYPE( struct t_pw * ) t_openpwbyname P((const char *)); +_TYPE( void ) t_closepw P((struct t_pw *)); +_TYPE( void ) t_rewindpw P((struct t_pw *)); +_TYPE( struct t_pwent * ) t_getpwent P((struct t_pw *)); +_TYPE( struct t_pwent * ) t_getpwbyname P((struct t_pw *, const char *)); +_TYPE( struct t_pwent * ) t_makepwent P((struct t_pw *, const char *, + const char *, const struct t_num *, + const struct t_confent *)); +_TYPE( void ) t_putpwent P((const struct t_pwent *, FILE *)); + +struct t_passwd { + struct t_pwent tp; + struct t_confent tc; +}; + +/* libc-style system password file access */ +_TYPE( struct t_passwd * ) gettpent(); +_TYPE( struct t_passwd * ) gettpnam P((const char *)); +_TYPE( void ) settpent(); +_TYPE( void ) endtpent(); + +#ifdef ENABLE_NSW +extern struct t_passwd * _gettpent(); +extern struct t_passwd * _gettpnam P((const char *)); +extern void _settpent(); +extern void _endtpent(); +#endif + +/* + * Utility functions + * + * "t_verifypw" accepts a username and password, and checks against the + * system password file to see if the password for that user is correct. + * Returns > 0 if it is correct, 0 if not, and -1 if some error occurred + * (i.e. the user doesn't exist on the system). This is intended ONLY + * for local authentication; for remote authentication, look at the + * t_client and t_server source. (That's the whole point of SRP!) + * "t_changepw" modifies the specified file, substituting the given password + * entry for the one already in the file. If no matching entry is found, + * the new entry is simply appended to the file. + * "t_deletepw" removes the specified user from the specified file. + */ +_TYPE( int ) t_verifypw P((const char *, const char *)); +_TYPE( int ) t_changepw P((const char *, const struct t_pwent *)); +_TYPE( int ) t_deletepw P((const char *, const char *)); + +/* Conversion utilities */ + +/* + * All these calls accept output as the first parameter. In the case of + * t_tohex and t_tob64, the last argument is the length of the byte-string + * input. + */ +_TYPE( char * t_tohex ) P((char *, char *, unsigned)); +_TYPE( int ) t_fromhex P((char *, char *)); +_TYPE( char * ) t_tob64 P((char *, char *, unsigned)); +_TYPE( int ) t_fromb64 P((char *, char *)); + +/* Miscellaneous utilities */ + +/* + * "t_random" is a cryptographic random number generator, which is seeded + * from various high-entropy sources and uses a one-way hash function + * in a feedback configuration. + * "t_sessionkey" is the interleaved hash used to generate session keys + * from a large integer. + * "t_getpass" reads a password from the terminal without echoing. + */ +_TYPE( void ) t_random P((unsigned char *, unsigned)); +_TYPE( void ) t_stronginitrand(); +_TYPE( unsigned char * ) + t_sessionkey P((unsigned char *, unsigned char *, unsigned)); +_TYPE( int ) t_getpass P((char *, unsigned, const char *)); + +/* + * Return value of t_checkprime: + * < 0 : not prime + * = 0 : prime, but not safe + * > 0 : safe + */ +#define NUM_NOTPRIME -1 +#define NUM_NOTSAFE 0 +#define NUM_SAFE 1 + +_TYPE( int ) t_checkprime P((const struct t_num *)); + +#endif diff --git a/package/network/services/ead/src/tinysrp/t_read.c b/package/network/services/ead/src/tinysrp/t_read.c new file mode 100644 index 0000000000..087b7d55b8 --- /dev/null +++ b/package/network/services/ead/src/tinysrp/t_read.c @@ -0,0 +1,81 @@ +/* + * Copyright (c) 1997-1999 The Stanford SRP Authentication Project + * 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" AND WITHOUT WARRANTY OF ANY KIND, + * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY + * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. + * + * IN NO EVENT SHALL STANFORD BE LIABLE FOR ANY SPECIAL, INCIDENTAL, + * INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, OR ANY DAMAGES WHATSOEVER + * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER OR NOT ADVISED OF + * THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF LIABILITY, ARISING OUT + * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + * In addition, the following conditions apply: + * + * 1. Any software that incorporates the SRP authentication technology + * must display the following acknowlegment: + * "This product uses the 'Secure Remote Password' cryptographic + * authentication system developed by Tom Wu (tjw@CS.Stanford.EDU)." + * + * 2. Any software that incorporates all or part of the SRP distribution + * itself must also display the following acknowledgment: + * "This product includes software developed by Tom Wu and Eugene + * Jhong for the SRP Distribution (http://srp.stanford.edu/srp/)." + * + * 3. Redistributions in source or binary form must retain an intact copy + * of this copyright notice and list of conditions. + */ + +#include +#include "config.h" + +#define FSEPARATOR ':' + +int +t_nextfield(fp, s, max) +FILE * fp; +char * s; +unsigned max; +{ + int c, count = 0; + + while((c = getc(fp)) != EOF) { + if(c == '\n') { + ungetc(c, fp); + break; + } + else if(c == FSEPARATOR) + break; + if(count < max - 1) { + *s++ = c; + ++count; + } + } + *s++ = '\0'; + return count; +} + +int +t_nextline(fp) +FILE * fp; +{ + int c; + + while((c = getc(fp)) != '\n') + if(c == EOF) + return -1; + return 0; +} diff --git a/package/network/services/ead/src/tinysrp/t_read.h b/package/network/services/ead/src/tinysrp/t_read.h new file mode 100644 index 0000000000..e621f793ad --- /dev/null +++ b/package/network/services/ead/src/tinysrp/t_read.h @@ -0,0 +1,55 @@ +/* + * Copyright (c) 1997-1999 The Stanford SRP Authentication Project + * 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" AND WITHOUT WARRANTY OF ANY KIND, + * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY + * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. + * + * IN NO EVENT SHALL STANFORD BE LIABLE FOR ANY SPECIAL, INCIDENTAL, + * INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, OR ANY DAMAGES WHATSOEVER + * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER OR NOT ADVISED OF + * THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF LIABILITY, ARISING OUT + * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + * In addition, the following conditions apply: + * + * 1. Any software that incorporates the SRP authentication technology + * must display the following acknowlegment: + * "This product uses the 'Secure Remote Password' cryptographic + * authentication system developed by Tom Wu (tjw@CS.Stanford.EDU)." + * + * 2. Any software that incorporates all or part of the SRP distribution + * itself must also display the following acknowledgment: + * "This product includes software developed by Tom Wu and Eugene + * Jhong for the SRP Distribution (http://srp.stanford.edu/srp/)." + * + * 3. Redistributions in source or binary form must retain an intact copy + * of this copyright notice and list of conditions. + */ + +#ifndef _T_READ_H_ +#define _T_READ_H_ + +#if !defined(P) +#ifdef __STDC__ +#define P(x) x +#else +#define P(x) () +#endif +#endif + +extern int t_nextfield P((FILE *, char *, unsigned)); +extern int t_nextline P((FILE *)); +#endif diff --git a/package/network/services/ead/src/tinysrp/t_server.c b/package/network/services/ead/src/tinysrp/t_server.c new file mode 100644 index 0000000000..6ab501bcb8 --- /dev/null +++ b/package/network/services/ead/src/tinysrp/t_server.c @@ -0,0 +1,259 @@ +/* + * Copyright (c) 1997-1999 The Stanford SRP Authentication Project + * 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" AND WITHOUT WARRANTY OF ANY KIND, + * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY + * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. + * + * IN NO EVENT SHALL STANFORD BE LIABLE FOR ANY SPECIAL, INCIDENTAL, + * INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, OR ANY DAMAGES WHATSOEVER + * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER OR NOT ADVISED OF + * THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF LIABILITY, ARISING OUT + * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + * In addition, the following conditions apply: + * + * 1. Any software that incorporates the SRP authentication technology + * must display the following acknowlegment: + * "This product uses the 'Secure Remote Password' cryptographic + * authentication system developed by Tom Wu (tjw@CS.Stanford.EDU)." + * + * 2. Any software that incorporates all or part of the SRP distribution + * itself must also display the following acknowledgment: + * "This product includes software developed by Tom Wu and Eugene + * Jhong for the SRP Distribution (http://srp.stanford.edu/srp/)." + * + * 3. Redistributions in source or binary form must retain an intact copy + * of this copyright notice and list of conditions. + */ + +#include +#include "t_defines.h" +#include "t_pwd.h" +#include "t_server.h" + +_TYPE( struct t_server * ) +t_serveropenraw(ent, tce) + struct t_pwent * ent; + struct t_confent * tce; +{ + struct t_server * ts; + unsigned char buf1[SHA_DIGESTSIZE], buf2[SHA_DIGESTSIZE]; + SHA1_CTX ctxt; + int i; + + if((ts = malloc(sizeof(struct t_server))) == 0) + return 0; + + SHA1Init(&ts->ckhash); + + ts->index = ent->index; + ts->n.len = tce->modulus.len; + ts->n.data = ts->nbuf; + memcpy(ts->n.data, tce->modulus.data, ts->n.len); + + SHA1Init(&ctxt); + SHA1Update(&ctxt, ts->n.data, ts->n.len); + SHA1Final(buf1, &ctxt); + + ts->g.len = tce->generator.len; + ts->g.data = ts->gbuf; + memcpy(ts->g.data, tce->generator.data, ts->g.len); + + SHA1Init(&ctxt); + SHA1Update(&ctxt, ts->g.data, ts->g.len); + SHA1Final(buf2, &ctxt); + + for(i = 0; i < sizeof(buf1); ++i) + buf1[i] ^= buf2[i]; + + SHA1Update(&ts->ckhash, buf1, sizeof(buf1)); + + SHA1Init(&ctxt); + SHA1Update(&ctxt, ent->name, strlen(ent->name)); + SHA1Final(buf1, &ctxt); + + SHA1Update(&ts->ckhash, buf1, sizeof(buf1)); + + ts->v.len = ent->password.len; + ts->v.data = ts->vbuf; + memcpy(ts->v.data, ent->password.data, ts->v.len); + + ts->s.len = ent->salt.len; + ts->s.data = ts->saltbuf; + memcpy(ts->s.data, ent->salt.data, ts->s.len); + + SHA1Update(&ts->ckhash, ts->s.data, ts->s.len); + + ts->b.data = ts->bbuf; + ts->B.data = ts->Bbuf; + + SHA1Init(&ts->hash); + SHA1Init(&ts->oldhash); + SHA1Init(&ts->oldckhash); + + return ts; +} + +_TYPE( struct t_num * ) +t_servergenexp(ts) + struct t_server * ts; +{ + BigInteger b, B, v, n, g; + + if(ts->n.len < BLEN) + ts->b.len = ts->n.len; + else + ts->b.len = BLEN; + + t_random(ts->b.data, ts->b.len); + b = BigIntegerFromBytes(ts->b.data, ts->b.len); + n = BigIntegerFromBytes(ts->n.data, ts->n.len); + g = BigIntegerFromBytes(ts->g.data, ts->g.len); + B = BigIntegerFromInt(0); + BigIntegerModExp(B, g, b, n); + + v = BigIntegerFromBytes(ts->v.data, ts->v.len); + BigIntegerAdd(B, B, v); + if(BigIntegerCmp(B, n) > 0) + BigIntegerSub(B, B, n); + + ts->B.len = BigIntegerToBytes(B, ts->B.data); + + BigIntegerFree(v); + BigIntegerFree(B); + BigIntegerFree(b); + BigIntegerFree(g); + BigIntegerFree(n); + + SHA1Update(&ts->oldckhash, ts->B.data, ts->B.len); + + return &ts->B; +} + +_TYPE( unsigned char * ) +t_servergetkey(ts, clientval) + struct t_server * ts; + struct t_num * clientval; +{ + BigInteger n, v, A, b, prod, res, S; + SHA1_CTX ctxt; + unsigned char sbuf[MAXPARAMLEN]; + unsigned char dig[SHA_DIGESTSIZE]; + unsigned slen; + unsigned int u; + + SHA1Update(&ts->ckhash, clientval->data, clientval->len); + SHA1Update(&ts->ckhash, ts->B.data, ts->B.len); + + SHA1Init(&ctxt); + SHA1Update(&ctxt, ts->B.data, ts->B.len); + SHA1Final(dig, &ctxt); + u = (dig[0] << 24) | (dig[1] << 16) | (dig[2] << 8) | dig[3]; + + SHA1Update(&ts->oldhash, clientval->data, clientval->len); + SHA1Update(&ts->hash, clientval->data, clientval->len); + + n = BigIntegerFromBytes(ts->n.data, ts->n.len); + b = BigIntegerFromBytes(ts->b.data, ts->b.len); + v = BigIntegerFromBytes(ts->v.data, ts->v.len); + A = BigIntegerFromBytes(clientval->data, clientval->len); + + prod = BigIntegerFromInt(0); + BigIntegerModExpInt(prod, v, u, n); + res = BigIntegerFromInt(0); + BigIntegerModMul(res, prod, A, n); + + BigIntegerFree(A); + BigIntegerFree(v); + BigIntegerFree(prod); + + if(BigIntegerCmpInt(res, 1) <= 0) { /* Check for Av^u == 1 (mod n) */ + BigIntegerFree(res); + BigIntegerFree(b); + BigIntegerFree(n); + return NULL; + } + + S = BigIntegerFromInt(0); + + BigIntegerAddInt(S, res, 1); + if(BigIntegerCmp(S, n) == 0) { /* Check for Av^u == -1 (mod n) */ + BigIntegerFree(res); + BigIntegerFree(b); + BigIntegerFree(n); + BigIntegerFree(S); + return NULL; + } + + BigIntegerModExp(S, res, b, n); + slen = BigIntegerToBytes(S, sbuf); + + BigIntegerFree(S); + BigIntegerFree(res); + BigIntegerFree(b); + BigIntegerFree(n); + + t_sessionkey(ts->session_key, sbuf, slen); + memset(sbuf, 0, slen); + + SHA1Update(&ts->oldhash, ts->session_key, sizeof(ts->session_key)); + SHA1Update(&ts->oldckhash, ts->session_key, sizeof(ts->session_key)); + SHA1Update(&ts->ckhash, ts->session_key, sizeof(ts->session_key)); + + return ts->session_key; +} + +_TYPE( int ) +t_serververify(ts, resp) + struct t_server * ts; + unsigned char * resp; +{ + unsigned char expected[SHA_DIGESTSIZE]; + int i; + + SHA1Final(expected, &ts->oldckhash); + i = memcmp(expected, resp, sizeof(expected)); + if(i == 0) { + SHA1Final(ts->session_response, &ts->oldhash); + return 0; + } + SHA1Final(expected, &ts->ckhash); + i = memcmp(expected, resp, sizeof(expected)); + if(i == 0) { + SHA1Update(&ts->hash, expected, sizeof(expected)); + SHA1Update(&ts->hash, ts->session_key, sizeof(ts->session_key)); + SHA1Final(ts->session_response, &ts->hash); + } + return i; +} + +_TYPE( unsigned char * ) +t_serverresponse(ts) + struct t_server * ts; +{ + return ts->session_response; +} + +_TYPE( void ) +t_serverclose(ts) + struct t_server * ts; +{ + memset(ts->bbuf, 0, sizeof(ts->bbuf)); + memset(ts->vbuf, 0, sizeof(ts->vbuf)); + memset(ts->saltbuf, 0, sizeof(ts->saltbuf)); + memset(ts->session_key, 0, sizeof(ts->session_key)); + free(ts); +} diff --git a/package/network/services/ead/src/tinysrp/t_server.h b/package/network/services/ead/src/tinysrp/t_server.h new file mode 100644 index 0000000000..20970ffe06 --- /dev/null +++ b/package/network/services/ead/src/tinysrp/t_server.h @@ -0,0 +1,138 @@ +/* + * Copyright (c) 1997-1999 The Stanford SRP Authentication Project + * 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" AND WITHOUT WARRANTY OF ANY KIND, + * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY + * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. + * + * IN NO EVENT SHALL STANFORD BE LIABLE FOR ANY SPECIAL, INCIDENTAL, + * INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, OR ANY DAMAGES WHATSOEVER + * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER OR NOT ADVISED OF + * THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF LIABILITY, ARISING OUT + * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + * In addition, the following conditions apply: + * + * 1. Any software that incorporates the SRP authentication technology + * must display the following acknowlegment: + * "This product uses the 'Secure Remote Password' cryptographic + * authentication system developed by Tom Wu (tjw@CS.Stanford.EDU)." + * + * 2. Any software that incorporates all or part of the SRP distribution + * itself must also display the following acknowledgment: + * "This product includes software developed by Tom Wu and Eugene + * Jhong for the SRP Distribution (http://srp.stanford.edu/srp/)." + * + * 3. Redistributions in source or binary form must retain an intact copy + * of this copyright notice and list of conditions. + */ + +#ifndef T_SERVER_H +#define T_SERVER_H + +#include "t_sha.h" + +#if !defined(P) +#ifdef __STDC__ +#define P(x) x +#else +#define P(x) () +#endif +#endif + +#ifndef _DLLDECL +#define _DLLDECL + +#ifdef MSVC15 /* MSVC1.5 support for 16 bit apps */ +#define _MSVC15EXPORT _export +#define _MSVC20EXPORT +#define _DLLAPI _export _pascal +#define _TYPE(a) a _MSVC15EXPORT +#define DLLEXPORT 1 + +#elif MSVC20 +#define _MSVC15EXPORT +#define _MSVC20EXPORT _declspec(dllexport) +#define _DLLAPI +#define _TYPE(a) _MSVC20EXPORT a +#define DLLEXPORT 1 + +#else /* Default, non-dll. Use this for Unix or DOS */ +#define _MSVC15DEXPORT +#define _MSVC20EXPORT +#define _DLLAPI +#define _TYPE(a) a +#endif +#endif + +#define BLEN 32 + +struct t_server { + int index; + struct t_num n; + struct t_num g; + struct t_num v; + struct t_num s; + + struct t_num b; + struct t_num B; + + SHA1_CTX oldhash, hash, oldckhash, ckhash; + + unsigned char session_key[SESSION_KEY_LEN]; + unsigned char session_response[RESPONSE_LEN]; + + unsigned char nbuf[MAXPARAMLEN], gbuf[MAXPARAMLEN], vbuf[MAXPARAMLEN]; + unsigned char saltbuf[MAXSALTLEN], bbuf[BLEN], Bbuf[MAXPARAMLEN]; +}; + +/* + * SRP server-side negotiation + * + * This code negotiates the server side of an SRP exchange. + * "t_serveropen" accepts a username (sent by the client), a pointer + * to an open password file, and a pointer to an open configuration + * file. The server should then call... + * "t_servergenexp" will generate a random 256-bit exponent and + * raise g (from the configuration file) to that power, returning + * the result. This result should be sent to the client as y(p). + * "t_servergetkey" accepts the exponential w(p), which should be + * sent by the client, and computes the 256-bit session key. + * This data should be saved before the session is closed. + * "t_serverresponse" computes the session key proof as SHA(w(p), K). + * "t_serverclose" closes the session and frees its memory. + * + * Note that authentication is not performed per se; it is up + * to either/both sides of the protocol to now verify securely + * that their session keys agree in order to establish authenticity. + * One possible way is through "oracle hashing"; one side sends + * r, the other replies with H(r,K), where H() is a hash function. + * + * t_serverresponse and t_serververify now implement a version of + * the session-key verification described above. + */ +_TYPE( struct t_server * ) + t_serveropen P((const char *)); +_TYPE( struct t_server * ) + t_serveropenfromfiles P((const char *, struct t_pw *, struct t_conf *)); +_TYPE( struct t_server * ) + t_serveropenraw P((struct t_pwent *, struct t_confent *)); +_TYPE( struct t_num * ) t_servergenexp P((struct t_server *)); +_TYPE( unsigned char * ) t_servergetkey P((struct t_server *, struct t_num *)); +_TYPE( int ) t_serververify P((struct t_server *, unsigned char *)); +_TYPE( unsigned char * ) t_serverresponse P((struct t_server *)); +_TYPE( void ) t_serverclose P((struct t_server *)); + +#endif diff --git a/package/network/services/ead/src/tinysrp/t_sha.c b/package/network/services/ead/src/tinysrp/t_sha.c new file mode 100644 index 0000000000..cc41d6487c --- /dev/null +++ b/package/network/services/ead/src/tinysrp/t_sha.c @@ -0,0 +1,166 @@ +#include "t_defines.h" +#include "t_sha.h" + +/* +SHA-1 in C +By Steve Reid +100% Public Domain + +Test Vectors (from FIPS PUB 180-1) +"abc" + A9993E36 4706816A BA3E2571 7850C26C 9CD0D89D +"abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq" + 84983E44 1C3BD26E BAAE4AA1 F95129E5 E54670F1 +A million repetitions of "a" + 34AA973C D4C4DAA4 F61EEB2B DBAD2731 6534016F +*/ + +/* #define WORDS_BIGENDIAN * This should be #define'd if true. */ +/* #define SHA1HANDSOFF * Copies data before messing with it. */ + +#include +#include + +static void SHA1Transform(uint32 state[5], const unsigned char buffer[64]); + +#define rol(value, bits) (((value) << (bits)) | ((value) >> (32 - (bits)))) + +/* blk0() and blk() perform the initial expand. */ +/* I got the idea of expanding during the round function from SSLeay */ +#ifndef WORDS_BIGENDIAN +#define blk0(i) (block->l[i] = (rol(block->l[i],24)&0xFF00FF00) \ + |(rol(block->l[i],8)&0x00FF00FF)) +#else +#define blk0(i) block->l[i] +#endif +#define blk(i) (block->l[i&15] = rol(block->l[(i+13)&15]^block->l[(i+8)&15] \ + ^block->l[(i+2)&15]^block->l[i&15],1)) + +/* (R0+R1), R2, R3, R4 are the different operations used in SHA1 */ +#define R0(v,w,x,y,z,i) z+=((w&(x^y))^y)+blk0(i)+0x5A827999+rol(v,5);w=rol(w,30); +#define R1(v,w,x,y,z,i) z+=((w&(x^y))^y)+blk(i)+0x5A827999+rol(v,5);w=rol(w,30); +#define R2(v,w,x,y,z,i) z+=(w^x^y)+blk(i)+0x6ED9EBA1+rol(v,5);w=rol(w,30); +#define R3(v,w,x,y,z,i) z+=(((w|x)&y)|(w&x))+blk(i)+0x8F1BBCDC+rol(v,5);w=rol(w,30); +#define R4(v,w,x,y,z,i) z+=(w^x^y)+blk(i)+0xCA62C1D6+rol(v,5);w=rol(w,30); + +/* Hash a single 512-bit block. This is the core of the algorithm. */ + +static void SHA1Transform(uint32 state[5], const unsigned char buffer[64]) +{ +uint32 a, b, c, d, e; +typedef union { + unsigned char c[64]; + uint32 l[16]; +} CHAR64LONG16; +CHAR64LONG16* block; +#ifdef SHA1HANDSOFF +static unsigned char workspace[64]; + block = (CHAR64LONG16*)workspace; + memcpy(block, buffer, 64); +#else + block = (CHAR64LONG16*)buffer; +#endif + /* Copy context->state[] to working vars */ + a = state[0]; + b = state[1]; + c = state[2]; + d = state[3]; + e = state[4]; + /* 4 rounds of 20 operations each. Loop unrolled. */ + R0(a,b,c,d,e, 0); R0(e,a,b,c,d, 1); R0(d,e,a,b,c, 2); R0(c,d,e,a,b, 3); + R0(b,c,d,e,a, 4); R0(a,b,c,d,e, 5); R0(e,a,b,c,d, 6); R0(d,e,a,b,c, 7); + R0(c,d,e,a,b, 8); R0(b,c,d,e,a, 9); R0(a,b,c,d,e,10); R0(e,a,b,c,d,11); + R0(d,e,a,b,c,12); R0(c,d,e,a,b,13); R0(b,c,d,e,a,14); R0(a,b,c,d,e,15); + R1(e,a,b,c,d,16); R1(d,e,a,b,c,17); R1(c,d,e,a,b,18); R1(b,c,d,e,a,19); + R2(a,b,c,d,e,20); R2(e,a,b,c,d,21); R2(d,e,a,b,c,22); R2(c,d,e,a,b,23); + R2(b,c,d,e,a,24); R2(a,b,c,d,e,25); R2(e,a,b,c,d,26); R2(d,e,a,b,c,27); + R2(c,d,e,a,b,28); R2(b,c,d,e,a,29); R2(a,b,c,d,e,30); R2(e,a,b,c,d,31); + R2(d,e,a,b,c,32); R2(c,d,e,a,b,33); R2(b,c,d,e,a,34); R2(a,b,c,d,e,35); + R2(e,a,b,c,d,36); R2(d,e,a,b,c,37); R2(c,d,e,a,b,38); R2(b,c,d,e,a,39); + R3(a,b,c,d,e,40); R3(e,a,b,c,d,41); R3(d,e,a,b,c,42); R3(c,d,e,a,b,43); + R3(b,c,d,e,a,44); R3(a,b,c,d,e,45); R3(e,a,b,c,d,46); R3(d,e,a,b,c,47); + R3(c,d,e,a,b,48); R3(b,c,d,e,a,49); R3(a,b,c,d,e,50); R3(e,a,b,c,d,51); + R3(d,e,a,b,c,52); R3(c,d,e,a,b,53); R3(b,c,d,e,a,54); R3(a,b,c,d,e,55); + R3(e,a,b,c,d,56); R3(d,e,a,b,c,57); R3(c,d,e,a,b,58); R3(b,c,d,e,a,59); + R4(a,b,c,d,e,60); R4(e,a,b,c,d,61); R4(d,e,a,b,c,62); R4(c,d,e,a,b,63); + R4(b,c,d,e,a,64); R4(a,b,c,d,e,65); R4(e,a,b,c,d,66); R4(d,e,a,b,c,67); + R4(c,d,e,a,b,68); R4(b,c,d,e,a,69); R4(a,b,c,d,e,70); R4(e,a,b,c,d,71); + R4(d,e,a,b,c,72); R4(c,d,e,a,b,73); R4(b,c,d,e,a,74); R4(a,b,c,d,e,75); + R4(e,a,b,c,d,76); R4(d,e,a,b,c,77); R4(c,d,e,a,b,78); R4(b,c,d,e,a,79); + /* Add the working vars back into context.state[] */ + state[0] += a; + state[1] += b; + state[2] += c; + state[3] += d; + state[4] += e; + /* Wipe variables */ + a = b = c = d = e = 0; +} + + +/* SHA1Init - Initialize new context */ + +void SHA1Init(SHA1_CTX* context) +{ + /* SHA1 initialization constants */ + context->state[0] = 0x67452301; + context->state[1] = 0xEFCDAB89; + context->state[2] = 0x98BADCFE; + context->state[3] = 0x10325476; + context->state[4] = 0xC3D2E1F0; + context->count[0] = context->count[1] = 0; +} + + +/* Run your data through this. */ + +void SHA1Update(SHA1_CTX* context, const unsigned char* data, unsigned int len) +{ +unsigned int i, j; + + j = (context->count[0] >> 3) & 63; + if ((context->count[0] += len << 3) < (len << 3)) context->count[1]++; + context->count[1] += (len >> 29); + if ((j + len) > 63) { + memcpy(&context->buffer[j], data, (i = 64-j)); + SHA1Transform(context->state, context->buffer); + for ( ; i + 63 < len; i += 64) { + SHA1Transform(context->state, &data[i]); + } + j = 0; + } + else i = 0; + memcpy(&context->buffer[j], &data[i], len - i); +} + + +/* Add padding and return the message digest. */ + +void SHA1Final(unsigned char digest[20], SHA1_CTX* context) +{ +uint32 i, j; +unsigned char finalcount[8]; + + for (i = 0; i < 8; i++) { + finalcount[i] = (unsigned char)((context->count[(i >= 4 ? 0 : 1)] + >> ((3-(i & 3)) * 8) ) & 255); /* Endian independent */ + } + SHA1Update(context, (unsigned char *)"\200", 1); + while ((context->count[0] & 504) != 448) { + SHA1Update(context, (unsigned char *)"\0", 1); + } + SHA1Update(context, finalcount, 8); /* Should cause a SHA1Transform() */ + for (i = 0; i < 20; i++) { + digest[i] = (unsigned char) + ((context->state[i>>2] >> ((3-(i & 3)) * 8) ) & 255); + } + /* Wipe variables */ + i = j = 0; + memset(context->buffer, 0, 64); + memset(context->state, 0, 20); + memset(context->count, 0, 8); + memset(&finalcount, 0, 8); +#ifdef SHA1HANDSOFF /* make SHA1Transform overwrite its own static vars */ + SHA1Transform(context->state, context->buffer); +#endif +} diff --git a/package/network/services/ead/src/tinysrp/t_sha.h b/package/network/services/ead/src/tinysrp/t_sha.h new file mode 100644 index 0000000000..d10115e748 --- /dev/null +++ b/package/network/services/ead/src/tinysrp/t_sha.h @@ -0,0 +1,26 @@ +#ifndef T_SHA_H +#define T_SHA_H + +#if !defined(P) +#ifdef __STDC__ +#define P(x) x +#else +#define P(x) () +#endif +#endif + +#define SHA_DIGESTSIZE 20 + +typedef unsigned int uint32; + +typedef struct { + uint32 state[5]; + uint32 count[2]; + unsigned char buffer[64]; +} SHA1_CTX; + +void SHA1Init P((SHA1_CTX* context)); +void SHA1Update P((SHA1_CTX* context, const unsigned char* data, unsigned int len)); +void SHA1Final P((unsigned char digest[20], SHA1_CTX* context)); + +#endif /* T_SHA_H */ diff --git a/package/network/services/ead/src/tinysrp/t_truerand.c b/package/network/services/ead/src/tinysrp/t_truerand.c new file mode 100644 index 0000000000..fa0d6ce603 --- /dev/null +++ b/package/network/services/ead/src/tinysrp/t_truerand.c @@ -0,0 +1,151 @@ +/* + * Physically random numbers (very nearly uniform) + * D. P. Mitchell + * Modified by Matt Blaze 7/95 + */ +/* + * The authors of this software are Don Mitchell and Matt Blaze. + * Copyright (c) 1995 by AT&T. + * Permission to use, copy, and modify this software without fee + * is hereby granted, provided that this entire notice is included in + * all copies of any software which is or includes a copy or + * modification of this software and in all copies of the supporting + * documentation for such software. + * + * This software may be subject to United States export controls. + * + * THIS SOFTWARE IS BEING PROVIDED "AS IS", WITHOUT ANY EXPRESS OR IMPLIED + * WARRANTY. IN PARTICULAR, NEITHER THE AUTHORS NOR AT&T MAKE ANY + * REPRESENTATION OR WARRANTY OF ANY KIND CONCERNING THE MERCHANTABILITY + * OF THIS SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR PURPOSE. + */ + +/* + * WARNING: depending on the particular platform, raw_truerand() + * output may be biased or correlated. In general, you can expect + * about 16 bits of "pseudo-entropy" out of each 32 bit word returned + * by truerand(), but it may not be uniformly diffused. You should + * raw_therefore run the output through some post-whitening function + * (like MD5 or DES or whatever) before using it to generate key + * material. (RSAREF's random package does this for you when you feed + * raw_truerand() bits to the seed input function.) + * + * The application interface, for 8, 16, and 32 bit properly "whitened" + * random numbers, can be found in trand8(), trand16(), and trand32(). + * Use those instead of calling raw_truerand() directly. + * + * The basic idea here is that between clock "skew" and various + * hard-to-predict OS event arrivals, counting a tight loop will yield + * a little (maybe a third of a bit or so) of "good" randomness per + * interval clock tick. This seems to work well even on unloaded + * machines. If there is a human operator at the machine, you should + * augment truerand with other measure, like keyboard event timing. + * On server machines (e.g., when you need to generate a + * Diffie-Hellman secret) truerand alone may be good enough. + * + * Test these assumptions on your own platform before fielding a + * system based on this software or these techniques. + * + * This software seems to work well (at 10 or so bits per + * raw_truerand() call) on a Sun Sparc-20 under SunOS 4.1.3 and on a + * P100 under BSDI 2.0. You're on your own elsewhere. + * + */ + +#include "t_defines.h" + +#include +#include +#include +#include +#include + +#ifdef OLD_TRUERAND +static jmp_buf env; +#endif +static unsigned volatile count +#ifndef OLD_TRUERAND + , done = 0 +#endif +; + +static unsigned ocount; +static unsigned buffer; + +static void +tick() +{ + struct itimerval it, oit; + + it.it_interval.tv_sec = 0; + it.it_interval.tv_usec = 0; + it.it_value.tv_sec = 0; + it.it_value.tv_usec = 16665; + if (setitimer(ITIMER_REAL, &it, &oit) < 0) + perror("tick"); +} + +static void +interrupt() +{ + if (count) { +#ifdef OLD_TRUERAND + longjmp(env, 1); +#else + ++done; + return; +#endif + } + + (void) signal(SIGALRM, interrupt); + tick(); +} + +static unsigned long +roulette() +{ +#ifdef OLD_TRUERAND + if (setjmp(env)) { + count ^= (count>>3) ^ (count>>6) ^ ocount; + count &= 0x7; + ocount=count; + buffer = (buffer<<3) ^ count; + return buffer; + } +#else + done = 0; +#endif + (void) signal(SIGALRM, interrupt); + count = 0; + tick(); +#ifdef OLD_TRUERAND + for (;;) +#else + while(done == 0) +#endif + count++; /* about 1 MHz on VAX 11/780 */ +#ifndef OLD_TRUERAND + count ^= (count>>3) ^ (count>>6) ^ ocount; + count &= 0x7; + ocount=count; + buffer = (buffer<<3) ^ count; + return buffer; +#endif +} + +unsigned long +raw_truerand() +{ + count=0; + (void) roulette(); + (void) roulette(); + (void) roulette(); + (void) roulette(); + (void) roulette(); + (void) roulette(); + (void) roulette(); + (void) roulette(); + (void) roulette(); + (void) roulette(); + return roulette(); +} diff --git a/package/network/services/ead/src/tinysrp/tconf.c b/package/network/services/ead/src/tinysrp/tconf.c new file mode 100644 index 0000000000..ad77f4cc1d --- /dev/null +++ b/package/network/services/ead/src/tinysrp/tconf.c @@ -0,0 +1,157 @@ +/* + * Copyright (c) 1997-2000 The Stanford SRP Authentication Project + * 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" AND WITHOUT WARRANTY OF ANY KIND, + * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY + * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. + * + * IN NO EVENT SHALL STANFORD BE LIABLE FOR ANY SPECIAL, INCIDENTAL, + * INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, OR ANY DAMAGES WHATSOEVER + * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER OR NOT ADVISED OF + * THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF LIABILITY, ARISING OUT + * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + * In addition, the following conditions apply: + * + * 1. Any software that incorporates the SRP authentication technology + * must display the following acknowlegment: + * "This product uses the 'Secure Remote Password' cryptographic + * authentication system developed by Tom Wu (tjw@CS.Stanford.EDU)." + * + * 2. Any software that incorporates all or part of the SRP distribution + * itself must also display the following acknowledgment: + * "This product includes software developed by Tom Wu and Eugene + * Jhong for the SRP Distribution (http://srp.stanford.edu/srp/)." + * + * 3. Redistributions in source or binary form must retain an intact copy + * of this copyright notice and list of conditions. + */ + +#include /* close getlogin */ +#include /* atexit exit */ +#include +#include + +#include "t_pwd.h" + +#define MIN_BASIS_BITS 512 +#define BASIS_BITS 2048 + +extern int optind; +extern char *optarg; + +extern int errno; + +char *progName; + +int debug = 0; +int verbose = 0; +int composite = 0; + +int main(argc, argv) + int argc; + char *argv[]; +{ + char *chp; + char *configFile = NULL; + char cbuf[256]; + char b64buf[MAXB64PARAMLEN]; + int c, ch, i, lastidx, keylen, yesno, fsize, status, nparams; + FILE *efp; + + struct t_preconf * tpc; + struct t_conf tcs; + struct t_conf * tc = &tcs; + struct t_confent * tcent; + + progName = *argv; + if ((chp = strrchr(progName, '/')) != (char *) 0) progName = chp + 1; + + while ((ch = getopt(argc, argv, "dv2c:")) != EOF) + switch(ch) { + case 'c': + configFile = optarg; + break; + case 'v': + verbose++; + break; + case 'd': + debug++; + break; + case '2': + composite++; + break; + default: + fprintf(stderr, "usage: %s [-dv2] [-c configfile]\n", progName); + exit(1); + } + + argc -= optind; + argv += optind; + + lastidx = 0; + keylen = 0; + + tcent = t_newconfent(tc); + + printf("\nThis program will generate a set of parameters for the EPS\n"); + printf("password file. The size of these parameters, measured in bits,\n"); + printf("determines the level of security offered by SRP, and is related\n"); + printf("to the security of similarly-sized RSA or Diffie-Hellman keys.\n"); + printf("Choosing a predefined field is generally preferable to generating\n"); + printf("a new field because clients can avoid costly parameter verification.\n"); + printf("Either way, the values generated by this program are public and\n"); + printf("can even shared between systems.\n"); + + printf("\nEnter the new field size, in bits. Suggested sizes:\n\n"); + printf(" 512 (fast, minimally secure)\n"); + printf(" 768 (moderate security)\n"); + printf("1024 (most popular default)\n"); + printf("1536 (additional security, possibly slow)\n"); + printf("2048 (maximum supported security level)\n"); + printf("\nField size (%d to %d): ", MIN_BASIS_BITS, BASIS_BITS); + + fgets(cbuf, sizeof(cbuf), stdin); + fsize = atoi(cbuf); + if(fsize < MIN_BASIS_BITS || fsize > BASIS_BITS) { + fprintf(stderr, "%s: field size must be between %d and %d\n", + progName, MIN_BASIS_BITS, BASIS_BITS); + exit(1); + } + + if(fsize <= keylen) + fprintf(stderr, "Warning: new field size is not larger than old field size\n"); + + printf("\nInitializing random number generator..."); + fflush(stdout); + t_initrand(); + + if(composite) + printf("done.\n\nGenerating a %d-bit composite with safe prime factors. This may take a while.\n", fsize); + else + printf("done.\n\nGenerating a %d-bit safe prime. This may take a while.\n", fsize); + + while((tcent = (composite ? t_makeconfent_c(tc, fsize) : + t_makeconfent(tc, fsize))) == NULL) + printf("Parameter generation failed, retrying...\n"); + tcent->index = lastidx + 1; + + printf("\nParameters successfully generated.\n"); + printf("N = [%s]\n", t_tob64(b64buf, + tcent->modulus.data, tcent->modulus.len)); + printf("g = [%s]\n", t_tob64(b64buf, + tcent->generator.data, tcent->generator.len)); + printf("\nYou must update the pre_params array in t_getconf.c\n"); +} diff --git a/package/network/services/ead/src/tinysrp/tinysrp.c b/package/network/services/ead/src/tinysrp/tinysrp.c new file mode 100644 index 0000000000..fc01055417 --- /dev/null +++ b/package/network/services/ead/src/tinysrp/tinysrp.c @@ -0,0 +1,235 @@ +/* This bit implements a simple API for using the SRP library over sockets. */ + +#include +#include +#include +#include +#include +#include +#include "t_defines.h" +#include "t_pwd.h" +#include "t_server.h" +#include "t_client.h" +#include "tinysrp.h" + +#ifndef MSG_WAITALL +#ifdef linux +#define MSG_WAITALL 0x100 /* somehow not defined on my box */ +#endif +#endif + +/* This is called by the client with a connected socket, username, and +passphrase. pass can be NULL in which case the user is queried. */ + +int tsrp_client_authenticate(int s, char *user, char *pass, TSRP_SESSION *tsrp) +{ + int i, index; + unsigned char username[MAXUSERLEN + 1], sbuf[MAXSALTLEN]; + unsigned char msgbuf[MAXPARAMLEN + 1], bbuf[MAXPARAMLEN]; + unsigned char passbuf[128], *skey; + struct t_client *tc; + struct t_preconf *tcp; /* @@@ should go away */ + struct t_num salt, *A, B; + + /* Send the username. */ + + i = strlen(user); + if (i > MAXUSERLEN) { + i = MAXUSERLEN; + } + msgbuf[0] = i; + memcpy(msgbuf + 1, user, i); + if (send(s, msgbuf, i + 1, 0) < 0) { + return 0; + } + memcpy(username, user, i); + username[i] = '\0'; + + /* Get the prime index and salt. */ + + i = recv(s, msgbuf, 2, MSG_WAITALL); + if (i <= 0) { + return 0; + } + index = msgbuf[0]; + if (index <= 0 || index > t_getprecount()) { + return 0; + } + tcp = t_getpreparam(index - 1); + salt.len = msgbuf[1]; + if (salt.len > MAXSALTLEN) { + return 0; + } + salt.data = sbuf; + i = recv(s, sbuf, salt.len, MSG_WAITALL); + if (i <= 0) { + return 0; + } + + /* @@@ t_clientopen() needs a variant that takes the index */ + + tc = t_clientopen(username, &tcp->modulus, &tcp->generator, &salt); + if (tc == NULL) { + return 0; + } + + /* Calculate A and send it to the server. */ + + A = t_clientgenexp(tc); + msgbuf[0] = A->len - 1; /* len is max 256 */ + memcpy(msgbuf + 1, A->data, A->len); + if (send(s, msgbuf, A->len + 1, 0) < 0) { + return 0; + } + + /* Ask the user for the passphrase. */ + + if (pass == NULL) { + t_getpass(passbuf, sizeof(passbuf), "Enter password:"); + pass = passbuf; + } + t_clientpasswd(tc, pass); + + /* Get B from the server. */ + + i = recv(s, msgbuf, 1, 0); + if (i <= 0) { + return 0; + } + B.len = msgbuf[0] + 1; + B.data = bbuf; + i = recv(s, bbuf, B.len, MSG_WAITALL); + if (i <= 0) { + return 0; + } + + /* Compute the session key. */ + + skey = t_clientgetkey(tc, &B); + if (skey == NULL) { + return 0; + } + + /* Send the response. */ + + if (send(s, t_clientresponse(tc), RESPONSE_LEN, 0) < 0) { + return 0; + } + + /* Get the server's response. */ + + i = recv(s, msgbuf, RESPONSE_LEN, MSG_WAITALL); + if (i <= 0) { + return 0; + } + if (t_clientverify(tc, msgbuf) != 0) { + return 0; + } + + /* All done. Now copy the key and clean up. */ + + if (tsrp) { + memcpy(tsrp->username, username, strlen(username) + 1); + memcpy(tsrp->key, skey, SESSION_KEY_LEN); + } + t_clientclose(tc); + + return 1; +} + +/* This is called by the server with a connected socket. */ + +int tsrp_server_authenticate(int s, TSRP_SESSION *tsrp) +{ + int i, j; + unsigned char username[MAXUSERLEN], *skey; + unsigned char msgbuf[MAXPARAMLEN + 1], abuf[MAXPARAMLEN]; + struct t_server *ts; + struct t_num A, *B; + + /* Get the username. */ + + i = recv(s, msgbuf, 1, 0); + if (i <= 0) { + return 0; + } + j = msgbuf[0]; + i = recv(s, username, j, MSG_WAITALL); + if (i <= 0) { + return 0; + } + username[j] = '\0'; + + ts = t_serveropen(username); + if (ts == NULL) { + return 0; + } + + /* Send the prime index and the salt. */ + + msgbuf[0] = ts->index; /* max 256 primes... */ + i = ts->s.len; + msgbuf[1] = i; + memcpy(msgbuf + 2, ts->s.data, i); + if (send(s, msgbuf, i + 2, 0) < 0) { + return 0; + } + + /* Calculate B while we're waiting. */ + + B = t_servergenexp(ts); + + /* Get A from the client. */ + + i = recv(s, msgbuf, 1, 0); + if (i <= 0) { + return 0; + } + A.len = msgbuf[0] + 1; + A.data = abuf; + i = recv(s, abuf, A.len, MSG_WAITALL); + if (i <= 0) { + return 0; + } + + /* Now send B. */ + + msgbuf[0] = B->len - 1; + memcpy(msgbuf + 1, B->data, B->len); + if (send(s, msgbuf, B->len + 1, 0) < 0) { + return 0; + } + + /* Calculate the session key while we're waiting. */ + + skey = t_servergetkey(ts, &A); + if (skey == NULL) { + return 0; + } + + /* Get the response from the client. */ + + i = recv(s, msgbuf, RESPONSE_LEN, MSG_WAITALL); + if (i <= 0) { + return 0; + } + if (t_serververify(ts, msgbuf) != 0) { + return 0; + } + + /* Client authenticated. Now authenticate ourselves to the client. */ + + if (send(s, t_serverresponse(ts), RESPONSE_LEN, 0) < 0) { + return 0; + } + + /* Copy the key and clean up. */ + + if (tsrp) { + memcpy(tsrp->username, username, strlen(username) + 1); + memcpy(tsrp->key, skey, SESSION_KEY_LEN); + } + t_serverclose(ts); + + return 1; +} diff --git a/package/network/services/ead/src/tinysrp/tinysrp.h b/package/network/services/ead/src/tinysrp/tinysrp.h new file mode 100644 index 0000000000..4420a196a3 --- /dev/null +++ b/package/network/services/ead/src/tinysrp/tinysrp.h @@ -0,0 +1,18 @@ +/* Simple API for the tinysrp library. */ + +#ifndef T_PWD_H +#define MAXUSERLEN 32 +#define SESSION_KEY_LEN 40 /* 320-bit session key */ +#endif + +typedef struct { + char username[MAXUSERLEN + 1]; + unsigned char key[SESSION_KEY_LEN]; +} TSRP_SESSION; + +/* These functions are passed a connected socket, and return true for a +successful authentication. If tsrp is not NULL, the username and key +fields are filled in. */ + +extern int tsrp_server_authenticate(int s, TSRP_SESSION *tsrp); +extern int tsrp_client_authenticate(int s, char *user, char *pass, TSRP_SESSION *tsrp); diff --git a/package/network/services/ead/src/tinysrp/tpasswd b/package/network/services/ead/src/tinysrp/tpasswd new file mode 100644 index 0000000000..2ac7e2a1b6 --- /dev/null +++ b/package/network/services/ead/src/tinysrp/tpasswd @@ -0,0 +1,2 @@ +moo:A9lHvOGAMJvw1m3vcDsQRUFovh6/QUmLDKqwhv.drKQzbE9nS7HrOZLUPx2MmS6ewwybN8RHqpWqnUJRCMFT14FMbYXR7kYNUUQNx43A7F.xrVOU7tlFq5NjoK9sfFtp6PMdbIOP5wzWmipiNFlCOu4sjlSZb.o7C1chLzTKU.0:19AI0Hc9jEkdFc:5 +new user:1FsanML2fbTOEsa072bLjyRD1LEqoRD2GwElfN0VmHeR.FAg5A.2.G5bTjIHmMmHL60kgoAHJZhRrgopalYmujlyAuQoKiHJb98SHm1oJaQ9nl/DrZCvfyw5LpVMqg.CupdiWz6OtmOz8fwC96ItExFnNDt6SmsVDIOn4HqXG6C0lLaqEvcqlN3gFDlJXyP2yldM.LJ1TkHTHmA3DjRkmWEUL3mWEgzkEHyPcRB3Jd5ncDT7jaNbJTTLRoOtgRsaqE7OXuPADoK8MGBcUquYBRrGwyU4Y/wW4gLc3QmV793zxkk.P3.dxkLSjro/Kk94D7kC6fx3K9tadLJyzd94rr:3v/KRlxT0.oYF1:1 diff --git a/package/network/services/ead/src/tinysrp/tphrase.c b/package/network/services/ead/src/tinysrp/tphrase.c new file mode 100644 index 0000000000..0ab1e085c1 --- /dev/null +++ b/package/network/services/ead/src/tinysrp/tphrase.c @@ -0,0 +1,354 @@ +/* Add passphrases to the tpasswd file. Use the last entry in the config +file by default or a particular one specified by index. */ + +#include +#include +#include +#include +#include +#include +#include "config.h" +#include "t_pwd.h" +#include "t_read.h" +#include "t_sha.h" +#include "t_defines.h" + +char *Progname; +char Usage[] = "usage: %s [-n configindex] [-p passfile] user\n"; +#define USAGE() fprintf(stderr, Usage, Progname) + +void doit(char *); + +int Configindex = -1; +char *Passfile = DEFAULT_PASSWD; + +int main(int argc, char **argv) +{ + int c; + + Progname = *argv; + + /* Parse option arguments. */ + + while ((c = getopt(argc, argv, "n:p:")) != EOF) { + switch (c) { + + case 'n': + Configindex = atoi(optarg); + break; + + case 'p': + Passfile = optarg; + break; + + default: + USAGE(); + exit(1); + } + } + argc -= optind; + argv += optind; + + if (argc != 1) { + USAGE(); + exit(1); + } + doit(argv[0]); + + return 0; +} + +void doit(char *name) +{ + char passphrase[128], passphrase1[128]; + FILE *f; + struct t_confent *tcent; + struct t_pw eps_passwd; + + /* Get the config entry. */ + + if (Configindex <= 0) { + Configindex = t_getprecount(); + } + tcent = gettcid(Configindex); + if (tcent == NULL) { + fprintf(stderr, "Invalid configuration file entry.\n"); + exit(1); + } + + /* Ask for the passphrase twice. */ + + printf("Setting passphrase for %s\n", name); + + if (t_getpass(passphrase, sizeof(passphrase), "Enter passphrase: ") < 0) { + exit(1); + } + if (t_getpass(passphrase1, sizeof(passphrase1), "Verify: ") < 0) { + exit(1); + } + if (strcmp(passphrase, passphrase1) != 0) { + fprintf(stderr, "mismatch\n"); + exit(1); + } + + /* Create the passphrase verifier. */ + + t_makepwent(&eps_passwd, name, passphrase, NULL, tcent); + + /* Don't need these anymore. */ + + memset(passphrase, 0, sizeof(passphrase)); + memset(passphrase1, 0, sizeof(passphrase1)); + + /* See if the passphrase file is there; create it if not. */ + + if ((f = fopen(Passfile, "r+")) == NULL) { + creat(Passfile, 0400); + } else { + fclose(f); + } + + /* Change the passphrase. */ + + if (t_changepw(Passfile, &eps_passwd.pebuf) < 0) { + fprintf(stderr, "Error changing passphrase\n"); + exit(1); + } +} + +/* TODO: Implement a more general method to handle delete/change */ + +_TYPE( int ) +t_changepw(pwname, diff) + const char * pwname; + const struct t_pwent * diff; +{ + char * bakfile; + char * bakfile2; + struct stat st; + FILE * passfp; + FILE * bakfp; + + if(pwname == NULL) + pwname = DEFAULT_PASSWD; + + if((passfp = fopen(pwname, "rb")) == NULL || fstat(fileno(passfp), &st) < 0) + return -1; + + if((bakfile = malloc(strlen(pwname) + 5)) == NULL) { + fclose(passfp); + return -1; + } + else if((bakfile2 = malloc(strlen(pwname) + 5)) == NULL) { + fclose(passfp); + free(bakfile); + return -1; + } + + sprintf(bakfile, "%s.bak", pwname); + sprintf(bakfile2, "%s.sav", pwname); + + if((bakfp = fopen(bakfile2, "wb")) == NULL && + (unlink(bakfile2) < 0 || (bakfp = fopen(bakfile2, "wb")) == NULL)) { + fclose(passfp); + free(bakfile); + free(bakfile2); + return -1; + } + +#ifdef NO_FCHMOD + chmod(bakfile2, st.st_mode & 0777); +#else + fchmod(fileno(bakfp), st.st_mode & 0777); +#endif + + t_pwcopy(bakfp, passfp, diff); + + fclose(bakfp); + fclose(passfp); + +#ifdef USE_RENAME + unlink(bakfile); + if(rename(pwname, bakfile) < 0) { + free(bakfile); + free(bakfile2); + return -1; + } + if(rename(bakfile2, pwname) < 0) { + free(bakfile); + free(bakfile2); + return -1; + } +#else + unlink(bakfile); + link(pwname, bakfile); + unlink(pwname); + link(bakfile2, pwname); + unlink(bakfile2); +#endif + free(bakfile); + free(bakfile2); + + return 0; +} + +_TYPE( struct t_pwent * ) +t_makepwent(tpw, user, pass, salt, confent) + struct t_pw * tpw; + const char * user; + const char * pass; + const struct t_num * salt; + const struct t_confent * confent; +{ + BigInteger x, v, n, g; + unsigned char dig[SHA_DIGESTSIZE]; + SHA1_CTX ctxt; + + tpw->pebuf.name = tpw->userbuf; + tpw->pebuf.password.data = tpw->pwbuf; + tpw->pebuf.salt.data = tpw->saltbuf; + + strncpy(tpw->pebuf.name, user, MAXUSERLEN); + tpw->pebuf.index = confent->index; + + if(salt) { + tpw->pebuf.salt.len = salt->len; + memcpy(tpw->pebuf.salt.data, salt->data, salt->len); + } + else { + memset(dig, 0, SALTLEN); /* salt is 80 bits */ + tpw->pebuf.salt.len = SALTLEN; + do { + t_random(tpw->pebuf.salt.data, SALTLEN); + } while(memcmp(tpw->pebuf.salt.data, dig, SALTLEN) == 0); + if(tpw->pebuf.salt.data[0] == 0) + tpw->pebuf.salt.data[0] = 0xff; + } + + n = BigIntegerFromBytes(confent->modulus.data, confent->modulus.len); + g = BigIntegerFromBytes(confent->generator.data, confent->generator.len); + v = BigIntegerFromInt(0); + + SHA1Init(&ctxt); + SHA1Update(&ctxt, user, strlen(user)); + SHA1Update(&ctxt, ":", 1); + SHA1Update(&ctxt, pass, strlen(pass)); + SHA1Final(dig, &ctxt); + + SHA1Init(&ctxt); + SHA1Update(&ctxt, tpw->pebuf.salt.data, tpw->pebuf.salt.len); + SHA1Update(&ctxt, dig, sizeof(dig)); + SHA1Final(dig, &ctxt); + + /* x = H(s, H(u, ':', p)) */ + x = BigIntegerFromBytes(dig, sizeof(dig)); + + BigIntegerModExp(v, g, x, n); + tpw->pebuf.password.len = BigIntegerToBytes(v, tpw->pebuf.password.data); + + BigIntegerFree(v); + BigIntegerFree(x); + BigIntegerFree(g); + BigIntegerFree(n); + + return &tpw->pebuf; +} + +int +t_pwcopy(pwdest, pwsrc, diff) + FILE * pwdest; + FILE * pwsrc; + struct t_pwent * diff; +{ + struct t_pw * src; + struct t_pwent * ent; + + if((src = t_openpw(pwsrc)) == NULL) + return -1; + + while((ent = t_getpwent(src)) != NULL) + if(diff && strcmp(diff->name, ent->name) == 0) { + t_putpwent(diff, pwdest); + diff = NULL; + } + else + t_putpwent(ent, pwdest); + + if(diff) + t_putpwent(diff, pwdest); + + return 0; +} + +_TYPE( struct t_pwent * ) +t_getpwent(tpw) + struct t_pw * tpw; +{ + char indexbuf[16]; + char passbuf[MAXB64PARAMLEN]; + char saltstr[MAXB64SALTLEN]; + +#ifdef ENABLE_YP + struct t_passwd * nisent; + /* FIXME: should tell caller to get conf entry from NIS also */ + + if(tpw->state == IN_NIS) { + nisent = _yp_gettpent(); + if(nisent != NULL) { + savepwent(tpw, &nisent->tp); + return &tpw->pebuf; + } + tpw->state = FILE_NIS; + } +#endif + + while(1) { + if(t_nextfield(tpw->instream, tpw->userbuf, MAXUSERLEN) > 0) { +#ifdef ENABLE_YP + if(tpw->state == FILE_NIS && *tpw->userbuf == '+') { + t_nextline(tpw->instream); + if(strlen(tpw->userbuf) > 1) { /* +name:... */ + nisent = _yp_gettpnam(tpw->userbuf + 1); + if(nisent != NULL) { + savepwent(tpw, nisent); + return &tpw->pebuf; + } + } + else { /* +:... */ + tpw->state = IN_NIS; + _yp_settpent(); + return t_getpwent(tpw); + } + } +#endif + if(t_nextfield(tpw->instream, passbuf, MAXB64PARAMLEN) > 0 && + (tpw->pebuf.password.len = t_fromb64(tpw->pwbuf, passbuf)) > 0 && + t_nextfield(tpw->instream, saltstr, MAXB64SALTLEN) > 0 && + (tpw->pebuf.salt.len = t_fromb64(tpw->saltbuf, saltstr)) > 0 && + t_nextfield(tpw->instream, indexbuf, 16) > 0 && + (tpw->pebuf.index = atoi(indexbuf)) > 0) { + tpw->pebuf.name = tpw->userbuf; + tpw->pebuf.password.data = tpw->pwbuf; + tpw->pebuf.salt.data = tpw->saltbuf; + t_nextline(tpw->instream); + return &tpw->pebuf; + } + } + if(t_nextline(tpw->instream) < 0) + return NULL; + } +} + +_TYPE( void ) +t_putpwent(ent, fp) + const struct t_pwent * ent; + FILE * fp; +{ + char strbuf[MAXB64PARAMLEN]; + char saltbuf[MAXB64SALTLEN]; + + fprintf(fp, "%s:%s:%s:%d\n", ent->name, + t_tob64(strbuf, ent->password.data, ent->password.len), + t_tob64(saltbuf, ent->salt.data, ent->salt.len), ent->index); +} + diff --git a/package/network/services/hostapd/Makefile b/package/network/services/hostapd/Makefile index f531e660ff..235f178bc9 100644 --- a/package/network/services/hostapd/Makefile +++ b/package/network/services/hostapd/Makefile @@ -7,7 +7,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=hostapd -PKG_RELEASE:=2 +PKG_RELEASE:=6 PKG_SOURCE_URL:=http://w1.fi/hostap.git PKG_SOURCE_PROTO:=git diff --git a/package/network/services/hostapd/patches/061-0001-OpenSSL-Use-constant-time-operations-for-private-big.patch b/package/network/services/hostapd/patches/061-0001-OpenSSL-Use-constant-time-operations-for-private-big.patch new file mode 100644 index 0000000000..7a73b09ff9 --- /dev/null +++ b/package/network/services/hostapd/patches/061-0001-OpenSSL-Use-constant-time-operations-for-private-big.patch @@ -0,0 +1,88 @@ +From d42c477cc794163a3757956bbffca5cea000923c Mon Sep 17 00:00:00 2001 +From: Jouni Malinen +Date: Tue, 26 Feb 2019 11:43:03 +0200 +Subject: [PATCH 01/14] OpenSSL: Use constant time operations for private + bignums + +This helps in reducing measurable timing differences in operations +involving private information. BoringSSL has removed BN_FLG_CONSTTIME +and expects specific constant time functions to be called instead, so a +bit different approach is needed depending on which library is used. + +The main operation that needs protection against side channel attacks is +BN_mod_exp() that depends on private keys (the public key validation +step in crypto_dh_derive_secret() is an exception that can use the +faster version since it does not depend on private keys). + +crypto_bignum_div() is currently used only in SAE FFC case with not +safe-prime groups and only with values that do not depend on private +keys, so it is not critical to protect it. + +crypto_bignum_inverse() is currently used only in SAE FFC PWE +derivation. The additional protection here is targeting only OpenSSL. +BoringSSL may need conversion to using BN_mod_inverse_blinded(). + +This is related to CVE-2019-9494 and CVE-2019-9495. + +Signed-off-by: Jouni Malinen +--- + src/crypto/crypto_openssl.c | 20 +++++++++++++++----- + 1 file changed, 15 insertions(+), 5 deletions(-) + +--- a/src/crypto/crypto_openssl.c ++++ b/src/crypto/crypto_openssl.c +@@ -549,7 +549,8 @@ int crypto_mod_exp(const u8 *base, size_ + bn_result == NULL) + goto error; + +- if (BN_mod_exp(bn_result, bn_base, bn_exp, bn_modulus, ctx) != 1) ++ if (BN_mod_exp_mont_consttime(bn_result, bn_base, bn_exp, bn_modulus, ++ ctx, NULL) != 1) + goto error; + + *result_len = BN_bn2bin(bn_result, result); +@@ -1295,8 +1296,9 @@ int crypto_bignum_exptmod(const struct c + bnctx = BN_CTX_new(); + if (bnctx == NULL) + return -1; +- res = BN_mod_exp((BIGNUM *) d, (const BIGNUM *) a, (const BIGNUM *) b, +- (const BIGNUM *) c, bnctx); ++ res = BN_mod_exp_mont_consttime((BIGNUM *) d, (const BIGNUM *) a, ++ (const BIGNUM *) b, (const BIGNUM *) c, ++ bnctx, NULL); + BN_CTX_free(bnctx); + + return res ? 0 : -1; +@@ -1315,6 +1317,11 @@ int crypto_bignum_inverse(const struct c + bnctx = BN_CTX_new(); + if (bnctx == NULL) + return -1; ++#ifdef OPENSSL_IS_BORINGSSL ++ /* TODO: use BN_mod_inverse_blinded() ? */ ++#else /* OPENSSL_IS_BORINGSSL */ ++ BN_set_flags((BIGNUM *) a, BN_FLG_CONSTTIME); ++#endif /* OPENSSL_IS_BORINGSSL */ + res = BN_mod_inverse((BIGNUM *) c, (const BIGNUM *) a, + (const BIGNUM *) b, bnctx); + BN_CTX_free(bnctx); +@@ -1348,6 +1355,9 @@ int crypto_bignum_div(const struct crypt + bnctx = BN_CTX_new(); + if (bnctx == NULL) + return -1; ++#ifndef OPENSSL_IS_BORINGSSL ++ BN_set_flags((BIGNUM *) a, BN_FLG_CONSTTIME); ++#endif /* OPENSSL_IS_BORINGSSL */ + res = BN_div((BIGNUM *) c, NULL, (const BIGNUM *) a, + (const BIGNUM *) b, bnctx); + BN_CTX_free(bnctx); +@@ -1439,8 +1449,8 @@ int crypto_bignum_legendre(const struct + /* exp = (p-1) / 2 */ + !BN_sub(exp, (const BIGNUM *) p, BN_value_one()) || + !BN_rshift1(exp, exp) || +- !BN_mod_exp(tmp, (const BIGNUM *) a, exp, (const BIGNUM *) p, +- bnctx)) ++ !BN_mod_exp_mont_consttime(tmp, (const BIGNUM *) a, exp, ++ (const BIGNUM *) p, bnctx, NULL)) + goto fail; + + if (BN_is_word(tmp, 1)) diff --git a/package/network/services/hostapd/patches/061-0002-Add-helper-functions-for-constant-time-operations.patch b/package/network/services/hostapd/patches/061-0002-Add-helper-functions-for-constant-time-operations.patch new file mode 100644 index 0000000000..87e41aea87 --- /dev/null +++ b/package/network/services/hostapd/patches/061-0002-Add-helper-functions-for-constant-time-operations.patch @@ -0,0 +1,212 @@ +From 6e34f618d37ddbb5854c42e2ad4fca83492fa7b7 Mon Sep 17 00:00:00 2001 +From: Jouni Malinen +Date: Wed, 27 Feb 2019 18:38:30 +0200 +Subject: [PATCH 02/14] Add helper functions for constant time operations + +These functions can be used to help implement constant time operations +for various cryptographic operations that must minimize externally +observable differences in processing (both in timing and also in +internal cache use, etc.). + +This is related to CVE-2019-9494 and CVE-2019-9495. + +Signed-off-by: Jouni Malinen +--- + src/utils/const_time.h | 191 +++++++++++++++++++++++++++++++++++++++++++++++++ + 1 file changed, 191 insertions(+) + create mode 100644 src/utils/const_time.h + +--- /dev/null ++++ b/src/utils/const_time.h +@@ -0,0 +1,191 @@ ++/* ++ * Helper functions for constant time operations ++ * Copyright (c) 2019, The Linux Foundation ++ * ++ * This software may be distributed under the terms of the BSD license. ++ * See README for more details. ++ * ++ * These helper functions can be used to implement logic that needs to minimize ++ * externally visible differences in execution path by avoiding use of branches, ++ * avoiding early termination or other time differences, and forcing same memory ++ * access pattern regardless of values. ++ */ ++ ++#ifndef CONST_TIME_H ++#define CONST_TIME_H ++ ++ ++#if defined(__clang__) ++#define NO_UBSAN_UINT_OVERFLOW \ ++ __attribute__((no_sanitize("unsigned-integer-overflow"))) ++#else ++#define NO_UBSAN_UINT_OVERFLOW ++#endif ++ ++ ++/** ++ * const_time_fill_msb - Fill all bits with MSB value ++ * @val: Input value ++ * Returns: Value with all the bits set to the MSB of the input val ++ */ ++static inline unsigned int const_time_fill_msb(unsigned int val) ++{ ++ /* Move the MSB to LSB and multiple by -1 to fill in all bits. */ ++ return (val >> (sizeof(val) * 8 - 1)) * ~0U; ++} ++ ++ ++/* Returns: -1 if val is zero; 0 if val is not zero */ ++static inline unsigned int const_time_is_zero(unsigned int val) ++ NO_UBSAN_UINT_OVERFLOW ++{ ++ /* Set MSB to 1 for 0 and fill rest of bits with the MSB value */ ++ return const_time_fill_msb(~val & (val - 1)); ++} ++ ++ ++/* Returns: -1 if a == b; 0 if a != b */ ++static inline unsigned int const_time_eq(unsigned int a, unsigned int b) ++{ ++ return const_time_is_zero(a ^ b); ++} ++ ++ ++/* Returns: -1 if a == b; 0 if a != b */ ++static inline u8 const_time_eq_u8(unsigned int a, unsigned int b) ++{ ++ return (u8) const_time_eq(a, b); ++} ++ ++ ++/** ++ * const_time_eq_bin - Constant time memory comparison ++ * @a: First buffer to compare ++ * @b: Second buffer to compare ++ * @len: Number of octets to compare ++ * Returns: -1 if buffers are equal, 0 if not ++ * ++ * This function is meant for comparing passwords or hash values where ++ * difference in execution time or memory access pattern could provide external ++ * observer information about the location of the difference in the memory ++ * buffers. The return value does not behave like memcmp(), i.e., ++ * const_time_eq_bin() cannot be used to sort items into a defined order. Unlike ++ * memcmp(), the execution time of const_time_eq_bin() does not depend on the ++ * contents of the compared memory buffers, but only on the total compared ++ * length. ++ */ ++static inline unsigned int const_time_eq_bin(const void *a, const void *b, ++ size_t len) ++{ ++ const u8 *aa = a; ++ const u8 *bb = b; ++ size_t i; ++ u8 res = 0; ++ ++ for (i = 0; i < len; i++) ++ res |= aa[i] ^ bb[i]; ++ ++ return const_time_is_zero(res); ++} ++ ++ ++/** ++ * const_time_select - Constant time unsigned int selection ++ * @mask: 0 (false) or -1 (true) to identify which value to select ++ * @true_val: Value to select for the true case ++ * @false_val: Value to select for the false case ++ * Returns: true_val if mask == -1, false_val if mask == 0 ++ */ ++static inline unsigned int const_time_select(unsigned int mask, ++ unsigned int true_val, ++ unsigned int false_val) ++{ ++ return (mask & true_val) | (~mask & false_val); ++} ++ ++ ++/** ++ * const_time_select_int - Constant time int selection ++ * @mask: 0 (false) or -1 (true) to identify which value to select ++ * @true_val: Value to select for the true case ++ * @false_val: Value to select for the false case ++ * Returns: true_val if mask == -1, false_val if mask == 0 ++ */ ++static inline int const_time_select_int(unsigned int mask, int true_val, ++ int false_val) ++{ ++ return (int) const_time_select(mask, (unsigned int) true_val, ++ (unsigned int) false_val); ++} ++ ++ ++/** ++ * const_time_select_u8 - Constant time u8 selection ++ * @mask: 0 (false) or -1 (true) to identify which value to select ++ * @true_val: Value to select for the true case ++ * @false_val: Value to select for the false case ++ * Returns: true_val if mask == -1, false_val if mask == 0 ++ */ ++static inline u8 const_time_select_u8(u8 mask, u8 true_val, u8 false_val) ++{ ++ return (u8) const_time_select(mask, true_val, false_val); ++} ++ ++ ++/** ++ * const_time_select_s8 - Constant time s8 selection ++ * @mask: 0 (false) or -1 (true) to identify which value to select ++ * @true_val: Value to select for the true case ++ * @false_val: Value to select for the false case ++ * Returns: true_val if mask == -1, false_val if mask == 0 ++ */ ++static inline s8 const_time_select_s8(u8 mask, s8 true_val, s8 false_val) ++{ ++ return (s8) const_time_select(mask, (unsigned int) true_val, ++ (unsigned int) false_val); ++} ++ ++ ++/** ++ * const_time_select_bin - Constant time binary buffer selection copy ++ * @mask: 0 (false) or -1 (true) to identify which value to copy ++ * @true_val: Buffer to copy for the true case ++ * @false_val: Buffer to copy for the false case ++ * @len: Number of octets to copy ++ * @dst: Destination buffer for the copy ++ * ++ * This function copies the specified buffer into the destination buffer using ++ * operations with identical memory access pattern regardless of which buffer ++ * is being copied. ++ */ ++static inline void const_time_select_bin(u8 mask, const u8 *true_val, ++ const u8 *false_val, size_t len, ++ u8 *dst) ++{ ++ size_t i; ++ ++ for (i = 0; i < len; i++) ++ dst[i] = const_time_select_u8(mask, true_val[i], false_val[i]); ++} ++ ++ ++static inline int const_time_memcmp(const void *a, const void *b, size_t len) ++{ ++ const u8 *aa = a; ++ const u8 *bb = b; ++ int diff, res = 0; ++ unsigned int mask; ++ ++ if (len == 0) ++ return 0; ++ do { ++ len--; ++ diff = (int) aa[len] - (int) bb[len]; ++ mask = const_time_is_zero((unsigned int) diff); ++ res = const_time_select_int(mask, res, diff); ++ } while (len); ++ ++ return res; ++} ++ ++#endif /* CONST_TIME_H */ diff --git a/package/network/services/hostapd/patches/061-0003-OpenSSL-Use-constant-time-selection-for-crypto_bignu.patch b/package/network/services/hostapd/patches/061-0003-OpenSSL-Use-constant-time-selection-for-crypto_bignu.patch new file mode 100644 index 0000000000..0d89b46cb3 --- /dev/null +++ b/package/network/services/hostapd/patches/061-0003-OpenSSL-Use-constant-time-selection-for-crypto_bignu.patch @@ -0,0 +1,55 @@ +From c93461c1d98f52681717a088776ab32fd97872b0 Mon Sep 17 00:00:00 2001 +From: Jouni Malinen +Date: Fri, 8 Mar 2019 00:24:12 +0200 +Subject: [PATCH 03/14] OpenSSL: Use constant time selection for + crypto_bignum_legendre() + +Get rid of the branches that depend on the result of the Legendre +operation. This is needed to avoid leaking information about different +temporary results in blinding mechanisms. + +This is related to CVE-2019-9494 and CVE-2019-9495. + +Signed-off-by: Jouni Malinen +--- + src/crypto/crypto_openssl.c | 15 +++++++++------ + 1 file changed, 9 insertions(+), 6 deletions(-) + +--- a/src/crypto/crypto_openssl.c ++++ b/src/crypto/crypto_openssl.c +@@ -24,6 +24,7 @@ + #endif /* CONFIG_ECC */ + + #include "common.h" ++#include "utils/const_time.h" + #include "wpabuf.h" + #include "dh_group5.h" + #include "sha1.h" +@@ -1435,6 +1436,7 @@ int crypto_bignum_legendre(const struct + BN_CTX *bnctx; + BIGNUM *exp = NULL, *tmp = NULL; + int res = -2; ++ unsigned int mask; + + if (TEST_FAIL()) + return -2; +@@ -1453,12 +1455,13 @@ int crypto_bignum_legendre(const struct + (const BIGNUM *) p, bnctx, NULL)) + goto fail; + +- if (BN_is_word(tmp, 1)) +- res = 1; +- else if (BN_is_zero(tmp)) +- res = 0; +- else +- res = -1; ++ /* Return 1 if tmp == 1, 0 if tmp == 0, or -1 otherwise. Need to use ++ * constant time selection to avoid branches here. */ ++ res = -1; ++ mask = const_time_eq(BN_is_word(tmp, 1), 1); ++ res = const_time_select_int(mask, 1, res); ++ mask = const_time_eq(BN_is_zero(tmp), 1); ++ res = const_time_select_int(mask, 0, res); + + fail: + BN_clear_free(tmp); diff --git a/package/network/services/hostapd/patches/061-0005-SAE-Minimize-timing-differences-in-PWE-derivation.patch b/package/network/services/hostapd/patches/061-0005-SAE-Minimize-timing-differences-in-PWE-derivation.patch new file mode 100644 index 0000000000..e72a9cbe5a --- /dev/null +++ b/package/network/services/hostapd/patches/061-0005-SAE-Minimize-timing-differences-in-PWE-derivation.patch @@ -0,0 +1,242 @@ +From 6513db3e96c43c2e36805cf5ead349765d18eaf7 Mon Sep 17 00:00:00 2001 +From: Jouni Malinen +Date: Tue, 26 Feb 2019 13:05:09 +0200 +Subject: [PATCH 05/14] SAE: Minimize timing differences in PWE derivation + +The QR test result can provide information about the password to an +attacker, so try to minimize differences in how the +sae_test_pwd_seed_ecc() result is used. (CVE-2019-9494) + +Use heap memory for the dummy password to allow the same password length +to be used even with long passwords. + +Use constant time selection functions to track the real vs. dummy +variables so that the exact same operations can be performed for both QR +test results. + +Signed-off-by: Jouni Malinen +--- + src/common/sae.c | 106 ++++++++++++++++++++++++++++++------------------------- + 1 file changed, 57 insertions(+), 49 deletions(-) + +--- a/src/common/sae.c ++++ b/src/common/sae.c +@@ -9,6 +9,7 @@ + #include "includes.h" + + #include "common.h" ++#include "utils/const_time.h" + #include "crypto/crypto.h" + #include "crypto/sha256.h" + #include "crypto/random.h" +@@ -269,15 +270,12 @@ static int sae_test_pwd_seed_ecc(struct + const u8 *prime, + const struct crypto_bignum *qr, + const struct crypto_bignum *qnr, +- struct crypto_bignum **ret_x_cand) ++ u8 *pwd_value) + { +- u8 pwd_value[SAE_MAX_ECC_PRIME_LEN]; + struct crypto_bignum *y_sqr, *x_cand; + int res; + size_t bits; + +- *ret_x_cand = NULL; +- + wpa_hexdump_key(MSG_DEBUG, "SAE: pwd-seed", pwd_seed, SHA256_MAC_LEN); + + /* pwd-value = KDF-z(pwd-seed, "SAE Hunting and Pecking", p) */ +@@ -286,7 +284,7 @@ static int sae_test_pwd_seed_ecc(struct + prime, sae->tmp->prime_len, pwd_value, bits) < 0) + return -1; + if (bits % 8) +- buf_shift_right(pwd_value, sizeof(pwd_value), 8 - bits % 8); ++ buf_shift_right(pwd_value, sae->tmp->prime_len, 8 - bits % 8); + wpa_hexdump_key(MSG_DEBUG, "SAE: pwd-value", + pwd_value, sae->tmp->prime_len); + +@@ -297,20 +295,13 @@ static int sae_test_pwd_seed_ecc(struct + if (!x_cand) + return -1; + y_sqr = crypto_ec_point_compute_y_sqr(sae->tmp->ec, x_cand); +- if (!y_sqr) { +- crypto_bignum_deinit(x_cand, 1); ++ crypto_bignum_deinit(x_cand, 1); ++ if (!y_sqr) + return -1; +- } + + res = is_quadratic_residue_blind(sae, prime, bits, qr, qnr, y_sqr); + crypto_bignum_deinit(y_sqr, 1); +- if (res <= 0) { +- crypto_bignum_deinit(x_cand, 1); +- return res; +- } +- +- *ret_x_cand = x_cand; +- return 1; ++ return res; + } + + +@@ -431,25 +422,30 @@ static int sae_derive_pwe_ecc(struct sae + const u8 *addr[3]; + size_t len[3]; + size_t num_elem; +- u8 dummy_password[32]; +- size_t dummy_password_len; ++ u8 *dummy_password, *tmp_password; + int pwd_seed_odd = 0; + u8 prime[SAE_MAX_ECC_PRIME_LEN]; + size_t prime_len; +- struct crypto_bignum *x = NULL, *qr, *qnr; ++ struct crypto_bignum *x = NULL, *qr = NULL, *qnr = NULL; ++ u8 x_bin[SAE_MAX_ECC_PRIME_LEN]; ++ u8 x_cand_bin[SAE_MAX_ECC_PRIME_LEN]; + size_t bits; +- int res; +- +- dummy_password_len = password_len; +- if (dummy_password_len > sizeof(dummy_password)) +- dummy_password_len = sizeof(dummy_password); +- if (random_get_bytes(dummy_password, dummy_password_len) < 0) +- return -1; ++ int res = -1; ++ u8 found = 0; /* 0 (false) or 0xff (true) to be used as const_time_* ++ * mask */ ++ ++ os_memset(x_bin, 0, sizeof(x_bin)); ++ ++ dummy_password = os_malloc(password_len); ++ tmp_password = os_malloc(password_len); ++ if (!dummy_password || !tmp_password || ++ random_get_bytes(dummy_password, password_len) < 0) ++ goto fail; + + prime_len = sae->tmp->prime_len; + if (crypto_bignum_to_bin(sae->tmp->prime, prime, sizeof(prime), + prime_len) < 0) +- return -1; ++ goto fail; + bits = crypto_ec_prime_len_bits(sae->tmp->ec); + + /* +@@ -458,7 +454,7 @@ static int sae_derive_pwe_ecc(struct sae + */ + if (get_random_qr_qnr(prime, prime_len, sae->tmp->prime, bits, + &qr, &qnr) < 0) +- return -1; ++ goto fail; + + wpa_hexdump_ascii_key(MSG_DEBUG, "SAE: password", + password, password_len); +@@ -474,7 +470,7 @@ static int sae_derive_pwe_ecc(struct sae + */ + sae_pwd_seed_key(addr1, addr2, addrs); + +- addr[0] = password; ++ addr[0] = tmp_password; + len[0] = password_len; + num_elem = 1; + if (identifier) { +@@ -491,9 +487,8 @@ static int sae_derive_pwe_ecc(struct sae + * attacks that attempt to determine the number of iterations required + * in the loop. + */ +- for (counter = 1; counter <= k || !x; counter++) { ++ for (counter = 1; counter <= k || !found; counter++) { + u8 pwd_seed[SHA256_MAC_LEN]; +- struct crypto_bignum *x_cand; + + if (counter > 200) { + /* This should not happen in practice */ +@@ -501,40 +496,49 @@ static int sae_derive_pwe_ecc(struct sae + break; + } + +- wpa_printf(MSG_DEBUG, "SAE: counter = %u", counter); ++ wpa_printf(MSG_DEBUG, "SAE: counter = %03u", counter); ++ const_time_select_bin(found, dummy_password, password, ++ password_len, tmp_password); + if (hmac_sha256_vector(addrs, sizeof(addrs), num_elem, + addr, len, pwd_seed) < 0) + break; + + res = sae_test_pwd_seed_ecc(sae, pwd_seed, +- prime, qr, qnr, &x_cand); ++ prime, qr, qnr, x_cand_bin); ++ const_time_select_bin(found, x_bin, x_cand_bin, prime_len, ++ x_bin); ++ pwd_seed_odd = const_time_select_u8( ++ found, pwd_seed_odd, ++ pwd_seed[SHA256_MAC_LEN - 1] & 0x01); ++ os_memset(pwd_seed, 0, sizeof(pwd_seed)); + if (res < 0) + goto fail; +- if (res > 0 && !x) { +- wpa_printf(MSG_DEBUG, +- "SAE: Selected pwd-seed with counter %u", +- counter); +- x = x_cand; +- pwd_seed_odd = pwd_seed[SHA256_MAC_LEN - 1] & 0x01; +- os_memset(pwd_seed, 0, sizeof(pwd_seed)); +- +- /* +- * Use a dummy password for the following rounds, if +- * any. +- */ +- addr[0] = dummy_password; +- len[0] = dummy_password_len; +- } else if (res > 0) { +- crypto_bignum_deinit(x_cand, 1); +- } ++ /* Need to minimize differences in handling res == 0 and 1 here ++ * to avoid differences in timing and instruction cache access, ++ * so use const_time_select_*() to make local copies of the ++ * values based on whether this loop iteration was the one that ++ * found the pwd-seed/x. */ ++ ++ /* found is 0 or 0xff here and res is 0 or 1. Bitwise OR of them ++ * (with res converted to 0/0xff) handles this in constant time. ++ */ ++ found |= res * 0xff; ++ wpa_printf(MSG_DEBUG, "SAE: pwd-seed result %d found=0x%02x", ++ res, found); + } + +- if (!x) { ++ if (!found) { + wpa_printf(MSG_DEBUG, "SAE: Could not generate PWE"); + res = -1; + goto fail; + } + ++ x = crypto_bignum_init_set(x_bin, prime_len); ++ if (!x) { ++ res = -1; ++ goto fail; ++ } ++ + if (!sae->tmp->pwe_ecc) + sae->tmp->pwe_ecc = crypto_ec_point_init(sae->tmp->ec); + if (!sae->tmp->pwe_ecc) +@@ -543,7 +547,6 @@ static int sae_derive_pwe_ecc(struct sae + res = crypto_ec_point_solve_y_coord(sae->tmp->ec, + sae->tmp->pwe_ecc, x, + pwd_seed_odd); +- crypto_bignum_deinit(x, 1); + if (res < 0) { + /* + * This should not happen since we already checked that there +@@ -555,6 +558,11 @@ static int sae_derive_pwe_ecc(struct sae + fail: + crypto_bignum_deinit(qr, 0); + crypto_bignum_deinit(qnr, 0); ++ os_free(dummy_password); ++ bin_clear_free(tmp_password, password_len); ++ crypto_bignum_deinit(x, 1); ++ os_memset(x_bin, 0, sizeof(x_bin)); ++ os_memset(x_cand_bin, 0, sizeof(x_cand_bin)); + + return res; + } diff --git a/package/network/services/hostapd/patches/061-0006-SAE-Avoid-branches-in-is_quadratic_residue_blind.patch b/package/network/services/hostapd/patches/061-0006-SAE-Avoid-branches-in-is_quadratic_residue_blind.patch new file mode 100644 index 0000000000..6d93cb2480 --- /dev/null +++ b/package/network/services/hostapd/patches/061-0006-SAE-Avoid-branches-in-is_quadratic_residue_blind.patch @@ -0,0 +1,139 @@ +From 362704dda04507e7ebb8035122e83d9f0ae7c320 Mon Sep 17 00:00:00 2001 +From: Jouni Malinen +Date: Tue, 26 Feb 2019 19:34:38 +0200 +Subject: [PATCH 06/14] SAE: Avoid branches in is_quadratic_residue_blind() + +Make the non-failure path in the function proceed without branches based +on r_odd and in constant time to minimize risk of observable differences +in timing or cache use. (CVE-2019-9494) + +Signed-off-by: Jouni Malinen +--- + src/common/sae.c | 64 ++++++++++++++++++++++++++++++++------------------------ + 1 file changed, 37 insertions(+), 27 deletions(-) + +--- a/src/common/sae.c ++++ b/src/common/sae.c +@@ -209,12 +209,14 @@ get_rand_1_to_p_1(const u8 *prime, size_ + + static int is_quadratic_residue_blind(struct sae_data *sae, + const u8 *prime, size_t bits, +- const struct crypto_bignum *qr, +- const struct crypto_bignum *qnr, ++ const u8 *qr, const u8 *qnr, + const struct crypto_bignum *y_sqr) + { +- struct crypto_bignum *r, *num; ++ struct crypto_bignum *r, *num, *qr_or_qnr = NULL; + int r_odd, check, res = -1; ++ u8 qr_or_qnr_bin[SAE_MAX_ECC_PRIME_LEN]; ++ size_t prime_len = sae->tmp->prime_len; ++ unsigned int mask; + + /* + * Use the blinding technique to mask y_sqr while determining +@@ -225,7 +227,7 @@ static int is_quadratic_residue_blind(st + * r = a random number between 1 and p-1, inclusive + * num = (v * r * r) modulo p + */ +- r = get_rand_1_to_p_1(prime, sae->tmp->prime_len, bits, &r_odd); ++ r = get_rand_1_to_p_1(prime, prime_len, bits, &r_odd); + if (!r) + return -1; + +@@ -235,41 +237,45 @@ static int is_quadratic_residue_blind(st + crypto_bignum_mulmod(num, r, sae->tmp->prime, num) < 0) + goto fail; + +- if (r_odd) { +- /* +- * num = (num * qr) module p +- * LGR(num, p) = 1 ==> quadratic residue +- */ +- if (crypto_bignum_mulmod(num, qr, sae->tmp->prime, num) < 0) +- goto fail; +- check = 1; +- } else { +- /* +- * num = (num * qnr) module p +- * LGR(num, p) = -1 ==> quadratic residue +- */ +- if (crypto_bignum_mulmod(num, qnr, sae->tmp->prime, num) < 0) +- goto fail; +- check = -1; +- } ++ /* ++ * Need to minimize differences in handling different cases, so try to ++ * avoid branches and timing differences. ++ * ++ * If r_odd: ++ * num = (num * qr) module p ++ * LGR(num, p) = 1 ==> quadratic residue ++ * else: ++ * num = (num * qnr) module p ++ * LGR(num, p) = -1 ==> quadratic residue ++ */ ++ mask = const_time_is_zero(r_odd); ++ const_time_select_bin(mask, qnr, qr, prime_len, qr_or_qnr_bin); ++ qr_or_qnr = crypto_bignum_init_set(qr_or_qnr_bin, prime_len); ++ if (!qr_or_qnr || ++ crypto_bignum_mulmod(num, qr_or_qnr, sae->tmp->prime, num) < 0) ++ goto fail; ++ /* r_odd is 0 or 1; branchless version of check = r_odd ? 1 : -1, */ ++ check = const_time_select_int(mask, -1, 1); + + res = crypto_bignum_legendre(num, sae->tmp->prime); + if (res == -2) { + res = -1; + goto fail; + } +- res = res == check; ++ /* branchless version of res = res == check ++ * (res is -1, 0, or 1; check is -1 or 1) */ ++ mask = const_time_eq(res, check); ++ res = const_time_select_int(mask, 1, 0); + fail: + crypto_bignum_deinit(num, 1); + crypto_bignum_deinit(r, 1); ++ crypto_bignum_deinit(qr_or_qnr, 1); + return res; + } + + + static int sae_test_pwd_seed_ecc(struct sae_data *sae, const u8 *pwd_seed, +- const u8 *prime, +- const struct crypto_bignum *qr, +- const struct crypto_bignum *qnr, ++ const u8 *prime, const u8 *qr, const u8 *qnr, + u8 *pwd_value) + { + struct crypto_bignum *y_sqr, *x_cand; +@@ -429,6 +435,8 @@ static int sae_derive_pwe_ecc(struct sae + struct crypto_bignum *x = NULL, *qr = NULL, *qnr = NULL; + u8 x_bin[SAE_MAX_ECC_PRIME_LEN]; + u8 x_cand_bin[SAE_MAX_ECC_PRIME_LEN]; ++ u8 qr_bin[SAE_MAX_ECC_PRIME_LEN]; ++ u8 qnr_bin[SAE_MAX_ECC_PRIME_LEN]; + size_t bits; + int res = -1; + u8 found = 0; /* 0 (false) or 0xff (true) to be used as const_time_* +@@ -453,7 +461,9 @@ static int sae_derive_pwe_ecc(struct sae + * (qnr) modulo p for blinding purposes during the loop. + */ + if (get_random_qr_qnr(prime, prime_len, sae->tmp->prime, bits, +- &qr, &qnr) < 0) ++ &qr, &qnr) < 0 || ++ crypto_bignum_to_bin(qr, qr_bin, sizeof(qr_bin), prime_len) < 0 || ++ crypto_bignum_to_bin(qnr, qnr_bin, sizeof(qnr_bin), prime_len) < 0) + goto fail; + + wpa_hexdump_ascii_key(MSG_DEBUG, "SAE: password", +@@ -504,7 +514,7 @@ static int sae_derive_pwe_ecc(struct sae + break; + + res = sae_test_pwd_seed_ecc(sae, pwd_seed, +- prime, qr, qnr, x_cand_bin); ++ prime, qr_bin, qnr_bin, x_cand_bin); + const_time_select_bin(found, x_bin, x_cand_bin, prime_len, + x_bin); + pwd_seed_odd = const_time_select_u8( diff --git a/package/network/services/hostapd/patches/061-0007-SAE-Mask-timing-of-MODP-groups-22-23-24.patch b/package/network/services/hostapd/patches/061-0007-SAE-Mask-timing-of-MODP-groups-22-23-24.patch new file mode 100644 index 0000000000..229d2b1070 --- /dev/null +++ b/package/network/services/hostapd/patches/061-0007-SAE-Mask-timing-of-MODP-groups-22-23-24.patch @@ -0,0 +1,113 @@ +From 90839597cc4016b33f00055b12d59174c62770a3 Mon Sep 17 00:00:00 2001 +From: Jouni Malinen +Date: Sat, 2 Mar 2019 12:24:09 +0200 +Subject: [PATCH 07/14] SAE: Mask timing of MODP groups 22, 23, 24 + +These groups have significant probability of coming up with pwd-value +that is equal or greater than the prime and as such, need for going +through the PWE derivation loop multiple times. This can result in +sufficient timing different to allow an external observer to determine +how many rounds are needed and that can leak information about the used +password. + +Force at least 40 loop rounds for these MODP groups similarly to the ECC +group design to mask timing. This behavior is not described in IEEE Std +802.11-2016 for SAE, but it does not result in different values (i.e., +only different timing), so such implementation specific countermeasures +can be done without breaking interoperability with other implementation. + +Note: These MODP groups 22, 23, and 24 are not considered sufficiently +strong to be used with SAE (or more or less anything else). As such, +they should never be enabled in runtime configuration for any production +use cases. These changes to introduce additional protection to mask +timing is only for completeness of implementation and not an indication +that these groups should be used. + +This is related to CVE-2019-9494. + +Signed-off-by: Jouni Malinen +--- + src/common/sae.c | 38 ++++++++++++++++++++++++++++---------- + 1 file changed, 28 insertions(+), 10 deletions(-) + +--- a/src/common/sae.c ++++ b/src/common/sae.c +@@ -578,22 +578,27 @@ fail: + } + + ++static int sae_modp_group_require_masking(int group) ++{ ++ /* Groups for which pwd-value is likely to be >= p frequently */ ++ return group == 22 || group == 23 || group == 24; ++} ++ ++ + static int sae_derive_pwe_ffc(struct sae_data *sae, const u8 *addr1, + const u8 *addr2, const u8 *password, + size_t password_len, const char *identifier) + { +- u8 counter; ++ u8 counter, k; + u8 addrs[2 * ETH_ALEN]; + const u8 *addr[3]; + size_t len[3]; + size_t num_elem; + int found = 0; ++ struct crypto_bignum *pwe = NULL; + +- if (sae->tmp->pwe_ffc == NULL) { +- sae->tmp->pwe_ffc = crypto_bignum_init(); +- if (sae->tmp->pwe_ffc == NULL) +- return -1; +- } ++ crypto_bignum_deinit(sae->tmp->pwe_ffc, 1); ++ sae->tmp->pwe_ffc = NULL; + + wpa_hexdump_ascii_key(MSG_DEBUG, "SAE: password", + password, password_len); +@@ -617,7 +622,9 @@ static int sae_derive_pwe_ffc(struct sae + len[num_elem] = sizeof(counter); + num_elem++; + +- for (counter = 1; !found; counter++) { ++ k = sae_modp_group_require_masking(sae->group) ? 40 : 1; ++ ++ for (counter = 1; counter <= k || !found; counter++) { + u8 pwd_seed[SHA256_MAC_LEN]; + int res; + +@@ -627,19 +634,30 @@ static int sae_derive_pwe_ffc(struct sae + break; + } + +- wpa_printf(MSG_DEBUG, "SAE: counter = %u", counter); ++ wpa_printf(MSG_DEBUG, "SAE: counter = %02u", counter); + if (hmac_sha256_vector(addrs, sizeof(addrs), num_elem, + addr, len, pwd_seed) < 0) + break; +- res = sae_test_pwd_seed_ffc(sae, pwd_seed, sae->tmp->pwe_ffc); ++ if (!pwe) { ++ pwe = crypto_bignum_init(); ++ if (!pwe) ++ break; ++ } ++ res = sae_test_pwd_seed_ffc(sae, pwd_seed, pwe); + if (res < 0) + break; + if (res > 0) { +- wpa_printf(MSG_DEBUG, "SAE: Use this PWE"); + found = 1; ++ if (!sae->tmp->pwe_ffc) { ++ wpa_printf(MSG_DEBUG, "SAE: Use this PWE"); ++ sae->tmp->pwe_ffc = pwe; ++ pwe = NULL; ++ } + } + } + ++ crypto_bignum_deinit(pwe, 1); ++ + return found ? 0 : -1; + } + diff --git a/package/network/services/hostapd/patches/061-0008-SAE-Use-const_time-selection-for-PWE-in-FFC.patch b/package/network/services/hostapd/patches/061-0008-SAE-Use-const_time-selection-for-PWE-in-FFC.patch new file mode 100644 index 0000000000..47e1b3c68e --- /dev/null +++ b/package/network/services/hostapd/patches/061-0008-SAE-Use-const_time-selection-for-PWE-in-FFC.patch @@ -0,0 +1,100 @@ +From f8f20717f87eff1f025f48ed585c7684debacf72 Mon Sep 17 00:00:00 2001 +From: Jouni Malinen +Date: Sat, 2 Mar 2019 12:45:33 +0200 +Subject: [PATCH 08/14] SAE: Use const_time selection for PWE in FFC + +This is an initial step towards making the FFC case use strictly +constant time operations similarly to the ECC case. +sae_test_pwd_seed_ffc() does not yet have constant time behavior, +though. + +This is related to CVE-2019-9494. + +Signed-off-by: Jouni Malinen +--- + src/common/sae.c | 53 +++++++++++++++++++++++++++++++++++------------------ + 1 file changed, 35 insertions(+), 18 deletions(-) + +--- a/src/common/sae.c ++++ b/src/common/sae.c +@@ -589,17 +589,28 @@ static int sae_derive_pwe_ffc(struct sae + const u8 *addr2, const u8 *password, + size_t password_len, const char *identifier) + { +- u8 counter, k; ++ u8 counter, k, sel_counter = 0; + u8 addrs[2 * ETH_ALEN]; + const u8 *addr[3]; + size_t len[3]; + size_t num_elem; +- int found = 0; +- struct crypto_bignum *pwe = NULL; ++ u8 found = 0; /* 0 (false) or 0xff (true) to be used as const_time_* ++ * mask */ ++ u8 mask; ++ struct crypto_bignum *pwe; ++ size_t prime_len = sae->tmp->prime_len * 8; ++ u8 *pwe_buf; + + crypto_bignum_deinit(sae->tmp->pwe_ffc, 1); + sae->tmp->pwe_ffc = NULL; + ++ /* Allocate a buffer to maintain selected and candidate PWE for constant ++ * time selection. */ ++ pwe_buf = os_zalloc(prime_len * 2); ++ pwe = crypto_bignum_init(); ++ if (!pwe_buf || !pwe) ++ goto fail; ++ + wpa_hexdump_ascii_key(MSG_DEBUG, "SAE: password", + password, password_len); + +@@ -638,27 +649,33 @@ static int sae_derive_pwe_ffc(struct sae + if (hmac_sha256_vector(addrs, sizeof(addrs), num_elem, + addr, len, pwd_seed) < 0) + break; +- if (!pwe) { +- pwe = crypto_bignum_init(); +- if (!pwe) +- break; +- } + res = sae_test_pwd_seed_ffc(sae, pwd_seed, pwe); ++ /* res is -1 for fatal failure, 0 if a valid PWE was not found, ++ * or 1 if a valid PWE was found. */ + if (res < 0) + break; +- if (res > 0) { +- found = 1; +- if (!sae->tmp->pwe_ffc) { +- wpa_printf(MSG_DEBUG, "SAE: Use this PWE"); +- sae->tmp->pwe_ffc = pwe; +- pwe = NULL; +- } +- } ++ /* Store the candidate PWE into the second half of pwe_buf and ++ * the selected PWE in the beginning of pwe_buf using constant ++ * time selection. */ ++ if (crypto_bignum_to_bin(pwe, pwe_buf + prime_len, prime_len, ++ prime_len) < 0) ++ break; ++ const_time_select_bin(found, pwe_buf, pwe_buf + prime_len, ++ prime_len, pwe_buf); ++ sel_counter = const_time_select_u8(found, sel_counter, counter); ++ mask = const_time_eq_u8(res, 1); ++ found = const_time_select_u8(found, found, mask); + } + +- crypto_bignum_deinit(pwe, 1); ++ if (!found) ++ goto fail; + +- return found ? 0 : -1; ++ wpa_printf(MSG_DEBUG, "SAE: Use PWE from counter = %02u", sel_counter); ++ sae->tmp->pwe_ffc = crypto_bignum_init_set(pwe_buf, prime_len); ++fail: ++ crypto_bignum_deinit(pwe, 1); ++ bin_clear_free(pwe_buf, prime_len * 2); ++ return sae->tmp->pwe_ffc ? 0 : -1; + } + + diff --git a/package/network/services/hostapd/patches/061-0009-SAE-Use-constant-time-operations-in-sae_test_pwd_see.patch b/package/network/services/hostapd/patches/061-0009-SAE-Use-constant-time-operations-in-sae_test_pwd_see.patch new file mode 100644 index 0000000000..150cbeb8ac --- /dev/null +++ b/package/network/services/hostapd/patches/061-0009-SAE-Use-constant-time-operations-in-sae_test_pwd_see.patch @@ -0,0 +1,133 @@ +From cff138b0747fa39765cbc641b66cfa5d7f1735d1 Mon Sep 17 00:00:00 2001 +From: Jouni Malinen +Date: Sat, 2 Mar 2019 16:05:56 +0200 +Subject: [PATCH 09/14] SAE: Use constant time operations in + sae_test_pwd_seed_ffc() + +Try to avoid showing externally visible timing or memory access +differences regardless of whether the derived pwd-value is smaller than +the group prime. + +This is related to CVE-2019-9494. + +Signed-off-by: Jouni Malinen +--- + src/common/sae.c | 75 ++++++++++++++++++++++++++++++++++---------------------- + 1 file changed, 46 insertions(+), 29 deletions(-) + +--- a/src/common/sae.c ++++ b/src/common/sae.c +@@ -311,14 +311,17 @@ static int sae_test_pwd_seed_ecc(struct + } + + ++/* Returns -1 on fatal failure, 0 if PWE cannot be derived from the provided ++ * pwd-seed, or 1 if a valid PWE was derived from pwd-seed. */ + static int sae_test_pwd_seed_ffc(struct sae_data *sae, const u8 *pwd_seed, + struct crypto_bignum *pwe) + { + u8 pwd_value[SAE_MAX_PRIME_LEN]; + size_t bits = sae->tmp->prime_len * 8; + u8 exp[1]; +- struct crypto_bignum *a, *b; +- int res; ++ struct crypto_bignum *a, *b = NULL; ++ int res, is_val; ++ u8 pwd_value_valid; + + wpa_hexdump_key(MSG_DEBUG, "SAE: pwd-seed", pwd_seed, SHA256_MAC_LEN); + +@@ -330,16 +333,29 @@ static int sae_test_pwd_seed_ffc(struct + wpa_hexdump_key(MSG_DEBUG, "SAE: pwd-value", pwd_value, + sae->tmp->prime_len); + +- if (os_memcmp(pwd_value, sae->tmp->dh->prime, sae->tmp->prime_len) >= 0) +- { +- wpa_printf(MSG_DEBUG, "SAE: pwd-value >= p"); +- return 0; +- } ++ /* Check whether pwd-value < p */ ++ res = const_time_memcmp(pwd_value, sae->tmp->dh->prime, ++ sae->tmp->prime_len); ++ /* pwd-value >= p is invalid, so res is < 0 for the valid cases and ++ * the negative sign can be used to fill the mask for constant time ++ * selection */ ++ pwd_value_valid = const_time_fill_msb(res); ++ ++ /* If pwd-value >= p, force pwd-value to be < p and perform the ++ * calculations anyway to hide timing difference. The derived PWE will ++ * be ignored in that case. */ ++ pwd_value[0] = const_time_select_u8(pwd_value_valid, pwd_value[0], 0); + + /* PWE = pwd-value^((p-1)/r) modulo p */ + ++ res = -1; + a = crypto_bignum_init_set(pwd_value, sae->tmp->prime_len); ++ if (!a) ++ goto fail; + ++ /* This is an optimization based on the used group that does not depend ++ * on the password in any way, so it is fine to use separate branches ++ * for this step without constant time operations. */ + if (sae->tmp->dh->safe_prime) { + /* + * r = (p-1)/2 for the group used here, so this becomes: +@@ -353,33 +369,34 @@ static int sae_test_pwd_seed_ffc(struct + b = crypto_bignum_init_set(exp, sizeof(exp)); + if (b == NULL || + crypto_bignum_sub(sae->tmp->prime, b, b) < 0 || +- crypto_bignum_div(b, sae->tmp->order, b) < 0) { +- crypto_bignum_deinit(b, 0); +- b = NULL; +- } ++ crypto_bignum_div(b, sae->tmp->order, b) < 0) ++ goto fail; + } + +- if (a == NULL || b == NULL) +- res = -1; +- else +- res = crypto_bignum_exptmod(a, b, sae->tmp->prime, pwe); +- +- crypto_bignum_deinit(a, 0); +- crypto_bignum_deinit(b, 0); +- +- if (res < 0) { +- wpa_printf(MSG_DEBUG, "SAE: Failed to calculate PWE"); +- return -1; +- } +- +- /* if (PWE > 1) --> found */ +- if (crypto_bignum_is_zero(pwe) || crypto_bignum_is_one(pwe)) { +- wpa_printf(MSG_DEBUG, "SAE: PWE <= 1"); +- return 0; +- } ++ if (!b) ++ goto fail; + +- wpa_printf(MSG_DEBUG, "SAE: PWE found"); +- return 1; ++ res = crypto_bignum_exptmod(a, b, sae->tmp->prime, pwe); ++ if (res < 0) ++ goto fail; ++ ++ /* There were no fatal errors in calculations, so determine the return ++ * value using constant time operations. We get here for number of ++ * invalid cases which are cleared here after having performed all the ++ * computation. PWE is valid if pwd-value was less than prime and ++ * PWE > 1. Start with pwd-value check first and then use constant time ++ * operations to clear res to 0 if PWE is 0 or 1. ++ */ ++ res = const_time_select_u8(pwd_value_valid, 1, 0); ++ is_val = crypto_bignum_is_zero(pwe); ++ res = const_time_select_u8(const_time_is_zero(is_val), res, 0); ++ is_val = crypto_bignum_is_one(pwe); ++ res = const_time_select_u8(const_time_is_zero(is_val), res, 0); ++ ++fail: ++ crypto_bignum_deinit(a, 1); ++ crypto_bignum_deinit(b, 1); ++ return res; + } + + diff --git a/package/network/services/hostapd/patches/062-0004-EAP-pwd-Use-constant-time-and-memory-access-for-find.patch b/package/network/services/hostapd/patches/062-0004-EAP-pwd-Use-constant-time-and-memory-access-for-find.patch new file mode 100644 index 0000000000..1870c497c4 --- /dev/null +++ b/package/network/services/hostapd/patches/062-0004-EAP-pwd-Use-constant-time-and-memory-access-for-find.patch @@ -0,0 +1,319 @@ +From aaf65feac67c3993935634eefe5bc76b9fce03aa Mon Sep 17 00:00:00 2001 +From: Jouni Malinen +Date: Tue, 26 Feb 2019 11:59:45 +0200 +Subject: [PATCH 04/14] EAP-pwd: Use constant time and memory access for + finding the PWE + +This algorithm could leak information to external observers in form of +timing differences or memory access patterns (cache use). While the +previous implementation had protection against the most visible timing +differences (looping 40 rounds and masking the legendre operation), it +did not protect against memory access patterns between the two possible +code paths in the masking operations. That might be sufficient to allow +an unprivileged process running on the same device to be able to +determine which path is being executed through a cache attack and based +on that, determine information about the used password. + +Convert the PWE finding loop to use constant time functions and +identical memory access path without different branches for the QR/QNR +cases to minimize possible side-channel information similarly to the +changes done for SAE authentication. (CVE-2019-9495) + +Signed-off-by: Jouni Malinen +--- + src/eap_common/eap_pwd_common.c | 187 +++++++++++++++++++++------------------- + 1 file changed, 99 insertions(+), 88 deletions(-) + +--- a/src/eap_common/eap_pwd_common.c ++++ b/src/eap_common/eap_pwd_common.c +@@ -8,11 +8,15 @@ + + #include "includes.h" + #include "common.h" ++#include "utils/const_time.h" + #include "crypto/sha256.h" + #include "crypto/crypto.h" + #include "eap_defs.h" + #include "eap_pwd_common.h" + ++#define MAX_ECC_PRIME_LEN 66 ++ ++ + /* The random function H(x) = HMAC-SHA256(0^32, x) */ + struct crypto_hash * eap_pwd_h_init(void) + { +@@ -102,6 +106,15 @@ EAP_PWD_group * get_eap_pwd_group(u16 nu + } + + ++static void buf_shift_right(u8 *buf, size_t len, size_t bits) ++{ ++ size_t i; ++ for (i = len - 1; i > 0; i--) ++ buf[i] = (buf[i - 1] << (8 - bits)) | (buf[i] >> bits); ++ buf[0] >>= bits; ++} ++ ++ + /* + * compute a "random" secret point on an elliptic curve based + * on the password and identities. +@@ -113,17 +126,27 @@ int compute_password_element(EAP_PWD_gro + const u8 *token) + { + struct crypto_bignum *qr = NULL, *qnr = NULL, *one = NULL; ++ struct crypto_bignum *qr_or_qnr = NULL; ++ u8 qr_bin[MAX_ECC_PRIME_LEN]; ++ u8 qnr_bin[MAX_ECC_PRIME_LEN]; ++ u8 qr_or_qnr_bin[MAX_ECC_PRIME_LEN]; ++ u8 x_bin[MAX_ECC_PRIME_LEN]; + struct crypto_bignum *tmp1 = NULL, *tmp2 = NULL, *pm1 = NULL; + struct crypto_hash *hash; + unsigned char pwe_digest[SHA256_MAC_LEN], *prfbuf = NULL, ctr; +- int is_odd, ret = 0, check, found = 0; +- size_t primebytelen, primebitlen; +- struct crypto_bignum *x_candidate = NULL, *rnd = NULL, *cofactor = NULL; ++ int ret = 0, check, res; ++ u8 found = 0; /* 0 (false) or 0xff (true) to be used as const_time_* ++ * mask */ ++ size_t primebytelen = 0, primebitlen; ++ struct crypto_bignum *x_candidate = NULL, *cofactor = NULL; + const struct crypto_bignum *prime; ++ u8 mask, found_ctr = 0, is_odd = 0; + + if (grp->pwe) + return -1; + ++ os_memset(x_bin, 0, sizeof(x_bin)); ++ + prime = crypto_ec_get_prime(grp->group); + cofactor = crypto_bignum_init(); + grp->pwe = crypto_ec_point_init(grp->group); +@@ -152,8 +175,6 @@ int compute_password_element(EAP_PWD_gro + + /* get a random quadratic residue and nonresidue */ + while (!qr || !qnr) { +- int res; +- + if (crypto_bignum_rand(tmp1, prime) < 0) + goto fail; + res = crypto_bignum_legendre(tmp1, prime); +@@ -167,6 +188,11 @@ int compute_password_element(EAP_PWD_gro + if (!tmp1) + goto fail; + } ++ if (crypto_bignum_to_bin(qr, qr_bin, sizeof(qr_bin), ++ primebytelen) < 0 || ++ crypto_bignum_to_bin(qnr, qnr_bin, sizeof(qnr_bin), ++ primebytelen) < 0) ++ goto fail; + + os_memset(prfbuf, 0, primebytelen); + ctr = 0; +@@ -194,17 +220,16 @@ int compute_password_element(EAP_PWD_gro + eap_pwd_h_update(hash, &ctr, sizeof(ctr)); + eap_pwd_h_final(hash, pwe_digest); + +- crypto_bignum_deinit(rnd, 1); +- rnd = crypto_bignum_init_set(pwe_digest, SHA256_MAC_LEN); +- if (!rnd) { +- wpa_printf(MSG_INFO, "EAP-pwd: unable to create rnd"); +- goto fail; +- } ++ is_odd = const_time_select_u8( ++ found, is_odd, pwe_digest[SHA256_MAC_LEN - 1] & 0x01); + if (eap_pwd_kdf(pwe_digest, SHA256_MAC_LEN, + (u8 *) "EAP-pwd Hunting And Pecking", + os_strlen("EAP-pwd Hunting And Pecking"), + prfbuf, primebitlen) < 0) + goto fail; ++ if (primebitlen % 8) ++ buf_shift_right(prfbuf, primebytelen, ++ 8 - primebitlen % 8); + + crypto_bignum_deinit(x_candidate, 1); + x_candidate = crypto_bignum_init_set(prfbuf, primebytelen); +@@ -214,24 +239,13 @@ int compute_password_element(EAP_PWD_gro + goto fail; + } + +- /* +- * eap_pwd_kdf() returns a string of bits 0..primebitlen but +- * BN_bin2bn will treat that string of bits as a big endian +- * number. If the primebitlen is not an even multiple of 8 +- * then excessive bits-- those _after_ primebitlen-- so now +- * we have to shift right the amount we masked off. +- */ +- if ((primebitlen % 8) && +- crypto_bignum_rshift(x_candidate, +- (8 - (primebitlen % 8)), +- x_candidate) < 0) +- goto fail; +- + if (crypto_bignum_cmp(x_candidate, prime) >= 0) + continue; + +- wpa_hexdump(MSG_DEBUG, "EAP-pwd: x_candidate", +- prfbuf, primebytelen); ++ wpa_hexdump_key(MSG_DEBUG, "EAP-pwd: x_candidate", ++ prfbuf, primebytelen); ++ const_time_select_bin(found, x_bin, prfbuf, primebytelen, ++ x_bin); + + /* + * compute y^2 using the equation of the curve +@@ -260,13 +274,15 @@ int compute_password_element(EAP_PWD_gro + * Flip a coin, multiply by the random quadratic residue or the + * random quadratic nonresidue and record heads or tails. + */ +- if (crypto_bignum_is_odd(tmp1)) { +- crypto_bignum_mulmod(tmp2, qr, prime, tmp2); +- check = 1; +- } else { +- crypto_bignum_mulmod(tmp2, qnr, prime, tmp2); +- check = -1; +- } ++ mask = const_time_eq_u8(crypto_bignum_is_odd(tmp1), 1); ++ check = const_time_select_s8(mask, 1, -1); ++ const_time_select_bin(mask, qr_bin, qnr_bin, primebytelen, ++ qr_or_qnr_bin); ++ crypto_bignum_deinit(qr_or_qnr, 1); ++ qr_or_qnr = crypto_bignum_init_set(qr_or_qnr_bin, primebytelen); ++ if (!qr_or_qnr || ++ crypto_bignum_mulmod(tmp2, qr_or_qnr, prime, tmp2) < 0) ++ goto fail; + + /* + * Now it's safe to do legendre, if check is 1 then it's +@@ -274,59 +290,12 @@ int compute_password_element(EAP_PWD_gro + * change result), if check is -1 then it's the opposite test + * (multiplying a qr by qnr would make a qnr). + */ +- if (crypto_bignum_legendre(tmp2, prime) == check) { +- if (found == 1) +- continue; +- +- /* need to unambiguously identify the solution */ +- is_odd = crypto_bignum_is_odd(rnd); +- +- /* +- * We know x_candidate is a quadratic residue so set +- * it here. +- */ +- if (crypto_ec_point_solve_y_coord(grp->group, grp->pwe, +- x_candidate, +- is_odd) != 0) { +- wpa_printf(MSG_INFO, +- "EAP-pwd: Could not solve for y"); +- continue; +- } +- +- /* +- * If there's a solution to the equation then the point +- * must be on the curve so why check again explicitly? +- * OpenSSL code says this is required by X9.62. We're +- * not X9.62 but it can't hurt just to be sure. +- */ +- if (!crypto_ec_point_is_on_curve(grp->group, +- grp->pwe)) { +- wpa_printf(MSG_INFO, +- "EAP-pwd: point is not on curve"); +- continue; +- } +- +- if (!crypto_bignum_is_one(cofactor)) { +- /* make sure the point is not in a small +- * sub-group */ +- if (crypto_ec_point_mul(grp->group, grp->pwe, +- cofactor, +- grp->pwe) != 0) { +- wpa_printf(MSG_INFO, +- "EAP-pwd: cannot multiply generator by order"); +- continue; +- } +- if (crypto_ec_point_is_at_infinity(grp->group, +- grp->pwe)) { +- wpa_printf(MSG_INFO, +- "EAP-pwd: point is at infinity"); +- continue; +- } +- } +- wpa_printf(MSG_DEBUG, +- "EAP-pwd: found a PWE in %d tries", ctr); +- found = 1; +- } ++ res = crypto_bignum_legendre(tmp2, prime); ++ if (res == -2) ++ goto fail; ++ mask = const_time_eq(res, check); ++ found_ctr = const_time_select_u8(found, found_ctr, ctr); ++ found |= mask; + } + if (found == 0) { + wpa_printf(MSG_INFO, +@@ -334,6 +303,44 @@ int compute_password_element(EAP_PWD_gro + num); + goto fail; + } ++ ++ /* ++ * We know x_candidate is a quadratic residue so set it here. ++ */ ++ crypto_bignum_deinit(x_candidate, 1); ++ x_candidate = crypto_bignum_init_set(x_bin, primebytelen); ++ if (!x_candidate || ++ crypto_ec_point_solve_y_coord(grp->group, grp->pwe, x_candidate, ++ is_odd) != 0) { ++ wpa_printf(MSG_INFO, "EAP-pwd: Could not solve for y"); ++ goto fail; ++ } ++ ++ /* ++ * If there's a solution to the equation then the point must be on the ++ * curve so why check again explicitly? OpenSSL code says this is ++ * required by X9.62. We're not X9.62 but it can't hurt just to be sure. ++ */ ++ if (!crypto_ec_point_is_on_curve(grp->group, grp->pwe)) { ++ wpa_printf(MSG_INFO, "EAP-pwd: point is not on curve"); ++ goto fail; ++ } ++ ++ if (!crypto_bignum_is_one(cofactor)) { ++ /* make sure the point is not in a small sub-group */ ++ if (crypto_ec_point_mul(grp->group, grp->pwe, cofactor, ++ grp->pwe) != 0) { ++ wpa_printf(MSG_INFO, ++ "EAP-pwd: cannot multiply generator by order"); ++ goto fail; ++ } ++ if (crypto_ec_point_is_at_infinity(grp->group, grp->pwe)) { ++ wpa_printf(MSG_INFO, "EAP-pwd: point is at infinity"); ++ goto fail; ++ } ++ } ++ wpa_printf(MSG_DEBUG, "EAP-pwd: found a PWE in %02d tries", found_ctr); ++ + if (0) { + fail: + crypto_ec_point_deinit(grp->pwe, 1); +@@ -343,14 +350,18 @@ int compute_password_element(EAP_PWD_gro + /* cleanliness and order.... */ + crypto_bignum_deinit(cofactor, 1); + crypto_bignum_deinit(x_candidate, 1); +- crypto_bignum_deinit(rnd, 1); + crypto_bignum_deinit(pm1, 0); + crypto_bignum_deinit(tmp1, 1); + crypto_bignum_deinit(tmp2, 1); + crypto_bignum_deinit(qr, 1); + crypto_bignum_deinit(qnr, 1); ++ crypto_bignum_deinit(qr_or_qnr, 1); + crypto_bignum_deinit(one, 0); +- os_free(prfbuf); ++ bin_clear_free(prfbuf, primebytelen); ++ os_memset(qr_bin, 0, sizeof(qr_bin)); ++ os_memset(qnr_bin, 0, sizeof(qnr_bin)); ++ os_memset(qr_or_qnr_bin, 0, sizeof(qr_or_qnr_bin)); ++ os_memset(pwe_digest, 0, sizeof(pwe_digest)); + + return ret; + } diff --git a/package/network/services/hostapd/patches/063-0010-SAE-Fix-confirm-message-validation-in-error-cases.patch b/package/network/services/hostapd/patches/063-0010-SAE-Fix-confirm-message-validation-in-error-cases.patch new file mode 100644 index 0000000000..3a3658e640 --- /dev/null +++ b/package/network/services/hostapd/patches/063-0010-SAE-Fix-confirm-message-validation-in-error-cases.patch @@ -0,0 +1,52 @@ +From ac8fa9ef198640086cf2ce7c94673be2b6a018a0 Mon Sep 17 00:00:00 2001 +From: Jouni Malinen +Date: Tue, 5 Mar 2019 23:43:25 +0200 +Subject: [PATCH 10/14] SAE: Fix confirm message validation in error cases + +Explicitly verify that own and peer commit scalar/element are available +when trying to check SAE confirm message. It could have been possible to +hit a NULL pointer dereference if the peer element could not have been +parsed. (CVE-2019-9496) + +Signed-off-by: Jouni Malinen +--- + src/common/sae.c | 14 +++++++++++--- + 1 file changed, 11 insertions(+), 3 deletions(-) + +--- a/src/common/sae.c ++++ b/src/common/sae.c +@@ -1464,23 +1464,31 @@ int sae_check_confirm(struct sae_data *s + + wpa_printf(MSG_DEBUG, "SAE: peer-send-confirm %u", WPA_GET_LE16(data)); + +- if (sae->tmp == NULL) { ++ if (!sae->tmp || !sae->peer_commit_scalar || ++ !sae->tmp->own_commit_scalar) { + wpa_printf(MSG_DEBUG, "SAE: Temporary data not yet available"); + return -1; + } + +- if (sae->tmp->ec) ++ if (sae->tmp->ec) { ++ if (!sae->tmp->peer_commit_element_ecc || ++ !sae->tmp->own_commit_element_ecc) ++ return -1; + sae_cn_confirm_ecc(sae, data, sae->peer_commit_scalar, + sae->tmp->peer_commit_element_ecc, + sae->tmp->own_commit_scalar, + sae->tmp->own_commit_element_ecc, + verifier); +- else ++ } else { ++ if (!sae->tmp->peer_commit_element_ffc || ++ !sae->tmp->own_commit_element_ffc) ++ return -1; + sae_cn_confirm_ffc(sae, data, sae->peer_commit_scalar, + sae->tmp->peer_commit_element_ffc, + sae->tmp->own_commit_scalar, + sae->tmp->own_commit_element_ffc, + verifier); ++ } + + if (os_memcmp_const(verifier, data + 2, SHA256_MAC_LEN) != 0) { + wpa_printf(MSG_DEBUG, "SAE: Confirm mismatch"); diff --git a/package/network/services/hostapd/patches/064-0011-EAP-pwd-server-Verify-received-scalar-and-element.patch b/package/network/services/hostapd/patches/064-0011-EAP-pwd-server-Verify-received-scalar-and-element.patch new file mode 100644 index 0000000000..8ecb5fd502 --- /dev/null +++ b/package/network/services/hostapd/patches/064-0011-EAP-pwd-server-Verify-received-scalar-and-element.patch @@ -0,0 +1,53 @@ +From 70ff850e89fbc8bc7da515321b4d15b5eef70581 Mon Sep 17 00:00:00 2001 +From: Mathy Vanhoef +Date: Sun, 31 Mar 2019 17:13:06 +0200 +Subject: [PATCH 11/14] EAP-pwd server: Verify received scalar and element + +When processing an EAP-pwd Commit frame, the peer's scalar and element +(elliptic curve point) were not validated. This allowed an adversary to +bypass authentication, and impersonate any user if the crypto +implementation did not verify the validity of the EC point. + +Fix this vulnerability by assuring the received scalar lies within the +valid range, and by checking that the received element is not the point +at infinity and lies on the elliptic curve being used. (CVE-2019-9498) + +The vulnerability is only exploitable if OpenSSL version 1.0.2 or lower +is used, or if LibreSSL or wolfssl is used. Newer versions of OpenSSL +(and also BoringSSL) implicitly validate the elliptic curve point in +EC_POINT_set_affine_coordinates_GFp(), preventing the attack. + +Signed-off-by: Mathy Vanhoef +--- + src/eap_server/eap_server_pwd.c | 20 ++++++++++++++++++++ + 1 file changed, 20 insertions(+) + +--- a/src/eap_server/eap_server_pwd.c ++++ b/src/eap_server/eap_server_pwd.c +@@ -718,6 +718,26 @@ eap_pwd_process_commit_resp(struct eap_s + goto fin; + } + ++ /* verify received scalar */ ++ if (crypto_bignum_is_zero(data->peer_scalar) || ++ crypto_bignum_is_one(data->peer_scalar) || ++ crypto_bignum_cmp(data->peer_scalar, ++ crypto_ec_get_order(data->grp->group)) >= 0) { ++ wpa_printf(MSG_INFO, ++ "EAP-PWD (server): received scalar is invalid"); ++ goto fin; ++ } ++ ++ /* verify received element */ ++ if (!crypto_ec_point_is_on_curve(data->grp->group, ++ data->peer_element) || ++ crypto_ec_point_is_at_infinity(data->grp->group, ++ data->peer_element)) { ++ wpa_printf(MSG_INFO, ++ "EAP-PWD (server): received element is invalid"); ++ goto fin; ++ } ++ + /* check to ensure peer's element is not in a small sub-group */ + if (!crypto_bignum_is_one(cofactor)) { + if (crypto_ec_point_mul(data->grp->group, data->peer_element, diff --git a/package/network/services/hostapd/patches/064-0012-EAP-pwd-server-Detect-reflection-attacks.patch b/package/network/services/hostapd/patches/064-0012-EAP-pwd-server-Detect-reflection-attacks.patch new file mode 100644 index 0000000000..44949cb24d --- /dev/null +++ b/package/network/services/hostapd/patches/064-0012-EAP-pwd-server-Detect-reflection-attacks.patch @@ -0,0 +1,40 @@ +From d63edfa90243e9a7de6ae5c275032f2cc79fef95 Mon Sep 17 00:00:00 2001 +From: Mathy Vanhoef +Date: Sun, 31 Mar 2019 17:26:01 +0200 +Subject: [PATCH 12/14] EAP-pwd server: Detect reflection attacks + +When processing an EAP-pwd Commit frame, verify that the peer's scalar +and elliptic curve element differ from the one sent by the server. This +prevents reflection attacks where the adversary reflects the scalar and +element sent by the server. (CVE-2019-9497) + +The vulnerability allows an adversary to complete the EAP-pwd handshake +as any user. However, the adversary does not learn the negotiated +session key, meaning the subsequent 4-way handshake would fail. As a +result, this cannot be abused to bypass authentication unless EAP-pwd is +used in non-WLAN cases without any following key exchange that would +require the attacker to learn the MSK. + +Signed-off-by: Mathy Vanhoef +--- + src/eap_server/eap_server_pwd.c | 9 +++++++++ + 1 file changed, 9 insertions(+) + +--- a/src/eap_server/eap_server_pwd.c ++++ b/src/eap_server/eap_server_pwd.c +@@ -753,6 +753,15 @@ eap_pwd_process_commit_resp(struct eap_s + } + } + ++ /* detect reflection attacks */ ++ if (crypto_bignum_cmp(data->my_scalar, data->peer_scalar) == 0 || ++ crypto_ec_point_cmp(data->grp->group, data->my_element, ++ data->peer_element) == 0) { ++ wpa_printf(MSG_INFO, ++ "EAP-PWD (server): detected reflection attack!"); ++ goto fin; ++ } ++ + /* compute the shared key, k */ + if ((crypto_ec_point_mul(data->grp->group, data->grp->pwe, + data->peer_scalar, K) < 0) || diff --git a/package/network/services/hostapd/patches/064-0013-EAP-pwd-client-Verify-received-scalar-and-element.patch b/package/network/services/hostapd/patches/064-0013-EAP-pwd-client-Verify-received-scalar-and-element.patch new file mode 100644 index 0000000000..9c7707ae3f --- /dev/null +++ b/package/network/services/hostapd/patches/064-0013-EAP-pwd-client-Verify-received-scalar-and-element.patch @@ -0,0 +1,53 @@ +From 8ad8585f91823ddcc3728155e288e0f9f872e31a Mon Sep 17 00:00:00 2001 +From: Mathy Vanhoef +Date: Sun, 31 Mar 2019 17:43:44 +0200 +Subject: [PATCH 13/14] EAP-pwd client: Verify received scalar and element + +When processing an EAP-pwd Commit frame, the server's scalar and element +(elliptic curve point) were not validated. This allowed an adversary to +bypass authentication, and act as a rogue Access Point (AP) if the +crypto implementation did not verify the validity of the EC point. + +Fix this vulnerability by assuring the received scalar lies within the +valid range, and by checking that the received element is not the point +at infinity and lies on the elliptic curve being used. (CVE-2019-9499) + +The vulnerability is only exploitable if OpenSSL version 1.0.2 or lower +is used, or if LibreSSL or wolfssl is used. Newer versions of OpenSSL +(and also BoringSSL) implicitly validate the elliptic curve point in +EC_POINT_set_affine_coordinates_GFp(), preventing the attack. + +Signed-off-by: Mathy Vanhoef +--- + src/eap_peer/eap_pwd.c | 20 ++++++++++++++++++++ + 1 file changed, 20 insertions(+) + +--- a/src/eap_peer/eap_pwd.c ++++ b/src/eap_peer/eap_pwd.c +@@ -594,6 +594,26 @@ eap_pwd_perform_commit_exchange(struct e + goto fin; + } + ++ /* verify received scalar */ ++ if (crypto_bignum_is_zero(data->server_scalar) || ++ crypto_bignum_is_one(data->server_scalar) || ++ crypto_bignum_cmp(data->server_scalar, ++ crypto_ec_get_order(data->grp->group)) >= 0) { ++ wpa_printf(MSG_INFO, ++ "EAP-PWD (peer): received scalar is invalid"); ++ goto fin; ++ } ++ ++ /* verify received element */ ++ if (!crypto_ec_point_is_on_curve(data->grp->group, ++ data->server_element) || ++ crypto_ec_point_is_at_infinity(data->grp->group, ++ data->server_element)) { ++ wpa_printf(MSG_INFO, ++ "EAP-PWD (peer): received element is invalid"); ++ goto fin; ++ } ++ + /* check to ensure server's element is not in a small sub-group */ + if (!crypto_bignum_is_one(cofactor)) { + if (crypto_ec_point_mul(data->grp->group, data->server_element, diff --git a/package/network/services/hostapd/patches/064-0014-EAP-pwd-Check-element-x-y-coordinates-explicitly.patch b/package/network/services/hostapd/patches/064-0014-EAP-pwd-Check-element-x-y-coordinates-explicitly.patch new file mode 100644 index 0000000000..ab1edfaffc --- /dev/null +++ b/package/network/services/hostapd/patches/064-0014-EAP-pwd-Check-element-x-y-coordinates-explicitly.patch @@ -0,0 +1,320 @@ +From 16d4f1069118aa19bfce013493e1ac5783f92f1d Mon Sep 17 00:00:00 2001 +From: Jouni Malinen +Date: Fri, 5 Apr 2019 02:12:50 +0300 +Subject: [PATCH 14/14] EAP-pwd: Check element x,y coordinates explicitly + +This adds an explicit check for 0 < x,y < prime based on RFC 5931, +2.8.5.2.2 requirement. The earlier checks might have covered this +implicitly, but it is safer to avoid any dependency on implicit checks +and specific crypto library behavior. (CVE-2019-9498 and CVE-2019-9499) + +Furthermore, this moves the EAP-pwd element and scalar parsing and +validation steps into shared helper functions so that there is no need +to maintain two separate copies of this common functionality between the +server and peer implementations. + +Signed-off-by: Jouni Malinen +--- + src/eap_common/eap_pwd_common.c | 106 ++++++++++++++++++++++++++++++++++++++++ + src/eap_common/eap_pwd_common.h | 3 ++ + src/eap_peer/eap_pwd.c | 45 ++--------------- + src/eap_server/eap_server_pwd.c | 45 ++--------------- + 4 files changed, 117 insertions(+), 82 deletions(-) + +--- a/src/eap_common/eap_pwd_common.c ++++ b/src/eap_common/eap_pwd_common.c +@@ -427,3 +427,109 @@ int compute_keys(EAP_PWD_group *grp, con + + return 1; + } ++ ++ ++static int eap_pwd_element_coord_ok(const struct crypto_bignum *prime, ++ const u8 *buf, size_t len) ++{ ++ struct crypto_bignum *val; ++ int ok = 1; ++ ++ val = crypto_bignum_init_set(buf, len); ++ if (!val || crypto_bignum_is_zero(val) || ++ crypto_bignum_cmp(val, prime) >= 0) ++ ok = 0; ++ crypto_bignum_deinit(val, 0); ++ return ok; ++} ++ ++ ++struct crypto_ec_point * eap_pwd_get_element(EAP_PWD_group *group, ++ const u8 *buf) ++{ ++ struct crypto_ec_point *element; ++ const struct crypto_bignum *prime; ++ size_t prime_len; ++ struct crypto_bignum *cofactor = NULL; ++ ++ prime = crypto_ec_get_prime(group->group); ++ prime_len = crypto_ec_prime_len(group->group); ++ ++ /* RFC 5931, 2.8.5.2.2: 0 < x,y < p */ ++ if (!eap_pwd_element_coord_ok(prime, buf, prime_len) || ++ !eap_pwd_element_coord_ok(prime, buf + prime_len, prime_len)) { ++ wpa_printf(MSG_INFO, "EAP-pwd: Invalid coordinate in element"); ++ return NULL; ++ } ++ ++ element = crypto_ec_point_from_bin(group->group, buf); ++ if (!element) { ++ wpa_printf(MSG_INFO, "EAP-pwd: EC point from element failed"); ++ return NULL; ++ } ++ ++ /* RFC 5931, 2.8.5.2.2: on curve and not the point at infinity */ ++ if (!crypto_ec_point_is_on_curve(group->group, element) || ++ crypto_ec_point_is_at_infinity(group->group, element)) { ++ wpa_printf(MSG_INFO, "EAP-pwd: Invalid element"); ++ goto fail; ++ } ++ ++ cofactor = crypto_bignum_init(); ++ if (!cofactor || crypto_ec_cofactor(group->group, cofactor) < 0) { ++ wpa_printf(MSG_INFO, ++ "EAP-pwd: Unable to get cofactor for curve"); ++ goto fail; ++ } ++ ++ if (!crypto_bignum_is_one(cofactor)) { ++ struct crypto_ec_point *point; ++ int ok = 1; ++ ++ /* check to ensure peer's element is not in a small sub-group */ ++ point = crypto_ec_point_init(group->group); ++ if (!point || ++ crypto_ec_point_mul(group->group, element, ++ cofactor, point) != 0 || ++ crypto_ec_point_is_at_infinity(group->group, point)) ++ ok = 0; ++ crypto_ec_point_deinit(point, 0); ++ ++ if (!ok) { ++ wpa_printf(MSG_INFO, ++ "EAP-pwd: Small sub-group check on peer element failed"); ++ goto fail; ++ } ++ } ++ ++out: ++ crypto_bignum_deinit(cofactor, 0); ++ return element; ++fail: ++ crypto_ec_point_deinit(element, 0); ++ element = NULL; ++ goto out; ++} ++ ++ ++struct crypto_bignum * eap_pwd_get_scalar(EAP_PWD_group *group, const u8 *buf) ++{ ++ struct crypto_bignum *scalar; ++ const struct crypto_bignum *order; ++ size_t order_len; ++ ++ order = crypto_ec_get_order(group->group); ++ order_len = crypto_ec_order_len(group->group); ++ ++ /* RFC 5931, 2.8.5.2: 1 < scalar < r */ ++ scalar = crypto_bignum_init_set(buf, order_len); ++ if (!scalar || crypto_bignum_is_zero(scalar) || ++ crypto_bignum_is_one(scalar) || ++ crypto_bignum_cmp(scalar, order) >= 0) { ++ wpa_printf(MSG_INFO, "EAP-pwd: received scalar is invalid"); ++ crypto_bignum_deinit(scalar, 0); ++ scalar = NULL; ++ } ++ ++ return scalar; ++} +--- a/src/eap_common/eap_pwd_common.h ++++ b/src/eap_common/eap_pwd_common.h +@@ -67,5 +67,8 @@ int compute_keys(EAP_PWD_group *grp, con + struct crypto_hash * eap_pwd_h_init(void); + void eap_pwd_h_update(struct crypto_hash *hash, const u8 *data, size_t len); + void eap_pwd_h_final(struct crypto_hash *hash, u8 *digest); ++struct crypto_ec_point * eap_pwd_get_element(EAP_PWD_group *group, ++ const u8 *buf); ++struct crypto_bignum * eap_pwd_get_scalar(EAP_PWD_group *group, const u8 *buf); + + #endif /* EAP_PWD_COMMON_H */ +--- a/src/eap_peer/eap_pwd.c ++++ b/src/eap_peer/eap_pwd.c +@@ -308,7 +308,7 @@ eap_pwd_perform_commit_exchange(struct e + const struct wpabuf *reqData, + const u8 *payload, size_t payload_len) + { +- struct crypto_ec_point *K = NULL, *point = NULL; ++ struct crypto_ec_point *K = NULL; + struct crypto_bignum *mask = NULL, *cofactor = NULL; + const u8 *ptr = payload; + u8 *scalar = NULL, *element = NULL; +@@ -572,63 +572,27 @@ eap_pwd_perform_commit_exchange(struct e + /* process the request */ + data->k = crypto_bignum_init(); + K = crypto_ec_point_init(data->grp->group); +- point = crypto_ec_point_init(data->grp->group); +- if (!data->k || !K || !point) { ++ if (!data->k || !K) { + wpa_printf(MSG_INFO, "EAP-PWD (peer): peer data allocation " + "fail"); + goto fin; + } + + /* element, x then y, followed by scalar */ +- data->server_element = crypto_ec_point_from_bin(data->grp->group, ptr); ++ data->server_element = eap_pwd_get_element(data->grp, ptr); + if (!data->server_element) { + wpa_printf(MSG_INFO, "EAP-PWD (peer): setting peer element " + "fail"); + goto fin; + } + ptr += prime_len * 2; +- data->server_scalar = crypto_bignum_init_set(ptr, order_len); ++ data->server_scalar = eap_pwd_get_scalar(data->grp, ptr); + if (!data->server_scalar) { + wpa_printf(MSG_INFO, + "EAP-PWD (peer): setting peer scalar fail"); + goto fin; + } + +- /* verify received scalar */ +- if (crypto_bignum_is_zero(data->server_scalar) || +- crypto_bignum_is_one(data->server_scalar) || +- crypto_bignum_cmp(data->server_scalar, +- crypto_ec_get_order(data->grp->group)) >= 0) { +- wpa_printf(MSG_INFO, +- "EAP-PWD (peer): received scalar is invalid"); +- goto fin; +- } +- +- /* verify received element */ +- if (!crypto_ec_point_is_on_curve(data->grp->group, +- data->server_element) || +- crypto_ec_point_is_at_infinity(data->grp->group, +- data->server_element)) { +- wpa_printf(MSG_INFO, +- "EAP-PWD (peer): received element is invalid"); +- goto fin; +- } +- +- /* check to ensure server's element is not in a small sub-group */ +- if (!crypto_bignum_is_one(cofactor)) { +- if (crypto_ec_point_mul(data->grp->group, data->server_element, +- cofactor, point) < 0) { +- wpa_printf(MSG_INFO, "EAP-PWD (peer): cannot multiply " +- "server element by order!\n"); +- goto fin; +- } +- if (crypto_ec_point_is_at_infinity(data->grp->group, point)) { +- wpa_printf(MSG_INFO, "EAP-PWD (peer): server element " +- "is at infinity!\n"); +- goto fin; +- } +- } +- + /* compute the shared key, k */ + if (crypto_ec_point_mul(data->grp->group, data->grp->pwe, + data->server_scalar, K) < 0 || +@@ -702,7 +666,6 @@ fin: + crypto_bignum_deinit(mask, 1); + crypto_bignum_deinit(cofactor, 1); + crypto_ec_point_deinit(K, 1); +- crypto_ec_point_deinit(point, 1); + if (data->outbuf == NULL) + eap_pwd_state(data, FAILURE); + else +--- a/src/eap_server/eap_server_pwd.c ++++ b/src/eap_server/eap_server_pwd.c +@@ -669,7 +669,7 @@ eap_pwd_process_commit_resp(struct eap_s + { + const u8 *ptr; + struct crypto_bignum *cofactor = NULL; +- struct crypto_ec_point *K = NULL, *point = NULL; ++ struct crypto_ec_point *K = NULL; + int res = 0; + size_t prime_len, order_len; + +@@ -688,9 +688,8 @@ eap_pwd_process_commit_resp(struct eap_s + + data->k = crypto_bignum_init(); + cofactor = crypto_bignum_init(); +- point = crypto_ec_point_init(data->grp->group); + K = crypto_ec_point_init(data->grp->group); +- if (!data->k || !cofactor || !point || !K) { ++ if (!data->k || !cofactor || !K) { + wpa_printf(MSG_INFO, "EAP-PWD (server): peer data allocation " + "fail"); + goto fin; +@@ -704,55 +703,20 @@ eap_pwd_process_commit_resp(struct eap_s + + /* element, x then y, followed by scalar */ + ptr = payload; +- data->peer_element = crypto_ec_point_from_bin(data->grp->group, ptr); ++ data->peer_element = eap_pwd_get_element(data->grp, ptr); + if (!data->peer_element) { + wpa_printf(MSG_INFO, "EAP-PWD (server): setting peer element " + "fail"); + goto fin; + } + ptr += prime_len * 2; +- data->peer_scalar = crypto_bignum_init_set(ptr, order_len); ++ data->peer_scalar = eap_pwd_get_scalar(data->grp, ptr); + if (!data->peer_scalar) { + wpa_printf(MSG_INFO, "EAP-PWD (server): peer data allocation " + "fail"); + goto fin; + } + +- /* verify received scalar */ +- if (crypto_bignum_is_zero(data->peer_scalar) || +- crypto_bignum_is_one(data->peer_scalar) || +- crypto_bignum_cmp(data->peer_scalar, +- crypto_ec_get_order(data->grp->group)) >= 0) { +- wpa_printf(MSG_INFO, +- "EAP-PWD (server): received scalar is invalid"); +- goto fin; +- } +- +- /* verify received element */ +- if (!crypto_ec_point_is_on_curve(data->grp->group, +- data->peer_element) || +- crypto_ec_point_is_at_infinity(data->grp->group, +- data->peer_element)) { +- wpa_printf(MSG_INFO, +- "EAP-PWD (server): received element is invalid"); +- goto fin; +- } +- +- /* check to ensure peer's element is not in a small sub-group */ +- if (!crypto_bignum_is_one(cofactor)) { +- if (crypto_ec_point_mul(data->grp->group, data->peer_element, +- cofactor, point) != 0) { +- wpa_printf(MSG_INFO, "EAP-PWD (server): cannot " +- "multiply peer element by order"); +- goto fin; +- } +- if (crypto_ec_point_is_at_infinity(data->grp->group, point)) { +- wpa_printf(MSG_INFO, "EAP-PWD (server): peer element " +- "is at infinity!\n"); +- goto fin; +- } +- } +- + /* detect reflection attacks */ + if (crypto_bignum_cmp(data->my_scalar, data->peer_scalar) == 0 || + crypto_ec_point_cmp(data->grp->group, data->my_element, +@@ -804,7 +768,6 @@ eap_pwd_process_commit_resp(struct eap_s + + fin: + crypto_ec_point_deinit(K, 1); +- crypto_ec_point_deinit(point, 1); + crypto_bignum_deinit(cofactor, 1); + + if (res) diff --git a/package/network/services/lldpd/Makefile b/package/network/services/lldpd/Makefile index 801a772e02..5b36155b71 100644 --- a/package/network/services/lldpd/Makefile +++ b/package/network/services/lldpd/Makefile @@ -8,17 +8,18 @@ include $(TOPDIR)/rules.mk PKG_NAME:=lldpd -PKG_VERSION:=1.0.1 -PKG_RELEASE:=2 +PKG_VERSION:=1.0.3 +PKG_RELEASE:=1 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz PKG_SOURCE_URL:=https://media.luffy.cx/files/lldpd -PKG_HASH:=450b622aac7ae1758f1ef82f3b7b94ec47f2ff33abfb0e6ac82555b9ee55f151 +PKG_HASH:=39fced395168015416bfe78b95414facf066f841f349024433aa20ab54e4c360 PKG_MAINTAINER:=Stijn Tintel PKG_LICENSE:=ISC PKG_FIXUP:=autoreconf +PKG_BUILD_PARALLEL:=1 PKG_INSTALL:=1 include $(INCLUDE_DIR)/package.mk @@ -95,6 +96,7 @@ CONFIGURE_ARGS += \ --with-embedded-libevent=no \ --disable-hardening \ --without-xml \ + --disable-doxygen-doc \ --sysconfdir=/tmp \ $(if $(CONFIG_LLDPD_WITH_CDP),,--disable-cdp) \ $(if $(CONFIG_LLDPD_WITH_FDP),,--disable-fdp) \ @@ -104,13 +106,8 @@ CONFIGURE_ARGS += \ $(if $(CONFIG_LLDPD_WITH_DOT3),,--disable-dot3) \ $(if $(CONFIG_LLDPD_WITH_CUSTOM),,--disable-custom) \ $(if $(CONFIG_LLDPD_WITH_SONMP),,--disable-sonmp) \ - $(if $(CONFIG_LLDPD_WITH_JSON),--with-json=json-c,--with-json=no) \ - $(if $(CONFIG_LLDPD_WITH_SNMP),--with-snmp,) - -# there is no flag to disable libbsd -CONFIGURE_VARS += \ - $(if $(CONFIG_USE_GLIBC),,libbsd_CFLAGS=-ldo-not-link-bsd) \ - $(if $(CONFIG_USE_GLIBC),,libbsd_LDFLAGS=-ldo-not-link-bsd) \ - $(if $(CONFIG_USE_GLIBC),,libbsd_LIBS="-lNONexistent") + $(if $(CONFIG_LLDPD_WITH_JSON),--enable-json0,) \ + $(if $(CONFIG_LLDPD_WITH_SNMP),--with-snmp,) \ + $(if $(CONFIG_USE_GLIBC),,--without-libbsd) $(eval $(call BuildPackage,lldpd)) diff --git a/package/network/services/lldpd/files/lldpd.config b/package/network/services/lldpd/files/lldpd.config index 05eb78e7aa..8f8b62716a 100644 --- a/package/network/services/lldpd/files/lldpd.config +++ b/package/network/services/lldpd/files/lldpd.config @@ -11,6 +11,7 @@ config lldpd config # if empty, the distribution description is sent #option lldp_description "libreCMC System" + #option lldp_hostname "Modified Hostname" # interfaces to listen on list interface "loopback" diff --git a/package/network/services/lldpd/files/lldpd.init b/package/network/services/lldpd/files/lldpd.init index 6a5b2df077..fcb920698f 100644 --- a/package/network/services/lldpd/files/lldpd.init +++ b/package/network/services/lldpd/files/lldpd.init @@ -28,6 +28,9 @@ write_lldpd_conf() config_load 'lldpd' config_get lldp_description 'config' 'lldp_description' "$(find_release_info)" + local lldp_hostname + config_get lldp_hostname 'config' 'lldp_hostname' "$(cat /proc/sys/kernel/hostname)" + local ifaces config_get ifaces 'config' 'interface' @@ -43,6 +46,7 @@ write_lldpd_conf() echo -n > "$LLDPD_CONF" [ -n "$ifnames" ] && echo "configure system interface pattern" "$ifnames" >> "$LLDPD_CONF" [ -n "$lldp_description" ] && echo "configure system description" "\"$lldp_description\"" >> "$LLDPD_CONF" + [ -n "$lldp_hostname" ] && echo "configure system hostname" "\"$lldp_hostname\"" >> "$LLDPD_CONF" # Since lldpd's sysconfdir is /tmp, we'll symlink /etc/lldpd.d to /tmp/$LLDPD_CONFS_DIR [ -e $LLDPD_CONFS_DIR ] || ln -s /etc/lldpd.d $LLDPD_CONFS_DIR diff --git a/package/network/services/lldpd/patches/001-disable_libcap.patch b/package/network/services/lldpd/patches/001-disable_libcap.patch new file mode 100644 index 0000000000..850d493c6f --- /dev/null +++ b/package/network/services/lldpd/patches/001-disable_libcap.patch @@ -0,0 +1,17 @@ +--- a/configure.ac 2019-04-30 17:04:53.542449926 +0300 ++++ b/configure.ac 2019-04-30 17:06:26.974453867 +0300 +@@ -244,7 +244,13 @@ + + # Third-party libraries + lldp_CHECK_LIBEVENT +-lldp_CHECK_LIBCAP ++ ++#libcap is not a core package so disable this capability ++#lldp_CHECK_LIBCAP ++libcap_LIBS= ++libcap_CFLAGS= ++AC_SUBST([libcap_LIBS]) ++AC_SUBST([libcap_CFLAGS]) + + # Compatibility with pkg.m4 < 0.27 + m4_ifdef([PKG_INSTALLDIR], [PKG_INSTALLDIR], diff --git a/package/network/services/odhcpd/Makefile b/package/network/services/odhcpd/Makefile index f92708b36c..875ad5da67 100644 --- a/package/network/services/odhcpd/Makefile +++ b/package/network/services/odhcpd/Makefile @@ -12,9 +12,9 @@ PKG_RELEASE:=3 PKG_SOURCE_PROTO:=git PKG_SOURCE_URL=$(PROJECT_GIT)/odhcpd.git -PKG_SOURCE_DATE:=2019-02-27 -PKG_SOURCE_VERSION:=16c5b6c9bcb71bb67a6ab15bb458bf9ab5a8fe7e -PKG_MIRROR_HASH:=bb42751da2a9d8fa1576db97524711af3fbf3758598f0dc631c075f6413796fd +PKG_SOURCE_DATE:=2019-08-19 +PKG_SOURCE_VERSION:=949476e8f6e8fc5331a577198097d49def703c76 +PKG_MIRROR_HASH:=1cbd60a187bd4b9d0acbbdd213b771912dc6084df4537ef5229c2a306c3adf88 PKG_MAINTAINER:=Hans Dedecker PKG_LICENSE:=GPL-2.0 diff --git a/package/network/services/openvpn/Makefile b/package/network/services/openvpn/Makefile index 9eef7f4cdc..30c74789a4 100644 --- a/package/network/services/openvpn/Makefile +++ b/package/network/services/openvpn/Makefile @@ -9,14 +9,14 @@ include $(TOPDIR)/rules.mk PKG_NAME:=openvpn -PKG_VERSION:=2.4.6 -PKG_RELEASE:=3 +PKG_VERSION:=2.4.7 +PKG_RELEASE:=2 PKG_SOURCE_URL:=\ https://build.openvpn.net/downloads/releases/ \ https://swupdate.openvpn.net/community/releases/ PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz -PKG_HASH:=4f6434fa541cc9e363434ea71a16a62cf2615fb2f16af5b38f43ab5939998c26 +PKG_HASH:=a42f53570f669eaf10af68e98d65b531015ff9e12be7a62d9269ea684652f648 PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(BUILD_VARIANT)/$(PKG_NAME)-$(PKG_VERSION) PKG_MAINTAINER:=Felix Fietkau @@ -45,7 +45,7 @@ else endif endef -Package/openvpn-openssl=$(call Package/openvpn/Default,openssl,OpenSSL,+PACKAGE_openvpn-openssl:libopenssl) +Package/openvpn-openssl=$(call Package/openvpn/Default,openssl,OpenSSL,+PACKAGE_openvpn-openssl:libopenssl +@OPENSSL_WITH_DEPRECATED) Package/openvpn-mbedtls=$(call Package/openvpn/Default,mbedtls,mbedTLS,+PACKAGE_openvpn-mbedtls:libmbedtls) Package/openvpn-nossl=$(call Package/openvpn/Default,nossl,plaintext (no SSL)) diff --git a/package/network/services/openvpn/files/openvpn.init b/package/network/services/openvpn/files/openvpn.init index ebb05640d8..a7d35d1a98 100644 --- a/package/network/services/openvpn/files/openvpn.init +++ b/package/network/services/openvpn/files/openvpn.init @@ -53,13 +53,14 @@ append_list() { local p; local v; local s="$1"; shift list_cb_append() { - v="$1:${v}" + v="${v}:$1" } for p in $*; do + unset v config_list_foreach "$s" "$p" list_cb_append + [ -n "$v" ] && append_param "$s" "$p" && echo " ${v:1}" >> "/var/etc/openvpn-$s.conf" done - [ -n "$v" ] && append_param "$s" "$p" && echo " ${v%*:}" >> "/var/etc/openvpn-$s.conf" } section_enabled() { diff --git a/package/network/services/openvpn/patches/100-mbedtls-disable-runtime-version-check.patch b/package/network/services/openvpn/patches/100-mbedtls-disable-runtime-version-check.patch index 5608fa4430..7fc0089000 100644 --- a/package/network/services/openvpn/patches/100-mbedtls-disable-runtime-version-check.patch +++ b/package/network/services/openvpn/patches/100-mbedtls-disable-runtime-version-check.patch @@ -1,6 +1,6 @@ --- a/src/openvpn/ssl_mbedtls.c +++ b/src/openvpn/ssl_mbedtls.c -@@ -1394,7 +1394,7 @@ const char * +@@ -1406,7 +1406,7 @@ const char * get_ssl_library_version(void) { static char mbedtls_version[30]; diff --git a/package/network/services/openvpn/patches/210-build_always_use_internal_lz4.patch b/package/network/services/openvpn/patches/210-build_always_use_internal_lz4.patch index a99f923644..dc4039c3e6 100644 --- a/package/network/services/openvpn/patches/210-build_always_use_internal_lz4.patch +++ b/package/network/services/openvpn/patches/210-build_always_use_internal_lz4.patch @@ -1,6 +1,6 @@ --- a/configure.ac +++ b/configure.ac -@@ -1077,68 +1077,15 @@ dnl +@@ -1078,68 +1078,15 @@ dnl AC_ARG_VAR([LZ4_CFLAGS], [C compiler flags for lz4]) AC_ARG_VAR([LZ4_LIBS], [linker flags for lz4]) if test "$enable_lz4" = "yes" && test "$enable_comp_stub" = "no"; then diff --git a/package/network/services/ppp/Makefile b/package/network/services/ppp/Makefile index e4a90384d4..c8016dc619 100644 --- a/package/network/services/ppp/Makefile +++ b/package/network/services/ppp/Makefile @@ -9,13 +9,13 @@ include $(TOPDIR)/rules.mk include $(INCLUDE_DIR)/kernel.mk PKG_NAME:=ppp -PKG_RELEASE:=1 +PKG_RELEASE:=2 PKG_SOURCE_PROTO:=git PKG_SOURCE_URL:=https://github.com/paulusmack/ppp -PKG_SOURCE_DATE:=2018-06-23 -PKG_SOURCE_VERSION:=5c765a67fd25f9d84e71ed61ace37c8c97f6be15 -PKG_MIRROR_HASH:=a79e62d0569e3d6a3207f2a693532d34629fb5b3b9d8c1d9b9786ebd1d1de70f +PKG_SOURCE_DATE:=2019-05-25 +PKG_SOURCE_VERSION:=8e77984ac5d7acbe68b2b2f590abd17564c9730d +PKG_MIRROR_HASH:=7e7e74f0261db2c45770d79c6114e768382e85bfeb3f5a83179f270d6c15006d PKG_MAINTAINER:=Felix Fietkau PKG_LICENSE:=BSD-4-Clause PKG_CPE_ID:=cpe:/a:samba:ppp diff --git a/package/network/services/ppp/files/ppp.sh b/package/network/services/ppp/files/ppp.sh index 2d9ca6d284..b553effd88 100755 --- a/package/network/services/ppp/files/ppp.sh +++ b/package/network/services/ppp/files/ppp.sh @@ -210,6 +210,9 @@ proto_pppoe_init_config() { proto_config_add_string "ac" proto_config_add_string "service" proto_config_add_string "host_uniq" + proto_config_add_int "padi_attempts" + proto_config_add_int "padi_timeout" + lasterror=1 } @@ -227,12 +230,16 @@ proto_pppoe_setup() { json_get_var ac ac json_get_var service service json_get_var host_uniq host_uniq + json_get_var padi_attempts padi_attempts + json_get_var padi_timeout padi_timeout ppp_generic_setup "$config" \ plugin rp-pppoe.so \ ${ac:+rp_pppoe_ac "$ac"} \ ${service:+rp_pppoe_service "$service"} \ ${host_uniq:+host-uniq "$host_uniq"} \ + ${padi_attempts:+pppoe-padi-attempts $padi_attempts} \ + ${padi_timeout:+pppoe-padi-timeout $padi_timeout} \ "nic-$iface" } diff --git a/package/network/services/ppp/patches/140-pppoe_compile_fix.patch b/package/network/services/ppp/patches/140-pppoe_compile_fix.patch index e25c567033..d82d106a50 100644 --- a/package/network/services/ppp/patches/140-pppoe_compile_fix.patch +++ b/package/network/services/ppp/patches/140-pppoe_compile_fix.patch @@ -34,14 +34,3 @@ /* Ethernet frame types according to RFC 2516 */ ---- a/pppd/plugins/rp-pppoe/Makefile.linux -+++ b/pppd/plugins/rp-pppoe/Makefile.linux -@@ -33,7 +33,7 @@ pppoe-discovery: pppoe-discovery.o debug - $(CC) $(LDFLAGS) -o pppoe-discovery pppoe-discovery.o debug.o - - pppoe-discovery.o: pppoe-discovery.c -- $(CC) $(CFLAGS) -c -o pppoe-discovery.o pppoe-discovery.c -+ $(CC) $(CFLAGS) -I../../.. -c -o pppoe-discovery.o pppoe-discovery.c - - debug.o: debug.c - $(CC) $(CFLAGS) -c -o debug.o debug.c diff --git a/package/network/services/ppp/patches/203-opt_flags.patch b/package/network/services/ppp/patches/203-opt_flags.patch index e79bbe4746..8dfacf3834 100644 --- a/package/network/services/ppp/patches/203-opt_flags.patch +++ b/package/network/services/ppp/patches/203-opt_flags.patch @@ -50,7 +50,7 @@ Signed-off-by: Jo-Philipp Wich --- a/pppd/plugins/rp-pppoe/Makefile.linux +++ b/pppd/plugins/rp-pppoe/Makefile.linux @@ -39,7 +39,7 @@ debug.o: debug.c - $(CC) $(CFLAGS) -c -o debug.o debug.c + $(CC) $(CFLAGS) -I../../.. -c -o debug.o debug.c rp-pppoe.so: plugin.o discovery.o if.o common.o - $(CC) $(LDFLAGS) -o rp-pppoe.so -shared plugin.o discovery.o if.o common.o diff --git a/package/network/services/ppp/patches/204-radius_config.patch b/package/network/services/ppp/patches/204-radius_config.patch index c97a535079..2f30b9d3dc 100644 --- a/package/network/services/ppp/patches/204-radius_config.patch +++ b/package/network/services/ppp/patches/204-radius_config.patch @@ -1,6 +1,6 @@ --- a/pppd/plugins/radius/config.c +++ b/pppd/plugins/radius/config.c -@@ -369,31 +369,37 @@ static int test_config(char *filename) +@@ -371,31 +371,37 @@ static int test_config(char *filename) } #endif diff --git a/package/network/services/ppp/patches/205-no_exponential_timeout.patch b/package/network/services/ppp/patches/205-no_exponential_timeout.patch index 1395ca5177..7f752e3137 100644 --- a/package/network/services/ppp/patches/205-no_exponential_timeout.patch +++ b/package/network/services/ppp/patches/205-no_exponential_timeout.patch @@ -7,7 +7,7 @@ Signed-off-by: Jo-Philipp Wich --- a/pppd/plugins/rp-pppoe/discovery.c +++ b/pppd/plugins/rp-pppoe/discovery.c -@@ -644,7 +644,9 @@ discovery(PPPoEConnection *conn) +@@ -632,7 +632,9 @@ discovery(PPPoEConnection *conn) conn->discoveryState = STATE_SENT_PADI; waitForPADO(conn, timeout); @@ -17,7 +17,7 @@ Signed-off-by: Jo-Philipp Wich } while (conn->discoveryState == STATE_SENT_PADI); timeout = conn->discoveryTimeout; -@@ -659,7 +661,9 @@ discovery(PPPoEConnection *conn) +@@ -647,7 +649,9 @@ discovery(PPPoEConnection *conn) sendPADR(conn); conn->discoveryState = STATE_SENT_PADR; waitForPADS(conn, timeout); diff --git a/package/network/services/ppp/patches/400-simplify_kernel_checks.patch b/package/network/services/ppp/patches/400-simplify_kernel_checks.patch index 05cbdb11ba..cd7ae9db76 100644 --- a/package/network/services/ppp/patches/400-simplify_kernel_checks.patch +++ b/package/network/services/ppp/patches/400-simplify_kernel_checks.patch @@ -80,7 +80,7 @@ Signed-off-by: Jo-Philipp Wich /* * This is the PPP device. Validate the version of the driver at this -@@ -2727,6 +2734,7 @@ get_pty(master_fdp, slave_fdp, slave_nam +@@ -2730,6 +2737,7 @@ get_pty(master_fdp, slave_fdp, slave_nam } #endif /* TIOCGPTN */ @@ -88,7 +88,7 @@ Signed-off-by: Jo-Philipp Wich if (sfd < 0) { /* the old way - scan through the pty name space */ for (i = 0; i < 64; ++i) { -@@ -2745,6 +2753,7 @@ get_pty(master_fdp, slave_fdp, slave_nam +@@ -2748,6 +2756,7 @@ get_pty(master_fdp, slave_fdp, slave_nam } } } @@ -125,7 +125,7 @@ Signed-off-by: Jo-Philipp Wich char *pppd_pppoe_service = NULL; static char *acName = NULL; static char *existingSession = NULL; -@@ -372,10 +369,6 @@ PPPoEDevnameHook(char *cmd, char **argv, +@@ -385,10 +382,6 @@ PPPoEDevnameHook(char *cmd, char **argv, void plugin_init(void) { @@ -138,7 +138,7 @@ Signed-off-by: Jo-Philipp Wich info("RP-PPPoE plugin version %s compiled against pppd %s", --- a/pppd/plugins/pppol2tp/pppol2tp.c +++ b/pppd/plugins/pppol2tp/pppol2tp.c -@@ -486,12 +486,7 @@ static void pppol2tp_cleanup(void) +@@ -490,12 +490,7 @@ static void pppol2tp_cleanup(void) void plugin_init(void) { diff --git a/package/network/services/ppp/patches/520-uniq.patch b/package/network/services/ppp/patches/520-uniq.patch deleted file mode 100644 index fddb07f253..0000000000 --- a/package/network/services/ppp/patches/520-uniq.patch +++ /dev/null @@ -1,269 +0,0 @@ ---- a/pppd/plugins/rp-pppoe/common.c -+++ b/pppd/plugins/rp-pppoe/common.c -@@ -119,15 +119,11 @@ sendPADT(PPPoEConnection *conn, char con - conn->session = 0; - - /* If we're using Host-Uniq, copy it over */ -- if (conn->useHostUniq) { -- PPPoETag hostUniq; -- pid_t pid = getpid(); -- hostUniq.type = htons(TAG_HOST_UNIQ); -- hostUniq.length = htons(sizeof(pid)); -- memcpy(hostUniq.payload, &pid, sizeof(pid)); -- memcpy(cursor, &hostUniq, sizeof(pid) + TAG_HDR_SIZE); -- cursor += sizeof(pid) + TAG_HDR_SIZE; -- plen += sizeof(pid) + TAG_HDR_SIZE; -+ if (conn->hostUniq.length) { -+ int len = ntohs(conn->hostUniq.length); -+ memcpy(cursor, &conn->hostUniq, len + TAG_HDR_SIZE); -+ cursor += len + TAG_HDR_SIZE; -+ plen += len + TAG_HDR_SIZE; - } - - /* Copy error message */ ---- a/pppd/plugins/rp-pppoe/discovery.c -+++ b/pppd/plugins/rp-pppoe/discovery.c -@@ -80,13 +80,10 @@ static void - parseForHostUniq(UINT16_t type, UINT16_t len, unsigned char *data, - void *extra) - { -- int *val = (int *) extra; -- if (type == TAG_HOST_UNIQ && len == sizeof(pid_t)) { -- pid_t tmp; -- memcpy(&tmp, data, len); -- if (tmp == getpid()) { -- *val = 1; -- } -+ PPPoETag *tag = extra; -+ -+ if (type == TAG_HOST_UNIQ && len == ntohs(tag->length)) { -+ tag->length = memcmp(data, tag->payload, len); - } - } - -@@ -104,16 +101,16 @@ parseForHostUniq(UINT16_t type, UINT16_t - static int - packetIsForMe(PPPoEConnection *conn, PPPoEPacket *packet) - { -- int forMe = 0; -+ PPPoETag hostUniq = conn->hostUniq; - - /* If packet is not directed to our MAC address, forget it */ - if (memcmp(packet->ethHdr.h_dest, conn->myEth, ETH_ALEN)) return 0; - - /* If we're not using the Host-Unique tag, then accept the packet */ -- if (!conn->useHostUniq) return 1; -+ if (!conn->hostUniq.length) return 1; - -- parsePacket(packet, parseForHostUniq, &forMe); -- return forMe; -+ parsePacket(packet, parseForHostUniq, &hostUniq); -+ return (hostUniq.length == 0); - } - - /********************************************************************** -@@ -301,16 +298,12 @@ sendPADI(PPPoEConnection *conn) - } - - /* If we're using Host-Uniq, copy it over */ -- if (conn->useHostUniq) { -- PPPoETag hostUniq; -- pid_t pid = getpid(); -- hostUniq.type = htons(TAG_HOST_UNIQ); -- hostUniq.length = htons(sizeof(pid)); -- memcpy(hostUniq.payload, &pid, sizeof(pid)); -- CHECK_ROOM(cursor, packet.payload, sizeof(pid) + TAG_HDR_SIZE); -- memcpy(cursor, &hostUniq, sizeof(pid) + TAG_HDR_SIZE); -- cursor += sizeof(pid) + TAG_HDR_SIZE; -- plen += sizeof(pid) + TAG_HDR_SIZE; -+ if (conn->hostUniq.length) { -+ int len = ntohs(conn->hostUniq.length); -+ CHECK_ROOM(cursor, packet.payload, len + TAG_HDR_SIZE); -+ memcpy(cursor, &conn->hostUniq, len + TAG_HDR_SIZE); -+ cursor += len + TAG_HDR_SIZE; -+ plen += len + TAG_HDR_SIZE; - } - - /* Add our maximum MTU/MRU */ -@@ -478,16 +471,12 @@ sendPADR(PPPoEConnection *conn) - cursor += namelen + TAG_HDR_SIZE; - - /* If we're using Host-Uniq, copy it over */ -- if (conn->useHostUniq) { -- PPPoETag hostUniq; -- pid_t pid = getpid(); -- hostUniq.type = htons(TAG_HOST_UNIQ); -- hostUniq.length = htons(sizeof(pid)); -- memcpy(hostUniq.payload, &pid, sizeof(pid)); -- CHECK_ROOM(cursor, packet.payload, sizeof(pid)+TAG_HDR_SIZE); -- memcpy(cursor, &hostUniq, sizeof(pid) + TAG_HDR_SIZE); -- cursor += sizeof(pid) + TAG_HDR_SIZE; -- plen += sizeof(pid) + TAG_HDR_SIZE; -+ if (conn->hostUniq.length) { -+ int len = ntohs(conn->hostUniq.length); -+ CHECK_ROOM(cursor, packet.payload, len+TAG_HDR_SIZE); -+ memcpy(cursor, &conn->hostUniq, len + TAG_HDR_SIZE); -+ cursor += len + TAG_HDR_SIZE; -+ plen += len + TAG_HDR_SIZE; - } - - /* Add our maximum MTU/MRU */ ---- a/pppd/plugins/rp-pppoe/plugin.c -+++ b/pppd/plugins/rp-pppoe/plugin.c -@@ -65,6 +65,7 @@ static char *existingSession = NULL; - static int printACNames = 0; - static char *pppoe_reqd_mac = NULL; - unsigned char pppoe_reqd_mac_addr[6]; -+static char *host_uniq = NULL; - - static int PPPoEDevnameHook(char *cmd, char **argv, int doit); - static option_t Options[] = { -@@ -82,6 +83,8 @@ static option_t Options[] = { - "Be verbose about discovered access concentrators"}, - { "pppoe-mac", o_string, &pppoe_reqd_mac, - "Only connect to specified MAC address" }, -+ { "host-uniq", o_string, &host_uniq, -+ "Specify custom Host-Uniq" }, - { NULL } - }; - int (*OldDevnameHook)(char *cmd, char **argv, int doit) = NULL; -@@ -107,7 +110,6 @@ PPPOEInitDevice(void) - conn->ifName = devnam; - conn->discoverySocket = -1; - conn->sessionSocket = -1; -- conn->useHostUniq = 1; - conn->printACNames = printACNames; - conn->discoveryTimeout = PADI_TIMEOUT; - return 1; -@@ -163,6 +165,9 @@ PPPOEConnectDevice(void) - if (lcp_wantoptions[0].mru > ifr.ifr_mtu - TOTAL_OVERHEAD) - lcp_wantoptions[0].mru = ifr.ifr_mtu - TOTAL_OVERHEAD; - -+ if (host_uniq && !parseHostUniq(host_uniq, &conn->hostUniq)) -+ fatal("Illegal value for host-uniq option"); -+ - conn->acName = acName; - conn->serviceName = pppd_pppoe_service; - strlcpy(ppp_devnam, devnam, sizeof(ppp_devnam)); ---- a/pppd/plugins/rp-pppoe/pppoe-discovery.c -+++ b/pppd/plugins/rp-pppoe/pppoe-discovery.c -@@ -356,7 +356,7 @@ packetIsForMe(PPPoEConnection *conn, PPP - if (memcmp(packet->ethHdr.h_dest, conn->myEth, ETH_ALEN)) return 0; - - /* If we're not using the Host-Unique tag, then accept the packet */ -- if (!conn->useHostUniq) return 1; -+ if (!conn->hostUniq.length) return 1; - - parsePacket(packet, parseForHostUniq, &forMe); - return forMe; -@@ -494,16 +494,12 @@ sendPADI(PPPoEConnection *conn) - cursor += namelen + TAG_HDR_SIZE; - - /* If we're using Host-Uniq, copy it over */ -- if (conn->useHostUniq) { -- PPPoETag hostUniq; -- pid_t pid = getpid(); -- hostUniq.type = htons(TAG_HOST_UNIQ); -- hostUniq.length = htons(sizeof(pid)); -- memcpy(hostUniq.payload, &pid, sizeof(pid)); -- CHECK_ROOM(cursor, packet.payload, sizeof(pid) + TAG_HDR_SIZE); -- memcpy(cursor, &hostUniq, sizeof(pid) + TAG_HDR_SIZE); -- cursor += sizeof(pid) + TAG_HDR_SIZE; -- plen += sizeof(pid) + TAG_HDR_SIZE; -+ if (conn->hostUniq.length) { -+ int len = ntohs(conn->hostUniq.length); -+ CHECK_ROOM(cursor, packet.payload, len + TAG_HDR_SIZE); -+ memcpy(cursor, &conn->hostUniq, len + TAG_HDR_SIZE); -+ cursor += len + TAG_HDR_SIZE; -+ plen += len + TAG_HDR_SIZE; - } - - packet.length = htons(plen); -@@ -669,7 +665,7 @@ int main(int argc, char *argv[]) - conn->discoveryTimeout = PADI_TIMEOUT; - conn->discoveryAttempts = MAX_PADI_ATTEMPTS; - -- while ((opt = getopt(argc, argv, "I:D:VUQS:C:t:a:h")) > 0) { -+ while ((opt = getopt(argc, argv, "I:D:VUW:QS:C:t:a:h")) > 0) { - switch(opt) { - case 'S': - conn->serviceName = xstrdup(optarg); -@@ -696,7 +692,23 @@ int main(int argc, char *argv[]) - } - break; - case 'U': -- conn->useHostUniq = 1; -+ if(conn->hostUniq.length) { -+ fprintf(stderr, "-U and -W are mutually exclusive\n"); -+ exit(EXIT_FAILURE); -+ } -+ char pidbuf[5]; -+ snprintf(pidbuf, sizeof(pidbuf), "%04x", getpid()); -+ parseHostUniq(pidbuf, &conn->hostUniq); -+ break; -+ case 'W': -+ if(conn->hostUniq.length) { -+ fprintf(stderr, "-U and -W are mutually exclusive\n"); -+ exit(EXIT_FAILURE); -+ } -+ if (!parseHostUniq(optarg, &conn->hostUniq)) { -+ fprintf(stderr, "Invalid host-uniq argument: %s\n", optarg); -+ exit(EXIT_FAILURE); -+ } - break; - case 'D': - conn->debugFile = fopen(optarg, "w"); ---- a/pppd/plugins/rp-pppoe/pppoe.h -+++ b/pppd/plugins/rp-pppoe/pppoe.h -@@ -21,6 +21,8 @@ - - #include /* For FILE */ - #include /* For pid_t */ -+#include -+#include - - /* How do we access raw Ethernet devices? */ - #undef USE_LINUX_PACKET -@@ -219,7 +221,7 @@ typedef struct PPPoEConnectionStruct { - char *serviceName; /* Desired service name, if any */ - char *acName; /* Desired AC name, if any */ - int synchronous; /* Use synchronous PPP */ -- int useHostUniq; /* Use Host-Uniq tag */ -+ PPPoETag hostUniq; /* Use Host-Uniq tag */ - int printACNames; /* Just print AC names */ - FILE *debugFile; /* Debug file for dumping packets */ - int numPADOs; /* Number of PADO packets received */ -@@ -276,6 +278,33 @@ void pppoe_printpkt(PPPoEPacket *packet, - void (*printer)(void *, char *, ...), void *arg); - void pppoe_log_packet(const char *prefix, PPPoEPacket *packet); - -+static inline int parseHostUniq(const char *uniq, PPPoETag *tag) -+{ -+ int i, len = strlen(uniq); -+ -+#define hex(x) \ -+ (((x) <= '9') ? ((x) - '0') : \ -+ (((x) <= 'F') ? ((x) - 'A' + 10) : \ -+ ((x) - 'a' + 10))) -+ -+ if (len % 2) -+ return 0; -+ -+ for (i = 0; i < len; i += 2) -+ { -+ if (!isxdigit(uniq[i]) || !isxdigit(uniq[i+1])) -+ return 0; -+ -+ tag->payload[i / 2] = (char)(16 * hex(uniq[i]) + hex(uniq[i+1])); -+ } -+ -+#undef hex -+ -+ tag->type = htons(TAG_HOST_UNIQ); -+ tag->length = htons(len / 2); -+ return 1; -+} -+ - #define SET_STRING(var, val) do { if (var) free(var); var = strDup(val); } while(0); - - #define CHECK_ROOM(cursor, start, len) \ diff --git a/package/network/services/ppp/patches/540-save-pppol2tp_fd_str.patch b/package/network/services/ppp/patches/540-save-pppol2tp_fd_str.patch index 7dd2ad844c..d6d44afbd0 100644 --- a/package/network/services/ppp/patches/540-save-pppol2tp_fd_str.patch +++ b/package/network/services/ppp/patches/540-save-pppol2tp_fd_str.patch @@ -1,8 +1,8 @@ --- a/pppd/plugins/pppol2tp/pppol2tp.c +++ b/pppd/plugins/pppol2tp/pppol2tp.c -@@ -148,6 +148,10 @@ static int setdevname_pppol2tp(char **ar - fatal("PPPoL2TP kernel driver not installed"); - } +@@ -152,6 +152,10 @@ static int setdevname_pppol2tp(char **ar + if (pppol2tp_fd_str == NULL) + novm("PPPoL2TP FD"); + pppol2tp_fd_str = strdup(*argv); + if (pppol2tp_fd_str == NULL) diff --git a/package/network/services/tinc/Makefile b/package/network/services/tinc/Makefile new file mode 100644 index 0000000000..a70f018f95 --- /dev/null +++ b/package/network/services/tinc/Makefile @@ -0,0 +1,64 @@ +# +# Copyright (C) 2007-2015 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +include $(TOPDIR)/rules.mk + +PKG_NAME:=tinc +PKG_VERSION:=1.0.35 +PKG_RELEASE:=3 + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=https://www.tinc-vpn.org/packages +PKG_HASH:=18c83b147cc3e2133a7ac2543eeb014d52070de01c7474287d3ccecc9b16895e + +PKG_BUILD_PARALLEL:=1 +PKG_INSTALL:=1 + +include $(INCLUDE_DIR)/package.mk + +define Package/tinc + SECTION:=net + CATEGORY:=Network + DEPENDS:=+liblzo +libopenssl +kmod-tun +zlib + TITLE:=VPN tunneling daemon + URL:=http://www.tinc-vpn.org/ + MAINTAINER:=Saverio Proto + SUBMENU:=VPN +endef + +define Package/tinc/description + tinc is a Virtual Private Network (VPN) daemon that uses tunnelling and + encryption to create a secure private network between hosts on the Internet. +endef + +TARGET_CFLAGS += -std=gnu99 + +CONFIGURE_ARGS += \ + --with-kernel="$(LINUX_DIR)" \ + --with-zlib="$(STAGING_DIR)/usr" \ + --with-lzo-include="$(STAGING_DIR)/usr/include/lzo" + +CONFIGURE_VARS += \ + ac_cv_have_decl_OpenSSL_add_all_algorithms=yes + +define Package/tinc/install + $(INSTALL_DIR) $(1)/usr/sbin + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/tincd $(1)/usr/sbin/ + $(INSTALL_DIR) $(1)/etc/init.d/ + $(INSTALL_BIN) files/$(PKG_NAME).init $(1)/etc/init.d/$(PKG_NAME) + $(INSTALL_DIR) $(1)/etc/config + $(INSTALL_CONF) files/$(PKG_NAME).config $(1)/etc/config/$(PKG_NAME) + $(INSTALL_DIR) $(1)/etc/tinc + $(INSTALL_DIR) $(1)/lib/upgrade/keep.d + $(INSTALL_DATA) files/tinc.upgrade $(1)/lib/upgrade/keep.d/tinc +endef + +define Package/tinc/conffiles +/etc/config/tinc +endef + +$(eval $(call BuildPackage,tinc)) diff --git a/package/network/services/tinc/files/tinc.config b/package/network/services/tinc/files/tinc.config new file mode 100644 index 0000000000..18940781aa --- /dev/null +++ b/package/network/services/tinc/files/tinc.config @@ -0,0 +1,56 @@ +config tinc-net NETNAME + option enabled 0 + + ## Daemon Configuration (cmd arguments) + #option generate_keys 0 + #option key_size 2048 + #option logfile /tmp/log/tinc.NETNAME.log + #option debug 3 + + ## Server Configuration (tinc.conf) + #option AddressFamily any + #option BindToAddress 127.0.0.1 + #option BindToInterface lo + + #list ConnectTo peer1 + + #option DirectOnly 0 + #option Forwarding internal + #option GraphDumpFile /tmp/log/tinc.NETNAME.dot + #option Hostnames 0 + #option IffOneQueue 0 + #option Interface NETNAME + #option KeyExpire 3600 + #option MACExpire 600 + #option MaxTimeout 900 + #option Mode router + + option Name NODENAME + + #option PingInterval 60 + #option PingTimeout 5 + #option PriorityInheritance 0 + #option PrivateKeyFile /etc/tinc/NETNAME/rsa_key.priv + #option ProcessPriority normal + #option ReplayWindow 16 + #option StrictSubnets 0 + #option TunnelServer 0 + #option UDPRcvBuf x + #option UDPSndBuf x + +config tinc-host NODENAME + option enabled 0 + + option net NETNAME + + #list Address example.com + #option Cipher blowfish + #option ClampMSS yes + #option Compression 0 + #option Digest sha1 + #option IndirectData 0 + #option MACLength 4 + #option PMTU 1514 + #option PMTUDiscovery yes + #option Port 655 + #option Subnet 192.168.1.0/24 diff --git a/package/network/services/tinc/files/tinc.init b/package/network/services/tinc/files/tinc.init new file mode 100644 index 0000000000..e49b358770 --- /dev/null +++ b/package/network/services/tinc/files/tinc.init @@ -0,0 +1,239 @@ +#!/bin/sh /etc/rc.common +# Copyright (C) 2011 OpenWrt.org +# Copyright (C) 2011 Linus Lüssing +# Based on Jo-Philipp Wich's OpenVPN init script +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. + +START=42 + +SERVICE_USE_PID=1 + +BIN=/usr/sbin/tincd +EXTRA_COMMANDS="up down" + +LIST_SEP=" +" +TMP_TINC="/tmp/tinc" + +append_param() { + local v="$1" + case "$v" in + *_*_*_*) v=${v%%_*}-${v#*_}; v=${v%%_*}-${v#*_}; v=${v%%_*}-${v#*_} ;; + *_*_*) v=${v%%_*}-${v#*_}; v=${v%%_*}-${v#*_} ;; + *_*) v=${v%%_*}-${v#*_} ;; + esac + ARGS="$ARGS --$v" + return 0 +} + +append_conf_bools() { + local p; local v; local s="$1"; local f="$2"; shift; shift + for p in $*; do + config_get_bool v "$s" "$p" + [ "$v" == 1 ] && echo "$p = yes" >> "$f" + [ "$v" == 0 ] && echo "$p = no" >> "$f" + done +} + +append_params() { + local p; local v; local s="$1"; shift + for p in $*; do + config_get v "$s" "$p" + IFS="$LIST_SEP" + for v in $v; do + [ -n "$v" ] && append_param "$p" && ARGS="$ARGS=$v" + done + unset IFS + done +} + +append_conf_params() { + local p; local v; local s="$1"; local f="$2"; shift; shift + for p in $*; do + config_get v "$s" "$p" + IFS="$LIST_SEP" + for v in $v; do + # Look up OpenWRT interface names + [ "$p" = "BindToInterface" ] && { + local ifname=$(uci -P /var/state get network.$v.ifname 2>&-) + [ -n "$ifname" ] && v="$ifname" + } + + [ -n "$v" ] && echo "$p = $v" >> "$f" + done + unset IFS + done +} + +section_enabled() { + config_get_bool enabled "$1" 'enabled' 0 + [ $enabled -gt 0 ] +} + +prepare_host() { + local s="$1" + local n + + # net disabled? + config_get n "$s" net + section_enabled "$n" || return 1 + + if [ "$#" = "2" ]; then + [ "$2" != "$n" ] && return 1 + fi + + # host disabled? + section_enabled "$s" || { + [ -f "$TMP_TINC/$n/hosts/$s" ] && rm "$TMP_TINC/$n/hosts/$s" + return 1 + } + + [ ! -f "/etc/tinc/$n/hosts/$s" ] && { + echo -n "tinc: Warning, public key for $s for network $n " + echo -n "missing in /etc/tinc/$n/hosts/$s, " + echo "skipping configuration of $s" + return 1 + } + + # append flags + append_conf_bools "$s" "$TMP_TINC/$n/hosts/$s" \ + ClampMSS IndirectData PMTUDiscovery TCPOnly + + # append params + append_conf_params "$s" "$TMP_TINC/$n/hosts/$s" \ + Address Cipher Compression Digest MACLength PMTU \ + Port PublicKey PublicKeyFile Subnet +} + +check_gen_own_key() { + local s="$1"; local n; local k + + config_get n "$s" Name + config_get_bool k "$s" generate_keys 0 + [ "$k" == 0 ] && return 0 + + ([ -z "$n" ] || [ -f "$TMP_TINC/$s/hosts/$n" ] || [ -f "$TMP_TINC/$s/rsa_key.priv" ]) && \ + return 0 + [ ! -d "$TMP_TINC/$s/hosts" ] && mkdir -p "$TMP_TINC/$s/hosts" + + config_get k "$s" key_size + if [ -z "$k" ]; then + $BIN -c "$TMP_TINC/$s" --generate-keys +Date: Wed, 12 Dec 2018 13:40:37 -0800 +Subject: [PATCH 1/2] Fix compilation when OpenSSL has no ENGINE support + +This will be the case in OpenWrt soon. +--- + src/tincd.c | 6 ++++++ + 1 file changed, 6 insertions(+) + +diff --git a/src/tincd.c b/src/tincd.c +index 7b882c7a..bdac0c9d 100644 +--- a/src/tincd.c ++++ b/src/tincd.c +@@ -37,7 +37,9 @@ + #include + #include + #include ++#ifndef OPENSSL_NO_ENGINE + #include ++#endif + + #ifdef HAVE_LZO + #include LZO1X_H +@@ -685,8 +687,10 @@ int main(int argc, char **argv) { + + init_configuration(&config_tree); + ++#ifndef OPENSSL_NO_ENGINE + ENGINE_load_builtin_engines(); + ENGINE_register_all_complete(); ++#endif + + OpenSSL_add_all_algorithms(); + +@@ -809,7 +813,9 @@ end: + + EVP_cleanup(); + ERR_free_strings(); ++#ifndef OPENSSL_NO_ENGINE + ENGINE_cleanup(); ++#endif + + exit_configuration(&config_tree); + list_delete_list(cmdline_conf); +-- +2.20.0 + diff --git a/package/network/services/tinc/patches/020-Fix-compilation-without-deprecated-OpenSSL-APIs.patch b/package/network/services/tinc/patches/020-Fix-compilation-without-deprecated-OpenSSL-APIs.patch new file mode 100644 index 0000000000..52fecc90c9 --- /dev/null +++ b/package/network/services/tinc/patches/020-Fix-compilation-without-deprecated-OpenSSL-APIs.patch @@ -0,0 +1,98 @@ +From 5e0e401dc69b9c25e5f85de7484a70ea97862e16 Mon Sep 17 00:00:00 2001 +From: Rosen Penev +Date: Wed, 12 Dec 2018 13:45:59 -0800 +Subject: [PATCH 2/2] Fix compilation without deprecated OpenSSL APIs + +This is an optional part of OpenWrt designed to save space. +--- + src/connection.c | 4 ++-- + src/connection.h | 4 ++++ + src/net_setup.c | 1 + + src/tincd.c | 5 +++++ + 4 files changed, 12 insertions(+), 2 deletions(-) + +diff --git a/src/connection.c b/src/connection.c +index 38b3ccfe..d137af12 100644 +--- a/src/connection.c ++++ b/src/connection.c +@@ -96,13 +96,13 @@ void free_connection_partially(connection_t *c) { + c->outbudget = 0; + + if(c->inctx) { +- EVP_CIPHER_CTX_cleanup(c->inctx); ++ EVP_CIPHER_CTX_reset(c->inctx); + free(c->inctx); + c->inctx = NULL; + } + + if(c->outctx) { +- EVP_CIPHER_CTX_cleanup(c->outctx); ++ EVP_CIPHER_CTX_reset(c->outctx); + free(c->outctx); + c->outctx = NULL; + } +diff --git a/src/connection.h b/src/connection.h +index 629e16b9..4f554672 100644 +--- a/src/connection.h ++++ b/src/connection.h +@@ -24,6 +24,10 @@ + #include + #include + ++#if OPENSSL_VERSION_NUMBER < 0x10100000L ++#define EVP_CIPHER_CTX_reset(c) EVP_CIPHER_CTX_cleanup(c) ++#endif ++ + #include "avl_tree.h" + + #define OPTION_INDIRECT 0x0001 +diff --git a/src/net_setup.c b/src/net_setup.c +index cac7455d..f26007bd 100644 +--- a/src/net_setup.c ++++ b/src/net_setup.c +@@ -27,6 +27,7 @@ + #include + #include + #include ++#include + + #include "avl_tree.h" + #include "conf.h" +diff --git a/src/tincd.c b/src/tincd.c +index bdac0c9d..e8a60449 100644 +--- a/src/tincd.c ++++ b/src/tincd.c +@@ -40,6 +40,7 @@ + #ifndef OPENSSL_NO_ENGINE + #include + #endif ++#include + + #ifdef HAVE_LZO + #include LZO1X_H +@@ -692,7 +693,9 @@ int main(int argc, char **argv) { + ENGINE_register_all_complete(); + #endif + ++#if OPENSSL_VERSION_NUMBER < 0x10100000L + OpenSSL_add_all_algorithms(); ++#endif + + if(generate_keys) { + read_server_config(); +@@ -811,10 +814,12 @@ end: + + free(priority); + ++#if OPENSSL_VERSION_NUMBER < 0x10100000L + EVP_cleanup(); + ERR_free_strings(); + #ifndef OPENSSL_NO_ENGINE + ENGINE_cleanup(); ++#endif + #endif + + exit_configuration(&config_tree); +-- +2.20.0 + diff --git a/package/network/services/tinyproxy/Makefile b/package/network/services/tinyproxy/Makefile new file mode 100644 index 0000000000..a7865c96e8 --- /dev/null +++ b/package/network/services/tinyproxy/Makefile @@ -0,0 +1,51 @@ +# +# Copyright (C) 2006-2014 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +include $(TOPDIR)/rules.mk + +PKG_NAME:=tinyproxy +PKG_VERSION:=1.8.3 +PKG_RELEASE:=3 + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2 +PKG_SOURCE_URL:=http://www.banu.com/pub/tinyproxy/1.8/ +PKG_HASH:=be559b54eb4772a703ad35239d1cb59d32f7cf8a739966742622d57df88b896e +PKG_MAINTAINER:=Jo-Philipp Wich + +PKG_INSTALL:=1 + +include $(INCLUDE_DIR)/package.mk + +define Package/tinyproxy + SUBMENU:=Web Servers/Proxies + SECTION:=net + CATEGORY:=Network + TITLE:=Tinyproxy is a lightweight HTTP and HTTPS proxy + URL:=http://tinyproxy.sourceforge.net/ +endef + +define Package/tinyproxy/conffiles +/etc/config/tinyproxy +endef + +CONFIGURE_ARGS+= \ + --enable-filter \ + --enable-transparent \ + --disable-regexcheck \ + +define Package/tinyproxy/install + $(INSTALL_DIR) $(1)/usr/sbin + $(CP) $(PKG_INSTALL_DIR)/usr/sbin/tinyproxy $(1)/usr/sbin/ + $(INSTALL_DIR) $(1)/usr/share/tinyproxy + $(CP) $(PKG_INSTALL_DIR)/usr/share/tinyproxy/*.html $(1)/usr/share/tinyproxy/ + $(INSTALL_DIR) $(1)/etc/config + $(INSTALL_CONF) ./files/tinyproxy.config $(1)/etc/config/tinyproxy + $(INSTALL_DIR) $(1)/etc/init.d + $(INSTALL_BIN) ./files/tinyproxy.init $(1)/etc/init.d/tinyproxy +endef + +$(eval $(call BuildPackage,tinyproxy)) diff --git a/package/network/services/tinyproxy/files/tinyproxy.config b/package/network/services/tinyproxy/files/tinyproxy.config new file mode 100644 index 0000000000..ac7b46ff0c --- /dev/null +++ b/package/network/services/tinyproxy/files/tinyproxy.config @@ -0,0 +1,251 @@ +config tinyproxy + +# +# Enable the proxy +# +option enabled 0 + +# +# Name of the user the tinyproxy daemon should switch to after the port +# has been bound. +# +option User nobody +option Group nogroup + +# +# Port to listen on. +# +option Port 8888 + +# +# If you have multiple interfaces this allows you to bind to only one. If +# this is commented out, tinyproxy will bind to all interfaces present. +# +#option Listen 192.168.0.1 + +# +# The Bind directive allows you to bind the outgoing connections to a +# particular IP address. +# +#option Bind 192.168.0.1 + +# +# Timeout: The number of seconds of inactivity a connection is allowed to +# have before it closed by tinyproxy. +# +option Timeout 600 + +# +# ErrorFile: Defines the HTML file to send when a given HTTP error +# occurs. You will probably need to customize the location to your +# particular install. The usual locations to check are: +# /usr/local/share/tinyproxy +# /usr/share/tinyproxy +# /etc/tinyproxy +# +#option ErrorFile_404 "/usr/share/tinyproxy/404.html" +#option ErrorFile_400 "/usr/share/tinyproxy/400.html" +#option ErrorFile_503 "/usr/share/tinyproxy/503.html" +#option ErrorFile_403 "/usr/share/tinyproxy/403.html" +#option ErrorFile_408 "/usr/share/tinyproxy/408.html" + +# +# DefaultErrorFile: The HTML file that gets sent if there is no +# HTML file defined with an ErrorFile keyword for the HTTP error +# that has occurred. +# +option DefaultErrorFile "/usr/share/tinyproxy/default.html" + +# +# StatFile: The HTML file that gets sent when a request is made +# for the stathost. If this file doesn't exist a basic page is +# hardcoded in tinyproxy. +# +option StatFile "/usr/share/tinyproxy/stats.html" + +# +# Where to log the information. Either LogFile or Syslog should be set, +# but not both. +# +option LogFile "/var/log/tinyproxy.log" +#option Syslog 1 + +# +# Set the logging level. Allowed settings are: +# Critical (least verbose) +# Error +# Warning +# Notice +# Connect (to log connections without Info's noise) +# Info (most verbose) +# The LogLevel logs from the set level and above. For example, if the LogLevel +# was set to Warning, than all log messages from Warning to Critical would be +# output, but Notice and below would be suppressed. +# +option LogLevel Info + +# +# Include the X-Tinyproxy header, which has the client's IP address when +# connecting to the sites listed. +# +# list XTinyproxy mydomain.com + +# +# This is the absolute highest number of threads which will be created. In +# other words, only MaxClients number of clients can be connected at the +# same time. +# +option MaxClients 100 + +# +# These settings set the upper and lower limit for the number of +# spare servers which should be available. If the number of spare servers +# falls below MinSpareServers then new ones will be created. If the number +# of servers exceeds MaxSpareServers then the extras will be killed off. +# +option MinSpareServers 5 +option MaxSpareServers 20 + +# +# Number of servers to start initially. +# +option StartServers 10 + +# +# MaxRequestsPerChild is the number of connections a thread will handle +# before it is killed. In practise this should be set to 0, which disables +# thread reaping. If you do notice problems with memory leakage, then set +# this to something like 10000 +# +option MaxRequestsPerChild 0 + +# +# The following is the authorization controls. If there are any access +# control keywords then the default action is to DENY. Otherwise, the +# default action is ALLOW. +# +# Also the order of the controls are important. The incoming connections +# are tested against the controls based on order. +# +list Allow 127.0.0.1 +#list Allow 192.168.0.0/16 +#list Allow 172.16.0.0/12 +#list Allow 10.0.0.0/8 + +# +# The "Via" header is required by the HTTP RFC, but using the real host name +# is a security concern. If the following directive is enabled, the string +# supplied will be used as the host name in the Via header; otherwise, the +# server's host name will be used. +# +option ViaProxyName "tinyproxy" + +# +# The location of the filter file. +# +#option Filter "/etc/tinyproxy/filter" + +# +# Filter based on URLs rather than domains. +# +#option FilterURLs 1 + +# +# Use POSIX Extended regular expressions rather than basic. +# +#option FilterExtended 1 + +# +# Use case sensitive regular expressions. +# +#option FilterCaseSensitive 1 + +# +# Change the default policy of the filtering system. If this directive is +# commented out, or is set to "0" then the default policy is to allow +# everything which is not specifically denied by the filter file. +# +# However, by setting this directive to "1" the default policy becomes to +# deny everything which is _not_ specifically allowed by the filter file. +# +#option FilterDefaultDeny 1 + +# +# If an Anonymous keyword is present, then anonymous proxying is enabled. +# The headers listed are allowed through, while all others are denied. If +# no Anonymous keyword is present, then all header are allowed through. +# You must include quotes around the headers. +# +#list Anonymous "Host" +#list Anonymous "Authorization" + +# +# This is a list of ports allowed by tinyproxy when the CONNECT method +# is used. To disable the CONNECT method altogether, set the value to 0. +# If no ConnectPort line is found, all ports are allowed (which is not +# very secure.) +# +# The following two ports are used by SSL. +# +list ConnectPort 443 +list ConnectPort 563 + +# +# Turns on upstream proxy support. +# +# The upstream rules allow you to selectively route upstream connections +# based on the host/domain of the site being accessed. +# +# For example: +# # connection to test domain goes through testproxy +# +#config upstream +# option type proxy +# option via testproxy:8008 +# option target ".test.domain.invalid" +# +#config upstream +# option type proxy +# option via testproxy:8008 +# option target ".our_testbed.example.com" +# +#config upstream +# option type proxy +# option via testproxy:8008 +# option target "192.168.128.0/255.255.254.0" +# +# # no upstream proxy for internal websites and unqualified hosts +# +#config upstream +# option type reject +# option target ".internal.example.com" +# +#config upstream +# option type reject +# option target "www.example.com" +# +#config upstream +# option type reject +# option target "10.0.0.0/8" +# +#config upstream +# option type reject +# option target "192.168.0.0/255.255.254.0" +# +#config upstream +# option type reject +# option target "." +# +# # default upstream is internet firewall +# +#config upstream +# option type proxy +# option via firewall.internal.example.com:80 +# +# The LAST matching rule wins the route decision. As you can see, you +# can use a host, or a domain: +# name matches host exactly +# .name matches any host in domain "name" +# . matches any host with no domain (in 'empty' domain) +# IP/bits matches network/mask +# IP/mask matches network/mask diff --git a/package/network/services/tinyproxy/files/tinyproxy.init b/package/network/services/tinyproxy/files/tinyproxy.init new file mode 100644 index 0000000000..046783073a --- /dev/null +++ b/package/network/services/tinyproxy/files/tinyproxy.init @@ -0,0 +1,142 @@ +#!/bin/sh /etc/rc.common +# Copyright (C) 2008-2011 OpenWrt.org + +START=50 + +CFGFILE=/var/etc/tinyproxy.conf + +section_enabled() { + config_get_bool enabled "$1" 'enabled' 0 + [ $enabled -gt 0 ] +} + +start() { + config_load 'tinyproxy' + config_foreach start_proxy 'tinyproxy' +} + +stop() { + service_stop /usr/sbin/tinyproxy +} + +start_proxy() { + section_enabled "$1" || return 1 + + mkdir -m0755 -p /var/etc + echo '### AUTOGENERATED CONFIGURATION' > $CFGFILE + echo '### DO NOT EDIT' >> $CFGFILE + echo '### SEE /etc/config/tinyproxy INSTEAD' >> $CFGFILE + echo '' >> $CFGFILE + + proxy_atom "$1" User >> $CFGFILE + proxy_atom "$1" Group >> $CFGFILE + proxy_atom "$1" Port 8888 >> $CFGFILE + proxy_atom "$1" Listen >> $CFGFILE + proxy_atom "$1" Bind >> $CFGFILE + proxy_atom "$1" Timeout >> $CFGFILE + + proxy_string "$1" ErrorFile_400 "ErrorFile 400" >> $CFGFILE + proxy_string "$1" ErrorFile_403 "ErrorFile 403" >> $CFGFILE + proxy_string "$1" ErrorFile_404 "ErrorFile 404" >> $CFGFILE + proxy_string "$1" ErrorFile_408 "ErrorFile 408" >> $CFGFILE + proxy_string "$1" ErrorFile_503 "ErrorFile 503" >> $CFGFILE + + proxy_string "$1" DefaultErrorFile >> $CFGFILE + proxy_string "$1" StatHost StatHost 127.0.0.1 >> $CFGFILE + proxy_string "$1" StatFile >> $CFGFILE + proxy_string "$1" LogFile >> $CFGFILE + + proxy_flag "$1" Syslog >> $CFGFILE + + proxy_atom "$1" LogLevel >> $CFGFILE + + proxy_flag "$1" XTinyproxy >> $CFGFILE + + proxy_atom "$1" MaxClients >> $CFGFILE + proxy_atom "$1" MinSpareServers >> $CFGFILE + proxy_atom "$1" MaxSpareServers >> $CFGFILE + proxy_atom "$1" StartServers >> $CFGFILE + proxy_atom "$1" MaxRequestsPerChild >> $CFGFILE + proxy_list "$1" Allow >> $CFGFILE + + proxy_string "$1" ViaProxyName >> $CFGFILE + proxy_string "$1" Filter >> $CFGFILE + + proxy_flag "$1" FilterURLs >> $CFGFILE + proxy_flag "$1" FilterExtended >> $CFGFILE + proxy_flag "$1" FilterCaseSensitive >> $CFGFILE + proxy_flag "$1" FilterDefaultDeny Yes No >> $CFGFILE + + proxy_list "$1" Anonymous '"' >> $CFGFILE + proxy_list "$1" ConnectPort >> $CFGFILE + + config_foreach write_upstream upstream + + service_start /usr/sbin/tinyproxy -c "$CFGFILE" +} + +write_upstream() { + local type + local via + local target + + config_get "type" "$1" "type" + config_get via "$1" via + config_get target "$1" target + [ -n "$target" ] && target=' "'"$target"'"' + + [ "$type" == "proxy" -a -n "$via" ] && \ + echo "upstream $via$target" >> $CFGFILE + + [ "$type" == "reject" -a -n "$target" ] && \ + echo "no upstream$target" >> $CFGFILE +} + +proxy_atom() { + local SECTION=$1 + local OPTION=$2 + local DEFAULT=$3 + + config_get _value "$SECTION" "$OPTION" + [ -z "$_value" ] && _value="$DEFAULT" + [ -n "$_value" ] && echo "$OPTION $_value" +} + +proxy_string() { + local SECTION=$1 + local OPTION=$2 + local ALIAS=$3 + local DEFAULT=$4 + + config_get _value "$SECTION" "$OPTION" + [ -z "$_value" ] && _value="$DEFAULT" + [ -n "$_value" ] && echo "${ALIAS:-${OPTION}} "'"'"$_value"'"' + [ -n "$_value" -a "$OPTION" = "LogFile" ] && { + touch $_value + chmod 666 $_value + } +} + +proxy_flag() { + local SECTION=$1 + local OPTION=$2 + local TRUE="${3:-On}" + local FALSE="${4:-Off}" + + config_get_bool _value "$SECTION" "$OPTION" 0 + [ "$_value" -eq "1" ] && _value="$TRUE" || _value="$FALSE" + echo "$OPTION $_value" +} + +proxy_list() { + local SECTION=$1 + local OPTION=$2 + local ENCLOSE=$3 + + config_get _value "$SECTION" "$OPTION" + [ -n "$_value" ] && { + for entry in $_value; do + echo "$OPTION ${ENCLOSE}${entry}${ENCLOSE}" + done + } +} diff --git a/package/network/services/tinyproxy/patches/010-no-docs-and-tests.patch b/package/network/services/tinyproxy/patches/010-no-docs-and-tests.patch new file mode 100644 index 0000000000..cbb0dd1965 --- /dev/null +++ b/package/network/services/tinyproxy/patches/010-no-docs-and-tests.patch @@ -0,0 +1,86 @@ +--- a/configure ++++ b/configure +@@ -6815,59 +6815,8 @@ fi + + + +-# Check for asciidoc +-# Extract the first word of "a2x", so it can be a program name with args. +-set dummy a2x; ac_word=$2 +-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +-$as_echo_n "checking for $ac_word... " >&6; } +-if test "${ac_cv_path_A2X+set}" = set; then : +- $as_echo_n "(cached) " >&6 +-else +- case $A2X in +- [\\/]* | ?:[\\/]*) +- ac_cv_path_A2X="$A2X" # Let the user override the test with a path. +- ;; +- *) +- as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +-for as_dir in $PATH +-do +- IFS=$as_save_IFS +- test -z "$as_dir" && as_dir=. +- for ac_exec_ext in '' $ac_executable_extensions; do +- if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then +- ac_cv_path_A2X="$as_dir/$ac_word$ac_exec_ext" +- $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 +- break 2 +- fi +-done +- done +-IFS=$as_save_IFS +- +- test -z "$ac_cv_path_A2X" && ac_cv_path_A2X="no" +- ;; +-esac +-fi +-A2X=$ac_cv_path_A2X +-if test -n "$A2X"; then +- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $A2X" >&5 +-$as_echo "$A2X" >&6; } +-else +- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +-$as_echo "no" >&6; } +-fi +- +- +- if test "x$A2X" != "xno"; then +- HAVE_A2X_TRUE= +- HAVE_A2X_FALSE='#' +-else + HAVE_A2X_TRUE='#' + HAVE_A2X_FALSE= +-fi +- +-if test x"$A2X" = x"no"; then +- as_fn_error $? "Test for asciidoc failed. See the file 'INSTALL' for help." "$LINENO" 5 +-fi + + ac_config_files="$ac_config_files Makefile src/Makefile data/Makefile data/templates/Makefile etc/Makefile docs/Makefile docs/man5/Makefile docs/man5/tinyproxy.conf.txt docs/man8/Makefile docs/man8/tinyproxy.txt m4macros/Makefile tests/Makefile tests/scripts/Makefile" + +--- a/Makefile.am ++++ b/Makefile.am +@@ -2,9 +2,7 @@ SUBDIRS = \ + src \ + data \ + etc \ +- docs \ + m4macros \ +- tests + + # tools want this on a single line + ACLOCAL_AMFLAGS = -I m4macros +--- a/Makefile.in ++++ b/Makefile.in +@@ -222,9 +222,7 @@ SUBDIRS = \ + src \ + data \ + etc \ +- docs \ + m4macros \ +- tests + + + # tools want this on a single line diff --git a/package/network/services/tinyproxy/patches/020-config_and_pid-path.patch b/package/network/services/tinyproxy/patches/020-config_and_pid-path.patch new file mode 100644 index 0000000000..3ab7482a4e --- /dev/null +++ b/package/network/services/tinyproxy/patches/020-config_and_pid-path.patch @@ -0,0 +1,13 @@ +--- a/src/main.c ++++ b/src/main.c +@@ -326,8 +326,8 @@ static void initialize_config_defaults ( + conf->errorpages = NULL; + conf->stathost = safestrdup (TINYPROXY_STATHOST); + conf->idletimeout = MAX_IDLE_TIME; +- conf->logf_name = safestrdup (LOCALSTATEDIR "/log/tinyproxy/tinyproxy.log"); +- conf->pidpath = safestrdup (LOCALSTATEDIR "/run/tinyproxy/tinyproxy.pid"); ++ conf->logf_name = safestrdup (LOCALSTATEDIR "/log/tinyproxy.log"); ++ conf->pidpath = safestrdup (LOCALSTATEDIR "/tinyproxy.pid"); + } + + /** diff --git a/package/network/services/tinyproxy/patches/030-allow_bind_in_transparent_mode.patch b/package/network/services/tinyproxy/patches/030-allow_bind_in_transparent_mode.patch new file mode 100644 index 0000000000..68d89db4db --- /dev/null +++ b/package/network/services/tinyproxy/patches/030-allow_bind_in_transparent_mode.patch @@ -0,0 +1,22 @@ +--- a/src/conf.c ++++ b/src/conf.c +@@ -865,7 +865,6 @@ static HANDLE_FUNC (handle_deny) + + static HANDLE_FUNC (handle_bind) + { +-#ifndef TRANSPARENT_PROXY + int r = set_string_arg (&conf->bind_address, line, &match[2]); + + if (r) +@@ -873,11 +872,6 @@ static HANDLE_FUNC (handle_bind) + log_message (LOG_INFO, + "Outgoing connections bound to IP %s", conf->bind_address); + return 0; +-#else +- fprintf (stderr, +- "\"Bind\" cannot be used with transparent support enabled.\n"); +- return 1; +-#endif + } + + static HANDLE_FUNC (handle_listen) diff --git a/package/network/services/tinyproxy/patches/120-fix_INET6.patch b/package/network/services/tinyproxy/patches/120-fix_INET6.patch new file mode 100644 index 0000000000..1c2683551a --- /dev/null +++ b/package/network/services/tinyproxy/patches/120-fix_INET6.patch @@ -0,0 +1,38 @@ +--- a/src/sock.c ++++ b/src/sock.c +@@ -39,8 +39,7 @@ + * returned if the bind succeeded. Otherwise, -1 is returned + * to indicate an error. + */ +-static int +-bind_socket (int sockfd, const char *addr, int family) ++static int bind_socket (int sockfd, const char *addr) + { + struct addrinfo hints, *res, *ressave; + +@@ -48,7 +47,7 @@ bind_socket (int sockfd, const char *add + assert (addr != NULL && strlen (addr) != 0); + + memset (&hints, 0, sizeof (struct addrinfo)); +- hints.ai_family = family; ++ hints.ai_family = AF_UNSPEC; + hints.ai_socktype = SOCK_STREAM; + + /* The local port it not important */ +@@ -106,14 +105,12 @@ int opensock (const char *host, int port + + /* Bind to the specified address */ + if (bind_to) { +- if (bind_socket (sockfd, bind_to, +- res->ai_family) < 0) { ++ if (bind_socket (sockfd, bind_to) < 0) { + close (sockfd); + continue; /* can't bind, so try again */ + } + } else if (config.bind_address) { +- if (bind_socket (sockfd, config.bind_address, +- res->ai_family) < 0) { ++ if (bind_socket (sockfd, config.bind_address) < 0) { + close (sockfd); + continue; /* can't bind, so try again */ + } diff --git a/package/network/services/tinyproxy/patches/CVE-2012-3505-tiniproxy-randomized-hashmaps.patch b/package/network/services/tinyproxy/patches/CVE-2012-3505-tiniproxy-randomized-hashmaps.patch new file mode 100644 index 0000000000..4737b8ba3f --- /dev/null +++ b/package/network/services/tinyproxy/patches/CVE-2012-3505-tiniproxy-randomized-hashmaps.patch @@ -0,0 +1,101 @@ +--- a/src/child.c ++++ b/src/child.c +@@ -20,6 +20,9 @@ + * processing incoming connections. + */ + ++#include ++#include ++ + #include "main.h" + + #include "child.h" +@@ -196,6 +199,7 @@ static void child_main (struct child_s * + } + + ptr->connects = 0; ++ srand(time(NULL)); + + while (!config.quit) { + ptr->status = T_WAITING; +--- a/src/hashmap.c ++++ b/src/hashmap.c +@@ -25,6 +25,8 @@ + * don't try to free the data, or realloc the memory. :) + */ + ++#include ++ + #include "main.h" + + #include "hashmap.h" +@@ -50,6 +52,7 @@ struct hashbucket_s { + }; + + struct hashmap_s { ++ uint32_t seed; + unsigned int size; + hashmap_iter end_iterator; + +@@ -65,7 +68,7 @@ struct hashmap_s { + * + * If any of the arguments are invalid a negative number is returned. + */ +-static int hashfunc (const char *key, unsigned int size) ++static int hashfunc (const char *key, unsigned int size, uint32_t seed) + { + uint32_t hash; + +@@ -74,7 +77,7 @@ static int hashfunc (const char *key, un + if (size == 0) + return -ERANGE; + +- for (hash = tolower (*key++); *key != '\0'; key++) { ++ for (hash = seed; *key != '\0'; key++) { + uint32_t bit = (hash & 1) ? (1 << (sizeof (uint32_t) - 1)) : 0; + + hash >>= 1; +@@ -104,6 +107,7 @@ hashmap_t hashmap_create (unsigned int n + if (!ptr) + return NULL; + ++ ptr->seed = (uint32_t)rand(); + ptr->size = nbuckets; + ptr->buckets = (struct hashbucket_s *) safecalloc (nbuckets, + sizeof (struct +@@ -201,7 +205,7 @@ hashmap_insert (hashmap_t map, const cha + if (!data || len < 1) + return -ERANGE; + +- hash = hashfunc (key, map->size); ++ hash = hashfunc (key, map->size, map->seed); + if (hash < 0) + return hash; + +@@ -382,7 +386,7 @@ ssize_t hashmap_search (hashmap_t map, c + if (map == NULL || key == NULL) + return -EINVAL; + +- hash = hashfunc (key, map->size); ++ hash = hashfunc (key, map->size, map->seed); + if (hash < 0) + return hash; + +@@ -416,7 +420,7 @@ ssize_t hashmap_entry_by_key (hashmap_t + if (!map || !key || !data) + return -EINVAL; + +- hash = hashfunc (key, map->size); ++ hash = hashfunc (key, map->size, map->seed); + if (hash < 0) + return hash; + +@@ -451,7 +455,7 @@ ssize_t hashmap_remove (hashmap_t map, c + if (map == NULL || key == NULL) + return -EINVAL; + +- hash = hashfunc (key, map->size); ++ hash = hashfunc (key, map->size, map->seed); + if (hash < 0) + return hash; + diff --git a/package/network/services/tinyproxy/patches/CVE-2012-3505-tinyproxy-limit-headers.patch b/package/network/services/tinyproxy/patches/CVE-2012-3505-tinyproxy-limit-headers.patch new file mode 100644 index 0000000000..b8023ab2a4 --- /dev/null +++ b/package/network/services/tinyproxy/patches/CVE-2012-3505-tinyproxy-limit-headers.patch @@ -0,0 +1,44 @@ +--- a/src/reqs.c ++++ b/src/reqs.c +@@ -610,6 +610,11 @@ add_header_to_connection (hashmap_t hash + return hashmap_insert (hashofheaders, header, sep, len); + } + ++/* define max number of headers. big enough to handle legitimate cases, ++ * but limited to avoid DoS ++ */ ++#define MAX_HEADERS 10000 ++ + /* + * Read all the headers from the stream + */ +@@ -617,6 +622,7 @@ static int get_all_headers (int fd, hash + { + char *line = NULL; + char *header = NULL; ++ int count; + char *tmp; + ssize_t linelen; + ssize_t len = 0; +@@ -625,7 +631,7 @@ static int get_all_headers (int fd, hash + assert (fd >= 0); + assert (hashofheaders != NULL); + +- for (;;) { ++ for (count = 0; count < MAX_HEADERS; count++) { + if ((linelen = readline (fd, &line)) <= 0) { + safefree (header); + safefree (line); +@@ -691,6 +697,12 @@ static int get_all_headers (int fd, hash + + safefree (line); + } ++ ++ /* if we get there, this is we reached MAX_HEADERS count. ++ bail out with error */ ++ safefree (header); ++ safefree (line); ++ return -1; + } + + /* diff --git a/package/network/services/tor/Makefile b/package/network/services/tor/Makefile new file mode 100644 index 0000000000..752dd66111 --- /dev/null +++ b/package/network/services/tor/Makefile @@ -0,0 +1,150 @@ +# +# Copyright (C) 2008-2019 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +include $(TOPDIR)/rules.mk + +PKG_NAME:=tor +PKG_VERSION:=0.4.0.5 +PKG_RELEASE:=1 + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=https://dist.torproject.org/ \ + https://archive.torproject.org/tor-package-archive +PKG_HASH:=b5a2cbf0dcd3f1df2675dbd5ec10bbe6f8ae995c41b68cebe2bc95bffc90696e +PKG_MAINTAINER:=Hauke Mehrtens \ + Peter Wagner +PKG_LICENSE_FILES:=LICENSE +PKG_CPE_ID:=cpe:/a:torproject:tor + +PKG_INSTALL:=1 +PKG_FIXUP:=autoreconf +PKG_BUILD_PARALLEL:=1 + +include $(INCLUDE_DIR)/package.mk + +define Package/tor/Default + SECTION:=net + CATEGORY:=Network + URL:=https://www.torproject.org/ + USERID:=tor=52:tor=52 +endef + +define Package/tor/Default/description + Tor is a toolset for a wide range of organizations and people that want to + improve their safety and security on the Internet. Using Tor can help you + anonymize web browsing and publishing, instant messaging, IRC, SSH, and + more. Tor also provides a platform on which software developers can build + new applications with built-in anonymity, safety, and privacy features. +endef + +define Package/tor +$(call Package/tor/Default) + TITLE:=An anonymous Internet communication system + DEPENDS:=+libevent2 +libopenssl +libpthread +librt +zlib +libcap +endef + +define Package/tor/description +$(call Package/tor/Default/description) + This package contains the tor daemon. +endef + +define Package/tor-gencert +$(call Package/tor/Default) + TITLE:=Tor certificate generation + DEPENDS:=+tor +endef + +define Package/tor-gencert/description +$(call Package/tor/Default/description) + Generate certs and keys for Tor directory authorities +endef + +define Package/tor-resolve +$(call Package/tor/Default) + TITLE:=tor hostname resolve + DEPENDS:=+tor +endef + +define Package/tor-resolve/description +$(call Package/tor/Default/description) + Resolve a hostname to an IP address via tor +endef + +define Package/tor-geoip +$(call Package/tor/Default) + TITLE:=GeoIP db for tor + DEPENDS:=+tor +endef + +define Package/tor-geoip/description +$(call Package/tor/Default/description) + This package contains a GeoIP database mapping IP addresses to countries. +endef + +define Package/tor/conffiles +/etc/tor/torrc +/var/lib/tor/fingerprint +/var/lib/tor/keys/* +endef + +CONFIGURE_ARGS += \ + --with-libevent-dir="$(STAGING_DIR)/usr" \ + --with-openssl-dir="$(STAGING_DIR)/usr" \ + --with-zlib-dir="$(STAGING_DIR)/usr" \ + --disable-asciidoc \ + --disable-seccomp \ + --disable-libscrypt \ + --disable-unittests \ + --disable-lzma \ + --disable-zstd \ + --with-tor-user=tor \ + --with-tor-group=tor + +TARGET_CFLAGS += -ffunction-sections -fdata-sections -flto +TARGET_LDFLAGS += -Wl,--gc-sections -flto + +ifneq ($(CONFIG_SSP_SUPPORT),y) + CONFIGURE_ARGS += \ + --disable-gcc-hardening +else + EXTRA_CFLAGS += $(FPIC) +endif + +CONFIGURE_VARS += \ + CROSS_COMPILE="yes" + +define Package/tor/install + $(INSTALL_DIR) $(1)/usr/sbin + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/tor $(1)/usr/sbin/ + $(INSTALL_DIR) $(1)/etc/init.d + $(INSTALL_BIN) ./files/tor.init $(1)/etc/init.d/tor + $(INSTALL_DIR) $(1)/etc/tor + $(INSTALL_CONF) $(PKG_INSTALL_DIR)/etc/tor/torrc.sample $(1)/etc/tor/torrc +endef + +define Package/tor-gencert/install + $(INSTALL_DIR) $(1)/usr/sbin + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/tor-gencert $(1)/usr/sbin/ +endef + +define Package/tor-resolve/install + $(INSTALL_DIR) $(1)/usr/sbin + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/tor-resolve $(1)/usr/sbin/ +endef + +define Package/tor-geoip/install + $(INSTALL_DIR) $(1)/usr/share/tor + $(INSTALL_DATA) \ + $(PKG_INSTALL_DIR)/usr/share/tor/geoip \ + $(PKG_INSTALL_DIR)/usr/share/tor/geoip6 \ + $(1)/usr/share/tor/ +endef + +$(eval $(call BuildPackage,tor)) +$(eval $(call BuildPackage,tor-gencert)) +$(eval $(call BuildPackage,tor-resolve)) +$(eval $(call BuildPackage,tor-geoip)) diff --git a/package/network/services/tor/files/tor.init b/package/network/services/tor/files/tor.init new file mode 100644 index 0000000000..ee0818d9d1 --- /dev/null +++ b/package/network/services/tor/files/tor.init @@ -0,0 +1,22 @@ +#!/bin/sh /etc/rc.common +# Copyright (C) 2006-2011 OpenWrt.org + +START=50 +STOP=50 + +USE_PROCD=1 + +start_service() { + touch /var/run/tor.pid + chown tor:tor /var/run/tor.pid + + mkdir -m 0700 -p /var/lib/tor + chown -R tor:tor /var/lib/tor + + mkdir -m 0755 -p /var/log/tor + chown -R tor:tor /var/log/tor + + procd_open_instance + procd_set_param command /usr/sbin/tor --runasdaemon 0 + procd_close_instance +} diff --git a/package/network/services/tor/patches/001-torrc.patch b/package/network/services/tor/patches/001-torrc.patch new file mode 100644 index 0000000000..16cae0402f --- /dev/null +++ b/package/network/services/tor/patches/001-torrc.patch @@ -0,0 +1,25 @@ +--- a/src/config/torrc.sample.in ++++ b/src/config/torrc.sample.in +@@ -39,7 +39,7 @@ + ## Send every possible message to @LOCALSTATEDIR@/log/tor/debug.log + #Log debug file @LOCALSTATEDIR@/log/tor/debug.log + ## Use the system log instead of Tor's logfiles +-#Log notice syslog ++Log notice syslog + ## To send all messages to stderr: + #Log debug stderr + +@@ -50,7 +50,7 @@ + + ## The directory for keeping all the keys/etc. By default, we store + ## things in $HOME/.tor on Unix, and in Application Data\tor on Windows. +-#DataDirectory @LOCALSTATEDIR@/lib/tor ++DataDirectory @LOCALSTATEDIR@/lib/tor + + ## The port on which Tor will listen for local connections from Tor + ## controller applications, as documented in control-spec.txt. +@@ -238,3 +238,4 @@ + #%include /etc/torrc.d/ + #%include /etc/torrc.custom + ++User tor diff --git a/package/network/services/torsocks/Makefile b/package/network/services/torsocks/Makefile new file mode 100644 index 0000000000..7cd1323962 --- /dev/null +++ b/package/network/services/torsocks/Makefile @@ -0,0 +1,62 @@ +# +# Copyright (C) 2017-2019 CZ.NIC, z. s. p. o. (https://www.nic.cz/) +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +include $(TOPDIR)/rules.mk + +PKG_NAME:=torsocks +PKG_VERSION:=2.3.0 +PKG_RELEASE:=1 + +PKG_SOURCE_URL:=https://people.torproject.org/~dgoulet/torsocks/ +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz +PKG_HASH:=b9f1b981d6b3fd4e1820de1eee325f8a7038c84765d5a6cd9af12571d5cc3622 + +PKG_MAINTAINER:=Jan Pavlinec +PKG_LICENSE:=GPLv2 +PKG_LICENSE_FILES:=LICENSE + +PKG_INSTALL:=1 +PKG_BUILD_PARALLEL:=1 +PKG_FIXUP:=autoreconf + +include $(INCLUDE_DIR)/package.mk + +define Package/torsocks + SECTION:=net + CATEGORY:=Network + SUBMENU:=IP Addresses and Names + TITLE:=torsocks + URL:=https://trac.torproject.org/projects/tor/wiki/doc/torsocks + DEPENDS:=+tor +endef + +define Package/torsocks/description + Torsocks allows you to use most applications in a safe way with Tor. + It ensures that DNS requests are handled safely and explicitly rejects any traffic other than TCP from the application you're using. +endef + +define Build/Configure + $(call Build/Configure/Default) +ifeq ($(CONFIG_USE_UCLIBC),y) + find $(PKG_BUILD_DIR) -name 'Makefile' -exec sed -i 's|--param ssp-buffer-size=1 -fstack-protector-all||' \{\} \+ +endif +endef + +define Package/conffiles +/etc/tor/torsocks.conf +endef + +define Package/torsocks/install + $(INSTALL_DIR) $(1)/etc/tor/ + $(CP) $(PKG_INSTALL_DIR)/etc/tor/torsocks.conf $(1)/etc/tor/ + $(INSTALL_DIR) $(1)/usr/lib/torsocks + $(CP) $(PKG_INSTALL_DIR)/usr/lib/torsocks/libtorsocks.so* $(1)/usr/lib/torsocks/ + $(INSTALL_DIR) $(1)/usr/bin + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/torsocks $(1)/usr/bin/ +endef + +$(eval $(call BuildPackage,torsocks)) diff --git a/package/network/services/uhttpd/Makefile b/package/network/services/uhttpd/Makefile index 93d3eb6605..34666c11f4 100644 --- a/package/network/services/uhttpd/Makefile +++ b/package/network/services/uhttpd/Makefile @@ -8,13 +8,13 @@ include $(TOPDIR)/rules.mk PKG_NAME:=uhttpd -PKG_RELEASE:=2 +PKG_RELEASE:=3 PKG_SOURCE_PROTO:=git PKG_SOURCE_URL=$(PROJECT_GIT)/uhttpd.git -PKG_SOURCE_DATE:=2018-11-28 -PKG_SOURCE_VERSION:=cdfc902a4cb77bc538a729f9e1c8a8578454a0e5 -PKG_MIRROR_HASH:=6b21111547a4453355bd6c941a47f0116a652a77d87c1e05a035168b8ab2aa6f +PKG_SOURCE_DATE:=2019-08-17 +PKG_SOURCE_VERSION:=6b03f9605323df23d12e3876feb466f53f8d50c4 +PKG_MIRROR_HASH:=4df96054a4fce659e6c849feae7850d542b37ad5caffc1485b7a63c7c2764cb1 PKG_MAINTAINER:=Felix Fietkau PKG_LICENSE:=ISC @@ -34,7 +34,7 @@ endef define Package/uhttpd $(Package/uhttpd/default) - DEPENDS:=+libubox +libblobmsg-json +libjson-script + DEPENDS:=+libubox +libblobmsg-json +libjson-script +libjson-c endef define Package/uhttpd/description diff --git a/package/network/services/uhttpd/files/uhttpd.config b/package/network/services/uhttpd/files/uhttpd.config index 932cd00a3a..ee21cebc71 100644 --- a/package/network/services/uhttpd/files/uhttpd.config +++ b/package/network/services/uhttpd/files/uhttpd.config @@ -24,7 +24,7 @@ config uhttpd main # If this number is exceeded, further requests are # queued until the number of running requests drops # below the limit again. - option max_requests 1 + option max_requests 3 # Maximum number of concurrent connections. # If this number is exceeded, further TCP connection diff --git a/package/network/services/wireguard/Makefile b/package/network/services/wireguard/Makefile index aab3e59850..310d5599c2 100644 --- a/package/network/services/wireguard/Makefile +++ b/package/network/services/wireguard/Makefile @@ -11,12 +11,12 @@ include $(INCLUDE_DIR)/kernel.mk PKG_NAME:=wireguard -PKG_VERSION:=0.0.20190227 +PKG_VERSION:=0.0.20190601 PKG_RELEASE:=1 PKG_SOURCE:=WireGuard-$(PKG_VERSION).tar.xz PKG_SOURCE_URL:=https://git.zx2c4.com/WireGuard/snapshot/ -PKG_HASH:=fcdb26fd2692d9e1dee54d14418603c38fbb973a06ce89d08fbe45292ff37f79 +PKG_HASH:=7528461824a0174bd7d4f15e68d8f0ce9a8ea318411502b80759438e8ef65568 PKG_LICENSE:=GPL-2.0 Apache-2.0 PKG_LICENSE_FILES:=COPYING diff --git a/package/network/services/wireguard/files/wireguard.sh b/package/network/services/wireguard/files/wireguard.sh index 96fa7215ff..4c811c6ba9 100644 --- a/package/network/services/wireguard/files/wireguard.sh +++ b/package/network/services/wireguard/files/wireguard.sh @@ -2,197 +2,184 @@ # Copyright 2016-2017 Dan Luedtke # Licensed to the public under the Apache License 2.0. - WG=/usr/bin/wg if [ ! -x $WG ]; then - logger -t "wireguard" "error: missing wireguard-tools (${WG})" - exit 0 + logger -t "wireguard" "error: missing wireguard-tools (${WG})" + exit 0 fi - [ -n "$INCLUDE_ONLY" ] || { - . /lib/functions.sh - . ../netifd-proto.sh - init_proto "$@" + . /lib/functions.sh + . ../netifd-proto.sh + init_proto "$@" } - proto_wireguard_init_config() { - proto_config_add_string "private_key" - proto_config_add_int "listen_port" - proto_config_add_int "mtu" - proto_config_add_string "fwmark" - available=1 - no_proto_task=1 + proto_config_add_string "private_key" + proto_config_add_int "listen_port" + proto_config_add_int "mtu" + proto_config_add_string "fwmark" + available=1 + no_proto_task=1 } - proto_wireguard_setup_peer() { - local peer_config="$1" - - local public_key - local preshared_key - local allowed_ips - local route_allowed_ips - local endpoint_host - local endpoint_port - local persistent_keepalive - - config_get public_key "${peer_config}" "public_key" - config_get preshared_key "${peer_config}" "preshared_key" - config_get allowed_ips "${peer_config}" "allowed_ips" - config_get_bool route_allowed_ips "${peer_config}" "route_allowed_ips" 0 - config_get endpoint_host "${peer_config}" "endpoint_host" - config_get endpoint_port "${peer_config}" "endpoint_port" - config_get persistent_keepalive "${peer_config}" "persistent_keepalive" - - # peer configuration - echo "[Peer]" >> "${wg_cfg}" - echo "PublicKey=${public_key}" >> "${wg_cfg}" - if [ "${preshared_key}" ]; then - echo "PresharedKey=${preshared_key}" >> "${wg_cfg}" - fi - for allowed_ip in $allowed_ips; do - echo "AllowedIPs=${allowed_ip}" >> "${wg_cfg}" - done - if [ "${endpoint_host}" ]; then - case "${endpoint_host}" in - *:*) - endpoint="[${endpoint_host}]" - ;; - *) - endpoint="${endpoint_host}" - ;; - esac - if [ "${endpoint_port}" ]; then - endpoint="${endpoint}:${endpoint_port}" - else - endpoint="${endpoint}:51820" - fi - echo "Endpoint=${endpoint}" >> "${wg_cfg}" - fi - if [ "${persistent_keepalive}" ]; then - echo "PersistentKeepalive=${persistent_keepalive}" >> "${wg_cfg}" - fi - - # add routes for allowed ips - if [ ${route_allowed_ips} -ne 0 ]; then - for allowed_ip in ${allowed_ips}; do - case "${allowed_ip}" in - *:*/*) - proto_add_ipv6_route "${allowed_ip%%/*}" "${allowed_ip##*/}" - ;; - *.*/*) - proto_add_ipv4_route "${allowed_ip%%/*}" "${allowed_ip##*/}" - ;; - *:*) - proto_add_ipv6_route "${allowed_ip%%/*}" "128" - ;; - *.*) - proto_add_ipv4_route "${allowed_ip%%/*}" "32" - ;; - esac - done - fi + local peer_config="$1" + + local public_key + local preshared_key + local allowed_ips + local route_allowed_ips + local endpoint_host + local endpoint_port + local persistent_keepalive + + config_get public_key "${peer_config}" "public_key" + config_get preshared_key "${peer_config}" "preshared_key" + config_get allowed_ips "${peer_config}" "allowed_ips" + config_get_bool route_allowed_ips "${peer_config}" "route_allowed_ips" 0 + config_get endpoint_host "${peer_config}" "endpoint_host" + config_get endpoint_port "${peer_config}" "endpoint_port" + config_get persistent_keepalive "${peer_config}" "persistent_keepalive" + + echo "[Peer]" >> "${wg_cfg}" + echo "PublicKey=${public_key}" >> "${wg_cfg}" + if [ "${preshared_key}" ]; then + echo "PresharedKey=${preshared_key}" >> "${wg_cfg}" + fi + for allowed_ip in $allowed_ips; do + echo "AllowedIPs=${allowed_ip}" >> "${wg_cfg}" + done + if [ "${endpoint_host}" ]; then + case "${endpoint_host}" in + *:*) + endpoint="[${endpoint_host}]" + ;; + *) + endpoint="${endpoint_host}" + ;; + esac + if [ "${endpoint_port}" ]; then + endpoint="${endpoint}:${endpoint_port}" + else + endpoint="${endpoint}:51820" + fi + echo "Endpoint=${endpoint}" >> "${wg_cfg}" + fi + if [ "${persistent_keepalive}" ]; then + echo "PersistentKeepalive=${persistent_keepalive}" >> "${wg_cfg}" + fi + + if [ ${route_allowed_ips} -ne 0 ]; then + for allowed_ip in ${allowed_ips}; do + case "${allowed_ip}" in + *:*/*) + proto_add_ipv6_route "${allowed_ip%%/*}" "${allowed_ip##*/}" + ;; + *.*/*) + proto_add_ipv4_route "${allowed_ip%%/*}" "${allowed_ip##*/}" + ;; + *:*) + proto_add_ipv6_route "${allowed_ip%%/*}" "128" + ;; + *.*) + proto_add_ipv4_route "${allowed_ip%%/*}" "32" + ;; + esac + done + fi } - proto_wireguard_setup() { - local config="$1" - local wg_dir="/tmp/wireguard" - local wg_cfg="${wg_dir}/${config}" - - local private_key - local listen_port - local mtu - - # load configuration - config_load network - config_get private_key "${config}" "private_key" - config_get listen_port "${config}" "listen_port" - config_get addresses "${config}" "addresses" - config_get mtu "${config}" "mtu" - config_get fwmark "${config}" "fwmark" - config_get ip6prefix "${config}" "ip6prefix" - - # create interface - ip link del dev "${config}" 2>/dev/null - ip link add dev "${config}" type wireguard - - if [ "${mtu}" ]; then - ip link set mtu "${mtu}" dev "${config}" - fi - - proto_init_update "${config}" 1 - - # generate configuration file - umask 077 - mkdir -p "${wg_dir}" - echo "[Interface]" > "${wg_cfg}" - echo "PrivateKey=${private_key}" >> "${wg_cfg}" - if [ "${listen_port}" ]; then - echo "ListenPort=${listen_port}" >> "${wg_cfg}" - fi - if [ "${fwmark}" ]; then - echo "FwMark=${fwmark}" >> "${wg_cfg}" - fi - config_foreach proto_wireguard_setup_peer "wireguard_${config}" - - # apply configuration file - ${WG} setconf ${config} "${wg_cfg}" - WG_RETURN=$? - - # delete configuration file - rm -f "${wg_cfg}" - - # check status - if [ ${WG_RETURN} -ne 0 ]; then - sleep 5 - proto_setup_failed "${config}" - exit 1 - fi - - # add ip addresses - for address in ${addresses}; do - case "${address}" in - *:*/*) - proto_add_ipv6_address "${address%%/*}" "${address##*/}" - ;; - *.*/*) - proto_add_ipv4_address "${address%%/*}" "${address##*/}" - ;; - *:*) - proto_add_ipv6_address "${address%%/*}" "128" - ;; - *.*) - proto_add_ipv4_address "${address%%/*}" "32" - ;; - esac - done - - # support ip6 prefixes - for prefix in ${ip6prefix}; do - proto_add_ipv6_prefix "$prefix" - done - - # endpoint dependency - wg show "${config}" endpoints | \ - sed -E 's/\[?([0-9.:a-f]+)\]?:([0-9]+)/\1 \2/' | \ - while IFS=$'\t ' read -r key address port; do - [ -n "${port}" ] || continue - proto_add_host_dependency "${config}" "${address}" - done - - proto_send_update "${config}" + local config="$1" + local wg_dir="/tmp/wireguard" + local wg_cfg="${wg_dir}/${config}" + + local private_key + local listen_port + local mtu + + config_load network + config_get private_key "${config}" "private_key" + config_get listen_port "${config}" "listen_port" + config_get addresses "${config}" "addresses" + config_get mtu "${config}" "mtu" + config_get fwmark "${config}" "fwmark" + config_get ip6prefix "${config}" "ip6prefix" + config_get nohostroute "${config}" "nohostroute" + + ip link del dev "${config}" 2>/dev/null + ip link add dev "${config}" type wireguard + + if [ "${mtu}" ]; then + ip link set mtu "${mtu}" dev "${config}" + fi + + proto_init_update "${config}" 1 + + umask 077 + mkdir -p "${wg_dir}" + echo "[Interface]" > "${wg_cfg}" + echo "PrivateKey=${private_key}" >> "${wg_cfg}" + if [ "${listen_port}" ]; then + echo "ListenPort=${listen_port}" >> "${wg_cfg}" + fi + if [ "${fwmark}" ]; then + echo "FwMark=${fwmark}" >> "${wg_cfg}" + fi + config_foreach proto_wireguard_setup_peer "wireguard_${config}" + + # apply configuration file + ${WG} setconf ${config} "${wg_cfg}" + WG_RETURN=$? + + rm -f "${wg_cfg}" + + if [ ${WG_RETURN} -ne 0 ]; then + sleep 5 + proto_setup_failed "${config}" + exit 1 + fi + + for address in ${addresses}; do + case "${address}" in + *:*/*) + proto_add_ipv6_address "${address%%/*}" "${address##*/}" + ;; + *.*/*) + proto_add_ipv4_address "${address%%/*}" "${address##*/}" + ;; + *:*) + proto_add_ipv6_address "${address%%/*}" "128" + ;; + *.*) + proto_add_ipv4_address "${address%%/*}" "32" + ;; + esac + done + + for prefix in ${ip6prefix}; do + proto_add_ipv6_prefix "$prefix" + done + + # endpoint dependency + if [ "${nohostroute}" != "1" ]; then + wg show "${config}" endpoints | \ + sed -E 's/\[?([0-9.:a-f]+)\]?:([0-9]+)/\1 \2/' | \ + while IFS=$'\t ' read -r key address port; do + [ -n "${port}" ] || continue + proto_add_host_dependency "${config}" "${address}" + done + fi + + proto_send_update "${config}" } - proto_wireguard_teardown() { - local config="$1" - ip link del dev "${config}" >/dev/null 2>&1 + local config="$1" + ip link del dev "${config}" >/dev/null 2>&1 } - [ -n "$INCLUDE_ONLY" ] || { - add_protocol wireguard + add_protocol wireguard } diff --git a/package/network/utils/comgt/files/ncm.sh b/package/network/utils/comgt/files/ncm.sh index 60b39655ec..9aaaa25f37 100644 --- a/package/network/utils/comgt/files/ncm.sh +++ b/package/network/utils/comgt/files/ncm.sh @@ -146,12 +146,18 @@ proto_ncm_setup() { proto_close_data proto_send_update "$interface" + local zone="$(fw3 -q network "$interface" 2>/dev/null)" + [ "$pdptype" = "IP" -o "$pdptype" = "IPV4V6" ] && { json_init json_add_string name "${interface}_4" json_add_string ifname "@$interface" json_add_string proto "dhcp" proto_add_dynamic_defaults + [ -n "$zone" ] && { + json_add_string zone "$zone" + } + json_close_object ubus call network add_dynamic "$(json_dump)" } @@ -162,6 +168,10 @@ proto_ncm_setup() { json_add_string proto "dhcpv6" json_add_string extendprefix 1 proto_add_dynamic_defaults + [ -n "$zone" ] && { + json_add_string zone "$zone" + } + json_close_object ubus call network add_dynamic "$(json_dump)" } diff --git a/package/network/utils/curl/Makefile b/package/network/utils/curl/Makefile index 16c7466ee3..bc83a400ac 100644 --- a/package/network/utils/curl/Makefile +++ b/package/network/utils/curl/Makefile @@ -8,7 +8,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=curl -PKG_VERSION:=7.64.0 +PKG_VERSION:=7.65.1 PKG_RELEASE:=1 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz @@ -16,7 +16,7 @@ PKG_SOURCE_URL:=https://dl.uxnr.de/mirror/curl/ \ https://curl.mirror.anstey.ca/ \ https://curl.askapache.com/download/ \ https://curl.haxx.se/download/ -PKG_HASH:=2f2f13fa34d44aa29cb444077ad7dc4dc6d189584ad552e0aaeb06e608af6001 +PKG_HASH:=f6c22074877f235aebc7c53057dbc7ee82358f8ae58bfb767e955c18c859a77a PKG_LICENSE:=MIT PKG_LICENSE_FILES:=COPYING diff --git a/package/network/utils/curl/patches/310-mbedtls-disable-runtime-version-check.patch b/package/network/utils/curl/patches/310-mbedtls-disable-runtime-version-check.patch deleted file mode 100644 index 1d80e2f811..0000000000 --- a/package/network/utils/curl/patches/310-mbedtls-disable-runtime-version-check.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/lib/vtls/mbedtls.c -+++ b/lib/vtls/mbedtls.c -@@ -813,7 +813,7 @@ static void Curl_mbedtls_session_free(vo - - static size_t Curl_mbedtls_version(char *buffer, size_t size) - { -- unsigned int version = mbedtls_version_get_number(); -+ unsigned int version = MBEDTLS_VERSION_NUMBER; - return msnprintf(buffer, size, "mbedTLS/%u.%u.%u", version>>24, - (version>>16)&0xff, (version>>8)&0xff); - } diff --git a/package/network/utils/ethtool/Makefile b/package/network/utils/ethtool/Makefile index c328c6b0b8..d70997d966 100644 --- a/package/network/utils/ethtool/Makefile +++ b/package/network/utils/ethtool/Makefile @@ -8,13 +8,13 @@ include $(TOPDIR)/rules.mk PKG_NAME:=ethtool -PKG_VERSION:=4.19 +PKG_VERSION:=5.1 PKG_RELEASE:=1 PKG_MAINTAINER:=Felix Fietkau PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz PKG_SOURCE_URL:=@KERNEL/software/network/ethtool -PKG_HASH:=b18a6c364e42c29cdac057cf183c9674163db96b30848adfa8c2a90450f6d0c8 +PKG_HASH:=65feac1fec6565290b7784b2efc925dee900a9b11202ce7c6c30a967c3da3387 PKG_LICENSE:=GPL-2.0 PKG_LICENSE_FILES:=COPYING diff --git a/package/network/utils/iperf/Makefile b/package/network/utils/iperf/Makefile index 383eb07949..33d00b43d7 100644 --- a/package/network/utils/iperf/Makefile +++ b/package/network/utils/iperf/Makefile @@ -8,11 +8,11 @@ include $(TOPDIR)/rules.mk PKG_NAME:=iperf -PKG_VERSION:=2.0.12 -PKG_RELEASE:=3 +PKG_VERSION:=2.0.13 +PKG_RELEASE:=1 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz -PKG_HASH:=367f651fb1264b13f6518e41b8a7e08ce3e41b2a1c80e99ff0347561eed32646 +PKG_HASH:=c88adec966096a81136dda91b4bd19c27aae06df4d45a7f547a8e50d723778ad PKG_SOURCE_URL:=@SF/iperf2 PKG_MAINTAINER:=Felix Fietkau diff --git a/package/network/utils/iperf/patches/0001-fix-latent-bug-in-signal-handling-per-POSIX-calling-.patch b/package/network/utils/iperf/patches/0001-fix-latent-bug-in-signal-handling-per-POSIX-calling-.patch deleted file mode 100644 index a713e06b96..0000000000 --- a/package/network/utils/iperf/patches/0001-fix-latent-bug-in-signal-handling-per-POSIX-calling-.patch +++ /dev/null @@ -1,43 +0,0 @@ -From 7c0ac64ebea38d0d9ff4d160db4d33bc087a3490 Mon Sep 17 00:00:00 2001 -From: Robert McMahon -Date: Mon, 16 Jul 2018 17:51:29 -0700 -Subject: [PATCH] fix latent bug in signal handling, per POSIX calling exit() - in signal handler is not safe. Use _exit() instead. Also, detect the user - signal SIGINT for the case of server needing two invocations to stop server - threads. Note: the server threads still need some work from graceful - termination with a single ctrl-c - ---- - ---- a/compat/signal.c -+++ b/compat/signal.c -@@ -171,7 +171,7 @@ void sig_exit( int inSigno ) { - static int num = 0; - if ( num++ == 0 ) { - fflush( 0 ); -- exit( 0 ); -+ _exit(0); - } - } /* end sig_exit */ - ---- a/src/main.cpp -+++ b/src/main.cpp -@@ -268,7 +268,7 @@ void Sig_Interupt( int inSigno ) { - // We try to not allow a single interrupt handled by multiple threads - // to completely kill the app so we save off the first thread ID - // then that is the only thread that can supply the next interrupt -- if ( thread_equalid( sThread, thread_zeroid() ) ) { -+ if ( (inSigno == SIGINT) && thread_equalid( sThread, thread_zeroid() ) ) { - sThread = thread_getid(); - } else if ( thread_equalid( sThread, thread_getid() ) ) { - sig_exit( inSigno ); -@@ -420,9 +420,3 @@ VOID ServiceStop() { - } - - #endif -- -- -- -- -- -- diff --git a/package/network/utils/iperf/patches/0002-cleanup-main-startup-fix-daemon-mode-per-redirecting.patch b/package/network/utils/iperf/patches/0002-cleanup-main-startup-fix-daemon-mode-per-redirecting.patch deleted file mode 100644 index c8655c9142..0000000000 --- a/package/network/utils/iperf/patches/0002-cleanup-main-startup-fix-daemon-mode-per-redirecting.patch +++ /dev/null @@ -1,161 +0,0 @@ -From 755be8bdb48d2536e39d2d7cf84e8a8f86b8776f Mon Sep 17 00:00:00 2001 -From: Robert McMahon -Date: Sat, 6 Oct 2018 13:36:52 -0700 -Subject: [PATCH] cleanup main startup, fix daemon mode per redirecting stdin, - stderr and stdout to /dev/null - ---- - ---- a/src/main.cpp -+++ b/src/main.cpp -@@ -167,67 +167,7 @@ int main( int argc, char **argv ) { - Settings_ParseCommandLine( argc, argv, ext_gSettings ); - - // Check for either having specified client or server -- if ( ext_gSettings->mThreadMode == kMode_Client -- || ext_gSettings->mThreadMode == kMode_Listener ) { --#ifdef WIN32 -- // Start the server as a daemon -- if ( isDaemon( ext_gSettings )) { -- if (ext_gSettings->mThreadMode == kMode_Listener) { -- CmdInstallService(argc, argv); -- } else { -- fprintf(stderr, "Client cannot be run as a daemon\n"); -- } -- return 0; -- } -- -- // Remove the Windows service if requested -- if ( isRemoveService( ext_gSettings ) ) { -- // remove the service -- if ( CmdRemoveService() ) { -- fprintf(stderr, "IPerf Service is removed.\n"); -- return 0; -- } -- } --#else -- if ( isDaemon( ext_gSettings ) ) { -- if (ext_gSettings->mThreadMode != kMode_Listener) { -- fprintf(stderr, "Iperf client cannot be run as a daemon\n"); -- return 0; -- } -- if (daemon(1, 1) < 0) { -- perror("daemon"); -- } -- fprintf( stderr, "Running Iperf Server as a daemon\n"); -- fprintf( stderr, "The Iperf daemon process ID : %d\n",((int)getpid())); -- fclose(stdout); -- fclose(stderr); -- fclose(stdin); -- } --#endif -- // initialize client(s) -- if ( ext_gSettings->mThreadMode == kMode_Client ) { -- client_init( ext_gSettings ); -- } -- --#ifdef HAVE_THREAD -- // start up the reporter and client(s) or listener -- { -- thread_Settings *into = NULL; -- // Create the settings structure for the reporter thread -- Settings_Copy( ext_gSettings, &into ); -- into->mThreadMode = kMode_Reporter; -- -- // Have the reporter launch the client or listener -- into->runNow = ext_gSettings; -- -- // Start all the threads that are ready to go -- thread_start( into ); -- } --#else -- // No need to make a reporter thread because we don't have threads -- thread_start( ext_gSettings ); --#endif -- } else { -+ if ((ext_gSettings->mThreadMode != kMode_Client) && (ext_gSettings->mThreadMode != kMode_Listener)) { - // neither server nor client mode was specified - // print usage and exit - -@@ -236,20 +176,75 @@ int main( int argc, char **argv ) { - // Starting in 2.0 to restart a previously defined service - // you must call iperf with "iperf -D" or using the environment variable - SERVICE_TABLE_ENTRY dispatchTable[] = -- { -- { (LPSTR)TEXT(SZSERVICENAME), (LPSERVICE_MAIN_FUNCTION)service_main}, -- { NULL, NULL} -- }; -+ { -+ { (LPSTR)TEXT(SZSERVICENAME), (LPSERVICE_MAIN_FUNCTION)service_main}, -+ { NULL, NULL} -+ }; - - // starting the service by SCM, there is no arguments will be passed in. - // the arguments will pass into Service_Main entry. - if (!StartServiceCtrlDispatcher(dispatchTable) ) - // If the service failed to start then print usage - #endif -- fprintf( stderr, usage_short, argv[0], argv[0] ); -+ fprintf( stderr, usage_short, argv[0], argv[0] ); -+ return 0; -+ } -+ -+ -+ switch (ext_gSettings->mThreadMode) { -+ case kMode_Client : -+ if ( isDaemon( ext_gSettings ) ) { -+ fprintf(stderr, "Iperf client cannot be run as a daemon\n"); -+ return 0; -+ } -+ // initialize client(s) -+ client_init( ext_gSettings ); -+ break; -+ case kMode_Listener : -+ if ( isDaemon( ext_gSettings ) ) { -+ fprintf( stderr, "Running Iperf Server as a daemon\n"); -+ // Start the server as a daemon -+#ifdef WIN32 -+ CmdInstallService(argc, argv); -+ // Remove the Windows service if requested -+ if ( isRemoveService( ext_gSettings ) ) { -+ // remove the service -+ if ( CmdRemoveService() ) { -+ fprintf(stderr, "IPerf Service is removed.\n"); -+ return 0; -+ } -+ } -+#else -+ fflush(stderr); -+ // redirect stdin, stdout and sterr to /dev/null (see dameon and no close flag) -+ if (daemon(1, 0) < 0) { -+ perror("daemon"); -+ } -+ } -+#endif -+ break; -+ default : -+ fprintf( stderr, "unknown mode"); -+ break; -+ } -+#ifdef HAVE_THREAD -+ // start up the reporter and client(s) or listener -+ { -+ thread_Settings *into = NULL; -+ // Create the settings structure for the reporter thread -+ Settings_Copy( ext_gSettings, &into ); -+ into->mThreadMode = kMode_Reporter; -+ -+ // Have the reporter launch the client or listener -+ into->runNow = ext_gSettings; - -- return 0; -+ // Start all the threads that are ready to go -+ thread_start( into ); - } -+#else -+ // No need to make a reporter thread because we don't have threads -+ thread_start( ext_gSettings ); -+#endif - - // wait for other (client, server) threads to complete - thread_joinall(); diff --git a/package/network/utils/iperf/patches/0003-fix-non-ipv6-builds.patch b/package/network/utils/iperf/patches/0003-fix-non-ipv6-builds.patch index 9d96c1919a..c6afa3e160 100644 --- a/package/network/utils/iperf/patches/0003-fix-non-ipv6-builds.patch +++ b/package/network/utils/iperf/patches/0003-fix-non-ipv6-builds.patch @@ -1,18 +1,16 @@ -Index: iperf-2.0.12/src/Listener.cpp -=================================================================== ---- iperf-2.0.12.orig/src/Listener.cpp -+++ iperf-2.0.12/src/Listener.cpp -@@ -670,6 +670,7 @@ int Listener::L2_setup (void) { +--- a/src/Listener.cpp ++++ b/src/Listener.cpp +@@ -723,6 +723,7 @@ int Listener::L2_setup (void) { // Now optimize packet flow up the raw socket // Establish the flow BPF to forward up only "connected" packets to this raw socket +#ifdef HAVE_IPV6 if (l->sa_family == AF_INET6) { + #ifdef HAVE_IPV6 struct in6_addr *v6peer = SockAddr_get_in6_addr(&server->peer); - struct in6_addr *v6local = SockAddr_get_in6_addr(&server->local); -@@ -682,6 +683,9 @@ int Listener::L2_setup (void) { - WARN_errno( rc == SOCKET_ERROR, "l2 v4in6 connect ip bpf"); - } +@@ -740,6 +741,9 @@ int Listener::L2_setup (void) { + return -1; + #endif /* HAVE_IPV6 */ } else { +#else + { diff --git a/package/network/utils/iproute2/Makefile b/package/network/utils/iproute2/Makefile index 866776f9cc..63e8534bf2 100644 --- a/package/network/utils/iproute2/Makefile +++ b/package/network/utils/iproute2/Makefile @@ -8,12 +8,12 @@ include $(TOPDIR)/rules.mk PKG_NAME:=iproute2 -PKG_VERSION:=4.20.0 -PKG_RELEASE:=1 +PKG_VERSION:=5.0.0 +PKG_RELEASE:=2.1 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz PKG_SOURCE_URL:=@KERNEL/linux/utils/net/iproute2 -PKG_HASH:=c8adaa6a40f888476b23acb283cfa30c0dd55f07b5aa20663ed5ba2ef1f6fda8 +PKG_HASH:=df047302a39650ef832c07e8dab5df7a23218cd398bd310c8628e386161d20ba PKG_BUILD_PARALLEL:=1 PKG_BUILD_DEPENDS:=iptables PKG_LICENSE:=GPL-2.0 @@ -37,6 +37,7 @@ define Package/ip-tiny $(call Package/iproute2/Default) TITLE:=Routing control utility (Minimal) VARIANT:=tiny + DEFAULT_VARIANT:=1 PROVIDES:=ip ALTERNATIVES:=200:/sbin/ip:/usr/libexec/ip-tiny DEPENDS:=+libnl-tiny +(PACKAGE_devlink||PACKAGE_rdma):libmnl @@ -48,55 +49,67 @@ $(call Package/iproute2/Default) VARIANT:=full PROVIDES:=ip ALTERNATIVES:=300:/sbin/ip:/usr/libexec/ip-full - DEPENDS:=+libnl-tiny +(PACKAGE_devlink||PACKAGE_rdma):libmnl + DEPENDS:=+libnl-tiny +libelf +(PACKAGE_devlink||PACKAGE_rdma):libmnl +libcap endef define Package/tc $(call Package/iproute2/Default) TITLE:=Traffic control utility - DEPENDS:=+kmod-sched-core +libxtables +libelf +(PACKAGE_devlink||PACKAGE_rdma):libmnl + VARIANT:=tc + PROVIDES:=tc + DEPENDS:=+kmod-sched-core +libxtables +libelf +(PACKAGE_devlink||PACKAGE_rdma):libmnl +PACKAGE_ip-full:libcap endef define Package/genl $(call Package/iproute2/Default) TITLE:=General netlink utility frontend - DEPENDS:=+libnl-tiny +(PACKAGE_devlink||PACKAGE_rdma):libmnl + DEPENDS:=+libnl-tiny +(PACKAGE_devlink||PACKAGE_rdma):libmnl +(PACKAGE_tc||PACKAGE_ip-full):libelf +PACKAGE_ip-full:libcap endef define Package/ip-bridge $(call Package/iproute2/Default) TITLE:=Bridge configuration utility from iproute2 - DEPENDS:=+libnl-tiny +(PACKAGE_devlink||PACKAGE_rdma):libmnl + DEPENDS:=+libnl-tiny +(PACKAGE_devlink||PACKAGE_rdma):libmnl +(PACKAGE_tc||PACKAGE_ip-full):libelf +PACKAGE_ip-full:libcap endef define Package/ss $(call Package/iproute2/Default) TITLE:=Socket statistics utility - DEPENDS:=+libnl-tiny +(PACKAGE_devlink||PACKAGE_rdma):libmnl + DEPENDS:=+libnl-tiny +(PACKAGE_devlink||PACKAGE_rdma):libmnl +(PACKAGE_tc||PACKAGE_ip-full):libelf +PACKAGE_ip-full:libcap endef define Package/nstat $(call Package/iproute2/Default) TITLE:=Network statistics utility - DEPENDS:=+libnl-tiny +(PACKAGE_devlink||PACKAGE_rdma):libmnl + DEPENDS:=+libnl-tiny +(PACKAGE_devlink||PACKAGE_rdma):libmnl +(PACKAGE_tc||PACKAGE_ip-full):libelf +PACKAGE_ip-full:libcap endef define Package/devlink $(call Package/iproute2/Default) TITLE:=Network devlink utility - DEPENDS:=+libmnl + DEPENDS:=+libmnl +(PACKAGE_tc||PACKAGE_ip-full):libelf +PACKAGE_ip-full:libcap endef define Package/rdma $(call Package/iproute2/Default) TITLE:=Network rdma utility - DEPENDS:=+libmnl + DEPENDS:=+libmnl +(PACKAGE_tc||PACKAGE_ip-full):libelf +PACKAGE_ip-full:libcap endef ifeq ($(BUILD_VARIANT),tiny) IP_CONFIG_TINY:=y endif +ifeq ($(BUILD_VARIANT),full) + HAVE_ELF:=y + HAVE_CAP:=y +endif + +ifeq ($(BUILD_VARIANT),tc) + HAVE_ELF:=y + SHARED_LIBS:=y +endif + ifdef CONFIG_PACKAGE_devlink HAVE_MNL:=y endif @@ -116,9 +129,11 @@ TARGET_CPPFLAGS += -I$(STAGING_DIR)/usr/include/libnl-tiny MAKE_FLAGS += \ KERNEL_INCLUDE="$(LINUX_DIR)/user_headers/include" \ - SHARED_LIBS="" \ + SHARED_LIBS=$(SHARED_LIBS) \ IP_CONFIG_TINY=$(IP_CONFIG_TINY) \ + HAVE_ELF=$(HAVE_ELF) \ HAVE_MNL=$(HAVE_MNL) \ + HAVE_CAP=$(HAVE_CAP) \ IPT_LIB_DIR=/usr/lib/iptables \ XT_LIB_DIR=/usr/lib/iptables \ FPIC="$(FPIC)" @@ -149,6 +164,10 @@ define Package/tc/install $(INSTALL_BIN) $(PKG_BUILD_DIR)/tc/tc $(1)/usr/sbin/ $(INSTALL_DIR) $(1)/etc/hotplug.d/iface $(INSTALL_BIN) ./files/15-teql $(1)/etc/hotplug.d/iface/ +ifeq ($(SHARED_LIBS),y) + $(INSTALL_DIR) $(1)/usr/lib/tc + $(CP) $(PKG_BUILD_DIR)/tc/*.so $(1)/usr/lib/tc +endif endef define Package/genl/install diff --git a/package/network/utils/iproute2/patches/001-tc-fix-undefined-XATTR_SIZE_MAX.patch b/package/network/utils/iproute2/patches/001-tc-fix-undefined-XATTR_SIZE_MAX.patch deleted file mode 100644 index 6f28a2822d..0000000000 --- a/package/network/utils/iproute2/patches/001-tc-fix-undefined-XATTR_SIZE_MAX.patch +++ /dev/null @@ -1,10 +0,0 @@ ---- a/tc/f_flower.c -+++ b/tc/f_flower.c -@@ -17,6 +17,7 @@ - #include - #include - #include -+#include - #include - #include - diff --git a/package/network/utils/iproute2/patches/010-cake-fwmark.patch b/package/network/utils/iproute2/patches/010-cake-fwmark.patch new file mode 100644 index 0000000000..46981067bc --- /dev/null +++ b/package/network/utils/iproute2/patches/010-cake-fwmark.patch @@ -0,0 +1,152 @@ +From a7cd7badedcb643dc1adb41edeb4cf8e4d9ec063 Mon Sep 17 00:00:00 2001 +From: Stephen Hemminger +Date: Tue, 19 Mar 2019 10:36:56 -0700 +Subject: uapi: add CAKE FWMARK + +Signed-off-by: Stephen Hemminger +--- + include/uapi/linux/pkt_sched.h | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/include/uapi/linux/pkt_sched.h b/include/uapi/linux/pkt_sched.h +index 1eb572e..7ee74c3 100644 +--- a/include/uapi/linux/pkt_sched.h ++++ b/include/uapi/linux/pkt_sched.h +@@ -1021,6 +1021,7 @@ enum { + TCA_CAKE_INGRESS, + TCA_CAKE_ACK_FILTER, + TCA_CAKE_SPLIT_GSO, ++ TCA_CAKE_FWMARK, + __TCA_CAKE_MAX + }; + #define TCA_CAKE_MAX (__TCA_CAKE_MAX - 1) + +From 5ebfe1f6fea2bb3bfccf4cf93829516caaa0233d Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Toke=20H=C3=B8iland-J=C3=B8rgensen?= +Date: Mon, 18 Mar 2019 01:30:45 +0100 +Subject: [PATCH] q_cake: Add support for setting the fwmark option +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +This adds support for the newly added fwmark option to CAKE, which allows +overriding the tin selection from the per-packet firewall marks. The fwmark +field is a bitmask that is applied to the fwmark to select the tin. + +Signed-off-by: Toke Høiland-Jørgensen +--- + man/man8/tc-cake.8 | 16 ++++++++++++++++ + tc/q_cake.c | 24 ++++++++++++++++++++++++ + 2 files changed, 40 insertions(+) + +diff --git a/man/man8/tc-cake.8 b/man/man8/tc-cake.8 +index eda436e1..8c57eadd 100644 +--- a/man/man8/tc-cake.8 ++++ b/man/man8/tc-cake.8 +@@ -91,6 +91,10 @@ TIME | + LIMIT ] + .br + [ ++.BR fwmark ++MASK ] ++.br ++[ + .BR ptm + | + .BR atm +@@ -524,6 +528,18 @@ preset on the modern Internet is firmly discouraged. + .br + Voice (CS7, CS6, EF, VA, TOS4), 25% threshold, reduced Codel interval. + ++.PP ++.B fwmark ++MASK ++.br ++ This options turns on fwmark-based overriding of CAKE's tin selection. ++If set, the option specifies a bitmask that will be applied to the fwmark ++associated with each packet. If the result of this masking is non-zero, the ++result will be right-shifted by the number of least-significant unset bits in ++the mask value, and the result will be used as a the tin number for that packet. ++This can be used to set policies in a firewall script that will override CAKE's ++built-in tin selection. ++ + .SH OTHER PARAMETERS + .B memlimit + LIMIT +diff --git a/tc/q_cake.c b/tc/q_cake.c +index e827e3f1..307a12c0 100644 +--- a/tc/q_cake.c ++++ b/tc/q_cake.c +@@ -82,6 +82,7 @@ static void explain(void) + " [ split-gso* | no-split-gso ]\n" + " [ ack-filter | ack-filter-aggressive | no-ack-filter* ]\n" + " [ memlimit LIMIT ]\n" ++" [ fwmark MASK ]\n" + " [ ptm | atm | noatm* ] [ overhead N | conservative | raw* ]\n" + " [ mpu N ] [ ingress | egress* ]\n" + " (* marks defaults)\n"); +@@ -106,6 +107,7 @@ static int cake_parse_opt(struct qdisc_util *qu, int argc, char **argv, + int autorate = -1; + int ingress = -1; + int overhead = 0; ++ int fwmark = -1; + int wash = -1; + int nat = -1; + int atm = -1; +@@ -332,6 +334,16 @@ static int cake_parse_opt(struct qdisc_util *qu, int argc, char **argv, + "Illegal value for \"memlimit\": \"%s\"\n", *argv); + return -1; + } ++ } else if (strcmp(*argv, "fwmark") == 0) { ++ unsigned int fwm; ++ ++ NEXT_ARG(); ++ if (get_u32(&fwm, *argv, 0)) { ++ fprintf(stderr, ++ "Illegal value for \"fwmark\": \"%s\"\n", *argv); ++ return -1; ++ } ++ fwmark = fwm; + } else if (strcmp(*argv, "help") == 0) { + explain(); + return -1; +@@ -376,6 +388,9 @@ static int cake_parse_opt(struct qdisc_util *qu, int argc, char **argv, + if (memlimit) + addattr_l(n, 1024, TCA_CAKE_MEMORY, &memlimit, + sizeof(memlimit)); ++ if (fwmark != -1) ++ addattr_l(n, 1024, TCA_CAKE_FWMARK, &fwmark, ++ sizeof(fwmark)); + if (nat != -1) + addattr_l(n, 1024, TCA_CAKE_NAT, &nat, sizeof(nat)); + if (wash != -1) +@@ -409,6 +424,7 @@ static int cake_print_opt(struct qdisc_util *qu, FILE *f, struct rtattr *opt) + struct rtattr *tb[TCA_CAKE_MAX + 1]; + unsigned int interval = 0; + unsigned int memlimit = 0; ++ unsigned int fwmark = 0; + __u64 bandwidth = 0; + int ack_filter = 0; + int split_gso = 0; +@@ -507,6 +523,10 @@ static int cake_print_opt(struct qdisc_util *qu, FILE *f, struct rtattr *opt) + RTA_PAYLOAD(tb[TCA_CAKE_RTT]) >= sizeof(__u32)) { + interval = rta_getattr_u32(tb[TCA_CAKE_RTT]); + } ++ if (tb[TCA_CAKE_FWMARK] && ++ RTA_PAYLOAD(tb[TCA_CAKE_FWMARK]) >= sizeof(__u32)) { ++ fwmark = rta_getattr_u32(tb[TCA_CAKE_FWMARK]); ++ } + + if (wash) + print_string(PRINT_FP, NULL, "wash ", NULL); +@@ -559,6 +579,10 @@ static int cake_print_opt(struct qdisc_util *qu, FILE *f, struct rtattr *opt) + sprint_size(memlimit, b1)); + } + ++ if (fwmark) ++ print_uint(PRINT_FP, NULL, "fwmark 0x%x ", fwmark); ++ print_0xhex(PRINT_JSON, "fwmark", NULL, fwmark); ++ + return 0; + } + diff --git a/package/network/utils/iproute2/patches/090-tc-add-support-for-action-act_ctinfo.patch b/package/network/utils/iproute2/patches/090-tc-add-support-for-action-act_ctinfo.patch new file mode 100644 index 0000000000..6335cca03a --- /dev/null +++ b/package/network/utils/iproute2/patches/090-tc-add-support-for-action-act_ctinfo.patch @@ -0,0 +1,589 @@ +From dff8eadcab33209e040e77a5d56d5def04808144 Mon Sep 17 00:00:00 2001 +From: Kevin Darbyshire-Bryant +Date: Fri, 15 Mar 2019 09:35:37 +0000 +Subject: [PATCH] tc: add support for action act_ctinfo +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +ctinfo is a tc action restoring data stored in conntrack marks to +various fields. At present it has two independent modes of operation, +restoration of DSCP into IPv4/v6 diffserv and restoration of conntrack +marks into packet skb marks. + +It understands a number of parameters specific to this action in +additional to the usual action syntax. Each operating mode is +independent of the other so all options are optional, however not +specifying at least one mode is a bit pointless. + +Usage: ... ctinfo [dscp mask [statemask]] [cpmark [mask]] [zone ZONE] + [CONTROL] [index ] + +DSCP mode + +dscp enables copying of a DSCP stored in the conntrack mark into the +ipv4/v6 diffserv field. The mask is a 32bit field and specifies where +in the conntrack mark the DSCP value is located. It must be 6 +contiguous bits long. eg. 0xfc000000 would restore the DSCP from the +upper 6 bits of the conntrack mark. + +The DSCP copying may be optionally controlled by a statemask. The +statemask is a 32bit field, usually with a single bit set and must not +overlap the dscp mask. The DSCP restore operation will only take place +if the corresponding bit/s in conntrack mark ANDed with the statemask +yield a non zero result. + +eg. dscp 0xfc000000 0x01000000 would retrieve the DSCP from the top 6 +bits, whilst using bit 25 as a flag to do so. Bit 26 is unused in this +example. + +CPMARK mode + +cpmark enables copying of the conntrack mark to the packet skb mark. In +this mode it is completely equivalent to the existing act_connmark +action. Additional functionality is provided by the optional mask +parameter, whereby the stored conntrack mark is logically ANDed with the +cpmark mask before being stored into skb mark. This allows shared usage +of the conntrack mark between applications. + +eg. cpmark 0x00ffffff would restore only the lower 24 bits of the +conntrack mark, thus may be useful in the event that the upper 8 bits +are used by the DSCP function. + +Usage: ... ctinfo [dscp mask [statemask]] [cpmark [mask]] [zone ZONE] + [CONTROL] [index ] +where : + dscp MASK is the bitmask to restore DSCP + STATEMASK is the bitmask to determine conditional restoring + cpmark MASK mask applied to restored packet mark + ZONE is the conntrack zone + CONTROL := reclassify | pipe | drop | continue | ok | + goto chain + +Signed-off-by: Kevin Darbyshire-Bryant +Reviewed-by: Toke Høiland-Jørgensen +--- + include/uapi/linux/pkt_cls.h | 3 +- + include/uapi/linux/tc_act/tc_ctinfo.h | 29 +++ + man/man8/tc-ctinfo.8 | 170 ++++++++++++++++ + tc/Makefile | 1 + + tc/m_ctinfo.c | 268 ++++++++++++++++++++++++++ + 5 files changed, 470 insertions(+), 1 deletion(-) + create mode 100644 include/uapi/linux/tc_act/tc_ctinfo.h + create mode 100644 man/man8/tc-ctinfo.8 + create mode 100644 tc/m_ctinfo.c + +diff --git a/include/uapi/linux/pkt_cls.h b/include/uapi/linux/pkt_cls.h +index 95d0db2a..a6e7e176 100644 +--- a/include/uapi/linux/pkt_cls.h ++++ b/include/uapi/linux/pkt_cls.h +@@ -68,7 +68,8 @@ enum { + TCA_ID_UNSPEC=0, + TCA_ID_POLICE=1, + /* other actions go here */ +- __TCA_ID_MAX=255 ++ TCA_ID_CTINFO=27, ++ __TCA_ID_MAX = 255 + }; + + #define TCA_ID_MAX __TCA_ID_MAX +diff --git a/include/uapi/linux/tc_act/tc_ctinfo.h b/include/uapi/linux/tc_act/tc_ctinfo.h +new file mode 100644 +index 00000000..f5f26d95 +--- /dev/null ++++ b/include/uapi/linux/tc_act/tc_ctinfo.h +@@ -0,0 +1,29 @@ ++/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ ++#ifndef __UAPI_TC_CTINFO_H ++#define __UAPI_TC_CTINFO_H ++ ++#include ++#include ++ ++struct tc_ctinfo { ++ tc_gen; ++}; ++ ++enum { ++ TCA_CTINFO_UNSPEC, ++ TCA_CTINFO_PAD, ++ TCA_CTINFO_TM, ++ TCA_CTINFO_ACT, ++ TCA_CTINFO_ZONE, ++ TCA_CTINFO_PARMS_DSCP_MASK, ++ TCA_CTINFO_PARMS_DSCP_STATEMASK, ++ TCA_CTINFO_PARMS_CPMARK_MASK, ++ TCA_CTINFO_STATS_DSCP_SET, ++ TCA_CTINFO_STATS_DSCP_ERROR, ++ TCA_CTINFO_STATS_CPMARK_SET, ++ __TCA_CTINFO_MAX ++}; ++ ++#define TCA_CTINFO_MAX (__TCA_CTINFO_MAX - 1) ++ ++#endif +diff --git a/man/man8/tc-ctinfo.8 b/man/man8/tc-ctinfo.8 +new file mode 100644 +index 00000000..096590d1 +--- /dev/null ++++ b/man/man8/tc-ctinfo.8 +@@ -0,0 +1,170 @@ ++.TH "ctinfo action in tc" 8 "4 Jun 2019" "iproute2" "Linux" ++.SH NAME ++ctinfo \- tc connmark processing action ++.SH SYNOPSIS ++.B tc ... action ctinfo ++[ ++.B dscp ++MASK [STATEMASK] ] [ ++.B cpmark ++[MASK] ] [ ++.B zone ++ZONE ] [ ++.B CONTROL ++] [ ++.B index ++ ++] ++ ++.SH DESCRIPTION ++CTINFO (Conntrack Information) is a tc action for retrieving data from ++conntrack marks into various fields. At present it has two independent ++processing modes which may be viewed as sub-functions. ++ ++DSCP mode copies a DSCP stored in conntrack's connmark into the IPv4/v6 diffserv ++field. The copying may conditionally occur based on a flag also stored in the ++connmark. DSCP mode was designed to assist in restoring packet classifications on ++ingress, classifications which may then be used by qdiscs such as CAKE. It may be ++used in any circumstance where ingress classification needs to be maintained across ++links that otherwise bleach or remap according to their own policies. ++ ++CPMARK (copymark) mode copies the conntrack connmark into the packet's mark field. Without ++additional parameters it is functionally completely equivalent to the existing ++connmark action. An optional mask may be specified to mask which bits of the ++connmark are restored. This may be useful when DSCP and CPMARK modes are combined. ++ ++Simple statistics (tc -s) on DSCP restores and CPMARK copies are maintained where values for ++set indicate a count of packets altered for that mode. DSCP includes an error count ++where the destination packet's diffserv field was unwriteable. ++.SH PARAMETERS ++.SS DSCP mode parameters: ++.IP mask ++A mask of 6 contiguous bits indicating where the DSCP value is located in the 32 bit ++conntrack mark field. A mask must be provided for this mode. mask is a 32 bit ++unsigned value. ++.IP statemask ++A mask of at least 1 bit indicating where a conditional restore flag is located in the ++32 bit conntrack mark field. The statemask bit/s must NOT overlap the mask bits. The ++DSCP will be restored if the conntrack mark logically ANDed with the statemask yields ++a non-zero result. statemask is an optional unsigned 32 bit value. ++.SS CPMARK mode parameters: ++.IP mask ++Store the logically ANDed result of conntrack mark and mask into the packet's mark ++field. Default is 0xffffffff i.e. the whole mark field. mask is an optional unsigned 32 bit ++value ++.SS Overall action parameters: ++.IP zone ++Specify the conntrack zone when doing conntrack lookups for packets. ++zone is a 16bit unsigned decimal value. ++Default is 0. ++.IP CONTROL ++The following keywords allow to control how the tree of qdisc, classes, ++filters and actions is further traversed after this action. ++.RS ++.TP ++.B reclassify ++Restart with the first filter in the current list. ++.TP ++.B pipe ++Continue with the next action attached to the same filter. ++.TP ++.B drop ++Drop the packet. ++.TP ++.B shot ++synonym for ++.B drop ++.TP ++.B continue ++Continue classification with the next filter in line. ++.TP ++.B pass ++Finish classification process and return to calling qdisc for further packet ++processing. This is the default. ++.RE ++.IP index ++Specify an index for this action in order to being able to identify it in later ++commands. index is a 32bit unsigned decimal value. ++.SH EXAMPLES ++Example showing conditional restoration of DSCP on ingress via an IFB ++.RS ++.EX ++ ++#Set up the IFB interface ++.br ++tc qdisc add dev ifb4eth0 handle ffff: ingress ++ ++#Put CAKE qdisc on it ++.br ++tc qdisc add dev ifb4eth0 root cake bandwidth 40mbit ++ ++#Set interface UP ++.br ++ip link set dev ifb4eth0 up ++ ++#Add 2 actions, ctinfo to restore dscp & mirred to redirect the packets to IFB ++.br ++tc filter add dev eth0 parent ffff: protocol all prio 10 u32 \\ ++ match u32 0 0 flowid 1:1 action \\ ++ ctinfo dscp 0xfc000000 0x01000000 \\ ++ mirred egress redirect dev ifb4eth0 ++ ++tc -s qdisc show dev eth0 ingress ++ ++ filter parent ffff: protocol all pref 10 u32 chain 0 ++ filter parent ffff: protocol all pref 10 u32 chain 0 fh 800: ht divisor 1 ++ filter parent ffff: protocol all pref 10 u32 chain 0 fh 800::800 order 2048 key ht 800 bkt 0 flowid 1:1 not_in_hw ++ match 00000000/00000000 at 0 ++ action order 1: ctinfo zone 0 pipe ++ index 2 ref 1 bind 1 dscp 0xfc000000 0x01000000 installed 72 sec used 0 sec DSCP set 1333 error 0 CPMARK set 0 ++ Action statistics: ++ Sent 658484 bytes 1833 pkt (dropped 0, overlimits 0 requeues 0) ++ backlog 0b 0p requeues 0 ++ ++ action order 2: mirred (Egress Redirect to device ifb4eth0) stolen ++ index 1 ref 1 bind 1 installed 72 sec used 0 sec ++ Action statistics: ++ Sent 658484 bytes 1833 pkt (dropped 0, overlimits 0 requeues 0) ++ backlog 0b 0p requeues 0 ++.EE ++.RE ++ ++Example showing conditional restoration of DSCP on egress ++ ++This may appear nonsensical since iptables marking of egress packets is easy ++to achieve, however the iptables flow classification rules may be extensive ++and so some sort of set once and forget may be useful especially on cpu ++constrained devices. ++.RS ++.EX ++ ++# Send unmarked connections to a marking chain which needs to store a DSCP ++and set statemask bit in the connmark ++.br ++iptables -t mangle -A POSTROUTING -o eth0 -m connmark \\ ++ --mark 0x00000000/0x01000000 -g CLASS_MARKING_CHAIN ++ ++# Apply marked DSCP to the packets ++.br ++tc filter add dev eth0 protocol all prio 10 u32 \\ ++ match u32 0 0 flowid 1:1 action \\ ++ ctinfo dscp 0xfc000000 0x01000000 ++ ++tc -s filter show dev eth0 ++ filter parent 800e: protocol all pref 10 u32 chain 0 ++ filter parent 800e: protocol all pref 10 u32 chain 0 fh 800: ht divisor 1 ++ filter parent 800e: protocol all pref 10 u32 chain 0 fh 800::800 order 2048 key ht 800 bkt 0 flowid 1:1 not_in_hw ++ match 00000000/00000000 at 0 ++ action order 1: ctinfo zone 0 pipe ++ index 1 ref 1 bind 1 dscp 0xfc000000 0x01000000 installed 7414 sec used 0 sec DSCP set 53404 error 0 CPMARK set 0 ++ Action statistics: ++ Sent 32890260 bytes 120441 pkt (dropped 0, overlimits 0 requeues 0) ++ backlog 0b 0p requeues 0 ++.br ++.SH SEE ALSO ++.BR tc (8), ++.BR tc-cake (8) ++.BR tc-connmark (8) ++.BR tc-mirred (8) ++.SH AUTHORS ++ctinfo was written by Kevin Darbyshire-Bryant. +diff --git a/tc/Makefile b/tc/Makefile +index 2edaf2c8..ec93a9a1 100644 +--- a/tc/Makefile ++++ b/tc/Makefile +@@ -48,6 +48,7 @@ TCMODULES += m_csum.o + TCMODULES += m_simple.o + TCMODULES += m_vlan.o + TCMODULES += m_connmark.o ++TCMODULES += m_ctinfo.o + TCMODULES += m_bpf.o + TCMODULES += m_tunnel_key.o + TCMODULES += m_sample.o +diff --git a/tc/m_ctinfo.c b/tc/m_ctinfo.c +new file mode 100644 +index 00000000..5e451f87 +--- /dev/null ++++ b/tc/m_ctinfo.c +@@ -0,0 +1,268 @@ ++/* SPDX-License-Identifier: GPL-2.0 */ ++/* ++ * m_ctinfo.c netfilter ctinfo mark action ++ * ++ * Copyright (c) 2019 Kevin Darbyshire-Bryant ++ */ ++ ++#include ++#include ++#include ++#include ++#include "utils.h" ++#include "tc_util.h" ++#include ++ ++static void ++explain(void) ++{ ++ fprintf(stderr, ++ "Usage: ... ctinfo [dscp mask [statemask]] [cpmark [mask]] [zone ZONE] [CONTROL] [index ]\n" ++ "where :\n" ++ "\tdscp MASK bitmask location of stored DSCP\n" ++ "\t STATEMASK bitmask to determine conditional restoring\n" ++ "\tcpmark MASK mask applied to mark on restoration\n" ++ "\tZONE is the conntrack zone\n" ++ "\tCONTROL := reclassify | pipe | drop | continue | ok |\n" ++ "\t goto chain \n"); ++} ++ ++static void ++usage(void) ++{ ++ explain(); ++ exit(-1); ++} ++ ++static int ++parse_ctinfo(struct action_util *a, int *argc_p, char ***argv_p, int tca_id, ++ struct nlmsghdr *n) ++{ ++ unsigned int cpmarkmask = 0, dscpmask = 0, dscpstatemask = 0; ++ struct tc_ctinfo sel = {}; ++ unsigned short zone = 0; ++ char **argv = *argv_p; ++ struct rtattr *tail; ++ int argc = *argc_p; ++ int ok = 0; ++ __u8 i; ++ ++ while (argc > 0) { ++ if (matches(*argv, "ctinfo") == 0) { ++ ok = 1; ++ NEXT_ARG_FWD(); ++ } else if (matches(*argv, "help") == 0) { ++ usage(); ++ } else { ++ break; ++ } ++ ++ } ++ ++ if (!ok) { ++ explain(); ++ return -1; ++ } ++ ++ if (argc) { ++ if (matches(*argv, "dscp") == 0) { ++ NEXT_ARG(); ++ if (get_u32(&dscpmask, *argv, 0)) { ++ fprintf(stderr, ++ "ctinfo: Illegal dscp \"mask\"\n"); ++ return -1; ++ } ++ if (NEXT_ARG_OK()) { ++ NEXT_ARG_FWD(); ++ if (!get_u32(&dscpstatemask, *argv, 0)) ++ NEXT_ARG_FWD(); /* was a statemask */ ++ } else { ++ NEXT_ARG_FWD(); ++ } ++ } ++ } ++ ++ /* cpmark has optional mask parameter, so the next arg might not */ ++ /* exist, or it might be the next option, or it may actually be a */ ++ /* 32bit mask */ ++ if (argc) { ++ if (matches(*argv, "cpmark") == 0) { ++ cpmarkmask = ~0; ++ if (NEXT_ARG_OK()) { ++ NEXT_ARG_FWD(); ++ if (!get_u32(&cpmarkmask, *argv, 0)) ++ NEXT_ARG_FWD(); /* was a mask */ ++ } else { ++ NEXT_ARG_FWD(); ++ } ++ } ++ } ++ ++ if (argc) { ++ if (matches(*argv, "zone") == 0) { ++ NEXT_ARG(); ++ if (get_u16(&zone, *argv, 10)) { ++ fprintf(stderr, "ctinfo: Illegal \"zone\"\n"); ++ return -1; ++ } ++ NEXT_ARG_FWD(); ++ } ++ } ++ ++ parse_action_control_dflt(&argc, &argv, &sel.action, ++ false, TC_ACT_PIPE); ++ ++ if (argc) { ++ if (matches(*argv, "index") == 0) { ++ NEXT_ARG(); ++ if (get_u32(&sel.index, *argv, 10)) { ++ fprintf(stderr, "ctinfo: Illegal \"index\"\n"); ++ return -1; ++ } ++ NEXT_ARG_FWD(); ++ } ++ } ++ ++ if (dscpmask & dscpstatemask) { ++ fprintf(stderr, ++ "ctinfo: dscp mask & statemask must NOT overlap\n"); ++ return -1; ++ } ++ ++ i = ffs(dscpmask); ++ if (i && ((~0 & (dscpmask >> (i - 1))) != 0x3f)) { ++ fprintf(stderr, ++ "ctinfo: dscp mask must be 6 contiguous bits long\n"); ++ return -1; ++ } ++ ++ tail = addattr_nest(n, MAX_MSG, tca_id); ++ addattr_l(n, MAX_MSG, TCA_CTINFO_ACT, &sel, sizeof(sel)); ++ addattr16(n, MAX_MSG, TCA_CTINFO_ZONE, zone); ++ ++ if (dscpmask) ++ addattr32(n, MAX_MSG, ++ TCA_CTINFO_PARMS_DSCP_MASK, dscpmask); ++ ++ if (dscpstatemask) ++ addattr32(n, MAX_MSG, ++ TCA_CTINFO_PARMS_DSCP_STATEMASK, dscpstatemask); ++ ++ if (cpmarkmask) ++ addattr32(n, MAX_MSG, ++ TCA_CTINFO_PARMS_CPMARK_MASK, cpmarkmask); ++ ++ addattr_nest_end(n, tail); ++ ++ *argc_p = argc; ++ *argv_p = argv; ++ return 0; ++} ++ ++static void print_ctinfo_stats(FILE *f, struct rtattr *tb[TCA_CTINFO_MAX + 1]) ++{ ++ struct tcf_t *tm; ++ ++ if (tb[TCA_CTINFO_TM]) { ++ tm = RTA_DATA(tb[TCA_CTINFO_TM]); ++ ++ print_tm(f, tm); ++ } ++ ++ if (tb[TCA_CTINFO_STATS_DSCP_SET]) ++ print_lluint(PRINT_ANY, "dscpset", " DSCP set %llu", ++ rta_getattr_u64(tb[TCA_CTINFO_STATS_DSCP_SET])); ++ if (tb[TCA_CTINFO_STATS_DSCP_ERROR]) ++ print_lluint(PRINT_ANY, "dscperror", " error %llu", ++ rta_getattr_u64(tb[TCA_CTINFO_STATS_DSCP_ERROR])); ++ ++ if (tb[TCA_CTINFO_STATS_CPMARK_SET]) ++ print_lluint(PRINT_ANY, "cpmarkset", " CPMARK set %llu", ++ rta_getattr_u64(tb[TCA_CTINFO_STATS_CPMARK_SET])); ++} ++ ++static int print_ctinfo(struct action_util *au, FILE *f, struct rtattr *arg) ++{ ++ unsigned int cpmarkmask = ~0, dscpmask = 0, dscpstatemask = 0; ++ struct rtattr *tb[TCA_CTINFO_MAX + 1]; ++ unsigned short zone = 0; ++ struct tc_ctinfo *ci; ++ ++ if (arg == NULL) ++ return -1; ++ ++ parse_rtattr_nested(tb, TCA_CTINFO_MAX, arg); ++ if (!tb[TCA_CTINFO_ACT]) { ++ print_string(PRINT_FP, NULL, "%s", ++ "[NULL ctinfo action parameters]"); ++ return -1; ++ } ++ ++ ci = RTA_DATA(tb[TCA_CTINFO_ACT]); ++ ++ if (tb[TCA_CTINFO_PARMS_DSCP_MASK]) { ++ if (RTA_PAYLOAD(tb[TCA_CTINFO_PARMS_DSCP_MASK]) >= ++ sizeof(__u32)) ++ dscpmask = rta_getattr_u32( ++ tb[TCA_CTINFO_PARMS_DSCP_MASK]); ++ else ++ print_string(PRINT_FP, NULL, "%s", ++ "[invalid dscp mask parameter]"); ++ } ++ ++ if (tb[TCA_CTINFO_PARMS_DSCP_STATEMASK]) { ++ if (RTA_PAYLOAD(tb[TCA_CTINFO_PARMS_DSCP_STATEMASK]) >= ++ sizeof(__u32)) ++ dscpstatemask = rta_getattr_u32( ++ tb[TCA_CTINFO_PARMS_DSCP_STATEMASK]); ++ else ++ print_string(PRINT_FP, NULL, "%s", ++ "[invalid dscp statemask parameter]"); ++ } ++ ++ if (tb[TCA_CTINFO_PARMS_CPMARK_MASK]) { ++ if (RTA_PAYLOAD(tb[TCA_CTINFO_PARMS_CPMARK_MASK]) >= ++ sizeof(__u32)) ++ cpmarkmask = rta_getattr_u32( ++ tb[TCA_CTINFO_PARMS_CPMARK_MASK]); ++ else ++ print_string(PRINT_FP, NULL, "%s", ++ "[invalid cpmark mask parameter]"); ++ } ++ ++ if (tb[TCA_CTINFO_ZONE] && RTA_PAYLOAD(tb[TCA_CTINFO_ZONE]) >= ++ sizeof(__u16)) ++ zone = rta_getattr_u16(tb[TCA_CTINFO_ZONE]); ++ ++ print_string(PRINT_ANY, "kind", "%s ", "ctinfo"); ++ print_hu(PRINT_ANY, "zone", "zone %u", zone); ++ print_action_control(f, " ", ci->action, ""); ++ ++ print_string(PRINT_FP, NULL, "%s", _SL_); ++ print_uint(PRINT_ANY, "index", "\t index %u", ci->index); ++ print_int(PRINT_ANY, "ref", " ref %d", ci->refcnt); ++ print_int(PRINT_ANY, "bind", " bind %d", ci->bindcnt); ++ ++ if (tb[TCA_CTINFO_PARMS_DSCP_MASK]) { ++ print_0xhex(PRINT_ANY, "dscpmask", " dscp %#010llx", dscpmask); ++ print_0xhex(PRINT_ANY, "dscpstatemask", " %#010llx", ++ dscpstatemask); ++ } ++ ++ if (tb[TCA_CTINFO_PARMS_CPMARK_MASK]) ++ print_0xhex(PRINT_ANY, "cpmark", " cpmark %#010llx", ++ cpmarkmask); ++ ++ if (show_stats) ++ print_ctinfo_stats(f, tb); ++ ++ print_string(PRINT_FP, NULL, "%s", _SL_); ++ ++ return 0; ++} ++ ++struct action_util ctinfo_action_util = { ++ .id = "ctinfo", ++ .parse_aopt = parse_ctinfo, ++ .print_aopt = print_ctinfo, ++}; +-- +2.20.1 (Apple Git-117) + diff --git a/package/network/utils/iproute2/patches/130-no_netem.patch b/package/network/utils/iproute2/patches/130-no_netem.patch index 58062655c9..aa93366f29 100644 --- a/package/network/utils/iproute2/patches/130-no_netem.patch +++ b/package/network/utils/iproute2/patches/130-no_netem.patch @@ -1,6 +1,6 @@ --- a/Makefile +++ b/Makefile -@@ -61,7 +61,7 @@ WFLAGS += -Wmissing-declarations -Wold-s +@@ -55,7 +55,7 @@ WFLAGS += -Wmissing-declarations -Wold-s CFLAGS := $(WFLAGS) $(CCOPTS) -I../include -I../include/uapi $(DEFINES) $(CFLAGS) YACCFLAGS = -d -t -v diff --git a/package/network/utils/iproute2/patches/135-sync-iptables-header.patch b/package/network/utils/iproute2/patches/135-sync-iptables-header.patch new file mode 100644 index 0000000000..bba90e69ab --- /dev/null +++ b/package/network/utils/iproute2/patches/135-sync-iptables-header.patch @@ -0,0 +1,101 @@ +Description: Sync header from iptables + The current versions in several suites have the same content: + - 1.6.1-2 (unstable) +Bug: https://bugs.debian.org/868059 +Forwarded: not-needed +Author: Cyril Brulebois +Last-Update: 2017-11-22 +--- a/include/xtables.h ++++ b/include/xtables.h +@@ -206,9 +206,24 @@ enum xtables_ext_flags { + XTABLES_EXT_ALIAS = 1 << 0, + }; + ++struct xt_xlate; ++ ++struct xt_xlate_mt_params { ++ const void *ip; ++ const struct xt_entry_match *match; ++ int numeric; ++ bool escape_quotes; ++}; ++ ++struct xt_xlate_tg_params { ++ const void *ip; ++ const struct xt_entry_target *target; ++ int numeric; ++ bool escape_quotes; ++}; ++ + /* Include file for additions: new matches and targets. */ +-struct xtables_match +-{ ++struct xtables_match { + /* + * ABI/API version this module requires. Must be first member, + * as the rest of this struct may be subject to ABI changes. +@@ -270,6 +285,10 @@ struct xtables_match + void (*x6_fcheck)(struct xt_fcheck_call *); + const struct xt_option_entry *x6_options; + ++ /* Translate iptables to nft */ ++ int (*xlate)(struct xt_xlate *xl, ++ const struct xt_xlate_mt_params *params); ++ + /* Size of per-extension instance extra "global" scratch space */ + size_t udata_size; + +@@ -281,8 +300,7 @@ struct xtables_match + unsigned int loaded; /* simulate loading so options are merged properly */ + }; + +-struct xtables_target +-{ ++struct xtables_target { + /* + * ABI/API version this module requires. Must be first member, + * as the rest of this struct may be subject to ABI changes. +@@ -347,6 +365,10 @@ struct xtables_target + void (*x6_fcheck)(struct xt_fcheck_call *); + const struct xt_option_entry *x6_options; + ++ /* Translate iptables to nft */ ++ int (*xlate)(struct xt_xlate *xl, ++ const struct xt_xlate_tg_params *params); ++ + size_t udata_size; + + /* Ignore these men behind the curtain: */ +@@ -407,6 +429,17 @@ struct xtables_globals + + #define XT_GETOPT_TABLEEND {.name = NULL, .has_arg = false} + ++/* ++ * enum op- ++ * ++ * For writing clean nftables translations code ++ */ ++enum xt_op { ++ XT_OP_EQ, ++ XT_OP_NEQ, ++ XT_OP_MAX, ++}; ++ + #ifdef __cplusplus + extern "C" { + #endif +@@ -549,6 +582,14 @@ extern void xtables_lmap_free(struct xta + extern int xtables_lmap_name2id(const struct xtables_lmap *, const char *); + extern const char *xtables_lmap_id2name(const struct xtables_lmap *, int); + ++/* xlate infrastructure */ ++struct xt_xlate *xt_xlate_alloc(int size); ++void xt_xlate_free(struct xt_xlate *xl); ++void xt_xlate_add(struct xt_xlate *xl, const char *fmt, ...); ++void xt_xlate_add_comment(struct xt_xlate *xl, const char *comment); ++const char *xt_xlate_get_comment(struct xt_xlate *xl); ++const char *xt_xlate_get(struct xt_xlate *xl); ++ + #ifdef XTABLES_INTERNAL + + /* Shipped modules rely on this... */ diff --git a/package/network/utils/iproute2/patches/140-keep_libmnl_optional.patch b/package/network/utils/iproute2/patches/140-keep_libmnl_optional.patch index 505f0221e3..d255ae7b0e 100644 --- a/package/network/utils/iproute2/patches/140-keep_libmnl_optional.patch +++ b/package/network/utils/iproute2/patches/140-keep_libmnl_optional.patch @@ -1,6 +1,6 @@ --- a/configure +++ b/configure -@@ -254,7 +254,7 @@ check_selinux() +@@ -255,7 +255,7 @@ check_selinux() check_mnl() { diff --git a/package/network/utils/iproute2/patches/145-keep_libelf_optional.patch b/package/network/utils/iproute2/patches/145-keep_libelf_optional.patch new file mode 100644 index 0000000000..2e3ad18809 --- /dev/null +++ b/package/network/utils/iproute2/patches/145-keep_libelf_optional.patch @@ -0,0 +1,11 @@ +--- a/configure ++++ b/configure +@@ -228,7 +228,7 @@ EOF + + check_elf() + { +- if ${PKG_CONFIG} libelf --exists; then ++ if [ "${HAVE_ELF}" = "y" ] && ${PKG_CONFIG} libelf --exists; then + echo "HAVE_ELF:=y" >>$CONFIG + echo "yes" + diff --git a/package/network/utils/iproute2/patches/150-keep_libcap_optional.patch b/package/network/utils/iproute2/patches/150-keep_libcap_optional.patch new file mode 100644 index 0000000000..05336a737c --- /dev/null +++ b/package/network/utils/iproute2/patches/150-keep_libcap_optional.patch @@ -0,0 +1,11 @@ +--- a/configure ++++ b/configure +@@ -313,7 +313,7 @@ EOF + + check_cap() + { +- if ${PKG_CONFIG} libcap --exists; then ++ if [ "${HAVE_CAP}" = "y" ] && ${PKG_CONFIG} libcap --exists; then + echo "HAVE_CAP:=y" >>$CONFIG + echo "yes" + diff --git a/package/network/utils/iproute2/patches/170-ip_tiny.patch b/package/network/utils/iproute2/patches/170-ip_tiny.patch index 91240b6d2f..fb5a6466e4 100644 --- a/package/network/utils/iproute2/patches/170-ip_tiny.patch +++ b/package/network/utils/iproute2/patches/170-ip_tiny.patch @@ -41,7 +41,7 @@ +#endif " OPTIONS := { -V[ersion] | -s[tatistics] | -d[etails] | -r[esolve] |\n" " -h[uman-readable] | -iec | -j[son] | -p[retty] |\n" - " -f[amily] { inet | inet6 | ipx | dnet | mpls | bridge | link } |\n" + " -f[amily] { inet | inet6 | mpls | bridge | link } |\n" @@ -72,32 +78,44 @@ static const struct cmd { int (*func)(int argc, char **argv); } cmds[] = { @@ -87,24 +87,6 @@ { "vrf", do_ipvrf}, { "sr", do_seg6 }, { "help", do_help }, ---- a/lib/utils.c -+++ b/lib/utils.c -@@ -1000,6 +1000,7 @@ const char *rt_addr_n2a_r(int af, int le - return inet_ntop(af, addr, buf, buflen); - case AF_MPLS: - return mpls_ntop(af, addr, buf, buflen); -+#ifndef IPROUTE2_TINY - case AF_IPX: - return ipx_ntop(af, addr, buf, buflen); - case AF_DECnet: -@@ -1009,6 +1010,7 @@ const char *rt_addr_n2a_r(int af, int le - memcpy(dna.a_addr, addr, 2); - return dnet_ntop(af, &dna, buf, buflen); - } -+#endif - case AF_PACKET: - return ll_addr_n2a(addr, len, ARPHRD_VOID, buf, buflen); - case AF_BRIDGE: --- a/lib/Makefile +++ b/lib/Makefile @@ -3,6 +3,10 @@ include ../config.mk diff --git a/package/network/utils/iproute2/patches/175-reduce-dynamic-syms.patch b/package/network/utils/iproute2/patches/175-reduce-dynamic-syms.patch new file mode 100644 index 0000000000..64ab135589 --- /dev/null +++ b/package/network/utils/iproute2/patches/175-reduce-dynamic-syms.patch @@ -0,0 +1,44 @@ +--- a/tc/Makefile ++++ b/tc/Makefile +@@ -107,7 +107,7 @@ LDLIBS += -L. -lm + + ifeq ($(SHARED_LIBS),y) + LDLIBS += -ldl +-LDFLAGS += -Wl,-export-dynamic ++LDFLAGS += -Wl,--dynamic-list=dynsyms.list + endif + + TCLIB := tc_core.o +@@ -137,7 +137,7 @@ MODDESTDIR := $(DESTDIR)$(LIBDIR)/tc + all: tc $(TCSO) + + tc: $(TCOBJ) $(LIBNETLINK) libtc.a +- $(QUIET_LINK)$(CC) $^ $(LDFLAGS) $(LDLIBS) -o $@ ++ $(QUIET_LINK)$(CC) $(filter-out dynsyms.list, $^) $(LDFLAGS) $(LDLIBS) -o $@ + + libtc.a: $(TCLIB) + $(QUIET_AR)$(AR) rcs $@ $^ +@@ -159,6 +159,7 @@ install: all + clean: + rm -f $(TCOBJ) $(TCLIB) libtc.a tc *.so emp_ematch.yacc.h; \ + rm -f emp_ematch.yacc.* ++ rm -f dynsyms.list + + q_atm.so: q_atm.c + $(QUIET_CC)$(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) -shared -fpic -o q_atm.so q_atm.c -latm +@@ -198,4 +199,15 @@ static-syms.h: $(wildcard *.c) + sed -n '/'$$s'[^ ]* =/{s:.* \([^ ]*'$$s'[^ ]*\) .*:extern char \1[] __attribute__((weak)); if (!strcmp(sym, "\1")) return \1;:;p}' $$files ; \ + done > $@ + ++else ++ ++tc: dynsyms.list ++dynsyms.list: $(wildcard *.c) ++ files="$(filter-out $(patsubst %.so,%.c,$(TCSO)), $^)" ; \ ++ echo "{" > $@ ; \ ++ for s in `grep -B 3 '\> $@ ; \ ++ echo "show_stats; print_tm; parse_rtattr; get_u32; matches; addattr_l; addattr_nest; addattr_nest_end; };" >> $@ ++ + endif diff --git a/package/network/utils/iproute2/patches/190-link-libelf-to-tc-only.patch b/package/network/utils/iproute2/patches/190-link-libelf-to-tc-only.patch deleted file mode 100644 index 31aacffba8..0000000000 --- a/package/network/utils/iproute2/patches/190-link-libelf-to-tc-only.patch +++ /dev/null @@ -1,60 +0,0 @@ ---- a/configure -+++ b/configure -@@ -231,8 +231,9 @@ check_elf() - echo "HAVE_ELF:=y" >>$CONFIG - echo "yes" - -- echo 'CFLAGS += -DHAVE_ELF' `${PKG_CONFIG} libelf --cflags` >> $CONFIG -- echo 'LDLIBS += ' `${PKG_CONFIG} libelf --libs` >>$CONFIG -+ echo 'CFLAGS += -DHAVE_ELF' >> $CONFIG -+ echo 'ELF_CFLAGS += ' `${PKG_CONFIG} libelf --cflags` >> $CONFIG -+ echo 'ELF_LDLIBS += ' `${PKG_CONFIG} libelf --libs` >>$CONFIG - else - echo "no" - fi ---- a/lib/Makefile -+++ b/lib/Makefile -@@ -11,9 +11,17 @@ UTILOBJ = utils.o rt_names.o ll_map.o ll - inet_proto.o namespace.o json_writer.o json_print.o \ - names.o color.o bpf.o exec.o fs.o - -+ELFOBJ=$(patsubst %.o,%.elf.o,$(UTILOBJ)) -+ - NLOBJ=libgenl.o libnetlink.o - --all: libnetlink.a libutil.a -+all: libnetlink.a libutil.a libutil-elf.a -+ -+%.o: %.c -+ $(QUIET_CC)$(CC) $(CFLAGS) -UHAVE_ELF $(EXTRA_CFLAGS) -c -o $@ $< -+ -+%.elf.o: %.c -+ $(QUIET_CC)$(CC) $(CFLAGS) $(ELF_CFLAGS) $(EXTRA_CFLAGS) -c -o $@ $< - - libnetlink.a: $(NLOBJ) - $(QUIET_AR)$(AR) rcs $@ $^ -@@ -21,7 +29,10 @@ libnetlink.a: $(NLOBJ) - libutil.a: $(UTILOBJ) $(ADDLIB) - $(QUIET_AR)$(AR) rcs $@ $^ - -+libutil-elf.a: $(ELFOBJ) $(ADDLIB) -+ $(QUIET_AR)$(AR) rcs $@ $^ -+ - install: - - clean: -- rm -f $(NLOBJ) $(UTILOBJ) $(ADDLIB) libnetlink.a libutil.a -+ rm -f $(NLOBJ) $(UTILOBJ) $(ELFOBJ) $(ADDLIB) libnetlink.a libutil.a libutil-elf.a ---- a/tc/Makefile -+++ b/tc/Makefile -@@ -133,8 +133,8 @@ MODDESTDIR := $(DESTDIR)$(LIBDIR)/tc - - all: tc $(TCSO) - --tc: $(TCOBJ) $(LIBNETLINK) libtc.a -- $(QUIET_LINK)$(CC) $^ $(LDFLAGS) $(LDLIBS) -o $@ -+tc: $(TCOBJ) $(subst libutil.a,libutil-elf.a,$(LIBNETLINK)) libtc.a -+ $(QUIET_LINK)$(CC) $^ $(LDFLAGS) $(LDLIBS) $(ELF_LDLIBS) -o $@ - - libtc.a: $(TCLIB) - $(QUIET_AR)$(AR) rcs $@ $^ diff --git a/package/network/utils/ipset/Makefile b/package/network/utils/ipset/Makefile index 37cff3aca4..69953c2e23 100644 --- a/package/network/utils/ipset/Makefile +++ b/package/network/utils/ipset/Makefile @@ -10,7 +10,7 @@ include $(INCLUDE_DIR)/kernel.mk PKG_NAME:=ipset PKG_VERSION:=7.1 -PKG_RELEASE:=2 +PKG_RELEASE:=3 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2 PKG_SOURCE_URL:=http://ipset.netfilter.org @@ -43,8 +43,11 @@ $(call Package/ipset/Default) endef CONFIGURE_ARGS += \ + --disable-static \ --with-kbuild="$(LINUX_DIR)" +TARGET_LDFLAGS += -Wl,--gc-sections,--as-needed + MAKE_FLAGS += \ ARCH="$(LINUX_KARCH)" \ SHELL="$(BASH)" @@ -52,7 +55,7 @@ MAKE_FLAGS += \ define Build/InstallDev $(INSTALL_DIR) $(1)/usr/include $(1)/usr/lib $(1)/usr/lib/pkgconfig $(CP) $(PKG_INSTALL_DIR)/usr/include/libipset $(1)/usr/include/ - $(CP) $(PKG_INSTALL_DIR)/usr/lib/libipset.{a,so*} $(1)/usr/lib/ + $(CP) $(PKG_INSTALL_DIR)/usr/lib/libipset.so* $(1)/usr/lib/ $(CP) $(PKG_BUILD_DIR)/lib/libipset.pc $(1)/usr/lib/pkgconfig/ endef diff --git a/package/network/utils/iptables/Makefile b/package/network/utils/iptables/Makefile index d60e25cdc7..dd761f3443 100644 --- a/package/network/utils/iptables/Makefile +++ b/package/network/utils/iptables/Makefile @@ -9,13 +9,12 @@ include $(TOPDIR)/rules.mk include $(INCLUDE_DIR)/kernel.mk PKG_NAME:=iptables -PKG_VERSION:=1.8.2 -PKG_RELEASE:=3 +PKG_VERSION:=1.8.3 +PKG_RELEASE:=1 -PKG_SOURCE_PROTO:=git -PKG_SOURCE_URL:=https://git.netfilter.org/iptables -PKG_SOURCE_VERSION:=bba6bc692b0e6137e13881a1f398c134822e9f83 -PKG_MIRROR_HASH:=23a61d2a23fc0d587029690ef2564625d78fba4b2d90117edaf5b9eaf55bb7f9 +PKG_SOURCE_URL:=https://netfilter.org/projects/iptables/files +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2 +PKG_HASH:=a23cac034181206b4545f4e7e730e76e08b5f3dd78771ba9645a6756de9cdd80 PKG_FIXUP:=autoreconf PKG_FLAGS:=nonshared @@ -37,7 +36,7 @@ define Package/iptables/Default SECTION:=net CATEGORY:=Network SUBMENU:=Firewall - URL:=http://netfilter.org/ + URL:=https://netfilter.org/ endef define Package/iptables/Module @@ -502,7 +501,7 @@ $(call Package/iptables/Default) SECTION:=libs CATEGORY:=Libraries TITLE:=IPv4 firewall - shared libiptc library - ABI_VERSION:=0 + ABI_VERSION:=2 DEPENDS:=+libxtables endef @@ -511,7 +510,7 @@ $(call Package/iptables/Default) SECTION:=libs CATEGORY:=Libraries TITLE:=IPv6 firewall - shared libiptc library - ABI_VERSION:=0 + ABI_VERSION:=2 DEPENDS:=+libxtables endef diff --git a/package/network/utils/iptables/patches/001-extensions_format-security_fixes_in_libip.patch b/package/network/utils/iptables/patches/001-extensions_format-security_fixes_in_libip.patch deleted file mode 100644 index 9bd85ec139..0000000000 --- a/package/network/utils/iptables/patches/001-extensions_format-security_fixes_in_libip.patch +++ /dev/null @@ -1,52 +0,0 @@ -From 907e429d7548157016cd51aba4adc5d0c7d9f816 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Adam=20Go=C5=82=C4=99biowski?= -Date: Wed, 14 Nov 2018 07:35:28 +0100 -Subject: extensions: format-security fixes in libip[6]t_icmp -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -commit 61d6c3834de3 ("xtables: add 'printf' attribute to xlate_add") -introduced support for gcc feature to check format string against passed -argument. This commit adds missing bits to extenstions's libipt_icmp.c -and libip6t_icmp6.c that were causing build to fail. - -Fixes: 61d6c3834de3 ("xtables: add 'printf' attribute to xlate_add") -Signed-off-by: Adam Gołębiowski -Signed-off-by: Pablo Neira Ayuso ---- - extensions/libip6t_icmp6.c | 4 ++-- - extensions/libipt_icmp.c | 2 +- - 2 files changed, 3 insertions(+), 3 deletions(-) - ---- a/extensions/libip6t_icmp6.c -+++ b/extensions/libip6t_icmp6.c -@@ -230,7 +230,7 @@ static unsigned int type_xlate_print(str - type_name = icmp6_type_xlate(icmptype); - - if (type_name) { -- xt_xlate_add(xl, type_name); -+ xt_xlate_add(xl, "%s", type_name); - } else { - for (i = 0; i < ARRAY_SIZE(icmpv6_codes); ++i) - if (icmpv6_codes[i].type == icmptype && -@@ -239,7 +239,7 @@ static unsigned int type_xlate_print(str - break; - - if (i != ARRAY_SIZE(icmpv6_codes)) -- xt_xlate_add(xl, icmpv6_codes[i].name); -+ xt_xlate_add(xl, "%s", icmpv6_codes[i].name); - else - return 0; - } ---- a/extensions/libipt_icmp.c -+++ b/extensions/libipt_icmp.c -@@ -236,7 +236,7 @@ static unsigned int type_xlate_print(str - if (icmp_codes[i].type == icmptype && - icmp_codes[i].code_min == code_min && - icmp_codes[i].code_max == code_max) { -- xt_xlate_add(xl, icmp_codes[i].name); -+ xt_xlate_add(xl, "%s", icmp_codes[i].name); - return 1; - } - } diff --git a/package/network/utils/iptables/patches/002-include_fix_build_with_kernel_headers_before_4_2.patch b/package/network/utils/iptables/patches/002-include_fix_build_with_kernel_headers_before_4_2.patch deleted file mode 100644 index 13737cf7cd..0000000000 --- a/package/network/utils/iptables/patches/002-include_fix_build_with_kernel_headers_before_4_2.patch +++ /dev/null @@ -1,48 +0,0 @@ -From 8d9d7e4b9ef4c6e6abab2cf35c747d7ca36824bd Mon Sep 17 00:00:00 2001 -From: Baruch Siach -Date: Fri, 16 Nov 2018 09:30:33 +0200 -Subject: include: fix build with kernel headers before 4.2 -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Commit 672accf1530 (include: update kernel netfilter header files) -updated linux/netfilter.h and brought with it the update from kernel -commit a263653ed798 (netfilter: don't pull include/linux/netfilter.h -from netns headers). This triggers conflict of headers that is fixed in -kernel commit 279c6c7fa64f (api: fix compatibility of linux/in.h with -netinet/in.h) included in kernel version 4.2. For earlier kernel headers -we need a workaround that prevents the headers conflict. - -Fixes the following build failure: - -In file included from .../sysroot/usr/include/netinet/ip.h:25:0, - from ../include/libiptc/ipt_kernel_headers.h:8, - from ../include/libiptc/libiptc.h:6, - from libip4tc.c:29: -.../sysroot/usr/include/linux/in.h:26:3: error: redeclaration of enumerator ‘IPPROTO_IP’ - IPPROTO_IP = 0, /* Dummy protocol for TCP */ - ^ -.../sysroot/usr/include/netinet/in.h:33:5: note: previous definition of ‘IPPROTO_IP’ was here - IPPROTO_IP = 0, /* Dummy protocol for TCP. */ - ^~~~~~~~~~ - -Signed-off-by: Baruch Siach -Signed-off-by: Florian Westphal ---- - include/linux/netfilter.h | 2 ++ - 1 file changed, 2 insertions(+) - ---- a/include/linux/netfilter.h -+++ b/include/linux/netfilter.h -@@ -3,8 +3,10 @@ - - #include - -+#ifndef _NETINET_IN_H - #include - #include -+#endif - #include - - /* Responses from hook functions. */ diff --git a/package/network/utils/iptables/patches/003-ebtables-vlan-fix_userspace_kernel_headers_collision.patch b/package/network/utils/iptables/patches/003-ebtables-vlan-fix_userspace_kernel_headers_collision.patch deleted file mode 100644 index 53e1113003..0000000000 --- a/package/network/utils/iptables/patches/003-ebtables-vlan-fix_userspace_kernel_headers_collision.patch +++ /dev/null @@ -1,41 +0,0 @@ -From 51d374ba41ae4f1bb851228c06b030b83dd2092f Mon Sep 17 00:00:00 2001 -From: Baruch Siach -Date: Tue, 13 Nov 2018 19:22:08 +0200 -Subject: ebtables: vlan: fix userspace/kernel headers collision -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Build with musl libc fails because of conflicting struct ethhdr -definitions: - -In file included from .../sysroot/usr/include/net/ethernet.h:10:0, - from ../iptables/nft-bridge.h:8, - from libebt_vlan.c:18: -.../sysroot/usr/include/netinet/if_ether.h:107:8: error: redefinition of ‘struct ethhdr’ - struct ethhdr { - ^~~~~~ -In file included from libebt_vlan.c:16:0: -.../sysroot/usr/include/linux/if_ether.h:160:8: note: originally defined here - struct ethhdr { - ^~~~~~ - -Include the userspace header first for the definition suppression logic -to do the right thing. - -Signed-off-by: Baruch Siach -Signed-off-by: Pablo Neira Ayuso ---- - extensions/libebt_vlan.c | 1 + - 1 file changed, 1 insertion(+) - ---- a/extensions/libebt_vlan.c -+++ b/extensions/libebt_vlan.c -@@ -12,6 +12,7 @@ - #include - #include - #include -+#include - #include - #include - #include "iptables/nft.h" diff --git a/package/network/utils/iptables/patches/101-remove-check-already.patch b/package/network/utils/iptables/patches/101-remove-check-already.patch index f8d1bf44b6..98e825f016 100644 --- a/package/network/utils/iptables/patches/101-remove-check-already.patch +++ b/package/network/utils/iptables/patches/101-remove-check-already.patch @@ -1,6 +1,6 @@ --- a/libxtables/xtables.c +++ b/libxtables/xtables.c -@@ -887,12 +887,6 @@ static void xtables_check_options(const +@@ -903,12 +903,6 @@ static void xtables_check_options(const void xtables_register_match(struct xtables_match *me) { @@ -13,7 +13,7 @@ if (me->version == NULL) { fprintf(stderr, "%s: match %s<%u> is missing a version\n", xt_params->program_name, me->name, me->revision); -@@ -1080,12 +1074,6 @@ void xtables_register_matches(struct xta +@@ -1096,12 +1090,6 @@ void xtables_register_matches(struct xta void xtables_register_target(struct xtables_target *me) { diff --git a/package/network/utils/iptables/patches/103-optional-xml.patch b/package/network/utils/iptables/patches/103-optional-xml.patch index 2396037fdd..342808a395 100644 --- a/package/network/utils/iptables/patches/103-optional-xml.patch +++ b/package/network/utils/iptables/patches/103-optional-xml.patch @@ -1,6 +1,6 @@ --- a/iptables/xtables-legacy-multi.c +++ b/iptables/xtables-legacy-multi.c -@@ -31,8 +31,10 @@ static const struct subcommand multi_sub +@@ -32,8 +32,10 @@ static const struct subcommand multi_sub #endif diff --git a/package/network/utils/iptables/patches/200-configurable_builtin.patch b/package/network/utils/iptables/patches/200-configurable_builtin.patch index 9c53c2bfed..5788a829b0 100644 --- a/package/network/utils/iptables/patches/200-configurable_builtin.patch +++ b/package/network/utils/iptables/patches/200-configurable_builtin.patch @@ -34,10 +34,10 @@ +pfa_objs := $(patsubst %,libarpt_%.o,${pfa_build_static}) +pf4_objs := $(patsubst %,libipt_%.o,${pf4_build_static}) +pf6_objs := $(patsubst %,libip6t_%.o,${pf6_build_static}) - pfx_solibs := $(patsubst %,libxt_%.so,${pfx_build_mod} ${pfx_symlinks}) + pfx_solibs := $(patsubst %,libxt_%.so,${pfx_build_mod}) pfb_solibs := $(patsubst %,libebt_%.so,${pfb_build_mod}) pfa_solibs := $(patsubst %,libarpt_%.so,${pfa_build_mod}) -@@ -67,13 +87,13 @@ pf6_solibs := $(patsubst %,libip6t_%. +@@ -68,14 +88,14 @@ pfx_symlink_files := $(patsubst %,libxt_ # targets := libext.a libext4.a libext6.a libext_ebt.a libext_arpt.a matches.man targets.man targets_install := @@ -46,19 +46,21 @@ -@ENABLE_STATIC_TRUE@ libext_arpt_objs := ${pfa_objs} -@ENABLE_STATIC_TRUE@ libext4_objs := ${pf4_objs} -@ENABLE_STATIC_TRUE@ libext6_objs := ${pf6_objs} --@ENABLE_STATIC_FALSE@ targets += ${pfx_solibs} ${pfb_solibs} ${pf4_solibs} ${pf6_solibs} ${pfa_solibs} +-@ENABLE_STATIC_FALSE@ targets += ${pfx_solibs} ${pfb_solibs} ${pf4_solibs} ${pf6_solibs} ${pfa_solibs} ${pfx_symlink_files} -@ENABLE_STATIC_FALSE@ targets_install += ${pfx_solibs} ${pfb_solibs} ${pf4_solibs} ${pf6_solibs} ${pfa_solibs} +-@ENABLE_STATIC_FALSE@ symlinks_install := ${pfx_symlink_files} +libext_objs := ${pfx_objs} +libext_ebt_objs := ${pfb_objs} +libext_arpt_objs := ${pfa_objs} +libext4_objs := ${pf4_objs} +libext6_objs := ${pf6_objs} -+targets += ${pfx_solibs} ${pfb_solibs} ${pf4_solibs} ${pf6_solibs} ${pfa_solibs} ++targets += ${pfx_solibs} ${pfb_solibs} ${pf4_solibs} ${pf6_solibs} ${pfa_solibs} ${pfx_symlink_files} +targets_install := $(strip ${pfx_solibs} ${pfb_solibs} ${pf4_solibs} ${pf6_solibs} ${pfa_solibs}) ++symlinks_install := ${pfx_symlink_files} .SECONDARY: -@@ -141,11 +161,11 @@ libext4.a: initext4.o ${libext4_objs} +@@ -148,11 +168,11 @@ libext4.a: initext4.o ${libext4_objs} libext6.a: initext6.o ${libext6_objs} ${AM_VERBOSE_AR} ${AR} crs $@ $^; diff --git a/package/network/utils/iptables/patches/600-shared-libext.patch b/package/network/utils/iptables/patches/600-shared-libext.patch index e88c288be6..f5c9c9d779 100644 --- a/package/network/utils/iptables/patches/600-shared-libext.patch +++ b/package/network/utils/iptables/patches/600-shared-libext.patch @@ -1,6 +1,6 @@ --- a/extensions/GNUmakefile.in +++ b/extensions/GNUmakefile.in -@@ -85,7 +85,7 @@ pf6_solibs := $(patsubst %,libip6t_%. +@@ -86,7 +86,7 @@ pfx_symlink_files := $(patsubst %,libxt_ # # Building blocks # @@ -9,7 +9,7 @@ targets_install := libext_objs := ${pfx_objs} libext_ebt_objs := ${pfb_objs} -@@ -112,7 +112,7 @@ clean: +@@ -119,7 +119,7 @@ clean: distclean: clean init%.o: init%.c @@ -18,7 +18,7 @@ -include .*.d -@@ -144,22 +144,22 @@ xt_connlabel_LIBADD = @libnetfilter_conn +@@ -151,22 +151,22 @@ xt_connlabel_LIBADD = @libnetfilter_conn # handling code in the Makefiles. # lib%.o: ${srcdir}/lib%.c @@ -54,7 +54,7 @@ initextb_func := $(addprefix ebt_,${pfb_build_static}) --- a/iptables/Makefile.am +++ b/iptables/Makefile.am -@@ -8,7 +8,8 @@ BUILT_SOURCES = +@@ -8,19 +8,22 @@ BUILT_SOURCES = xtables_legacy_multi_SOURCES = xtables-legacy-multi.c iptables-xml.c xtables_legacy_multi_CFLAGS = ${AM_CFLAGS} @@ -64,25 +64,23 @@ if ENABLE_STATIC xtables_legacy_multi_CFLAGS += -DALL_INCLUSIVE endif -@@ -16,13 +17,15 @@ if ENABLE_IPV4 - xtables_legacy_multi_SOURCES += iptables-save.c iptables-restore.c \ - iptables-standalone.c iptables.c + if ENABLE_IPV4 + xtables_legacy_multi_SOURCES += iptables-standalone.c iptables.c xtables_legacy_multi_CFLAGS += -DENABLE_IPV4 -xtables_legacy_multi_LDADD += ../libiptc/libip4tc.la ../extensions/libext4.a +xtables_legacy_multi_LDADD += ../libiptc/libip4tc.la +xtables_legacy_multi_LDFLAGS += -liptext4 endif if ENABLE_IPV6 - xtables_legacy_multi_SOURCES += ip6tables-save.c ip6tables-restore.c \ - ip6tables-standalone.c ip6tables.c + xtables_legacy_multi_SOURCES += ip6tables-standalone.c ip6tables.c xtables_legacy_multi_CFLAGS += -DENABLE_IPV6 -xtables_legacy_multi_LDADD += ../libiptc/libip6tc.la ../extensions/libext6.a +xtables_legacy_multi_LDADD += ../libiptc/libip6tc.la +xtables_legacy_multi_LDFLAGS += -liptext6 endif - xtables_legacy_multi_SOURCES += xshared.c + xtables_legacy_multi_SOURCES += xshared.c iptables-restore.c iptables-save.c xtables_legacy_multi_LDADD += ../libxtables/libxtables.la -lm -@@ -32,7 +35,8 @@ if ENABLE_NFTABLES +@@ -30,7 +33,8 @@ if ENABLE_NFTABLES BUILT_SOURCES += xtables-config-parser.h xtables_nft_multi_SOURCES = xtables-nft-multi.c iptables-xml.c xtables_nft_multi_CFLAGS = ${AM_CFLAGS} @@ -92,7 +90,7 @@ if ENABLE_STATIC xtables_nft_multi_CFLAGS += -DALL_INCLUSIVE endif -@@ -47,7 +51,8 @@ xtables_nft_multi_SOURCES += xtables-sav +@@ -45,7 +49,8 @@ xtables_nft_multi_SOURCES += xtables-sav xtables-eb-standalone.c xtables-eb.c \ xtables-eb-translate.c \ xtables-translate.c diff --git a/package/network/utils/iw/patches/001-nl80211_h_sync.patch b/package/network/utils/iw/patches/001-nl80211_h_sync.patch index e1d318f529..5f15684d30 100644 --- a/package/network/utils/iw/patches/001-nl80211_h_sync.patch +++ b/package/network/utils/iw/patches/001-nl80211_h_sync.patch @@ -1,21 +1,45 @@ --- a/nl80211.h +++ b/nl80211.h -@@ -2299,6 +2299,9 @@ enum nl80211_commands { +@@ -2299,6 +2299,12 @@ enum nl80211_commands { * This is also used for capability advertisement in the wiphy information, * with the appropriate sub-attributes. * ++ * @NL80211_ATTR_AIRTIME_WEIGHT: Station's weight when scheduled by the airtime ++ * scheduler. ++ * + * @NL80211_ATTR_WIPHY_ANTENNA_GAIN: Configured antenna gain. Used to reduce + * transmit power to stay within regulatory limits. u32, dBi. + * * @NUM_NL80211_ATTR: total number of nl80211_attrs available * @NL80211_ATTR_MAX: highest attribute number currently defined * @__NL80211_ATTR_AFTER_LAST: internal use -@@ -2748,6 +2751,8 @@ enum nl80211_attrs { +@@ -2748,6 +2754,10 @@ enum nl80211_attrs { NL80211_ATTR_PEER_MEASUREMENTS, ++ NL80211_ATTR_AIRTIME_WEIGHT, ++ + NL80211_ATTR_WIPHY_ANTENNA_GAIN, + /* add attributes here, update the policy in nl80211.c */ __NL80211_ATTR_AFTER_LAST, +@@ -3125,6 +3135,9 @@ enum nl80211_sta_bss_param { + * might not be fully accurate. + * @NL80211_STA_INFO_CONNECTED_TO_GATE: set to true if STA has a path to a + * mesh gate (u8, 0 or 1) ++ * @NL80211_STA_INFO_TX_DURATION: aggregate PPDU duration for all frames ++ * sent to the station (u64, usec) ++ * @NL80211_STA_INFO_AIRTIME_WEIGHT: current airtime weight for station (u16) + * @__NL80211_STA_INFO_AFTER_LAST: internal + * @NL80211_STA_INFO_MAX: highest possible station info attribute + */ +@@ -3168,6 +3181,8 @@ enum nl80211_sta_info { + NL80211_STA_INFO_RX_MPDUS, + NL80211_STA_INFO_FCS_ERROR_COUNT, + NL80211_STA_INFO_CONNECTED_TO_GATE, ++ NL80211_STA_INFO_TX_DURATION, ++ NL80211_STA_INFO_AIRTIME_WEIGHT, + + /* keep last */ + __NL80211_STA_INFO_AFTER_LAST, diff --git a/package/network/utils/iwinfo/Makefile b/package/network/utils/iwinfo/Makefile index 73810105cb..5eccb037f3 100644 --- a/package/network/utils/iwinfo/Makefile +++ b/package/network/utils/iwinfo/Makefile @@ -11,9 +11,9 @@ PKG_RELEASE:=1 PKG_SOURCE_PROTO:=git PKG_SOURCE_URL=$(PROJECT_GIT)/iwinfo.git -PKG_SOURCE_DATE:=2019-03-01 -PKG_SOURCE_VERSION:=cb108c546893535dadeda759b1cd4b91b266c936 -PKG_MIRROR_HASH:=fd89f1b992d36f6b76cf671c2c40e671d70620c0ee101e76d6d885580371827c +PKG_SOURCE_DATE:=2019-08-28 +PKG_SOURCE_VERSION:=a9f95570341baf2773a71585eef760ad5c257e65 +PKG_MIRROR_HASH:=df86c083c2449cc2e3274922fc04b2563f05ceaea49f24e74ce8cd8bc48c269c PKG_MAINTAINER:=Jo-Philipp Wich PKG_LICENSE:=GPL-2.0 diff --git a/package/network/utils/layerscape/restool/Makefile b/package/network/utils/layerscape/restool/Makefile index d87649ebe4..4dc0967651 100644 --- a/package/network/utils/layerscape/restool/Makefile +++ b/package/network/utils/layerscape/restool/Makefile @@ -8,13 +8,13 @@ include $(TOPDIR)/rules.mk PKG_NAME:=restool -PKG_VERSION:=lsdk-1806 +PKG_VERSION:=lsdk-1903 PKG_RELEASE:=1 PKG_SOURCE_PROTO:=git PKG_SOURCE_URL:=https://source.codeaurora.org/external/qoriq/qoriq-components/restool -PKG_SOURCE_VERSION:=2815572ab25029a8fb47f0dc6a0b56ae5ff76713 -PKG_MIRROR_HASH:=cf76a8fd1239bb9b7696c25d5c26c6e81ea73497ad1ada9488390daf0ef7c291 +PKG_SOURCE_VERSION:=8b1dd407bbd48b4f1a50c71b78083112a6397619 +PKG_MIRROR_HASH:=2bb086dd4fc4975268b89867e7fc95b42a764b56c4a498518ef0d54694ffe40e include $(INCLUDE_DIR)/package.mk diff --git a/package/network/utils/linux-atm/patches/510-remove-LINUX_NETDEVICE-hack.patch b/package/network/utils/linux-atm/patches/510-remove-LINUX_NETDEVICE-hack.patch new file mode 100644 index 0000000000..d76ec1eaf4 --- /dev/null +++ b/package/network/utils/linux-atm/patches/510-remove-LINUX_NETDEVICE-hack.patch @@ -0,0 +1,52 @@ +This fixes the following compile problem with kernel 4.20: + +In file included from arp.c:20:0: +include/linux/if_arp.h:121:16: error: 'IFNAMSIZ' undeclared here (not in a function) + char arp_dev[IFNAMSIZ]; + ^~~~~~~~ +make[7]: *** [Makefile:459: arp.o] Error 1 + +This is caused by commit 6a12709da354 ("net: if_arp: use define instead +of hard-coded value") in the upstream Linux kernel which is integrated +in Linux 4.20. + +--- a/src/oamd/io.c ++++ b/src/oamd/io.c +@@ -20,7 +20,6 @@ + #include + #include + #include +-#define _LINUX_NETDEVICE_H /* glibc2 */ + #include + #include + +--- a/src/arpd/itf.c ++++ b/src/arpd/itf.c +@@ -12,7 +12,6 @@ + #include + #include + #include +-#define _LINUX_NETDEVICE_H /* glibc2 */ + #include + #include + +--- a/src/arpd/io.c ++++ b/src/arpd/io.c +@@ -21,7 +21,6 @@ + #include + #include /* for CLIP_DEFAULT_IDLETIMER */ + #include +-#define _LINUX_NETDEVICE_H /* glibc2 */ + #include + #include + +--- a/src/arpd/arp.c ++++ b/src/arpd/arp.c +@@ -15,7 +15,6 @@ + #include + #include /* for linux/if_arp.h */ + #include /* for ntohs, etc. */ +-#define _LINUX_NETDEVICE_H /* very crude hack for glibc2 */ + #include + #include + #include diff --git a/package/network/utils/nftables/Makefile b/package/network/utils/nftables/Makefile index d1e995116d..d4f91a2c89 100644 --- a/package/network/utils/nftables/Makefile +++ b/package/network/utils/nftables/Makefile @@ -8,7 +8,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=nftables PKG_VERSION:=0.9.0 -PKG_RELEASE:=1 +PKG_RELEASE:=2 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2 PKG_SOURCE_URL:=https://netfilter.org/projects/$(PKG_NAME)/files diff --git a/package/network/utils/nftables/patches/010-uclibc-ng.patch b/package/network/utils/nftables/patches/010-uclibc-ng.patch new file mode 100644 index 0000000000..760fde5186 --- /dev/null +++ b/package/network/utils/nftables/patches/010-uclibc-ng.patch @@ -0,0 +1,28 @@ +From c65c4f9998587a0c705b3635215f25fa5680c0d3 Mon Sep 17 00:00:00 2001 +From: Rosen Penev +Date: Fri, 3 May 2019 11:49:11 -0700 +Subject: gmputil: Add missing header for va_list + +Otherwise it errors with unknown type name when using uClibc. + +Signed-off-by: Rosen Penev +Signed-off-by: Pablo Neira Ayuso +--- + include/gmputil.h | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/include/gmputil.h b/include/gmputil.h +index 73959c17..ad63d67b 100644 +--- a/include/gmputil.h ++++ b/include/gmputil.h +@@ -7,6 +7,7 @@ + #include + #else + #include ++#include + #include + /* mini-gmp doesn't come with gmp_vfprintf, so we use our own minimal variant */ + extern int mpz_vfprintf(FILE *fp, const char *format, va_list args); +-- +cgit v1.2.1 + diff --git a/package/network/utils/umbim/Makefile b/package/network/utils/umbim/Makefile index 511453c8aa..d1a7cc9418 100644 --- a/package/network/utils/umbim/Makefile +++ b/package/network/utils/umbim/Makefile @@ -5,9 +5,9 @@ PKG_RELEASE:=1 PKG_SOURCE_PROTO:=git PKG_SOURCE_URL=$(PROJECT_GIT)/umbim.git -PKG_SOURCE_DATE:=2015-07-04 -PKG_SOURCE_VERSION:=29aaf43b097ee57f7aa1bb24341db6cc4148cbf3 -PKG_MIRROR_HASH:=56e612d9da1ac26de96c4929fbabd047862d725a13ceb904807a9d3d7db43a30 +PKG_SOURCE_DATE:=2019-03-11 +PKG_SOURCE_VERSION:=24f9dc71a624cecd67c181cec77b4101038a39d9 +PKG_MIRROR_HASH:=452bd6f1019ce53fd02119b12a8d6b13e946b73de02642e20e9fd85c482c452d PKG_MAINTAINER:=John Crispin PKG_LICENSE:=GPL-2.0 diff --git a/package/network/utils/uqmi/Makefile b/package/network/utils/uqmi/Makefile index 99df0abd48..2ad75b51f6 100644 --- a/package/network/utils/uqmi/Makefile +++ b/package/network/utils/uqmi/Makefile @@ -1,13 +1,13 @@ include $(TOPDIR)/rules.mk PKG_NAME:=uqmi -PKG_RELEASE:=6 +PKG_RELEASE:=7 PKG_SOURCE_PROTO:=git PKG_SOURCE_URL=$(PROJECT_GIT)/uqmi.git -PKG_SOURCE_DATE:=2016-12-19 -PKG_SOURCE_VERSION:=8ceeab690d8c6f1e3afbd4bcaee7bc2ba3fbe165 -PKG_MIRROR_HASH:=b3637ff04e51769137af1c5e173e73311e11c3c2dcc49eeaca6aa3520f61d247 +PKG_SOURCE_DATE:=2019-06-27 +PKG_SOURCE_VERSION:=1965c713937495a5cb029165c16acdb6572c3f87 +PKG_MIRROR_HASH:=3c39b1c1f20b7d523b0891d08b3d10233331ada8e11d0b55cfd4882816308951 PKG_MAINTAINER:=Matti Laakso PKG_LICENSE:=GPL-2.0 diff --git a/package/network/utils/uqmi/files/lib/netifd/proto/qmi.sh b/package/network/utils/uqmi/files/lib/netifd/proto/qmi.sh index 1da98db5ac..f4b30b87eb 100755 --- a/package/network/utils/uqmi/files/lib/netifd/proto/qmi.sh +++ b/package/network/utils/uqmi/files/lib/netifd/proto/qmi.sh @@ -298,6 +298,9 @@ proto_qmi_setup() { } proto_close_data proto_send_update "$interface" + + local zone="$(fw3 -q network "$interface" 2>/dev/null)" + [ -n "$pdh_6" ] && { if [ -z "$dhcpv6" -o "$dhcpv6" = 0 ]; then json_load "$(uqmi -s -d $device --set-client-id wds,$cid_6 --get-current-settings)" @@ -318,6 +321,11 @@ proto_qmi_setup() { proto_add_dns_server "$dns1_6" proto_add_dns_server "$dns2_6" } + [ -n "$zone" ] && { + proto_add_data + json_add_string zone "$zone" + proto_close_data + } proto_send_update "$interface" else json_init @@ -328,6 +336,7 @@ proto_qmi_setup() { proto_add_dynamic_defaults # RFC 7278: Extend an IPv6 /64 Prefix to LAN json_add_string extendprefix 1 + [ -n "$zone" ] && json_add_string zone "$zone" json_close_object ubus call network add_dynamic "$(json_dump)" fi @@ -340,6 +349,7 @@ proto_qmi_setup() { json_add_string proto "dhcp" [ -n "$ip4table" ] && json_add_string ip4table "$ip4table" proto_add_dynamic_defaults + [ -n "$zone" ] && json_add_string zone "$zone" json_close_object ubus call network add_dynamic "$(json_dump)" } diff --git a/package/network/utils/wpan-tools/Makefile b/package/network/utils/wpan-tools/Makefile index e57223dee4..060aaf5046 100644 --- a/package/network/utils/wpan-tools/Makefile +++ b/package/network/utils/wpan-tools/Makefile @@ -24,10 +24,6 @@ define Package/wpan-tools DEPENDS:= +libnl endef -define Build/Configure - $(call Build/Configure/Default) -endef - define Package/wpan-tools/install $(INSTALL_DIR) $(1)/usr/sbin $(INSTALL_BIN) $(PKG_BUILD_DIR)/src/iwpan $(1)/usr/sbin/ diff --git a/package/system/ca-certificates/Makefile b/package/system/ca-certificates/Makefile index e1c6d41ba1..f449645c77 100644 --- a/package/system/ca-certificates/Makefile +++ b/package/system/ca-certificates/Makefile @@ -7,14 +7,13 @@ include $(TOPDIR)/rules.mk PKG_NAME:=ca-certificates -PKG_VERSION:=20180409 -PKG_RELEASE:=3 +PKG_VERSION:=20190110 +PKG_RELEASE:=1 PKG_MAINTAINER:= PKG_SOURCE:=$(PKG_NAME)_$(PKG_VERSION).tar.xz PKG_SOURCE_URL:=http://ftp.debian.org/debian/pool/main/c/ca-certificates -PKG_HASH:=7af6f5bfc619fd29cbf0258c1d95107c38ce840ad6274e343e1e0d971fc72b51 -PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME) +PKG_HASH:=ee4bf0f4c6398005f5b5ca4e0b87b82837ac5c3b0280a1cb3a63c47555c3a675 PKG_INSTALL:=1 diff --git a/package/system/fstools/Makefile b/package/system/fstools/Makefile index c82b3ddb1a..e8225cc771 100644 --- a/package/system/fstools/Makefile +++ b/package/system/fstools/Makefile @@ -8,13 +8,13 @@ include $(TOPDIR)/rules.mk PKG_NAME:=fstools -PKG_RELEASE:=4 +PKG_RELEASE:=1 PKG_SOURCE_PROTO:=git PKG_SOURCE_URL=$(PROJECT_GIT)/fstools.git -PKG_SOURCE_DATE:=2018-12-28 -PKG_SOURCE_VERSION:=af93f4b8dc32cf1320dfe8f4b93bb3a12606fc33 -PKG_MIRROR_HASH:=a2d8c2500fe75014ef16c039d8cdb276c1d5c066f8bce6550a3ecf46a9a411a9 +PKG_SOURCE_DATE:=2019-08-28 +PKG_SOURCE_VERSION:=6a61b9ac105b8eb28680e728a2723e302a91304d +PKG_MIRROR_HASH:=f617d06ccea732fcbfdc2a2bd70c59726d37f61de100fae895d718884a9624d1 CMAKE_INSTALL:=1 PKG_LICENSE:=GPL-2.0 @@ -79,14 +79,14 @@ define Package/block-mount SECTION:=base CATEGORY:=Base system TITLE:=Block device mounting and checking - DEPENDS:=+ubox +libubox +libuci + DEPENDS:=+ubox +libubox +libuci +libblobmsg-json +libjson-c endef define Package/blockd SECTION:=base CATEGORY:=Base system TITLE:=Block device automounting - DEPENDS:=+block-mount +fstools +libubus +kmod-fs-autofs4 + DEPENDS:=+block-mount +fstools +libubus +kmod-fs-autofs4 +libblobmsg-json +libjson-c endef define Package/fstools/install diff --git a/package/system/fstools/files/fstab.init b/package/system/fstools/files/fstab.init index 5faa8ecbb9..08d5601bee 100644 --- a/package/system/fstools/files/fstab.init +++ b/package/system/fstools/files/fstab.init @@ -8,7 +8,11 @@ boot() { } start() { - echo "this file has been obsoleted. please call \"/sbin/block mount\" directly" + return 0 +} + +restart() { + return 0 } stop() { diff --git a/package/system/librecmc-keyring/Makefile b/package/system/librecmc-keyring/Makefile deleted file mode 100644 index f8ffaaa71b..0000000000 --- a/package/system/librecmc-keyring/Makefile +++ /dev/null @@ -1,38 +0,0 @@ -# Copyright (C) 2016 LEDE project -# Copyright (C) 2017 libreCMC Project - -include $(TOPDIR)/rules.mk - -PKG_NAME:=librecmc-keyring -PKG_RELEASE:=1 - -PKG_SOURCE_PROTO:=git -PKG_SOURCE_URL=https://gogs.librecmc.org/libreCMC/keyring.git -PKG_SOURCE_DATE:=2017-07-05 -PKG_SOURCE_VERSION:=f701477b2bf1f733fe3a450de302dd2c21fab3d0 -PKG_MIRROR_HASH:=a4ed0d3e5850a285f2a35849e3f076bacd38b8ce9019bd8592810a534b020e4e - -PKG_MAINTAINER:=Robert Call -PKG_LICENSE:=GPL-2.0 - -include $(INCLUDE_DIR)/package.mk - -define Package/librecmc-keyring - SECTION:=base - CATEGORY:=Base system - TITLE:=libreCMC Developer Keyring - URL:=https://librecmc.org -endef - -define Package/librecmc-keyring/description - The libreCMC developer keyring containing developer usign and gpg public keys. -endef - -Build/Compile= - -define Package/librecmc-keyring/install - $(INSTALL_DIR) $(1)/etc/opkg/keys/ - $(INSTALL_DATA) $(PKG_BUILD_DIR)/usign/* $(1)/etc/opkg/keys/ -endef - -$(eval $(call BuildPackage,librecmc-keyring)) diff --git a/package/system/mtd/src/Makefile b/package/system/mtd/src/Makefile index 08a9fb295d..e08a824cf8 100644 --- a/package/system/mtd/src/Makefile +++ b/package/system/mtd/src/Makefile @@ -8,6 +8,7 @@ obj.wrg = wrg.o md5.o obj.wrgg = wrgg.o md5.o obj.tpl = tpl_ramips_recoveryflag.o obj.ar71xx = trx.o $(obj.seama) $(obj.wrgg) +obj.gemini = $(obj.wrgg) obj.brcm = trx.o obj.brcm47xx = $(obj.brcm) obj.bcm53xx = $(obj.brcm) $(obj.seama) @@ -16,7 +17,7 @@ obj.ramips = $(obj.seama) $(obj.tpl) $(obj.wrg) obj.mvebu = linksys_bootcount.o obj.kirkwood = linksys_bootcount.o obj.ipq806x = linksys_bootcount.o -obj.ipq40xx = linksys_bootcount_fix.o +obj.ipq40xx = linksys_bootcount.o ifdef FIS_SUPPORT obj += fis.o diff --git a/package/system/mtd/src/linksys_bootcount.c b/package/system/mtd/src/linksys_bootcount.c index 500ede4972..bd06728696 100644 --- a/package/system/mtd/src/linksys_bootcount.c +++ b/package/system/mtd/src/linksys_bootcount.c @@ -2,6 +2,7 @@ * Linksys boot counter reset code for mtd * * Copyright (C) 2013 Jonas Gorski + * Portions Copyright (c) 2019, Jeff Kletsky * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License v2 @@ -29,6 +30,7 @@ #include #include #include +#include #include #include @@ -37,6 +39,30 @@ #define BOOTCOUNT_MAGIC 0x20110811 +/* + * EA6350v3, and potentially other NOR-boot devices, + * use an offset increment of 16 between records, + * not mtd_info_user.writesize (often 1 on NOR devices). + */ + +#define BC_OFFSET_INCREMENT_MIN 16 + + + +#define DLOG_OPEN() + +#define DLOG_ERR(...) do { \ + fprintf(stderr, "ERROR: " __VA_ARGS__); fprintf(stderr, "\n"); \ + } while (0) + +#define DLOG_NOTICE(...) do { \ + fprintf(stderr, __VA_ARGS__); fprintf(stderr, "\n"); \ + } while (0) + +#define DLOG_DEBUG(...) + + + struct bootcounter { uint32_t magic; uint32_t count; @@ -50,25 +76,50 @@ int mtd_resetbc(const char *mtd) struct mtd_info_user mtd_info; struct bootcounter *curr = (struct bootcounter *)page; unsigned int i; + unsigned int bc_offset_increment; int last_count = 0; int num_bc; int fd; int ret; + int retval = 0; + + DLOG_OPEN(); fd = mtd_check_open(mtd); if (ioctl(fd, MEMGETINFO, &mtd_info) < 0) { - fprintf(stderr, "failed to get mtd info!\n"); - return -1; + DLOG_ERR("Unable to obtain mtd_info for given partition name."); + + retval = -1; + goto out; + } + + + /* Detect need to override increment (for EA6350v3) */ + + if (mtd_info.writesize < BC_OFFSET_INCREMENT_MIN) { + + bc_offset_increment = BC_OFFSET_INCREMENT_MIN; + DLOG_DEBUG("Offset increment set to %i for writesize of %i", + bc_offset_increment, mtd_info.writesize); + } else { + + bc_offset_increment = mtd_info.writesize; } - num_bc = mtd_info.size / mtd_info.writesize; + num_bc = mtd_info.size / bc_offset_increment; for (i = 0; i < num_bc; i++) { - pread(fd, curr, sizeof(*curr), i * mtd_info.writesize); + pread(fd, curr, sizeof(*curr), i * bc_offset_increment); + + /* Existing code assumes erase is to 0xff; left as-is (2019) */ - if (curr->magic != BOOTCOUNT_MAGIC && curr->magic != 0xffffffff) { - fprintf(stderr, "unexpected magic %08x, bailing out\n", curr->magic); + if (curr->magic != BOOTCOUNT_MAGIC && + curr->magic != 0xffffffff) { + DLOG_ERR("Unexpected magic %08x at offset %08x; aborting.", + curr->magic, i * bc_offset_increment); + + retval = -2; goto out; } @@ -78,38 +129,59 @@ int mtd_resetbc(const char *mtd) last_count = curr->count; } - /* no need to do writes when last boot count is already 0 */ - if (last_count == 0) + + if (last_count == 0) { /* bootcount is already 0 */ + + retval = 0; goto out; + } if (i == num_bc) { + DLOG_NOTICE("Boot-count log full with %i entries; erasing (expected occasionally).", + i); + struct erase_info_user erase_info; erase_info.start = 0; erase_info.length = mtd_info.size; - /* erase block */ ret = ioctl(fd, MEMERASE, &erase_info); if (ret < 0) { - fprintf(stderr, "failed to erase block: %i\n", ret); - return -1; + DLOG_ERR("Failed to erase boot-count log MTD; ioctl() MEMERASE returned %i", + ret); + + retval = -3; + goto out; } i = 0; } - memset(curr, 0xff, mtd_info.writesize); + memset(curr, 0xff, bc_offset_increment); curr->magic = BOOTCOUNT_MAGIC; curr->count = 0; curr->checksum = BOOTCOUNT_MAGIC; - ret = pwrite(fd, curr, mtd_info.writesize, i * mtd_info.writesize); - if (ret < 0) - fprintf(stderr, "failed to write: %i\n", ret); - sync(); + /* Assumes bc_offset_increment is a multiple of mtd_info.writesize */ + + ret = pwrite(fd, curr, bc_offset_increment, i * bc_offset_increment); + if (ret < 0) { + DLOG_ERR("Failed to write boot-count log entry; pwrite() returned %i", + errno); + retval = -4; + goto out; + + } else { + sync(); + + DLOG_NOTICE("Boot count sucessfully reset to zero."); + + retval = 0; + goto out; + } + out: close(fd); - - return 0; + return retval; } diff --git a/package/system/mtd/src/linksys_bootcount_fix.c b/package/system/mtd/src/linksys_bootcount_fix.c deleted file mode 100644 index 3fc38012fb..0000000000 --- a/package/system/mtd/src/linksys_bootcount_fix.c +++ /dev/null @@ -1,115 +0,0 @@ -/* - * Linksys boot counter reset code for mtd - * - * Copyright (C) 2013 Jonas Gorski - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License v2 - * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include - -#include "mtd.h" - -#define BOOTCOUNT_MAGIC 0x20110811 - -struct bootcounter { - uint32_t magic; - uint32_t count; - uint32_t checksum; -}; - -static char page[2048]; - -int mtd_resetbc(const char *mtd) -{ - struct mtd_info_user mtd_info; - struct bootcounter *curr = (struct bootcounter *)page; - unsigned int i; - int last_count = 0; - int num_bc; - int fd; - int ret; - - fd = mtd_check_open(mtd); - - if (ioctl(fd, MEMGETINFO, &mtd_info) < 0) { - fprintf(stderr, "failed to get mtd info!\n"); - return -1; - } - - num_bc = mtd_info.size / 16; - - for (i = 0; i < num_bc; i++) { - pread(fd, curr, sizeof(*curr), i * 16); - - if (curr->magic != (BOOTCOUNT_MAGIC) && curr->magic != 0xffffffff) { - fprintf(stderr, "unexpected magic %08x, bailing out\n", curr->magic); - goto out; - } - - if (curr->magic == 0xffffffff) - break; - - last_count = curr->count; - } - - /* no need to do writes when last boot count is already 0 */ - if (last_count == 0) - goto out; - - - if (i == num_bc) { - struct erase_info_user erase_info; - erase_info.start = 0; - erase_info.length = mtd_info.size; - - /* erase block */ - ret = ioctl(fd, MEMERASE, &erase_info); - if (ret < 0) { - fprintf(stderr, "failed to erase block: %i\n", ret); - return -1; - } - - i = 0; - } - - memset(curr, 0xff, 16); - - curr->magic = BOOTCOUNT_MAGIC; - curr->count = 0; - curr->checksum = BOOTCOUNT_MAGIC; - - ret = pwrite(fd, curr, 16, i * 16); - if (ret < 0) - fprintf(stderr, "failed to write: %i\n", ret); - sync(); -out: - close(fd); - - return 0; -} diff --git a/package/system/mtd/src/wrgg.c b/package/system/mtd/src/wrgg.c index e0b5ca172d..c62f9f5507 100644 --- a/package/system/mtd/src/wrgg.c +++ b/package/system/mtd/src/wrgg.c @@ -39,13 +39,10 @@ #include "wrgg.h" #include "md5.h" -#if __BYTE_ORDER == __BIG_ENDIAN -#define STORE32_LE(X) ((((X) & 0x000000FF) << 24) | (((X) & 0x0000FF00) << 8) | (((X) & 0x00FF0000) >> 8) | (((X) & 0xFF000000) >> 24)) -#elif __BYTE_ORDER == __LITTLE_ENDIAN -#define STORE32_LE(X) (X) -#else -#error unknown endianness! -#endif +static inline uint32_t le32_to_cpu(uint8_t *buf) +{ + return buf[0] | buf[1] << 8 | buf[2] << 16 | buf[3] << 24; +} ssize_t pread(int fd, void *buf, size_t count, off_t offset); ssize_t pwrite(int fd, const void *buf, size_t count, off_t offset); @@ -94,7 +91,7 @@ wrgg_fix_md5(struct wrgg03_header *shdr, int fd, size_t data_offset, size_t data } /* update the size in the image */ - shdr->size = htonl(data_size); + shdr->size = data_size; /* update the checksum in the image */ memcpy(shdr->digest, digest, sizeof(digest)); @@ -147,12 +144,14 @@ mtd_fixwrgg(const char *mtd, size_t offset, size_t data_size) } shdr = (struct wrgg03_header *)(first_block + offset); - if (shdr->magic1 != htonl(STORE32_LE(WRGG03_MAGIC))) { - fprintf(stderr, "magic1 %x\n", shdr->magic1); - fprintf(stderr, "htonl(WRGG03_MAGIC) %x\n", WRGG03_MAGIC); + + /* The magic is always stored in little-endian byte order */ + if (le32_to_cpu((uint8_t *)&shdr->magic1) != WRGG03_MAGIC) { + fprintf(stderr, "magic1 = %x\n", shdr->magic1); + fprintf(stderr, "WRGG03_MAGIC = %x\n", WRGG03_MAGIC); fprintf(stderr, "No WRGG header found\n"); exit(1); - } else if (!ntohl(shdr->size)) { + } else if (!shdr->size) { fprintf(stderr, "WRGG entity with empty image\n"); exit(1); } @@ -160,8 +159,8 @@ mtd_fixwrgg(const char *mtd, size_t offset, size_t data_size) data_offset = offset + sizeof(struct wrgg03_header); if (!data_size) data_size = mtdsize - data_offset; - if (data_size > ntohl(shdr->size)) - data_size = ntohl(shdr->size); + if (data_size > shdr->size) + data_size = shdr->size; if (wrgg_fix_md5(shdr, fd, data_offset, data_size)) goto out; diff --git a/package/system/openwrt-keyring/Makefile b/package/system/openwrt-keyring/Makefile index bbeaad1594..f449fc3e51 100644 --- a/package/system/openwrt-keyring/Makefile +++ b/package/system/openwrt-keyring/Makefile @@ -7,9 +7,9 @@ PKG_RELEASE:=1 PKG_SOURCE_PROTO:=git PKG_SOURCE_URL=$(PROJECT_GIT)/keyring.git -PKG_SOURCE_DATE:=2018-05-18 -PKG_SOURCE_VERSION:=103a32e9f52fd35a428dc08ddbca86fe41dfb918 -PKG_MIRROR_HASH:=58f42796396fee0e4f008d6f5a970a421d023d6c98e71bf53c2778734fa3480b +PKG_SOURCE_DATE:=2019-07-25 +PKG_SOURCE_VERSION:=8080ef341b4180e40c4ae8ab63511ac6496f0ad1 +PKG_MIRROR_HASH:=000882364b953691bf02f7ac41462badb68f452f0317cdfd51cfd617c9b1e364 PKG_MAINTAINER:=John Crispin PKG_LICENSE:=GPL-2.0 diff --git a/package/system/opkg/Makefile b/package/system/opkg/Makefile index 313a058933..ed3cd5ebf4 100644 --- a/package/system/opkg/Makefile +++ b/package/system/opkg/Makefile @@ -14,9 +14,9 @@ PKG_FLAGS:=essential PKG_SOURCE_PROTO:=git PKG_SOURCE_URL:=https://git.openwrt.org/project/opkg-lede.git -PKG_SOURCE_DATE:=2019-01-31 -PKG_SOURCE_VERSION:=d4ba162bb3f931bd5a019154270a548cf1f0853b -PKG_MIRROR_HASH:=dc97e6f6409031422c3c52c513209a6b806b219713c2898cb32fb95d34e92008 +PKG_SOURCE_DATE:=2019-06-14 +PKG_SOURCE_VERSION:=dcbc142e51f5f5f2fb9e4e44657e013d3c36a52b +PKG_MIRROR_HASH:=fca7e71dd06f0d5ee0af0d0a493d641d4d5d7e403d64c67879a462a020aa2299 PKG_LICENSE:=GPL-2.0 PKG_LICENSE_FILES:=COPYING @@ -25,7 +25,7 @@ PKG_MAINTAINER:=Jo-Philipp Wich # Extend depends from version.mk PKG_CONFIG_DEPENDS += \ - CONFIG_SIGNED_PACKAGES \ + CONFIG_SIGNATURE_CHECK \ CONFIG_TARGET_INIT_PATH PKG_BUILD_PARALLEL:=1 @@ -88,7 +88,7 @@ define Package/opkg/install $(INSTALL_DATA) ./files/opkg$(2).conf $(1)/etc/opkg.conf $(INSTALL_BIN) ./files/20_migrate-feeds $(1)/etc/uci-defaults/ $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/opkg-cl $(1)/bin/opkg - ifneq ($(CONFIG_SIGNED_PACKAGES),) + ifneq ($(CONFIG_SIGNATURE_CHECK),) echo "option check_signature" >> $(1)/etc/opkg.conf endif $(INSTALL_DIR) $(1)/usr/sbin diff --git a/package/system/procd/Makefile b/package/system/procd/Makefile index 7663e589f8..e4348f2019 100644 --- a/package/system/procd/Makefile +++ b/package/system/procd/Makefile @@ -12,9 +12,9 @@ PKG_RELEASE:=1 PKG_SOURCE_PROTO:=git PKG_SOURCE_URL=$(PROJECT_GIT)/procd.git -PKG_SOURCE_DATE:=2018-12-27 -PKG_SOURCE_VERSION:=e2b055edf26419c183f4bdc3aa47da789081f72e -PKG_MIRROR_HASH:=de5dbf7b48a0ec9fa0ec741f00bd4f7725c3db80ec0e85e623f13ea00b980e36 +PKG_SOURCE_DATE:=2019-05-30 +PKG_SOURCE_VERSION:=ade00ca585a49c8478bf60eb24ce385676be37a4 +PKG_MIRROR_HASH:=1417727ae6fcda01017e1bec3ec66e3e78116f9343cfe0256e40af54c52f2acc CMAKE_INSTALL:=1 PKG_LICENSE:=GPL-2.0 @@ -45,6 +45,7 @@ define Package/procd CATEGORY:=Base system DEPENDS:=+ubusd +ubus +libjson-script +ubox +USE_GLIBC:librt +libubox +libubus TITLE:=libreCMC system process manager + USERID:=:dialout=20 :audio=29 endef define Package/procd-ujail @@ -57,7 +58,7 @@ endef define Package/procd-seccomp SECTION:=base CATEGORY:=Base system - DEPENDS:=@arm||@armeb||@mips||@mipsel||@i386||@x86_64 @!TARGET_uml @KERNEL_SECCOMP +libubox +libblobmsg-json + DEPENDS:=@arm||@armeb||@mips||@mipsel||@i386||@powerpc||@x86_64 @!TARGET_uml @KERNEL_SECCOMP +libubox +libblobmsg-json TITLE:=libreCMC process seccomp helper + utrace endef diff --git a/package/system/procd/files/hotplug.json b/package/system/procd/files/hotplug.json index 1c949bbea3..f676bac79e 100644 --- a/package/system/procd/files/hotplug.json +++ b/package/system/procd/files/hotplug.json @@ -20,6 +20,10 @@ [ "regex", "DEVNAME", "^snd" ], [ "makedev", "/dev/%DEVNAME%", "0660", "audio" ] ], + [ "if", + [ "regex", "DEVNAME", "^tty" ], + [ "makedev", "/dev/%DEVNAME%", "0660", "dialout" ] + ], [ "if", [ "has", "DEVNAME" ], [ "makedev", "/dev/%DEVNAME%", "0600" ] diff --git a/package/system/procd/files/procd.sh b/package/system/procd/files/procd.sh index 72f25fe0c0..8d6d406012 100644 --- a/package/system/procd/files/procd.sh +++ b/package/system/procd/files/procd.sh @@ -18,14 +18,21 @@ # file: configuration files (array) # netdev: bound network device (detects ifindex changes) # limits: resource limits (passed to the process) -# user info: array with 1 values $username +# user: $username to run service as +# group: $groupname to run service as # pidfile: file name to write pid into +# stdout: boolean whether to redirect commands stdout to syslog (default: 0) +# stderr: boolean whether to redirect commands stderr to syslog (default: 0) +# facility: syslog facility used when logging to syslog (default: daemon) # # No space separation is done for arrays/tables - use one function argument per command line argument # # procd_close_instance(): # Complete the instance being prepared # +# procd_running(service, [instance]): +# Checks if service/instance is currently running +# # procd_kill(service, [instance]): # Kill a service instance (or all instances) # @@ -249,7 +256,7 @@ _procd_set_param() { reload_signal) json_add_int "$type" $(kill -l "$1") ;; - pidfile|user|seccomp|capabilities) + pidfile|user|group|seccomp|capabilities|facility) json_add_string "$type" "$1" ;; stdout|stderr|no_new_privs) @@ -398,6 +405,18 @@ _procd_add_instance() { _procd_close_instance } +procd_running() { + local service="$1" + local instance="${2:-instance1}" + local running + + json_init + json_add_string name "$service" + running=$(_procd_ubus_call list | jsonfilter -e "@.$service.instances.${instance}.running") + + [ "$running" = "true" ] +} + _procd_kill() { local service="$1" local instance="$2" diff --git a/package/system/rpcd/Makefile b/package/system/rpcd/Makefile index b73a4c2b64..062a466e40 100644 --- a/package/system/rpcd/Makefile +++ b/package/system/rpcd/Makefile @@ -8,14 +8,14 @@ include $(TOPDIR)/rules.mk PKG_NAME:=rpcd -PKG_RELEASE:=1 +PKG_RELEASE:=2 PKG_SOURCE_PROTO:=git PKG_SOURCE_URL=$(PROJECT_GIT)/rpcd.git -PKG_SOURCE_DATE:=2018-11-28 -PKG_SOURCE_VERSION:=3aa81d0dfae167eccc26203bd0c96f3e3450f253 +PKG_SOURCE_DATE:=2019-06-05 +PKG_SOURCE_VERSION:=89bfaa42460696fb3c37c232f69c2afd5c6d909e PKG_MAINTAINER:=Jo-Philipp Wich -PKG_MIRROR_HASH:=1befc5e1793a687e7a37b4f4d611e5f95aef4b79ad4b288c4dcb4c74d212509b +PKG_MIRROR_HASH:=c7ab910d4b3d135003d6c272968e8d73691aff4cdb367802e436ddf0c2d03435 PKG_LICENSE:=ISC PKG_LICENSE_FILES:= diff --git a/package/system/rpcd/files/rpcd.init b/package/system/rpcd/files/rpcd.init index 0a37ee19f9..4a31aa0d00 100755 --- a/package/system/rpcd/files/rpcd.init +++ b/package/system/rpcd/files/rpcd.init @@ -15,10 +15,7 @@ start_service() { procd_close_instance } -stop() { - service_stop /sbin/rpcd +reload_service() { + procd_send_signal rpcd } -reload() { - service_reload /sbin/rpcd -} diff --git a/package/system/ubox/Makefile b/package/system/ubox/Makefile index 36138b8a4b..2155fab2e6 100644 --- a/package/system/ubox/Makefile +++ b/package/system/ubox/Makefile @@ -1,13 +1,13 @@ include $(TOPDIR)/rules.mk PKG_NAME:=ubox -PKG_RELEASE:=1 +PKG_RELEASE:=2 PKG_SOURCE_PROTO:=git PKG_SOURCE_URL=$(PROJECT_GIT)/ubox.git -PKG_SOURCE_DATE:=2018-12-18 -PKG_SOURCE_VERSION:=876c7f5bfb9b13d48e6d7960dd114082a0a95a6d -PKG_MIRROR_HASH:=7c51ede116f7b17d8249453b10023398a4b662e78294c6fc269c8ed375cb47ce +PKG_SOURCE_DATE:=2019-04-07 +PKG_SOURCE_VERSION:=5130fa4d9c5d15d643506f906927b209d7690a83 +PKG_MIRROR_HASH:=58b19e4b4e4ba7cdaf7359222dc8e53781a7804d3349dc5a5f08eb72e6a47deb CMAKE_INSTALL:=1 PKG_LICENSE:=GPL-2.0 @@ -27,18 +27,28 @@ define Package/ubox TITLE:=libreCMC system helper toolbox endef +define Package/getrandom + SECTION:=base + CATEGORY:=Base system + TITLE:=libreCMC getrandom system helper +endef + define Package/logd -SECTION:=base + SECTION:=base CATEGORY:=Base system DEPENDS:=+libubox +libubus +libblobmsg-json +USE_GLIBC:librt TITLE:=libreCMC system log implementation endef +define Package/getrandom/install + $(INSTALL_DIR) $(1)/usr/bin + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/getrandom $(1)/usr/bin/ +endef + define Package/ubox/install $(INSTALL_DIR) $(1)/sbin $(1)/usr/sbin $(1)/lib $(1)/usr/bin $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/{kmodloader,validate_data} $(1)/sbin/ - $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/getrandom $(1)/usr/bin/ $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/lib/libvalidate.so $(1)/lib $(LN) kmodloader $(1)/sbin/rmmod @@ -56,4 +66,5 @@ define Package/logd/install endef $(eval $(call BuildPackage,ubox)) +$(eval $(call BuildPackage,getrandom)) $(eval $(call BuildPackage,logd)) diff --git a/package/system/ucert/Makefile b/package/system/ucert/Makefile index 1344a0acb3..49938154bf 100644 --- a/package/system/ucert/Makefile +++ b/package/system/ucert/Makefile @@ -47,6 +47,7 @@ define Package/ucert CATEGORY:=Base system DEPENDS:=+usign +libubox TITLE:=libreCMC certificate verification utility + PROVIDES:=ucert CONFLICTS:=ucert-full VARIANT:=tiny endef diff --git a/package/system/uci/Makefile b/package/system/uci/Makefile index 8ac90078cc..87219f0c08 100644 --- a/package/system/uci/Makefile +++ b/package/system/uci/Makefile @@ -9,13 +9,13 @@ include $(TOPDIR)/rules.mk PKG_NAME:=uci -PKG_RELEASE:=2 +PKG_RELEASE:=3 PKG_SOURCE_URL=$(PROJECT_GIT)/uci.git PKG_SOURCE_PROTO:=git -PKG_SOURCE_DATE=2018-08-11 -PKG_SOURCE_VERSION:=4c8b4d6efc8302b508d261573351fffb75bd98c2 -PKG_MIRROR_HASH:=c1f0f565921c71ff9231508c7c249baacad4c3ae1a3fade25c37bcb2bf7a7b5f +PKG_SOURCE_DATE=2019-05-17 +PKG_SOURCE_VERSION:=f199b961c2970b63cc83947ad49b327b3f48f05f +PKG_MIRROR_HASH:=bd860a1a97a5c8f1cd77875afcadba9dafff0c4a0d6743ba0c915d76e1c624cd PKG_LICENSE:=LGPL-2.1 PKG_LICENSE_FILES:= diff --git a/package/system/uci/files/lib/config/uci.sh b/package/system/uci/files/lib/config/uci.sh index 78ec277669..1e85ced834 100644 --- a/package/system/uci/files/lib/config/uci.sh +++ b/package/system/uci/files/lib/config/uci.sh @@ -85,6 +85,15 @@ uci_set() { /sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} set "$PACKAGE.$CONFIG.$OPTION=$VALUE" } +uci_add_list() { + local PACKAGE="$1" + local CONFIG="$2" + local OPTION="$3" + local VALUE="$4" + + /sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} add_list "$PACKAGE.$CONFIG.$OPTION=$VALUE" +} + uci_get_state() { uci_get "$1" "$2" "$3" "$4" "/var/state" } @@ -108,7 +117,7 @@ uci_add() { local CONFIG="$3" if [ -z "$CONFIG" ]; then - export ${NO_EXPORT:+-n} CONFIG_SECTION="$(/sbin/uci add "$PACKAGE" "$TYPE")" + export ${NO_EXPORT:+-n} CONFIG_SECTION="$(/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} add "$PACKAGE" "$TYPE")" else /sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} set "$PACKAGE.$CONFIG=$TYPE" export ${NO_EXPORT:+-n} CONFIG_SECTION="$CONFIG" @@ -132,6 +141,15 @@ uci_remove() { /sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} del "$PACKAGE.$CONFIG${OPTION:+.$OPTION}" } +uci_remove_list() { + local PACKAGE="$1" + local CONFIG="$2" + local OPTION="$3" + local VALUE="$4" + + /sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} del_list "$PACKAGE.$CONFIG.$OPTION=$VALUE" +} + uci_commit() { local PACKAGE="$1" /sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} commit $PACKAGE diff --git a/package/system/urandom-seed/Makefile b/package/system/urandom-seed/Makefile new file mode 100644 index 0000000000..268c87373d --- /dev/null +++ b/package/system/urandom-seed/Makefile @@ -0,0 +1,32 @@ +include $(TOPDIR)/rules.mk + +PKG_NAME:=urandom-seed +PKG_VERSION:=1.0 +PKG_RELEASE:=1 +PKG_LICENSE:=GPL-2.0 + +PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME) + +include $(INCLUDE_DIR)/package.mk + +define Package/$(PKG_NAME) + SECTION:=base + CATEGORY:=Base system + DEPENDS:=+getrandom + TITLE:=/etc/urandom.seed handling for libreCMC + URL:=http://openwrt.org/ +endef + +define Build/Prepare + mkdir -p $(PKG_BUILD_DIR) +endef + +define Build/Compile/Default +endef +Build/Compile = $(Build/Compile/Default) + +define Package/$(PKG_NAME)/install + $(CP) ./files/* $(1)/ +endef + +$(eval $(call BuildPackage,urandom-seed)) diff --git a/package/base-files/files/etc/init.d/urandom_seed b/package/system/urandom-seed/files/etc/init.d/urandom_seed similarity index 100% rename from package/base-files/files/etc/init.d/urandom_seed rename to package/system/urandom-seed/files/etc/init.d/urandom_seed diff --git a/package/base-files/files/lib/preinit/81_urandom_seed b/package/system/urandom-seed/files/lib/preinit/81_urandom_seed similarity index 100% rename from package/base-files/files/lib/preinit/81_urandom_seed rename to package/system/urandom-seed/files/lib/preinit/81_urandom_seed diff --git a/package/base-files/files/sbin/urandom_seed b/package/system/urandom-seed/files/sbin/urandom_seed similarity index 100% rename from package/base-files/files/sbin/urandom_seed rename to package/system/urandom-seed/files/sbin/urandom_seed diff --git a/package/system/urngd/Makefile b/package/system/urngd/Makefile new file mode 100644 index 0000000000..1f2286fbef --- /dev/null +++ b/package/system/urngd/Makefile @@ -0,0 +1,48 @@ +include $(TOPDIR)/rules.mk + +PKG_NAME:=urngd +PKG_RELEASE:=1 + +PKG_SOURCE_PROTO:=git +PKG_SOURCE_URL=https://git.openwrt.org/project/urngd.git +PKG_SOURCE_DATE:=2019-06-17 +PKG_SOURCE_VERSION:=c057e177ace7704a3d4e2e1272baaf2e2d21cbed +PKG_MIRROR_HASH:=6ef24be5da227b36fc63098767cf3de8dccbe5578487ffdbd69c7beeeb76bccd + +PKG_LICENSE:=GPL-2.0 BSD-3-Clause +PKG_LICENSE_FILES:= + +PKG_BUILD_PARALLEL:=1 + +include $(INCLUDE_DIR)/package.mk +include $(INCLUDE_DIR)/cmake.mk + +define Package/$(PKG_NAME) + SECTION:=utils + CATEGORY:=Base system + TITLE:=libreCMC non-physical true random number generator based on timing jitter + DEPENDS:=+libubox +endef + +define Package/$(PKG_NAME)/description + urngd is libreCMC's micro non-physical true random number generator based on + timing jitter. + + Using the Jitter RNG core, the rngd provides an entropy source that feeds into + the Linux /dev/random device if its entropy runs low. It updates the + /dev/random entropy estimator such that the newly provided entropy unblocks + /dev/random. + + The seeding of /dev/random also ensures that /dev/urandom benefits from + entropy. Especially during boot time, when the entropy of Linux is low, the + Jitter RNGd provides a source of sufficient entropy. +endef + +define Package/$(PKG_NAME)/install + $(INSTALL_DIR) $(1)/etc/init.d + $(INSTALL_BIN) ./files/$(PKG_NAME).init $(1)/etc/init.d/$(PKG_NAME) + $(INSTALL_DIR) $(1)/sbin + $(INSTALL_BIN) $(PKG_BUILD_DIR)/$(PKG_NAME) $(1)/sbin/$(PKG_NAME) +endef + +$(eval $(call BuildPackage,$(PKG_NAME))) diff --git a/package/system/urngd/files/urngd.init b/package/system/urngd/files/urngd.init new file mode 100644 index 0000000000..7531ca8f39 --- /dev/null +++ b/package/system/urngd/files/urngd.init @@ -0,0 +1,17 @@ +#!/bin/sh /etc/rc.common + +START=00 + +USE_PROCD=1 +NAME=urngd +PROG=/sbin/urngd + +start_service() { + procd_open_instance + procd_set_param command "$PROG" + procd_close_instance +} + +reload_service() { + procd_send_signal $PROG +} diff --git a/package/system/usign/Makefile b/package/system/usign/Makefile index 2b86b19bbc..a59def3448 100644 --- a/package/system/usign/Makefile +++ b/package/system/usign/Makefile @@ -5,9 +5,9 @@ PKG_RELEASE:=1 PKG_SOURCE_PROTO:=git PKG_SOURCE_URL=$(PROJECT_GIT)/usign.git -PKG_SOURCE_DATE:=2015-07-04 -PKG_SOURCE_VERSION:=ef6419142a3b0fbcddcccf536e3c1880302c6f89 -PKG_MIRROR_HASH:=9499ed7e40889b364e446a428e185c40986b75087888bd7e1496542457a6dbaa +PKG_SOURCE_DATE:=2019-08-06 +PKG_SOURCE_VERSION:=5a52b379902471cef495687547c7b568142f66d2 +PKG_MIRROR_HASH:=9779f6d6718a7f7cd3e28aa7feefc9b3f4b0c7a85cb58ff18afbeb6b4372177a CMAKE_INSTALL:=1 PKG_CHECK_FORMAT_SECURITY:=1 PKG_USE_MIPS16:=0 diff --git a/package/utils/adb/Makefile b/package/utils/adb/Makefile index 55f9c1a598..7be8ee9a1c 100644 --- a/package/utils/adb/Makefile +++ b/package/utils/adb/Makefile @@ -8,6 +8,7 @@ PKG_RELEASE:=2 PKG_SOURCE_PROTO:=git PKG_SOURCE_URL:=https://android.googlesource.com/platform/system/core PKG_SOURCE_VERSION:=6fe92d1a3fb17545d82d020a3c995f32e6b71f9d +PKG_MIRROR_HASH:=a9b4b86602dfc0d4fc9e1d0f78dc83e648a931fb04f5a4be9b1f0054a8cebf7e PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_SOURCE_VERSION) PKG_SOURCE:=$(PKG_SOURCE_SUBDIR).tar.xz PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_SOURCE_SUBDIR) diff --git a/package/utils/adb/patches/003-fix-musl-build.patch b/package/utils/adb/patches/003-fix-musl-build.patch new file mode 100644 index 0000000000..8a974b130e --- /dev/null +++ b/package/utils/adb/patches/003-fix-musl-build.patch @@ -0,0 +1,10 @@ +--- a/adb/usb_linux.c ++++ b/adb/usb_linux.c +@@ -21,6 +21,7 @@ + + #include + #include ++#include + #include + #include + #include diff --git a/package/utils/busybox/Makefile b/package/utils/busybox/Makefile index bf0cec743a..c23c97eff5 100644 --- a/package/utils/busybox/Makefile +++ b/package/utils/busybox/Makefile @@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=busybox PKG_VERSION:=1.30.1 -PKG_RELEASE:=1 +PKG_RELEASE:=5 PKG_FLAGS:=essential PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2 @@ -37,6 +37,8 @@ endif BUSYBOX_SYM=$(if $(CONFIG_BUSYBOX_CUSTOM),CONFIG,DEFAULT) BUSYBOX_IF_ENABLED=$(if $(CONFIG_BUSYBOX_$(BUSYBOX_SYM)_$(1)),$(2)) +# All files provided by busybox will serve as fallback alternatives by opkg. +# There should be no need to enumerate ALTERNATIVES entries here define Package/busybox SECTION:=base CATEGORY:=Base system @@ -45,23 +47,6 @@ define Package/busybox URL:=http://busybox.net/ DEPENDS:=+BUSYBOX_CONFIG_PAM:libpam +BUSYBOX_CONFIG_NTPD:jsonfilter MENU:=1 - ALTERNATIVES:=\ - $(call BUSYBOX_IF_ENABLED,FIND, 100:/usr/bin/find:/bin/busybox) \ - $(call BUSYBOX_IF_ENABLED,FLOCK, 100:/usr/bin/flock:/bin/busybox) \ - $(call BUSYBOX_IF_ENABLED,FREE, 100:/usr/bin/free:/bin/busybox) \ - $(call BUSYBOX_IF_ENABLED,IP, 100:/sbin/ip:/bin/busybox) \ - $(call BUSYBOX_IF_ENABLED,KILL, 100:/bin/kill:/bin/busybox) \ - $(call BUSYBOX_IF_ENABLED,PGREP, 100:/usr/bin/pgrep:/bin/busybox) \ - $(call BUSYBOX_IF_ENABLED,PKILL, 100:/usr/bin/pkill:/bin/busybox) \ - $(call BUSYBOX_IF_ENABLED,PMAP, 100:/usr/bin/pmap:/bin/busybox) \ - $(call BUSYBOX_IF_ENABLED,PS, 100:/bin/ps:/bin/busybox) \ - $(call BUSYBOX_IF_ENABLED,PWDX, 100:/usr/bin/pwdx:/bin/busybox) \ - $(call BUSYBOX_IF_ENABLED,TOP, 100:/usr/bin/top:/bin/busybox) \ - $(call BUSYBOX_IF_ENABLED,UPTIME, 100:/usr/bin/uptime:/bin/busybox) \ - $(call BUSYBOX_IF_ENABLED,WATCH, 100:/bin/watch:/bin/busybox) \ - $(call BUSYBOX_IF_ENABLED,WGET, 100:/usr/bin/wget:/bin/busybox) \ - $(call BUSYBOX_IF_ENABLED,XARGS, 100:/usr/bin/xargs:/bin/busybox) \ - endef define Package/busybox/description @@ -120,6 +105,7 @@ endef define Package/busybox/install $(INSTALL_DIR) $(1)/etc/init.d + $(INSTALL_DIR) $(1)/usr/sbin $(CP) $(PKG_INSTALL_DIR)/* $(1)/ ifneq ($(CONFIG_BUSYBOX_$(BUSYBOX_SYM)_CROND),) $(INSTALL_BIN) ./files/cron $(1)/etc/init.d/cron diff --git a/package/utils/busybox/patches/530-ip-use-rtnl_send_check-on-flush-commands.patch b/package/utils/busybox/patches/530-ip-use-rtnl_send_check-on-flush-commands.patch new file mode 100644 index 0000000000..0e8ec37f80 --- /dev/null +++ b/package/utils/busybox/patches/530-ip-use-rtnl_send_check-on-flush-commands.patch @@ -0,0 +1,214 @@ +From 028c5aa18b5273c029f0278232d922ee1a164de6 Mon Sep 17 00:00:00 2001 +From: Denys Vlasenko +Date: Wed, 22 May 2019 13:54:46 +0200 +Subject: ip: use rtnl_send_check() on flush commands, closes 6962 + +function old new delta +rtnl_send_check - 160 +160 +xrtnl_wilddump_request 64 66 +2 +ipneigh_list_or_flush 714 706 -8 +rtnl_send 69 - -69 +------------------------------------------------------------------------------ +(add/remove: 1/1 grow/shrink: 1/1 up/down: 162/-77) Total: 85 bytes + +Signed-off-by: Denys Vlasenko +--- + networking/libiproute/ipaddress.c | 6 ++++-- + networking/libiproute/ipneigh.c | 9 ++++---- + networking/libiproute/iproute.c | 5 ++++- + networking/libiproute/libnetlink.c | 43 +++++++++++++++++++++++++++++++------- + networking/libiproute/libnetlink.h | 19 +++++++++++++++-- + 5 files changed, 65 insertions(+), 17 deletions(-) + +--- a/networking/libiproute/ipaddress.c ++++ b/networking/libiproute/ipaddress.c +@@ -23,6 +23,7 @@ + + struct filter_t { + char *label; ++ /* Flush cmd buf. If !NULL, print_addrinfo() constructs flush commands in it */ + char *flushb; + struct rtnl_handle *rth; + int scope, scopemask; +@@ -34,6 +35,8 @@ struct filter_t { + smallint showqueue; + smallint oneline; + smallint up; ++ /* Misnomer. Does not mean "flushed something" */ ++ /* More like "flush commands were constructed by print_addrinfo()" */ + smallint flushed; + inet_prefix pfx; + } FIX_ALIASING; +@@ -201,7 +204,7 @@ static NOINLINE int print_linkinfo(const + + static int flush_update(void) + { +- if (rtnl_send(G_filter.rth, G_filter.flushb, G_filter.flushp) < 0) { ++ if (rtnl_send_check(G_filter.rth, G_filter.flushb, G_filter.flushp) < 0) { + bb_perror_msg("can't send flush request"); + return -1; + } +@@ -507,7 +510,6 @@ int FAST_FUNC ipaddr_list_or_flush(char + xrtnl_dump_filter(&rth, store_nlmsg, &ainfo); + } + +- + if (G_filter.family && G_filter.family != AF_PACKET) { + struct nlmsg_list **lp; + lp = &linfo; +--- a/networking/libiproute/ipneigh.c ++++ b/networking/libiproute/ipneigh.c +@@ -32,7 +32,10 @@ struct filter_t { + int state; + int unused_only; + inet_prefix pfx; ++ /* Misnomer. Does not mean "flushed N something" */ ++ /* More like "no_of_flush_commands_constructed_by_print_neigh()" */ + int flushed; ++ /* Flush cmd buf. If !NULL, print_neigh() constructs flush commands in it */ + char *flushb; + int flushp; + int flushe; +@@ -45,7 +48,7 @@ typedef struct filter_t filter_t; + + static int flush_update(void) + { +- if (rtnl_send(G_filter.rth, G_filter.flushb, G_filter.flushp) < 0) { ++ if (rtnl_send_check(G_filter.rth, G_filter.flushb, G_filter.flushp) < 0) { + bb_perror_msg("can't send flush request"); + return -1; + } +@@ -299,9 +302,7 @@ static int FAST_FUNC ipneigh_list_or_flu + G_filter.rth = &rth; + + while (round < MAX_ROUNDS) { +- if (xrtnl_wilddump_request(&rth, G_filter.family, RTM_GETNEIGH) < 0) { +- bb_perror_msg_and_die("can't send dump request"); +- } ++ xrtnl_wilddump_request(&rth, G_filter.family, RTM_GETNEIGH); + G_filter.flushed = 0; + if (xrtnl_dump_filter(&rth, print_neigh, NULL) < 0) { + bb_perror_msg_and_die("flush terminated"); +--- a/networking/libiproute/iproute.c ++++ b/networking/libiproute/iproute.c +@@ -26,7 +26,10 @@ + + struct filter_t { + int tb; ++ /* Misnomer. Does not mean "flushed something" */ ++ /* More like "flush commands were constructed by print_route()" */ + smallint flushed; ++ /* Flush cmd buf. If !NULL, print_route() constructs flush commands in it */ + char *flushb; + int flushp; + int flushe; +@@ -53,7 +56,7 @@ typedef struct filter_t filter_t; + + static int flush_update(void) + { +- if (rtnl_send(G_filter.rth, G_filter.flushb, G_filter.flushp) < 0) { ++ if (rtnl_send_check(G_filter.rth, G_filter.flushb, G_filter.flushp) < 0) { + bb_perror_msg("can't send flush request"); + return -1; + } +--- a/networking/libiproute/libnetlink.c ++++ b/networking/libiproute/libnetlink.c +@@ -34,7 +34,7 @@ void FAST_FUNC xrtnl_open(struct rtnl_ha + rth->seq = time(NULL); + } + +-int FAST_FUNC xrtnl_wilddump_request(struct rtnl_handle *rth, int family, int type) ++void FAST_FUNC xrtnl_wilddump_request(struct rtnl_handle *rth, int family, int type) + { + struct { + struct nlmsghdr nlh; +@@ -48,18 +48,45 @@ int FAST_FUNC xrtnl_wilddump_request(str + req.nlh.nlmsg_seq = rth->dump = ++rth->seq; + req.g.rtgen_family = family; + +- return rtnl_send(rth, (void*)&req, sizeof(req)); ++ rtnl_send(rth, (void*)&req, sizeof(req)); + } + +-//TODO: pass rth->fd instead of full rth? +-int FAST_FUNC rtnl_send(struct rtnl_handle *rth, char *buf, int len) ++/* A version which checks for e.g. EPERM errors. ++ * Try: setuidgid 1:1 ip addr flush dev eth0 ++ */ ++int FAST_FUNC rtnl_send_check(struct rtnl_handle *rth, const void *buf, int len) + { +- struct sockaddr_nl nladdr; ++ struct nlmsghdr *h; ++ int status; ++ char resp[1024]; ++ ++ status = write(rth->fd, buf, len); ++ if (status < 0) ++ return status; ++ ++ /* Check for immediate errors */ ++ status = recv(rth->fd, resp, sizeof(resp), MSG_DONTWAIT|MSG_PEEK); ++ if (status < 0) { ++ if (errno == EAGAIN) /* if no error, this happens */ ++ return 0; ++ return -1; ++ } ++ ++ for (h = (struct nlmsghdr *)resp; ++ NLMSG_OK(h, status); ++ h = NLMSG_NEXT(h, status) ++ ) { ++ if (h->nlmsg_type == NLMSG_ERROR) { ++ struct nlmsgerr *err = (struct nlmsgerr*)NLMSG_DATA(h); ++ if (h->nlmsg_len < NLMSG_LENGTH(sizeof(struct nlmsgerr))) ++ bb_error_msg("ERROR truncated"); ++ else ++ errno = -err->error; ++ return -1; ++ } ++ } + +- memset(&nladdr, 0, sizeof(nladdr)); +- nladdr.nl_family = AF_NETLINK; +- +- return xsendto(rth->fd, buf, len, (struct sockaddr*)&nladdr, sizeof(nladdr)); ++ return 0; + } + + int FAST_FUNC rtnl_dump_request(struct rtnl_handle *rth, int type, void *req, int len) +--- a/networking/libiproute/libnetlink.h ++++ b/networking/libiproute/libnetlink.h +@@ -20,7 +20,7 @@ struct rtnl_handle { + + extern void xrtnl_open(struct rtnl_handle *rth) FAST_FUNC; + #define rtnl_close(rth) (close((rth)->fd)) +-extern int xrtnl_wilddump_request(struct rtnl_handle *rth, int fam, int type) FAST_FUNC; ++extern void xrtnl_wilddump_request(struct rtnl_handle *rth, int fam, int type) FAST_FUNC; + extern int rtnl_dump_request(struct rtnl_handle *rth, int type, void *req, int len) FAST_FUNC; + extern int xrtnl_dump_filter(struct rtnl_handle *rth, + int (*filter)(const struct sockaddr_nl*, struct nlmsghdr *n, void*) FAST_FUNC, +@@ -34,8 +34,23 @@ extern int rtnl_talk(struct rtnl_handle + int (*junk)(struct sockaddr_nl *,struct nlmsghdr *n, void *), + void *jarg) FAST_FUNC; + +-extern int rtnl_send(struct rtnl_handle *rth, char *buf, int) FAST_FUNC; ++int rtnl_send_check(struct rtnl_handle *rth, const void *buf, int len) FAST_FUNC; ++//TODO: pass rth->fd instead of full rth? ++static ALWAYS_INLINE void rtnl_send(struct rtnl_handle *rth, const void *buf, int len) ++{ ++ // Used to be: ++ //struct sockaddr_nl nladdr; ++ //memset(&nladdr, 0, sizeof(nladdr)); ++ //nladdr.nl_family = AF_NETLINK; ++ //return xsendto(rth->fd, buf, len, (struct sockaddr*)&nladdr, sizeof(nladdr)); + ++ // iproute2-4.2.0 simplified the above to: ++ //return send(rth->fd, buf, len, 0); ++ ++ // We are using even shorter: ++ xwrite(rth->fd, buf, len); ++ // and convert to void, inline. ++} + + extern int addattr32(struct nlmsghdr *n, int maxlen, int type, uint32_t data) FAST_FUNC; + extern int addattr_l(struct nlmsghdr *n, int maxlen, int type, void *data, int alen) FAST_FUNC; diff --git a/package/utils/bzip2/Makefile b/package/utils/bzip2/Makefile index 9c64d2264a..7ae089f4f4 100644 --- a/package/utils/bzip2/Makefile +++ b/package/utils/bzip2/Makefile @@ -8,16 +8,15 @@ include $(TOPDIR)/rules.mk PKG_NAME:=bzip2 -PKG_VERSION:=1.0.6 -PKG_RELEASE:=5 +PKG_VERSION:=1.0.8 +PKG_RELEASE:=1 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz -PKG_SOURCE_URL:=http://distfiles.gentoo.org/distfiles/ \ - http://distcache.freebsd.org/ports-distfiles/ -PKG_HASH:=a2848f34fcd5d6cf47def00461fcb528a0484d8edef8208d6d2e2909dc61d9cd -PKG_MAINTAINER:=Steven Barth +PKG_SOURCE_URL:=https://sourceware.org/pub/bzip2 +PKG_HASH:=ab5a03176ee106d3f0fa90e381da478ddae405918153cca248e682cd0c4a2269 -PKG_LICENSE:=BZIP2 +PKG_MAINTAINER:=Steven Barth +PKG_LICENSE:=bzip2-1.0.8 PKG_LICENSE_FILES:=LICENSE PKG_CPE_ID:=cpe:/a:bzip:bzip2 @@ -26,7 +25,7 @@ include $(INCLUDE_DIR)/package.mk define Package/bzip2/Default SUBMENU:=Compression - URL:=http://www.bzip.org/ + URL:=https://sourceware.org/bzip2/ endef define Package/libbz2 diff --git a/package/utils/bzip2/patches/010-CVE-2016-3189.patch b/package/utils/bzip2/patches/010-CVE-2016-3189.patch deleted file mode 100644 index 064f982c48..0000000000 --- a/package/utils/bzip2/patches/010-CVE-2016-3189.patch +++ /dev/null @@ -1,11 +0,0 @@ -diff -up ./bzip2recover.c.old ./bzip2recover.c ---- ./bzip2recover.c.old 2016-03-22 08:49:38.855620000 +0100 -+++ ./bzip2recover.c 2016-03-30 10:22:27.341430099 +0200 -@@ -457,6 +457,7 @@ Int32 main ( Int32 argc, Char** argv ) - bsPutUChar ( bsWr, 0x50 ); bsPutUChar ( bsWr, 0x90 ); - bsPutUInt32 ( bsWr, blockCRC ); - bsClose ( bsWr ); -+ outFile = NULL; - } - if (wrBlock >= rbCtr) break; - wrBlock++; diff --git a/package/utils/bzip2/patches/020-no-utime.patch b/package/utils/bzip2/patches/020-no-utime.patch new file mode 100644 index 0000000000..d0cd4f0e35 --- /dev/null +++ b/package/utils/bzip2/patches/020-no-utime.patch @@ -0,0 +1,27 @@ +--- a/bzip2.c ++++ b/bzip2.c +@@ -69,7 +69,6 @@ + #if BZ_UNIX + # include + # include +-# include + # include + # include + # include +@@ -1051,12 +1050,12 @@ void applySavedTimeInfoToOutputFile ( Ch + { + # if BZ_UNIX + IntNative retVal; +- struct utimbuf uTimBuf; ++ struct timespec uTimBuf[2] = {}; + +- uTimBuf.actime = fileMetaInfo.st_atime; +- uTimBuf.modtime = fileMetaInfo.st_mtime; ++ uTimBuf[0].tv_sec = fileMetaInfo.st_atime; ++ uTimBuf[1].tv_sec = fileMetaInfo.st_mtime; + +- retVal = utime ( dstName, &uTimBuf ); ++ retVal = utimensat ( AT_FDCWD, dstName, uTimBuf , 0 ); + ERROR_IF_NOT_ZERO ( retVal ); + # endif + } diff --git a/package/utils/lua/Makefile b/package/utils/lua/Makefile index c34e569b67..077a60fbf3 100644 --- a/package/utils/lua/Makefile +++ b/package/utils/lua/Makefile @@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=lua PKG_VERSION:=5.1.5 -PKG_RELEASE:=2 +PKG_RELEASE:=3 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz PKG_SOURCE_URL:=http://www.lua.org/ftp/ \ diff --git a/package/utils/lua/patches-host/013-lnum-strtoul-parsing-fixes.patch b/package/utils/lua/patches-host/013-lnum-strtoul-parsing-fixes.patch new file mode 100644 index 0000000000..7f00c8c3a2 --- /dev/null +++ b/package/utils/lua/patches-host/013-lnum-strtoul-parsing-fixes.patch @@ -0,0 +1,48 @@ +diff --git a/src/lnum.c b/src/lnum.c +index 1456b6a2ed23..b0632b04c2b7 100644 +--- a/src/lnum.c ++++ b/src/lnum.c +@@ -127,6 +127,8 @@ static int luaO_str2i (const char *s, lua_Integer *res, char **endptr_ref) { + #else + return 0; /* Reject the number */ + #endif ++ } else if (v > LUA_INTEGER_MAX) { ++ return TK_NUMBER; + } + } else if ((v > LUA_INTEGER_MAX) || (*endptr && (!isspace(*endptr)))) { + return TK_NUMBER; /* not in signed range, or has '.', 'e' etc. trailing */ +@@ -310,3 +312,13 @@ int try_unmint( lua_Integer *r, lua_Integer ib ) { + return 0; + } + ++#ifdef LONG_OVERFLOW_LUA_INTEGER ++unsigned LUA_INTEGER lua_str2ul( const char *str, char **endptr, int base ) { ++ unsigned long v= strtoul(str, endptr, base); ++ if ( v > LUA_INTEGER_MAX ) { ++ errno= ERANGE; ++ v= ULONG_MAX; ++ } ++ return (unsigned LUA_INTEGER)v; ++} ++#endif +diff --git a/src/lnum_config.h b/src/lnum_config.h +index 19d7a4231a49..1092eead6629 100644 +--- a/src/lnum_config.h ++++ b/src/lnum_config.h +@@ -141,7 +141,12 @@ + #endif + + #ifndef lua_str2ul +-# define lua_str2ul (unsigned LUA_INTEGER)strtoul ++# if LONG_MAX > LUA_INTEGER_MAX ++# define LONG_OVERFLOW_LUA_INTEGER ++ unsigned LUA_INTEGER lua_str2ul( const char *str, char **endptr, int base ); ++# else ++# define lua_str2ul (unsigned LUA_INTEGER)strtoul ++# endif + #endif + #ifndef LUA_INTEGER_MIN + # define LUA_INTEGER_MIN (-LUA_INTEGER_MAX -1) /* -2^16|32 */ +-- +1.9.1 + diff --git a/package/utils/lua/patches/013-lnum-strtoul-parsing-fixes.patch b/package/utils/lua/patches/013-lnum-strtoul-parsing-fixes.patch new file mode 100644 index 0000000000..7f00c8c3a2 --- /dev/null +++ b/package/utils/lua/patches/013-lnum-strtoul-parsing-fixes.patch @@ -0,0 +1,48 @@ +diff --git a/src/lnum.c b/src/lnum.c +index 1456b6a2ed23..b0632b04c2b7 100644 +--- a/src/lnum.c ++++ b/src/lnum.c +@@ -127,6 +127,8 @@ static int luaO_str2i (const char *s, lua_Integer *res, char **endptr_ref) { + #else + return 0; /* Reject the number */ + #endif ++ } else if (v > LUA_INTEGER_MAX) { ++ return TK_NUMBER; + } + } else if ((v > LUA_INTEGER_MAX) || (*endptr && (!isspace(*endptr)))) { + return TK_NUMBER; /* not in signed range, or has '.', 'e' etc. trailing */ +@@ -310,3 +312,13 @@ int try_unmint( lua_Integer *r, lua_Integer ib ) { + return 0; + } + ++#ifdef LONG_OVERFLOW_LUA_INTEGER ++unsigned LUA_INTEGER lua_str2ul( const char *str, char **endptr, int base ) { ++ unsigned long v= strtoul(str, endptr, base); ++ if ( v > LUA_INTEGER_MAX ) { ++ errno= ERANGE; ++ v= ULONG_MAX; ++ } ++ return (unsigned LUA_INTEGER)v; ++} ++#endif +diff --git a/src/lnum_config.h b/src/lnum_config.h +index 19d7a4231a49..1092eead6629 100644 +--- a/src/lnum_config.h ++++ b/src/lnum_config.h +@@ -141,7 +141,12 @@ + #endif + + #ifndef lua_str2ul +-# define lua_str2ul (unsigned LUA_INTEGER)strtoul ++# if LONG_MAX > LUA_INTEGER_MAX ++# define LONG_OVERFLOW_LUA_INTEGER ++ unsigned LUA_INTEGER lua_str2ul( const char *str, char **endptr, int base ); ++# else ++# define lua_str2ul (unsigned LUA_INTEGER)strtoul ++# endif + #endif + #ifndef LUA_INTEGER_MIN + # define LUA_INTEGER_MIN (-LUA_INTEGER_MAX -1) /* -2^16|32 */ +-- +1.9.1 + diff --git a/package/utils/mdadm/Makefile b/package/utils/mdadm/Makefile index 18026bbed2..f20a58b704 100644 --- a/package/utils/mdadm/Makefile +++ b/package/utils/mdadm/Makefile @@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=mdadm PKG_VERSION:=4.1 -PKG_RELEASE:=1 +PKG_RELEASE:=2 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz PKG_SOURCE_URL:=@KERNEL/linux/utils/raid/mdadm diff --git a/package/utils/mdadm/patches/100-cross_compile.patch b/package/utils/mdadm/patches/100-cross_compile.patch index 3576364d6f..0a5fa017c6 100644 --- a/package/utils/mdadm/patches/100-cross_compile.patch +++ b/package/utils/mdadm/patches/100-cross_compile.patch @@ -1,6 +1,6 @@ --- a/Makefile +++ b/Makefile -@@ -97,7 +97,7 @@ DLM:=$(shell [ -f /usr/include/libdlm.h ] || echo -DNO_DLM) +@@ -97,7 +97,7 @@ DLM:=$(shell [ -f /usr/include/libdlm.h DIRFLAGS = -DMAP_DIR=\"$(MAP_DIR)\" -DMAP_FILE=\"$(MAP_FILE)\" DIRFLAGS += -DMDMON_DIR=\"$(MDMON_DIR)\" DIRFLAGS += -DFAILED_SLOTS_DIR=\"$(FAILED_SLOTS_DIR)\" diff --git a/package/utils/mdadm/patches/102-Add-missing-include-file-sys-sysmacros.h.patch b/package/utils/mdadm/patches/102-Add-missing-include-file-sys-sysmacros.h.patch new file mode 100644 index 0000000000..891b5c62f0 --- /dev/null +++ b/package/utils/mdadm/patches/102-Add-missing-include-file-sys-sysmacros.h.patch @@ -0,0 +1,29 @@ +From 452dc4d13a012cdcb05088c0dbc699959c4d6c73 Mon Sep 17 00:00:00 2001 +From: Baruch Siach +Date: Tue, 6 Aug 2019 16:05:23 +0300 +Subject: mdadm.h: include sysmacros.h unconditionally + +musl libc now also requires sys/sysmacros.h for the major/minor macros. +All supported libc implementations carry sys/sysmacros.h, including +diet-libc, klibc, and uclibc-ng. + +Cc: Hauke Mehrtens +Signed-off-by: Baruch Siach +Signed-off-by: Jes Sorensen +--- + mdadm.h | 2 -- + 1 file changed, 2 deletions(-) + +--- a/mdadm.h ++++ b/mdadm.h +@@ -45,10 +45,8 @@ extern __off64_t lseek64 __P ((int __fd, + #include + #include + #include +-#ifdef __GLIBC__ + /* Newer glibc requires sys/sysmacros.h directly for makedev() */ + #include +-#endif + #ifdef __dietlibc__ + #include + /* dietlibc has deprecated random and srandom!! */ diff --git a/package/utils/mdadm/patches/200-reduce_size.patch b/package/utils/mdadm/patches/200-reduce_size.patch index 098fa1e1ec..6905c2ccfe 100644 --- a/package/utils/mdadm/patches/200-reduce_size.patch +++ b/package/utils/mdadm/patches/200-reduce_size.patch @@ -1,6 +1,6 @@ --- a/Incremental.c +++ b/Incremental.c -@@ -1619,6 +1619,10 @@ static int Incremental_container(struct supertype *st, char *devname, +@@ -1619,6 +1619,10 @@ static int Incremental_container(struct if (ra_all == ra_blocked) return 0; diff --git a/package/utils/mtd-utils/Makefile b/package/utils/mtd-utils/Makefile index ca60726d81..8acd46747e 100644 --- a/package/utils/mtd-utils/Makefile +++ b/package/utils/mtd-utils/Makefile @@ -8,12 +8,12 @@ include $(TOPDIR)/rules.mk PKG_NAME:=mtd-utils -PKG_VERSION:=2.0.2 +PKG_VERSION:=2.1.1 PKG_RELEASE:=1 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2 PKG_SOURCE_URL:=ftp://ftp.infradead.org/pub/mtd-utils/ -PKG_HASH:=fb3de61be8e932abb424e8ea3c30298f553d5f970ad158a737bb303bbf9660b8 +PKG_HASH:=8d15e8b70f036d6af1a66011f8ca0e048e9675fa7983d33bea92c24313a232d2 PKG_INSTALL:=1 PKG_FIXUP:=autoreconf @@ -58,7 +58,9 @@ MAKE_FLAGS += LDLIBS+="$(LIBGCC_S)" CONFIGURE_ARGS += \ --disable-tests \ + --without-crypto \ --without-xattr \ + --without-zstd \ --without-lzo TARGET_CFLAGS += -ffunction-sections -fdata-sections diff --git a/package/utils/mtd-utils/patches/200-Revert-Return-correct-error-number-in-ubi_get_vol_in.patch b/package/utils/mtd-utils/patches/200-Revert-Return-correct-error-number-in-ubi_get_vol_in.patch deleted file mode 100644 index 79695c4954..0000000000 --- a/package/utils/mtd-utils/patches/200-Revert-Return-correct-error-number-in-ubi_get_vol_in.patch +++ /dev/null @@ -1,30 +0,0 @@ -From 7d27becbb355853ba778e8b83fe171eecb8195d2 Mon Sep 17 00:00:00 2001 -From: Christian Lamparter -Date: Thu, 7 Jun 2018 22:36:19 +0200 -Subject: [PATCH] Revert "Return correct error number in ubi_get_vol_info1" - -This reverts commit dede98ffb706676309488d7cc660f569548d5930. ---- - lib/libubi.c | 5 +---- - 1 file changed, 1 insertion(+), 4 deletions(-) - -diff --git a/lib/libubi.c b/lib/libubi.c -index b50e68a..978b433 100644 ---- a/lib/libubi.c -+++ b/lib/libubi.c -@@ -1240,11 +1240,8 @@ int ubi_get_vol_info1(libubi_t desc, int dev_num, int vol_id, - info->dev_num = dev_num; - info->vol_id = vol_id; - -- if (vol_get_major(lib, dev_num, vol_id, &info->major, &info->minor)) { -- if (errno == ENOENT) -- errno = ENODEV; -+ if (vol_get_major(lib, dev_num, vol_id, &info->major, &info->minor)) - return -1; -- } - - ret = vol_read_data(lib->vol_type, dev_num, vol_id, buf, 50); - if (ret < 0) --- -2.17.1 - diff --git a/package/utils/spidev_test/Makefile b/package/utils/spidev_test/Makefile index b7c5227f91..1e07863f04 100644 --- a/package/utils/spidev_test/Makefile +++ b/package/utils/spidev_test/Makefile @@ -10,13 +10,16 @@ include $(INCLUDE_DIR)/kernel.mk PKG_NAME:=spidev-test PKG_RELEASE:=$(LINUX_VERSION) +PKG_FLAGS:=nonshared +PKG_BUILD_DIR:=$(LINUX_DIR)/tools/spi-$(TARGET_DIR_NAME) +PKG_BUILD_PARALLEL:=1 include $(INCLUDE_DIR)/package.mk define Package/spidev-test SECTION:=utils CATEGORY:=Utilities - DEPENDS:=+kmod-spi-dev + DEPENDS:=+kmod-spi-dev @!IN_SDK TITLE:=SPI testing utility VERSION:=$(LINUX_VERSION)-$(PKG_RELEASE) URL:=http://www.kernel.org @@ -27,9 +30,26 @@ define Package/spidev-test/description SPI testing utility. endef +define Build/Prepare + $(CP) $(LINUX_DIR)/tools/spi/* $(PKG_BUILD_DIR)/ +endef + +MAKE_FLAGS = \ + ARCH="$(LINUX_KARCH)" \ + CROSS_COMPILE="$(TARGET_CROSS)" \ + CC="$(TARGET_CC)" \ + LD="$(TARGET_CROSS)ld" \ + CFLAGS="$(TARGET_CFLAGS) $(TARGET_CPPFLAGS)" \ + LDFLAGS="$(TARGET_LDFLAGS)" \ + $(if $(findstring c,$(LIBRECMC_VERBOSE)),V=1,V='') \ + WERROR=0 \ + prefix=/usr + define Build/Compile - $(TARGET_CC) $(TARGET_CFLAGS) -o $(PKG_BUILD_DIR)/spidev_test \ - $(PKG_BUILD_DIR)/spidev_test.c + +$(MAKE_FLAGS) $(MAKE) $(PKG_JOBS) \ + -C $(PKG_BUILD_DIR) \ + -f Makefile \ + --no-print-directory endef define Package/spidev-test/install diff --git a/package/utils/spidev_test/src/spidev_test.c b/package/utils/spidev_test/src/spidev_test.c deleted file mode 100644 index 135b3f592b..0000000000 --- a/package/utils/spidev_test/src/spidev_test.c +++ /dev/null @@ -1,318 +0,0 @@ -/* - * SPI testing utility (using spidev driver) - * - * Copyright (c) 2007 MontaVista Software, Inc. - * Copyright (c) 2007 Anton Vorontsov - * - * 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. - * - * Cross-compile with cross-gcc -I/path/to/cross-kernel/include - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#define ARRAY_SIZE(a) (sizeof(a) / sizeof((a)[0])) - -static void pabort(const char *s) -{ - perror(s); - abort(); -} - -static const char *device = "/dev/spidev1.1"; -static uint32_t mode; -static uint8_t bits = 8; -static uint32_t speed = 500000; -static uint16_t delay; -static int verbose; - -uint8_t default_tx[] = { - 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, - 0x40, 0x00, 0x00, 0x00, 0x00, 0x95, - 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, - 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, - 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, - 0xF0, 0x0D, -}; - -uint8_t default_rx[ARRAY_SIZE(default_tx)] = {0, }; -char *input_tx; - -static void hex_dump(const void *src, size_t length, size_t line_size, char *prefix) -{ - int i = 0; - const unsigned char *address = src; - const unsigned char *line = address; - unsigned char c; - - printf("%s | ", prefix); - while (length-- > 0) { - printf("%02X ", *address++); - if (!(++i % line_size) || (length == 0 && i % line_size)) { - if (length == 0) { - while (i++ % line_size) - printf("__ "); - } - printf(" | "); /* right close */ - while (line < address) { - c = *line++; - printf("%c", (c < 33 || c == 255) ? 0x2E : c); - } - printf("\n"); - if (length > 0) - printf("%s | ", prefix); - } - } -} - -/* - * Unescape - process hexadecimal escape character - * converts shell input "\x23" -> 0x23 - */ -static int unescape(char *_dst, char *_src, size_t len) -{ - int ret = 0; - char *src = _src; - char *dst = _dst; - unsigned int ch; - - while (*src) { - if (*src == '\\' && *(src+1) == 'x') { - sscanf(src + 2, "%2x", &ch); - src += 4; - *dst++ = (unsigned char)ch; - } else { - *dst++ = *src++; - } - ret++; - } - return ret; -} - -static void transfer(int fd, uint8_t const *tx, uint8_t const *rx, size_t len) -{ - int ret; - - struct spi_ioc_transfer tr = { - .tx_buf = (unsigned long)tx, - .rx_buf = (unsigned long)rx, - .len = len, - .delay_usecs = delay, - .speed_hz = speed, - .bits_per_word = bits, - }; - - if (mode & SPI_TX_QUAD) - tr.tx_nbits = 4; - else if (mode & SPI_TX_DUAL) - tr.tx_nbits = 2; - if (mode & SPI_RX_QUAD) - tr.rx_nbits = 4; - else if (mode & SPI_RX_DUAL) - tr.rx_nbits = 2; - if (!(mode & SPI_LOOP)) { - if (mode & (SPI_TX_QUAD | SPI_TX_DUAL)) - tr.rx_buf = 0; - else if (mode & (SPI_RX_QUAD | SPI_RX_DUAL)) - tr.tx_buf = 0; - } - - ret = ioctl(fd, SPI_IOC_MESSAGE(1), &tr); - if (ret < 1) - pabort("can't send spi message"); - - if (verbose) - hex_dump(tx, len, 32, "TX"); - hex_dump(rx, len, 32, "RX"); -} - -static void print_usage(const char *prog) -{ - printf("Usage: %s [-DsbdlHOLC3]\n", prog); - puts(" -D --device device to use (default /dev/spidev1.1)\n" - " -s --speed max speed (Hz)\n" - " -d --delay delay (usec)\n" - " -b --bpw bits per word \n" - " -l --loop loopback\n" - " -H --cpha clock phase\n" - " -O --cpol clock polarity\n" - " -L --lsb least significant bit first\n" - " -C --cs-high chip select active high\n" - " -3 --3wire SI/SO signals shared\n" - " -v --verbose Verbose (show tx buffer)\n" - " -p Send data (e.g. \"1234\\xde\\xad\")\n" - " -N --no-cs no chip select\n" - " -R --ready slave pulls low to pause\n" - " -2 --dual dual transfer\n" - " -4 --quad quad transfer\n"); - exit(1); -} - -static void parse_opts(int argc, char *argv[]) -{ - while (1) { - static const struct option lopts[] = { - { "device", 1, 0, 'D' }, - { "speed", 1, 0, 's' }, - { "delay", 1, 0, 'd' }, - { "bpw", 1, 0, 'b' }, - { "loop", 0, 0, 'l' }, - { "cpha", 0, 0, 'H' }, - { "cpol", 0, 0, 'O' }, - { "lsb", 0, 0, 'L' }, - { "cs-high", 0, 0, 'C' }, - { "3wire", 0, 0, '3' }, - { "no-cs", 0, 0, 'N' }, - { "ready", 0, 0, 'R' }, - { "dual", 0, 0, '2' }, - { "verbose", 0, 0, 'v' }, - { "quad", 0, 0, '4' }, - { NULL, 0, 0, 0 }, - }; - int c; - - c = getopt_long(argc, argv, "D:s:d:b:lHOLC3NR24p:v", lopts, NULL); - - if (c == -1) - break; - - switch (c) { - case 'D': - device = optarg; - break; - case 's': - speed = atoi(optarg); - break; - case 'd': - delay = atoi(optarg); - break; - case 'b': - bits = atoi(optarg); - break; - case 'l': - mode |= SPI_LOOP; - break; - case 'H': - mode |= SPI_CPHA; - break; - case 'O': - mode |= SPI_CPOL; - break; - case 'L': - mode |= SPI_LSB_FIRST; - break; - case 'C': - mode |= SPI_CS_HIGH; - break; - case '3': - mode |= SPI_3WIRE; - break; - case 'N': - mode |= SPI_NO_CS; - break; - case 'v': - verbose = 1; - break; - case 'R': - mode |= SPI_READY; - break; - case 'p': - input_tx = optarg; - break; - case '2': - mode |= SPI_TX_DUAL; - break; - case '4': - mode |= SPI_TX_QUAD; - break; - default: - print_usage(argv[0]); - break; - } - } - if (mode & SPI_LOOP) { - if (mode & SPI_TX_DUAL) - mode |= SPI_RX_DUAL; - if (mode & SPI_TX_QUAD) - mode |= SPI_RX_QUAD; - } -} - -int main(int argc, char *argv[]) -{ - int ret = 0; - int fd; - uint8_t *tx; - uint8_t *rx; - int size; - - parse_opts(argc, argv); - - fd = open(device, O_RDWR); - if (fd < 0) - pabort("can't open device"); - - /* - * spi mode - */ - ret = ioctl(fd, SPI_IOC_WR_MODE32, &mode); - if (ret == -1) - pabort("can't set spi mode"); - - ret = ioctl(fd, SPI_IOC_RD_MODE32, &mode); - if (ret == -1) - pabort("can't get spi mode"); - - /* - * bits per word - */ - ret = ioctl(fd, SPI_IOC_WR_BITS_PER_WORD, &bits); - if (ret == -1) - pabort("can't set bits per word"); - - ret = ioctl(fd, SPI_IOC_RD_BITS_PER_WORD, &bits); - if (ret == -1) - pabort("can't get bits per word"); - - /* - * max speed hz - */ - ret = ioctl(fd, SPI_IOC_WR_MAX_SPEED_HZ, &speed); - if (ret == -1) - pabort("can't set max speed hz"); - - ret = ioctl(fd, SPI_IOC_RD_MAX_SPEED_HZ, &speed); - if (ret == -1) - pabort("can't get max speed hz"); - - printf("spi mode: 0x%x\n", mode); - printf("bits per word: %d\n", bits); - printf("max speed: %d Hz (%d KHz)\n", speed, speed/1000); - - if (input_tx) { - size = strlen(input_tx+1); - tx = malloc(size); - rx = malloc(size); - size = unescape((char *)tx, input_tx, size); - transfer(fd, tx, rx, size); - free(rx); - free(tx); - } else { - transfer(fd, default_tx, default_rx, sizeof(default_tx)); - } - - close(fd); - - return ret; -} diff --git a/package/utils/usbutils/Makefile b/package/utils/usbutils/Makefile index b4ee64e577..0a427a53e5 100644 --- a/package/utils/usbutils/Makefile +++ b/package/utils/usbutils/Makefile @@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=usbutils PKG_VERSION:=007 -PKG_RELEASE:=9 +PKG_RELEASE:=10 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz PKG_SOURCE_URL:=@KERNEL/linux/utils/usb/usbutils @@ -32,13 +32,13 @@ define Package/usbutils URL:=http://www.linux-usb.org/ endef -USB_IDS_VER:=0.315 +USB_IDS_VER:=0.321 USB_IDS_FILE:=usb.ids.$(USB_IDS_VER) define Download/usb_ids FILE:=$(USB_IDS_FILE) URL_FILE:=usb.ids - URL:=$(PROJECT_GIT)/hwdata/raw/v$(USB_IDS_VER) - HASH:=7454bd75fcfe5559bd1caa1bb132ecffe72a39269a2efaab9472de46be3bcf57 + URL:=@GITHUB/vcrhonek/hwdata/v$(USB_IDS_VER) + HASH:=00aa21766bb078186d2bc2cca9a2ae910aa2b787a810e97019b1b3f94c9453f2 endef $(eval $(call Download,usb_ids)) diff --git a/package/utils/xfsprogs/Makefile b/package/utils/xfsprogs/Makefile index 50a5147b04..353773840a 100644 --- a/package/utils/xfsprogs/Makefile +++ b/package/utils/xfsprogs/Makefile @@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=xfsprogs PKG_CPE_ID:=cpe:/a:sgi:xfsprogs -PKG_RELEASE:=2 +PKG_RELEASE:=3 PKG_VERSION:=4.11.0 PKG_SOURCE_URL:=@KERNEL/linux/utils/fs/xfs/xfsprogs PKG_HASH:=c3a6d87b564d7738243c507df82276bed982265e345363a95f2c764e8a5f5bb2 diff --git a/package/utils/xfsprogs/patches/130-db-malloc-Use-posix_memalign-instead-of-deprecated-v.patch b/package/utils/xfsprogs/patches/130-db-malloc-Use-posix_memalign-instead-of-deprecated-v.patch new file mode 100644 index 0000000000..7bf1c77a40 --- /dev/null +++ b/package/utils/xfsprogs/patches/130-db-malloc-Use-posix_memalign-instead-of-deprecated-v.patch @@ -0,0 +1,31 @@ +From 930f9aa8f08759fa739dd6e615ba8b3a1890008d Mon Sep 17 00:00:00 2001 +From: Rosen Penev +Date: Mon, 6 May 2019 13:56:13 -0700 +Subject: [PATCH] db/malloc: Use posix_memalign instead of deprecated valloc + +valloc is not available with uClibc-ng as well as being deprecated, which +causes compilation errors. aligned_alloc is not available before C11 so +used posix_memalign.' + +Signed-off-by: Rosen Penev +--- + db/malloc.c | 3 +-- + 1 file changed, 1 insertion(+), 2 deletions(-) + +diff --git a/db/malloc.c b/db/malloc.c +index 77b3e022..38fe0b05 100644 +--- a/db/malloc.c ++++ b/db/malloc.c +@@ -56,8 +56,7 @@ xmalloc( + { + void *ptr; + +- ptr = valloc(size); +- if (ptr) ++ if(!posix_memalign(&ptr, sysconf(_SC_PAGESIZE), size)) + return ptr; + badmalloc(); + /* NOTREACHED */ +-- +2.17.1 + diff --git a/scripts/clean-package.sh b/scripts/clean-package.sh index e580566a52..6dd9bf7306 100755 --- a/scripts/clean-package.sh +++ b/scripts/clean-package.sh @@ -1,4 +1,5 @@ #!/usr/bin/env bash +IFS=$'\n' [ -n "$1" -a -n "$2" ] || { echo "Usage: $0 " exit 1 diff --git a/scripts/download.pl b/scripts/download.pl index 32959e47de..34fd6a6f0b 100755 --- a/scripts/download.pl +++ b/scripts/download.pl @@ -197,6 +197,11 @@ foreach my $mirror (@ARGV) { push @mirrors, "https://mirror.netcologne.de/apache.org/$1"; push @mirrors, "https://mirror.aarnet.edu.au/pub/apache/$1"; push @mirrors, "https://mirror.csclub.uwaterloo.ca/apache/$1"; + push @mirrors, "http://mirror.cogentco.com/pub/apache/$1"; + push @mirrors, "http://mirror.navercorp.com/apache/$1"; + push @mirrors, "http://ftp.jaist.ac.jp/pub/apache/$1"; + push @mirrors, "ftp://apache.cs.utah.edu/apache.org/$1"; + push @mirrors, "ftp://apache.mirrors.ovh.net/ftp.apache.org/dist/$1"; } elsif ($mirror =~ /^\@GITHUB\/(.+)$/) { # give github a few more tries (different mirrors) for (1 .. 5) { @@ -205,9 +210,21 @@ foreach my $mirror (@ARGV) { } elsif ($mirror =~ /^\@GNU\/(.+)$/) { push @mirrors, "https://mirror.csclub.uwaterloo.ca/gnu/$1"; push @mirrors, "https://mirror.netcologne.de/gnu/$1"; + push @mirrors, "http://ftp.kddilabs.jp/GNU/gnu/$1"; + push @mirrors, "http://www.nic.funet.fi/pub/gnu/gnu/$1"; + push @mirrors, "http://mirror.internode.on.net/pub/gnu/$1"; + push @mirrors, "http://mirror.navercorp.com/gnu/$1"; + push @mirrors, "ftp://mirrors.rit.edu/gnu/$1"; + push @mirrors, "ftp://download.xs4all.nl/pub/gnu/"; } elsif ($mirror =~ /^\@SAVANNAH\/(.+)$/) { push @mirrors, "https://mirror.netcologne.de/savannah/$1"; push @mirrors, "https://mirror.csclub.uwaterloo.ca/nongnu/$1"; + push @mirrors, "http://ftp.acc.umu.se/mirror/gnu.org/savannah/$1"; + push @mirrors, "http://nongnu.uib.no/$1"; + push @mirrors, "http://ftp.igh.cnrs.fr/pub/nongnu/$1"; + push @mirrors, "http://public.p-knowledge.co.jp/Savannah-nongnu-mirror/$1"; + push @mirrors, "ftp://cdimage.debian.org/mirror/gnu.org/savannah/$1"; + push @mirrors, "ftp://ftp.acc.umu.se/mirror/gnu.org/savannah/$1"; } elsif ($mirror =~ /^\@KERNEL\/(.+)$/) { my @extra = ( $1 ); if ($filename =~ /linux-\d+\.\d+(?:\.\d+)?-rc/) { @@ -218,26 +235,32 @@ foreach my $mirror (@ARGV) { foreach my $dir (@extra) { push @mirrors, "https://cdn.kernel.org/pub/$dir"; push @mirrors, "https://mirror.rackspace.com/kernel.org/$dir"; + push @mirrors, "http://download.xs4all.nl/ftp.kernel.org/pub/$dir"; + push @mirrors, "http://mirrors.mit.edu/kernel/$dir"; + push @mirrors, "http://ftp.nara.wide.ad.jp/pub/kernel.org/$dir"; + push @mirrors, "http://www.ring.gr.jp/archives/linux/kernel.org/$dir"; + push @mirrors, "ftp://ftp.riken.jp/Linux/kernel.org/$dir"; + push @mirrors, "ftp://www.mirrorservice.org/sites/ftp.kernel.org/pub/$dir"; } - } elsif ($mirror =~ /^\@KERNEL_LIBRE\/(.+)$/) { - my @extra = ( $1 ); - if ($filename =~ /linux-libre-\d+\.\d+(?:\.\d+)?-rc-gnu/) { - push @extra, "$extra[0]/testing"; - } elsif ($filename =~ /linux-libre-(\d+\.\d+(?:\.\d+)?)-gnu/) { - push @extra, "$extra[0]/v$1"; - } - foreach my $dir (@extra) { - push @mirrors, "https://linux-libre.fsfla.org/pub/linux-libre/releases/$dir"; - } } elsif ($mirror =~ /^\@GNOME\/(.+)$/) { push @mirrors, "https://mirror.csclub.uwaterloo.ca/gnome/sources/$1"; + push @mirrors, "http://ftp.acc.umu.se/pub/GNOME/sources/$1"; + push @mirrors, "http://ftp.kaist.ac.kr/gnome/sources/$1"; + push @mirrors, "http://www.mirrorservice.org/sites/ftp.gnome.org/pub/GNOME/sources/$1"; + push @mirrors, "http://mirror.internode.on.net/pub/gnome/sources/$1"; + push @mirrors, "http://ftp.belnet.be/ftp.gnome.org/sources/$1"; + push @mirrors, "ftp://ftp.cse.buffalo.edu/pub/Gnome/sources/$1"; + push @mirrors, "ftp://ftp.nara.wide.ad.jp/pub/X11/GNOME/sources/$1"; } else { push @mirrors, $mirror; } } -push @mirrors, 'https://librecmc.org/librecmc/downloads/sources/v1.5'; +#push @mirrors, 'https://mirror1.openwrt.org'; +push @mirrors, 'https://sources.lede-project.org'; +push @mirrors, 'https://mirror2.openwrt.org/sources'; +push @mirrors, 'https://downloads.openwrt.org/sources'; while (!-f "$target/$filename") { my $mirror = shift @mirrors; diff --git a/scripts/gen_image_generic.sh b/scripts/gen_image_generic.sh index 206ba7f3fa..d9beeb0295 100755 --- a/scripts/gen_image_generic.sh +++ b/scripts/gen_image_generic.sh @@ -1,6 +1,6 @@ #!/usr/bin/env bash # Copyright (C) 2006-2012 OpenWrt.org -set -x +set -e -x [ $# == 5 -o $# == 6 ] || { echo "SYNTAX: $0 []" exit 1 diff --git a/scripts/getver.sh b/scripts/getver.sh index ac0cd678aa..d0b5dd7c63 100755 --- a/scripts/getver.sh +++ b/scripts/getver.sh @@ -12,7 +12,7 @@ try_version() { } try_git() { - REBOOT=1474ba39ab1bdfc29322ba6fde05d8c7eeff1a5f + REBOOT=fba6486b644f18ac2e7d27ccb6876ad80a83a60a git rev-parse --git-dir >/dev/null 2>&1 || return 1 [ -n "$GET_REV" ] || GET_REV="HEAD" diff --git a/scripts/metadata.pm b/scripts/metadata.pm index 5300e293e7..d088332152 100644 --- a/scripts/metadata.pm +++ b/scripts/metadata.pm @@ -131,6 +131,7 @@ sub parse_target_metadata($) { /^Target-Optimization:\s*(.+)\s*$/ and $target->{cflags} = $1; /^CPU-Type:\s*(.+)\s*$/ and $target->{cputype} = $1; /^Linux-Version:\s*(.+)\s*$/ and $target->{version} = $1; + /^Linux-Testing-Version:\s*(.+)\s*$/ and $target->{testing_version} = $1; /^Linux-Release:\s*(.+)\s*$/ and $target->{release} = $1; /^Linux-Kernel-Arch:\s*(.+)\s*$/ and $target->{karch} = $1; /^Default-Subtarget:\s*(.+)\s*$/ and $target->{def_subtarget} = $1; @@ -139,6 +140,8 @@ sub parse_target_metadata($) { $profile = { id => $1, name => $1, + has_image_metadata => 0, + supported_devices => [], priority => 999, packages => [] }; @@ -146,6 +149,8 @@ sub parse_target_metadata($) { push @{$target->{profiles}}, $profile; }; /^Target-Profile-Name:\s*(.+)\s*$/ and $profile->{name} = $1; + /^Target-Profile-hasImageMetadata:\s*(\d+)\s*$/ and $profile->{has_image_metadata} = $1; + /^Target-Profile-SupportedDevices:\s*(.+)\s*$/ and $profile->{supported_devices} = [ split(/\s+/, $1) ]; /^Target-Profile-Priority:\s*(\d+)\s*$/ and do { $profile->{priority} = $1; $target->{sort} = 1; diff --git a/scripts/package-metadata.pl b/scripts/package-metadata.pl index e0cdff1e81..76b09a56eb 100755 --- a/scripts/package-metadata.pl +++ b/scripts/package-metadata.pl @@ -358,14 +358,30 @@ sub gen_package_config() { print_package_overrides(); } +sub and_condition($) { + my $condition = shift; + my @spl_and = split('\&\&', $condition); + if (@spl_and == 1) { + return "\$(CONFIG_$spl_and[0])"; + } + return "\$(and " . join (',', map("\$(CONFIG_$_)", @spl_and)) . ")"; +} + +sub gen_condition ($) { + my $condition = shift; + # remove '!()', just as include/package-ipkg.mk does + $condition =~ s/[()!]//g; + return join("", map(and_condition($_), split('\|\|', $condition))); +} + sub get_conditional_dep($$) { my $condition = shift; my $depstr = shift; if ($condition) { if ($condition =~ /^!(.+)/) { - return "\$(if \$(CONFIG_$1),,$depstr)"; + return "\$(if " . gen_condition($1) . ",,$depstr)"; } else { - return "\$(if \$(CONFIG_$condition),$depstr)"; + return "\$(if " . gen_condition($condition) . ",$depstr)"; } } else { return $depstr; diff --git a/scripts/qemustart b/scripts/qemustart index 4f38facad9..ceeb13bc09 100755 --- a/scripts/qemustart +++ b/scripts/qemustart @@ -74,6 +74,7 @@ check_setup_() { } check_setup() { + [ -n "$o_network" ] || return 0 check_setup_ || { __errmsg "please check the script content to see the environment requirement" return 1 @@ -89,6 +90,7 @@ Usage: $SELF [-h|--help] [--kernel ] [--rootfs ] [--machine ] + [-n|--network] will default to "generic" and must be specified if are present @@ -119,12 +121,19 @@ rand_mac() { } parse_args() { + o_network= o_qemu_extra=() while [ "$#" -gt 0 ]; do + # Cmdline options for the script itself SHOULD try to be + # prefixed with two dashes to distinguish them from those for + # qemu executables. + # + # Also note that qemu accepts both --opt and -opt case "$1" in --kernel) o_kernel="$2"; shift 2 ;; --rootfs) o_rootfs="$2"; shift 2 ;; --machine|-machine|-M) o_mach="$2"; shift 2 ;; + --network|-n) o_network=1; shift ;; --help|-h) usage exit 0 @@ -185,9 +194,16 @@ start_qemu_armvirt() { ) } + [ -z "$o_network" ] || { + o_qemu_extra+=( \ + "-netdev" "bridge,id=lan,br=$BR_LAN,helper=$HELPER" \ + "-device" "virtio-net-pci,id=devlan,netdev=lan,mac=$MAC_LAN" \ + "-netdev" "bridge,id=wan,br=$BR_WAN,helper=$HELPER" "-device" \ + "virtio-net-pci,id=devwan,netdev=wan,mac=$MAC_WAN" \ + ) + } + "$qemu_exe" -machine "$mach" -cpu "$cpu" -nographic \ - -netdev bridge,id=lan,br="$BR_LAN,helper=$HELPER" -device virtio-net-pci,id=devlan,netdev=lan,mac="$MAC_LAN" \ - -netdev bridge,id=wan,br="$BR_WAN,helper=$HELPER" -device virtio-net-pci,id=devwan,netdev=wan,mac="$MAC_WAN" \ -kernel "$kernel" \ "${o_qemu_extra[@]}" } @@ -196,6 +212,7 @@ start_qemu_malta() { local is64 local isel local qemu_exe + local rootfs="$o_rootfs" local kernel="$o_kernel" local mach="${o_mach:-malta}" @@ -206,20 +223,36 @@ start_qemu_malta() { [ -n "$kernel" ] || kernel="$o_bindir/librecmc-malta-${o_subtarget%-*}-vmlinux-initramfs.elf" + [ -z "$rootfs" ] || { + if [ ! -f "$rootfs" -a -s "$rootfs.gz" ]; then + gunzip "$rootfs.gz" + fi + o_qemu_extra+=( \ + "-drive" "file=$rootfs,format=raw" \ + "-append" "root=/dev/sda rootwait" \ + ) + } + # NOTE: order of wan, lan -device arguments matters as it will affect which # one will be actually used as the wan, lan network interface inside the # guest machine + [ -z "$o_network" ] || { + o_qemu_extra+=( + -netdev bridge,id=wan,br="$BR_WAN,helper=$HELPER" -device pcnet,netdev=wan,mac="$MAC_WAN" + -netdev bridge,id=lan,br="$BR_LAN,helper=$HELPER" -device pcnet,netdev=lan,mac="$MAC_LAN" + ) + } + "$qemu_exe" -machine "$mach" -nographic \ - -netdev bridge,id=wan,br="$BR_WAN,helper=$HELPER" -device pcnet,netdev=wan,mac="$MAC_WAN" \ - -netdev bridge,id=lan,br="$BR_LAN,helper=$HELPER" -device pcnet,netdev=lan,mac="$MAC_LAN" \ -kernel "$kernel" \ "${o_qemu_extra[@]}" } start_qemu_x86() { + local qemu_exe + local kernel="$o_kernel" local rootfs="$o_rootfs" local mach="${o_mach:-pc}" - local qemu_exe [ -n "$rootfs" ] || { rootfs="$o_bindir/librecmc-$o_target-${o_subtarget%-*}-combined-ext4.img" @@ -241,6 +274,30 @@ start_qemu_x86() { ;; esac + [ -n "$kernel" ] && { + o_qemu_extra+=( \ + "-kernel" "$kernel" \ + "-append" "root=/dev/vda console=ttyS0 rootwait" \ + ) + } + + [ -z "$o_network" ] || { + case "${o_subtarget%-*}" in + legacy) + o_qemu_extra+=( + -netdev "bridge,id=lan,br=$BR_LAN,helper=$HELPER" -device "e1000,id=devlan,netdev=lan,mac=$MAC_LAN" + -netdev "bridge,id=wan,br=$BR_WAN,helper=$HELPER" -device "e1000,id=devwan,netdev=wan,mac=$MAC_WAN" + ) + ;; + generic|64) + o_qemu_extra+=( + -netdev "bridge,id=lan,br=$BR_LAN,helper=$HELPER" -device "virtio-net-pci,id=devlan,netdev=lan,mac=$MAC_LAN" + -netdev "bridge,id=wan,br=$BR_WAN,helper=$HELPER" -device "virtio-net-pci,id=devwan,netdev=wan,mac=$MAC_WAN" + ) + ;; + esac + } + case "${o_subtarget%-*}" in legacy) # use IDE (PATA) disk instead of AHCI (SATA). Refer to link @@ -254,16 +311,12 @@ start_qemu_x86() { # # [1] https://dev.openwrt.org/ticket/17947 "$qemu_exe" -machine "$mach" -nographic \ - -netdev bridge,id=lan,br="$BR_LAN,helper=$HELPER" -device e1000,id=devlan,netdev=lan,mac="$MAC_LAN" \ - -netdev bridge,id=wan,br="$BR_WAN,helper=$HELPER" -device e1000,id=devwan,netdev=wan,mac="$MAC_WAN" \ -device ide-drive,drive=drv0 \ -drive "file=$rootfs,format=raw,id=drv0,if=none" \ "${o_qemu_extra[@]}" ;; generic|64) "$qemu_exe" -machine "$mach" -nographic \ - -netdev bridge,id=lan,br="$BR_LAN,helper=$HELPER" -device virtio-net-pci,id=devlan,netdev=lan,mac="$MAC_LAN" \ - -netdev bridge,id=wan,br="$BR_WAN,helper=$HELPER" -device virtio-net-pci,id=devwan,netdev=wan,mac="$MAC_WAN" \ -drive "file=$rootfs,format=raw,if=virtio" \ "${o_qemu_extra[@]}" ;; @@ -282,6 +335,6 @@ start_qemu() { esac } -check_setup \ - && parse_args "$@" \ +parse_args "$@" \ + && check_setup \ && start_qemu diff --git a/scripts/target-metadata.pl b/scripts/target-metadata.pl index ef0a34eb4f..d183e943f6 100755 --- a/scripts/target-metadata.pl +++ b/scripts/target-metadata.pl @@ -42,6 +42,7 @@ sub target_config_features(@) { /^virtio$/ and $ret .= "\tselect VIRTIO_SUPPORT\n"; /^rootfs-part$/ and $ret .= "\tselect USES_ROOTFS_PART\n"; /^boot-part$/ and $ret .= "\tselect USES_BOOT_PART\n"; + /^testing-kernel$/ and $ret .= "\tselect HAS_TESTING_KERNEL\n"; } return $ret; } @@ -83,11 +84,14 @@ sub print_target($) { } my $v = kver($target->{version}); + my $tv = kver($target->{testing_version}); + $tv or $tv = $v; if (@{$target->{subtargets}} == 0) { $confstr = <{conf} bool "$target->{name}" - select LINUX_$v + select LINUX_$v if !TESTING_KERNEL + select LINUX_$tv if TESTING_KERNEL EOF } else { @@ -170,7 +174,7 @@ EOF print <{version}); - next if $kver{$v}; - $kver{$v} = 1; - print <{version}, $target->{testing_version}) { + next unless $tv; + my $v = kver($tv); + next if $kver{$v}; + $kver{$v} = 1; + print <{id} } @{$cur->{profiles}})."\n"; foreach my $profile (@{$cur->{profiles}}) { print $profile->{id}.'_NAME:='.$profile->{name}."\n"; + print $profile->{id}.'_HAS_IMAGE_METADATA:='.$profile->{has_image_metadata}."\n"; + if (defined($profile->{supported_devices}) and @{$profile->{supported_devices}} > 0) { + print $profile->{id}.'_SUPPORTED_DEVICES:='.join(' ', @{$profile->{supported_devices}})."\n"; + } print $profile->{id}.'_PACKAGES:='.join(' ', @{$profile->{packages}})."\n"; } } diff --git a/scripts/ubinize-image.sh b/scripts/ubinize-image.sh index 09a00b1898..a18d6dc428 100755 --- a/scripts/ubinize-image.sh +++ b/scripts/ubinize-image.sh @@ -9,7 +9,7 @@ outfile="" err="" get_magic_word() { - dd if=$1 bs=2 count=1 2>/dev/null | hexdump -v -n 2 -e '1/1 "%02x"' + dd if=$1 bs=2 count=1 2>/dev/null | od -A n -N 2 -t x1 | tr -d ' ' } is_ubifs() { diff --git a/target/Config.in b/target/Config.in index 3cf4231f2a..3ee23ebf7f 100644 --- a/target/Config.in +++ b/target/Config.in @@ -2,6 +2,9 @@ source "tmp/.config-target.in" # Kernel/Hardware features +config HAS_TESTING_KERNEL + bool + config HAS_SPE_FPU depends on powerpc select HAS_FPU diff --git a/target/Makefile b/target/Makefile index 7c17adb502..7ad26c7177 100644 --- a/target/Makefile +++ b/target/Makefile @@ -7,13 +7,12 @@ curdir:=target $(curdir)/subtargets:=install -$(curdir)/builddirs:=linux sdk imagebuilder toolchain ccsdisk +$(curdir)/builddirs:=linux sdk imagebuilder toolchain $(curdir)/builddirs-default:=linux -$(curdir)/builddirs-install:=linux $(if $(CONFIG_SDK),sdk) $(if $(CONFIG_IB),imagebuilder) $(if $(CONFIG_MAKE_TOOLCHAIN),toolchain) $(if $(CONFIG_CCS),ccsdisk) +$(curdir)/builddirs-install:=linux $(if $(CONFIG_SDK),sdk) $(if $(CONFIG_IB),imagebuilder) $(if $(CONFIG_MAKE_TOOLCHAIN),toolchain) $(curdir)/sdk/install:=$(curdir)/linux/install $(curdir)/imagebuilder/install:=$(curdir)/linux/install -$(curdir)/ccsdisk/install:=$(curdir)/ccsdisk/install $(eval $(call stampfile,$(curdir),target,prereq,.config)) $(eval $(call stampfile,$(curdir),target,compile,$(TMP_DIR)/.build)) diff --git a/target/ccsdisk/Config.in b/target/ccsdisk/Config.in deleted file mode 100644 index 246eaa6c30..0000000000 --- a/target/ccsdisk/Config.in +++ /dev/null @@ -1,25 +0,0 @@ -menuconfig CCS - bool "Build the libreCMC CCS (Complete Corresponding Source) Disk" - depends on !EXTERNAL_TOOLCHAIN - default BUILDBOT - help - This generates a CCS disk for distribution with devices that ship - with libreCMC. Note that this may omit some components, ex. u-boot - for a given target, which should be part of the CCS. Please see /docs/ccs.md - - config CCS_GIT_UPSTREAM - string "Enter source repository to clone" if CCS - default "https://gogs.librecmc.org/librecmc/librecmc" if !CCS_GIT_TOPDIR - help - The git repository specified here is for the corresponding libreCMC - Buildroot that was used to build and generate firmware images. - - config CCS_GIT_TOPDIR - bool "Use local checkout for sources" if CCS - help - This option will use the current checkout for the libreCMC Buildroot - source. If using this option, make sure that all changes have been - properly checked in. - - - diff --git a/target/ccsdisk/Makefile b/target/ccsdisk/Makefile deleted file mode 100644 index b8e5c8590d..0000000000 --- a/target/ccsdisk/Makefile +++ /dev/null @@ -1,41 +0,0 @@ -# -# Copyright (C) 2019 Robert Call -# -# This is free software, licensed under the GNU General Public License v2. -# See /LICENSE for more information. -# - -include $(TOPDIR)/rules.mk -include $(INCLUDE_DIR)/kernel.mk -include $(INCLUDE_DIR)/version.mk - -override MAKEFLAGS= - -CCS_NAME:=$(VERSION_DIST_SANITIZED)-$(VERSION_NUMBER)-src -CCS_BUILD_DIR:=$(BUILD_DIR)/$(CCS_NAME) -ISO_BUILD_DIR:=$(CCS_BUILD_DIR)/iso - -all: install - -$(BIN_DIR)/$(CCS_NAME).tar.gz: - mkdir -p $(BIN_DIR) - mkdir -p $(CCS_BUILD_DIR) - $(if $(CONFIG_CCS_GIT_TOPDIR),(cd $(CCS_BUILD_DIR); git clone $(TOPDIR) librecmc),(cd $(CCS_BUILD_DIR); git clone $(CONFIG_CCS_GIT_UPSTREAM) librecmc)) - $(CP) $(TOPDIR)/.config $(CCS_BUILD_DIR)/librecmc - $(CP) -r $(TOPDIR)/dl $(CCS_BUILD_DIR)/librecmc/ - -createiso: - mkdir -p $(ISO_BUILD_DIR)/bin/$(BOARD) - (cd $(CCS_BUILD_DIR); $(TAR) -czf $(ISO_BUILD_DIR)/$(CCS_NAME).tar.gz librecmc) - $(CP) ./files/README $(ISO_BUILD_DIR) - $(CP) $(BIN_DIR) $(ISO_BUILD_DIR)/bin/$(BOARD) - $(VERSION_SED_SCRIPT) $(ISO_BUILD_DIR)/README - genisoimage -J -joliet-long -r -o $(BIN_DIR)/$(CCS_NAME).iso $(ISO_BUILD_DIR) - -download: -compile: -install: clean $(BIN_DIR)/$(CCS_NAME).tar.gz createiso - - -clean: - rm -rf $(CCS_BUILD_DIR) $(BIN_DIR)/$(CCS_NAME).tar.gz $(BIN_DIR)/$(CCS_NAME)-src.iso diff --git a/target/ccsdisk/files/README b/target/ccsdisk/files/README deleted file mode 100644 index 840888f1d4..0000000000 --- a/target/ccsdisk/files/README +++ /dev/null @@ -1,94 +0,0 @@ - ____ _____ ____ - _ _ _ | __|| || __| - | (_) |__ _ _ ___ | | | | | || | - | | | '_ \ '_/ -_)| |__ | | | || |__ - |_|_|_.__/_| \___||____||_|_|_||____| - ----------------------------------------- - The libre embedded GNU/Linux distro. - -This compact disk contains the source code and firmware images -for the %T line of routers. - - -Disk Layout: -============================ - -/bin/%T/* : Contains firmware images for %T family of routers - - -libreCMC-%V-src.tar.gz : The full libreCMC source code w/ original configuration. - - -Building libreCMC image from source: -============================ - -To build your own firmware, you need to have access to a GNU/Linux system -(case-sensitive filesystem required) with the following installed : - -gcc, binutils, bzip2, flex, python, perl, make, find, -grep, diff, unzip, gawk, getopt, libssl-dev (openssl-devel), libz-dev and libc headers. - -References to this and other documentation use : "$LIBRECMC_SRC" , which -is the directory where the libreCMC source code resides. - -Before starting, please extract : libreCMC-%V.tar.gz - -tar fxv librecmc-%V.tar.gz - -cd libreCMC/ - -Within the libreCMC src. directory (in this case, trunk), please use "make menuconfig" to create your -desired configuration for the toolchain and firmware. Please note that the default configuration is -what was used to build the firmware image for your router. It is advised that you use this configuration. If -you need to restore the default configuration, copy librecmc_config to libreCMC/trunk/.config - -Simply running "make" will build your firmware. The build system will extract all included sources, -build the cross-compile toolchain, the kernel and all chosen applications. If there is an issue, please run: - -make V=s - -This will show debugging output and give a clue as to why the build failed. - -When the build completes without any issues, the resulting librecmc-ar71xx-generic-tpe-r1100-squashfs-sysupgrade.bin image will -be found in : $SRC_ROOT/bin/targets/ar71xx/ - -Flashing The libreCMC firmware -============================ - -1) Open a web browser and go to : https://192.168.10.1 - -2) You will see a security warning because SSL cert is self- -signed. Click the "understand the risks" and then "add exception" buttons. - -3) Enter the admin password for the router (stock password is : none ) - -4) The backup / flash utility is under "System -> Backup / Flash Firmware". - -5) Make sure to backup your configuration (if you are upgrading to a new release) -by clicking the "Generate archive" button. This will download a file named -backup-libreCMC-$(DATE).tar.gz - -6) Upload the new firmware by clicking the "browse" button under "Flash new firmware image". -If you wish to keep your current settings, make sure that the "Keep Settings" checkbox is -checked. If the file name is correct, make sure to click the "Flash Image" button. - -7) Wait a about 1 - 2.5 min. The router will restart itself then the page should refresh, bringing -you back to the login page. - - -Final Words -============================ - -We would like to thank you for supporting the libreCMC project. If you find any -software in this release that is non-free software, please report it to info@librecmc.org. -We will review the offending piece of software and devise a workaround or patch. -libreCMC aims to always be a 100% libre Free Software project. - - -Happy Hacking, - - Your libreCMC Project - http://librecmc.org - info@librecmc.org - - diff --git a/target/imagebuilder/files/Makefile b/target/imagebuilder/files/Makefile index 4fa4d3514c..280094f34a 100644 --- a/target/imagebuilder/files/Makefile +++ b/target/imagebuilder/files/Makefile @@ -45,6 +45,7 @@ Building images: make image FILES="" # include extra files from make image BIN_DIR="" # alternative output directory for the images make image EXTRA_IMAGE_NAME="" # Add this to the output image filename (sanitized) + make image DISABLED_SERVICES=" [ [ ..]]" # Which services in /etc/init.d/ should be disabled Print manifest: List "all" packages which get installed into the image. @@ -73,8 +74,10 @@ include $(INCLUDE_DIR)/target.mk USER_PROFILE ?= $(firstword $(PROFILE_NAMES)) PROFILE_LIST = $(foreach p,$(PROFILE_NAMES), \ - echo '$(patsubst DEVICE_%,%,$(p)):'; $(if $($(p)_NAME),echo ' $(subst ','"'"',$($(p)_NAME))'; ) echo ' Packages: $($(p)_PACKAGES)'; \ -) + echo '$(patsubst DEVICE_%,%,$(p)):'; $(if $($(p)_NAME),echo ' $(subst ','"'"',$($(p)_NAME))'; ) \ + echo ' Packages: $($(p)_PACKAGES)'; echo ' hasImageMetadata: $($(p)_HAS_IMAGE_METADATA)'; \ + $(if $($(p)_SUPPORTED_DEVICES),echo ' SupportedDevices: $($(p)_SUPPORTED_DEVICES)';) ) + .profiles.mk: .targetinfo @$(SCRIPT_DIR)/target-metadata.pl profile_mk $< '$(BOARD)$(if $(SUBTARGET),/$(SUBTARGET))' > $@ @@ -94,7 +97,8 @@ staging_dir/host/.prereq-build: include/prereq-build.mk touch $@ _call_info: FORCE - echo 'Current Target: "$(BOARD)$(if $(SUBTARGET), ($(BOARDNAME)))"' + echo 'Current Target: "$(TARGETID)"' + echo 'Current Revision: "$(REVISION)"' echo 'Default Packages: $(DEFAULT_PACKAGES)' echo 'Available Profiles:' echo; $(PROFILE_LIST) @@ -157,7 +161,7 @@ prepare_rootfs: FORCE @echo Finalizing root filesystem... $(CP) $(TARGET_DIR) $(TARGET_DIR_ORIG) - $(call prepare_rootfs,$(TARGET_DIR),$(USER_FILES)) + $(call prepare_rootfs,$(TARGET_DIR),$(USER_FILES),$(DISABLED_SERVICES)) build_image: FORCE @echo @@ -195,7 +199,8 @@ image: $(if $(PROFILE),USER_PROFILE="$(PROFILE_FILTER)") \ $(if $(FILES),USER_FILES="$(FILES)") \ $(if $(PACKAGES),USER_PACKAGES="$(PACKAGES)") \ - $(if $(BIN_DIR),BIN_DIR="$(BIN_DIR)")) + $(if $(BIN_DIR),BIN_DIR="$(BIN_DIR)") \ + $(if $(DISABLED_SERVICES),DISABLED_SERVICES="$(DISABLED_SERVICES)")) manifest: FORCE $(MAKE) -s _check_profile diff --git a/target/linux/ar71xx/base-files/etc/board.d/01_leds b/target/linux/ar71xx/base-files/etc/board.d/01_leds index edca185c62..8e49cb9fe2 100755 --- a/target/linux/ar71xx/base-files/etc/board.d/01_leds +++ b/target/linux/ar71xx/base-files/etc/board.d/01_leds @@ -124,8 +124,8 @@ archer-c5|\ archer-c7) ucidef_set_led_usbport "usb1" "USB1" "tp-link:green:usb1" "usb1-port1" ucidef_set_led_usbport "usb2" "USB2" "tp-link:green:usb2" "usb2-port1" - ucidef_set_led_wlan "wlan2g" "WLAN2G" "tp-link:blue:wlan2g" "phy1tpt" - ucidef_set_led_wlan "wlan5g" "WLAN5G" "tp-link:blue:wlan5g" "phy0tpt" + ucidef_set_led_wlan "wlan2g" "WLAN2G" "tp-link:green:wlan2g" "phy1tpt" + ucidef_set_led_wlan "wlan5g" "WLAN5G" "tp-link:green:wlan5g" "phy0tpt" ;; archer-c58-v1|\ archer-c59-v1|\ @@ -179,6 +179,7 @@ bsb) ucidef_set_led_default "sys" "SYS" "$board:red:sys" "1" ;; bullet-m|\ +bullet-m-xw|\ loco-m-xw|\ nanostation-m|\ nanostation-m-xw|\ @@ -252,6 +253,7 @@ cf-e530n) ;; cpe210|\ cpe210-v2|\ +cpe210-v3|\ cpe510|\ wbs210|\ wbs510) @@ -262,7 +264,8 @@ wbs510) ucidef_set_led_rssi "rssihigh" "RSSIHIGH" "tp-link:green:link4" "wlan0" "76" "100" "-75" "13" case "$board" in - cpe210-v2) + cpe210-v2|\ + cpe210-v3) ucidef_set_led_netdev "lan" "LAN" "tp-link:green:lan0" "eth0" ;; *) @@ -670,7 +673,8 @@ rb-2011l|\ rb-2011uas|\ rb-2011uas-2hnd|\ rb-2011uias|\ -rb-2011uias-2hnd) +rb-2011uias-2hnd|\ +rb-2011uias-2hnd-r2) ucidef_set_led_switch "eth6" "ETH6" "rb:green:eth6" "switch1" "0x20" ucidef_set_led_switch "eth7" "ETH7" "rb:green:eth7" "switch1" "0x10" ucidef_set_led_switch "eth8" "ETH8" "rb:green:eth8" "switch1" "0x08" diff --git a/target/linux/ar71xx/base-files/etc/board.d/02_network b/target/linux/ar71xx/base-files/etc/board.d/02_network index 13dfd2b000..1fcfa43c4b 100755 --- a/target/linux/ar71xx/base-files/etc/board.d/02_network +++ b/target/linux/ar71xx/base-files/etc/board.d/02_network @@ -68,12 +68,14 @@ ar71xx_setup_interfaces() ap91-5g|\ aw-nr580|\ bullet-m|\ + bullet-m-xw|\ c-55|\ cap324|\ cap4200ag|\ cf-e380ac-v1|\ cf-e380ac-v2|\ cpe210-v2|\ + cpe210-v3|\ dr342|\ eap120|\ eap300v2|\ @@ -107,9 +109,11 @@ ar71xx_setup_interfaces() rb-912uag-2hpnd|\ rb-912uag-5hpnd|\ rb-921gs-5hpacd-r2|\ + rb-922uags-5hpacd|\ rb-lhg-5nd|\ rb-mapl-2nd|\ rb-sxt2n|\ + rb-sxt-2nd-r3|\ rb-sxt5n|\ rb-wap-2nd|\ rb-wapr-2nd|\ @@ -156,7 +160,6 @@ ar71xx_setup_interfaces() a60|\ alfa-ap96|\ alfa-nx|\ - archer-c25-v1|\ dr344|\ gl-ar150|\ gl-ar300m|\ @@ -178,20 +181,10 @@ ar71xx_setup_interfaces() wrtnode2q) ucidef_set_interfaces_lan_wan "eth1" "eth0" ;; - rb-750-r2|\ - rb-750p-pbr2|\ - rb-750up-r2|\ - rb-951ui-2nd|\ - rb-952ui-5ac2nd) - ucidef_set_interfaces_lan_wan "eth1.1" "eth0" - ucidef_add_switch "switch0" \ - "0@eth1" "1:lan:4" "2:lan:3" "3:lan:2" "4:lan:1" - ;; all0258n|\ all0315n|\ dlan-hotspot|\ dlan-pro-500-wp|\ - ens202ext|\ ja76pf2|\ rocket-m-ti|\ ubnt-unifi-outdoor) @@ -245,6 +238,16 @@ ar71xx_setup_interfaces() ucidef_add_switch "switch0" \ "0@eth1" "2:lan" "3:lan" "4:lan" "5:lan" "6@eth0" "1:wan" ;; + archer-c25-v1|\ + rb-750-r2|\ + rb-750p-pbr2|\ + rb-750up-r2|\ + rb-951ui-2nd|\ + rb-952ui-5ac2nd) + ucidef_set_interfaces_lan_wan "eth1.1" "eth0" + ucidef_add_switch "switch0" \ + "0@eth1" "1:lan:4" "2:lan:3" "3:lan:2" "4:lan:1" + ;; archer-c58-v1|\ archer-c59-v1|\ archer-c59-v2|\ @@ -332,12 +335,14 @@ ar71xx_setup_interfaces() rb-2011uas|\ rb-2011uas-2hnd|\ rb-2011uias|\ - rb-2011uias-2hnd) + rb-2011uias-2hnd|\ + rb-2011uias-2hnd-r2) case "$board" in rb-2011ils|\ rb-2011uas*|\ rb-2011uias|\ - rb-2011uias-2hnd) + rb-2011uias-2hnd|\ + rb-2011uias-2hnd-r2) ucidef_add_switch "switch0" \ "0@eth0" "2:lan" "3:lan" "4:lan" "5:lan" "1:wan" "6:sfp" ;; @@ -580,6 +585,11 @@ ar71xx_setup_interfaces() ucidef_add_switch "switch0" \ "0@eth0" "1:lan:1" "2:lan:2" "3:lan:3" "4:lan:4" "5:wan" ;; + ens202ext) + ucidef_set_interfaces_lan_wan "eth1.1" "eth1.2" + ucidef_add_switch "switch0" \ + "0@eth1" "2:lan:1" "3:lan:2" "4:lan:3" "5:lan:4" "1:wan" + ;; *) ucidef_set_interfaces_lan_wan "eth0" "eth1" ;; @@ -597,6 +607,10 @@ ar71xx_setup_macs() base_mac=$(mtd_get_mac_binary config 8) wan_mac=$(macaddr_add "$base_mac" 1) ;; + archer-c7-v5) + base_mac=$(mtd_get_mac_binary info 8) + wan_mac=$(macaddr_add "$base_mac" 1) + ;; dgl-5500-a1|\ dir-825-c1) wan_mac=$(mtd_get_mac_ascii nvram "wan_mac") @@ -637,10 +651,60 @@ ar71xx_setup_macs() [ -n "$wan_mac" ] && ucidef_set_interface_macaddr "wan" $wan_mac } +ar71xx_setup_ar8xxx_switch() +{ + local board="$1" + + case $board in + ap147-010|\ + archer-c25-v1|\ + archer-c58-v1|\ + archer-c59-v1|\ + archer-c59-v2|\ + archer-c60-v1|\ + archer-c60-v2|\ + archer-c7-v4|\ + archer-c7-v5|\ + cf-e375ac|\ + cf-e385ac|\ + cr3000|\ + dhp-1565-a1|\ + mynet-n600|\ + rb-2011il|\ + rb-2011ils|\ + rb-2011l|\ + rb-2011uas|\ + rb-2011uas-2hnd|\ + rb-2011uias|\ + rb-2011uias-2hnd|\ + rb-2011uias-2hnd-r2|\ + rb-750|\ + rb-750p-pbr2|\ + rb-750-r2|\ + rb-750up-r2|\ + rb-951ui-2nd|\ + rb-952ui-5ac2nd|\ + rb-map-2nd|\ + tl-wr1043nd-v4|\ + tl-wr1043n-v5|\ + wndr3700v4|\ + wndr3700v4|\ + wndr4300|\ + wnr1000-v2|\ + wnr2000-v3|\ + wnr2200|\ + wnr612-v2|\ + wpn824n) + ucidef_set_ar8xxx_switch_mib "switch0" 0 500 + ;; + esac +} + board_config_update board=$(board_name) ar71xx_setup_interfaces $board ar71xx_setup_macs $board +ar71xx_setup_ar8xxx_switch $board board_config_flush exit 0 diff --git a/target/linux/ar71xx/base-files/etc/diag.sh b/target/linux/ar71xx/base-files/etc/diag.sh index 3c9f17d8c3..8ff75627a5 100644 --- a/target/linux/ar71xx/base-files/etc/diag.sh +++ b/target/linux/ar71xx/base-files/etc/diag.sh @@ -85,8 +85,6 @@ get_status_led() { tl-wr902ac-v1) status_led="$board:green:power" ;; - archer-c5|\ - archer-c7|\ tl-mr10u|\ tl-mr12u|\ tl-mr13u|\ @@ -129,6 +127,7 @@ get_status_led() { status_led="$board:red:sys" ;; bullet-m|\ + bullet-m-xw|\ loco-m-xw|\ nano-m|\ nanostation-m|\ @@ -381,6 +380,7 @@ get_status_led() { rb-lhg-5nd|\ rb-map-2nd|\ rb-mapl-2nd|\ + rb-sxt-2nd-r3|\ rb-wap-2nd|\ rb-wapr-2nd) status_led="rb:green:user" @@ -448,6 +448,8 @@ get_status_led() { tl-mr6400) status_led="tp-link:white:power" ;; + archer-c5|\ + archer-c7|\ tl-mr3220|\ tl-mr3220-v2|\ tl-mr3420|\ diff --git a/target/linux/ar71xx/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom b/target/linux/ar71xx/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom index 94bce7d335..208d5f6bff 100644 --- a/target/linux/ar71xx/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom +++ b/target/linux/ar71xx/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom @@ -20,7 +20,7 @@ ath9k_eeprom_extract() { [ -n "$mtd" ] || \ ath9k_eeprom_die "no mtd device found for partition $part" - dd if=$mtd of=/lib/firmware/$FIRMWARE bs=1 skip=$offset count=$count 2>/dev/null || \ + dd if=$mtd of=/lib/firmware/$FIRMWARE iflag=skip_bytes bs=$count skip=$offset count=1 2>/dev/null || \ ath9k_eeprom_die "failed to extract from $mtd" } @@ -35,7 +35,7 @@ ath9k_ubi_eeprom_extract() { [ -n "$ubi" ] || \ ath9k_eeprom_die "no UBI volume found for $part" - dd if=/dev/$ubi of=/lib/firmware/$FIRMWARE bs=1 skip=$offset count=$count 2>/dev/null || \ + dd if=/dev/$ubi of=/lib/firmware/$FIRMWARE iflag=skip_bytes bs=$count skip=$offset count=1 2>/dev/null || \ ath9k_eeprom_die "failed to extract from $ubi" } @@ -62,7 +62,7 @@ ath9k_patch_firmware_mac() { [ -z "$mac" ] && return - macaddr_2bin $mac | dd of=/lib/firmware/$FIRMWARE conv=notrunc bs=1 seek=2 count=6 + macaddr_2bin $mac | dd of=/lib/firmware/$FIRMWARE conv=notrunc oflag=seek_bytes bs=6 seek=2 count=1 } board=$(board_name) diff --git a/target/linux/ar71xx/base-files/etc/hotplug.d/net/10-ar922x-led-fix b/target/linux/ar71xx/base-files/etc/hotplug.d/net/10-ar922x-led-fix index c41d4b08f6..bd1abb9681 100644 --- a/target/linux/ar71xx/base-files/etc/hotplug.d/net/10-ar922x-led-fix +++ b/target/linux/ar71xx/base-files/etc/hotplug.d/net/10-ar922x-led-fix @@ -12,6 +12,9 @@ devdir=$(dirname $DEVPATH) devdir=$(dirname $devdir) phydir=/sys$devdir/ieee80211 + +[ -d $phydir ] || exit 0 + phyname=$(cat $phydir/phy*/name) [ -z $phyname -o $ACTION != "add" ] && exit 0 diff --git a/target/linux/ar71xx/base-files/lib/ar71xx.sh b/target/linux/ar71xx/base-files/lib/ar71xx.sh index 95fa247f4b..894835b14d 100755 --- a/target/linux/ar71xx/base-files/lib/ar71xx.sh +++ b/target/linux/ar71xx/base-files/lib/ar71xx.sh @@ -16,7 +16,7 @@ ar71xx_get_mtd_offset_size_format() { dev=$(find_mtd_part $mtd) [ -z "$dev" ] && return - dd if=$dev bs=1 skip=$offset count=$size 2>/dev/null | hexdump -v -e "1/1 \"$format\"" + dd if=$dev iflag=skip_bytes bs=$size skip=$offset count=1 2>/dev/null | hexdump -v -e "1/1 \"$format\"" } ar71xx_get_mtd_part_magic() { @@ -390,7 +390,169 @@ tplink_pharos_v2_get_model_string() { part=$(find_mtd_part 'product-info') [ -z "$part" ] && return 1 - dd if=$part bs=1 skip=4360 count=64 2>/dev/null | tr -d '\r\0' | head -n 1 + dd if=$part iflag=skip_bytes bs=64 skip=4360 count=1 2>/dev/null | tr -d '\r\0' | head -n 1 +} + +mikrotik_board_detect() { + local machine="$1" + + case "$machine" in + *"2011iL") + name="rb-2011il" + ;; + *"2011iLS") + name="rb-2011ils" + ;; + *"2011L") + name="rb-2011l" + ;; + *"2011UAS") + name="rb-2011uas" + ;; + *"2011UAS-2HnD") + name="rb-2011uas-2hnd" + ;; + *"2011UiAS") + name="rb-2011uias" + ;; + *"2011UiAS-2HnD") + name="rb-2011uias-2hnd" + ;; + *"2011UiAS-2HnD r2") + name="rb-2011uias-2hnd-r2" + ;; + *"411/A/AH") + name="rb-411" + ;; + *"411U") + name="rb-411u" + ;; + *"433/AH") + name="rb-433" + ;; + *"433UAH") + name="rb-433u" + ;; + *"435G") + name="rb-435g" + ;; + *"450") + name="rb-450" + ;; + *"450G") + name="rb-450g" + ;; + *"493/AH") + name="rb-493" + ;; + *"493G") + name="rb-493g" + ;; + *"750") + name="rb-750" + ;; + *"750 r2"|\ + *"750r2") + name="rb-750-r2" + ;; + *"750GL") + name="rb-750gl" + ;; + *"750P r2") + name="rb-750p-pbr2" + ;; + *"750UP r2"|\ + *"750UPr2") + name="rb-750up-r2" + ;; + *"751") + name="rb-751" + ;; + *"751G") + name="rb-751g" + ;; + *"911-2Hn") + name="rb-911-2hn" + ;; + *"911-5Hn") + name="rb-911-5hn" + ;; + *"911G-2HPnD") + name="rb-911g-2hpnd" + ;; + *"911G-5HPacD") + name="rb-911g-5hpacd" + ;; + *"911G-5HPnD") + name="rb-911g-5hpnd" + ;; + *"912UAG-2HPnD") + name="rb-912uag-2hpnd" + ;; + *"912UAG-5HPnD") + name="rb-912uag-5hpnd" + ;; + *"921GS-5HPacD r2") + name="rb-921gs-5hpacd-r2" + ;; + *"922UAGS-5HPacD") + name="rb-922uags-5hpacd" + ;; + *"931-2nD") + name="rb-931-2nd" + ;; + *"941-2nD") + name="rb-941-2nd" + ;; + *"951G-2HnD") + name="rb-951g-2hnd" + ;; + *"951Ui-2HnD") + name="rb-951ui-2hnd" + ;; + *"951Ui-2nD") + name="rb-951ui-2nd" + ;; + *"952Ui-5ac2nD") + name="rb-952ui-5ac2nd" + ;; + *"962UiGS-5HacT2HnT") + name="rb-962uigs-5hact2hnt" + ;; + *"LHG 5nD") + name="rb-lhg-5nd" + ;; + *"mAP 2nD"|\ + *"mAP2nD") + name="rb-map-2nd" + ;; + *"mAP L-2nD"|\ + *"mAPL-2nD") + name="rb-mapl-2nd" + ;; + *"SXT 2nD r3") + name="rb-sxt-2nd-r3" + ;; + *"SXT Lite2") + name="rb-sxt2n" + ;; + *"SXT Lite5") + name="rb-sxt5n" + ;; + *"wAP 2nD r2") + name="rb-wap-2nd" + ;; + *"wAP R-2nD"|\ + *"wAPR-2nD") + name="rb-wapr-2nd" + ;; + *"wAP G-5HacT2HnD"|\ + *"wAPG-5HacT2HnD") + name="rb-wapg-5hact2hnd" + ;; + esac + + echo "$name" } ar71xx_board_detect() { @@ -530,6 +692,9 @@ ar71xx_board_detect() { name="bullet-m" ubnt_xm_board_detect ;; + *"Bullet M XW") + name="bullet-m-xw" + ;; *"BXU2000n-2 rev. A1") name="bxu2000n-2-a1" ;; @@ -586,6 +751,10 @@ ar71xx_board_detect() { name="cpe210-v2" tplink_pharos_board_detect "$(tplink_pharos_v2_get_model_string)" ;; + *"CPE210 v3") + name="cpe210-v3" + tplink_pharos_board_detect "$(tplink_pharos_v2_get_model_string)" + ;; *"CPE505N") name="cpe505n" ;; @@ -832,6 +1001,10 @@ ar71xx_board_detect() { *"MAC1200R") name="mc-mac1200r" ;; + "MikroTik"*|\ + "Mikrotik"*) + name=$(mikrotik_board_detect "$machine") + ;; *"MiniBox V1.0") name="minibox-v1" ;; @@ -996,144 +1169,6 @@ ar71xx_board_detect() { *"Rocket M XW") name="rocket-m-xw" ;; - *"RouterBOARD 2011iL") - name="rb-2011il" - ;; - *"RouterBOARD 2011iLS") - name="rb-2011ils" - ;; - *"RouterBOARD 2011L") - name="rb-2011l" - ;; - *"RouterBOARD 2011UAS") - name="rb-2011uas" - ;; - *"RouterBOARD 2011UAS-2HnD") - name="rb-2011uas-2hnd" - ;; - *"RouterBOARD 2011UiAS") - name="rb-2011uias" - ;; - *"RouterBOARD 2011UiAS-2HnD") - name="rb-2011uias-2hnd" - ;; - *"RouterBOARD 411/A/AH") - name="rb-411" - ;; - *"RouterBOARD 411U") - name="rb-411u" - ;; - *"RouterBOARD 433/AH") - name="rb-433" - ;; - *"RouterBOARD 433UAH") - name="rb-433u" - ;; - *"RouterBOARD 435G") - name="rb-435g" - ;; - *"RouterBOARD 450") - name="rb-450" - ;; - *"RouterBOARD 450G") - name="rb-450g" - ;; - *"RouterBOARD 493/AH") - name="rb-493" - ;; - *"RouterBOARD 493G") - name="rb-493g" - ;; - *"RouterBOARD 750") - name="rb-750" - ;; - *"RouterBOARD 750 r2") - name="rb-750-r2" - ;; - *"RouterBOARD 750GL") - name="rb-750gl" - ;; - *"RouterBOARD 750P r2") - name="rb-750p-pbr2" - ;; - *"RouterBOARD 750UP r2") - name="rb-750up-r2" - ;; - *"RouterBOARD 751") - name="rb-751" - ;; - *"RouterBOARD 751G") - name="rb-751g" - ;; - *"RouterBOARD 911-2Hn") - name="rb-911-2hn" - ;; - *"RouterBOARD 911-5Hn") - name="rb-911-5hn" - ;; - *"RouterBOARD 911G-2HPnD") - name="rb-911g-2hpnd" - ;; - *"RouterBOARD 911G-5HPacD") - name="rb-911g-5hpacd" - ;; - *"RouterBOARD 911G-5HPnD") - name="rb-911g-5hpnd" - ;; - *"RouterBOARD 912UAG-2HPnD") - name="rb-912uag-2hpnd" - ;; - *"RouterBOARD 912UAG-5HPnD") - name="rb-912uag-5hpnd" - ;; - *"RouterBOARD 921GS-5HPacD r2") - name="rb-921gs-5hpacd-r2" - ;; - *"RouterBOARD 931-2nD") - name="rb-931-2nd" - ;; - *"RouterBOARD"*"941-2nD") - name="rb-941-2nd" - ;; - *"RouterBOARD 951G-2HnD") - name="rb-951g-2hnd" - ;; - *"RouterBOARD 951Ui-2HnD") - name="rb-951ui-2hnd" - ;; - *"RouterBOARD 951Ui-2nD") - name="rb-951ui-2nd" - ;; - *"RouterBOARD 952Ui-5ac2nD") - name="rb-952ui-5ac2nd" - ;; - *"RouterBOARD 962UiGS-5HacT2HnT") - name="rb-962uigs-5hact2hnt" - ;; - *"RouterBOARD LHG 5nD") - name="rb-lhg-5nd" - ;; - *"RouterBOARD mAP 2nD") - name="rb-map-2nd" - ;; - *"RouterBOARD mAP L-2nD") - name="rb-mapl-2nd" - ;; - *"RouterBOARD SXT Lite2") - name="rb-sxt2n" - ;; - *"RouterBOARD SXT Lite5") - name="rb-sxt5n" - ;; - *"RouterBOARD wAP 2nD r2") - name="rb-wap-2nd" - ;; - *"RouterBOARD wAP R-2nD") - name="rb-wapr-2nd" - ;; - *"RouterBOARD wAP G-5HacT2HnD") - name="rb-wapg-5hact2hnd" - ;; *"RouterStation") name="routerstation" ;; diff --git a/target/linux/ar71xx/base-files/lib/preinit/05_set_preinit_iface_ar71xx b/target/linux/ar71xx/base-files/lib/preinit/05_set_preinit_iface_ar71xx index 909e615092..68875fa1ec 100644 --- a/target/linux/ar71xx/base-files/lib/preinit/05_set_preinit_iface_ar71xx +++ b/target/linux/ar71xx/base-files/lib/preinit/05_set_preinit_iface_ar71xx @@ -38,6 +38,7 @@ set_preinit_iface() { tl-wr841n-v8|\ tl-wr842n-v2|\ tl-wr940n-v4|\ + tl-wr940n-v6|\ tl-wr941nd-v6|\ wnr1000-v2|\ wnr2000-v3|\ diff --git a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh index 21ad3075bd..d0690dbaf4 100755 --- a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh +++ b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh @@ -218,6 +218,7 @@ platform_check_image() { archer-c7-v4|\ archer-c7-v5|\ bullet-m|\ + bullet-m-xw|\ c-55|\ carambola2|\ cf-e316n-v2|\ @@ -557,6 +558,7 @@ platform_check_image() { rb-912uag-2hpnd|\ rb-912uag-5hpnd|\ rb-921gs-5hpacd-r2|\ + rb-922uags-5hpacd|\ rb-951g-2hnd|\ rb-951ui-2hnd|\ rb-2011l|\ @@ -566,6 +568,7 @@ platform_check_image() { rb-2011uas-2hnd|\ rb-2011uias|\ rb-2011uias-2hnd|\ + rb-2011uias-2hnd-r2|\ rb-sxt2n|\ rb-sxt5n) nand_do_platform_check routerboard $1 @@ -589,7 +592,8 @@ platform_check_image() { tplink_pharos_check_image "$1" "7f454c46" "$(tplink_pharos_get_model_string)" '' && return 0 return 1 ;; - cpe210-v2) + cpe210-v2|\ + cpe210-v3) tplink_pharos_check_image "$1" "01000000" "$(tplink_pharos_v2_get_model_string)" '\0\xff\r' && return 0 return 1 ;; @@ -730,6 +734,7 @@ platform_check_image() { rb-lhg-5nd|\ rb-map-2nd|\ rb-mapl-2nd|\ + rb-sxt-2nd-r3|\ rb-wap-2nd|\ rb-wapg-5hact2hnd|\ rb-wapr-2nd) @@ -758,6 +763,7 @@ platform_pre_upgrade() { rb-lhg-5nd|\ rb-map-2nd|\ rb-mapl-2nd|\ + rb-sxt-2nd-r3|\ rb-wap-2nd|\ rb-wapg-5hact2hnd|\ rb-wapr-2nd) @@ -876,6 +882,7 @@ platform_do_upgrade() { rb-912uag-2hpnd|\ rb-912uag-5hpnd|\ rb-921gs-5hpacd-r2|\ + rb-922uags-5hpacd|\ rb-951g-2hnd|\ rb-951ui-2hnd|\ rb-2011il|\ @@ -885,6 +892,7 @@ platform_do_upgrade() { rb-2011uas-2hnd|\ rb-2011uias|\ rb-2011uias-2hnd|\ + rb-2011uias-2hnd-r2|\ rb-sxt2n|\ rb-sxt5n|\ wi2a-ac200i|\ diff --git a/target/linux/ar71xx/files/arch/mips/ath79/Kconfig.openwrt b/target/linux/ar71xx/files/arch/mips/ath79/Kconfig.openwrt index 6f358bc842..6fd78c46a0 100644 --- a/target/linux/ar71xx/files/arch/mips/ath79/Kconfig.openwrt +++ b/target/linux/ar71xx/files/arch/mips/ath79/Kconfig.openwrt @@ -1188,6 +1188,7 @@ config ATH79_MACH_RBSPI MikroTik RouterBOARD Powerbox MikroTik RouterBOARD LHG 5 MikroTik RouterBOARD cAP (EXPERIMENTAL) + MikroTik RouterBOARD SXT Lite 2 r3 MikroTik RouterBOARD wAP MikroTik RouterBOARD wAP R-2nD diff --git a/target/linux/ar71xx/files/arch/mips/ath79/mach-archer-c7.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-archer-c7.c index 35e3c271f8..287252780d 100644 --- a/target/linux/ar71xx/files/arch/mips/ath79/mach-archer-c7.c +++ b/target/linux/ar71xx/files/arch/mips/ath79/mach-archer-c7.c @@ -50,7 +50,7 @@ #define ARCHER_C7_GPIO_LED_USB1 18 #define ARCHER_C7_GPIO_LED_USB2 19 -#define ARCHER_C7_GPIO_BTN_RFKILL 13 +#define ARCHER_C7_GPIO_BTN_RFKILL 23 #define ARCHER_C7_V2_GPIO_BTN_RFKILL 23 #define ARCHER_C7_GPIO_BTN_RESET 16 @@ -74,22 +74,22 @@ static struct flash_platform_data archer_c7_flash_data = { static struct gpio_led archer_c7_leds_gpio[] __initdata = { { - .name = "tp-link:blue:qss", + .name = "tp-link:green:qss", .gpio = ARCHER_C7_GPIO_LED_QSS, .active_low = 1, }, { - .name = "tp-link:blue:system", + .name = "tp-link:green:system", .gpio = ARCHER_C7_GPIO_LED_SYSTEM, .active_low = 1, }, { - .name = "tp-link:blue:wlan2g", + .name = "tp-link:green:wlan2g", .gpio = ARCHER_C7_GPIO_LED_WLAN2G, .active_low = 1, }, { - .name = "tp-link:blue:wlan5g", + .name = "tp-link:green:wlan5g", .gpio = ARCHER_C7_GPIO_LED_WLAN5G, .active_low = 1, }, @@ -142,11 +142,11 @@ static struct gpio_keys_button archer_c7_v2_gpio_keys[] __initdata = { }; static const struct ar8327_led_info archer_c7_leds_ar8327[] = { - AR8327_LED_INFO(PHY0_0, HW, "tp-link:blue:wan"), - AR8327_LED_INFO(PHY1_0, HW, "tp-link:blue:lan1"), - AR8327_LED_INFO(PHY2_0, HW, "tp-link:blue:lan2"), - AR8327_LED_INFO(PHY3_0, HW, "tp-link:blue:lan3"), - AR8327_LED_INFO(PHY4_0, HW, "tp-link:blue:lan4"), + AR8327_LED_INFO(PHY0_0, HW, "tp-link:green:wan"), + AR8327_LED_INFO(PHY1_0, HW, "tp-link:green:lan1"), + AR8327_LED_INFO(PHY2_0, HW, "tp-link:green:lan2"), + AR8327_LED_INFO(PHY3_0, HW, "tp-link:green:lan3"), + AR8327_LED_INFO(PHY4_0, HW, "tp-link:green:lan4"), }; /* GMAC0 of the AR8327 switch is connected to the QCA9558 SoC via SGMII */ diff --git a/target/linux/ar71xx/files/arch/mips/ath79/mach-cpe510.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-cpe510.c index ceb1769ddd..16efbc8802 100644 --- a/target/linux/ar71xx/files/arch/mips/ath79/mach-cpe510.c +++ b/target/linux/ar71xx/files/arch/mips/ath79/mach-cpe510.c @@ -236,6 +236,9 @@ MIPS_MACHINE(ATH79_MACH_CPE210, "CPE210", "TP-LINK CPE210/220", MIPS_MACHINE(ATH79_MACH_CPE210_V2, "CPE210V2", "TP-LINK CPE210 v2", cpe210_v2_setup); +MIPS_MACHINE(ATH79_MACH_CPE210_V3, "CPE210V3", "TP-LINK CPE210 v3", + cpe210_v2_setup); + MIPS_MACHINE(ATH79_MACH_CPE510, "CPE510", "TP-LINK CPE510/520", cpe510_setup); diff --git a/target/linux/ar71xx/files/arch/mips/ath79/mach-hiveap-121.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-hiveap-121.c index 363d73dd53..5cbb2054f7 100644 --- a/target/linux/ar71xx/files/arch/mips/ath79/mach-hiveap-121.c +++ b/target/linux/ar71xx/files/arch/mips/ath79/mach-hiveap-121.c @@ -111,7 +111,7 @@ static void __init hiveap_121_setup(void) ath79_eth0_data.mii_bus_dev = &ath79_mdio0_device.dev; ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_RGMII; ath79_eth0_data.phy_mask = BIT(HIVEAP_121_LAN_PHYADDR); - ath79_eth0_pll_data.pll_1000 = 0x0e000000; + ath79_eth0_pll_data.pll_1000 = 0x06000000; ath79_eth0_pll_data.pll_100 = 0x00000101; ath79_eth0_pll_data.pll_10 = 0x00001313; ath79_register_eth(0); diff --git a/target/linux/ar71xx/files/arch/mips/ath79/mach-rambutan.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-rambutan.c index 36fde26c95..1730a29f33 100644 --- a/target/linux/ar71xx/files/arch/mips/ath79/mach-rambutan.c +++ b/target/linux/ar71xx/files/arch/mips/ath79/mach-rambutan.c @@ -46,6 +46,7 @@ static struct mdio_board_info rambutan_mdio0_info[] = { static struct at803x_platform_data rambutan_ar8033_data = { .has_reset_gpio = 1, + .override_sgmii_aneg = 1, .reset_gpio = 23, }; @@ -80,6 +81,7 @@ static void __init rambutan_setup(void) ath79_eth1_data.phy_if_mode = PHY_INTERFACE_MODE_SGMII; ath79_eth1_data.phy_mask = BIT(0); ath79_eth1_data.mii_bus_dev = &ath79_mdio1_device.dev; + ath79_eth1_data.enable_sgmii_fixup = 1; ath79_eth1_pll_data.pll_1000 = 0x17000000; ath79_eth1_pll_data.pll_10 = 0x1313; ath79_register_eth(1); diff --git a/target/linux/ar71xx/files/arch/mips/ath79/mach-rb2011.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-rb2011.c index 7bf64905c6..aee0fb2014 100644 --- a/target/linux/ar71xx/files/arch/mips/ath79/mach-rb2011.c +++ b/target/linux/ar71xx/files/arch/mips/ath79/mach-rb2011.c @@ -256,7 +256,9 @@ static int rb2011_nand_scan_fixup(struct mtd_info *mtd) { #if LINUX_VERSION_CODE < KERNEL_VERSION(4,6,0) struct nand_chip *chip = mtd->priv; -#endif +#else + struct nand_chip *chip = mtd_to_nand(mtd); +#endif /* < 4.6.0 */ if (mtd->writesize == 512) { /* @@ -270,6 +272,8 @@ static int rb2011_nand_scan_fixup(struct mtd_info *mtd) #endif } + chip->options = NAND_NO_SUBPAGE_WRITE; + return 0; } diff --git a/target/linux/ar71xx/files/arch/mips/ath79/mach-rb4xx.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-rb4xx.c index 722993ff9b..edf90e1872 100644 --- a/target/linux/ar71xx/files/arch/mips/ath79/mach-rb4xx.c +++ b/target/linux/ar71xx/files/arch/mips/ath79/mach-rb4xx.c @@ -88,7 +88,7 @@ static struct platform_device rb4xx_nand_device = { .id = -1, }; -static struct ath79_pci_irq rb4xx_pci_irqs[] __initdata = { +static struct ath79_pci_irq rb4xx_pci_irqs[] = { { .slot = 17, .pin = 1, diff --git a/target/linux/ar71xx/files/arch/mips/ath79/mach-rb922.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-rb922.c index 43bcc99fc7..1c1cae1e76 100644 --- a/target/linux/ar71xx/files/arch/mips/ath79/mach-rb922.c +++ b/target/linux/ar71xx/files/arch/mips/ath79/mach-rb922.c @@ -1,5 +1,5 @@ /* - * MikroTik RouterBOARD 91X support + * MikroTik RouterBOARD 92X support * * Copyright (C) 2015 Gabor Juhos * @@ -49,6 +49,10 @@ #define RB922_GPIO_BTN_RESET 20 #define RB922_GPIO_NAND_NCE 23 +#define RB92X_FLAG_USB BIT(0) +#define RB92X_FLAG_USB_POWER BIT(1) +#define RB92X_FLAG_PCIE BIT(2) + #define RB922_PHY_ADDR 4 #define RB922_KEYS_POLL_INTERVAL 20 /* msecs */ @@ -62,6 +66,11 @@ #define RB_SOFT_CFG_OFFSET 0xf000 #define RB_SOFT_CFG_SIZE 0x1000 +struct rb_board_info { + const char *name; + u32 flags; +}; + static struct mtd_partition rb922gs_spi_partitions[] = { { .name = "routerboot", @@ -82,6 +91,32 @@ static struct mtd_partition rb922gs_spi_partitions[] = { } }; +static void __init rb922gs_init_partitions(const struct rb_info *info) +{ + rb922gs_spi_partitions[0].size = info->hard_cfg_offs; + rb922gs_spi_partitions[1].offset = info->hard_cfg_offs; + rb922gs_spi_partitions[3].offset = info->soft_cfg_offs; +} + +static struct mtd_partition rb922gs_nand_partitions[] = { + { + .name = "booter", + .offset = 0, + .size = (256 * 1024), + .mask_flags = MTD_WRITEABLE, + }, + { + .name = "kernel", + .offset = (256 * 1024), + .size = (4 * 1024 * 1024) - (256 * 1024), + }, + { + .name = "ubi", + .offset = MTDPART_OFS_NXTBLK, + .size = MTDPART_SIZ_FULL, + }, +}; + static struct flash_platform_data rb922gs_spi_flash_data = { .parts = rb922gs_spi_partitions, .nr_parts = ARRAY_SIZE(rb922gs_spi_partitions), @@ -118,12 +153,7 @@ static struct mdio_board_info rb922gs_mdio0_info[] = { }, }; -static void __init rb922gs_init_partitions(const struct rb_info *info) -{ - rb922gs_spi_partitions[0].size = info->hard_cfg_offs; - rb922gs_spi_partitions[1].offset = info->hard_cfg_offs; - rb922gs_spi_partitions[3].offset = info->soft_cfg_offs; -} + static void rb922gs_nand_select_chip(int chip_no) { @@ -221,25 +251,6 @@ static int rb922gs_nand_scan_fixup(struct mtd_info *mtd) return 0; } -static struct mtd_partition rb922gs_nand_partitions[] = { - { - .name = "booter", - .offset = 0, - .size = (256 * 1024), - .mask_flags = MTD_WRITEABLE, - }, - { - .name = "kernel", - .offset = (256 * 1024), - .size = (4 * 1024 * 1024) - (256 * 1024), - }, - { - .name = "ubi", - .offset = MTDPART_OFS_NXTBLK, - .size = MTDPART_SIZ_FULL, - }, -}; - static void __init rb922gs_nand_init(void) { gpio_request_one(RB922_GPIO_NAND_NCE, GPIOF_OUT_INIT_HIGH, "NAND nCE"); @@ -252,10 +263,37 @@ static void __init rb922gs_nand_init(void) ath79_register_nfc(); } +#define RB_BOARD_INFO(_name, _flags) \ + { \ + .name = (_name), \ + .flags = (_flags), \ + } + +static const struct rb_board_info rb92x_boards[] __initconst = { + RB_BOARD_INFO("921GS-5HPacD r2", RB92X_FLAG_PCIE), + RB_BOARD_INFO("922UAGS-5HPacD", RB92X_FLAG_USB | RB92X_FLAG_USB_POWER | RB92X_FLAG_PCIE), +}; + +static u32 rb92x_get_flags(const struct rb_info *info) +{ + int i; + + for (i = 0; i < ARRAY_SIZE(rb92x_boards); i++) { + const struct rb_board_info *bi; + + bi = &rb92x_boards[i]; + if (strcmp(info->board_name, bi->name) == 0) + return bi->flags; + } + + return 0; +} + static void __init rb922gs_setup(void) { const struct rb_info *info; char buf[64]; + u32 flags; info = rb_init_info((void *) KSEG1ADDR(0x1f000000), 0x10000); if (!info) @@ -281,7 +319,9 @@ static void __init rb922gs_setup(void) ath79_eth0_data.mii_bus_dev = &ath79_mdio0_device.dev; ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_RGMII; ath79_eth0_data.phy_mask = BIT(RB922_PHY_ADDR); - if (strcmp(info->board_name, "921GS-5HPacD r2") == 0) { + if (strcmp(info->board_name, "921GS-5HPacD r2") == 0 || + strcmp(info->board_name, "922UAGS-5HPacD") == 0) + { ath79_eth0_pll_data.pll_10 = 0xa0001313; ath79_eth0_pll_data.pll_100 = 0xa0000101; ath79_eth0_pll_data.pll_1000 = 0x8f000000; @@ -294,7 +334,18 @@ static void __init rb922gs_setup(void) ath79_register_eth(0); - ath79_register_pci(); + flags = rb92x_get_flags(info); + + if (flags & RB92X_FLAG_USB) + ath79_register_usb(); + + if (flags & RB92X_FLAG_USB_POWER) + gpio_request_one(RB922_GPIO_USB_POWER, GPIOF_OUT_INIT_LOW | + GPIOF_EXPORT_DIR_FIXED, "USB power"); + + if (flags & RB92X_FLAG_PCIE) + ath79_register_pci(); + ath79_register_leds_gpio(-1, ARRAY_SIZE(rb922gs_leds), rb922gs_leds); ath79_register_gpio_keys_polled(-1, RB922_KEYS_POLL_INTERVAL, ARRAY_SIZE(rb922gs_gpio_keys), diff --git a/target/linux/ar71xx/files/arch/mips/ath79/mach-rbspi.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-rbspi.c index 96511a4080..6bb42c78e3 100644 --- a/target/linux/ar71xx/files/arch/mips/ath79/mach-rbspi.c +++ b/target/linux/ar71xx/files/arch/mips/ath79/mach-rbspi.c @@ -512,6 +512,18 @@ static struct platform_device rbwapgsc_phy_device = { }, }; +static struct at803x_platform_data rbwapgsc_at803x_data = { + .override_sgmii_aneg = 1, +}; + +static struct mdio_board_info rbwapgsc_mdio_info[] = { + { + .bus_id = "gpio-1", + .mdio_addr = RBWAPGSC_MDIO_PHYADDR, + .platform_data = &rbwapgsc_at803x_data, + }, +}; + /* RB911L GPIOs */ #define RB911L_GPIO_BTN_RESET 15 #define RB911L_GPIO_LED_1 13 @@ -1106,10 +1118,14 @@ static void __init rbwapgsc_setup(void) platform_device_register(&rbwapgsc_phy_device); + mdiobus_register_board_info(rbwapgsc_mdio_info, + ARRAY_SIZE(rbwapgsc_mdio_info)); + ath79_init_mac(ath79_eth1_data.mac_addr, ath79_mac_base, 0); ath79_eth1_data.mii_bus_dev = &rbwapgsc_phy_device.dev; ath79_eth1_data.phy_if_mode = PHY_INTERFACE_MODE_SGMII; ath79_eth1_data.phy_mask = BIT(RBWAPGSC_MDIO_PHYADDR); + ath79_eth1_data.enable_sgmii_fixup = 1; ath79_eth1_pll_data.pll_1000 = 0x03000101; ath79_eth1_pll_data.pll_100 = 0x80000101; ath79_eth1_pll_data.pll_10 = 0x80001313; diff --git a/target/linux/ar71xx/files/arch/mips/ath79/mach-tl-wr940n-v4.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-tl-wr940n-v4.c index b530622d9f..9324b2b924 100644 --- a/target/linux/ar71xx/files/arch/mips/ath79/mach-tl-wr940n-v4.c +++ b/target/linux/ar71xx/files/arch/mips/ath79/mach-tl-wr940n-v4.c @@ -143,7 +143,7 @@ static void __init tl_wr940n_setup(void) ath79_register_mdio(0, 0x0); ath79_init_mac(ath79_eth0_data.mac_addr, mac, 1); - ath79_init_mac(ath79_eth1_data.mac_addr, mac, -1); + ath79_init_mac(ath79_eth1_data.mac_addr, mac, 0); ath79_switch_data.phy4_mii_en = 1; diff --git a/target/linux/ar71xx/files/arch/mips/ath79/mach-ubnt-xm.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-ubnt-xm.c index ba79537b37..6ceb91efff 100644 --- a/target/linux/ar71xx/files/arch/mips/ath79/mach-ubnt-xm.c +++ b/target/linux/ar71xx/files/arch/mips/ath79/mach-ubnt-xm.c @@ -656,6 +656,9 @@ MIPS_MACHINE(ATH79_MACH_UBNT_LOCO_M_XW, "UBNT-LOCO-XW", "Ubiquiti Loco M XW", MIPS_MACHINE(ATH79_MACH_UBNT_ROCKET_M_XW, "UBNT-RM-XW", "Ubiquiti Rocket M XW", ubnt_rocket_m_xw_setup); +MIPS_MACHINE(ATH79_MACH_UBNT_BULLET_M_XW, "UBNT-BM-XW", "Ubiquiti Bullet M XW", + ubnt_rocket_m_xw_setup); + MIPS_MACHINE(ATH79_MACH_UBNT_ROCKET_M_TI, "UBNT-RM-TI", "Ubiquiti Rocket M TI", ubnt_rocket_m_ti_setup); diff --git a/target/linux/ar71xx/files/arch/mips/ath79/mach-wnr2200.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-wnr2200.c index f238c73809..79de51c98e 100644 --- a/target/linux/ar71xx/files/arch/mips/ath79/mach-wnr2200.c +++ b/target/linux/ar71xx/files/arch/mips/ath79/mach-wnr2200.c @@ -222,6 +222,7 @@ static void __init wnr2200_setup(void) wnr2200_get_wmac(wlan_mac_addr, WNR2200_MAC0_OFFSET, WNR2200_MAC1_OFFSET, WNR2200_WMAC_OFFSET); + ap9x_pci_setup_wmac_led_pin(0, 0); ap91_pci_init(art + WNR2200_PCIE_CALDATA_OFFSET, wlan_mac_addr); ath79_register_leds_gpio(-1, ARRAY_SIZE(wnr2200_leds_gpio), diff --git a/target/linux/ar71xx/files/arch/mips/ath79/machtypes.h b/target/linux/ar71xx/files/arch/mips/ath79/machtypes.h index 974b69fda6..9722744a37 100644 --- a/target/linux/ar71xx/files/arch/mips/ath79/machtypes.h +++ b/target/linux/ar71xx/files/arch/mips/ath79/machtypes.h @@ -76,6 +76,7 @@ enum ath79_mach_type { ATH79_MACH_CF_E530N, /* COMFAST CF-E530N */ ATH79_MACH_CPE210, /* TP-LINK CPE210 v1 */ ATH79_MACH_CPE210_V2, /* TP-LINK CPE210 v2 */ + ATH79_MACH_CPE210_V3, /* TP-LINK CPE210 v3 */ ATH79_MACH_CPE505N, /* P&W CPE505N */ ATH79_MACH_CPE510, /* TP-LINK CPE510 */ ATH79_MACH_CPE830, /* YunCore CPE830 */ @@ -320,6 +321,7 @@ enum ath79_mach_type { ATH79_MACH_UBNT_AIRGWP, /* Ubiquiti AirGateway Pro */ ATH79_MACH_UBNT_AIRROUTER, /* Ubiquiti AirRouter */ ATH79_MACH_UBNT_BULLET_M, /* Ubiquiti Bullet M */ + ATH79_MACH_UBNT_BULLET_M_XW, /* Ubiquiti Bullet M XW */ ATH79_MACH_UBNT_LBE_M5, /* Ubiquiti Litebeam M5 */ ATH79_MACH_UBNT_LOCO_M_XW, /* Ubiquiti Loco M XW */ ATH79_MACH_UBNT_LSSR71, /* Ubiquiti LS-SR71 */ diff --git a/target/linux/ar71xx/files/drivers/net/ethernet/atheros/ag71xx/ag71xx_ethtool.c b/target/linux/ar71xx/files/drivers/net/ethernet/atheros/ag71xx/ag71xx_ethtool.c index a2eaba1a1e..9e5a53e7fc 100644 --- a/target/linux/ar71xx/files/drivers/net/ethernet/atheros/ag71xx/ag71xx_ethtool.c +++ b/target/linux/ar71xx/files/drivers/net/ethernet/atheros/ag71xx/ag71xx_ethtool.c @@ -14,38 +14,6 @@ #include "ag71xx.h" #include -static int ag71xx_ethtool_get_settings(struct net_device *dev, - struct ethtool_cmd *cmd) -{ - struct ag71xx *ag = netdev_priv(dev); - struct phy_device *phydev = ag->phy_dev; - - if (!phydev) - return -ENODEV; - -#if LINUX_VERSION_CODE < KERNEL_VERSION(4,14,0) - return phy_ethtool_gset(phydev, cmd); -#else - return phy_ethtool_ioctl(phydev, cmd); -#endif -} - -static int ag71xx_ethtool_set_settings(struct net_device *dev, - struct ethtool_cmd *cmd) -{ - struct ag71xx *ag = netdev_priv(dev); - struct phy_device *phydev = ag->phy_dev; - - if (!phydev) - return -ENODEV; - -#if LINUX_VERSION_CODE < KERNEL_VERSION(4,14,0) - return phy_ethtool_sset(phydev, cmd); -#else - return phy_ethtool_ioctl(phydev, cmd); -#endif -} - static void ag71xx_ethtool_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info) { @@ -127,14 +95,26 @@ static int ag71xx_ethtool_set_ringparam(struct net_device *dev, return err; } +static int ag71xx_ethtool_nway_reset(struct net_device *dev) +{ + struct ag71xx *ag = netdev_priv(dev); + struct phy_device *phydev = ag->phy_dev; + + if (!phydev) + return -ENODEV; + + return genphy_restart_aneg(phydev); +} + struct ethtool_ops ag71xx_ethtool_ops = { - .set_settings = ag71xx_ethtool_set_settings, - .get_settings = ag71xx_ethtool_get_settings, .get_drvinfo = ag71xx_ethtool_get_drvinfo, .get_msglevel = ag71xx_ethtool_get_msglevel, .set_msglevel = ag71xx_ethtool_set_msglevel, .get_ringparam = ag71xx_ethtool_get_ringparam, .set_ringparam = ag71xx_ethtool_set_ringparam, + .get_link_ksettings = phy_ethtool_get_link_ksettings, + .set_link_ksettings = phy_ethtool_set_link_ksettings, .get_link = ethtool_op_get_link, .get_ts_info = ethtool_op_get_ts_info, + .nway_reset = ag71xx_ethtool_nway_reset, }; diff --git a/target/linux/ar71xx/files/drivers/net/ethernet/atheros/ag71xx/ag71xx_main.c b/target/linux/ar71xx/files/drivers/net/ethernet/atheros/ag71xx/ag71xx_main.c index 542d4915b3..ebbe8a7472 100644 --- a/target/linux/ar71xx/files/drivers/net/ethernet/atheros/ag71xx/ag71xx_main.c +++ b/target/linux/ar71xx/files/drivers/net/ethernet/atheros/ag71xx/ag71xx_main.c @@ -127,7 +127,7 @@ static void ag71xx_ring_tx_init(struct ag71xx *ag) { struct ag71xx_ring *ring = &ag->tx_ring; int ring_size = BIT(ring->order); - int ring_mask = ring_size - 1; + int ring_mask = BIT(ring->order) - 1; int i; for (i = 0; i < ring_size; i++) { @@ -159,7 +159,7 @@ static void ag71xx_ring_rx_clean(struct ag71xx *ag) for (i = 0; i < ring_size; i++) if (ring->buf[i].rx_buf) { - dma_unmap_single(&ag->dev->dev, ring->buf[i].dma_addr, + dma_unmap_single(&ag->pdev->dev, ring->buf[i].dma_addr, ag->rx_buf_size, DMA_FROM_DEVICE); skb_free_frag(ring->buf[i].rx_buf); } @@ -200,7 +200,7 @@ static bool ag71xx_fill_rx_buf(struct ag71xx *ag, struct ag71xx_buf *buf, return false; buf->rx_buf = data; - buf->dma_addr = dma_map_single(&ag->dev->dev, data, ag->rx_buf_size, + buf->dma_addr = dma_map_single(&ag->pdev->dev, data, ag->rx_buf_size, DMA_FROM_DEVICE); desc->data = (u32) buf->dma_addr + offset; return true; @@ -290,15 +290,15 @@ static int ag71xx_rings_init(struct ag71xx *ag) if (!tx->buf) return -ENOMEM; - tx->descs_cpu = dma_alloc_coherent(NULL, ring_size * AG71XX_DESC_SIZE, - &tx->descs_dma, GFP_ATOMIC); + tx->descs_cpu = dma_alloc_coherent(&ag->pdev->dev, ring_size * AG71XX_DESC_SIZE, + &tx->descs_dma, GFP_KERNEL); if (!tx->descs_cpu) { kfree(tx->buf); tx->buf = NULL; return -ENOMEM; } - rx->buf = &tx->buf[BIT(tx->order)]; + rx->buf = &tx->buf[tx_size]; rx->descs_cpu = ((void *)tx->descs_cpu) + tx_size * AG71XX_DESC_SIZE; rx->descs_dma = tx->descs_dma + tx_size * AG71XX_DESC_SIZE; @@ -313,7 +313,7 @@ static void ag71xx_rings_free(struct ag71xx *ag) int ring_size = BIT(tx->order) + BIT(rx->order); if (tx->descs_cpu) - dma_free_coherent(NULL, ring_size * AG71XX_DESC_SIZE, + dma_free_coherent(&ag->pdev->dev, ring_size * AG71XX_DESC_SIZE, tx->descs_cpu, tx->descs_dma); kfree(tx->buf); @@ -668,10 +668,6 @@ static int ag71xx_hw_enable(struct ag71xx *ag) static void ag71xx_hw_disable(struct ag71xx *ag) { - unsigned long flags; - - spin_lock_irqsave(&ag->lock, flags); - netif_stop_queue(ag->dev); ag71xx_hw_stop(ag); @@ -680,8 +676,6 @@ static void ag71xx_hw_disable(struct ag71xx *ag) napi_disable(&ag->napi); del_timer_sync(&ag->oom_timer); - spin_unlock_irqrestore(&ag->lock, flags); - ag71xx_rings_cleanup(ag); } @@ -791,7 +785,7 @@ static netdev_tx_t ag71xx_hard_start_xmit(struct sk_buff *skb, goto err_drop; } - dma_addr = dma_map_single(&dev->dev, skb->data, skb->len, + dma_addr = dma_map_single(&ag->pdev->dev, skb->data, skb->len, DMA_TO_DEVICE); i = ring->curr & ring_mask; @@ -833,7 +827,7 @@ static netdev_tx_t ag71xx_hard_start_xmit(struct sk_buff *skb, return NETDEV_TX_OK; err_drop_unmap: - dma_unmap_single(&dev->dev, dma_addr, skb->len, DMA_TO_DEVICE); + dma_unmap_single(&ag->pdev->dev, dma_addr, skb->len, DMA_TO_DEVICE); err_drop: dev->stats.tx_dropped++; @@ -845,18 +839,8 @@ err_drop: static int ag71xx_do_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) { struct ag71xx *ag = netdev_priv(dev); - int ret; switch (cmd) { - case SIOCETHTOOL: - if (ag->phy_dev == NULL) - break; - - spin_lock_irq(&ag->lock); - ret = phy_ethtool_ioctl(ag->phy_dev, (void *) ifr->ifr_data); - spin_unlock_irq(&ag->lock); - return ret; - case SIOCSIFHWADDR: if (copy_from_user (dev->dev_addr, ifr->ifr_data, sizeof(dev->dev_addr))) @@ -1116,7 +1100,7 @@ static int ag71xx_rx_packets(struct ag71xx *ag, int limit) pktlen = desc->ctrl & pktlen_mask; pktlen -= ETH_FCS_LEN; - dma_unmap_single(&dev->dev, ring->buf[i].dma_addr, + dma_unmap_single(&ag->pdev->dev, ring->buf[i].dma_addr, ag->rx_buf_size, DMA_FROM_DEVICE); dev->stats.rx_packets++; @@ -1290,6 +1274,9 @@ static int ag71xx_change_mtu(struct net_device *dev, int new_mtu) return -EBUSY; dev->mtu = new_mtu; + ag71xx_wr(ag, AG71XX_REG_MAC_MFL, + ag71xx_max_frame_len(dev->mtu)); + return 0; } @@ -1307,27 +1294,6 @@ static const struct net_device_ops ag71xx_netdev_ops = { #endif }; -static const char *ag71xx_get_phy_if_mode_name(phy_interface_t mode) -{ - switch (mode) { - case PHY_INTERFACE_MODE_MII: - return "MII"; - case PHY_INTERFACE_MODE_GMII: - return "GMII"; - case PHY_INTERFACE_MODE_RMII: - return "RMII"; - case PHY_INTERFACE_MODE_RGMII: - return "RGMII"; - case PHY_INTERFACE_MODE_SGMII: - return "SGMII"; - default: - break; - } - - return "unknown"; -} - - static int ag71xx_probe(struct platform_device *pdev) { struct net_device *dev; @@ -1339,26 +1305,26 @@ static int ag71xx_probe(struct platform_device *pdev) pdata = pdev->dev.platform_data; if (!pdata) { dev_err(&pdev->dev, "no platform data specified\n"); - err = -ENXIO; - goto err_out; + return -ENXIO; + } if (pdata->mii_bus_dev == NULL && pdata->phy_mask) { dev_err(&pdev->dev, "no MII bus device specified\n"); - err = -EINVAL; - goto err_out; + return -EINVAL; } - dev = alloc_etherdev(sizeof(*ag)); - if (!dev) { - dev_err(&pdev->dev, "alloc_etherdev failed\n"); - err = -ENOMEM; - goto err_out; - } + dev = devm_alloc_etherdev(&pdev->dev, sizeof(*ag)); + if (!dev) + return -ENOMEM; if (!pdata->max_frame_len || !pdata->desc_pktlen_mask) return -EINVAL; + res = platform_get_resource(pdev, IORESOURCE_MEM, 0); + if (!res) + return -EINVAL; + SET_NETDEV_DEV(dev, &pdev->dev); ag = netdev_priv(dev); @@ -1371,24 +1337,20 @@ static int ag71xx_probe(struct platform_device *pdev) res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "mac_base"); if (!res) { dev_err(&pdev->dev, "no mac_base resource found\n"); - err = -ENXIO; - goto err_out; + return -ENXIO; } - ag->mac_base = ioremap_nocache(res->start, res->end - res->start + 1); - if (!ag->mac_base) { - dev_err(&pdev->dev, "unable to ioremap mac_base\n"); - err = -ENOMEM; - goto err_free_dev; - } + ag->mac_base = devm_ioremap_nocache(&pdev->dev, res->start, + res->end - res->start + 1); + if (!ag->mac_base) + return -ENOMEM; dev->irq = platform_get_irq(pdev, 0); - err = request_irq(dev->irq, ag71xx_interrupt, - 0x0, - dev->name, dev); + err = devm_request_irq(&pdev->dev, dev->irq, ag71xx_interrupt, + 0x0, dev_name(&pdev->dev), dev); if (err) { dev_err(&pdev->dev, "unable to request IRQ %d\n", dev->irq); - goto err_unmap_base; + return err; } dev->base_addr = (unsigned long)ag->mac_base; @@ -1413,11 +1375,12 @@ static int ag71xx_probe(struct platform_device *pdev) } ag->tx_ring.order = ag71xx_ring_size_order(tx_size); - ag->stop_desc = dma_alloc_coherent(NULL, - sizeof(struct ag71xx_desc), &ag->stop_desc_dma, GFP_KERNEL); + ag->stop_desc = dmam_alloc_coherent(&pdev->dev, + sizeof(struct ag71xx_desc), + &ag->stop_desc_dma, GFP_KERNEL); if (!ag->stop_desc) - goto err_free_irq; + return -ENOMEM; ag->stop_desc->data = 0; ag->stop_desc->ctrl = 0; @@ -1429,13 +1392,15 @@ static int ag71xx_probe(struct platform_device *pdev) ag71xx_dump_regs(ag); + ag71xx_wr(ag, AG71XX_REG_MAC_CFG1, 0); + ag71xx_hw_init(ag); ag71xx_dump_regs(ag); err = ag71xx_phy_connect(ag); if (err) - goto err_free_desc; + return err; err = ag71xx_debugfs_init(ag); if (err) @@ -1446,49 +1411,35 @@ static int ag71xx_probe(struct platform_device *pdev) err = register_netdev(dev); if (err) { dev_err(&pdev->dev, "unable to register net device\n"); - goto err_debugfs_exit; + platform_set_drvdata(pdev, NULL); + ag71xx_debugfs_exit(ag); + goto err_phy_disconnect; } - pr_info("%s: Atheros AG71xx at 0x%08lx, irq %d, mode:%s\n", - dev->name, dev->base_addr, dev->irq, - ag71xx_get_phy_if_mode_name(pdata->phy_if_mode)); + pr_info("%s: Atheros AG71xx at 0x%08lx, irq %d, mode: %s\n", + dev->name, (unsigned long) ag->mac_base, dev->irq, + phy_modes(pdata->phy_if_mode)); return 0; -err_debugfs_exit: - ag71xx_debugfs_exit(ag); err_phy_disconnect: ag71xx_phy_disconnect(ag); -err_free_desc: - dma_free_coherent(NULL, sizeof(struct ag71xx_desc), ag->stop_desc, - ag->stop_desc_dma); -err_free_irq: - free_irq(dev->irq, dev); -err_unmap_base: - iounmap(ag->mac_base); -err_free_dev: - kfree(dev); -err_out: - platform_set_drvdata(pdev, NULL); return err; } static int ag71xx_remove(struct platform_device *pdev) { struct net_device *dev = platform_get_drvdata(pdev); + struct ag71xx *ag; - if (dev) { - struct ag71xx *ag = netdev_priv(dev); - - ag71xx_debugfs_exit(ag); - ag71xx_phy_disconnect(ag); - unregister_netdev(dev); - free_irq(dev->irq, dev); - iounmap(ag->mac_base); - kfree(dev); - platform_set_drvdata(pdev, NULL); - } + if (!dev) + return 0; + ag = netdev_priv(dev); + ag71xx_debugfs_exit(ag); + ag71xx_phy_disconnect(ag); + unregister_netdev(dev); + platform_set_drvdata(pdev, NULL); return 0; } diff --git a/target/linux/ar71xx/files/drivers/net/ethernet/atheros/ag71xx/ag71xx_phy.c b/target/linux/ar71xx/files/drivers/net/ethernet/atheros/ag71xx/ag71xx_phy.c index 12fa2e301b..336143f753 100644 --- a/target/linux/ar71xx/files/drivers/net/ethernet/atheros/ag71xx/ag71xx_phy.c +++ b/target/linux/ar71xx/files/drivers/net/ethernet/atheros/ag71xx/ag71xx_phy.c @@ -128,9 +128,9 @@ static int ag71xx_phy_connect_multi(struct ag71xx *ag) continue; DBG("%s: PHY found at %s, uid=%08x\n", - dev_name(dev), - dev_name(&ag->mii_bus->mdio_map[phy_addr]->dev), - ag->mii_bus->mdio_map[phy_addr]->phy_id); + dev_name(dev), + dev_name(&ag->mii_bus->mdio_map[phy_addr]->dev), + (phydev) ? phydev->phy_id : 0); if (phydev == NULL) phydev = mdiobus_get_phy(ag->mii_bus, phy_addr); diff --git a/target/linux/ar71xx/image/Makefile b/target/linux/ar71xx/image/Makefile index 7f37a2f279..804532b55c 100644 --- a/target/linux/ar71xx/image/Makefile +++ b/target/linux/ar71xx/image/Makefile @@ -16,6 +16,7 @@ ifeq ($(SUBTARGET),generic) include ./generic.mk include ./generic-legacy-devices.mk include ./generic-tp-link.mk +include ./generic-ubnt.mk endif ifeq ($(SUBTARGET),tiny) include ./tiny.mk diff --git a/target/linux/ar71xx/image/generic-legacy-devices.mk b/target/linux/ar71xx/image/generic-legacy-devices.mk index 1dcbb9d471..0e656ba350 100644 --- a/target/linux/ar71xx/image/generic-legacy-devices.mk +++ b/target/linux/ar71xx/image/generic-legacy-devices.mk @@ -1,3 +1,4 @@ + define LegacyDevice/ALFANX DEVICE_TITLE := ALFA Network N2/N5 board endef @@ -148,6 +149,7 @@ define LegacyDevice/DGL5500A1 endef LEGACY_DEVICES += DGL5500A1 + define LegacyDevice/DHP1565A1 DEVICE_TITLE := D-Link DHP-1565 rev. A1 DEVICE_PACKAGES := kmod-usb-core kmod-usb2 @@ -211,12 +213,15 @@ define LegacyDevice/dLAN_pro_500_wp endef LEGACY_DEVICES += dLAN_pro_500_wp + define LegacyDevice/ESR900 DEVICE_TITLE := EnGenius ESR900 DEVICE_PACKAGES := kmod-usb-core kmod-usb2 kmod-usb-ledtrig-usbport endef LEGACY_DEVICES += ESR900 + + define LegacyDevice/WP543_8M DEVICE_TITLE := Compex WP543/WPJ543 (8MB flash) DEVICE_PACKAGES := kmod-usb-core kmod-usb-ohci kmod-usb2 @@ -259,6 +264,7 @@ define LegacyDevice/OM5P endef LEGACY_DEVICES += OM5P + define LegacyDevice/MR600 DEVICE_TITLE := OpenMesh MR600 DEVICE_PACKAGES := om-watchdog @@ -271,6 +277,7 @@ define LegacyDevice/MR900 endef LEGACY_DEVICES += MR900 + define LegacyDevice/ALL0305 DEVICE_TITLE := Allnet ALL0305 DEVICE_PACKAGES := fconfig kmod-ath5k -kmod-ath9k diff --git a/target/linux/ar71xx/image/generic-tp-link.mk b/target/linux/ar71xx/image/generic-tp-link.mk index 9f466d1461..01ae420c06 100644 --- a/target/linux/ar71xx/image/generic-tp-link.mk +++ b/target/linux/ar71xx/image/generic-tp-link.mk @@ -6,6 +6,12 @@ define Device/archer-cxx KERNEL := kernel-bin | patch-cmdline | lzma | uImageArcher lzma endef + + + + + + define Device/archer-c5-v1 $(Device/tplink-16mlzma) DEVICE_TITLE := TP-LINK Archer C5 v1 @@ -50,26 +56,8 @@ define Device/archer-c7-v2-il endef TARGET_DEVICES += archer-c7-v2-il -define Device/tl-wdr7500-v3 - $(Device/tplink-8mlzma) - DEVICE_TITLE := TP-LINK Archer C7 v3 - DEVICE_PACKAGES := kmod-usb-core kmod-usb2 kmod-usb-ledtrig-usbport - BOARDNAME := ARCHER-C7 - DEVICE_PROFILE := ARCHERC7 - TPLINK_HWID := 0x75000003 -endef -TARGET_DEVICES += tl-wdr7500-v3 -define Device/archer-c7-v5 - $(Device/archer-c7-v4) - DEVICE_TITLE := TP-LINK Archer C7 v5 - BOARDNAME := ARCHER-C7-V5 - TPLINK_BOARD_ID := ARCHER-C7-V5 - IMAGE_SIZE := 15360k - MTDPARTS := spi0.0:128k(factory-uboot)ro,128k(u-boot)ro,64k@0x50000(art)ro,15360k@0xc0000(firmware) - SUPPORTED_DEVICES := archer-c7-v5 -endef -TARGET_DEVICES += archer-c7-v5 + define Device/cpe510-520-v1 DEVICE_TITLE := TP-LINK CPE510/520 v1 @@ -104,12 +92,29 @@ define Device/cpe210-v2 TPLINK_BOARD_ID := CPE210V2 TPLINK_HWID := 0x0 TPLINK_HWREV := 0 - MTDPARTS := spi0.0:128k(u-boot)ro,64k(partition-table)ro,64k(product-info)ro,1792k(kernel),5888k(rootfs),192k(config)ro,64k(ART)ro,7680k@0x40000(firmware) + MTDPARTS := spi0.0:128k(u-boot)ro,64k(partition-table)ro,64k(product-info)ro,7680k(firmware),192k(config)ro,64k(ART)ro IMAGE_SIZE := 7680k + KERNEL := kernel-bin | patch-cmdline | lzma | tplink-v1-header -O + KERNEL_INITRAMFS := kernel-bin | patch-cmdline | lzma | tplink-v1-header DEVICE_PACKAGES := rssileds endef TARGET_DEVICES += cpe210-v2 +define Device/cpe210-v3 + $(Device/tplink-safeloader) + DEVICE_TITLE := TP-LINK CPE210 v3 + BOARDNAME := CPE210V3 + TPLINK_BOARD_ID := CPE210V3 + TPLINK_HWID := 0x0 + TPLINK_HWREV := 0 + MTDPARTS := spi0.0:128k(u-boot)ro,64k(partition-table)ro,64k(product-info)ro,7680k(firmware),192k(config)ro,64k(ART)ro + IMAGE_SIZE := 7680k + KERNEL := kernel-bin | patch-cmdline | lzma | tplink-v1-header -O + KERNEL_INITRAMFS := kernel-bin | patch-cmdline | lzma | tplink-v1-header + DEVICE_PACKAGES := rssileds +endef +TARGET_DEVICES += cpe210-v3 + define Device/wbs210-v1 $(Device/cpe510-520-v1) DEVICE_TITLE := TP-LINK WBS210 v1 @@ -141,6 +146,8 @@ define Device/eap120-v1 endef TARGET_DEVICES += eap120-v1 + + define Device/tl-mr6400-v1 $(Device/tplink-8mlzma) DEVICE_TITLE := TP-LINK TL-MR6400 v1 @@ -202,6 +209,7 @@ define Device/tl-wdr4900-v2 endef TARGET_DEVICES += tl-wdr4900-v2 + define Device/mw4530r-v1 $(Device/tl-wdr4300-v1) DEVICE_TITLE := Mercury MW4530R v1 @@ -209,6 +217,7 @@ define Device/mw4530r-v1 endef TARGET_DEVICES += mw4530r-v1 + define Device/tl-wr1043n-v5 $(Device/archer-cxx) DEVICE_TITLE := TP-LINK TL-WR1043N v5 @@ -344,6 +353,7 @@ define Device/tl-wr842n-v3 endef TARGET_DEVICES += tl-wr842n-v3 + define Device/tl-wr942n-v1 $(Device/archer-cxx) DEVICE_TITLE := TP-LINK TL-WR942N v1 diff --git a/target/linux/ar71xx/image/generic-ubnt.mk b/target/linux/ar71xx/image/generic-ubnt.mk new file mode 100644 index 0000000000..3b31735153 --- /dev/null +++ b/target/linux/ar71xx/image/generic-ubnt.mk @@ -0,0 +1,280 @@ +DEVICE_VARS += UBNT_BOARD UBNT_CHIP UBNT_TYPE UBNT_VERSION UBNT_REVISION + +# On M (XW) devices the U-Boot as of version 1.1.4-s1039 doesn't like +# VERSION_DIST being on the place of major(?) version number, so we need to +# use some number. +UBNT_REVISION := $(VERSION_DIST)-$(REVISION) + +# mkubntimage is using the kernel image direct +# routerboard creates partitions out of the ubnt header +define Build/mkubntimage + -$(STAGING_DIR_HOST)/bin/mkfwimage \ + -B $(UBNT_BOARD) -v $(UBNT_TYPE).$(UBNT_CHIP).v6.0.0-$(VERSION_DIST)-$(REVISION) \ + -k $(IMAGE_KERNEL) \ + -r $@ \ + -o $@ +endef + +# all UBNT XM device expect the kernel image to have 1024k while flash, when +# booting the image, the size doesn't matter. +define Build/mkubntimage-split + -[ -f $@ ] && ( \ + dd if=$@ of=$@.old1 bs=1024k count=1; \ + dd if=$@ of=$@.old2 bs=1024k skip=1; \ + $(STAGING_DIR_HOST)/bin/mkfwimage \ + -B $(UBNT_BOARD) -v $(UBNT_TYPE).$(UBNT_CHIP).v$(UBNT_VERSION)-$(UBNT_REVISION) \ + -k $@.old1 \ + -r $@.old2 \ + -o $@; \ + rm $@.old1 $@.old2 ) +endef + +define Build/mkubntimage2 + -$(STAGING_DIR_HOST)/bin/mkfwimage2 -f 0x9f000000 \ + -v $(UBNT_TYPE).$(UBNT_CHIP).v6.0.0-$(VERSION_DIST)-$(REVISION) \ + -p jffs2:0x50000:0xf60000:0:0:$@ \ + -o $@.new + @mv $@.new $@ +endef + + +# UBNT_BOARD e.g. one of (XS2, XS5, RS, XM) +# UBNT_TYPE e.g. one of (BZ, XM, XW) +# UBNT_CHIP e.g. one of (ar7240, ar933x, ar934x) +# UBNT_VERSION e.g. one of (6.0.0, 8.5.0) +define Device/ubnt + DEVICE_PACKAGES := kmod-usb-core kmod-usb2 + DEVICE_PROFILE := UBNT + IMAGE_SIZE := 7552k + MTDPARTS := spi0.0:256k(u-boot)ro,64k(u-boot-env)ro,7552k(firmware),256k(cfg)ro,64k(EEPROM)ro + UBNT_BOARD := XM + UBNT_VERSION := 6.0.0 + IMAGES := sysupgrade.bin factory.bin + IMAGE/sysupgrade.bin := append-kernel | pad-to $$$$(BLOCKSIZE) | append-rootfs | pad-rootfs | check-size $$$$(IMAGE_SIZE) + IMAGE/factory.bin := $$(IMAGE/sysupgrade.bin) | mkubntimage-split +endef + +define Device/ubnt-xm + $(Device/ubnt) + DEVICE_PACKAGES += kmod-usb-ohci rssileds + UBNT_TYPE := XM + UBNT_CHIP := ar7240 + KERNEL := kernel-bin | patch-cmdline | relocate-kernel | lzma | uImage lzma +endef + +define Device/ubnt-xw + $(Device/ubnt) + DEVICE_PACKAGES += rssileds + UBNT_TYPE := XW + UBNT_CHIP := ar934x + UBNT_VERSION := 6.0.4 + UBNT_REVISION := 42.$(UBNT_REVISION) +endef + +define Device/ubnt-bz + $(Device/ubnt) + UBNT_TYPE := BZ + UBNT_CHIP := ar7240 +endef + +define Device/rw2458n + $(Device/ubnt-xm) + DEVICE_TITLE := Ubiquiti RW2458N + BOARDNAME := RW2458N +endef +TARGET_DEVICES += rw2458n + +define Device/ubnt-airrouter + $(Device/ubnt-xm) + DEVICE_TITLE := Ubiquiti AirRouter + BOARDNAME := UBNT-AR +endef +TARGET_DEVICES += ubnt-airrouter + +define Device/ubnt-bullet-m + $(Device/ubnt-xm) + DEVICE_TITLE := Ubiquiti Bullet-M + BOARDNAME := UBNT-BM +endef +TARGET_DEVICES += ubnt-bullet-m + +define Device/ubnt-rocket-m + $(Device/ubnt-xm) + DEVICE_TITLE := Ubiquiti Rocket-M + BOARDNAME := UBNT-RM +endef +TARGET_DEVICES += ubnt-rocket-m + +define Device/ubnt-nano-m + $(Device/ubnt-xm) + DEVICE_TITLE := Ubiquiti Nano-M + BOARDNAME := UBNT-NM +endef +TARGET_DEVICES += ubnt-nano-m + +define Device/ubnt-unifi + $(Device/ubnt-bz) + DEVICE_TITLE := Ubiquiti UniFi + BOARDNAME := UBNT-UF + DEVICE_PROFILE += UBNTUNIFI +endef +TARGET_DEVICES += ubnt-unifi + +define Device/ubnt-unifiac + DEVICE_PACKAGES := kmod-usb-core kmod-usb2 + DEVICE_PROFILE := UBNT + IMAGE_SIZE := 7744k + MTDPARTS := spi0.0:384k(u-boot)ro,64k(u-boot-env)ro,7744k(firmware),7744k(ubnt-airos)ro,128k(bs),256k(cfg)ro,64k(EEPROM)ro + IMAGES := sysupgrade.bin + IMAGE/sysupgrade.bin := append-kernel | pad-to $$$$(BLOCKSIZE) | append-rootfs | pad-rootfs | check-size $$$$(IMAGE_SIZE) +endef + + + + + +define Device/ubnt-unifi-outdoor + $(Device/ubnt-bz) + DEVICE_TITLE := Ubiquiti UniFi Outdoor + BOARDNAME := UBNT-U20 + DEVICE_PROFILE += UBNTUNIFIOUTDOOR +endef +TARGET_DEVICES += ubnt-unifi-outdoor + +define Device/ubnt-nano-m-xw + $(Device/ubnt-xw) + DEVICE_TITLE := Ubiquiti Nano M XW + BOARDNAME := UBNT-NM-XW +endef +TARGET_DEVICES += ubnt-nano-m-xw + +define Device/ubnt-lbe-m5 + $(Device/ubnt-xw) + DEVICE_TITLE := Ubiquiti Litebeam M5 + BOARDNAME := UBNT-LBE-M5 +endef +TARGET_DEVICES += ubnt-lbe-m5 + +define Device/ubnt-loco-m-xw + $(Device/ubnt-xw) + DEVICE_TITLE := Ubiquiti Loco XW + BOARDNAME := UBNT-LOCO-XW +endef +TARGET_DEVICES += ubnt-loco-m-xw + +define Device/ubnt-bullet-m-xw + $(Device/ubnt-xw) + DEVICE_TITLE := Ubiquiti Bullet-M XW + BOARDNAME := UBNT-BM-XW +endef +TARGET_DEVICES += ubnt-bullet-m-xw + +define Device/ubnt-rocket-m-xw + $(Device/ubnt-xw) + DEVICE_TITLE := Ubiquiti Rocket M XW + BOARDNAME := UBNT-RM-XW +endef +TARGET_DEVICES += ubnt-rocket-m-xw + +define Device/ubnt-rocket-m-ti + $(Device/ubnt-xw) + DEVICE_TITLE := Ubiquiti Rocket M TI + BOARDNAME := UBNT-RM-TI + UBNT_TYPE := TI +endef +TARGET_DEVICES += ubnt-rocket-m-ti + +define Device/ubnt-air-gateway + $(Device/ubnt-xm) + DEVICE_TITLE := Ubiquiti Air Gateway + BOARDNAME := UBNT-AGW + UBNT_TYPE := AirGW + UBNT_CHIP := ar933x + CONSOLE := ttyATH0,115200 +endef +TARGET_DEVICES += ubnt-air-gateway + +define Device/ubnt-air-gateway-pro + $(Device/ubnt-xm) + DEVICE_TITLE := Ubiquiti Air Gateway Pro + BOARDNAME := UBNT-AGWP + UBNT_TYPE := AirGWP + UBNT_CHIP := ar934x +endef +TARGET_DEVICES += ubnt-air-gateway-pro + +define Device/ubdev01 + $(Device/ubnt-xm) + DEVICE_TITLE := Ubiquiti ubDEV01 + MTDPARTS := spi0.0:256k(u-boot)ro,64k(u-boot-env)ro,7488k(firmware),64k(certs),256k(cfg)ro,64k(EEPROM)ro + BOARDNAME := UBNT-UF + UBNT_BOARD := UBDEV01 +endef +TARGET_DEVICES += ubdev01 + +define Device/ubnt-routerstation + DEVICE_PACKAGES := kmod-usb-core kmod-usb-ohci kmod-usb2 + DEVICE_PROFILE := UBNT + IMAGE_SIZE := 16128k + IMAGES := sysupgrade.bin factory.bin + IMAGE/factory.bin := append-rootfs | pad-rootfs | mkubntimage + IMAGE/sysupgrade.bin := append-rootfs | pad-rootfs | combined-image | check-size $$$$(IMAGE_SIZE) + KERNEL := kernel-bin | patch-cmdline | lzma | pad-to $$(BLOCKSIZE) +endef + +define Device/ubnt-rs + $(Device/ubnt-routerstation) + DEVICE_TITLE := Ubiquiti RouterStation + BOARDNAME := UBNT-RS + DEVICE_PROFILE += UBNTRS + UBNT_BOARD := RS + UBNT_TYPE := RSx + UBNT_CHIP := ar7100 +endef +TARGET_DEVICES += ubnt-rs + +define Device/ubnt-rspro + $(Device/ubnt-routerstation) + DEVICE_TITLE := Ubiquiti RouterStation Pro + BOARDNAME := UBNT-RSPRO + DEVICE_PROFILE += UBNTRSPRO + UBNT_BOARD := RSPRO + UBNT_TYPE := RSPRO + UBNT_CHIP := ar7100pro +endef +TARGET_DEVICES += ubnt-rspro + +define Device/ubnt-ls-sr71 + $(Device/ubnt-routerstation) + DEVICE_TITLE := Ubiquiti LS-SR71 + BOARDNAME := UBNT-LS-SR71 + UBNT_BOARD := LS-SR71 + UBNT_TYPE := LS-SR71 + UBNT_CHIP := ar7100 +endef +TARGET_DEVICES += ubnt-ls-sr71 + +define Device/ubnt-uap-pro + DEVICE_TITLE := Ubiquiti UAP Pro + KERNEL_SIZE := 2048k + IMAGE_SIZE := 15744k + MTDPARTS := spi0.0:256k(u-boot)ro,64k(u-boot-env)ro,2048k(kernel),13696k(rootfs),256k(cfg)ro,64k(EEPROM)ro,15744k@0x50000(firmware) + UBNT_TYPE := BZ + UBNT_CHIP := ar934x + BOARDNAME := UAP-PRO + DEVICE_PROFILE := UBNT UAPPRO + KERNEL := kernel-bin | patch-cmdline | lzma | uImage lzma | jffs2 kernel0 + IMAGES := sysupgrade.bin factory.bin + IMAGE/sysupgrade.bin := append-kernel | pad-to $$$$(KERNEL_SIZE) | append-rootfs | pad-rootfs | check-size $$$$(IMAGE_SIZE) + IMAGE/factory.bin := $$(IMAGE/sysupgrade.bin) | mkubntimage2 +endef +TARGET_DEVICES += ubnt-uap-pro + +define Device/ubnt-unifi-outdoor-plus + $(Device/ubnt-uap-pro) + DEVICE_TITLE := Ubiquiti UniFi Outdoor Plus + UBNT_CHIP := ar7240 + BOARDNAME := UBNT-UOP + DEVICE_PROFILE := UBNT +endef +TARGET_DEVICES += ubnt-unifi-outdoor-plus diff --git a/target/linux/ar71xx/image/generic.mk b/target/linux/ar71xx/image/generic.mk index e0189624a1..01a39171a4 100644 --- a/target/linux/ar71xx/image/generic.mk +++ b/target/linux/ar71xx/image/generic.mk @@ -184,14 +184,11 @@ define Device/cf-e320n-v2 endef TARGET_DEVICES += cf-e320n-v2 -define Device/cf-e380ac-v2 - $(Device/cf-e380ac-v1) - DEVICE_TITLE := COMFAST CF-E380AC v2 - BOARDNAME := CF-E380AC-V2 - IMAGE_SIZE := 16000k - MTDPARTS := spi0.0:256k(u-boot)ro,64k(art)ro,16000k(firmware),64k(art-backup)ro -endef -TARGET_DEVICES += cf-e380ac-v2 + + + + + define Device/cf-e520n DEVICE_TITLE := COMFAST CF-E520N @@ -244,12 +241,7 @@ define Device/dragino2 endef TARGET_DEVICES += dragino2 -define Device/e1700ac-v2-8M - $(Device/e1700ac-v2-16M) - DEVICE_TITLE := Qxwlan E1700AC v2 (8MB flash) - IMAGE_SIZE := 7744k -endef -TARGET_DEVICES += e1700ac-v2-8M + define Device/e558-v2-16M DEVICE_TITLE := Qxwlan E558 v2 (16MB flash) @@ -289,12 +281,7 @@ define Device/e600g-v2-8M endef TARGET_DEVICES += e600g-v2-8M -define Device/e600gac-v2-8M - $(Device/e600gac-v2-16M) - DEVICE_TITLE := Qxwlan E600GAC v2 (8MB flash) - IMAGE_SIZE := 7744k -endef -TARGET_DEVICES += e600gac-v2-8M + define Device/e750a-v4-16M DEVICE_TITLE := Qxwlan E750A v4 (16MB flash) @@ -734,6 +721,7 @@ define Device/jwap230 endef TARGET_DEVICES += jwap230 + define Device/r36a DEVICE_TITLE := ALFA Network R36A DEVICE_PACKAGES := kmod-usb-core kmod-usb2 kmod-usb-ledtrig-usbport -swconfig @@ -777,6 +765,16 @@ define Device/rut900 endef TARGET_DEVICES += rut900 + + + + + + + + + + define Device/minibox-v1 $(Device/tplink-16mlzma) DEVICE_TITLE := GainStrong MiniBox V1.0 @@ -789,6 +787,16 @@ define Device/minibox-v1 endef TARGET_DEVICES += minibox-v1 +define Device/minibox-v3.2 + $(Device/tplink-16mlzma) + DEVICE_TITLE := Gainstrong MiniBox V3.2 + DEVICE_PACKAGES := kmod-usb-core kmod-usb2 kmod-usb-ledtrig-usbport -swconfig + BOARDNAME := MINIBOX-V3.2 + DEVICE_PROFILE := MINIBOXV32 + TPLINK_HWID := 0x3C00010C +endef +TARGET_DEVICES += minibox-v3.2 + define Device/oolite-v1 $(Device/minibox-v1) DEVICE_TITLE := GainStrong Oolite V1.0 @@ -798,13 +806,7 @@ define Device/oolite-v1 endef TARGET_DEVICES += oolite-v1 -define Device/oolite-v5.2-dev - $(Device/oolite-v5.2) - DEVICE_TITLE := GainStrong Oolite V5.2-Dev (development board) - BOARDNAME := OOLITE-V5-2-DEV - DEVICE_PROFILE := OOLITEV52DEV -endef -TARGET_DEVICES += oolite-v5.2-dev + define Device/omy-g1 $(Device/tplink-16mlzma) @@ -883,6 +885,8 @@ define Device/som9331 endef TARGET_DEVICES += som9331 + + define Device/t830 DEVICE_TITLE := YunCore T830 DEVICE_PACKAGES := kmod-usb-core kmod-usb2 kmod-usb-ledtrig-usbport @@ -929,6 +933,7 @@ define Device/n5q endef TARGET_DEVICES += n5q + define Device/c-55 DEVICE_TITLE := AirTight Networks C-55 DEVICE_PACKAGES := kmod-ath9k @@ -975,6 +980,21 @@ define Device/seama SEAMA_SIGNATURE := endef +define Device/dir-869-a1 + $(Device/seama) + DEVICE_TITLE := D-Link DIR-869 rev. A1 + DEVICE_PACKAGES := + BOARDNAME := DIR-869-A1 + IMAGE_SIZE := 15872k + MTDPARTS := spi0.0:256k(u-boot)ro,64k(u-boot-env)ro,64k(devdata)ro,64k(devconf)ro,15872k(firmware),64k(radiocfg)ro + SEAMA_SIGNATURE := wrgac54_dlink.2015_dir869 + IMAGE/factory.bin := \ + $$(IMAGE/default) | pad-rootfs -x 64 | \ + seama | seama-seal -m "signature=$$$$(SEAMA_SIGNATURE)" | \ + check-size $$$$(IMAGE_SIZE) +endef +TARGET_DEVICES += dir-869-a1 + define Device/mynet-n600 $(Device/seama) DEVICE_TITLE := Western Digital My Net N600 @@ -997,6 +1017,7 @@ define Device/mynet-n750 endef TARGET_DEVICES += mynet-n750 + define Device/dap-1330-a1 DEVICE_TITLE := D-Link DAP-1330 rev. A1 DEVICE_PACKAGES := rssileds @@ -1009,6 +1030,7 @@ define Device/dap-1330-a1 endef TARGET_DEVICES += dap-1330-a1 + define Device/wam250 DEVICE_TITLE := Samsung WAM250 DEVICE_PACKAGES := kmod-usb-core kmod-usb2 -swconfig @@ -1034,6 +1056,7 @@ define Device/wifi-pineapple-nano endef TARGET_DEVICES += wifi-pineapple-nano + define Device/wpj-16m DEVICE_PACKAGES := kmod-usb-core kmod-usb2 kmod-usb-ledtrig-usbport MTDPARTS := spi0.0:192k(u-boot)ro,16128k(firmware),64k(art)ro diff --git a/target/linux/ar71xx/image/nand.mk b/target/linux/ar71xx/image/nand.mk index 456b1fdbb5..ef441317e4 100644 --- a/target/linux/ar71xx/image/nand.mk +++ b/target/linux/ar71xx/image/nand.mk @@ -29,6 +29,7 @@ define Device/c-60 endef TARGET_DEVICES += c-60 + define Device/hiveap-121 DEVICE_TITLE := Aerohive HiveAP-121 DEVICE_PACKAGES := kmod-usb-core kmod-usb2 kmod-i2c-gpio-custom kmod-spi-gpio kmod-ath9k kmod-tpm-i2c-atmel @@ -74,6 +75,7 @@ define Device/rambutan endef TARGET_DEVICES += rambutan + define Device/z1 DEVICE_TITLE := Meraki Z1 DEVICE_PACKAGES := kmod-usb-core kmod-usb2 kmod-usb-ledtrig-usbport kmod-spi-gpio kmod-ath9k kmod-owl-loader @@ -87,6 +89,7 @@ define Device/z1 endef TARGET_DEVICES += z1 + define LegacyDevice/WNDR3700V4 DEVICE_TITLE := NETGEAR WNDR3700v4 DEVICE_PACKAGES := kmod-usb-core kmod-usb2 kmod-usb-ledtrig-usbport @@ -98,3 +101,4 @@ define LegacyDevice/WNDR4300V1 DEVICE_PACKAGES := kmod-usb-core kmod-usb2 kmod-usb-ledtrig-usbport endef LEGACY_DEVICES += WNDR4300V1 + diff --git a/target/linux/ar71xx/image/tiny-legacy-devices.mk b/target/linux/ar71xx/image/tiny-legacy-devices.mk index 3445c4c8c3..fb9633d0ab 100644 --- a/target/linux/ar71xx/image/tiny-legacy-devices.mk +++ b/target/linux/ar71xx/image/tiny-legacy-devices.mk @@ -1,3 +1,4 @@ + define LegacyDevice/DIR600A1 DEVICE_TITLE := D-Link DIR-600 rev. A1 endef diff --git a/target/linux/ar71xx/patches-4.14/310-lib-add-rle-decompression.patch b/target/linux/ar71xx/patches-4.14/310-lib-add-rle-decompression.patch index 766ffbeb76..727f4d8343 100644 --- a/target/linux/ar71xx/patches-4.14/310-lib-add-rle-decompression.patch +++ b/target/linux/ar71xx/patches-4.14/310-lib-add-rle-decompression.patch @@ -12,7 +12,7 @@ # ZLIB_INFLATE; DECOMPRESS_GZIP is just a wrapper.) --- a/lib/Makefile +++ b/lib/Makefile -@@ -134,6 +134,7 @@ obj-$(CONFIG_XZ_DEC) += xz/ +@@ -146,6 +146,7 @@ obj-$(CONFIG_XZ_DEC) += xz/ obj-$(CONFIG_RAID6_PQ) += raid6/ obj-$(CONFIG_LZMA_COMPRESS) += lzma/ obj-$(CONFIG_LZMA_DECOMPRESS) += lzma/ diff --git a/target/linux/ar71xx/patches-4.14/450-gpio-nxp-74hc153-gpio-chip-driver.patch b/target/linux/ar71xx/patches-4.14/450-gpio-nxp-74hc153-gpio-chip-driver.patch index 3ea491bc37..0902773ff4 100644 --- a/target/linux/ar71xx/patches-4.14/450-gpio-nxp-74hc153-gpio-chip-driver.patch +++ b/target/linux/ar71xx/patches-4.14/450-gpio-nxp-74hc153-gpio-chip-driver.patch @@ -1,6 +1,6 @@ --- a/drivers/gpio/Kconfig +++ b/drivers/gpio/Kconfig -@@ -1298,4 +1298,12 @@ config GPIO_VIPERBOARD +@@ -1299,4 +1299,12 @@ config GPIO_VIPERBOARD endmenu diff --git a/target/linux/ar71xx/patches-4.14/451-gpio-74x164-improve-platform-device-support.patch b/target/linux/ar71xx/patches-4.14/451-gpio-74x164-improve-platform-device-support.patch index 870804e937..8039a71689 100644 --- a/target/linux/ar71xx/patches-4.14/451-gpio-74x164-improve-platform-device-support.patch +++ b/target/linux/ar71xx/patches-4.14/451-gpio-74x164-improve-platform-device-support.patch @@ -109,7 +109,7 @@ +#endif --- a/drivers/gpio/Kconfig +++ b/drivers/gpio/Kconfig -@@ -1250,7 +1250,6 @@ menu "SPI GPIO expanders" +@@ -1251,7 +1251,6 @@ menu "SPI GPIO expanders" config GPIO_74X164 tristate "74x164 serial-in/parallel-out 8-bits shift register" diff --git a/target/linux/ar71xx/patches-4.14/452-gpio-add-gpio-latch-driver.patch b/target/linux/ar71xx/patches-4.14/452-gpio-add-gpio-latch-driver.patch index d88b480410..13c5781dee 100644 --- a/target/linux/ar71xx/patches-4.14/452-gpio-add-gpio-latch-driver.patch +++ b/target/linux/ar71xx/patches-4.14/452-gpio-add-gpio-latch-driver.patch @@ -1,6 +1,6 @@ --- a/drivers/gpio/Kconfig +++ b/drivers/gpio/Kconfig -@@ -1305,4 +1305,9 @@ config GPIO_NXP_74HC153 +@@ -1306,4 +1306,9 @@ config GPIO_NXP_74HC153 Platform driver for NXP 74HC153 Dual 4-input Multiplexer. This provides a GPIO interface supporting input mode only. diff --git a/target/linux/ar71xx/patches-4.14/500-MIPS-fw-myloader.patch b/target/linux/ar71xx/patches-4.14/500-MIPS-fw-myloader.patch index 0797bf7ba2..f22806abc5 100644 --- a/target/linux/ar71xx/patches-4.14/500-MIPS-fw-myloader.patch +++ b/target/linux/ar71xx/patches-4.14/500-MIPS-fw-myloader.patch @@ -1,6 +1,6 @@ --- a/arch/mips/Makefile +++ b/arch/mips/Makefile -@@ -223,6 +223,7 @@ cflags-$(toolchain-virt) += -DTOOLCHAIN +@@ -228,6 +228,7 @@ cflags-$(toolchain-virt) += -DTOOLCHAIN # libs-$(CONFIG_FW_ARC) += arch/mips/fw/arc/ libs-$(CONFIG_FW_CFE) += arch/mips/fw/cfe/ diff --git a/target/linux/ar71xx/patches-4.14/509-MIPS-ath79-process-board-kernel-option.patch b/target/linux/ar71xx/patches-4.14/509-MIPS-ath79-process-board-kernel-option.patch index 3091ab69b6..139b09c1b0 100644 --- a/target/linux/ar71xx/patches-4.14/509-MIPS-ath79-process-board-kernel-option.patch +++ b/target/linux/ar71xx/patches-4.14/509-MIPS-ath79-process-board-kernel-option.patch @@ -1,6 +1,6 @@ --- a/arch/mips/ath79/setup.c +++ b/arch/mips/ath79/setup.c -@@ -283,6 +283,8 @@ void __init plat_time_init(void) +@@ -277,6 +277,8 @@ void __init plat_time_init(void) mips_hpt_frequency = cpu_clk_rate / 2; } diff --git a/target/linux/ar71xx/patches-4.14/525-MIPS-ath79-enable-qca-usb-quirks.patch b/target/linux/ar71xx/patches-4.14/525-MIPS-ath79-enable-qca-usb-quirks.patch index 0e33674adf..3cafbe290c 100644 --- a/target/linux/ar71xx/patches-4.14/525-MIPS-ath79-enable-qca-usb-quirks.patch +++ b/target/linux/ar71xx/patches-4.14/525-MIPS-ath79-enable-qca-usb-quirks.patch @@ -77,7 +77,7 @@ + + switch (pdev->id) { + case 0: -+ base = 0x18116c94; ++ base = 0x18116d94; + break; + + case 1: diff --git a/target/linux/ar71xx/patches-4.14/604-MIPS-ath79-no-of.patch b/target/linux/ar71xx/patches-4.14/604-MIPS-ath79-no-of.patch index 5be33f9b08..2e7d5d8232 100644 --- a/target/linux/ar71xx/patches-4.14/604-MIPS-ath79-no-of.patch +++ b/target/linux/ar71xx/patches-4.14/604-MIPS-ath79-no-of.patch @@ -10,7 +10,7 @@ --- a/arch/mips/ath79/setup.c +++ b/arch/mips/ath79/setup.c -@@ -196,16 +196,20 @@ unsigned int get_c0_compare_int(void) +@@ -190,16 +190,20 @@ unsigned int get_c0_compare_int(void) void __init plat_mem_setup(void) { @@ -31,7 +31,7 @@ if (mips_machtype != ATH79_MACH_GENERIC_OF) { ath79_reset_base = ioremap_nocache(AR71XX_RESET_BASE, -@@ -301,17 +305,21 @@ static int __init ath79_setup(void) +@@ -295,17 +299,21 @@ static int __init ath79_setup(void) arch_initcall(ath79_setup); diff --git a/target/linux/ar71xx/patches-4.14/910-unaligned_access_hacks.patch b/target/linux/ar71xx/patches-4.14/910-unaligned_access_hacks.patch index 99624f07c1..fbad39a5cc 100644 --- a/target/linux/ar71xx/patches-4.14/910-unaligned_access_hacks.patch +++ b/target/linux/ar71xx/patches-4.14/910-unaligned_access_hacks.patch @@ -457,7 +457,7 @@ memcpy(p, foc->val, foc->len); --- a/net/ipv4/igmp.c +++ b/net/ipv4/igmp.c -@@ -537,7 +537,7 @@ static struct sk_buff *add_grec(struct s +@@ -548,7 +548,7 @@ static struct sk_buff *add_grec(struct s if (!skb) return NULL; psrc = skb_put(skb, sizeof(__be32)); @@ -506,7 +506,7 @@ #define IGMP_HOST_MEMBERSHIP_REPORT 0x12 /* Ditto */ --- a/net/core/flow_dissector.c +++ b/net/core/flow_dissector.c -@@ -108,7 +108,7 @@ __be32 __skb_flow_get_ports(const struct +@@ -109,7 +109,7 @@ __be32 __skb_flow_get_ports(const struct ports = __skb_header_pointer(skb, thoff + poff, sizeof(_ports), data, hlen, &_ports); if (ports) @@ -661,7 +661,7 @@ return false; return true; -@@ -634,13 +638,13 @@ static inline void ipv6_addr_set_v4mappe +@@ -605,13 +609,13 @@ static inline void ipv6_addr_set_v4mappe */ static inline int __ipv6_addr_diff32(const void *token1, const void *token2, int addrlen) { @@ -677,7 +677,7 @@ if (xb) return i * 32 + 31 - __fls(ntohl(xb)); } -@@ -809,17 +813,18 @@ static inline int ip6_default_np_autolab +@@ -780,17 +784,18 @@ static inline int ip6_default_np_autolab static inline void ip6_flow_hdr(struct ipv6hdr *hdr, unsigned int tclass, __be32 flowlabel) { @@ -757,7 +757,7 @@ EXPORT_SYMBOL(xfrm_parse_spi); --- a/net/ipv4/tcp_input.c +++ b/net/ipv4/tcp_input.c -@@ -3858,14 +3858,16 @@ static bool tcp_parse_aligned_timestamp( +@@ -3874,14 +3874,16 @@ static bool tcp_parse_aligned_timestamp( { const __be32 *ptr = (const __be32 *)(th + 1); @@ -850,7 +850,7 @@ *sum = csum_fold(csum_partial(diff, sizeof(diff), --- a/drivers/net/vxlan.c +++ b/drivers/net/vxlan.c -@@ -1857,15 +1857,15 @@ static int vxlan_build_skb(struct sk_buf +@@ -1868,15 +1868,15 @@ static int vxlan_build_skb(struct sk_buf return err; vxh = __skb_push(skb, sizeof(*vxh)); diff --git a/target/linux/ar71xx/patches-4.14/930-chipidea-pullup.patch b/target/linux/ar71xx/patches-4.14/930-chipidea-pullup.patch index 6e293305db..2e9a878630 100644 --- a/target/linux/ar71xx/patches-4.14/930-chipidea-pullup.patch +++ b/target/linux/ar71xx/patches-4.14/930-chipidea-pullup.patch @@ -37,7 +37,7 @@ ret = hw_device_init(ci, base); if (ret < 0) { dev_err(dev, "can't initialize hardware\n"); -@@ -1004,7 +1007,7 @@ static int ci_hdrc_probe(struct platform +@@ -1011,7 +1014,7 @@ static int ci_hdrc_probe(struct platform goto deinit_gadget; } diff --git a/target/linux/ar71xx/patches-4.14/950-add-boardinfo-platform-data.patch b/target/linux/ar71xx/patches-4.14/950-add-boardinfo-platform-data.patch index 6b0d300023..edeac838d9 100644 --- a/target/linux/ar71xx/patches-4.14/950-add-boardinfo-platform-data.patch +++ b/target/linux/ar71xx/patches-4.14/950-add-boardinfo-platform-data.patch @@ -26,7 +26,7 @@ #endif /* __MDIO_BOARD_INFO_H */ --- a/drivers/net/phy/mdio_bus.c +++ b/drivers/net/phy/mdio_bus.c -@@ -456,6 +456,17 @@ void mdiobus_free(struct mii_bus *bus) +@@ -455,6 +455,17 @@ void mdiobus_free(struct mii_bus *bus) } EXPORT_SYMBOL(mdiobus_free); @@ -44,7 +44,7 @@ /** * mdiobus_scan - scan a bus for MDIO devices. * @bus: mii_bus to scan -@@ -471,6 +482,7 @@ EXPORT_SYMBOL(mdiobus_free); +@@ -470,6 +481,7 @@ EXPORT_SYMBOL(mdiobus_free); struct phy_device *mdiobus_scan(struct mii_bus *bus, int addr) { struct phy_device *phydev; @@ -52,7 +52,7 @@ int err; phydev = get_phy_device(bus, addr, false); -@@ -483,6 +495,12 @@ struct phy_device *mdiobus_scan(struct m +@@ -482,6 +494,12 @@ struct phy_device *mdiobus_scan(struct m */ of_mdiobus_link_mdiodev(bus, &phydev->mdio); diff --git a/target/linux/ath79/base-files/etc/board.d/01_leds b/target/linux/ath79/base-files/etc/board.d/01_leds index 705ae3d407..41a4abae18 100755 --- a/target/linux/ath79/base-files/etc/board.d/01_leds +++ b/target/linux/ath79/base-files/etc/board.d/01_leds @@ -8,6 +8,10 @@ board=$(board_name) boardname="${board##*,}" case "$board" in +8dev,carambola2) + ucidef_set_led_netdev "lan" "LAN" "$boardname:orange:eth0" "eth0" + ucidef_set_led_switch "wan" "WAN" "$boardname:orange:eth1" "switch0" "0x04" + ;; avm,fritz300e) ucidef_set_led_netdev "lan" "LAN" "$boardname:green:lan" "eth0" ucidef_set_rssimon "wlan0" "200000" "1" @@ -18,7 +22,7 @@ avm,fritz300e) ucidef_set_led_rssi "rssihigh" "RSSIHIGH" "$boardname:green:rssi4" "wlan0" "80" "100" ;; avm,fritz4020) - ucidef_set_led_netdev "wan" "WAN" "$boardname:green:wan" "eth0" + ucidef_set_led_netdev "wan" "WAN" "$boardname:green:wan" "eth1" ucidef_set_led_switch "lan" "LAN" "$boardname:green:lan" "switch0" "0x1E" ;; buffalo,whr-g301n) @@ -29,7 +33,7 @@ buffalo,whr-g301n) ucidef_set_led_switch "lan4" "LAN4" "$boardname:green:lan4" "switch0" "0x10" ;; comfast,cf-e110n-v2) - ucidef_set_led_netdev "lan" "LAN" "$boardname:green:lan" "eth0" + ucidef_set_led_netdev "lan" "LAN" "$boardname:green:lan" "eth1" ucidef_set_led_switch "wan" "WAN" "$boardname:green:wan" "switch0" "0x02" ucidef_set_led_wlan "wlan" "WLAN" "$boardname:green:wlan" "phy0tpt" ucidef_set_rssimon "wlan0" "200000" "1" @@ -39,7 +43,7 @@ comfast,cf-e110n-v2) ucidef_set_led_rssi "rssihigh" "RSSIHIGH" "$boardname:green:rssihigh" "wlan0" "76" "100" ;; comfast,cf-e120a-v3) - ucidef_set_led_netdev "lan" "LAN" "$boardname:green:lan" "eth0" + ucidef_set_led_netdev "lan" "LAN" "$boardname:green:lan" "eth1" ucidef_set_led_switch "wan" "WAN" "$boardname:green:wan" "switch0" "0x04" ucidef_set_rssimon "wlan0" "200000" "1" ucidef_set_led_rssi "rssilow" "RSSILOW" "$boardname:red:rssilow" "wlan0" "1" "100" @@ -47,12 +51,23 @@ comfast,cf-e120a-v3) ucidef_set_led_rssi "rssimediumhigh" "RSSIMEDIUMHIGH" "$boardname:green:rssimediumhigh" "wlan0" "51" "100" ucidef_set_led_rssi "rssihigh" "RSSIHIGH" "$boardname:green:rssihigh" "wlan0" "76" "100" ;; +comfast,cf-e5) + ucidef_set_led_switch "lan" "LAN" "$boardname:blue:lan" "switch0" "0x02" + ucidef_set_led_netdev "wan" "WAN" "$boardname:blue:wan" "eth1" + ucidef_set_rssimon "wlan0" "200000" "1" + ucidef_set_led_rssi "rssilow" "RSSILOW" "$boardname:blue:rssi0" "wlan0" "1" "100" + ucidef_set_led_rssi "rssimedium" "RSSIMEDIUM" "$boardname:blue:rssi1" "wlan0" "33" "100" + ucidef_set_led_rssi "rssihigh" "RSSIHIGH" "$boardname:blue:rssi2" "wlan0" "66" "100" + ;; dlink,dir-859-a1) ucidef_set_led_switch "internet" "WAN" "$boardname:green:internet" "switch0" "0x20" ;; +engenius,ecb1750) + ucidef_set_led_netdev "lan" "LAN" "$boardname:blue:lan" "eth0" + ;; engenius,ews511ap) - ucidef_set_led_netdev "lan1" "LAN1" "$boardname:blue:lan1" "eth0" - ucidef_set_led_netdev "lan2" "LAN2" "$boardname:blue:lan2" "eth1" + ucidef_set_led_netdev "lan1" "LAN1" "$boardname:blue:lan1" "eth1" + ucidef_set_led_netdev "lan2" "LAN2" "$boardname:blue:lan2" "eth0" ;; etactica,eg200) ucidef_set_led_netdev "lan" "LAN" "$boardname:red:eth0" "eth0" @@ -60,11 +75,18 @@ etactica,eg200) ucidef_set_led_default "etactica" "etactica" "$boardname:red:etactica" "ignore" ;; glinet,gl-ar150) - ucidef_set_led_netdev "wan" "WAN" "$boardname:green:wan" "eth0" + ucidef_set_led_netdev "wan" "WAN" "$boardname:green:wan" "eth1" ucidef_set_led_switch "lan" "LAN" "$boardname:green:lan" "switch0" "0x02" ;; +glinet,gl-ar300m-nand|\ +glinet,gl-ar300m-nor) + ucidef_set_led_netdev "lan" "LAN" "gl-ar300m:green:lan" "eth0" + ;; +glinet,gl-ar300m-lite) + ucidef_set_led_netdev "lan" "LAN" "gl-ar300m-lite:green:lan" "eth0" + ;; glinet,gl-x750) - ucidef_set_led_netdev "wan" "WAN" "$boardname:green:wan" "eth0" + ucidef_set_led_netdev "wan" "WAN" "$boardname:green:wan" "eth1" ;; netgear,wnr612-v2|\ on,n150r) @@ -92,21 +114,46 @@ tplink,archer-c7-v5) ucidef_set_led_switch "lan4" "LAN4" "tp-link:green:lan4" "switch0" "0x20" ;; tplink,archer-c2-v3|\ -tplink,tl-wr1043nd-v4) +tplink,tl-wr1043nd-v4|\ +tplink,tl-wr1043n-v5) ucidef_set_led_switch "wan" "WAN" "tp-link:green:wan" "switch0" "0x20" ucidef_set_led_switch "lan1" "LAN1" "tp-link:green:lan1" "switch0" "0x10" ucidef_set_led_switch "lan2" "LAN2" "tp-link:green:lan2" "switch0" "0x08" ucidef_set_led_switch "lan3" "LAN3" "tp-link:green:lan3" "switch0" "0x04" ucidef_set_led_switch "lan4" "LAN4" "tp-link:green:lan4" "switch0" "0x02" ;; +tplink,archer-c6-v2) + ucidef_set_led_switch "lan" "LAN" "tp-link:green:lan" "switch0" "0x3C" + ucidef_set_led_switch "wan" "WAN" "tp-link:green:wan" "switch0" "0x02" + ;; +tplink,archer-c25-v1|\ +tplink,tl-wr841-v9|\ +tplink,tl-wr841-v11|\ +tplink,tl-wr842n-v3) + ucidef_set_led_netdev "wan" "WAN" "tp-link:green:wan" "eth1" + ucidef_set_led_switch "lan1" "LAN1" "tp-link:green:lan1" "switch0" "0x10" + ucidef_set_led_switch "lan2" "LAN2" "tp-link:green:lan2" "switch0" "0x08" + ucidef_set_led_switch "lan3" "LAN3" "tp-link:green:lan3" "switch0" "0x04" + ucidef_set_led_switch "lan4" "LAN4" "tp-link:green:lan4" "switch0" "0x02" + ;; tplink,archer-c58-v1|\ tplink,archer-c59-v1) ucidef_set_led_switch "lan" "LAN" "tp-link:green:lan" "switch0" "0x1E" - ucidef_set_led_netdev "wan" "WAN" "tp-link:green:wan" "eth0" + ucidef_set_led_netdev "wan" "WAN" "tp-link:green:wan" "eth1" ;; -tplink,archer-c6-v2) - ucidef_set_led_switch "lan" "LAN" "tp-link:green:lan" "switch0" "0x3C" - ucidef_set_led_switch "wan" "WAN" "tp-link:green:wan" "switch0" "0x02" +tplink,archer-d50-v1) + ucidef_set_led_switch "lan" "LAN" "tp-link:white:lan" "switch0" "0x1c" + ucidef_set_led_switch "wan_data" "WAN Data" "tp-link:white:internet" "switch0" "0x02" "" "tx rx" + ucidef_set_led_switch "wan_link" "WAN Link" "tp-link:white:wan" "switch0" "0x02" "" "link" + ;; +tplink,cpe210-v2|\ +tplink,cpe210-v3) + ucidef_set_led_netdev "lan" "LAN" "tp-link:green:lan" "eth0" + ucidef_set_rssimon "wlan0" "200000" "1" + ucidef_set_led_rssi "rssilow" "RSSILOW" "tp-link:green:link1" "wlan0" "1" "100" + ucidef_set_led_rssi "rssimediumlow" "RSSIMEDIUMLOW" "tp-link:green:link2" "wlan0" "30" "100" + ucidef_set_led_rssi "rssimediumhigh" "RSSIMEDIUMHIGH" "tp-link:green:link3" "wlan0" "60" "100" + ucidef_set_led_rssi "rssihigh" "RSSIHIGH" "tp-link:green:link4" "wlan0" "80" "100" ;; tplink,re450-v2) ucidef_set_led_netdev "lan_data" "LAN Data" "tp-link:green:lan_data" "eth0" "tx rx" @@ -132,23 +179,16 @@ tplink,tl-wr740n-v4|\ tplink,tl-wr741nd-v4|\ tplink,tl-wr841-v8|\ tplink,tl-wr842n-v2) - ucidef_set_led_netdev "wan" "WAN" "tp-link:green:wan" "eth0" + ucidef_set_led_netdev "wan" "WAN" "tp-link:green:wan" "eth1" ucidef_set_led_switch "lan1" "LAN1" "tp-link:green:lan1" "switch0" "0x04" ucidef_set_led_switch "lan2" "LAN2" "tp-link:green:lan2" "switch0" "0x08" ucidef_set_led_switch "lan3" "LAN3" "tp-link:green:lan3" "switch0" "0x10" ucidef_set_led_switch "lan4" "LAN4" "tp-link:green:lan4" "switch0" "0x02" ;; -tplink,tl-wr841-v9|\ -tplink,tl-wr841-v11) - ucidef_set_led_netdev "wan" "WAN" "tp-link:green:wan" "eth0" - ucidef_set_led_switch "lan1" "LAN1" "tp-link:green:lan1" "switch0" "0x10" - ucidef_set_led_switch "lan2" "LAN2" "tp-link:green:lan2" "switch0" "0x08" - ucidef_set_led_switch "lan3" "LAN3" "tp-link:green:lan3" "switch0" "0x04" - ucidef_set_led_switch "lan4" "LAN4" "tp-link:green:lan4" "switch0" "0x02" - ;; ubnt,bullet-m|\ ubnt,bullet-m-xw|\ -ubnt,nano-m|\ +ubnt,nanostation-m|\ +ubnt,nanostation-m-xw|\ ubnt,rocket-m) ucidef_set_rssimon "wlan0" "200000" "1" ucidef_set_led_rssi "rssilow" "RSSILOW" "ubnt:red:link1" "wlan0" "1" "100" @@ -156,6 +196,7 @@ ubnt,rocket-m) ucidef_set_led_rssi "rssimediumhigh" "RSSIMEDIUMHIGH" "ubnt:green:link3" "wlan0" "51" "100" ucidef_set_led_rssi "rssihigh" "RSSIHIGH" "ubnt:green:link4" "wlan0" "76" "100" ;; +ubnt,nanobeam-ac|\ ubnt,nanostation-ac) ucidef_set_rssimon "wlan0" "200000" "1" ucidef_set_led_rssi "rssilow" "RSSILOW" "ubnt:blue:rssi0" "wlan0" "1" "100" @@ -170,6 +211,14 @@ wd,mynet-wifi-rangeextender) ucidef_set_led_rssi "rssimedium" "RSSIMED" "$boardname:blue:rssi-med" "wlan0" "33" "100" ucidef_set_led_rssi "rssihigh" "RSSIMAX" "$boardname:blue:rssi-max" "wlan0" "66" "100" ;; +yuncore,a770) + ucidef_set_led_netdev "wan" "WAN" "$boardname:green:wan" "eth1" + ucidef_set_led_switch "lan" "LAN" "$boardname:green:lan" "switch0" "0x10" + ;; +zbtlink,zbt-wd323) + ucidef_set_led_switch "lan1" "LAN1" "zbt-wd323:orange:lan1" "switch0" "0x10" + ucidef_set_led_switch "lan2" "LAN2" "zbt-wd323:orange:lan2" "switch0" "0x08" + ;; esac board_config_flush diff --git a/target/linux/ath79/base-files/etc/board.d/02_network b/target/linux/ath79/base-files/etc/board.d/02_network index f1171695bd..caac39ca07 100755 --- a/target/linux/ath79/base-files/etc/board.d/02_network +++ b/target/linux/ath79/base-files/etc/board.d/02_network @@ -9,15 +9,24 @@ ath79_setup_interfaces() local board="$1" case "$board" in + aruba,ap-105|\ avm,fritz300e|\ devolo,dvl1200i|\ devolo,dvl1750c|\ devolo,dvl1750i|\ + devolo,dvl1750x|\ + engenius,ecb1750|\ + glinet,ar300m-lite|\ + netgear,ex6400|\ + netgear,ex7300|\ ocedo,koala|\ ocedo,raccoon|\ pcs,cap324|\ pisen,wmm003n|\ pqi,air-pen|\ + tplink,cpe210-v2|\ + tplink,cpe210-v3|\ + tplink,re350k-v1|\ tplink,re450-v2|\ tplink,tl-mr10u|\ tplink,tl-mr3020-v1|\ @@ -27,6 +36,7 @@ ath79_setup_interfaces() ubnt,bullet-m|\ ubnt,bullet-m-xw|\ ubnt,lap-120|\ + ubnt,nanobeam-ac|\ ubnt,nanostation-ac-loco|\ ubnt,rocket-m|\ ubnt,unifiac-lite|\ @@ -40,9 +50,9 @@ ath79_setup_interfaces() pcs,cr3000|\ tplink,archer-c58-v1|\ tplink,archer-c59-v1) - ucidef_set_interface_wan "eth0" + ucidef_set_interface_wan "eth1" ucidef_add_switch "switch0" \ - "0@eth1" "1:lan:1" "2:lan:4" "3:lan:3" "4:lan:2" + "0@eth0" "1:lan:1" "2:lan:4" "3:lan:3" "4:lan:2" ;; buffalo,bhr-4grv|\ buffalo,wzr-hp-g450h) @@ -53,7 +63,21 @@ ath79_setup_interfaces() ucidef_add_switch "switch0" \ "0@eth1" "1:lan" "2:lan" "3:lan" "4:lan" "5:wan" "6@eth0" ;; - buffalo,wzr-hp-ag300h) + buffalo,whr-g301n) + ucidef_set_interface_wan "eth0" + ucidef_add_switch "switch0" \ + "0@eth1" "1:lan:4" "2:lan:3" "3:lan:2" "4:lan:1" + ;; + buffalo,wzr-hp-ag300h|\ + tplink,archer-c25-v1|\ + tplink,tl-mr3220-v1|\ + tplink,tl-mr3420-v1|\ + tplink,tl-wr841-v7|\ + tplink,tl-wr841-v9|\ + tplink,tl-wr841-v11|\ + tplink,tl-wr842n-v1|\ + tplink,tl-wr842n-v3|\ + ubnt,airrouter) ucidef_set_interface_wan "eth1" ucidef_add_switch "switch0" \ "0@eth0" "1:lan:4" "2:lan:3" "3:lan:2" "4:lan:1" @@ -62,8 +86,15 @@ ath79_setup_interfaces() ucidef_add_switch "switch0" \ "0@eth0" "1:lan:1" "3:lan:4" "4:lan:3" "5:lan:2" "2:wan" ;; + comfast,cf-e110n-v2|\ + comfast,cf-e120a-v3|\ + ubnt,nanostation-m|\ + ubnt,routerstation) + ucidef_set_interfaces_lan_wan "eth1" "eth0" + ;; devolo,dvl1200e|\ - devolo,dvl1750e) + devolo,dvl1750e|\ + ocedo,ursus) ucidef_set_interface_lan "eth0 eth1" ;; dlink,dir-825-b1) @@ -74,8 +105,10 @@ ath79_setup_interfaces() dlink,dir-825-c1|\ dlink,dir-835-a1|\ dlink,dir-859-a1|\ + engenius,epg5000|\ tplink,archer-c2-v3|\ - tplink,tl-wr1043nd-v4) + tplink,tl-wr1043nd-v4|\ + tplink,tl-wr1043n-v5) ucidef_add_switch "switch0" \ "0@eth0" "1:lan:4" "2:lan:3" "3:lan:2" "4:lan:1" "5:wan" ;; @@ -94,15 +127,6 @@ ath79_setup_interfaces() etactica,eg200) ucidef_set_interface_lan "eth0" "dhcp" ;; - glinet,gl-ar150|\ - glinet,gl-ar300m-nand|\ - glinet,gl-ar300m-nor|\ - glinet,gl-x750|\ - tplink,tl-wr810n-v1|\ - tplink,tl-wr810n-v2|\ - ubnt,routerstation) - ucidef_set_interfaces_lan_wan "eth1" "eth0" - ;; glinet,gl-ar750s) ucidef_add_switch "switch0" \ "0@eth0" "2:lan:2" "3:lan:1" "1:wan" @@ -112,10 +136,22 @@ ath79_setup_interfaces() iodata,wn-ac1600dgr|\ iodata,wn-ac1600dgr2|\ iodata,wn-ag300dgr|\ - pcs,cr5000) + pcs,cr5000|\ + wd,mynet-n750) ucidef_add_switch "switch0" \ "0@eth0" "1:lan" "2:lan" "3:lan" "4:lan" "5:wan" ;; + librerouter,librerouter-v1) + ucidef_add_switch "switch0" \ + "0@eth0" "5:wan" "6@eth1" "4:lan" + ;; + nec,wg1200cr|\ + ubnt,nanostation-ac|\ + ubnt,unifiac-mesh-pro|\ + ubnt,unifiac-pro) + ucidef_add_switch "switch0" \ + "0@eth0" "2:lan" "3:wan" + ;; nec,wg800hp) ucidef_add_switch "switch0" \ "0@eth0" "2:lan" "3:lan" "4:lan" "1:wan" @@ -133,7 +169,12 @@ ath79_setup_interfaces() ;; netgear,wnr612-v2|\ on,n150r|\ - tplink,tl-wr841-v7) + tplink,tl-wr740n-v1|\ + tplink,tl-wr740n-v3|\ + tplink,tl-wr741-v1|\ + tplink,tl-wr743nd-v1|\ + tplink,tl-wr841-v5|\ + tplink,tl-wr941-v4) ucidef_set_interface_wan "eth0" ucidef_add_switch "switch0" \ "0@eth1" "1:lan" "2:lan" "3:lan" "4:lan" @@ -146,6 +187,16 @@ ath79_setup_interfaces() ucidef_add_switch "switch0" \ "0@eth0" "1:lan" "2:lan" "3:wan" ;; + tplink,archer-a7-v5|\ + tplink,archer-c6-v2|\ + tplink,archer-c7-v4|\ + tplink,archer-c7-v5|\ + tplink,tl-wdr3600-v1|\ + tplink,tl-wdr4300-v1|\ + tplink,tl-wr941n-v7-cn) + ucidef_add_switch "switch0" \ + "0@eth0" "2:lan:1" "3:lan:2" "4:lan:3" "5:lan:4" "1:wan" + ;; tplink,archer-c5-v1|\ tplink,archer-c7-v1|\ tplink,archer-c7-v2|\ @@ -153,24 +204,9 @@ ath79_setup_interfaces() ucidef_add_switch "switch0" \ "0@eth1" "2:lan" "3:lan" "4:lan" "5:lan" "6@eth0" "1:wan" ;; - buffalo,whr-g301n|\ - tplink,tl-mr3220-v1|\ - tplink,tl-mr3420-v1|\ - tplink,tl-wr841-v9|\ - tplink,tl-wr841-v11|\ - ubnt,airrouter) - ucidef_set_interface_wan "eth0" + tplink,archer-d50-v1) ucidef_add_switch "switch0" \ - "0@eth1" "1:lan:4" "2:lan:3" "3:lan:2" "4:lan:1" - ;; - tplink,archer-a7-v5|\ - tplink,archer-c6-v2|\ - tplink,archer-c7-v4|\ - tplink,archer-c7-v5|\ - tplink,tl-wdr3600|\ - tplink,tl-wdr4300) - ucidef_add_switch "switch0" \ - "0@eth0" "2:lan:1" "3:lan:2" "4:lan:3" "5:lan:4" "1:wan" + "0@eth0" "2:lan:3" "3:lan:2" "4:lan:1" "1:wan" ;; tplink,tl-wr1043nd-v1) ucidef_add_switch "switch0" \ @@ -185,43 +221,36 @@ ath79_setup_interfaces() ucidef_add_switch "switch0" \ "1:lan" "2:lan" "3:lan" "4:lan" "0:wan" "9@eth0" ;; - tplink,tl-wr740n-v1|\ - tplink,tl-wr740n-v3|\ - tplink,tl-wr741-v1|\ - tplink,tl-wr743nd-v1|\ - tplink,tl-wr841-v5|\ - tplink,tl-wr941-v4) - ucidef_set_interface_wan "eth0" - ucidef_add_switch "switch0" \ - "0@eth1" "1:lan" "2:lan" "3:lan" "4:lan" - ;; tplink,tl-wr740n-v4|\ tplink,tl-wr741nd-v4|\ tplink,tl-wr841-v8|\ - tplink,tl-wr842n-v1|\ tplink,tl-wr842n-v2) - ucidef_set_interface_wan "eth0" + ucidef_set_interface_wan "eth1" ucidef_add_switch "switch0" \ - "0@eth1" "1:lan:4" "2:lan:1" "3:lan:2" "4:lan:3" + "0@eth0" "1:lan:4" "2:lan:1" "3:lan:2" "4:lan:3" ;; tplink,tl-wr941-v2) ucidef_set_interfaces_lan_wan "lan1 lan2 lan3 lan4" "wan" ;; + ubnt,acb-isp) + ucidef_set_interface_wan "eth1" + ucidef_add_switch "switch0" \ + "0@eth0" "2:lan:1" "3:lan:3" "4:lan:2" + ;; ubnt,routerstation-pro) ucidef_set_interface_wan "eth0" ucidef_add_switch "switch0" \ "0@eth1" "2:lan:3" "3:lan:2" "4:lan:1" ;; - ubnt,nanostation-ac|\ - ubnt,unifiac-mesh-pro|\ - ubnt,unifiac-pro) + ubnt,nanostation-m-xw) ucidef_add_switch "switch0" \ - "0@eth0" "2:lan" "3:wan" + "0@eth0" "5:lan" "1:wan" ;; + zbtlink,zbt-wd323|\ xiaomi,mi-router-4q) - ucidef_set_interface_wan "eth0" + ucidef_set_interface_wan "eth1" ucidef_add_switch "switch0" \ - "0@eth1" "3:lan:1" "4:lan:2" + "0@eth0" "3:lan:1" "4:lan:2" ;; *) ucidef_set_interfaces_lan_wan "eth0" "eth1" @@ -250,13 +279,26 @@ ath79_setup_macs() lan_mac=$(mtd_get_mac_text "mac" 4) wan_mac=$(mtd_get_mac_text "mac" 24) ;; - dlink,dir-859-a1) + dlink,dir-859-a1|\ + nec,wg1200cr|\ + wd,mynet-n750) lan_mac=$(mtd_get_mac_ascii devdata "lanmac") wan_mac=$(mtd_get_mac_ascii devdata "wanmac") ;; elecom,wrc-1750ghbk2-i|\ elecom,wrc-300ghbk2-i) - wan_mac=$(macaddr_add "$(mtd_get_mac_binary ART 4098)" -2) + wan_mac=$(macaddr_add "$(mtd_get_mac_binary art 4098)" -2) + ;; + engenius,ecb1750) + lan_mac=$(mtd_get_mac_ascii u-boot-env ethaddr) + ;; + engenius,epg5000|\ + iodata,wn-ac1167dgr|\ + iodata,wn-ac1600dgr|\ + iodata,wn-ac1600dgr2|\ + iodata,wn-ag300dgr) + lan_mac=$(mtd_get_mac_ascii u-boot-env ethaddr) + wan_mac=$(mtd_get_mac_ascii u-boot-env wanaddr) ;; engenius,ews511ap) lan_mac=$(mtd_get_mac_text "u-boot-env" 233) @@ -268,12 +310,9 @@ ath79_setup_macs() lan_mac=$(mtd_get_mac_ascii u-boot-env ethaddr) wan_mac=$(macaddr_add "$lan_mac" -1) ;; - iodata,wn-ac1167dgr|\ - iodata,wn-ac1600dgr|\ - iodata,wn-ac1600dgr2|\ - iodata,wn-ag300dgr) - lan_mac=$(mtd_get_mac_ascii u-boot-env ethaddr) - wan_mac=$(mtd_get_mac_ascii u-boot-env wanaddr) + jjplus,ja76pf2) + wan_mac=$(fconfig -s -r -d $(find_mtd_part "RedBoot config") -n alias/ethaddr) + lan_mac=$(macaddr_add "$wan_mac" 1) ;; nec,wg800hp) lan_mac=$(mtd_get_mac_text board_data 640) @@ -292,15 +331,16 @@ ath79_setup_macs() wan_mac=$(mtd_get_mac_binary factory 0) lan_mac=$(macaddr_setbit_la "$wan_mac") ;; - tplink,archer-c7-v4) - base_mac=$(mtd_get_mac_binary config 8) - wan_mac=$(macaddr_add "$base_mac" 1) - ;; - tplink,tl-wr1043nd-v4) - base_mac=$(mtd_get_mac_binary product-info 8) + tplink,archer-a7-v5|\ + tplink,archer-c7-v4|\ + tplink,archer-c7-v5|\ + tplink,tl-wr1043nd-v4|\ + tplink,tl-wr1043n-v5) + base_mac=$(mtd_get_mac_binary info 8) wan_mac=$(macaddr_add "$base_mac" 1) ;; - tplink,tl-wr941-v2) + tplink,tl-wr941-v2|\ + tplink,tl-wr941n-v7-cn) base_mac=$(mtd_get_mac_binary u-boot 130048) wan_mac=$(macaddr_add "$base_mac" 1) ;; diff --git a/target/linux/ath79/base-files/etc/board.d/03_gpio_switches b/target/linux/ath79/base-files/etc/board.d/03_gpio_switches index 4f08fab525..7f40285daf 100755 --- a/target/linux/ath79/base-files/etc/board.d/03_gpio_switches +++ b/target/linux/ath79/base-files/etc/board.d/03_gpio_switches @@ -10,13 +10,35 @@ board_config_update board=$(board_name) case "$board" in +comfast,cf-e5) + ucidef_add_gpio_switch "lte_power" "LTE Power" "14" "1" + ucidef_add_gpio_switch "lte_wakeup" "LTE Wakeup" "11" "1" + ucidef_add_gpio_switch "lte_poweroff" "LTE Poweroff" "1" "1" + ucidef_add_gpio_switch "lte_reset" "LTE Reset" "12" "1" + ;; dlink,dir-825-c1|\ dlink,dir-835-a1) ucidef_add_gpio_switch "wan_led_auto" "WAN LED Auto" "20" "0" ;; +librerouter,librerouter-v1) + ucidef_add_gpio_switch "poe_passthrough" "PoE Passthrough" "1" "0" + ;; +tplink,archer-c25-v1) + ucidef_add_gpio_switch "led_control" "LED control" "21" "0" + ucidef_add_gpio_switch "led_reset" "LED reset" "19" "1" + ;; ubnt,nanostation-ac) ucidef_add_gpio_switch "poe_passthrough" "PoE Passthrough" "3" ;; +ubnt,acb-isp) + ucidef_add_gpio_switch "poe_passthrough" "PoE Passthrough" "11" + ;; +zbtlink,zbt-wd323) + ucidef_add_gpio_switch "io0" "IO#0" "0" + ucidef_add_gpio_switch "io1" "IO#1" "1" + ucidef_add_gpio_switch "io2" "IO#2" "2" + ucidef_add_gpio_switch "io14" "IO#14" "14" + ;; esac board_config_flush diff --git a/target/linux/ath79/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom b/target/linux/ath79/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom index 84e4d07b35..5a20b84344 100644 --- a/target/linux/ath79/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom +++ b/target/linux/ath79/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom @@ -81,7 +81,7 @@ ath9k_patch_fw_mac() { dd of=/lib/firmware/$FIRMWARE conv=notrunc bs=1 seek=$chksum_offset count=2 } - macaddr_2bin $mac | dd of=/lib/firmware/$FIRMWARE conv=notrunc bs=1 seek=$mac_offset count=6 + macaddr_2bin $mac | dd of=/lib/firmware/$FIRMWARE conv=notrunc oflag=seek_bytes bs=6 seek=$mac_offset count=1 } ath9k_patch_fw_mac_crc() { @@ -105,10 +105,17 @@ case "$FIRMWARE" in ath9k_eeprom_extract "art" 4096 1088 ath9k_patch_fw_mac_crc $(mtd_get_mac_text "mac" 4) 2 ;; - dlink,dir-859-a1) + dlink,dir-859-a1|\ + nec,wg1200cr|\ + wd,mynet-n750) ath9k_eeprom_extract "art" 4096 1088 ath9k_patch_fw_mac $(mtd_get_mac_ascii devdata "wlan24mac") 2 ;; + engenius,ecb1750) + ath9k_eeprom_extract "art" 4096 1088 + ath9k_patch_fw_mac $(macaddr_add $(mtd_get_mac_ascii u-boot-env "athaddr") +1) 2 + ;; + engenius,epg5000|\ iodata,wn-ac1167dgr|\ iodata,wn-ac1600dgr|\ iodata,wn-ac1600dgr2|\ @@ -137,7 +144,7 @@ case "$FIRMWARE" in ath9k_eeprom_extract "art" 4096 3768 ;; buffalo,wzr-hp-g450h) - ath9k_eeprom_extract "ART" 4096 1088 + ath9k_eeprom_extract "art" 4096 1088 ;; dlink,dir-825-c1|\ dlink,dir-835-a1) @@ -145,8 +152,8 @@ case "$FIRMWARE" in ath9k_patch_fw_mac_crc $(macaddr_add $(mtd_get_mac_text "mac" 24) 1) 2 ;; ocedo,raccoon|\ - tplink,tl-wdr3600|\ - tplink,tl-wdr4300|\ + tplink,tl-wdr3600-v1|\ + tplink,tl-wdr4300-v1|\ tplink,tl-wdr4900-v2|\ winchannel,wb2000) ath9k_eeprom_extract "art" 20480 1088 @@ -175,6 +182,10 @@ case "$FIRMWARE" in ubnt,unifi) ath9k_eeprom_extract "art" 4096 2048 ;; + wd,mynet-n750) + ath9k_eeprom_extract "art" 20480 1088 + ath9k_patch_fw_mac $(mtd_get_mac_ascii devdata "wlan5mac") 2 + ;; wd,mynet-wifi-rangeextender) ath9k_eeprom_extract "art" 4096 4096 ath9k_patch_fw_mac_crc $(nvram get wl0_hwaddr) "$mac" 2 diff --git a/target/linux/ath79/base-files/etc/hotplug.d/ieee80211/00-wifi-migration b/target/linux/ath79/base-files/etc/hotplug.d/ieee80211/00-wifi-migration new file mode 100644 index 0000000000..b1824303e6 --- /dev/null +++ b/target/linux/ath79/base-files/etc/hotplug.d/ieee80211/00-wifi-migration @@ -0,0 +1,50 @@ +#!/bin/sh + +WIFI_PATH_CHANGED=0 + +. /lib/functions.sh + +migrate_wifi_path() { + local section="$1" + local path + + config_get path ${section} path + case ${path} in + "pci0000:01/0000:01:00.0") + board=$(board_name) + + case "$board" in + tplink,archer-c7-v1|\ + tplink,archer-c7-v2) + path="pci0000:00/0000:00:00.0" + WIFI_PATH_CHANGED=1 + ;; + *) + return 0 + ;; + esac + ;; + "platform/qca955x_wmac") + path="platform/ahb/ahb:apb/18100000.wmac" + WIFI_PATH_CHANGED=1 + ;; + "platform/ar933x_wmac") + path="platform/ahb/18100000.wmac" + WIFI_PATH_CHANGED=1 + ;; + *) + return 0 + ;; + esac + + uci set wireless.${section}.path=${path} +} + +[ "${ACTION}" = "add" ] && { + [ ! -e /etc/config/wireless ] && return 0 + + config_load wireless + config_foreach migrate_wifi_path wifi-device + + [ "${WIFI_PATH_CHANGED}" = "1" ] && uci commit wireless +} diff --git a/target/linux/ath79/base-files/etc/uci-defaults/04_led_migration b/target/linux/ath79/base-files/etc/uci-defaults/04_led_migration new file mode 100644 index 0000000000..bc40d22c09 --- /dev/null +++ b/target/linux/ath79/base-files/etc/uci-defaults/04_led_migration @@ -0,0 +1,28 @@ +#!/bin/sh + +. /lib/functions.sh +. /lib/functions/migrations.sh + +board=$(board_name) + +case "$board" in +engenius,epg5000) + migrate_leds ":wlan-2g=:wlan2g" ":wlan-5g=:wlan5g" + ;; +tplink,archer-c7-v2) + migrate_leds ":blue:=:green:" + ;; +tplink,archer-c7-v4) + migrate_leds "archer-c7-v4:=tp-link:" + ;; +tplink,archer-c7-v5) + migrate_leds "archer-c7-v5:=tp-link:" + ;; +wd,mynet-n750) + migrate_leds "wd:=mynet-n750:" + ;; +esac + +migrations_apply system + +exit 0 diff --git a/target/linux/ath79/base-files/lib/upgrade/platform.sh b/target/linux/ath79/base-files/lib/upgrade/platform.sh index a7cb455b8e..c2fe08154d 100644 --- a/target/linux/ath79/base-files/lib/upgrade/platform.sh +++ b/target/linux/ath79/base-files/lib/upgrade/platform.sh @@ -5,13 +5,31 @@ PART_NAME=firmware REQUIRE_IMAGE_METADATA=1 -routerstation_do_upgrade() { +redboot_fis_do_upgrade() { local append - local kern_length=0x$(dd if="$1" bs=2 skip=1 count=4 2>/dev/null) + local sysup_file="$1" + local kern_part="$2" + local magic=$(get_magic_word "$sysup_file") - [ -f "$CONF_TAR" -a "$SAVE_CONFIG" -eq 1 ] && append="-j $CONF_TAR" - dd if="$1" bs=64k skip=1 2>/dev/null | \ - mtd -r $append -Fkernel:$kern_length:0x80060000,rootfs write - kernel:rootfs + if [ "$magic" = "4349" ]; then + local kern_length=0x$(dd if="$sysup_file" bs=2 skip=1 count=4 2>/dev/null) + + [ -f "$CONF_TAR" -a "$SAVE_CONFIG" -eq 1 ] && append="-j $CONF_TAR" + dd if="$sysup_file" bs=64k skip=1 2>/dev/null | \ + mtd -r $append -F$kern_part:$kern_length:0x80060000,rootfs write - $kern_part:rootfs + + elif [ "$magic" = "7379" ]; then + local board_dir=$(tar tf $sysup_file | grep -m 1 '^sysupgrade-.*/$') + local kern_length=$(tar xf $sysup_file ${board_dir}kernel -O | wc -c) + + [ -f "$CONF_TAR" -a "$SAVE_CONFIG" -eq 1 ] && append="-j $CONF_TAR" + tar xf $sysup_file ${board_dir}kernel ${board_dir}root -O | \ + mtd -r $append -F$kern_part:$kern_length:0x80060000,rootfs write - $kern_part:rootfs + + else + echo "Unknown image, aborting!" + return 1 + fi } platform_check_image() { @@ -22,9 +40,12 @@ platform_do_upgrade() { local board=$(board_name) case "$board" in + jjplus,ja76pf2) + redboot_fis_do_upgrade "$ARGV" linux + ;; ubnt,routerstation|\ ubnt,routerstation-pro) - routerstation_do_upgrade "$ARGV" + redboot_fis_do_upgrade "$ARGV" kernel ;; *) default_do_upgrade "$ARGV" diff --git a/target/linux/ath79/config-4.19 b/target/linux/ath79/config-4.19 new file mode 100644 index 0000000000..6cdbb968c3 --- /dev/null +++ b/target/linux/ath79/config-4.19 @@ -0,0 +1,229 @@ +CONFIG_AG71XX=y +# CONFIG_AG71XX_DEBUG is not set +CONFIG_AG71XX_DEBUG_FS=y +CONFIG_AR8216_PHY=y +CONFIG_AR8216_PHY_LEDS=y +CONFIG_ARCH_BINFMT_ELF_STATE=y +CONFIG_ARCH_CLOCKSOURCE_DATA=y +CONFIG_ARCH_DISCARD_MEMBLOCK=y +CONFIG_ARCH_HAS_ELF_RANDOMIZE=y +CONFIG_ARCH_HAS_RESET_CONTROLLER=y +CONFIG_ARCH_HAS_SYNC_DMA_FOR_DEVICE=y +CONFIG_ARCH_HIBERNATION_POSSIBLE=y +CONFIG_ARCH_MMAP_RND_BITS_MAX=15 +CONFIG_ARCH_MMAP_RND_COMPAT_BITS_MAX=15 +CONFIG_ARCH_SUPPORTS_UPROBES=y +CONFIG_ARCH_SUSPEND_POSSIBLE=y +CONFIG_ARCH_USE_BUILTIN_BSWAP=y +CONFIG_ARCH_USE_QUEUED_RWLOCKS=y +CONFIG_ARCH_USE_QUEUED_SPINLOCKS=y +CONFIG_ARCH_WANT_IPC_PARSE_VERSION=y +CONFIG_ATH79=y +CONFIG_ATH79_WDT=y +CONFIG_CEVT_R4K=y +CONFIG_CLKDEV_LOOKUP=y +CONFIG_CLONE_BACKWARDS=y +CONFIG_CMDLINE="rootfstype=squashfs,jffs2" +CONFIG_CMDLINE_BOOL=y +# CONFIG_CMDLINE_OVERRIDE is not set +CONFIG_COMMON_CLK=y +# CONFIG_COMMON_CLK_BOSTON is not set +CONFIG_CPU_BIG_ENDIAN=y +CONFIG_CPU_GENERIC_DUMP_TLB=y +CONFIG_CPU_HAS_PREFETCH=y +CONFIG_CPU_HAS_RIXI=y +CONFIG_CPU_HAS_SYNC=y +CONFIG_CPU_MIPS32=y +CONFIG_CPU_MIPS32_R2=y +CONFIG_CPU_MIPSR2=y +CONFIG_CPU_NEEDS_NO_SMARTMIPS_OR_MICROMIPS=y +CONFIG_CPU_R4K_CACHE_TLB=y +CONFIG_CPU_R4K_FPU=y +CONFIG_CPU_SUPPORTS_32BIT_KERNEL=y +CONFIG_CPU_SUPPORTS_HIGHMEM=y +CONFIG_CPU_SUPPORTS_MSA=y +CONFIG_CRYPTO_RNG2=y +CONFIG_CRYPTO_WORKQUEUE=y +CONFIG_CSRC_R4K=y +CONFIG_DMA_DIRECT_OPS=y +CONFIG_DMA_NONCOHERENT=y +CONFIG_DMA_NONCOHERENT_CACHE_SYNC=y +CONFIG_DMA_NONCOHERENT_MMAP=y +CONFIG_DMA_NONCOHERENT_OPS=y +CONFIG_DTC=y +CONFIG_EARLY_PRINTK=y +CONFIG_ETHERNET_PACKET_MANGLE=y +CONFIG_FIXED_PHY=y +CONFIG_GENERIC_ATOMIC64=y +CONFIG_GENERIC_CLOCKEVENTS=y +CONFIG_GENERIC_CMOS_UPDATE=y +CONFIG_GENERIC_CPU_AUTOPROBE=y +CONFIG_GENERIC_IRQ_CHIP=y +CONFIG_GENERIC_IRQ_EFFECTIVE_AFF_MASK=y +CONFIG_GENERIC_IRQ_SHOW=y +CONFIG_GENERIC_LIB_ASHLDI3=y +CONFIG_GENERIC_LIB_ASHRDI3=y +CONFIG_GENERIC_LIB_CMPDI2=y +CONFIG_GENERIC_LIB_LSHRDI3=y +CONFIG_GENERIC_LIB_UCMPDI2=y +CONFIG_GENERIC_PCI_IOMAP=y +CONFIG_GENERIC_PHY=y +CONFIG_GENERIC_PINCONF=y +CONFIG_GENERIC_PINCTRL_GROUPS=y +CONFIG_GENERIC_PINMUX_FUNCTIONS=y +CONFIG_GENERIC_SCHED_CLOCK=y +CONFIG_GENERIC_SMP_IDLE_THREAD=y +CONFIG_GENERIC_TIME_VSYSCALL=y +CONFIG_GPIOLIB=y +CONFIG_GPIOLIB_IRQCHIP=y +CONFIG_GPIO_74X164=y +CONFIG_GPIO_ATH79=y +CONFIG_GPIO_GENERIC=y +CONFIG_GPIO_SYSFS=y +CONFIG_HANDLE_DOMAIN_IRQ=y +CONFIG_HARDWARE_WATCHPOINTS=y +CONFIG_HAS_DMA=y +CONFIG_HAS_IOMEM=y +CONFIG_HAS_IOPORT_MAP=y +CONFIG_HAVE_ARCH_COMPILER_H=y +CONFIG_HAVE_ARCH_JUMP_LABEL=y +CONFIG_HAVE_ARCH_KGDB=y +CONFIG_HAVE_ARCH_SECCOMP_FILTER=y +CONFIG_HAVE_ARCH_TRACEHOOK=y +CONFIG_HAVE_CBPF_JIT=y +CONFIG_HAVE_CLK=y +CONFIG_HAVE_CLK_PREPARE=y +CONFIG_HAVE_CONTEXT_TRACKING=y +CONFIG_HAVE_COPY_THREAD_TLS=y +CONFIG_HAVE_C_RECORDMCOUNT=y +CONFIG_HAVE_DEBUG_KMEMLEAK=y +CONFIG_HAVE_DEBUG_STACKOVERFLOW=y +CONFIG_HAVE_DMA_CONTIGUOUS=y +CONFIG_HAVE_DYNAMIC_FTRACE=y +CONFIG_HAVE_FTRACE_MCOUNT_RECORD=y +CONFIG_HAVE_FUNCTION_GRAPH_TRACER=y +CONFIG_HAVE_FUNCTION_TRACER=y +CONFIG_HAVE_GENERIC_DMA_COHERENT=y +CONFIG_HAVE_IDE=y +CONFIG_HAVE_IRQ_EXIT_ON_IRQ_STACK=y +CONFIG_HAVE_IRQ_TIME_ACCOUNTING=y +CONFIG_HAVE_KVM=y +CONFIG_HAVE_LATENCYTOP_SUPPORT=y +CONFIG_HAVE_LD_DEAD_CODE_DATA_ELIMINATION=y +CONFIG_HAVE_MEMBLOCK=y +CONFIG_HAVE_MEMBLOCK_NODE_MAP=y +CONFIG_HAVE_MOD_ARCH_SPECIFIC=y +CONFIG_HAVE_NET_DSA=y +CONFIG_HAVE_OPROFILE=y +CONFIG_HAVE_PERF_EVENTS=y +CONFIG_HAVE_REGS_AND_STACK_ACCESS_API=y +CONFIG_HAVE_RSEQ=y +CONFIG_HAVE_SYSCALL_TRACEPOINTS=y +CONFIG_HAVE_VIRT_CPU_ACCOUNTING_GEN=y +CONFIG_HW_HAS_PCI=y +CONFIG_HZ_PERIODIC=y +CONFIG_IMAGE_CMDLINE_HACK=y +CONFIG_INITRAMFS_SOURCE="" +CONFIG_IRQCHIP=y +CONFIG_IRQ_DOMAIN=y +CONFIG_IRQ_FORCED_THREADING=y +CONFIG_IRQ_MIPS_CPU=y +CONFIG_IRQ_WORK=y +CONFIG_LEDS_GPIO=y +# CONFIG_LEDS_RESET is not set +CONFIG_LIBFDT=y +CONFIG_LOCK_DEBUGGING_SUPPORT=y +CONFIG_MDIO_BITBANG=y +CONFIG_MDIO_BUS=y +CONFIG_MDIO_DEVICE=y +CONFIG_MDIO_GPIO=y +CONFIG_MEMFD_CREATE=y +CONFIG_MFD_SYSCON=y +CONFIG_MIGRATION=y +CONFIG_MIPS=y +CONFIG_MIPS_ASID_BITS=8 +CONFIG_MIPS_ASID_SHIFT=0 +CONFIG_MIPS_CBPF_JIT=y +CONFIG_MIPS_CLOCK_VSYSCALL=y +# CONFIG_MIPS_CMDLINE_BUILTIN_EXTEND is not set +# CONFIG_MIPS_CMDLINE_DTB_EXTEND is not set +# CONFIG_MIPS_CMDLINE_FROM_BOOTLOADER is not set +CONFIG_MIPS_CMDLINE_FROM_DTB=y +# CONFIG_MIPS_ELF_APPENDED_DTB is not set +CONFIG_MIPS_L1_CACHE_SHIFT=5 +# CONFIG_MIPS_NO_APPENDED_DTB is not set +CONFIG_MIPS_RAW_APPENDED_DTB=y +CONFIG_MIPS_SPRAM=y +CONFIG_MODULES_USE_ELF_REL=y +CONFIG_MTD_CFI_ADV_OPTIONS=y +CONFIG_MTD_CFI_GEOMETRY=y +# CONFIG_MTD_CFI_I2 is not set +# CONFIG_MTD_CFI_INTELEXT is not set +CONFIG_MTD_CMDLINE_PARTS=y +CONFIG_MTD_M25P80=y +# CONFIG_MTD_MAP_BANK_WIDTH_1 is not set +# CONFIG_MTD_MAP_BANK_WIDTH_4 is not set +CONFIG_MTD_PARSER_CYBERTAN=y +CONFIG_MTD_PHYSMAP=y +CONFIG_MTD_SPI_NOR=y +CONFIG_MTD_SPLIT_LZMA_FW=y +CONFIG_MTD_SPLIT_TPLINK_FW=y +CONFIG_MTD_SPLIT_UIMAGE_FW=y +CONFIG_MTD_TPLINK_PARTS=y +CONFIG_MTD_VIRT_CONCAT=y +CONFIG_NEED_DMA_MAP_STATE=y +CONFIG_NEED_PER_CPU_KM=y +CONFIG_NO_GENERIC_PCI_IOPORT_MAP=y +CONFIG_NVMEM=y +CONFIG_OF=y +CONFIG_OF_ADDRESS=y +CONFIG_OF_EARLY_FLATTREE=y +CONFIG_OF_FLATTREE=y +CONFIG_OF_GPIO=y +CONFIG_OF_IRQ=y +CONFIG_OF_KOBJ=y +CONFIG_OF_MDIO=y +CONFIG_OF_NET=y +CONFIG_PCI_DRIVERS_LEGACY=y +CONFIG_PERF_USE_VMALLOC=y +CONFIG_PGTABLE_LEVELS=2 +CONFIG_PHYLIB=y +# CONFIG_PHY_AR7100_USB is not set +# CONFIG_PHY_AR7200_USB is not set +# CONFIG_PHY_ATH79_USB is not set +CONFIG_PINCTRL=y +CONFIG_RATIONAL=y +CONFIG_REGMAP=y +CONFIG_REGMAP_MMIO=y +CONFIG_RESET_ATH79=y +CONFIG_RESET_CONTROLLER=y +CONFIG_SERIAL_8250_NR_UARTS=1 +CONFIG_SERIAL_8250_RUNTIME_UARTS=1 +CONFIG_SERIAL_AR933X=y +CONFIG_SERIAL_AR933X_CONSOLE=y +CONFIG_SERIAL_AR933X_NR_UARTS=2 +CONFIG_SERIAL_OF_PLATFORM=y +CONFIG_SPI=y +CONFIG_SPI_ATH79=y +CONFIG_SPI_BITBANG=y +CONFIG_SPI_GPIO=y +CONFIG_SPI_MASTER=y +CONFIG_SPI_MEM=y +# CONFIG_SPI_RB4XX is not set +CONFIG_SRCU=y +CONFIG_SWCONFIG=y +CONFIG_SWCONFIG_LEDS=y +CONFIG_SWPHY=y +CONFIG_SYSCTL_EXCEPTION_TRACE=y +CONFIG_SYS_HAS_CPU_MIPS32_R2=y +CONFIG_SYS_HAS_EARLY_PRINTK=y +CONFIG_SYS_SUPPORTS_32BIT_KERNEL=y +CONFIG_SYS_SUPPORTS_ARBIT_HZ=y +CONFIG_SYS_SUPPORTS_BIG_ENDIAN=y +CONFIG_SYS_SUPPORTS_MIPS16=y +CONFIG_SYS_SUPPORTS_ZBOOT=y +CONFIG_SYS_SUPPORTS_ZBOOT_UART_PROM=y +CONFIG_TICK_CPU_ACCOUNTING=y +CONFIG_TINY_SRCU=y +CONFIG_USB_SUPPORT=y +CONFIG_USE_OF=y diff --git a/target/linux/ath79/dts/ar7161_aruba_ap-105.dts b/target/linux/ath79/dts/ar7161_aruba_ap-105.dts new file mode 100644 index 0000000000..45d4d03f31 --- /dev/null +++ b/target/linux/ath79/dts/ar7161_aruba_ap-105.dts @@ -0,0 +1,190 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT +/dts-v1/; + +#include +#include + +#include "ar7100.dtsi" + +/ { + compatible = "aruba,ap-105", "qca,ar7161"; + model = "Aruba AP-105"; + + chosen { + bootargs = "console=ttyS0,9600"; + }; + + aliases { + led-boot = &power_green; + led-failsafe = &power_red; + led-running = &power_green; + led-upgrade = &power_green; + }; + + extosc: ref { + compatible = "fixed-clock"; + #clock-cells = <0>; + clock-output-names = "ref"; + clock-frequency = <40000000>; + }; + + leds { + compatible = "gpio-leds"; + + power_green: power_green { + label = "ap-105:green:power"; + gpios = <&gpio 3 GPIO_ACTIVE_LOW>; + }; + + power_red: power_red { + label = "ap-105:red:power"; + gpios = <&gpio 2 GPIO_ACTIVE_LOW>; + panic-indicator; + }; + + wifi_2g_red: wifi_2g_red { + label = "ap-105:red:wlan2g"; + gpios = <&gpio 8 GPIO_ACTIVE_LOW>; + }; + + wifi_5g_red: wifi_5g_red { + label = "ap-105:red:wlan5g"; + gpios = <&gpio 11 GPIO_ACTIVE_LOW>; + }; + }; + + ath9k-leds { + compatible = "gpio-leds"; + + wifi_2g_green { + label = "ap-105:green:wlan2g"; + gpios = <&ath9k0 5 GPIO_ACTIVE_LOW>; + linux,default-trigger = "phy0tpt"; + }; + + wifi_5g_green { + label = "ap-105:green:wlan5g"; + gpios = <&ath9k1 5 GPIO_ACTIVE_LOW>; + linux,default-trigger = "phy1tpt"; + }; + }; + + keys { + compatible = "gpio-keys"; + + reset { + label = "reset"; + linux,code = ; + gpios = <&gpio 6 GPIO_ACTIVE_LOW>; + }; + }; + + i2c { + compatible = "i2c-gpio"; + + sda-gpios = <&gpio 5 GPIO_ACTIVE_LOW>; + scl-gpios = <&gpio 4 GPIO_ACTIVE_LOW>; + + /* can be removed on 4.19 */ + gpios = <&gpio 5 GPIO_ACTIVE_LOW>, + <&gpio 4 GPIO_ACTIVE_LOW>; + + #address-cells = <1>; + #size-cells = <0>; + + tpm@29 { + compatible = "atmel,at97sc3203s"; + reg = <0x29>; + + /* triggering it, will also kill system */ + reset-gpios = <&gpio 7 GPIO_ACTIVE_LOW>; + }; + }; +}; + +&pcie0 { + status = "okay"; + + ath9k0: wifi@0,11 { /* 2.4 GHz */ + compatible = "pci168c,0029"; + mtd-mac-address = <&hwinfo 0x1c>; + mtd-mac-address-increment = <1>; + reg = <0x8800 0 0 0 0>; + #gpio-cells = <2>; + gpio-controller; + }; + + ath9k1: wifi@0,12 { /* 5 GHz */ + compatible = "pci168c,0029"; + mtd-mac-address = <&hwinfo 0x1c>; + mtd-mac-address-increment = <2>; + reg = <0x9000 0 0 0 0>; + #gpio-cells = <2>; + gpio-controller; + }; +}; + +&uart { + status = "okay"; +}; + +&mdio0 { + status = "okay"; + + phy-mask = <0x1>; + + phy0: ethernet-phy@0 { + reg = <0>; + }; +}; + +ð0 { + status = "okay"; + mtd-mac-address = <&hwinfo 0x1c>; + + pll-data = <0x00110000 0x00001099 0x00991099>; + + phy-mode = "rgmii"; + phy-handle = <&phy0>; +}; + +&spi { + status = "okay"; + num-cs = <1>; + + flash@0 { + compatible = "jedec,spi-nor"; + reg = <0>; + spi-max-frequency = <25000000>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "u-boot"; + reg = <0x000000 0x40000>; + read-only; + }; + + partition@40000 { + label = "firmware"; + reg = <0x40000 0xfa0000>; + compatible = "denx,uimage"; + }; + + hwinfo: partition@fe0000 { + label = "hwinfo"; + reg = <0xfe0000 0x10000>; + read-only; + }; + + partition@ff0000 { + label = "u-boot-env"; + reg = <0xff0000 0x10000>; + read-only; + }; + }; + }; +}; diff --git a/target/linux/ath79/dts/ar7161_jjplus_ja76pf2.dts b/target/linux/ath79/dts/ar7161_jjplus_ja76pf2.dts new file mode 100644 index 0000000000..76f140fa55 --- /dev/null +++ b/target/linux/ath79/dts/ar7161_jjplus_ja76pf2.dts @@ -0,0 +1,126 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT +/dts-v1/; + +#include +#include + +#include "ar7100.dtsi" + +/ { + model = "jjPlus JA76PF2"; + compatible = "jjplus,ja76pf2", "qca,ar7161"; + + memory@0 { + device_type = "memory"; + reg = <0x0 0x4000000>; + }; + + chosen { + bootargs = "console=ttyS0,115200n8"; + }; + + aliases { + led-boot = &d2; + led-failsafe = &d2; + led-running = &d2; + led-upgrade = &d2; + }; + + extosc: ref { + compatible = "fixed-clock"; + #clock-cells = <0>; + clock-output-names = "ref"; + clock-frequency = <40000000>; + }; + + leds { + compatible = "gpio-leds"; + + d2: d2 { + label = "ja76pf2:green:d2"; + gpios = <&gpio 5 GPIO_ACTIVE_LOW>; + }; + + d3 { + label = "ja76pf2:green:d3"; + gpios = <&gpio 4 GPIO_ACTIVE_HIGH>; + }; + + d4 { + label = "ja76pf2:green:d4"; + gpios = <&gpio 3 GPIO_ACTIVE_HIGH>; + }; + }; + + keys { + compatible = "gpio-keys-polled"; + poll-interval = <20>; + + sw1 { + label = "sw1"; + linux,code = ; + gpios = <&gpio 7 GPIO_ACTIVE_LOW>; + debounce-interval = <60>; + }; + + sw2 { + label = "sw2"; + linux,code = ; + gpios = <&gpio 8 GPIO_ACTIVE_LOW>; + debounce-interval = <60>; + }; + }; +}; + +&mdio0 { + status = "okay"; + + phy-mask = <0x1>; + + phy0: ethernet-phy@0 { + reg = <0>; + phy-mode = "rgmii"; + }; + + phy4: ethernet-phy@4 { + reg = <4>; + phy-mode = "rgmii"; + }; +}; + +ð0 { + status = "okay"; + + phy-handle = <&phy0>; +}; + +ð1 { + status = "okay"; + + phy-handle = <&phy4>; +}; + +&pcie0 { + status = "okay"; +}; + +&spi { + status = "okay"; + num-cs = <1>; + + flash@0 { + compatible = "jedec,spi-nor"; + reg = <0>; + spi-max-frequency = <104000000>; + + partitions { + #address-cells = <1>; + #size-cells = <1>; + compatible = "ecoscentric,redboot-fis-partitions"; + }; + }; +}; + +&uart { + status = "okay"; +}; diff --git a/target/linux/ath79/dts/ar7161_netgear_wndr3700.dtsi b/target/linux/ath79/dts/ar7161_netgear_wndr3700.dtsi index b1c4d87bcb..89e9b2fbb7 100644 --- a/target/linux/ath79/dts/ar7161_netgear_wndr3700.dtsi +++ b/target/linux/ath79/dts/ar7161_netgear_wndr3700.dtsi @@ -81,8 +81,7 @@ }; keys { - compatible = "gpio-keys-polled"; - poll-interval = <100>; + compatible = "gpio-keys"; wps { label = "wps"; diff --git a/target/linux/ath79/dts/ar7240.dtsi b/target/linux/ath79/dts/ar7240.dtsi index d32960a498..268c8780f4 100644 --- a/target/linux/ath79/dts/ar7240.dtsi +++ b/target/linux/ath79/dts/ar7240.dtsi @@ -39,11 +39,12 @@ builtin-switch; builtin_switch: switch0@1f { - compatible = "qca,ar8216-builtin"; + compatible = "qca,ar7240sw"; reg = <0x1f>; resets = <&rst 8>; reset-names = "switch"; + qca,mib-poll-interval = <500>; mdio-bus { #address-cells = <1>; diff --git a/target/linux/ath79/dts/ar7241.dtsi b/target/linux/ath79/dts/ar7241.dtsi index 2e7c26b8e7..8f0eb3b270 100644 --- a/target/linux/ath79/dts/ar7241.dtsi +++ b/target/linux/ath79/dts/ar7241.dtsi @@ -58,11 +58,12 @@ builtin-switch; builtin_switch: switch0@1f { - compatible = "qca,ar8216-builtin"; + compatible = "qca,ar7240sw"; reg = <0x1f>; resets = <&rst 8>; reset-names = "switch"; + qca,mib-poll-interval = <500>; mdio-bus { #address-cells = <1>; @@ -77,7 +78,7 @@ }; ð1 { - compatible = "qca,ar7241-eth", "syscon", "simple-mfd"; + compatible = "qca,ar7241-eth", "syscon"; pll-data = <0x00110000 0x00001099 0x00991099>; diff --git a/target/linux/ath79/dts/ar7241_ubnt_airrouter.dts b/target/linux/ath79/dts/ar7241_ubnt_airrouter.dts index 9e38bf8087..774a45f22d 100644 --- a/target/linux/ath79/dts/ar7241_ubnt_airrouter.dts +++ b/target/linux/ath79/dts/ar7241_ubnt_airrouter.dts @@ -30,9 +30,9 @@ }; &usb_phy { - status = "okay"; + status = "okay"; }; &usb { - status = "okay"; + status = "okay"; }; diff --git a/target/linux/ath79/dts/ar7241_ubnt_nano-m.dts b/target/linux/ath79/dts/ar7241_ubnt_nano-m.dts deleted file mode 100644 index ebdc4306e5..0000000000 --- a/target/linux/ath79/dts/ar7241_ubnt_nano-m.dts +++ /dev/null @@ -1,9 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-or-later OR MIT -/dts-v1/; - -#include "ar7241_ubnt_xm_outdoor.dtsi" - -/ { - compatible = "ubnt,nano-m", "ubnt,xm", "qca,ar7241"; - model = "Ubiquiti Nanostation M"; -}; diff --git a/target/linux/ath79/dts/ar7241_ubnt_nanostation-m.dts b/target/linux/ath79/dts/ar7241_ubnt_nanostation-m.dts new file mode 100644 index 0000000000..eebe65e53f --- /dev/null +++ b/target/linux/ath79/dts/ar7241_ubnt_nanostation-m.dts @@ -0,0 +1,9 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT +/dts-v1/; + +#include "ar7241_ubnt_xm_outdoor.dtsi" + +/ { + compatible = "ubnt,nanostation-m", "ubnt,xm", "qca,ar7241"; + model = "Ubiquiti Nanostation M"; +}; diff --git a/target/linux/ath79/dts/ar7242.dtsi b/target/linux/ath79/dts/ar7242.dtsi index dd5417e570..be28ae7838 100644 --- a/target/linux/ath79/dts/ar7242.dtsi +++ b/target/linux/ath79/dts/ar7242.dtsi @@ -45,7 +45,7 @@ }; ð0 { - compatible = "qca,ar7242-eth", "syscon", "simple-mfd"; + compatible = "qca,ar7242-eth", "syscon"; pll-data = <0x16000000 0x00000101 0x00001616>; pll-reg = <0x4 0x2c 17>; @@ -61,17 +61,18 @@ builtin-switch; builtin_switch: switch0@1f { - compatible = "qca,ar8216-builtin"; + compatible = "qca,ar7240sw"; #address-cells = <1>; #size-cells = <0>; reg = <0x1f>; resets = <&rst 8>; reset-names = "switch"; + qca,mib-poll-interval = <500>; }; }; ð1 { - compatible = "qca,ar7242-eth", "syscon", "simple-mfd"; + compatible = "qca,ar7242-eth", "syscon"; resets = <&rst 13>; reset-names = "mac"; diff --git a/target/linux/ath79/dts/ar7242_buffalo_bhr-4grv.dts b/target/linux/ath79/dts/ar7242_buffalo_bhr-4grv.dts index d2f40e5565..ac3230f378 100644 --- a/target/linux/ath79/dts/ar7242_buffalo_bhr-4grv.dts +++ b/target/linux/ath79/dts/ar7242_buffalo_bhr-4grv.dts @@ -9,7 +9,7 @@ }; ð0 { - mtd-mac-address = <&ART 0x0>; + mtd-mac-address = <&art 0x0>; }; &sec_vpn { diff --git a/target/linux/ath79/dts/ar7242_buffalo_wzr-bhr.dtsi b/target/linux/ath79/dts/ar7242_buffalo_wzr-bhr.dtsi index 5165efa859..70ce41b84d 100644 --- a/target/linux/ath79/dts/ar7242_buffalo_wzr-bhr.dtsi +++ b/target/linux/ath79/dts/ar7242_buffalo_wzr-bhr.dtsi @@ -89,9 +89,9 @@ label = "u-boot-env"; }; - ART: partition@50000 { + art: partition@50000 { reg = <0x50000 0x10000>; - label = "ART"; + label = "art"; read-only; }; diff --git a/target/linux/ath79/dts/ar7242_buffalo_wzr-hp-g450h.dts b/target/linux/ath79/dts/ar7242_buffalo_wzr-hp-g450h.dts index ea30a4d0d3..e76f677fd5 100644 --- a/target/linux/ath79/dts/ar7242_buffalo_wzr-hp-g450h.dts +++ b/target/linux/ath79/dts/ar7242_buffalo_wzr-hp-g450h.dts @@ -57,7 +57,7 @@ }; ð0 { - mtd-mac-address = <&ART 0x1002>; + mtd-mac-address = <&art 0x1002>; }; &sec_vpn { @@ -70,7 +70,7 @@ ath9k: wifi@0,0 { compatible = "pci168c,0030"; reg = <0x0000 0 0 0 0>; - mtd-mac-address = <&ART 0x1002>; + mtd-mac-address = <&art 0x1002>; qca,no-eeprom; #gpio-cells = <2>; gpio-controller; diff --git a/target/linux/ath79/dts/ar9330.dtsi b/target/linux/ath79/dts/ar9330.dtsi index 01116ff45a..64c135405b 100644 --- a/target/linux/ath79/dts/ar9330.dtsi +++ b/target/linux/ath79/dts/ar9330.dtsi @@ -74,8 +74,8 @@ pinctrl-single,bits = <0x0 0x1 0x1>; }; - switch_led_pins: pinmux_switch_led_pins { - pinctrl-single,bits = <0x0 0x1f 0xf8>; + switch_led_disable_pins: pinmux_switch_led_disable_pins { + pinctrl-single,bits = <0x0 0x0 0xf8>; }; }; @@ -86,6 +86,16 @@ #clock-cells = <1>; }; + wdt: wdt@18060008 { + compatible = "qca,ar7130-wdt"; + reg = <0x18060008 0x8>; + + interrupts = <4>; + + clocks = <&pll ATH79_CLK_AHB>; + clock-names = "wdt"; + }; + rst: reset-controller@1806001c { compatible = "qca,ar7100-reset"; reg = <0x1806001c 0x4>; @@ -173,10 +183,11 @@ builtin-switch; builtin_switch: switch0@1f { - compatible = "qca,ar8216-builtin"; + compatible = "qca,ar7240sw"; reg = <0x1f>; resets = <&rst 8>; reset-names = "switch"; + qca,mib-poll-interval = <500>; mdio-bus { #address-cells = <1>; @@ -191,7 +202,7 @@ }; ð1 { - compatible = "qca,ar9330-eth", "syscon", "simple-mfd"; + compatible = "qca,ar9330-eth", "syscon"; pll-data = <0x00110000 0x00001099 0x00991099>; phy-mode = "gmii"; diff --git a/target/linux/ath79/dts/ar9330_glinet_gl-ar150.dts b/target/linux/ath79/dts/ar9330_glinet_gl-ar150.dts index 53df36760f..76f6e80236 100644 --- a/target/linux/ath79/dts/ar9330_glinet_gl-ar150.dts +++ b/target/linux/ath79/dts/ar9330_glinet_gl-ar150.dts @@ -111,7 +111,7 @@ }; art: partition@3 { - label = "ART"; + label = "art"; reg = <0xff0000 0x010000>; read-only; }; diff --git a/target/linux/ath79/dts/ar9331_8dev_carambola2.dts b/target/linux/ath79/dts/ar9331_8dev_carambola2.dts new file mode 100644 index 0000000000..eb8ea3b20c --- /dev/null +++ b/target/linux/ath79/dts/ar9331_8dev_carambola2.dts @@ -0,0 +1,135 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT +/dts-v1/; + +#include +#include + +#include "ar9331.dtsi" + +/ { + model = "8devices Carambola2"; + compatible = "8dev,carambola2", "qca,ar9331"; + + aliases { + serial0 = &uart; + }; + + leds { + compatible = "gpio-leds"; + + wlan { + label = "carambola2:green:wlan"; + gpios = <&gpio 0 GPIO_ACTIVE_LOW>; + linux,default-trigger = "phy0tpt"; + }; + + eth0 { + label = "carambola2:orange:eth0"; + gpios = <&gpio 13 GPIO_ACTIVE_HIGH>; + }; + + eth1 { + label = "carambola2:orange:eth1"; + gpios = <&gpio 14 GPIO_ACTIVE_HIGH>; + }; + }; + + keys { + compatible = "gpio-keys"; + + wps { + label = "wps"; + linux,code = ; + gpios = <&gpio 11 GPIO_ACTIVE_LOW>; + }; + }; +}; + +&ref { + clock-frequency = <40000000>; +}; + +&uart { + status = "okay"; +}; + +&gpio { + status = "okay"; +}; + +&usb { + dr_mode = "host"; + status = "okay"; +}; + +&usb_phy { + status = "okay"; +}; + +&spi { + num-chipselects = <0>; + status = "okay"; + + flash@0 { + compatible = "jedec,spi-nor"; + spi-max-frequency = <104000000>; + reg = <0>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + uboot: partition@0 { + label = "u-boot"; + reg = <0x000000 0x040000>; + read-only; + }; + + partition@40000 { + label = "u-boot-env"; + reg = <0x040000 0x010000>; + read-only; + }; + + partition@50000 { + compatible = "denx,uimage"; + label = "firmware"; + reg = <0x50000 0xfa0000>; + }; + + art: partition@ff0000 { + label = "art"; + reg = <0xff0000 0x010000>; + read-only; + }; + }; + }; +}; + +&mdio0 { + status = "okay"; +}; + +ð0 { + status = "okay"; + mtd-mac-address = <&art 0x0>; + + gmac-config { + device = <&gmac>; + + switch-phy-addr-swap = <1>; + switch-phy-swap = <1>; + }; +}; + +ð1 { + status = "okay"; + mtd-mac-address = <&art 0x6>; +}; + +&wmac { + status = "okay"; + mtd-cal-data = <&art 0x1000>; + mtd-mac-address = <&art 0x1002>; +}; diff --git a/target/linux/ath79/dts/ar9331_dptechnics_dpt-module.dts b/target/linux/ath79/dts/ar9331_dptechnics_dpt-module.dts deleted file mode 100644 index 971c927053..0000000000 --- a/target/linux/ath79/dts/ar9331_dptechnics_dpt-module.dts +++ /dev/null @@ -1,69 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0 -/dts-v1/; - -#include -#include - -#include "ar9331.dtsi" - -/ { - model = "DPTechnics DPT-Module"; - compatible = "dptechnics,dpt-module", "qca,ar9331"; - - aliases { - serial0 = &uart; - }; - - leds { - compatible = "gpio-leds"; - - system { - label = "dpt-module:green:system"; - gpios = <&gpio 27 GPIO_ACTIVE_LOW>; - }; - }; - - keys { - compatible = "gpio-keys-polled"; - poll-interval = <100>; - - button0 { - label = "reset"; - linux,code = ; - gpios = <&gpio 11 GPIO_ACTIVE_LOW>; - }; - }; -}; - -&ref { - clock-frequency = <25000000>; -}; - -&uart { - status = "okay"; -}; - -&gpio { - status = "okay"; -}; - -&usb { - dr_mode = "host"; - status = "okay"; -}; - -&usb_phy { - status = "okay"; -}; - -&spi { - num-chipselects = <1>; - status = "okay"; - - /* Winbond 25Q128FVSG SPI flash */ - flash@0 { - compatible = "winbond,w25q128", "jedec,spi-nor"; - spi-max-frequency = <104000000>; - reg = <0>; - }; -}; diff --git a/target/linux/ath79/dts/ar9331_dragino_ms14.dts b/target/linux/ath79/dts/ar9331_dragino_ms14.dts deleted file mode 100644 index 713fe4103a..0000000000 --- a/target/linux/ath79/dts/ar9331_dragino_ms14.dts +++ /dev/null @@ -1,90 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0 -/dts-v1/; - -#include -#include - -#include "ar9331.dtsi" - -/ { - model = "Dragino MS14 (Dragino 2)"; - compatible = "dragino,ms14", "qca,ar9331"; - - aliases { - serial0 = &uart; - }; - - leds { - compatible = "gpio-leds"; - - wlan { - label = "dragino2:red:wlan"; - gpios = <&gpio 0 GPIO_ACTIVE_HIGH>; - }; - - lan { - label = "dragino2:red:lan"; - gpios = <&gpio 13 GPIO_ACTIVE_LOW>; - }; - - wan { - label = "dragino2:red:wan"; - gpios = <&gpio 17 GPIO_ACTIVE_LOW>; - }; - - system { - label = "dragino2:red:system"; - gpios = <&gpio 28 GPIO_ACTIVE_HIGH>; - }; - }; - - keys { - compatible = "gpio-keys-polled"; - poll-interval = <100>; - - button0 { - label = "jumpstart"; - linux,code = ; - gpios = <&gpio 11 GPIO_ACTIVE_LOW>; - }; - - button1 { - label = "reset"; - linux,code = ; - gpios = <&gpio 12 GPIO_ACTIVE_LOW>; - }; - }; -}; - -&ref { - clock-frequency = <25000000>; -}; - -&uart { - status = "okay"; -}; - -&gpio { - status = "okay"; -}; - -&usb { - dr_mode = "host"; - status = "okay"; -}; - -&usb_phy { - status = "okay"; -}; - -&spi { - num-chipselects = <1>; - status = "okay"; - - /* Winbond 25Q128BVFG SPI flash */ - flash@0 { - compatible = "winbond,w25q128", "jedec,spi-nor"; - spi-max-frequency = <104000000>; - reg = <0>; - }; -}; diff --git a/target/linux/ath79/dts/ar9331_embeddedwireless_dorin.dts b/target/linux/ath79/dts/ar9331_embeddedwireless_dorin.dts index 43bec35fa2..d0e0169f1b 100644 --- a/target/linux/ath79/dts/ar9331_embeddedwireless_dorin.dts +++ b/target/linux/ath79/dts/ar9331_embeddedwireless_dorin.dts @@ -94,7 +94,7 @@ }; art: partition@3 { - label = "ART"; + label = "art"; reg = <0xff0000 0x010000>; read-only; }; diff --git a/target/linux/ath79/dts/ar9331_etactica_eg200.dts b/target/linux/ath79/dts/ar9331_etactica_eg200.dts index d566647a05..708e9defa4 100644 --- a/target/linux/ath79/dts/ar9331_etactica_eg200.dts +++ b/target/linux/ath79/dts/ar9331_etactica_eg200.dts @@ -19,13 +19,15 @@ poll-interval = <50>; restore { - linux,code = ; + linux,code = ; gpios = <&gpio 11 GPIO_ACTIVE_LOW>; }; }; leds { compatible = "gpio-leds"; + pinctrl-names = "default"; + pinctrl-0 = <&switch_led_disable_pins>; modbus { label = "eg200:red:modbus"; diff --git a/target/linux/ath79/dts/ar9331_onion_omega.dts b/target/linux/ath79/dts/ar9331_onion_omega.dts deleted file mode 100644 index 5d0fe33eef..0000000000 --- a/target/linux/ath79/dts/ar9331_onion_omega.dts +++ /dev/null @@ -1,69 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0 -/dts-v1/; - -#include -#include - -#include "ar9331.dtsi" - -/ { - model = "Onion Omega"; - compatible = "onion,omega", "qca,ar9331"; - - aliases { - serial0 = &uart; - }; - - leds { - compatible = "gpio-leds"; - - system { - label = "onion:amber:system"; - gpios = <&gpio 27 GPIO_ACTIVE_LOW>; - }; - }; - - keys { - compatible = "gpio-keys-polled"; - poll-interval = <100>; - - button0 { - label = "reset"; - linux,code = ; - gpios = <&gpio 11 GPIO_ACTIVE_HIGH>; - }; - }; -}; - -&ref { - clock-frequency = <25000000>; -}; - -&uart { - status = "okay"; -}; - -&gpio { - status = "okay"; -}; - -&usb { - dr_mode = "host"; - status = "okay"; -}; - -&usb_phy { - status = "okay"; -}; - -&spi { - num-chipselects = <1>; - status = "okay"; - - /* Winbond 25Q128FVSG SPI flash */ - flash@0 { - compatible = "winbond,w25q128", "jedec,spi-nor"; - spi-max-frequency = <104000000>; - reg = <0>; - }; -}; diff --git a/target/linux/ath79/dts/ar9331_tplink_tl-mr3040-v2.dts b/target/linux/ath79/dts/ar9331_tplink_tl-mr3040-v2.dts index fe15157f8b..ebf4d4485f 100644 --- a/target/linux/ath79/dts/ar9331_tplink_tl-mr3040-v2.dts +++ b/target/linux/ath79/dts/ar9331_tplink_tl-mr3040-v2.dts @@ -17,6 +17,8 @@ leds { compatible = "gpio-leds"; + pinctrl-names = "default"; + pinctrl-0 = <&switch_led_disable_pins>; wlan { label = "tp-link:green:wlan"; diff --git a/target/linux/ath79/dts/ar9331_tplink_tl-wr710n-v1.dts b/target/linux/ath79/dts/ar9331_tplink_tl-wr710n-v1.dts new file mode 100644 index 0000000000..056e9fa512 --- /dev/null +++ b/target/linux/ath79/dts/ar9331_tplink_tl-wr710n-v1.dts @@ -0,0 +1,130 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT +/dts-v1/; + +#include +#include + +#include "ar9331.dtsi" + +/ { + model = "TP-Link TL-WR710N v1"; + compatible = "tplink,tl-wr710n-v1", "qca,ar9331"; + + aliases { + serial0 = &uart; + led-boot = &led_system; + led-failsafe = &led_system; + led-running = &led_system; + led-upgrade = &led_system; + }; + + keys { + compatible = "gpio-keys-polled"; + poll-interval = <20>; + + reset { + label = "reset"; + linux,code = ; + gpios = <&gpio 11 GPIO_ACTIVE_LOW>; + debounce-interval = <60>; + }; + }; + + leds { + compatible = "gpio-leds"; + + led_system: system { + label = "tl-wr710n:green:system"; + gpios = <&gpio 27 GPIO_ACTIVE_LOW>; + }; + }; + + reg_usb_vbus: regulator { + compatible = "regulator-fixed"; + regulator-name = "usb_vbus"; + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5000000>; + gpio = <&gpio 8 GPIO_ACTIVE_HIGH>; + enable-active-high; + }; + +}; + +&spi { + status = "okay"; + num-cs = <1>; + + flash@0 { + compatible = "jedec,spi-nor"; + reg = <0>; + spi-max-frequency = <25000000>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + uboot: partition@0 { + reg = <0x0 0x20000>; + label = "u-boot"; + read-only; + }; + + firmware: partition@20000 { + compatible = "tplink,firmware"; + reg = <0x20000 0x7d0000>; + label = "firmware"; + }; + + art: partition@7f0000 { + reg = <0x7f0000 0x10000>; + label = "art"; + read-only; + }; + }; + }; +}; + +ð0 { + status = "okay"; + + mtd-mac-address = <&uboot 0x1fc00>; + + gmac-config { + device = <&gmac>; + + switch-phy-addr-swap = <0>; + switch-phy-swap = <0>; + }; +}; + +ð1 { + status = "okay"; + + mtd-mac-address = <&uboot 0x1fc00>; + mtd-mac-address-increment = <(-1)>; +}; + +&gpio { + status = "okay"; +}; + +&uart { + status = "okay"; +}; + +&usb { + dr_mode = "host"; + vbus-supply = <®_usb_vbus>; + status = "okay"; +}; + +&usb_phy { + status = "okay"; +}; + +&wmac { + status = "okay"; + mtd-cal-data = <&art 0x1000>; + mtd-mac-address = <&uboot 0x1fc00>; +}; diff --git a/target/linux/ath79/dts/ar9331_tplink_tl-wr741nd-v4.dtsi b/target/linux/ath79/dts/ar9331_tplink_tl-wr741nd-v4.dtsi index 02c647c179..e4b59f1591 100644 --- a/target/linux/ath79/dts/ar9331_tplink_tl-wr741nd-v4.dtsi +++ b/target/linux/ath79/dts/ar9331_tplink_tl-wr741nd-v4.dtsi @@ -40,7 +40,7 @@ leds { compatible = "gpio-leds"; pinctrl-names = "default"; - pinctrl-0 = <&switch_led_pins>; + pinctrl-0 = <&switch_led_disable_pins>; lan1 { label = "tp-link:green:lan1"; diff --git a/target/linux/ath79/dts/ar9342_iodata_etg3-r.dts b/target/linux/ath79/dts/ar9342_iodata_etg3-r.dts index 9fce43fd4f..bd2489aa28 100644 --- a/target/linux/ath79/dts/ar9342_iodata_etg3-r.dts +++ b/target/linux/ath79/dts/ar9342_iodata_etg3-r.dts @@ -93,7 +93,7 @@ }; partition@7f0000 { - label = "ART"; + label = "art"; reg = <0x7f0000 0x010000>; read-only; }; diff --git a/target/linux/ath79/dts/ar9342_ubnt_nanobeam-ac.dts b/target/linux/ath79/dts/ar9342_ubnt_nanobeam-ac.dts new file mode 100644 index 0000000000..6e64c7faad --- /dev/null +++ b/target/linux/ath79/dts/ar9342_ubnt_nanobeam-ac.dts @@ -0,0 +1,64 @@ +// SPDX-License-Identifier: GPL-2.0 +/dts-v1/; + +#include +#include + +#include "ar9342_ubnt_wa.dtsi" + +/ { + compatible = "ubnt,nanobeam-ac", "ubnt,wa", "qca,ar9342"; + model = "Ubiquiti NanoBeam AC (WA)"; + + leds { + compatible = "gpio-leds"; + + rssi0 { + label = "ubnt:blue:rssi0"; + gpios = <&gpio 11 GPIO_ACTIVE_LOW>; + }; + + rssi1 { + label = "ubnt:blue:rssi1"; + gpios = <&gpio 16 GPIO_ACTIVE_LOW>; + }; + + rssi2 { + label = "ubnt:blue:rssi2"; + gpios = <&gpio 13 GPIO_ACTIVE_LOW>; + }; + + rssi3 { + label = "ubnt:blue:rssi3"; + gpios = <&gpio 14 GPIO_ACTIVE_LOW>; + }; + }; +}; + +&mdio0 { + status = "okay"; + + phy-mask = <4>; + phy4: ethernet-phy@4 { + phy-mode = "rgmii"; + reg = <4>; + }; +}; + +ð0 { + status = "okay"; + + /* default for ar934x, except for 1000M and 10M */ + pll-data = <0x06000000 0x00000101 0x00001313>; + + mtd-mac-address = <&eeprom 0x0>; + + phy-mode = "rgmii"; + phy-handle = <&phy4>; + + gmac-config { + device = <&gmac>; + rxd-delay = <3>; + rxdv-delay = <3>; + }; +}; diff --git a/target/linux/ath79/dts/ar9342_ubnt_nanostation-m-xw.dts b/target/linux/ath79/dts/ar9342_ubnt_nanostation-m-xw.dts new file mode 100644 index 0000000000..6ac79b0c1e --- /dev/null +++ b/target/linux/ath79/dts/ar9342_ubnt_nanostation-m-xw.dts @@ -0,0 +1,37 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT +/dts-v1/; + +#include +#include + +#include "ar9342_ubnt_xw.dtsi" + +/ { + compatible = "ubnt,nanostation-m-xw", "ubnt,xw", "qca,ar9342"; + model = "Ubiquiti Nanostation M (XW)"; +}; + +&mdio0 { + status = "okay"; + + phy4-mii-enable; + phy-mask = <0x23>; + + phy4: ethernet-phy@0 { + reg = <0>; + phy-mode = "mii"; + }; +}; + +ð0 { + status = "okay"; + + phy-mode = "mii"; + phy-handle = <&phy4>; + + gmac-config { + device = <&gmac>; + mii-gmac0 = <1>; + mii-gmac0-slave = <1>; + }; +}; diff --git a/target/linux/ath79/dts/ar9344_ocedo_raccoon.dts b/target/linux/ath79/dts/ar9344_ocedo_raccoon.dts index 0875c319b9..a1a912383f 100644 --- a/target/linux/ath79/dts/ar9344_ocedo_raccoon.dts +++ b/target/linux/ath79/dts/ar9344_ocedo_raccoon.dts @@ -169,8 +169,7 @@ ð0 { status = "okay"; - /* default for ar934x, except for 1000M */ - pll-data = <0x06000000 0x00000101 0x00001616>; + pll-data = <0x06000000 0x00000101 0x00001313>; mtd-mac-address = <&art 0x0>; diff --git a/target/linux/ath79/dts/ar9344_tplink_tl-wdr3600-v1.dts b/target/linux/ath79/dts/ar9344_tplink_tl-wdr3600-v1.dts new file mode 100644 index 0000000000..42f40d52a2 --- /dev/null +++ b/target/linux/ath79/dts/ar9344_tplink_tl-wdr3600-v1.dts @@ -0,0 +1,9 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT +/dts-v1/; + +#include "ar9344_tplink_tl-wdr4300.dtsi" + +/ { + model = "TP-Link TL-WDR3600 v1"; + compatible = "tplink,tl-wdr3600-v1", "qca,ar9344"; +}; diff --git a/target/linux/ath79/dts/ar9344_tplink_tl-wdr3600.dts b/target/linux/ath79/dts/ar9344_tplink_tl-wdr3600.dts deleted file mode 100644 index 9f708242f9..0000000000 --- a/target/linux/ath79/dts/ar9344_tplink_tl-wdr3600.dts +++ /dev/null @@ -1,9 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-or-later OR MIT -/dts-v1/; - -#include "ar9344_tplink_tl-wdr4300.dtsi" - -/ { - model = "TP-Link WDR3600"; - compatible = "tplink,tl-wdr3600", "qca,ar9344"; -}; diff --git a/target/linux/ath79/dts/ar9344_tplink_tl-wdr4300-v1.dts b/target/linux/ath79/dts/ar9344_tplink_tl-wdr4300-v1.dts new file mode 100644 index 0000000000..f8f05d24bb --- /dev/null +++ b/target/linux/ath79/dts/ar9344_tplink_tl-wdr4300-v1.dts @@ -0,0 +1,9 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT +/dts-v1/; + +#include "ar9344_tplink_tl-wdr4300.dtsi" + +/ { + model = "TP-Link TL-WDR4300 v1"; + compatible = "tplink,tl-wdr4300-v1", "qca,ar9344"; +}; diff --git a/target/linux/ath79/dts/ar9344_tplink_tl-wdr4300.dts b/target/linux/ath79/dts/ar9344_tplink_tl-wdr4300.dts deleted file mode 100644 index ba6b4f846a..0000000000 --- a/target/linux/ath79/dts/ar9344_tplink_tl-wdr4300.dts +++ /dev/null @@ -1,9 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-or-later OR MIT -/dts-v1/; - -#include "ar9344_tplink_tl-wdr4300.dtsi" - -/ { - model = "TP-Link WDR4300"; - compatible = "tplink,tl-wdr4300", "qca,ar9344"; -}; diff --git a/target/linux/ath79/dts/ar9344_wd_mynet-n750.dts b/target/linux/ath79/dts/ar9344_wd_mynet-n750.dts new file mode 100644 index 0000000000..a9f7e6e9a3 --- /dev/null +++ b/target/linux/ath79/dts/ar9344_wd_mynet-n750.dts @@ -0,0 +1,216 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT +/dts-v1/; + +#include +#include + +#include "ar9344.dtsi" + +/ { + model = "Western Digital My Net N750"; + compatible = "wd,mynet-n750", "qca,ar9344"; + + chosen { + bootargs = "console=ttyS0,115200n8"; + }; + + aliases { + led-boot = &power; + led-failsafe = &power; + led-running = &power; + led-upgrade = &power; + }; + + leds { + compatible = "gpio-leds"; + + wifi { + label = "mynet-n750:blue:wireless"; + gpios = <&gpio 11 GPIO_ACTIVE_HIGH>; + }; + + internet { + label = "mynet-n750:blue:internet"; + gpios = <&gpio 12 GPIO_ACTIVE_HIGH>; + }; + + wps { + label = "mynet-n750:blue:wps"; + gpios = <&gpio 13 GPIO_ACTIVE_HIGH>; + }; + + power: power { + label = "mynet-n750:blue:power"; + gpios = <&gpio 14 GPIO_ACTIVE_HIGH>; + }; + }; + + keys { + compatible = "gpio-keys"; + + reset { + linux,code = ; + gpios = <&gpio 17 GPIO_ACTIVE_LOW>; + }; + + wps { + linux,code = ; + gpios = <&gpio 19 GPIO_ACTIVE_LOW>; + }; + }; +}; + +&ref { + clock-frequency = <40000000>; +}; + +&uart { + status = "okay"; +}; + +&gpio { + status = "okay"; + + gpio_ext_lna0 { + gpio-hog; + gpios = <15 0>; + output-high; + line-name = "mynet-n750:ext:lna0"; + }; + + gpio_ext_lna1 { + gpio-hog; + gpios = <18 0>; + output-high; + line-name = "mynet-n750:ext:lna1"; + }; +}; + +&spi { + num-cs = <1>; + + status = "okay"; + + flash@0 { + compatible = "jedec,spi-nor"; + reg = <0>; + spi-max-frequency = <25000000>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "bootloader"; + reg = <0x000000 0x40000>; + read-only; + }; + + partition@40000 { + label = "bdcfg"; + reg = <0x040000 0x10000>; + read-only; + }; + + partition@50000 { + label = "devdata"; + reg = <0x050000 0x10000>; + read-only; + }; + + partition@60000 { + label = "devconf"; + reg = <0x060000 0x10000>; + read-only; + }; + + partition@70000 { + compatible = "seama"; + label = "firmware"; + reg = <0x070000 0xf80000>; + }; + + art: partition@ff0000 { + label = "art"; + reg = <0xff0000 0x010000>; + read-only; + }; + }; + }; +}; + +&usb { + #address-cells = <1>; + #size-cells = <0>; + status = "okay"; + + port@1 { + #address-cells = <1>; + #size-cells = <0>; + reg = <1>; + #trigger-source-cells = <0>; + + hub_port1: port@1 { + reg = <1>; + #trigger-source-cells = <0>; + }; + + hub_port2: port@2 { + reg = <2>; + #trigger-source-cells = <0>; + }; + }; +}; + +&usb_phy { + status = "okay"; +}; + +&pcie { + status = "okay"; + + wifi@0,0 { + compatible = "pci168c,0033"; + reg = <0x0000 0 0 0 0>; + qca,no-eeprom; + }; +}; + +&wmac { + status = "okay"; + qca,no-eeprom; +}; + +&mdio0 { + status = "okay"; + phy-mask = <0>; + + switch0@1f { + compatible = "qca,ar8327"; + reg = <0x1f>; + + qca,ar8327-initvals = < + 0x04 0x07600000 /* PORT0 PAD MODE CTRL */ + 0x10 0x80000080 /* POWER_ON_STRIP */ + 0x50 0xc737c737 /* LED_CTRL0 */ + 0x54 0x00000000 /* LED_CTRL1 */ + 0x58 0x00000000 /* LED_CTRL2 */ + 0x5c 0x0030c300 /* LED_CTRL3 */ + 0x7c 0x0000007e /* PORT0_STATUS */ + >; + }; +}; + +ð0 { + status = "okay"; + + /* default for ar934x, except for 1000M */ + pll-data = <0x06000000 0x00000101 0x00001616>; + + phy-mode = "rgmii"; + fixed-link { + speed = <1000>; + full-duplex; + }; +}; diff --git a/target/linux/ath79/dts/ar9344_wd_mynet-wifi-rangeextender.dts b/target/linux/ath79/dts/ar9344_wd_mynet-wifi-rangeextender.dts index 1877cea3d9..49c6784151 100644 --- a/target/linux/ath79/dts/ar9344_wd_mynet-wifi-rangeextender.dts +++ b/target/linux/ath79/dts/ar9344_wd_mynet-wifi-rangeextender.dts @@ -58,26 +58,22 @@ }; keys { - compatible = "gpio-keys-polled"; - poll-interval = <50>; + compatible = "gpio-keys"; reset { linux,code = ; gpios = <&gpio 13 GPIO_ACTIVE_LOW>; - debounce-interval = <60>; }; band-switch { linux,code = ; gpios = <&gpio 14 GPIO_ACTIVE_HIGH>; linux,input-type = ; - debounce-interval = <60>; }; wps { linux,code = ; gpios = <&gpio 15 GPIO_ACTIVE_LOW>; - debounce-interval = <60>; }; }; }; diff --git a/target/linux/ath79/dts/ar9344_zbtlink_zbt-wd323.dts b/target/linux/ath79/dts/ar9344_zbtlink_zbt-wd323.dts new file mode 100644 index 0000000000..d899cff9ef --- /dev/null +++ b/target/linux/ath79/dts/ar9344_zbtlink_zbt-wd323.dts @@ -0,0 +1,166 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT +/dts-v1/; + +#include +#include + +#include "ar9344.dtsi" + +/ { + model = "ZBT WD323"; + compatible = "zbtlink,zbt-wd323", "qca,ar9344"; + + keys { + compatible = "gpio-keys"; + + reset { + label = "reset"; + gpios = <&gpio 16 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + }; + + i2c { + compatible = "i2c-gpio"; + #address-cells = <1>; + #size-cells = <0>; + + pinctrl-names = "default"; + pinctrl-0 = <&enable_gpio15 &enable_gpio19>; + + sda-gpios = <&gpio 19 GPIO_ACTIVE_LOW>; + scl-gpios = <&gpio 15 GPIO_ACTIVE_LOW>; + + /* can be removed on 4.19 */ + gpios = <&gpio 19 GPIO_ACTIVE_LOW>, + <&gpio 15 GPIO_ACTIVE_LOW>; + + pcf8563: pcf8563@51 { + compatible = "nxp,pcf8563"; + reg = <0x51>; + #clock-cells = <0>; + }; + }; + + leds { + compatible = "gpio-leds"; + + pinctrl-names = "default"; + pinctrl-0 = <&enable_gpio20_gpio22>; + + wifi { + label = "zbt-wd323:green:wifi"; + gpios = <&gpio 12 GPIO_ACTIVE_LOW>; + linux,default-trigger = "phy0tpt"; + }; + + lan1 { + label = "zbt-wd323:orange:lan1"; + gpios = <&gpio 20 GPIO_ACTIVE_LOW>; + }; + + lan2 { + label = "zbt-wd323:orange:lan2"; + gpios = <&gpio 22 GPIO_ACTIVE_LOW>; + }; + + }; +}; + +&wdt { + status = "okay"; + + pinctrl-names = "default"; + pinctrl-0 = <&enable_gpio21>; +}; + +&uart { + status = "okay"; +}; + +&gpio { + status = "okay"; + + pinctrl-names = "default"; + pinctrl-0 = <&jtag_disable_pins>; +}; + +&usb { + status = "okay"; +}; + +&usb_phy { + status = "okay"; +}; + +ð0 { + status = "okay"; + phy-handle = <&swphy4>; + mtd-mac-address = <&art 0x0>; +}; + +ð1 { + status = "okay"; + mtd-mac-address = <&art 0x6>; +}; + +&spi { + num-chipselects = <1>; + status = "okay"; + + flash@0 { + compatible = "jedec,spi-nor"; + spi-max-frequency = <22000000>; + reg = <0>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + uboot@0 { + reg = <0x0 0x40000>; + read-only; + }; + + uboot-env@40000 { + reg = <0x40000 0x10000>; + read-only; + }; + + firmware@50000 { + compatible = "denx,uimage"; + reg = <0x50000 0xfa0000>; + }; + + art: art@ff0000 { + reg = <0xff0000 0x10000>; + read-only; + }; + }; + }; +}; + +&wmac { + status = "okay"; + mtd-cal-data = <&art 0x1000>; + mtd-mac-address = <&art 0x1002>; +}; + +&pinmux { + enable_gpio15: pinmux_enable_gpio15 { + pinctrl-single,bits = <0xc 0x0 0xff000000>; + }; + + enable_gpio19: pinmux_enable_gpio19 { + pinctrl-single,bits = <0x10 0x0 0xff000000>; + }; + + enable_gpio20_gpio22: pinmux_enable_gpio20_gpio22 { + pinctrl-single,bits = <0x14 0x0 0xff00ff>; + }; + + enable_gpio21: pinmux_enable_gpio21 { + pinctrl-single,bits = <0x14 0x0 0xff00>; + }; +}; diff --git a/target/linux/ath79/dts/ar934x.dtsi b/target/linux/ath79/dts/ar934x.dtsi index 3eed4de799..831854b89b 100644 --- a/target/linux/ath79/dts/ar934x.dtsi +++ b/target/linux/ath79/dts/ar934x.dtsi @@ -192,19 +192,16 @@ &mdio0 { compatible = "qca,ar9340-mdio"; - resets = <&rst 22>; - reset-names = "mdio"; }; ð0 { - compatible = "qca,ar9340-eth", "syscon", "simple-mfd"; + compatible = "qca,ar9340-eth", "syscon"; pll-data = <0x16000000 0x00000101 0x00001616>; pll-reg = <0x4 0x2c 17>; pll-handle = <&pll>; - - resets = <&rst 9>; - reset-names = "mac"; + resets = <&rst 9>, <&rst 22>; + reset-names = "mac", "mdio"; }; &mdio1 { @@ -216,13 +213,14 @@ builtin-switch; builtin_switch: switch0@1f { - compatible = "qca,ar8229-builtin"; + compatible = "qca,ar8229"; reg = <0x1f>; resets = <&rst 8>; reset-names = "switch"; phy-mode = "gmii"; - phy4-mii-enable; + qca,mib-poll-interval = <500>; + qca,phy4-mii-enable; mdio-bus { #address-cells = <1>; @@ -242,7 +240,7 @@ }; ð1 { - compatible = "qca,ar9340-eth", "syscon", "simple-mfd"; + compatible = "qca,ar9340-eth", "syscon"; resets = <&rst 13>; reset-names = "mac"; diff --git a/target/linux/ath79/dts/ath79.dtsi b/target/linux/ath79/dts/ath79.dtsi index a57c58659f..c351272025 100644 --- a/target/linux/ath79/dts/ath79.dtsi +++ b/target/linux/ath79/dts/ath79.dtsi @@ -43,7 +43,7 @@ eth0: eth@19000000 { status = "disabled"; - compatible = "qca,ath79-eth", "syscon", "simple-mfd"; + compatible = "qca,ath79-eth", "syscon"; reg = <0x19000000 0x200>; interrupts = <4>; @@ -66,7 +66,7 @@ eth1: eth@1a000000 { status = "disabled"; - compatible = "qca,ath79-eth", "syscon", "simple-mfd"; + compatible = "qca,ath79-eth", "syscon"; reg = <0x1a000000 0x200>; interrupts = <5>; diff --git a/target/linux/ath79/dts/qca9531_comfast_cf-e5.dts b/target/linux/ath79/dts/qca9531_comfast_cf-e5.dts new file mode 100644 index 0000000000..c181b32aa6 --- /dev/null +++ b/target/linux/ath79/dts/qca9531_comfast_cf-e5.dts @@ -0,0 +1,141 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT +/dts-v1/; + +#include +#include + +#include "qca953x.dtsi" + +/ { + compatible = "comfast,cf-e5", "qca,qca9531"; + model = "COMFAST CF-E5/E7"; + + keys { + compatible = "gpio-keys-polled"; + poll-interval = <20>; + + button0 { + label = "reset"; + linux,code = ; + gpios = <&gpio 17 GPIO_ACTIVE_LOW>; + }; + }; + + leds { + compatible = "gpio-leds"; + pinctrl-names = "default"; + pinctrl-0 = <&jtag_disable_pins &led_wan_pin>; + + wan { + label = "cf-e5:blue:wan"; + gpios = <&gpio 4 GPIO_ACTIVE_LOW>; + }; + + lan { + label = "cf-e5:blue:lan"; + gpios = <&gpio 16 GPIO_ACTIVE_LOW>; + }; + + wlan { + label = "cf-e5:blue:wlan"; + gpios = <&gpio 0 GPIO_ACTIVE_LOW>; + linux,default-trigger = "phy0tpt"; + }; + + rssi0 { + label = "cf-e5:blue:rssi0"; + gpios = <&gpio 2 GPIO_ACTIVE_LOW>; + }; + + rssi1 { + label = "cf-e5:blue:rssi1"; + gpios = <&gpio 3 GPIO_ACTIVE_LOW>; + }; + + rssi2 { + label = "cf-e5:blue:rssi2"; + gpios = <&gpio 15 GPIO_ACTIVE_LOW>; + }; + }; +}; + +&uart { + status = "okay"; +}; + +&usb0 { + #address-cells = <1>; + #size-cells = <0>; + status = "okay"; + + hub_port: port@1 { + reg = <1>; + #trigger-source-cells = <0>; + }; +}; + +&usb_phy { + status = "okay"; +}; + +&spi { + status = "okay"; + num-cs = <1>; + + flash@0 { + compatible = "jedec,spi-nor"; + reg = <0>; + spi-max-frequency = <25000000>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "u-boot"; + reg = <0x000000 0x010000>; + read-only; + }; + + art: partition@10000 { + label = "art"; + reg = <0x010000 0x010000>; + read-only; + }; + + partition@20000 { + compatible = "denx,uimage"; + label = "firmware"; + reg = <0x020000 0xfd0000>; + }; + + partition@ff0000 { + label = "art-backup"; + reg = <0xff0000 0x010000>; + read-only; + }; + }; + }; +}; + +ð0 { + status = "okay"; + mtd-mac-address = <&art 0x0>; + phy-handle = <&swphy4>; +}; + +ð1 { + mtd-mac-address = <&art 0x6>; +}; + +&wmac { + status = "okay"; + mtd-cal-data = <&art 0x1000>; +}; + +&pinmux { + led_wan_pin: pinmux_led_wan_pin { + pinctrl-single,bits = <0x4 0x0 0xff>; + }; +}; diff --git a/target/linux/ath79/dts/qca9531_engenius_ews511ap.dts b/target/linux/ath79/dts/qca9531_engenius_ews511ap.dts deleted file mode 100644 index 62b6a766fc..0000000000 --- a/target/linux/ath79/dts/qca9531_engenius_ews511ap.dts +++ /dev/null @@ -1,144 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-or-later OR MIT -/dts-v1/; - -#include -#include - -#include "qca953x.dtsi" - -/ { - compatible = "engenius,ews511ap", "qca,qca9531"; - model = "EnGenius EWS511AP"; - - keys { - compatible = "gpio-keys-polled"; - - poll-interval = <20>; - pinctrl-names = "default"; - pinctrl-0 = <&jtag_disable_pins>; - - reset { - label = "reset"; - linux,code = ; - gpios = <&gpio 1 GPIO_ACTIVE_LOW>; - }; - }; - - aliases { - led-boot = &power_led; - led-failsafe = &power_led; - led-running = &power_led; - led-upgrade = &power_led; - }; - - leds { - compatible = "gpio-leds"; - - power_led: power { - label = "ews511ap:amber:power"; - gpios = <&gpio 0 GPIO_ACTIVE_LOW>; - default-state = "on"; - }; - - lan1 { - label = "ews511ap:blue:lan1"; - gpios = <&gpio 4 GPIO_ACTIVE_LOW>; - }; - - lan2 { - label = "ews511ap:blue:lan2"; - gpios = <&gpio 13 GPIO_ACTIVE_LOW>; - }; - - wlan2g { - label = "ews511ap:green:wlan2g"; - gpios = <&gpio 15 GPIO_ACTIVE_LOW>; - linux,default-trigger = "phy0tpt"; - }; - - wlan5g { - label = "ews511ap:green:wlan5g"; - gpios = <&gpio 3 GPIO_ACTIVE_LOW>; - linux,default-trigger = "phy1tpt"; - }; - }; - - watchdog { - compatible = "linux,wdt-gpio"; - - gpios = <&gpio 12 GPIO_ACTIVE_LOW>; - hw_algo = "toggle"; - /* hw_margin_ms is actually 300s but driver limits it to 60s */ - hw_margin_ms = <60000>; - always-running; - }; -}; - -&wdt { - status = "okay"; -}; - -&rst { - status = "okay"; -}; - -&pcie0 { - status = "okay"; -}; - -&uart { - status = "okay"; -}; - -&spi { - status = "okay"; - num-cs = <0>; - - flash@0 { - compatible = "jedec,spi-nor"; - reg = <0>; - spi-max-frequency = <25000000>; - - partitions { - compatible = "fixed-partitions"; - #address-cells = <1>; - #size-cells = <1>; - - partition@0 { - label = "u-boot"; - reg = <0x000000 0x040000>; - read-only; - }; - - ubootenv: partition@40000 { - label = "u-boot-env"; - reg = <0x040000 0x010000>; - }; - - art: partition@50000 { - label = "art"; - reg = <0x050000 0x010000>; - }; - - partition@60000 { - compatible = "denx,uimage"; - label = "firmware"; - reg = <0x060000 0xfa0000>; - }; - }; - }; -}; - -ð0 { - status = "okay"; - phy-handle = <&swphy4>; -}; - -ð1 { - status = "okay"; -}; - -&wmac { - status = "okay"; - mtd-cal-data = <&art 0x1000>; -}; diff --git a/target/linux/ath79/dts/qca9531_glinet_gl-ar300m-lite.dts b/target/linux/ath79/dts/qca9531_glinet_gl-ar300m-lite.dts new file mode 100644 index 0000000000..fba08e4295 --- /dev/null +++ b/target/linux/ath79/dts/qca9531_glinet_gl-ar300m-lite.dts @@ -0,0 +1,22 @@ +/dts-v1/; + +#include "qca9531_glinet_gl-ar300m-nor.dts" + +/ { + compatible = "glinet,gl-ar300m-lite", "qca,qca9531"; + model = "GL.iNet GL-AR300M-Lite"; +}; + +// GL-AR300M-Lite has different LED colors than the non-Lite version + +&led_status { + label = "gl-ar300m-lite:red:status"; +}; + +&led_lan { + label = "gl-ar300m-lite:green:lan"; +}; + +&led_wlan { + label = "gl-ar300m-lite:green:wlan"; +}; \ No newline at end of file diff --git a/target/linux/ath79/dts/qca9531_glinet_gl-ar300m-nand.dts b/target/linux/ath79/dts/qca9531_glinet_gl-ar300m-nand.dts index 9e78f83a76..26c30f2b72 100644 --- a/target/linux/ath79/dts/qca9531_glinet_gl-ar300m-nand.dts +++ b/target/linux/ath79/dts/qca9531_glinet_gl-ar300m-nand.dts @@ -8,42 +8,8 @@ }; &spi { - status = "okay"; num-cs = <1>; - flash@0 { - compatible = "winbond,w25q128", "jedec,spi-nor"; - reg = <0>; - spi-max-frequency = <25000000>; - - partitions { - compatible = "fixed-partitions"; - #address-cells = <1>; - #size-cells = <1>; - - partition@0 { - label = "u-boot"; - reg = <0x000000 0x040000>; - read-only; - }; - - partition@1 { - label = "u-boot-env"; - reg = <0x040000 0x010000>; - }; - - partition@2 { - label = "reserved"; - reg = <0x050000 0xfa0000>; - }; - - art: partition@3 { - label = "art"; - reg = <0xff0000 0x010000>; - }; - }; - }; - flash@1 { compatible = "spinand,mt29f"; reg = <1>; diff --git a/target/linux/ath79/dts/qca9531_glinet_gl-ar300m-nor.dts b/target/linux/ath79/dts/qca9531_glinet_gl-ar300m-nor.dts index 6b77af0401..02196cf9c4 100644 --- a/target/linux/ath79/dts/qca9531_glinet_gl-ar300m-nor.dts +++ b/target/linux/ath79/dts/qca9531_glinet_gl-ar300m-nor.dts @@ -9,42 +9,3 @@ compatible = "glinet,gl-ar300m-nor", "qca,qca9531"; model = "GL.iNet GL-AR300M (NOR)"; }; - -&spi { - status = "okay"; - num-cs = <0>; - - flash@0 { - compatible = "winbond,w25q128", "jedec,spi-nor"; - reg = <0>; - spi-max-frequency = <25000000>; - - partitions { - compatible = "fixed-partitions"; - #address-cells = <1>; - #size-cells = <1>; - - partition@0 { - label = "u-boot"; - reg = <0x000000 0x040000>; - read-only; - }; - - partition@1 { - label = "u-boot-env"; - reg = <0x040000 0x010000>; - }; - - partition@2 { - compatible = "denx,uimage"; - label = "firmware"; - reg = <0x050000 0xfa0000>; - }; - - art: partition@3 { - label = "art"; - reg = <0xff0000 0x010000>; - }; - }; - }; -}; diff --git a/target/linux/ath79/dts/qca9531_glinet_gl-ar300m.dtsi b/target/linux/ath79/dts/qca9531_glinet_gl-ar300m.dtsi index 55002b44e3..8b127ed1d8 100644 --- a/target/linux/ath79/dts/qca9531_glinet_gl-ar300m.dtsi +++ b/target/linux/ath79/dts/qca9531_glinet_gl-ar300m.dtsi @@ -41,20 +41,22 @@ leds { compatible = "gpio-leds"; - wlan { - label = "gl-ar300m:green:wlan"; - gpios = <&gpio 14 GPIO_ACTIVE_LOW>; - linux,default-trigger = "phy0tpt"; + // Colors from non-Lite versions + + led_status: status { + label = "gl-ar300m:green:status"; + gpios = <&gpio 12 GPIO_ACTIVE_LOW>; }; - lan { + led_lan: lan { label = "gl-ar300m:green:lan"; gpios = <&gpio 13 GPIO_ACTIVE_LOW>; }; - led_status: status { - label = "gl-ar300m:red:status"; - gpios = <&gpio 12 GPIO_ACTIVE_LOW>; + led_wlan: wlan { + label = "gl-ar300m:red:wlan"; + gpios = <&gpio 14 GPIO_ACTIVE_LOW>; + linux,default-trigger = "phy0tpt"; }; }; }; @@ -63,6 +65,46 @@ status = "okay"; }; +&spi { + status = "okay"; + num-cs = <0>; + + flash@0 { + compatible = "winbond,w25q128", "jedec,spi-nor"; + reg = <0>; + spi-max-frequency = <25000000>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "u-boot"; + reg = <0x000000 0x040000>; + read-only; + }; + + partition@1 { + label = "u-boot-env"; + reg = <0x040000 0x010000>; + }; + + partition@2 { + compatible = "denx,uimage"; + label = "firmware"; + reg = <0x050000 0xfa0000>; + }; + + art: partition@3 { + label = "art"; + reg = <0xff0000 0x010000>; + read-only; + }; + }; + }; +}; + &uart { status = "okay"; }; diff --git a/target/linux/ath79/dts/qca9531_glinet_gl-x750.dts b/target/linux/ath79/dts/qca9531_glinet_gl-x750.dts index 79cd51673a..ddaf7709b7 100644 --- a/target/linux/ath79/dts/qca9531_glinet_gl-x750.dts +++ b/target/linux/ath79/dts/qca9531_glinet_gl-x750.dts @@ -108,6 +108,7 @@ art: partition@50000 { label = "art"; reg = <0x050000 0x010000>; + read-only; }; partition@60000 { diff --git a/target/linux/ath79/dts/qca9531_yuncore_a770.dts b/target/linux/ath79/dts/qca9531_yuncore_a770.dts new file mode 100644 index 0000000000..18ad6307a1 --- /dev/null +++ b/target/linux/ath79/dts/qca9531_yuncore_a770.dts @@ -0,0 +1,126 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT +/dts-v1/; + +#include +#include + +#include "qca953x.dtsi" + +/ { + model = "YunCore A770"; + compatible = "yuncore,a770", "qca,qca9533"; + + aliases { + led-boot = &status; + led-failsafe = &status; + led-running = &status; + led-upgrade = &status; + }; + + chosen { + bootargs = "console=ttyS0,115200n8"; + }; + + keys { + compatible = "gpio-keys"; + + reset { + label = "reset"; + linux,code = ; + gpios = <&gpio 17 GPIO_ACTIVE_LOW>; + debounce-interval = <60>; + }; + }; + + leds { + compatible = "gpio-leds"; + + lan { + label = "a770:green:lan"; + gpios = <&gpio 16 GPIO_ACTIVE_LOW>; + }; + + status: status { + label = "a770:green:status"; + gpios = <&gpio 12 GPIO_ACTIVE_LOW>; + default-state = "keep"; + }; + + wan { + label = "a770:green:wan"; + gpios = <&gpio 4 GPIO_ACTIVE_LOW>; + }; + + wlan2g { + label = "a770:red:wlan2g"; + gpios = <&gpio 13 GPIO_ACTIVE_LOW>; + linux,default-trigger = "phy1tpt"; + }; + }; +}; + +ð0 { + status = "okay"; + + phy-handle = <&swphy4>; + mtd-mac-address = <&art 0x0>; +}; + +ð1 { + mtd-mac-address = <&art 0x6>; +}; + +&pcie0 { + status = "okay"; +}; + +&spi { + status = "okay"; + + num-cs = <1>; + + flash@0 { + compatible = "jedec,spi-nor"; + reg = <0>; + spi-max-frequency = <25000000>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "u-boot"; + reg = <0x000000 0x040000>; + read-only; + }; + + partition@40000 { + label = "u-boot-env"; + reg = <0x040000 0x010000>; + }; + + partition@50000 { + compatible = "denx,uimage"; + label = "firmware"; + reg = <0x050000 0xfa0000>; + }; + + art: partition@ff0000 { + label = "art"; + reg = <0xff0000 0x010000>; + read-only; + }; + }; + }; +}; + +&uart { + status = "okay"; +}; + +&wmac { + status = "okay"; + + mtd-cal-data = <&art 0x1000>; +}; diff --git a/target/linux/ath79/dts/qca9533_tplink_cpe210-v2.dts b/target/linux/ath79/dts/qca9533_tplink_cpe210-v2.dts new file mode 100644 index 0000000000..e8273ba249 --- /dev/null +++ b/target/linux/ath79/dts/qca9533_tplink_cpe210-v2.dts @@ -0,0 +1,9 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT +/dts-v1/; + +#include "qca9533_tplink_cpe210.dtsi" + +/ { + compatible = "tplink,cpe210-v2", "qca,qca9533"; + model = "TP-LINK CPE210 v2"; +}; diff --git a/target/linux/ath79/dts/qca9533_tplink_cpe210-v3.dts b/target/linux/ath79/dts/qca9533_tplink_cpe210-v3.dts new file mode 100644 index 0000000000..cf1f728d0f --- /dev/null +++ b/target/linux/ath79/dts/qca9533_tplink_cpe210-v3.dts @@ -0,0 +1,9 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT +/dts-v1/; + +#include "qca9533_tplink_cpe210.dtsi" + +/ { + compatible = "tplink,cpe210-v3", "qca,qca9533"; + model = "TP-LINK CPE210 v3"; +}; diff --git a/target/linux/ath79/dts/qca9533_tplink_cpe210.dtsi b/target/linux/ath79/dts/qca9533_tplink_cpe210.dtsi new file mode 100644 index 0000000000..f86ff30fc7 --- /dev/null +++ b/target/linux/ath79/dts/qca9533_tplink_cpe210.dtsi @@ -0,0 +1,135 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT +/dts-v1/; + +#include +#include + +#include "qca953x.dtsi" + +/ { + chosen { + bootargs = "console=ttyS0,115200n8"; + }; + + aliases { + led-boot = &system; + led-failsafe = &system; + led-running = &system; + led-upgrade = &system; + }; + + leds { + compatible = "gpio-leds"; + + lan { + label = "tp-link:green:lan"; + gpios = <&gpio 11 GPIO_ACTIVE_LOW>; + }; + + link1 { + label = "tp-link:green:link1"; + gpios = <&gpio 13 GPIO_ACTIVE_LOW>; + }; + + link2 { + label = "tp-link:green:link2"; + gpios = <&gpio 14 GPIO_ACTIVE_LOW>; + }; + + link3 { + label = "tp-link:green:link3"; + gpios = <&gpio 15 GPIO_ACTIVE_LOW>; + }; + + system: link4 { + label = "tp-link:green:link4"; + gpios = <&gpio 16 GPIO_ACTIVE_LOW>; + }; + }; + + keys { + compatible = "gpio-keys-polled"; + poll-interval = <100>; + + reset_button { + label = "Reset button"; + linux,code = ; + gpios = <&gpio 17 GPIO_ACTIVE_LOW>; + }; + }; +}; + +&uart { + status = "okay"; +}; + +&spi { + status = "okay"; + num-cs = <1>; + + flash@0 { + #address-cells = <1>; + #size-cells = <1>; + compatible = "jedec,spi-nor"; + reg = <0>; + spi-max-frequency = <25000000>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + uboot: partition@0 { + label = "u-boot"; + reg = <0x000000 0x020000>; + read-only; + }; + + partition@20000 { + label = "partition-table"; + reg = <0x020000 0x10000>; + read-only; + }; + + info: partition@30000 { + label = "info"; + reg = <0x030000 0x10000>; + read-only; + }; + + partition@40000 { + label = "firmware"; + reg = <0x040000 0x780000>; + compatible = "tplink,firmware"; + }; + + config: partition@7c0000 { + label = "config"; + reg = <0x7c0000 0x30000>; + read-only; + }; + + art: partition@7f0000 { + label = "art"; + reg = <0x7f0000 0x10000>; + read-only; + }; + }; + }; +}; + +ð0 { + status = "okay"; + phy-handle = <&swphy4>; + mtd-mac-address = <&info 0x8>; +}; + +ð1 { + compatible = "syscon", "simple-mfd"; +}; + +&wmac { + status = "okay"; + mtd-cal-data = <&art 0x1000>; + mtd-mac-address = <&info 0x8>; +}; diff --git a/target/linux/ath79/dts/qca9533_tplink_tl-wr842n-v3.dts b/target/linux/ath79/dts/qca9533_tplink_tl-wr842n-v3.dts new file mode 100644 index 0000000000..c173add252 --- /dev/null +++ b/target/linux/ath79/dts/qca9533_tplink_tl-wr842n-v3.dts @@ -0,0 +1,168 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT +/dts-v1/; + +#include +#include + +#include "qca953x.dtsi" + +/ { + compatible = "tplink,tl-wr842n-v3", "qca,qca9533"; + model = "TP-Link TL-WR842N v3"; + + aliases { + led-boot = &qss_led; + led-failsafe = &qss_led; + led-running = &qss_led; + led-upgrade = &qss_led; + }; + + gpio_leds: leds { + compatible = "gpio-leds"; + + system: power { + label = "tp-link:green:power"; + gpios = <&gpio 2 GPIO_ACTIVE_LOW>; + default-state = "on"; + }; + + wifi { + label = "tp-link:green:wlan"; + gpios = <&gpio 3 GPIO_ACTIVE_LOW>; + linux,default-trigger = "phy0tpt"; + }; + + qss_led: qss { + label = "tp-link:green:qss"; + gpios = <&gpio 17 GPIO_ACTIVE_LOW>; + }; + + wan_green { + label = "tp-link:green:wan"; + gpios = <&gpio 11 GPIO_ACTIVE_LOW>; + }; + + wan_red { + label = "tp-link:red:wan"; + gpios = <&gpio 4 GPIO_ACTIVE_LOW>; + }; + + lan1 { + label = "tp-link:green:lan1"; + gpios = <&gpio 12 GPIO_ACTIVE_LOW>; + }; + + lan2 { + label = "tp-link:green:lan2"; + gpios = <&gpio 13 GPIO_ACTIVE_LOW>; + }; + + lan3 { + label = "tp-link:green:lan3"; + gpios = <&gpio 14 GPIO_ACTIVE_LOW>; + }; + + lan4 { + label = "tp-link:green:lan4"; + gpios = <&gpio 15 GPIO_ACTIVE_LOW>; + }; + + usb { + label = "tp-link:green:usb"; + gpios = <&gpio 16 GPIO_ACTIVE_LOW>; + linux,default-trigger = "usbport"; + trigger-sources = <&hub_port>; + }; + }; + + keys { + compatible = "gpio-keys"; + + reset { + label = "Reset button"; + linux,code = ; + gpios = <&gpio 1 GPIO_ACTIVE_LOW>; + debounce-interval = <60>; + }; + + rfkill { + label = "RFKILL button"; + linux,code = ; + gpios = <&gpio 0 GPIO_ACTIVE_LOW>; + debounce-interval = <60>; + }; + }; +}; + +&uart { + status = "okay"; +}; + +&usb0 { + #address-cells = <1>; + #size-cells = <0>; + status = "okay"; + + hub_port: port@1 { + reg = <1>; + #trigger-source-cells = <0>; + }; +}; + +&usb_phy { + status = "okay"; +}; + +&spi { + status = "okay"; + num-cs = <1>; + + flash@0 { + compatible = "jedec,spi-nor"; + reg = <0>; + spi-max-frequency = <25000000>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + uboot: partition@0 { + label = "u-boot"; + reg = <0x000000 0x020000>; + read-only; + }; + + partition@20000 { + compatible = "tplink,firmware"; + label = "firmware"; + reg = <0x020000 0xfd0000>; + }; + + art: partition@ff0000 { + label = "art"; + reg = <0xff0000 0x010000>; + read-only; + }; + }; + }; +}; + +ð1 { + mtd-mac-address = <&uboot 0x1fc00>; +}; + +ð0 { + status = "okay"; + phy-handle = <&swphy4>; + + mtd-mac-address = <&uboot 0x1fc00>; + mtd-mac-address-increment = <1>; +}; + +&wmac { + status = "okay"; + mtd-cal-data = <&art 0x1000>; + mtd-mac-address = <&uboot 0x1fc00>; +}; + diff --git a/target/linux/ath79/dts/qca9533_ubnt_acb-isp.dts b/target/linux/ath79/dts/qca9533_ubnt_acb-isp.dts new file mode 100644 index 0000000000..3bdaa8ba9b --- /dev/null +++ b/target/linux/ath79/dts/qca9533_ubnt_acb-isp.dts @@ -0,0 +1,95 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT +/dts-v1/; + +#include +#include + +#include "qca953x.dtsi" + +/ { + compatible = "ubnt,acb-isp", "qca,qca9533"; + model = "Ubiquiti airCube ISP"; + + keys { + compatible = "gpio-keys"; + + reset { + label = "reset"; + linux,code = ; + gpios = <&gpio 17 GPIO_ACTIVE_LOW>; + debounce-interval = <60>; + }; + }; +}; + +&spi { + status = "okay"; + num-cs = <1>; + + flash@0 { + compatible = "jedec,spi-nor"; + reg = <0>; + spi-max-frequency = <25000000>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "u-boot"; + reg = <0x000000 0x040000>; + read-only; + }; + + partition@40000 { + label = "u-boot-env"; + reg = <0x040000 0x010000>; + read-only; + }; + + partition@50000 { + compatible = "denx,uimage"; + label = "firmware"; + reg = <0x050000 0xf60000>; + }; + + partition@fb0000 { + label = "cfg"; + reg = <0xfb0000 0x040000>; + read-only; + }; + + eeprom: partition@ff0000 { + label = "EEPROM"; + reg = <0xff0000 0x010000>; + read-only; + }; + }; + }; +}; + +&uart { + status = "okay"; +}; + +ð0 { + status = "okay"; + mtd-mac-address = <&eeprom 0x0>; + phy-handle = <&swphy4>; +}; + +ð1 { + status = "okay"; + mtd-mac-address = <&eeprom 0x6>; + + gmac-config { + device = <&gmac>; + }; +}; + +&wmac { + status = "okay"; + mtd-cal-data = <&eeprom 0x1000>; + mtd-mac-address = <&eeprom 0x1002>; +}; diff --git a/target/linux/ath79/dts/qca953x.dtsi b/target/linux/ath79/dts/qca953x.dtsi index 669e3fb851..45e5b851fa 100644 --- a/target/linux/ath79/dts/qca953x.dtsi +++ b/target/linux/ath79/dts/qca953x.dtsi @@ -245,13 +245,14 @@ builtin-switch; builtin_switch: switch0@1f { - compatible = "qca,ar8229-builtin"; + compatible = "qca,ar8229"; reg = <0x1f>; resets = <&rst 8>; reset-names = "switch"; phy-mode = "gmii"; - phy4-mii-enable; + qca,phy4-mii-enable; + qca,mib-poll-interval = <500>; mdio-bus { #address-cells = <1>; @@ -273,7 +274,7 @@ ð1 { status = "okay"; - compatible = "qca,qca9530-eth", "syscon", "simple-mfd"; + compatible = "qca,qca9530-eth", "syscon"; resets = <&rst 13>; reset-names = "mac"; diff --git a/target/linux/ath79/dts/qca9557.dtsi b/target/linux/ath79/dts/qca9557.dtsi index 77e5a316dd..b726a382ee 100644 --- a/target/linux/ath79/dts/qca9557.dtsi +++ b/target/linux/ath79/dts/qca9557.dtsi @@ -223,7 +223,7 @@ gmac: gmac@18070000 { compatible = "qca,qca9550-gmac"; - reg = <0x18070000 0x14>; + reg = <0x18070000 0x58>; }; wmac: wmac@18100000 { @@ -289,12 +289,11 @@ }; &mdio0 { - resets = <&rst 22>; - reset-names = "mdio"; + compatible = "qca,ar9340-mdio"; }; ð0 { - compatible = "qca,qca9550-eth", "syscon", "simple-mfd"; + compatible = "qca,qca9550-eth", "syscon"; pll-reg = <0 0x28 0>; pll-handle = <&pll>; @@ -302,17 +301,16 @@ pll-data = <0x16000000 0x00000101 0x00001616>; phy-mode = "rgmii"; - resets = <&rst 9>; - reset-names = "mac"; + resets = <&rst 9>, <&rst 22>; + reset-names = "mac", "mdio"; }; &mdio1 { - resets = <&rst 23>; - reset-names = "mdio"; + compatible = "qca,ar9340-mdio"; }; ð1 { - compatible = "qca,qca9550-eth", "syscon", "simple-mfd"; + compatible = "qca,qca9550-eth", "syscon"; pll-reg = <0 0x48 0>; pll-handle = <&pll>; @@ -320,6 +318,6 @@ pll-data = <0x16000000 0x00000101 0x00001616>; phy-mode = "sgmii"; - resets = <&rst 13>; - reset-names = "mac"; + resets = <&rst 13>, <&rst 23>; + reset-names = "mac", "mdio"; }; diff --git a/target/linux/ath79/dts/qca9557_iodata_wn-ac1167dgr.dts b/target/linux/ath79/dts/qca9557_iodata_wn-ac1167dgr.dts deleted file mode 100644 index c2fc7abcb3..0000000000 --- a/target/linux/ath79/dts/qca9557_iodata_wn-ac1167dgr.dts +++ /dev/null @@ -1,28 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-or-later OR MIT -/dts-v1/; - -#include -#include - -#include "qca9557_iodata_wn-ac-dgr.dtsi" - -/ { - compatible = "iodata,wn-ac1167dgr", "qca,qca9557"; - model = "I-O DATA WN-AC1167DGR"; -}; - -&leds { - copy { - label = "iodata:green:copy"; - gpios = <&gpio 2 GPIO_ACTIVE_LOW>; - }; -}; - -&keys { - copy { - label = "copy"; - gpios = <&gpio 15 GPIO_ACTIVE_LOW>; - linux,code = ; - debounce-interval = <60>; - }; -}; diff --git a/target/linux/ath79/dts/qca9557_iodata_wn-ac1600dgr.dts b/target/linux/ath79/dts/qca9557_iodata_wn-ac1600dgr.dts deleted file mode 100644 index ef47e1e41f..0000000000 --- a/target/linux/ath79/dts/qca9557_iodata_wn-ac1600dgr.dts +++ /dev/null @@ -1,28 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-or-later OR MIT -/dts-v1/; - -#include -#include - -#include "qca9557_iodata_wn-ac-dgr.dtsi" - -/ { - compatible = "iodata,wn-ac1600dgr", "qca,qca9557"; - model = "I-O DATA WN-AC1600DGR"; -}; - -&leds { - function { - label = "iodata:green:function"; - gpios = <&gpio 2 GPIO_ACTIVE_LOW>; - }; -}; - -&keys { - function { - label = "function"; - gpios = <&gpio 15 GPIO_ACTIVE_LOW>; - linux,code = ; - debounce-interval = <60>; - }; -}; diff --git a/target/linux/ath79/dts/qca9557_iodata_wn-ac1600dgr2.dts b/target/linux/ath79/dts/qca9557_iodata_wn-ac1600dgr2.dts deleted file mode 100644 index 37ae8fe01f..0000000000 --- a/target/linux/ath79/dts/qca9557_iodata_wn-ac1600dgr2.dts +++ /dev/null @@ -1,28 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-or-later OR MIT -/dts-v1/; - -#include -#include - -#include "qca9557_iodata_wn-ac-dgr.dtsi" - -/ { - compatible = "iodata,wn-ac1600dgr2", "qca,qca9557"; - model = "I-O DATA WN-AC1600DGR2"; -}; - -&leds { - copy { - label = "iodata:green:copy"; - gpios = <&gpio 2 GPIO_ACTIVE_LOW>; - }; -}; - -&keys { - copy { - label = "copy"; - gpios = <&gpio 15 GPIO_ACTIVE_LOW>; - linux,code = ; - debounce-interval = <60>; - }; -}; diff --git a/target/linux/ath79/dts/qca9558_devolo_dvl1200e.dts b/target/linux/ath79/dts/qca9558_devolo_dvl1200e.dts deleted file mode 100644 index 3bca23cc57..0000000000 --- a/target/linux/ath79/dts/qca9558_devolo_dvl1200e.dts +++ /dev/null @@ -1,47 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-or-later OR MIT -/dts-v1/; - -#include -#include - -#include "qca9558_devolo_dvl1xxx.dtsi" - -/ { - compatible = "devolo,dvl1200e", "qca,qca9557"; - model = "devolo WiFi pro 1200e"; - - aliases { - led-boot = &status_blue; - led-failsafe = &status_red; - led-running = &status_blue; - led-upgrade = &status_red; - }; - - leds { - compatible = "gpio-leds"; - - status_blue: status_blue { - label = "dvl1200e:blue:status"; - gpios = <&gpio 14 GPIO_ACTIVE_LOW>; - default-state = "on"; - }; - - status_red: status_red { - label = "dvl1200e:red:status"; - gpios = <&gpio 15 GPIO_ACTIVE_LOW>; - }; - }; - - beeper { - compatible = "gpio-beeper"; - gpios = <&gpio 4 GPIO_ACTIVE_HIGH>; - }; -}; - -&mdio1 { - status = "okay"; -}; - -ð1 { - status = "okay"; -}; diff --git a/target/linux/ath79/dts/qca9558_devolo_dvl1200i.dts b/target/linux/ath79/dts/qca9558_devolo_dvl1200i.dts deleted file mode 100644 index 5900d8b487..0000000000 --- a/target/linux/ath79/dts/qca9558_devolo_dvl1200i.dts +++ /dev/null @@ -1,51 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-or-later OR MIT -/dts-v1/; - -#include -#include - -#include "qca9558_devolo_dvl1xxx.dtsi" - -/ { - compatible = "devolo,dvl1200i", "qca,qca9557"; - model = "devolo WiFi pro 1200i"; - - aliases { - led-boot = &status_blue; - led-failsafe = &status_red; - led-running = &status_blue; - led-upgrade = &status_red; - }; - - leds { - compatible = "gpio-leds"; - - status_blue: status_blue { - label = "dvl1200i:blue:status"; - gpios = <&gpio 14 GPIO_ACTIVE_LOW>; - default-state = "on"; - }; - - status_red: status_red { - label = "dvl1200i:red:status"; - gpios = <&gpio 15 GPIO_ACTIVE_LOW>; - }; - }; - - beeper { - compatible = "gpio-beeper"; - gpios = <&gpio 4 GPIO_ACTIVE_HIGH>; - }; -}; - -ð0 { - pll-data = <0xbe000000 0x80000101 0x80001313>; -}; - -&gmac_config { - rxdv-delay = <3>; - rxd-delay = <3>; - txen-delay = <3>; - txd-delay = <3>; - rgmii-enabled = <1>; -}; diff --git a/target/linux/ath79/dts/qca9558_devolo_dvl1750c.dts b/target/linux/ath79/dts/qca9558_devolo_dvl1750c.dts deleted file mode 100644 index b5a2954406..0000000000 --- a/target/linux/ath79/dts/qca9558_devolo_dvl1750c.dts +++ /dev/null @@ -1,46 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-or-later OR MIT -/dts-v1/; - -#include -#include - -#include "qca9558_devolo_dvl1xxx.dtsi" - -/ { - compatible = "devolo,dvl1750c", "qca,qca9557"; - model = "devolo WiFi pro 1750c"; - - aliases { - led-boot = &status_blue; - led-failsafe = &status_red; - led-running = &status_blue; - led-upgrade = &status_red; - }; - - leds { - compatible = "gpio-leds"; - - status_blue: status_blue { - label = "dvl1750c:blue:status"; - gpios = <&gpio 14 GPIO_ACTIVE_LOW>; - default-state = "on"; - }; - - status_red: status_red { - label = "dvl1750c:red:status"; - gpios = <&gpio 15 GPIO_ACTIVE_LOW>; - }; - }; - - beeper { - compatible = "gpio-beeper"; - gpios = <&gpio 21 GPIO_ACTIVE_HIGH>; - }; -}; - -&gmac_config { - rxdv-delay = <3>; - rxd-delay = <3>; - txen-delay = <3>; - txd-delay = <3>; -}; diff --git a/target/linux/ath79/dts/qca9558_devolo_dvl1750e.dts b/target/linux/ath79/dts/qca9558_devolo_dvl1750e.dts deleted file mode 100644 index 2570eb7cea..0000000000 --- a/target/linux/ath79/dts/qca9558_devolo_dvl1750e.dts +++ /dev/null @@ -1,83 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-or-later OR MIT -/dts-v1/; - -#include -#include - -#include "qca9558_devolo_dvl1xxx.dtsi" - -/ { - compatible = "devolo,dvl1750e", "qca,qca9557"; - model = "devolo WiFi pro 1750e"; - - aliases { - led-boot = &status_blue; - led-failsafe = &status_red; - led-running = &status_blue; - led-upgrade = &status_red; - }; - - keys { - wps { - label = "WPS Button"; - linux,code = ; - gpios = <&gpio 16 GPIO_ACTIVE_LOW>; - debounce-interval = <60>; - }; - - usb_eject { - label = "USB Eject Button"; - linux,code = ; - linux,input-type = ; - gpios = <&gpio 19 GPIO_ACTIVE_LOW>; - debounce-interval = <60>; - }; - }; - - leds { - compatible = "gpio-leds"; - - status_blue: status_blue { - label = "dvl1750e:blue:status"; - gpios = <&gpio 14 GPIO_ACTIVE_LOW>; - default-state = "on"; - }; - - status_red: status_red { - label = "dvl1750e:red:status"; - gpios = <&gpio 15 GPIO_ACTIVE_LOW>; - }; - }; - - beeper { - compatible = "gpio-beeper"; - gpios = <&gpio 4 GPIO_ACTIVE_HIGH>; - }; - - - gpio_export { - compatible = "gpio-export"; - - gpio_usb_power { - gpio-export,name = "devolo:power:usb"; - gpio-export,output = <1>; - gpios = <&gpio 11 GPIO_ACTIVE_HIGH>; - }; - }; -}; - -&usb_phy0 { - status = "okay"; -}; - -&usb0 { - status = "okay"; -}; - -&mdio1 { - status = "okay"; -}; - -ð1 { - status = "okay"; -}; diff --git a/target/linux/ath79/dts/qca9558_devolo_dvl1750i.dts b/target/linux/ath79/dts/qca9558_devolo_dvl1750i.dts deleted file mode 100644 index bd3702eb36..0000000000 --- a/target/linux/ath79/dts/qca9558_devolo_dvl1750i.dts +++ /dev/null @@ -1,51 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-or-later OR MIT -/dts-v1/; - -#include -#include - -#include "qca9558_devolo_dvl1xxx.dtsi" - -/ { - compatible = "devolo,dvl1750i", "qca,qca9557"; - model = "devolo WiFi pro 1750i"; - - aliases { - led-boot = &status_blue; - led-failsafe = &status_red; - led-running = &status_blue; - led-upgrade = &status_red; - }; - - leds { - compatible = "gpio-leds"; - - status_blue: status_blue { - label = "dvl1750i:blue:status"; - gpios = <&gpio 14 GPIO_ACTIVE_LOW>; - default-state = "on"; - }; - - status_red: status_red { - label = "dvl1750i:red:status"; - gpios = <&gpio 15 GPIO_ACTIVE_LOW>; - }; - }; - - beeper { - compatible = "gpio-beeper"; - gpios = <&gpio 4 GPIO_ACTIVE_HIGH>; - }; -}; - -ð0 { - pll-data = <0xbe000000 0x80000101 0x80001313>; -}; - -&gmac_config { - rxdv-delay = <3>; - rxd-delay = <3>; - txen-delay = <3>; - txd-delay = <3>; - rgmii-enabled = <1>; -}; diff --git a/target/linux/ath79/dts/qca9558_librerouter_librerouter-v1.dts b/target/linux/ath79/dts/qca9558_librerouter_librerouter-v1.dts new file mode 100644 index 0000000000..3b7e3aceda --- /dev/null +++ b/target/linux/ath79/dts/qca9558_librerouter_librerouter-v1.dts @@ -0,0 +1,211 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT +/dts-v1/; + +#include +#include + +#include "qca9557.dtsi" + +/ { + compatible = "librerouter,librerouter-v1", "qca,qca9558"; + model = "LibreRouter v1"; + + chosen { + bootargs = "console=ttyS0,115200n8"; + }; + + aliases { + led-boot = &system; + led-failsafe = &system; + led-running = &system; + led-upgrade = &system; + }; + + leds { + compatible = "gpio-leds"; + + system: system { + label = "librerouter-v1:green:system"; + gpios = <&gpio 23 GPIO_ACTIVE_HIGH>; + default-state = "on"; + }; + + wifi_green { + label = "librerouter-v1:green:wlan2g"; + gpios = <&gpio 22 GPIO_ACTIVE_LOW>; + linux,default-trigger = "phy0tpt"; + }; + + status_blue { + label = "librerouter-v1:blue:status"; + gpios = <&gpio 20 GPIO_ACTIVE_LOW>; + }; + + }; + + button { + compatible = "gpio-keys"; + + reset { + label = "Reset"; + linux,code = ; + gpios = <&gpio 17 GPIO_ACTIVE_LOW>; + debounce-interval = <60>; + }; + + }; + + watchdog { + compatible = "linux,wdt-gpio"; + gpios = <&gpio 2 GPIO_ACTIVE_LOW>; + hw_algo = "toggle"; + hw_margin_ms = <1000>; + always-running; + }; + +}; + +&pcie0 { + status = "okay"; + + wifi@0,0 { + compatible = "pci168c,0033"; + reg = <0x0000 0 0 0 0>; + }; +}; + +&pcie1 { + status = "okay"; + + wifi@0,0 { + compatible = "pci168c,0033"; + reg = <0x0000 0 0 0 0>; + }; +}; + +&uart { + status = "okay"; +}; + +&gpio { + status = "okay"; +}; + +&usb_phy0 { + status = "okay"; +}; + +&usb0 { + #address-cells = <1>; + #size-cells = <0>; + status = "okay"; +}; + +&usb_phy1 { + status = "okay"; +}; + +&usb1 { + #address-cells = <1>; + #size-cells = <0>; + status = "okay"; +}; + +&spi { + status = "okay"; + num-cs = <1>; + + flash@0 { + compatible = "jedec,spi-nor"; + reg = <0>; + spi-max-frequency = <25000000>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "u-boot"; + reg = <0x000000 0x040000>; + read-only; + }; + + partition@40000 { + label = "u-boot-env"; + reg = <0x040000 0x010000>; + }; + + partition@50000 { + compatible = "denx,uimage"; + label = "firmware"; + reg = <0x050000 0x7c0000>; + }; + + partition@810000 { + label = "fw2"; + reg = <0x810000 0x7d0000>; + }; + + partition@fd0000 { + label = "res"; + reg = <0xfd0000 0x20000>; + }; + + art: partition@ff0000 { + label = "art"; + reg = <0xff0000 0x010000>; + read-only; + }; + }; + }; +}; + +&mdio0 { + status = "okay"; + + phy0: ethernet-phy@0 { + reg = <0>; + qca,ar8327-initvals = < + 0x04 0x87600000 /* PORT0: RGMII, MAC0/6 exchage, tx_delay 01, rx_delay 10 */ + 0x0c 0x00000080 /* PORT6: SGMII */ + 0x10 0x81000080 /* POWER_ON_STRAP: LED open drain, SerDes auto-neg disabled */ + 0x50 0xcf37cf37 /* LED_CTRL0 */ + 0x54 0xcf37cf37 /* LED_CTRL1 */ + 0x58 0xcf37cf37 /* LED_CTRL2 */ + 0x5c 0x0 /* LED_CTRL3 */ + 0x7c 0x0000007e /* PORT0_STATUS */ + 0x94 0x0000007e /* PORT6 STATUS */ + >; + }; +}; + +ð0 { + status = "okay"; + + pll-data = <0xa6000000 0x00000101 0x00001616>; + mtd-mac-address = <&art 0x0>; + + phy-handle = <&phy0>; + +}; + +ð1 { + status = "okay"; + + phy-mode = "sgmii"; + pll-data = <0x03000101 0x00000101 0x00001616>; + mtd-mac-address = <&art 0x6>; + + fixed-link { + speed = <1000>; + full-duplex; + }; +}; + +&wmac { + status = "okay"; + + mtd-cal-data = <&art 0x1000>; + mtd-mac-address = <&art 0xc>; +}; diff --git a/target/linux/ath79/dts/qca9558_netgear_ex6400.dts b/target/linux/ath79/dts/qca9558_netgear_ex6400.dts new file mode 100644 index 0000000000..8b61331f96 --- /dev/null +++ b/target/linux/ath79/dts/qca9558_netgear_ex6400.dts @@ -0,0 +1,9 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT +/dts-v1/; + +#include "qca9558_netgear_ex7300.dtsi" + +/ { + model = "Netgear EX6400"; + compatible = "netgear,ex6400", "qca,qca9558"; +}; diff --git a/target/linux/ath79/dts/qca9558_netgear_ex7300.dtsi b/target/linux/ath79/dts/qca9558_netgear_ex7300.dtsi new file mode 100644 index 0000000000..21c25a5717 --- /dev/null +++ b/target/linux/ath79/dts/qca9558_netgear_ex7300.dtsi @@ -0,0 +1,222 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT +/dts-v1/; + +#include +#include + +#include "qca9557.dtsi" + +/ { + chosen { + bootargs = "console=ttyS0,115200n8"; + }; + + aliases { + led-boot = &power_green; + led-failsafe = &power_amber; + led-running = &power_green; + led-upgrade = &power_amber; + }; + + led_spi { + compatible = "spi-gpio"; + #address-cells = <1>; + #size-cells = <0>; + + gpio-sck = <&gpio 18 GPIO_ACTIVE_HIGH>; + gpio-mosi = <&gpio 15 GPIO_ACTIVE_HIGH>; + num-chipselects = <0>; + + led_gpio: led_gpio@0 { + compatible = "nxp,74lvc594"; + reg = <0>; + gpio-controller; + #gpio-cells = <2>; + registers-number = <1>; + lines-initial-states = /bits/ 8 <0xff>; + spi-max-frequency = <500000>; + + gpio_latch_bit { + gpio-hog; + gpios = <4 GPIO_ACTIVE_HIGH>; + output-high; + line-name = "gpio-latch-bit"; + }; + }; + }; + + leds { + compatible = "gpio-leds"; + + power_green: power_green { + label = "netgear:green:power"; + gpios = <&gpio 19 GPIO_ACTIVE_LOW>; + }; + + power_amber: power_amber { + label = "netgear:amber:power"; + gpios = <&gpio 20 GPIO_ACTIVE_LOW>; + }; + + left_blue { + label = "netgear:blue:left"; + gpios = <&led_gpio 7 GPIO_ACTIVE_LOW>; + }; + + right_blue { + label = "netgear:blue:right"; + gpios = <&led_gpio 6 GPIO_ACTIVE_LOW>; + }; + + wps_green { + label = "netgear:green:wps"; + gpios = <&led_gpio 5 GPIO_ACTIVE_LOW>; + }; + + client_red { + label = "netgear:red:client"; + gpios = <&led_gpio 3 GPIO_ACTIVE_LOW>; + }; + + client_green { + label = "netgear:green:client"; + gpios = <&led_gpio 2 GPIO_ACTIVE_LOW>; + }; + + router_red { + label = "netgear:red:router"; + gpios = <&led_gpio 1 GPIO_ACTIVE_LOW>; + }; + + router_green { + label = "netgear:green:router"; + gpios = <&led_gpio 0 GPIO_ACTIVE_LOW>; + }; + }; + + keys { + compatible = "gpio-keys"; + + reset { + label = "Reset button"; + linux,code = ; + gpios = <&gpio 11 GPIO_ACTIVE_LOW>; + debounce-interval = <60>; + }; + + wps { + label = "WPS button"; + linux,code = ; + gpios = <&gpio 22 GPIO_ACTIVE_LOW>; + debounce-interval = <60>; + }; + + extender_apmode { + label = "EXTENDER/APMODE switch"; + gpios = <&gpio 23 GPIO_ACTIVE_LOW>; + linux,code = ; + linux,input-type = ; + debounce-interval = <60>; + }; + }; +}; + +&pcie0 { + status = "okay"; +}; + +&uart { + status = "okay"; +}; + +&pll { + clocks = <&extosc>; +}; + +&spi { + status = "okay"; + num-cs = <1>; + + flash@0 { + compatible = "jedec,spi-nor"; + reg = <0>; + spi-max-frequency = <25000000>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + uboot: partition@0 { + label = "u-boot"; + reg = <0x000000 0x040000>; + read-only; + }; + + partition@40000 { + label = "u-boot-env"; + reg = <0x040000 0x010000>; + }; + + caldata: partition@50000 { + label = "caldata"; + reg = <0x050000 0x010000>; + read-only; + }; + + partition@60000 { + label = "caldata-backup"; + reg = <0x060000 0x010000>; + read-only; + }; + + partition@70000 { + label = "config"; + reg = <0x070000 0x010000>; + }; + + partition@80000 { + label = "pot"; + reg = <0x080000 0x010000>; + }; + + partition@90000 { + label = "firmware"; + reg = <0x090000 0xf30000>; + compatible = "denx,uimage"; + }; + + partition@fc0000 { + label = "language"; + reg = <0xfc0000 0x040000>; + }; + }; + }; +}; + +&wmac { + status = "okay"; + + mtd-cal-data = <&caldata 0x1000>; + mtd-mac-address = <&caldata 0x06>; +}; + +&mdio0 { + status = "okay"; + + phy4: ethernet-phy@4 { + reg = <4>; + phy-mode = "rgmii"; + }; +}; + +ð0 { + status = "okay"; + + mtd-mac-address = <&caldata 0x00>; + + phy-handle = <&phy4>; + phy-mode = "rgmii"; + + pll-data = <0x83000000 0x80000101 0x80001313>; +}; diff --git a/target/linux/ath79/dts/qca9558_ocedo_koala.dts b/target/linux/ath79/dts/qca9558_ocedo_koala.dts deleted file mode 100644 index 23835492a3..0000000000 --- a/target/linux/ath79/dts/qca9558_ocedo_koala.dts +++ /dev/null @@ -1,160 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-or-later OR MIT -/dts-v1/; - -#include -#include - -#include "qca9557.dtsi" - -/ { - compatible = "ocedo,koala", "qca,qca9557"; - model = "OCEDO Koala"; - - chosen { - bootargs = "console=ttyS0,115200n8"; - }; - - aliases { - led-boot = &system; - led-failsafe = &system; - led-running = &system; - led-upgrade = &system; - }; - - leds { - compatible = "gpio-leds"; - - power { - label = "koala:green:power"; - gpios = <&gpio 22 GPIO_ACTIVE_LOW>; - default-state = "on"; - }; - - wifi2 { - label = "koala:yellow:wlan2"; - gpios = <&gpio 23 GPIO_ACTIVE_LOW>; - linux,default-trigger = "phy1tpt"; - }; - - wifi5 { - label = "koala:red:wlan58"; - gpios = <&gpio 13 GPIO_ACTIVE_LOW>; - linux,default-trigger = "phy0tpt"; - }; - - system: system { - label = "koala:blue:sys"; - gpios = <&gpio 19 GPIO_ACTIVE_LOW>; - }; - }; - - keys { - compatible = "gpio-keys-polled"; - poll-interval = <100>; - - reset { - label = "reset"; - linux,code = ; - gpios = <&gpio 17 GPIO_ACTIVE_LOW>; - }; - }; -}; - -&pcie0 { - status = "okay"; -}; - -&uart { - status = "okay"; -}; - -&pll { - clocks = <&extosc>; -}; - -&spi { - status = "okay"; - num-cs = <1>; - - flash@0 { - compatible = "jedec,spi-nor"; - reg = <0>; - spi-max-frequency = <25000000>; - - partitions { - compatible = "fixed-partitions"; - #address-cells = <1>; - #size-cells = <1>; - - uboot: partition@0 { - label = "u-boot"; - reg = <0x000000 0x040000>; - read-only; - }; - - partition@40000 { - label = "u-boot-env"; - reg = <0x040000 0x010000>; - }; - - partition@50000 { - compatible = "denx,uimage"; - label = "firmware"; - reg = <0x050000 0x740000>; - }; - - partition@790000 { - label = "vendor"; - reg = <0x790000 0x740000>; - read-only; - }; - - partition@ed0000 { - label = "data"; - reg = <0xed0000 0x110000>; - read-only; - }; - - partition@fe0000 { - label = "id"; - reg = <0xfe0000 0x010000>; - read-only; - }; - - art: partition@ff0000 { - label = "art"; - reg = <0xff0000 0x010000>; - read-only; - }; - }; - }; -}; - -&wmac { - status = "okay"; - - mtd-cal-data = <&art 0x1000>; - mtd-mac-address = <&art 0x06>; -}; - -&mdio0 { - status = "okay"; - - phy5: ethernet-phy@5 { - reg = <5>; - phy-mode = "rgmii-rxid"; - - at803x-disable-smarteee; - }; -}; - -ð0 { - status = "okay"; - - mtd-mac-address = <&art 0x00>; - - phy-handle = <&phy5>; - phy-mode = "rgmii-rxid"; - - pll-data = <0x8e000000 0x80000101 0x80001313>; -}; diff --git a/target/linux/ath79/dts/qca9558_openmesh_om5p-ac-v2.dts b/target/linux/ath79/dts/qca9558_openmesh_om5p-ac-v2.dts deleted file mode 100644 index 1e3cf40f71..0000000000 --- a/target/linux/ath79/dts/qca9558_openmesh_om5p-ac-v2.dts +++ /dev/null @@ -1,168 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-or-later OR MIT -/dts-v1/; - -#include -#include - -#include "qca9557.dtsi" - -/ { - compatible = "openmesh,om5p-ac-v2", "qca,qca9557"; - model = "OpenMesh OM5P-AC V2"; - - extosc: ref { - compatible = "fixed-clock"; - #clock-cells = <0>; - clock-output-names = "ref"; - clock-frequency = <40000000>; - }; - - leds { - compatible = "gpio-leds"; - - power { - label = "om5pac:blue:power"; - gpios = <&gpio 14 GPIO_ACTIVE_LOW>; - }; - - wifi_green { - label = "om5pac:green:wifi"; - gpios = <&gpio 13 GPIO_ACTIVE_LOW>; - }; - - wifi_yellow { - label = "om5pac:yellow:wifi"; - gpios = <&gpio 15 GPIO_ACTIVE_LOW>; - }; - - wifi_red { - label = "om5pac:red:wifi"; - gpios = <&gpio 23 GPIO_ACTIVE_LOW>; - }; - }; - - keys { - compatible = "gpio-keys-polled"; - poll-interval = <100>; - - button0 { - label = "reset"; - linux,code = ; - gpios = <&gpio 1 GPIO_ACTIVE_LOW>; - }; - }; - - gpio-export { - compatible = "gpio-export"; - #size-cells = <0>; - - gpio_pa_dcdc { - gpio-export,name = "om5pac:pa_dcdc"; - gpio-export,output = <1>; - gpios = <&gpio 2 GPIO_ACTIVE_HIGH>; - }; - gpio_pa_high { - gpio-export,name = "om5pac:pa_high"; - gpio-export,output = <1>; - gpios = <&gpio 16 GPIO_ACTIVE_HIGH>; - }; - }; -}; - -&pinmux { - pinmux_pa_dcdc_pins { - pinctrl-single,bits = <0x0 0xff00 0x0>; - }; - - pinmux_pa_high_pins { - pinctrl-single,bits = <0x10 0xff 0x0>; - }; -}; - -&pcie0 { - status = "okay"; -}; - -&uart { - status = "okay"; -}; - -&pll { - clocks = <&extosc>; -}; - -&spi { - status = "okay"; - num-cs = <1>; - - flash@0 { - compatible = "jedec,spi-nor"; - reg = <0>; - spi-max-frequency = <25000000>; - - partitions { - compatible = "fixed-partitions"; - #address-cells = <1>; - #size-cells = <1>; - - partition@0 { - label = "u-boot"; - reg = <0x000000 0x040000>; - read-only; - }; - - partition@1 { - label = "u-boot-env"; - reg = <0x040000 0x010000>; - }; - - partition@2 { - compatible = "denx,uimage"; - label = "firmware"; - reg = <0x850000 0x7a0000>; - }; - - partition@3 { - label = "ART"; - reg = <0xff0000 0x010000>; - read-only; - }; - }; - }; -}; - -&mdio0 { - status = "okay"; - - phy4: ethernet-phy@4 { - reg = <4>; - phy-mode = "rgmii-id"; - }; -}; - -&mdio1 { - status = "okay"; - - phy1: ethernet-phy@1 { - reg = <1>; - phy-mode = "sgmii"; - }; -}; - -ð0 { - status = "okay"; - - pll-data = <0x82000101 0x80000101 0x80001313>; - - phy-handle = <&phy4>; - phy-mode = "rgmii"; -}; - -ð1 { - status = "okay"; - - pll-data = <0x03000101 0x80000101 0x80001313>; - - phy-handle = <&phy1>; - phy-mode = "sgmii"; -}; diff --git a/target/linux/ath79/dts/qca9558_tplink_tl-wr941n-v7-cn.dts b/target/linux/ath79/dts/qca9558_tplink_tl-wr941n-v7-cn.dts new file mode 100644 index 0000000000..c33fe7404a --- /dev/null +++ b/target/linux/ath79/dts/qca9558_tplink_tl-wr941n-v7-cn.dts @@ -0,0 +1,126 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT +/dts-v1/; + +#include +#include + +#include "qca9557.dtsi" + +/ { + compatible = "tplink,tl-wr941n-v7-cn", "qca,qca9558"; + model = "TP-Link TL-WR941N v7 (CN)"; + + chosen { + bootargs = "console=ttyS0,115200n8"; + }; + + aliases { + led-boot = &led_system; + led-failsafe = &led_system; + led-running = &led_system; + led-upgrade = &led_system; + }; + + leds { + compatible = "gpio-leds"; + + led_system: system { + label = "tp-link:green:system"; + gpios = <&gpio 19 GPIO_ACTIVE_LOW>; + default-state = "on"; + }; + + wlan { + label = "tp-link:green:wlan"; + gpios = <&gpio 12 GPIO_ACTIVE_LOW>; + linux,default-trigger = "phy0tpt"; + }; + + qss { + label = "tp-link:green:qss"; + gpios = <&gpio 15 GPIO_ACTIVE_LOW>; + }; + }; + + keys { + compatible = "gpio-keys"; + + reset { + label = "reset"; + linux,code = ; + gpios = <&gpio 17 GPIO_ACTIVE_LOW>; + debounce-interval = <60>; + }; + + wps { + label = "qss"; + linux,code = ; + gpios = <&gpio 16 GPIO_ACTIVE_LOW>; + debounce-interval = <60>; + }; + }; +}; + +&uart { + status = "okay"; +}; + +&spi { + status = "okay"; + num-cs = <1>; + + flash@0 { + compatible = "jedec,spi-nor"; + reg = <0>; + spi-max-frequency = <25000000>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + uboot: partition@0 { + label = "u-boot"; + reg = <0x000000 0x020000>; + read-only; + }; + + partition@20000 { + compatible = "tplink,firmware"; + label = "firmware"; + reg = <0x020000 0x3d0000>; + }; + + art: partition@7f0000 { + label = "art"; + reg = <0x3f0000 0x010000>; + read-only; + }; + }; + }; +}; + +&mdio0 { + status = "okay"; + + switch0@1f { + compatible = "qca,ar8236"; + reg = <0x1f>; + }; +}; + +ð0 { + status = "okay"; + phy-mode = "mii"; + mtd-mac-address = <&uboot 0x1fc00>; + fixed-link { + speed = <100>; + full-duplex; + }; +}; + +&wmac { + status = "okay"; + mtd-cal-data = <&art 0x1000>; + mtd-mac-address = <&uboot 0x1fc00>; +}; diff --git a/target/linux/ath79/dts/qca9561_tplink_archer-c58-v1.dts b/target/linux/ath79/dts/qca9561_tplink_archer-c58-v1.dts deleted file mode 100644 index fdc5713fad..0000000000 --- a/target/linux/ath79/dts/qca9561_tplink_archer-c58-v1.dts +++ /dev/null @@ -1,125 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-or-later OR MIT -/dts-v1/; - -#include -#include - -#include "qca9561_tplink_archer-c5x.dtsi" - -/ { - compatible = "tplink,archer-c58-v1", "qca,qca9560"; - model = "TP-Link Archer C58 v1"; - - aliases { - led-boot = &power; - led-failsafe = &power; - led-running = &power; - led-upgrade = &power; - }; - - leds { - compatible = "gpio-leds"; - - power: power { - label = "tp-link:green:power"; - gpios = <&led_gpio 0 GPIO_ACTIVE_LOW>; - default-state = "on"; - }; - - wlan2g { - label = "tp-link:green:wlan2g"; - gpios = <&led_gpio 1 GPIO_ACTIVE_LOW>; - linux,default-trigger = "phy1tpt"; - }; - - wlan5g { - label = "tp-link:green:wlan5g"; - gpios = <&led_gpio 2 GPIO_ACTIVE_LOW>; - linux,default-trigger = "phy0tpt"; - }; - - wan_green { - label = "tp-link:green:wan"; - gpios = <&led_gpio 4 GPIO_ACTIVE_LOW>; - }; - - wan_amber { - label = "tp-link:amber:wan"; - gpios = <&led_gpio 5 GPIO_ACTIVE_LOW>; - }; - - lan { - label = "tp-link:green:lan"; - gpios = <&led_gpio 3 GPIO_ACTIVE_LOW>; - }; - - wps { - label = "tp-link:green:wps"; - gpios = <&led_gpio 6 GPIO_ACTIVE_LOW>; - }; - }; -}; - -&spi { - status = "okay"; - num-cs = <1>; - - flash@0 { - compatible = "jedec,spi-nor"; - reg = <0>; - spi-max-frequency = <25000000>; - - partitions { - compatible = "fixed-partitions"; - #address-cells = <1>; - #size-cells = <1>; - - partition@0 { - label = "u-boot"; - reg = <0x000000 0x010000>; - read-only; - }; - - mac: partition@10000 { - label = "mac"; - reg = <0x010000 0x010000>; - read-only; - }; - - partition@20000 { - compatible = "denx,uimage"; - label = "firmware"; - reg = <0x020000 0x7c0000>; - }; - - partition@7e0000 { - label = "tplink"; - reg = <0x7e0000 0x010000>; - read-only; - }; - - art: partition@7f0000 { - label = "art"; - reg = <0x7f0000 0x010000>; - read-only; - }; - }; - }; -}; - -ð0 { - status = "okay"; - mtd-mac-address = <&mac 0x8>; - mtd-mac-address-increment = <1>; -}; - -ð1 { - status = "okay"; - mtd-mac-address = <&mac 0x8>; -}; - -&wmac { - status = "okay"; - mtd-cal-data = <&art 0x1000>; - mtd-mac-address = <&mac 0x8>; -}; diff --git a/target/linux/ath79/dts/qca9561_tplink_archer-c59-v1.dts b/target/linux/ath79/dts/qca9561_tplink_archer-c59-v1.dts deleted file mode 100644 index 6ac5f3811e..0000000000 --- a/target/linux/ath79/dts/qca9561_tplink_archer-c59-v1.dts +++ /dev/null @@ -1,147 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-or-later OR MIT -/dts-v1/; - -#include -#include - -#include "qca9561_tplink_archer-c5x.dtsi" - -/ { - compatible = "tplink,archer-c59-v1", "qca,qca9560"; - model = "TP-Link Archer C59 v1"; - - aliases { - led-boot = &power; - led-failsafe = &power; - led-running = &power; - led-upgrade = &power; - }; - - leds { - compatible = "gpio-leds"; - - power: power { - label = "tp-link:green:power"; - gpios = <&led_gpio 0 GPIO_ACTIVE_LOW>; - default-state = "on"; - }; - - wlan2g { - label = "tp-link:green:wlan2g"; - gpios = <&led_gpio 1 GPIO_ACTIVE_LOW>; - linux,default-trigger = "phy1tpt"; - }; - - wlan5g { - label = "tp-link:green:wlan5g"; - gpios = <&led_gpio 2 GPIO_ACTIVE_LOW>; - linux,default-trigger = "phy0tpt"; - }; - - wan_green { - label = "tp-link:green:wan"; - gpios = <&led_gpio 4 GPIO_ACTIVE_LOW>; - }; - - wan_amber { - label = "tp-link:amber:wan"; - gpios = <&led_gpio 5 GPIO_ACTIVE_LOW>; - }; - - lan { - label = "tp-link:green:lan"; - gpios = <&led_gpio 3 GPIO_ACTIVE_LOW>; - }; - - wps { - label = "tp-link:green:wps"; - gpios = <&led_gpio 6 GPIO_ACTIVE_LOW>; - }; - - usb { - label = "tp-link:green:usb"; - gpios = <&led_gpio 7 GPIO_ACTIVE_LOW>; - linux,default-trigger = "usbport"; - trigger-sources = <&hub_port>; - }; - }; -}; - -&usb0 { - #address-cells = <1>; - #size-cells = <0>; - status = "okay"; - - hub_port: port@1 { - reg = <1>; - #trigger-source-cells = <0>; - }; -}; - -&usb_phy0 { - status = "okay"; -}; - -&spi { - status = "okay"; - num-cs = <1>; - - flash@0 { - compatible = "jedec,spi-nor"; - reg = <0>; - spi-max-frequency = <25000000>; - - partitions { - compatible = "fixed-partitions"; - #address-cells = <1>; - #size-cells = <1>; - - partition@0 { - label = "u-boot"; - reg = <0x000000 0x010000>; - read-only; - }; - - mac: partition@10000 { - label = "mac"; - reg = <0x010000 0x010000>; - read-only; - }; - - partition@20000 { - compatible = "denx,uimage"; - label = "firmware"; - reg = <0x020000 0xe30000>; - }; - - partition@e50000 { - label = "tplink"; - reg = <0xe50000 0x1a0000>; - read-only; - }; - - art: partition@ff0000 { - label = "art"; - reg = <0xff0000 0x010000>; - read-only; - }; - }; - }; -}; - -ð0 { - status = "okay"; - mtd-mac-address = <&mac 0x8>; - mtd-mac-address-increment = <1>; -}; - -ð1 { - status = "okay"; - mtd-mac-address = <&mac 0x8>; -}; - -&wmac { - status = "okay"; - mtd-cal-data = <&art 0x1000>; - mtd-mac-address = <&mac 0x8>; -}; diff --git a/target/linux/ath79/dts/qca9563_dlink_dir-859-a1.dts b/target/linux/ath79/dts/qca9563_dlink_dir-859-a1.dts deleted file mode 100644 index 23b4cc5126..0000000000 --- a/target/linux/ath79/dts/qca9563_dlink_dir-859-a1.dts +++ /dev/null @@ -1,177 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-or-later OR MIT -/dts-v1/; - -#include -#include - -#include "qca956x.dtsi" - -/ { - model = "D-Link DIR-859 A1"; - compatible = "dlink,dir-859-a1", "qca,qca9563"; - - aliases { - led-boot = &power; - led-failsafe = &power; - led-running = &power; - led-upgrade = &power; - }; - - chosen { - bootargs = "console=ttyS0,115200n8"; - }; - - leds { - compatible = "gpio-leds"; - - wps { - label = "dir-859-a1:green:wps"; - gpios = <&gpio 8 GPIO_ACTIVE_LOW>; - }; - - power: power { - label = "dir-859-a1:green:power"; - gpios = <&gpio 15 GPIO_ACTIVE_LOW>; - }; - - internet { - label = "dir-859-a1:green:internet"; - gpios = <&gpio 16 GPIO_ACTIVE_LOW>; - }; - - wlan { - label = "dir-859-a1:green:wlan"; - gpios = <&gpio 19 GPIO_ACTIVE_LOW>; - linux,default-trigger = "phy0tpt"; - }; - }; - - keys { - compatible = "gpio-keys-polled"; - poll-interval = <20>; - - wps { - linux,code = ; - gpios = <&gpio 1 GPIO_ACTIVE_LOW>; - debounce-interval = <60>; - }; - - reset { - linux,code = ; - gpios = <&gpio 2 GPIO_ACTIVE_LOW>; - debounce-interval = <60>; - }; - }; - - gpio-export { - compatible = "gpio-export"; - #size-cells = <0>; - - gpio_switch_reset { - gpio-export,name = "dir-859-a1:reset:switch"; - gpio-export,output = <1>; - gpios = <&gpio 11 GPIO_ACTIVE_HIGH>; - }; - }; -}; - -&uart { - status = "okay"; -}; - -&gpio { - status = "okay"; -}; - -&pcie { - status = "okay"; -}; - -&spi { - num-cs = <1>; - - status = "okay"; - - flash@0 { - compatible = "jedec,spi-nor"; - reg = <0>; - spi-max-frequency = <30000000>; - - partitions { - compatible = "fixed-partitions"; - #address-cells = <1>; - #size-cells = <1>; - - partition@0 { - label = "bootloader"; - reg = <0x000000 0x40000>; - read-only; - }; - - partition@40000 { - label = "bdcfg"; - reg = <0x040000 0x10000>; - read-only; - }; - - partition@50000 { - label = "devdata"; - reg = <0x050000 0x10000>; - read-only; - }; - - partition@60000 { - label = "devconf"; - reg = <0x060000 0x10000>; - read-only; - }; - - partition@70000 { - compatible = "seama"; - label = "firmware"; - reg = <0x070000 0xf80000>; - }; - - art: partition@ff0000 { - label = "art"; - reg = <0xff0000 0x010000>; - read-only; - }; - }; - }; -}; - -&mdio0 { - status = "okay"; - - phy-mask = <0>; - - phy0: ethernet-phy@0 { - reg = <0>; - phy-mode = "sgmii"; - - qca,ar8327-initvals = < - 0x04 0x00080080 /* PORT0 PAD MODE CTRL */ - 0x10 0x81000080 /* POWER_ON_STRIP */ - 0x50 0xcc35cc35 /* LED_CTRL0 */ - 0x54 0xcb37cb37 /* LED_CTRL1 */ - 0x58 0x00000000 /* LED_CTRL2 */ - 0x5c 0x00f3cf00 /* LED_CTRL3 */ - 0x7c 0x0000007e /* PORT0_STATUS */ - >; - }; -}; - -ð0 { - status = "okay"; - - pll-data = <0x03000101 0x00000101 0x00001919>; - - phy-mode = "sgmii"; - phy-handle = <&phy0>; -}; - -&wmac { - status = "okay"; - qca,no-eeprom; -}; diff --git a/target/linux/ath79/dts/qca9563_elecom_wrc-1750ghbk2-i.dts b/target/linux/ath79/dts/qca9563_elecom_wrc-1750ghbk2-i.dts deleted file mode 100644 index 287dee6bb1..0000000000 --- a/target/linux/ath79/dts/qca9563_elecom_wrc-1750ghbk2-i.dts +++ /dev/null @@ -1,56 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-or-later OR MIT -/dts-v1/; - -#include -#include - -#include "qca9563_elecom_wrc-ghbk2-i.dtsi" - -/ { - model = "ELECOM WRC-1750GHBK2-I/C"; - compatible = "elecom,wrc-1750ghbk2-i", "qca,qca9563"; -}; - -&leds { - power: power { - label = "elecom:blue:power"; - gpios = <&gpio 1 GPIO_ACTIVE_HIGH>; - default-state = "on"; - }; - - wlan2g { - label = "elecom:blue:wlan2g"; - gpios = <&gpio 7 GPIO_ACTIVE_HIGH>; - linux,default-trigger = "phy1tpt"; - }; - - wlan5g { - label = "elecom:blue:wlan5g"; - gpios = <&gpio 8 GPIO_ACTIVE_HIGH>; - linux,default-trigger = "phy0tpt"; - }; -}; - -&partitions { - partition@70000 { - compatible = "denx,uimage"; - label = "firmware"; - reg = <0x070000 0xf70000>; - }; - - partition@fe0000 { - label = "hwconfig"; - reg = <0xfe0000 0x010000>; - read-only; - }; - - ART: partition@ff0000 { - label = "ART"; - reg = <0xff0000 0x010000>; - read-only; - }; -}; - -&pcie { - status = "okay"; -}; diff --git a/target/linux/ath79/dts/qca9563_elecom_wrc-300ghbk2-i.dts b/target/linux/ath79/dts/qca9563_elecom_wrc-300ghbk2-i.dts index c823f4a342..778e0fd52e 100644 --- a/target/linux/ath79/dts/qca9563_elecom_wrc-300ghbk2-i.dts +++ b/target/linux/ath79/dts/qca9563_elecom_wrc-300ghbk2-i.dts @@ -38,8 +38,8 @@ read-only; }; - ART: partition@7f0000 { - label = "ART"; + art: partition@7f0000 { + label = "art"; reg = <0x7f0000 0x010000>; read-only; }; diff --git a/target/linux/ath79/dts/qca9563_elecom_wrc-ghbk2-i.dtsi b/target/linux/ath79/dts/qca9563_elecom_wrc-ghbk2-i.dtsi index 8d5bbe180c..2f5c2c4aac 100644 --- a/target/linux/ath79/dts/qca9563_elecom_wrc-ghbk2-i.dtsi +++ b/target/linux/ath79/dts/qca9563_elecom_wrc-ghbk2-i.dtsi @@ -111,7 +111,7 @@ pll-data = <0x03000101 0x00000101 0x00001919>; - mtd-mac-address = <&ART 0x1002>; + mtd-mac-address = <&art 0x1002>; mtd-mac-address-increment = <(-1)>; phy-mode = "sgmii"; phy-handle = <&phy0>; @@ -123,5 +123,5 @@ &wmac { status = "okay"; - mtd-cal-data = <&ART 0x1000>; + mtd-cal-data = <&art 0x1000>; }; diff --git a/target/linux/ath79/dts/qca9563_glinet_gl-ar750s.dts b/target/linux/ath79/dts/qca9563_glinet_gl-ar750s.dts index 439acaae85..0145a24fba 100644 --- a/target/linux/ath79/dts/qca9563_glinet_gl-ar750s.dts +++ b/target/linux/ath79/dts/qca9563_glinet_gl-ar750s.dts @@ -62,6 +62,19 @@ linux,default-trigger = "phy0tpt"; }; }; + + usb_vbus: regulator-usb-vbus { + compatible = "regulator-fixed"; + + regulator-name = "USB_VBUS"; + + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5000000>; + regulator-always-on; + + gpio = <&gpio 7 GPIO_ACTIVE_HIGH>; + enable-active-high; + }; }; &spi { @@ -92,6 +105,7 @@ art: partition@50000 { label = "art"; reg = <0x050000 0x010000>; + read-only; }; partition@60000 { @@ -112,20 +126,22 @@ }; &usb0 { - #address-cells = <1>; - #size-cells = <0>; status = "okay"; - - hub_port: port@1 { - reg = <1>; - #trigger-source-cells = <0>; - }; + vbus-supply = <&usb_vbus>; }; &usb_phy0 { status = "okay"; }; +&usb1 { + status = "okay"; +}; + +&usb_phy1 { + status = "okay"; +}; + &mdio0 { status = "okay"; phy-mask = <0>; diff --git a/target/linux/ath79/dts/qca9563_nec_wg800hp.dts b/target/linux/ath79/dts/qca9563_nec_wg800hp.dts deleted file mode 100644 index 9cba99b6a6..0000000000 --- a/target/linux/ath79/dts/qca9563_nec_wg800hp.dts +++ /dev/null @@ -1,188 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-or-later OR MIT -/dts-v1/; - -#include -#include - -#include "qca956x.dtsi" - -/ { - model = "NEC Aterm WG800HP"; - compatible = "nec,wg800hp", "qca,qca9563"; - - chosen { - bootargs = "console=ttyS0,115200n8"; - }; - - aliases { - led-boot = &power_green; - led-failsafe = &power_red; - led-running = &power_green; - led-upgrade = &power_green; - }; - - leds { - compatible = "gpio-leds"; - pinctrl-names = "default"; - pinctrl-0 = <&jtag_disable_pins>; - - wlan2g_red { - label = "wg800hp:red:wlan2g"; - gpios = <&gpio 6 GPIO_ACTIVE_LOW>; - }; - - active_red { - label = "wg800hp:red:active"; - gpios = <&gpio 7 GPIO_ACTIVE_LOW>; - }; - - active_green { - label = "wg800hp:green:active"; - gpios = <&gpio 8 GPIO_ACTIVE_LOW>; - }; - - power_red: power_red { - label = "wg800hp:red:power"; - gpios = <&gpio 14 GPIO_ACTIVE_LOW>; - }; - - power_green: power_green { - label = "wg800hp:green:power"; - gpios = <&gpio 15 GPIO_ACTIVE_LOW>; - default-state = "on"; - }; - - wlan5g_red { - label = "wg800hp:red:wlan5g"; - gpios = <&gpio 16 GPIO_ACTIVE_HIGH>; - }; - - wlan5g_green { - label = "wg800hp:green:wlan5g"; - gpios = <&gpio 17 GPIO_ACTIVE_HIGH>; - linux,default-trigger = "phy0tpt"; - }; - - wlan2g_green { - label = "wg800hp:green:wlan2g"; - gpios = <&gpio 19 GPIO_ACTIVE_LOW>; - linux,default-trigger = "phy1tpt"; - }; - }; - - keys { - compatible = "gpio-keys"; - - br { - label = "br"; - gpios = <&gpio 1 GPIO_ACTIVE_LOW>; - linux,code = ; - linux,input-type = ; - debounce-interval = <60>; - }; - - reset { - label = "reset"; - gpios = <&gpio 2 GPIO_ACTIVE_LOW>; - linux,code = ; - debounce-interval = <60>; - }; - - wps { - label = "wps"; - gpios = <&gpio 5 GPIO_ACTIVE_LOW>; - linux,code = ; - debounce-interval = <60>; - }; - }; -}; - -&spi { - status = "okay"; - num-cs = <1>; - - flash@0 { - compatible = "jedec,spi-nor"; - reg = <0>; - spi-max-frequency = <25000000>; - - partitions { - compatible = "fixed-partitions"; - #address-cells = <1>; - #size-cells = <1>; - - partition@0 { - label = "u-boot"; - reg = <0x000000 0x040000>; - read-only; - }; - - partition@40000 { - label = "u-boot-env"; - reg = <0x040000 0x010000>; - read-only; - }; - - partition@50000 { - compatible = "denx,uimage"; - label = "firmware"; - reg = <0x050000 0x6f0000>; - }; - - partition@740000 { - label = "user_data"; - reg = <0x740000 0x0a0000>; - read-only; - }; - - partition@7e0000 { - label = "board_data"; - reg = <0x7e0000 0x010000>; - read-only; - }; - - art: partition@7f0000 { - label = "art"; - reg = <0x7f0000 0x010000>; - read-only; - }; - }; - }; -}; - -&mdio0 { - status = "okay"; - - phy0: ethernet-phy@0 { - reg = <0>; - - qca,ar8327-initvals = < - 0x04 0x00000080 /* PORT0 PAD MODE CTRL */ - 0x50 0xcc35cc35 /* LED_CTRL0 */ - 0x54 0xca35ca35 /* LED_CTRL1 */ - 0x58 0xc935c935 /* LED_CTRL2 */ - 0x5c 0x03ffff00 /* LED_CTRL3 */ - 0x7c 0x0000007e /* PORT0_STATUS */ - >; - }; -}; - -ð0 { - status = "okay"; - - phy-mode = "sgmii"; - phy-handle = <&phy0>; -}; - -&pcie { - status = "okay"; -}; - -&uart { - status = "okay"; -}; - -&wmac { - status = "okay"; - qca,no-eeprom; -}; diff --git a/target/linux/ath79/dts/qca9563_phicomm_k2t.dts b/target/linux/ath79/dts/qca9563_phicomm_k2t.dts deleted file mode 100644 index d819a76fd2..0000000000 --- a/target/linux/ath79/dts/qca9563_phicomm_k2t.dts +++ /dev/null @@ -1,148 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-or-later OR MIT -/dts-v1/; - -#include -#include - -#include "qca956x.dtsi" - -/ { - model = "Phicomm K2T"; - compatible = "phicomm,k2t", "qca,qca9563"; - - aliases { - led-boot = &status_red; - led-failsafe = &status_red; - led-running = &status_red; - led-upgrade = &status_red; - }; - - chosen { - bootargs = "console=ttyS0,115200n8"; - }; - - leds { - compatible = "gpio-leds"; - - status_blue { - label = "phicomm:blue:status"; - gpios = <&gpio 6 GPIO_ACTIVE_LOW>; - }; - - status_red: status_red { - label = "phicomm:red:status"; - gpios = <&gpio 7 GPIO_ACTIVE_HIGH>; - }; - - status_yellow { - label = "phicomm:yellow:status"; - gpios = <&gpio 8 GPIO_ACTIVE_LOW>; - }; - }; - - keys { - compatible = "gpio-keys-polled"; - poll-interval = <20>; - - reset { - linux,code = ; - gpios = <&gpio 2 GPIO_ACTIVE_LOW>; - debounce-interval = <60>; - }; - }; -}; - -&uart { - status = "okay"; -}; - -&gpio { - status = "okay"; -}; - -&pcie { - status = "okay"; -}; - -&spi { - num-cs = <1>; - - status = "okay"; - - flash@0 { - compatible = "jedec,spi-nor"; - reg = <0>; - spi-max-frequency = <25000000>; - - partitions { - compatible = "fixed-partitions"; - #address-cells = <1>; - #size-cells = <1>; - - partition@0 { - label = "u-boot"; - reg = <0x000000 0x30000>; - read-only; - }; - - partition@30000 { - label = "config"; - reg = <0x030000 0x10000>; - read-only; - }; - - partition@40000 { - label = "permanent"; - reg = <0x040000 0x50000>; - read-only; - }; - - partition@90000 { - compatible = "denx,uimage"; - label = "firmware"; - reg = <0x090000 0xf60000>; - }; - - art: partition@ff0000 { - label = "art"; - reg = <0xff0000 0x010000>; - read-only; - }; - }; - }; -}; - -&mdio0 { - status = "okay"; - - phy-mask = <0>; - - phy0: ethernet-phy@0 { - reg = <0>; - phy-mode = "sgmii"; - - qca,ar8327-initvals = < - 0x04 0x00080080 /* PORT0 PAD MODE CTRL */ - 0x10 0x81000080 /* POWER_ON_STRIP */ - 0x50 0xcc35cc35 /* LED_CTRL0 */ - 0x54 0xcb37cb37 /* LED_CTRL1 */ - 0x58 0x00000000 /* LED_CTRL2 */ - 0x5c 0x00f3cf00 /* LED_CTRL3 */ - 0x7c 0x0000007e /* PORT0_STATUS */ - >; - }; -}; - -ð0 { - status = "okay"; - - pll-data = <0x03000101 0x00000101 0x00001919>; - - phy-mode = "sgmii"; - phy-handle = <&phy0>; -}; - -&wmac { - status = "okay"; - mtd-cal-data = <&art 0x1000>; -}; diff --git a/target/linux/ath79/dts/qca9563_rosinson_wr818.dts b/target/linux/ath79/dts/qca9563_rosinson_wr818.dts index cf0ec1bfa1..faa8105e8c 100644 --- a/target/linux/ath79/dts/qca9563_rosinson_wr818.dts +++ b/target/linux/ath79/dts/qca9563_rosinson_wr818.dts @@ -8,7 +8,7 @@ / { model = "ROSINSON WR818"; - compatible = "rosinson,wr818", "qca,qca9560"; + compatible = "rosinson,wr818", "qca,qca9563"; chosen { bootargs = "console=ttyS0,115200n8"; diff --git a/target/linux/ath79/dts/qca9563_tplink_archer-a7-v5.dts b/target/linux/ath79/dts/qca9563_tplink_archer-a7-v5.dts deleted file mode 100644 index 8cf86c0bc4..0000000000 --- a/target/linux/ath79/dts/qca9563_tplink_archer-a7-v5.dts +++ /dev/null @@ -1,50 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-or-later OR MIT -/dts-v1/; - -#include "qca9563_tplink_archer-x7-v5.dtsi" - -/ { - compatible = "tplink,archer-a7-v5", "qca,qca9563"; - model = "TP-Link Archer A7 v5"; -}; - -&mtdparts { - factory-uboot@0 { - label = "factory-uboot"; - reg = <0x000000 0x020000>; - read-only; - }; - - uboot: u-boot@20000 { - label = "u-boot"; - reg = <0x020000 0x020000>; - read-only; - }; - - firmware@40000 { - label = "firmware"; - reg = <0x040000 0xec0000>; - compatible = "denx,uimage"; - }; - - info: info@f40000 { - label = "info"; - reg = <0xf40000 0x020000>; - }; - - config: config@f60000 { - label = "config"; - reg = <0xf60000 0x050000>; - }; - - partition@fc0000 { - label = "partition-table"; - reg = <0xfc0000 0x010000>; - }; - - art: art@ff0000 { - label = "art"; - reg = <0xff0000 0x010000>; - read-only; - }; -}; diff --git a/target/linux/ath79/dts/qca9563_tplink_archer-c2-v3.dts b/target/linux/ath79/dts/qca9563_tplink_archer-c2-v3.dts deleted file mode 100644 index c106a63eb8..0000000000 --- a/target/linux/ath79/dts/qca9563_tplink_archer-c2-v3.dts +++ /dev/null @@ -1,185 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-or-later OR MIT -/dts-v1/; - -#include -#include - -#include "qca956x.dtsi" - -/ { - compatible = "tplink,archer-c2-v3", "qca,qca9563"; - model = "TP-Link Archer C2 v3"; - - chosen { - bootargs = "console=ttyS0,115200n8"; - }; - - aliases { - led-boot = &system; - led-failsafe = &system; - led-running = &system; - led-upgrade = &system; - }; - - gpio_leds: leds { - compatible = "gpio-leds"; - - system: system { - label = "tp-link:green:system"; - gpios = <&gpio 6 GPIO_ACTIVE_LOW>; - default-state = "on"; - }; - - wifi2g { - label = "tp-link:green:wifi2g"; - gpios = <&gpio 8 GPIO_ACTIVE_LOW>; - linux,default-trigger = "phy1tpt"; - }; - - wifi5g { - label = "tp-link:green:wifi5g"; - gpios = <&gpio 7 GPIO_ACTIVE_LOW>; - linux,default-trigger = "phy0tpt"; - }; - - wifi_wps { - label = "tp-link:green:wps"; - gpios = <&gpio 1 GPIO_ACTIVE_LOW>; - }; - - wan { - label = "tp-link:green:wan"; - gpios = <&gpio 16 GPIO_ACTIVE_LOW>; - }; - - wan_fail { - label = "tp-link:orange:wan"; - gpios = <&gpio 15 GPIO_ACTIVE_LOW>; - }; - - lan1 { - label = "tp-link:green:lan1"; - gpios = <&gpio 9 GPIO_ACTIVE_LOW>; - }; - - lan2 { - label = "tp-link:green:lan2"; - gpios = <&gpio 11 GPIO_ACTIVE_LOW>; - }; - - lan3 { - label = "tp-link:green:lan3"; - gpios = <&gpio 14 GPIO_ACTIVE_LOW>; - }; - - lan4 { - label = "tp-link:green:lan4"; - gpios = <&gpio 21 GPIO_ACTIVE_LOW>; - }; - }; - - keys { - compatible = "gpio-keys"; - - reset { - label = "Reset button"; - linux,code = ; - gpios = <&gpio 2 GPIO_ACTIVE_LOW>; - debounce-interval = <60>; - }; - - wps { - label = "WPS button"; - linux,code = ; - gpios = <&gpio 5 GPIO_ACTIVE_LOW>; - debounce-interval = <60>; - }; - }; -}; - -&uart { - status = "okay"; -}; - -&spi { - status = "okay"; - num-cs = <1>; - - flash@0 { - compatible = "jedec,spi-nor"; - reg = <0>; - spi-max-frequency = <25000000>; - - partitions { - compatible = "fixed-partitions"; - #address-cells = <1>; - #size-cells = <1>; - - partition@0 { - label = "factory-uboot"; - reg = <0x000000 0x020000>; - read-only; - }; - - partition@20000 { - label = "uboot"; - reg = <0x020000 0x10000>; - }; - - partition@30000 { - label = "firmware"; - reg = <0x030000 0x7A0000>; - compatible = "denx,uimage"; - }; - - info: partition@7e0000 { - label = "product-info"; - reg = <0x7e0000 0x010000>; - read-only; - }; - - art: partition@7f0000 { - label = "ART"; - reg = <0x7f0000 0x010000>; - read-only; - }; - }; - }; -}; - -&gpio { - status = "okay"; -}; - -&mdio0 { - status = "okay"; - - phy-mask = <0>; - phy0: ethernet-phy@0 { - reg = <0>; - phy-mode = "sgmii"; - - qca,ar8327-initvals = < - 0x04 0x00080080 /* PORT0 PAD MODE CTRL */ - 0x7c 0x0000007e /* PORT0_STATUS */ - >; - }; -}; - -&pcie { - status = "okay"; -}; - -ð0 { - status = "okay"; - - mtd-mac-address = <&info 0x8>; - phy-mode = "sgmii"; - phy-handle = <&phy0>; -}; - -&wmac { - status = "okay"; - mtd-cal-data = <&art 0x1000>; - mtd-mac-address = <&info 0x8>; -}; diff --git a/target/linux/ath79/dts/qca9563_tplink_archer-c6-v2.dts b/target/linux/ath79/dts/qca9563_tplink_archer-c6-v2.dts deleted file mode 100644 index 5caec6fab1..0000000000 --- a/target/linux/ath79/dts/qca9563_tplink_archer-c6-v2.dts +++ /dev/null @@ -1,9 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-or-later OR MIT -/dts-v1/; - -#include "qca9563_tplink_archer-x6-v2.dtsi" - -/ { - compatible = "tplink,archer-c6-v2", "qca,qca9563"; - model = "TP-Link Archer C6 v2"; -}; diff --git a/target/linux/ath79/dts/qca9563_tplink_archer-c7-v4.dts b/target/linux/ath79/dts/qca9563_tplink_archer-c7-v4.dts deleted file mode 100644 index db8869cf16..0000000000 --- a/target/linux/ath79/dts/qca9563_tplink_archer-c7-v4.dts +++ /dev/null @@ -1,271 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-or-later OR MIT -/dts-v1/; - -#include -#include - -#include "qca956x.dtsi" - -/ { - compatible = "tplink,archer-c7-v4", "qca,qca9563"; - model = "TP-Link Archer C7 v4"; - - chosen { - bootargs = "console=ttyS0,115200n8"; - }; - - aliases { - led-boot = &system; - led-failsafe = &system; - led-running = &system; - led-upgrade = &system; - }; - - led_spi { - compatible = "spi-gpio"; - #address-cells = <1>; - #size-cells = <0>; - - gpio-sck = <&gpio 15 GPIO_ACTIVE_HIGH>; // 74HC595 SRCLK (Serial Clock) - gpio-mosi = <&gpio 14 GPIO_ACTIVE_HIGH>; // 74HC595 SER (Serial) - cs-gpios = <&gpio 16 GPIO_ACTIVE_HIGH>; // 74HC595 RCLK (Register Clock) - num-chipselects = <1>; - - led_gpio: led_gpio@0 { - compatible = "fairchild,74hc595"; - reg = <0>; - gpio-controller; - #gpio-cells = <2>; - registers-number = <1>; - spi-max-frequency = <10000000>; - }; - }; - - gpio-export { - compatible = "gpio-export"; - - gpio_shift_register_oe { - gpio-export,name = "tp-link:oe:sr"; - gpio-export,output = <0>; - gpios = <&gpio 1 GPIO_ACTIVE_LOW>; // 74HC595 /OE (Output Enable) - }; - - gpio_shift_register_reset { - gpio-export,name = "tp-link:reset:sr"; - gpio-export,output = <1>; - gpios = <&gpio 21 GPIO_ACTIVE_LOW>; // 74HC595 /SRCLR (Serial Clear) - }; - }; - - leds { - compatible = "gpio-leds"; - - system: system { - label = "tp-link:green:system"; - gpios = <&gpio 6 GPIO_ACTIVE_LOW>; - default-state = "on"; - }; - - usb1 { - label = "tp-link:green:usb1"; - gpios = <&gpio 8 GPIO_ACTIVE_LOW>; - trigger-sources = <&hub_port1>; - linux,default-trigger = "usbport"; - }; - - usb2 { - label = "tp-link:green:usb2"; - gpios = <&gpio 7 GPIO_ACTIVE_LOW>; - trigger-sources = <&hub_port0>; - linux,default-trigger = "usbport"; - }; - - wlan5g { - label = "tp-link:green:wlan5g"; - gpios = <&gpio 9 GPIO_ACTIVE_LOW>; - linux,default-trigger = "phy0tpt"; - }; - - wlan2g { - label = "tp-link:green:wlan2g"; - gpios = <&led_gpio 7 GPIO_ACTIVE_LOW>; - linux,default-trigger = "phy1tpt"; - }; - - wan { - label = "tp-link:green:wan"; - gpios = <&led_gpio 5 GPIO_ACTIVE_LOW>; - }; - - wan_fail { - label = "tp-link:orange:wan"; - gpios = <&led_gpio 6 GPIO_ACTIVE_LOW>; - }; - - lan1 { - label = "tp-link:green:lan1"; - gpios = <&led_gpio 4 GPIO_ACTIVE_LOW>; - }; - - lan2 { - label = "tp-link:green:lan2"; - gpios = <&led_gpio 3 GPIO_ACTIVE_LOW>; - }; - - lan3 { - label = "tp-link:green:lan3"; - gpios = <&led_gpio 2 GPIO_ACTIVE_LOW>; - }; - - lan4 { - label = "tp-link:green:lan4"; - gpios = <&led_gpio 1 GPIO_ACTIVE_LOW>; - }; - - wps { - label = "tp-link:green:wps"; - gpios = <&led_gpio 0 GPIO_ACTIVE_LOW>; - }; - }; - - keys { - compatible = "gpio-keys"; - - reset { - label = "Reset button"; - linux,code = ; - gpios = <&gpio 5 GPIO_ACTIVE_LOW>; - debounce-interval = <60>; - }; - - wps { - label = "WPS button"; - linux,code = ; - gpios = <&gpio 2 GPIO_ACTIVE_LOW>; - debounce-interval = <60>; - }; - }; - -}; - -&pcie { - status = "okay"; -}; - -&uart { - status = "okay"; -}; - -&gpio { - status = "okay"; -}; - -&usb_phy0 { - status = "okay"; -}; - -&usb0 { - #address-cells = <1>; - #size-cells = <0>; - status = "okay"; - - hub_port0: port@1 { - reg = <1>; - #trigger-source-cells = <0>; - }; -}; - -&usb_phy1 { - status = "okay"; -}; - -&usb1 { - #address-cells = <1>; - #size-cells = <0>; - status = "okay"; - - hub_port1: port@1 { - reg = <1>; - #trigger-source-cells = <0>; - }; -}; - -&spi { - status = "okay"; - num-cs = <1>; - - flash@0 { - compatible = "jedec,spi-nor"; - reg = <0>; - spi-max-frequency = <25000000>; - - partitions { - compatible = "fixed-partitions"; - #address-cells = <1>; - #size-cells = <1>; - - partition@0 { - label = "factory-uboot"; - reg = <0x000000 0x020000>; - read-only; - }; - - partition@20000 { - label = "u-boot"; - reg = <0x020000 0x020000>; - read-only; - }; - - partition@40000 { - label = "firmware"; - reg = <0x040000 0xec0000>; - compatible = "denx,uimage"; - }; - - info: partition@f00000 { - label = "config"; - reg = <0xf00000 0x0f0000>; - read-only; - }; - - art: partition@ff0000 { - label = "art"; - reg = <0xff0000 0x010000>; - read-only; - }; - }; - }; -}; - -&mdio0 { - status = "okay"; - - phy-mask = <0>; - - phy0: ethernet-phy@0 { - reg = <0>; - phy-mode = "sgmii"; - - qca,ar8327-initvals = < - 0x04 0x80080080 /* PORT0 PAD MODE CTRL */ - 0x7c 0x0000007e /* PORT0_STATUS */ - 0x94 0x00000200 /* PORT6_STATUS */ - >; - }; -}; - -ð0 { - status = "okay"; - - pll-data = <0x03000101 0x00000101 0x00001919>; - - phy-mode = "sgmii"; - mtd-mac-address = <&info 0x8>; - phy-handle = <&phy0>; -}; - -&wmac { - status = "okay"; - mtd-cal-data = <&art 0x1000>; - mtd-mac-address = <&info 0x8>; -}; diff --git a/target/linux/ath79/dts/qca9563_tplink_archer-c7-v5.dts b/target/linux/ath79/dts/qca9563_tplink_archer-c7-v5.dts deleted file mode 100644 index 026d6c65e3..0000000000 --- a/target/linux/ath79/dts/qca9563_tplink_archer-c7-v5.dts +++ /dev/null @@ -1,55 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-or-later OR MIT -/dts-v1/; - -#include "qca9563_tplink_archer-x7-v5.dtsi" - -/ { - compatible = "tplink,archer-c7-v5", "qca,qca9563"; - model = "TP-Link Archer C7 v5"; -}; - -&mtdparts { - partition@0 { - label = "factory-uboot"; - reg = <0x000000 0x020000>; - read-only; - }; - - partition@20000 { - label = "u-boot"; - reg = <0x020000 0x020000>; - read-only; - }; - - partition@40000 { - label = "partition-table"; - reg = <0x040000 0x010000>; - }; - - art: partition@50000 { - label = "art"; - reg = <0x050000 0x010000>; - read-only; - }; - - info: partition@60000 { - label = "info"; - reg = <0x060000 0x020000>; - }; - - partition@80000 { - label = "user-config"; - reg = <0x080000 0x040000>; - }; - - partition@c0000 { - label = "firmware"; - reg = <0x0c0000 0xf00000>; - compatible = "denx,uimage"; - }; - - partition@ff0000 { - label = "default-config"; - reg = <0xff0000 0x010000>; - }; -}; diff --git a/target/linux/ath79/dts/qca9563_tplink_archer-x6-v2.dtsi b/target/linux/ath79/dts/qca9563_tplink_archer-x6-v2.dtsi index 37ab16453b..ac10d9134a 100644 --- a/target/linux/ath79/dts/qca9563_tplink_archer-x6-v2.dtsi +++ b/target/linux/ath79/dts/qca9563_tplink_archer-x6-v2.dtsi @@ -146,6 +146,7 @@ phy0: ethernet-phy@0 { reg = <0>; phy-mode = "sgmii"; + qca,mib-poll-interval = <500>; qca,ar8327-initvals = < 0x04 0x00080080 /* PORT0 PAD MODE CTRL */ diff --git a/target/linux/ath79/dts/qca9563_tplink_archer-x7-v5.dtsi b/target/linux/ath79/dts/qca9563_tplink_archer-x7-v5.dtsi index afb33d6471..324d831249 100644 --- a/target/linux/ath79/dts/qca9563_tplink_archer-x7-v5.dtsi +++ b/target/linux/ath79/dts/qca9563_tplink_archer-x7-v5.dtsi @@ -12,7 +12,10 @@ }; aliases { - led-status = &system; + led-boot = &system; + led-failsafe = &system; + led-running = &system; + led-upgrade = &system; }; gpio_leds: leds { @@ -24,30 +27,64 @@ default-state = "on"; }; + usb { + label = "tp-link:green:usb"; + gpios = <&gpio 7 GPIO_ACTIVE_LOW>; + trigger-sources = <&hub_port0>; + linux,default-trigger = "usbport"; + }; + + wlan5g { + label = "tp-link:green:wlan5g"; + gpios = <&gpio 9 GPIO_ACTIVE_LOW>; + linux,default-trigger = "phy0tpt"; + }; + led_wlan2g: wlan2g { label = "tp-link:green:wlan2g"; gpios = <&gpio 14 GPIO_ACTIVE_LOW>; linux,default-trigger = "phy1tpt"; }; - usb { - label = "tp-link:green:usb"; - gpios = <&gpio 7 GPIO_ACTIVE_LOW>; - trigger-sources = <&hub_port0>; - linux,default-trigger = "usbport"; + wan { + label = "tp-link:green:wan"; + gpios = <&gpio 21 GPIO_ACTIVE_LOW>; + }; + + wan_fail { + label = "tp-link:orange:wan"; + gpios = <&gpio 20 GPIO_ACTIVE_LOW>; + }; + + lan1 { + label = "tp-link:green:lan1"; + gpios = <&gpio 8 GPIO_ACTIVE_LOW>; + }; + + lan2 { + label = "tp-link:green:lan2"; + gpios = <&gpio 17 GPIO_ACTIVE_LOW>; + }; + + lan3 { + label = "tp-link:green:lan3"; + gpios = <&gpio 16 GPIO_ACTIVE_LOW>; + }; + + lan4 { + label = "tp-link:green:lan4"; + gpios = <&gpio 15 GPIO_ACTIVE_LOW>; + }; + + wps { + label = "tp-link:green:wps"; + gpios = <&gpio 1 GPIO_ACTIVE_LOW>; }; }; gpio_keys: keys { compatible = "gpio-keys"; - reset { - label = "Reset button"; - linux,code = ; - gpios = <&gpio 11 GPIO_ACTIVE_LOW>; - debounce-interval = <60>; - }; - wps { label = "WPS button"; linux,code = ; @@ -94,49 +131,6 @@ }; }; -&gpio_leds { - wlan5g { - label = "tp-link:green:wlan5g"; - gpios = <&gpio 9 GPIO_ACTIVE_LOW>; - linux,default-trigger = "phy0tpt"; - }; - - wan { - label = "tp-link:green:wan"; - gpios = <&gpio 21 GPIO_ACTIVE_LOW>; - }; - - wan_fail { - label = "tp-link:orange:wan"; - gpios = <&gpio 20 GPIO_ACTIVE_LOW>; - }; - - lan1 { - label = "tp-link:green:lan1"; - gpios = <&gpio 8 GPIO_ACTIVE_LOW>; - }; - - lan2 { - label = "tp-link:green:lan2"; - gpios = <&gpio 17 GPIO_ACTIVE_LOW>; - }; - - lan3 { - label = "tp-link:green:lan3"; - gpios = <&gpio 16 GPIO_ACTIVE_LOW>; - }; - - lan4 { - label = "tp-link:green:lan4"; - gpios = <&gpio 15 GPIO_ACTIVE_LOW>; - }; - - wps { - label = "tp-link:green:wps"; - gpios = <&gpio 1 GPIO_ACTIVE_LOW>; - }; -}; - &spi { status = "okay"; num-cs = <1>; @@ -162,15 +156,15 @@ phy0: ethernet-phy@0 { reg = <0>; phy-mode = "sgmii"; + qca,mib-poll-interval = <500>; qca,ar8327-initvals = < - 0x04 0x00080080 /* PORT0 PAD MODE CTRL */ - 0x10 0x81000080 /* POWER_ON_STRIP */ - 0x50 0xcc35cc35 /* LED_CTRL0 */ - 0x54 0xcb37cb37 /* LED_CTRL1 */ - 0x58 0x00000000 /* LED_CTRL2 */ - 0x5c 0x00f3cf00 /* LED_CTRL3 */ + 0x04 0x80080080 /* PORT0 PAD MODE CTRL */ + 0x08 0x00000000 /* PORT5 PAD MODE CTRL */ + 0x0c 0x00000000 /* PORT6 PAD MODE CTRL */ + 0x10 0x00000080 /* POWER_ON_STRIP */ 0x7c 0x0000007e /* PORT0_STATUS */ + 0x94 0x00000200 /* PORT6_STATUS */ >; }; }; diff --git a/target/linux/ath79/dts/qca9563_tplink_re450-v2.dts b/target/linux/ath79/dts/qca9563_tplink_re450-v2.dts deleted file mode 100644 index ad55a55e56..0000000000 --- a/target/linux/ath79/dts/qca9563_tplink_re450-v2.dts +++ /dev/null @@ -1,189 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-or-later OR MIT -/dts-v1/; - -#include -#include - -#include "qca956x.dtsi" - -/ { - compatible = "tplink,re450-v2", "qca,qca9563"; - model = "TP-Link RE450 v2"; - - chosen { - bootargs = "console=ttyS0,115200n8"; - }; - - aliases { - led-boot = &system; - led-failsafe = &system; - led-running = &system; - led-upgrade = &system; - mdio-gpio0 = &mdio2; - }; - - leds { - compatible = "gpio-leds"; - - system: power { - label = "tp-link:blue:power"; - gpios = <&gpio 1 GPIO_ACTIVE_LOW>; - }; - - wlan2g { - label = "tp-link:blue:wlan2g"; - gpios = <&gpio 14 GPIO_ACTIVE_LOW>; - linux,default-trigger = "phy1tpt"; - }; - - wlan5g { - label = "tp-link:blue:wlan5g"; - gpios = <&gpio 5 GPIO_ACTIVE_LOW>; - linux,default-trigger = "phy0tpt"; - }; - - lan_link { - label = "tp-link:green:lan_link"; - gpios = <&gpio 8 GPIO_ACTIVE_LOW>; - }; - - lan_data { - label = "tp-link:green:lan_data"; - gpios = <&gpio 9 GPIO_ACTIVE_LOW>; - }; - - wps_blue { - label = "tp-link:blue:wps"; - gpios = <&gpio 17 GPIO_ACTIVE_HIGH>; - }; - - wps_red { - label = "tp-link:red:wps"; - gpios = <&gpio 20 GPIO_ACTIVE_HIGH>; - }; - }; - - keys { - compatible = "gpio-keys"; - - reset { - label = "Reset button"; - linux,code = ; - gpios = <&gpio 6 GPIO_ACTIVE_LOW>; - debounce-interval = <60>; - }; - - power { - label = "Power button"; - linux,code = ; - gpios = <&gpio 2 GPIO_ACTIVE_LOW>; - debounce-interval = <60>; - }; - - leds { - label = "LED control button"; - linux,code = ; - gpios = <&gpio 7 GPIO_ACTIVE_LOW>; - debounce-interval = <60>; - }; - - wps { - label = "WPS button"; - linux,code = ; - gpios = <&gpio 19 GPIO_ACTIVE_LOW>; - debounce-interval = <60>; - }; - }; - - mdio2: mdio { - compatible = "virtual,mdio-gpio"; - - gpios = <&gpio 3 GPIO_ACTIVE_HIGH>, /* MDC */ - <&gpio 4 GPIO_ACTIVE_HIGH>; /* MDIO */ - #address-cells = <1>; - #size-cells = <0>; - - phy0: ethernet-phy@4 { - reg = <4>; - device_type = "ethernet-phy"; - reset-gpios = <&gpio 11 GPIO_ACTIVE_LOW>; - }; - }; -}; - -&pcie { - status = "okay"; -}; - -&uart { - status = "okay"; -}; - -&gpio { - status = "okay"; -}; - -&spi { - status = "okay"; - num-cs = <1>; - - flash@0 { - compatible = "jedec,spi-nor"; - reg = <0>; - spi-max-frequency = <25000000>; - - partitions { - compatible = "fixed-partitions"; - #address-cells = <1>; - #size-cells = <1>; - - partition@0 { - label = "u-boot"; - reg = <0x000000 0x020000>; - read-only; - }; - - partition@20000 { - compatible = "tplink,firmware"; - label = "firmware"; - reg = <0x020000 0x5e0000>; - }; - - partition@600000 { - label = "partition-table"; - reg = <0x600000 0x010000>; - read-only; - }; - - info: partition@610000 { - label = "product-info"; - reg = <0x610000 0x020000>; - read-only; - }; - - partition@630000 { - label = "config"; - reg = <0x630000 0x020000>; - read-only; - }; - - art: partition@7f0000 { - label = "art"; - reg = <0x7f0000 0x010000>; - read-only; - }; - }; - }; -}; - -ð0 { - status = "okay"; - mtd-mac-address = <&info 0x8>; - phy-handle = <&phy0>; -}; - -&wmac { - status = "okay"; - mtd-cal-data = <&art 0x1000>; - mtd-mac-address = <&info 0x8>; -}; diff --git a/target/linux/ath79/dts/qca9563_tplink_tl-wr1043n-v5.dts b/target/linux/ath79/dts/qca9563_tplink_tl-wr1043n-v5.dts new file mode 100644 index 0000000000..b4c7e9b45f --- /dev/null +++ b/target/linux/ath79/dts/qca9563_tplink_tl-wr1043n-v5.dts @@ -0,0 +1,74 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT +/dts-v1/; + +#include "qca9563_tplink_tl-wr1043n.dtsi" + +/ { + compatible = "tplink,tl-wr1043n-v5", "qca,qca9563"; + model = "TP-Link TL-WR1043N v5"; +}; + +&spi { + status = "okay"; + num-cs = <1>; + + flash@0 { + compatible = "jedec,spi-nor"; + reg = <0>; + spi-max-frequency = <25000000>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "factory-uboot"; + reg = <0x000000 0x020000>; + read-only; + }; + + partition@20000 { + label = "u-boot"; + reg = <0x020000 0x020000>; + read-only; + }; + + partition@40000 { + compatible = "denx,uimage"; + label = "firmware"; + reg = <0x040000 0xec0000>; + }; + + info: partition@f00000 { + label = "info"; + reg = <0xf00000 0x020000>; + read-only; + }; + + partition@f20000 { + label = "config"; + reg = <0xf20000 0x0a0000>; + read-only; + }; + + partition@fc0000 { + label = "partition-table"; + reg = <0xfc0000 0x010000>; + read-only; + }; + + partition@fd0000 { + label = "logs"; + reg = <0xfd0000 0x020000>; + read-only; + }; + + art: partition@ff0000 { + label = "art"; + reg = <0xff0000 0x010000>; + read-only; + }; + }; + }; +}; diff --git a/target/linux/ath79/dts/qca9563_tplink_tl-wr1043n.dtsi b/target/linux/ath79/dts/qca9563_tplink_tl-wr1043n.dtsi index fc23ee1dd8..42b4b6b8c6 100644 --- a/target/linux/ath79/dts/qca9563_tplink_tl-wr1043n.dtsi +++ b/target/linux/ath79/dts/qca9563_tplink_tl-wr1043n.dtsi @@ -86,17 +86,6 @@ debounce-interval = <60>; }; }; - - gpio-export { - compatible = "gpio-export"; - #size-cells = <0>; - - gpio_usb_power { - gpio-export,name = "tp-link:power:usb"; - gpio-export,output = <1>; - gpios = <&gpio 8 GPIO_ACTIVE_HIGH>; - }; - }; }; &uart { @@ -107,65 +96,6 @@ status = "okay"; }; -&spi { - status = "okay"; - num-cs = <1>; - - flash@0 { - compatible = "jedec,spi-nor"; - reg = <0>; - spi-max-frequency = <25000000>; - - partitions { - compatible = "fixed-partitions"; - #address-cells = <1>; - #size-cells = <1>; - - partition@0 { - label = "u-boot"; - reg = <0x000000 0x020000>; - read-only; - }; - - partition@20000 { - compatible = "tplink,firmware"; - label = "firmware"; - reg = <0x020000 0xf30000>; - }; - - info: partition@f50000 { - label = "product-info"; - reg = <0xf50000 0x020000>; - read-only; - }; - - partition@f70000 { - label = "config"; - reg = <0xf70000 0x050000>; - read-only; - }; - - partition@fc0000 { - label = "partition-table"; - reg = <0xfc0000 0x010000>; - read-only; - }; - - partition@fd0000 { - label = "logs"; - reg = <0xfd0000 0x020000>; - read-only; - }; - - art: partition@ff0000 { - label = "ART"; - reg = <0xff0000 0x010000>; - read-only; - }; - }; - }; -}; - &mdio0 { status = "okay"; @@ -173,6 +103,7 @@ phy0: ethernet-phy@0 { reg = <0>; phy-mode = "sgmii"; + qca,mib-poll-interval = <500>; qca,ar8327-initvals = < 0x04 0x00080080 /* PORT0 PAD MODE CTRL */ diff --git a/target/linux/ath79/dts/qca9563_tplink_tl-wr1043nd-v4.dts b/target/linux/ath79/dts/qca9563_tplink_tl-wr1043nd-v4.dts index e51bb7f834..07a7409886 100644 --- a/target/linux/ath79/dts/qca9563_tplink_tl-wr1043nd-v4.dts +++ b/target/linux/ath79/dts/qca9563_tplink_tl-wr1043nd-v4.dts @@ -1,14 +1,81 @@ // SPDX-License-Identifier: GPL-2.0-or-later OR MIT /dts-v1/; -#include -#include - #include "qca9563_tplink_tl-wr1043n.dtsi" / { compatible = "tplink,tl-wr1043nd-v4", "qca,qca9563"; model = "TP-Link TL-WR1043ND v4"; + + gpio-export { + compatible = "gpio-export"; + #size-cells = <0>; + + gpio_usb_power { + gpio-export,name = "tp-link:power:usb"; + gpio-export,output = <1>; + gpios = <&gpio 8 GPIO_ACTIVE_HIGH>; + }; + }; +}; + +&spi { + status = "okay"; + num-cs = <1>; + + flash@0 { + compatible = "jedec,spi-nor"; + reg = <0>; + spi-max-frequency = <25000000>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "u-boot"; + reg = <0x000000 0x020000>; + read-only; + }; + + partition@20000 { + compatible = "tplink,firmware"; + label = "firmware"; + reg = <0x020000 0xf30000>; + }; + + info: partition@f50000 { + label = "info"; + reg = <0xf50000 0x020000>; + read-only; + }; + + partition@f70000 { + label = "config"; + reg = <0xf70000 0x050000>; + read-only; + }; + + partition@fc0000 { + label = "partition-table"; + reg = <0xfc0000 0x010000>; + read-only; + }; + + partition@fd0000 { + label = "logs"; + reg = <0xfd0000 0x020000>; + read-only; + }; + + art: partition@ff0000 { + label = "art"; + reg = <0xff0000 0x010000>; + read-only; + }; + }; + }; }; &gpio_leds { diff --git a/target/linux/ath79/dts/qca956x.dtsi b/target/linux/ath79/dts/qca956x.dtsi index b6f7dcaff3..01098fdc8a 100644 --- a/target/linux/ath79/dts/qca956x.dtsi +++ b/target/linux/ath79/dts/qca956x.dtsi @@ -257,7 +257,7 @@ }; ð0 { - compatible = "qca,qca9560-eth", "syscon", "simple-mfd"; + compatible = "qca,qca9560-eth", "syscon"; pll-data = <0x03000000 0x00000101 0x00001919>; pll-reg = <0 0x48 0>; @@ -274,12 +274,13 @@ builtin-switch; builtin_switch: switch0@1f { - compatible = "qca,ar8229-builtin"; + compatible = "qca,ar8229"; reg = <0x1f>; resets = <&rst 8>; reset-names = "switch"; phy-mode = "gmii"; - phy4-mii-enable; + qca,phy4-mii-enable; + qca,mib-poll-interval = <500>; mdio-bus { #address-cells = <1>; @@ -299,7 +300,7 @@ }; ð1 { - compatible = "qca,qca9560-eth", "syscon", "simple-mfd"; + compatible = "qca,qca9560-eth", "syscon"; phy-mode = "gmii"; diff --git a/target/linux/ath79/files/drivers/net/ethernet/atheros/ag71xx/Makefile b/target/linux/ath79/files/drivers/net/ethernet/atheros/ag71xx/Makefile index 480dbb62c0..87add0d208 100644 --- a/target/linux/ath79/files/drivers/net/ethernet/atheros/ag71xx/Makefile +++ b/target/linux/ath79/files/drivers/net/ethernet/atheros/ag71xx/Makefile @@ -9,6 +9,5 @@ ag71xx-y += ag71xx_phy.o ag71xx-$(CONFIG_AG71XX_DEBUG_FS) += ag71xx_debugfs.o -obj-$(CONFIG_AG71XX) += ag71xx_ar7240.o obj-$(CONFIG_AG71XX) += ag71xx_mdio.o obj-$(CONFIG_AG71XX) += ag71xx.o diff --git a/target/linux/ath79/files/drivers/net/ethernet/atheros/ag71xx/ag71xx.h b/target/linux/ath79/files/drivers/net/ethernet/atheros/ag71xx/ag71xx.h index 9aac1998a8..fde9db3745 100644 --- a/target/linux/ath79/files/drivers/net/ethernet/atheros/ag71xx/ag71xx.h +++ b/target/linux/ath79/files/drivers/net/ethernet/atheros/ag71xx/ag71xx.h @@ -188,6 +188,7 @@ struct ag71xx { struct timer_list oom_timer; struct reset_control *mac_reset; + struct reset_control *mdio_reset; u32 fifodata[3]; u32 plldata[3]; diff --git a/target/linux/ath79/files/drivers/net/ethernet/atheros/ag71xx/ag71xx_ar7240.c b/target/linux/ath79/files/drivers/net/ethernet/atheros/ag71xx/ag71xx_ar7240.c deleted file mode 100644 index 77f7670c2b..0000000000 --- a/target/linux/ath79/files/drivers/net/ethernet/atheros/ag71xx/ag71xx_ar7240.c +++ /dev/null @@ -1,1344 +0,0 @@ -/* - * Driver for the built-in ethernet switch of the Atheros AR7240 SoC - * Copyright (c) 2010 Gabor Juhos - * Copyright (c) 2010 Felix Fietkau - * - * 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 -#include -#include -#include -#include -#include -#include -#include -#include -#include "ag71xx.h" - -#define BITM(_count) (BIT(_count) - 1) -#define BITS(_shift, _count) (BITM(_count) << _shift) - -#define AR7240_REG_MASK_CTRL 0x00 -#define AR7240_MASK_CTRL_REVISION_M BITM(8) -#define AR7240_MASK_CTRL_VERSION_M BITM(8) -#define AR7240_MASK_CTRL_VERSION_S 8 -#define AR7240_MASK_CTRL_VERSION_AR7240 0x01 -#define AR7240_MASK_CTRL_VERSION_AR934X 0x02 -#define AR7240_MASK_CTRL_SOFT_RESET BIT(31) - -#define AR7240_REG_MAC_ADDR0 0x20 -#define AR7240_REG_MAC_ADDR1 0x24 - -#define AR7240_REG_FLOOD_MASK 0x2c -#define AR7240_FLOOD_MASK_BROAD_TO_CPU BIT(26) - -#define AR7240_REG_GLOBAL_CTRL 0x30 -#define AR7240_GLOBAL_CTRL_MTU_M BITM(11) -#define AR9340_GLOBAL_CTRL_MTU_M BITM(14) - -#define AR7240_REG_VTU 0x0040 -#define AR7240_VTU_OP BITM(3) -#define AR7240_VTU_OP_NOOP 0x0 -#define AR7240_VTU_OP_FLUSH 0x1 -#define AR7240_VTU_OP_LOAD 0x2 -#define AR7240_VTU_OP_PURGE 0x3 -#define AR7240_VTU_OP_REMOVE_PORT 0x4 -#define AR7240_VTU_ACTIVE BIT(3) -#define AR7240_VTU_FULL BIT(4) -#define AR7240_VTU_PORT BITS(8, 4) -#define AR7240_VTU_PORT_S 8 -#define AR7240_VTU_VID BITS(16, 12) -#define AR7240_VTU_VID_S 16 -#define AR7240_VTU_PRIO BITS(28, 3) -#define AR7240_VTU_PRIO_S 28 -#define AR7240_VTU_PRIO_EN BIT(31) - -#define AR7240_REG_VTU_DATA 0x0044 -#define AR7240_VTUDATA_MEMBER BITS(0, 10) -#define AR7240_VTUDATA_VALID BIT(11) - -#define AR7240_REG_ATU 0x50 -#define AR7240_ATU_FLUSH_ALL 0x1 - -#define AR7240_REG_AT_CTRL 0x5c -#define AR7240_AT_CTRL_AGE_TIME BITS(0, 15) -#define AR7240_AT_CTRL_AGE_EN BIT(17) -#define AR7240_AT_CTRL_LEARN_CHANGE BIT(18) -#define AR7240_AT_CTRL_RESERVED BIT(19) -#define AR7240_AT_CTRL_ARP_EN BIT(20) - -#define AR7240_REG_TAG_PRIORITY 0x70 - -#define AR7240_REG_SERVICE_TAG 0x74 -#define AR7240_SERVICE_TAG_M BITM(16) - -#define AR7240_REG_CPU_PORT 0x78 -#define AR7240_MIRROR_PORT_S 4 -#define AR7240_MIRROR_PORT_M BITM(4) -#define AR7240_CPU_PORT_EN BIT(8) - -#define AR7240_REG_MIB_FUNCTION0 0x80 -#define AR7240_MIB_TIMER_M BITM(16) -#define AR7240_MIB_AT_HALF_EN BIT(16) -#define AR7240_MIB_BUSY BIT(17) -#define AR7240_MIB_FUNC_S 24 -#define AR7240_MIB_FUNC_M BITM(3) -#define AR7240_MIB_FUNC_NO_OP 0x0 -#define AR7240_MIB_FUNC_FLUSH 0x1 -#define AR7240_MIB_FUNC_CAPTURE 0x3 - -#define AR7240_REG_MDIO_CTRL 0x98 -#define AR7240_MDIO_CTRL_DATA_M BITM(16) -#define AR7240_MDIO_CTRL_REG_ADDR_S 16 -#define AR7240_MDIO_CTRL_PHY_ADDR_S 21 -#define AR7240_MDIO_CTRL_CMD_WRITE 0 -#define AR7240_MDIO_CTRL_CMD_READ BIT(27) -#define AR7240_MDIO_CTRL_MASTER_EN BIT(30) -#define AR7240_MDIO_CTRL_BUSY BIT(31) - -#define AR7240_REG_PORT_BASE(_port) (0x100 + (_port) * 0x100) - -#define AR7240_REG_PORT_STATUS(_port) (AR7240_REG_PORT_BASE((_port)) + 0x00) -#define AR7240_PORT_STATUS_SPEED_S 0 -#define AR7240_PORT_STATUS_SPEED_M BITM(2) -#define AR7240_PORT_STATUS_SPEED_10 0 -#define AR7240_PORT_STATUS_SPEED_100 1 -#define AR7240_PORT_STATUS_SPEED_1000 2 -#define AR7240_PORT_STATUS_TXMAC BIT(2) -#define AR7240_PORT_STATUS_RXMAC BIT(3) -#define AR7240_PORT_STATUS_TXFLOW BIT(4) -#define AR7240_PORT_STATUS_RXFLOW BIT(5) -#define AR7240_PORT_STATUS_DUPLEX BIT(6) -#define AR7240_PORT_STATUS_LINK_UP BIT(8) -#define AR7240_PORT_STATUS_LINK_AUTO BIT(9) -#define AR7240_PORT_STATUS_LINK_PAUSE BIT(10) - -#define AR7240_REG_PORT_CTRL(_port) (AR7240_REG_PORT_BASE((_port)) + 0x04) -#define AR7240_PORT_CTRL_STATE_M BITM(3) -#define AR7240_PORT_CTRL_STATE_DISABLED 0 -#define AR7240_PORT_CTRL_STATE_BLOCK 1 -#define AR7240_PORT_CTRL_STATE_LISTEN 2 -#define AR7240_PORT_CTRL_STATE_LEARN 3 -#define AR7240_PORT_CTRL_STATE_FORWARD 4 -#define AR7240_PORT_CTRL_LEARN_LOCK BIT(7) -#define AR7240_PORT_CTRL_VLAN_MODE_S 8 -#define AR7240_PORT_CTRL_VLAN_MODE_KEEP 0 -#define AR7240_PORT_CTRL_VLAN_MODE_STRIP 1 -#define AR7240_PORT_CTRL_VLAN_MODE_ADD 2 -#define AR7240_PORT_CTRL_VLAN_MODE_DOUBLE_TAG 3 -#define AR7240_PORT_CTRL_IGMP_SNOOP BIT(10) -#define AR7240_PORT_CTRL_HEADER BIT(11) -#define AR7240_PORT_CTRL_MAC_LOOP BIT(12) -#define AR7240_PORT_CTRL_SINGLE_VLAN BIT(13) -#define AR7240_PORT_CTRL_LEARN BIT(14) -#define AR7240_PORT_CTRL_DOUBLE_TAG BIT(15) -#define AR7240_PORT_CTRL_MIRROR_TX BIT(16) -#define AR7240_PORT_CTRL_MIRROR_RX BIT(17) - -#define AR7240_REG_PORT_VLAN(_port) (AR7240_REG_PORT_BASE((_port)) + 0x08) - -#define AR7240_PORT_VLAN_DEFAULT_ID_S 0 -#define AR7240_PORT_VLAN_DEST_PORTS_S 16 -#define AR7240_PORT_VLAN_MODE_S 30 -#define AR7240_PORT_VLAN_MODE_PORT_ONLY 0 -#define AR7240_PORT_VLAN_MODE_PORT_FALLBACK 1 -#define AR7240_PORT_VLAN_MODE_VLAN_ONLY 2 -#define AR7240_PORT_VLAN_MODE_SECURE 3 - - -#define AR7240_REG_STATS_BASE(_port) (0x20000 + (_port) * 0x100) - -#define AR7240_STATS_RXBROAD 0x00 -#define AR7240_STATS_RXPAUSE 0x04 -#define AR7240_STATS_RXMULTI 0x08 -#define AR7240_STATS_RXFCSERR 0x0c -#define AR7240_STATS_RXALIGNERR 0x10 -#define AR7240_STATS_RXRUNT 0x14 -#define AR7240_STATS_RXFRAGMENT 0x18 -#define AR7240_STATS_RX64BYTE 0x1c -#define AR7240_STATS_RX128BYTE 0x20 -#define AR7240_STATS_RX256BYTE 0x24 -#define AR7240_STATS_RX512BYTE 0x28 -#define AR7240_STATS_RX1024BYTE 0x2c -#define AR7240_STATS_RX1518BYTE 0x30 -#define AR7240_STATS_RXMAXBYTE 0x34 -#define AR7240_STATS_RXTOOLONG 0x38 -#define AR7240_STATS_RXGOODBYTE 0x3c -#define AR7240_STATS_RXBADBYTE 0x44 -#define AR7240_STATS_RXOVERFLOW 0x4c -#define AR7240_STATS_FILTERED 0x50 -#define AR7240_STATS_TXBROAD 0x54 -#define AR7240_STATS_TXPAUSE 0x58 -#define AR7240_STATS_TXMULTI 0x5c -#define AR7240_STATS_TXUNDERRUN 0x60 -#define AR7240_STATS_TX64BYTE 0x64 -#define AR7240_STATS_TX128BYTE 0x68 -#define AR7240_STATS_TX256BYTE 0x6c -#define AR7240_STATS_TX512BYTE 0x70 -#define AR7240_STATS_TX1024BYTE 0x74 -#define AR7240_STATS_TX1518BYTE 0x78 -#define AR7240_STATS_TXMAXBYTE 0x7c -#define AR7240_STATS_TXOVERSIZE 0x80 -#define AR7240_STATS_TXBYTE 0x84 -#define AR7240_STATS_TXCOLLISION 0x8c -#define AR7240_STATS_TXABORTCOL 0x90 -#define AR7240_STATS_TXMULTICOL 0x94 -#define AR7240_STATS_TXSINGLECOL 0x98 -#define AR7240_STATS_TXEXCDEFER 0x9c -#define AR7240_STATS_TXDEFER 0xa0 -#define AR7240_STATS_TXLATECOL 0xa4 - -#define AR7240_PORT_CPU 0 -#define AR7240_NUM_PORTS 6 -#define AR7240_NUM_PHYS 5 - -#define AR7240_PHY_ID1 0x004d -#define AR7240_PHY_ID2 0xd041 - -#define AR934X_PHY_ID1 0x004d -#define AR934X_PHY_ID2 0xd042 - -#define AR7240_MAX_VLANS 16 - -#define AR934X_REG_OPER_MODE0 0x04 -#define AR934X_OPER_MODE0_MAC_GMII_EN BIT(6) -#define AR934X_OPER_MODE0_PHY_MII_EN BIT(10) - -#define AR934X_REG_OPER_MODE1 0x08 -#define AR934X_REG_OPER_MODE1_PHY4_MII_EN BIT(28) - -#define AR934X_REG_FLOOD_MASK 0x2c -#define AR934X_FLOOD_MASK_MC_DP(_p) BIT(16 + (_p)) -#define AR934X_FLOOD_MASK_BC_DP(_p) BIT(25 + (_p)) - -#define AR934X_REG_QM_CTRL 0x3c -#define AR934X_QM_CTRL_ARP_EN BIT(15) - -#define AR934X_REG_AT_CTRL 0x5c -#define AR934X_AT_CTRL_AGE_TIME BITS(0, 15) -#define AR934X_AT_CTRL_AGE_EN BIT(17) -#define AR934X_AT_CTRL_LEARN_CHANGE BIT(18) - -#define AR934X_MIB_ENABLE BIT(30) - -#define AR934X_REG_PORT_BASE(_port) (0x100 + (_port) * 0x100) - -#define AR934X_REG_PORT_VLAN1(_port) (AR934X_REG_PORT_BASE((_port)) + 0x08) -#define AR934X_PORT_VLAN1_DEFAULT_SVID_S 0 -#define AR934X_PORT_VLAN1_FORCE_DEFAULT_VID_EN BIT(12) -#define AR934X_PORT_VLAN1_PORT_TLS_MODE BIT(13) -#define AR934X_PORT_VLAN1_PORT_VLAN_PROP_EN BIT(14) -#define AR934X_PORT_VLAN1_PORT_CLONE_EN BIT(15) -#define AR934X_PORT_VLAN1_DEFAULT_CVID_S 16 -#define AR934X_PORT_VLAN1_FORCE_PORT_VLAN_EN BIT(28) -#define AR934X_PORT_VLAN1_ING_PORT_PRI_S 29 - -#define AR934X_REG_PORT_VLAN2(_port) (AR934X_REG_PORT_BASE((_port)) + 0x0c) -#define AR934X_PORT_VLAN2_PORT_VID_MEM_S 16 -#define AR934X_PORT_VLAN2_8021Q_MODE_S 30 -#define AR934X_PORT_VLAN2_8021Q_MODE_PORT_ONLY 0 -#define AR934X_PORT_VLAN2_8021Q_MODE_PORT_FALLBACK 1 -#define AR934X_PORT_VLAN2_8021Q_MODE_VLAN_ONLY 2 -#define AR934X_PORT_VLAN2_8021Q_MODE_SECURE 3 - -#define sw_to_ar7240(_dev) container_of(_dev, struct ar7240sw, swdev) - -struct ar7240sw_port_stat { - unsigned long rx_broadcast; - unsigned long rx_pause; - unsigned long rx_multicast; - unsigned long rx_fcs_error; - unsigned long rx_align_error; - unsigned long rx_runt; - unsigned long rx_fragments; - unsigned long rx_64byte; - unsigned long rx_128byte; - unsigned long rx_256byte; - unsigned long rx_512byte; - unsigned long rx_1024byte; - unsigned long rx_1518byte; - unsigned long rx_maxbyte; - unsigned long rx_toolong; - unsigned long rx_good_byte; - unsigned long rx_bad_byte; - unsigned long rx_overflow; - unsigned long filtered; - - unsigned long tx_broadcast; - unsigned long tx_pause; - unsigned long tx_multicast; - unsigned long tx_underrun; - unsigned long tx_64byte; - unsigned long tx_128byte; - unsigned long tx_256byte; - unsigned long tx_512byte; - unsigned long tx_1024byte; - unsigned long tx_1518byte; - unsigned long tx_maxbyte; - unsigned long tx_oversize; - unsigned long tx_byte; - unsigned long tx_collision; - unsigned long tx_abortcol; - unsigned long tx_multicol; - unsigned long tx_singlecol; - unsigned long tx_excdefer; - unsigned long tx_defer; - unsigned long tx_xlatecol; -}; - -struct ar7240sw { - struct mii_bus *mii_bus; - struct mii_bus *switch_mii_bus; - struct device_node *of_node; - struct device_node *mdio_node; - struct switch_dev swdev; - int num_ports; - u8 ver; - bool vlan; - u16 vlan_id[AR7240_MAX_VLANS]; - u8 vlan_table[AR7240_MAX_VLANS]; - u8 vlan_tagged; - u16 pvid[AR7240_NUM_PORTS]; - char buf[80]; - - rwlock_t stats_lock; - struct ar7240sw_port_stat port_stats[AR7240_NUM_PORTS]; -}; - -struct ar7240sw_hw_stat { - char string[ETH_GSTRING_LEN]; - int sizeof_stat; - int reg; -}; - -static DEFINE_MUTEX(reg_mutex); - -static inline int sw_is_ar7240(struct ar7240sw *as) -{ - return as->ver == AR7240_MASK_CTRL_VERSION_AR7240; -} - -static inline int sw_is_ar934x(struct ar7240sw *as) -{ - return as->ver == AR7240_MASK_CTRL_VERSION_AR934X; -} - -static inline u32 ar7240sw_port_mask(struct ar7240sw *as, int port) -{ - return BIT(port); -} - -static inline u32 ar7240sw_port_mask_all(struct ar7240sw *as) -{ - return BIT(as->swdev.ports) - 1; -} - -static inline u32 ar7240sw_port_mask_but(struct ar7240sw *as, int port) -{ - return ar7240sw_port_mask_all(as) & ~BIT(port); -} - -static inline u16 mk_phy_addr(u32 reg) -{ - return 0x17 & ((reg >> 4) | 0x10); -} - -static inline u16 mk_phy_reg(u32 reg) -{ - return (reg << 1) & 0x1e; -} - -static inline u16 mk_high_addr(u32 reg) -{ - return (reg >> 7) & 0x1ff; -} - -static u32 __ar7240sw_reg_read(struct mii_bus *mii, u32 reg) -{ - unsigned long flags; - u16 phy_addr; - u16 phy_reg; - u32 hi, lo; - - reg = (reg & 0xfffffffc) >> 2; - phy_addr = mk_phy_addr(reg); - phy_reg = mk_phy_reg(reg); - - local_irq_save(flags); - mutex_lock(&mii->mdio_lock); - mii->write(mii, 0x1f, 0x10, mk_high_addr(reg)); - lo = (u32) mii->read(mii, phy_addr, phy_reg); - hi = (u32) mii->read(mii, phy_addr, phy_reg + 1); - mutex_unlock(&mii->mdio_lock); - local_irq_restore(flags); - - return (hi << 16) | lo; -} - -static void __ar7240sw_reg_write(struct mii_bus *mii, u32 reg, u32 val) -{ - unsigned long flags; - u16 phy_addr; - u16 phy_reg; - - reg = (reg & 0xfffffffc) >> 2; - phy_addr = mk_phy_addr(reg); - phy_reg = mk_phy_reg(reg); - - local_irq_save(flags); - mutex_lock(&mii->mdio_lock); - mii->write(mii, 0x1f, 0x10, mk_high_addr(reg)); - mii->write(mii, phy_addr, phy_reg + 1, (val >> 16)); - mii->write(mii, phy_addr, phy_reg, (val & 0xffff)); - mutex_unlock(&mii->mdio_lock); - local_irq_restore(flags); -} - -static u32 ar7240sw_reg_read(struct mii_bus *mii, u32 reg_addr) -{ - u32 ret; - - mutex_lock(®_mutex); - ret = __ar7240sw_reg_read(mii, reg_addr); - mutex_unlock(®_mutex); - - return ret; -} - -static void ar7240sw_reg_write(struct mii_bus *mii, u32 reg_addr, u32 reg_val) -{ - mutex_lock(®_mutex); - __ar7240sw_reg_write(mii, reg_addr, reg_val); - mutex_unlock(®_mutex); -} - -static u32 ar7240sw_reg_rmw(struct mii_bus *mii, u32 reg, u32 mask, u32 val) -{ - u32 t; - - mutex_lock(®_mutex); - t = __ar7240sw_reg_read(mii, reg); - t &= ~mask; - t |= val; - __ar7240sw_reg_write(mii, reg, t); - mutex_unlock(®_mutex); - - return t; -} - -static void ar7240sw_reg_set(struct mii_bus *mii, u32 reg, u32 val) -{ - u32 t; - - mutex_lock(®_mutex); - t = __ar7240sw_reg_read(mii, reg); - t |= val; - __ar7240sw_reg_write(mii, reg, t); - mutex_unlock(®_mutex); -} - -static int __ar7240sw_reg_wait(struct mii_bus *mii, u32 reg, u32 mask, u32 val, - unsigned timeout) -{ - int i; - - for (i = 0; i < timeout; i++) { - u32 t; - - t = __ar7240sw_reg_read(mii, reg); - if ((t & mask) == val) - return 0; - - usleep_range(1000, 2000); - } - - return -ETIMEDOUT; -} - -static int ar7240sw_reg_wait(struct mii_bus *mii, u32 reg, u32 mask, u32 val, - unsigned timeout) -{ - int ret; - - mutex_lock(®_mutex); - ret = __ar7240sw_reg_wait(mii, reg, mask, val, timeout); - mutex_unlock(®_mutex); - return ret; -} - -int ar7240sw_phy_read(struct mii_bus *bus, int phy_addr, int reg_addr) -{ - u32 t, val = 0xffff; - int err; - struct ar7240sw *as = bus->priv; - struct mii_bus *mii = as->mii_bus; - - if (phy_addr >= AR7240_NUM_PHYS) - return 0xffff; - - mutex_lock(®_mutex); - t = (reg_addr << AR7240_MDIO_CTRL_REG_ADDR_S) | - (phy_addr << AR7240_MDIO_CTRL_PHY_ADDR_S) | - AR7240_MDIO_CTRL_MASTER_EN | - AR7240_MDIO_CTRL_BUSY | - AR7240_MDIO_CTRL_CMD_READ; - - __ar7240sw_reg_write(mii, AR7240_REG_MDIO_CTRL, t); - err = __ar7240sw_reg_wait(mii, AR7240_REG_MDIO_CTRL, - AR7240_MDIO_CTRL_BUSY, 0, 5); - if (!err) - val = __ar7240sw_reg_read(mii, AR7240_REG_MDIO_CTRL); - mutex_unlock(®_mutex); - - return val & AR7240_MDIO_CTRL_DATA_M; -} - -int ar7240sw_phy_write(struct mii_bus *bus, int phy_addr, int reg_addr, - u16 reg_val) -{ - u32 t; - int ret; - struct ar7240sw *as = bus->priv; - struct mii_bus *mii = as->mii_bus; - - if (phy_addr >= AR7240_NUM_PHYS) - return -EINVAL; - - mutex_lock(®_mutex); - t = (phy_addr << AR7240_MDIO_CTRL_PHY_ADDR_S) | - (reg_addr << AR7240_MDIO_CTRL_REG_ADDR_S) | - AR7240_MDIO_CTRL_MASTER_EN | - AR7240_MDIO_CTRL_BUSY | - AR7240_MDIO_CTRL_CMD_WRITE | - reg_val; - - __ar7240sw_reg_write(mii, AR7240_REG_MDIO_CTRL, t); - ret = __ar7240sw_reg_wait(mii, AR7240_REG_MDIO_CTRL, - AR7240_MDIO_CTRL_BUSY, 0, 5); - mutex_unlock(®_mutex); - - return ret; -} - -static int ar7240sw_capture_stats(struct ar7240sw *as) -{ - struct mii_bus *mii = as->mii_bus; - int port; - int ret; - - write_lock(&as->stats_lock); - - /* Capture the hardware statistics for all ports */ - ar7240sw_reg_rmw(mii, AR7240_REG_MIB_FUNCTION0, - (AR7240_MIB_FUNC_M << AR7240_MIB_FUNC_S), - (AR7240_MIB_FUNC_CAPTURE << AR7240_MIB_FUNC_S)); - - /* Wait for the capturing to complete. */ - ret = ar7240sw_reg_wait(mii, AR7240_REG_MIB_FUNCTION0, - AR7240_MIB_BUSY, 0, 10); - - if (ret) - goto unlock; - - for (port = 0; port < AR7240_NUM_PORTS; port++) { - unsigned int base; - struct ar7240sw_port_stat *stats; - - base = AR7240_REG_STATS_BASE(port); - stats = &as->port_stats[port]; - -#define READ_STAT(_r) ar7240sw_reg_read(mii, base + AR7240_STATS_ ## _r) - - stats->rx_good_byte += READ_STAT(RXGOODBYTE); - stats->tx_byte += READ_STAT(TXBYTE); - -#undef READ_STAT - } - - ret = 0; - -unlock: - write_unlock(&as->stats_lock); - return ret; -} - -static void ar7240sw_disable_port(struct ar7240sw *as, unsigned port) -{ - ar7240sw_reg_write(as->mii_bus, AR7240_REG_PORT_CTRL(port), - AR7240_PORT_CTRL_STATE_DISABLED); -} - -static void ar7240sw_setup(struct ar7240sw *as) -{ - struct mii_bus *mii = as->mii_bus; - - /* Enable CPU port, and disable mirror port */ - ar7240sw_reg_write(mii, AR7240_REG_CPU_PORT, - AR7240_CPU_PORT_EN | - (15 << AR7240_MIRROR_PORT_S)); - - /* Setup TAG priority mapping */ - ar7240sw_reg_write(mii, AR7240_REG_TAG_PRIORITY, 0xfa50); - - if (sw_is_ar934x(as)) { - /* Enable aging, MAC replacing */ - ar7240sw_reg_write(mii, AR934X_REG_AT_CTRL, - 0x2b /* 5 min age time */ | - AR934X_AT_CTRL_AGE_EN | - AR934X_AT_CTRL_LEARN_CHANGE); - /* Enable ARP frame acknowledge */ - ar7240sw_reg_set(mii, AR934X_REG_QM_CTRL, - AR934X_QM_CTRL_ARP_EN); - /* Enable Broadcast/Multicast frames transmitted to the CPU */ - ar7240sw_reg_set(mii, AR934X_REG_FLOOD_MASK, - AR934X_FLOOD_MASK_BC_DP(0) | - AR934X_FLOOD_MASK_MC_DP(0)); - - /* setup MTU */ - ar7240sw_reg_rmw(mii, AR7240_REG_GLOBAL_CTRL, - AR9340_GLOBAL_CTRL_MTU_M, - AR9340_GLOBAL_CTRL_MTU_M); - - /* Enable MIB counters */ - ar7240sw_reg_set(mii, AR7240_REG_MIB_FUNCTION0, - AR934X_MIB_ENABLE); - - } else { - /* Enable ARP frame acknowledge, aging, MAC replacing */ - ar7240sw_reg_write(mii, AR7240_REG_AT_CTRL, - AR7240_AT_CTRL_RESERVED | - 0x2b /* 5 min age time */ | - AR7240_AT_CTRL_AGE_EN | - AR7240_AT_CTRL_ARP_EN | - AR7240_AT_CTRL_LEARN_CHANGE); - /* Enable Broadcast frames transmitted to the CPU */ - ar7240sw_reg_set(mii, AR7240_REG_FLOOD_MASK, - AR7240_FLOOD_MASK_BROAD_TO_CPU); - - /* setup MTU */ - ar7240sw_reg_rmw(mii, AR7240_REG_GLOBAL_CTRL, - AR7240_GLOBAL_CTRL_MTU_M, - AR7240_GLOBAL_CTRL_MTU_M); - } - - /* setup Service TAG */ - ar7240sw_reg_rmw(mii, AR7240_REG_SERVICE_TAG, AR7240_SERVICE_TAG_M, 0); -} - -/* inspired by phy_poll_reset in drivers/net/phy/phy_device.c */ -static int -ar7240sw_phy_poll_reset(struct mii_bus *bus) -{ - const unsigned int sleep_msecs = 20; - int ret, elapsed, i; - - for (elapsed = sleep_msecs; elapsed <= 600; - elapsed += sleep_msecs) { - msleep(sleep_msecs); - for (i = 0; i < AR7240_NUM_PHYS; i++) { - ret = ar7240sw_phy_read(bus, i, MII_BMCR); - if (ret < 0) - return ret; - if (ret & BMCR_RESET) - break; - if (i == AR7240_NUM_PHYS - 1) { - usleep_range(1000, 2000); - return 0; - } - } - } - return -ETIMEDOUT; -} - -static int ar7240sw_reset(struct ar7240sw *as) -{ - struct mii_bus *mii = as->mii_bus; - struct mii_bus *swmii = as->switch_mii_bus; - int ret; - int i; - - /* Set all ports to disabled state. */ - for (i = 0; i < AR7240_NUM_PORTS; i++) - ar7240sw_disable_port(as, i); - - /* Wait for transmit queues to drain. */ - usleep_range(2000, 3000); - - /* Reset the switch. */ - ar7240sw_reg_write(mii, AR7240_REG_MASK_CTRL, - AR7240_MASK_CTRL_SOFT_RESET); - - ret = ar7240sw_reg_wait(mii, AR7240_REG_MASK_CTRL, - AR7240_MASK_CTRL_SOFT_RESET, 0, 1000); - - /* setup PHYs */ - for (i = 0; i < AR7240_NUM_PHYS; i++) { - ar7240sw_phy_write(swmii, i, MII_ADVERTISE, - ADVERTISE_ALL | ADVERTISE_PAUSE_CAP | - ADVERTISE_PAUSE_ASYM); - ar7240sw_phy_write(swmii, i, MII_BMCR, - BMCR_RESET | BMCR_ANENABLE); - } - ret = ar7240sw_phy_poll_reset(swmii); - if (ret) - return ret; - - ar7240sw_setup(as); - return ret; -} - -static void ar7240sw_setup_port(struct ar7240sw *as, unsigned port, u8 portmask) -{ - struct mii_bus *mii = as->mii_bus; - u32 ctrl; - u32 vid, mode; - - ctrl = AR7240_PORT_CTRL_STATE_FORWARD | AR7240_PORT_CTRL_LEARN | - AR7240_PORT_CTRL_SINGLE_VLAN; - - if (port == AR7240_PORT_CPU) { - ar7240sw_reg_write(mii, AR7240_REG_PORT_STATUS(port), - AR7240_PORT_STATUS_SPEED_1000 | - AR7240_PORT_STATUS_TXFLOW | - AR7240_PORT_STATUS_RXFLOW | - AR7240_PORT_STATUS_TXMAC | - AR7240_PORT_STATUS_RXMAC | - AR7240_PORT_STATUS_DUPLEX); - } else { - ar7240sw_reg_write(mii, AR7240_REG_PORT_STATUS(port), - AR7240_PORT_STATUS_LINK_AUTO); - } - - /* Set the default VID for this port */ - if (as->vlan) { - vid = as->vlan_id[as->pvid[port]]; - mode = AR7240_PORT_VLAN_MODE_SECURE; - } else { - vid = port; - mode = AR7240_PORT_VLAN_MODE_PORT_ONLY; - } - - if (as->vlan) { - if (as->vlan_tagged & BIT(port)) - ctrl |= AR7240_PORT_CTRL_VLAN_MODE_ADD << - AR7240_PORT_CTRL_VLAN_MODE_S; - else - ctrl |= AR7240_PORT_CTRL_VLAN_MODE_STRIP << - AR7240_PORT_CTRL_VLAN_MODE_S; - } else { - ctrl |= AR7240_PORT_CTRL_VLAN_MODE_KEEP << - AR7240_PORT_CTRL_VLAN_MODE_S; - } - - if (!portmask) { - if (port == AR7240_PORT_CPU) - portmask = ar7240sw_port_mask_but(as, AR7240_PORT_CPU); - else - portmask = ar7240sw_port_mask(as, AR7240_PORT_CPU); - } - - /* preserve mirror rx&tx flags */ - ctrl |= ar7240sw_reg_read(mii, AR7240_REG_PORT_CTRL(port)) & - (AR7240_PORT_CTRL_MIRROR_RX | AR7240_PORT_CTRL_MIRROR_TX); - - /* allow the port to talk to all other ports, but exclude its - * own ID to prevent frames from being reflected back to the - * port that they came from */ - portmask &= ar7240sw_port_mask_but(as, port); - - ar7240sw_reg_write(mii, AR7240_REG_PORT_CTRL(port), ctrl); - if (sw_is_ar934x(as)) { - u32 vlan1, vlan2; - - vlan1 = (vid << AR934X_PORT_VLAN1_DEFAULT_CVID_S); - vlan2 = (portmask << AR934X_PORT_VLAN2_PORT_VID_MEM_S) | - (mode << AR934X_PORT_VLAN2_8021Q_MODE_S); - ar7240sw_reg_write(mii, AR934X_REG_PORT_VLAN1(port), vlan1); - ar7240sw_reg_write(mii, AR934X_REG_PORT_VLAN2(port), vlan2); - } else { - u32 vlan; - - vlan = vid | (mode << AR7240_PORT_VLAN_MODE_S) | - (portmask << AR7240_PORT_VLAN_DEST_PORTS_S); - - ar7240sw_reg_write(mii, AR7240_REG_PORT_VLAN(port), vlan); - } -} - -static int -ar7240_set_vid(struct switch_dev *dev, const struct switch_attr *attr, - struct switch_val *val) -{ - struct ar7240sw *as = sw_to_ar7240(dev); - as->vlan_id[val->port_vlan] = val->value.i; - return 0; -} - -static int -ar7240_get_vid(struct switch_dev *dev, const struct switch_attr *attr, - struct switch_val *val) -{ - struct ar7240sw *as = sw_to_ar7240(dev); - val->value.i = as->vlan_id[val->port_vlan]; - return 0; -} - -static int -ar7240_set_pvid(struct switch_dev *dev, int port, int vlan) -{ - struct ar7240sw *as = sw_to_ar7240(dev); - - /* make sure no invalid PVIDs get set */ - - if (vlan >= dev->vlans) - return -EINVAL; - - as->pvid[port] = vlan; - return 0; -} - -static int -ar7240_get_pvid(struct switch_dev *dev, int port, int *vlan) -{ - struct ar7240sw *as = sw_to_ar7240(dev); - *vlan = as->pvid[port]; - return 0; -} - -static int -ar7240_get_ports(struct switch_dev *dev, struct switch_val *val) -{ - struct ar7240sw *as = sw_to_ar7240(dev); - u8 ports = as->vlan_table[val->port_vlan]; - int i; - - val->len = 0; - for (i = 0; i < as->swdev.ports; i++) { - struct switch_port *p; - - if (!(ports & (1 << i))) - continue; - - p = &val->value.ports[val->len++]; - p->id = i; - if (as->vlan_tagged & (1 << i)) - p->flags = (1 << SWITCH_PORT_FLAG_TAGGED); - else - p->flags = 0; - } - return 0; -} - -static int -ar7240_set_ports(struct switch_dev *dev, struct switch_val *val) -{ - struct ar7240sw *as = sw_to_ar7240(dev); - u8 *vt = &as->vlan_table[val->port_vlan]; - int i, j; - - *vt = 0; - for (i = 0; i < val->len; i++) { - struct switch_port *p = &val->value.ports[i]; - - if (p->flags & (1 << SWITCH_PORT_FLAG_TAGGED)) - as->vlan_tagged |= (1 << p->id); - else { - as->vlan_tagged &= ~(1 << p->id); - as->pvid[p->id] = val->port_vlan; - - /* make sure that an untagged port does not - * appear in other vlans */ - for (j = 0; j < AR7240_MAX_VLANS; j++) { - if (j == val->port_vlan) - continue; - as->vlan_table[j] &= ~(1 << p->id); - } - } - - *vt |= 1 << p->id; - } - return 0; -} - -static int -ar7240_set_vlan(struct switch_dev *dev, const struct switch_attr *attr, - struct switch_val *val) -{ - struct ar7240sw *as = sw_to_ar7240(dev); - as->vlan = !!val->value.i; - return 0; -} - -static int -ar7240_get_vlan(struct switch_dev *dev, const struct switch_attr *attr, - struct switch_val *val) -{ - struct ar7240sw *as = sw_to_ar7240(dev); - val->value.i = as->vlan; - return 0; -} - -static void -ar7240_vtu_op(struct ar7240sw *as, u32 op, u32 val) -{ - struct mii_bus *mii = as->mii_bus; - - if (ar7240sw_reg_wait(mii, AR7240_REG_VTU, AR7240_VTU_ACTIVE, 0, 5)) - return; - - if ((op & AR7240_VTU_OP) == AR7240_VTU_OP_LOAD) { - val &= AR7240_VTUDATA_MEMBER; - val |= AR7240_VTUDATA_VALID; - ar7240sw_reg_write(mii, AR7240_REG_VTU_DATA, val); - } - op |= AR7240_VTU_ACTIVE; - ar7240sw_reg_write(mii, AR7240_REG_VTU, op); -} - -static int -ar7240_hw_apply(struct switch_dev *dev) -{ - struct ar7240sw *as = sw_to_ar7240(dev); - u8 portmask[AR7240_NUM_PORTS]; - int i, j; - - /* flush all vlan translation unit entries */ - ar7240_vtu_op(as, AR7240_VTU_OP_FLUSH, 0); - - memset(portmask, 0, sizeof(portmask)); - if (as->vlan) { - /* calculate the port destination masks and load vlans - * into the vlan translation unit */ - for (j = 0; j < AR7240_MAX_VLANS; j++) { - u8 vp = as->vlan_table[j]; - - if (!vp) - continue; - - for (i = 0; i < as->swdev.ports; i++) { - u8 mask = (1 << i); - if (vp & mask) - portmask[i] |= vp & ~mask; - } - - ar7240_vtu_op(as, - AR7240_VTU_OP_LOAD | - (as->vlan_id[j] << AR7240_VTU_VID_S), - as->vlan_table[j]); - } - } else { - /* vlan disabled: - * isolate all ports, but connect them to the cpu port */ - for (i = 0; i < as->swdev.ports; i++) { - if (i == AR7240_PORT_CPU) - continue; - - portmask[i] = 1 << AR7240_PORT_CPU; - portmask[AR7240_PORT_CPU] |= (1 << i); - } - } - - /* update the port destination mask registers and tag settings */ - for (i = 0; i < as->swdev.ports; i++) - ar7240sw_setup_port(as, i, portmask[i]); - - return 0; -} - -static int -ar7240_reset_switch(struct switch_dev *dev) -{ - struct ar7240sw *as = sw_to_ar7240(dev); - ar7240sw_reset(as); - return 0; -} - -static int -ar7240_get_port_link(struct switch_dev *dev, int port, - struct switch_port_link *link) -{ - struct ar7240sw *as = sw_to_ar7240(dev); - struct mii_bus *mii = as->mii_bus; - u32 status; - - if (port >= AR7240_NUM_PORTS) - return -EINVAL; - - status = ar7240sw_reg_read(mii, AR7240_REG_PORT_STATUS(port)); - link->aneg = !!(status & AR7240_PORT_STATUS_LINK_AUTO); - if (link->aneg) { - link->link = !!(status & AR7240_PORT_STATUS_LINK_UP); - if (!link->link) - return 0; - } else { - link->link = true; - } - - link->duplex = !!(status & AR7240_PORT_STATUS_DUPLEX); - link->tx_flow = !!(status & AR7240_PORT_STATUS_TXFLOW); - link->rx_flow = !!(status & AR7240_PORT_STATUS_RXFLOW); - switch (status & AR7240_PORT_STATUS_SPEED_M) { - case AR7240_PORT_STATUS_SPEED_10: - link->speed = SWITCH_PORT_SPEED_10; - break; - case AR7240_PORT_STATUS_SPEED_100: - link->speed = SWITCH_PORT_SPEED_100; - break; - case AR7240_PORT_STATUS_SPEED_1000: - link->speed = SWITCH_PORT_SPEED_1000; - break; - } - - return 0; -} - -static int -ar7240_get_port_stats(struct switch_dev *dev, int port, - struct switch_port_stats *stats) -{ - struct ar7240sw *as = sw_to_ar7240(dev); - - if (port >= AR7240_NUM_PORTS) - return -EINVAL; - - ar7240sw_capture_stats(as); - - read_lock(&as->stats_lock); - stats->rx_bytes = as->port_stats[port].rx_good_byte; - stats->tx_bytes = as->port_stats[port].tx_byte; - read_unlock(&as->stats_lock); - - return 0; -} - -static int -ar7240_set_mirror_monitor_port(struct switch_dev *dev, - const struct switch_attr *attr, - struct switch_val *val) -{ - struct ar7240sw *as = sw_to_ar7240(dev); - struct mii_bus *mii = as->mii_bus; - - int port = val->value.i; - - if (port > 15) - return -EINVAL; - - ar7240sw_reg_rmw(mii, AR7240_REG_CPU_PORT, - AR7240_MIRROR_PORT_M << AR7240_MIRROR_PORT_S, - port << AR7240_MIRROR_PORT_S); - - return 0; -} - -static int -ar7240_get_mirror_monitor_port(struct switch_dev *dev, - const struct switch_attr *attr, - struct switch_val *val) -{ - struct ar7240sw *as = sw_to_ar7240(dev); - struct mii_bus *mii = as->mii_bus; - - u32 ret; - - ret = ar7240sw_reg_read(mii, AR7240_REG_CPU_PORT); - val->value.i = (ret >> AR7240_MIRROR_PORT_S) & AR7240_MIRROR_PORT_M; - - return 0; -} - -static int -ar7240_set_mirror_rx(struct switch_dev *dev, const struct switch_attr *attr, - struct switch_val *val) -{ - struct ar7240sw *as = sw_to_ar7240(dev); - struct mii_bus *mii = as->mii_bus; - - int port = val->port_vlan; - - if (port >= dev->ports) - return -EINVAL; - - if (val && val->value.i == 1) - ar7240sw_reg_set(mii, AR7240_REG_PORT_CTRL(port), - AR7240_PORT_CTRL_MIRROR_RX); - else - ar7240sw_reg_rmw(mii, AR7240_REG_PORT_CTRL(port), - AR7240_PORT_CTRL_MIRROR_RX, 0); - - return 0; -} - -static int -ar7240_get_mirror_rx(struct switch_dev *dev, const struct switch_attr *attr, - struct switch_val *val) -{ - struct ar7240sw *as = sw_to_ar7240(dev); - struct mii_bus *mii = as->mii_bus; - - u32 ctrl; - - int port = val->port_vlan; - - if (port >= dev->ports) - return -EINVAL; - - ctrl = ar7240sw_reg_read(mii, AR7240_REG_PORT_CTRL(port)); - - if ((ctrl & AR7240_PORT_CTRL_MIRROR_RX) == AR7240_PORT_CTRL_MIRROR_RX) - val->value.i = 1; - else - val->value.i = 0; - - return 0; -} - -static int -ar7240_set_mirror_tx(struct switch_dev *dev, const struct switch_attr *attr, - struct switch_val *val) -{ - struct ar7240sw *as = sw_to_ar7240(dev); - struct mii_bus *mii = as->mii_bus; - - int port = val->port_vlan; - - if (port >= dev->ports) - return -EINVAL; - - if (val && val->value.i == 1) - ar7240sw_reg_set(mii, AR7240_REG_PORT_CTRL(port), - AR7240_PORT_CTRL_MIRROR_TX); - else - ar7240sw_reg_rmw(mii, AR7240_REG_PORT_CTRL(port), - AR7240_PORT_CTRL_MIRROR_TX, 0); - - return 0; -} - -static int -ar7240_get_mirror_tx(struct switch_dev *dev, const struct switch_attr *attr, - struct switch_val *val) -{ - struct ar7240sw *as = sw_to_ar7240(dev); - struct mii_bus *mii = as->mii_bus; - - u32 ctrl; - - int port = val->port_vlan; - - if (port >= dev->ports) - return -EINVAL; - - ctrl = ar7240sw_reg_read(mii, AR7240_REG_PORT_CTRL(port)); - - if ((ctrl & AR7240_PORT_CTRL_MIRROR_TX) == AR7240_PORT_CTRL_MIRROR_TX) - val->value.i = 1; - else - val->value.i = 0; - - return 0; -} - -static struct switch_attr ar7240_globals[] = { - { - .type = SWITCH_TYPE_INT, - .name = "enable_vlan", - .description = "Enable VLAN mode", - .set = ar7240_set_vlan, - .get = ar7240_get_vlan, - .max = 1 - }, - { - .type = SWITCH_TYPE_INT, - .name = "mirror_monitor_port", - .description = "Mirror monitor port", - .set = ar7240_set_mirror_monitor_port, - .get = ar7240_get_mirror_monitor_port, - .max = 15 - }, -}; - -static struct switch_attr ar7240_port[] = { - { - .type = SWITCH_TYPE_INT, - .name = "enable_mirror_rx", - .description = "Enable mirroring of RX packets", - .set = ar7240_set_mirror_rx, - .get = ar7240_get_mirror_rx, - .max = 1 - }, - { - .type = SWITCH_TYPE_INT, - .name = "enable_mirror_tx", - .description = "Enable mirroring of TX packets", - .set = ar7240_set_mirror_tx, - .get = ar7240_get_mirror_tx, - .max = 1 - }, -}; - -static struct switch_attr ar7240_vlan[] = { - { - .type = SWITCH_TYPE_INT, - .name = "vid", - .description = "VLAN ID", - .set = ar7240_set_vid, - .get = ar7240_get_vid, - .max = 4094, - }, -}; - -static const struct switch_dev_ops ar7240_ops = { - .attr_global = { - .attr = ar7240_globals, - .n_attr = ARRAY_SIZE(ar7240_globals), - }, - .attr_port = { - .attr = ar7240_port, - .n_attr = ARRAY_SIZE(ar7240_port), - }, - .attr_vlan = { - .attr = ar7240_vlan, - .n_attr = ARRAY_SIZE(ar7240_vlan), - }, - .get_port_pvid = ar7240_get_pvid, - .set_port_pvid = ar7240_set_pvid, - .get_vlan_ports = ar7240_get_ports, - .set_vlan_ports = ar7240_set_ports, - .apply_config = ar7240_hw_apply, - .reset_switch = ar7240_reset_switch, - .get_port_link = ar7240_get_port_link, - .get_port_stats = ar7240_get_port_stats, -}; - -static int -ag71xx_ar7240_probe(struct mdio_device *mdiodev) -{ - struct mii_bus *mii = mdiodev->bus; - struct ar7240sw *as; - struct switch_dev *swdev; - struct reset_control *switch_reset; - u32 ctrl; - int phy_if_mode, err, i; - - as = devm_kzalloc(&mdiodev->dev, sizeof(*as), GFP_KERNEL); - if (!as) - return -ENOMEM; - - as->mii_bus = mii; - as->of_node = mdiodev->dev.of_node; - as->mdio_node = of_get_child_by_name(as->of_node, "mdio-bus"); - - swdev = &as->swdev; - - switch_reset = devm_reset_control_get_optional(&mdiodev->dev, "switch"); - if (switch_reset) { - reset_control_assert(switch_reset); - msleep(50); - reset_control_deassert(switch_reset); - msleep(200); - } - - ctrl = ar7240sw_reg_read(mii, AR7240_REG_MASK_CTRL); - as->ver = (ctrl >> AR7240_MASK_CTRL_VERSION_S) & - AR7240_MASK_CTRL_VERSION_M; - - if (sw_is_ar7240(as)) { - swdev->name = "AR7240/AR9330 built-in switch"; - swdev->ports = AR7240_NUM_PORTS - 1; - } else if (sw_is_ar934x(as)) { - swdev->name = "AR934X built-in switch"; - phy_if_mode = of_get_phy_mode(as->of_node); - - if (phy_if_mode == PHY_INTERFACE_MODE_GMII) { - ar7240sw_reg_set(mii, AR934X_REG_OPER_MODE0, - AR934X_OPER_MODE0_MAC_GMII_EN); - } else if (phy_if_mode == PHY_INTERFACE_MODE_MII) { - ar7240sw_reg_set(mii, AR934X_REG_OPER_MODE0, - AR934X_OPER_MODE0_PHY_MII_EN); - } else { - pr_err("%s: invalid PHY interface mode\n", - dev_name(&mdiodev->dev)); - return -EINVAL; - } - - if (of_property_read_bool(as->of_node, "phy4-mii-enable")) { - ar7240sw_reg_set(mii, AR934X_REG_OPER_MODE1, - AR934X_REG_OPER_MODE1_PHY4_MII_EN); - swdev->ports = AR7240_NUM_PORTS - 1; - } else { - swdev->ports = AR7240_NUM_PORTS; - } - } else { - pr_err("%s: unsupported chip, ctrl=%08x\n", - dev_name(&mdiodev->dev), ctrl); - return -EINVAL; - } - - swdev->cpu_port = AR7240_PORT_CPU; - swdev->vlans = AR7240_MAX_VLANS; - swdev->ops = &ar7240_ops; - swdev->alias = dev_name(&mdiodev->dev); - - if ((err = register_switch(&as->swdev, NULL)) < 0) - return err; - - pr_info("%s: Found an %s\n", dev_name(&mdiodev->dev), swdev->name); - - as->switch_mii_bus = devm_mdiobus_alloc(&mdiodev->dev); - as->switch_mii_bus->name = "ar7240sw_mdio"; - as->switch_mii_bus->read = ar7240sw_phy_read; - as->switch_mii_bus->write = ar7240sw_phy_write; - as->switch_mii_bus->priv = as; - as->switch_mii_bus->parent = &mdiodev->dev; - snprintf(as->switch_mii_bus->id, MII_BUS_ID_SIZE, "%s", dev_name(&mdiodev->dev)); - - if(as->mdio_node) { - err = of_mdiobus_register(as->switch_mii_bus, as->mdio_node); - if (err) - return err; - } - - /* initialize defaults */ - for (i = 0; i < AR7240_MAX_VLANS; i++) - as->vlan_id[i] = i; - - as->vlan_table[0] = ar7240sw_port_mask_all(as); - ar7240sw_reset(as); - ar7240_hw_apply(&as->swdev); - rwlock_init(&as->stats_lock); - dev_set_drvdata(&mdiodev->dev, as); - return 0; -} - -static void -ag71xx_ar7240_remove(struct mdio_device *mdiodev) -{ - struct ar7240sw *as = dev_get_drvdata(&mdiodev->dev); - if(as->mdio_node) - mdiobus_unregister(as->switch_mii_bus); - unregister_switch(&as->swdev); -} - -static const struct of_device_id ag71xx_sw_of_match[] = { - { .compatible = "qca,ar8216-builtin" }, - { .compatible = "qca,ar8229-builtin" }, - { /* sentinel */ }, -}; - -static struct mdio_driver ag71xx_sw_driver = { - .probe = ag71xx_ar7240_probe, - .remove = ag71xx_ar7240_remove, - .mdiodrv.driver = { - .name = "ag71xx-switch", - .of_match_table = ag71xx_sw_of_match, - }, -}; - -mdio_module_driver(ag71xx_sw_driver); -MODULE_LICENSE("GPL"); diff --git a/target/linux/ath79/files/drivers/net/ethernet/atheros/ag71xx/ag71xx_ethtool.c b/target/linux/ath79/files/drivers/net/ethernet/atheros/ag71xx/ag71xx_ethtool.c index 6f37fda387..2cd7b1be83 100644 --- a/target/linux/ath79/files/drivers/net/ethernet/atheros/ag71xx/ag71xx_ethtool.c +++ b/target/linux/ath79/files/drivers/net/ethernet/atheros/ag71xx/ag71xx_ethtool.c @@ -13,30 +13,6 @@ #include "ag71xx.h" -static int ag71xx_ethtool_get_settings(struct net_device *dev, - struct ethtool_cmd *cmd) -{ - struct ag71xx *ag = netdev_priv(dev); - struct phy_device *phydev = ag->phy_dev; - - if (!phydev) - return -ENODEV; - - return phy_ethtool_ioctl(phydev, cmd); -} - -static int ag71xx_ethtool_set_settings(struct net_device *dev, - struct ethtool_cmd *cmd) -{ - struct ag71xx *ag = netdev_priv(dev); - struct phy_device *phydev = ag->phy_dev; - - if (!phydev) - return -ENODEV; - - return phy_ethtool_ioctl(phydev, cmd); -} - static u32 ag71xx_ethtool_get_msglevel(struct net_device *dev) { struct ag71xx *ag = netdev_priv(dev); @@ -108,13 +84,25 @@ static int ag71xx_ethtool_set_ringparam(struct net_device *dev, return err; } +static int ag71xx_ethtool_nway_reset(struct net_device *dev) +{ + struct ag71xx *ag = netdev_priv(dev); + struct phy_device *phydev = ag->phy_dev; + + if (!phydev) + return -ENODEV; + + return genphy_restart_aneg(phydev); +} + struct ethtool_ops ag71xx_ethtool_ops = { - .set_settings = ag71xx_ethtool_set_settings, - .get_settings = ag71xx_ethtool_get_settings, .get_msglevel = ag71xx_ethtool_get_msglevel, .set_msglevel = ag71xx_ethtool_set_msglevel, .get_ringparam = ag71xx_ethtool_get_ringparam, .set_ringparam = ag71xx_ethtool_set_ringparam, + .get_link_ksettings = phy_ethtool_get_link_ksettings, + .set_link_ksettings = phy_ethtool_set_link_ksettings, .get_link = ethtool_op_get_link, .get_ts_info = ethtool_op_get_ts_info, + .nway_reset = ag71xx_ethtool_nway_reset, }; diff --git a/target/linux/ath79/files/drivers/net/ethernet/atheros/ag71xx/ag71xx_gmac.c b/target/linux/ath79/files/drivers/net/ethernet/atheros/ag71xx/ag71xx_gmac.c index e69abb6438..cc0a15d3a4 100644 --- a/target/linux/ath79/files/drivers/net/ethernet/atheros/ag71xx/ag71xx_gmac.c +++ b/target/linux/ath79/files/drivers/net/ethernet/atheros/ag71xx/ag71xx_gmac.c @@ -53,6 +53,7 @@ static void ag71xx_setup_gmac_934x(struct device_node *np, void __iomem *base) ag71xx_of_bit(np, "rgmii-gmac0", &val, AR934X_ETH_CFG_RGMII_GMAC0); ag71xx_of_bit(np, "mii-gmac0", &val, AR934X_ETH_CFG_MII_GMAC0); + ag71xx_of_bit(np, "mii-gmac0-slave", &val, AR934X_ETH_CFG_MII_GMAC0_SLAVE); ag71xx_of_bit(np, "gmii-gmac0", &val, AR934X_ETH_CFG_GMII_GMAC0); ag71xx_of_bit(np, "switch-phy-swap", &val, AR934X_ETH_CFG_SW_PHY_SWAP); ag71xx_of_bit(np, "switch-only-mode", &val, diff --git a/target/linux/ath79/files/drivers/net/ethernet/atheros/ag71xx/ag71xx_main.c b/target/linux/ath79/files/drivers/net/ethernet/atheros/ag71xx/ag71xx_main.c index d809bbee80..b4ffa1154f 100644 --- a/target/linux/ath79/files/drivers/net/ethernet/atheros/ag71xx/ag71xx_main.c +++ b/target/linux/ath79/files/drivers/net/ethernet/atheros/ag71xx/ag71xx_main.c @@ -130,7 +130,7 @@ static void ag71xx_ring_tx_init(struct ag71xx *ag) { struct ag71xx_ring *ring = &ag->tx_ring; int ring_size = BIT(ring->order); - int ring_mask = ring_size - 1; + int ring_mask = BIT(ring->order) - 1; int i; for (i = 0; i < ring_size; i++) { @@ -162,7 +162,7 @@ static void ag71xx_ring_rx_clean(struct ag71xx *ag) for (i = 0; i < ring_size; i++) if (ring->buf[i].rx_buf) { - dma_unmap_single(&ag->dev->dev, ring->buf[i].dma_addr, + dma_unmap_single(&ag->pdev->dev, ring->buf[i].dma_addr, ag->rx_buf_size, DMA_FROM_DEVICE); skb_free_frag(ring->buf[i].rx_buf); } @@ -187,7 +187,7 @@ static bool ag71xx_fill_rx_buf(struct ag71xx *ag, struct ag71xx_buf *buf, return false; buf->rx_buf = data; - buf->dma_addr = dma_map_single(&ag->dev->dev, data, ag->rx_buf_size, + buf->dma_addr = dma_map_single(&ag->pdev->dev, data, ag->rx_buf_size, DMA_FROM_DEVICE); desc->data = (u32) buf->dma_addr + offset; return true; @@ -276,15 +276,15 @@ static int ag71xx_rings_init(struct ag71xx *ag) if (!tx->buf) return -ENOMEM; - tx->descs_cpu = dma_alloc_coherent(NULL, ring_size * AG71XX_DESC_SIZE, - &tx->descs_dma, GFP_ATOMIC); + tx->descs_cpu = dma_alloc_coherent(&ag->pdev->dev, ring_size * AG71XX_DESC_SIZE, + &tx->descs_dma, GFP_KERNEL); if (!tx->descs_cpu) { kfree(tx->buf); tx->buf = NULL; return -ENOMEM; } - rx->buf = &tx->buf[BIT(tx->order)]; + rx->buf = &tx->buf[tx_size]; rx->descs_cpu = ((void *)tx->descs_cpu) + tx_size * AG71XX_DESC_SIZE; rx->descs_dma = tx->descs_dma + tx_size * AG71XX_DESC_SIZE; @@ -299,7 +299,7 @@ static void ag71xx_rings_free(struct ag71xx *ag) int ring_size = BIT(tx->order) + BIT(rx->order); if (tx->descs_cpu) - dma_free_coherent(NULL, ring_size * AG71XX_DESC_SIZE, + dma_free_coherent(&ag->pdev->dev, ring_size * AG71XX_DESC_SIZE, tx->descs_cpu, tx->descs_dma); kfree(tx->buf); @@ -453,8 +453,12 @@ static void ag71xx_hw_init(struct ag71xx *ag) udelay(20); reset_control_assert(ag->mac_reset); + if (ag->mdio_reset) + reset_control_assert(ag->mdio_reset); msleep(100); reset_control_deassert(ag->mac_reset); + if (ag->mdio_reset) + reset_control_deassert(ag->mdio_reset); msleep(200); ag71xx_hw_setup(ag); @@ -759,10 +763,6 @@ static int ag71xx_hw_enable(struct ag71xx *ag) static void ag71xx_hw_disable(struct ag71xx *ag) { - unsigned long flags; - - spin_lock_irqsave(&ag->lock, flags); - netif_stop_queue(ag->dev); ag71xx_hw_stop(ag); @@ -771,8 +771,6 @@ static void ag71xx_hw_disable(struct ag71xx *ag) napi_disable(&ag->napi); del_timer_sync(&ag->oom_timer); - spin_unlock_irqrestore(&ag->lock, flags); - ag71xx_rings_cleanup(ag); } @@ -888,7 +886,7 @@ static netdev_tx_t ag71xx_hard_start_xmit(struct sk_buff *skb, goto err_drop; } - dma_addr = dma_map_single(&dev->dev, skb->data, skb->len, + dma_addr = dma_map_single(&ag->pdev->dev, skb->data, skb->len, DMA_TO_DEVICE); i = ring->curr & ring_mask; @@ -930,7 +928,7 @@ static netdev_tx_t ag71xx_hard_start_xmit(struct sk_buff *skb, return NETDEV_TX_OK; err_drop_unmap: - dma_unmap_single(&dev->dev, dma_addr, skb->len, DMA_TO_DEVICE); + dma_unmap_single(&ag->pdev->dev, dma_addr, skb->len, DMA_TO_DEVICE); err_drop: dev->stats.tx_dropped++; @@ -942,18 +940,9 @@ err_drop: static int ag71xx_do_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) { struct ag71xx *ag = netdev_priv(dev); - int ret; - - switch (cmd) { - case SIOCETHTOOL: - if (ag->phy_dev == NULL) - break; - spin_lock_irq(&ag->lock); - ret = phy_ethtool_ioctl(ag->phy_dev, (void *) ifr->ifr_data); - spin_unlock_irq(&ag->lock); - return ret; + switch (cmd) { case SIOCSIFHWADDR: if (copy_from_user (dev->dev_addr, ifr->ifr_data, sizeof(dev->dev_addr))) @@ -981,10 +970,16 @@ static int ag71xx_do_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) return -EOPNOTSUPP; } +#if (LINUX_VERSION_CODE < KERNEL_VERSION(4,15,0)) static void ag71xx_oom_timer_handler(unsigned long data) { struct net_device *dev = (struct net_device *) data; struct ag71xx *ag = netdev_priv(dev); +#else +static void ag71xx_oom_timer_handler(struct timer_list *t) +{ + struct ag71xx *ag = from_timer(ag, t, oom_timer); +#endif napi_schedule(&ag->napi); } @@ -1137,7 +1132,7 @@ static int ag71xx_rx_packets(struct ag71xx *ag, int limit) pktlen = desc->ctrl & pktlen_mask; pktlen -= ETH_FCS_LEN; - dma_unmap_single(&dev->dev, ring->buf[i].dma_addr, + dma_unmap_single(&ag->pdev->dev, ring->buf[i].dma_addr, ag->rx_buf_size, DMA_FROM_DEVICE); dev->stats.rx_packets++; @@ -1279,20 +1274,6 @@ static irqreturn_t ag71xx_interrupt(int irq, void *dev_id) return IRQ_HANDLED; } -#ifdef CONFIG_NET_POLL_CONTROLLER -/* - * Polling 'interrupt' - used by things like netconsole to send skbs - * without having to re-enable interrupts. It's not called while - * the interrupt routine is executing. - */ -static void ag71xx_netpoll(struct net_device *dev) -{ - disable_irq(dev->irq); - ag71xx_interrupt(dev->irq, dev); - enable_irq(dev->irq); -} -#endif - static int ag71xx_change_mtu(struct net_device *dev, int new_mtu) { struct ag71xx *ag = netdev_priv(dev); @@ -1313,35 +1294,11 @@ static const struct net_device_ops ag71xx_netdev_ops = { .ndo_change_mtu = ag71xx_change_mtu, .ndo_set_mac_address = eth_mac_addr, .ndo_validate_addr = eth_validate_addr, -#ifdef CONFIG_NET_POLL_CONTROLLER - .ndo_poll_controller = ag71xx_netpoll, -#endif }; -static const char *ag71xx_get_phy_if_mode_name(phy_interface_t mode) -{ - switch (mode) { - case PHY_INTERFACE_MODE_MII: - return "MII"; - case PHY_INTERFACE_MODE_GMII: - return "GMII"; - case PHY_INTERFACE_MODE_RMII: - return "RMII"; - case PHY_INTERFACE_MODE_RGMII: - return "RGMII"; - case PHY_INTERFACE_MODE_SGMII: - return "SGMII"; - default: - break; - } - - return "unknown"; -} - static int ag71xx_probe(struct platform_device *pdev) { struct device_node *np = pdev->dev.of_node; - struct device_node *mdio_node; struct net_device *dev; struct resource *res; struct ag71xx *ag; @@ -1352,7 +1309,7 @@ static int ag71xx_probe(struct platform_device *pdev) if (!np) return -ENODEV; - dev = alloc_etherdev(sizeof(*ag)); + dev = devm_alloc_etherdev(&pdev->dev, sizeof(*ag)); if (!dev) return -ENOMEM; @@ -1373,13 +1330,14 @@ static int ag71xx_probe(struct platform_device *pdev) AG71XX_DEFAULT_MSG_ENABLE); spin_lock_init(&ag->lock); - ag->mac_reset = devm_reset_control_get(&pdev->dev, "mac"); + ag->mac_reset = devm_reset_control_get_exclusive(&pdev->dev, "mac"); if (IS_ERR(ag->mac_reset)) { dev_err(&pdev->dev, "missing mac reset\n"); - err = PTR_ERR(ag->mac_reset); - goto err_free; + return PTR_ERR(ag->mac_reset); } + ag->mdio_reset = devm_reset_control_get_optional_exclusive(&pdev->dev, "mdio"); + if (of_property_read_u32_array(np, "fifo-data", ag->fifodata, 3)) { if (of_device_is_compatible(np, "qca,ar9130-eth") || of_device_is_compatible(np, "qca,ar7100-eth")) { @@ -1410,18 +1368,15 @@ static int ag71xx_probe(struct platform_device *pdev) ag->mac_base = devm_ioremap_nocache(&pdev->dev, res->start, res->end - res->start + 1); - if (!ag->mac_base) { - err = -ENOMEM; - goto err_free; - } + if (!ag->mac_base) + return -ENOMEM; + res = platform_get_resource(pdev, IORESOURCE_MEM, 1); if (res) { ag->mii_base = devm_ioremap_nocache(&pdev->dev, res->start, res->end - res->start + 1); - if (!ag->mii_base) { - err = -ENOMEM; - goto err_free; - } + if (!ag->mii_base) + return -ENOMEM; } dev->irq = platform_get_irq(pdev, 0); @@ -1429,7 +1384,7 @@ static int ag71xx_probe(struct platform_device *pdev) 0x0, dev_name(&pdev->dev), dev); if (err) { dev_err(&pdev->dev, "unable to request IRQ %d\n", dev->irq); - goto err_free; + return err; } dev->netdev_ops = &ag71xx_netdev_ops; @@ -1437,9 +1392,13 @@ static int ag71xx_probe(struct platform_device *pdev) INIT_DELAYED_WORK(&ag->restart_work, ag71xx_restart_work_func); +#if (LINUX_VERSION_CODE < KERNEL_VERSION(4,15,0)) init_timer(&ag->oom_timer); ag->oom_timer.data = (unsigned long) dev; ag->oom_timer.function = ag71xx_oom_timer_handler; +#else + timer_setup(&ag->oom_timer, ag71xx_oom_timer_handler, 0); +#endif tx_size = AG71XX_TX_RING_SIZE_DEFAULT; ag->rx_ring.order = ag71xx_ring_size_order(AG71XX_RX_RING_SIZE_DEFAULT); @@ -1462,7 +1421,14 @@ static int ag71xx_probe(struct platform_device *pdev) dev->min_mtu = 68; dev->max_mtu = max_frame_len - ag71xx_max_frame_len(0); - if (of_device_is_compatible(np, "qca,ar7240-eth")) + if (of_device_is_compatible(np, "qca,ar7240-eth") || + of_device_is_compatible(np, "qca,ar7241-eth") || + of_device_is_compatible(np, "qca,ar7242-eth") || + of_device_is_compatible(np, "qca,ar9330-eth") || + of_device_is_compatible(np, "qca,ar9340-eth") || + of_device_is_compatible(np, "qca,qca9530-eth") || + of_device_is_compatible(np, "qca,qca9550-eth") || + of_device_is_compatible(np, "qca,qca9560-eth")) ag->tx_hang_workaround = 1; ag->rx_buf_offset = NET_SKB_PAD; @@ -1480,7 +1446,7 @@ static int ag71xx_probe(struct platform_device *pdev) sizeof(struct ag71xx_desc), &ag->stop_desc_dma, GFP_KERNEL); if (!ag->stop_desc) - goto err_free; + return -ENOMEM; ag->stop_desc->data = 0; ag->stop_desc->ctrl = 0; @@ -1497,8 +1463,7 @@ static int ag71xx_probe(struct platform_device *pdev) ag->phy_if_mode = of_get_phy_mode(np); if (ag->phy_if_mode < 0) { dev_err(&pdev->dev, "missing phy-mode property in DT\n"); - err = ag->phy_if_mode; - goto err_free; + return ag->phy_if_mode; } if (of_property_read_u32(np, "qca,mac-idx", &ag->mac_idx)) @@ -1525,15 +1490,23 @@ static int ag71xx_probe(struct platform_device *pdev) ag71xx_dump_regs(ag); - if (!of_device_is_compatible(np, "simple-mfd")) { - mdio_node = of_get_child_by_name(np, "mdio-bus"); - if (!IS_ERR(mdio_node)) - of_platform_device_create(mdio_node, NULL, NULL); + /* + * populate current node to register mdio-bus as a subdevice. + * the mdio bus works independently on ar7241 and later chips + * and we need to load mdio1 before gmac0, which can be done + * by adding a "simple-mfd" compatible to gmac node. The + * following code checks OF_POPULATED_BUS flag before populating + * to avoid duplicated population. + */ + if (!of_node_check_flag(np, OF_POPULATED_BUS)) { + err = of_platform_populate(np, NULL, NULL, &pdev->dev); + if (err) + return err; } err = ag71xx_phy_connect(ag); if (err) - goto err_free; + return err; err = ag71xx_debugfs_init(ag); if (err) @@ -1549,16 +1522,14 @@ static int ag71xx_probe(struct platform_device *pdev) goto err_phy_disconnect; } - pr_info("%s: Atheros AG71xx at 0x%08lx, irq %d, mode:%s\n", + pr_info("%s: Atheros AG71xx at 0x%08lx, irq %d, mode: %s\n", dev->name, (unsigned long) ag->mac_base, dev->irq, - ag71xx_get_phy_if_mode_name(ag->phy_if_mode)); + phy_modes(ag->phy_if_mode)); return 0; err_phy_disconnect: ag71xx_phy_disconnect(ag); -err_free: - free_netdev(dev); return err; } @@ -1574,11 +1545,7 @@ static int ag71xx_remove(struct platform_device *pdev) ag71xx_debugfs_exit(ag); ag71xx_phy_disconnect(ag); unregister_netdev(dev); - free_irq(dev->irq, dev); - iounmap(ag->mac_base); - kfree(dev); platform_set_drvdata(pdev, NULL); - return 0; } diff --git a/target/linux/ath79/files/drivers/net/ethernet/atheros/ag71xx/ag71xx_mdio.c b/target/linux/ath79/files/drivers/net/ethernet/atheros/ag71xx/ag71xx_mdio.c index 58aef74872..a58ee3346b 100644 --- a/target/linux/ath79/files/drivers/net/ethernet/atheros/ag71xx/ag71xx_mdio.c +++ b/target/linux/ath79/files/drivers/net/ethernet/atheros/ag71xx/ag71xx_mdio.c @@ -190,7 +190,7 @@ static int ag71xx_mdio_probe(struct platform_device *pdev) if (!mii_bus) return -ENOMEM; - am->mdio_reset = of_reset_control_get_exclusive(np, "mdio"); + am->mdio_reset = devm_reset_control_get_exclusive(amdev, "mdio"); builtin_switch = of_property_read_bool(np, "builtin-switch"); mii_bus->name = "ag71xx_mdio"; diff --git a/target/linux/ath79/files/drivers/net/ethernet/atheros/ag71xx/ag71xx_phy.c b/target/linux/ath79/files/drivers/net/ethernet/atheros/ag71xx/ag71xx_phy.c index f9df38d530..ac1af26860 100644 --- a/target/linux/ath79/files/drivers/net/ethernet/atheros/ag71xx/ag71xx_phy.c +++ b/target/linux/ath79/files/drivers/net/ethernet/atheros/ag71xx/ag71xx_phy.c @@ -75,8 +75,8 @@ int ag71xx_phy_connect(struct ag71xx *ag) if (!ag->phy_dev) { dev_err(&ag->pdev->dev, - "Could not connect to PHY device\n"); - return -ENODEV; + "Could not connect to PHY device. Deferring probe.\n"); + return -EPROBE_DEFER; } dev_info(&ag->pdev->dev, "connected to PHY at %s [uid=%08x, driver=%s]\n", diff --git a/target/linux/ath79/generic/config-default b/target/linux/ath79/generic/config-default index fddcb1d704..313ab8604b 100644 --- a/target/linux/ath79/generic/config-default +++ b/target/linux/ath79/generic/config-default @@ -8,6 +8,7 @@ CONFIG_LEDS_RESET=y CONFIG_MARVELL_PHY=y CONFIG_MICREL_PHY=y CONFIG_MTD_REDBOOT_PARTS=y +CONFIG_MTD_REDBOOT_DIRECTORY_BLOCK=-2 CONFIG_MTD_SPLIT_EVA_FW=y CONFIG_OF_ADDRESS_PCI=y CONFIG_OF_PCI=y diff --git a/target/linux/ath79/image/Makefile b/target/linux/ath79/image/Makefile index 8f9ba594b1..734f27e689 100644 --- a/target/linux/ath79/image/Makefile +++ b/target/linux/ath79/image/Makefile @@ -69,6 +69,7 @@ endef ifeq ($(SUBTARGET),generic) include ./generic.mk include ./generic-tp-link.mk +include ./generic-ubnt.mk endif ifeq ($(SUBTARGET),nand) include ./nand.mk diff --git a/target/linux/ath79/image/common-netgear.mk b/target/linux/ath79/image/common-netgear.mk index 5dfcd38a92..9b79936295 100644 --- a/target/linux/ath79/image/common-netgear.mk +++ b/target/linux/ath79/image/common-netgear.mk @@ -19,6 +19,23 @@ define Build/netgear-squashfs rm -rf $@.squashfs $@.fs endef +define Build/netgear-rootfs + mkimage \ + -A mips -O linux -T filesystem -C none \ + -M $(NETGEAR_KERNEL_MAGIC) \ + -n '$(VERSION_DIST) filesystem' \ + -d $(IMAGE_ROOTFS) $@.fs + cat $@.fs >> $@ + rm -rf $@.fs +endef + define Build/netgear-uImage $(call Build/uImage,$(1) -M $(NETGEAR_KERNEL_MAGIC)) endef + +define Device/netgear_ath79 + KERNEL := kernel-bin | append-dtb | lzma -d20 | netgear-uImage lzma + IMAGES += factory.img + IMAGE/sysupgrade.bin := $$(IMAGE/default) | append-metadata | check-size $$$$(IMAGE_SIZE) + IMAGE/factory.img := $$(IMAGE/default) | netgear-dni | check-size $$$$(IMAGE_SIZE) +endef diff --git a/target/linux/ath79/image/common-tp-link.mk b/target/linux/ath79/image/common-tp-link.mk index 34d5fe3fa1..0960102e56 100644 --- a/target/linux/ath79/image/common-tp-link.mk +++ b/target/linux/ath79/image/common-tp-link.mk @@ -99,8 +99,9 @@ endef define Device/tplink-safeloader $(Device/tplink) - KERNEL := kernel-bin | append-dtb | lzma | tplink-v1-header - IMAGE/sysupgrade.bin := append-rootfs | tplink-safeloader sysupgrade | append-metadata + KERNEL := kernel-bin | append-dtb | lzma | tplink-v1-header -O + IMAGE/sysupgrade.bin := append-rootfs | tplink-safeloader sysupgrade | \ + append-metadata | check-size $$$$(IMAGE_SIZE) IMAGE/factory.bin := append-rootfs | tplink-safeloader factory endef diff --git a/target/linux/ath79/image/generic-tp-link.mk b/target/linux/ath79/image/generic-tp-link.mk index 2d28b47325..02e0b7a5c1 100644 --- a/target/linux/ath79/image/generic-tp-link.mk +++ b/target/linux/ath79/image/generic-tp-link.mk @@ -1,5 +1,11 @@ include ./common-tp-link.mk + + + + + + define Device/tplink_archer-c5-v1 $(Device/tplink-16mlzma) ATH_SOC := qca9558 @@ -16,6 +22,7 @@ define Device/tplink_archer-c7-v1 DEVICE_TITLE := TP-Link Archer C7 v1 DEVICE_PACKAGES := kmod-usb-core kmod-usb2 kmod-usb-ledtrig-usbport TPLINK_HWID := 0x75000001 + SUPPORTED_DEVICES += archer-c7 endef TARGET_DEVICES += tplink_archer-c7-v1 @@ -25,31 +32,61 @@ define Device/tplink_archer-c7-v2 DEVICE_TITLE := TP-Link Archer C7 v2 DEVICE_PACKAGES := kmod-usb-core kmod-usb2 kmod-usb-ledtrig-usbport TPLINK_HWID := 0xc7000002 + SUPPORTED_DEVICES += archer-c7 IMAGES += factory-us.bin factory-eu.bin IMAGE/factory-us.bin := append-rootfs | mktplinkfw factory -C US IMAGE/factory-eu.bin := append-rootfs | mktplinkfw factory -C EU endef TARGET_DEVICES += tplink_archer-c7-v2 -define Device/tplink_tl-wdr3600 + + +define Device/tplink_cpe210-v2 + $(Device/tplink-safeloader) + ATH_SOC := qca9533 + IMAGE_SIZE := 7680k + DEVICE_TITLE := TP-Link CPE210 v2 + TPLINK_BOARD_ID := CPE210V2 + DEVICE_PACKAGES := rssileds + LOADER_TYPE := elf + SUPPORTED_DEVICES += cpe210-v2 +endef +TARGET_DEVICES += tplink_cpe210-v2 + +define Device/tplink_cpe210-v3 + $(Device/tplink-safeloader) + ATH_SOC := qca9533 + IMAGE_SIZE := 7680k + DEVICE_TITLE := TP-Link CPE210 v3 + DEVICE_PACKAGES := rssileds + TPLINK_BOARD_ID := CPE210V3 + LOADER_TYPE := elf + SUPPORTED_DEVICES += cpe210-v3 +endef +TARGET_DEVICES += tplink_cpe210-v3 + + + + +define Device/tplink_tl-wdr3600-v1 $(Device/tplink-8mlzma) ATH_SOC := ar9344 - DEVICE_TITLE := TP-Link TL-WDR3600 + DEVICE_TITLE := TP-Link TL-WDR3600 v1 DEVICE_PACKAGES := kmod-usb-core kmod-usb2 kmod-usb-ledtrig-usbport TPLINK_HWID := 0x36000001 SUPPORTED_DEVICES += tl-wdr4300 endef -TARGET_DEVICES += tplink_tl-wdr3600 +TARGET_DEVICES += tplink_tl-wdr3600-v1 -define Device/tplink_tl-wdr4300 +define Device/tplink_tl-wdr4300-v1 $(Device/tplink-8mlzma) ATH_SOC := ar9344 - DEVICE_TITLE := TP-Link TL-WDR4300 + DEVICE_TITLE := TP-Link TL-WDR4300 v1 DEVICE_PACKAGES := kmod-usb-core kmod-usb2 kmod-usb-ledtrig-usbport TPLINK_HWID := 0x43000001 SUPPORTED_DEVICES += tl-wdr4300 endef -TARGET_DEVICES += tplink_tl-wdr4300 +TARGET_DEVICES += tplink_tl-wdr4300-v1 define Device/tplink_tl-wdr4900-v2 $(Device/tplink-8mlzma) @@ -60,16 +97,6 @@ define Device/tplink_tl-wdr4900-v2 endef TARGET_DEVICES += tplink_tl-wdr4900-v2 -define Device/tplink_tl-wr1043nd-v1 - $(Device/tplink-8m) - ATH_SOC := ar9132 - DEVICE_TITLE := TP-Link TL-WR1043N/ND v1 - DEVICE_PACKAGES := kmod-usb-core kmod-usb2 kmod-usb-ledtrig-usbport - TPLINK_HWID := 0x10430001 - SUPPORTED_DEVICES += tl-wr1043nd -endef -TARGET_DEVICES += tplink_tl-wr1043nd-v1 - define Device/tplink_tl-wr810n-v1 $(Device/tplink-8mlzma) ATH_SOC := qca9531 @@ -87,6 +114,16 @@ define Device/tplink_tl-wr810n-v2 endef TARGET_DEVICES += tplink_tl-wr810n-v2 +define Device/tplink_tl-wr710n-v1 + $(Device/tplink-8mlzma) + ATH_SOC := ar9331 + DEVICE_TITLE := TP-Link TL-WR710N v1 + DEVICE_PACKAGES := kmod-usb-core kmod-usb-chipidea2 kmod-usb-ledtrig-usbport + TPLINK_HWID := 0x07100001 + SUPPORTED_DEVICES += tl-wr710n +endef +TARGET_DEVICES += tplink_tl-wr710n-v1 + define Device/tplink_tl-wr842n-v1 $(Device/tplink-8m) ATH_SOC := ar7241 @@ -106,6 +143,26 @@ define Device/tplink_tl-wr842n-v2 endef TARGET_DEVICES += tplink_tl-wr842n-v2 +define Device/tplink_tl-wr842n-v3 + $(Device/tplink-16mlzma) + ATH_SOC := qca9533 + DEVICE_TITLE := TP-Link TL-WR842N v3 + DEVICE_PACKAGES := kmod-usb-core kmod-usb2 kmod-usb-ledtrig-usbport + TPLINK_HWID := 0x8420003 + SUPPORTED_DEVICES += tl-wr842n-v3 +endef +TARGET_DEVICES += tplink_tl-wr842n-v3 + +define Device/tplink_tl-wr1043nd-v1 + $(Device/tplink-8m) + ATH_SOC := ar9132 + DEVICE_TITLE := TP-Link TL-WR1043N/ND v1 + DEVICE_PACKAGES := kmod-usb-core kmod-usb2 kmod-usb-ledtrig-usbport + TPLINK_HWID := 0x10430001 + SUPPORTED_DEVICES += tl-wr1043nd +endef +TARGET_DEVICES += tplink_tl-wr1043nd-v1 + define Device/tplink_tl-wr1043nd-v2 $(Device/tplink-8mlzma) ATH_SOC := qca9558 @@ -127,21 +184,27 @@ endef TARGET_DEVICES += tplink_tl-wr1043nd-v3 define Device/tplink_tl-wr1043nd-v4 - $(Device/tplink) + $(Device/tplink-safeloader) ATH_SOC := qca9563 IMAGE_SIZE := 15552k DEVICE_TITLE := TP-Link TL-WR1043N/ND v4 DEVICE_PACKAGES := kmod-usb-core kmod-usb2 kmod-usb-ledtrig-usbport TPLINK_HWID := 0x10430004 TPLINK_BOARD_ID := TLWR1043NDV4 - KERNEL := kernel-bin | append-dtb | lzma | tplink-v1-header -O - IMAGE/sysupgrade.bin := append-rootfs | tplink-safeloader sysupgrade | \ - append-metadata | check-size $$$$(IMAGE_SIZE) - IMAGE/factory.bin := append-rootfs | tplink-safeloader factory SUPPORTED_DEVICES += tl-wr1043nd-v4 endef TARGET_DEVICES += tplink_tl-wr1043nd-v4 +define Device/tplink_tl-wr1043n-v5 + $(Device/tplink-safeloader-uimage) + ATH_SOC := qca9563 + IMAGE_SIZE := 15104k + DEVICE_TITLE := TP-Link TL-WR1043N v5 + TPLINK_BOARD_ID := TLWR1043NV5 + SUPPORTED_DEVICES += tl-wr1043n-v5 +endef +TARGET_DEVICES += tplink_tl-wr1043n-v5 + define Device/tplink_tl-wr2543-v1 $(Device/tplink-8mlzma) ATH_SOC := ar7242 diff --git a/target/linux/ath79/image/generic-ubnt.mk b/target/linux/ath79/image/generic-ubnt.mk new file mode 100644 index 0000000000..6f2f7d9dec --- /dev/null +++ b/target/linux/ath79/image/generic-ubnt.mk @@ -0,0 +1,243 @@ +DEVICE_VARS += UBNT_BOARD UBNT_CHIP UBNT_TYPE UBNT_VERSION UBNT_REVISION + +# On M (XW) devices the U-Boot as of version 1.1.4-s1039 doesn't like +# VERSION_DIST being on the place of major(?) version number, so we need to +# use some number. +UBNT_REVISION := $(VERSION_DIST)-$(REVISION) + +# mkubntimage is using the kernel image direct +# routerboard creates partitions out of the ubnt header +define Build/mkubntimage + -$(STAGING_DIR_HOST)/bin/mkfwimage \ + -B $(UBNT_BOARD) -v $(UBNT_TYPE).$(UBNT_CHIP).v6.0.0-$(VERSION_DIST)-$(REVISION) \ + -k $(IMAGE_KERNEL) \ + -r $@ \ + -o $@ +endef + +# all UBNT XM/WA devices expect the kernel image to have 1024k while flash, when +# booting the image, the size doesn't matter. +define Build/mkubntimage-split + -[ -f $@ ] && ( \ + dd if=$@ of=$@.old1 bs=1024k count=1; \ + dd if=$@ of=$@.old2 bs=1024k skip=1; \ + $(STAGING_DIR_HOST)/bin/mkfwimage \ + -B $(UBNT_BOARD) -v $(UBNT_TYPE).$(UBNT_CHIP).v$(UBNT_VERSION)-$(UBNT_REVISION) \ + -k $@.old1 \ + -r $@.old2 \ + -o $@; \ + rm $@.old1 $@.old2 ) +endef + +# UBNT_BOARD e.g. one of (XS2, XS5, RS, XM) +# UBNT_TYPE e.g. one of (BZ, XM, XW) +# UBNT_CHIP e.g. one of (ar7240, ar933x, ar934x) +# UBNT_VERSION e.g. one of (6.0.0, 8.5.0) +define Device/ubnt + DEVICE_PACKAGES := kmod-usb-core kmod-usb2 + IMAGE_SIZE := 7552k + UBNT_BOARD := XM + UBNT_VERSION := 6.0.0 + IMAGES += factory.bin + IMAGE/factory.bin := append-kernel | pad-to $$$$(BLOCKSIZE) | \ + append-rootfs | pad-rootfs | check-size $$$$(IMAGE_SIZE) | mkubntimage-split +endef + +define Device/ubnt-xm + $(Device/ubnt) + DEVICE_PACKAGES += kmod-usb-ohci rssileds + UBNT_TYPE := XM + UBNT_CHIP := ar7240 + ATH_SOC := ar7241 + KERNEL := kernel-bin | append-dtb | relocate-kernel | lzma | uImage lzma +endef + +define Device/ubnt-bz + $(Device/ubnt) + UBNT_TYPE := BZ + UBNT_CHIP := ar7240 + ATH_SOC := ar7241 +endef + +define Device/ubnt-wa + $(Device/ubnt) + UBNT_TYPE := WA + UBNT_CHIP := ar934x + UBNT_BOARD := WA + UBNT_VERSION := 8.5.0 + ATH_SOC := ar9342 +endef + +define Device/ubnt-xw + $(Device/ubnt) + UBNT_TYPE := XW + UBNT_CHIP := ar934x + UBNT_BOARD := XM + UBNT_VERSION := 6.0.4 + UBNT_REVISION := 42.$(UBNT_REVISION) + ATH_SOC := ar9342 +endef + +define Device/ubnt_airrouter + $(Device/ubnt-xm) + DEVICE_TITLE := Ubiquiti AirRouter + SUPPORTED_DEVICES += airrouter +endef +TARGET_DEVICES += ubnt_airrouter + +define Device/ubnt_bullet-m + $(Device/ubnt-xm) + DEVICE_TITLE := Ubiquiti Bullet-M + SUPPORTED_DEVICES += bullet-m +endef +TARGET_DEVICES += ubnt_bullet-m + +define Device/ubnt_bullet-m-xw + $(Device/ubnt-xw) + DEVICE_TITLE := Ubiquiti Bullet-M (XW) + SUPPORTED_DEVICES += bullet-m-xw +endef +TARGET_DEVICES += ubnt_bullet-m-xw + +define Device/ubnt_rocket-m + $(Device/ubnt-xm) + DEVICE_TITLE := Ubiquiti Rocket-M + SUPPORTED_DEVICES += rocket-m +endef +TARGET_DEVICES += ubnt_rocket-m + +define Device/ubnt_nanostation-m + $(Device/ubnt-xm) + DEVICE_TITLE := Ubiquiti Nanostation M + SUPPORTED_DEVICES += nano-m +endef +TARGET_DEVICES += ubnt_nanostation-m + +define Device/ubnt_nanostation-m-xw + $(Device/ubnt-xw) + DEVICE_TITLE := Ubiquiti Nanostation M (XW) + SUPPORTED_DEVICES += nano-m-xw +endef +TARGET_DEVICES += ubnt_nanostation-m-xw + +define Device/ubnt_lap-120 + $(Device/ubnt-wa) + DEVICE_TITLE := Ubiquiti LiteAP ac (LAP-120) + DEVICE_PACKAGES += + IMAGE_SIZE := 15744k + IMAGE/factory.bin := $$(IMAGE/sysupgrade.bin) | mkubntimage-split +endef +TARGET_DEVICES += ubnt_lap-120 + +define Device/ubnt_nanobeam-ac + $(Device/ubnt-wa) + DEVICE_TITLE := Ubiquiti NanoBeam AC + DEVICE_PACKAGES += + IMAGE_SIZE := 15744k + IMAGE/factory.bin := $$(IMAGE/sysupgrade.bin) | mkubntimage-split +endef +TARGET_DEVICES += ubnt_nanobeam-ac + +define Device/ubnt_nanostation-ac + $(Device/ubnt-wa) + DEVICE_TITLE := Ubiquiti Nanostation AC + DEVICE_PACKAGES += + IMAGE_SIZE := 15744k + IMAGE/factory.bin := $$(IMAGE/sysupgrade.bin) | mkubntimage-split +endef +TARGET_DEVICES += ubnt_nanostation-ac + +define Device/ubnt_nanostation-ac-loco + $(Device/ubnt-wa) + DEVICE_TITLE := Ubiquiti Nanostation AC loco + DEVICE_PACKAGES += + IMAGE_SIZE := 15744k + IMAGE/factory.bin := $$(IMAGE/sysupgrade.bin) | mkubntimage-split +endef +TARGET_DEVICES += ubnt_nanostation-ac-loco + +define Device/ubnt_unifi + $(Device/ubnt-bz) + DEVICE_TITLE := Ubiquiti UniFi + SUPPORTED_DEVICES += unifi +endef +TARGET_DEVICES += ubnt_unifi + +define Device/ubnt_unifiac + ATH_SOC := qca9563 + IMAGE_SIZE := 7744k + DEVICE_PACKAGES := +endef + + +define Device/ubnt_unifiac-lite + $(Device/ubnt_unifiac) + DEVICE_TITLE := Ubiquiti UniFi AC-Lite + SUPPORTED_DEVICES += ubnt-unifiac-lite +endef +TARGET_DEVICES += ubnt_unifiac-lite + +define Device/ubnt_unifiac-mesh + $(Device/ubnt_unifiac) + DEVICE_TITLE := Ubiquiti UniFi AC-Mesh + SUPPORTED_DEVICES += ubnt-unifiac-mesh +endef +TARGET_DEVICES += ubnt_unifiac-mesh + +define Device/ubnt_unifiac-mesh-pro + $(Device/ubnt_unifiac) + DEVICE_TITLE := Ubiquiti UniFi AC-Mesh Pro + SUPPORTED_DEVICES += ubnt-unifiac-mesh-pro +endef +TARGET_DEVICES += ubnt_unifiac-mesh-pro + +define Device/ubnt_unifiac-pro + $(Device/ubnt_unifiac) + DEVICE_TITLE := Ubiquiti UniFi AC-Pro + DEVICE_PACKAGES += kmod-usb-core kmod-usb2 + SUPPORTED_DEVICES += ubnt-unifiac-pro +endef +TARGET_DEVICES += ubnt_unifiac-pro + +define Device/ubnt_routerstation_common + DEVICE_PACKAGES := -kmod-ath9k -wpad-mini -uboot-envtools kmod-usb-ohci kmod-usb2 fconfig + ATH_SOC := ar7161 + IMAGE_SIZE := 16128k + IMAGES += factory.bin + IMAGE/factory.bin := append-rootfs | pad-rootfs | mkubntimage | check-size $$$$(IMAGE_SIZE) + IMAGE/sysupgrade.bin := append-rootfs | pad-rootfs | combined-image | check-size $$$$(IMAGE_SIZE) +# IMAGE/sysupgrade.bin := append-rootfs | pad-rootfs | check-size $$$$(IMAGE_SIZE) | sysupgrade-tar rootfs=$$$$@ | append-metadata + KERNEL := kernel-bin | append-dtb | lzma | pad-to $$(BLOCKSIZE) + KERNEL_INITRAMFS := kernel-bin | append-dtb +endef + +define Device/ubnt_routerstation + $(Device/ubnt_routerstation_common) + DEVICE_TITLE := Ubiquiti RouterStation + UBNT_BOARD := RS + UBNT_TYPE := RSx + UBNT_CHIP := ar7100 + DEVICE_PACKAGES += -swconfig +endef +TARGET_DEVICES += ubnt_routerstation + +define Device/ubnt_routerstation-pro + $(Device/ubnt_routerstation_common) + DEVICE_TITLE := Ubiquiti RouterStation Pro + UBNT_BOARD := RSPRO + UBNT_TYPE := RSPRO + UBNT_CHIP := ar7100pro +endef +TARGET_DEVICES += ubnt_routerstation-pro + +define Device/ubnt_acb-isp + $(Device/ubnt) + ATH_SOC := qca9533 + IMAGE_SIZE := 15744k + DEVICE_TITLE := Ubiquiti airCube ISP + UBNT_BOARD := ACB-ISP + UBNT_TYPE := ACB + UBNT_CHIP := qca9533 + IMAGES := sysupgrade.bin +endef +TARGET_DEVICES += ubnt_acb-isp diff --git a/target/linux/ath79/image/generic.mk b/target/linux/ath79/image/generic.mk index 5198696435..43304fa226 100644 --- a/target/linux/ath79/image/generic.mk +++ b/target/linux/ath79/image/generic.mk @@ -42,6 +42,12 @@ define Build/add-elecom-factory-initramfs fi endef +define Build/nec-enc + $(STAGING_DIR_HOST)/bin/nec-enc \ + -i $@ -o $@.new -k $(1) + mv $@.new $@ +endef + define Build/nec-fw ( stat -c%s $@ | tr -d "\n" | dd bs=16 count=1 conv=sync; ) >> $@ ( \ @@ -69,6 +75,23 @@ define Device/seama SEAMA_SIGNATURE := endef +define Device/8dev_carambola2 + ATH_SOC := ar9331 + DEVICE_TITLE := 8devices Carambola2 + DEVICE_PACKAGES := kmod-usb2 kmod-usb-chipidea2 + IMAGE_SIZE := 16000k + SUPPORTED_DEVICES += carambola2 +endef +TARGET_DEVICES += 8dev_carambola2 + +define Device/aruba_ap-105 + ATH_SOC := ar7161 + DEVICE_TITLE := Aruba AP-105 + IMAGE_SIZE := 16000k + DEVICE_PACKAGES := kmod-i2c-core kmod-i2c-gpio kmod-tpm-i2c-atmel +endef +TARGET_DEVICES += aruba_ap-105 + define Device/avm_fritz300e ATH_SOC := ar7242 DEVICE_TITLE := AVM FRITZ!WLAN Repeater 300E @@ -171,6 +194,21 @@ define Device/comfast_cf-e120a-v3 endef TARGET_DEVICES += comfast_cf-e120a-v3 +define Device/comfast_cf-e5 + ATH_SOC := qca9531 + DEVICE_TITLE := COMFAST CF-E5/E7 + DEVICE_PACKAGES := rssileds kmod-leds-gpio kmod-usb-core kmod-usb2 kmod-usb-net \ + kmod-usb-net-qmi-wwan -swconfig -uboot-envtools + IMAGE_SIZE := 16192k +endef +TARGET_DEVICES += comfast_cf-e5 + + + + + + + define Device/dlink_dir-825-b1 ATH_SOC := ar7161 DEVICE_TITLE := D-LINK DIR-825 B1 @@ -209,6 +247,8 @@ define Device/dlink_dir-835-a1 endef TARGET_DEVICES += dlink_dir-835-a1 + + define Device/elecom_wrc-300ghbk2-i ATH_SOC := qca9563 DEVICE_TITLE := ELECOM WRC-300GHBK2-I @@ -226,6 +266,9 @@ define Device/embeddedwireless_dorin endef TARGET_DEVICES += embeddedwireless_dorin + + + define Device/etactica_eg200 ATH_SOC := ar9331 DEVICE_TITLE := eTactica EG200 @@ -244,19 +287,29 @@ define Device/glinet_gl-ar150 endef TARGET_DEVICES += glinet_gl-ar150 -define Device/glinet_gl-ar300m-nor +define Device/glinet_gl-ar300m-common-nor ATH_SOC := qca9531 - DEVICE_TITLE := GL.iNet GL-AR300M DEVICE_PACKAGES := kmod-usb-core kmod-usb2 IMAGE_SIZE := 16000k SUPPORTED_DEVICES += gl-ar300m endef + +define Device/glinet_gl-ar300m-lite + $(Device/glinet_gl-ar300m-common-nor) + DEVICE_TITLE := GL.iNet GL-AR300M-Lite +endef +TARGET_DEVICES += glinet_gl-ar300m-lite + +define Device/glinet_gl-ar300m-nor + $(Device/glinet_gl-ar300m-common-nor) + DEVICE_TITLE := GL.iNet GL-AR300M +endef TARGET_DEVICES += glinet_gl-ar300m-nor define Device/glinet_gl-ar750s ATH_SOC := qca9563 DEVICE_TITLE := GL.iNet GL-AR750S - DEVICE_PACKAGES := kmod-usb2 + DEVICE_PACKAGES := kmod-usb2 block-mount IMAGE_SIZE := 16000k SUPPORTED_DEVICES += gl-ar750s endef @@ -274,9 +327,13 @@ define Device/iodata_etg3-r ATH_SOC := ar9342 DEVICE_TITLE := I-O DATA ETG3-R IMAGE_SIZE := 7680k + DEVICE_PACKAGES := -iwinfo -kmod-ath9k -wpad-basic endef TARGET_DEVICES += iodata_etg3-r + + + define Device/iodata_wn-ag300dgr ATH_SOC := ar1022 DEVICE_TITLE := I-O DATA WN-AG300DGR @@ -289,6 +346,29 @@ define Device/iodata_wn-ag300dgr endef TARGET_DEVICES += iodata_wn-ag300dgr +define Device/jjplus_ja76pf2 + ATH_SOC := ar7161 + DEVICE_TITLE := jjPlus JA76PF2 + DEVICE_PACKAGES += -kmod-ath9k -swconfig -wpad-mini -uboot-envtools fconfig + IMAGE/sysupgrade.bin := append-rootfs | pad-rootfs | combined-image | check-size $$$$(IMAGE_SIZE) +# IMAGE/sysupgrade.bin := append-rootfs | pad-rootfs | check-size $$$$(IMAGE_SIZE) | sysupgrade-tar rootfs=$$$$@ | append-metadata + KERNEL := kernel-bin | append-dtb | lzma | pad-to $$(BLOCKSIZE) + KERNEL_INITRAMFS := kernel-bin | append-dtb + IMAGE_SIZE := 16000k +endef +TARGET_DEVICES += jjplus_ja76pf2 + +define Device/librerouter_librerouter-v1 + ATH_SOC := qca9558 + DEVICE_TITLE := LibreRouter v1 + IMAGE_SIZE := 7936k + DEVICE_PACKAGES := kmod-usb-core kmod-usb2 +endef +TARGET_DEVICES += librerouter_librerouter-v1 + + + + define Device/ocedo_raccoon ATH_SOC := ar9344 DEVICE_TITLE := OCEDO Raccoon @@ -297,6 +377,8 @@ define Device/ocedo_raccoon endef TARGET_DEVICES += ocedo_raccoon + + define Device/pcs_cap324 ATH_SOC := ar9344 DEVICE_TITLE := PowerCloud Systems CAP324 @@ -324,14 +406,13 @@ TARGET_DEVICES += pcs_cr5000 define Device/netgear_wndr3x00 ATH_SOC := ar7161 - KERNEL := kernel-bin | append-dtb | lzma -d20 | netgear-uImage lzma - IMAGES += factory.img IMAGE/default := append-kernel | pad-to $$$$(BLOCKSIZE) | netgear-squashfs | append-rootfs | pad-rootfs - IMAGE/sysupgrade.bin := $$(IMAGE/default) | append-metadata | check-size $$$$(IMAGE_SIZE) - IMAGE/factory.img := $$(IMAGE/default) | netgear-dni | check-size $$$$(IMAGE_SIZE) DEVICE_PACKAGES := kmod-usb-core kmod-usb-ohci kmod-usb2 kmod-usb-ledtrig-usbport kmod-leds-reset kmod-owl-loader + $(Device/netgear_ath79) endef + + define Device/netgear_wndr3700 $(Device/netgear_wndr3x00) DEVICE_TITLE := NETGEAR WNDR3700 @@ -375,6 +456,7 @@ define Device/netgear_wndr3800 endef TARGET_DEVICES += netgear_wndr3800 + define Device/rosinson_wr818 ATH_SOC := qca9563 DEVICE_TITLE := ROSINSON WR818 @@ -383,6 +465,17 @@ define Device/rosinson_wr818 endef TARGET_DEVICES += rosinson_wr818 +define Device/wd_mynet-n750 + $(Device/seama) + ATH_SOC := ar9344 + DEVICE_TITLE := Western Digital My Net N750 + IMAGE_SIZE := 15872k + DEVICE_PACKAGES := kmod-usb-core kmod-usb2 + SEAMA_SIGNATURE := wrgnd13_wd_av + SUPPORTED_DEVICES += mynet-n750 +endef +TARGET_DEVICES += wd_mynet-n750 + define Device/wd_mynet-wifi-rangeextender ATH_SOC := ar9344 DEVICE_TITLE := Western Digital My Net Wi-Fi Range Extender @@ -410,3 +503,13 @@ define Device/xiaomi_mi-router-4q IMAGE_SIZE := 14336k endef TARGET_DEVICES += xiaomi_mi-router-4q + + +define Device/zbtlink_zbt-wd323 + ATH_SOC := ar9344 + DEVICE_TITLE := ZBT WD323 + IMAGE_SIZE := 16000k + DEVICE_PACKAGES := kmod-usb2 kmod-i2c-core kmod-i2c-gpio kmod-rtc-pcf8563 \ + kmod-usb-serial kmod-usb-serial-cp210x uqmi +endef +TARGET_DEVICES += zbtlink_zbt-wd323 diff --git a/target/linux/ath79/image/tiny-netgear.mk b/target/linux/ath79/image/tiny-netgear.mk index 8d0de15a1b..42d6cab8bd 100644 --- a/target/linux/ath79/image/tiny-netgear.mk +++ b/target/linux/ath79/image/tiny-netgear.mk @@ -1,35 +1,27 @@ include ./common-netgear.mk - -define Device/netgear_wnr612-v2 +define Device/netgear_ar7240 ATH_SOC := ar7240 - DEVICE_TITLE := Netgear WNR612v2 - DEVICE_DTS := ar7240_netgear_wnr612-v2 NETGEAR_KERNEL_MAGIC := 0x32303631 - KERNEL := kernel-bin | append-dtb | lzma -d20 | netgear-uImage lzma KERNEL_INITRAMFS := kernel-bin | append-dtb | lzma -d20 | netgear-uImage lzma - NETGEAR_BOARD_ID := REALWNR612V2 IMAGE_SIZE := 3904k - IMAGES += factory.img IMAGE/default := append-kernel | pad-to $$$$(BLOCKSIZE) | netgear-squashfs | append-rootfs | pad-rootfs - IMAGE/sysupgrade.bin := $$(IMAGE/default) | append-metadata | check-size $$$$(IMAGE_SIZE) - IMAGE/factory.img := $$(IMAGE/default) | netgear-dni | check-size $$$$(IMAGE_SIZE) + $(Device/netgear_ath79) +endef + +define Device/netgear_wnr612-v2 + $(Device/netgear_ar7240) + DEVICE_TITLE := Netgear WNR612v2 + DEVICE_DTS := ar7240_netgear_wnr612-v2 + NETGEAR_BOARD_ID := REALWNR612V2 SUPPORTED_DEVICES += wnr612-v2 endef TARGET_DEVICES += netgear_wnr612-v2 define Device/on_n150r - ATH_SOC := ar7240 + $(Device/netgear_ar7240) DEVICE_TITLE := ON Network N150R - NETGEAR_KERNEL_MAGIC := 0x32303631 - KERNEL := kernel-bin | append-dtb | lzma -d20 | netgear-uImage lzma - KERNEL_INITRAMFS := kernel-bin | append-dtb | lzma -d20 | netgear-uImage lzma NETGEAR_BOARD_ID := N150R - IMAGE_SIZE := 3904k - IMAGES += factory.img - IMAGE/default := append-kernel | pad-to $$$$(BLOCKSIZE) | netgear-squashfs | append-rootfs | pad-rootfs - IMAGE/sysupgrade.bin := $$(IMAGE/default) | append-metadata | check-size $$$$(IMAGE_SIZE) - IMAGE/factory.img := $$(IMAGE/default) | netgear-dni | check-size $$$$(IMAGE_SIZE) SUPPORTED_DEVICES += n150r endef TARGET_DEVICES += on_n150r diff --git a/target/linux/ath79/image/tiny-tp-link.mk b/target/linux/ath79/image/tiny-tp-link.mk index 8847ca57e5..fb8ab75cb1 100644 --- a/target/linux/ath79/image/tiny-tp-link.mk +++ b/target/linux/ath79/image/tiny-tp-link.mk @@ -180,3 +180,11 @@ define Device/tplink_tl-wr941-v4 TPLINK_HWID := 0x09410004 endef TARGET_DEVICES += tplink_tl-wr941-v4 + +define Device/tplink_tl-wr941n-v7-cn + $(Device/tplink-4mlzma) + ATH_SOC := qca9558 + DEVICE_TITLE := TP-Link TL-WR941N v7 (CN) + TPLINK_HWID := 0x09410007 +endef +TARGET_DEVICES += tplink_tl-wr941n-v7-cn diff --git a/target/linux/ath79/patches-4.14/0027-MIPS-ath79-drop-legacy-IRQ-code.patch b/target/linux/ath79/patches-4.14/0027-MIPS-ath79-drop-legacy-IRQ-code.patch index 79f003d2ea..6586f08431 100644 --- a/target/linux/ath79/patches-4.14/0027-MIPS-ath79-drop-legacy-IRQ-code.patch +++ b/target/linux/ath79/patches-4.14/0027-MIPS-ath79-drop-legacy-IRQ-code.patch @@ -208,7 +208,7 @@ Signed-off-by: John Crispin #include #include -@@ -311,6 +312,11 @@ void __init plat_time_init(void) +@@ -305,6 +306,11 @@ void __init plat_time_init(void) mips_hpt_frequency = cpu_clk_rate / 2; } diff --git a/target/linux/ath79/patches-4.14/0028-MIPS-ath79-drop-machfiles.patch b/target/linux/ath79/patches-4.14/0028-MIPS-ath79-drop-machfiles.patch index 2d87f70074..bb5acde8bb 100644 --- a/target/linux/ath79/patches-4.14/0028-MIPS-ath79-drop-machfiles.patch +++ b/target/linux/ath79/patches-4.14/0028-MIPS-ath79-drop-machfiles.patch @@ -938,7 +938,7 @@ Signed-off-by: John Crispin #define ATH79_SYS_TYPE_LEN 64 -@@ -236,25 +235,21 @@ void __init plat_mem_setup(void) +@@ -230,25 +229,21 @@ void __init plat_mem_setup(void) else if (fw_passed_dtb) __dt_setup_arch((void *)KSEG0ADDR(fw_passed_dtb)); @@ -973,7 +973,7 @@ Signed-off-by: John Crispin { struct device_node *np; struct clk *clk; -@@ -284,66 +279,12 @@ static void __init ath79_of_plat_time_in +@@ -278,66 +273,12 @@ static void __init ath79_of_plat_time_in clk_put(clk); } diff --git a/target/linux/ath79/patches-4.14/0036-GPIO-add-named-gpio-exports.patch b/target/linux/ath79/patches-4.14/0036-GPIO-add-named-gpio-exports.patch index a1d5d9d9ff..61ed9ea784 100644 --- a/target/linux/ath79/patches-4.14/0036-GPIO-add-named-gpio-exports.patch +++ b/target/linux/ath79/patches-4.14/0036-GPIO-add-named-gpio-exports.patch @@ -22,7 +22,7 @@ Signed-off-by: John Crispin #include "gpiolib.h" -@@ -507,3 +509,68 @@ void of_gpiochip_remove(struct gpio_chip +@@ -513,3 +515,68 @@ void of_gpiochip_remove(struct gpio_chip gpiochip_remove_pin_ranges(chip); of_node_put(chip->of_node); } diff --git a/target/linux/ath79/patches-4.14/408-mtd-redboot_partition_scan.patch b/target/linux/ath79/patches-4.14/408-mtd-redboot_partition_scan.patch new file mode 100644 index 0000000000..cd41e7ceb2 --- /dev/null +++ b/target/linux/ath79/patches-4.14/408-mtd-redboot_partition_scan.patch @@ -0,0 +1,44 @@ +--- a/drivers/mtd/redboot.c ++++ b/drivers/mtd/redboot.c +@@ -76,12 +76,18 @@ static int parse_redboot_partitions(stru + static char nullstring[] = "unallocated"; + #endif + ++ buf = vmalloc(master->erasesize); ++ if (!buf) ++ return -ENOMEM; ++ ++ restart: + if ( directory < 0 ) { + offset = master->size + directory * master->erasesize; + while (mtd_block_isbad(master, offset)) { + if (!offset) { + nogood: + printk(KERN_NOTICE "Failed to find a non-bad block to check for RedBoot partition table\n"); ++ vfree(buf); + return -EIO; + } + offset -= master->erasesize; +@@ -94,10 +100,6 @@ static int parse_redboot_partitions(stru + goto nogood; + } + } +- buf = vmalloc(master->erasesize); +- +- if (!buf) +- return -ENOMEM; + + printk(KERN_NOTICE "Searching for RedBoot partition table in %s at offset 0x%lx\n", + master->name, offset); +@@ -170,6 +172,11 @@ static int parse_redboot_partitions(stru + } + if (i == numslots) { + /* Didn't find it */ ++ if (offset + master->erasesize < master->size) { ++ /* not at the end of the flash yet, maybe next block :) */ ++ directory++; ++ goto restart; ++ } + printk(KERN_NOTICE "No RedBoot partition table detected in %s\n", + master->name); + ret = 0; diff --git a/target/linux/ath79/patches-4.14/910-unaligned_access_hacks.patch b/target/linux/ath79/patches-4.14/910-unaligned_access_hacks.patch index e43bc97da3..5d9b84eb9f 100644 --- a/target/linux/ath79/patches-4.14/910-unaligned_access_hacks.patch +++ b/target/linux/ath79/patches-4.14/910-unaligned_access_hacks.patch @@ -486,7 +486,7 @@ #define IGMP_HOST_MEMBERSHIP_REPORT 0x12 /* Ditto */ --- a/net/core/flow_dissector.c +++ b/net/core/flow_dissector.c -@@ -108,7 +108,7 @@ __be32 __skb_flow_get_ports(const struct +@@ -109,7 +109,7 @@ __be32 __skb_flow_get_ports(const struct ports = __skb_header_pointer(skb, thoff + poff, sizeof(_ports), data, hlen, &_ports); if (ports) @@ -641,7 +641,7 @@ return false; return true; -@@ -634,13 +638,13 @@ static inline void ipv6_addr_set_v4mappe +@@ -605,13 +609,13 @@ static inline void ipv6_addr_set_v4mappe */ static inline int __ipv6_addr_diff32(const void *token1, const void *token2, int addrlen) { @@ -657,7 +657,7 @@ if (xb) return i * 32 + 31 - __fls(ntohl(xb)); } -@@ -809,17 +813,18 @@ static inline int ip6_default_np_autolab +@@ -780,17 +784,18 @@ static inline int ip6_default_np_autolab static inline void ip6_flow_hdr(struct ipv6hdr *hdr, unsigned int tclass, __be32 flowlabel) { @@ -737,7 +737,7 @@ EXPORT_SYMBOL(xfrm_parse_spi); --- a/net/ipv4/tcp_input.c +++ b/net/ipv4/tcp_input.c -@@ -3858,14 +3858,16 @@ static bool tcp_parse_aligned_timestamp( +@@ -3874,14 +3874,16 @@ static bool tcp_parse_aligned_timestamp( { const __be32 *ptr = (const __be32 *)(th + 1); diff --git a/target/linux/generic/backport-4.14/011-kbuild-export-SUBARCH.patch b/target/linux/generic/backport-4.14/011-kbuild-export-SUBARCH.patch index 3df01c34b1..1c82a9576a 100644 --- a/target/linux/generic/backport-4.14/011-kbuild-export-SUBARCH.patch +++ b/target/linux/generic/backport-4.14/011-kbuild-export-SUBARCH.patch @@ -10,9 +10,9 @@ Signed-off-by: Felix Fietkau --- a/Makefile +++ b/Makefile -@@ -428,8 +428,8 @@ KBUILD_CFLAGS_MODULE := -DMODULE - KBUILD_LDFLAGS_MODULE := -T $(srctree)/scripts/module-common.lds +@@ -429,8 +429,8 @@ KBUILD_LDFLAGS_MODULE := -T $(srctree)/s GCC_PLUGINS_CFLAGS := + CLANG_FLAGS := -export ARCH SRCARCH CONFIG_SHELL HOSTCC HOSTCFLAGS CROSS_COMPILE AS LD CC -export CPP AR NM STRIP OBJCOPY OBJDUMP HOSTLDFLAGS HOST_LOADLIBES diff --git a/target/linux/generic/backport-4.14/012-kbuild-add-macro-for-controlling-warnings-to-linux-c.patch b/target/linux/generic/backport-4.14/012-kbuild-add-macro-for-controlling-warnings-to-linux-c.patch index 8d91266e24..8993b6376c 100644 --- a/target/linux/generic/backport-4.14/012-kbuild-add-macro-for-controlling-warnings-to-linux-c.patch +++ b/target/linux/generic/backport-4.14/012-kbuild-add-macro-for-controlling-warnings-to-linux-c.patch @@ -84,7 +84,7 @@ Signed-off-by: Masahiro Yamada --- a/include/linux/compiler-gcc.h +++ b/include/linux/compiler-gcc.h -@@ -362,3 +362,30 @@ +@@ -366,3 +366,30 @@ #if GCC_VERSION >= 50100 #define COMPILER_HAS_GENERIC_BUILTIN_OVERFLOW 1 #endif @@ -117,7 +117,7 @@ Signed-off-by: Masahiro Yamada + --- a/include/linux/compiler_types.h +++ b/include/linux/compiler_types.h -@@ -283,4 +283,22 @@ struct ftrace_likely_data { +@@ -287,4 +287,22 @@ struct ftrace_likely_data { # define __native_word(t) (sizeof(t) == sizeof(char) || sizeof(t) == sizeof(short) || sizeof(t) == sizeof(int) || sizeof(t) == sizeof(long)) #endif diff --git a/target/linux/generic/backport-4.14/025-tcp-allow-drivers-to-tweak-TSQ-logic.patch b/target/linux/generic/backport-4.14/025-tcp-allow-drivers-to-tweak-TSQ-logic.patch index 915a7f05d1..d99294e371 100644 --- a/target/linux/generic/backport-4.14/025-tcp-allow-drivers-to-tweak-TSQ-logic.patch +++ b/target/linux/generic/backport-4.14/025-tcp-allow-drivers-to-tweak-TSQ-logic.patch @@ -55,7 +55,7 @@ Cc: Kir Kolyshkin rwlock_t sk_callback_lock; --- a/net/core/sock.c +++ b/net/core/sock.c -@@ -2743,6 +2743,7 @@ void sock_init_data(struct socket *sock, +@@ -2740,6 +2740,7 @@ void sock_init_data(struct socket *sock, sk->sk_max_pacing_rate = ~0U; sk->sk_pacing_rate = ~0U; @@ -65,7 +65,7 @@ Cc: Kir Kolyshkin * Before updating sk_refcnt, we must commit prior changes to memory --- a/net/ipv4/tcp_output.c +++ b/net/ipv4/tcp_output.c -@@ -1683,7 +1683,7 @@ u32 tcp_tso_autosize(const struct sock * +@@ -1696,7 +1696,7 @@ u32 tcp_tso_autosize(const struct sock * { u32 bytes, segs; @@ -74,7 +74,7 @@ Cc: Kir Kolyshkin sk->sk_gso_max_size - 1 - MAX_TCP_HEADER); /* Goal is to send at least one packet per ms, -@@ -2200,7 +2200,7 @@ static bool tcp_small_queue_check(struct +@@ -2213,7 +2213,7 @@ static bool tcp_small_queue_check(struct { unsigned int limit; diff --git a/target/linux/generic/backport-4.14/030-USB-serial-option-fix-dwm-158-3g-modem-interface.patch b/target/linux/generic/backport-4.14/030-USB-serial-option-fix-dwm-158-3g-modem-interface.patch index 5f6147f59d..545da78616 100644 --- a/target/linux/generic/backport-4.14/030-USB-serial-option-fix-dwm-158-3g-modem-interface.patch +++ b/target/linux/generic/backport-4.14/030-USB-serial-option-fix-dwm-158-3g-modem-interface.patch @@ -30,7 +30,7 @@ Signed-off-by: Johan Hovold --- a/drivers/usb/serial/option.c +++ b/drivers/usb/serial/option.c -@@ -1934,7 +1934,8 @@ static const struct usb_device_id option +@@ -1954,7 +1954,8 @@ static const struct usb_device_id option { USB_DEVICE_INTERFACE_CLASS(0x2001, 0x7d01, 0xff) }, /* D-Link DWM-156 (variant) */ { USB_DEVICE_INTERFACE_CLASS(0x2001, 0x7d02, 0xff) }, { USB_DEVICE_INTERFACE_CLASS(0x2001, 0x7d03, 0xff) }, diff --git a/target/linux/generic/backport-4.14/030-v4.17-0001-usb-dwc2-add-support-for-host-mode-external-vbus-sup.patch b/target/linux/generic/backport-4.14/030-v4.17-0001-usb-dwc2-add-support-for-host-mode-external-vbus-sup.patch index a17844f5e6..4d029ebfe2 100644 --- a/target/linux/generic/backport-4.14/030-v4.17-0001-usb-dwc2-add-support-for-host-mode-external-vbus-sup.patch +++ b/target/linux/generic/backport-4.14/030-v4.17-0001-usb-dwc2-add-support-for-host-mode-external-vbus-sup.patch @@ -63,7 +63,7 @@ Signed-off-by: Felipe Balbi /** * dwc2_enable_host_interrupts() - Enables the Host mode interrupts * -@@ -3342,6 +3359,7 @@ static void dwc2_conn_id_status_change(s +@@ -3346,6 +3363,7 @@ static void dwc2_conn_id_status_change(s /* B-Device connector (Device Mode) */ if (gotgctl & GOTGCTL_CONID_B) { @@ -71,7 +71,7 @@ Signed-off-by: Felipe Balbi /* Wait for switch to device mode */ dev_dbg(hsotg->dev, "connId B\n"); if (hsotg->bus_suspended) { -@@ -4448,6 +4466,9 @@ static int _dwc2_hcd_start(struct usb_hc +@@ -4455,6 +4473,9 @@ static int _dwc2_hcd_start(struct usb_hc } spin_unlock_irqrestore(&hsotg->lock, flags); @@ -81,7 +81,7 @@ Signed-off-by: Felipe Balbi return 0; } -@@ -4475,6 +4496,8 @@ static void _dwc2_hcd_stop(struct usb_hc +@@ -4482,6 +4503,8 @@ static void _dwc2_hcd_stop(struct usb_hc clear_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags); spin_unlock_irqrestore(&hsotg->lock, flags); @@ -90,7 +90,7 @@ Signed-off-by: Felipe Balbi usleep_range(1000, 3000); } -@@ -4511,6 +4534,7 @@ static int _dwc2_hcd_suspend(struct usb_ +@@ -4518,6 +4541,7 @@ static int _dwc2_hcd_suspend(struct usb_ hprt0 |= HPRT0_SUSP; hprt0 &= ~HPRT0_PWR; dwc2_writel(hprt0, hsotg->regs + HPRT0); @@ -98,7 +98,7 @@ Signed-off-by: Felipe Balbi } /* Enter hibernation */ -@@ -4591,6 +4615,8 @@ static int _dwc2_hcd_resume(struct usb_h +@@ -4598,6 +4622,8 @@ static int _dwc2_hcd_resume(struct usb_h spin_unlock_irqrestore(&hsotg->lock, flags); dwc2_port_resume(hsotg); } else { diff --git a/target/linux/generic/backport-4.14/030-v4.17-0002-usb-dwc2-dwc2_vbus_supply_init-fix-error-check.patch b/target/linux/generic/backport-4.14/030-v4.17-0002-usb-dwc2-dwc2_vbus_supply_init-fix-error-check.patch index 59ab805cf6..02b61fe84f 100644 --- a/target/linux/generic/backport-4.14/030-v4.17-0002-usb-dwc2-dwc2_vbus_supply_init-fix-error-check.patch +++ b/target/linux/generic/backport-4.14/030-v4.17-0002-usb-dwc2-dwc2_vbus_supply_init-fix-error-check.patch @@ -42,7 +42,7 @@ Signed-off-by: Felipe Balbi return regulator_enable(hsotg->vbus_supply); } -@@ -4467,9 +4472,7 @@ static int _dwc2_hcd_start(struct usb_hc +@@ -4474,9 +4479,7 @@ static int _dwc2_hcd_start(struct usb_hc spin_unlock_irqrestore(&hsotg->lock, flags); diff --git a/target/linux/generic/backport-4.14/095-Allow-class-e-address-assignment-via-ifconfig-ioctl.patch b/target/linux/generic/backport-4.14/095-Allow-class-e-address-assignment-via-ifconfig-ioctl.patch index ade5c6cc23..1c501867a9 100644 --- a/target/linux/generic/backport-4.14/095-Allow-class-e-address-assignment-via-ifconfig-ioctl.patch +++ b/target/linux/generic/backport-4.14/095-Allow-class-e-address-assignment-via-ifconfig-ioctl.patch @@ -48,7 +48,7 @@ Reviewed-by: John Gilmore #define INADDR_ANY ((unsigned long int) 0x00000000) --- a/net/ipv4/devinet.c +++ b/net/ipv4/devinet.c -@@ -921,7 +921,7 @@ static int inet_abc_len(__be32 addr) +@@ -929,7 +929,7 @@ static int inet_abc_len(__be32 addr) { int rc = -1; /* Something else, probably a multicast. */ @@ -57,7 +57,7 @@ Reviewed-by: John Gilmore rc = 0; else { __u32 haddr = ntohl(addr); -@@ -932,6 +932,8 @@ static int inet_abc_len(__be32 addr) +@@ -940,6 +940,8 @@ static int inet_abc_len(__be32 addr) rc = 16; else if (IN_CLASSC(haddr)) rc = 24; diff --git a/target/linux/generic/backport-4.14/270-batman-adv-Let-packet.h-include-its-headers-directly.patch b/target/linux/generic/backport-4.14/270-batman-adv-Let-packet.h-include-its-headers-directly.patch new file mode 100644 index 0000000000..9b3dfc1fd3 --- /dev/null +++ b/target/linux/generic/backport-4.14/270-batman-adv-Let-packet.h-include-its-headers-directly.patch @@ -0,0 +1,36 @@ +From: Sven Eckelmann +Date: Thu, 21 Dec 2017 10:17:38 +0100 +Subject: [PATCH] batman-adv: Let packet.h include its headers directly + +The headers used by packet.h should also be included by it directly. main.h +is currently dealing with it in batman-adv, but this will no longer work +when this header is moved to include/uapi/linux/. + +Signed-off-by: Sven Eckelmann +Signed-off-by: David S. Miller +--- + +--- a/net/batman-adv/main.h ++++ b/net/batman-adv/main.h +@@ -184,10 +184,8 @@ enum batadv_uev_type { + + /* Kernel headers */ + +-#include /* for packet.h */ + #include + #include +-#include /* for packet.h */ + #include + #include + #include +--- a/net/batman-adv/packet.h ++++ b/net/batman-adv/packet.h +@@ -19,6 +19,8 @@ + #define _NET_BATMAN_ADV_PACKET_H_ + + #include ++#include ++#include + #include + + #define batadv_tp_is_error(n) ((u8)(n) > 127 ? 1 : 0) diff --git a/target/linux/generic/backport-4.14/271-batman-adv-Remove-usage-of-BIT-x-in-packet.h.patch b/target/linux/generic/backport-4.14/271-batman-adv-Remove-usage-of-BIT-x-in-packet.h.patch new file mode 100644 index 0000000000..5466d234d8 --- /dev/null +++ b/target/linux/generic/backport-4.14/271-batman-adv-Remove-usage-of-BIT-x-in-packet.h.patch @@ -0,0 +1,72 @@ +From: Sven Eckelmann +Date: Thu, 21 Dec 2017 10:17:39 +0100 +Subject: [PATCH] batman-adv: Remove usage of BIT(x) in packet.h + +The BIT(x) macro is no longer available for uapi headers because it is +defined outside of it (linux/bitops.h). The use of it must therefore be +avoided and replaced by an appropriate other representation. + +Signed-off-by: Sven Eckelmann +Signed-off-by: David S. Miller +--- + +--- a/net/batman-adv/packet.h ++++ b/net/batman-adv/packet.h +@@ -19,7 +19,6 @@ + #define _NET_BATMAN_ADV_PACKET_H_ + + #include +-#include + #include + #include + +@@ -85,9 +84,9 @@ enum batadv_subtype { + * one hop neighbor on the interface where it was originally received. + */ + enum batadv_iv_flags { +- BATADV_NOT_BEST_NEXT_HOP = BIT(0), +- BATADV_PRIMARIES_FIRST_HOP = BIT(1), +- BATADV_DIRECTLINK = BIT(2), ++ BATADV_NOT_BEST_NEXT_HOP = 1UL << 0, ++ BATADV_PRIMARIES_FIRST_HOP = 1UL << 1, ++ BATADV_DIRECTLINK = 1UL << 2, + }; + + /* ICMP message types */ +@@ -108,9 +107,9 @@ enum batadv_icmp_packettype { + * @BATADV_MCAST_WANT_ALL_IPV6: we want all IPv6 multicast packets + */ + enum batadv_mcast_flags { +- BATADV_MCAST_WANT_ALL_UNSNOOPABLES = BIT(0), +- BATADV_MCAST_WANT_ALL_IPV4 = BIT(1), +- BATADV_MCAST_WANT_ALL_IPV6 = BIT(2), ++ BATADV_MCAST_WANT_ALL_UNSNOOPABLES = 1UL << 0, ++ BATADV_MCAST_WANT_ALL_IPV4 = 1UL << 1, ++ BATADV_MCAST_WANT_ALL_IPV6 = 1UL << 2, + }; + + /* tt data subtypes */ +@@ -124,10 +123,10 @@ enum batadv_mcast_flags { + * @BATADV_TT_FULL_TABLE: contains full table to replace existing table + */ + enum batadv_tt_data_flags { +- BATADV_TT_OGM_DIFF = BIT(0), +- BATADV_TT_REQUEST = BIT(1), +- BATADV_TT_RESPONSE = BIT(2), +- BATADV_TT_FULL_TABLE = BIT(4), ++ BATADV_TT_OGM_DIFF = 1UL << 0, ++ BATADV_TT_REQUEST = 1UL << 1, ++ BATADV_TT_RESPONSE = 1UL << 2, ++ BATADV_TT_FULL_TABLE = 1UL << 4, + }; + + /** +@@ -135,7 +134,7 @@ enum batadv_tt_data_flags { + * @BATADV_VLAN_HAS_TAG: whether the field contains a valid vlan tag or not + */ + enum batadv_vlan_flags { +- BATADV_VLAN_HAS_TAG = BIT(15), ++ BATADV_VLAN_HAS_TAG = 1UL << 15, + }; + + /* claim frame types for the bridge loop avoidance */ diff --git a/target/linux/generic/backport-4.14/272-batman-adv-Remove-kernel-fixed-width-types-in-packet.patch b/target/linux/generic/backport-4.14/272-batman-adv-Remove-kernel-fixed-width-types-in-packet.patch new file mode 100644 index 0000000000..c46a8f74c7 --- /dev/null +++ b/target/linux/generic/backport-4.14/272-batman-adv-Remove-kernel-fixed-width-types-in-packet.patch @@ -0,0 +1,386 @@ +From: Sven Eckelmann +Date: Thu, 21 Dec 2017 10:17:40 +0100 +Subject: [PATCH] batman-adv: Remove kernel fixed width types in packet.h + +The uapi headers use the __u8/__u16/... version of the fixed width types +instead of u8/u16/... The use of the latter must be avoided before +packet.h is copied to include/uapi/linux/. + +Signed-off-by: Sven Eckelmann +Signed-off-by: David S. Miller +--- + +--- a/net/batman-adv/packet.h ++++ b/net/batman-adv/packet.h +@@ -22,7 +22,7 @@ + #include + #include + +-#define batadv_tp_is_error(n) ((u8)(n) > 127 ? 1 : 0) ++#define batadv_tp_is_error(n) ((__u8)(n) > 127 ? 1 : 0) + + /** + * enum batadv_packettype - types for batman-adv encapsulated packets +@@ -169,8 +169,8 @@ enum batadv_tvlv_type { + * transport the claim type and the group id + */ + struct batadv_bla_claim_dst { +- u8 magic[3]; /* FF:43:05 */ +- u8 type; /* bla_claimframe */ ++ __u8 magic[3]; /* FF:43:05 */ ++ __u8 type; /* bla_claimframe */ + __be16 group; /* group id */ + }; + +@@ -190,15 +190,15 @@ struct batadv_bla_claim_dst { + * @tvlv_len: length of tvlv data following the ogm header + */ + struct batadv_ogm_packet { +- u8 packet_type; +- u8 version; +- u8 ttl; +- u8 flags; ++ __u8 packet_type; ++ __u8 version; ++ __u8 ttl; ++ __u8 flags; + __be32 seqno; +- u8 orig[ETH_ALEN]; +- u8 prev_sender[ETH_ALEN]; +- u8 reserved; +- u8 tq; ++ __u8 orig[ETH_ALEN]; ++ __u8 prev_sender[ETH_ALEN]; ++ __u8 reserved; ++ __u8 tq; + __be16 tvlv_len; + /* __packed is not needed as the struct size is divisible by 4, + * and the largest data type in this struct has a size of 4. +@@ -219,12 +219,12 @@ struct batadv_ogm_packet { + * @throughput: the currently flooded path throughput + */ + struct batadv_ogm2_packet { +- u8 packet_type; +- u8 version; +- u8 ttl; +- u8 flags; ++ __u8 packet_type; ++ __u8 version; ++ __u8 ttl; ++ __u8 flags; + __be32 seqno; +- u8 orig[ETH_ALEN]; ++ __u8 orig[ETH_ALEN]; + __be16 tvlv_len; + __be32 throughput; + /* __packed is not needed as the struct size is divisible by 4, +@@ -243,9 +243,9 @@ struct batadv_ogm2_packet { + * @elp_interval: currently used ELP sending interval in ms + */ + struct batadv_elp_packet { +- u8 packet_type; +- u8 version; +- u8 orig[ETH_ALEN]; ++ __u8 packet_type; ++ __u8 version; ++ __u8 orig[ETH_ALEN]; + __be32 seqno; + __be32 elp_interval; + }; +@@ -268,14 +268,14 @@ struct batadv_elp_packet { + * members are padded the same way as they are in real packets. + */ + struct batadv_icmp_header { +- u8 packet_type; +- u8 version; +- u8 ttl; +- u8 msg_type; /* see ICMP message types above */ +- u8 dst[ETH_ALEN]; +- u8 orig[ETH_ALEN]; +- u8 uid; +- u8 align[3]; ++ __u8 packet_type; ++ __u8 version; ++ __u8 ttl; ++ __u8 msg_type; /* see ICMP message types above */ ++ __u8 dst[ETH_ALEN]; ++ __u8 orig[ETH_ALEN]; ++ __u8 uid; ++ __u8 align[3]; + }; + + /** +@@ -291,14 +291,14 @@ struct batadv_icmp_header { + * @seqno: ICMP sequence number + */ + struct batadv_icmp_packet { +- u8 packet_type; +- u8 version; +- u8 ttl; +- u8 msg_type; /* see ICMP message types above */ +- u8 dst[ETH_ALEN]; +- u8 orig[ETH_ALEN]; +- u8 uid; +- u8 reserved; ++ __u8 packet_type; ++ __u8 version; ++ __u8 ttl; ++ __u8 msg_type; /* see ICMP message types above */ ++ __u8 dst[ETH_ALEN]; ++ __u8 orig[ETH_ALEN]; ++ __u8 uid; ++ __u8 reserved; + __be16 seqno; + }; + +@@ -320,15 +320,15 @@ struct batadv_icmp_packet { + * store it using network order + */ + struct batadv_icmp_tp_packet { +- u8 packet_type; +- u8 version; +- u8 ttl; +- u8 msg_type; /* see ICMP message types above */ +- u8 dst[ETH_ALEN]; +- u8 orig[ETH_ALEN]; +- u8 uid; +- u8 subtype; +- u8 session[2]; ++ __u8 packet_type; ++ __u8 version; ++ __u8 ttl; ++ __u8 msg_type; /* see ICMP message types above */ ++ __u8 dst[ETH_ALEN]; ++ __u8 orig[ETH_ALEN]; ++ __u8 uid; ++ __u8 subtype; ++ __u8 session[2]; + __be32 seqno; + __be32 timestamp; + }; +@@ -359,16 +359,16 @@ enum batadv_icmp_tp_subtype { + * @rr: route record array + */ + struct batadv_icmp_packet_rr { +- u8 packet_type; +- u8 version; +- u8 ttl; +- u8 msg_type; /* see ICMP message types above */ +- u8 dst[ETH_ALEN]; +- u8 orig[ETH_ALEN]; +- u8 uid; +- u8 rr_cur; ++ __u8 packet_type; ++ __u8 version; ++ __u8 ttl; ++ __u8 msg_type; /* see ICMP message types above */ ++ __u8 dst[ETH_ALEN]; ++ __u8 orig[ETH_ALEN]; ++ __u8 uid; ++ __u8 rr_cur; + __be16 seqno; +- u8 rr[BATADV_RR_LEN][ETH_ALEN]; ++ __u8 rr[BATADV_RR_LEN][ETH_ALEN]; + }; + + #define BATADV_ICMP_MAX_PACKET_SIZE sizeof(struct batadv_icmp_packet_rr) +@@ -394,11 +394,11 @@ struct batadv_icmp_packet_rr { + * @dest: originator destination of the unicast packet + */ + struct batadv_unicast_packet { +- u8 packet_type; +- u8 version; +- u8 ttl; +- u8 ttvn; /* destination translation table version number */ +- u8 dest[ETH_ALEN]; ++ __u8 packet_type; ++ __u8 version; ++ __u8 ttl; ++ __u8 ttvn; /* destination translation table version number */ ++ __u8 dest[ETH_ALEN]; + /* "4 bytes boundary + 2 bytes" long to make the payload after the + * following ethernet header again 4 bytes boundary aligned + */ +@@ -413,9 +413,9 @@ struct batadv_unicast_packet { + */ + struct batadv_unicast_4addr_packet { + struct batadv_unicast_packet u; +- u8 src[ETH_ALEN]; +- u8 subtype; +- u8 reserved; ++ __u8 src[ETH_ALEN]; ++ __u8 subtype; ++ __u8 reserved; + /* "4 bytes boundary + 2 bytes" long to make the payload after the + * following ethernet header again 4 bytes boundary aligned + */ +@@ -435,22 +435,22 @@ struct batadv_unicast_4addr_packet { + * @total_size: size of the merged packet + */ + struct batadv_frag_packet { +- u8 packet_type; +- u8 version; /* batman version field */ +- u8 ttl; ++ __u8 packet_type; ++ __u8 version; /* batman version field */ ++ __u8 ttl; + #if defined(__BIG_ENDIAN_BITFIELD) +- u8 no:4; +- u8 priority:3; +- u8 reserved:1; ++ __u8 no:4; ++ __u8 priority:3; ++ __u8 reserved:1; + #elif defined(__LITTLE_ENDIAN_BITFIELD) +- u8 reserved:1; +- u8 priority:3; +- u8 no:4; ++ __u8 reserved:1; ++ __u8 priority:3; ++ __u8 no:4; + #else + #error "unknown bitfield endianness" + #endif +- u8 dest[ETH_ALEN]; +- u8 orig[ETH_ALEN]; ++ __u8 dest[ETH_ALEN]; ++ __u8 orig[ETH_ALEN]; + __be16 seqno; + __be16 total_size; + }; +@@ -465,12 +465,12 @@ struct batadv_frag_packet { + * @orig: originator of the broadcast packet + */ + struct batadv_bcast_packet { +- u8 packet_type; +- u8 version; /* batman version field */ +- u8 ttl; +- u8 reserved; ++ __u8 packet_type; ++ __u8 version; /* batman version field */ ++ __u8 ttl; ++ __u8 reserved; + __be32 seqno; +- u8 orig[ETH_ALEN]; ++ __u8 orig[ETH_ALEN]; + /* "4 bytes boundary + 2 bytes" long to make the payload after the + * following ethernet header again 4 bytes boundary aligned + */ +@@ -494,19 +494,19 @@ struct batadv_bcast_packet { + * @coded_len: length of network coded part of the payload + */ + struct batadv_coded_packet { +- u8 packet_type; +- u8 version; /* batman version field */ +- u8 ttl; +- u8 first_ttvn; +- /* u8 first_dest[ETH_ALEN]; - saved in mac header destination */ +- u8 first_source[ETH_ALEN]; +- u8 first_orig_dest[ETH_ALEN]; ++ __u8 packet_type; ++ __u8 version; /* batman version field */ ++ __u8 ttl; ++ __u8 first_ttvn; ++ /* __u8 first_dest[ETH_ALEN]; - saved in mac header destination */ ++ __u8 first_source[ETH_ALEN]; ++ __u8 first_orig_dest[ETH_ALEN]; + __be32 first_crc; +- u8 second_ttl; +- u8 second_ttvn; +- u8 second_dest[ETH_ALEN]; +- u8 second_source[ETH_ALEN]; +- u8 second_orig_dest[ETH_ALEN]; ++ __u8 second_ttl; ++ __u8 second_ttvn; ++ __u8 second_dest[ETH_ALEN]; ++ __u8 second_source[ETH_ALEN]; ++ __u8 second_orig_dest[ETH_ALEN]; + __be32 second_crc; + __be16 coded_len; + }; +@@ -525,14 +525,14 @@ struct batadv_coded_packet { + * @align: 2 bytes to align the header to a 4 byte boundary + */ + struct batadv_unicast_tvlv_packet { +- u8 packet_type; +- u8 version; /* batman version field */ +- u8 ttl; +- u8 reserved; +- u8 dst[ETH_ALEN]; +- u8 src[ETH_ALEN]; ++ __u8 packet_type; ++ __u8 version; /* batman version field */ ++ __u8 ttl; ++ __u8 reserved; ++ __u8 dst[ETH_ALEN]; ++ __u8 src[ETH_ALEN]; + __be16 tvlv_len; +- u16 align; ++ __u16 align; + }; + + /** +@@ -542,8 +542,8 @@ struct batadv_unicast_tvlv_packet { + * @len: tvlv container length + */ + struct batadv_tvlv_hdr { +- u8 type; +- u8 version; ++ __u8 type; ++ __u8 version; + __be16 len; + }; + +@@ -566,8 +566,8 @@ struct batadv_tvlv_gateway_data { + * one batadv_tvlv_tt_vlan_data object per announced vlan + */ + struct batadv_tvlv_tt_data { +- u8 flags; +- u8 ttvn; ++ __u8 flags; ++ __u8 ttvn; + __be16 num_vlan; + }; + +@@ -581,7 +581,7 @@ struct batadv_tvlv_tt_data { + struct batadv_tvlv_tt_vlan_data { + __be32 crc; + __be16 vid; +- u16 reserved; ++ __u16 reserved; + }; + + /** +@@ -593,9 +593,9 @@ struct batadv_tvlv_tt_vlan_data { + * @vid: VLAN identifier + */ + struct batadv_tvlv_tt_change { +- u8 flags; +- u8 reserved[3]; +- u8 addr[ETH_ALEN]; ++ __u8 flags; ++ __u8 reserved[3]; ++ __u8 addr[ETH_ALEN]; + __be16 vid; + }; + +@@ -605,7 +605,7 @@ struct batadv_tvlv_tt_change { + * @vid: VLAN identifier + */ + struct batadv_tvlv_roam_adv { +- u8 client[ETH_ALEN]; ++ __u8 client[ETH_ALEN]; + __be16 vid; + }; + +@@ -615,8 +615,8 @@ struct batadv_tvlv_roam_adv { + * @reserved: reserved field + */ + struct batadv_tvlv_mcast_data { +- u8 flags; +- u8 reserved[3]; ++ __u8 flags; ++ __u8 reserved[3]; + }; + + #endif /* _NET_BATMAN_ADV_PACKET_H_ */ diff --git a/target/linux/generic/backport-4.14/273-batman-adv-Convert-packet.h-to-uapi-header.patch b/target/linux/generic/backport-4.14/273-batman-adv-Convert-packet.h-to-uapi-header.patch new file mode 100644 index 0000000000..0435803f51 --- /dev/null +++ b/target/linux/generic/backport-4.14/273-batman-adv-Convert-packet.h-to-uapi-header.patch @@ -0,0 +1,1665 @@ +From: Sven Eckelmann +Date: Thu, 21 Dec 2017 10:17:41 +0100 +Subject: [PATCH] batman-adv: Convert packet.h to uapi header + +The header file is used by different userspace programs to inject packets +or to decode sniffed packets. It should therefore be available to them as +userspace header. + +Also other components in the kernel (like the flow dissector) require +access to the packet definitions to be able to decode ETH_P_BATMAN ethernet +packets. + +Signed-off-by: Sven Eckelmann +Signed-off-by: David S. Miller +--- + rename net/batman-adv/packet.h => include/uapi/linux/batadv_packet.h (99%) + +--- a/MAINTAINERS ++++ b/MAINTAINERS +@@ -2551,6 +2551,7 @@ S: Maintained + F: Documentation/ABI/testing/sysfs-class-net-batman-adv + F: Documentation/ABI/testing/sysfs-class-net-mesh + F: Documentation/networking/batman-adv.rst ++F: include/uapi/linux/batadv_packet.h + F: include/uapi/linux/batman_adv.h + F: net/batman-adv/ + +--- a/net/batman-adv/bat_iv_ogm.c ++++ b/net/batman-adv/bat_iv_ogm.c +@@ -51,6 +51,7 @@ + #include + #include + #include ++#include + #include + + #include "bat_algo.h" +@@ -62,7 +63,6 @@ + #include "netlink.h" + #include "network-coding.h" + #include "originator.h" +-#include "packet.h" + #include "routing.h" + #include "send.h" + #include "translation-table.h" +--- a/net/batman-adv/bat_v.c ++++ b/net/batman-adv/bat_v.c +@@ -37,6 +37,7 @@ + #include + #include + #include ++#include + #include + + #include "bat_algo.h" +@@ -49,7 +50,6 @@ + #include "log.h" + #include "netlink.h" + #include "originator.h" +-#include "packet.h" + + struct sk_buff; + +--- a/net/batman-adv/bat_v_elp.c ++++ b/net/batman-adv/bat_v_elp.c +@@ -41,13 +41,13 @@ + #include + #include + #include ++#include + + #include "bat_algo.h" + #include "bat_v_ogm.h" + #include "hard-interface.h" + #include "log.h" + #include "originator.h" +-#include "packet.h" + #include "routing.h" + #include "send.h" + +--- a/net/batman-adv/bat_v_ogm.c ++++ b/net/batman-adv/bat_v_ogm.c +@@ -38,13 +38,13 @@ + #include + #include + #include ++#include + + #include "bat_algo.h" + #include "hard-interface.h" + #include "hash.h" + #include "log.h" + #include "originator.h" +-#include "packet.h" + #include "routing.h" + #include "send.h" + #include "translation-table.h" +--- a/net/batman-adv/bridge_loop_avoidance.c ++++ b/net/batman-adv/bridge_loop_avoidance.c +@@ -49,6 +49,7 @@ + #include + #include + #include ++#include + #include + + #include "hard-interface.h" +@@ -56,7 +57,6 @@ + #include "log.h" + #include "netlink.h" + #include "originator.h" +-#include "packet.h" + #include "soft-interface.h" + #include "sysfs.h" + #include "translation-table.h" +--- a/net/batman-adv/distributed-arp-table.h ++++ b/net/batman-adv/distributed-arp-table.h +@@ -23,9 +23,9 @@ + #include + #include + #include ++#include + + #include "originator.h" +-#include "packet.h" + + struct seq_file; + struct sk_buff; +--- a/net/batman-adv/fragmentation.c ++++ b/net/batman-adv/fragmentation.c +@@ -32,10 +32,10 @@ + #include + #include + #include ++#include + + #include "hard-interface.h" + #include "originator.h" +-#include "packet.h" + #include "routing.h" + #include "send.h" + #include "soft-interface.h" +--- a/net/batman-adv/gateway_client.c ++++ b/net/batman-adv/gateway_client.c +@@ -43,6 +43,7 @@ + #include + #include + #include ++#include + #include + + #include "gateway_common.h" +@@ -50,7 +51,6 @@ + #include "log.h" + #include "netlink.h" + #include "originator.h" +-#include "packet.h" + #include "routing.h" + #include "soft-interface.h" + #include "sysfs.h" +--- a/net/batman-adv/gateway_common.c ++++ b/net/batman-adv/gateway_common.c +@@ -26,10 +26,10 @@ + #include + #include + #include ++#include + + #include "gateway_client.h" + #include "log.h" +-#include "packet.h" + #include "tvlv.h" + + /** +--- a/net/batman-adv/hard-interface.c ++++ b/net/batman-adv/hard-interface.c +@@ -36,6 +36,7 @@ + #include + #include + #include ++#include + + #include "bat_v.h" + #include "bridge_loop_avoidance.h" +@@ -44,7 +45,6 @@ + #include "gateway_client.h" + #include "log.h" + #include "originator.h" +-#include "packet.h" + #include "send.h" + #include "soft-interface.h" + #include "sysfs.h" +--- a/net/batman-adv/icmp_socket.c ++++ b/net/batman-adv/icmp_socket.c +@@ -42,11 +42,11 @@ + #include + #include + #include ++#include + + #include "hard-interface.h" + #include "log.h" + #include "originator.h" +-#include "packet.h" + #include "send.h" + + static struct batadv_socket_client *batadv_socket_client_hash[256]; +--- a/net/batman-adv/main.c ++++ b/net/batman-adv/main.c +@@ -45,6 +45,7 @@ + #include + #include + #include ++#include + #include + + #include "bat_algo.h" +@@ -62,7 +63,6 @@ + #include "netlink.h" + #include "network-coding.h" + #include "originator.h" +-#include "packet.h" + #include "routing.h" + #include "send.h" + #include "soft-interface.h" +--- a/net/batman-adv/main.h ++++ b/net/batman-adv/main.h +@@ -190,8 +190,8 @@ enum batadv_uev_type { + #include + #include + #include ++#include + +-#include "packet.h" + #include "types.h" + + struct net_device; +--- a/net/batman-adv/multicast.c ++++ b/net/batman-adv/multicast.c +@@ -54,11 +54,11 @@ + #include + #include + #include ++#include + + #include "hard-interface.h" + #include "hash.h" + #include "log.h" +-#include "packet.h" + #include "translation-table.h" + #include "tvlv.h" + +--- a/net/batman-adv/netlink.c ++++ b/net/batman-adv/netlink.c +@@ -39,6 +39,7 @@ + #include + #include + #include ++#include + #include + + #include "bat_algo.h" +@@ -46,7 +47,6 @@ + #include "gateway_client.h" + #include "hard-interface.h" + #include "originator.h" +-#include "packet.h" + #include "soft-interface.h" + #include "tp_meter.h" + #include "translation-table.h" +--- a/net/batman-adv/network-coding.c ++++ b/net/batman-adv/network-coding.c +@@ -47,12 +47,12 @@ + #include + #include + #include ++#include + + #include "hard-interface.h" + #include "hash.h" + #include "log.h" + #include "originator.h" +-#include "packet.h" + #include "routing.h" + #include "send.h" + #include "tvlv.h" +--- a/net/batman-adv/packet.h ++++ /dev/null +@@ -1,622 +0,0 @@ +-/* Copyright (C) 2007-2017 B.A.T.M.A.N. contributors: +- * +- * Marek Lindner, Simon Wunderlich +- * +- * This program is free software; you can redistribute it and/or +- * modify it under the terms of version 2 of the GNU General Public +- * License 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 . +- */ +- +-#ifndef _NET_BATMAN_ADV_PACKET_H_ +-#define _NET_BATMAN_ADV_PACKET_H_ +- +-#include +-#include +-#include +- +-#define batadv_tp_is_error(n) ((__u8)(n) > 127 ? 1 : 0) +- +-/** +- * enum batadv_packettype - types for batman-adv encapsulated packets +- * @BATADV_IV_OGM: originator messages for B.A.T.M.A.N. IV +- * @BATADV_BCAST: broadcast packets carrying broadcast payload +- * @BATADV_CODED: network coded packets +- * @BATADV_ELP: echo location packets for B.A.T.M.A.N. V +- * @BATADV_OGM2: originator messages for B.A.T.M.A.N. V +- * +- * @BATADV_UNICAST: unicast packets carrying unicast payload traffic +- * @BATADV_UNICAST_FRAG: unicast packets carrying a fragment of the original +- * payload packet +- * @BATADV_UNICAST_4ADDR: unicast packet including the originator address of +- * the sender +- * @BATADV_ICMP: unicast packet like IP ICMP used for ping or traceroute +- * @BATADV_UNICAST_TVLV: unicast packet carrying TVLV containers +- */ +-enum batadv_packettype { +- /* 0x00 - 0x3f: local packets or special rules for handling */ +- BATADV_IV_OGM = 0x00, +- BATADV_BCAST = 0x01, +- BATADV_CODED = 0x02, +- BATADV_ELP = 0x03, +- BATADV_OGM2 = 0x04, +- /* 0x40 - 0x7f: unicast */ +-#define BATADV_UNICAST_MIN 0x40 +- BATADV_UNICAST = 0x40, +- BATADV_UNICAST_FRAG = 0x41, +- BATADV_UNICAST_4ADDR = 0x42, +- BATADV_ICMP = 0x43, +- BATADV_UNICAST_TVLV = 0x44, +-#define BATADV_UNICAST_MAX 0x7f +- /* 0x80 - 0xff: reserved */ +-}; +- +-/** +- * enum batadv_subtype - packet subtype for unicast4addr +- * @BATADV_P_DATA: user payload +- * @BATADV_P_DAT_DHT_GET: DHT request message +- * @BATADV_P_DAT_DHT_PUT: DHT store message +- * @BATADV_P_DAT_CACHE_REPLY: ARP reply generated by DAT +- */ +-enum batadv_subtype { +- BATADV_P_DATA = 0x01, +- BATADV_P_DAT_DHT_GET = 0x02, +- BATADV_P_DAT_DHT_PUT = 0x03, +- BATADV_P_DAT_CACHE_REPLY = 0x04, +-}; +- +-/* this file is included by batctl which needs these defines */ +-#define BATADV_COMPAT_VERSION 15 +- +-/** +- * enum batadv_iv_flags - flags used in B.A.T.M.A.N. IV OGM packets +- * @BATADV_NOT_BEST_NEXT_HOP: flag is set when ogm packet is forwarded and was +- * previously received from someone else than the best neighbor. +- * @BATADV_PRIMARIES_FIRST_HOP: flag unused. +- * @BATADV_DIRECTLINK: flag is for the first hop or if rebroadcasted from a +- * one hop neighbor on the interface where it was originally received. +- */ +-enum batadv_iv_flags { +- BATADV_NOT_BEST_NEXT_HOP = 1UL << 0, +- BATADV_PRIMARIES_FIRST_HOP = 1UL << 1, +- BATADV_DIRECTLINK = 1UL << 2, +-}; +- +-/* ICMP message types */ +-enum batadv_icmp_packettype { +- BATADV_ECHO_REPLY = 0, +- BATADV_DESTINATION_UNREACHABLE = 3, +- BATADV_ECHO_REQUEST = 8, +- BATADV_TTL_EXCEEDED = 11, +- BATADV_PARAMETER_PROBLEM = 12, +- BATADV_TP = 15, +-}; +- +-/** +- * enum batadv_mcast_flags - flags for multicast capabilities and settings +- * @BATADV_MCAST_WANT_ALL_UNSNOOPABLES: we want all packets destined for +- * 224.0.0.0/24 or ff02::1 +- * @BATADV_MCAST_WANT_ALL_IPV4: we want all IPv4 multicast packets +- * @BATADV_MCAST_WANT_ALL_IPV6: we want all IPv6 multicast packets +- */ +-enum batadv_mcast_flags { +- BATADV_MCAST_WANT_ALL_UNSNOOPABLES = 1UL << 0, +- BATADV_MCAST_WANT_ALL_IPV4 = 1UL << 1, +- BATADV_MCAST_WANT_ALL_IPV6 = 1UL << 2, +-}; +- +-/* tt data subtypes */ +-#define BATADV_TT_DATA_TYPE_MASK 0x0F +- +-/** +- * enum batadv_tt_data_flags - flags for tt data tvlv +- * @BATADV_TT_OGM_DIFF: TT diff propagated through OGM +- * @BATADV_TT_REQUEST: TT request message +- * @BATADV_TT_RESPONSE: TT response message +- * @BATADV_TT_FULL_TABLE: contains full table to replace existing table +- */ +-enum batadv_tt_data_flags { +- BATADV_TT_OGM_DIFF = 1UL << 0, +- BATADV_TT_REQUEST = 1UL << 1, +- BATADV_TT_RESPONSE = 1UL << 2, +- BATADV_TT_FULL_TABLE = 1UL << 4, +-}; +- +-/** +- * enum batadv_vlan_flags - flags for the four MSB of any vlan ID field +- * @BATADV_VLAN_HAS_TAG: whether the field contains a valid vlan tag or not +- */ +-enum batadv_vlan_flags { +- BATADV_VLAN_HAS_TAG = 1UL << 15, +-}; +- +-/* claim frame types for the bridge loop avoidance */ +-enum batadv_bla_claimframe { +- BATADV_CLAIM_TYPE_CLAIM = 0x00, +- BATADV_CLAIM_TYPE_UNCLAIM = 0x01, +- BATADV_CLAIM_TYPE_ANNOUNCE = 0x02, +- BATADV_CLAIM_TYPE_REQUEST = 0x03, +- BATADV_CLAIM_TYPE_LOOPDETECT = 0x04, +-}; +- +-/** +- * enum batadv_tvlv_type - tvlv type definitions +- * @BATADV_TVLV_GW: gateway tvlv +- * @BATADV_TVLV_DAT: distributed arp table tvlv +- * @BATADV_TVLV_NC: network coding tvlv +- * @BATADV_TVLV_TT: translation table tvlv +- * @BATADV_TVLV_ROAM: roaming advertisement tvlv +- * @BATADV_TVLV_MCAST: multicast capability tvlv +- */ +-enum batadv_tvlv_type { +- BATADV_TVLV_GW = 0x01, +- BATADV_TVLV_DAT = 0x02, +- BATADV_TVLV_NC = 0x03, +- BATADV_TVLV_TT = 0x04, +- BATADV_TVLV_ROAM = 0x05, +- BATADV_TVLV_MCAST = 0x06, +-}; +- +-#pragma pack(2) +-/* the destination hardware field in the ARP frame is used to +- * transport the claim type and the group id +- */ +-struct batadv_bla_claim_dst { +- __u8 magic[3]; /* FF:43:05 */ +- __u8 type; /* bla_claimframe */ +- __be16 group; /* group id */ +-}; +- +-#pragma pack() +- +-/** +- * struct batadv_ogm_packet - ogm (routing protocol) packet +- * @packet_type: batman-adv packet type, part of the general header +- * @version: batman-adv protocol version, part of the genereal header +- * @ttl: time to live for this packet, part of the genereal header +- * @flags: contains routing relevant flags - see enum batadv_iv_flags +- * @seqno: sequence identification +- * @orig: address of the source node +- * @prev_sender: address of the previous sender +- * @reserved: reserved byte for alignment +- * @tq: transmission quality +- * @tvlv_len: length of tvlv data following the ogm header +- */ +-struct batadv_ogm_packet { +- __u8 packet_type; +- __u8 version; +- __u8 ttl; +- __u8 flags; +- __be32 seqno; +- __u8 orig[ETH_ALEN]; +- __u8 prev_sender[ETH_ALEN]; +- __u8 reserved; +- __u8 tq; +- __be16 tvlv_len; +- /* __packed is not needed as the struct size is divisible by 4, +- * and the largest data type in this struct has a size of 4. +- */ +-}; +- +-#define BATADV_OGM_HLEN sizeof(struct batadv_ogm_packet) +- +-/** +- * struct batadv_ogm2_packet - ogm2 (routing protocol) packet +- * @packet_type: batman-adv packet type, part of the general header +- * @version: batman-adv protocol version, part of the general header +- * @ttl: time to live for this packet, part of the general header +- * @flags: reseved for routing relevant flags - currently always 0 +- * @seqno: sequence number +- * @orig: originator mac address +- * @tvlv_len: length of the appended tvlv buffer (in bytes) +- * @throughput: the currently flooded path throughput +- */ +-struct batadv_ogm2_packet { +- __u8 packet_type; +- __u8 version; +- __u8 ttl; +- __u8 flags; +- __be32 seqno; +- __u8 orig[ETH_ALEN]; +- __be16 tvlv_len; +- __be32 throughput; +- /* __packed is not needed as the struct size is divisible by 4, +- * and the largest data type in this struct has a size of 4. +- */ +-}; +- +-#define BATADV_OGM2_HLEN sizeof(struct batadv_ogm2_packet) +- +-/** +- * struct batadv_elp_packet - elp (neighbor discovery) packet +- * @packet_type: batman-adv packet type, part of the general header +- * @version: batman-adv protocol version, part of the genereal header +- * @orig: originator mac address +- * @seqno: sequence number +- * @elp_interval: currently used ELP sending interval in ms +- */ +-struct batadv_elp_packet { +- __u8 packet_type; +- __u8 version; +- __u8 orig[ETH_ALEN]; +- __be32 seqno; +- __be32 elp_interval; +-}; +- +-#define BATADV_ELP_HLEN sizeof(struct batadv_elp_packet) +- +-/** +- * struct batadv_icmp_header - common members among all the ICMP packets +- * @packet_type: batman-adv packet type, part of the general header +- * @version: batman-adv protocol version, part of the genereal header +- * @ttl: time to live for this packet, part of the genereal header +- * @msg_type: ICMP packet type +- * @dst: address of the destination node +- * @orig: address of the source node +- * @uid: local ICMP socket identifier +- * @align: not used - useful for alignment purposes only +- * +- * This structure is used for ICMP packets parsing only and it is never sent +- * over the wire. The alignment field at the end is there to ensure that +- * members are padded the same way as they are in real packets. +- */ +-struct batadv_icmp_header { +- __u8 packet_type; +- __u8 version; +- __u8 ttl; +- __u8 msg_type; /* see ICMP message types above */ +- __u8 dst[ETH_ALEN]; +- __u8 orig[ETH_ALEN]; +- __u8 uid; +- __u8 align[3]; +-}; +- +-/** +- * struct batadv_icmp_packet - ICMP packet +- * @packet_type: batman-adv packet type, part of the general header +- * @version: batman-adv protocol version, part of the genereal header +- * @ttl: time to live for this packet, part of the genereal header +- * @msg_type: ICMP packet type +- * @dst: address of the destination node +- * @orig: address of the source node +- * @uid: local ICMP socket identifier +- * @reserved: not used - useful for alignment +- * @seqno: ICMP sequence number +- */ +-struct batadv_icmp_packet { +- __u8 packet_type; +- __u8 version; +- __u8 ttl; +- __u8 msg_type; /* see ICMP message types above */ +- __u8 dst[ETH_ALEN]; +- __u8 orig[ETH_ALEN]; +- __u8 uid; +- __u8 reserved; +- __be16 seqno; +-}; +- +-/** +- * struct batadv_icmp_tp_packet - ICMP TP Meter packet +- * @packet_type: batman-adv packet type, part of the general header +- * @version: batman-adv protocol version, part of the genereal header +- * @ttl: time to live for this packet, part of the genereal header +- * @msg_type: ICMP packet type +- * @dst: address of the destination node +- * @orig: address of the source node +- * @uid: local ICMP socket identifier +- * @subtype: TP packet subtype (see batadv_icmp_tp_subtype) +- * @session: TP session identifier +- * @seqno: the TP sequence number +- * @timestamp: time when the packet has been sent. This value is filled in a +- * TP_MSG and echoed back in the next TP_ACK so that the sender can compute the +- * RTT. Since it is read only by the host which wrote it, there is no need to +- * store it using network order +- */ +-struct batadv_icmp_tp_packet { +- __u8 packet_type; +- __u8 version; +- __u8 ttl; +- __u8 msg_type; /* see ICMP message types above */ +- __u8 dst[ETH_ALEN]; +- __u8 orig[ETH_ALEN]; +- __u8 uid; +- __u8 subtype; +- __u8 session[2]; +- __be32 seqno; +- __be32 timestamp; +-}; +- +-/** +- * enum batadv_icmp_tp_subtype - ICMP TP Meter packet subtypes +- * @BATADV_TP_MSG: Msg from sender to receiver +- * @BATADV_TP_ACK: acknowledgment from receiver to sender +- */ +-enum batadv_icmp_tp_subtype { +- BATADV_TP_MSG = 0, +- BATADV_TP_ACK, +-}; +- +-#define BATADV_RR_LEN 16 +- +-/** +- * struct batadv_icmp_packet_rr - ICMP RouteRecord packet +- * @packet_type: batman-adv packet type, part of the general header +- * @version: batman-adv protocol version, part of the genereal header +- * @ttl: time to live for this packet, part of the genereal header +- * @msg_type: ICMP packet type +- * @dst: address of the destination node +- * @orig: address of the source node +- * @uid: local ICMP socket identifier +- * @rr_cur: number of entries the rr array +- * @seqno: ICMP sequence number +- * @rr: route record array +- */ +-struct batadv_icmp_packet_rr { +- __u8 packet_type; +- __u8 version; +- __u8 ttl; +- __u8 msg_type; /* see ICMP message types above */ +- __u8 dst[ETH_ALEN]; +- __u8 orig[ETH_ALEN]; +- __u8 uid; +- __u8 rr_cur; +- __be16 seqno; +- __u8 rr[BATADV_RR_LEN][ETH_ALEN]; +-}; +- +-#define BATADV_ICMP_MAX_PACKET_SIZE sizeof(struct batadv_icmp_packet_rr) +- +-/* All packet headers in front of an ethernet header have to be completely +- * divisible by 2 but not by 4 to make the payload after the ethernet +- * header again 4 bytes boundary aligned. +- * +- * A packing of 2 is necessary to avoid extra padding at the end of the struct +- * caused by a structure member which is larger than two bytes. Otherwise +- * the structure would not fulfill the previously mentioned rule to avoid the +- * misalignment of the payload after the ethernet header. It may also lead to +- * leakage of information when the padding it not initialized before sending. +- */ +-#pragma pack(2) +- +-/** +- * struct batadv_unicast_packet - unicast packet for network payload +- * @packet_type: batman-adv packet type, part of the general header +- * @version: batman-adv protocol version, part of the genereal header +- * @ttl: time to live for this packet, part of the genereal header +- * @ttvn: translation table version number +- * @dest: originator destination of the unicast packet +- */ +-struct batadv_unicast_packet { +- __u8 packet_type; +- __u8 version; +- __u8 ttl; +- __u8 ttvn; /* destination translation table version number */ +- __u8 dest[ETH_ALEN]; +- /* "4 bytes boundary + 2 bytes" long to make the payload after the +- * following ethernet header again 4 bytes boundary aligned +- */ +-}; +- +-/** +- * struct batadv_unicast_4addr_packet - extended unicast packet +- * @u: common unicast packet header +- * @src: address of the source +- * @subtype: packet subtype +- * @reserved: reserved byte for alignment +- */ +-struct batadv_unicast_4addr_packet { +- struct batadv_unicast_packet u; +- __u8 src[ETH_ALEN]; +- __u8 subtype; +- __u8 reserved; +- /* "4 bytes boundary + 2 bytes" long to make the payload after the +- * following ethernet header again 4 bytes boundary aligned +- */ +-}; +- +-/** +- * struct batadv_frag_packet - fragmented packet +- * @packet_type: batman-adv packet type, part of the general header +- * @version: batman-adv protocol version, part of the genereal header +- * @ttl: time to live for this packet, part of the genereal header +- * @dest: final destination used when routing fragments +- * @orig: originator of the fragment used when merging the packet +- * @no: fragment number within this sequence +- * @priority: priority of frame, from ToS IP precedence or 802.1p +- * @reserved: reserved byte for alignment +- * @seqno: sequence identification +- * @total_size: size of the merged packet +- */ +-struct batadv_frag_packet { +- __u8 packet_type; +- __u8 version; /* batman version field */ +- __u8 ttl; +-#if defined(__BIG_ENDIAN_BITFIELD) +- __u8 no:4; +- __u8 priority:3; +- __u8 reserved:1; +-#elif defined(__LITTLE_ENDIAN_BITFIELD) +- __u8 reserved:1; +- __u8 priority:3; +- __u8 no:4; +-#else +-#error "unknown bitfield endianness" +-#endif +- __u8 dest[ETH_ALEN]; +- __u8 orig[ETH_ALEN]; +- __be16 seqno; +- __be16 total_size; +-}; +- +-/** +- * struct batadv_bcast_packet - broadcast packet for network payload +- * @packet_type: batman-adv packet type, part of the general header +- * @version: batman-adv protocol version, part of the genereal header +- * @ttl: time to live for this packet, part of the genereal header +- * @reserved: reserved byte for alignment +- * @seqno: sequence identification +- * @orig: originator of the broadcast packet +- */ +-struct batadv_bcast_packet { +- __u8 packet_type; +- __u8 version; /* batman version field */ +- __u8 ttl; +- __u8 reserved; +- __be32 seqno; +- __u8 orig[ETH_ALEN]; +- /* "4 bytes boundary + 2 bytes" long to make the payload after the +- * following ethernet header again 4 bytes boundary aligned +- */ +-}; +- +-/** +- * struct batadv_coded_packet - network coded packet +- * @packet_type: batman-adv packet type, part of the general header +- * @version: batman-adv protocol version, part of the genereal header +- * @ttl: time to live for this packet, part of the genereal header +- * @first_source: original source of first included packet +- * @first_orig_dest: original destinal of first included packet +- * @first_crc: checksum of first included packet +- * @first_ttvn: tt-version number of first included packet +- * @second_ttl: ttl of second packet +- * @second_dest: second receiver of this coded packet +- * @second_source: original source of second included packet +- * @second_orig_dest: original destination of second included packet +- * @second_crc: checksum of second included packet +- * @second_ttvn: tt version number of second included packet +- * @coded_len: length of network coded part of the payload +- */ +-struct batadv_coded_packet { +- __u8 packet_type; +- __u8 version; /* batman version field */ +- __u8 ttl; +- __u8 first_ttvn; +- /* __u8 first_dest[ETH_ALEN]; - saved in mac header destination */ +- __u8 first_source[ETH_ALEN]; +- __u8 first_orig_dest[ETH_ALEN]; +- __be32 first_crc; +- __u8 second_ttl; +- __u8 second_ttvn; +- __u8 second_dest[ETH_ALEN]; +- __u8 second_source[ETH_ALEN]; +- __u8 second_orig_dest[ETH_ALEN]; +- __be32 second_crc; +- __be16 coded_len; +-}; +- +-#pragma pack() +- +-/** +- * struct batadv_unicast_tvlv_packet - generic unicast packet with tvlv payload +- * @packet_type: batman-adv packet type, part of the general header +- * @version: batman-adv protocol version, part of the genereal header +- * @ttl: time to live for this packet, part of the genereal header +- * @reserved: reserved field (for packet alignment) +- * @src: address of the source +- * @dst: address of the destination +- * @tvlv_len: length of tvlv data following the unicast tvlv header +- * @align: 2 bytes to align the header to a 4 byte boundary +- */ +-struct batadv_unicast_tvlv_packet { +- __u8 packet_type; +- __u8 version; /* batman version field */ +- __u8 ttl; +- __u8 reserved; +- __u8 dst[ETH_ALEN]; +- __u8 src[ETH_ALEN]; +- __be16 tvlv_len; +- __u16 align; +-}; +- +-/** +- * struct batadv_tvlv_hdr - base tvlv header struct +- * @type: tvlv container type (see batadv_tvlv_type) +- * @version: tvlv container version +- * @len: tvlv container length +- */ +-struct batadv_tvlv_hdr { +- __u8 type; +- __u8 version; +- __be16 len; +-}; +- +-/** +- * struct batadv_tvlv_gateway_data - gateway data propagated through gw tvlv +- * container +- * @bandwidth_down: advertised uplink download bandwidth +- * @bandwidth_up: advertised uplink upload bandwidth +- */ +-struct batadv_tvlv_gateway_data { +- __be32 bandwidth_down; +- __be32 bandwidth_up; +-}; +- +-/** +- * struct batadv_tvlv_tt_data - tt data propagated through the tt tvlv container +- * @flags: translation table flags (see batadv_tt_data_flags) +- * @ttvn: translation table version number +- * @num_vlan: number of announced VLANs. In the TVLV this struct is followed by +- * one batadv_tvlv_tt_vlan_data object per announced vlan +- */ +-struct batadv_tvlv_tt_data { +- __u8 flags; +- __u8 ttvn; +- __be16 num_vlan; +-}; +- +-/** +- * struct batadv_tvlv_tt_vlan_data - vlan specific tt data propagated through +- * the tt tvlv container +- * @crc: crc32 checksum of the entries belonging to this vlan +- * @vid: vlan identifier +- * @reserved: unused, useful for alignment purposes +- */ +-struct batadv_tvlv_tt_vlan_data { +- __be32 crc; +- __be16 vid; +- __u16 reserved; +-}; +- +-/** +- * struct batadv_tvlv_tt_change - translation table diff data +- * @flags: status indicators concerning the non-mesh client (see +- * batadv_tt_client_flags) +- * @reserved: reserved field - useful for alignment purposes only +- * @addr: mac address of non-mesh client that triggered this tt change +- * @vid: VLAN identifier +- */ +-struct batadv_tvlv_tt_change { +- __u8 flags; +- __u8 reserved[3]; +- __u8 addr[ETH_ALEN]; +- __be16 vid; +-}; +- +-/** +- * struct batadv_tvlv_roam_adv - roaming advertisement +- * @client: mac address of roaming client +- * @vid: VLAN identifier +- */ +-struct batadv_tvlv_roam_adv { +- __u8 client[ETH_ALEN]; +- __be16 vid; +-}; +- +-/** +- * struct batadv_tvlv_mcast_data - payload of a multicast tvlv +- * @flags: multicast flags announced by the orig node +- * @reserved: reserved field +- */ +-struct batadv_tvlv_mcast_data { +- __u8 flags; +- __u8 reserved[3]; +-}; +- +-#endif /* _NET_BATMAN_ADV_PACKET_H_ */ +--- a/net/batman-adv/routing.c ++++ b/net/batman-adv/routing.c +@@ -33,6 +33,7 @@ + #include + #include + #include ++#include + + #include "bitarray.h" + #include "bridge_loop_avoidance.h" +@@ -43,7 +44,6 @@ + #include "log.h" + #include "network-coding.h" + #include "originator.h" +-#include "packet.h" + #include "send.h" + #include "soft-interface.h" + #include "tp_meter.h" +--- a/net/batman-adv/send.h ++++ b/net/batman-adv/send.h +@@ -23,8 +23,7 @@ + #include + #include + #include +- +-#include "packet.h" ++#include + + struct sk_buff; + +--- a/net/batman-adv/soft-interface.c ++++ b/net/batman-adv/soft-interface.c +@@ -48,6 +48,7 @@ + #include + #include + #include ++#include + + #include "bat_algo.h" + #include "bridge_loop_avoidance.h" +@@ -59,7 +60,6 @@ + #include "multicast.h" + #include "network-coding.h" + #include "originator.h" +-#include "packet.h" + #include "send.h" + #include "sysfs.h" + #include "translation-table.h" +--- a/net/batman-adv/sysfs.c ++++ b/net/batman-adv/sysfs.c +@@ -37,6 +37,7 @@ + #include + #include + #include ++#include + + #include "bridge_loop_avoidance.h" + #include "distributed-arp-table.h" +@@ -45,7 +46,6 @@ + #include "hard-interface.h" + #include "log.h" + #include "network-coding.h" +-#include "packet.h" + #include "soft-interface.h" + + static struct net_device *batadv_kobj_to_netdev(struct kobject *obj) +--- a/net/batman-adv/tp_meter.c ++++ b/net/batman-adv/tp_meter.c +@@ -48,13 +48,13 @@ + #include + #include + #include ++#include + #include + + #include "hard-interface.h" + #include "log.h" + #include "netlink.h" + #include "originator.h" +-#include "packet.h" + #include "send.h" + + /** +--- a/net/batman-adv/translation-table.c ++++ b/net/batman-adv/translation-table.c +@@ -50,6 +50,7 @@ + #include + #include + #include ++#include + #include + + #include "bridge_loop_avoidance.h" +@@ -58,7 +59,6 @@ + #include "log.h" + #include "netlink.h" + #include "originator.h" +-#include "packet.h" + #include "soft-interface.h" + #include "tvlv.h" + +--- a/net/batman-adv/tvlv.c ++++ b/net/batman-adv/tvlv.c +@@ -35,9 +35,9 @@ + #include + #include + #include ++#include + + #include "originator.h" +-#include "packet.h" + #include "send.h" + #include "tvlv.h" + +--- a/net/batman-adv/types.h ++++ b/net/batman-adv/types.h +@@ -34,10 +34,9 @@ + #include + #include + #include ++#include + #include + +-#include "packet.h" +- + struct seq_file; + + #ifdef CONFIG_BATMAN_ADV_DAT +--- /dev/null ++++ b/include/uapi/linux/batadv_packet.h +@@ -0,0 +1,623 @@ ++/* SPDX-License-Identifier: (GPL-2.0 WITH Linux-syscall-note) */ ++/* Copyright (C) 2007-2017 B.A.T.M.A.N. contributors: ++ * ++ * Marek Lindner, Simon Wunderlich ++ * ++ * This program is free software; you can redistribute it and/or ++ * modify it under the terms of version 2 of the GNU General Public ++ * License 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 . ++ */ ++ ++#ifndef _UAPI_LINUX_BATADV_PACKET_H_ ++#define _UAPI_LINUX_BATADV_PACKET_H_ ++ ++#include ++#include ++#include ++ ++#define batadv_tp_is_error(n) ((__u8)(n) > 127 ? 1 : 0) ++ ++/** ++ * enum batadv_packettype - types for batman-adv encapsulated packets ++ * @BATADV_IV_OGM: originator messages for B.A.T.M.A.N. IV ++ * @BATADV_BCAST: broadcast packets carrying broadcast payload ++ * @BATADV_CODED: network coded packets ++ * @BATADV_ELP: echo location packets for B.A.T.M.A.N. V ++ * @BATADV_OGM2: originator messages for B.A.T.M.A.N. V ++ * ++ * @BATADV_UNICAST: unicast packets carrying unicast payload traffic ++ * @BATADV_UNICAST_FRAG: unicast packets carrying a fragment of the original ++ * payload packet ++ * @BATADV_UNICAST_4ADDR: unicast packet including the originator address of ++ * the sender ++ * @BATADV_ICMP: unicast packet like IP ICMP used for ping or traceroute ++ * @BATADV_UNICAST_TVLV: unicast packet carrying TVLV containers ++ */ ++enum batadv_packettype { ++ /* 0x00 - 0x3f: local packets or special rules for handling */ ++ BATADV_IV_OGM = 0x00, ++ BATADV_BCAST = 0x01, ++ BATADV_CODED = 0x02, ++ BATADV_ELP = 0x03, ++ BATADV_OGM2 = 0x04, ++ /* 0x40 - 0x7f: unicast */ ++#define BATADV_UNICAST_MIN 0x40 ++ BATADV_UNICAST = 0x40, ++ BATADV_UNICAST_FRAG = 0x41, ++ BATADV_UNICAST_4ADDR = 0x42, ++ BATADV_ICMP = 0x43, ++ BATADV_UNICAST_TVLV = 0x44, ++#define BATADV_UNICAST_MAX 0x7f ++ /* 0x80 - 0xff: reserved */ ++}; ++ ++/** ++ * enum batadv_subtype - packet subtype for unicast4addr ++ * @BATADV_P_DATA: user payload ++ * @BATADV_P_DAT_DHT_GET: DHT request message ++ * @BATADV_P_DAT_DHT_PUT: DHT store message ++ * @BATADV_P_DAT_CACHE_REPLY: ARP reply generated by DAT ++ */ ++enum batadv_subtype { ++ BATADV_P_DATA = 0x01, ++ BATADV_P_DAT_DHT_GET = 0x02, ++ BATADV_P_DAT_DHT_PUT = 0x03, ++ BATADV_P_DAT_CACHE_REPLY = 0x04, ++}; ++ ++/* this file is included by batctl which needs these defines */ ++#define BATADV_COMPAT_VERSION 15 ++ ++/** ++ * enum batadv_iv_flags - flags used in B.A.T.M.A.N. IV OGM packets ++ * @BATADV_NOT_BEST_NEXT_HOP: flag is set when ogm packet is forwarded and was ++ * previously received from someone else than the best neighbor. ++ * @BATADV_PRIMARIES_FIRST_HOP: flag unused. ++ * @BATADV_DIRECTLINK: flag is for the first hop or if rebroadcasted from a ++ * one hop neighbor on the interface where it was originally received. ++ */ ++enum batadv_iv_flags { ++ BATADV_NOT_BEST_NEXT_HOP = 1UL << 0, ++ BATADV_PRIMARIES_FIRST_HOP = 1UL << 1, ++ BATADV_DIRECTLINK = 1UL << 2, ++}; ++ ++/* ICMP message types */ ++enum batadv_icmp_packettype { ++ BATADV_ECHO_REPLY = 0, ++ BATADV_DESTINATION_UNREACHABLE = 3, ++ BATADV_ECHO_REQUEST = 8, ++ BATADV_TTL_EXCEEDED = 11, ++ BATADV_PARAMETER_PROBLEM = 12, ++ BATADV_TP = 15, ++}; ++ ++/** ++ * enum batadv_mcast_flags - flags for multicast capabilities and settings ++ * @BATADV_MCAST_WANT_ALL_UNSNOOPABLES: we want all packets destined for ++ * 224.0.0.0/24 or ff02::1 ++ * @BATADV_MCAST_WANT_ALL_IPV4: we want all IPv4 multicast packets ++ * @BATADV_MCAST_WANT_ALL_IPV6: we want all IPv6 multicast packets ++ */ ++enum batadv_mcast_flags { ++ BATADV_MCAST_WANT_ALL_UNSNOOPABLES = 1UL << 0, ++ BATADV_MCAST_WANT_ALL_IPV4 = 1UL << 1, ++ BATADV_MCAST_WANT_ALL_IPV6 = 1UL << 2, ++}; ++ ++/* tt data subtypes */ ++#define BATADV_TT_DATA_TYPE_MASK 0x0F ++ ++/** ++ * enum batadv_tt_data_flags - flags for tt data tvlv ++ * @BATADV_TT_OGM_DIFF: TT diff propagated through OGM ++ * @BATADV_TT_REQUEST: TT request message ++ * @BATADV_TT_RESPONSE: TT response message ++ * @BATADV_TT_FULL_TABLE: contains full table to replace existing table ++ */ ++enum batadv_tt_data_flags { ++ BATADV_TT_OGM_DIFF = 1UL << 0, ++ BATADV_TT_REQUEST = 1UL << 1, ++ BATADV_TT_RESPONSE = 1UL << 2, ++ BATADV_TT_FULL_TABLE = 1UL << 4, ++}; ++ ++/** ++ * enum batadv_vlan_flags - flags for the four MSB of any vlan ID field ++ * @BATADV_VLAN_HAS_TAG: whether the field contains a valid vlan tag or not ++ */ ++enum batadv_vlan_flags { ++ BATADV_VLAN_HAS_TAG = 1UL << 15, ++}; ++ ++/* claim frame types for the bridge loop avoidance */ ++enum batadv_bla_claimframe { ++ BATADV_CLAIM_TYPE_CLAIM = 0x00, ++ BATADV_CLAIM_TYPE_UNCLAIM = 0x01, ++ BATADV_CLAIM_TYPE_ANNOUNCE = 0x02, ++ BATADV_CLAIM_TYPE_REQUEST = 0x03, ++ BATADV_CLAIM_TYPE_LOOPDETECT = 0x04, ++}; ++ ++/** ++ * enum batadv_tvlv_type - tvlv type definitions ++ * @BATADV_TVLV_GW: gateway tvlv ++ * @BATADV_TVLV_DAT: distributed arp table tvlv ++ * @BATADV_TVLV_NC: network coding tvlv ++ * @BATADV_TVLV_TT: translation table tvlv ++ * @BATADV_TVLV_ROAM: roaming advertisement tvlv ++ * @BATADV_TVLV_MCAST: multicast capability tvlv ++ */ ++enum batadv_tvlv_type { ++ BATADV_TVLV_GW = 0x01, ++ BATADV_TVLV_DAT = 0x02, ++ BATADV_TVLV_NC = 0x03, ++ BATADV_TVLV_TT = 0x04, ++ BATADV_TVLV_ROAM = 0x05, ++ BATADV_TVLV_MCAST = 0x06, ++}; ++ ++#pragma pack(2) ++/* the destination hardware field in the ARP frame is used to ++ * transport the claim type and the group id ++ */ ++struct batadv_bla_claim_dst { ++ __u8 magic[3]; /* FF:43:05 */ ++ __u8 type; /* bla_claimframe */ ++ __be16 group; /* group id */ ++}; ++ ++#pragma pack() ++ ++/** ++ * struct batadv_ogm_packet - ogm (routing protocol) packet ++ * @packet_type: batman-adv packet type, part of the general header ++ * @version: batman-adv protocol version, part of the genereal header ++ * @ttl: time to live for this packet, part of the genereal header ++ * @flags: contains routing relevant flags - see enum batadv_iv_flags ++ * @seqno: sequence identification ++ * @orig: address of the source node ++ * @prev_sender: address of the previous sender ++ * @reserved: reserved byte for alignment ++ * @tq: transmission quality ++ * @tvlv_len: length of tvlv data following the ogm header ++ */ ++struct batadv_ogm_packet { ++ __u8 packet_type; ++ __u8 version; ++ __u8 ttl; ++ __u8 flags; ++ __be32 seqno; ++ __u8 orig[ETH_ALEN]; ++ __u8 prev_sender[ETH_ALEN]; ++ __u8 reserved; ++ __u8 tq; ++ __be16 tvlv_len; ++ /* __packed is not needed as the struct size is divisible by 4, ++ * and the largest data type in this struct has a size of 4. ++ */ ++}; ++ ++#define BATADV_OGM_HLEN sizeof(struct batadv_ogm_packet) ++ ++/** ++ * struct batadv_ogm2_packet - ogm2 (routing protocol) packet ++ * @packet_type: batman-adv packet type, part of the general header ++ * @version: batman-adv protocol version, part of the general header ++ * @ttl: time to live for this packet, part of the general header ++ * @flags: reseved for routing relevant flags - currently always 0 ++ * @seqno: sequence number ++ * @orig: originator mac address ++ * @tvlv_len: length of the appended tvlv buffer (in bytes) ++ * @throughput: the currently flooded path throughput ++ */ ++struct batadv_ogm2_packet { ++ __u8 packet_type; ++ __u8 version; ++ __u8 ttl; ++ __u8 flags; ++ __be32 seqno; ++ __u8 orig[ETH_ALEN]; ++ __be16 tvlv_len; ++ __be32 throughput; ++ /* __packed is not needed as the struct size is divisible by 4, ++ * and the largest data type in this struct has a size of 4. ++ */ ++}; ++ ++#define BATADV_OGM2_HLEN sizeof(struct batadv_ogm2_packet) ++ ++/** ++ * struct batadv_elp_packet - elp (neighbor discovery) packet ++ * @packet_type: batman-adv packet type, part of the general header ++ * @version: batman-adv protocol version, part of the genereal header ++ * @orig: originator mac address ++ * @seqno: sequence number ++ * @elp_interval: currently used ELP sending interval in ms ++ */ ++struct batadv_elp_packet { ++ __u8 packet_type; ++ __u8 version; ++ __u8 orig[ETH_ALEN]; ++ __be32 seqno; ++ __be32 elp_interval; ++}; ++ ++#define BATADV_ELP_HLEN sizeof(struct batadv_elp_packet) ++ ++/** ++ * struct batadv_icmp_header - common members among all the ICMP packets ++ * @packet_type: batman-adv packet type, part of the general header ++ * @version: batman-adv protocol version, part of the genereal header ++ * @ttl: time to live for this packet, part of the genereal header ++ * @msg_type: ICMP packet type ++ * @dst: address of the destination node ++ * @orig: address of the source node ++ * @uid: local ICMP socket identifier ++ * @align: not used - useful for alignment purposes only ++ * ++ * This structure is used for ICMP packets parsing only and it is never sent ++ * over the wire. The alignment field at the end is there to ensure that ++ * members are padded the same way as they are in real packets. ++ */ ++struct batadv_icmp_header { ++ __u8 packet_type; ++ __u8 version; ++ __u8 ttl; ++ __u8 msg_type; /* see ICMP message types above */ ++ __u8 dst[ETH_ALEN]; ++ __u8 orig[ETH_ALEN]; ++ __u8 uid; ++ __u8 align[3]; ++}; ++ ++/** ++ * struct batadv_icmp_packet - ICMP packet ++ * @packet_type: batman-adv packet type, part of the general header ++ * @version: batman-adv protocol version, part of the genereal header ++ * @ttl: time to live for this packet, part of the genereal header ++ * @msg_type: ICMP packet type ++ * @dst: address of the destination node ++ * @orig: address of the source node ++ * @uid: local ICMP socket identifier ++ * @reserved: not used - useful for alignment ++ * @seqno: ICMP sequence number ++ */ ++struct batadv_icmp_packet { ++ __u8 packet_type; ++ __u8 version; ++ __u8 ttl; ++ __u8 msg_type; /* see ICMP message types above */ ++ __u8 dst[ETH_ALEN]; ++ __u8 orig[ETH_ALEN]; ++ __u8 uid; ++ __u8 reserved; ++ __be16 seqno; ++}; ++ ++/** ++ * struct batadv_icmp_tp_packet - ICMP TP Meter packet ++ * @packet_type: batman-adv packet type, part of the general header ++ * @version: batman-adv protocol version, part of the genereal header ++ * @ttl: time to live for this packet, part of the genereal header ++ * @msg_type: ICMP packet type ++ * @dst: address of the destination node ++ * @orig: address of the source node ++ * @uid: local ICMP socket identifier ++ * @subtype: TP packet subtype (see batadv_icmp_tp_subtype) ++ * @session: TP session identifier ++ * @seqno: the TP sequence number ++ * @timestamp: time when the packet has been sent. This value is filled in a ++ * TP_MSG and echoed back in the next TP_ACK so that the sender can compute the ++ * RTT. Since it is read only by the host which wrote it, there is no need to ++ * store it using network order ++ */ ++struct batadv_icmp_tp_packet { ++ __u8 packet_type; ++ __u8 version; ++ __u8 ttl; ++ __u8 msg_type; /* see ICMP message types above */ ++ __u8 dst[ETH_ALEN]; ++ __u8 orig[ETH_ALEN]; ++ __u8 uid; ++ __u8 subtype; ++ __u8 session[2]; ++ __be32 seqno; ++ __be32 timestamp; ++}; ++ ++/** ++ * enum batadv_icmp_tp_subtype - ICMP TP Meter packet subtypes ++ * @BATADV_TP_MSG: Msg from sender to receiver ++ * @BATADV_TP_ACK: acknowledgment from receiver to sender ++ */ ++enum batadv_icmp_tp_subtype { ++ BATADV_TP_MSG = 0, ++ BATADV_TP_ACK, ++}; ++ ++#define BATADV_RR_LEN 16 ++ ++/** ++ * struct batadv_icmp_packet_rr - ICMP RouteRecord packet ++ * @packet_type: batman-adv packet type, part of the general header ++ * @version: batman-adv protocol version, part of the genereal header ++ * @ttl: time to live for this packet, part of the genereal header ++ * @msg_type: ICMP packet type ++ * @dst: address of the destination node ++ * @orig: address of the source node ++ * @uid: local ICMP socket identifier ++ * @rr_cur: number of entries the rr array ++ * @seqno: ICMP sequence number ++ * @rr: route record array ++ */ ++struct batadv_icmp_packet_rr { ++ __u8 packet_type; ++ __u8 version; ++ __u8 ttl; ++ __u8 msg_type; /* see ICMP message types above */ ++ __u8 dst[ETH_ALEN]; ++ __u8 orig[ETH_ALEN]; ++ __u8 uid; ++ __u8 rr_cur; ++ __be16 seqno; ++ __u8 rr[BATADV_RR_LEN][ETH_ALEN]; ++}; ++ ++#define BATADV_ICMP_MAX_PACKET_SIZE sizeof(struct batadv_icmp_packet_rr) ++ ++/* All packet headers in front of an ethernet header have to be completely ++ * divisible by 2 but not by 4 to make the payload after the ethernet ++ * header again 4 bytes boundary aligned. ++ * ++ * A packing of 2 is necessary to avoid extra padding at the end of the struct ++ * caused by a structure member which is larger than two bytes. Otherwise ++ * the structure would not fulfill the previously mentioned rule to avoid the ++ * misalignment of the payload after the ethernet header. It may also lead to ++ * leakage of information when the padding it not initialized before sending. ++ */ ++#pragma pack(2) ++ ++/** ++ * struct batadv_unicast_packet - unicast packet for network payload ++ * @packet_type: batman-adv packet type, part of the general header ++ * @version: batman-adv protocol version, part of the genereal header ++ * @ttl: time to live for this packet, part of the genereal header ++ * @ttvn: translation table version number ++ * @dest: originator destination of the unicast packet ++ */ ++struct batadv_unicast_packet { ++ __u8 packet_type; ++ __u8 version; ++ __u8 ttl; ++ __u8 ttvn; /* destination translation table version number */ ++ __u8 dest[ETH_ALEN]; ++ /* "4 bytes boundary + 2 bytes" long to make the payload after the ++ * following ethernet header again 4 bytes boundary aligned ++ */ ++}; ++ ++/** ++ * struct batadv_unicast_4addr_packet - extended unicast packet ++ * @u: common unicast packet header ++ * @src: address of the source ++ * @subtype: packet subtype ++ * @reserved: reserved byte for alignment ++ */ ++struct batadv_unicast_4addr_packet { ++ struct batadv_unicast_packet u; ++ __u8 src[ETH_ALEN]; ++ __u8 subtype; ++ __u8 reserved; ++ /* "4 bytes boundary + 2 bytes" long to make the payload after the ++ * following ethernet header again 4 bytes boundary aligned ++ */ ++}; ++ ++/** ++ * struct batadv_frag_packet - fragmented packet ++ * @packet_type: batman-adv packet type, part of the general header ++ * @version: batman-adv protocol version, part of the genereal header ++ * @ttl: time to live for this packet, part of the genereal header ++ * @dest: final destination used when routing fragments ++ * @orig: originator of the fragment used when merging the packet ++ * @no: fragment number within this sequence ++ * @priority: priority of frame, from ToS IP precedence or 802.1p ++ * @reserved: reserved byte for alignment ++ * @seqno: sequence identification ++ * @total_size: size of the merged packet ++ */ ++struct batadv_frag_packet { ++ __u8 packet_type; ++ __u8 version; /* batman version field */ ++ __u8 ttl; ++#if defined(__BIG_ENDIAN_BITFIELD) ++ __u8 no:4; ++ __u8 priority:3; ++ __u8 reserved:1; ++#elif defined(__LITTLE_ENDIAN_BITFIELD) ++ __u8 reserved:1; ++ __u8 priority:3; ++ __u8 no:4; ++#else ++#error "unknown bitfield endianness" ++#endif ++ __u8 dest[ETH_ALEN]; ++ __u8 orig[ETH_ALEN]; ++ __be16 seqno; ++ __be16 total_size; ++}; ++ ++/** ++ * struct batadv_bcast_packet - broadcast packet for network payload ++ * @packet_type: batman-adv packet type, part of the general header ++ * @version: batman-adv protocol version, part of the genereal header ++ * @ttl: time to live for this packet, part of the genereal header ++ * @reserved: reserved byte for alignment ++ * @seqno: sequence identification ++ * @orig: originator of the broadcast packet ++ */ ++struct batadv_bcast_packet { ++ __u8 packet_type; ++ __u8 version; /* batman version field */ ++ __u8 ttl; ++ __u8 reserved; ++ __be32 seqno; ++ __u8 orig[ETH_ALEN]; ++ /* "4 bytes boundary + 2 bytes" long to make the payload after the ++ * following ethernet header again 4 bytes boundary aligned ++ */ ++}; ++ ++/** ++ * struct batadv_coded_packet - network coded packet ++ * @packet_type: batman-adv packet type, part of the general header ++ * @version: batman-adv protocol version, part of the genereal header ++ * @ttl: time to live for this packet, part of the genereal header ++ * @first_source: original source of first included packet ++ * @first_orig_dest: original destinal of first included packet ++ * @first_crc: checksum of first included packet ++ * @first_ttvn: tt-version number of first included packet ++ * @second_ttl: ttl of second packet ++ * @second_dest: second receiver of this coded packet ++ * @second_source: original source of second included packet ++ * @second_orig_dest: original destination of second included packet ++ * @second_crc: checksum of second included packet ++ * @second_ttvn: tt version number of second included packet ++ * @coded_len: length of network coded part of the payload ++ */ ++struct batadv_coded_packet { ++ __u8 packet_type; ++ __u8 version; /* batman version field */ ++ __u8 ttl; ++ __u8 first_ttvn; ++ /* __u8 first_dest[ETH_ALEN]; - saved in mac header destination */ ++ __u8 first_source[ETH_ALEN]; ++ __u8 first_orig_dest[ETH_ALEN]; ++ __be32 first_crc; ++ __u8 second_ttl; ++ __u8 second_ttvn; ++ __u8 second_dest[ETH_ALEN]; ++ __u8 second_source[ETH_ALEN]; ++ __u8 second_orig_dest[ETH_ALEN]; ++ __be32 second_crc; ++ __be16 coded_len; ++}; ++ ++#pragma pack() ++ ++/** ++ * struct batadv_unicast_tvlv_packet - generic unicast packet with tvlv payload ++ * @packet_type: batman-adv packet type, part of the general header ++ * @version: batman-adv protocol version, part of the genereal header ++ * @ttl: time to live for this packet, part of the genereal header ++ * @reserved: reserved field (for packet alignment) ++ * @src: address of the source ++ * @dst: address of the destination ++ * @tvlv_len: length of tvlv data following the unicast tvlv header ++ * @align: 2 bytes to align the header to a 4 byte boundary ++ */ ++struct batadv_unicast_tvlv_packet { ++ __u8 packet_type; ++ __u8 version; /* batman version field */ ++ __u8 ttl; ++ __u8 reserved; ++ __u8 dst[ETH_ALEN]; ++ __u8 src[ETH_ALEN]; ++ __be16 tvlv_len; ++ __u16 align; ++}; ++ ++/** ++ * struct batadv_tvlv_hdr - base tvlv header struct ++ * @type: tvlv container type (see batadv_tvlv_type) ++ * @version: tvlv container version ++ * @len: tvlv container length ++ */ ++struct batadv_tvlv_hdr { ++ __u8 type; ++ __u8 version; ++ __be16 len; ++}; ++ ++/** ++ * struct batadv_tvlv_gateway_data - gateway data propagated through gw tvlv ++ * container ++ * @bandwidth_down: advertised uplink download bandwidth ++ * @bandwidth_up: advertised uplink upload bandwidth ++ */ ++struct batadv_tvlv_gateway_data { ++ __be32 bandwidth_down; ++ __be32 bandwidth_up; ++}; ++ ++/** ++ * struct batadv_tvlv_tt_data - tt data propagated through the tt tvlv container ++ * @flags: translation table flags (see batadv_tt_data_flags) ++ * @ttvn: translation table version number ++ * @num_vlan: number of announced VLANs. In the TVLV this struct is followed by ++ * one batadv_tvlv_tt_vlan_data object per announced vlan ++ */ ++struct batadv_tvlv_tt_data { ++ __u8 flags; ++ __u8 ttvn; ++ __be16 num_vlan; ++}; ++ ++/** ++ * struct batadv_tvlv_tt_vlan_data - vlan specific tt data propagated through ++ * the tt tvlv container ++ * @crc: crc32 checksum of the entries belonging to this vlan ++ * @vid: vlan identifier ++ * @reserved: unused, useful for alignment purposes ++ */ ++struct batadv_tvlv_tt_vlan_data { ++ __be32 crc; ++ __be16 vid; ++ __u16 reserved; ++}; ++ ++/** ++ * struct batadv_tvlv_tt_change - translation table diff data ++ * @flags: status indicators concerning the non-mesh client (see ++ * batadv_tt_client_flags) ++ * @reserved: reserved field - useful for alignment purposes only ++ * @addr: mac address of non-mesh client that triggered this tt change ++ * @vid: VLAN identifier ++ */ ++struct batadv_tvlv_tt_change { ++ __u8 flags; ++ __u8 reserved[3]; ++ __u8 addr[ETH_ALEN]; ++ __be16 vid; ++}; ++ ++/** ++ * struct batadv_tvlv_roam_adv - roaming advertisement ++ * @client: mac address of roaming client ++ * @vid: VLAN identifier ++ */ ++struct batadv_tvlv_roam_adv { ++ __u8 client[ETH_ALEN]; ++ __be16 vid; ++}; ++ ++/** ++ * struct batadv_tvlv_mcast_data - payload of a multicast tvlv ++ * @flags: multicast flags announced by the orig node ++ * @reserved: reserved field ++ */ ++struct batadv_tvlv_mcast_data { ++ __u8 flags; ++ __u8 reserved[3]; ++}; ++ ++#endif /* _UAPI_LINUX_BATADV_PACKET_H_ */ diff --git a/target/linux/generic/backport-4.14/274-flow_dissector-Parse-batman-adv-unicast-headers.patch b/target/linux/generic/backport-4.14/274-flow_dissector-Parse-batman-adv-unicast-headers.patch new file mode 100644 index 0000000000..b0b2823cc9 --- /dev/null +++ b/target/linux/generic/backport-4.14/274-flow_dissector-Parse-batman-adv-unicast-headers.patch @@ -0,0 +1,108 @@ +From: Sven Eckelmann +Date: Thu, 21 Dec 2017 10:17:42 +0100 +Subject: [PATCH] flow_dissector: Parse batman-adv unicast headers + +The batman-adv unicast packets contain a full layer 2 frame in encapsulated +form. The flow dissector must therefore be able to parse the batman-adv +unicast header to reach the layer 2+3 information. + + +--------------------+ + | ip(v6)hdr | + +--------------------+ + | inner ethhdr | + +--------------------+ + | batadv unicast hdr | + +--------------------+ + | outer ethhdr | + +--------------------+ + +The obtained information from the upper layer can then be used by RPS to +schedule the processing on separate cores. This allows better distribution +of multiple flows from the same neighbor to different cores. + +Signed-off-by: Sven Eckelmann +Reviewed-by: Jiri Pirko +Acked-by: Willem de Bruijn +Signed-off-by: David S. Miller +--- + +--- a/net/core/flow_dissector.c ++++ b/net/core/flow_dissector.c +@@ -22,6 +22,7 @@ + #include + #include + #include ++#include + + static void dissector_set_key(struct flow_dissector *flow_dissector, + enum flow_dissector_key_id key_id) +@@ -338,6 +339,57 @@ __skb_flow_dissect_gre(const struct sk_b + return FLOW_DISSECT_RET_PROTO_AGAIN; + } + ++/** ++ * __skb_flow_dissect_batadv() - dissect batman-adv header ++ * @skb: sk_buff to with the batman-adv header ++ * @key_control: flow dissectors control key ++ * @data: raw buffer pointer to the packet, if NULL use skb->data ++ * @p_proto: pointer used to update the protocol to process next ++ * @p_nhoff: pointer used to update inner network header offset ++ * @hlen: packet header length ++ * @flags: any combination of FLOW_DISSECTOR_F_* ++ * ++ * ETH_P_BATMAN packets are tried to be dissected. Only ++ * &struct batadv_unicast packets are actually processed because they contain an ++ * inner ethernet header and are usually followed by actual network header. This ++ * allows the flow dissector to continue processing the packet. ++ * ++ * Return: FLOW_DISSECT_RET_PROTO_AGAIN when &struct batadv_unicast was found, ++ * FLOW_DISSECT_RET_OUT_GOOD when dissector should stop after encapsulation, ++ * otherwise FLOW_DISSECT_RET_OUT_BAD ++ */ ++static enum flow_dissect_ret ++__skb_flow_dissect_batadv(const struct sk_buff *skb, ++ struct flow_dissector_key_control *key_control, ++ void *data, __be16 *p_proto, int *p_nhoff, int hlen, ++ unsigned int flags) ++{ ++ struct { ++ struct batadv_unicast_packet batadv_unicast; ++ struct ethhdr eth; ++ } *hdr, _hdr; ++ ++ hdr = __skb_header_pointer(skb, *p_nhoff, sizeof(_hdr), data, hlen, ++ &_hdr); ++ if (!hdr) ++ return FLOW_DISSECT_RET_OUT_BAD; ++ ++ if (hdr->batadv_unicast.version != BATADV_COMPAT_VERSION) ++ return FLOW_DISSECT_RET_OUT_BAD; ++ ++ if (hdr->batadv_unicast.packet_type != BATADV_UNICAST) ++ return FLOW_DISSECT_RET_OUT_BAD; ++ ++ *p_proto = hdr->eth.h_proto; ++ *p_nhoff += sizeof(*hdr); ++ ++ key_control->flags |= FLOW_DIS_ENCAPSULATION; ++ if (flags & FLOW_DISSECTOR_F_STOP_AT_ENCAP) ++ return FLOW_DISSECT_RET_OUT_GOOD; ++ ++ return FLOW_DISSECT_RET_PROTO_AGAIN; ++} ++ + static void + __skb_flow_dissect_tcp(const struct sk_buff *skb, + struct flow_dissector *flow_dissector, +@@ -717,6 +769,11 @@ proto_again: + nhoff, hlen); + break; + ++ case htons(ETH_P_BATMAN): ++ fdret = __skb_flow_dissect_batadv(skb, key_control, data, ++ &proto, &nhoff, hlen, flags); ++ break; ++ + default: + fdret = FLOW_DISSECT_RET_OUT_BAD; + break; diff --git a/target/linux/generic/backport-4.14/293-v4.16-netfilter-reduce-size-of-hook-entry-point-locations.patch b/target/linux/generic/backport-4.14/293-v4.16-netfilter-reduce-size-of-hook-entry-point-locations.patch index fcf54e9858..aad588f19b 100644 --- a/target/linux/generic/backport-4.14/293-v4.16-netfilter-reduce-size-of-hook-entry-point-locations.patch +++ b/target/linux/generic/backport-4.14/293-v4.16-netfilter-reduce-size-of-hook-entry-point-locations.patch @@ -92,7 +92,7 @@ Signed-off-by: Pablo Neira Ayuso #endif --- a/net/bridge/br_netfilter_hooks.c +++ b/net/bridge/br_netfilter_hooks.c -@@ -992,7 +992,7 @@ int br_nf_hook_thresh(unsigned int hook, +@@ -988,7 +988,7 @@ int br_nf_hook_thresh(unsigned int hook, unsigned int i; int ret; @@ -159,7 +159,7 @@ Signed-off-by: Pablo Neira Ayuso net->nf.proc_netfilter = proc_net_mkdir(net, "netfilter", --- a/net/netfilter/nf_queue.c +++ b/net/netfilter/nf_queue.c -@@ -201,6 +201,23 @@ repeat: +@@ -206,6 +206,23 @@ repeat: return NF_ACCEPT; } @@ -183,7 +183,7 @@ Signed-off-by: Pablo Neira Ayuso /* Caller must hold rcu read-side lock */ void nf_reinject(struct nf_queue_entry *entry, unsigned int verdict) { -@@ -216,12 +233,12 @@ void nf_reinject(struct nf_queue_entry * +@@ -221,12 +238,12 @@ void nf_reinject(struct nf_queue_entry * net = entry->state.net; pf = entry->state.pf; diff --git a/target/linux/generic/backport-4.14/296-v4.16-netfilter-don-t-allocate-space-for-arp-bridge-hooks-.patch b/target/linux/generic/backport-4.14/296-v4.16-netfilter-don-t-allocate-space-for-arp-bridge-hooks-.patch index 9444f6bb48..41675c3494 100644 --- a/target/linux/generic/backport-4.14/296-v4.16-netfilter-don-t-allocate-space-for-arp-bridge-hooks-.patch +++ b/target/linux/generic/backport-4.14/296-v4.16-netfilter-don-t-allocate-space-for-arp-bridge-hooks-.patch @@ -152,7 +152,7 @@ Signed-off-by: Pablo Neira Ayuso #endif --- a/net/netfilter/nf_queue.c +++ b/net/netfilter/nf_queue.c -@@ -204,8 +204,10 @@ repeat: +@@ -209,8 +209,10 @@ repeat: static struct nf_hook_entries *nf_hook_entries_head(const struct net *net, u8 pf, u8 hooknum) { switch (pf) { diff --git a/target/linux/generic/backport-4.14/301-v4.16-netfilter-core-only-allow-one-nat-hook-per-hook-poin.patch b/target/linux/generic/backport-4.14/301-v4.16-netfilter-core-only-allow-one-nat-hook-per-hook-poin.patch index 05888a070e..80fd3678af 100644 --- a/target/linux/generic/backport-4.14/301-v4.16-netfilter-core-only-allow-one-nat-hook-per-hook-poin.patch +++ b/target/linux/generic/backport-4.14/301-v4.16-netfilter-core-only-allow-one-nat-hook-per-hook-poin.patch @@ -135,7 +135,7 @@ Signed-off-by: Pablo Neira Ayuso new->hooks[nhooks] = old->hooks[i]; --- a/net/netfilter/nf_tables_api.c +++ b/net/netfilter/nf_tables_api.c -@@ -1431,6 +1431,8 @@ static int nf_tables_addchain(struct nft +@@ -1446,6 +1446,8 @@ static int nf_tables_addchain(struct nft ops->hook = hookfn; if (afi->hook_ops_init) afi->hook_ops_init(ops, i); diff --git a/target/linux/generic/backport-4.14/303-v4.16-netfilter-nf_tables-remove-multihook-chains-and-fami.patch b/target/linux/generic/backport-4.14/303-v4.16-netfilter-nf_tables-remove-multihook-chains-and-fami.patch index 4c00ea8456..130fad7d8f 100644 --- a/target/linux/generic/backport-4.14/303-v4.16-netfilter-nf_tables-remove-multihook-chains-and-fami.patch +++ b/target/linux/generic/backport-4.14/303-v4.16-netfilter-nf_tables-remove-multihook-chains-and-fami.patch @@ -128,7 +128,7 @@ Signed-off-by: Pablo Neira Ayuso } static int nft_trans_table_add(struct nft_ctx *ctx, int msg_type) -@@ -624,8 +621,7 @@ static void _nf_tables_table_disable(str +@@ -639,8 +636,7 @@ static void _nf_tables_table_disable(str if (cnt && i++ == cnt) break; @@ -138,7 +138,7 @@ Signed-off-by: Pablo Neira Ayuso } } -@@ -642,8 +638,7 @@ static int nf_tables_table_enable(struct +@@ -657,8 +653,7 @@ static int nf_tables_table_enable(struct if (!nft_is_base_chain(chain)) continue; @@ -148,7 +148,7 @@ Signed-off-by: Pablo Neira Ayuso if (err < 0) goto err; -@@ -1055,7 +1050,7 @@ static int nf_tables_fill_chain_info(str +@@ -1070,7 +1065,7 @@ static int nf_tables_fill_chain_info(str if (nft_is_base_chain(chain)) { const struct nft_base_chain *basechain = nft_base_chain(chain); @@ -157,7 +157,7 @@ Signed-off-by: Pablo Neira Ayuso struct nlattr *nest; nest = nla_nest_start(skb, NFTA_CHAIN_HOOK); -@@ -1283,8 +1278,8 @@ static void nf_tables_chain_destroy(stru +@@ -1298,8 +1293,8 @@ static void nf_tables_chain_destroy(stru free_percpu(basechain->stats); if (basechain->stats) static_branch_dec(&nft_counters_enabled); @@ -168,7 +168,7 @@ Signed-off-by: Pablo Neira Ayuso kfree(chain->name); kfree(basechain); } else { -@@ -1380,7 +1375,6 @@ static int nf_tables_addchain(struct nft +@@ -1395,7 +1390,6 @@ static int nf_tables_addchain(struct nft struct nft_stats __percpu *stats; struct net *net = ctx->net; struct nft_chain *chain; @@ -176,7 +176,7 @@ Signed-off-by: Pablo Neira Ayuso int err; if (table->use == UINT_MAX) -@@ -1419,21 +1413,18 @@ static int nf_tables_addchain(struct nft +@@ -1434,21 +1428,18 @@ static int nf_tables_addchain(struct nft basechain->type = hook.type; chain = &basechain->chain; @@ -210,7 +210,7 @@ Signed-off-by: Pablo Neira Ayuso chain->flags |= NFT_BASE_CHAIN; basechain->policy = policy; -@@ -1451,7 +1442,7 @@ static int nf_tables_addchain(struct nft +@@ -1466,7 +1457,7 @@ static int nf_tables_addchain(struct nft goto err1; } @@ -219,7 +219,7 @@ Signed-off-by: Pablo Neira Ayuso if (err < 0) goto err1; -@@ -1465,7 +1456,7 @@ static int nf_tables_addchain(struct nft +@@ -1480,7 +1471,7 @@ static int nf_tables_addchain(struct nft return 0; err2: @@ -228,7 +228,7 @@ Signed-off-by: Pablo Neira Ayuso err1: nf_tables_chain_destroy(chain); -@@ -1478,13 +1469,12 @@ static int nf_tables_updchain(struct nft +@@ -1493,13 +1484,12 @@ static int nf_tables_updchain(struct nft const struct nlattr * const *nla = ctx->nla; struct nft_table *table = ctx->table; struct nft_chain *chain = ctx->chain; @@ -243,7 +243,7 @@ Signed-off-by: Pablo Neira Ayuso if (nla[NFTA_CHAIN_HOOK]) { if (!nft_is_base_chain(chain)) -@@ -1501,14 +1491,12 @@ static int nf_tables_updchain(struct nft +@@ -1516,14 +1506,12 @@ static int nf_tables_updchain(struct nft return -EBUSY; } @@ -264,7 +264,7 @@ Signed-off-by: Pablo Neira Ayuso } nft_chain_release_hook(&hook); } -@@ -5129,10 +5117,9 @@ static int nf_tables_commit(struct net * +@@ -5153,10 +5141,9 @@ static int nf_tables_commit(struct net * case NFT_MSG_DELCHAIN: list_del_rcu(&trans->ctx.chain->list); nf_tables_chain_notify(&trans->ctx, NFT_MSG_DELCHAIN); @@ -278,7 +278,7 @@ Signed-off-by: Pablo Neira Ayuso break; case NFT_MSG_NEWRULE: nft_clear(trans->ctx.net, nft_trans_rule(trans)); -@@ -5269,10 +5256,9 @@ static int nf_tables_abort(struct net *n +@@ -5293,10 +5280,9 @@ static int nf_tables_abort(struct net *n } else { trans->ctx.table->use--; list_del_rcu(&trans->ctx.chain->list); @@ -292,7 +292,7 @@ Signed-off-by: Pablo Neira Ayuso } break; case NFT_MSG_DELCHAIN: -@@ -5375,7 +5361,7 @@ int nft_chain_validate_hooks(const struc +@@ -5399,7 +5385,7 @@ int nft_chain_validate_hooks(const struc if (nft_is_base_chain(chain)) { basechain = nft_base_chain(chain); @@ -301,7 +301,7 @@ Signed-off-by: Pablo Neira Ayuso return 0; return -EOPNOTSUPP; -@@ -5857,8 +5843,7 @@ int __nft_release_basechain(struct nft_c +@@ -5881,8 +5867,7 @@ int __nft_release_basechain(struct nft_c BUG_ON(!nft_is_base_chain(ctx->chain)); @@ -311,7 +311,7 @@ Signed-off-by: Pablo Neira Ayuso list_for_each_entry_safe(rule, nr, &ctx->chain->rules, list) { list_del(&rule->list); ctx->chain->use--; -@@ -5887,8 +5872,7 @@ static void __nft_release_afinfo(struct +@@ -5911,8 +5896,7 @@ static void __nft_release_afinfo(struct list_for_each_entry_safe(table, nt, &afi->tables, list) { list_for_each_entry(chain, &table->chains, list) @@ -361,7 +361,7 @@ Signed-off-by: Pablo Neira Ayuso par->hook_mask = 1 << ops->hooknum; } else { -@@ -317,7 +317,7 @@ static int nft_target_validate(const str +@@ -318,7 +318,7 @@ static int nft_target_validate(const str if (nft_is_base_chain(ctx->chain)) { const struct nft_base_chain *basechain = nft_base_chain(ctx->chain); @@ -370,7 +370,7 @@ Signed-off-by: Pablo Neira Ayuso hook_mask = 1 << ops->hooknum; if (target->hooks && !(hook_mask & target->hooks)) -@@ -414,7 +414,7 @@ nft_match_set_mtchk_param(struct xt_mtch +@@ -415,7 +415,7 @@ nft_match_set_mtchk_param(struct xt_mtch if (nft_is_base_chain(ctx->chain)) { const struct nft_base_chain *basechain = nft_base_chain(ctx->chain); @@ -379,7 +379,7 @@ Signed-off-by: Pablo Neira Ayuso par->hook_mask = 1 << ops->hooknum; } else { -@@ -565,7 +565,7 @@ static int nft_match_validate(const stru +@@ -566,7 +566,7 @@ static int nft_match_validate(const stru if (nft_is_base_chain(ctx->chain)) { const struct nft_base_chain *basechain = nft_base_chain(ctx->chain); diff --git a/target/linux/generic/backport-4.14/304-v4.16-netfilter-move-checksum-indirection-to-struct-nf_ipv.patch b/target/linux/generic/backport-4.14/304-v4.16-netfilter-move-checksum-indirection-to-struct-nf_ipv.patch index a73256a2c9..07202fe591 100644 --- a/target/linux/generic/backport-4.14/304-v4.16-netfilter-move-checksum-indirection-to-struct-nf_ipv.patch +++ b/target/linux/generic/backport-4.14/304-v4.16-netfilter-move-checksum-indirection-to-struct-nf_ipv.patch @@ -116,7 +116,7 @@ Signed-off-by: Pablo Neira Ayuso .saveroute = nf_ip_saveroute, --- a/net/ipv6/netfilter.c +++ b/net/ipv6/netfilter.c -@@ -194,12 +194,12 @@ static __sum16 nf_ip6_checksum_partial(s +@@ -196,12 +196,12 @@ static __sum16 nf_ip6_checksum_partial(s static const struct nf_ipv6_ops ipv6ops = { .chk_addr = ipv6_chk_addr, .route_input = ip6_route_input, diff --git a/target/linux/generic/backport-4.14/305-v4.16-netfilter-move-checksum_partial-indirection-to-struc.patch b/target/linux/generic/backport-4.14/305-v4.16-netfilter-move-checksum_partial-indirection-to-struc.patch index 6ef0928257..39f5564404 100644 --- a/target/linux/generic/backport-4.14/305-v4.16-netfilter-move-checksum_partial-indirection-to-struc.patch +++ b/target/linux/generic/backport-4.14/305-v4.16-netfilter-move-checksum_partial-indirection-to-struc.patch @@ -151,7 +151,7 @@ Signed-off-by: Pablo Neira Ayuso .reroute = nf_ip_reroute, --- a/net/ipv6/netfilter.c +++ b/net/ipv6/netfilter.c -@@ -192,15 +192,15 @@ static __sum16 nf_ip6_checksum_partial(s +@@ -194,15 +194,15 @@ static __sum16 nf_ip6_checksum_partial(s }; static const struct nf_ipv6_ops ipv6ops = { diff --git a/target/linux/generic/backport-4.14/306-v4.16-netfilter-remove-saveroute-indirection-in-struct-nf_.patch b/target/linux/generic/backport-4.14/306-v4.16-netfilter-remove-saveroute-indirection-in-struct-nf_.patch index 2b44066f1a..943b3eed30 100644 --- a/target/linux/generic/backport-4.14/306-v4.16-netfilter-remove-saveroute-indirection-in-struct-nf_.patch +++ b/target/linux/generic/backport-4.14/306-v4.16-netfilter-remove-saveroute-indirection-in-struct-nf_.patch @@ -125,7 +125,7 @@ Signed-off-by: Pablo Neira Ayuso }; --- a/net/ipv6/netfilter.c +++ b/net/ipv6/netfilter.c -@@ -70,31 +70,6 @@ int ip6_route_me_harder(struct net *net, +@@ -72,31 +72,6 @@ int ip6_route_me_harder(struct net *net, } EXPORT_SYMBOL(ip6_route_me_harder); @@ -157,7 +157,7 @@ Signed-off-by: Pablo Neira Ayuso static int nf_ip6_reroute(struct net *net, struct sk_buff *skb, const struct nf_queue_entry *entry) { -@@ -202,7 +177,6 @@ static const struct nf_ipv6_ops ipv6ops +@@ -204,7 +179,6 @@ static const struct nf_ipv6_ops ipv6ops static const struct nf_afinfo nf_ip6_afinfo = { .family = AF_INET6, .route = nf_ip6_route, @@ -212,10 +212,10 @@ Signed-off-by: Pablo Neira Ayuso static int __nf_queue(struct sk_buff *skb, const struct nf_hook_state *state, const struct nf_hook_entries *entries, unsigned int index, unsigned int queuenum) -@@ -144,7 +175,16 @@ static int __nf_queue(struct sk_buff *sk +@@ -148,7 +179,16 @@ static int __nf_queue(struct sk_buff *sk + }; nf_queue_entry_get_refs(entry); - skb_dst_force(skb); - afinfo->saveroute(skb, entry); + + switch (entry->state.pf) { diff --git a/target/linux/generic/backport-4.14/307-v4.16-netfilter-move-route-indirection-to-struct-nf_ipv6_o.patch b/target/linux/generic/backport-4.14/307-v4.16-netfilter-move-route-indirection-to-struct-nf_ipv6_o.patch index eb3e29349a..a594f87cd9 100644 --- a/target/linux/generic/backport-4.14/307-v4.16-netfilter-move-route-indirection-to-struct-nf_ipv6_o.patch +++ b/target/linux/generic/backport-4.14/307-v4.16-netfilter-move-route-indirection-to-struct-nf_ipv6_o.patch @@ -114,7 +114,7 @@ Signed-off-by: Pablo Neira Ayuso }; --- a/net/ipv6/netfilter.c +++ b/net/ipv6/netfilter.c -@@ -172,11 +172,11 @@ static const struct nf_ipv6_ops ipv6ops +@@ -174,11 +174,11 @@ static const struct nf_ipv6_ops ipv6ops .fragment = ip6_fragment, .checksum = nf_ip6_checksum, .checksum_partial = nf_ip6_checksum_partial, diff --git a/target/linux/generic/backport-4.14/308-v4.16-netfilter-move-reroute-indirection-to-struct-nf_ipv6.patch b/target/linux/generic/backport-4.14/308-v4.16-netfilter-move-reroute-indirection-to-struct-nf_ipv6.patch index d45c4ef85b..810f57ca19 100644 --- a/target/linux/generic/backport-4.14/308-v4.16-netfilter-move-reroute-indirection-to-struct-nf_ipv6.patch +++ b/target/linux/generic/backport-4.14/308-v4.16-netfilter-move-reroute-indirection-to-struct-nf_ipv6.patch @@ -138,7 +138,7 @@ Signed-off-by: Pablo Neira Ayuso --- a/net/ipv6/netfilter.c +++ b/net/ipv6/netfilter.c -@@ -70,7 +70,7 @@ int ip6_route_me_harder(struct net *net, +@@ -72,7 +72,7 @@ int ip6_route_me_harder(struct net *net, } EXPORT_SYMBOL(ip6_route_me_harder); @@ -147,7 +147,7 @@ Signed-off-by: Pablo Neira Ayuso const struct nf_queue_entry *entry) { struct ip6_rt_info *rt_info = nf_queue_entry_reroute(entry); -@@ -80,7 +80,7 @@ static int nf_ip6_reroute(struct net *ne +@@ -82,7 +82,7 @@ static int nf_ip6_reroute(struct net *ne if (!ipv6_addr_equal(&iph->daddr, &rt_info->daddr) || !ipv6_addr_equal(&iph->saddr, &rt_info->saddr) || skb->mark != rt_info->mark) @@ -156,7 +156,7 @@ Signed-off-by: Pablo Neira Ayuso } return 0; } -@@ -173,11 +173,11 @@ static const struct nf_ipv6_ops ipv6ops +@@ -175,11 +175,11 @@ static const struct nf_ipv6_ops ipv6ops .checksum = nf_ip6_checksum, .checksum_partial = nf_ip6_checksum_partial, .route = nf_ip6_route, @@ -171,7 +171,7 @@ Signed-off-by: Pablo Neira Ayuso --- a/net/netfilter/nf_queue.c +++ b/net/netfilter/nf_queue.c -@@ -266,7 +266,6 @@ void nf_reinject(struct nf_queue_entry * +@@ -271,7 +271,6 @@ void nf_reinject(struct nf_queue_entry * const struct nf_hook_entry *hook_entry; const struct nf_hook_entries *hooks; struct sk_buff *skb = entry->skb; @@ -179,7 +179,7 @@ Signed-off-by: Pablo Neira Ayuso const struct net *net; unsigned int i; int err; -@@ -293,8 +292,7 @@ void nf_reinject(struct nf_queue_entry * +@@ -298,8 +297,7 @@ void nf_reinject(struct nf_queue_entry * verdict = nf_hook_entry_hookfn(hook_entry, skb, &entry->state); if (verdict == NF_ACCEPT) { diff --git a/target/linux/generic/backport-4.14/309-v4.16-netfilter-remove-route_key_size-field-in-struct-nf_a.patch b/target/linux/generic/backport-4.14/309-v4.16-netfilter-remove-route_key_size-field-in-struct-nf_a.patch index 270379346a..20820e40ca 100644 --- a/target/linux/generic/backport-4.14/309-v4.16-netfilter-remove-route_key_size-field-in-struct-nf_a.patch +++ b/target/linux/generic/backport-4.14/309-v4.16-netfilter-remove-route_key_size-field-in-struct-nf_a.patch @@ -29,7 +29,7 @@ Signed-off-by: Pablo Neira Ayuso static int __init ipv4_netfilter_init(void) --- a/net/ipv6/netfilter.c +++ b/net/ipv6/netfilter.c -@@ -178,7 +178,6 @@ static const struct nf_ipv6_ops ipv6ops +@@ -180,7 +180,6 @@ static const struct nf_ipv6_ops ipv6ops static const struct nf_afinfo nf_ip6_afinfo = { .family = AF_INET6, @@ -83,7 +83,7 @@ Signed-off-by: Pablo Neira Ayuso if (!entry) { status = -ENOMEM; goto err; -@@ -170,7 +180,7 @@ static int __nf_queue(struct sk_buff *sk +@@ -175,7 +185,7 @@ static int __nf_queue(struct sk_buff *sk .skb = skb, .state = *state, .hook_index = index, diff --git a/target/linux/generic/backport-4.14/310-v4.16-netfilter-remove-struct-nf_afinfo-and-its-helper-fun.patch b/target/linux/generic/backport-4.14/310-v4.16-netfilter-remove-struct-nf_afinfo-and-its-helper-fun.patch index 381b99721a..be3f7336bd 100644 --- a/target/linux/generic/backport-4.14/310-v4.16-netfilter-remove-struct-nf_afinfo-and-its-helper-fun.patch +++ b/target/linux/generic/backport-4.14/310-v4.16-netfilter-remove-struct-nf_afinfo-and-its-helper-fun.patch @@ -102,7 +102,7 @@ Signed-off-by: Pablo Neira Ayuso -subsys_initcall(ipv4_netfilter_init); --- a/net/ipv6/netfilter.c +++ b/net/ipv6/netfilter.c -@@ -176,14 +176,10 @@ static const struct nf_ipv6_ops ipv6ops +@@ -178,14 +178,10 @@ static const struct nf_ipv6_ops ipv6ops .reroute = nf_ip6_reroute, }; @@ -118,7 +118,7 @@ Signed-off-by: Pablo Neira Ayuso } /* This can be called from inet6_init() on errors, so it cannot -@@ -192,5 +188,4 @@ int __init ipv6_netfilter_init(void) +@@ -194,5 +190,4 @@ int __init ipv6_netfilter_init(void) void ipv6_netfilter_fini(void) { RCU_INIT_POINTER(nf_ipv6_ops, NULL); diff --git a/target/linux/generic/backport-4.14/312-v4.16-netfilter-nf_tables-remove-hooks-from-family-definit.patch b/target/linux/generic/backport-4.14/312-v4.16-netfilter-nf_tables-remove-hooks-from-family-definit.patch index 3ee8ad9d33..8f7d11bd67 100644 --- a/target/linux/generic/backport-4.14/312-v4.16-netfilter-nf_tables-remove-hooks-from-family-definit.patch +++ b/target/linux/generic/backport-4.14/312-v4.16-netfilter-nf_tables-remove-hooks-from-family-definit.patch @@ -151,7 +151,7 @@ Signed-off-by: Pablo Neira Ayuso static int __init nf_tables_ipv6_init(void) --- a/net/netfilter/nf_tables_api.c +++ b/net/netfilter/nf_tables_api.c -@@ -1383,7 +1383,6 @@ static int nf_tables_addchain(struct nft +@@ -1398,7 +1398,6 @@ static int nf_tables_addchain(struct nft if (nla[NFTA_CHAIN_HOOK]) { struct nft_chain_hook hook; struct nf_hook_ops *ops; @@ -159,7 +159,7 @@ Signed-off-by: Pablo Neira Ayuso err = nft_chain_parse_hook(net, nla, afi, &hook, create); if (err < 0) -@@ -1409,7 +1408,6 @@ static int nf_tables_addchain(struct nft +@@ -1424,7 +1423,6 @@ static int nf_tables_addchain(struct nft static_branch_inc(&nft_counters_enabled); } @@ -167,7 +167,7 @@ Signed-off-by: Pablo Neira Ayuso basechain->type = hook.type; chain = &basechain->chain; -@@ -1418,10 +1416,8 @@ static int nf_tables_addchain(struct nft +@@ -1433,10 +1431,8 @@ static int nf_tables_addchain(struct nft ops->hooknum = hook.num; ops->priority = hook.priority; ops->priv = chain; diff --git a/target/linux/generic/backport-4.14/320-v4.16-netfilter-nf_conntrack-add-IPS_OFFLOAD-status-bit.patch b/target/linux/generic/backport-4.14/320-v4.16-netfilter-nf_conntrack-add-IPS_OFFLOAD-status-bit.patch index 7788dd1434..de88825802 100644 --- a/target/linux/generic/backport-4.14/320-v4.16-netfilter-nf_conntrack-add-IPS_OFFLOAD-status-bit.patch +++ b/target/linux/generic/backport-4.14/320-v4.16-netfilter-nf_conntrack-add-IPS_OFFLOAD-status-bit.patch @@ -47,7 +47,7 @@ Signed-off-by: Pablo Neira Ayuso }; --- a/net/netfilter/nf_conntrack_core.c +++ b/net/netfilter/nf_conntrack_core.c -@@ -901,6 +901,9 @@ static unsigned int early_drop_list(stru +@@ -960,6 +960,9 @@ static unsigned int early_drop_list(stru hlist_nulls_for_each_entry_rcu(h, n, head, hnnode) { tmp = nf_ct_tuplehash_to_ctrack(h); @@ -57,7 +57,7 @@ Signed-off-by: Pablo Neira Ayuso if (nf_ct_is_expired(tmp)) { nf_ct_gc_expired(tmp); continue; -@@ -978,6 +981,18 @@ static bool gc_worker_can_early_drop(con +@@ -1037,6 +1040,18 @@ static bool gc_worker_can_early_drop(con return false; } @@ -76,7 +76,7 @@ Signed-off-by: Pablo Neira Ayuso static void gc_worker(struct work_struct *work) { unsigned int min_interval = max(HZ / GC_MAX_BUCKETS_DIV, 1u); -@@ -1014,6 +1029,11 @@ static void gc_worker(struct work_struct +@@ -1073,6 +1088,11 @@ static void gc_worker(struct work_struct tmp = nf_ct_tuplehash_to_ctrack(h); scanned++; @@ -90,7 +90,7 @@ Signed-off-by: Pablo Neira Ayuso expired_count++; --- a/net/netfilter/nf_conntrack_netlink.c +++ b/net/netfilter/nf_conntrack_netlink.c -@@ -1120,6 +1120,14 @@ static const struct nla_policy ct_nla_po +@@ -1123,6 +1123,14 @@ static const struct nla_policy ct_nla_po .len = NF_CT_LABELS_MAX_SIZE }, }; @@ -105,7 +105,7 @@ Signed-off-by: Pablo Neira Ayuso static int ctnetlink_flush_conntrack(struct net *net, const struct nlattr * const cda[], u32 portid, int report) -@@ -1132,7 +1140,7 @@ static int ctnetlink_flush_conntrack(str +@@ -1135,7 +1143,7 @@ static int ctnetlink_flush_conntrack(str return PTR_ERR(filter); } @@ -114,7 +114,7 @@ Signed-off-by: Pablo Neira Ayuso portid, report); kfree(filter); -@@ -1178,6 +1186,11 @@ static int ctnetlink_del_conntrack(struc +@@ -1181,6 +1189,11 @@ static int ctnetlink_del_conntrack(struc ct = nf_ct_tuplehash_to_ctrack(h); @@ -124,8 +124,8 @@ Signed-off-by: Pablo Neira Ayuso + } + if (cda[CTA_ID]) { - u_int32_t id = ntohl(nla_get_be32(cda[CTA_ID])); - if (id != (u32)(unsigned long)ct) { + __be32 id = nla_get_be32(cda[CTA_ID]); + --- a/net/netfilter/nf_conntrack_proto_tcp.c +++ b/net/netfilter/nf_conntrack_proto_tcp.c @@ -305,6 +305,9 @@ static bool tcp_invert_tuple(struct nf_c diff --git a/target/linux/generic/backport-4.14/321-v4.16-netfilter-nf_tables-add-flow-table-netlink-frontend.patch b/target/linux/generic/backport-4.14/321-v4.16-netfilter-nf_tables-add-flow-table-netlink-frontend.patch index f573d53b26..ff8aafb255 100644 --- a/target/linux/generic/backport-4.14/321-v4.16-netfilter-nf_tables-add-flow-table-netlink-frontend.patch +++ b/target/linux/generic/backport-4.14/321-v4.16-netfilter-nf_tables-add-flow-table-netlink-frontend.patch @@ -217,7 +217,7 @@ Signed-off-by: Pablo Neira Ayuso /** * nft_register_afinfo - register nf_tables address family info -@@ -374,6 +376,40 @@ static int nft_delobj(struct nft_ctx *ct +@@ -389,6 +391,40 @@ static int nft_delobj(struct nft_ctx *ct return err; } @@ -258,7 +258,7 @@ Signed-off-by: Pablo Neira Ayuso /* * Tables */ -@@ -757,6 +793,7 @@ static int nf_tables_newtable(struct net +@@ -772,6 +808,7 @@ static int nf_tables_newtable(struct net INIT_LIST_HEAD(&table->chains); INIT_LIST_HEAD(&table->sets); INIT_LIST_HEAD(&table->objects); @@ -266,7 +266,7 @@ Signed-off-by: Pablo Neira Ayuso table->flags = flags; nft_ctx_init(&ctx, net, skb, nlh, afi, table, NULL, nla); -@@ -778,10 +815,11 @@ err1: +@@ -793,10 +830,11 @@ err1: static int nft_flush_table(struct nft_ctx *ctx) { @@ -279,7 +279,7 @@ Signed-off-by: Pablo Neira Ayuso list_for_each_entry(chain, &ctx->table->chains, list) { if (!nft_is_active_next(ctx->net, chain)) -@@ -807,6 +845,12 @@ static int nft_flush_table(struct nft_ct +@@ -822,6 +860,12 @@ static int nft_flush_table(struct nft_ct goto out; } @@ -292,7 +292,7 @@ Signed-off-by: Pablo Neira Ayuso list_for_each_entry_safe(obj, ne, &ctx->table->objects, list) { err = nft_delobj(ctx, obj); if (err < 0) -@@ -4829,6 +4873,605 @@ static void nf_tables_obj_notify(const s +@@ -4853,6 +4897,605 @@ static void nf_tables_obj_notify(const s ctx->afi->family, ctx->report, GFP_KERNEL); } @@ -898,7 +898,7 @@ Signed-off-by: Pablo Neira Ayuso static int nf_tables_fill_gen_info(struct sk_buff *skb, struct net *net, u32 portid, u32 seq) { -@@ -4859,6 +5502,49 @@ nla_put_failure: +@@ -4883,6 +5526,49 @@ nla_put_failure: return -EMSGSIZE; } @@ -948,7 +948,7 @@ Signed-off-by: Pablo Neira Ayuso static void nf_tables_gen_notify(struct net *net, struct sk_buff *skb, int event) { -@@ -5011,6 +5697,21 @@ static const struct nfnl_callback nf_tab +@@ -5035,6 +5721,21 @@ static const struct nfnl_callback nf_tab .attr_count = NFTA_OBJ_MAX, .policy = nft_obj_policy, }, @@ -970,7 +970,7 @@ Signed-off-by: Pablo Neira Ayuso }; static void nft_chain_commit_update(struct nft_trans *trans) -@@ -5059,6 +5760,9 @@ static void nf_tables_commit_release(str +@@ -5083,6 +5784,9 @@ static void nf_tables_commit_release(str case NFT_MSG_DELOBJ: nft_obj_destroy(nft_trans_obj(trans)); break; @@ -980,7 +980,7 @@ Signed-off-by: Pablo Neira Ayuso } kfree(trans); } -@@ -5178,6 +5882,21 @@ static int nf_tables_commit(struct net * +@@ -5202,6 +5906,21 @@ static int nf_tables_commit(struct net * nf_tables_obj_notify(&trans->ctx, nft_trans_obj(trans), NFT_MSG_DELOBJ); break; @@ -1002,7 +1002,7 @@ Signed-off-by: Pablo Neira Ayuso } } -@@ -5215,6 +5934,9 @@ static void nf_tables_abort_release(stru +@@ -5239,6 +5958,9 @@ static void nf_tables_abort_release(stru case NFT_MSG_NEWOBJ: nft_obj_destroy(nft_trans_obj(trans)); break; @@ -1012,7 +1012,7 @@ Signed-off-by: Pablo Neira Ayuso } kfree(trans); } -@@ -5306,6 +6028,17 @@ static int nf_tables_abort(struct net *n +@@ -5330,6 +6052,17 @@ static int nf_tables_abort(struct net *n nft_clear(trans->ctx.net, nft_trans_obj(trans)); nft_trans_destroy(trans); break; @@ -1030,7 +1030,7 @@ Signed-off-by: Pablo Neira Ayuso } } -@@ -5856,6 +6589,7 @@ EXPORT_SYMBOL_GPL(__nft_release_basechai +@@ -5880,6 +6613,7 @@ EXPORT_SYMBOL_GPL(__nft_release_basechai /* Called by nft_unregister_afinfo() from __net_exit path, nfnl_lock is held. */ static void __nft_release_afinfo(struct net *net, struct nft_af_info *afi) { @@ -1038,7 +1038,7 @@ Signed-off-by: Pablo Neira Ayuso struct nft_table *table, *nt; struct nft_chain *chain, *nc; struct nft_object *obj, *ne; -@@ -5869,6 +6603,9 @@ static void __nft_release_afinfo(struct +@@ -5893,6 +6627,9 @@ static void __nft_release_afinfo(struct list_for_each_entry_safe(table, nt, &afi->tables, list) { list_for_each_entry(chain, &table->chains, list) nf_tables_unregister_hook(net, table, chain); @@ -1048,7 +1048,7 @@ Signed-off-by: Pablo Neira Ayuso /* No packets are walking on these chains anymore. */ ctx.table = table; list_for_each_entry(chain, &table->chains, list) { -@@ -5879,6 +6616,11 @@ static void __nft_release_afinfo(struct +@@ -5903,6 +6640,11 @@ static void __nft_release_afinfo(struct nf_tables_rule_release(&ctx, rule); } } @@ -1060,7 +1060,7 @@ Signed-off-by: Pablo Neira Ayuso list_for_each_entry_safe(set, ns, &table->sets, list) { list_del(&set->list); table->use--; -@@ -5922,6 +6664,8 @@ static int __init nf_tables_module_init( +@@ -5946,6 +6688,8 @@ static int __init nf_tables_module_init( if (err < 0) goto err3; @@ -1069,7 +1069,7 @@ Signed-off-by: Pablo Neira Ayuso pr_info("nf_tables: (c) 2007-2009 Patrick McHardy \n"); return register_pernet_subsys(&nf_tables_net_ops); err3: -@@ -5936,6 +6680,7 @@ static void __exit nf_tables_module_exit +@@ -5960,6 +6704,7 @@ static void __exit nf_tables_module_exit { unregister_pernet_subsys(&nf_tables_net_ops); nfnetlink_subsys_unregister(&nf_tables_subsys); diff --git a/target/linux/generic/backport-4.14/324-v4.16-netfilter-flow-table-support-for-IPv6.patch b/target/linux/generic/backport-4.14/324-v4.16-netfilter-flow-table-support-for-IPv6.patch index 3e7db09068..02edd96d55 100644 --- a/target/linux/generic/backport-4.14/324-v4.16-netfilter-flow-table-support-for-IPv6.patch +++ b/target/linux/generic/backport-4.14/324-v4.16-netfilter-flow-table-support-for-IPv6.patch @@ -15,7 +15,7 @@ Signed-off-by: Pablo Neira Ayuso --- a/include/net/ipv6.h +++ b/include/net/ipv6.h -@@ -889,6 +889,8 @@ static inline struct sk_buff *ip6_finish +@@ -860,6 +860,8 @@ static inline struct sk_buff *ip6_finish &inet6_sk(sk)->cork); } diff --git a/target/linux/generic/backport-4.14/327-v4.16-netfilter-nf_tables-remove-nhooks-field-from-struct-.patch b/target/linux/generic/backport-4.14/327-v4.16-netfilter-nf_tables-remove-nhooks-field-from-struct-.patch index af81224883..b055bac498 100644 --- a/target/linux/generic/backport-4.14/327-v4.16-netfilter-nf_tables-remove-nhooks-field-from-struct-.patch +++ b/target/linux/generic/backport-4.14/327-v4.16-netfilter-nf_tables-remove-nhooks-field-from-struct-.patch @@ -72,7 +72,7 @@ Signed-off-by: Pablo Neira Ayuso --- a/net/netfilter/nf_tables_api.c +++ b/net/netfilter/nf_tables_api.c -@@ -1359,9 +1359,6 @@ static int nft_chain_parse_hook(struct n +@@ -1374,9 +1374,6 @@ static int nft_chain_parse_hook(struct n return -EINVAL; hook->num = ntohl(nla_get_be32(ha[NFTA_HOOK_HOOKNUM])); @@ -82,7 +82,7 @@ Signed-off-by: Pablo Neira Ayuso hook->priority = ntohl(nla_get_be32(ha[NFTA_HOOK_PRIORITY])); type = chain_type[afi->family][NFT_CHAIN_T_DEFAULT]; -@@ -4981,7 +4978,7 @@ static int nf_tables_flowtable_parse_hoo +@@ -5005,7 +5002,7 @@ static int nf_tables_flowtable_parse_hoo return -EINVAL; hooknum = ntohl(nla_get_be32(tb[NFTA_FLOWTABLE_HOOK_NUM])); diff --git a/target/linux/generic/backport-4.14/328-v4.16-netfilter-nf_tables-fix-a-typo-in-nf_tables_getflowt.patch b/target/linux/generic/backport-4.14/328-v4.16-netfilter-nf_tables-fix-a-typo-in-nf_tables_getflowt.patch index 4ea9cf6c89..734ab526ca 100644 --- a/target/linux/generic/backport-4.14/328-v4.16-netfilter-nf_tables-fix-a-typo-in-nf_tables_getflowt.patch +++ b/target/linux/generic/backport-4.14/328-v4.16-netfilter-nf_tables-fix-a-typo-in-nf_tables_getflowt.patch @@ -11,7 +11,7 @@ Signed-off-by: Pablo Neira Ayuso --- a/net/netfilter/nf_tables_api.c +++ b/net/netfilter/nf_tables_api.c -@@ -5405,7 +5405,7 @@ static int nf_tables_getflowtable(struct +@@ -5429,7 +5429,7 @@ static int nf_tables_getflowtable(struct flowtable = nf_tables_flowtable_lookup(table, nla[NFTA_FLOWTABLE_NAME], genmask); diff --git a/target/linux/generic/backport-4.14/330-v4.16-netfilter-nf_tables-remove-flag-field-from-struct-nf.patch b/target/linux/generic/backport-4.14/330-v4.16-netfilter-nf_tables-remove-flag-field-from-struct-nf.patch index c599ad79c2..32d5d2b4ef 100644 --- a/target/linux/generic/backport-4.14/330-v4.16-netfilter-nf_tables-remove-flag-field-from-struct-nf.patch +++ b/target/linux/generic/backport-4.14/330-v4.16-netfilter-nf_tables-remove-flag-field-from-struct-nf.patch @@ -38,7 +38,7 @@ Signed-off-by: Pablo Neira Ayuso int nft_register_afinfo(struct net *, struct nft_af_info *); --- a/net/netfilter/nf_tables_api.c +++ b/net/netfilter/nf_tables_api.c -@@ -1376,7 +1376,7 @@ static int nft_chain_parse_hook(struct n +@@ -1391,7 +1391,7 @@ static int nft_chain_parse_hook(struct n hook->type = type; hook->dev = NULL; diff --git a/target/linux/generic/backport-4.14/331-v4.16-netfilter-nf_tables-no-need-for-struct-nft_af_info-t.patch b/target/linux/generic/backport-4.14/331-v4.16-netfilter-nf_tables-no-need-for-struct-nft_af_info-t.patch index 29404cff63..f2ece780b4 100644 --- a/target/linux/generic/backport-4.14/331-v4.16-netfilter-nf_tables-no-need-for-struct-nft_af_info-t.patch +++ b/target/linux/generic/backport-4.14/331-v4.16-netfilter-nf_tables-no-need-for-struct-nft_af_info-t.patch @@ -11,7 +11,7 @@ Signed-off-by: Pablo Neira Ayuso --- a/net/netfilter/nf_tables_api.c +++ b/net/netfilter/nf_tables_api.c -@@ -640,10 +640,7 @@ err: +@@ -655,10 +655,7 @@ err: return err; } @@ -23,7 +23,7 @@ Signed-off-by: Pablo Neira Ayuso { struct nft_chain *chain; u32 i = 0; -@@ -661,9 +658,7 @@ static void _nf_tables_table_disable(str +@@ -676,9 +673,7 @@ static void _nf_tables_table_disable(str } } @@ -34,7 +34,7 @@ Signed-off-by: Pablo Neira Ayuso { struct nft_chain *chain; int err, i = 0; -@@ -683,15 +678,13 @@ static int nf_tables_table_enable(struct +@@ -698,15 +693,13 @@ static int nf_tables_table_enable(struct return 0; err: if (i) @@ -53,7 +53,7 @@ Signed-off-by: Pablo Neira Ayuso } static int nf_tables_updtable(struct nft_ctx *ctx) -@@ -720,7 +713,7 @@ static int nf_tables_updtable(struct nft +@@ -735,7 +728,7 @@ static int nf_tables_updtable(struct nft nft_trans_table_enable(trans) = false; } else if (!(flags & NFT_TABLE_F_DORMANT) && ctx->table->flags & NFT_TABLE_F_DORMANT) { @@ -62,7 +62,7 @@ Signed-off-by: Pablo Neira Ayuso if (ret >= 0) { ctx->table->flags &= ~NFT_TABLE_F_DORMANT; nft_trans_table_enable(trans) = true; -@@ -5786,7 +5779,6 @@ static int nf_tables_commit(struct net * +@@ -5810,7 +5803,6 @@ static int nf_tables_commit(struct net * if (nft_trans_table_update(trans)) { if (!nft_trans_table_enable(trans)) { nf_tables_table_disable(net, @@ -70,7 +70,7 @@ Signed-off-by: Pablo Neira Ayuso trans->ctx.table); trans->ctx.table->flags |= NFT_TABLE_F_DORMANT; } -@@ -5950,7 +5942,6 @@ static int nf_tables_abort(struct net *n +@@ -5974,7 +5966,6 @@ static int nf_tables_abort(struct net *n if (nft_trans_table_update(trans)) { if (nft_trans_table_enable(trans)) { nf_tables_table_disable(net, diff --git a/target/linux/generic/backport-4.14/332-v4.16-netfilter-nf_tables-remove-struct-nft_af_info-parame.patch b/target/linux/generic/backport-4.14/332-v4.16-netfilter-nf_tables-remove-struct-nft_af_info-parame.patch index 086178ae20..0ce65dc141 100644 --- a/target/linux/generic/backport-4.14/332-v4.16-netfilter-nf_tables-remove-struct-nft_af_info-parame.patch +++ b/target/linux/generic/backport-4.14/332-v4.16-netfilter-nf_tables-remove-struct-nft_af_info-parame.patch @@ -11,7 +11,7 @@ Signed-off-by: Pablo Neira Ayuso --- a/net/netfilter/nf_tables_api.c +++ b/net/netfilter/nf_tables_api.c -@@ -452,7 +452,7 @@ static inline u64 nf_tables_alloc_handle +@@ -467,7 +467,7 @@ static inline u64 nf_tables_alloc_handle static const struct nf_chain_type *chain_type[NFPROTO_NUMPROTO][NFT_CHAIN_T_MAX]; static const struct nf_chain_type * @@ -20,7 +20,7 @@ Signed-off-by: Pablo Neira Ayuso { int i; -@@ -465,22 +465,20 @@ __nf_tables_chain_type_lookup(int family +@@ -480,22 +480,20 @@ __nf_tables_chain_type_lookup(int family } static const struct nf_chain_type * @@ -47,7 +47,7 @@ Signed-off-by: Pablo Neira Ayuso if (type != NULL) return ERR_PTR(-EAGAIN); } -@@ -1356,8 +1354,8 @@ static int nft_chain_parse_hook(struct n +@@ -1371,8 +1369,8 @@ static int nft_chain_parse_hook(struct n type = chain_type[afi->family][NFT_CHAIN_T_DEFAULT]; if (nla[NFTA_CHAIN_TYPE]) { diff --git a/target/linux/generic/backport-4.14/334-v4.15-netfilter-nf_tables-fix-potential-NULL-ptr-deref-in-.patch b/target/linux/generic/backport-4.14/334-v4.15-netfilter-nf_tables-fix-potential-NULL-ptr-deref-in-.patch index bc6810bdd2..6bb5cbba4a 100644 --- a/target/linux/generic/backport-4.14/334-v4.15-netfilter-nf_tables-fix-potential-NULL-ptr-deref-in-.patch +++ b/target/linux/generic/backport-4.14/334-v4.15-netfilter-nf_tables-fix-potential-NULL-ptr-deref-in-.patch @@ -15,7 +15,7 @@ Signed-off-by: Pablo Neira Ayuso --- a/net/netfilter/nf_tables_api.c +++ b/net/netfilter/nf_tables_api.c -@@ -5324,8 +5324,10 @@ static int nf_tables_dump_flowtable_done +@@ -5348,8 +5348,10 @@ static int nf_tables_dump_flowtable_done if (!filter) return 0; diff --git a/target/linux/generic/backport-4.14/335-v4.16-netfilter-nf_tables-add-single-table-list-for-all-fa.patch b/target/linux/generic/backport-4.14/335-v4.16-netfilter-nf_tables-add-single-table-list-for-all-fa.patch index e08b9b26d5..e6f2058ada 100644 --- a/target/linux/generic/backport-4.14/335-v4.16-netfilter-nf_tables-add-single-table-list-for-all-fa.patch +++ b/target/linux/generic/backport-4.14/335-v4.16-netfilter-nf_tables-add-single-table-list-for-all-fa.patch @@ -108,7 +108,7 @@ Signed-off-by: Pablo Neira Ayuso ctx->table = table; ctx->chain = chain; ctx->nla = nla; -@@ -414,30 +413,31 @@ static int nft_delflowtable(struct nft_c +@@ -429,30 +428,31 @@ static int nft_delflowtable(struct nft_c * Tables */ @@ -146,7 +146,7 @@ Signed-off-by: Pablo Neira Ayuso if (table != NULL) return table; -@@ -536,7 +536,7 @@ static void nf_tables_table_notify(const +@@ -551,7 +551,7 @@ static void nf_tables_table_notify(const goto err; err = nf_tables_fill_table_info(skb, ctx->net, ctx->portid, ctx->seq, @@ -155,7 +155,7 @@ Signed-off-by: Pablo Neira Ayuso if (err < 0) { kfree_skb(skb); goto err; -@@ -553,7 +553,6 @@ static int nf_tables_dump_tables(struct +@@ -568,7 +568,6 @@ static int nf_tables_dump_tables(struct struct netlink_callback *cb) { const struct nfgenmsg *nfmsg = nlmsg_data(cb->nlh); @@ -163,7 +163,7 @@ Signed-off-by: Pablo Neira Ayuso const struct nft_table *table; unsigned int idx = 0, s_idx = cb->args[0]; struct net *net = sock_net(skb->sk); -@@ -562,30 +561,27 @@ static int nf_tables_dump_tables(struct +@@ -577,30 +576,27 @@ static int nf_tables_dump_tables(struct rcu_read_lock(); cb->seq = net->nft.base_seq; @@ -211,7 +211,7 @@ Signed-off-by: Pablo Neira Ayuso } done: rcu_read_unlock(); -@@ -617,7 +613,8 @@ static int nf_tables_gettable(struct net +@@ -632,7 +628,8 @@ static int nf_tables_gettable(struct net if (IS_ERR(afi)) return PTR_ERR(afi); @@ -221,7 +221,7 @@ Signed-off-by: Pablo Neira Ayuso if (IS_ERR(table)) return PTR_ERR(table); -@@ -748,7 +745,7 @@ static int nf_tables_newtable(struct net +@@ -763,7 +760,7 @@ static int nf_tables_newtable(struct net return PTR_ERR(afi); name = nla[NFTA_TABLE_NAME]; @@ -230,7 +230,7 @@ Signed-off-by: Pablo Neira Ayuso if (IS_ERR(table)) { if (PTR_ERR(table) != -ENOENT) return PTR_ERR(table); -@@ -758,7 +755,7 @@ static int nf_tables_newtable(struct net +@@ -773,7 +770,7 @@ static int nf_tables_newtable(struct net if (nlh->nlmsg_flags & NLM_F_REPLACE) return -EOPNOTSUPP; @@ -239,7 +239,7 @@ Signed-off-by: Pablo Neira Ayuso return nf_tables_updtable(&ctx); } -@@ -785,14 +782,15 @@ static int nf_tables_newtable(struct net +@@ -800,14 +797,15 @@ static int nf_tables_newtable(struct net INIT_LIST_HEAD(&table->sets); INIT_LIST_HEAD(&table->objects); INIT_LIST_HEAD(&table->flowtables); @@ -257,7 +257,7 @@ Signed-off-by: Pablo Neira Ayuso return 0; err4: kfree(table->name); -@@ -866,30 +864,28 @@ out: +@@ -881,30 +879,28 @@ out: static int nft_flush(struct nft_ctx *ctx, int family) { @@ -301,7 +301,7 @@ Signed-off-by: Pablo Neira Ayuso } out: return err; -@@ -907,7 +903,7 @@ static int nf_tables_deltable(struct net +@@ -922,7 +918,7 @@ static int nf_tables_deltable(struct net int family = nfmsg->nfgen_family; struct nft_ctx ctx; @@ -310,7 +310,7 @@ Signed-off-by: Pablo Neira Ayuso if (family == AF_UNSPEC || nla[NFTA_TABLE_NAME] == NULL) return nft_flush(&ctx, family); -@@ -915,7 +911,8 @@ static int nf_tables_deltable(struct net +@@ -930,7 +926,8 @@ static int nf_tables_deltable(struct net if (IS_ERR(afi)) return PTR_ERR(afi); @@ -320,7 +320,7 @@ Signed-off-by: Pablo Neira Ayuso if (IS_ERR(table)) return PTR_ERR(table); -@@ -923,7 +920,7 @@ static int nf_tables_deltable(struct net +@@ -938,7 +935,7 @@ static int nf_tables_deltable(struct net table->use > 0) return -EBUSY; @@ -329,7 +329,7 @@ Signed-off-by: Pablo Neira Ayuso ctx.table = table; return nft_flush_table(&ctx); -@@ -935,7 +932,7 @@ static void nf_tables_table_destroy(stru +@@ -950,7 +947,7 @@ static void nf_tables_table_destroy(stru kfree(ctx->table->name); kfree(ctx->table); @@ -338,7 +338,7 @@ Signed-off-by: Pablo Neira Ayuso } int nft_register_chain_type(const struct nf_chain_type *ctype) -@@ -1136,7 +1133,7 @@ static void nf_tables_chain_notify(const +@@ -1151,7 +1148,7 @@ static void nf_tables_chain_notify(const goto err; err = nf_tables_fill_chain_info(skb, ctx->net, ctx->portid, ctx->seq, @@ -347,7 +347,7 @@ Signed-off-by: Pablo Neira Ayuso ctx->chain); if (err < 0) { kfree_skb(skb); -@@ -1154,7 +1151,6 @@ static int nf_tables_dump_chains(struct +@@ -1169,7 +1166,6 @@ static int nf_tables_dump_chains(struct struct netlink_callback *cb) { const struct nfgenmsg *nfmsg = nlmsg_data(cb->nlh); @@ -355,7 +355,7 @@ Signed-off-by: Pablo Neira Ayuso const struct nft_table *table; const struct nft_chain *chain; unsigned int idx = 0, s_idx = cb->args[0]; -@@ -1164,31 +1160,30 @@ static int nf_tables_dump_chains(struct +@@ -1179,31 +1175,30 @@ static int nf_tables_dump_chains(struct rcu_read_lock(); cb->seq = net->nft.base_seq; @@ -407,7 +407,7 @@ Signed-off-by: Pablo Neira Ayuso } } done: -@@ -1222,7 +1217,8 @@ static int nf_tables_getchain(struct net +@@ -1237,7 +1232,8 @@ static int nf_tables_getchain(struct net if (IS_ERR(afi)) return PTR_ERR(afi); @@ -417,7 +417,7 @@ Signed-off-by: Pablo Neira Ayuso if (IS_ERR(table)) return PTR_ERR(table); -@@ -1332,8 +1328,8 @@ struct nft_chain_hook { +@@ -1347,8 +1343,8 @@ struct nft_chain_hook { static int nft_chain_parse_hook(struct net *net, const struct nlattr * const nla[], @@ -428,7 +428,7 @@ Signed-off-by: Pablo Neira Ayuso { struct nlattr *ha[NFTA_HOOK_MAX + 1]; const struct nf_chain_type *type; -@@ -1352,10 +1348,10 @@ static int nft_chain_parse_hook(struct n +@@ -1367,10 +1363,10 @@ static int nft_chain_parse_hook(struct n hook->num = ntohl(nla_get_be32(ha[NFTA_HOOK_HOOKNUM])); hook->priority = ntohl(nla_get_be32(ha[NFTA_HOOK_PRIORITY])); @@ -441,7 +441,7 @@ Signed-off-by: Pablo Neira Ayuso if (IS_ERR(type)) return PTR_ERR(type); } -@@ -1367,7 +1363,7 @@ static int nft_chain_parse_hook(struct n +@@ -1382,7 +1378,7 @@ static int nft_chain_parse_hook(struct n hook->type = type; hook->dev = NULL; @@ -450,7 +450,7 @@ Signed-off-by: Pablo Neira Ayuso char ifname[IFNAMSIZ]; if (!ha[NFTA_HOOK_DEV]) { -@@ -1402,7 +1398,6 @@ static int nf_tables_addchain(struct nft +@@ -1417,7 +1413,6 @@ static int nf_tables_addchain(struct nft { const struct nlattr * const *nla = ctx->nla; struct nft_table *table = ctx->table; @@ -458,7 +458,7 @@ Signed-off-by: Pablo Neira Ayuso struct nft_base_chain *basechain; struct nft_stats __percpu *stats; struct net *net = ctx->net; -@@ -1416,7 +1411,7 @@ static int nf_tables_addchain(struct nft +@@ -1431,7 +1426,7 @@ static int nf_tables_addchain(struct nft struct nft_chain_hook hook; struct nf_hook_ops *ops; @@ -467,7 +467,7 @@ Signed-off-by: Pablo Neira Ayuso if (err < 0) return err; -@@ -1508,7 +1503,7 @@ static int nf_tables_updchain(struct nft +@@ -1523,7 +1518,7 @@ static int nf_tables_updchain(struct nft if (!nft_is_base_chain(chain)) return -EBUSY; @@ -476,7 +476,7 @@ Signed-off-by: Pablo Neira Ayuso create); if (err < 0) return err; -@@ -1618,7 +1613,8 @@ static int nf_tables_newchain(struct net +@@ -1633,7 +1628,8 @@ static int nf_tables_newchain(struct net if (IS_ERR(afi)) return PTR_ERR(afi); @@ -486,7 +486,7 @@ Signed-off-by: Pablo Neira Ayuso if (IS_ERR(table)) return PTR_ERR(table); -@@ -1658,7 +1654,7 @@ static int nf_tables_newchain(struct net +@@ -1673,7 +1669,7 @@ static int nf_tables_newchain(struct net } } @@ -495,7 +495,7 @@ Signed-off-by: Pablo Neira Ayuso if (chain != NULL) { if (nlh->nlmsg_flags & NLM_F_EXCL) -@@ -1692,7 +1688,8 @@ static int nf_tables_delchain(struct net +@@ -1707,7 +1703,8 @@ static int nf_tables_delchain(struct net if (IS_ERR(afi)) return PTR_ERR(afi); @@ -505,7 +505,7 @@ Signed-off-by: Pablo Neira Ayuso if (IS_ERR(table)) return PTR_ERR(table); -@@ -1704,7 +1701,7 @@ static int nf_tables_delchain(struct net +@@ -1719,7 +1716,7 @@ static int nf_tables_delchain(struct net chain->use > 0) return -EBUSY; @@ -514,7 +514,7 @@ Signed-off-by: Pablo Neira Ayuso use = chain->use; list_for_each_entry(rule, &chain->rules, list) { -@@ -1869,7 +1866,7 @@ static int nf_tables_expr_parse(const st +@@ -1887,7 +1884,7 @@ static int nf_tables_expr_parse(const st if (err < 0) return err; @@ -523,7 +523,7 @@ Signed-off-by: Pablo Neira Ayuso if (IS_ERR(type)) return PTR_ERR(type); -@@ -2093,7 +2090,7 @@ static void nf_tables_rule_notify(const +@@ -2115,7 +2112,7 @@ static void nf_tables_rule_notify(const goto err; err = nf_tables_fill_rule_info(skb, ctx->net, ctx->portid, ctx->seq, @@ -532,7 +532,7 @@ Signed-off-by: Pablo Neira Ayuso ctx->chain, rule); if (err < 0) { kfree_skb(skb); -@@ -2117,7 +2114,6 @@ static int nf_tables_dump_rules(struct s +@@ -2139,7 +2136,6 @@ static int nf_tables_dump_rules(struct s { const struct nfgenmsg *nfmsg = nlmsg_data(cb->nlh); const struct nft_rule_dump_ctx *ctx = cb->data; @@ -540,7 +540,7 @@ Signed-off-by: Pablo Neira Ayuso const struct nft_table *table; const struct nft_chain *chain; const struct nft_rule *rule; -@@ -2128,39 +2124,37 @@ static int nf_tables_dump_rules(struct s +@@ -2150,39 +2146,37 @@ static int nf_tables_dump_rules(struct s rcu_read_lock(); cb->seq = net->nft.base_seq; @@ -605,7 +605,7 @@ Signed-off-by: Pablo Neira Ayuso } } } -@@ -2238,7 +2232,8 @@ static int nf_tables_getrule(struct net +@@ -2260,7 +2254,8 @@ static int nf_tables_getrule(struct net if (IS_ERR(afi)) return PTR_ERR(afi); @@ -615,7 +615,7 @@ Signed-off-by: Pablo Neira Ayuso if (IS_ERR(table)) return PTR_ERR(table); -@@ -2323,7 +2318,8 @@ static int nf_tables_newrule(struct net +@@ -2345,7 +2340,8 @@ static int nf_tables_newrule(struct net if (IS_ERR(afi)) return PTR_ERR(afi); @@ -625,7 +625,7 @@ Signed-off-by: Pablo Neira Ayuso if (IS_ERR(table)) return PTR_ERR(table); -@@ -2362,7 +2358,7 @@ static int nf_tables_newrule(struct net +@@ -2384,7 +2380,7 @@ static int nf_tables_newrule(struct net return PTR_ERR(old_rule); } @@ -634,7 +634,7 @@ Signed-off-by: Pablo Neira Ayuso n = 0; size = 0; -@@ -2495,7 +2491,8 @@ static int nf_tables_delrule(struct net +@@ -2517,7 +2513,8 @@ static int nf_tables_delrule(struct net if (IS_ERR(afi)) return PTR_ERR(afi); @@ -644,7 +644,7 @@ Signed-off-by: Pablo Neira Ayuso if (IS_ERR(table)) return PTR_ERR(table); -@@ -2506,7 +2503,7 @@ static int nf_tables_delrule(struct net +@@ -2528,7 +2525,7 @@ static int nf_tables_delrule(struct net return PTR_ERR(chain); } @@ -653,7 +653,7 @@ Signed-off-by: Pablo Neira Ayuso if (chain) { if (nla[NFTA_RULE_HANDLE]) { -@@ -2704,13 +2701,13 @@ static int nft_ctx_init_from_setattr(str +@@ -2726,13 +2723,13 @@ static int nft_ctx_init_from_setattr(str if (afi == NULL) return -EAFNOSUPPORT; @@ -670,7 +670,7 @@ Signed-off-by: Pablo Neira Ayuso return 0; } -@@ -2838,7 +2835,7 @@ static int nf_tables_fill_set(struct sk_ +@@ -2860,7 +2857,7 @@ static int nf_tables_fill_set(struct sk_ goto nla_put_failure; nfmsg = nlmsg_data(nlh); @@ -679,7 +679,7 @@ Signed-off-by: Pablo Neira Ayuso nfmsg->version = NFNETLINK_V0; nfmsg->res_id = htons(ctx->net->nft.base_seq & 0xffff); -@@ -2930,10 +2927,8 @@ static int nf_tables_dump_sets(struct sk +@@ -2952,10 +2949,8 @@ static int nf_tables_dump_sets(struct sk { const struct nft_set *set; unsigned int idx, s_idx = cb->args[0]; @@ -690,7 +690,7 @@ Signed-off-by: Pablo Neira Ayuso struct nft_ctx *ctx = cb->data, ctx_set; if (cb->args[1]) -@@ -2942,51 +2937,44 @@ static int nf_tables_dump_sets(struct sk +@@ -2964,51 +2959,44 @@ static int nf_tables_dump_sets(struct sk rcu_read_lock(); cb->seq = net->nft.base_seq; @@ -771,7 +771,7 @@ Signed-off-by: Pablo Neira Ayuso } cb->args[1] = 1; done: -@@ -3196,11 +3184,12 @@ static int nf_tables_newset(struct net * +@@ -3218,11 +3206,12 @@ static int nf_tables_newset(struct net * if (IS_ERR(afi)) return PTR_ERR(afi); @@ -786,7 +786,7 @@ Signed-off-by: Pablo Neira Ayuso set = nf_tables_set_lookup(table, nla[NFTA_SET_NAME], genmask); if (IS_ERR(set)) { -@@ -3469,12 +3458,12 @@ static int nft_ctx_init_from_elemattr(st +@@ -3491,12 +3480,12 @@ static int nft_ctx_init_from_elemattr(st if (IS_ERR(afi)) return PTR_ERR(afi); @@ -802,7 +802,7 @@ Signed-off-by: Pablo Neira Ayuso return 0; } -@@ -3579,7 +3568,6 @@ static int nf_tables_dump_set(struct sk_ +@@ -3601,7 +3590,6 @@ static int nf_tables_dump_set(struct sk_ { struct nft_set_dump_ctx *dump_ctx = cb->data; struct net *net = sock_net(skb->sk); @@ -810,7 +810,7 @@ Signed-off-by: Pablo Neira Ayuso struct nft_table *table; struct nft_set *set; struct nft_set_dump_args args; -@@ -3591,21 +3579,19 @@ static int nf_tables_dump_set(struct sk_ +@@ -3613,21 +3601,19 @@ static int nf_tables_dump_set(struct sk_ int event; rcu_read_lock(); @@ -841,7 +841,7 @@ Signed-off-by: Pablo Neira Ayuso } break; } -@@ -3625,7 +3611,7 @@ static int nf_tables_dump_set(struct sk_ +@@ -3647,7 +3633,7 @@ static int nf_tables_dump_set(struct sk_ goto nla_put_failure; nfmsg = nlmsg_data(nlh); @@ -850,7 +850,7 @@ Signed-off-by: Pablo Neira Ayuso nfmsg->version = NFNETLINK_V0; nfmsg->res_id = htons(net->nft.base_seq & 0xffff); -@@ -3727,7 +3713,7 @@ static int nf_tables_fill_setelem_info(s +@@ -3749,7 +3735,7 @@ static int nf_tables_fill_setelem_info(s goto nla_put_failure; nfmsg = nlmsg_data(nlh); @@ -859,7 +859,7 @@ Signed-off-by: Pablo Neira Ayuso nfmsg->version = NFNETLINK_V0; nfmsg->res_id = htons(ctx->net->nft.base_seq & 0xffff); -@@ -3971,7 +3957,7 @@ static int nft_add_set_elem(struct nft_c +@@ -3993,7 +3979,7 @@ static int nft_add_set_elem(struct nft_c list_for_each_entry(binding, &set->bindings, list) { struct nft_ctx bind_ctx = { .net = ctx->net, @@ -868,7 +868,7 @@ Signed-off-by: Pablo Neira Ayuso .table = ctx->table, .chain = (struct nft_chain *)binding->chain, }; -@@ -4521,7 +4507,8 @@ static int nf_tables_newobj(struct net * +@@ -4545,7 +4531,8 @@ static int nf_tables_newobj(struct net * if (IS_ERR(afi)) return PTR_ERR(afi); @@ -878,7 +878,7 @@ Signed-off-by: Pablo Neira Ayuso if (IS_ERR(table)) return PTR_ERR(table); -@@ -4539,7 +4526,7 @@ static int nf_tables_newobj(struct net * +@@ -4563,7 +4550,7 @@ static int nf_tables_newobj(struct net * return 0; } @@ -887,7 +887,7 @@ Signed-off-by: Pablo Neira Ayuso type = nft_obj_type_get(objtype); if (IS_ERR(type)) -@@ -4616,7 +4603,6 @@ struct nft_obj_filter { +@@ -4640,7 +4627,6 @@ struct nft_obj_filter { static int nf_tables_dump_obj(struct sk_buff *skb, struct netlink_callback *cb) { const struct nfgenmsg *nfmsg = nlmsg_data(cb->nlh); @@ -895,7 +895,7 @@ Signed-off-by: Pablo Neira Ayuso const struct nft_table *table; unsigned int idx = 0, s_idx = cb->args[0]; struct nft_obj_filter *filter = cb->data; -@@ -4631,38 +4617,37 @@ static int nf_tables_dump_obj(struct sk_ +@@ -4655,38 +4641,37 @@ static int nf_tables_dump_obj(struct sk_ rcu_read_lock(); cb->seq = net->nft.base_seq; @@ -960,7 +960,7 @@ Signed-off-by: Pablo Neira Ayuso } } done: -@@ -4749,7 +4734,8 @@ static int nf_tables_getobj(struct net * +@@ -4773,7 +4758,8 @@ static int nf_tables_getobj(struct net * if (IS_ERR(afi)) return PTR_ERR(afi); @@ -970,7 +970,7 @@ Signed-off-by: Pablo Neira Ayuso if (IS_ERR(table)) return PTR_ERR(table); -@@ -4809,7 +4795,8 @@ static int nf_tables_delobj(struct net * +@@ -4833,7 +4819,8 @@ static int nf_tables_delobj(struct net * if (IS_ERR(afi)) return PTR_ERR(afi); @@ -980,7 +980,7 @@ Signed-off-by: Pablo Neira Ayuso if (IS_ERR(table)) return PTR_ERR(table); -@@ -4820,7 +4807,7 @@ static int nf_tables_delobj(struct net * +@@ -4844,7 +4831,7 @@ static int nf_tables_delobj(struct net * if (obj->use > 0) return -EBUSY; @@ -989,7 +989,7 @@ Signed-off-by: Pablo Neira Ayuso return nft_delobj(&ctx, obj); } -@@ -4858,7 +4845,7 @@ static void nf_tables_obj_notify(const s +@@ -4882,7 +4869,7 @@ static void nf_tables_obj_notify(const s struct nft_object *obj, int event) { nft_obj_notify(ctx->net, ctx->table, obj, ctx->portid, ctx->seq, event, @@ -998,7 +998,7 @@ Signed-off-by: Pablo Neira Ayuso } /* -@@ -5048,7 +5035,7 @@ void nft_flow_table_iterate(struct net * +@@ -5072,7 +5059,7 @@ void nft_flow_table_iterate(struct net * rcu_read_lock(); list_for_each_entry_rcu(afi, &net->nft.af_info, list) { @@ -1007,7 +1007,7 @@ Signed-off-by: Pablo Neira Ayuso list_for_each_entry_rcu(flowtable, &table->flowtables, list) { iter(&flowtable->data, data); } -@@ -5096,7 +5083,8 @@ static int nf_tables_newflowtable(struct +@@ -5120,7 +5107,8 @@ static int nf_tables_newflowtable(struct if (IS_ERR(afi)) return PTR_ERR(afi); @@ -1017,7 +1017,7 @@ Signed-off-by: Pablo Neira Ayuso if (IS_ERR(table)) return PTR_ERR(table); -@@ -5113,7 +5101,7 @@ static int nf_tables_newflowtable(struct +@@ -5137,7 +5125,7 @@ static int nf_tables_newflowtable(struct return 0; } @@ -1026,7 +1026,7 @@ Signed-off-by: Pablo Neira Ayuso flowtable = kzalloc(sizeof(*flowtable), GFP_KERNEL); if (!flowtable) -@@ -5194,7 +5182,8 @@ static int nf_tables_delflowtable(struct +@@ -5218,7 +5206,8 @@ static int nf_tables_delflowtable(struct if (IS_ERR(afi)) return PTR_ERR(afi); @@ -1036,7 +1036,7 @@ Signed-off-by: Pablo Neira Ayuso if (IS_ERR(table)) return PTR_ERR(table); -@@ -5205,7 +5194,7 @@ static int nf_tables_delflowtable(struct +@@ -5229,7 +5218,7 @@ static int nf_tables_delflowtable(struct if (flowtable->use > 0) return -EBUSY; @@ -1045,7 +1045,7 @@ Signed-off-by: Pablo Neira Ayuso return nft_delflowtable(&ctx, flowtable); } -@@ -5274,40 +5263,37 @@ static int nf_tables_dump_flowtable(stru +@@ -5298,40 +5287,37 @@ static int nf_tables_dump_flowtable(stru struct net *net = sock_net(skb->sk); int family = nfmsg->nfgen_family; struct nft_flowtable *flowtable; @@ -1107,7 +1107,7 @@ Signed-off-by: Pablo Neira Ayuso } } done: -@@ -5392,7 +5378,8 @@ static int nf_tables_getflowtable(struct +@@ -5416,7 +5402,8 @@ static int nf_tables_getflowtable(struct if (IS_ERR(afi)) return PTR_ERR(afi); @@ -1117,7 +1117,7 @@ Signed-off-by: Pablo Neira Ayuso if (IS_ERR(table)) return PTR_ERR(table); -@@ -5435,7 +5422,7 @@ static void nf_tables_flowtable_notify(s +@@ -5459,7 +5446,7 @@ static void nf_tables_flowtable_notify(s err = nf_tables_fill_flowtable_info(skb, ctx->net, ctx->portid, ctx->seq, event, 0, @@ -1126,7 +1126,7 @@ Signed-off-by: Pablo Neira Ayuso if (err < 0) { kfree_skb(skb); goto err; -@@ -5513,17 +5500,14 @@ static int nf_tables_flowtable_event(str +@@ -5537,17 +5524,14 @@ static int nf_tables_flowtable_event(str struct net_device *dev = netdev_notifier_info_to_dev(ptr); struct nft_flowtable *flowtable; struct nft_table *table; @@ -1147,7 +1147,7 @@ Signed-off-by: Pablo Neira Ayuso } } nfnl_unlock(NFNL_SUBSYS_NFTABLES); -@@ -6549,6 +6533,7 @@ EXPORT_SYMBOL_GPL(nft_data_dump); +@@ -6573,6 +6557,7 @@ EXPORT_SYMBOL_GPL(nft_data_dump); static int __net_init nf_tables_init_net(struct net *net) { INIT_LIST_HEAD(&net->nft.af_info); @@ -1155,7 +1155,7 @@ Signed-off-by: Pablo Neira Ayuso INIT_LIST_HEAD(&net->nft.commit_list); net->nft.base_seq = 1; return 0; -@@ -6585,10 +6570,10 @@ static void __nft_release_afinfo(struct +@@ -6609,10 +6594,10 @@ static void __nft_release_afinfo(struct struct nft_set *set, *ns; struct nft_ctx ctx = { .net = net, @@ -1228,7 +1228,7 @@ Signed-off-by: Pablo Neira Ayuso par->nft_compat = true; } -@@ -282,7 +282,7 @@ nft_target_destroy(const struct nft_ctx +@@ -283,7 +283,7 @@ nft_target_destroy(const struct nft_ctx par.net = ctx->net; par.target = target; par.targinfo = info; @@ -1237,7 +1237,7 @@ Signed-off-by: Pablo Neira Ayuso if (par.target->destroy != NULL) par.target->destroy(&par); -@@ -389,7 +389,7 @@ nft_match_set_mtchk_param(struct xt_mtch +@@ -390,7 +390,7 @@ nft_match_set_mtchk_param(struct xt_mtch { par->net = ctx->net; par->table = ctx->table->name; @@ -1246,7 +1246,7 @@ Signed-off-by: Pablo Neira Ayuso case AF_INET: entry->e4.ip.proto = proto; entry->e4.ip.invflags = inv ? IPT_INV_PROTO : 0; -@@ -420,7 +420,7 @@ nft_match_set_mtchk_param(struct xt_mtch +@@ -421,7 +421,7 @@ nft_match_set_mtchk_param(struct xt_mtch } else { par->hook_mask = 0; } @@ -1255,7 +1255,7 @@ Signed-off-by: Pablo Neira Ayuso par->nft_compat = true; } -@@ -503,7 +503,7 @@ __nft_match_destroy(const struct nft_ctx +@@ -504,7 +504,7 @@ __nft_match_destroy(const struct nft_ctx par.net = ctx->net; par.match = match; par.matchinfo = info; @@ -1264,7 +1264,7 @@ Signed-off-by: Pablo Neira Ayuso if (par.match->destroy != NULL) par.match->destroy(&par); -@@ -733,7 +733,7 @@ nft_match_select_ops(const struct nft_ct +@@ -734,7 +734,7 @@ nft_match_select_ops(const struct nft_ct mt_name = nla_data(tb[NFTA_MATCH_NAME]); rev = ntohl(nla_get_be32(tb[NFTA_MATCH_REV])); @@ -1273,7 +1273,7 @@ Signed-off-by: Pablo Neira Ayuso /* Re-use the existing match if it's already loaded. */ list_for_each_entry(nft_match, &nft_match_list, head) { -@@ -824,7 +824,7 @@ nft_target_select_ops(const struct nft_c +@@ -825,7 +825,7 @@ nft_target_select_ops(const struct nft_c tg_name = nla_data(tb[NFTA_TARGET_NAME]); rev = ntohl(nla_get_be32(tb[NFTA_TARGET_REV])); diff --git a/target/linux/generic/backport-4.14/336-v4.15-netfilter-exit_net-cleanup-check-added.patch b/target/linux/generic/backport-4.14/336-v4.15-netfilter-exit_net-cleanup-check-added.patch index 844ba450d7..d331593496 100644 --- a/target/linux/generic/backport-4.14/336-v4.15-netfilter-exit_net-cleanup-check-added.patch +++ b/target/linux/generic/backport-4.14/336-v4.15-netfilter-exit_net-cleanup-check-added.patch @@ -21,7 +21,7 @@ Signed-off-by: Pablo Neira Ayuso static struct pernet_operations clusterip_net_ops = { --- a/net/netfilter/nf_tables_api.c +++ b/net/netfilter/nf_tables_api.c -@@ -6539,6 +6539,12 @@ static int __net_init nf_tables_init_net +@@ -6563,6 +6563,12 @@ static int __net_init nf_tables_init_net return 0; } @@ -34,7 +34,7 @@ Signed-off-by: Pablo Neira Ayuso int __nft_release_basechain(struct nft_ctx *ctx) { struct nft_rule *rule, *nr; -@@ -6616,6 +6622,7 @@ static void __nft_release_afinfo(struct +@@ -6640,6 +6646,7 @@ static void __nft_release_afinfo(struct static struct pernet_operations nf_tables_net_ops = { .init = nf_tables_init_net, diff --git a/target/linux/generic/backport-4.14/337-v4.16-netfilter-nf_tables-get-rid-of-pernet-families.patch b/target/linux/generic/backport-4.14/337-v4.16-netfilter-nf_tables-get-rid-of-pernet-families.patch index 2274c1327d..f30c3425f8 100644 --- a/target/linux/generic/backport-4.14/337-v4.16-netfilter-nf_tables-get-rid-of-pernet-families.patch +++ b/target/linux/generic/backport-4.14/337-v4.16-netfilter-nf_tables-get-rid-of-pernet-families.patch @@ -364,7 +364,7 @@ Signed-off-by: Pablo Neira Ayuso if (afi->family == family) return afi; } -@@ -5030,15 +5028,12 @@ void nft_flow_table_iterate(struct net * +@@ -5054,15 +5052,12 @@ void nft_flow_table_iterate(struct net * void *data) { struct nft_flowtable *flowtable; @@ -383,7 +383,7 @@ Signed-off-by: Pablo Neira Ayuso } } rcu_read_unlock(); -@@ -6530,21 +6525,6 @@ int nft_data_dump(struct sk_buff *skb, i +@@ -6554,21 +6549,6 @@ int nft_data_dump(struct sk_buff *skb, i } EXPORT_SYMBOL_GPL(nft_data_dump); @@ -405,7 +405,7 @@ Signed-off-by: Pablo Neira Ayuso int __nft_release_basechain(struct nft_ctx *ctx) { struct nft_rule *rule, *nr; -@@ -6565,8 +6545,7 @@ int __nft_release_basechain(struct nft_c +@@ -6589,8 +6569,7 @@ int __nft_release_basechain(struct nft_c } EXPORT_SYMBOL_GPL(__nft_release_basechain); @@ -415,7 +415,7 @@ Signed-off-by: Pablo Neira Ayuso { struct nft_flowtable *flowtable, *nf; struct nft_table *table, *nt; -@@ -6576,10 +6555,11 @@ static void __nft_release_afinfo(struct +@@ -6600,10 +6579,11 @@ static void __nft_release_afinfo(struct struct nft_set *set, *ns; struct nft_ctx ctx = { .net = net, @@ -428,7 +428,7 @@ Signed-off-by: Pablo Neira Ayuso list_for_each_entry(chain, &table->chains, list) nf_tables_unregister_hook(net, table, chain); list_for_each_entry(flowtable, &table->flowtables, list) -@@ -6620,6 +6600,21 @@ static void __nft_release_afinfo(struct +@@ -6644,6 +6624,21 @@ static void __nft_release_afinfo(struct } } diff --git a/target/linux/generic/backport-4.14/338-v4.16-netfilter-nf_tables-get-rid-of-struct-nft_af_info-ab.patch b/target/linux/generic/backport-4.14/338-v4.16-netfilter-nf_tables-get-rid-of-struct-nft_af_info-ab.patch index fd19ffad5a..278340c9be 100644 --- a/target/linux/generic/backport-4.14/338-v4.16-netfilter-nf_tables-get-rid-of-struct-nft_af_info-ab.patch +++ b/target/linux/generic/backport-4.14/338-v4.16-netfilter-nf_tables-get-rid-of-struct-nft_af_info-ab.patch @@ -323,7 +323,7 @@ Signed-off-by: Pablo Neira Ayuso static void nft_ctx_init(struct nft_ctx *ctx, struct net *net, -@@ -419,7 +354,7 @@ static struct nft_table *nft_table_looku +@@ -434,7 +369,7 @@ static struct nft_table *nft_table_looku list_for_each_entry(table, &net->nft.tables, list) { if (!nla_strcmp(nla, table->name) && @@ -332,7 +332,7 @@ Signed-off-by: Pablo Neira Ayuso nft_active_genmask(table, genmask)) return table; } -@@ -560,7 +495,7 @@ static int nf_tables_dump_tables(struct +@@ -575,7 +510,7 @@ static int nf_tables_dump_tables(struct cb->seq = net->nft.base_seq; list_for_each_entry_rcu(table, &net->nft.tables, list) { @@ -341,7 +341,7 @@ Signed-off-by: Pablo Neira Ayuso continue; if (idx < s_idx) -@@ -574,7 +509,7 @@ static int nf_tables_dump_tables(struct +@@ -589,7 +524,7 @@ static int nf_tables_dump_tables(struct NETLINK_CB(cb->skb).portid, cb->nlh->nlmsg_seq, NFT_MSG_NEWTABLE, NLM_F_MULTI, @@ -350,7 +350,7 @@ Signed-off-by: Pablo Neira Ayuso goto done; nl_dump_check_consistent(cb, nlmsg_hdr(skb)); -@@ -594,7 +529,6 @@ static int nf_tables_gettable(struct net +@@ -609,7 +544,6 @@ static int nf_tables_gettable(struct net { const struct nfgenmsg *nfmsg = nlmsg_data(nlh); u8 genmask = nft_genmask_cur(net); @@ -358,7 +358,7 @@ Signed-off-by: Pablo Neira Ayuso const struct nft_table *table; struct sk_buff *skb2; int family = nfmsg->nfgen_family; -@@ -607,11 +541,7 @@ static int nf_tables_gettable(struct net +@@ -622,11 +556,7 @@ static int nf_tables_gettable(struct net return netlink_dump_start(nlsk, skb, nlh, &c); } @@ -371,7 +371,7 @@ Signed-off-by: Pablo Neira Ayuso genmask); if (IS_ERR(table)) return PTR_ERR(table); -@@ -731,19 +661,14 @@ static int nf_tables_newtable(struct net +@@ -746,19 +676,14 @@ static int nf_tables_newtable(struct net const struct nfgenmsg *nfmsg = nlmsg_data(nlh); u8 genmask = nft_genmask_next(net); const struct nlattr *name; @@ -392,7 +392,7 @@ Signed-off-by: Pablo Neira Ayuso if (IS_ERR(table)) { if (PTR_ERR(table) != -ENOENT) return PTR_ERR(table); -@@ -753,7 +678,7 @@ static int nf_tables_newtable(struct net +@@ -768,7 +693,7 @@ static int nf_tables_newtable(struct net if (nlh->nlmsg_flags & NLM_F_REPLACE) return -EOPNOTSUPP; @@ -401,7 +401,7 @@ Signed-off-by: Pablo Neira Ayuso return nf_tables_updtable(&ctx); } -@@ -763,40 +688,34 @@ static int nf_tables_newtable(struct net +@@ -778,40 +703,34 @@ static int nf_tables_newtable(struct net return -EINVAL; } @@ -450,7 +450,7 @@ Signed-off-by: Pablo Neira Ayuso return err; } -@@ -867,10 +786,10 @@ static int nft_flush(struct nft_ctx *ctx +@@ -882,10 +801,10 @@ static int nft_flush(struct nft_ctx *ctx int err = 0; list_for_each_entry_safe(table, nt, &ctx->net->nft.tables, list) { @@ -463,7 +463,7 @@ Signed-off-by: Pablo Neira Ayuso if (!nft_is_active_next(ctx->net, table)) continue; -@@ -896,7 +815,6 @@ static int nf_tables_deltable(struct net +@@ -911,7 +830,6 @@ static int nf_tables_deltable(struct net { const struct nfgenmsg *nfmsg = nlmsg_data(nlh); u8 genmask = nft_genmask_next(net); @@ -471,7 +471,7 @@ Signed-off-by: Pablo Neira Ayuso struct nft_table *table; int family = nfmsg->nfgen_family; struct nft_ctx ctx; -@@ -905,11 +823,7 @@ static int nf_tables_deltable(struct net +@@ -920,11 +838,7 @@ static int nf_tables_deltable(struct net if (family == AF_UNSPEC || nla[NFTA_TABLE_NAME] == NULL) return nft_flush(&ctx, family); @@ -484,7 +484,7 @@ Signed-off-by: Pablo Neira Ayuso genmask); if (IS_ERR(table)) return PTR_ERR(table); -@@ -918,7 +832,7 @@ static int nf_tables_deltable(struct net +@@ -933,7 +847,7 @@ static int nf_tables_deltable(struct net table->use > 0) return -EBUSY; @@ -493,7 +493,7 @@ Signed-off-by: Pablo Neira Ayuso ctx.table = table; return nft_flush_table(&ctx); -@@ -930,7 +844,6 @@ static void nf_tables_table_destroy(stru +@@ -945,7 +859,6 @@ static void nf_tables_table_destroy(stru kfree(ctx->table->name); kfree(ctx->table); @@ -501,7 +501,7 @@ Signed-off-by: Pablo Neira Ayuso } int nft_register_chain_type(const struct nf_chain_type *ctype) -@@ -1159,7 +1072,7 @@ static int nf_tables_dump_chains(struct +@@ -1174,7 +1087,7 @@ static int nf_tables_dump_chains(struct cb->seq = net->nft.base_seq; list_for_each_entry_rcu(table, &net->nft.tables, list) { @@ -510,7 +510,7 @@ Signed-off-by: Pablo Neira Ayuso continue; list_for_each_entry_rcu(chain, &table->chains, list) { -@@ -1175,7 +1088,7 @@ static int nf_tables_dump_chains(struct +@@ -1190,7 +1103,7 @@ static int nf_tables_dump_chains(struct cb->nlh->nlmsg_seq, NFT_MSG_NEWCHAIN, NLM_F_MULTI, @@ -519,7 +519,7 @@ Signed-off-by: Pablo Neira Ayuso chain) < 0) goto done; -@@ -1197,7 +1110,6 @@ static int nf_tables_getchain(struct net +@@ -1212,7 +1125,6 @@ static int nf_tables_getchain(struct net { const struct nfgenmsg *nfmsg = nlmsg_data(nlh); u8 genmask = nft_genmask_cur(net); @@ -527,7 +527,7 @@ Signed-off-by: Pablo Neira Ayuso const struct nft_table *table; const struct nft_chain *chain; struct sk_buff *skb2; -@@ -1211,11 +1123,7 @@ static int nf_tables_getchain(struct net +@@ -1226,11 +1138,7 @@ static int nf_tables_getchain(struct net return netlink_dump_start(nlsk, skb, nlh, &c); } @@ -540,7 +540,7 @@ Signed-off-by: Pablo Neira Ayuso genmask); if (IS_ERR(table)) return PTR_ERR(table); -@@ -1597,7 +1505,6 @@ static int nf_tables_newchain(struct net +@@ -1612,7 +1520,6 @@ static int nf_tables_newchain(struct net const struct nlattr * uninitialized_var(name); u8 genmask = nft_genmask_next(net); int family = nfmsg->nfgen_family; @@ -548,7 +548,7 @@ Signed-off-by: Pablo Neira Ayuso struct nft_table *table; struct nft_chain *chain; u8 policy = NF_ACCEPT; -@@ -1607,11 +1514,7 @@ static int nf_tables_newchain(struct net +@@ -1622,11 +1529,7 @@ static int nf_tables_newchain(struct net create = nlh->nlmsg_flags & NLM_F_CREATE ? true : false; @@ -561,7 +561,7 @@ Signed-off-by: Pablo Neira Ayuso genmask); if (IS_ERR(table)) return PTR_ERR(table); -@@ -1652,7 +1555,7 @@ static int nf_tables_newchain(struct net +@@ -1667,7 +1570,7 @@ static int nf_tables_newchain(struct net } } @@ -570,7 +570,7 @@ Signed-off-by: Pablo Neira Ayuso if (chain != NULL) { if (nlh->nlmsg_flags & NLM_F_EXCL) -@@ -1673,7 +1576,6 @@ static int nf_tables_delchain(struct net +@@ -1688,7 +1591,6 @@ static int nf_tables_delchain(struct net { const struct nfgenmsg *nfmsg = nlmsg_data(nlh); u8 genmask = nft_genmask_next(net); @@ -578,7 +578,7 @@ Signed-off-by: Pablo Neira Ayuso struct nft_table *table; struct nft_chain *chain; struct nft_rule *rule; -@@ -1682,11 +1584,7 @@ static int nf_tables_delchain(struct net +@@ -1697,11 +1599,7 @@ static int nf_tables_delchain(struct net u32 use; int err; @@ -591,7 +591,7 @@ Signed-off-by: Pablo Neira Ayuso genmask); if (IS_ERR(table)) return PTR_ERR(table); -@@ -1699,7 +1597,7 @@ static int nf_tables_delchain(struct net +@@ -1714,7 +1612,7 @@ static int nf_tables_delchain(struct net chain->use > 0) return -EBUSY; @@ -600,7 +600,7 @@ Signed-off-by: Pablo Neira Ayuso use = chain->use; list_for_each_entry(rule, &chain->rules, list) { -@@ -2123,7 +2021,7 @@ static int nf_tables_dump_rules(struct s +@@ -2145,7 +2043,7 @@ static int nf_tables_dump_rules(struct s cb->seq = net->nft.base_seq; list_for_each_entry_rcu(table, &net->nft.tables, list) { @@ -609,7 +609,7 @@ Signed-off-by: Pablo Neira Ayuso continue; if (ctx && ctx->table && strcmp(ctx->table, table->name) != 0) -@@ -2146,7 +2044,7 @@ static int nf_tables_dump_rules(struct s +@@ -2168,7 +2066,7 @@ static int nf_tables_dump_rules(struct s cb->nlh->nlmsg_seq, NFT_MSG_NEWRULE, NLM_F_MULTI | NLM_F_APPEND, @@ -618,7 +618,7 @@ Signed-off-by: Pablo Neira Ayuso table, chain, rule) < 0) goto done; -@@ -2182,7 +2080,6 @@ static int nf_tables_getrule(struct net +@@ -2204,7 +2102,6 @@ static int nf_tables_getrule(struct net { const struct nfgenmsg *nfmsg = nlmsg_data(nlh); u8 genmask = nft_genmask_cur(net); @@ -626,7 +626,7 @@ Signed-off-by: Pablo Neira Ayuso const struct nft_table *table; const struct nft_chain *chain; const struct nft_rule *rule; -@@ -2226,11 +2123,7 @@ static int nf_tables_getrule(struct net +@@ -2248,11 +2145,7 @@ static int nf_tables_getrule(struct net return netlink_dump_start(nlsk, skb, nlh, &c); } @@ -639,7 +639,7 @@ Signed-off-by: Pablo Neira Ayuso genmask); if (IS_ERR(table)) return PTR_ERR(table); -@@ -2296,7 +2189,7 @@ static int nf_tables_newrule(struct net +@@ -2318,7 +2211,7 @@ static int nf_tables_newrule(struct net { const struct nfgenmsg *nfmsg = nlmsg_data(nlh); u8 genmask = nft_genmask_next(net); @@ -648,7 +648,7 @@ Signed-off-by: Pablo Neira Ayuso struct nft_table *table; struct nft_chain *chain; struct nft_rule *rule, *old_rule = NULL; -@@ -2312,11 +2205,7 @@ static int nf_tables_newrule(struct net +@@ -2334,11 +2227,7 @@ static int nf_tables_newrule(struct net create = nlh->nlmsg_flags & NLM_F_CREATE ? true : false; @@ -661,7 +661,7 @@ Signed-off-by: Pablo Neira Ayuso genmask); if (IS_ERR(table)) return PTR_ERR(table); -@@ -2356,7 +2245,7 @@ static int nf_tables_newrule(struct net +@@ -2378,7 +2267,7 @@ static int nf_tables_newrule(struct net return PTR_ERR(old_rule); } @@ -670,7 +670,7 @@ Signed-off-by: Pablo Neira Ayuso n = 0; size = 0; -@@ -2478,18 +2367,13 @@ static int nf_tables_delrule(struct net +@@ -2500,18 +2389,13 @@ static int nf_tables_delrule(struct net { const struct nfgenmsg *nfmsg = nlmsg_data(nlh); u8 genmask = nft_genmask_next(net); @@ -690,7 +690,7 @@ Signed-off-by: Pablo Neira Ayuso genmask); if (IS_ERR(table)) return PTR_ERR(table); -@@ -2501,7 +2385,7 @@ static int nf_tables_delrule(struct net +@@ -2523,7 +2407,7 @@ static int nf_tables_delrule(struct net return PTR_ERR(chain); } @@ -699,7 +699,7 @@ Signed-off-by: Pablo Neira Ayuso if (chain) { if (nla[NFTA_RULE_HANDLE]) { -@@ -2686,26 +2570,17 @@ static int nft_ctx_init_from_setattr(str +@@ -2708,26 +2592,17 @@ static int nft_ctx_init_from_setattr(str u8 genmask) { const struct nfgenmsg *nfmsg = nlmsg_data(nlh); @@ -729,7 +729,7 @@ Signed-off-by: Pablo Neira Ayuso return 0; } -@@ -2937,7 +2812,7 @@ static int nf_tables_dump_sets(struct sk +@@ -2959,7 +2834,7 @@ static int nf_tables_dump_sets(struct sk list_for_each_entry_rcu(table, &net->nft.tables, list) { if (ctx->family != NFPROTO_UNSPEC && @@ -738,7 +738,7 @@ Signed-off-by: Pablo Neira Ayuso continue; if (ctx->table && ctx->table != table) -@@ -2958,7 +2833,7 @@ static int nf_tables_dump_sets(struct sk +@@ -2980,7 +2855,7 @@ static int nf_tables_dump_sets(struct sk ctx_set = *ctx; ctx_set.table = table; @@ -747,7 +747,7 @@ Signed-off-by: Pablo Neira Ayuso if (nf_tables_fill_set(skb, &ctx_set, set, NFT_MSG_NEWSET, -@@ -3070,8 +2945,8 @@ static int nf_tables_newset(struct net * +@@ -3092,8 +2967,8 @@ static int nf_tables_newset(struct net * { const struct nfgenmsg *nfmsg = nlmsg_data(nlh); u8 genmask = nft_genmask_next(net); @@ -757,7 +757,7 @@ Signed-off-by: Pablo Neira Ayuso struct nft_table *table; struct nft_set *set; struct nft_ctx ctx; -@@ -3178,16 +3053,12 @@ static int nf_tables_newset(struct net * +@@ -3200,16 +3075,12 @@ static int nf_tables_newset(struct net * create = nlh->nlmsg_flags & NLM_F_CREATE ? true : false; @@ -776,7 +776,7 @@ Signed-off-by: Pablo Neira Ayuso set = nf_tables_set_lookup(table, nla[NFTA_SET_NAME], genmask); if (IS_ERR(set)) { -@@ -3449,19 +3320,15 @@ static int nft_ctx_init_from_elemattr(st +@@ -3471,19 +3342,15 @@ static int nft_ctx_init_from_elemattr(st u8 genmask) { const struct nfgenmsg *nfmsg = nlmsg_data(nlh); @@ -799,7 +799,7 @@ Signed-off-by: Pablo Neira Ayuso return 0; } -@@ -3579,7 +3446,7 @@ static int nf_tables_dump_set(struct sk_ +@@ -3601,7 +3468,7 @@ static int nf_tables_dump_set(struct sk_ rcu_read_lock(); list_for_each_entry_rcu(table, &net->nft.tables, list) { if (dump_ctx->ctx.family != NFPROTO_UNSPEC && @@ -808,7 +808,7 @@ Signed-off-by: Pablo Neira Ayuso continue; if (table != dump_ctx->ctx.table) -@@ -3609,7 +3476,7 @@ static int nf_tables_dump_set(struct sk_ +@@ -3631,7 +3498,7 @@ static int nf_tables_dump_set(struct sk_ goto nla_put_failure; nfmsg = nlmsg_data(nlh); @@ -817,7 +817,7 @@ Signed-off-by: Pablo Neira Ayuso nfmsg->version = NFNETLINK_V0; nfmsg->res_id = htons(net->nft.base_seq & 0xffff); -@@ -4489,7 +4356,6 @@ static int nf_tables_newobj(struct net * +@@ -4513,7 +4380,6 @@ static int nf_tables_newobj(struct net * const struct nft_object_type *type; u8 genmask = nft_genmask_next(net); int family = nfmsg->nfgen_family; @@ -825,7 +825,7 @@ Signed-off-by: Pablo Neira Ayuso struct nft_table *table; struct nft_object *obj; struct nft_ctx ctx; -@@ -4501,11 +4367,7 @@ static int nf_tables_newobj(struct net * +@@ -4525,11 +4391,7 @@ static int nf_tables_newobj(struct net * !nla[NFTA_OBJ_DATA]) return -EINVAL; @@ -838,7 +838,7 @@ Signed-off-by: Pablo Neira Ayuso genmask); if (IS_ERR(table)) return PTR_ERR(table); -@@ -4524,7 +4386,7 @@ static int nf_tables_newobj(struct net * +@@ -4548,7 +4410,7 @@ static int nf_tables_newobj(struct net * return 0; } @@ -847,7 +847,7 @@ Signed-off-by: Pablo Neira Ayuso type = nft_obj_type_get(objtype); if (IS_ERR(type)) -@@ -4616,7 +4478,7 @@ static int nf_tables_dump_obj(struct sk_ +@@ -4640,7 +4502,7 @@ static int nf_tables_dump_obj(struct sk_ cb->seq = net->nft.base_seq; list_for_each_entry_rcu(table, &net->nft.tables, list) { @@ -856,7 +856,7 @@ Signed-off-by: Pablo Neira Ayuso continue; list_for_each_entry_rcu(obj, &table->objects, list) { -@@ -4639,7 +4501,7 @@ static int nf_tables_dump_obj(struct sk_ +@@ -4663,7 +4525,7 @@ static int nf_tables_dump_obj(struct sk_ cb->nlh->nlmsg_seq, NFT_MSG_NEWOBJ, NLM_F_MULTI | NLM_F_APPEND, @@ -865,7 +865,7 @@ Signed-off-by: Pablo Neira Ayuso obj, reset) < 0) goto done; -@@ -4697,7 +4559,6 @@ static int nf_tables_getobj(struct net * +@@ -4721,7 +4583,6 @@ static int nf_tables_getobj(struct net * const struct nfgenmsg *nfmsg = nlmsg_data(nlh); u8 genmask = nft_genmask_cur(net); int family = nfmsg->nfgen_family; @@ -873,7 +873,7 @@ Signed-off-by: Pablo Neira Ayuso const struct nft_table *table; struct nft_object *obj; struct sk_buff *skb2; -@@ -4728,11 +4589,7 @@ static int nf_tables_getobj(struct net * +@@ -4752,11 +4613,7 @@ static int nf_tables_getobj(struct net * !nla[NFTA_OBJ_TYPE]) return -EINVAL; @@ -886,7 +886,7 @@ Signed-off-by: Pablo Neira Ayuso genmask); if (IS_ERR(table)) return PTR_ERR(table); -@@ -4779,7 +4636,6 @@ static int nf_tables_delobj(struct net * +@@ -4803,7 +4660,6 @@ static int nf_tables_delobj(struct net * const struct nfgenmsg *nfmsg = nlmsg_data(nlh); u8 genmask = nft_genmask_next(net); int family = nfmsg->nfgen_family; @@ -894,7 +894,7 @@ Signed-off-by: Pablo Neira Ayuso struct nft_table *table; struct nft_object *obj; struct nft_ctx ctx; -@@ -4789,11 +4645,7 @@ static int nf_tables_delobj(struct net * +@@ -4813,11 +4669,7 @@ static int nf_tables_delobj(struct net * !nla[NFTA_OBJ_NAME]) return -EINVAL; @@ -907,7 +907,7 @@ Signed-off-by: Pablo Neira Ayuso genmask); if (IS_ERR(table)) return PTR_ERR(table); -@@ -4805,7 +4657,7 @@ static int nf_tables_delobj(struct net * +@@ -4829,7 +4681,7 @@ static int nf_tables_delobj(struct net * if (obj->use > 0) return -EBUSY; @@ -916,7 +916,7 @@ Signed-off-by: Pablo Neira Ayuso return nft_delobj(&ctx, obj); } -@@ -4990,33 +4842,31 @@ err1: +@@ -5014,33 +4866,31 @@ err1: return err; } @@ -956,7 +956,7 @@ Signed-off-by: Pablo Neira Ayuso return ERR_PTR(-EAGAIN); } #endif -@@ -5064,7 +4914,6 @@ static int nf_tables_newflowtable(struct +@@ -5088,7 +4938,6 @@ static int nf_tables_newflowtable(struct u8 genmask = nft_genmask_next(net); int family = nfmsg->nfgen_family; struct nft_flowtable *flowtable; @@ -964,7 +964,7 @@ Signed-off-by: Pablo Neira Ayuso struct nft_table *table; struct nft_ctx ctx; int err, i, k; -@@ -5074,12 +4923,8 @@ static int nf_tables_newflowtable(struct +@@ -5098,12 +4947,8 @@ static int nf_tables_newflowtable(struct !nla[NFTA_FLOWTABLE_HOOK]) return -EINVAL; @@ -978,7 +978,7 @@ Signed-off-by: Pablo Neira Ayuso if (IS_ERR(table)) return PTR_ERR(table); -@@ -5096,7 +4941,7 @@ static int nf_tables_newflowtable(struct +@@ -5120,7 +4965,7 @@ static int nf_tables_newflowtable(struct return 0; } @@ -987,7 +987,7 @@ Signed-off-by: Pablo Neira Ayuso flowtable = kzalloc(sizeof(*flowtable), GFP_KERNEL); if (!flowtable) -@@ -5109,7 +4954,7 @@ static int nf_tables_newflowtable(struct +@@ -5133,7 +4978,7 @@ static int nf_tables_newflowtable(struct goto err1; } @@ -996,7 +996,7 @@ Signed-off-by: Pablo Neira Ayuso if (IS_ERR(type)) { err = PTR_ERR(type); goto err2; -@@ -5169,16 +5014,11 @@ static int nf_tables_delflowtable(struct +@@ -5193,16 +5038,11 @@ static int nf_tables_delflowtable(struct u8 genmask = nft_genmask_next(net); int family = nfmsg->nfgen_family; struct nft_flowtable *flowtable; @@ -1014,7 +1014,7 @@ Signed-off-by: Pablo Neira Ayuso if (IS_ERR(table)) return PTR_ERR(table); -@@ -5189,7 +5029,7 @@ static int nf_tables_delflowtable(struct +@@ -5213,7 +5053,7 @@ static int nf_tables_delflowtable(struct if (flowtable->use > 0) return -EBUSY; @@ -1023,7 +1023,7 @@ Signed-off-by: Pablo Neira Ayuso return nft_delflowtable(&ctx, flowtable); } -@@ -5264,7 +5104,7 @@ static int nf_tables_dump_flowtable(stru +@@ -5288,7 +5128,7 @@ static int nf_tables_dump_flowtable(stru cb->seq = net->nft.base_seq; list_for_each_entry_rcu(table, &net->nft.tables, list) { @@ -1032,7 +1032,7 @@ Signed-off-by: Pablo Neira Ayuso continue; list_for_each_entry_rcu(flowtable, &table->flowtables, list) { -@@ -5283,7 +5123,7 @@ static int nf_tables_dump_flowtable(stru +@@ -5307,7 +5147,7 @@ static int nf_tables_dump_flowtable(stru cb->nlh->nlmsg_seq, NFT_MSG_NEWFLOWTABLE, NLM_F_MULTI | NLM_F_APPEND, @@ -1041,7 +1041,7 @@ Signed-off-by: Pablo Neira Ayuso goto done; nl_dump_check_consistent(cb, nlmsg_hdr(skb)); -@@ -5343,7 +5183,6 @@ static int nf_tables_getflowtable(struct +@@ -5367,7 +5207,6 @@ static int nf_tables_getflowtable(struct u8 genmask = nft_genmask_cur(net); int family = nfmsg->nfgen_family; struct nft_flowtable *flowtable; @@ -1049,7 +1049,7 @@ Signed-off-by: Pablo Neira Ayuso const struct nft_table *table; struct sk_buff *skb2; int err; -@@ -5369,12 +5208,8 @@ static int nf_tables_getflowtable(struct +@@ -5393,12 +5232,8 @@ static int nf_tables_getflowtable(struct if (!nla[NFTA_FLOWTABLE_NAME]) return -EINVAL; @@ -1063,7 +1063,7 @@ Signed-off-by: Pablo Neira Ayuso if (IS_ERR(table)) return PTR_ERR(table); -@@ -6545,7 +6380,7 @@ int __nft_release_basechain(struct nft_c +@@ -6569,7 +6404,7 @@ int __nft_release_basechain(struct nft_c } EXPORT_SYMBOL_GPL(__nft_release_basechain); @@ -1072,7 +1072,7 @@ Signed-off-by: Pablo Neira Ayuso { struct nft_flowtable *flowtable, *nf; struct nft_table *table, *nt; -@@ -6558,7 +6393,7 @@ static void __nft_release_afinfo(struct +@@ -6582,7 +6417,7 @@ static void __nft_release_afinfo(struct }; list_for_each_entry_safe(table, nt, &net->nft.tables, list) { @@ -1081,7 +1081,7 @@ Signed-off-by: Pablo Neira Ayuso list_for_each_entry(chain, &table->chains, list) nf_tables_unregister_hook(net, table, chain); -@@ -6610,7 +6445,7 @@ static int __net_init nf_tables_init_net +@@ -6634,7 +6469,7 @@ static int __net_init nf_tables_init_net static void __net_exit nf_tables_exit_net(struct net *net) { diff --git a/target/linux/generic/backport-4.14/339-v4.16-netfilter-nft_flow_offload-wait-for-garbage-collecto.patch b/target/linux/generic/backport-4.14/339-v4.16-netfilter-nft_flow_offload-wait-for-garbage-collecto.patch index 663f088d65..7a3571609a 100644 --- a/target/linux/generic/backport-4.14/339-v4.16-netfilter-nft_flow_offload-wait-for-garbage-collecto.patch +++ b/target/linux/generic/backport-4.14/339-v4.16-netfilter-nft_flow_offload-wait-for-garbage-collecto.patch @@ -17,7 +17,7 @@ Signed-off-by: Pablo Neira Ayuso --- a/net/netfilter/nf_tables_api.c +++ b/net/netfilter/nf_tables_api.c -@@ -4880,13 +4880,13 @@ void nft_flow_table_iterate(struct net * +@@ -4904,13 +4904,13 @@ void nft_flow_table_iterate(struct net * struct nft_flowtable *flowtable; const struct nft_table *table; diff --git a/target/linux/generic/backport-4.14/342-v4.16-netfilter-nf_tables-fix-flowtable-free.patch b/target/linux/generic/backport-4.14/342-v4.16-netfilter-nf_tables-fix-flowtable-free.patch index 3aed3f9ff1..d75aa4de03 100644 --- a/target/linux/generic/backport-4.14/342-v4.16-netfilter-nf_tables-fix-flowtable-free.patch +++ b/target/linux/generic/backport-4.14/342-v4.16-netfilter-nf_tables-fix-flowtable-free.patch @@ -118,7 +118,7 @@ Signed-off-by: Pablo Neira Ayuso }; --- a/net/netfilter/nf_tables_api.c +++ b/net/netfilter/nf_tables_api.c -@@ -5265,17 +5265,12 @@ err: +@@ -5289,17 +5289,12 @@ err: nfnetlink_set_err(ctx->net, ctx->portid, NFNLGRP_NFTABLES, -ENOBUFS); } diff --git a/target/linux/generic/backport-4.14/344-v4.16-netfilter-nf_tables-allocate-handle-and-delete-objec.patch b/target/linux/generic/backport-4.14/344-v4.16-netfilter-nf_tables-allocate-handle-and-delete-objec.patch index 84729ad1f5..a2544aeaf0 100644 --- a/target/linux/generic/backport-4.14/344-v4.16-netfilter-nf_tables-allocate-handle-and-delete-objec.patch +++ b/target/linux/generic/backport-4.14/344-v4.16-netfilter-nf_tables-allocate-handle-and-delete-objec.patch @@ -151,7 +151,7 @@ Signed-off-by: Pablo Neira Ayuso static void nft_ctx_init(struct nft_ctx *ctx, struct net *net, -@@ -361,6 +362,20 @@ static struct nft_table *nft_table_looku +@@ -376,6 +377,20 @@ static struct nft_table *nft_table_looku return NULL; } @@ -172,7 +172,7 @@ Signed-off-by: Pablo Neira Ayuso static struct nft_table *nf_tables_table_lookup(const struct net *net, const struct nlattr *nla, u8 family, u8 genmask) -@@ -377,6 +392,22 @@ static struct nft_table *nf_tables_table +@@ -392,6 +407,22 @@ static struct nft_table *nf_tables_table return ERR_PTR(-ENOENT); } @@ -195,7 +195,7 @@ Signed-off-by: Pablo Neira Ayuso static inline u64 nf_tables_alloc_handle(struct nft_table *table) { return ++table->hgenerator; -@@ -423,6 +454,7 @@ static const struct nla_policy nft_table +@@ -438,6 +469,7 @@ static const struct nla_policy nft_table [NFTA_TABLE_NAME] = { .type = NLA_STRING, .len = NFT_TABLE_MAXNAMELEN - 1 }, [NFTA_TABLE_FLAGS] = { .type = NLA_U32 }, @@ -203,7 +203,7 @@ Signed-off-by: Pablo Neira Ayuso }; static int nf_tables_fill_table_info(struct sk_buff *skb, struct net *net, -@@ -444,7 +476,9 @@ static int nf_tables_fill_table_info(str +@@ -459,7 +491,9 @@ static int nf_tables_fill_table_info(str if (nla_put_string(skb, NFTA_TABLE_NAME, table->name) || nla_put_be32(skb, NFTA_TABLE_FLAGS, htonl(table->flags)) || @@ -214,7 +214,7 @@ Signed-off-by: Pablo Neira Ayuso goto nla_put_failure; nlmsg_end(skb, nlh); -@@ -703,6 +737,7 @@ static int nf_tables_newtable(struct net +@@ -718,6 +752,7 @@ static int nf_tables_newtable(struct net INIT_LIST_HEAD(&table->flowtables); table->family = family; table->flags = flags; @@ -222,7 +222,7 @@ Signed-off-by: Pablo Neira Ayuso nft_ctx_init(&ctx, net, skb, nlh, family, table, NULL, nla); err = nft_trans_table_add(&ctx, NFT_MSG_NEWTABLE); -@@ -820,11 +855,18 @@ static int nf_tables_deltable(struct net +@@ -835,11 +870,18 @@ static int nf_tables_deltable(struct net struct nft_ctx ctx; nft_ctx_init(&ctx, net, skb, nlh, 0, NULL, NULL, nla); @@ -244,7 +244,7 @@ Signed-off-by: Pablo Neira Ayuso if (IS_ERR(table)) return PTR_ERR(table); -@@ -1581,6 +1623,7 @@ static int nf_tables_delchain(struct net +@@ -1596,6 +1638,7 @@ static int nf_tables_delchain(struct net struct nft_rule *rule; int family = nfmsg->nfgen_family; struct nft_ctx ctx; @@ -252,7 +252,7 @@ Signed-off-by: Pablo Neira Ayuso u32 use; int err; -@@ -1589,7 +1632,12 @@ static int nf_tables_delchain(struct net +@@ -1604,7 +1647,12 @@ static int nf_tables_delchain(struct net if (IS_ERR(table)) return PTR_ERR(table); @@ -266,7 +266,7 @@ Signed-off-by: Pablo Neira Ayuso if (IS_ERR(chain)) return PTR_ERR(chain); -@@ -2557,6 +2605,7 @@ static const struct nla_policy nft_set_p +@@ -2579,6 +2627,7 @@ static const struct nla_policy nft_set_p [NFTA_SET_USERDATA] = { .type = NLA_BINARY, .len = NFT_USERDATA_MAXLEN }, [NFTA_SET_OBJ_TYPE] = { .type = NLA_U32 }, @@ -274,7 +274,7 @@ Signed-off-by: Pablo Neira Ayuso }; static const struct nla_policy nft_set_desc_policy[NFTA_SET_DESC_MAX + 1] = { -@@ -2600,6 +2649,22 @@ static struct nft_set *nf_tables_set_loo +@@ -2622,6 +2671,22 @@ static struct nft_set *nf_tables_set_loo return ERR_PTR(-ENOENT); } @@ -297,7 +297,7 @@ Signed-off-by: Pablo Neira Ayuso static struct nft_set *nf_tables_set_lookup_byid(const struct net *net, const struct nlattr *nla, u8 genmask) -@@ -2716,6 +2781,9 @@ static int nf_tables_fill_set(struct sk_ +@@ -2738,6 +2803,9 @@ static int nf_tables_fill_set(struct sk_ goto nla_put_failure; if (nla_put_string(skb, NFTA_SET_NAME, set->name)) goto nla_put_failure; @@ -307,7 +307,7 @@ Signed-off-by: Pablo Neira Ayuso if (set->flags != 0) if (nla_put_be32(skb, NFTA_SET_FLAGS, htonl(set->flags))) goto nla_put_failure; -@@ -3124,6 +3192,7 @@ static int nf_tables_newset(struct net * +@@ -3146,6 +3214,7 @@ static int nf_tables_newset(struct net * set->udata = udata; set->timeout = timeout; set->gc_int = gc_int; @@ -315,7 +315,7 @@ Signed-off-by: Pablo Neira Ayuso err = ops->init(set, &desc, nla); if (err < 0) -@@ -3183,7 +3252,10 @@ static int nf_tables_delset(struct net * +@@ -3205,7 +3274,10 @@ static int nf_tables_delset(struct net * if (err < 0) return err; @@ -327,7 +327,7 @@ Signed-off-by: Pablo Neira Ayuso if (IS_ERR(set)) return PTR_ERR(set); -@@ -4244,6 +4316,21 @@ struct nft_object *nf_tables_obj_lookup( +@@ -4268,6 +4340,21 @@ struct nft_object *nf_tables_obj_lookup( } EXPORT_SYMBOL_GPL(nf_tables_obj_lookup); @@ -349,7 +349,7 @@ Signed-off-by: Pablo Neira Ayuso static const struct nla_policy nft_obj_policy[NFTA_OBJ_MAX + 1] = { [NFTA_OBJ_TABLE] = { .type = NLA_STRING, .len = NFT_TABLE_MAXNAMELEN - 1 }, -@@ -4251,6 +4338,7 @@ static const struct nla_policy nft_obj_p +@@ -4275,6 +4362,7 @@ static const struct nla_policy nft_obj_p .len = NFT_OBJ_MAXNAMELEN - 1 }, [NFTA_OBJ_TYPE] = { .type = NLA_U32 }, [NFTA_OBJ_DATA] = { .type = NLA_NESTED }, @@ -357,7 +357,7 @@ Signed-off-by: Pablo Neira Ayuso }; static struct nft_object *nft_obj_init(const struct nft_ctx *ctx, -@@ -4398,6 +4486,8 @@ static int nf_tables_newobj(struct net * +@@ -4422,6 +4510,8 @@ static int nf_tables_newobj(struct net * goto err1; } obj->table = table; @@ -366,7 +366,7 @@ Signed-off-by: Pablo Neira Ayuso obj->name = nla_strdup(nla[NFTA_OBJ_NAME], GFP_KERNEL); if (!obj->name) { err = -ENOMEM; -@@ -4444,7 +4534,9 @@ static int nf_tables_fill_obj_info(struc +@@ -4468,7 +4558,9 @@ static int nf_tables_fill_obj_info(struc nla_put_string(skb, NFTA_OBJ_NAME, obj->name) || nla_put_be32(skb, NFTA_OBJ_TYPE, htonl(obj->ops->type->type)) || nla_put_be32(skb, NFTA_OBJ_USE, htonl(obj->use)) || @@ -377,7 +377,7 @@ Signed-off-by: Pablo Neira Ayuso goto nla_put_failure; nlmsg_end(skb, nlh); -@@ -4642,7 +4734,7 @@ static int nf_tables_delobj(struct net * +@@ -4666,7 +4758,7 @@ static int nf_tables_delobj(struct net * u32 objtype; if (!nla[NFTA_OBJ_TYPE] || @@ -386,7 +386,7 @@ Signed-off-by: Pablo Neira Ayuso return -EINVAL; table = nf_tables_table_lookup(net, nla[NFTA_OBJ_TABLE], family, -@@ -4651,7 +4743,12 @@ static int nf_tables_delobj(struct net * +@@ -4675,7 +4767,12 @@ static int nf_tables_delobj(struct net * return PTR_ERR(table); objtype = ntohl(nla_get_be32(nla[NFTA_OBJ_TYPE])); @@ -400,7 +400,7 @@ Signed-off-by: Pablo Neira Ayuso if (IS_ERR(obj)) return PTR_ERR(obj); if (obj->use > 0) -@@ -4723,6 +4820,7 @@ static const struct nla_policy nft_flowt +@@ -4747,6 +4844,7 @@ static const struct nla_policy nft_flowt [NFTA_FLOWTABLE_NAME] = { .type = NLA_STRING, .len = NFT_NAME_MAXLEN - 1 }, [NFTA_FLOWTABLE_HOOK] = { .type = NLA_NESTED }, @@ -408,7 +408,7 @@ Signed-off-by: Pablo Neira Ayuso }; struct nft_flowtable *nf_tables_flowtable_lookup(const struct nft_table *table, -@@ -4740,6 +4838,20 @@ struct nft_flowtable *nf_tables_flowtabl +@@ -4764,6 +4862,20 @@ struct nft_flowtable *nf_tables_flowtabl } EXPORT_SYMBOL_GPL(nf_tables_flowtable_lookup); @@ -429,7 +429,7 @@ Signed-off-by: Pablo Neira Ayuso #define NFT_FLOWTABLE_DEVICE_MAX 8 static int nf_tables_parse_devices(const struct nft_ctx *ctx, -@@ -4948,6 +5060,8 @@ static int nf_tables_newflowtable(struct +@@ -4972,6 +5084,8 @@ static int nf_tables_newflowtable(struct return -ENOMEM; flowtable->table = table; @@ -438,7 +438,7 @@ Signed-off-by: Pablo Neira Ayuso flowtable->name = nla_strdup(nla[NFTA_FLOWTABLE_NAME], GFP_KERNEL); if (!flowtable->name) { err = -ENOMEM; -@@ -5022,8 +5136,14 @@ static int nf_tables_delflowtable(struct +@@ -5046,8 +5160,14 @@ static int nf_tables_delflowtable(struct if (IS_ERR(table)) return PTR_ERR(table); @@ -455,7 +455,7 @@ Signed-off-by: Pablo Neira Ayuso if (IS_ERR(flowtable)) return PTR_ERR(flowtable); if (flowtable->use > 0) -@@ -5056,7 +5176,9 @@ static int nf_tables_fill_flowtable_info +@@ -5080,7 +5200,9 @@ static int nf_tables_fill_flowtable_info if (nla_put_string(skb, NFTA_FLOWTABLE_TABLE, flowtable->table->name) || nla_put_string(skb, NFTA_FLOWTABLE_NAME, flowtable->name) || diff --git a/target/linux/generic/backport-4.14/350-v4.18-ipv6-make-ip6_dst_mtu_forward-inline.patch b/target/linux/generic/backport-4.14/350-v4.18-ipv6-make-ip6_dst_mtu_forward-inline.patch index daa4d3b3d8..dddc347436 100644 --- a/target/linux/generic/backport-4.14/350-v4.18-ipv6-make-ip6_dst_mtu_forward-inline.patch +++ b/target/linux/generic/backport-4.14/350-v4.18-ipv6-make-ip6_dst_mtu_forward-inline.patch @@ -38,7 +38,7 @@ Signed-off-by: Felix Fietkau #endif --- a/include/net/ipv6.h +++ b/include/net/ipv6.h -@@ -889,8 +889,6 @@ static inline struct sk_buff *ip6_finish +@@ -860,8 +860,6 @@ static inline struct sk_buff *ip6_finish &inet6_sk(sk)->cork); } diff --git a/target/linux/generic/backport-4.14/357-v4.18-netfilter-nf_flow_table-move-init-code-to-nf_flow_ta.patch b/target/linux/generic/backport-4.14/357-v4.18-netfilter-nf_flow_table-move-init-code-to-nf_flow_ta.patch index 3cc644a530..7113c5d9c4 100644 --- a/target/linux/generic/backport-4.14/357-v4.18-netfilter-nf_flow_table-move-init-code-to-nf_flow_ta.patch +++ b/target/linux/generic/backport-4.14/357-v4.18-netfilter-nf_flow_table-move-init-code-to-nf_flow_ta.patch @@ -236,7 +236,7 @@ Signed-off-by: Felix Fietkau .owner = THIS_MODULE, --- a/net/netfilter/nf_tables_api.c +++ b/net/netfilter/nf_tables_api.c -@@ -5075,40 +5075,38 @@ static int nf_tables_newflowtable(struct +@@ -5099,40 +5099,38 @@ static int nf_tables_newflowtable(struct } flowtable->data.type = type; @@ -285,7 +285,7 @@ Signed-off-by: Felix Fietkau err3: module_put(type->owner); err2: -@@ -5389,10 +5387,8 @@ err: +@@ -5413,10 +5411,8 @@ err: static void nf_tables_flowtable_destroy(struct nft_flowtable *flowtable) { diff --git a/target/linux/generic/backport-4.14/358-v4.18-netfilter-nf_flow_table-fix-priv-pointer-for-netdev-.patch b/target/linux/generic/backport-4.14/358-v4.18-netfilter-nf_flow_table-fix-priv-pointer-for-netdev-.patch index d78f8003aa..818498b1e7 100644 --- a/target/linux/generic/backport-4.14/358-v4.18-netfilter-nf_flow_table-fix-priv-pointer-for-netdev-.patch +++ b/target/linux/generic/backport-4.14/358-v4.18-netfilter-nf_flow_table-fix-priv-pointer-for-netdev-.patch @@ -11,7 +11,7 @@ Signed-off-by: Felix Fietkau --- a/net/netfilter/nf_tables_api.c +++ b/net/netfilter/nf_tables_api.c -@@ -4941,7 +4941,7 @@ static int nf_tables_flowtable_parse_hoo +@@ -4965,7 +4965,7 @@ static int nf_tables_flowtable_parse_hoo flowtable->ops[i].pf = NFPROTO_NETDEV; flowtable->ops[i].hooknum = hooknum; flowtable->ops[i].priority = priority; diff --git a/target/linux/generic/backport-4.14/359-v4.18-netfilter-nf_flow_table-track-flow-tables-in-nf_flow.patch b/target/linux/generic/backport-4.14/359-v4.18-netfilter-nf_flow_table-track-flow-tables-in-nf_flow.patch index 8268041c21..01ee106a4c 100644 --- a/target/linux/generic/backport-4.14/359-v4.18-netfilter-nf_flow_table-track-flow-tables-in-nf_flow.patch +++ b/target/linux/generic/backport-4.14/359-v4.18-netfilter-nf_flow_table-track-flow-tables-in-nf_flow.patch @@ -88,7 +88,7 @@ Signed-off-by: Felix Fietkau WARN_ON(!nf_flow_offload_gc_step(flow_table)); --- a/net/netfilter/nf_tables_api.c +++ b/net/netfilter/nf_tables_api.c -@@ -4985,23 +4985,6 @@ static const struct nf_flowtable_type *n +@@ -5009,23 +5009,6 @@ static const struct nf_flowtable_type *n return ERR_PTR(-ENOENT); } diff --git a/target/linux/generic/backport-4.14/370-netfilter-nf_flow_table-fix-offloaded-connection-tim.patch b/target/linux/generic/backport-4.14/370-netfilter-nf_flow_table-fix-offloaded-connection-tim.patch index e17b4b6204..286f1f659c 100644 --- a/target/linux/generic/backport-4.14/370-netfilter-nf_flow_table-fix-offloaded-connection-tim.patch +++ b/target/linux/generic/backport-4.14/370-netfilter-nf_flow_table-fix-offloaded-connection-tim.patch @@ -21,7 +21,7 @@ Signed-off-by: Felix Fietkau --- a/net/netfilter/nf_conntrack_core.c +++ b/net/netfilter/nf_conntrack_core.c -@@ -981,18 +981,6 @@ static bool gc_worker_can_early_drop(con +@@ -1040,18 +1040,6 @@ static bool gc_worker_can_early_drop(con return false; } @@ -40,7 +40,7 @@ Signed-off-by: Felix Fietkau static void gc_worker(struct work_struct *work) { unsigned int min_interval = max(HZ / GC_MAX_BUCKETS_DIV, 1u); -@@ -1029,10 +1017,8 @@ static void gc_worker(struct work_struct +@@ -1088,10 +1076,8 @@ static void gc_worker(struct work_struct tmp = nf_ct_tuplehash_to_ctrack(h); scanned++; diff --git a/target/linux/generic/backport-4.14/380-v5.3-net-sched-Introduce-act_ctinfo-action.patch b/target/linux/generic/backport-4.14/380-v5.3-net-sched-Introduce-act_ctinfo-action.patch new file mode 100644 index 0000000000..dd22d2bfac --- /dev/null +++ b/target/linux/generic/backport-4.14/380-v5.3-net-sched-Introduce-act_ctinfo-action.patch @@ -0,0 +1,566 @@ +From e3777dd42dc6f1b9cb099836707a3e7971dcf4df Mon Sep 17 00:00:00 2001 +From: Kevin Darbyshire-Bryant +Date: Wed, 13 Mar 2019 20:54:49 +0000 +Subject: [PATCH] net: sched: Introduce act_ctinfo action + +ctinfo is a new tc filter action module. It is designed to restore DSCPs +stored in conntrack marks + +The feature is intended for use and has been found useful for restoring +ingress classifications based on egress classifications across links +that bleach or otherwise change DSCP, typically home ISP Internet links. +Restoring DSCP on ingress on the WAN link allows qdiscs such as CAKE to +shape inbound packets according to policies that are easier to implement +on egress. + +Ingress classification is traditionally a challenging task since +iptables rules haven't yet run and tc filter/eBPF programs are pre-NAT +lookups, hence are unable to see internal IPv4 addresses as used on the +typical home masquerading gateway. + +ctinfo understands the following parameters: + +dscp mask[/statemask] + +mask - a 32 bit mask of at least 6 contiguous bits where conndscp will +place the DSCP in conntrack mark. The DSCP is left-shifted by the +number of unset lower bits of the mask before storing into the mark +field. + +statemask - a 32 bit mask of (usually) 1 bit length, outside the area +specified by mask. This represents a conditional operation flag the +DSCP is only restored if the flag is set. This is useful to implement a +'one shot' iptables based classification where the 'complicated' +iptables rules are only run once to classify the connection on initial +(egress) packet and subsequent packets are all marked/restored with the +same DSCP. A mask of zero disables the conditional behaviour. + +optional parameters: + +zone - conntrack zone + +control - action related control (reclassify | pipe | drop | continue | +ok | goto chain + +Signed-off-by: Kevin Darbyshire-Bryant +--- + include/net/tc_act/tc_ctinfo.h | 33 +++ + include/uapi/linux/pkt_cls.h | 3 +- + include/uapi/linux/tc_act/tc_ctinfo.h | 29 ++ + net/sched/Kconfig | 13 + + net/sched/Makefile | 1 + + net/sched/act_ctinfo.c | 394 ++++++++++++++++++++++++++ + 6 files changed, 472 insertions(+), 1 deletion(-) + create mode 100644 include/net/tc_act/tc_ctinfo.h + create mode 100644 include/uapi/linux/tc_act/tc_ctinfo.h + create mode 100644 net/sched/act_ctinfo.c + +--- /dev/null ++++ b/include/net/tc_act/tc_ctinfo.h +@@ -0,0 +1,33 @@ ++/* SPDX-License-Identifier: GPL-2.0 */ ++#ifndef __NET_TC_CTINFO_H ++#define __NET_TC_CTINFO_H ++ ++#include ++ ++struct tcf_ctinfo_params { ++ struct rcu_head rcu; ++ struct net *net; ++ u32 dscpmask; ++ u32 dscpstatemask; ++ u32 cpmarkmask; ++ u16 zone; ++ u8 mode; ++ u8 dscpmaskshift; ++}; ++ ++struct tcf_ctinfo { ++ struct tc_action common; ++ struct tcf_ctinfo_params __rcu *params; ++ u64 stats_dscp_set; ++ u64 stats_dscp_error; ++ u64 stats_cpmark_set; ++}; ++ ++enum { ++ CTINFO_MODE_DSCP = BIT(0), ++ CTINFO_MODE_CPMARK = BIT(1) ++}; ++ ++#define to_ctinfo(a) ((struct tcf_ctinfo *)a) ++ ++#endif /* __NET_TC_CTINFO_H */ +--- a/include/uapi/linux/pkt_cls.h ++++ b/include/uapi/linux/pkt_cls.h +@@ -66,7 +66,8 @@ enum { + TCA_ID_UNSPEC=0, + TCA_ID_POLICE=1, + /* other actions go here */ +- __TCA_ID_MAX=255 ++ TCA_ID_CTINFO=27, ++ __TCA_ID_MAX = 255 + }; + + #define TCA_ID_MAX __TCA_ID_MAX +--- /dev/null ++++ b/include/uapi/linux/tc_act/tc_ctinfo.h +@@ -0,0 +1,29 @@ ++/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ ++#ifndef __UAPI_TC_CTINFO_H ++#define __UAPI_TC_CTINFO_H ++ ++#include ++#include ++ ++struct tc_ctinfo { ++ tc_gen; ++}; ++ ++enum { ++ TCA_CTINFO_UNSPEC, ++ TCA_CTINFO_PAD, ++ TCA_CTINFO_TM, ++ TCA_CTINFO_ACT, ++ TCA_CTINFO_ZONE, ++ TCA_CTINFO_PARMS_DSCP_MASK, ++ TCA_CTINFO_PARMS_DSCP_STATEMASK, ++ TCA_CTINFO_PARMS_CPMARK_MASK, ++ TCA_CTINFO_STATS_DSCP_SET, ++ TCA_CTINFO_STATS_DSCP_ERROR, ++ TCA_CTINFO_STATS_CPMARK_SET, ++ __TCA_CTINFO_MAX ++}; ++ ++#define TCA_CTINFO_MAX (__TCA_CTINFO_MAX - 1) ++ ++#endif +--- a/net/sched/Kconfig ++++ b/net/sched/Kconfig +@@ -808,6 +808,19 @@ config NET_ACT_CONNMARK + To compile this code as a module, choose M here: the + module will be called act_connmark. + ++config NET_ACT_CTINFO ++ tristate "Netfilter Connmark to DSCP Retriever" ++ depends on NET_CLS_ACT && NETFILTER && IP_NF_IPTABLES ++ depends on NF_CONNTRACK && NF_CONNTRACK_MARK ++ help ++ Say Y here to allow transfer of a connmark stored DSCP into ++ ipv4/v6 diffserv ++ ++ If unsure, say N. ++ ++ To compile this code as a module, choose M here: the ++ module will be called act_ctinfo. ++ + config NET_ACT_SKBMOD + tristate "skb data modification action" + depends on NET_CLS_ACT +--- a/net/sched/Makefile ++++ b/net/sched/Makefile +@@ -21,6 +21,7 @@ obj-$(CONFIG_NET_ACT_CSUM) += act_csum.o + obj-$(CONFIG_NET_ACT_VLAN) += act_vlan.o + obj-$(CONFIG_NET_ACT_BPF) += act_bpf.o + obj-$(CONFIG_NET_ACT_CONNMARK) += act_connmark.o ++obj-$(CONFIG_NET_ACT_CTINFO) += act_ctinfo.o + obj-$(CONFIG_NET_ACT_SKBMOD) += act_skbmod.o + obj-$(CONFIG_NET_ACT_IFE) += act_ife.o + obj-$(CONFIG_NET_IFE_SKBMARK) += act_meta_mark.o +--- /dev/null ++++ b/net/sched/act_ctinfo.c +@@ -0,0 +1,394 @@ ++// SPDX-License-Identifier: GPL-2.0+ ++/* net/sched/act_ctinfo.c netfilter ctinfo connmark actions ++ * ++ * Copyright (c) 2019 Kevin Darbyshire-Bryant ++ */ ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#include ++#include ++#include ++#include ++ ++static struct tc_action_ops act_ctinfo_ops; ++static unsigned int ctinfo_net_id; ++ ++static void tcf_ctinfo_dscp_set(struct nf_conn *ct, struct tcf_ctinfo *ca, ++ struct tcf_ctinfo_params *cp, ++ struct sk_buff *skb, int wlen, int proto) ++{ ++ u8 dscp,newdscp; ++ ++ newdscp = (((ct->mark & cp->dscpmask) >> cp->dscpmaskshift) << 2) & ++ ~INET_ECN_MASK; ++ ++ /* mark contains DSCP so restore DSCP bits from ct->mark into diffserv */ ++ /* using overlimits stats to count how many DSCP updates */ ++ switch (proto) { ++ case NFPROTO_IPV4: ++ dscp = ipv4_get_dsfield(ip_hdr(skb)) & ~INET_ECN_MASK; ++ if (dscp != newdscp) { ++ if (likely(!skb_try_make_writable(skb, wlen))) { ++ ipv4_change_dsfield(ip_hdr(skb), ++ INET_ECN_MASK, ++ newdscp); ++ ca->stats_dscp_set++; ++ } else { ++ ca->stats_dscp_error++; ++ } ++ } ++ break; ++ case NFPROTO_IPV6: ++ dscp = ipv6_get_dsfield(ipv6_hdr(skb)) & ~INET_ECN_MASK; ++ if (dscp != newdscp) { ++ if (likely(!skb_try_make_writable(skb, wlen))) { ++ ipv6_change_dsfield(ipv6_hdr(skb), ++ INET_ECN_MASK, ++ newdscp); ++ ca->stats_dscp_set++; ++ } else { ++ ca->stats_dscp_error++; ++ } ++ } ++ break; ++ default: ++ break; ++ } ++} ++ ++static void tcf_ctinfo_cpmark_set(struct nf_conn *ct, struct tcf_ctinfo *ca, ++ struct tcf_ctinfo_params *cp, ++ struct sk_buff *skb) ++{ ++ ca->stats_cpmark_set++; ++ skb->mark = ct->mark & cp->cpmarkmask; ++} ++ ++static int tcf_ctinfo_act(struct sk_buff *skb, const struct tc_action *a, ++ struct tcf_result *res) ++{ ++ const struct nf_conntrack_tuple_hash *thash = NULL; ++ struct tcf_ctinfo *ca = to_ctinfo(a); ++ struct nf_conntrack_tuple tuple; ++ struct nf_conntrack_zone zone; ++ enum ip_conntrack_info ctinfo; ++ struct tcf_ctinfo_params *cp; ++ struct nf_conn *ct; ++ int proto, wlen; ++ int action; ++ ++ cp = rcu_dereference_bh(ca->params); ++ ++ tcf_lastuse_update(&ca->tcf_tm); ++ bstats_update(&ca->tcf_bstats, skb); ++ action = READ_ONCE(ca->tcf_action); ++ ++ wlen = skb_network_offset(skb); ++ if (tc_skb_protocol(skb) == htons(ETH_P_IP)) { ++ wlen += sizeof(struct iphdr); ++ if (!pskb_may_pull(skb, wlen)) ++ goto out; ++ ++ proto = NFPROTO_IPV4; ++ } else if (tc_skb_protocol(skb) == htons(ETH_P_IPV6)) { ++ wlen += sizeof(struct ipv6hdr); ++ if (!pskb_may_pull(skb, wlen)) ++ goto out; ++ ++ proto = NFPROTO_IPV6; ++ } else { ++ goto out; ++ } ++ ++ ct = nf_ct_get(skb, &ctinfo); ++ if (!ct) { /* look harder, usually ingress */ ++ if (!nf_ct_get_tuplepr(skb, skb_network_offset(skb), ++ proto, cp->net, &tuple)) ++ goto out; ++ zone.id = cp->zone; ++ zone.dir = NF_CT_DEFAULT_ZONE_DIR; ++ ++ thash = nf_conntrack_find_get(cp->net, &zone, &tuple); ++ if (!thash) ++ goto out; ++ ++ ct = nf_ct_tuplehash_to_ctrack(thash); ++ } ++ ++ if (cp->mode & CTINFO_MODE_DSCP) ++ if (!cp->dscpstatemask || (ct->mark & cp->dscpstatemask)) ++ tcf_ctinfo_dscp_set(ct, ca, cp, skb, wlen, proto); ++ ++ if (cp->mode & CTINFO_MODE_CPMARK) ++ tcf_ctinfo_cpmark_set(ct, ca, cp, skb); ++ ++ if (thash) ++ nf_ct_put(ct); ++out: ++ return action; ++} ++ ++static const struct nla_policy ctinfo_policy[TCA_CTINFO_MAX + 1] = { ++ [TCA_CTINFO_ACT] = { .len = sizeof(struct ++ tc_ctinfo) }, ++ [TCA_CTINFO_ZONE] = { .type = NLA_U16 }, ++ [TCA_CTINFO_PARMS_DSCP_MASK] = { .type = NLA_U32 }, ++ [TCA_CTINFO_PARMS_DSCP_STATEMASK] = { .type = NLA_U32 }, ++ [TCA_CTINFO_PARMS_CPMARK_MASK] = { .type = NLA_U32 }, ++}; ++ ++static int tcf_ctinfo_init(struct net *net, struct nlattr *nla, ++ struct nlattr *est, struct tc_action **a, ++ int ovr, int bind) ++{ ++ struct tc_action_net *tn = net_generic(net, ctinfo_net_id); ++ struct nlattr *tb[TCA_CTINFO_MAX + 1]; ++ struct tcf_ctinfo_params *cp_new; ++/* struct tcf_chain *goto_ch = NULL; */ ++ u32 dscpmask = 0, dscpstatemask; ++ struct tc_ctinfo *actparm; ++ struct tcf_ctinfo *ci; ++ u8 dscpmaskshift; ++ int ret = 0, err; ++ ++ if (!nla) ++ return -EINVAL; ++ ++ err = nla_parse_nested(tb, TCA_CTINFO_MAX, nla, ctinfo_policy, NULL); ++ if (err < 0) ++ return err; ++ ++ if (!tb[TCA_CTINFO_ACT]) ++ return -EINVAL; ++ actparm = nla_data(tb[TCA_CTINFO_ACT]); ++ ++ /* do some basic validation here before dynamically allocating things */ ++ /* that we would otherwise have to clean up. */ ++ if (tb[TCA_CTINFO_PARMS_DSCP_MASK]) { ++ dscpmask = nla_get_u32(tb[TCA_CTINFO_PARMS_DSCP_MASK]); ++ /* need contiguous 6 bit mask */ ++ dscpmaskshift = dscpmask ? __ffs(dscpmask) : 0; ++ if ((~0 & (dscpmask >> dscpmaskshift)) != 0x3f) ++ return -EINVAL; ++ dscpstatemask = tb[TCA_CTINFO_PARMS_DSCP_STATEMASK] ? ++ nla_get_u32(tb[TCA_CTINFO_PARMS_DSCP_STATEMASK]) : 0; ++ /* mask & statemask must not overlap */ ++ if (dscpmask & dscpstatemask) ++ return -EINVAL; ++ } ++ /* done the validation:now to the actual action allocation */ ++ err = tcf_idr_check(tn, actparm->index, a, bind); ++ if (!err) { ++ ret = tcf_idr_create(tn, actparm->index, est, a, ++ &act_ctinfo_ops, bind, false); ++ if (ret) { ++ /* tcf_idr_cleanup(tn, actparm->index); */ ++ return ret; ++ } ++ ret = ACT_P_CREATED; ++ } else if (err > 0) { ++ if (bind) /* don't override defaults */ ++ return 0; ++ if (!ovr) { ++ tcf_idr_release(*a, bind); ++ return -EEXIST; ++ } ++ } else { ++ return err; ++ } ++ ++/* err = tcf_action_check_ctrlact(actparm->action, tp, &goto_ch, extack); ++ if (err < 0) ++ goto release_idr; ++ */ ++ ++ ci = to_ctinfo(*a); ++ ++ cp_new = kzalloc(sizeof(*cp_new), GFP_KERNEL); ++ if (unlikely(!cp_new)) { ++ err = -ENOMEM; ++ goto put_chain; ++ } ++ ++ cp_new->net = net; ++ cp_new->zone = tb[TCA_CTINFO_ZONE] ? ++ nla_get_u16(tb[TCA_CTINFO_ZONE]) : 0; ++ if (dscpmask) { ++ cp_new->dscpmask = dscpmask; ++ cp_new->dscpmaskshift = dscpmaskshift; ++ cp_new->dscpstatemask = dscpstatemask; ++ cp_new->mode |= CTINFO_MODE_DSCP; ++ } ++ ++ if (tb[TCA_CTINFO_PARMS_CPMARK_MASK]) { ++ cp_new->cpmarkmask = nla_get_u32(tb[TCA_CTINFO_PARMS_CPMARK_MASK]); ++ cp_new->mode |= CTINFO_MODE_CPMARK; ++ } ++ ++ spin_lock_bh(&ci->tcf_lock); ++/* goto_ch = tcf_action_set_ctrlact(*a, actparm->action, goto_ch); */ ++ ci->tcf_action = actparm->action; ++ rcu_swap_protected(ci->params, cp_new, ++ lockdep_is_held(&ci->tcf_lock)); ++ spin_unlock_bh(&ci->tcf_lock); ++ ++/* if (goto_ch) ++ tcf_chain_put_by_act(goto_ch); */ ++ if (cp_new) ++ kfree_rcu(cp_new, rcu); ++ ++ if (ret == ACT_P_CREATED) ++ tcf_idr_insert(tn, *a); ++ ++ return ret; ++ ++put_chain: ++/* if (goto_ch) ++ tcf_chain_put_by_act(goto_ch); */ ++/*release_idr:*/ ++ tcf_idr_release(*a, bind); ++ return err; ++} ++ ++static int tcf_ctinfo_dump(struct sk_buff *skb, struct tc_action *a, ++ int bind, int ref) ++{ ++ struct tcf_ctinfo *ci = to_ctinfo(a); ++ struct tc_ctinfo opt = { ++ .index = ci->tcf_index, ++ .refcnt = ci->tcf_refcnt - ref, ++ .bindcnt = ci->tcf_bindcnt - bind, ++ }; ++ unsigned char *b = skb_tail_pointer(skb); ++ struct tcf_ctinfo_params *cp; ++ struct tcf_t t; ++ ++ spin_lock_bh(&ci->tcf_lock); ++ cp = rcu_dereference_protected(ci->params, ++ lockdep_is_held(&ci->tcf_lock)); ++ ++ tcf_tm_dump(&t, &ci->tcf_tm); ++ if (nla_put_64bit(skb, TCA_CTINFO_TM, sizeof(t), &t, TCA_CTINFO_PAD)) ++ goto nla_put_failure; ++ ++ opt.action = ci->tcf_action; ++ if (nla_put(skb, TCA_CTINFO_ACT, sizeof(opt), &opt)) ++ goto nla_put_failure; ++ ++ if (nla_put_u16(skb, TCA_CTINFO_ZONE, cp->zone)) ++ goto nla_put_failure; ++ ++ if (cp->mode & CTINFO_MODE_DSCP) { ++ if (nla_put_u32(skb, TCA_CTINFO_PARMS_DSCP_MASK, ++ cp->dscpmask)) ++ goto nla_put_failure; ++ if (nla_put_u32(skb, TCA_CTINFO_PARMS_DSCP_STATEMASK, ++ cp->dscpstatemask)) ++ goto nla_put_failure; ++ } ++ ++ if (cp->mode & CTINFO_MODE_CPMARK) { ++ if (nla_put_u32(skb, TCA_CTINFO_PARMS_CPMARK_MASK, ++ cp->cpmarkmask)) ++ goto nla_put_failure; ++ } ++ ++ if (nla_put_u64_64bit(skb, TCA_CTINFO_STATS_DSCP_SET, ++ ci->stats_dscp_set, TCA_CTINFO_PAD)) ++ goto nla_put_failure; ++ ++ if (nla_put_u64_64bit(skb, TCA_CTINFO_STATS_DSCP_ERROR, ++ ci->stats_dscp_error, TCA_CTINFO_PAD)) ++ goto nla_put_failure; ++ ++ if (nla_put_u64_64bit(skb, TCA_CTINFO_STATS_CPMARK_SET, ++ ci->stats_cpmark_set, TCA_CTINFO_PAD)) ++ goto nla_put_failure; ++ ++ spin_unlock_bh(&ci->tcf_lock); ++ return skb->len; ++ ++nla_put_failure: ++ spin_unlock_bh(&ci->tcf_lock); ++ nlmsg_trim(skb, b); ++ return -1; ++} ++ ++static int tcf_ctinfo_walker(struct net *net, struct sk_buff *skb, ++ struct netlink_callback *cb, int type, ++ const struct tc_action_ops *ops) ++{ ++ struct tc_action_net *tn = net_generic(net, ctinfo_net_id); ++ ++ return tcf_generic_walker(tn, skb, cb, type, ops); ++} ++ ++static int tcf_ctinfo_search(struct net *net, struct tc_action **a, u32 index) ++{ ++ struct tc_action_net *tn = net_generic(net, ctinfo_net_id); ++ ++ return tcf_idr_search(tn, a, index); ++} ++ ++static struct tc_action_ops act_ctinfo_ops = { ++ .kind = "ctinfo", ++ .type = TCA_ID_CTINFO, ++ .owner = THIS_MODULE, ++ .act = tcf_ctinfo_act, ++ .dump = tcf_ctinfo_dump, ++ .init = tcf_ctinfo_init, ++ .walk = tcf_ctinfo_walker, ++ .lookup = tcf_ctinfo_search, ++ .size = sizeof(struct tcf_ctinfo), ++}; ++ ++static __net_init int ctinfo_init_net(struct net *net) ++{ ++ struct tc_action_net *tn = net_generic(net, ctinfo_net_id); ++ ++ return tc_action_net_init(tn, &act_ctinfo_ops); ++} ++ ++static void __net_exit ctinfo_exit_net(struct net *net) ++{ ++ struct tc_action_net *tn = net_generic(net, ctinfo_net_id); ++ ++ tc_action_net_exit(tn); ++} ++ ++static struct pernet_operations ctinfo_net_ops = { ++ .init = ctinfo_init_net, ++ .exit = ctinfo_exit_net, ++ .id = &ctinfo_net_id, ++ .size = sizeof(struct tc_action_net), ++}; ++ ++static int __init ctinfo_init_module(void) ++{ ++ return tcf_register_action(&act_ctinfo_ops, &ctinfo_net_ops); ++} ++ ++static void __exit ctinfo_cleanup_module(void) ++{ ++ tcf_unregister_action(&act_ctinfo_ops, &ctinfo_net_ops); ++} ++ ++module_init(ctinfo_init_module); ++module_exit(ctinfo_cleanup_module); ++MODULE_AUTHOR("Kevin Darbyshire-Bryant "); ++MODULE_DESCRIPTION("Conntrack mark to DSCP restoring"); ++MODULE_LICENSE("GPL"); diff --git a/target/linux/generic/backport-4.14/401-v5.2-leds-trigger-netdev-fix-refcnt-leak-on-interface-ren.patch b/target/linux/generic/backport-4.14/401-v5.2-leds-trigger-netdev-fix-refcnt-leak-on-interface-ren.patch new file mode 100644 index 0000000000..32682627fc --- /dev/null +++ b/target/linux/generic/backport-4.14/401-v5.2-leds-trigger-netdev-fix-refcnt-leak-on-interface-ren.patch @@ -0,0 +1,69 @@ +From dd7590a3ab3f0804ed5e930295e2caa5979e3958 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= +Date: Thu, 28 Feb 2019 22:57:33 +0100 +Subject: [PATCH] leds: trigger: netdev: fix refcnt leak on interface rename +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Renaming a netdev-trigger-tracked interface was resulting in an +unbalanced dev_hold(). + +Example: +> iw phy phy0 interface add foo type __ap +> echo netdev > trigger +> echo foo > device_name +> ip link set foo name bar +> iw dev bar del +[ 237.355366] unregister_netdevice: waiting for bar to become free. Usage count = 1 +[ 247.435362] unregister_netdevice: waiting for bar to become free. Usage count = 1 +[ 257.545366] unregister_netdevice: waiting for bar to become free. Usage count = 1 + +Above problem was caused by trigger checking a dev->name which obviously +changes after renaming an interface. It meant missing all further events +including the NETDEV_UNREGISTER which is required for calling dev_put(). + +This change fixes that by: +1) Comparing device struct *address* for notification-filtering purposes +2) Dropping unneeded NETDEV_CHANGENAME code (no behavior change) + +Fixes: 06f502f57d0d ("leds: trigger: Introduce a NETDEV trigger") +Signed-off-by: Rafał Miłecki +Acked-by: Pavel Machek +Signed-off-by: Jacek Anaszewski +--- + drivers/leds/trigger/ledtrig-netdev.c | 13 +++++-------- + 1 file changed, 5 insertions(+), 8 deletions(-) + +--- a/drivers/leds/trigger/ledtrig-netdev.c ++++ b/drivers/leds/trigger/ledtrig-netdev.c +@@ -299,11 +299,11 @@ static int netdev_trig_notify(struct not + notifier); + + if (evt != NETDEV_UP && evt != NETDEV_DOWN && evt != NETDEV_CHANGE +- && evt != NETDEV_REGISTER && evt != NETDEV_UNREGISTER +- && evt != NETDEV_CHANGENAME) ++ && evt != NETDEV_REGISTER && evt != NETDEV_UNREGISTER) + return NOTIFY_DONE; + +- if (strcmp(dev->name, trigger_data->device_name)) ++ if (!(dev == trigger_data->net_dev || ++ (evt == NETDEV_REGISTER && !strcmp(dev->name, trigger_data->device_name)))) + return NOTIFY_DONE; + + cancel_delayed_work_sync(&trigger_data->work); +@@ -318,12 +318,9 @@ static int netdev_trig_notify(struct not + dev_hold(dev); + trigger_data->net_dev = dev; + break; +- case NETDEV_CHANGENAME: + case NETDEV_UNREGISTER: +- if (trigger_data->net_dev) { +- dev_put(trigger_data->net_dev); +- trigger_data->net_dev = NULL; +- } ++ dev_put(trigger_data->net_dev); ++ trigger_data->net_dev = NULL; + break; + case NETDEV_UP: + case NETDEV_CHANGE: diff --git a/target/linux/generic/pending-4.14/551-ubifs-fix-default-compression-selection.patch b/target/linux/generic/backport-4.14/500-v4.20-ubifs-Fix-default-compression-selection-in-ubifs.patch similarity index 100% rename from target/linux/generic/pending-4.14/551-ubifs-fix-default-compression-selection.patch rename to target/linux/generic/backport-4.14/500-v4.20-ubifs-Fix-default-compression-selection-in-ubifs.patch diff --git a/target/linux/generic/backport-4.14/900-v4.18-firmware-dmi-Add-access-to-the-SKU-ID-string.patch b/target/linux/generic/backport-4.14/900-v4.18-firmware-dmi-Add-access-to-the-SKU-ID-string.patch new file mode 100644 index 0000000000..9c80b47607 --- /dev/null +++ b/target/linux/generic/backport-4.14/900-v4.18-firmware-dmi-Add-access-to-the-SKU-ID-string.patch @@ -0,0 +1,57 @@ +From b23908d3c48a37c46c6a26df2cdeab1610b360ba Mon Sep 17 00:00:00 2001 +From: Simon Glass +Date: Sun, 17 Jun 2018 14:09:42 +0200 +Subject: [PATCH] firmware: dmi: Add access to the SKU ID string + +This is used in some systems from user space for determining the identity +of the device. + +Expose this as a file so that that user-space tools don't need to read +from /sys/firmware/dmi/tables/DMI + +Signed-off-by: Simon Glass +Signed-off-by: Jean Delvare +--- + drivers/firmware/dmi-id.c | 2 ++ + drivers/firmware/dmi_scan.c | 1 + + include/linux/mod_devicetable.h | 1 + + 3 files changed, 4 insertions(+) + +--- a/drivers/firmware/dmi-id.c ++++ b/drivers/firmware/dmi-id.c +@@ -47,6 +47,7 @@ DEFINE_DMI_ATTR_WITH_SHOW(product_name, + DEFINE_DMI_ATTR_WITH_SHOW(product_version, 0444, DMI_PRODUCT_VERSION); + DEFINE_DMI_ATTR_WITH_SHOW(product_serial, 0400, DMI_PRODUCT_SERIAL); + DEFINE_DMI_ATTR_WITH_SHOW(product_uuid, 0400, DMI_PRODUCT_UUID); ++DEFINE_DMI_ATTR_WITH_SHOW(product_sku, 0444, DMI_PRODUCT_SKU); + DEFINE_DMI_ATTR_WITH_SHOW(product_family, 0444, DMI_PRODUCT_FAMILY); + DEFINE_DMI_ATTR_WITH_SHOW(board_vendor, 0444, DMI_BOARD_VENDOR); + DEFINE_DMI_ATTR_WITH_SHOW(board_name, 0444, DMI_BOARD_NAME); +@@ -193,6 +194,7 @@ static void __init dmi_id_init_attr_tabl + ADD_DMI_ATTR(product_serial, DMI_PRODUCT_SERIAL); + ADD_DMI_ATTR(product_uuid, DMI_PRODUCT_UUID); + ADD_DMI_ATTR(product_family, DMI_PRODUCT_FAMILY); ++ ADD_DMI_ATTR(product_sku, DMI_PRODUCT_SKU); + ADD_DMI_ATTR(board_vendor, DMI_BOARD_VENDOR); + ADD_DMI_ATTR(board_name, DMI_BOARD_NAME); + ADD_DMI_ATTR(board_version, DMI_BOARD_VERSION); +--- a/drivers/firmware/dmi_scan.c ++++ b/drivers/firmware/dmi_scan.c +@@ -435,6 +435,7 @@ static void __init dmi_decode(const stru + dmi_save_ident(dm, DMI_PRODUCT_VERSION, 6); + dmi_save_ident(dm, DMI_PRODUCT_SERIAL, 7); + dmi_save_uuid(dm, DMI_PRODUCT_UUID, 8); ++ dmi_save_ident(dm, DMI_PRODUCT_SKU, 25); + dmi_save_ident(dm, DMI_PRODUCT_FAMILY, 26); + break; + case 2: /* Base Board Information */ +--- a/include/linux/mod_devicetable.h ++++ b/include/linux/mod_devicetable.h +@@ -471,6 +471,7 @@ enum dmi_field { + DMI_PRODUCT_VERSION, + DMI_PRODUCT_SERIAL, + DMI_PRODUCT_UUID, ++ DMI_PRODUCT_SKU, + DMI_PRODUCT_FAMILY, + DMI_BOARD_VENDOR, + DMI_BOARD_NAME, diff --git a/target/linux/generic/backport-4.14/950-tty-serial-exar-generalize-rs485-setup.patch b/target/linux/generic/backport-4.14/950-tty-serial-exar-generalize-rs485-setup.patch new file mode 100644 index 0000000000..42c4705e51 --- /dev/null +++ b/target/linux/generic/backport-4.14/950-tty-serial-exar-generalize-rs485-setup.patch @@ -0,0 +1,75 @@ +From 9d9398944488cd3a3e1e0912b26fbc4d5921e547 Mon Sep 17 00:00:00 2001 +From: Daniel Golle +Date: Mon, 4 Jun 2018 23:33:07 +0200 +Subject: [PATCH] tty: serial: exar: generalize RS485 setup + +Move the non-board-specific part of the RS485 initialization from +iot2040_rs485_config function to a new generic function used also for +other boards. +This allows using TIOCGRS485 and TIOCSRS485 on boards (such as mPCIe +serial IO modules) which are hard-wired to RS485 or have jumpers for +their configurations. + +Signed-off-by: Daniel Golle +Reviewed-by: Jan Kiszka +Signed-off-by: Greg Kroah-Hartman +--- + drivers/tty/serial/8250/8250_exar.c | 38 +++++++++++++++++++---------- + 1 file changed, 25 insertions(+), 13 deletions(-) + +--- a/drivers/tty/serial/8250/8250_exar.c ++++ b/drivers/tty/serial/8250/8250_exar.c +@@ -275,8 +275,32 @@ static int xr17v35x_register_gpio(struct + return 0; + } + ++static int generic_rs485_config(struct uart_port *port, ++ struct serial_rs485 *rs485) ++{ ++ bool is_rs485 = !!(rs485->flags & SER_RS485_ENABLED); ++ u8 __iomem *p = port->membase; ++ u8 value; ++ ++ value = readb(p + UART_EXAR_FCTR); ++ if (is_rs485) ++ value |= UART_FCTR_EXAR_485; ++ else ++ value &= ~UART_FCTR_EXAR_485; ++ ++ writeb(value, p + UART_EXAR_FCTR); ++ ++ if (is_rs485) ++ writeb(UART_EXAR_RS485_DLY(4), p + UART_MSR); ++ ++ port->rs485 = *rs485; ++ ++ return 0; ++} ++ + static const struct exar8250_platform exar8250_default_platform = { + .register_gpio = xr17v35x_register_gpio, ++ .rs485_config = generic_rs485_config, + }; + + static int iot2040_rs485_config(struct uart_port *port, +@@ -309,19 +333,7 @@ static int iot2040_rs485_config(struct u + value |= mode; + writeb(value, p + UART_EXAR_MPIOLVL_7_0); + +- value = readb(p + UART_EXAR_FCTR); +- if (is_rs485) +- value |= UART_FCTR_EXAR_485; +- else +- value &= ~UART_FCTR_EXAR_485; +- writeb(value, p + UART_EXAR_FCTR); +- +- if (is_rs485) +- writeb(UART_EXAR_RS485_DLY(4), p + UART_MSR); +- +- port->rs485 = *rs485; +- +- return 0; ++ return generic_rs485_config(port, rs485); + } + + static const struct property_entry iot2040_gpio_properties[] = { diff --git a/target/linux/generic/backport-4.19/010-Kbuild-don-t-hardcode-path-to-awk-in-scripts-ld-vers.patch b/target/linux/generic/backport-4.19/010-Kbuild-don-t-hardcode-path-to-awk-in-scripts-ld-vers.patch deleted file mode 100644 index 7ac4f9d240..0000000000 --- a/target/linux/generic/backport-4.19/010-Kbuild-don-t-hardcode-path-to-awk-in-scripts-ld-vers.patch +++ /dev/null @@ -1,30 +0,0 @@ -From 13b1ecc3401653a355798eb1dee10cc1608202f4 Mon Sep 17 00:00:00 2001 -From: Felix Fietkau -Date: Mon, 18 Jan 2016 12:27:49 +0100 -Subject: [PATCH 33/34] Kbuild: don't hardcode path to awk in - scripts/ld-version.sh - -On some systems /usr/bin/awk does not exist, or is broken. Find it via -$PATH instead. - -Signed-off-by: Felix Fietkau ---- - scripts/ld-version.sh | 4 +++- - 1 file changed, 3 insertions(+), 1 deletion(-) - ---- a/scripts/ld-version.sh -+++ b/scripts/ld-version.sh -@@ -1,6 +1,7 @@ --#!/usr/bin/awk -f -+#!/bin/sh - # SPDX-License-Identifier: GPL-2.0 - # extract linker version number from stdin and turn into single number -+exec awk ' - { - gsub(".*\\)", ""); - gsub(".*version ", ""); -@@ -9,3 +10,4 @@ - print a[1]*100000000 + a[2]*1000000 + a[3]*10000; - exit - } -+' diff --git a/target/linux/generic/backport-4.19/011-kbuild-export-SUBARCH.patch b/target/linux/generic/backport-4.19/011-kbuild-export-SUBARCH.patch deleted file mode 100644 index b5f654906a..0000000000 --- a/target/linux/generic/backport-4.19/011-kbuild-export-SUBARCH.patch +++ /dev/null @@ -1,23 +0,0 @@ -From 173019b66dcc9d68ad9333aa744dad1e369b5aa8 Mon Sep 17 00:00:00 2001 -From: Felix Fietkau -Date: Sun, 9 Jul 2017 00:26:53 +0200 -Subject: [PATCH 34/34] kernel: add compile fix for linux 4.9 on x86 - -Signed-off-by: Felix Fietkau ---- - Makefile | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - ---- a/Makefile -+++ b/Makefile -@@ -431,8 +431,8 @@ KBUILD_LDFLAGS_MODULE := -T $(srctree)/s - KBUILD_LDFLAGS := - GCC_PLUGINS_CFLAGS := - --export ARCH SRCARCH CONFIG_SHELL HOSTCC KBUILD_HOSTCFLAGS CROSS_COMPILE AS LD CC --export CPP AR NM STRIP OBJCOPY OBJDUMP KBUILD_HOSTLDFLAGS KBUILD_HOSTLDLIBS -+export ARCH SRCARCH SUBARCH CONFIG_SHELL HOSTCC KBUILD_HOSTCFLAGS CROSS_COMPILE AS LD -+export CC CPP AR NM STRIP OBJCOPY OBJDUMP KBUILD_HOSTLDFLAGS KBUILD_HOSTLDLIBS - export MAKE LEX YACC AWK GENKSYMS INSTALLKERNEL PERL PYTHON PYTHON2 PYTHON3 UTS_MACHINE - export HOSTCXX KBUILD_HOSTCXXFLAGS LDFLAGS_MODULE CHECK CHECKFLAGS - diff --git a/target/linux/generic/backport-4.19/020-backport_netfilter_rtcache.patch b/target/linux/generic/backport-4.19/020-backport_netfilter_rtcache.patch deleted file mode 100644 index 32b43082be..0000000000 --- a/target/linux/generic/backport-4.19/020-backport_netfilter_rtcache.patch +++ /dev/null @@ -1,558 +0,0 @@ -From 1bb0c3ec899827cfa4668bb63a08713a40744d21 Mon Sep 17 00:00:00 2001 -From: Florian Westphal -Date: Sun, 9 Jul 2017 08:58:30 +0200 -Subject: [PATCH] netfilter: conntrack: cache route for forwarded connections - -... to avoid per-packet FIB lookup if possible. - -The cached dst is re-used provided the input interface -is the same as that of the previous packet in the same direction. - -If not, the cached dst is invalidated. - -For ipv6 we also need to store sernum, else dst_check doesn't work, -pointed out by Eric Dumazet. - -This should speed up forwarding when conntrack is already in use -anyway, especially when using reverse path filtering -- active RPF -enforces two FIB lookups for each packet. - -Before the routing cache removal this didn't matter since RPF was performed -only when route cache didn't yield a result; but without route cache it -comes at higher price. - -Julian Anastasov suggested to add NETDEV_UNREGISTER handler to -avoid holding on to dsts of 'frozen' conntracks. - -Signed-off-by: Florian Westphal ---- - include/net/netfilter/nf_conntrack_extend.h | 4 + - include/net/netfilter/nf_conntrack_rtcache.h | 34 +++ - net/netfilter/Kconfig | 12 + - net/netfilter/Makefile | 3 + - net/netfilter/nf_conntrack_rtcache.c | 428 +++++++++++++++++++++++++++ - 5 files changed, 481 insertions(+) - create mode 100644 include/net/netfilter/nf_conntrack_rtcache.h - create mode 100644 net/netfilter/nf_conntrack_rtcache.c - ---- a/include/net/netfilter/nf_conntrack_extend.h -+++ b/include/net/netfilter/nf_conntrack_extend.h -@@ -28,6 +28,9 @@ enum nf_ct_ext_id { - #if IS_ENABLED(CONFIG_NETFILTER_SYNPROXY) - NF_CT_EXT_SYNPROXY, - #endif -+#if IS_ENABLED(CONFIG_NF_CONNTRACK_RTCACHE) -+ NF_CT_EXT_RTCACHE, -+#endif - NF_CT_EXT_NUM, - }; - -@@ -40,6 +43,7 @@ enum nf_ct_ext_id { - #define NF_CT_EXT_TIMEOUT_TYPE struct nf_conn_timeout - #define NF_CT_EXT_LABELS_TYPE struct nf_conn_labels - #define NF_CT_EXT_SYNPROXY_TYPE struct nf_conn_synproxy -+#define NF_CT_EXT_RTCACHE_TYPE struct nf_conn_rtcache - - /* Extensions: optional stuff which isn't permanently in struct. */ - struct nf_ct_ext { ---- /dev/null -+++ b/include/net/netfilter/nf_conntrack_rtcache.h -@@ -0,0 +1,34 @@ -+#include -+#include -+#include -+ -+struct dst_entry; -+ -+struct nf_conn_dst_cache { -+ struct dst_entry *dst; -+ int iif; -+#if IS_ENABLED(CONFIG_NF_CONNTRACK_IPV6) -+ u32 cookie; -+#endif -+ -+}; -+ -+struct nf_conn_rtcache { -+ struct nf_conn_dst_cache cached_dst[IP_CT_DIR_MAX]; -+}; -+ -+static inline -+struct nf_conn_rtcache *nf_ct_rtcache_find(const struct nf_conn *ct) -+{ -+#if IS_ENABLED(CONFIG_NF_CONNTRACK_RTCACHE) -+ return nf_ct_ext_find(ct, NF_CT_EXT_RTCACHE); -+#else -+ return NULL; -+#endif -+} -+ -+static inline int nf_conn_rtcache_iif_get(const struct nf_conn_rtcache *rtc, -+ enum ip_conntrack_dir dir) -+{ -+ return rtc->cached_dst[dir].iif; -+} ---- a/net/netfilter/Kconfig -+++ b/net/netfilter/Kconfig -@@ -135,6 +135,18 @@ config NF_CONNTRACK_EVENTS - - If unsure, say `N'. - -+config NF_CONNTRACK_RTCACHE -+ tristate "Cache route entries in conntrack objects" -+ depends on NETFILTER_ADVANCED -+ depends on NF_CONNTRACK -+ help -+ If this option is enabled, the connection tracking code will -+ cache routing information for each connection that is being -+ forwarded, at a cost of 32 bytes per conntrack object. -+ -+ To compile it as a module, choose M here. If unsure, say N. -+ The module will be called nf_conntrack_rtcache. -+ - config NF_CONNTRACK_TIMEOUT - bool 'Connection tracking timeout' - depends on NETFILTER_ADVANCED ---- a/net/netfilter/Makefile -+++ b/net/netfilter/Makefile -@@ -25,6 +25,9 @@ obj-$(CONFIG_NETFILTER_NETLINK_OSF) += n - # connection tracking - obj-$(CONFIG_NF_CONNTRACK) += nf_conntrack.o - -+# optional conntrack route cache extension -+obj-$(CONFIG_NF_CONNTRACK_RTCACHE) += nf_conntrack_rtcache.o -+ - obj-$(CONFIG_NF_CT_PROTO_GRE) += nf_conntrack_proto_gre.o - - # netlink interface for nf_conntrack ---- /dev/null -+++ b/net/netfilter/nf_conntrack_rtcache.c -@@ -0,0 +1,428 @@ -+/* route cache for netfilter. -+ * -+ * (C) 2014 Red Hat GmbH -+ * -+ * 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 -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+#include -+ -+#include -+#include -+#include -+#include -+ -+#if IS_ENABLED(CONFIG_NF_CONNTRACK_IPV6) -+#include -+#endif -+ -+static void __nf_conn_rtcache_destroy(struct nf_conn_rtcache *rtc, -+ enum ip_conntrack_dir dir) -+{ -+ struct dst_entry *dst = rtc->cached_dst[dir].dst; -+ -+ dst_release(dst); -+} -+ -+static void nf_conn_rtcache_destroy(struct nf_conn *ct) -+{ -+ struct nf_conn_rtcache *rtc = nf_ct_rtcache_find(ct); -+ -+ if (!rtc) -+ return; -+ -+ __nf_conn_rtcache_destroy(rtc, IP_CT_DIR_ORIGINAL); -+ __nf_conn_rtcache_destroy(rtc, IP_CT_DIR_REPLY); -+} -+ -+static void nf_ct_rtcache_ext_add(struct nf_conn *ct) -+{ -+ struct nf_conn_rtcache *rtc; -+ -+ rtc = nf_ct_ext_add(ct, NF_CT_EXT_RTCACHE, GFP_ATOMIC); -+ if (rtc) { -+ rtc->cached_dst[IP_CT_DIR_ORIGINAL].iif = -1; -+ rtc->cached_dst[IP_CT_DIR_ORIGINAL].dst = NULL; -+ rtc->cached_dst[IP_CT_DIR_REPLY].iif = -1; -+ rtc->cached_dst[IP_CT_DIR_REPLY].dst = NULL; -+ } -+} -+ -+static struct nf_conn_rtcache *nf_ct_rtcache_find_usable(struct nf_conn *ct) -+{ -+ return nf_ct_rtcache_find(ct); -+} -+ -+static struct dst_entry * -+nf_conn_rtcache_dst_get(const struct nf_conn_rtcache *rtc, -+ enum ip_conntrack_dir dir) -+{ -+ return rtc->cached_dst[dir].dst; -+} -+ -+static u32 nf_rtcache_get_cookie(int pf, const struct dst_entry *dst) -+{ -+#if IS_ENABLED(CONFIG_NF_CONNTRACK_IPV6) -+ if (pf == NFPROTO_IPV6) { -+ const struct rt6_info *rt = (const struct rt6_info *)dst; -+ -+ if (rt->rt6i_node) -+ return (u32)rt->rt6i_node->fn_sernum; -+ } -+#endif -+ return 0; -+} -+ -+static void nf_conn_rtcache_dst_set(int pf, -+ struct nf_conn_rtcache *rtc, -+ struct dst_entry *dst, -+ enum ip_conntrack_dir dir, int iif) -+{ -+ if (rtc->cached_dst[dir].iif != iif) -+ rtc->cached_dst[dir].iif = iif; -+ -+ if (rtc->cached_dst[dir].dst != dst) { -+ struct dst_entry *old; -+ -+ dst_hold(dst); -+ -+ old = xchg(&rtc->cached_dst[dir].dst, dst); -+ dst_release(old); -+ -+#if IS_ENABLED(CONFIG_NF_CONNTRACK_IPV6) -+ if (pf == NFPROTO_IPV6) -+ rtc->cached_dst[dir].cookie = -+ nf_rtcache_get_cookie(pf, dst); -+#endif -+ } -+} -+ -+static void nf_conn_rtcache_dst_obsolete(struct nf_conn_rtcache *rtc, -+ enum ip_conntrack_dir dir) -+{ -+ struct dst_entry *old; -+ -+ pr_debug("Invalidate iif %d for dir %d on cache %p\n", -+ rtc->cached_dst[dir].iif, dir, rtc); -+ -+ old = xchg(&rtc->cached_dst[dir].dst, NULL); -+ dst_release(old); -+ rtc->cached_dst[dir].iif = -1; -+} -+ -+static unsigned int nf_rtcache_in(u_int8_t pf, -+ struct sk_buff *skb, -+ const struct nf_hook_state *state) -+{ -+ struct nf_conn_rtcache *rtc; -+ enum ip_conntrack_info ctinfo; -+ enum ip_conntrack_dir dir; -+ struct dst_entry *dst; -+ struct nf_conn *ct; -+ int iif; -+ u32 cookie; -+ -+ if (skb_dst(skb) || skb->sk) -+ return NF_ACCEPT; -+ -+ ct = nf_ct_get(skb, &ctinfo); -+ if (!ct) -+ return NF_ACCEPT; -+ -+ rtc = nf_ct_rtcache_find_usable(ct); -+ if (!rtc) -+ return NF_ACCEPT; -+ -+ /* if iif changes, don't use cache and let ip stack -+ * do route lookup. -+ * -+ * If rp_filter is enabled it might toss skb, so -+ * we don't want to avoid these checks. -+ */ -+ dir = CTINFO2DIR(ctinfo); -+ iif = nf_conn_rtcache_iif_get(rtc, dir); -+ if (state->in->ifindex != iif) { -+ pr_debug("ct %p, iif %d, cached iif %d, skip cached entry\n", -+ ct, iif, state->in->ifindex); -+ return NF_ACCEPT; -+ } -+ dst = nf_conn_rtcache_dst_get(rtc, dir); -+ if (dst == NULL) -+ return NF_ACCEPT; -+ -+ cookie = nf_rtcache_get_cookie(pf, dst); -+ -+ dst = dst_check(dst, cookie); -+ pr_debug("obtained dst %p for skb %p, cookie %d\n", dst, skb, cookie); -+ if (likely(dst)) -+ skb_dst_set_noref(skb, dst); -+ else -+ nf_conn_rtcache_dst_obsolete(rtc, dir); -+ -+ return NF_ACCEPT; -+} -+ -+static unsigned int nf_rtcache_forward(u_int8_t pf, -+ struct sk_buff *skb, -+ const struct nf_hook_state *state) -+{ -+ struct nf_conn_rtcache *rtc; -+ enum ip_conntrack_info ctinfo; -+ enum ip_conntrack_dir dir; -+ struct nf_conn *ct; -+ struct dst_entry *dst = skb_dst(skb); -+ int iif; -+ -+ ct = nf_ct_get(skb, &ctinfo); -+ if (!ct) -+ return NF_ACCEPT; -+ -+ if (dst && dst_xfrm(dst)) -+ return NF_ACCEPT; -+ -+ if (!nf_ct_is_confirmed(ct)) { -+ if (WARN_ON(nf_ct_rtcache_find(ct))) -+ return NF_ACCEPT; -+ nf_ct_rtcache_ext_add(ct); -+ return NF_ACCEPT; -+ } -+ -+ rtc = nf_ct_rtcache_find_usable(ct); -+ if (!rtc) -+ return NF_ACCEPT; -+ -+ dir = CTINFO2DIR(ctinfo); -+ iif = nf_conn_rtcache_iif_get(rtc, dir); -+ pr_debug("ct %p, skb %p, dir %d, iif %d, cached iif %d\n", -+ ct, skb, dir, iif, state->in->ifindex); -+ if (likely(state->in->ifindex == iif)) -+ return NF_ACCEPT; -+ -+ nf_conn_rtcache_dst_set(pf, rtc, skb_dst(skb), dir, state->in->ifindex); -+ return NF_ACCEPT; -+} -+ -+static unsigned int nf_rtcache_in4(void *priv, -+ struct sk_buff *skb, -+ const struct nf_hook_state *state) -+{ -+ return nf_rtcache_in(NFPROTO_IPV4, skb, state); -+} -+ -+static unsigned int nf_rtcache_forward4(void *priv, -+ struct sk_buff *skb, -+ const struct nf_hook_state *state) -+{ -+ return nf_rtcache_forward(NFPROTO_IPV4, skb, state); -+} -+ -+#if IS_ENABLED(CONFIG_NF_CONNTRACK_IPV6) -+static unsigned int nf_rtcache_in6(void *priv, -+ struct sk_buff *skb, -+ const struct nf_hook_state *state) -+{ -+ return nf_rtcache_in(NFPROTO_IPV6, skb, state); -+} -+ -+static unsigned int nf_rtcache_forward6(void *priv, -+ struct sk_buff *skb, -+ const struct nf_hook_state *state) -+{ -+ return nf_rtcache_forward(NFPROTO_IPV6, skb, state); -+} -+#endif -+ -+static int nf_rtcache_dst_remove(struct nf_conn *ct, void *data) -+{ -+ struct nf_conn_rtcache *rtc = nf_ct_rtcache_find(ct); -+ struct net_device *dev = data; -+ -+ if (!rtc) -+ return 0; -+ -+ if (dev->ifindex == rtc->cached_dst[IP_CT_DIR_ORIGINAL].iif || -+ dev->ifindex == rtc->cached_dst[IP_CT_DIR_REPLY].iif) { -+ nf_conn_rtcache_dst_obsolete(rtc, IP_CT_DIR_ORIGINAL); -+ nf_conn_rtcache_dst_obsolete(rtc, IP_CT_DIR_REPLY); -+ } -+ -+ return 0; -+} -+ -+static int nf_rtcache_netdev_event(struct notifier_block *this, -+ unsigned long event, void *ptr) -+{ -+ struct net_device *dev = netdev_notifier_info_to_dev(ptr); -+ struct net *net = dev_net(dev); -+ -+ if (event == NETDEV_DOWN) -+ nf_ct_iterate_cleanup_net(net, nf_rtcache_dst_remove, dev, 0, 0); -+ -+ return NOTIFY_DONE; -+} -+ -+static struct notifier_block nf_rtcache_notifier = { -+ .notifier_call = nf_rtcache_netdev_event, -+}; -+ -+static struct nf_hook_ops rtcache_ops[] = { -+ { -+ .hook = nf_rtcache_in4, -+ .pf = NFPROTO_IPV4, -+ .hooknum = NF_INET_PRE_ROUTING, -+ .priority = NF_IP_PRI_LAST, -+ }, -+ { -+ .hook = nf_rtcache_forward4, -+ .pf = NFPROTO_IPV4, -+ .hooknum = NF_INET_FORWARD, -+ .priority = NF_IP_PRI_LAST, -+ }, -+#if IS_ENABLED(CONFIG_NF_CONNTRACK_IPV6) -+ { -+ .hook = nf_rtcache_in6, -+ .pf = NFPROTO_IPV6, -+ .hooknum = NF_INET_PRE_ROUTING, -+ .priority = NF_IP_PRI_LAST, -+ }, -+ { -+ .hook = nf_rtcache_forward6, -+ .pf = NFPROTO_IPV6, -+ .hooknum = NF_INET_FORWARD, -+ .priority = NF_IP_PRI_LAST, -+ }, -+#endif -+}; -+ -+static struct nf_ct_ext_type rtcache_extend __read_mostly = { -+ .len = sizeof(struct nf_conn_rtcache), -+ .align = __alignof__(struct nf_conn_rtcache), -+ .id = NF_CT_EXT_RTCACHE, -+ .destroy = nf_conn_rtcache_destroy, -+}; -+ -+static void __net_exit rtcache_net_exit(struct net *net) -+{ -+ /* remove hooks so no new connections get rtcache extension */ -+ nf_unregister_net_hooks(net, rtcache_ops, ARRAY_SIZE(rtcache_ops)); -+} -+ -+static struct pernet_operations rtcache_ops_net_ops = { -+ .exit = rtcache_net_exit, -+}; -+ -+static int __init nf_conntrack_rtcache_init(void) -+{ -+ int ret = nf_ct_extend_register(&rtcache_extend); -+ -+ if (ret < 0) { -+ pr_err("nf_conntrack_rtcache: Unable to register extension\n"); -+ return ret; -+ } -+ -+ ret = register_pernet_subsys(&rtcache_ops_net_ops); -+ if (ret) { -+ nf_ct_extend_unregister(&rtcache_extend); -+ return ret; -+ } -+ -+ ret = nf_register_net_hooks(&init_net, rtcache_ops, -+ ARRAY_SIZE(rtcache_ops)); -+ if (ret < 0) { -+ nf_ct_extend_unregister(&rtcache_extend); -+ unregister_pernet_subsys(&rtcache_ops_net_ops); -+ return ret; -+ } -+ -+ ret = register_netdevice_notifier(&nf_rtcache_notifier); -+ if (ret) { -+ nf_unregister_net_hooks(&init_net, rtcache_ops, -+ ARRAY_SIZE(rtcache_ops)); -+ nf_ct_extend_unregister(&rtcache_extend); -+ unregister_pernet_subsys(&rtcache_ops_net_ops); -+ } -+ -+ return ret; -+} -+ -+static int nf_rtcache_ext_remove(struct nf_conn *ct, void *data) -+{ -+ struct nf_conn_rtcache *rtc = nf_ct_rtcache_find(ct); -+ -+ return rtc != NULL; -+} -+ -+static bool __exit nf_conntrack_rtcache_wait_for_dying(struct net *net) -+{ -+ bool wait = false; -+ int cpu; -+ -+ for_each_possible_cpu(cpu) { -+ struct nf_conntrack_tuple_hash *h; -+ struct hlist_nulls_node *n; -+ struct nf_conn *ct; -+ struct ct_pcpu *pcpu = per_cpu_ptr(net->ct.pcpu_lists, cpu); -+ -+ rcu_read_lock(); -+ spin_lock_bh(&pcpu->lock); -+ -+ hlist_nulls_for_each_entry(h, n, &pcpu->dying, hnnode) { -+ ct = nf_ct_tuplehash_to_ctrack(h); -+ if (nf_ct_rtcache_find(ct) != NULL) { -+ wait = true; -+ break; -+ } -+ } -+ spin_unlock_bh(&pcpu->lock); -+ rcu_read_unlock(); -+ } -+ -+ return wait; -+} -+ -+static void __exit nf_conntrack_rtcache_fini(void) -+{ -+ struct net *net; -+ int count = 0; -+ -+ synchronize_net(); -+ -+ unregister_netdevice_notifier(&nf_rtcache_notifier); -+ -+ rtnl_lock(); -+ -+ /* zap all conntracks with rtcache extension */ -+ for_each_net(net) -+ nf_ct_iterate_cleanup_net(net, nf_rtcache_ext_remove, NULL, 0, 0); -+ -+ for_each_net(net) { -+ /* .. and make sure they're gone from dying list, too */ -+ while (nf_conntrack_rtcache_wait_for_dying(net)) { -+ msleep(200); -+ WARN_ONCE(++count > 25, "Waiting for all rtcache conntracks to go away\n"); -+ } -+ } -+ -+ rtnl_unlock(); -+ synchronize_net(); -+ nf_ct_extend_unregister(&rtcache_extend); -+} -+module_init(nf_conntrack_rtcache_init); -+module_exit(nf_conntrack_rtcache_fini); -+ -+MODULE_LICENSE("GPL"); -+MODULE_AUTHOR("Florian Westphal "); -+MODULE_DESCRIPTION("Conntrack route cache extension"); diff --git a/target/linux/generic/backport-4.19/047-v4.21-mtd-keep-original-flags-for-every-struct-mtd_info.patch b/target/linux/generic/backport-4.19/047-v4.21-mtd-keep-original-flags-for-every-struct-mtd_info.patch deleted file mode 100644 index d587c9ec07..0000000000 --- a/target/linux/generic/backport-4.19/047-v4.21-mtd-keep-original-flags-for-every-struct-mtd_info.patch +++ /dev/null @@ -1,58 +0,0 @@ -From 1186af457cc186c5ed01708da71b1ffbdf0a2638 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= -Date: Tue, 20 Nov 2018 09:55:45 +0100 -Subject: [PATCH] mtd: keep original flags for every struct mtd_info -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -When allocating a new partition mtd subsystem runs internal tests in the -allocate_partition(). They may result in modifying specified flags (e.g. -dropping some /features/ like write access). - -Those constraints don't have to be necessary true for subpartitions. It -may happen parent partition isn't block aligned (effectively disabling -write access) while subpartition may fit blocks nicely. In such case all -checks should be run again (starting with original flags value). - -Signed-off-by: Rafał Miłecki -Signed-off-by: Boris Brezillon ---- - drivers/mtd/mtdcore.c | 2 ++ - drivers/mtd/mtdpart.c | 3 ++- - include/linux/mtd/mtd.h | 1 + - 3 files changed, 5 insertions(+), 1 deletion(-) - ---- a/drivers/mtd/mtdcore.c -+++ b/drivers/mtd/mtdcore.c -@@ -665,6 +665,8 @@ static void mtd_set_dev_defaults(struct - } else { - pr_debug("mtd device won't show a device symlink in sysfs\n"); - } -+ -+ mtd->orig_flags = mtd->flags; - } - - /** ---- a/drivers/mtd/mtdpart.c -+++ b/drivers/mtd/mtdpart.c -@@ -346,7 +346,8 @@ static struct mtd_part *allocate_partiti - - /* set up the MTD object for this partition */ - slave->mtd.type = parent->type; -- slave->mtd.flags = parent->flags & ~part->mask_flags; -+ slave->mtd.flags = parent->orig_flags & ~part->mask_flags; -+ slave->mtd.orig_flags = slave->mtd.flags; - slave->mtd.size = part->size; - slave->mtd.writesize = parent->writesize; - slave->mtd.writebufsize = parent->writebufsize; ---- a/include/linux/mtd/mtd.h -+++ b/include/linux/mtd/mtd.h -@@ -207,6 +207,7 @@ struct mtd_debug_info { - struct mtd_info { - u_char type; - uint32_t flags; -+ uint32_t orig_flags; /* Flags as before running mtd checks */ - uint64_t size; // Total size of the MTD - - /* "Major" erase size for the device. Naïve users may take this diff --git a/target/linux/generic/backport-4.19/048-v4.21-mtd-improve-calculating-partition-boundaries-when-ch.patch b/target/linux/generic/backport-4.19/048-v4.21-mtd-improve-calculating-partition-boundaries-when-ch.patch deleted file mode 100644 index 02296276b0..0000000000 --- a/target/linux/generic/backport-4.19/048-v4.21-mtd-improve-calculating-partition-boundaries-when-ch.patch +++ /dev/null @@ -1,55 +0,0 @@ -From 6750f61a13a0197c40e4a40739117493b15f19e8 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= -Date: Tue, 20 Nov 2018 10:24:09 +0100 -Subject: [PATCH] mtd: improve calculating partition boundaries when checking - for alignment -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -When checking for alignment mtd should check absolute offsets. It's -important for subpartitions as it doesn't make sense to check their -relative addresses. - -Signed-off-by: Rafał Miłecki -Signed-off-by: Boris Brezillon ---- - drivers/mtd/mtdpart.c | 13 +++++++++++-- - 1 file changed, 11 insertions(+), 2 deletions(-) - ---- a/drivers/mtd/mtdpart.c -+++ b/drivers/mtd/mtdpart.c -@@ -61,6 +61,15 @@ static inline struct mtd_part *mtd_to_pa - return container_of(mtd, struct mtd_part, mtd); - } - -+static u64 part_absolute_offset(struct mtd_info *mtd) -+{ -+ struct mtd_part *part = mtd_to_part(mtd); -+ -+ if (!mtd_is_partition(mtd)) -+ return 0; -+ -+ return part_absolute_offset(part->parent) + part->offset; -+} - - /* - * MTD methods which simply translate the effective address and pass through -@@ -518,7 +527,7 @@ static struct mtd_part *allocate_partiti - if (!(slave->mtd.flags & MTD_NO_ERASE)) - wr_alignment = slave->mtd.erasesize; - -- tmp = slave->offset; -+ tmp = part_absolute_offset(parent) + slave->offset; - remainder = do_div(tmp, wr_alignment); - if ((slave->mtd.flags & MTD_WRITEABLE) && remainder) { - /* Doesn't start on a boundary of major erase size */ -@@ -529,7 +538,7 @@ static struct mtd_part *allocate_partiti - part->name); - } - -- tmp = slave->mtd.size; -+ tmp = part_absolute_offset(parent) + slave->mtd.size; - remainder = do_div(tmp, wr_alignment); - if ((slave->mtd.flags & MTD_WRITEABLE) && remainder) { - slave->mtd.flags &= ~MTD_WRITEABLE; diff --git a/target/linux/generic/backport-4.19/080-v5.1-0001-bcma-keep-a-direct-pointer-to-the-struct-device.patch b/target/linux/generic/backport-4.19/080-v5.1-0001-bcma-keep-a-direct-pointer-to-the-struct-device.patch deleted file mode 100644 index cc32aee17b..0000000000 --- a/target/linux/generic/backport-4.19/080-v5.1-0001-bcma-keep-a-direct-pointer-to-the-struct-device.patch +++ /dev/null @@ -1,199 +0,0 @@ -From 5a1c18b761ddb299a06746948b9ec2814b04fa92 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= -Date: Wed, 2 Jan 2019 00:00:01 +0100 -Subject: [PATCH] bcma: keep a direct pointer to the struct device -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Accessing struct device is pretty useful/common so having a direct -pointer: -1) Simplifies some code -2) Makes bcma_bus_get_host_dev() unneeded -3) Allows further improvements like using dev_* printing helpers - -Signed-off-by: Rafał Miłecki -Signed-off-by: Kalle Valo ---- - drivers/bcma/bcma_private.h | 1 - - drivers/bcma/driver_gpio.c | 2 +- - drivers/bcma/host_pci.c | 2 ++ - drivers/bcma/host_soc.c | 4 ++-- - drivers/bcma/main.c | 45 +++++++++---------------------------- - include/linux/bcma/bcma.h | 11 +++------ - 6 files changed, 18 insertions(+), 47 deletions(-) - ---- a/drivers/bcma/bcma_private.h -+++ b/drivers/bcma/bcma_private.h -@@ -33,7 +33,6 @@ int __init bcma_bus_early_register(struc - int bcma_bus_suspend(struct bcma_bus *bus); - int bcma_bus_resume(struct bcma_bus *bus); - #endif --struct device *bcma_bus_get_host_dev(struct bcma_bus *bus); - - /* scan.c */ - void bcma_detect_chip(struct bcma_bus *bus); ---- a/drivers/bcma/driver_gpio.c -+++ b/drivers/bcma/driver_gpio.c -@@ -183,7 +183,7 @@ int bcma_gpio_init(struct bcma_drv_cc *c - chip->direction_input = bcma_gpio_direction_input; - chip->direction_output = bcma_gpio_direction_output; - chip->owner = THIS_MODULE; -- chip->parent = bcma_bus_get_host_dev(bus); -+ chip->parent = bus->dev; - #if IS_BUILTIN(CONFIG_OF) - chip->of_node = cc->core->dev.of_node; - #endif ---- a/drivers/bcma/host_pci.c -+++ b/drivers/bcma/host_pci.c -@@ -196,6 +196,8 @@ static int bcma_host_pci_probe(struct pc - goto err_pci_release_regions; - } - -+ bus->dev = &dev->dev; -+ - /* Map MMIO */ - err = -ENOMEM; - bus->mmio = pci_iomap(dev, 0, ~0UL); ---- a/drivers/bcma/host_soc.c -+++ b/drivers/bcma/host_soc.c -@@ -179,7 +179,6 @@ int __init bcma_host_soc_register(struct - /* Host specific */ - bus->hosttype = BCMA_HOSTTYPE_SOC; - bus->ops = &bcma_host_soc_ops; -- bus->host_pdev = NULL; - - /* Initialize struct, detect chip */ - bcma_init_bus(bus); -@@ -213,6 +212,8 @@ static int bcma_host_soc_probe(struct pl - if (!bus) - return -ENOMEM; - -+ bus->dev = dev; -+ - /* Map MMIO */ - bus->mmio = of_iomap(np, 0); - if (!bus->mmio) -@@ -221,7 +222,6 @@ static int bcma_host_soc_probe(struct pl - /* Host specific */ - bus->hosttype = BCMA_HOSTTYPE_SOC; - bus->ops = &bcma_host_soc_ops; -- bus->host_pdev = pdev; - - /* Initialize struct, detect chip */ - bcma_init_bus(bus); ---- a/drivers/bcma/main.c -+++ b/drivers/bcma/main.c -@@ -223,8 +223,8 @@ unsigned int bcma_core_irq(struct bcma_d - mips_irq = bcma_core_mips_irq(core); - return mips_irq <= 4 ? mips_irq + 2 : 0; - } -- if (bus->host_pdev) -- return bcma_of_get_irq(&bus->host_pdev->dev, core, num); -+ if (bus->dev) -+ return bcma_of_get_irq(bus->dev, core, num); - return 0; - case BCMA_HOSTTYPE_SDIO: - return 0; -@@ -239,18 +239,18 @@ void bcma_prepare_core(struct bcma_bus * - core->dev.release = bcma_release_core_dev; - core->dev.bus = &bcma_bus_type; - dev_set_name(&core->dev, "bcma%d:%d", bus->num, core->core_index); -- core->dev.parent = bcma_bus_get_host_dev(bus); -- if (core->dev.parent) -- bcma_of_fill_device(core->dev.parent, core); -+ core->dev.parent = bus->dev; -+ if (bus->dev) -+ bcma_of_fill_device(bus->dev, core); - - switch (bus->hosttype) { - case BCMA_HOSTTYPE_PCI: -- core->dma_dev = &bus->host_pci->dev; -+ core->dma_dev = bus->dev; - core->irq = bus->host_pci->irq; - break; - case BCMA_HOSTTYPE_SOC: -- if (IS_ENABLED(CONFIG_OF) && bus->host_pdev) { -- core->dma_dev = &bus->host_pdev->dev; -+ if (IS_ENABLED(CONFIG_OF) && bus->dev) { -+ core->dma_dev = bus->dev; - } else { - core->dev.dma_mask = &core->dev.coherent_dma_mask; - core->dma_dev = &core->dev; -@@ -261,28 +261,6 @@ void bcma_prepare_core(struct bcma_bus * - } - } - --struct device *bcma_bus_get_host_dev(struct bcma_bus *bus) --{ -- switch (bus->hosttype) { -- case BCMA_HOSTTYPE_PCI: -- if (bus->host_pci) -- return &bus->host_pci->dev; -- else -- return NULL; -- case BCMA_HOSTTYPE_SOC: -- if (bus->host_pdev) -- return &bus->host_pdev->dev; -- else -- return NULL; -- case BCMA_HOSTTYPE_SDIO: -- if (bus->host_sdio) -- return &bus->host_sdio->dev; -- else -- return NULL; -- } -- return NULL; --} -- - void bcma_init_bus(struct bcma_bus *bus) - { - mutex_lock(&bcma_buses_mutex); -@@ -402,7 +380,6 @@ int bcma_bus_register(struct bcma_bus *b - { - int err; - struct bcma_device *core; -- struct device *dev; - - /* Scan for devices (cores) */ - err = bcma_bus_scan(bus); -@@ -425,10 +402,8 @@ int bcma_bus_register(struct bcma_bus *b - bcma_core_pci_early_init(&bus->drv_pci[0]); - } - -- dev = bcma_bus_get_host_dev(bus); -- if (dev) { -- of_platform_default_populate(dev->of_node, NULL, dev); -- } -+ if (bus->dev) -+ of_platform_default_populate(bus->dev->of_node, NULL, bus->dev); - - /* Cores providing flash access go before SPROM init */ - list_for_each_entry(core, &bus->cores, list) { ---- a/include/linux/bcma/bcma.h -+++ b/include/linux/bcma/bcma.h -@@ -332,6 +332,8 @@ extern int bcma_arch_register_fallback_s - struct ssb_sprom *out)); - - struct bcma_bus { -+ struct device *dev; -+ - /* The MMIO area. */ - void __iomem *mmio; - -@@ -339,14 +341,7 @@ struct bcma_bus { - - enum bcma_hosttype hosttype; - bool host_is_pcie2; /* Used for BCMA_HOSTTYPE_PCI only */ -- union { -- /* Pointer to the PCI bus (only for BCMA_HOSTTYPE_PCI) */ -- struct pci_dev *host_pci; -- /* Pointer to the SDIO device (only for BCMA_HOSTTYPE_SDIO) */ -- struct sdio_func *host_sdio; -- /* Pointer to platform device (only for BCMA_HOSTTYPE_SOC) */ -- struct platform_device *host_pdev; -- }; -+ struct pci_dev *host_pci; /* PCI bus pointer (BCMA_HOSTTYPE_PCI only) */ - - struct bcma_chipinfo chipinfo; - diff --git a/target/linux/generic/backport-4.19/080-v5.1-0002-bcma-use-dev_-printing-functions.patch b/target/linux/generic/backport-4.19/080-v5.1-0002-bcma-use-dev_-printing-functions.patch deleted file mode 100644 index 7ce8ba8967..0000000000 --- a/target/linux/generic/backport-4.19/080-v5.1-0002-bcma-use-dev_-printing-functions.patch +++ /dev/null @@ -1,36 +0,0 @@ -From 777bc4801a6868fcbff09ffb6e30f023e7c5ed38 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= -Date: Wed, 2 Jan 2019 00:00:02 +0100 -Subject: [PATCH] bcma: use dev_* printing functions -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -It provides more meaningful messages. - -Signed-off-by: Rafał Miłecki -Signed-off-by: Kalle Valo ---- - drivers/bcma/bcma_private.h | 8 ++++---- - 1 file changed, 4 insertions(+), 4 deletions(-) - ---- a/drivers/bcma/bcma_private.h -+++ b/drivers/bcma/bcma_private.h -@@ -10,13 +10,13 @@ - #include - - #define bcma_err(bus, fmt, ...) \ -- pr_err("bus%d: " fmt, (bus)->num, ##__VA_ARGS__) -+ dev_err((bus)->dev, "bus%d: " fmt, (bus)->num, ##__VA_ARGS__) - #define bcma_warn(bus, fmt, ...) \ -- pr_warn("bus%d: " fmt, (bus)->num, ##__VA_ARGS__) -+ dev_warn((bus)->dev, "bus%d: " fmt, (bus)->num, ##__VA_ARGS__) - #define bcma_info(bus, fmt, ...) \ -- pr_info("bus%d: " fmt, (bus)->num, ##__VA_ARGS__) -+ dev_info((bus)->dev, "bus%d: " fmt, (bus)->num, ##__VA_ARGS__) - #define bcma_debug(bus, fmt, ...) \ -- pr_debug("bus%d: " fmt, (bus)->num, ##__VA_ARGS__) -+ dev_dbg((bus)->dev, "bus%d: " fmt, (bus)->num, ##__VA_ARGS__) - - struct bcma_bus; - diff --git a/target/linux/generic/backport-4.19/095-Allow-class-e-address-assignment-via-ifconfig-ioctl.patch b/target/linux/generic/backport-4.19/095-Allow-class-e-address-assignment-via-ifconfig-ioctl.patch deleted file mode 100644 index 5d49a406c4..0000000000 --- a/target/linux/generic/backport-4.19/095-Allow-class-e-address-assignment-via-ifconfig-ioctl.patch +++ /dev/null @@ -1,79 +0,0 @@ -From 46bf067870156abd61fe24d14c2486d15b8b502c Mon Sep 17 00:00:00 2001 -From: Dave Taht -Date: Fri, 14 Dec 2018 18:38:40 +0000 -Subject: [PATCH 1/1] Allow class-e address assignment in ifconfig and early - boot - -While the linux kernel became mostly "class-e clean" a decade ago, -and most distributions long ago switched to the iproute2 suite -of utilities, which allow class-e (240.0.0.0/4) address assignment, -distributions relying on busybox, toybox and other forms of -ifconfig cannot assign class-e addresses without this kernel patch. - -With this patch, also, a boot command line on these addresses is feasible: -(ip=248.0.1.2::248.0.1.1:255.255.255.0). - -While CIDR has been obsolete for 2 decades, and a survey of all the -userspace open source code in the world shows most IN_whatever macros -are also obsolete... rather than obsolete CIDR from this ioctl entirely, -this patch merely enables class-e assignment, sanely. - -H/T to Vince Fuller and his original patch here: - https://lkml.org/lkml/2008/1/7/370 - -Signed-off-by: Dave Taht -Reviewed-by: John Gilmore ---- - include/uapi/linux/in.h | 8 ++++++-- - net/ipv4/devinet.c | 4 +++- - net/ipv4/ipconfig.c | 2 ++ - 3 files changed, 11 insertions(+), 3 deletions(-) - ---- a/include/uapi/linux/in.h -+++ b/include/uapi/linux/in.h -@@ -268,8 +268,12 @@ struct sockaddr_in { - #define IN_MULTICAST(a) IN_CLASSD(a) - #define IN_MULTICAST_NET 0xF0000000 - --#define IN_EXPERIMENTAL(a) ((((long int) (a)) & 0xf0000000) == 0xf0000000) --#define IN_BADCLASS(a) IN_EXPERIMENTAL((a)) -+#define IN_BADCLASS(a) (((long int) (a) ) == (long int)0xffffffff) -+#define IN_EXPERIMENTAL(a) IN_BADCLASS((a)) -+ -+#define IN_CLASSE(a) ((((long int) (a)) & 0xf0000000) == 0xf0000000) -+#define IN_CLASSE_NET 0xffffffff -+#define IN_CLASSE_NSHIFT 0 - - /* Address to accept any incoming messages. */ - #define INADDR_ANY ((unsigned long int) 0x00000000) ---- a/net/ipv4/devinet.c -+++ b/net/ipv4/devinet.c -@@ -941,7 +941,7 @@ static int inet_abc_len(__be32 addr) - { - int rc = -1; /* Something else, probably a multicast. */ - -- if (ipv4_is_zeronet(addr)) -+ if (ipv4_is_zeronet(addr) || ipv4_is_lbcast(addr)) - rc = 0; - else { - __u32 haddr = ntohl(addr); -@@ -952,6 +952,8 @@ static int inet_abc_len(__be32 addr) - rc = 16; - else if (IN_CLASSC(haddr)) - rc = 24; -+ else if (IN_CLASSE(haddr)) -+ rc = 32; - } - - return rc; ---- a/net/ipv4/ipconfig.c -+++ b/net/ipv4/ipconfig.c -@@ -429,6 +429,8 @@ static int __init ic_defaults(void) - ic_netmask = htonl(IN_CLASSB_NET); - else if (IN_CLASSC(ntohl(ic_myaddr))) - ic_netmask = htonl(IN_CLASSC_NET); -+ else if (IN_CLASSE(ntohl(ic_myaddr))) -+ ic_netmask = htonl(IN_CLASSE_NET); - else { - pr_err("IP-Config: Unable to guess netmask for address %pI4\n", - &ic_myaddr); diff --git a/target/linux/generic/backport-4.19/101-arm-cns3xxx-use-actual-size-reads-for-PCIe.patch b/target/linux/generic/backport-4.19/101-arm-cns3xxx-use-actual-size-reads-for-PCIe.patch deleted file mode 100644 index 2b3384391a..0000000000 --- a/target/linux/generic/backport-4.19/101-arm-cns3xxx-use-actual-size-reads-for-PCIe.patch +++ /dev/null @@ -1,46 +0,0 @@ -From 4cc30de79d293f1e8c5f50ae3a9c005def9564a0 Mon Sep 17 00:00:00 2001 -From: Koen Vandeputte -Date: Mon, 7 Jan 2019 14:14:27 +0100 -Subject: [PATCH 2/2] arm: cns3xxx: use actual size reads for PCIe - -commit 802b7c06adc7 ("ARM: cns3xxx: Convert PCI to use generic config accessors") -reimplemented cns3xxx_pci_read_config() using pci_generic_config_read32(), -which preserved the property of only doing 32-bit reads. - -It also replaced cns3xxx_pci_write_config() with pci_generic_config_write(), -so it changed writes from always being 32 bits to being the actual size, -which works just fine. - -Due to: -- The documentation does not mention that only 32 bit access is allowed. -- Writes are already executed using the actual size -- Extensive testing shows that 8b, 16b and 32b reads work as intended - -It makes perfectly sense to also swap 32 bit reading in favor of actual size. - -Fixes: 802b7c06adc7 ("ARM: cns3xxx: Convert PCI to use generic config accessors") -Suggested-by: Bjorn Helgaas -Signed-off-by: Koen Vandeputte -CC: Arnd Bergmann -CC: Krzysztof Halasa -CC: Olof Johansson -CC: Robin Leblon -CC: Rob Herring -CC: Russell King -CC: Tim Harvey -CC: stable@vger.kernel.org # v4.0+ ---- - arch/arm/mach-cns3xxx/pcie.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - ---- a/arch/arm/mach-cns3xxx/pcie.c -+++ b/arch/arm/mach-cns3xxx/pcie.c -@@ -93,7 +93,7 @@ static int cns3xxx_pci_read_config(struc - u32 mask = (0x1ull << (size * 8)) - 1; - int shift = (where % 4) * 8; - -- ret = pci_generic_config_read32(bus, devfn, where, size, val); -+ ret = pci_generic_config_read(bus, devfn, where, size, val); - - if (ret == PCIBIOS_SUCCESSFUL && !bus->number && !devfn && - (where & 0xffc) == PCI_CLASS_REVISION) diff --git a/target/linux/generic/backport-4.19/343-netfilter-nft_flow_offload-handle-netdevice-events-f.patch b/target/linux/generic/backport-4.19/343-netfilter-nft_flow_offload-handle-netdevice-events-f.patch deleted file mode 100644 index 51c9e488e9..0000000000 --- a/target/linux/generic/backport-4.19/343-netfilter-nft_flow_offload-handle-netdevice-events-f.patch +++ /dev/null @@ -1,99 +0,0 @@ -From: Pablo Neira Ayuso -Date: Thu, 25 Jan 2018 12:58:55 +0100 -Subject: [PATCH] netfilter: nft_flow_offload: handle netdevice events from - nf_flow_table - -Move the code that deals with device events to the core. - -Signed-off-by: Pablo Neira Ayuso ---- - ---- a/net/netfilter/nf_flow_table_core.c -+++ b/net/netfilter/nf_flow_table_core.c -@@ -519,5 +519,35 @@ void nf_flow_table_free(struct nf_flowta - } - EXPORT_SYMBOL_GPL(nf_flow_table_free); - -+static int nf_flow_table_netdev_event(struct notifier_block *this, -+ unsigned long event, void *ptr) -+{ -+ struct net_device *dev = netdev_notifier_info_to_dev(ptr); -+ -+ if (event != NETDEV_DOWN) -+ return NOTIFY_DONE; -+ -+ nf_flow_table_cleanup(dev_net(dev), dev); -+ -+ return NOTIFY_DONE; -+} -+ -+static struct notifier_block flow_offload_netdev_notifier = { -+ .notifier_call = nf_flow_table_netdev_event, -+}; -+ -+static int __init nf_flow_table_module_init(void) -+{ -+ return register_netdevice_notifier(&flow_offload_netdev_notifier); -+} -+ -+static void __exit nf_flow_table_module_exit(void) -+{ -+ unregister_netdevice_notifier(&flow_offload_netdev_notifier); -+} -+ -+module_init(nf_flow_table_module_init); -+module_exit(nf_flow_table_module_exit); -+ - MODULE_LICENSE("GPL"); - MODULE_AUTHOR("Pablo Neira Ayuso "); ---- a/net/netfilter/nft_flow_offload.c -+++ b/net/netfilter/nft_flow_offload.c -@@ -193,47 +193,14 @@ static struct nft_expr_type nft_flow_off - .owner = THIS_MODULE, - }; - --static int flow_offload_netdev_event(struct notifier_block *this, -- unsigned long event, void *ptr) --{ -- struct net_device *dev = netdev_notifier_info_to_dev(ptr); -- -- if (event != NETDEV_DOWN) -- return NOTIFY_DONE; -- -- nf_flow_table_cleanup(dev_net(dev), dev); -- -- return NOTIFY_DONE; --} -- --static struct notifier_block flow_offload_netdev_notifier = { -- .notifier_call = flow_offload_netdev_event, --}; -- - static int __init nft_flow_offload_module_init(void) - { -- int err; -- -- err = register_netdevice_notifier(&flow_offload_netdev_notifier); -- if (err) -- goto err; -- -- err = nft_register_expr(&nft_flow_offload_type); -- if (err < 0) -- goto register_expr; -- -- return 0; -- --register_expr: -- unregister_netdevice_notifier(&flow_offload_netdev_notifier); --err: -- return err; -+ return nft_register_expr(&nft_flow_offload_type); - } - - static void __exit nft_flow_offload_module_exit(void) - { - nft_unregister_expr(&nft_flow_offload_type); -- unregister_netdevice_notifier(&flow_offload_netdev_notifier); - } - - module_init(nft_flow_offload_module_init); diff --git a/target/linux/generic/backport-4.19/366-netfilter-nf_flow_table-clean-up-and-fix-dst-handlin.patch b/target/linux/generic/backport-4.19/366-netfilter-nf_flow_table-clean-up-and-fix-dst-handlin.patch deleted file mode 100644 index 624602dabe..0000000000 --- a/target/linux/generic/backport-4.19/366-netfilter-nf_flow_table-clean-up-and-fix-dst-handlin.patch +++ /dev/null @@ -1,89 +0,0 @@ -From: Felix Fietkau -Date: Thu, 15 Mar 2018 18:21:43 +0100 -Subject: [PATCH] netfilter: nf_flow_table: clean up and fix dst handling - -dst handling in the code is inconsistent and possibly wrong. In my test, -skb_dst(skb) holds the dst entry after routing but before NAT, so the -code could possibly return the same dst entry for both directions of a -connection. -Additionally, there was some confusion over the dst entry vs the address -passed as parameter to rt_nexthop/rt6_nexthop. - -Do an explicit dst lookup for both ends of the connection and always use -the source address for it. When running the IP hook, use the dst entry -for the opposite direction for determining the route. - -Signed-off-by: Felix Fietkau ---- - ---- a/net/netfilter/nf_flow_table_ip.c -+++ b/net/netfilter/nf_flow_table_ip.c -@@ -241,7 +241,7 @@ nf_flow_offload_ip_hook(void *priv, stru - - dir = tuplehash->tuple.dir; - flow = container_of(tuplehash, struct flow_offload, tuplehash[dir]); -- rt = (struct rtable *)flow->tuplehash[dir].tuple.dst_cache; -+ rt = (struct rtable *)flow->tuplehash[!dir].tuple.dst_cache; - - if (unlikely(nf_flow_exceeds_mtu(skb, flow->tuplehash[dir].tuple.mtu)) && - (ip_hdr(skb)->frag_off & htons(IP_DF)) != 0) -@@ -459,7 +459,7 @@ nf_flow_offload_ipv6_hook(void *priv, st - - dir = tuplehash->tuple.dir; - flow = container_of(tuplehash, struct flow_offload, tuplehash[dir]); -- rt = (struct rt6_info *)flow->tuplehash[dir].tuple.dst_cache; -+ rt = (struct rt6_info *)flow->tuplehash[!dir].tuple.dst_cache; - - if (unlikely(nf_flow_exceeds_mtu(skb, flow->tuplehash[dir].tuple.mtu))) - return NF_ACCEPT; ---- a/net/netfilter/nft_flow_offload.c -+++ b/net/netfilter/nft_flow_offload.c -@@ -17,27 +17,38 @@ struct nft_flow_offload { - struct nft_flowtable *flowtable; - }; - --static int nft_flow_route(const struct nft_pktinfo *pkt, -- const struct nf_conn *ct, -- struct nf_flow_route *route, -- enum ip_conntrack_dir dir) -+static struct dst_entry * -+nft_flow_dst(const struct nf_conn *ct, enum ip_conntrack_dir dir, -+ const struct nft_pktinfo *pkt) - { -- struct dst_entry *this_dst = skb_dst(pkt->skb); -- struct dst_entry *other_dst = NULL; -+ struct dst_entry *dst; - struct flowi fl; - - memset(&fl, 0, sizeof(fl)); - switch (nft_pf(pkt)) { - case NFPROTO_IPV4: -- fl.u.ip4.daddr = ct->tuplehash[!dir].tuple.dst.u3.ip; -+ fl.u.ip4.daddr = ct->tuplehash[dir].tuple.src.u3.ip; - break; - case NFPROTO_IPV6: -- fl.u.ip6.daddr = ct->tuplehash[!dir].tuple.dst.u3.in6; -+ fl.u.ip6.daddr = ct->tuplehash[dir].tuple.src.u3.in6; - break; - } - -- nf_route(nft_net(pkt), &other_dst, &fl, false, nft_pf(pkt)); -- if (!other_dst) -+ nf_route(nft_net(pkt), &dst, &fl, false, nft_pf(pkt)); -+ -+ return dst; -+} -+ -+static int nft_flow_route(const struct nft_pktinfo *pkt, -+ const struct nf_conn *ct, -+ struct nf_flow_route *route, -+ enum ip_conntrack_dir dir) -+{ -+ struct dst_entry *this_dst, *other_dst; -+ -+ this_dst = nft_flow_dst(ct, dir, pkt); -+ other_dst = nft_flow_dst(ct, !dir, pkt); -+ if (!this_dst || !other_dst) - return -ENOENT; - - route->tuple[dir].dst = this_dst; diff --git a/target/linux/generic/backport-4.19/370-netfilter-nf_flow_table-fix-offloaded-connection-tim.patch b/target/linux/generic/backport-4.19/370-netfilter-nf_flow_table-fix-offloaded-connection-tim.patch deleted file mode 100644 index 9c4b7e392e..0000000000 --- a/target/linux/generic/backport-4.19/370-netfilter-nf_flow_table-fix-offloaded-connection-tim.patch +++ /dev/null @@ -1,110 +0,0 @@ -From: Felix Fietkau -Date: Wed, 13 Jun 2018 12:33:39 +0200 -Subject: [PATCH] netfilter: nf_flow_table: fix offloaded connection timeout - corner case - -The full teardown of offloaded flows is deferred to a gc work item, -however processing of packets by netfilter needs to happen immediately -after a teardown is requested, because the conntrack state needs to be -fixed up. - -Since the IPS_OFFLOAD_BIT is still kept until the teardown is complete, -the netfilter conntrack gc can accidentally bump the timeout of a -connection where offload was just stopped, causing a conntrack entry -leak. - -Fix this by moving the conntrack timeout bumping from conntrack core to -the nf_flow_offload and add a check to prevent bogus timeout bumps. - -Signed-off-by: Felix Fietkau ---- - ---- a/net/netfilter/nf_conntrack_core.c -+++ b/net/netfilter/nf_conntrack_core.c -@@ -1119,18 +1119,6 @@ static bool gc_worker_can_early_drop(con - return false; - } - --#define DAY (86400 * HZ) -- --/* Set an arbitrary timeout large enough not to ever expire, this save -- * us a check for the IPS_OFFLOAD_BIT from the packet path via -- * nf_ct_is_expired(). -- */ --static void nf_ct_offload_timeout(struct nf_conn *ct) --{ -- if (nf_ct_expires(ct) < DAY / 2) -- ct->timeout = nfct_time_stamp + DAY; --} -- - static void gc_worker(struct work_struct *work) - { - unsigned int min_interval = max(HZ / GC_MAX_BUCKETS_DIV, 1u); -@@ -1167,10 +1155,8 @@ static void gc_worker(struct work_struct - tmp = nf_ct_tuplehash_to_ctrack(h); - - scanned++; -- if (test_bit(IPS_OFFLOAD_BIT, &tmp->status)) { -- nf_ct_offload_timeout(tmp); -+ if (test_bit(IPS_OFFLOAD_BIT, &tmp->status)) - continue; -- } - - if (nf_ct_is_expired(tmp)) { - nf_ct_gc_expired(tmp); ---- a/net/netfilter/nf_flow_table_core.c -+++ b/net/netfilter/nf_flow_table_core.c -@@ -182,8 +182,27 @@ static const struct rhashtable_params nf - .automatic_shrinking = true, - }; - -+#define DAY (86400 * HZ) -+ -+/* Set an arbitrary timeout large enough not to ever expire, this save -+ * us a check for the IPS_OFFLOAD_BIT from the packet path via -+ * nf_ct_is_expired(). -+ */ -+static void nf_ct_offload_timeout(struct flow_offload *flow) -+{ -+ struct flow_offload_entry *entry; -+ struct nf_conn *ct; -+ -+ entry = container_of(flow, struct flow_offload_entry, flow); -+ ct = entry->ct; -+ -+ if (nf_ct_expires(ct) < DAY / 2) -+ ct->timeout = nfct_time_stamp + DAY; -+} -+ - int flow_offload_add(struct nf_flowtable *flow_table, struct flow_offload *flow) - { -+ nf_ct_offload_timeout(flow); - flow->timeout = (u32)jiffies; - - rhashtable_insert_fast(&flow_table->rhashtable, -@@ -304,6 +323,8 @@ static int nf_flow_offload_gc_step(struc - rhashtable_walk_start(&hti); - - while ((tuplehash = rhashtable_walk_next(&hti))) { -+ bool teardown; -+ - if (IS_ERR(tuplehash)) { - err = PTR_ERR(tuplehash); - if (err != -EAGAIN) -@@ -316,9 +337,13 @@ static int nf_flow_offload_gc_step(struc - - flow = container_of(tuplehash, struct flow_offload, tuplehash[0]); - -- if (nf_flow_has_expired(flow) || -- (flow->flags & (FLOW_OFFLOAD_DYING | -- FLOW_OFFLOAD_TEARDOWN))) -+ teardown = flow->flags & (FLOW_OFFLOAD_DYING | -+ FLOW_OFFLOAD_TEARDOWN); -+ -+ if (!teardown) -+ nf_ct_offload_timeout(flow); -+ -+ if (nf_flow_has_expired(flow) || teardown) - flow_offload_del(flow_table, flow); - } - out: diff --git a/target/linux/generic/backport-4.19/371-netfilter-nf_flow_table-fix-up-ct-state-of-flows-aft.patch b/target/linux/generic/backport-4.19/371-netfilter-nf_flow_table-fix-up-ct-state-of-flows-aft.patch deleted file mode 100644 index 59751ff037..0000000000 --- a/target/linux/generic/backport-4.19/371-netfilter-nf_flow_table-fix-up-ct-state-of-flows-aft.patch +++ /dev/null @@ -1,24 +0,0 @@ -From: Felix Fietkau -Date: Thu, 14 Jun 2018 11:20:09 +0200 -Subject: [PATCH] netfilter: nf_flow_table: fix up ct state of flows after - timeout - -If a connection simply times out instead of being torn down, it is left -active with a long timeout. Fix this by calling flow_offload_fixup_ct_state -here as well. - -Signed-off-by: Felix Fietkau ---- - ---- a/net/netfilter/nf_flow_table_core.c -+++ b/net/netfilter/nf_flow_table_core.c -@@ -230,6 +230,9 @@ static void flow_offload_del(struct nf_f - e = container_of(flow, struct flow_offload_entry, flow); - clear_bit(IPS_OFFLOAD_BIT, &e->ct->status); - -+ if (!(flow->flags & FLOW_OFFLOAD_TEARDOWN)) -+ flow_offload_fixup_ct_state(e->ct); -+ - flow_offload_free(flow); - } - diff --git a/target/linux/generic/backport-4.9/010-Kbuild-don-t-hardcode-path-to-awk-in-scripts-ld-vers.patch b/target/linux/generic/backport-4.9/010-Kbuild-don-t-hardcode-path-to-awk-in-scripts-ld-vers.patch deleted file mode 100644 index 1115ee1ba2..0000000000 --- a/target/linux/generic/backport-4.9/010-Kbuild-don-t-hardcode-path-to-awk-in-scripts-ld-vers.patch +++ /dev/null @@ -1,29 +0,0 @@ -From 13b1ecc3401653a355798eb1dee10cc1608202f4 Mon Sep 17 00:00:00 2001 -From: Felix Fietkau -Date: Mon, 18 Jan 2016 12:27:49 +0100 -Subject: [PATCH 33/34] Kbuild: don't hardcode path to awk in - scripts/ld-version.sh - -On some systems /usr/bin/awk does not exist, or is broken. Find it via -$PATH instead. - -Signed-off-by: Felix Fietkau ---- - scripts/ld-version.sh | 4 +++- - 1 file changed, 3 insertions(+), 1 deletion(-) - ---- a/scripts/ld-version.sh -+++ b/scripts/ld-version.sh -@@ -1,5 +1,6 @@ --#!/usr/bin/awk -f -+#!/bin/sh - # extract linker version number from stdin and turn into single number -+exec awk ' - { - gsub(".*\\)", ""); - gsub(".*version ", ""); -@@ -8,3 +9,4 @@ - print a[1]*100000000 + a[2]*1000000 + a[3]*10000; - exit - } -+' diff --git a/target/linux/generic/backport-4.9/011-kbuild-export-SUBARCH.patch b/target/linux/generic/backport-4.9/011-kbuild-export-SUBARCH.patch deleted file mode 100644 index d937c83f33..0000000000 --- a/target/linux/generic/backport-4.9/011-kbuild-export-SUBARCH.patch +++ /dev/null @@ -1,23 +0,0 @@ -From 173019b66dcc9d68ad9333aa744dad1e369b5aa8 Mon Sep 17 00:00:00 2001 -From: Felix Fietkau -Date: Sun, 9 Jul 2017 00:26:53 +0200 -Subject: [PATCH 34/34] kernel: add compile fix for linux 4.9 on x86 - -Signed-off-by: Felix Fietkau ---- - Makefile | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - ---- a/Makefile -+++ b/Makefile -@@ -411,8 +411,8 @@ KERNELRELEASE = $(shell cat include/conf - KERNELVERSION = $(VERSION)$(if $(PATCHLEVEL),.$(PATCHLEVEL)$(if $(SUBLEVEL),.$(SUBLEVEL)))$(EXTRAVERSION) - - export VERSION PATCHLEVEL SUBLEVEL KERNELRELEASE KERNELVERSION --export ARCH SRCARCH CONFIG_SHELL HOSTCC HOSTCFLAGS CROSS_COMPILE AS LD CC --export CPP AR NM STRIP OBJCOPY OBJDUMP -+export ARCH SRCARCH SUBARCH CONFIG_SHELL HOSTCC HOSTCFLAGS CROSS_COMPILE AS LD -+export CC CPP AR NM STRIP OBJCOPY OBJDUMP - export MAKE AWK GENKSYMS INSTALLKERNEL PERL PYTHON UTS_MACHINE - export HOSTCXX HOSTCXXFLAGS LDFLAGS_MODULE CHECK CHECKFLAGS - diff --git a/target/linux/generic/backport-4.9/012-kbuild-add-macro-for-controlling-warnings-to-linux-c.patch b/target/linux/generic/backport-4.9/012-kbuild-add-macro-for-controlling-warnings-to-linux-c.patch deleted file mode 100644 index 4b22ca0e3f..0000000000 --- a/target/linux/generic/backport-4.9/012-kbuild-add-macro-for-controlling-warnings-to-linux-c.patch +++ /dev/null @@ -1,143 +0,0 @@ -From: Arnd Bergmann -Date: Tue, 19 Jun 2018 13:14:56 -0700 -Subject: [PATCH] kbuild: add macro for controlling warnings to - linux/compiler.h - -I have occasionally run into a situation where it would make sense to -control a compiler warning from a source file rather than doing so from -a Makefile using the $(cc-disable-warning, ...) or $(cc-option, ...) -helpers. - -The approach here is similar to what glibc uses, using __diag() and -related macros to encapsulate a _Pragma("GCC diagnostic ...") statement -that gets turned into the respective "#pragma GCC diagnostic ..." by -the preprocessor when the macro gets expanded. - -Like glibc, I also have an argument to pass the affected compiler -version, but decided to actually evaluate that one. For now, this -supports GCC_4_6, GCC_4_7, GCC_4_8, GCC_4_9, GCC_5, GCC_6, GCC_7, -GCC_8 and GCC_9. Adding support for CLANG_5 and other interesting -versions is straightforward here. GNU compilers starting with gcc-4.2 -could support it in principle, but "#pragma GCC diagnostic push" -was only added in gcc-4.6, so it seems simpler to not deal with those -at all. The same versions show a large number of warnings already, -so it seems easier to just leave it at that and not do a more -fine-grained control for them. - -The use cases I found so far include: - -- turning off the gcc-8 -Wattribute-alias warning inside of the - SYSCALL_DEFINEx() macro without having to do it globally. - -- Reducing the build time for a simple re-make after a change, - once we move the warnings from ./Makefile and - ./scripts/Makefile.extrawarn into linux/compiler.h - -- More control over the warnings based on other configurations, - using preprocessor syntax instead of Makefile syntax. This should make - it easier for the average developer to understand and change things. - -- Adding an easy way to turn the W=1 option on unconditionally - for a subdirectory or a specific file. This has been requested - by several developers in the past that want to have their subsystems - W=1 clean. - -- Integrating clang better into the build systems. Clang supports - more warnings than GCC, and we probably want to classify them - as default, W=1, W=2 etc, but there are cases in which the - warnings should be classified differently due to excessive false - positives from one or the other compiler. - -- Adding a way to turn the default warnings into errors (e.g. using - a new "make E=0" tag) while not also turning the W=1 warnings into - errors. - -This patch for now just adds the minimal infrastructure in order to -do the first of the list above. As the #pragma GCC diagnostic -takes precedence over command line options, the next step would be -to convert a lot of the individual Makefiles that set nonstandard -options to use __diag() instead. - -[paul.burton@mips.com: - - Rebase atop current master. - - Add __diag_GCC, or more generally __diag_, abstraction to - avoid code outside of linux/compiler-gcc.h needing to duplicate - knowledge about different GCC versions. - - Add a comment argument to __diag_{ignore,warn,error} which isn't - used in the expansion of the macros but serves to push people to - document the reason for using them - per feedback from Kees Cook. - - Translate severity to GCC-specific pragmas in linux/compiler-gcc.h - rather than using GCC-specific in linux/compiler_types.h. - - Drop all but GCC 8 macros, since we only need to define macros for - versions that we need to introduce pragmas for, and as of this - series that's just GCC 8. - - Capitalize comments in linux/compiler-gcc.h to match the style of - the rest of the file. - - Line up macro definitions with tabs in linux/compiler-gcc.h.] - -Signed-off-by: Arnd Bergmann -Signed-off-by: Paul Burton -Tested-by: Christophe Leroy -Tested-by: Stafford Horne -Signed-off-by: Masahiro Yamada ---- - ---- a/include/linux/compiler-gcc.h -+++ b/include/linux/compiler-gcc.h -@@ -338,3 +338,30 @@ - #if GCC_VERSION >= 50100 - #define COMPILER_HAS_GENERIC_BUILTIN_OVERFLOW 1 - #endif -+ -+ -+/* -+ * Turn individual warnings and errors on and off locally, depending -+ * on version. -+ */ -+#define __diag_GCC(version, severity, s) \ -+ __diag_GCC_ ## version(__diag_GCC_ ## severity s) -+ -+/* Severity used in pragma directives */ -+#define __diag_GCC_ignore ignored -+#define __diag_GCC_warn warning -+#define __diag_GCC_error error -+ -+/* Compilers before gcc-4.6 do not understand "#pragma GCC diagnostic push" */ -+#if GCC_VERSION >= 40600 -+#define __diag_str1(s) #s -+#define __diag_str(s) __diag_str1(s) -+#define __diag(s) _Pragma(__diag_str(GCC diagnostic s)) -+#endif -+ -+#if GCC_VERSION >= 80000 -+#define __diag_GCC_8(s) __diag(s) -+#else -+#define __diag_GCC_8(s) -+#endif -+ ---- a/include/linux/compiler.h -+++ b/include/linux/compiler.h -@@ -578,4 +578,23 @@ static __always_inline void __write_once - # define __kprobes - # define nokprobe_inline inline - #endif -+ -+#ifndef __diag -+#define __diag(string) -+#endif -+ -+#ifndef __diag_GCC -+#define __diag_GCC(version, severity, string) -+#endif -+ -+#define __diag_push() __diag(push) -+#define __diag_pop() __diag(pop) -+ -+#define __diag_ignore(compiler, version, option, comment) \ -+ __diag_ ## compiler(version, ignore, option) -+#define __diag_warn(compiler, version, option, comment) \ -+ __diag_ ## compiler(version, warn, option) -+#define __diag_error(compiler, version, option, comment) \ -+ __diag_ ## compiler(version, error, option) -+ - #endif /* __LINUX_COMPILER_H */ diff --git a/target/linux/generic/backport-4.9/013-disable-Wattribute-alias-warning-for-SYSCALL_DEFINEx.patch b/target/linux/generic/backport-4.9/013-disable-Wattribute-alias-warning-for-SYSCALL_DEFINEx.patch deleted file mode 100644 index fc2a26d7cd..0000000000 --- a/target/linux/generic/backport-4.9/013-disable-Wattribute-alias-warning-for-SYSCALL_DEFINEx.patch +++ /dev/null @@ -1,88 +0,0 @@ -From: Arnd Bergmann -Date: Tue, 19 Jun 2018 13:14:57 -0700 -Subject: [PATCH] disable -Wattribute-alias warning for SYSCALL_DEFINEx() - -gcc-8 warns for every single definition of a system call entry -point, e.g.: - -include/linux/compat.h:56:18: error: 'compat_sys_rt_sigprocmask' alias between functions of incompatible types 'long int(int, compat_sigset_t *, compat_sigset_t *, compat_size_t)' {aka 'long int(int, struct *, struct *, unsigned int)'} and 'long int(long int, long int, long int, long int)' [-Werror=attribute-alias] - asmlinkage long compat_sys##name(__MAP(x,__SC_DECL,__VA_ARGS__))\ - ^~~~~~~~~~ -include/linux/compat.h:45:2: note: in expansion of macro 'COMPAT_SYSCALL_DEFINEx' - COMPAT_SYSCALL_DEFINEx(4, _##name, __VA_ARGS__) - ^~~~~~~~~~~~~~~~~~~~~~ -kernel/signal.c:2601:1: note: in expansion of macro 'COMPAT_SYSCALL_DEFINE4' - COMPAT_SYSCALL_DEFINE4(rt_sigprocmask, int, how, compat_sigset_t __user *, nset, - ^~~~~~~~~~~~~~~~~~~~~~ -include/linux/compat.h:60:18: note: aliased declaration here - asmlinkage long compat_SyS##name(__MAP(x,__SC_LONG,__VA_ARGS__))\ - ^~~~~~~~~~ - -The new warning seems reasonable in principle, but it doesn't -help us here, since we rely on the type mismatch to sanitize the -system call arguments. After I reported this as GCC PR82435, a new --Wno-attribute-alias option was added that could be used to turn the -warning off globally on the command line, but I'd prefer to do it a -little more fine-grained. - -Interestingly, turning a warning off and on again inside of -a single macro doesn't always work, in this case I had to add -an extra statement inbetween and decided to copy the __SC_TEST -one from the native syscall to the compat syscall macro. See -https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83256 for more details -about this. - -[paul.burton@mips.com: - - Rebase atop current master. - - Split GCC & version arguments to __diag_ignore() in order to match - changes to the preceding patch. - - Add the comment argument to match the preceding patch.] - -Link: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82435 -Signed-off-by: Arnd Bergmann -Signed-off-by: Paul Burton -Tested-by: Christophe Leroy -Tested-by: Stafford Horne -Signed-off-by: Masahiro Yamada ---- - ---- a/include/linux/compat.h -+++ b/include/linux/compat.h -@@ -47,6 +47,9 @@ - COMPAT_SYSCALL_DEFINEx(6, _##name, __VA_ARGS__) - - #define COMPAT_SYSCALL_DEFINEx(x, name, ...) \ -+ __diag_push(); \ -+ __diag_ignore(GCC, 8, "-Wattribute-alias", \ -+ "Type aliasing is used to sanitize syscall arguments");\ - asmlinkage long compat_sys##name(__MAP(x,__SC_DECL,__VA_ARGS__))\ - __attribute__((alias(__stringify(compat_SyS##name)))); \ - static inline long C_SYSC##name(__MAP(x,__SC_DECL,__VA_ARGS__));\ -@@ -55,6 +58,7 @@ - { \ - return C_SYSC##name(__MAP(x,__SC_DELOUSE,__VA_ARGS__)); \ - } \ -+ __diag_pop(); \ - static inline long C_SYSC##name(__MAP(x,__SC_DECL,__VA_ARGS__)) - - #ifndef compat_user_stack_pointer ---- a/include/linux/syscalls.h -+++ b/include/linux/syscalls.h -@@ -192,6 +192,9 @@ extern struct trace_event_functions exit - - #define __PROTECT(...) asmlinkage_protect(__VA_ARGS__) - #define __SYSCALL_DEFINEx(x, name, ...) \ -+ __diag_push(); \ -+ __diag_ignore(GCC, 8, "-Wattribute-alias", \ -+ "Type aliasing is used to sanitize syscall arguments");\ - asmlinkage long sys##name(__MAP(x,__SC_DECL,__VA_ARGS__)) \ - __attribute__((alias(__stringify(SyS##name)))); \ - static inline long SYSC##name(__MAP(x,__SC_DECL,__VA_ARGS__)); \ -@@ -203,6 +206,7 @@ extern struct trace_event_functions exit - __PROTECT(x, ret,__MAP(x,__SC_ARGS,__VA_ARGS__)); \ - return ret; \ - } \ -+ __diag_pop(); \ - static inline long SYSC##name(__MAP(x,__SC_DECL,__VA_ARGS__)) - - asmlinkage long sys32_quotactl(unsigned int cmd, const char __user *special, diff --git a/target/linux/generic/backport-4.9/020-backport_netfilter_rtcache.patch b/target/linux/generic/backport-4.9/020-backport_netfilter_rtcache.patch deleted file mode 100644 index e7c9b4c702..0000000000 --- a/target/linux/generic/backport-4.9/020-backport_netfilter_rtcache.patch +++ /dev/null @@ -1,543 +0,0 @@ -From c4d66e57455f5384128753674cc0f9e02db5e1f6 Mon Sep 17 00:00:00 2001 -From: Florian Westphal -Date: Sun, 9 Jul 2017 08:58:30 +0200 -Subject: [PATCH] netfilter: conntrack: cache route for forwarded connections - -... to avoid per-packet FIB lookup if possible. - -The cached dst is re-used provided the input interface -is the same as that of the previous packet in the same direction. - -If not, the cached dst is invalidated. - -For ipv6 we also need to store sernum, else dst_check doesn't work, -pointed out by Eric Dumazet. - -This should speed up forwarding when conntrack is already in use -anyway, especially when using reverse path filtering -- active RPF -enforces two FIB lookups for each packet. - -Before the routing cache removal this didn't matter since RPF was performed -only when route cache didn't yield a result; but without route cache it -comes at higher price. - -Julian Anastasov suggested to add NETDEV_UNREGISTER handler to -avoid holding on to dsts of 'frozen' conntracks. - -Signed-off-by: Florian Westphal ---- - include/net/netfilter/nf_conntrack_extend.h | 4 + - include/net/netfilter/nf_conntrack_rtcache.h | 34 +++ - net/netfilter/Kconfig | 12 + - net/netfilter/Makefile | 3 + - net/netfilter/nf_conntrack_rtcache.c | 413 +++++++++++++++++++++++++++ - 5 files changed, 466 insertions(+) - create mode 100644 include/net/netfilter/nf_conntrack_rtcache.h - create mode 100644 net/netfilter/nf_conntrack_rtcache.c - ---- a/include/net/netfilter/nf_conntrack_extend.h -+++ b/include/net/netfilter/nf_conntrack_extend.h -@@ -27,6 +27,9 @@ enum nf_ct_ext_id { - #if IS_ENABLED(CONFIG_NETFILTER_SYNPROXY) - NF_CT_EXT_SYNPROXY, - #endif -+#if IS_ENABLED(CONFIG_NF_CONNTRACK_RTCACHE) -+ NF_CT_EXT_RTCACHE, -+#endif - NF_CT_EXT_NUM, - }; - -@@ -39,6 +42,7 @@ enum nf_ct_ext_id { - #define NF_CT_EXT_TIMEOUT_TYPE struct nf_conn_timeout - #define NF_CT_EXT_LABELS_TYPE struct nf_conn_labels - #define NF_CT_EXT_SYNPROXY_TYPE struct nf_conn_synproxy -+#define NF_CT_EXT_RTCACHE_TYPE struct nf_conn_rtcache - - /* Extensions: optional stuff which isn't permanently in struct. */ - struct nf_ct_ext { ---- /dev/null -+++ b/include/net/netfilter/nf_conntrack_rtcache.h -@@ -0,0 +1,34 @@ -+#include -+#include -+#include -+ -+struct dst_entry; -+ -+struct nf_conn_dst_cache { -+ struct dst_entry *dst; -+ int iif; -+#if IS_ENABLED(CONFIG_NF_CONNTRACK_IPV6) -+ u32 cookie; -+#endif -+ -+}; -+ -+struct nf_conn_rtcache { -+ struct nf_conn_dst_cache cached_dst[IP_CT_DIR_MAX]; -+}; -+ -+static inline -+struct nf_conn_rtcache *nf_ct_rtcache_find(const struct nf_conn *ct) -+{ -+#if IS_ENABLED(CONFIG_NF_CONNTRACK_RTCACHE) -+ return nf_ct_ext_find(ct, NF_CT_EXT_RTCACHE); -+#else -+ return NULL; -+#endif -+} -+ -+static inline int nf_conn_rtcache_iif_get(const struct nf_conn_rtcache *rtc, -+ enum ip_conntrack_dir dir) -+{ -+ return rtc->cached_dst[dir].iif; -+} ---- a/net/netfilter/Kconfig -+++ b/net/netfilter/Kconfig -@@ -114,6 +114,18 @@ config NF_CONNTRACK_EVENTS - - If unsure, say `N'. - -+config NF_CONNTRACK_RTCACHE -+ tristate "Cache route entries in conntrack objects" -+ depends on NETFILTER_ADVANCED -+ depends on NF_CONNTRACK -+ help -+ If this option is enabled, the connection tracking code will -+ cache routing information for each connection that is being -+ forwarded, at a cost of 32 bytes per conntrack object. -+ -+ To compile it as a module, choose M here. If unsure, say N. -+ The module will be called nf_conntrack_rtcache. -+ - config NF_CONNTRACK_TIMEOUT - bool 'Connection tracking timeout' - depends on NETFILTER_ADVANCED ---- a/net/netfilter/Makefile -+++ b/net/netfilter/Makefile -@@ -16,6 +16,9 @@ obj-$(CONFIG_NETFILTER_NETLINK_LOG) += n - # connection tracking - obj-$(CONFIG_NF_CONNTRACK) += nf_conntrack.o - -+# optional conntrack route cache extension -+obj-$(CONFIG_NF_CONNTRACK_RTCACHE) += nf_conntrack_rtcache.o -+ - # SCTP protocol connection tracking - obj-$(CONFIG_NF_CT_PROTO_DCCP) += nf_conntrack_proto_dccp.o - obj-$(CONFIG_NF_CT_PROTO_GRE) += nf_conntrack_proto_gre.o ---- /dev/null -+++ b/net/netfilter/nf_conntrack_rtcache.c -@@ -0,0 +1,413 @@ -+/* route cache for netfilter. -+ * -+ * (C) 2014 Red Hat GmbH -+ * -+ * 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 -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+#include -+ -+#include -+#include -+#include -+#include -+ -+#if IS_ENABLED(CONFIG_NF_CONNTRACK_IPV6) -+#include -+#endif -+ -+static void __nf_conn_rtcache_destroy(struct nf_conn_rtcache *rtc, -+ enum ip_conntrack_dir dir) -+{ -+ struct dst_entry *dst = rtc->cached_dst[dir].dst; -+ -+ dst_release(dst); -+} -+ -+static void nf_conn_rtcache_destroy(struct nf_conn *ct) -+{ -+ struct nf_conn_rtcache *rtc = nf_ct_rtcache_find(ct); -+ -+ if (!rtc) -+ return; -+ -+ __nf_conn_rtcache_destroy(rtc, IP_CT_DIR_ORIGINAL); -+ __nf_conn_rtcache_destroy(rtc, IP_CT_DIR_REPLY); -+} -+ -+static void nf_ct_rtcache_ext_add(struct nf_conn *ct) -+{ -+ struct nf_conn_rtcache *rtc; -+ -+ rtc = nf_ct_ext_add(ct, NF_CT_EXT_RTCACHE, GFP_ATOMIC); -+ if (rtc) { -+ rtc->cached_dst[IP_CT_DIR_ORIGINAL].iif = -1; -+ rtc->cached_dst[IP_CT_DIR_ORIGINAL].dst = NULL; -+ rtc->cached_dst[IP_CT_DIR_REPLY].iif = -1; -+ rtc->cached_dst[IP_CT_DIR_REPLY].dst = NULL; -+ } -+} -+ -+static struct nf_conn_rtcache *nf_ct_rtcache_find_usable(struct nf_conn *ct) -+{ -+ if (nf_ct_is_untracked(ct)) -+ return NULL; -+ return nf_ct_rtcache_find(ct); -+} -+ -+static struct dst_entry * -+nf_conn_rtcache_dst_get(const struct nf_conn_rtcache *rtc, -+ enum ip_conntrack_dir dir) -+{ -+ return rtc->cached_dst[dir].dst; -+} -+ -+static u32 nf_rtcache_get_cookie(int pf, const struct dst_entry *dst) -+{ -+#if IS_ENABLED(CONFIG_NF_CONNTRACK_IPV6) -+ if (pf == NFPROTO_IPV6) { -+ const struct rt6_info *rt = (const struct rt6_info *)dst; -+ -+ if (rt->rt6i_node) -+ return (u32)rt->rt6i_node->fn_sernum; -+ } -+#endif -+ return 0; -+} -+ -+static void nf_conn_rtcache_dst_set(int pf, -+ struct nf_conn_rtcache *rtc, -+ struct dst_entry *dst, -+ enum ip_conntrack_dir dir, int iif) -+{ -+ if (rtc->cached_dst[dir].iif != iif) -+ rtc->cached_dst[dir].iif = iif; -+ -+ if (rtc->cached_dst[dir].dst != dst) { -+ struct dst_entry *old; -+ -+ dst_hold(dst); -+ -+ old = xchg(&rtc->cached_dst[dir].dst, dst); -+ dst_release(old); -+ -+#if IS_ENABLED(CONFIG_NF_CONNTRACK_IPV6) -+ if (pf == NFPROTO_IPV6) -+ rtc->cached_dst[dir].cookie = -+ nf_rtcache_get_cookie(pf, dst); -+#endif -+ } -+} -+ -+static void nf_conn_rtcache_dst_obsolete(struct nf_conn_rtcache *rtc, -+ enum ip_conntrack_dir dir) -+{ -+ struct dst_entry *old; -+ -+ pr_debug("Invalidate iif %d for dir %d on cache %p\n", -+ rtc->cached_dst[dir].iif, dir, rtc); -+ -+ old = xchg(&rtc->cached_dst[dir].dst, NULL); -+ dst_release(old); -+ rtc->cached_dst[dir].iif = -1; -+} -+ -+static unsigned int nf_rtcache_in(u_int8_t pf, -+ struct sk_buff *skb, -+ const struct nf_hook_state *state) -+{ -+ struct nf_conn_rtcache *rtc; -+ enum ip_conntrack_info ctinfo; -+ enum ip_conntrack_dir dir; -+ struct dst_entry *dst; -+ struct nf_conn *ct; -+ int iif; -+ u32 cookie; -+ -+ if (skb_dst(skb) || skb->sk) -+ return NF_ACCEPT; -+ -+ ct = nf_ct_get(skb, &ctinfo); -+ if (!ct) -+ return NF_ACCEPT; -+ -+ rtc = nf_ct_rtcache_find_usable(ct); -+ if (!rtc) -+ return NF_ACCEPT; -+ -+ /* if iif changes, don't use cache and let ip stack -+ * do route lookup. -+ * -+ * If rp_filter is enabled it might toss skb, so -+ * we don't want to avoid these checks. -+ */ -+ dir = CTINFO2DIR(ctinfo); -+ iif = nf_conn_rtcache_iif_get(rtc, dir); -+ if (state->in->ifindex != iif) { -+ pr_debug("ct %p, iif %d, cached iif %d, skip cached entry\n", -+ ct, iif, state->in->ifindex); -+ return NF_ACCEPT; -+ } -+ dst = nf_conn_rtcache_dst_get(rtc, dir); -+ if (dst == NULL) -+ return NF_ACCEPT; -+ -+ cookie = nf_rtcache_get_cookie(pf, dst); -+ -+ dst = dst_check(dst, cookie); -+ pr_debug("obtained dst %p for skb %p, cookie %d\n", dst, skb, cookie); -+ if (likely(dst)) -+ skb_dst_set_noref(skb, dst); -+ else -+ nf_conn_rtcache_dst_obsolete(rtc, dir); -+ -+ return NF_ACCEPT; -+} -+ -+static unsigned int nf_rtcache_forward(u_int8_t pf, -+ struct sk_buff *skb, -+ const struct nf_hook_state *state) -+{ -+ struct nf_conn_rtcache *rtc; -+ enum ip_conntrack_info ctinfo; -+ enum ip_conntrack_dir dir; -+ struct nf_conn *ct; -+ struct dst_entry *dst = skb_dst(skb); -+ int iif; -+ -+ ct = nf_ct_get(skb, &ctinfo); -+ if (!ct) -+ return NF_ACCEPT; -+ -+ if (dst && dst_xfrm(dst)) -+ return NF_ACCEPT; -+ -+ if (!nf_ct_is_confirmed(ct)) { -+ if (WARN_ON(nf_ct_rtcache_find(ct))) -+ return NF_ACCEPT; -+ nf_ct_rtcache_ext_add(ct); -+ return NF_ACCEPT; -+ } -+ -+ rtc = nf_ct_rtcache_find_usable(ct); -+ if (!rtc) -+ return NF_ACCEPT; -+ -+ dir = CTINFO2DIR(ctinfo); -+ iif = nf_conn_rtcache_iif_get(rtc, dir); -+ pr_debug("ct %p, skb %p, dir %d, iif %d, cached iif %d\n", -+ ct, skb, dir, iif, state->in->ifindex); -+ if (likely(state->in->ifindex == iif)) -+ return NF_ACCEPT; -+ -+ nf_conn_rtcache_dst_set(pf, rtc, skb_dst(skb), dir, state->in->ifindex); -+ return NF_ACCEPT; -+} -+ -+static unsigned int nf_rtcache_in4(void *priv, -+ struct sk_buff *skb, -+ const struct nf_hook_state *state) -+{ -+ return nf_rtcache_in(NFPROTO_IPV4, skb, state); -+} -+ -+static unsigned int nf_rtcache_forward4(void *priv, -+ struct sk_buff *skb, -+ const struct nf_hook_state *state) -+{ -+ return nf_rtcache_forward(NFPROTO_IPV4, skb, state); -+} -+ -+#if IS_ENABLED(CONFIG_NF_CONNTRACK_IPV6) -+static unsigned int nf_rtcache_in6(void *priv, -+ struct sk_buff *skb, -+ const struct nf_hook_state *state) -+{ -+ return nf_rtcache_in(NFPROTO_IPV6, skb, state); -+} -+ -+static unsigned int nf_rtcache_forward6(void *priv, -+ struct sk_buff *skb, -+ const struct nf_hook_state *state) -+{ -+ return nf_rtcache_forward(NFPROTO_IPV6, skb, state); -+} -+#endif -+ -+static int nf_rtcache_dst_remove(struct nf_conn *ct, void *data) -+{ -+ struct nf_conn_rtcache *rtc = nf_ct_rtcache_find(ct); -+ struct net_device *dev = data; -+ -+ if (!rtc) -+ return 0; -+ -+ if (dev->ifindex == rtc->cached_dst[IP_CT_DIR_ORIGINAL].iif || -+ dev->ifindex == rtc->cached_dst[IP_CT_DIR_REPLY].iif) { -+ nf_conn_rtcache_dst_obsolete(rtc, IP_CT_DIR_ORIGINAL); -+ nf_conn_rtcache_dst_obsolete(rtc, IP_CT_DIR_REPLY); -+ } -+ -+ return 0; -+} -+ -+static int nf_rtcache_netdev_event(struct notifier_block *this, -+ unsigned long event, void *ptr) -+{ -+ struct net_device *dev = netdev_notifier_info_to_dev(ptr); -+ struct net *net = dev_net(dev); -+ -+ if (event == NETDEV_DOWN) -+ nf_ct_iterate_cleanup(net, nf_rtcache_dst_remove, dev, 0, 0); -+ -+ return NOTIFY_DONE; -+} -+ -+static struct notifier_block nf_rtcache_notifier = { -+ .notifier_call = nf_rtcache_netdev_event, -+}; -+ -+static struct nf_hook_ops rtcache_ops[] = { -+ { -+ .hook = nf_rtcache_in4, -+ .pf = NFPROTO_IPV4, -+ .hooknum = NF_INET_PRE_ROUTING, -+ .priority = NF_IP_PRI_LAST, -+ }, -+ { -+ .hook = nf_rtcache_forward4, -+ .pf = NFPROTO_IPV4, -+ .hooknum = NF_INET_FORWARD, -+ .priority = NF_IP_PRI_LAST, -+ }, -+#if IS_ENABLED(CONFIG_NF_CONNTRACK_IPV6) -+ { -+ .hook = nf_rtcache_in6, -+ .pf = NFPROTO_IPV6, -+ .hooknum = NF_INET_PRE_ROUTING, -+ .priority = NF_IP_PRI_LAST, -+ }, -+ { -+ .hook = nf_rtcache_forward6, -+ .pf = NFPROTO_IPV6, -+ .hooknum = NF_INET_FORWARD, -+ .priority = NF_IP_PRI_LAST, -+ }, -+#endif -+}; -+ -+static struct nf_ct_ext_type rtcache_extend __read_mostly = { -+ .len = sizeof(struct nf_conn_rtcache), -+ .align = __alignof__(struct nf_conn_rtcache), -+ .id = NF_CT_EXT_RTCACHE, -+ .destroy = nf_conn_rtcache_destroy, -+}; -+ -+static int __init nf_conntrack_rtcache_init(void) -+{ -+ int ret = nf_ct_extend_register(&rtcache_extend); -+ -+ if (ret < 0) { -+ pr_err("nf_conntrack_rtcache: Unable to register extension\n"); -+ return ret; -+ } -+ -+ ret = nf_register_hooks(rtcache_ops, ARRAY_SIZE(rtcache_ops)); -+ if (ret < 0) { -+ nf_ct_extend_unregister(&rtcache_extend); -+ return ret; -+ } -+ -+ ret = register_netdevice_notifier(&nf_rtcache_notifier); -+ if (ret) { -+ nf_unregister_hooks(rtcache_ops, ARRAY_SIZE(rtcache_ops)); -+ nf_ct_extend_unregister(&rtcache_extend); -+ } -+ -+ return ret; -+} -+ -+static int nf_rtcache_ext_remove(struct nf_conn *ct, void *data) -+{ -+ struct nf_conn_rtcache *rtc = nf_ct_rtcache_find(ct); -+ -+ return rtc != NULL; -+} -+ -+static bool __exit nf_conntrack_rtcache_wait_for_dying(struct net *net) -+{ -+ bool wait = false; -+ int cpu; -+ -+ for_each_possible_cpu(cpu) { -+ struct nf_conntrack_tuple_hash *h; -+ struct hlist_nulls_node *n; -+ struct nf_conn *ct; -+ struct ct_pcpu *pcpu = per_cpu_ptr(net->ct.pcpu_lists, cpu); -+ -+ rcu_read_lock(); -+ spin_lock_bh(&pcpu->lock); -+ -+ hlist_nulls_for_each_entry(h, n, &pcpu->dying, hnnode) { -+ ct = nf_ct_tuplehash_to_ctrack(h); -+ if (nf_ct_rtcache_find(ct) != NULL) { -+ wait = true; -+ break; -+ } -+ } -+ spin_unlock_bh(&pcpu->lock); -+ rcu_read_unlock(); -+ } -+ -+ return wait; -+} -+ -+static void __exit nf_conntrack_rtcache_fini(void) -+{ -+ struct net *net; -+ int count = 0; -+ -+ /* remove hooks so no new connections get rtcache extension */ -+ nf_unregister_hooks(rtcache_ops, ARRAY_SIZE(rtcache_ops)); -+ -+ synchronize_net(); -+ -+ unregister_netdevice_notifier(&nf_rtcache_notifier); -+ -+ rtnl_lock(); -+ -+ /* zap all conntracks with rtcache extension */ -+ for_each_net(net) -+ nf_ct_iterate_cleanup(net, nf_rtcache_ext_remove, NULL, 0, 0); -+ -+ for_each_net(net) { -+ /* .. and make sure they're gone from dying list, too */ -+ while (nf_conntrack_rtcache_wait_for_dying(net)) { -+ msleep(200); -+ WARN_ONCE(++count > 25, "Waiting for all rtcache conntracks to go away\n"); -+ } -+ } -+ -+ rtnl_unlock(); -+ synchronize_net(); -+ nf_ct_extend_unregister(&rtcache_extend); -+} -+module_init(nf_conntrack_rtcache_init); -+module_exit(nf_conntrack_rtcache_fini); -+ -+MODULE_LICENSE("GPL"); -+MODULE_AUTHOR("Florian Westphal "); -+MODULE_DESCRIPTION("Conntrack route cache extension"); diff --git a/target/linux/generic/backport-4.9/021-bridge-multicast-to-unicast.patch b/target/linux/generic/backport-4.9/021-bridge-multicast-to-unicast.patch deleted file mode 100644 index 4b7e8ba75a..0000000000 --- a/target/linux/generic/backport-4.9/021-bridge-multicast-to-unicast.patch +++ /dev/null @@ -1,499 +0,0 @@ -From: Felix Fietkau -Date: Thu, 19 Jan 2017 03:45:10 +0100 -Subject: [PATCH] bridge: multicast to unicast -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Implements an optional, per bridge port flag and feature to deliver -multicast packets to any host on the according port via unicast -individually. This is done by copying the packet per host and -changing the multicast destination MAC to a unicast one accordingly. - -multicast-to-unicast works on top of the multicast snooping feature of -the bridge. Which means unicast copies are only delivered to hosts which -are interested in it and signalized this via IGMP/MLD reports -previously. - -This feature is intended for interface types which have a more reliable -and/or efficient way to deliver unicast packets than broadcast ones -(e.g. wifi). - -However, it should only be enabled on interfaces where no IGMPv2/MLDv1 -report suppression takes place. This feature is disabled by default. - -The initial patch and idea is from Felix Fietkau. - -Signed-off-by: Felix Fietkau -[linus.luessing@c0d3.blue: various bug + style fixes, commit message] -Signed-off-by: Linus Lüssing ---- - ---- a/include/linux/if_bridge.h -+++ b/include/linux/if_bridge.h -@@ -46,6 +46,7 @@ struct br_ip_list { - #define BR_LEARNING_SYNC BIT(9) - #define BR_PROXYARP_WIFI BIT(10) - #define BR_MCAST_FLOOD BIT(11) -+#define BR_MULTICAST_TO_UNICAST BIT(12) - - #define BR_DEFAULT_AGEING_TIME (300 * HZ) - ---- a/include/uapi/linux/if_link.h -+++ b/include/uapi/linux/if_link.h -@@ -319,6 +319,7 @@ enum { - IFLA_BRPORT_MULTICAST_ROUTER, - IFLA_BRPORT_PAD, - IFLA_BRPORT_MCAST_FLOOD, -+ IFLA_BRPORT_MCAST_TO_UCAST, - __IFLA_BRPORT_MAX - }; - #define IFLA_BRPORT_MAX (__IFLA_BRPORT_MAX - 1) ---- a/net/bridge/br_forward.c -+++ b/net/bridge/br_forward.c -@@ -173,6 +173,29 @@ out: - return p; - } - -+static void maybe_deliver_addr(struct net_bridge_port *p, struct sk_buff *skb, -+ const unsigned char *addr, bool local_orig) -+{ -+ struct net_device *dev = BR_INPUT_SKB_CB(skb)->brdev; -+ const unsigned char *src = eth_hdr(skb)->h_source; -+ -+ if (!should_deliver(p, skb)) -+ return; -+ -+ /* Even with hairpin, no soliloquies - prevent breaking IPv6 DAD */ -+ if (skb->dev == p->dev && ether_addr_equal(src, addr)) -+ return; -+ -+ skb = skb_copy(skb, GFP_ATOMIC); -+ if (!skb) { -+ dev->stats.tx_dropped++; -+ return; -+ } -+ -+ memcpy(eth_hdr(skb)->h_dest, addr, ETH_ALEN); -+ __br_forward(p, skb, local_orig); -+} -+ - /* called under rcu_read_lock */ - void br_flood(struct net_bridge *br, struct sk_buff *skb, - enum br_pkt_type pkt_type, bool local_rcv, bool local_orig) -@@ -241,10 +264,20 @@ void br_multicast_flood(struct net_bridg - rport = rp ? hlist_entry(rp, struct net_bridge_port, rlist) : - NULL; - -- port = (unsigned long)lport > (unsigned long)rport ? -- lport : rport; -+ if ((unsigned long)lport > (unsigned long)rport) { -+ port = lport; -+ -+ if (p->flags & MDB_PG_FLAGS_MCAST_TO_UCAST) { -+ maybe_deliver_addr(lport, skb, p->eth_addr, -+ local_orig); -+ goto delivered; -+ } -+ } else { -+ port = rport; -+ } - - prev = maybe_deliver(prev, port, skb, local_orig); -+delivered: - if (IS_ERR(prev)) - goto out; - if (prev == port) ---- a/net/bridge/br_mdb.c -+++ b/net/bridge/br_mdb.c -@@ -532,7 +532,7 @@ static int br_mdb_add_group(struct net_b - break; - } - -- p = br_multicast_new_port_group(port, group, *pp, state); -+ p = br_multicast_new_port_group(port, group, *pp, state, NULL); - if (unlikely(!p)) - return -ENOMEM; - rcu_assign_pointer(*pp, p); ---- a/net/bridge/br_multicast.c -+++ b/net/bridge/br_multicast.c -@@ -42,12 +42,14 @@ static void br_multicast_add_router(stru - static void br_ip4_multicast_leave_group(struct net_bridge *br, - struct net_bridge_port *port, - __be32 group, -- __u16 vid); -+ __u16 vid, -+ const unsigned char *src); -+ - #if IS_ENABLED(CONFIG_IPV6) - static void br_ip6_multicast_leave_group(struct net_bridge *br, - struct net_bridge_port *port, - const struct in6_addr *group, -- __u16 vid); -+ __u16 vid, const unsigned char *src); - #endif - unsigned int br_mdb_rehash_seq; - -@@ -658,7 +660,8 @@ struct net_bridge_port_group *br_multica - struct net_bridge_port *port, - struct br_ip *group, - struct net_bridge_port_group __rcu *next, -- unsigned char flags) -+ unsigned char flags, -+ const unsigned char *src) - { - struct net_bridge_port_group *p; - -@@ -673,12 +676,39 @@ struct net_bridge_port_group *br_multica - hlist_add_head(&p->mglist, &port->mglist); - setup_timer(&p->timer, br_multicast_port_group_expired, - (unsigned long)p); -+ -+ if ((port->flags & BR_MULTICAST_TO_UNICAST) && src) { -+ memcpy(p->eth_addr, src, ETH_ALEN); -+ p->flags |= MDB_PG_FLAGS_MCAST_TO_UCAST; -+ } -+ - return p; - } - -+static bool br_port_group_equal(struct net_bridge_port_group *p, -+ struct net_bridge_port *port, -+ const unsigned char *src) -+{ -+ if (p->port != port) -+ return false; -+ -+ if (!(p->flags & MDB_PG_FLAGS_MCAST_TO_UCAST) != -+ !(port->flags & BR_MULTICAST_TO_UNICAST)) -+ return false; -+ -+ if (!(p->flags & MDB_PG_FLAGS_MCAST_TO_UCAST)) -+ return true; -+ -+ if (!src) -+ return false; -+ -+ return ether_addr_equal(src, p->eth_addr); -+} -+ - static int br_multicast_add_group(struct net_bridge *br, - struct net_bridge_port *port, -- struct br_ip *group) -+ struct br_ip *group, -+ const unsigned char *src) - { - struct net_bridge_mdb_entry *mp; - struct net_bridge_port_group *p; -@@ -705,13 +735,13 @@ static int br_multicast_add_group(struct - for (pp = &mp->ports; - (p = mlock_dereference(*pp, br)) != NULL; - pp = &p->next) { -- if (p->port == port) -+ if (br_port_group_equal(p, port, src)) - goto found; - if ((unsigned long)p->port < (unsigned long)port) - break; - } - -- p = br_multicast_new_port_group(port, group, *pp, 0); -+ p = br_multicast_new_port_group(port, group, *pp, 0, src); - if (unlikely(!p)) - goto err; - rcu_assign_pointer(*pp, p); -@@ -730,7 +760,8 @@ err: - static int br_ip4_multicast_add_group(struct net_bridge *br, - struct net_bridge_port *port, - __be32 group, -- __u16 vid) -+ __u16 vid, -+ const unsigned char *src) - { - struct br_ip br_group; - -@@ -741,14 +772,15 @@ static int br_ip4_multicast_add_group(st - br_group.proto = htons(ETH_P_IP); - br_group.vid = vid; - -- return br_multicast_add_group(br, port, &br_group); -+ return br_multicast_add_group(br, port, &br_group, src); - } - - #if IS_ENABLED(CONFIG_IPV6) - static int br_ip6_multicast_add_group(struct net_bridge *br, - struct net_bridge_port *port, - const struct in6_addr *group, -- __u16 vid) -+ __u16 vid, -+ const unsigned char *src) - { - struct br_ip br_group; - -@@ -759,7 +791,7 @@ static int br_ip6_multicast_add_group(st - br_group.proto = htons(ETH_P_IPV6); - br_group.vid = vid; - -- return br_multicast_add_group(br, port, &br_group); -+ return br_multicast_add_group(br, port, &br_group, src); - } - #endif - -@@ -1028,6 +1060,7 @@ static int br_ip4_multicast_igmp3_report - struct sk_buff *skb, - u16 vid) - { -+ const unsigned char *src; - struct igmpv3_report *ih; - struct igmpv3_grec *grec; - int i; -@@ -1068,12 +1101,14 @@ static int br_ip4_multicast_igmp3_report - continue; - } - -+ src = eth_hdr(skb)->h_source; - if ((type == IGMPV3_CHANGE_TO_INCLUDE || - type == IGMPV3_MODE_IS_INCLUDE) && - ntohs(grec->grec_nsrcs) == 0) { -- br_ip4_multicast_leave_group(br, port, group, vid); -+ br_ip4_multicast_leave_group(br, port, group, vid, src); - } else { -- err = br_ip4_multicast_add_group(br, port, group, vid); -+ err = br_ip4_multicast_add_group(br, port, group, vid, -+ src); - if (err) - break; - } -@@ -1088,6 +1123,7 @@ static int br_ip6_multicast_mld2_report( - struct sk_buff *skb, - u16 vid) - { -+ const unsigned char *src = eth_hdr(skb)->h_source; - struct icmp6hdr *icmp6h; - struct mld2_grec *grec; - int i; -@@ -1139,10 +1175,11 @@ static int br_ip6_multicast_mld2_report( - grec->grec_type == MLD2_MODE_IS_INCLUDE) && - ntohs(*nsrcs) == 0) { - br_ip6_multicast_leave_group(br, port, &grec->grec_mca, -- vid); -+ vid, src); - } else { - err = br_ip6_multicast_add_group(br, port, -- &grec->grec_mca, vid); -+ &grec->grec_mca, vid, -+ src); - if (err) - break; - } -@@ -1465,7 +1502,8 @@ br_multicast_leave_group(struct net_brid - struct net_bridge_port *port, - struct br_ip *group, - struct bridge_mcast_other_query *other_query, -- struct bridge_mcast_own_query *own_query) -+ struct bridge_mcast_own_query *own_query, -+ const unsigned char *src) - { - struct net_bridge_mdb_htable *mdb; - struct net_bridge_mdb_entry *mp; -@@ -1489,7 +1527,7 @@ br_multicast_leave_group(struct net_brid - for (pp = &mp->ports; - (p = mlock_dereference(*pp, br)) != NULL; - pp = &p->next) { -- if (p->port != port) -+ if (!br_port_group_equal(p, port, src)) - continue; - - rcu_assign_pointer(*pp, p->next); -@@ -1520,7 +1558,7 @@ br_multicast_leave_group(struct net_brid - for (p = mlock_dereference(mp->ports, br); - p != NULL; - p = mlock_dereference(p->next, br)) { -- if (p->port != port) -+ if (!br_port_group_equal(p, port, src)) - continue; - - if (!hlist_unhashed(&p->mglist) && -@@ -1571,7 +1609,8 @@ out: - static void br_ip4_multicast_leave_group(struct net_bridge *br, - struct net_bridge_port *port, - __be32 group, -- __u16 vid) -+ __u16 vid, -+ const unsigned char *src) - { - struct br_ip br_group; - struct bridge_mcast_own_query *own_query; -@@ -1586,14 +1625,15 @@ static void br_ip4_multicast_leave_group - br_group.vid = vid; - - br_multicast_leave_group(br, port, &br_group, &br->ip4_other_query, -- own_query); -+ own_query, src); - } - - #if IS_ENABLED(CONFIG_IPV6) - static void br_ip6_multicast_leave_group(struct net_bridge *br, - struct net_bridge_port *port, - const struct in6_addr *group, -- __u16 vid) -+ __u16 vid, -+ const unsigned char *src) - { - struct br_ip br_group; - struct bridge_mcast_own_query *own_query; -@@ -1608,7 +1648,7 @@ static void br_ip6_multicast_leave_group - br_group.vid = vid; - - br_multicast_leave_group(br, port, &br_group, &br->ip6_other_query, -- own_query); -+ own_query, src); - } - #endif - -@@ -1651,6 +1691,7 @@ static int br_multicast_ipv4_rcv(struct - u16 vid) - { - struct sk_buff *skb_trimmed = NULL; -+ const unsigned char *src; - struct igmphdr *ih; - int err; - -@@ -1666,13 +1707,14 @@ static int br_multicast_ipv4_rcv(struct - } - - ih = igmp_hdr(skb); -+ src = eth_hdr(skb)->h_source; - BR_INPUT_SKB_CB(skb)->igmp = ih->type; - - switch (ih->type) { - case IGMP_HOST_MEMBERSHIP_REPORT: - case IGMPV2_HOST_MEMBERSHIP_REPORT: - BR_INPUT_SKB_CB(skb)->mrouters_only = 1; -- err = br_ip4_multicast_add_group(br, port, ih->group, vid); -+ err = br_ip4_multicast_add_group(br, port, ih->group, vid, src); - break; - case IGMPV3_HOST_MEMBERSHIP_REPORT: - err = br_ip4_multicast_igmp3_report(br, port, skb_trimmed, vid); -@@ -1681,7 +1723,7 @@ static int br_multicast_ipv4_rcv(struct - err = br_ip4_multicast_query(br, port, skb_trimmed, vid); - break; - case IGMP_HOST_LEAVE_MESSAGE: -- br_ip4_multicast_leave_group(br, port, ih->group, vid); -+ br_ip4_multicast_leave_group(br, port, ih->group, vid, src); - break; - } - -@@ -1701,6 +1743,7 @@ static int br_multicast_ipv6_rcv(struct - u16 vid) - { - struct sk_buff *skb_trimmed = NULL; -+ const unsigned char *src; - struct mld_msg *mld; - int err; - -@@ -1720,8 +1763,10 @@ static int br_multicast_ipv6_rcv(struct - - switch (mld->mld_type) { - case ICMPV6_MGM_REPORT: -+ src = eth_hdr(skb)->h_source; - BR_INPUT_SKB_CB(skb)->mrouters_only = 1; -- err = br_ip6_multicast_add_group(br, port, &mld->mld_mca, vid); -+ err = br_ip6_multicast_add_group(br, port, &mld->mld_mca, vid, -+ src); - break; - case ICMPV6_MLD2_REPORT: - err = br_ip6_multicast_mld2_report(br, port, skb_trimmed, vid); -@@ -1730,7 +1775,8 @@ static int br_multicast_ipv6_rcv(struct - err = br_ip6_multicast_query(br, port, skb_trimmed, vid); - break; - case ICMPV6_MGM_REDUCTION: -- br_ip6_multicast_leave_group(br, port, &mld->mld_mca, vid); -+ src = eth_hdr(skb)->h_source; -+ br_ip6_multicast_leave_group(br, port, &mld->mld_mca, vid, src); - break; - } - ---- a/net/bridge/br_netlink.c -+++ b/net/bridge/br_netlink.c -@@ -123,6 +123,7 @@ static inline size_t br_port_info_size(v - + nla_total_size(1) /* IFLA_BRPORT_GUARD */ - + nla_total_size(1) /* IFLA_BRPORT_PROTECT */ - + nla_total_size(1) /* IFLA_BRPORT_FAST_LEAVE */ -+ + nla_total_size(1) /* IFLA_BRPORT_MCAST_TO_UCAST */ - + nla_total_size(1) /* IFLA_BRPORT_LEARNING */ - + nla_total_size(1) /* IFLA_BRPORT_UNICAST_FLOOD */ - + nla_total_size(1) /* IFLA_BRPORT_PROXYARP */ -@@ -173,6 +174,8 @@ static int br_port_fill_attrs(struct sk_ - !!(p->flags & BR_ROOT_BLOCK)) || - nla_put_u8(skb, IFLA_BRPORT_FAST_LEAVE, - !!(p->flags & BR_MULTICAST_FAST_LEAVE)) || -+ nla_put_u8(skb, IFLA_BRPORT_MCAST_TO_UCAST, -+ !!(p->flags & BR_MULTICAST_TO_UNICAST)) || - nla_put_u8(skb, IFLA_BRPORT_LEARNING, !!(p->flags & BR_LEARNING)) || - nla_put_u8(skb, IFLA_BRPORT_UNICAST_FLOOD, - !!(p->flags & BR_FLOOD)) || -@@ -586,6 +589,7 @@ static const struct nla_policy br_port_p - [IFLA_BRPORT_PROXYARP] = { .type = NLA_U8 }, - [IFLA_BRPORT_PROXYARP_WIFI] = { .type = NLA_U8 }, - [IFLA_BRPORT_MULTICAST_ROUTER] = { .type = NLA_U8 }, -+ [IFLA_BRPORT_MCAST_TO_UCAST] = { .type = NLA_U8 }, - }; - - /* Change the state of the port and notify spanning tree */ -@@ -636,6 +640,7 @@ static int br_setport(struct net_bridge_ - br_set_port_flag(p, tb, IFLA_BRPORT_LEARNING, BR_LEARNING); - br_set_port_flag(p, tb, IFLA_BRPORT_UNICAST_FLOOD, BR_FLOOD); - br_set_port_flag(p, tb, IFLA_BRPORT_MCAST_FLOOD, BR_MCAST_FLOOD); -+ br_set_port_flag(p, tb, IFLA_BRPORT_MCAST_TO_UCAST, BR_MULTICAST_TO_UNICAST); - br_set_port_flag(p, tb, IFLA_BRPORT_PROXYARP, BR_PROXYARP); - br_set_port_flag(p, tb, IFLA_BRPORT_PROXYARP_WIFI, BR_PROXYARP_WIFI); - ---- a/net/bridge/br_private.h -+++ b/net/bridge/br_private.h -@@ -166,8 +166,9 @@ struct net_bridge_fdb_entry - struct rcu_head rcu; - }; - --#define MDB_PG_FLAGS_PERMANENT BIT(0) --#define MDB_PG_FLAGS_OFFLOAD BIT(1) -+#define MDB_PG_FLAGS_PERMANENT BIT(0) -+#define MDB_PG_FLAGS_OFFLOAD BIT(1) -+#define MDB_PG_FLAGS_MCAST_TO_UCAST BIT(2) - - struct net_bridge_port_group { - struct net_bridge_port *port; -@@ -177,6 +178,7 @@ struct net_bridge_port_group { - struct timer_list timer; - struct br_ip addr; - unsigned char flags; -+ unsigned char eth_addr[ETH_ALEN]; - }; - - struct net_bridge_mdb_entry -@@ -591,7 +593,7 @@ void br_multicast_free_pg(struct rcu_hea - struct net_bridge_port_group * - br_multicast_new_port_group(struct net_bridge_port *port, struct br_ip *group, - struct net_bridge_port_group __rcu *next, -- unsigned char flags); -+ unsigned char flags, const unsigned char *src); - void br_mdb_init(void); - void br_mdb_uninit(void); - void br_mdb_notify(struct net_device *dev, struct net_bridge_port *port, ---- a/net/bridge/br_sysfs_if.c -+++ b/net/bridge/br_sysfs_if.c -@@ -188,6 +188,7 @@ static BRPORT_ATTR(multicast_router, S_I - store_multicast_router); - - BRPORT_ATTR_FLAG(multicast_fast_leave, BR_MULTICAST_FAST_LEAVE); -+BRPORT_ATTR_FLAG(multicast_to_unicast, BR_MULTICAST_TO_UNICAST); - #endif - - static const struct brport_attribute *brport_attrs[] = { -@@ -214,6 +215,7 @@ static const struct brport_attribute *br - #ifdef CONFIG_BRIDGE_IGMP_SNOOPING - &brport_attr_multicast_router, - &brport_attr_multicast_fast_leave, -+ &brport_attr_multicast_to_unicast, - #endif - &brport_attr_proxyarp, - &brport_attr_proxyarp_wifi, diff --git a/target/linux/generic/backport-4.9/022-net-add-devm-version-of-alloc_etherdev_mqs-function.patch b/target/linux/generic/backport-4.9/022-net-add-devm-version-of-alloc_etherdev_mqs-function.patch deleted file mode 100644 index c5d65b7105..0000000000 --- a/target/linux/generic/backport-4.9/022-net-add-devm-version-of-alloc_etherdev_mqs-function.patch +++ /dev/null @@ -1,69 +0,0 @@ -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= -Date: Sat, 28 Jan 2017 15:15:42 +0100 -Subject: [PATCH] net: add devm version of alloc_etherdev_mqs function -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -This patch adds devm_alloc_etherdev_mqs function and devm_alloc_etherdev -macro. These can be used for simpler netdev allocation without having to -care about calling free_netdev. - -Thanks to this change drivers, their error paths and removal paths may -get simpler by a bit. - -Signed-off-by: Rafał Miłecki -Signed-off-by: David S. Miller ---- - ---- a/include/linux/etherdevice.h -+++ b/include/linux/etherdevice.h -@@ -54,6 +54,11 @@ struct net_device *alloc_etherdev_mqs(in - #define alloc_etherdev(sizeof_priv) alloc_etherdev_mq(sizeof_priv, 1) - #define alloc_etherdev_mq(sizeof_priv, count) alloc_etherdev_mqs(sizeof_priv, count, count) - -+struct net_device *devm_alloc_etherdev_mqs(struct device *dev, int sizeof_priv, -+ unsigned int txqs, -+ unsigned int rxqs); -+#define devm_alloc_etherdev(dev, sizeof_priv) devm_alloc_etherdev_mqs(dev, sizeof_priv, 1, 1) -+ - struct sk_buff **eth_gro_receive(struct sk_buff **head, - struct sk_buff *skb); - int eth_gro_complete(struct sk_buff *skb, int nhoff); ---- a/net/ethernet/eth.c -+++ b/net/ethernet/eth.c -@@ -391,6 +391,34 @@ struct net_device *alloc_etherdev_mqs(in - } - EXPORT_SYMBOL(alloc_etherdev_mqs); - -+static void devm_free_netdev(struct device *dev, void *res) -+{ -+ free_netdev(*(struct net_device **)res); -+} -+ -+struct net_device *devm_alloc_etherdev_mqs(struct device *dev, int sizeof_priv, -+ unsigned int txqs, unsigned int rxqs) -+{ -+ struct net_device **dr; -+ struct net_device *netdev; -+ -+ dr = devres_alloc(devm_free_netdev, sizeof(*dr), GFP_KERNEL); -+ if (!dr) -+ return NULL; -+ -+ netdev = alloc_etherdev_mqs(sizeof_priv, txqs, rxqs); -+ if (!netdev) { -+ devres_free(dr); -+ return NULL; -+ } -+ -+ *dr = netdev; -+ devres_add(dev, dr); -+ -+ return netdev; -+} -+EXPORT_SYMBOL(devm_alloc_etherdev_mqs); -+ - ssize_t sysfs_format_mac(char *buf, const unsigned char *addr, int len) - { - return scnprintf(buf, PAGE_SIZE, "%*phC\n", len, addr); diff --git a/target/linux/generic/backport-4.9/024-1-tcp-tsq-add-tsq_flags-tsq_enum.patch b/target/linux/generic/backport-4.9/024-1-tcp-tsq-add-tsq_flags-tsq_enum.patch deleted file mode 100644 index 172e714c5d..0000000000 --- a/target/linux/generic/backport-4.9/024-1-tcp-tsq-add-tsq_flags-tsq_enum.patch +++ /dev/null @@ -1,90 +0,0 @@ -From 40fc3423b983b864bf70b03199191260ae9b2ea6 Mon Sep 17 00:00:00 2001 -From: Eric Dumazet -Date: Sat, 3 Dec 2016 11:14:50 -0800 -Subject: [PATCH 01/10] tcp: tsq: add tsq_flags / tsq_enum - -This is a cleanup, to ease code review of following patches. - -Old 'enum tsq_flags' is renamed, and a new enumeration is added -with the flags used in cmpxchg() operations as opposed to -single bit operations. - -Signed-off-by: Eric Dumazet -Signed-off-by: David S. Miller ---- - include/linux/tcp.h | 11 ++++++++++- - net/ipv4/tcp_output.c | 16 ++++++++-------- - 2 files changed, 18 insertions(+), 9 deletions(-) - ---- a/include/linux/tcp.h -+++ b/include/linux/tcp.h -@@ -368,7 +368,7 @@ struct tcp_sock { - u32 *saved_syn; - }; - --enum tsq_flags { -+enum tsq_enum { - TSQ_THROTTLED, - TSQ_QUEUED, - TCP_TSQ_DEFERRED, /* tcp_tasklet_func() found socket was owned */ -@@ -379,6 +379,15 @@ enum tsq_flags { - */ - }; - -+enum tsq_flags { -+ TSQF_THROTTLED = (1UL << TSQ_THROTTLED), -+ TSQF_QUEUED = (1UL << TSQ_QUEUED), -+ TCPF_TSQ_DEFERRED = (1UL << TCP_TSQ_DEFERRED), -+ TCPF_WRITE_TIMER_DEFERRED = (1UL << TCP_WRITE_TIMER_DEFERRED), -+ TCPF_DELACK_TIMER_DEFERRED = (1UL << TCP_DELACK_TIMER_DEFERRED), -+ TCPF_MTU_REDUCED_DEFERRED = (1UL << TCP_MTU_REDUCED_DEFERRED), -+}; -+ - static inline struct tcp_sock *tcp_sk(const struct sock *sk) - { - return (struct tcp_sock *)sk; ---- a/net/ipv4/tcp_output.c -+++ b/net/ipv4/tcp_output.c -@@ -789,10 +789,10 @@ static void tcp_tasklet_func(unsigned lo - } - } - --#define TCP_DEFERRED_ALL ((1UL << TCP_TSQ_DEFERRED) | \ -- (1UL << TCP_WRITE_TIMER_DEFERRED) | \ -- (1UL << TCP_DELACK_TIMER_DEFERRED) | \ -- (1UL << TCP_MTU_REDUCED_DEFERRED)) -+#define TCP_DEFERRED_ALL (TCPF_TSQ_DEFERRED | \ -+ TCPF_WRITE_TIMER_DEFERRED | \ -+ TCPF_DELACK_TIMER_DEFERRED | \ -+ TCPF_MTU_REDUCED_DEFERRED) - /** - * tcp_release_cb - tcp release_sock() callback - * @sk: socket -@@ -813,7 +813,7 @@ void tcp_release_cb(struct sock *sk) - nflags = flags & ~TCP_DEFERRED_ALL; - } while (cmpxchg(&tp->tsq_flags, flags, nflags) != flags); - -- if (flags & (1UL << TCP_TSQ_DEFERRED)) -+ if (flags & TCPF_TSQ_DEFERRED) - tcp_tsq_handler(sk); - - /* Here begins the tricky part : -@@ -827,15 +827,15 @@ void tcp_release_cb(struct sock *sk) - */ - sock_release_ownership(sk); - -- if (flags & (1UL << TCP_WRITE_TIMER_DEFERRED)) { -+ if (flags & TCPF_WRITE_TIMER_DEFERRED) { - tcp_write_timer_handler(sk); - __sock_put(sk); - } -- if (flags & (1UL << TCP_DELACK_TIMER_DEFERRED)) { -+ if (flags & TCPF_DELACK_TIMER_DEFERRED) { - tcp_delack_timer_handler(sk); - __sock_put(sk); - } -- if (flags & (1UL << TCP_MTU_REDUCED_DEFERRED)) { -+ if (flags & TCPF_MTU_REDUCED_DEFERRED) { - inet_csk(sk)->icsk_af_ops->mtu_reduced(sk); - __sock_put(sk); - } diff --git a/target/linux/generic/backport-4.9/024-2-tcp-tsq-remove-one-locked-operation-in-tcp_wfree.patch b/target/linux/generic/backport-4.9/024-2-tcp-tsq-remove-one-locked-operation-in-tcp_wfree.patch deleted file mode 100644 index af194b2bed..0000000000 --- a/target/linux/generic/backport-4.9/024-2-tcp-tsq-remove-one-locked-operation-in-tcp_wfree.patch +++ /dev/null @@ -1,48 +0,0 @@ -From 408f0a6c21e124cc4f6c7aa370b38aa47e55428d Mon Sep 17 00:00:00 2001 -From: Eric Dumazet -Date: Sat, 3 Dec 2016 11:14:51 -0800 -Subject: [PATCH 02/10] tcp: tsq: remove one locked operation in tcp_wfree() - -Instead of atomically clear TSQ_THROTTLED and atomically set TSQ_QUEUED -bits, use one cmpxchg() to perform a single locked operation. - -Since the following patch will also set TCP_TSQ_DEFERRED here, -this cmpxchg() will make this addition free. - -Signed-off-by: Eric Dumazet -Signed-off-by: David S. Miller ---- - net/ipv4/tcp_output.c | 13 ++++++++++--- - 1 file changed, 10 insertions(+), 3 deletions(-) - ---- a/net/ipv4/tcp_output.c -+++ b/net/ipv4/tcp_output.c -@@ -865,6 +865,7 @@ void tcp_wfree(struct sk_buff *skb) - { - struct sock *sk = skb->sk; - struct tcp_sock *tp = tcp_sk(sk); -+ unsigned long flags, nval, oval; - int wmem; - - /* Keep one reference on sk_wmem_alloc. -@@ -882,11 +883,17 @@ void tcp_wfree(struct sk_buff *skb) - if (wmem >= SKB_TRUESIZE(1) && this_cpu_ksoftirqd() == current) - goto out; - -- if (test_and_clear_bit(TSQ_THROTTLED, &tp->tsq_flags) && -- !test_and_set_bit(TSQ_QUEUED, &tp->tsq_flags)) { -- unsigned long flags; -+ for (oval = READ_ONCE(tp->tsq_flags);; oval = nval) { - struct tsq_tasklet *tsq; - -+ if (!(oval & TSQF_THROTTLED) || (oval & TSQF_QUEUED)) -+ goto out; -+ -+ nval = (oval & ~TSQF_THROTTLED) | TSQF_QUEUED; -+ nval = cmpxchg(&tp->tsq_flags, oval, nval); -+ if (nval != oval) -+ continue; -+ - /* queue this socket to tasklet queue */ - local_irq_save(flags); - tsq = this_cpu_ptr(&tsq_tasklet); diff --git a/target/linux/generic/backport-4.9/024-3-tcp-tsq-add-shortcut-in-tcp_tasklet_func.patch b/target/linux/generic/backport-4.9/024-3-tcp-tsq-add-shortcut-in-tcp_tasklet_func.patch deleted file mode 100644 index b9b3c55076..0000000000 --- a/target/linux/generic/backport-4.9/024-3-tcp-tsq-add-shortcut-in-tcp_tasklet_func.patch +++ /dev/null @@ -1,71 +0,0 @@ -From b223feb9de2a65c533ff95c08e834fa732906ea5 Mon Sep 17 00:00:00 2001 -From: Eric Dumazet -Date: Sat, 3 Dec 2016 11:14:52 -0800 -Subject: [PATCH 03/10] tcp: tsq: add shortcut in tcp_tasklet_func() - -Under high stress, I've seen tcp_tasklet_func() consuming -~700 usec, handling ~150 tcp sockets. - -By setting TCP_TSQ_DEFERRED in tcp_wfree(), we give a chance -for other cpus/threads entering tcp_write_xmit() to grab it, -allowing tcp_tasklet_func() to skip sockets that already did -an xmit cycle. - -In the future, we might give to ACK processing an increased -budget to reduce even more tcp_tasklet_func() amount of work. - -Signed-off-by: Eric Dumazet -Signed-off-by: David S. Miller ---- - net/ipv4/tcp_output.c | 22 ++++++++++++---------- - 1 file changed, 12 insertions(+), 10 deletions(-) - ---- a/net/ipv4/tcp_output.c -+++ b/net/ipv4/tcp_output.c -@@ -772,19 +772,19 @@ static void tcp_tasklet_func(unsigned lo - list_for_each_safe(q, n, &list) { - tp = list_entry(q, struct tcp_sock, tsq_node); - list_del(&tp->tsq_node); -+ clear_bit(TSQ_QUEUED, &tp->tsq_flags); - - sk = (struct sock *)tp; -- bh_lock_sock(sk); -- -- if (!sock_owned_by_user(sk)) { -- tcp_tsq_handler(sk); -- } else { -- /* defer the work to tcp_release_cb() */ -- set_bit(TCP_TSQ_DEFERRED, &tp->tsq_flags); -+ if (!sk->sk_lock.owned && -+ test_bit(TCP_TSQ_DEFERRED, &tp->tsq_flags)) { -+ bh_lock_sock(sk); -+ if (!sock_owned_by_user(sk)) { -+ clear_bit(TCP_TSQ_DEFERRED, &tp->tsq_flags); -+ tcp_tsq_handler(sk); -+ } -+ bh_unlock_sock(sk); - } -- bh_unlock_sock(sk); - -- clear_bit(TSQ_QUEUED, &tp->tsq_flags); - sk_free(sk); - } - } -@@ -889,7 +889,7 @@ void tcp_wfree(struct sk_buff *skb) - if (!(oval & TSQF_THROTTLED) || (oval & TSQF_QUEUED)) - goto out; - -- nval = (oval & ~TSQF_THROTTLED) | TSQF_QUEUED; -+ nval = (oval & ~TSQF_THROTTLED) | TSQF_QUEUED | TCPF_TSQ_DEFERRED; - nval = cmpxchg(&tp->tsq_flags, oval, nval); - if (nval != oval) - continue; -@@ -2222,6 +2222,8 @@ static bool tcp_write_xmit(struct sock * - unlikely(tso_fragment(sk, skb, limit, mss_now, gfp))) - break; - -+ if (test_bit(TCP_TSQ_DEFERRED, &tp->tsq_flags)) -+ clear_bit(TCP_TSQ_DEFERRED, &tp->tsq_flags); - if (tcp_small_queue_check(sk, skb, 0)) - break; - diff --git a/target/linux/generic/backport-4.9/024-4-tcp-tsq-avoid-one-atomic-in-tcp_wfree.patch b/target/linux/generic/backport-4.9/024-4-tcp-tsq-avoid-one-atomic-in-tcp_wfree.patch deleted file mode 100644 index 87452ac853..0000000000 --- a/target/linux/generic/backport-4.9/024-4-tcp-tsq-avoid-one-atomic-in-tcp_wfree.patch +++ /dev/null @@ -1,38 +0,0 @@ -From a9b204d1564702b704ad6fe74f10a102c7b87ba3 Mon Sep 17 00:00:00 2001 -From: Eric Dumazet -Date: Sat, 3 Dec 2016 11:14:53 -0800 -Subject: [PATCH 04/10] tcp: tsq: avoid one atomic in tcp_wfree() - -Under high load, tcp_wfree() has an atomic operation trying -to schedule a tasklet over and over. - -We can schedule it only if our per cpu list was empty. - -Signed-off-by: Eric Dumazet -Signed-off-by: David S. Miller ---- - net/ipv4/tcp_output.c | 5 ++++- - 1 file changed, 4 insertions(+), 1 deletion(-) - ---- a/net/ipv4/tcp_output.c -+++ b/net/ipv4/tcp_output.c -@@ -885,6 +885,7 @@ void tcp_wfree(struct sk_buff *skb) - - for (oval = READ_ONCE(tp->tsq_flags);; oval = nval) { - struct tsq_tasklet *tsq; -+ bool empty; - - if (!(oval & TSQF_THROTTLED) || (oval & TSQF_QUEUED)) - goto out; -@@ -897,8 +898,10 @@ void tcp_wfree(struct sk_buff *skb) - /* queue this socket to tasklet queue */ - local_irq_save(flags); - tsq = this_cpu_ptr(&tsq_tasklet); -+ empty = list_empty(&tsq->head); - list_add(&tp->tsq_node, &tsq->head); -- tasklet_schedule(&tsq->tasklet); -+ if (empty) -+ tasklet_schedule(&tsq->tasklet); - local_irq_restore(flags); - return; - } diff --git a/target/linux/generic/backport-4.9/024-5-tcp-tsq-add-a-shortcut-in-tcp_small_queue_check.patch b/target/linux/generic/backport-4.9/024-5-tcp-tsq-add-a-shortcut-in-tcp_small_queue_check.patch deleted file mode 100644 index d04e365f98..0000000000 --- a/target/linux/generic/backport-4.9/024-5-tcp-tsq-add-a-shortcut-in-tcp_small_queue_check.patch +++ /dev/null @@ -1,37 +0,0 @@ -From 75eefc6c59fd2c5f1ab95a3a113c217237d12a31 Mon Sep 17 00:00:00 2001 -From: Eric Dumazet -Date: Sat, 3 Dec 2016 11:14:54 -0800 -Subject: [PATCH 05/10] tcp: tsq: add a shortcut in tcp_small_queue_check() - -Always allow the two first skbs in write queue to be sent, -regardless of sk_wmem_alloc/sk_pacing_rate values. - -This helps a lot in situations where TX completions are delayed either -because of driver latencies or softirq latencies. - -Test is done with no cache line misses. - -Signed-off-by: Eric Dumazet -Signed-off-by: David S. Miller ---- - net/ipv4/tcp_output.c | 9 +++++++++ - 1 file changed, 9 insertions(+) - ---- a/net/ipv4/tcp_output.c -+++ b/net/ipv4/tcp_output.c -@@ -2127,6 +2127,15 @@ static bool tcp_small_queue_check(struct - limit <<= factor; - - if (atomic_read(&sk->sk_wmem_alloc) > limit) { -+ /* Always send the 1st or 2nd skb in write queue. -+ * No need to wait for TX completion to call us back, -+ * after softirq/tasklet schedule. -+ * This helps when TX completions are delayed too much. -+ */ -+ if (skb == sk->sk_write_queue.next || -+ skb->prev == sk->sk_write_queue.next) -+ return false; -+ - set_bit(TSQ_THROTTLED, &tcp_sk(sk)->tsq_flags); - /* It is possible TX completion already happened - * before we set TSQ_THROTTLED, so we must diff --git a/target/linux/generic/backport-4.9/024-6-tcp-tcp_mtu_probe-is-likely-to-exit-early.patch b/target/linux/generic/backport-4.9/024-6-tcp-tcp_mtu_probe-is-likely-to-exit-early.patch deleted file mode 100644 index 2a6cd40c8a..0000000000 --- a/target/linux/generic/backport-4.9/024-6-tcp-tcp_mtu_probe-is-likely-to-exit-early.patch +++ /dev/null @@ -1,55 +0,0 @@ -From 12a59abc22d6664f7d3944f625ceefee92de8820 Mon Sep 17 00:00:00 2001 -From: Eric Dumazet -Date: Sat, 3 Dec 2016 11:14:55 -0800 -Subject: [PATCH 06/10] tcp: tcp_mtu_probe() is likely to exit early - -Adding a likely() in tcp_mtu_probe() moves its code which used to -be inlined in front of tcp_write_xmit() - -We still have a cache line miss to access icsk->icsk_mtup.enabled, -we will probably have to reorganize fields to help data locality. - -Signed-off-by: Eric Dumazet -Signed-off-by: David S. Miller ---- - net/ipv4/tcp_output.c | 18 +++++++++--------- - 1 file changed, 9 insertions(+), 9 deletions(-) - ---- a/net/ipv4/tcp_output.c -+++ b/net/ipv4/tcp_output.c -@@ -1960,26 +1960,26 @@ static bool tcp_can_coalesce_send_queue_ - */ - static int tcp_mtu_probe(struct sock *sk) - { -- struct tcp_sock *tp = tcp_sk(sk); - struct inet_connection_sock *icsk = inet_csk(sk); -+ struct tcp_sock *tp = tcp_sk(sk); - struct sk_buff *skb, *nskb, *next; - struct net *net = sock_net(sk); -- int len; - int probe_size; - int size_needed; -- int copy; -+ int copy, len; - int mss_now; - int interval; - - /* Not currently probing/verifying, - * not in recovery, - * have enough cwnd, and -- * not SACKing (the variable headers throw things off) */ -- if (!icsk->icsk_mtup.enabled || -- icsk->icsk_mtup.probe_size || -- inet_csk(sk)->icsk_ca_state != TCP_CA_Open || -- tp->snd_cwnd < 11 || -- tp->rx_opt.num_sacks || tp->rx_opt.dsack) -+ * not SACKing (the variable headers throw things off) -+ */ -+ if (likely(!icsk->icsk_mtup.enabled || -+ icsk->icsk_mtup.probe_size || -+ inet_csk(sk)->icsk_ca_state != TCP_CA_Open || -+ tp->snd_cwnd < 11 || -+ tp->rx_opt.num_sacks || tp->rx_opt.dsack)) - return -1; - - /* Use binary search for probe_size between tcp_mss_base, diff --git a/target/linux/generic/backport-4.9/024-7-net-reorganize-struct-sock-for-better-data-locality.patch b/target/linux/generic/backport-4.9/024-7-net-reorganize-struct-sock-for-better-data-locality.patch deleted file mode 100644 index a43b4037fe..0000000000 --- a/target/linux/generic/backport-4.9/024-7-net-reorganize-struct-sock-for-better-data-locality.patch +++ /dev/null @@ -1,158 +0,0 @@ -From 9115e8cd2a0c6eaaa900c462721f12e1d45f326c Mon Sep 17 00:00:00 2001 -From: Eric Dumazet -Date: Sat, 3 Dec 2016 11:14:56 -0800 -Subject: [PATCH 07/10] net: reorganize struct sock for better data locality - -Group fields used in TX path, and keep some cache lines mostly read -to permit sharing among cpus. - -Gained two 4 bytes holes on 64bit arches. - -Added a place holder for tcp tsq_flags, next to sk_wmem_alloc -to speed up tcp_wfree() in the following patch. - -I have not added ____cacheline_aligned_in_smp, this might be done later. -I prefer doing this once inet and tcp/udp sockets reorg is also done. - -Tested with both TCP and UDP. - -UDP receiver performance under flood increased by ~20 % : -Accessing sk_filter/sk_wq/sk_napi_id no longer stalls because sk_drops -was moved away from a critical cache line, now mostly read and shared. - - /* --- cacheline 4 boundary (256 bytes) --- */ - unsigned int sk_napi_id; /* 0x100 0x4 */ - int sk_rcvbuf; /* 0x104 0x4 */ - struct sk_filter * sk_filter; /* 0x108 0x8 */ - union { - struct socket_wq * sk_wq; /* 0x8 */ - struct socket_wq * sk_wq_raw; /* 0x8 */ - }; /* 0x110 0x8 */ - struct xfrm_policy * sk_policy[2]; /* 0x118 0x10 */ - struct dst_entry * sk_rx_dst; /* 0x128 0x8 */ - struct dst_entry * sk_dst_cache; /* 0x130 0x8 */ - atomic_t sk_omem_alloc; /* 0x138 0x4 */ - int sk_sndbuf; /* 0x13c 0x4 */ - /* --- cacheline 5 boundary (320 bytes) --- */ - int sk_wmem_queued; /* 0x140 0x4 */ - atomic_t sk_wmem_alloc; /* 0x144 0x4 */ - long unsigned int sk_tsq_flags; /* 0x148 0x8 */ - struct sk_buff * sk_send_head; /* 0x150 0x8 */ - struct sk_buff_head sk_write_queue; /* 0x158 0x18 */ - __s32 sk_peek_off; /* 0x170 0x4 */ - int sk_write_pending; /* 0x174 0x4 */ - long int sk_sndtimeo; /* 0x178 0x8 */ - -Signed-off-by: Eric Dumazet -Tested-by: Paolo Abeni -Signed-off-by: David S. Miller ---- - include/net/sock.h | 51 +++++++++++++++++++++++++++------------------------ - 1 file changed, 27 insertions(+), 24 deletions(-) - ---- a/include/net/sock.h -+++ b/include/net/sock.h -@@ -344,6 +344,9 @@ struct sock { - #define sk_rxhash __sk_common.skc_rxhash - - socket_lock_t sk_lock; -+ atomic_t sk_drops; -+ int sk_rcvlowat; -+ struct sk_buff_head sk_error_queue; - struct sk_buff_head sk_receive_queue; - /* - * The backlog queue is special, it is always used with -@@ -360,14 +363,13 @@ struct sock { - struct sk_buff *tail; - } sk_backlog; - #define sk_rmem_alloc sk_backlog.rmem_alloc -- int sk_forward_alloc; - -- __u32 sk_txhash; -+ int sk_forward_alloc; - #ifdef CONFIG_NET_RX_BUSY_POLL -- unsigned int sk_napi_id; - unsigned int sk_ll_usec; -+ /* ===== mostly read cache line ===== */ -+ unsigned int sk_napi_id; - #endif -- atomic_t sk_drops; - int sk_rcvbuf; - - struct sk_filter __rcu *sk_filter; -@@ -380,11 +382,30 @@ struct sock { - #endif - struct dst_entry *sk_rx_dst; - struct dst_entry __rcu *sk_dst_cache; -- /* Note: 32bit hole on 64bit arches */ -- atomic_t sk_wmem_alloc; - atomic_t sk_omem_alloc; - int sk_sndbuf; -+ -+ /* ===== cache line for TX ===== */ -+ int sk_wmem_queued; -+ atomic_t sk_wmem_alloc; -+ unsigned long sk_tsq_flags; -+ struct sk_buff *sk_send_head; - struct sk_buff_head sk_write_queue; -+ __s32 sk_peek_off; -+ int sk_write_pending; -+ long sk_sndtimeo; -+ struct timer_list sk_timer; -+ __u32 sk_priority; -+ __u32 sk_mark; -+ u32 sk_pacing_rate; /* bytes per second */ -+ u32 sk_max_pacing_rate; -+ struct page_frag sk_frag; -+ netdev_features_t sk_route_caps; -+ netdev_features_t sk_route_nocaps; -+ int sk_gso_type; -+ unsigned int sk_gso_max_size; -+ gfp_t sk_allocation; -+ __u32 sk_txhash; - - /* - * Because of non atomicity rules, all -@@ -400,31 +421,17 @@ struct sock { - #define SK_PROTOCOL_MAX U8_MAX - kmemcheck_bitfield_end(flags); - -- int sk_wmem_queued; -- gfp_t sk_allocation; -- u32 sk_pacing_rate; /* bytes per second */ -- u32 sk_max_pacing_rate; -- netdev_features_t sk_route_caps; -- netdev_features_t sk_route_nocaps; -- int sk_gso_type; -- unsigned int sk_gso_max_size; - u16 sk_gso_max_segs; -- int sk_rcvlowat; - unsigned long sk_lingertime; -- struct sk_buff_head sk_error_queue; - struct proto *sk_prot_creator; - rwlock_t sk_callback_lock; - int sk_err, - sk_err_soft; - u32 sk_ack_backlog; - u32 sk_max_ack_backlog; -- __u32 sk_priority; -- __u32 sk_mark; - struct pid *sk_peer_pid; - const struct cred *sk_peer_cred; - long sk_rcvtimeo; -- long sk_sndtimeo; -- struct timer_list sk_timer; - ktime_t sk_stamp; - #if BITS_PER_LONG==32 - seqlock_t sk_stamp_seq; -@@ -434,10 +441,6 @@ struct sock { - u32 sk_tskey; - struct socket *sk_socket; - void *sk_user_data; -- struct page_frag sk_frag; -- struct sk_buff *sk_send_head; -- __s32 sk_peek_off; -- int sk_write_pending; - #ifdef CONFIG_SECURITY - void *sk_security; - #endif diff --git a/target/linux/generic/backport-4.9/024-8-tcp-tsq-move-tsq_flags-close-to-sk_wmem_alloc.patch b/target/linux/generic/backport-4.9/024-8-tcp-tsq-move-tsq_flags-close-to-sk_wmem_alloc.patch deleted file mode 100644 index 0a5b9ead9d..0000000000 --- a/target/linux/generic/backport-4.9/024-8-tcp-tsq-move-tsq_flags-close-to-sk_wmem_alloc.patch +++ /dev/null @@ -1,176 +0,0 @@ -From 7aa5470c2c09265902b5e4289afa82e4e7c2987e Mon Sep 17 00:00:00 2001 -From: Eric Dumazet -Date: Sat, 3 Dec 2016 11:14:57 -0800 -Subject: [PATCH 08/10] tcp: tsq: move tsq_flags close to sk_wmem_alloc - -tsq_flags being in the same cache line than sk_wmem_alloc -makes a lot of sense. Both fields are changed from tcp_wfree() -and more generally by various TSQ related functions. - -Prior patch made room in struct sock and added sk_tsq_flags, -this patch deletes tsq_flags from struct tcp_sock. - -Signed-off-by: Eric Dumazet -Signed-off-by: David S. Miller ---- - include/linux/tcp.h | 1 - - net/ipv4/tcp.c | 4 ++-- - net/ipv4/tcp_ipv4.c | 2 +- - net/ipv4/tcp_output.c | 24 +++++++++++------------- - net/ipv4/tcp_timer.c | 4 ++-- - net/ipv6/tcp_ipv6.c | 2 +- - 6 files changed, 17 insertions(+), 20 deletions(-) - ---- a/include/linux/tcp.h -+++ b/include/linux/tcp.h -@@ -192,7 +192,6 @@ struct tcp_sock { - u32 tsoffset; /* timestamp offset */ - - struct list_head tsq_node; /* anchor in tsq_tasklet.head list */ -- unsigned long tsq_flags; - - /* Data for direct copy to user */ - struct { ---- a/net/ipv4/tcp.c -+++ b/net/ipv4/tcp.c -@@ -665,9 +665,9 @@ static void tcp_push(struct sock *sk, in - if (tcp_should_autocork(sk, skb, size_goal)) { - - /* avoid atomic op if TSQ_THROTTLED bit is already set */ -- if (!test_bit(TSQ_THROTTLED, &tp->tsq_flags)) { -+ if (!test_bit(TSQ_THROTTLED, &sk->sk_tsq_flags)) { - NET_INC_STATS(sock_net(sk), LINUX_MIB_TCPAUTOCORKING); -- set_bit(TSQ_THROTTLED, &tp->tsq_flags); -+ set_bit(TSQ_THROTTLED, &sk->sk_tsq_flags); - } - /* It is possible TX completion already happened - * before we set TSQ_THROTTLED. ---- a/net/ipv4/tcp_ipv4.c -+++ b/net/ipv4/tcp_ipv4.c -@@ -446,7 +446,7 @@ void tcp_v4_err(struct sk_buff *icmp_skb - if (!sock_owned_by_user(sk)) { - tcp_v4_mtu_reduced(sk); - } else { -- if (!test_and_set_bit(TCP_MTU_REDUCED_DEFERRED, &tp->tsq_flags)) -+ if (!test_and_set_bit(TCP_MTU_REDUCED_DEFERRED, &sk->sk_tsq_flags)) - sock_hold(sk); - } - goto out; ---- a/net/ipv4/tcp_output.c -+++ b/net/ipv4/tcp_output.c -@@ -772,14 +772,15 @@ static void tcp_tasklet_func(unsigned lo - list_for_each_safe(q, n, &list) { - tp = list_entry(q, struct tcp_sock, tsq_node); - list_del(&tp->tsq_node); -- clear_bit(TSQ_QUEUED, &tp->tsq_flags); - - sk = (struct sock *)tp; -+ clear_bit(TSQ_QUEUED, &sk->sk_tsq_flags); -+ - if (!sk->sk_lock.owned && -- test_bit(TCP_TSQ_DEFERRED, &tp->tsq_flags)) { -+ test_bit(TCP_TSQ_DEFERRED, &sk->sk_tsq_flags)) { - bh_lock_sock(sk); - if (!sock_owned_by_user(sk)) { -- clear_bit(TCP_TSQ_DEFERRED, &tp->tsq_flags); -+ clear_bit(TCP_TSQ_DEFERRED, &sk->sk_tsq_flags); - tcp_tsq_handler(sk); - } - bh_unlock_sock(sk); -@@ -802,16 +803,15 @@ static void tcp_tasklet_func(unsigned lo - */ - void tcp_release_cb(struct sock *sk) - { -- struct tcp_sock *tp = tcp_sk(sk); - unsigned long flags, nflags; - - /* perform an atomic operation only if at least one flag is set */ - do { -- flags = tp->tsq_flags; -+ flags = sk->sk_tsq_flags; - if (!(flags & TCP_DEFERRED_ALL)) - return; - nflags = flags & ~TCP_DEFERRED_ALL; -- } while (cmpxchg(&tp->tsq_flags, flags, nflags) != flags); -+ } while (cmpxchg(&sk->sk_tsq_flags, flags, nflags) != flags); - - if (flags & TCPF_TSQ_DEFERRED) - tcp_tsq_handler(sk); -@@ -883,7 +883,7 @@ void tcp_wfree(struct sk_buff *skb) - if (wmem >= SKB_TRUESIZE(1) && this_cpu_ksoftirqd() == current) - goto out; - -- for (oval = READ_ONCE(tp->tsq_flags);; oval = nval) { -+ for (oval = READ_ONCE(sk->sk_tsq_flags);; oval = nval) { - struct tsq_tasklet *tsq; - bool empty; - -@@ -891,7 +891,7 @@ void tcp_wfree(struct sk_buff *skb) - goto out; - - nval = (oval & ~TSQF_THROTTLED) | TSQF_QUEUED | TCPF_TSQ_DEFERRED; -- nval = cmpxchg(&tp->tsq_flags, oval, nval); -+ nval = cmpxchg(&sk->sk_tsq_flags, oval, nval); - if (nval != oval) - continue; - -@@ -2136,7 +2136,7 @@ static bool tcp_small_queue_check(struct - skb->prev == sk->sk_write_queue.next) - return false; - -- set_bit(TSQ_THROTTLED, &tcp_sk(sk)->tsq_flags); -+ set_bit(TSQ_THROTTLED, &sk->sk_tsq_flags); - /* It is possible TX completion already happened - * before we set TSQ_THROTTLED, so we must - * test again the condition. -@@ -2234,8 +2234,8 @@ static bool tcp_write_xmit(struct sock * - unlikely(tso_fragment(sk, skb, limit, mss_now, gfp))) - break; - -- if (test_bit(TCP_TSQ_DEFERRED, &tp->tsq_flags)) -- clear_bit(TCP_TSQ_DEFERRED, &tp->tsq_flags); -+ if (test_bit(TCP_TSQ_DEFERRED, &sk->sk_tsq_flags)) -+ clear_bit(TCP_TSQ_DEFERRED, &sk->sk_tsq_flags); - if (tcp_small_queue_check(sk, skb, 0)) - break; - -@@ -3546,8 +3546,6 @@ void __tcp_send_ack(struct sock *sk, u32 - /* We do not want pure acks influencing TCP Small Queues or fq/pacing - * too much. - * SKB_TRUESIZE(max(1 .. 66, MAX_TCP_HEADER)) is unfortunately ~784 -- * We also avoid tcp_wfree() overhead (cache line miss accessing -- * tp->tsq_flags) by using regular sock_wfree() - */ - skb_set_tcp_pure_ack(buff); - ---- a/net/ipv4/tcp_timer.c -+++ b/net/ipv4/tcp_timer.c -@@ -326,7 +326,7 @@ static void tcp_delack_timer(unsigned lo - inet_csk(sk)->icsk_ack.blocked = 1; - __NET_INC_STATS(sock_net(sk), LINUX_MIB_DELAYEDACKLOCKED); - /* deleguate our work to tcp_release_cb() */ -- if (!test_and_set_bit(TCP_DELACK_TIMER_DEFERRED, &tcp_sk(sk)->tsq_flags)) -+ if (!test_and_set_bit(TCP_DELACK_TIMER_DEFERRED, &sk->sk_tsq_flags)) - sock_hold(sk); - } - bh_unlock_sock(sk); -@@ -609,7 +609,7 @@ static void tcp_write_timer(unsigned lon - tcp_write_timer_handler(sk); - } else { - /* delegate our work to tcp_release_cb() */ -- if (!test_and_set_bit(TCP_WRITE_TIMER_DEFERRED, &tcp_sk(sk)->tsq_flags)) -+ if (!test_and_set_bit(TCP_WRITE_TIMER_DEFERRED, &sk->sk_tsq_flags)) - sock_hold(sk); - } - bh_unlock_sock(sk); ---- a/net/ipv6/tcp_ipv6.c -+++ b/net/ipv6/tcp_ipv6.c -@@ -404,7 +404,7 @@ static void tcp_v6_err(struct sk_buff *s - if (!sock_owned_by_user(sk)) - tcp_v6_mtu_reduced(sk); - else if (!test_and_set_bit(TCP_MTU_REDUCED_DEFERRED, -- &tp->tsq_flags)) -+ &sk->sk_tsq_flags)) - sock_hold(sk); - goto out; - } diff --git a/target/linux/generic/backport-4.9/024-9-tcp-add-a-missing-barrier-in-tcp_tasklet_func.patch b/target/linux/generic/backport-4.9/024-9-tcp-add-a-missing-barrier-in-tcp_tasklet_func.patch deleted file mode 100644 index bd74303266..0000000000 --- a/target/linux/generic/backport-4.9/024-9-tcp-add-a-missing-barrier-in-tcp_tasklet_func.patch +++ /dev/null @@ -1,40 +0,0 @@ -From 0a9648f1293966c838dc570da73c15a76f4c89d6 Mon Sep 17 00:00:00 2001 -From: Eric Dumazet -Date: Wed, 21 Dec 2016 05:42:43 -0800 -Subject: [PATCH 09/10] tcp: add a missing barrier in tcp_tasklet_func() - -Madalin reported crashes happening in tcp_tasklet_func() on powerpc64 - -Before TSQ_QUEUED bit is cleared, we must ensure the changes done -by list_del(&tp->tsq_node); are committed to memory, otherwise -corruption might happen, as an other cpu could catch TSQ_QUEUED -clearance too soon. - -We can notice that old kernels were immune to this bug, because -TSQ_QUEUED was cleared after a bh_lock_sock(sk)/bh_unlock_sock(sk) -section, but they could have missed a kick to write additional bytes, -when NIC interrupts for a given flow are spread to multiple cpus. - -Affected TCP flows would need an incoming ACK or RTO timer to add more -packets to the pipe. So overall situation should be better now. - -Fixes: b223feb9de2a ("tcp: tsq: add shortcut in tcp_tasklet_func()") -Signed-off-by: Eric Dumazet -Reported-by: Madalin Bucur -Tested-by: Madalin Bucur -Tested-by: Xing Lei -Signed-off-by: David S. Miller ---- - net/ipv4/tcp_output.c | 1 + - 1 file changed, 1 insertion(+) - ---- a/net/ipv4/tcp_output.c -+++ b/net/ipv4/tcp_output.c -@@ -774,6 +774,7 @@ static void tcp_tasklet_func(unsigned lo - list_del(&tp->tsq_node); - - sk = (struct sock *)tp; -+ smp_mb__before_atomic(); - clear_bit(TSQ_QUEUED, &sk->sk_tsq_flags); - - if (!sk->sk_lock.owned && diff --git a/target/linux/generic/backport-4.9/025-tcp-allow-drivers-to-tweak-TSQ-logic.patch b/target/linux/generic/backport-4.9/025-tcp-allow-drivers-to-tweak-TSQ-logic.patch deleted file mode 100644 index 7741fd749a..0000000000 --- a/target/linux/generic/backport-4.9/025-tcp-allow-drivers-to-tweak-TSQ-logic.patch +++ /dev/null @@ -1,85 +0,0 @@ -From: Eric Dumazet -Date: Sat, 11 Nov 2017 15:54:12 -0800 -Subject: [PATCH] tcp: allow drivers to tweak TSQ logic -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -I had many reports that TSQ logic breaks wifi aggregation. - -Current logic is to allow up to 1 ms of bytes to be queued into qdisc -and drivers queues. - -But Wifi aggregation needs a bigger budget to allow bigger rates to -be discovered by various TCP Congestion Controls algorithms. - -This patch adds an extra socket field, allowing wifi drivers to select -another log scale to derive TCP Small Queue credit from current pacing -rate. - -Initial value is 10, meaning that this patch does not change current -behavior. - -We expect wifi drivers to set this field to smaller values (tests have -been done with values from 6 to 9) - -They would have to use following template : - -if (skb->sk && skb->sk->sk_pacing_shift != MY_PACING_SHIFT) - skb->sk->sk_pacing_shift = MY_PACING_SHIFT; - -Ref: https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1670041 -Signed-off-by: Eric Dumazet -Cc: Johannes Berg -Cc: Toke Høiland-Jørgensen -Cc: Kir Kolyshkin ---- ---- a/include/net/sock.h -+++ b/include/net/sock.h -@@ -260,6 +260,7 @@ struct sock_common { - * @sk_gso_type: GSO type (e.g. %SKB_GSO_TCPV4) - * @sk_gso_max_size: Maximum GSO segment size to build - * @sk_gso_max_segs: Maximum number of GSO segments -+ * @sk_pacing_shift: scaling factor for TCP Small Queues - * @sk_lingertime: %SO_LINGER l_linger setting - * @sk_backlog: always used with the per-socket spinlock held - * @sk_callback_lock: used with the callbacks in the end of this struct -@@ -422,6 +423,8 @@ struct sock { - kmemcheck_bitfield_end(flags); - - u16 sk_gso_max_segs; -+#define sk_pacing_shift sk_pacing_shift /* for backport checks */ -+ u8 sk_pacing_shift; - unsigned long sk_lingertime; - struct proto *sk_prot_creator; - rwlock_t sk_callback_lock; ---- a/net/core/sock.c -+++ b/net/core/sock.c -@@ -2479,6 +2479,7 @@ void sock_init_data(struct socket *sock, - - sk->sk_max_pacing_rate = ~0U; - sk->sk_pacing_rate = ~0U; -+ sk->sk_pacing_shift = 10; - sk->sk_incoming_cpu = -1; - /* - * Before updating sk_refcnt, we must commit prior changes to memory ---- a/net/ipv4/tcp_output.c -+++ b/net/ipv4/tcp_output.c -@@ -1593,7 +1593,7 @@ u32 tcp_tso_autosize(const struct sock * - { - u32 bytes, segs; - -- bytes = min(sk->sk_pacing_rate >> 10, -+ bytes = min(sk->sk_pacing_rate >> sk->sk_pacing_shift, - sk->sk_gso_max_size - 1 - MAX_TCP_HEADER); - - /* Goal is to send at least one packet per ms, -@@ -2123,7 +2123,7 @@ static bool tcp_small_queue_check(struct - { - unsigned int limit; - -- limit = max(2 * skb->truesize, sk->sk_pacing_rate >> 10); -+ limit = max(2 * skb->truesize, sk->sk_pacing_rate >> sk->sk_pacing_shift); - limit = min_t(u32, limit, sysctl_tcp_limit_output_bytes); - limit <<= factor; - diff --git a/target/linux/generic/backport-4.9/030-01-ubifs-Drop-softlimit-and-delta-fields-from-struct-ub.patch b/target/linux/generic/backport-4.9/030-01-ubifs-Drop-softlimit-and-delta-fields-from-struct-ub.patch deleted file mode 100644 index 8e1f312a0b..0000000000 --- a/target/linux/generic/backport-4.9/030-01-ubifs-Drop-softlimit-and-delta-fields-from-struct-ub.patch +++ /dev/null @@ -1,82 +0,0 @@ -From 854826c9d526fd81077742c3b000e3f7fcaef3ce Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= -Date: Tue, 20 Sep 2016 10:36:14 +0200 -Subject: [PATCH] ubifs: Drop softlimit and delta fields from struct ubifs_wbuf -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Values of these fields are set during init and never modified. They are -used (read) in a single function only. There isn't really any reason to -keep them in a struct. It only makes struct just a bit bigger without -any visible gain. - -Signed-off-by: Rafał Miłecki -Reviewed-by: Boris Brezillon -Signed-off-by: Richard Weinberger ---- - fs/ubifs/io.c | 18 ++++++++++-------- - fs/ubifs/ubifs.h | 5 ----- - 2 files changed, 10 insertions(+), 13 deletions(-) - ---- a/fs/ubifs/io.c -+++ b/fs/ubifs/io.c -@@ -452,16 +452,22 @@ static enum hrtimer_restart wbuf_timer_c - */ - static void new_wbuf_timer_nolock(struct ubifs_wbuf *wbuf) - { -+ ktime_t softlimit = ktime_set(WBUF_TIMEOUT_SOFTLIMIT, 0); -+ unsigned long long delta; -+ -+ delta = WBUF_TIMEOUT_HARDLIMIT - WBUF_TIMEOUT_SOFTLIMIT; -+ delta *= 1000000000ULL; -+ - ubifs_assert(!hrtimer_active(&wbuf->timer)); -+ ubifs_assert(delta <= ULONG_MAX); - - if (wbuf->no_timer) - return; - dbg_io("set timer for jhead %s, %llu-%llu millisecs", - dbg_jhead(wbuf->jhead), -- div_u64(ktime_to_ns(wbuf->softlimit), USEC_PER_SEC), -- div_u64(ktime_to_ns(wbuf->softlimit) + wbuf->delta, -- USEC_PER_SEC)); -- hrtimer_start_range_ns(&wbuf->timer, wbuf->softlimit, wbuf->delta, -+ div_u64(ktime_to_ns(softlimit), USEC_PER_SEC), -+ div_u64(ktime_to_ns(softlimit) + delta, USEC_PER_SEC)); -+ hrtimer_start_range_ns(&wbuf->timer, softlimit, delta, - HRTIMER_MODE_REL); - } - -@@ -1059,10 +1065,6 @@ int ubifs_wbuf_init(struct ubifs_info *c - - hrtimer_init(&wbuf->timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL); - wbuf->timer.function = wbuf_timer_callback_nolock; -- wbuf->softlimit = ktime_set(WBUF_TIMEOUT_SOFTLIMIT, 0); -- wbuf->delta = WBUF_TIMEOUT_HARDLIMIT - WBUF_TIMEOUT_SOFTLIMIT; -- wbuf->delta *= 1000000000ULL; -- ubifs_assert(wbuf->delta <= ULONG_MAX); - return 0; - } - ---- a/fs/ubifs/ubifs.h -+++ b/fs/ubifs/ubifs.h -@@ -645,9 +645,6 @@ typedef int (*ubifs_lpt_scan_callback)(s - * @io_mutex: serializes write-buffer I/O - * @lock: serializes @buf, @lnum, @offs, @avail, @used, @next_ino and @inodes - * fields -- * @softlimit: soft write-buffer timeout interval -- * @delta: hard and soft timeouts delta (the timer expire interval is @softlimit -- * and @softlimit + @delta) - * @timer: write-buffer timer - * @no_timer: non-zero if this write-buffer does not have a timer - * @need_sync: non-zero if the timer expired and the wbuf needs sync'ing -@@ -676,8 +673,6 @@ struct ubifs_wbuf { - int (*sync_callback)(struct ubifs_info *c, int lnum, int free, int pad); - struct mutex io_mutex; - spinlock_t lock; -- ktime_t softlimit; -- unsigned long long delta; - struct hrtimer timer; - unsigned int no_timer:1; - unsigned int need_sync:1; diff --git a/target/linux/generic/backport-4.9/030-02-ubifs-Use-dirty_writeback_interval-value-for-wbuf-ti.patch b/target/linux/generic/backport-4.9/030-02-ubifs-Use-dirty_writeback_interval-value-for-wbuf-ti.patch deleted file mode 100644 index 96fa441132..0000000000 --- a/target/linux/generic/backport-4.9/030-02-ubifs-Use-dirty_writeback_interval-value-for-wbuf-ti.patch +++ /dev/null @@ -1,66 +0,0 @@ -From 1b7fc2c0069f3864a3dda15430b7aded31c0bfcc Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= -Date: Tue, 20 Sep 2016 10:36:15 +0200 -Subject: [PATCH] ubifs: Use dirty_writeback_interval value for wbuf timer -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Right now wbuf timer has hardcoded timeouts and there is no place for -manual adjustments. Some projects / cases many need that though. Few -file systems allow doing that by respecting dirty_writeback_interval -that can be set using sysctl (dirty_writeback_centisecs). - -Lowering dirty_writeback_interval could be some way of dealing with user -space apps lacking proper fsyncs. This is definitely *not* a perfect -solution but we don't have ideal (user space) world. There were already -advanced discussions on this matter, mostly when ext4 was introduced and -it wasn't behaving as ext3. Anyway, the final decision was to add some -hacks to the ext4, as trying to fix whole user space or adding new API -was pointless. - -We can't (and shouldn't?) just follow ext4. We can't e.g. sync on close -as this would cause too many commits and flash wearing. On the other -hand we still should allow some trade-off between -o sync and default -wbuf timeout. Respecting dirty_writeback_interval should allow some sane -cutomizations if used warily. - -Signed-off-by: Rafał Miłecki -Reviewed-by: Boris Brezillon -Signed-off-by: Richard Weinberger ---- - fs/ubifs/io.c | 8 ++++---- - fs/ubifs/ubifs.h | 4 ---- - 2 files changed, 4 insertions(+), 8 deletions(-) - ---- a/fs/ubifs/io.c -+++ b/fs/ubifs/io.c -@@ -452,11 +452,11 @@ static enum hrtimer_restart wbuf_timer_c - */ - static void new_wbuf_timer_nolock(struct ubifs_wbuf *wbuf) - { -- ktime_t softlimit = ktime_set(WBUF_TIMEOUT_SOFTLIMIT, 0); -- unsigned long long delta; -+ ktime_t softlimit = ms_to_ktime(dirty_writeback_interval * 10); -+ unsigned long long delta = dirty_writeback_interval; - -- delta = WBUF_TIMEOUT_HARDLIMIT - WBUF_TIMEOUT_SOFTLIMIT; -- delta *= 1000000000ULL; -+ /* centi to milli, milli to nano, then 10% */ -+ delta *= 10ULL * NSEC_PER_MSEC / 10ULL; - - ubifs_assert(!hrtimer_active(&wbuf->timer)); - ubifs_assert(delta <= ULONG_MAX); ---- a/fs/ubifs/ubifs.h -+++ b/fs/ubifs/ubifs.h -@@ -83,10 +83,6 @@ - */ - #define BGT_NAME_PATTERN "ubifs_bgt%d_%d" - --/* Write-buffer synchronization timeout interval in seconds */ --#define WBUF_TIMEOUT_SOFTLIMIT 3 --#define WBUF_TIMEOUT_HARDLIMIT 5 -- - /* Maximum possible inode number (only 32-bit inodes are supported now) */ - #define MAX_INUM 0xFFFFFFFF - diff --git a/target/linux/generic/backport-4.9/040-mm-add-support-for-releasing-multiple-instances-of-a.patch b/target/linux/generic/backport-4.9/040-mm-add-support-for-releasing-multiple-instances-of-a.patch deleted file mode 100644 index d4b60d4559..0000000000 --- a/target/linux/generic/backport-4.9/040-mm-add-support-for-releasing-multiple-instances-of-a.patch +++ /dev/null @@ -1,75 +0,0 @@ -From: Alexander Duyck -Date: Wed, 14 Dec 2016 15:05:26 -0800 -Subject: [PATCH] mm: add support for releasing multiple instances of a page - -Add a function that allows us to batch free a page that has multiple -references outstanding. Specifically this function can be used to drop -a page being used in the page frag alloc cache. With this drivers can -make use of functionality similar to the page frag alloc cache without -having to do any workarounds for the fact that there is no function that -frees multiple references. - -Link: http://lkml.kernel.org/r/20161110113606.76501.70752.stgit@ahduyck-blue-test.jf.intel.com -Signed-off-by: Alexander Duyck -Cc: "David S. Miller" -Cc: "James E.J. Bottomley" -Cc: Chris Metcalf -Cc: David Howells -Cc: Geert Uytterhoeven -Cc: Hans-Christian Noren Egtvedt -Cc: Helge Deller -Cc: James Hogan -Cc: Jeff Kirsher -Cc: Jonas Bonn -Cc: Keguang Zhang -Cc: Ley Foon Tan -Cc: Mark Salter -Cc: Max Filippov -Cc: Michael Ellerman -Cc: Michal Simek -Cc: Ralf Baechle -Cc: Rich Felker -Cc: Richard Kuo -Cc: Russell King -Cc: Steven Miao -Cc: Tobias Klauser -Cc: Vineet Gupta -Cc: Yoshinori Sato -Signed-off-by: Andrew Morton -Signed-off-by: Linus Torvalds ---- - ---- a/include/linux/gfp.h -+++ b/include/linux/gfp.h -@@ -506,6 +506,8 @@ extern void free_hot_cold_page(struct pa - extern void free_hot_cold_page_list(struct list_head *list, bool cold); - - struct page_frag_cache; -+extern void __page_frag_drain(struct page *page, unsigned int order, -+ unsigned int count); - extern void *__alloc_page_frag(struct page_frag_cache *nc, - unsigned int fragsz, gfp_t gfp_mask); - extern void __free_page_frag(void *addr); ---- a/mm/page_alloc.c -+++ b/mm/page_alloc.c -@@ -3935,6 +3935,20 @@ static struct page *__page_frag_refill(s - return page; - } - -+void __page_frag_drain(struct page *page, unsigned int order, -+ unsigned int count) -+{ -+ VM_BUG_ON_PAGE(page_ref_count(page) == 0, page); -+ -+ if (page_ref_sub_and_test(page, count)) { -+ if (order == 0) -+ free_hot_cold_page(page, false); -+ else -+ __free_pages_ok(page, order); -+ } -+} -+EXPORT_SYMBOL(__page_frag_drain); -+ - void *__alloc_page_frag(struct page_frag_cache *nc, - unsigned int fragsz, gfp_t gfp_mask) - { diff --git a/target/linux/generic/backport-4.9/041-mm-rename-__alloc_page_frag-to-page_frag_alloc-and-_.patch b/target/linux/generic/backport-4.9/041-mm-rename-__alloc_page_frag-to-page_frag_alloc-and-_.patch deleted file mode 100644 index facc43004e..0000000000 --- a/target/linux/generic/backport-4.9/041-mm-rename-__alloc_page_frag-to-page_frag_alloc-and-_.patch +++ /dev/null @@ -1,137 +0,0 @@ -From: Alexander Duyck -Date: Tue, 10 Jan 2017 16:58:06 -0800 -Subject: [PATCH] mm: rename __alloc_page_frag to page_frag_alloc and - __free_page_frag to page_frag_free - -Patch series "Page fragment updates", v4. - -This patch series takes care of a few cleanups for the page fragments -API. - -First we do some renames so that things are much more consistent. First -we move the page_frag_ portion of the name to the front of the functions -names. Secondly we split out the cache specific functions from the -other page fragment functions by adding the word "cache" to the name. - -Finally I added a bit of documentation that will hopefully help to -explain some of this. I plan to revisit this later as we get things -more ironed out in the near future with the changes planned for the DMA -setup to support eXpress Data Path. - -This patch (of 3): - -This patch renames the page frag functions to be more consistent with -other APIs. Specifically we place the name page_frag first in the name -and then have either an alloc or free call name that we append as the -suffix. This makes it a bit clearer in terms of naming. - -In addition we drop the leading double underscores since we are -technically no longer a backing interface and instead the front end that -is called from the networking APIs. - -Link: http://lkml.kernel.org/r/20170104023854.13451.67390.stgit@localhost.localdomain -Signed-off-by: Alexander Duyck -Signed-off-by: Andrew Morton -Signed-off-by: Linus Torvalds ---- - ---- a/include/linux/gfp.h -+++ b/include/linux/gfp.h -@@ -508,9 +508,9 @@ extern void free_hot_cold_page_list(stru - struct page_frag_cache; - extern void __page_frag_drain(struct page *page, unsigned int order, - unsigned int count); --extern void *__alloc_page_frag(struct page_frag_cache *nc, -- unsigned int fragsz, gfp_t gfp_mask); --extern void __free_page_frag(void *addr); -+extern void *page_frag_alloc(struct page_frag_cache *nc, -+ unsigned int fragsz, gfp_t gfp_mask); -+extern void page_frag_free(void *addr); - - #define __free_page(page) __free_pages((page), 0) - #define free_page(addr) free_pages((addr), 0) ---- a/include/linux/skbuff.h -+++ b/include/linux/skbuff.h -@@ -2476,7 +2476,7 @@ static inline struct sk_buff *netdev_all - - static inline void skb_free_frag(void *addr) - { -- __free_page_frag(addr); -+ page_frag_free(addr); - } - - void *napi_alloc_frag(unsigned int fragsz); ---- a/mm/page_alloc.c -+++ b/mm/page_alloc.c -@@ -3949,8 +3949,8 @@ void __page_frag_drain(struct page *page - } - EXPORT_SYMBOL(__page_frag_drain); - --void *__alloc_page_frag(struct page_frag_cache *nc, -- unsigned int fragsz, gfp_t gfp_mask) -+void *page_frag_alloc(struct page_frag_cache *nc, -+ unsigned int fragsz, gfp_t gfp_mask) - { - unsigned int size = PAGE_SIZE; - struct page *page; -@@ -4001,19 +4001,19 @@ refill: - - return nc->va + offset; - } --EXPORT_SYMBOL(__alloc_page_frag); -+EXPORT_SYMBOL(page_frag_alloc); - - /* - * Frees a page fragment allocated out of either a compound or order 0 page. - */ --void __free_page_frag(void *addr) -+void page_frag_free(void *addr) - { - struct page *page = virt_to_head_page(addr); - - if (unlikely(put_page_testzero(page))) - __free_pages_ok(page, compound_order(page)); - } --EXPORT_SYMBOL(__free_page_frag); -+EXPORT_SYMBOL(page_frag_free); - - static void *make_alloc_exact(unsigned long addr, unsigned int order, - size_t size) ---- a/net/core/skbuff.c -+++ b/net/core/skbuff.c -@@ -369,7 +369,7 @@ static void *__netdev_alloc_frag(unsigne - - local_irq_save(flags); - nc = this_cpu_ptr(&netdev_alloc_cache); -- data = __alloc_page_frag(nc, fragsz, gfp_mask); -+ data = page_frag_alloc(nc, fragsz, gfp_mask); - local_irq_restore(flags); - return data; - } -@@ -393,7 +393,7 @@ static void *__napi_alloc_frag(unsigned - { - struct napi_alloc_cache *nc = this_cpu_ptr(&napi_alloc_cache); - -- return __alloc_page_frag(&nc->page, fragsz, gfp_mask); -+ return page_frag_alloc(&nc->page, fragsz, gfp_mask); - } - - void *napi_alloc_frag(unsigned int fragsz) -@@ -445,7 +445,7 @@ struct sk_buff *__netdev_alloc_skb(struc - local_irq_save(flags); - - nc = this_cpu_ptr(&netdev_alloc_cache); -- data = __alloc_page_frag(nc, len, gfp_mask); -+ data = page_frag_alloc(nc, len, gfp_mask); - pfmemalloc = nc->pfmemalloc; - - local_irq_restore(flags); -@@ -509,7 +509,7 @@ struct sk_buff *__napi_alloc_skb(struct - if (sk_memalloc_socks()) - gfp_mask |= __GFP_MEMALLOC; - -- data = __alloc_page_frag(&nc->page, len, gfp_mask); -+ data = page_frag_alloc(&nc->page, len, gfp_mask); - if (unlikely(!data)) - return NULL; - diff --git a/target/linux/generic/backport-4.9/042-mm-rename-__page_frag-functions-to-__page_frag_cache.patch b/target/linux/generic/backport-4.9/042-mm-rename-__page_frag-functions-to-__page_frag_cache.patch deleted file mode 100644 index 31b57167b4..0000000000 --- a/target/linux/generic/backport-4.9/042-mm-rename-__page_frag-functions-to-__page_frag_cache.patch +++ /dev/null @@ -1,79 +0,0 @@ -From: Alexander Duyck -Date: Tue, 10 Jan 2017 16:58:09 -0800 -Subject: [PATCH] mm: rename __page_frag functions to __page_frag_cache, drop - order from drain - -This patch does two things. - -First it goes through and renames the __page_frag prefixed functions to -__page_frag_cache so that we can be clear that we are draining or -refilling the cache, not the frags themselves. - -Second we drop the order parameter from __page_frag_cache_drain since we -don't actually need to pass it since all fragments are either order 0 or -must be a compound page. - -Link: http://lkml.kernel.org/r/20170104023954.13451.5678.stgit@localhost.localdomain -Signed-off-by: Alexander Duyck -Signed-off-by: Andrew Morton -Signed-off-by: Linus Torvalds ---- - ---- a/include/linux/gfp.h -+++ b/include/linux/gfp.h -@@ -506,8 +506,7 @@ extern void free_hot_cold_page(struct pa - extern void free_hot_cold_page_list(struct list_head *list, bool cold); - - struct page_frag_cache; --extern void __page_frag_drain(struct page *page, unsigned int order, -- unsigned int count); -+extern void __page_frag_cache_drain(struct page *page, unsigned int count); - extern void *page_frag_alloc(struct page_frag_cache *nc, - unsigned int fragsz, gfp_t gfp_mask); - extern void page_frag_free(void *addr); ---- a/mm/page_alloc.c -+++ b/mm/page_alloc.c -@@ -3914,8 +3914,8 @@ EXPORT_SYMBOL(free_pages); - * drivers to provide a backing region of memory for use as either an - * sk_buff->head, or to be used in the "frags" portion of skb_shared_info. - */ --static struct page *__page_frag_refill(struct page_frag_cache *nc, -- gfp_t gfp_mask) -+static struct page *__page_frag_cache_refill(struct page_frag_cache *nc, -+ gfp_t gfp_mask) - { - struct page *page = NULL; - gfp_t gfp = gfp_mask; -@@ -3935,19 +3935,20 @@ static struct page *__page_frag_refill(s - return page; - } - --void __page_frag_drain(struct page *page, unsigned int order, -- unsigned int count) -+void __page_frag_cache_drain(struct page *page, unsigned int count) - { - VM_BUG_ON_PAGE(page_ref_count(page) == 0, page); - - if (page_ref_sub_and_test(page, count)) { -+ unsigned int order = compound_order(page); -+ - if (order == 0) - free_hot_cold_page(page, false); - else - __free_pages_ok(page, order); - } - } --EXPORT_SYMBOL(__page_frag_drain); -+EXPORT_SYMBOL(__page_frag_cache_drain); - - void *page_frag_alloc(struct page_frag_cache *nc, - unsigned int fragsz, gfp_t gfp_mask) -@@ -3958,7 +3959,7 @@ void *page_frag_alloc(struct page_frag_c - - if (unlikely(!nc->va)) { - refill: -- page = __page_frag_refill(nc, gfp_mask); -+ page = __page_frag_cache_refill(nc, gfp_mask); - if (!page) - return NULL; - diff --git a/target/linux/generic/backport-4.9/060-0002-mtd-bcm47xxsflash-use-platform_-set-get-_drvdata.patch b/target/linux/generic/backport-4.9/060-0002-mtd-bcm47xxsflash-use-platform_-set-get-_drvdata.patch deleted file mode 100644 index d975a26202..0000000000 --- a/target/linux/generic/backport-4.9/060-0002-mtd-bcm47xxsflash-use-platform_-set-get-_drvdata.patch +++ /dev/null @@ -1,63 +0,0 @@ -From be5e5099183301fb7920f8f6b66bd3ac1f820a97 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= -Date: Mon, 16 Jan 2017 17:28:18 +0100 -Subject: [PATCH] mtd: bcm47xxsflash: use platform_(set|get)_drvdata -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -We have generic place & helpers for storing platform driver data so -there is no reason for using custom priv pointer. - -This allows cleaning up struct bcma_sflash from unneeded fields. - -Signed-off-by: Rafał Miłecki -Acked-by: Kalle Valo -Acked-by: Boris Brezillon -Signed-off-by: Brian Norris ---- - drivers/mtd/devices/bcm47xxsflash.c | 6 +++--- - include/linux/bcma/bcma_driver_chipcommon.h | 3 --- - 2 files changed, 3 insertions(+), 6 deletions(-) - ---- a/drivers/mtd/devices/bcm47xxsflash.c -+++ b/drivers/mtd/devices/bcm47xxsflash.c -@@ -284,7 +284,6 @@ static int bcm47xxsflash_bcma_probe(stru - b47s = devm_kzalloc(dev, sizeof(*b47s), GFP_KERNEL); - if (!b47s) - return -ENOMEM; -- sflash->priv = b47s; - - res = platform_get_resource(pdev, IORESOURCE_MEM, 0); - if (!res) { -@@ -320,6 +319,8 @@ static int bcm47xxsflash_bcma_probe(stru - b47s->size = sflash->size; - bcm47xxsflash_fill_mtd(b47s, &pdev->dev); - -+ platform_set_drvdata(pdev, b47s); -+ - err = mtd_device_parse_register(&b47s->mtd, probes, NULL, NULL, 0); - if (err) { - pr_err("Failed to register MTD device: %d\n", err); -@@ -335,8 +336,7 @@ static int bcm47xxsflash_bcma_probe(stru - - static int bcm47xxsflash_bcma_remove(struct platform_device *pdev) - { -- struct bcma_sflash *sflash = dev_get_platdata(&pdev->dev); -- struct bcm47xxsflash *b47s = sflash->priv; -+ struct bcm47xxsflash *b47s = platform_get_drvdata(pdev); - - mtd_device_unregister(&b47s->mtd); - iounmap(b47s->window); ---- a/include/linux/bcma/bcma_driver_chipcommon.h -+++ b/include/linux/bcma/bcma_driver_chipcommon.h -@@ -593,9 +593,6 @@ struct bcma_sflash { - u32 blocksize; - u16 numblocks; - u32 size; -- -- struct mtd_info *mtd; -- void *priv; - }; - #endif - diff --git a/target/linux/generic/backport-4.9/060-0003-mtd-bcm47xxsflash-support-reading-flash-out-of-mappi.patch b/target/linux/generic/backport-4.9/060-0003-mtd-bcm47xxsflash-support-reading-flash-out-of-mappi.patch deleted file mode 100644 index ecdae2a871..0000000000 --- a/target/linux/generic/backport-4.9/060-0003-mtd-bcm47xxsflash-support-reading-flash-out-of-mappi.patch +++ /dev/null @@ -1,81 +0,0 @@ -From ccc38234fdc70120be79e7fb2df5c27ca5cd4c8a Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= -Date: Wed, 8 Feb 2017 23:53:44 +0100 -Subject: [PATCH] mtd: bcm47xxsflash: support reading flash out of mapping - window -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -For reading flash content we use MMIO but it's possible to read only -first 16 MiB this way. It's simply an arch design/limitation. -To support flash sizes bigger than 16 MiB implement indirect access -using ChipCommon registers. -This has been tested using MX25L25635F. - -Signed-off-by: Rafał Miłecki -Acked-by: Marek Vasut -Signed-off-by: Brian Norris ---- - drivers/mtd/devices/bcm47xxsflash.c | 24 +++++++++++++++++++++--- - drivers/mtd/devices/bcm47xxsflash.h | 3 +++ - 2 files changed, 24 insertions(+), 3 deletions(-) - ---- a/drivers/mtd/devices/bcm47xxsflash.c -+++ b/drivers/mtd/devices/bcm47xxsflash.c -@@ -105,15 +105,33 @@ static int bcm47xxsflash_read(struct mtd - size_t *retlen, u_char *buf) - { - struct bcm47xxsflash *b47s = mtd->priv; -+ size_t orig_len = len; - - /* Check address range */ - if ((from + len) > mtd->size) - return -EINVAL; - -- memcpy_fromio(buf, b47s->window + from, len); -- *retlen = len; -+ /* Read as much as possible using fast MMIO window */ -+ if (from < BCM47XXSFLASH_WINDOW_SZ) { -+ size_t memcpy_len; - -- return len; -+ memcpy_len = min(len, (size_t)(BCM47XXSFLASH_WINDOW_SZ - from)); -+ memcpy_fromio(buf, b47s->window + from, memcpy_len); -+ from += memcpy_len; -+ len -= memcpy_len; -+ buf += memcpy_len; -+ } -+ -+ /* Use indirect access for content out of the window */ -+ for (; len; len--) { -+ b47s->cc_write(b47s, BCMA_CC_FLASHADDR, from++); -+ bcm47xxsflash_cmd(b47s, OPCODE_ST_READ4B); -+ *buf++ = b47s->cc_read(b47s, BCMA_CC_FLASHDATA); -+ } -+ -+ *retlen = orig_len; -+ -+ return orig_len; - } - - static int bcm47xxsflash_write_st(struct mtd_info *mtd, u32 offset, size_t len, ---- a/drivers/mtd/devices/bcm47xxsflash.h -+++ b/drivers/mtd/devices/bcm47xxsflash.h -@@ -3,6 +3,8 @@ - - #include - -+#define BCM47XXSFLASH_WINDOW_SZ SZ_16M -+ - /* Used for ST flashes only. */ - #define OPCODE_ST_WREN 0x0006 /* Write Enable */ - #define OPCODE_ST_WRDIS 0x0004 /* Write Disable */ -@@ -16,6 +18,7 @@ - #define OPCODE_ST_RES 0x03ab /* Read Electronic Signature */ - #define OPCODE_ST_CSA 0x1000 /* Keep chip select asserted */ - #define OPCODE_ST_SSE 0x0220 /* Sub-sector Erase */ -+#define OPCODE_ST_READ4B 0x6313 /* Read Data Bytes in 4Byte addressing mode */ - - /* Used for Atmel flashes only. */ - #define OPCODE_AT_READ 0x07e8 diff --git a/target/linux/generic/backport-4.9/060-0004-mtd-bcm47xxpart-move-TRX-parsing-code-to-separated-f.patch b/target/linux/generic/backport-4.9/060-0004-mtd-bcm47xxpart-move-TRX-parsing-code-to-separated-f.patch deleted file mode 100644 index 999f544d3b..0000000000 --- a/target/linux/generic/backport-4.9/060-0004-mtd-bcm47xxpart-move-TRX-parsing-code-to-separated-f.patch +++ /dev/null @@ -1,180 +0,0 @@ -From b522d7b0ebe3539340c2a6d46d787ae3d33bcb92 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= -Date: Tue, 10 Jan 2017 23:15:24 +0100 -Subject: [PATCH] mtd: bcm47xxpart: move TRX parsing code to separated function -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -This change simplifies main parsing loop logic a bit. In future it may -be useful for moving TRX support to separated module / parser (if we -implement support for them at some point). -Finally parsing TRX at the end puts us in a better position as we have -better flash layout knowledge. It may be useful e.g. if it appears there -is more than 1 TRX partition. - -Signed-off-by: Rafał Miłecki -Acked-by: Marek Vasut -Signed-off-by: Brian Norris ---- - drivers/mtd/bcm47xxpart.c | 121 ++++++++++++++++++++++++++++------------------ - 1 file changed, 74 insertions(+), 47 deletions(-) - ---- a/drivers/mtd/bcm47xxpart.c -+++ b/drivers/mtd/bcm47xxpart.c -@@ -83,6 +83,67 @@ out_default: - return "rootfs"; - } - -+static int bcm47xxpart_parse_trx(struct mtd_info *master, -+ struct mtd_partition *trx, -+ struct mtd_partition *parts, -+ size_t parts_len) -+{ -+ struct trx_header header; -+ size_t bytes_read; -+ int curr_part = 0; -+ int i, err; -+ -+ if (parts_len < 3) { -+ pr_warn("No enough space to add TRX partitions!\n"); -+ return -ENOMEM; -+ } -+ -+ err = mtd_read(master, trx->offset, sizeof(header), &bytes_read, -+ (uint8_t *)&header); -+ if (err && !mtd_is_bitflip(err)) { -+ pr_err("mtd_read error while reading TRX header: %d\n", err); -+ return err; -+ } -+ -+ i = 0; -+ -+ /* We have LZMA loader if offset[2] points to sth */ -+ if (header.offset[2]) { -+ bcm47xxpart_add_part(&parts[curr_part++], "loader", -+ trx->offset + header.offset[i], 0); -+ i++; -+ } -+ -+ if (header.offset[i]) { -+ bcm47xxpart_add_part(&parts[curr_part++], "linux", -+ trx->offset + header.offset[i], 0); -+ i++; -+ } -+ -+ if (header.offset[i]) { -+ size_t offset = trx->offset + header.offset[i]; -+ const char *name = bcm47xxpart_trx_data_part_name(master, -+ offset); -+ -+ bcm47xxpart_add_part(&parts[curr_part++], name, offset, 0); -+ i++; -+ } -+ -+ /* -+ * Assume that every partition ends at the beginning of the one it is -+ * followed by. -+ */ -+ for (i = 0; i < curr_part; i++) { -+ u64 next_part_offset = (i < curr_part - 1) ? -+ parts[i + 1].offset : -+ trx->offset + trx->size; -+ -+ parts[i].size = next_part_offset - parts[i].offset; -+ } -+ -+ return curr_part; -+} -+ - static int bcm47xxpart_parse(struct mtd_info *master, - const struct mtd_partition **pparts, - struct mtd_part_parser_data *data) -@@ -93,9 +154,7 @@ static int bcm47xxpart_parse(struct mtd_ - size_t bytes_read; - uint32_t offset; - uint32_t blocksize = master->erasesize; -- struct trx_header *trx; - int trx_part = -1; -- int last_trx_part = -1; - int possible_nvram_sizes[] = { 0x8000, 0xF000, 0x10000, }; - int err; - -@@ -182,54 +241,14 @@ static int bcm47xxpart_parse(struct mtd_ - - /* TRX */ - if (buf[0x000 / 4] == TRX_MAGIC) { -- if (BCM47XXPART_MAX_PARTS - curr_part < 4) { -- pr_warn("Not enough partitions left to register trx, scanning stopped!\n"); -- break; -- } -- -- trx = (struct trx_header *)buf; -+ struct trx_header *trx; - - trx_part = curr_part; - bcm47xxpart_add_part(&parts[curr_part++], "firmware", - offset, 0); - -- i = 0; -- /* We have LZMA loader if offset[2] points to sth */ -- if (trx->offset[2]) { -- bcm47xxpart_add_part(&parts[curr_part++], -- "loader", -- offset + trx->offset[i], -- 0); -- i++; -- } -- -- if (trx->offset[i]) { -- bcm47xxpart_add_part(&parts[curr_part++], -- "linux", -- offset + trx->offset[i], -- 0); -- i++; -- } -- -- /* -- * Pure rootfs size is known and can be calculated as: -- * trx->length - trx->offset[i]. We don't fill it as -- * we want to have jffs2 (overlay) in the same mtd. -- */ -- if (trx->offset[i]) { -- const char *name; -- -- name = bcm47xxpart_trx_data_part_name(master, offset + trx->offset[i]); -- bcm47xxpart_add_part(&parts[curr_part++], -- name, -- offset + trx->offset[i], -- 0); -- i++; -- } -- -- last_trx_part = curr_part - 1; -- - /* Jump to the end of TRX */ -+ trx = (struct trx_header *)buf; - offset = roundup(offset + trx->length, blocksize); - /* Next loop iteration will increase the offset */ - offset -= blocksize; -@@ -307,9 +326,17 @@ static int bcm47xxpart_parse(struct mtd_ - parts[i + 1].offset : master->size; - - parts[i].size = next_part_offset - parts[i].offset; -- if (i == last_trx_part && trx_part >= 0) -- parts[trx_part].size = next_part_offset - -- parts[trx_part].offset; -+ } -+ -+ /* If there was TRX parse it now */ -+ if (trx_part >= 0) { -+ int num_parts; -+ -+ num_parts = bcm47xxpart_parse_trx(master, &parts[trx_part], -+ parts + curr_part, -+ BCM47XXPART_MAX_PARTS - curr_part); -+ if (num_parts > 0) -+ curr_part += num_parts; - } - - *pparts = parts; diff --git a/target/linux/generic/backport-4.9/060-0005-mtd-bcm47xxpart-support-layouts-with-multiple-TRX-pa.patch b/target/linux/generic/backport-4.9/060-0005-mtd-bcm47xxpart-support-layouts-with-multiple-TRX-pa.patch deleted file mode 100644 index bcefee8e87..0000000000 --- a/target/linux/generic/backport-4.9/060-0005-mtd-bcm47xxpart-support-layouts-with-multiple-TRX-pa.patch +++ /dev/null @@ -1,112 +0,0 @@ -From 89a0d9a9f1941a086a82bc7cd73d275cec98ba14 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= -Date: Tue, 10 Jan 2017 23:15:25 +0100 -Subject: [PATCH] mtd: bcm47xxpart: support layouts with multiple TRX - partitions -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Some devices may have an extra TRX partition used as failsafe one. If -we detect such partition we should set a proper name for it and don't -parse it. - -Signed-off-by: Rafał Miłecki -Acked-by: Marek Vasut -Signed-off-by: Brian Norris ---- - drivers/mtd/bcm47xxpart.c | 56 ++++++++++++++++++++++++++++++++++++++--------- - 1 file changed, 46 insertions(+), 10 deletions(-) - ---- a/drivers/mtd/bcm47xxpart.c -+++ b/drivers/mtd/bcm47xxpart.c -@@ -9,6 +9,7 @@ - * - */ - -+#include - #include - #include - #include -@@ -144,6 +145,30 @@ static int bcm47xxpart_parse_trx(struct - return curr_part; - } - -+/** -+ * bcm47xxpart_bootpartition - gets index of TRX partition used by bootloader -+ * -+ * Some devices may have more than one TRX partition. In such case one of them -+ * is the main one and another a failsafe one. Bootloader may fallback to the -+ * failsafe firmware if it detects corruption of the main image. -+ * -+ * This function provides info about currently used TRX partition. It's the one -+ * containing kernel started by the bootloader. -+ */ -+static int bcm47xxpart_bootpartition(void) -+{ -+ char buf[4]; -+ int bootpartition; -+ -+ /* Check CFE environment variable */ -+ if (bcm47xx_nvram_getenv("bootpartition", buf, sizeof(buf)) > 0) { -+ if (!kstrtoint(buf, 0, &bootpartition)) -+ return bootpartition; -+ } -+ -+ return 0; -+} -+ - static int bcm47xxpart_parse(struct mtd_info *master, - const struct mtd_partition **pparts, - struct mtd_part_parser_data *data) -@@ -154,7 +179,8 @@ static int bcm47xxpart_parse(struct mtd_ - size_t bytes_read; - uint32_t offset; - uint32_t blocksize = master->erasesize; -- int trx_part = -1; -+ int trx_parts[2]; /* Array with indexes of TRX partitions */ -+ int trx_num = 0; /* Number of found TRX partitions */ - int possible_nvram_sizes[] = { 0x8000, 0xF000, 0x10000, }; - int err; - -@@ -243,7 +269,11 @@ static int bcm47xxpart_parse(struct mtd_ - if (buf[0x000 / 4] == TRX_MAGIC) { - struct trx_header *trx; - -- trx_part = curr_part; -+ if (trx_num >= ARRAY_SIZE(trx_parts)) -+ pr_warn("No enough space to store another TRX found at 0x%X\n", -+ offset); -+ else -+ trx_parts[trx_num++] = curr_part; - bcm47xxpart_add_part(&parts[curr_part++], "firmware", - offset, 0); - -@@ -329,14 +359,20 @@ static int bcm47xxpart_parse(struct mtd_ - } - - /* If there was TRX parse it now */ -- if (trx_part >= 0) { -- int num_parts; -+ for (i = 0; i < trx_num; i++) { -+ struct mtd_partition *trx = &parts[trx_parts[i]]; - -- num_parts = bcm47xxpart_parse_trx(master, &parts[trx_part], -- parts + curr_part, -- BCM47XXPART_MAX_PARTS - curr_part); -- if (num_parts > 0) -- curr_part += num_parts; -+ if (i == bcm47xxpart_bootpartition()) { -+ int num_parts; -+ -+ num_parts = bcm47xxpart_parse_trx(master, trx, -+ parts + curr_part, -+ BCM47XXPART_MAX_PARTS - curr_part); -+ if (num_parts > 0) -+ curr_part += num_parts; -+ } else { -+ trx->name = "failsafe"; -+ } - } - - *pparts = parts; diff --git a/target/linux/generic/backport-4.9/061-v4.10-0001-mtd-spi-nor-add-Macronix-mx25u25635f-to-list-of-know.patch b/target/linux/generic/backport-4.9/061-v4.10-0001-mtd-spi-nor-add-Macronix-mx25u25635f-to-list-of-know.patch deleted file mode 100644 index a70d827782..0000000000 --- a/target/linux/generic/backport-4.9/061-v4.10-0001-mtd-spi-nor-add-Macronix-mx25u25635f-to-list-of-know.patch +++ /dev/null @@ -1,22 +0,0 @@ -From 355445b86f0f61125409e1217be4f0a8ee362116 Mon Sep 17 00:00:00 2001 -From: Ash Benz -Date: Sat, 19 Nov 2016 07:51:49 +0800 -Subject: [PATCH] mtd: spi-nor: add Macronix mx25u25635f to list of known - devices. - -Signed-off-by: Ash Benz -Signed-off-by: Cyrille Pitchen ---- - drivers/mtd/spi-nor/spi-nor.c | 1 + - 1 file changed, 1 insertion(+) - ---- a/drivers/mtd/spi-nor/spi-nor.c -+++ b/drivers/mtd/spi-nor/spi-nor.c -@@ -878,6 +878,7 @@ static const struct flash_info spi_nor_i - { "mx25l12805d", INFO(0xc22018, 0, 64 * 1024, 256, 0) }, - { "mx25l12855e", INFO(0xc22618, 0, 64 * 1024, 256, 0) }, - { "mx25l25635e", INFO(0xc22019, 0, 64 * 1024, 512, 0) }, -+ { "mx25u25635f", INFO(0xc22539, 0, 64 * 1024, 512, SECT_4K) }, - { "mx25l25655e", INFO(0xc22619, 0, 64 * 1024, 512, 0) }, - { "mx66l51235l", INFO(0xc2201a, 0, 64 * 1024, 1024, SPI_NOR_QUAD_READ) }, - { "mx66l1g55g", INFO(0xc2261b, 0, 64 * 1024, 2048, SPI_NOR_QUAD_READ) }, diff --git a/target/linux/generic/backport-4.9/061-v4.10-0002-mtd-spi-nor-fix-spansion-quad-enable.patch b/target/linux/generic/backport-4.9/061-v4.10-0002-mtd-spi-nor-fix-spansion-quad-enable.patch deleted file mode 100644 index e4563ebeb6..0000000000 --- a/target/linux/generic/backport-4.9/061-v4.10-0002-mtd-spi-nor-fix-spansion-quad-enable.patch +++ /dev/null @@ -1,42 +0,0 @@ -From 807c16253319ee6ccf8873ae64f070f7eb532cd5 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Jo=C3=ABl=20Esponde?= -Date: Wed, 23 Nov 2016 12:47:40 +0100 -Subject: [PATCH] mtd: spi-nor: fix spansion quad enable -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -With the S25FL127S nor flash part, each writing to the configuration -register takes hundreds of ms. During that time, no more accesses to -the flash should be done (even reads). - -This commit adds a wait loop after the register writing until the flash -finishes its work. - -This issue could make rootfs mounting fail when the latter was done too -much closely to this quad enable bit setting step. And in this case, a -driver as UBIFS may try to recover the filesystem and may broke it -completely. - -Signed-off-by: Joël Esponde -Signed-off-by: Cyrille Pitchen ---- - drivers/mtd/spi-nor/spi-nor.c | 7 +++++++ - 1 file changed, 7 insertions(+) - ---- a/drivers/mtd/spi-nor/spi-nor.c -+++ b/drivers/mtd/spi-nor/spi-nor.c -@@ -1269,6 +1269,13 @@ static int spansion_quad_enable(struct s - return ret; - } - -+ ret = spi_nor_wait_till_ready(nor); -+ if (ret) { -+ dev_err(nor->dev, -+ "timeout while writing configuration register\n"); -+ return ret; -+ } -+ - /* read back and check it */ - ret = read_cr(nor); - if (!(ret > 0 && (ret & CR_QUAD_EN_SPAN))) { diff --git a/target/linux/generic/backport-4.9/061-v4.10-0003-mtd-spi-nor-fix-flags-for-s25fl128s.patch b/target/linux/generic/backport-4.9/061-v4.10-0003-mtd-spi-nor-fix-flags-for-s25fl128s.patch deleted file mode 100644 index 76c5d2d971..0000000000 --- a/target/linux/generic/backport-4.9/061-v4.10-0003-mtd-spi-nor-fix-flags-for-s25fl128s.patch +++ /dev/null @@ -1,28 +0,0 @@ -From 4287916d7bab2806305d3296b4cf261fa49d959b Mon Sep 17 00:00:00 2001 -From: Heiner Kallweit -Date: Thu, 27 Oct 2016 23:13:26 +0200 -Subject: [PATCH] mtd: spi-nor: fix flags for s25fl128s - -The Spansion S25FL128S also supports dual read mode. -In addition remove flag SECT_4K. 4K erases are supported, -but not uniformly. - -Signed-off-by: Heiner Kallweit -Reviewed-by: Jagan Teki -Acked-by: Marek Vasut -Signed-off-by: Cyrille Pitchen ---- - drivers/mtd/spi-nor/spi-nor.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - ---- a/drivers/mtd/spi-nor/spi-nor.c -+++ b/drivers/mtd/spi-nor/spi-nor.c -@@ -912,7 +912,7 @@ static const struct flash_info spi_nor_i - { "s70fl01gs", INFO(0x010221, 0x4d00, 256 * 1024, 256, 0) }, - { "s25sl12800", INFO(0x012018, 0x0300, 256 * 1024, 64, 0) }, - { "s25sl12801", INFO(0x012018, 0x0301, 64 * 1024, 256, 0) }, -- { "s25fl128s", INFO6(0x012018, 0x4d0180, 64 * 1024, 256, SECT_4K | SPI_NOR_QUAD_READ) }, -+ { "s25fl128s", INFO6(0x012018, 0x4d0180, 64 * 1024, 256, SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ) }, - { "s25fl129p0", INFO(0x012018, 0x4d00, 256 * 1024, 64, SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ) }, - { "s25fl129p1", INFO(0x012018, 0x4d01, 64 * 1024, 256, SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ) }, - { "s25sl004a", INFO(0x010212, 0, 64 * 1024, 8, 0) }, diff --git a/target/linux/generic/backport-4.9/061-v4.10-0004-mtd-spi-nor-add-support-for-s25fl208k.patch b/target/linux/generic/backport-4.9/061-v4.10-0004-mtd-spi-nor-add-support-for-s25fl208k.patch deleted file mode 100644 index 004c1c5151..0000000000 --- a/target/linux/generic/backport-4.9/061-v4.10-0004-mtd-spi-nor-add-support-for-s25fl208k.patch +++ /dev/null @@ -1,23 +0,0 @@ -From 022a400f90ceeb26405edd5e077d56e2f38c8123 Mon Sep 17 00:00:00 2001 -From: Sean Nyekjaer -Date: Wed, 5 Oct 2016 10:59:49 +0200 -Subject: [PATCH] mtd: spi-nor: add support for s25fl208k - -Signed-off-by: Sean Nyekjaer -Reviewed-by: Jagan Teki -Acked-by: Marek Vasut -Signed-off-by: Cyrille Pitchen ---- - drivers/mtd/spi-nor/spi-nor.c | 1 + - 1 file changed, 1 insertion(+) - ---- a/drivers/mtd/spi-nor/spi-nor.c -+++ b/drivers/mtd/spi-nor/spi-nor.c -@@ -928,6 +928,7 @@ static const struct flash_info spi_nor_i - { "s25fl132k", INFO(0x014016, 0, 64 * 1024, 64, SECT_4K) }, - { "s25fl164k", INFO(0x014017, 0, 64 * 1024, 128, SECT_4K) }, - { "s25fl204k", INFO(0x014013, 0, 64 * 1024, 8, SECT_4K | SPI_NOR_DUAL_READ) }, -+ { "s25fl208k", INFO(0x014014, 0, 64 * 1024, 16, SECT_4K | SPI_NOR_DUAL_READ) }, - - /* SST -- large erase sizes are "overlays", "sectors" are 4K */ - { "sst25vf040b", INFO(0xbf258d, 0, 64 * 1024, 8, SECT_4K | SST_WRITE) }, diff --git a/target/linux/generic/backport-4.9/061-v4.10-0005-mtd-spi-nor-Add-at25df321-spi-nor-flash-support.patch b/target/linux/generic/backport-4.9/061-v4.10-0005-mtd-spi-nor-Add-at25df321-spi-nor-flash-support.patch deleted file mode 100644 index b97d8c7857..0000000000 --- a/target/linux/generic/backport-4.9/061-v4.10-0005-mtd-spi-nor-Add-at25df321-spi-nor-flash-support.patch +++ /dev/null @@ -1,26 +0,0 @@ -From b08618c929b289699a496b8d45a4e1a014187e56 Mon Sep 17 00:00:00 2001 -From: Jagan Teki -Date: Tue, 26 Jul 2016 14:07:54 +0530 -Subject: [PATCH] mtd: spi-nor: Add at25df321 spi-nor flash support - -Add Atmel at25df321 spi-nor flash to the list of spi_nor_ids. - -Cc: Brian Norris -Cc: Wenyou Yang -Signed-off-by: Jagan Teki -Acked-by: Wenyou Yang -Signed-off-by: Cyrille Pitchen ---- - drivers/mtd/spi-nor/spi-nor.c | 1 + - 1 file changed, 1 insertion(+) - ---- a/drivers/mtd/spi-nor/spi-nor.c -+++ b/drivers/mtd/spi-nor/spi-nor.c -@@ -799,6 +799,7 @@ static const struct flash_info spi_nor_i - { "at25fs040", INFO(0x1f6604, 0, 64 * 1024, 8, SECT_4K) }, - - { "at25df041a", INFO(0x1f4401, 0, 64 * 1024, 8, SECT_4K) }, -+ { "at25df321", INFO(0x1f4700, 0, 64 * 1024, 64, SECT_4K) }, - { "at25df321a", INFO(0x1f4701, 0, 64 * 1024, 64, SECT_4K) }, - { "at25df641", INFO(0x1f4800, 0, 64 * 1024, 128, SECT_4K) }, - diff --git a/target/linux/generic/backport-4.9/061-v4.10-0006-mtd-spi-nor-Add-support-for-N25Q016A.patch b/target/linux/generic/backport-4.9/061-v4.10-0006-mtd-spi-nor-Add-support-for-N25Q016A.patch deleted file mode 100644 index 8df61f6ed2..0000000000 --- a/target/linux/generic/backport-4.9/061-v4.10-0006-mtd-spi-nor-Add-support-for-N25Q016A.patch +++ /dev/null @@ -1,29 +0,0 @@ -From 61e4611864b396c7e9040b7335f25d3921bc87cd Mon Sep 17 00:00:00 2001 -From: Moritz Fischer -Date: Fri, 15 Jul 2016 10:03:48 -0700 -Subject: [PATCH] mtd: spi-nor: Add support for N25Q016A - -This commit adds support in the spi-nor driver for the -N25Q016A, a 16Mbit SPI NOR flash from Micron. - -Cc: David Woodhouse -Cc: Brian Norris -Cc: Jagan Teki - -Signed-off-by: Moritz Fischer -Reviewed-by: Jagan Teki -Signed-off-by: Cyrille Pitchen ---- - drivers/mtd/spi-nor/spi-nor.c | 1 + - 1 file changed, 1 insertion(+) - ---- a/drivers/mtd/spi-nor/spi-nor.c -+++ b/drivers/mtd/spi-nor/spi-nor.c -@@ -885,6 +885,7 @@ static const struct flash_info spi_nor_i - { "mx66l1g55g", INFO(0xc2261b, 0, 64 * 1024, 2048, SPI_NOR_QUAD_READ) }, - - /* Micron */ -+ { "n25q016a", INFO(0x20bb15, 0, 64 * 1024, 32, SECT_4K | SPI_NOR_QUAD_READ) }, - { "n25q032", INFO(0x20ba16, 0, 64 * 1024, 64, SPI_NOR_QUAD_READ) }, - { "n25q032a", INFO(0x20bb16, 0, 64 * 1024, 64, SPI_NOR_QUAD_READ) }, - { "n25q064", INFO(0x20ba17, 0, 64 * 1024, 128, SECT_4K | SPI_NOR_QUAD_READ) }, diff --git a/target/linux/generic/backport-4.9/061-v4.10-0007-mtd-spi-nor-Add-support-for-mr25h40.patch b/target/linux/generic/backport-4.9/061-v4.10-0007-mtd-spi-nor-Add-support-for-mr25h40.patch deleted file mode 100644 index 3bae77db7c..0000000000 --- a/target/linux/generic/backport-4.9/061-v4.10-0007-mtd-spi-nor-Add-support-for-mr25h40.patch +++ /dev/null @@ -1,25 +0,0 @@ -From edd0c8f4932dbf3e21036cb443ba5bdf7449d02b Mon Sep 17 00:00:00 2001 -From: IWAMOTO Masahiko -Date: Wed, 5 Oct 2016 08:22:52 +0000 -Subject: [PATCH] mtd: spi-nor: Add support for mr25h40 - -Add Everspin mr25h40 512KB MRAM to the list of supported chips. - -Signed-off-by: Masahiko Iwamoto -Reviewed-by: Jagan Teki -Acked-by: Marek Vasut -Signed-off-by: Cyrille Pitchen ---- - drivers/mtd/spi-nor/spi-nor.c | 1 + - 1 file changed, 1 insertion(+) - ---- a/drivers/mtd/spi-nor/spi-nor.c -+++ b/drivers/mtd/spi-nor/spi-nor.c -@@ -826,6 +826,7 @@ static const struct flash_info spi_nor_i - /* Everspin */ - { "mr25h256", CAT25_INFO( 32 * 1024, 1, 256, 2, SPI_NOR_NO_ERASE | SPI_NOR_NO_FR) }, - { "mr25h10", CAT25_INFO(128 * 1024, 1, 256, 3, SPI_NOR_NO_ERASE | SPI_NOR_NO_FR) }, -+ { "mr25h40", CAT25_INFO(512 * 1024, 1, 256, 3, SPI_NOR_NO_ERASE | SPI_NOR_NO_FR) }, - - /* Fujitsu */ - { "mb85rs1mt", INFO(0x047f27, 0, 128 * 1024, 1, SPI_NOR_NO_ERASE) }, diff --git a/target/linux/generic/backport-4.9/062-v4.11-0001-mtd-spi-nor-Add-support-for-S3AN-spi-nor-devices.patch b/target/linux/generic/backport-4.9/062-v4.11-0001-mtd-spi-nor-Add-support-for-S3AN-spi-nor-devices.patch deleted file mode 100644 index a174984921..0000000000 --- a/target/linux/generic/backport-4.9/062-v4.11-0001-mtd-spi-nor-Add-support-for-S3AN-spi-nor-devices.patch +++ /dev/null @@ -1,312 +0,0 @@ -From 61cba34bd6c1bddfc38f94cc3f80bdfefcc3393b Mon Sep 17 00:00:00 2001 -From: Ricardo Ribalda -Date: Fri, 2 Dec 2016 12:31:44 +0100 -Subject: [PATCH] mtd: spi-nor: Add support for S3AN spi-nor devices - -Xilinx Spartan-3AN FPGAs contain an In-System Flash where they keep -their configuration data and (optionally) some user data. - -The protocol of this flash follows most of the spi-nor standard. With -the following differences: - -- Page size might not be a power of two. -- The address calculation (default addressing mode). -- The spi nor commands used. - -Protocol is described on Xilinx User Guide UG333 - -Signed-off-by: Ricardo Ribalda Delgado -Cc: Boris Brezillon -Cc: Brian Norris -Cc: Marek Vasut -Reviewed-by: Marek Vasut -Signed-off-by: Cyrille Pitchen ---- - drivers/mtd/spi-nor/spi-nor.c | 154 ++++++++++++++++++++++++++++++++++++++++-- - include/linux/mtd/spi-nor.h | 12 ++++ - 2 files changed, 161 insertions(+), 5 deletions(-) - ---- a/drivers/mtd/spi-nor/spi-nor.c -+++ b/drivers/mtd/spi-nor/spi-nor.c -@@ -75,6 +75,12 @@ struct flash_info { - * bit. Must be used with - * SPI_NOR_HAS_LOCK. - */ -+#define SPI_S3AN BIT(10) /* -+ * Xilinx Spartan 3AN In-System Flash -+ * (MFR cannot be used for probing -+ * because it has the same value as -+ * ATMEL flashes) -+ */ - }; - - #define JEDEC_MFR(info) ((info)->id[0]) -@@ -217,6 +223,21 @@ static inline int set_4byte(struct spi_n - return nor->write_reg(nor, SPINOR_OP_BRWR, nor->cmd_buf, 1); - } - } -+ -+static int s3an_sr_ready(struct spi_nor *nor) -+{ -+ int ret; -+ u8 val; -+ -+ ret = nor->read_reg(nor, SPINOR_OP_XRDSR, &val, 1); -+ if (ret < 0) { -+ dev_err(nor->dev, "error %d reading XRDSR\n", (int) ret); -+ return ret; -+ } -+ -+ return !!(val & XSR_RDY); -+} -+ - static inline int spi_nor_sr_ready(struct spi_nor *nor) - { - int sr = read_sr(nor); -@@ -238,7 +259,11 @@ static inline int spi_nor_fsr_ready(stru - static int spi_nor_ready(struct spi_nor *nor) - { - int sr, fsr; -- sr = spi_nor_sr_ready(nor); -+ -+ if (nor->flags & SNOR_F_READY_XSR_RDY) -+ sr = s3an_sr_ready(nor); -+ else -+ sr = spi_nor_sr_ready(nor); - if (sr < 0) - return sr; - fsr = nor->flags & SNOR_F_USE_FSR ? spi_nor_fsr_ready(nor) : 1; -@@ -320,6 +345,24 @@ static void spi_nor_unlock_and_unprep(st - } - - /* -+ * This code converts an address to the Default Address Mode, that has non -+ * power of two page sizes. We must support this mode because it is the default -+ * mode supported by Xilinx tools, it can access the whole flash area and -+ * changing over to the Power-of-two mode is irreversible and corrupts the -+ * original data. -+ * Addr can safely be unsigned int, the biggest S3AN device is smaller than -+ * 4 MiB. -+ */ -+static loff_t spi_nor_s3an_addr_convert(struct spi_nor *nor, unsigned int addr) -+{ -+ unsigned int offset = addr; -+ -+ offset %= nor->page_size; -+ -+ return ((addr - offset) << 1) | offset; -+} -+ -+/* - * Initiate the erasure of a single sector - */ - static int spi_nor_erase_sector(struct spi_nor *nor, u32 addr) -@@ -327,6 +370,9 @@ static int spi_nor_erase_sector(struct s - u8 buf[SPI_NOR_MAX_ADDR_WIDTH]; - int i; - -+ if (nor->flags & SNOR_F_S3AN_ADDR_DEFAULT) -+ addr = spi_nor_s3an_addr_convert(nor, addr); -+ - if (nor->erase) - return nor->erase(nor, addr); - -@@ -368,7 +414,7 @@ static int spi_nor_erase(struct mtd_info - return ret; - - /* whole-chip erase? */ -- if (len == mtd->size) { -+ if (len == mtd->size && !(nor->flags & SNOR_F_NO_OP_CHIP_ERASE)) { - unsigned long timeout; - - write_enable(nor); -@@ -782,6 +828,19 @@ static int spi_nor_is_locked(struct mtd_ - .addr_width = (_addr_width), \ - .flags = (_flags), - -+#define S3AN_INFO(_jedec_id, _n_sectors, _page_size) \ -+ .id = { \ -+ ((_jedec_id) >> 16) & 0xff, \ -+ ((_jedec_id) >> 8) & 0xff, \ -+ (_jedec_id) & 0xff \ -+ }, \ -+ .id_len = 3, \ -+ .sector_size = (8*_page_size), \ -+ .n_sectors = (_n_sectors), \ -+ .page_size = _page_size, \ -+ .addr_width = 3, \ -+ .flags = SPI_NOR_NO_FR | SPI_S3AN, -+ - /* NOTE: double check command sets and memory organization when you add - * more nor chips. This current list focusses on newer chips, which - * have been converging on command sets which including JEDEC ID. -@@ -1020,6 +1079,13 @@ static const struct flash_info spi_nor_i - { "cat25c09", CAT25_INFO( 128, 8, 32, 2, SPI_NOR_NO_ERASE | SPI_NOR_NO_FR) }, - { "cat25c17", CAT25_INFO( 256, 8, 32, 2, SPI_NOR_NO_ERASE | SPI_NOR_NO_FR) }, - { "cat25128", CAT25_INFO(2048, 8, 64, 2, SPI_NOR_NO_ERASE | SPI_NOR_NO_FR) }, -+ -+ /* Xilinx S3AN Internal Flash */ -+ { "3S50AN", S3AN_INFO(0x1f2200, 64, 264) }, -+ { "3S200AN", S3AN_INFO(0x1f2400, 256, 264) }, -+ { "3S400AN", S3AN_INFO(0x1f2400, 256, 264) }, -+ { "3S700AN", S3AN_INFO(0x1f2500, 512, 264) }, -+ { "3S1400AN", S3AN_INFO(0x1f2600, 512, 528) }, - { }, - }; - -@@ -1060,7 +1126,12 @@ static int spi_nor_read(struct mtd_info - return ret; - - while (len) { -- ret = nor->read(nor, from, len, buf); -+ loff_t addr = from; -+ -+ if (nor->flags & SNOR_F_S3AN_ADDR_DEFAULT) -+ addr = spi_nor_s3an_addr_convert(nor, addr); -+ -+ ret = nor->read(nor, addr, len, buf); - if (ret == 0) { - /* We shouldn't see 0-length reads */ - ret = -EIO; -@@ -1181,8 +1252,23 @@ static int spi_nor_write(struct mtd_info - - for (i = 0; i < len; ) { - ssize_t written; -+ loff_t addr = to + i; - -- page_offset = (to + i) & (nor->page_size - 1); -+ /* -+ * If page_size is a power of two, the offset can be quickly -+ * calculated with an AND operation. On the other cases we -+ * need to do a modulus operation (more expensive). -+ * Power of two numbers have only one bit set and we can use -+ * the instruction hweight32 to detect if we need to do a -+ * modulus (do_div()) or not. -+ */ -+ if (hweight32(nor->page_size) == 1) { -+ page_offset = addr & (nor->page_size - 1); -+ } else { -+ uint64_t aux = addr; -+ -+ page_offset = do_div(aux, nor->page_size); -+ } - WARN_ONCE(page_offset, - "Writing at offset %zu into a NOR page. Writing partial pages may decrease reliability and increase wear of NOR flash.", - page_offset); -@@ -1190,8 +1276,11 @@ static int spi_nor_write(struct mtd_info - page_remain = min_t(size_t, - nor->page_size - page_offset, len - i); - -+ if (nor->flags & SNOR_F_S3AN_ADDR_DEFAULT) -+ addr = spi_nor_s3an_addr_convert(nor, addr); -+ - write_enable(nor); -- ret = nor->write(nor, to + i, page_remain, buf + i); -+ ret = nor->write(nor, addr, page_remain, buf + i); - if (ret < 0) - goto write_err; - written = ret; -@@ -1325,6 +1414,47 @@ static int spi_nor_check(struct spi_nor - return 0; - } - -+static int s3an_nor_scan(const struct flash_info *info, struct spi_nor *nor) -+{ -+ int ret; -+ u8 val; -+ -+ ret = nor->read_reg(nor, SPINOR_OP_XRDSR, &val, 1); -+ if (ret < 0) { -+ dev_err(nor->dev, "error %d reading XRDSR\n", (int) ret); -+ return ret; -+ } -+ -+ nor->erase_opcode = SPINOR_OP_XSE; -+ nor->program_opcode = SPINOR_OP_XPP; -+ nor->read_opcode = SPINOR_OP_READ; -+ nor->flags |= SNOR_F_NO_OP_CHIP_ERASE; -+ -+ /* -+ * This flashes have a page size of 264 or 528 bytes (known as -+ * Default addressing mode). It can be changed to a more standard -+ * Power of two mode where the page size is 256/512. This comes -+ * with a price: there is 3% less of space, the data is corrupted -+ * and the page size cannot be changed back to default addressing -+ * mode. -+ * -+ * The current addressing mode can be read from the XRDSR register -+ * and should not be changed, because is a destructive operation. -+ */ -+ if (val & XSR_PAGESIZE) { -+ /* Flash in Power of 2 mode */ -+ nor->page_size = (nor->page_size == 264) ? 256 : 512; -+ nor->mtd.writebufsize = nor->page_size; -+ nor->mtd.size = 8 * nor->page_size * info->n_sectors; -+ nor->mtd.erasesize = 8 * nor->page_size; -+ } else { -+ /* Flash in Default addressing mode */ -+ nor->flags |= SNOR_F_S3AN_ADDR_DEFAULT; -+ } -+ -+ return 0; -+} -+ - int spi_nor_scan(struct spi_nor *nor, const char *name, enum read_mode mode) - { - const struct flash_info *info = NULL; -@@ -1373,6 +1503,14 @@ int spi_nor_scan(struct spi_nor *nor, co - mutex_init(&nor->lock); - - /* -+ * Make sure the XSR_RDY flag is set before calling -+ * spi_nor_wait_till_ready(). Xilinx S3AN share MFR -+ * with Atmel spi-nor -+ */ -+ if (info->flags & SPI_S3AN) -+ nor->flags |= SNOR_F_READY_XSR_RDY; -+ -+ /* - * Atmel, SST, Intel/Numonyx, and others serial NOR tend to power up - * with the software protection bits set - */ -@@ -1530,6 +1668,12 @@ int spi_nor_scan(struct spi_nor *nor, co - - nor->read_dummy = spi_nor_read_dummy_cycles(nor); - -+ if (info->flags & SPI_S3AN) { -+ ret = s3an_nor_scan(info, nor); -+ if (ret) -+ return ret; -+ } -+ - dev_info(dev, "%s (%lld Kbytes)\n", info->name, - (long long)mtd->size >> 10); - ---- a/include/linux/mtd/spi-nor.h -+++ b/include/linux/mtd/spi-nor.h -@@ -68,6 +68,15 @@ - #define SPINOR_OP_WRDI 0x04 /* Write disable */ - #define SPINOR_OP_AAI_WP 0xad /* Auto address increment word program */ - -+/* Used for S3AN flashes only */ -+#define SPINOR_OP_XSE 0x50 /* Sector erase */ -+#define SPINOR_OP_XPP 0x82 /* Page program */ -+#define SPINOR_OP_XRDSR 0xd7 /* Read status register */ -+ -+#define XSR_PAGESIZE BIT(0) /* Page size in Po2 or Linear */ -+#define XSR_RDY BIT(7) /* Ready */ -+ -+ - /* Used for Macronix and Winbond flashes. */ - #define SPINOR_OP_EN4B 0xb7 /* Enter 4-byte mode */ - #define SPINOR_OP_EX4B 0xe9 /* Exit 4-byte mode */ -@@ -119,6 +128,9 @@ enum spi_nor_ops { - enum spi_nor_option_flags { - SNOR_F_USE_FSR = BIT(0), - SNOR_F_HAS_SR_TB = BIT(1), -+ SNOR_F_NO_OP_CHIP_ERASE = BIT(2), -+ SNOR_F_S3AN_ADDR_DEFAULT = BIT(3), -+ SNOR_F_READY_XSR_RDY = BIT(4), - }; - - /** diff --git a/target/linux/generic/backport-4.9/062-v4.11-0002-mtd-spi-nor-improve-macronix_quad_enable.patch b/target/linux/generic/backport-4.9/062-v4.11-0002-mtd-spi-nor-improve-macronix_quad_enable.patch deleted file mode 100644 index ec469d405b..0000000000 --- a/target/linux/generic/backport-4.9/062-v4.11-0002-mtd-spi-nor-improve-macronix_quad_enable.patch +++ /dev/null @@ -1,28 +0,0 @@ -From 1e99d0d51ec97bf48edd277658004ce030543d98 Mon Sep 17 00:00:00 2001 -From: Cyrille Pitchen -Date: Tue, 6 Dec 2016 17:01:41 +0100 -Subject: [PATCH] mtd: spi-nor: improve macronix_quad_enable() - -The patch checks whether the Quad Enable bit is already set in the Status -Register. If so, the function exits immediately with a successful return -code. - -Signed-off-by: Cyrille Pitchen -Reviewed-by: Jagan Teki -Acked-by: Marek Vasut ---- - drivers/mtd/spi-nor/spi-nor.c | 3 +++ - 1 file changed, 3 insertions(+) - ---- a/drivers/mtd/spi-nor/spi-nor.c -+++ b/drivers/mtd/spi-nor/spi-nor.c -@@ -1311,6 +1311,9 @@ static int macronix_quad_enable(struct s - val = read_sr(nor); - if (val < 0) - return val; -+ if (val & SR_QUAD_EN_MX) -+ return 0; -+ - write_enable(nor); - - write_sr(nor, val | SR_QUAD_EN_MX); diff --git a/target/linux/generic/backport-4.9/062-v4.11-0003-mtd-spi-nor-remove-WARN_ONCE-message-in-spi_nor_writ.patch b/target/linux/generic/backport-4.9/062-v4.11-0003-mtd-spi-nor-remove-WARN_ONCE-message-in-spi_nor_writ.patch deleted file mode 100644 index 790b557611..0000000000 --- a/target/linux/generic/backport-4.9/062-v4.11-0003-mtd-spi-nor-remove-WARN_ONCE-message-in-spi_nor_writ.patch +++ /dev/null @@ -1,33 +0,0 @@ -From dc176595bf184e89bf28fdf91cbc1d050dfe63b3 Mon Sep 17 00:00:00 2001 -From: Cyrille Pitchen -Date: Tue, 6 Dec 2016 18:14:24 +0100 -Subject: [PATCH] mtd: spi-nor: remove WARN_ONCE() message in spi_nor_write() - -This patch removes the WARN_ONCE() test in spi_nor_write(). -This macro triggers the display of a warning message almost every time we -use a UBI file-system because a write operation is performed at offset 64, -which is in the middle of the SPI NOR memory page. This is a valid -operation for ubifs. - -Hence this warning is pretty annoying and useless so we just remove it. - -Signed-off-by: Cyrille Pitchen -Suggested-by: Richard Weinberger -Suggested-by: Andras Szemzo -Acked-by: Boris Brezillon ---- - drivers/mtd/spi-nor/spi-nor.c | 3 --- - 1 file changed, 3 deletions(-) - ---- a/drivers/mtd/spi-nor/spi-nor.c -+++ b/drivers/mtd/spi-nor/spi-nor.c -@@ -1269,9 +1269,6 @@ static int spi_nor_write(struct mtd_info - - page_offset = do_div(aux, nor->page_size); - } -- WARN_ONCE(page_offset, -- "Writing at offset %zu into a NOR page. Writing partial pages may decrease reliability and increase wear of NOR flash.", -- page_offset); - /* the size of data remaining on the first page */ - page_remain = min_t(size_t, - nor->page_size - page_offset, len - i); diff --git a/target/linux/generic/backport-4.9/062-v4.11-0004-mtd-spi-nor-rename-SPINOR_OP_-macros-of-the-4-byte-a.patch b/target/linux/generic/backport-4.9/062-v4.11-0004-mtd-spi-nor-rename-SPINOR_OP_-macros-of-the-4-byte-a.patch deleted file mode 100644 index 34562e197c..0000000000 --- a/target/linux/generic/backport-4.9/062-v4.11-0004-mtd-spi-nor-rename-SPINOR_OP_-macros-of-the-4-byte-a.patch +++ /dev/null @@ -1,187 +0,0 @@ -From 05aba5763dcf35eddc58aaf99c9f16d19730e0a8 Mon Sep 17 00:00:00 2001 -From: Cyrille Pitchen -Date: Thu, 27 Oct 2016 11:55:39 +0200 -Subject: [PATCH] mtd: spi-nor: rename SPINOR_OP_* macros of the 4-byte address - op codes - -This patch renames the SPINOR_OP_* macros of the 4-byte address -instruction set so the new names all share a common pattern: the 4-byte -address name is built from the 3-byte address name appending the "_4B" -suffix. - -The patch also introduces new op codes to support other SPI protocols such -as SPI 1-4-4 and SPI 1-2-2. - -This is a transitional patch and will help a later patch of spi-nor.c -to automate the translation from the 3-byte address op codes into their -4-byte address version. - -Signed-off-by: Cyrille Pitchen -Acked-by: Mark Brown -Acked-by: Marek Vasut ---- - drivers/mtd/devices/serial_flash_cmds.h | 7 ------- - drivers/mtd/devices/st_spi_fsm.c | 28 ++++++++++++++-------------- - drivers/mtd/spi-nor/spi-nor.c | 8 ++++---- - drivers/spi/spi-bcm-qspi.c | 6 +++--- - include/linux/mtd/spi-nor.h | 22 ++++++++++++++++------ - 5 files changed, 37 insertions(+), 34 deletions(-) - ---- a/drivers/mtd/devices/serial_flash_cmds.h -+++ b/drivers/mtd/devices/serial_flash_cmds.h -@@ -18,19 +18,12 @@ - #define SPINOR_OP_RDVCR 0x85 - - /* JEDEC Standard - Serial Flash Discoverable Parmeters (SFDP) Commands */ --#define SPINOR_OP_READ_1_2_2 0xbb /* DUAL I/O READ */ --#define SPINOR_OP_READ_1_4_4 0xeb /* QUAD I/O READ */ -- - #define SPINOR_OP_WRITE 0x02 /* PAGE PROGRAM */ - #define SPINOR_OP_WRITE_1_1_2 0xa2 /* DUAL INPUT PROGRAM */ - #define SPINOR_OP_WRITE_1_2_2 0xd2 /* DUAL INPUT EXT PROGRAM */ - #define SPINOR_OP_WRITE_1_1_4 0x32 /* QUAD INPUT PROGRAM */ - #define SPINOR_OP_WRITE_1_4_4 0x12 /* QUAD INPUT EXT PROGRAM */ - --/* READ commands with 32-bit addressing */ --#define SPINOR_OP_READ4_1_2_2 0xbc --#define SPINOR_OP_READ4_1_4_4 0xec -- - /* Configuration flags */ - #define FLASH_FLAG_SINGLE 0x000000ff - #define FLASH_FLAG_READ_WRITE 0x00000001 ---- a/drivers/mtd/devices/st_spi_fsm.c -+++ b/drivers/mtd/devices/st_spi_fsm.c -@@ -507,13 +507,13 @@ static struct seq_rw_config n25q_read3_c - * - 'FAST' variants configured for 8 dummy cycles (see note above.) - */ - static struct seq_rw_config n25q_read4_configs[] = { -- {FLASH_FLAG_READ_1_4_4, SPINOR_OP_READ4_1_4_4, 0, 4, 4, 0x00, 0, 8}, -- {FLASH_FLAG_READ_1_1_4, SPINOR_OP_READ4_1_1_4, 0, 1, 4, 0x00, 0, 8}, -- {FLASH_FLAG_READ_1_2_2, SPINOR_OP_READ4_1_2_2, 0, 2, 2, 0x00, 0, 8}, -- {FLASH_FLAG_READ_1_1_2, SPINOR_OP_READ4_1_1_2, 0, 1, 2, 0x00, 0, 8}, -- {FLASH_FLAG_READ_FAST, SPINOR_OP_READ4_FAST, 0, 1, 1, 0x00, 0, 8}, -- {FLASH_FLAG_READ_WRITE, SPINOR_OP_READ4, 0, 1, 1, 0x00, 0, 0}, -- {0x00, 0, 0, 0, 0, 0x00, 0, 0}, -+ {FLASH_FLAG_READ_1_4_4, SPINOR_OP_READ_1_4_4_4B, 0, 4, 4, 0x00, 0, 8}, -+ {FLASH_FLAG_READ_1_1_4, SPINOR_OP_READ_1_1_4_4B, 0, 1, 4, 0x00, 0, 8}, -+ {FLASH_FLAG_READ_1_2_2, SPINOR_OP_READ_1_2_2_4B, 0, 2, 2, 0x00, 0, 8}, -+ {FLASH_FLAG_READ_1_1_2, SPINOR_OP_READ_1_1_2_4B, 0, 1, 2, 0x00, 0, 8}, -+ {FLASH_FLAG_READ_FAST, SPINOR_OP_READ_FAST_4B, 0, 1, 1, 0x00, 0, 8}, -+ {FLASH_FLAG_READ_WRITE, SPINOR_OP_READ_4B, 0, 1, 1, 0x00, 0, 0}, -+ {0x00, 0, 0, 0, 0, 0x00, 0, 0}, - }; - - /* -@@ -553,13 +553,13 @@ static int stfsm_mx25_en_32bit_addr_seq( - * entering a state that is incompatible with the SPIBoot Controller. - */ - static struct seq_rw_config stfsm_s25fl_read4_configs[] = { -- {FLASH_FLAG_READ_1_4_4, SPINOR_OP_READ4_1_4_4, 0, 4, 4, 0x00, 2, 4}, -- {FLASH_FLAG_READ_1_1_4, SPINOR_OP_READ4_1_1_4, 0, 1, 4, 0x00, 0, 8}, -- {FLASH_FLAG_READ_1_2_2, SPINOR_OP_READ4_1_2_2, 0, 2, 2, 0x00, 4, 0}, -- {FLASH_FLAG_READ_1_1_2, SPINOR_OP_READ4_1_1_2, 0, 1, 2, 0x00, 0, 8}, -- {FLASH_FLAG_READ_FAST, SPINOR_OP_READ4_FAST, 0, 1, 1, 0x00, 0, 8}, -- {FLASH_FLAG_READ_WRITE, SPINOR_OP_READ4, 0, 1, 1, 0x00, 0, 0}, -- {0x00, 0, 0, 0, 0, 0x00, 0, 0}, -+ {FLASH_FLAG_READ_1_4_4, SPINOR_OP_READ_1_4_4_4B, 0, 4, 4, 0x00, 2, 4}, -+ {FLASH_FLAG_READ_1_1_4, SPINOR_OP_READ_1_1_4_4B, 0, 1, 4, 0x00, 0, 8}, -+ {FLASH_FLAG_READ_1_2_2, SPINOR_OP_READ_1_2_2_4B, 0, 2, 2, 0x00, 4, 0}, -+ {FLASH_FLAG_READ_1_1_2, SPINOR_OP_READ_1_1_2_4B, 0, 1, 2, 0x00, 0, 8}, -+ {FLASH_FLAG_READ_FAST, SPINOR_OP_READ_FAST_4B, 0, 1, 1, 0x00, 0, 8}, -+ {FLASH_FLAG_READ_WRITE, SPINOR_OP_READ_4B, 0, 1, 1, 0x00, 0, 0}, -+ {0x00, 0, 0, 0, 0, 0x00, 0, 0}, - }; - - static struct seq_rw_config stfsm_s25fl_write4_configs[] = { ---- a/drivers/mtd/spi-nor/spi-nor.c -+++ b/drivers/mtd/spi-nor/spi-nor.c -@@ -1638,16 +1638,16 @@ int spi_nor_scan(struct spi_nor *nor, co - /* Dedicated 4-byte command set */ - switch (nor->flash_read) { - case SPI_NOR_QUAD: -- nor->read_opcode = SPINOR_OP_READ4_1_1_4; -+ nor->read_opcode = SPINOR_OP_READ_1_1_4_4B; - break; - case SPI_NOR_DUAL: -- nor->read_opcode = SPINOR_OP_READ4_1_1_2; -+ nor->read_opcode = SPINOR_OP_READ_1_1_2_4B; - break; - case SPI_NOR_FAST: -- nor->read_opcode = SPINOR_OP_READ4_FAST; -+ nor->read_opcode = SPINOR_OP_READ_FAST_4B; - break; - case SPI_NOR_NORMAL: -- nor->read_opcode = SPINOR_OP_READ4; -+ nor->read_opcode = SPINOR_OP_READ_4B; - break; - } - nor->program_opcode = SPINOR_OP_PP_4B; ---- a/drivers/spi/spi-bcm-qspi.c -+++ b/drivers/spi/spi-bcm-qspi.c -@@ -371,7 +371,7 @@ static int bcm_qspi_bspi_set_flex_mode(s - /* default mode, does not need flex_cmd */ - flex_mode = 0; - else -- command = SPINOR_OP_READ4_FAST; -+ command = SPINOR_OP_READ_FAST_4B; - break; - case SPI_NBITS_DUAL: - bpc = 0x00000001; -@@ -384,7 +384,7 @@ static int bcm_qspi_bspi_set_flex_mode(s - } else { - command = SPINOR_OP_READ_1_1_2; - if (spans_4byte) -- command = SPINOR_OP_READ4_1_1_2; -+ command = SPINOR_OP_READ_1_1_2_4B; - } - break; - case SPI_NBITS_QUAD: -@@ -399,7 +399,7 @@ static int bcm_qspi_bspi_set_flex_mode(s - } else { - command = SPINOR_OP_READ_1_1_4; - if (spans_4byte) -- command = SPINOR_OP_READ4_1_1_4; -+ command = SPINOR_OP_READ_1_1_4_4B; - } - break; - default: ---- a/include/linux/mtd/spi-nor.h -+++ b/include/linux/mtd/spi-nor.h -@@ -43,9 +43,13 @@ - #define SPINOR_OP_WRSR 0x01 /* Write status register 1 byte */ - #define SPINOR_OP_READ 0x03 /* Read data bytes (low frequency) */ - #define SPINOR_OP_READ_FAST 0x0b /* Read data bytes (high frequency) */ --#define SPINOR_OP_READ_1_1_2 0x3b /* Read data bytes (Dual SPI) */ --#define SPINOR_OP_READ_1_1_4 0x6b /* Read data bytes (Quad SPI) */ -+#define SPINOR_OP_READ_1_1_2 0x3b /* Read data bytes (Dual Output SPI) */ -+#define SPINOR_OP_READ_1_2_2 0xbb /* Read data bytes (Dual I/O SPI) */ -+#define SPINOR_OP_READ_1_1_4 0x6b /* Read data bytes (Quad Output SPI) */ -+#define SPINOR_OP_READ_1_4_4 0xeb /* Read data bytes (Quad I/O SPI) */ - #define SPINOR_OP_PP 0x02 /* Page program (up to 256 bytes) */ -+#define SPINOR_OP_PP_1_1_4 0x32 /* Quad page program */ -+#define SPINOR_OP_PP_1_4_4 0x38 /* Quad page program */ - #define SPINOR_OP_BE_4K 0x20 /* Erase 4KiB block */ - #define SPINOR_OP_BE_4K_PMC 0xd7 /* Erase 4KiB block on PMC chips */ - #define SPINOR_OP_BE_32K 0x52 /* Erase 32KiB block */ -@@ -56,11 +60,17 @@ - #define SPINOR_OP_RDFSR 0x70 /* Read flag status register */ - - /* 4-byte address opcodes - used on Spansion and some Macronix flashes. */ --#define SPINOR_OP_READ4 0x13 /* Read data bytes (low frequency) */ --#define SPINOR_OP_READ4_FAST 0x0c /* Read data bytes (high frequency) */ --#define SPINOR_OP_READ4_1_1_2 0x3c /* Read data bytes (Dual SPI) */ --#define SPINOR_OP_READ4_1_1_4 0x6c /* Read data bytes (Quad SPI) */ -+#define SPINOR_OP_READ_4B 0x13 /* Read data bytes (low frequency) */ -+#define SPINOR_OP_READ_FAST_4B 0x0c /* Read data bytes (high frequency) */ -+#define SPINOR_OP_READ_1_1_2_4B 0x3c /* Read data bytes (Dual Output SPI) */ -+#define SPINOR_OP_READ_1_2_2_4B 0xbc /* Read data bytes (Dual I/O SPI) */ -+#define SPINOR_OP_READ_1_1_4_4B 0x6c /* Read data bytes (Quad Output SPI) */ -+#define SPINOR_OP_READ_1_4_4_4B 0xec /* Read data bytes (Quad I/O SPI) */ - #define SPINOR_OP_PP_4B 0x12 /* Page program (up to 256 bytes) */ -+#define SPINOR_OP_PP_1_1_4_4B 0x34 /* Quad page program */ -+#define SPINOR_OP_PP_1_4_4_4B 0x3e /* Quad page program */ -+#define SPINOR_OP_BE_4K_4B 0x21 /* Erase 4KiB block */ -+#define SPINOR_OP_BE_32K_4B 0x5c /* Erase 32KiB block */ - #define SPINOR_OP_SE_4B 0xdc /* Sector erase (usually 64KiB) */ - - /* Used for SST flashes only. */ diff --git a/target/linux/generic/backport-4.9/062-v4.11-0005-mtd-spi-nor-add-a-stateless-method-to-support-memory.patch b/target/linux/generic/backport-4.9/062-v4.11-0005-mtd-spi-nor-add-a-stateless-method-to-support-memory.patch deleted file mode 100644 index 1d507c1920..0000000000 --- a/target/linux/generic/backport-4.9/062-v4.11-0005-mtd-spi-nor-add-a-stateless-method-to-support-memory.patch +++ /dev/null @@ -1,150 +0,0 @@ -From 3274ba26f27becfc4193ec6e229288140651f240 Mon Sep 17 00:00:00 2001 -From: Cyrille Pitchen -Date: Thu, 27 Oct 2016 12:03:57 +0200 -Subject: [PATCH] mtd: spi-nor: add a stateless method to support memory size - above 128Mib - -This patch provides an alternative mean to support memory above 16MiB -(128Mib) by replacing 3byte address op codes by their associated 4byte -address versions. - -Using the dedicated 4byte address op codes doesn't change the internal -state of the SPI NOR memory as opposed to using other means such as -updating a Base Address Register (BAR) and sending command to enter/leave -the 4byte mode. - -Hence when a CPU reset occurs, early bootloaders don't need to be aware -of BAR value or 4byte mode being enabled: they can still access the first -16MiB of the SPI NOR memory using the regular 3byte address op codes. - -Signed-off-by: Cyrille Pitchen -Tested-by: Vignesh R -Acked-by: Marek Vasut ---- - drivers/mtd/spi-nor/spi-nor.c | 101 +++++++++++++++++++++++++++++++++--------- - 1 file changed, 80 insertions(+), 21 deletions(-) - ---- a/drivers/mtd/spi-nor/spi-nor.c -+++ b/drivers/mtd/spi-nor/spi-nor.c -@@ -81,6 +81,10 @@ struct flash_info { - * because it has the same value as - * ATMEL flashes) - */ -+#define SPI_NOR_4B_OPCODES BIT(11) /* -+ * Use dedicated 4byte address op codes -+ * to support memory size above 128Mib. -+ */ - }; - - #define JEDEC_MFR(info) ((info)->id[0]) -@@ -194,6 +198,78 @@ static inline struct spi_nor *mtd_to_spi - return mtd->priv; - } - -+ -+static u8 spi_nor_convert_opcode(u8 opcode, const u8 table[][2], size_t size) -+{ -+ size_t i; -+ -+ for (i = 0; i < size; i++) -+ if (table[i][0] == opcode) -+ return table[i][1]; -+ -+ /* No conversion found, keep input op code. */ -+ return opcode; -+} -+ -+static inline u8 spi_nor_convert_3to4_read(u8 opcode) -+{ -+ static const u8 spi_nor_3to4_read[][2] = { -+ { SPINOR_OP_READ, SPINOR_OP_READ_4B }, -+ { SPINOR_OP_READ_FAST, SPINOR_OP_READ_FAST_4B }, -+ { SPINOR_OP_READ_1_1_2, SPINOR_OP_READ_1_1_2_4B }, -+ { SPINOR_OP_READ_1_2_2, SPINOR_OP_READ_1_2_2_4B }, -+ { SPINOR_OP_READ_1_1_4, SPINOR_OP_READ_1_1_4_4B }, -+ { SPINOR_OP_READ_1_4_4, SPINOR_OP_READ_1_4_4_4B }, -+ }; -+ -+ return spi_nor_convert_opcode(opcode, spi_nor_3to4_read, -+ ARRAY_SIZE(spi_nor_3to4_read)); -+} -+ -+static inline u8 spi_nor_convert_3to4_program(u8 opcode) -+{ -+ static const u8 spi_nor_3to4_program[][2] = { -+ { SPINOR_OP_PP, SPINOR_OP_PP_4B }, -+ { SPINOR_OP_PP_1_1_4, SPINOR_OP_PP_1_1_4_4B }, -+ { SPINOR_OP_PP_1_4_4, SPINOR_OP_PP_1_4_4_4B }, -+ }; -+ -+ return spi_nor_convert_opcode(opcode, spi_nor_3to4_program, -+ ARRAY_SIZE(spi_nor_3to4_program)); -+} -+ -+static inline u8 spi_nor_convert_3to4_erase(u8 opcode) -+{ -+ static const u8 spi_nor_3to4_erase[][2] = { -+ { SPINOR_OP_BE_4K, SPINOR_OP_BE_4K_4B }, -+ { SPINOR_OP_BE_32K, SPINOR_OP_BE_32K_4B }, -+ { SPINOR_OP_SE, SPINOR_OP_SE_4B }, -+ }; -+ -+ return spi_nor_convert_opcode(opcode, spi_nor_3to4_erase, -+ ARRAY_SIZE(spi_nor_3to4_erase)); -+} -+ -+static void spi_nor_set_4byte_opcodes(struct spi_nor *nor, -+ const struct flash_info *info) -+{ -+ /* Do some manufacturer fixups first */ -+ switch (JEDEC_MFR(info)) { -+ case SNOR_MFR_SPANSION: -+ /* No small sector erase for 4-byte command set */ -+ nor->erase_opcode = SPINOR_OP_SE; -+ nor->mtd.erasesize = info->sector_size; -+ break; -+ -+ default: -+ break; -+ } -+ -+ nor->read_opcode = spi_nor_convert_3to4_read(nor->read_opcode); -+ nor->program_opcode = spi_nor_convert_3to4_program(nor->program_opcode); -+ nor->erase_opcode = spi_nor_convert_3to4_erase(nor->erase_opcode); -+} -+ - /* Enable/disable 4-byte addressing mode. */ - static inline int set_4byte(struct spi_nor *nor, const struct flash_info *info, - int enable) -@@ -1634,27 +1710,10 @@ int spi_nor_scan(struct spi_nor *nor, co - else if (mtd->size > 0x1000000) { - /* enable 4-byte addressing if the device exceeds 16MiB */ - nor->addr_width = 4; -- if (JEDEC_MFR(info) == SNOR_MFR_SPANSION) { -- /* Dedicated 4-byte command set */ -- switch (nor->flash_read) { -- case SPI_NOR_QUAD: -- nor->read_opcode = SPINOR_OP_READ_1_1_4_4B; -- break; -- case SPI_NOR_DUAL: -- nor->read_opcode = SPINOR_OP_READ_1_1_2_4B; -- break; -- case SPI_NOR_FAST: -- nor->read_opcode = SPINOR_OP_READ_FAST_4B; -- break; -- case SPI_NOR_NORMAL: -- nor->read_opcode = SPINOR_OP_READ_4B; -- break; -- } -- nor->program_opcode = SPINOR_OP_PP_4B; -- /* No small sector erase for 4-byte command set */ -- nor->erase_opcode = SPINOR_OP_SE_4B; -- mtd->erasesize = info->sector_size; -- } else -+ if (JEDEC_MFR(info) == SNOR_MFR_SPANSION || -+ info->flags & SPI_NOR_4B_OPCODES) -+ spi_nor_set_4byte_opcodes(nor, info); -+ else - set_4byte(nor, info, 1); - } else { - nor->addr_width = 3; diff --git a/target/linux/generic/backport-4.9/062-v4.11-0006-mtd-spi-nor-Add-lock-unlock-support-for-f25l32pa.patch b/target/linux/generic/backport-4.9/062-v4.11-0006-mtd-spi-nor-Add-lock-unlock-support-for-f25l32pa.patch deleted file mode 100644 index be78682193..0000000000 --- a/target/linux/generic/backport-4.9/062-v4.11-0006-mtd-spi-nor-Add-lock-unlock-support-for-f25l32pa.patch +++ /dev/null @@ -1,26 +0,0 @@ -From 252c36bb9c7b98b356f033d16ea83d20fb8b4d3e Mon Sep 17 00:00:00 2001 -From: Victor Shyba -Date: Mon, 2 Jan 2017 22:34:30 -0300 -Subject: [PATCH] mtd: spi-nor: Add lock/unlock support for f25l32pa - -This chip has write protection enabled on power-up, -so this flag is necessary to support write operations. - -Signed-off-by: Victor Shyba -Acked-by: Marek Vasut -Signed-off-by: Cyrille Pitchen ---- - drivers/mtd/spi-nor/spi-nor.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - ---- a/drivers/mtd/spi-nor/spi-nor.c -+++ b/drivers/mtd/spi-nor/spi-nor.c -@@ -956,7 +956,7 @@ static const struct flash_info spi_nor_i - { "en25s64", INFO(0x1c3817, 0, 64 * 1024, 128, SECT_4K) }, - - /* ESMT */ -- { "f25l32pa", INFO(0x8c2016, 0, 64 * 1024, 64, SECT_4K) }, -+ { "f25l32pa", INFO(0x8c2016, 0, 64 * 1024, 64, SECT_4K | SPI_NOR_HAS_LOCK) }, - - /* Everspin */ - { "mr25h256", CAT25_INFO( 32 * 1024, 1, 256, 2, SPI_NOR_NO_ERASE | SPI_NOR_NO_FR) }, diff --git a/target/linux/generic/backport-4.9/062-v4.11-0007-mtd-spi-nor-Fix-S3AN-addressing-calculation.patch b/target/linux/generic/backport-4.9/062-v4.11-0007-mtd-spi-nor-Fix-S3AN-addressing-calculation.patch deleted file mode 100644 index f8d0541428..0000000000 --- a/target/linux/generic/backport-4.9/062-v4.11-0007-mtd-spi-nor-Fix-S3AN-addressing-calculation.patch +++ /dev/null @@ -1,35 +0,0 @@ -From 5f0e0758efddef5b06994a76d8c7f0b8a4c1daae Mon Sep 17 00:00:00 2001 -From: Ricardo Ribalda -Date: Wed, 18 Jan 2017 17:40:16 +0100 -Subject: [PATCH] mtd: spi-nor: Fix S3AN addressing calculation - -The page calculation under spi_nor_s3an_addr_convert() was wrong. On -Default Address Mode we need to perform a divide by page_size. - -Signed-off-by: Ricardo Ribalda Delgado -Acked-by: Marek Vasut -Signed-off-by: Cyrille Pitchen ---- - drivers/mtd/spi-nor/spi-nor.c | 9 ++++++--- - 1 file changed, 6 insertions(+), 3 deletions(-) - ---- a/drivers/mtd/spi-nor/spi-nor.c -+++ b/drivers/mtd/spi-nor/spi-nor.c -@@ -431,11 +431,14 @@ static void spi_nor_unlock_and_unprep(st - */ - static loff_t spi_nor_s3an_addr_convert(struct spi_nor *nor, unsigned int addr) - { -- unsigned int offset = addr; -+ unsigned int offset; -+ unsigned int page; - -- offset %= nor->page_size; -+ offset = addr % nor->page_size; -+ page = addr / nor->page_size; -+ page <<= (nor->page_size > 512) ? 10 : 9; - -- return ((addr - offset) << 1) | offset; -+ return page | offset; - } - - /* diff --git a/target/linux/generic/backport-4.9/062-v4.11-0008-mtd-spi-nor-Add-support-for-gd25q16.patch b/target/linux/generic/backport-4.9/062-v4.11-0008-mtd-spi-nor-Add-support-for-gd25q16.patch deleted file mode 100644 index 5253957286..0000000000 --- a/target/linux/generic/backport-4.9/062-v4.11-0008-mtd-spi-nor-Add-support-for-gd25q16.patch +++ /dev/null @@ -1,28 +0,0 @@ -From 4c5747a390acc9d1da3b332507c8bae7a8ddfc48 Mon Sep 17 00:00:00 2001 -From: Kamal Dasu -Date: Fri, 20 Jan 2017 14:25:51 -0500 -Subject: [PATCH] mtd: spi-nor: Add support for gd25q16 - -Add GigaDevice GD25Q16 (16M-bit) to supported list. - -Signed-off-by: Kamal Dasu -Acked-by: Marek Vasut -Signed-off-by: Cyrille Pitchen ---- - drivers/mtd/spi-nor/spi-nor.c | 5 +++++ - 1 file changed, 5 insertions(+) - ---- a/drivers/mtd/spi-nor/spi-nor.c -+++ b/drivers/mtd/spi-nor/spi-nor.c -@@ -971,6 +971,11 @@ static const struct flash_info spi_nor_i - - /* GigaDevice */ - { -+ "gd25q16", INFO(0xc84015, 0, 64 * 1024, 32, -+ SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ | -+ SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB) -+ }, -+ { - "gd25q32", INFO(0xc84016, 0, 64 * 1024, 64, - SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ | - SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB) diff --git a/target/linux/generic/backport-4.9/063-v4.11-0001-mtd-nand-Add-Winbond-manufacturer-id.patch b/target/linux/generic/backport-4.9/063-v4.11-0001-mtd-nand-Add-Winbond-manufacturer-id.patch deleted file mode 100644 index cbab378b2b..0000000000 --- a/target/linux/generic/backport-4.9/063-v4.11-0001-mtd-nand-Add-Winbond-manufacturer-id.patch +++ /dev/null @@ -1,34 +0,0 @@ -From a4077ce5871304f8a78f80b74b18b6052a410f1a Mon Sep 17 00:00:00 2001 -From: "Andrey Jr. Melnikov" -Date: Thu, 8 Dec 2016 19:57:08 +0300 -Subject: [PATCH] mtd: nand: Add Winbond manufacturer id - -Add WINBOND manufacturer id. - -Signed-off-by: Andrey Jr. Melnikov -Signed-off-by: Boris Brezillon ---- - drivers/mtd/nand/nand_ids.c | 1 + - include/linux/mtd/nand.h | 1 + - 2 files changed, 2 insertions(+) - ---- a/drivers/mtd/nand/nand_ids.c -+++ b/drivers/mtd/nand/nand_ids.c -@@ -182,6 +182,7 @@ struct nand_manufacturers nand_manuf_ids - {NAND_MFR_SANDISK, "SanDisk"}, - {NAND_MFR_INTEL, "Intel"}, - {NAND_MFR_ATO, "ATO"}, -+ {NAND_MFR_WINBOND, "Winbond"}, - {0x0, "Unknown"} - }; - ---- a/include/linux/mtd/nand.h -+++ b/include/linux/mtd/nand.h -@@ -928,6 +928,7 @@ static inline void nand_set_controller_d - #define NAND_MFR_SANDISK 0x45 - #define NAND_MFR_INTEL 0x89 - #define NAND_MFR_ATO 0x9b -+#define NAND_MFR_WINBOND 0xef - - /* The maximum expected count of bytes in the NAND ID sequence */ - #define NAND_MAX_ID_LEN 8 diff --git a/target/linux/generic/backport-4.9/063-v4.11-0002-mtd-introduce-function-max_bad_blocks.patch b/target/linux/generic/backport-4.9/063-v4.11-0002-mtd-introduce-function-max_bad_blocks.patch deleted file mode 100644 index d2e582ef5b..0000000000 --- a/target/linux/generic/backport-4.9/063-v4.11-0002-mtd-introduce-function-max_bad_blocks.patch +++ /dev/null @@ -1,73 +0,0 @@ -From 6080ef6e7c0a0592cbcca11200d879faf65e27d4 Mon Sep 17 00:00:00 2001 -From: Jeff Westfahl -Date: Tue, 10 Jan 2017 13:30:17 -0600 -Subject: [PATCH] mtd: introduce function max_bad_blocks - -If implemented, 'max_bad_blocks' returns the maximum number of bad -blocks to reserve for a MTD. An implementation for NAND is coming soon. - -Signed-off-by: Jeff Westfahl -Signed-off-by: Zach Brown -Acked-by: Boris Brezillon -Acked-by: Brian Norris -Signed-off-by: Brian Norris ---- - drivers/mtd/mtdpart.c | 10 ++++++++++ - include/linux/mtd/mtd.h | 13 +++++++++++++ - 2 files changed, 23 insertions(+) - ---- a/drivers/mtd/mtdpart.c -+++ b/drivers/mtd/mtdpart.c -@@ -349,6 +349,14 @@ static const struct mtd_ooblayout_ops pa - .free = part_ooblayout_free, - }; - -+static int part_max_bad_blocks(struct mtd_info *mtd, loff_t ofs, size_t len) -+{ -+ struct mtd_part *part = mtd_to_part(mtd); -+ -+ return part->master->_max_bad_blocks(part->master, -+ ofs + part->offset, len); -+} -+ - static inline void free_partition(struct mtd_part *p) - { - kfree(p->mtd.name); -@@ -475,6 +483,8 @@ static struct mtd_part *allocate_partiti - slave->mtd._block_isbad = part_block_isbad; - if (master->_block_markbad) - slave->mtd._block_markbad = part_block_markbad; -+ if (master->_max_bad_blocks) -+ slave->mtd._max_bad_blocks = part_max_bad_blocks; - - if (master->_get_device) - slave->mtd._get_device = part_get_device; ---- a/include/linux/mtd/mtd.h -+++ b/include/linux/mtd/mtd.h -@@ -322,6 +322,7 @@ struct mtd_info { - int (*_block_isreserved) (struct mtd_info *mtd, loff_t ofs); - int (*_block_isbad) (struct mtd_info *mtd, loff_t ofs); - int (*_block_markbad) (struct mtd_info *mtd, loff_t ofs); -+ int (*_max_bad_blocks) (struct mtd_info *mtd, loff_t ofs, size_t len); - int (*_suspend) (struct mtd_info *mtd); - void (*_resume) (struct mtd_info *mtd); - void (*_reboot) (struct mtd_info *mtd); -@@ -397,6 +398,18 @@ static inline int mtd_oobavail(struct mt - return ops->mode == MTD_OPS_AUTO_OOB ? mtd->oobavail : mtd->oobsize; - } - -+static inline int mtd_max_bad_blocks(struct mtd_info *mtd, -+ loff_t ofs, size_t len) -+{ -+ if (!mtd->_max_bad_blocks) -+ return -ENOTSUPP; -+ -+ if (mtd->size < (len + ofs) || ofs < 0) -+ return -EINVAL; -+ -+ return mtd->_max_bad_blocks(mtd, ofs, len); -+} -+ - int mtd_wunit_to_pairing_info(struct mtd_info *mtd, int wunit, - struct mtd_pairing_info *info); - int mtd_pairing_info_to_wunit(struct mtd_info *mtd, diff --git a/target/linux/generic/backport-4.9/063-v4.11-0003-mtd-Add-partition-device-node-to-mtd-partition-devic.patch b/target/linux/generic/backport-4.9/063-v4.11-0003-mtd-Add-partition-device-node-to-mtd-partition-devic.patch deleted file mode 100644 index ea68fc474f..0000000000 --- a/target/linux/generic/backport-4.9/063-v4.11-0003-mtd-Add-partition-device-node-to-mtd-partition-devic.patch +++ /dev/null @@ -1,50 +0,0 @@ -From 42e9401bd1467d22c4dc4d2c637347b874e6a80b Mon Sep 17 00:00:00 2001 -From: Sascha Hauer -Date: Thu, 9 Feb 2017 11:50:24 +0100 -Subject: [PATCH] mtd: Add partition device node to mtd partition devices -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -The user visible change here is that mtd partitions get an of_node link -in sysfs. - -Signed-off-by: Sascha Hauer -Signed-off-by: Uwe Kleine-König -Signed-off-by: Brian Norris ---- - drivers/mtd/mtdpart.c | 1 + - drivers/mtd/ofpart.c | 1 + - include/linux/mtd/partitions.h | 1 + - 3 files changed, 3 insertions(+) - ---- a/drivers/mtd/mtdpart.c -+++ b/drivers/mtd/mtdpart.c -@@ -432,6 +432,7 @@ static struct mtd_part *allocate_partiti - slave->mtd.dev.parent = IS_ENABLED(CONFIG_MTD_PARTITIONED_MASTER) ? - &master->dev : - master->dev.parent; -+ slave->mtd.dev.of_node = part->of_node; - - slave->mtd._read = part_read; - slave->mtd._write = part_write; ---- a/drivers/mtd/ofpart.c -+++ b/drivers/mtd/ofpart.c -@@ -108,6 +108,7 @@ static int parse_ofpart_partitions(struc - - parts[i].offset = of_read_number(reg, a_cells); - parts[i].size = of_read_number(reg + a_cells, s_cells); -+ parts[i].of_node = pp; - - partname = of_get_property(pp, "label", &len); - if (!partname) ---- a/include/linux/mtd/partitions.h -+++ b/include/linux/mtd/partitions.h -@@ -41,6 +41,7 @@ struct mtd_partition { - uint64_t size; /* partition size */ - uint64_t offset; /* offset within the master MTD space */ - uint32_t mask_flags; /* master MTD flags to mask out for this partition */ -+ struct device_node *of_node; - }; - - #define MTDPART_OFS_RETAIN (-3) diff --git a/target/linux/generic/backport-4.9/064-v4.12-mtd-spi-nor-enable-stateless-4b-op-codes-for-mx25u25.patch b/target/linux/generic/backport-4.9/064-v4.12-mtd-spi-nor-enable-stateless-4b-op-codes-for-mx25u25.patch deleted file mode 100644 index d1544b1d36..0000000000 --- a/target/linux/generic/backport-4.9/064-v4.12-mtd-spi-nor-enable-stateless-4b-op-codes-for-mx25u25.patch +++ /dev/null @@ -1,29 +0,0 @@ -From b0fcb4b413028376894feaaaf62bcb09ab1b52f2 Mon Sep 17 00:00:00 2001 -From: Mathias Kresin -Date: Thu, 13 Apr 2017 09:23:54 +0200 -Subject: [PATCH] mtd: spi-nor: enable stateless 4b op codes for mx25u25635f - -All required stateless 4-byte op codes are supported by this flash -chip. The stateless 4-byte support can't be autodetected due to a -missing 4-byte Address Instruction Table in SFDP. - -Fixes hangs on reboot for SoCs expecting the flash chip in 3byte mode. - -Signed-off-by: Mathias Kresin -Acked-by: Marek Vasut -Signed-off-by: Cyrille Pitchen ---- - drivers/mtd/spi-nor/spi-nor.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - ---- a/drivers/mtd/spi-nor/spi-nor.c -+++ b/drivers/mtd/spi-nor/spi-nor.c -@@ -1023,7 +1023,7 @@ static const struct flash_info spi_nor_i - { "mx25l12805d", INFO(0xc22018, 0, 64 * 1024, 256, 0) }, - { "mx25l12855e", INFO(0xc22618, 0, 64 * 1024, 256, 0) }, - { "mx25l25635e", INFO(0xc22019, 0, 64 * 1024, 512, 0) }, -- { "mx25u25635f", INFO(0xc22539, 0, 64 * 1024, 512, SECT_4K) }, -+ { "mx25u25635f", INFO(0xc22539, 0, 64 * 1024, 512, SECT_4K | SPI_NOR_4B_OPCODES) }, - { "mx25l25655e", INFO(0xc22619, 0, 64 * 1024, 512, 0) }, - { "mx66l51235l", INFO(0xc2201a, 0, 64 * 1024, 1024, SPI_NOR_QUAD_READ) }, - { "mx66l1g55g", INFO(0xc2261b, 0, 64 * 1024, 2048, SPI_NOR_QUAD_READ) }, diff --git a/target/linux/generic/backport-4.9/065-v4.13-0001-mtd-handle-partitioning-on-devices-with-0-erasesize.patch b/target/linux/generic/backport-4.9/065-v4.13-0001-mtd-handle-partitioning-on-devices-with-0-erasesize.patch deleted file mode 100644 index d912811850..0000000000 --- a/target/linux/generic/backport-4.9/065-v4.13-0001-mtd-handle-partitioning-on-devices-with-0-erasesize.patch +++ /dev/null @@ -1,77 +0,0 @@ -From 1eeef2d7483a7e3f8d2dd2a5b9939b3b814dc549 Mon Sep 17 00:00:00 2001 -From: Chris Packham -Date: Fri, 9 Jun 2017 15:58:31 +1200 -Subject: [PATCH] mtd: handle partitioning on devices with 0 erasesize - -erasesize is meaningful for flash devices but for SRAM there is no -concept of an erase block so erasesize is set to 0. When partitioning -these devices instead of ensuring partitions fall on erasesize -boundaries we ensure they fall on writesize boundaries. - -Helped-by: Boris Brezillon -Signed-off-by: Chris Packham -Acked-by: Boris Brezillon -Signed-off-by: Brian Norris ---- - drivers/mtd/mtdpart.c | 26 +++++++++++++++++--------- - 1 file changed, 17 insertions(+), 9 deletions(-) - ---- a/drivers/mtd/mtdpart.c -+++ b/drivers/mtd/mtdpart.c -@@ -393,8 +393,12 @@ static struct mtd_part *allocate_partiti - const struct mtd_partition *part, int partno, - uint64_t cur_offset) - { -+ int wr_alignment = (master->flags & MTD_NO_ERASE) ? master->writesize: -+ master->erasesize; - struct mtd_part *slave; -+ u32 remainder; - char *name; -+ u64 tmp; - - /* allocate the partition structure */ - slave = kzalloc(sizeof(*slave), GFP_KERNEL); -@@ -499,10 +503,11 @@ static struct mtd_part *allocate_partiti - if (slave->offset == MTDPART_OFS_APPEND) - slave->offset = cur_offset; - if (slave->offset == MTDPART_OFS_NXTBLK) { -+ tmp = cur_offset; - slave->offset = cur_offset; -- if (mtd_mod_by_eb(cur_offset, master) != 0) { -- /* Round up to next erasesize */ -- slave->offset = (mtd_div_by_eb(cur_offset, master) + 1) * master->erasesize; -+ remainder = do_div(tmp, wr_alignment); -+ if (remainder) { -+ slave->offset += wr_alignment - remainder; - printk(KERN_NOTICE "Moving partition %d: " - "0x%012llx -> 0x%012llx\n", partno, - (unsigned long long)cur_offset, (unsigned long long)slave->offset); -@@ -567,19 +572,22 @@ static struct mtd_part *allocate_partiti - slave->mtd.erasesize = master->erasesize; - } - -- if ((slave->mtd.flags & MTD_WRITEABLE) && -- mtd_mod_by_eb(slave->offset, &slave->mtd)) { -+ tmp = slave->offset; -+ remainder = do_div(tmp, wr_alignment); -+ if ((slave->mtd.flags & MTD_WRITEABLE) && remainder) { - /* Doesn't start on a boundary of major erase size */ - /* FIXME: Let it be writable if it is on a boundary of - * _minor_ erase size though */ - slave->mtd.flags &= ~MTD_WRITEABLE; -- printk(KERN_WARNING"mtd: partition \"%s\" doesn't start on an erase block boundary -- force read-only\n", -+ printk(KERN_WARNING"mtd: partition \"%s\" doesn't start on an erase/write block boundary -- force read-only\n", - part->name); - } -- if ((slave->mtd.flags & MTD_WRITEABLE) && -- mtd_mod_by_eb(slave->mtd.size, &slave->mtd)) { -+ -+ tmp = slave->mtd.size; -+ remainder = do_div(tmp, wr_alignment); -+ if ((slave->mtd.flags & MTD_WRITEABLE) && remainder) { - slave->mtd.flags &= ~MTD_WRITEABLE; -- printk(KERN_WARNING"mtd: partition \"%s\" doesn't end on an erase block -- force read-only\n", -+ printk(KERN_WARNING"mtd: partition \"%s\" doesn't end on an erase/write block -- force read-only\n", - part->name); - } - diff --git a/target/linux/generic/backport-4.9/065-v4.13-0002-mtd-partitions-factor-out-code-calling-parser.patch b/target/linux/generic/backport-4.9/065-v4.13-0002-mtd-partitions-factor-out-code-calling-parser.patch deleted file mode 100644 index d312e081a9..0000000000 --- a/target/linux/generic/backport-4.9/065-v4.13-0002-mtd-partitions-factor-out-code-calling-parser.patch +++ /dev/null @@ -1,68 +0,0 @@ -From 01f9c7240a900d5676a8496496f2974dd36996b1 Mon Sep 17 00:00:00 2001 -From: Brian Norris -Date: Tue, 23 May 2017 07:30:20 +0200 -Subject: [PATCH] mtd: partitions: factor out code calling parser -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -This code is going to be reused for parsers matched using OF so let's -factor it out to make this easier. - -Signed-off-by: Brian Norris -Signed-off-by: Rafał Miłecki -Acked-by: Brian Norris ---- - drivers/mtd/mtdpart.c | 33 ++++++++++++++++++++++++--------- - 1 file changed, 24 insertions(+), 9 deletions(-) - ---- a/drivers/mtd/mtdpart.c -+++ b/drivers/mtd/mtdpart.c -@@ -807,6 +807,27 @@ static const char * const default_mtd_pa - NULL - }; - -+static int mtd_part_do_parse(struct mtd_part_parser *parser, -+ struct mtd_info *master, -+ struct mtd_partitions *pparts, -+ struct mtd_part_parser_data *data) -+{ -+ int ret; -+ -+ ret = (*parser->parse_fn)(master, &pparts->parts, data); -+ pr_debug("%s: parser %s: %i\n", master->name, parser->name, ret); -+ if (ret <= 0) -+ return ret; -+ -+ pr_notice("%d %s partitions found on MTD device %s\n", ret, -+ parser->name, master->name); -+ -+ pparts->nr_parts = ret; -+ pparts->parser = parser; -+ -+ return ret; -+} -+ - /** - * parse_mtd_partitions - parse MTD partitions - * @master: the master partition (describes whole MTD device) -@@ -847,16 +868,10 @@ int parse_mtd_partitions(struct mtd_info - parser ? parser->name : NULL); - if (!parser) - continue; -- ret = (*parser->parse_fn)(master, &pparts->parts, data); -- pr_debug("%s: parser %s: %i\n", -- master->name, parser->name, ret); -- if (ret > 0) { -- printk(KERN_NOTICE "%d %s partitions found on MTD device %s\n", -- ret, parser->name, master->name); -- pparts->nr_parts = ret; -- pparts->parser = parser; -+ ret = mtd_part_do_parse(parser, master, pparts, data); -+ /* Found partitions! */ -+ if (ret > 0) - return 0; -- } - mtd_part_parser_put(parser); - /* - * Stash the first error we see; only report it if no parser diff --git a/target/linux/generic/backport-4.9/065-v4.13-0003-mtd-partitions-add-helper-for-deleting-partition.patch b/target/linux/generic/backport-4.9/065-v4.13-0003-mtd-partitions-add-helper-for-deleting-partition.patch deleted file mode 100644 index d93f4ba4b5..0000000000 --- a/target/linux/generic/backport-4.9/065-v4.13-0003-mtd-partitions-add-helper-for-deleting-partition.patch +++ /dev/null @@ -1,119 +0,0 @@ -From 08263a9ae664b24fa777d20b365601534842b236 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= -Date: Wed, 21 Jun 2017 08:26:42 +0200 -Subject: [PATCH] mtd: partitions: add helper for deleting partition -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -There are two similar functions handling deletion. One handles single -partition and another the whole MTD flash device. They share (duplicate) -some code so it makes sense to add a small helper for that part. - -Function del_mtd_partitions has been moved a bit to keep all deleting -stuff together. - -Signed-off-by: Rafał Miłecki -Signed-off-by: Brian Norris ---- - drivers/mtd/mtdpart.c | 75 +++++++++++++++++++++++++++++---------------------- - 1 file changed, 43 insertions(+), 32 deletions(-) - ---- a/drivers/mtd/mtdpart.c -+++ b/drivers/mtd/mtdpart.c -@@ -363,32 +363,6 @@ static inline void free_partition(struct - kfree(p); - } - --/* -- * This function unregisters and destroy all slave MTD objects which are -- * attached to the given master MTD object. -- */ -- --int del_mtd_partitions(struct mtd_info *master) --{ -- struct mtd_part *slave, *next; -- int ret, err = 0; -- -- mutex_lock(&mtd_partitions_mutex); -- list_for_each_entry_safe(slave, next, &mtd_partitions, list) -- if (slave->master == master) { -- ret = del_mtd_device(&slave->mtd); -- if (ret < 0) { -- err = ret; -- continue; -- } -- list_del(&slave->list); -- free_partition(slave); -- } -- mutex_unlock(&mtd_partitions_mutex); -- -- return err; --} -- - static struct mtd_part *allocate_partition(struct mtd_info *master, - const struct mtd_partition *part, int partno, - uint64_t cur_offset) -@@ -675,6 +649,48 @@ int mtd_add_partition(struct mtd_info *m - } - EXPORT_SYMBOL_GPL(mtd_add_partition); - -+/** -+ * __mtd_del_partition - delete MTD partition -+ * -+ * @priv: internal MTD struct for partition to be deleted -+ * -+ * This function must be called with the partitions mutex locked. -+ */ -+static int __mtd_del_partition(struct mtd_part *priv) -+{ -+ int err; -+ -+ err = del_mtd_device(&priv->mtd); -+ if (err) -+ return err; -+ -+ list_del(&priv->list); -+ free_partition(priv); -+ -+ return 0; -+} -+ -+/* -+ * This function unregisters and destroy all slave MTD objects which are -+ * attached to the given master MTD object. -+ */ -+int del_mtd_partitions(struct mtd_info *master) -+{ -+ struct mtd_part *slave, *next; -+ int ret, err = 0; -+ -+ mutex_lock(&mtd_partitions_mutex); -+ list_for_each_entry_safe(slave, next, &mtd_partitions, list) -+ if (slave->master == master) { -+ ret = __mtd_del_partition(slave); -+ if (ret < 0) -+ err = ret; -+ } -+ mutex_unlock(&mtd_partitions_mutex); -+ -+ return err; -+} -+ - int mtd_del_partition(struct mtd_info *master, int partno) - { - struct mtd_part *slave, *next; -@@ -686,12 +702,7 @@ int mtd_del_partition(struct mtd_info *m - (slave->mtd.index == partno)) { - sysfs_remove_files(&slave->mtd.dev.kobj, - mtd_partition_attrs); -- ret = del_mtd_device(&slave->mtd); -- if (ret < 0) -- break; -- -- list_del(&slave->list); -- free_partition(slave); -+ ret = __mtd_del_partition(slave); - break; - } - mutex_unlock(&mtd_partitions_mutex); diff --git a/target/linux/generic/backport-4.9/065-v4.13-0004-mtd-partitions-remove-sysfs-files-when-deleting-all-.patch b/target/linux/generic/backport-4.9/065-v4.13-0004-mtd-partitions-remove-sysfs-files-when-deleting-all-.patch deleted file mode 100644 index 0f1b502b70..0000000000 --- a/target/linux/generic/backport-4.9/065-v4.13-0004-mtd-partitions-remove-sysfs-files-when-deleting-all-.patch +++ /dev/null @@ -1,45 +0,0 @@ -From c5ceaba74083daf619bdb34d4871e297a177eebf Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= -Date: Wed, 21 Jun 2017 08:26:43 +0200 -Subject: [PATCH] mtd: partitions: remove sysfs files when deleting all - master's partitions -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -When support for sysfs "offset" file was added it missed to update the -del_mtd_partitions function. It deletes partitions just like -mtd_del_partition does so both should also take care of removing sysfs -files. - -This change moves sysfs_remove_files call to the shared function to fix -this issue. - -Fixes: a62c24d755291 ("mtd: part: Add sysfs variable for offset of partition") -Cc: Dan Ehrenberg -Signed-off-by: Rafał Miłecki -Signed-off-by: Brian Norris ---- - drivers/mtd/mtdpart.c | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - ---- a/drivers/mtd/mtdpart.c -+++ b/drivers/mtd/mtdpart.c -@@ -660,6 +660,8 @@ static int __mtd_del_partition(struct mt - { - int err; - -+ sysfs_remove_files(&priv->mtd.dev.kobj, mtd_partition_attrs); -+ - err = del_mtd_device(&priv->mtd); - if (err) - return err; -@@ -700,8 +702,6 @@ int mtd_del_partition(struct mtd_info *m - list_for_each_entry_safe(slave, next, &mtd_partitions, list) - if ((slave->master == master) && - (slave->mtd.index == partno)) { -- sysfs_remove_files(&slave->mtd.dev.kobj, -- mtd_partition_attrs); - ret = __mtd_del_partition(slave); - break; - } diff --git a/target/linux/generic/backport-4.9/065-v4.13-0005-mtd-partitions-rename-master-to-the-parent-where-app.patch b/target/linux/generic/backport-4.9/065-v4.13-0005-mtd-partitions-rename-master-to-the-parent-where-app.patch deleted file mode 100644 index 7951227654..0000000000 --- a/target/linux/generic/backport-4.9/065-v4.13-0005-mtd-partitions-rename-master-to-the-parent-where-app.patch +++ /dev/null @@ -1,606 +0,0 @@ -From 0a9d72b69da6d8dae1abd7990c6c4c749846ef3e Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= -Date: Wed, 21 Jun 2017 08:26:44 +0200 -Subject: [PATCH] mtd: partitions: rename "master" to the "parent" where - appropriate -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -This prepares mtd subsystem for the new feature: subpartitions. In some -cases flash device partition can be a container with extra subpartitions -(volumes). - -So far there was a flat structure implemented. One master (flash device) -could be partitioned into few partitions. Every partition got its master -and it was enough to get things running. - -To support subpartitions we need to store pointer to the parent for each -partition. This is required to implement more natural tree structure and -handle all recursion and offsets calculation. - -To make code consistent this patch renamed "master" to the "parent" in -places where we can be dealing with subpartitions. - -Signed-off-by: Rafał Miłecki -Signed-off-by: Brian Norris ---- - drivers/mtd/mtdpart.c | 204 ++++++++++++++++++++++++++------------------------ - 1 file changed, 105 insertions(+), 99 deletions(-) - ---- a/drivers/mtd/mtdpart.c -+++ b/drivers/mtd/mtdpart.c -@@ -37,10 +37,16 @@ - static LIST_HEAD(mtd_partitions); - static DEFINE_MUTEX(mtd_partitions_mutex); - --/* Our partition node structure */ -+/** -+ * struct mtd_part - our partition node structure -+ * -+ * @mtd: struct holding partition details -+ * @parent: parent mtd - flash device or another partition -+ * @offset: partition offset relative to the *flash device* -+ */ - struct mtd_part { - struct mtd_info mtd; -- struct mtd_info *master; -+ struct mtd_info *parent; - uint64_t offset; - struct list_head list; - }; -@@ -67,15 +73,15 @@ static int part_read(struct mtd_info *mt - struct mtd_ecc_stats stats; - int res; - -- stats = part->master->ecc_stats; -- res = part->master->_read(part->master, from + part->offset, len, -+ stats = part->parent->ecc_stats; -+ res = part->parent->_read(part->parent, from + part->offset, len, - retlen, buf); - if (unlikely(mtd_is_eccerr(res))) - mtd->ecc_stats.failed += -- part->master->ecc_stats.failed - stats.failed; -+ part->parent->ecc_stats.failed - stats.failed; - else - mtd->ecc_stats.corrected += -- part->master->ecc_stats.corrected - stats.corrected; -+ part->parent->ecc_stats.corrected - stats.corrected; - return res; - } - -@@ -84,7 +90,7 @@ static int part_point(struct mtd_info *m - { - struct mtd_part *part = mtd_to_part(mtd); - -- return part->master->_point(part->master, from + part->offset, len, -+ return part->parent->_point(part->parent, from + part->offset, len, - retlen, virt, phys); - } - -@@ -92,7 +98,7 @@ static int part_unpoint(struct mtd_info - { - struct mtd_part *part = mtd_to_part(mtd); - -- return part->master->_unpoint(part->master, from + part->offset, len); -+ return part->parent->_unpoint(part->parent, from + part->offset, len); - } - - static unsigned long part_get_unmapped_area(struct mtd_info *mtd, -@@ -103,7 +109,7 @@ static unsigned long part_get_unmapped_a - struct mtd_part *part = mtd_to_part(mtd); - - offset += part->offset; -- return part->master->_get_unmapped_area(part->master, len, offset, -+ return part->parent->_get_unmapped_area(part->parent, len, offset, - flags); - } - -@@ -132,7 +138,7 @@ static int part_read_oob(struct mtd_info - return -EINVAL; - } - -- res = part->master->_read_oob(part->master, from + part->offset, ops); -+ res = part->parent->_read_oob(part->parent, from + part->offset, ops); - if (unlikely(res)) { - if (mtd_is_bitflip(res)) - mtd->ecc_stats.corrected++; -@@ -146,7 +152,7 @@ static int part_read_user_prot_reg(struc - size_t len, size_t *retlen, u_char *buf) - { - struct mtd_part *part = mtd_to_part(mtd); -- return part->master->_read_user_prot_reg(part->master, from, len, -+ return part->parent->_read_user_prot_reg(part->parent, from, len, - retlen, buf); - } - -@@ -154,7 +160,7 @@ static int part_get_user_prot_info(struc - size_t *retlen, struct otp_info *buf) - { - struct mtd_part *part = mtd_to_part(mtd); -- return part->master->_get_user_prot_info(part->master, len, retlen, -+ return part->parent->_get_user_prot_info(part->parent, len, retlen, - buf); - } - -@@ -162,7 +168,7 @@ static int part_read_fact_prot_reg(struc - size_t len, size_t *retlen, u_char *buf) - { - struct mtd_part *part = mtd_to_part(mtd); -- return part->master->_read_fact_prot_reg(part->master, from, len, -+ return part->parent->_read_fact_prot_reg(part->parent, from, len, - retlen, buf); - } - -@@ -170,7 +176,7 @@ static int part_get_fact_prot_info(struc - size_t *retlen, struct otp_info *buf) - { - struct mtd_part *part = mtd_to_part(mtd); -- return part->master->_get_fact_prot_info(part->master, len, retlen, -+ return part->parent->_get_fact_prot_info(part->parent, len, retlen, - buf); - } - -@@ -178,7 +184,7 @@ static int part_write(struct mtd_info *m - size_t *retlen, const u_char *buf) - { - struct mtd_part *part = mtd_to_part(mtd); -- return part->master->_write(part->master, to + part->offset, len, -+ return part->parent->_write(part->parent, to + part->offset, len, - retlen, buf); - } - -@@ -186,7 +192,7 @@ static int part_panic_write(struct mtd_i - size_t *retlen, const u_char *buf) - { - struct mtd_part *part = mtd_to_part(mtd); -- return part->master->_panic_write(part->master, to + part->offset, len, -+ return part->parent->_panic_write(part->parent, to + part->offset, len, - retlen, buf); - } - -@@ -199,14 +205,14 @@ static int part_write_oob(struct mtd_inf - return -EINVAL; - if (ops->datbuf && to + ops->len > mtd->size) - return -EINVAL; -- return part->master->_write_oob(part->master, to + part->offset, ops); -+ return part->parent->_write_oob(part->parent, to + part->offset, ops); - } - - static int part_write_user_prot_reg(struct mtd_info *mtd, loff_t from, - size_t len, size_t *retlen, u_char *buf) - { - struct mtd_part *part = mtd_to_part(mtd); -- return part->master->_write_user_prot_reg(part->master, from, len, -+ return part->parent->_write_user_prot_reg(part->parent, from, len, - retlen, buf); - } - -@@ -214,14 +220,14 @@ static int part_lock_user_prot_reg(struc - size_t len) - { - struct mtd_part *part = mtd_to_part(mtd); -- return part->master->_lock_user_prot_reg(part->master, from, len); -+ return part->parent->_lock_user_prot_reg(part->parent, from, len); - } - - static int part_writev(struct mtd_info *mtd, const struct kvec *vecs, - unsigned long count, loff_t to, size_t *retlen) - { - struct mtd_part *part = mtd_to_part(mtd); -- return part->master->_writev(part->master, vecs, count, -+ return part->parent->_writev(part->parent, vecs, count, - to + part->offset, retlen); - } - -@@ -231,7 +237,7 @@ static int part_erase(struct mtd_info *m - int ret; - - instr->addr += part->offset; -- ret = part->master->_erase(part->master, instr); -+ ret = part->parent->_erase(part->parent, instr); - if (ret) { - if (instr->fail_addr != MTD_FAIL_ADDR_UNKNOWN) - instr->fail_addr -= part->offset; -@@ -257,51 +263,51 @@ EXPORT_SYMBOL_GPL(mtd_erase_callback); - static int part_lock(struct mtd_info *mtd, loff_t ofs, uint64_t len) - { - struct mtd_part *part = mtd_to_part(mtd); -- return part->master->_lock(part->master, ofs + part->offset, len); -+ return part->parent->_lock(part->parent, ofs + part->offset, len); - } - - static int part_unlock(struct mtd_info *mtd, loff_t ofs, uint64_t len) - { - struct mtd_part *part = mtd_to_part(mtd); -- return part->master->_unlock(part->master, ofs + part->offset, len); -+ return part->parent->_unlock(part->parent, ofs + part->offset, len); - } - - static int part_is_locked(struct mtd_info *mtd, loff_t ofs, uint64_t len) - { - struct mtd_part *part = mtd_to_part(mtd); -- return part->master->_is_locked(part->master, ofs + part->offset, len); -+ return part->parent->_is_locked(part->parent, ofs + part->offset, len); - } - - static void part_sync(struct mtd_info *mtd) - { - struct mtd_part *part = mtd_to_part(mtd); -- part->master->_sync(part->master); -+ part->parent->_sync(part->parent); - } - - static int part_suspend(struct mtd_info *mtd) - { - struct mtd_part *part = mtd_to_part(mtd); -- return part->master->_suspend(part->master); -+ return part->parent->_suspend(part->parent); - } - - static void part_resume(struct mtd_info *mtd) - { - struct mtd_part *part = mtd_to_part(mtd); -- part->master->_resume(part->master); -+ part->parent->_resume(part->parent); - } - - static int part_block_isreserved(struct mtd_info *mtd, loff_t ofs) - { - struct mtd_part *part = mtd_to_part(mtd); - ofs += part->offset; -- return part->master->_block_isreserved(part->master, ofs); -+ return part->parent->_block_isreserved(part->parent, ofs); - } - - static int part_block_isbad(struct mtd_info *mtd, loff_t ofs) - { - struct mtd_part *part = mtd_to_part(mtd); - ofs += part->offset; -- return part->master->_block_isbad(part->master, ofs); -+ return part->parent->_block_isbad(part->parent, ofs); - } - - static int part_block_markbad(struct mtd_info *mtd, loff_t ofs) -@@ -310,7 +316,7 @@ static int part_block_markbad(struct mtd - int res; - - ofs += part->offset; -- res = part->master->_block_markbad(part->master, ofs); -+ res = part->parent->_block_markbad(part->parent, ofs); - if (!res) - mtd->ecc_stats.badblocks++; - return res; -@@ -319,13 +325,13 @@ static int part_block_markbad(struct mtd - static int part_get_device(struct mtd_info *mtd) - { - struct mtd_part *part = mtd_to_part(mtd); -- return part->master->_get_device(part->master); -+ return part->parent->_get_device(part->parent); - } - - static void part_put_device(struct mtd_info *mtd) - { - struct mtd_part *part = mtd_to_part(mtd); -- part->master->_put_device(part->master); -+ part->parent->_put_device(part->parent); - } - - static int part_ooblayout_ecc(struct mtd_info *mtd, int section, -@@ -333,7 +339,7 @@ static int part_ooblayout_ecc(struct mtd - { - struct mtd_part *part = mtd_to_part(mtd); - -- return mtd_ooblayout_ecc(part->master, section, oobregion); -+ return mtd_ooblayout_ecc(part->parent, section, oobregion); - } - - static int part_ooblayout_free(struct mtd_info *mtd, int section, -@@ -341,7 +347,7 @@ static int part_ooblayout_free(struct mt - { - struct mtd_part *part = mtd_to_part(mtd); - -- return mtd_ooblayout_free(part->master, section, oobregion); -+ return mtd_ooblayout_free(part->parent, section, oobregion); - } - - static const struct mtd_ooblayout_ops part_ooblayout_ops = { -@@ -353,7 +359,7 @@ static int part_max_bad_blocks(struct mt - { - struct mtd_part *part = mtd_to_part(mtd); - -- return part->master->_max_bad_blocks(part->master, -+ return part->parent->_max_bad_blocks(part->parent, - ofs + part->offset, len); - } - -@@ -363,12 +369,12 @@ static inline void free_partition(struct - kfree(p); - } - --static struct mtd_part *allocate_partition(struct mtd_info *master, -+static struct mtd_part *allocate_partition(struct mtd_info *parent, - const struct mtd_partition *part, int partno, - uint64_t cur_offset) - { -- int wr_alignment = (master->flags & MTD_NO_ERASE) ? master->writesize: -- master->erasesize; -+ int wr_alignment = (parent->flags & MTD_NO_ERASE) ? parent->writesize: -+ parent->erasesize; - struct mtd_part *slave; - u32 remainder; - char *name; -@@ -379,25 +385,25 @@ static struct mtd_part *allocate_partiti - name = kstrdup(part->name, GFP_KERNEL); - if (!name || !slave) { - printk(KERN_ERR"memory allocation error while creating partitions for \"%s\"\n", -- master->name); -+ parent->name); - kfree(name); - kfree(slave); - return ERR_PTR(-ENOMEM); - } - - /* set up the MTD object for this partition */ -- slave->mtd.type = master->type; -- slave->mtd.flags = master->flags & ~part->mask_flags; -+ slave->mtd.type = parent->type; -+ slave->mtd.flags = parent->flags & ~part->mask_flags; - slave->mtd.size = part->size; -- slave->mtd.writesize = master->writesize; -- slave->mtd.writebufsize = master->writebufsize; -- slave->mtd.oobsize = master->oobsize; -- slave->mtd.oobavail = master->oobavail; -- slave->mtd.subpage_sft = master->subpage_sft; -- slave->mtd.pairing = master->pairing; -+ slave->mtd.writesize = parent->writesize; -+ slave->mtd.writebufsize = parent->writebufsize; -+ slave->mtd.oobsize = parent->oobsize; -+ slave->mtd.oobavail = parent->oobavail; -+ slave->mtd.subpage_sft = parent->subpage_sft; -+ slave->mtd.pairing = parent->pairing; - - slave->mtd.name = name; -- slave->mtd.owner = master->owner; -+ slave->mtd.owner = parent->owner; - - /* NOTE: Historically, we didn't arrange MTDs as a tree out of - * concern for showing the same data in multiple partitions. -@@ -408,70 +414,70 @@ static struct mtd_part *allocate_partiti - * distinguish between the master and the partition in sysfs. - */ - slave->mtd.dev.parent = IS_ENABLED(CONFIG_MTD_PARTITIONED_MASTER) ? -- &master->dev : -- master->dev.parent; -+ &parent->dev : -+ parent->dev.parent; - slave->mtd.dev.of_node = part->of_node; - - slave->mtd._read = part_read; - slave->mtd._write = part_write; - -- if (master->_panic_write) -+ if (parent->_panic_write) - slave->mtd._panic_write = part_panic_write; - -- if (master->_point && master->_unpoint) { -+ if (parent->_point && parent->_unpoint) { - slave->mtd._point = part_point; - slave->mtd._unpoint = part_unpoint; - } - -- if (master->_get_unmapped_area) -+ if (parent->_get_unmapped_area) - slave->mtd._get_unmapped_area = part_get_unmapped_area; -- if (master->_read_oob) -+ if (parent->_read_oob) - slave->mtd._read_oob = part_read_oob; -- if (master->_write_oob) -+ if (parent->_write_oob) - slave->mtd._write_oob = part_write_oob; -- if (master->_read_user_prot_reg) -+ if (parent->_read_user_prot_reg) - slave->mtd._read_user_prot_reg = part_read_user_prot_reg; -- if (master->_read_fact_prot_reg) -+ if (parent->_read_fact_prot_reg) - slave->mtd._read_fact_prot_reg = part_read_fact_prot_reg; -- if (master->_write_user_prot_reg) -+ if (parent->_write_user_prot_reg) - slave->mtd._write_user_prot_reg = part_write_user_prot_reg; -- if (master->_lock_user_prot_reg) -+ if (parent->_lock_user_prot_reg) - slave->mtd._lock_user_prot_reg = part_lock_user_prot_reg; -- if (master->_get_user_prot_info) -+ if (parent->_get_user_prot_info) - slave->mtd._get_user_prot_info = part_get_user_prot_info; -- if (master->_get_fact_prot_info) -+ if (parent->_get_fact_prot_info) - slave->mtd._get_fact_prot_info = part_get_fact_prot_info; -- if (master->_sync) -+ if (parent->_sync) - slave->mtd._sync = part_sync; -- if (!partno && !master->dev.class && master->_suspend && -- master->_resume) { -+ if (!partno && !parent->dev.class && parent->_suspend && -+ parent->_resume) { - slave->mtd._suspend = part_suspend; - slave->mtd._resume = part_resume; - } -- if (master->_writev) -+ if (parent->_writev) - slave->mtd._writev = part_writev; -- if (master->_lock) -+ if (parent->_lock) - slave->mtd._lock = part_lock; -- if (master->_unlock) -+ if (parent->_unlock) - slave->mtd._unlock = part_unlock; -- if (master->_is_locked) -+ if (parent->_is_locked) - slave->mtd._is_locked = part_is_locked; -- if (master->_block_isreserved) -+ if (parent->_block_isreserved) - slave->mtd._block_isreserved = part_block_isreserved; -- if (master->_block_isbad) -+ if (parent->_block_isbad) - slave->mtd._block_isbad = part_block_isbad; -- if (master->_block_markbad) -+ if (parent->_block_markbad) - slave->mtd._block_markbad = part_block_markbad; -- if (master->_max_bad_blocks) -+ if (parent->_max_bad_blocks) - slave->mtd._max_bad_blocks = part_max_bad_blocks; - -- if (master->_get_device) -+ if (parent->_get_device) - slave->mtd._get_device = part_get_device; -- if (master->_put_device) -+ if (parent->_put_device) - slave->mtd._put_device = part_put_device; - - slave->mtd._erase = part_erase; -- slave->master = master; -+ slave->parent = parent; - slave->offset = part->offset; - - if (slave->offset == MTDPART_OFS_APPEND) -@@ -489,25 +495,25 @@ static struct mtd_part *allocate_partiti - } - if (slave->offset == MTDPART_OFS_RETAIN) { - slave->offset = cur_offset; -- if (master->size - slave->offset >= slave->mtd.size) { -- slave->mtd.size = master->size - slave->offset -+ if (parent->size - slave->offset >= slave->mtd.size) { -+ slave->mtd.size = parent->size - slave->offset - - slave->mtd.size; - } else { - printk(KERN_ERR "mtd partition \"%s\" doesn't have enough space: %#llx < %#llx, disabled\n", -- part->name, master->size - slave->offset, -+ part->name, parent->size - slave->offset, - slave->mtd.size); - /* register to preserve ordering */ - goto out_register; - } - } - if (slave->mtd.size == MTDPART_SIZ_FULL) -- slave->mtd.size = master->size - slave->offset; -+ slave->mtd.size = parent->size - slave->offset; - - printk(KERN_NOTICE "0x%012llx-0x%012llx : \"%s\"\n", (unsigned long long)slave->offset, - (unsigned long long)(slave->offset + slave->mtd.size), slave->mtd.name); - - /* let's do some sanity checks */ -- if (slave->offset >= master->size) { -+ if (slave->offset >= parent->size) { - /* let's register it anyway to preserve ordering */ - slave->offset = 0; - slave->mtd.size = 0; -@@ -515,16 +521,16 @@ static struct mtd_part *allocate_partiti - part->name); - goto out_register; - } -- if (slave->offset + slave->mtd.size > master->size) { -- slave->mtd.size = master->size - slave->offset; -+ if (slave->offset + slave->mtd.size > parent->size) { -+ slave->mtd.size = parent->size - slave->offset; - printk(KERN_WARNING"mtd: partition \"%s\" extends beyond the end of device \"%s\" -- size truncated to %#llx\n", -- part->name, master->name, (unsigned long long)slave->mtd.size); -+ part->name, parent->name, (unsigned long long)slave->mtd.size); - } -- if (master->numeraseregions > 1) { -+ if (parent->numeraseregions > 1) { - /* Deal with variable erase size stuff */ -- int i, max = master->numeraseregions; -+ int i, max = parent->numeraseregions; - u64 end = slave->offset + slave->mtd.size; -- struct mtd_erase_region_info *regions = master->eraseregions; -+ struct mtd_erase_region_info *regions = parent->eraseregions; - - /* Find the first erase regions which is part of this - * partition. */ -@@ -543,7 +549,7 @@ static struct mtd_part *allocate_partiti - BUG_ON(slave->mtd.erasesize == 0); - } else { - /* Single erase size */ -- slave->mtd.erasesize = master->erasesize; -+ slave->mtd.erasesize = parent->erasesize; - } - - tmp = slave->offset; -@@ -566,17 +572,17 @@ static struct mtd_part *allocate_partiti - } - - mtd_set_ooblayout(&slave->mtd, &part_ooblayout_ops); -- slave->mtd.ecc_step_size = master->ecc_step_size; -- slave->mtd.ecc_strength = master->ecc_strength; -- slave->mtd.bitflip_threshold = master->bitflip_threshold; -+ slave->mtd.ecc_step_size = parent->ecc_step_size; -+ slave->mtd.ecc_strength = parent->ecc_strength; -+ slave->mtd.bitflip_threshold = parent->bitflip_threshold; - -- if (master->_block_isbad) { -+ if (parent->_block_isbad) { - uint64_t offs = 0; - - while (offs < slave->mtd.size) { -- if (mtd_block_isreserved(master, offs + slave->offset)) -+ if (mtd_block_isreserved(parent, offs + slave->offset)) - slave->mtd.ecc_stats.bbtblocks++; -- else if (mtd_block_isbad(master, offs + slave->offset)) -+ else if (mtd_block_isbad(parent, offs + slave->offset)) - slave->mtd.ecc_stats.badblocks++; - offs += slave->mtd.erasesize; - } -@@ -610,7 +616,7 @@ static int mtd_add_partition_attrs(struc - return ret; - } - --int mtd_add_partition(struct mtd_info *master, const char *name, -+int mtd_add_partition(struct mtd_info *parent, const char *name, - long long offset, long long length) - { - struct mtd_partition part; -@@ -623,7 +629,7 @@ int mtd_add_partition(struct mtd_info *m - return -EINVAL; - - if (length == MTDPART_SIZ_FULL) -- length = master->size - offset; -+ length = parent->size - offset; - - if (length <= 0) - return -EINVAL; -@@ -633,7 +639,7 @@ int mtd_add_partition(struct mtd_info *m - part.size = length; - part.offset = offset; - -- new = allocate_partition(master, &part, -1, offset); -+ new = allocate_partition(parent, &part, -1, offset); - if (IS_ERR(new)) - return PTR_ERR(new); - -@@ -683,7 +689,7 @@ int del_mtd_partitions(struct mtd_info * - - mutex_lock(&mtd_partitions_mutex); - list_for_each_entry_safe(slave, next, &mtd_partitions, list) -- if (slave->master == master) { -+ if (slave->parent == master) { - ret = __mtd_del_partition(slave); - if (ret < 0) - err = ret; -@@ -700,7 +706,7 @@ int mtd_del_partition(struct mtd_info *m - - mutex_lock(&mtd_partitions_mutex); - list_for_each_entry_safe(slave, next, &mtd_partitions, list) -- if ((slave->master == master) && -+ if ((slave->parent == master) && - (slave->mtd.index == partno)) { - ret = __mtd_del_partition(slave); - break; -@@ -933,6 +939,6 @@ uint64_t mtd_get_device_size(const struc - if (!mtd_is_partition(mtd)) - return mtd->size; - -- return mtd_to_part(mtd)->master->size; -+ return mtd_to_part(mtd)->parent->size; - } - EXPORT_SYMBOL_GPL(mtd_get_device_size); diff --git a/target/linux/generic/backport-4.9/065-v4.13-0006-mtd-partitions-add-support-for-subpartitions.patch b/target/linux/generic/backport-4.9/065-v4.13-0006-mtd-partitions-add-support-for-subpartitions.patch deleted file mode 100644 index 0d3e10ac20..0000000000 --- a/target/linux/generic/backport-4.9/065-v4.13-0006-mtd-partitions-add-support-for-subpartitions.patch +++ /dev/null @@ -1,96 +0,0 @@ -From 97519dc52b44af054d7654776e78eaa211cf1842 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= -Date: Wed, 21 Jun 2017 08:26:45 +0200 -Subject: [PATCH] mtd: partitions: add support for subpartitions -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Some flash device partitions can be containers with extra subpartitions -(volumes). All callbacks are already capable of this additional level of -indirection. - -This patch makes sure we always display subpartitions using a tree -structure and takes care of deleting subpartitions when parent gets -removed. - -Signed-off-by: Rafał Miłecki -Signed-off-by: Brian Norris ---- - drivers/mtd/mtdpart.c | 23 ++++++++++++++++------- - 1 file changed, 16 insertions(+), 7 deletions(-) - ---- a/drivers/mtd/mtdpart.c -+++ b/drivers/mtd/mtdpart.c -@@ -413,7 +413,7 @@ static struct mtd_part *allocate_partiti - * parent conditional on that option. Note, this is a way to - * distinguish between the master and the partition in sysfs. - */ -- slave->mtd.dev.parent = IS_ENABLED(CONFIG_MTD_PARTITIONED_MASTER) ? -+ slave->mtd.dev.parent = IS_ENABLED(CONFIG_MTD_PARTITIONED_MASTER) || mtd_is_partition(parent) ? - &parent->dev : - parent->dev.parent; - slave->mtd.dev.of_node = part->of_node; -@@ -664,8 +664,17 @@ EXPORT_SYMBOL_GPL(mtd_add_partition); - */ - static int __mtd_del_partition(struct mtd_part *priv) - { -+ struct mtd_part *child, *next; - int err; - -+ list_for_each_entry_safe(child, next, &mtd_partitions, list) { -+ if (child->parent == &priv->mtd) { -+ err = __mtd_del_partition(child); -+ if (err) -+ return err; -+ } -+ } -+ - sysfs_remove_files(&priv->mtd.dev.kobj, mtd_partition_attrs); - - err = del_mtd_device(&priv->mtd); -@@ -680,16 +689,16 @@ static int __mtd_del_partition(struct mt - - /* - * This function unregisters and destroy all slave MTD objects which are -- * attached to the given master MTD object. -+ * attached to the given MTD object. - */ --int del_mtd_partitions(struct mtd_info *master) -+int del_mtd_partitions(struct mtd_info *mtd) - { - struct mtd_part *slave, *next; - int ret, err = 0; - - mutex_lock(&mtd_partitions_mutex); - list_for_each_entry_safe(slave, next, &mtd_partitions, list) -- if (slave->parent == master) { -+ if (slave->parent == mtd) { - ret = __mtd_del_partition(slave); - if (ret < 0) - err = ret; -@@ -699,14 +708,14 @@ int del_mtd_partitions(struct mtd_info * - return err; - } - --int mtd_del_partition(struct mtd_info *master, int partno) -+int mtd_del_partition(struct mtd_info *mtd, int partno) - { - struct mtd_part *slave, *next; - int ret = -EINVAL; - - mutex_lock(&mtd_partitions_mutex); - list_for_each_entry_safe(slave, next, &mtd_partitions, list) -- if ((slave->parent == master) && -+ if ((slave->parent == mtd) && - (slave->mtd.index == partno)) { - ret = __mtd_del_partition(slave); - break; -@@ -939,6 +948,6 @@ uint64_t mtd_get_device_size(const struc - if (!mtd_is_partition(mtd)) - return mtd->size; - -- return mtd_to_part(mtd)->parent->size; -+ return mtd_get_device_size(mtd_to_part(mtd)->parent); - } - EXPORT_SYMBOL_GPL(mtd_get_device_size); diff --git a/target/linux/generic/backport-4.9/065-v4.13-0007-mtd-partitions-add-support-for-partition-parsers.patch b/target/linux/generic/backport-4.9/065-v4.13-0007-mtd-partitions-add-support-for-partition-parsers.patch deleted file mode 100644 index a28ee316fa..0000000000 --- a/target/linux/generic/backport-4.9/065-v4.13-0007-mtd-partitions-add-support-for-partition-parsers.patch +++ /dev/null @@ -1,110 +0,0 @@ -From 1a0915be192606fee64830b9c5d70b7ed59426b6 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= -Date: Wed, 21 Jun 2017 08:26:46 +0200 -Subject: [PATCH] mtd: partitions: add support for partition parsers -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Some devices have partitions that are kind of containers with extra -subpartitions / volumes instead of e.g. a simple filesystem data. To -support such cases we need to first create normal flash device -partitions and then take care of these special ones. - -It's very common case for home routers. Depending on the vendor there -are formats like TRX, Seama, TP-Link, WRGG & more. All of them are used -to embed few partitions into a single one / single firmware file. - -Ideally all vendors would use some well documented / standardized format -like UBI (and some probably start doing so), but there are still -countless devices on the market using these poor vendor specific -formats. - -This patch extends MTD subsystem by allowing to specify list of parsers -that should be tried for a given partition. Supporting such poor formats -is highly unlikely to be the top priority so these changes try to -minimize maintenance cost to the minimum. It reuses existing code for -these new parsers and just adds a one property and one new function. - -This implementation requires setting partition parsers in a flash -parser. A proper change of bcm47xxpart will follow and in the future we -will hopefully also find a solution for doing it with ofpart -("fixed-partitions"). - -Signed-off-by: Rafał Miłecki -Signed-off-by: Brian Norris ---- - drivers/mtd/mtdpart.c | 31 +++++++++++++++++++++++++++++++ - include/linux/mtd/partitions.h | 7 +++++++ - 2 files changed, 38 insertions(+) - ---- a/drivers/mtd/mtdpart.c -+++ b/drivers/mtd/mtdpart.c -@@ -369,6 +369,35 @@ static inline void free_partition(struct - kfree(p); - } - -+/** -+ * mtd_parse_part - parse MTD partition looking for subpartitions -+ * -+ * @slave: part that is supposed to be a container and should be parsed -+ * @types: NULL-terminated array with names of partition parsers to try -+ * -+ * Some partitions are kind of containers with extra subpartitions (volumes). -+ * There can be various formats of such containers. This function tries to use -+ * specified parsers to analyze given partition and registers found -+ * subpartitions on success. -+ */ -+static int mtd_parse_part(struct mtd_part *slave, const char *const *types) -+{ -+ struct mtd_partitions parsed; -+ int err; -+ -+ err = parse_mtd_partitions(&slave->mtd, types, &parsed, NULL); -+ if (err) -+ return err; -+ else if (!parsed.nr_parts) -+ return -ENOENT; -+ -+ err = add_mtd_partitions(&slave->mtd, parsed.parts, parsed.nr_parts); -+ -+ mtd_part_parser_cleanup(&parsed); -+ -+ return err; -+} -+ - static struct mtd_part *allocate_partition(struct mtd_info *parent, - const struct mtd_partition *part, int partno, - uint64_t cur_offset) -@@ -758,6 +787,8 @@ int add_mtd_partitions(struct mtd_info * - - add_mtd_device(&slave->mtd); - mtd_add_partition_attrs(slave); -+ if (parts[i].types) -+ mtd_parse_part(slave, parts[i].types); - - cur_offset = slave->offset + slave->mtd.size; - } ---- a/include/linux/mtd/partitions.h -+++ b/include/linux/mtd/partitions.h -@@ -20,6 +20,12 @@ - * - * For each partition, these fields are available: - * name: string that will be used to label the partition's MTD device. -+ * types: some partitions can be containers using specific format to describe -+ * embedded subpartitions / volumes. E.g. many home routers use "firmware" -+ * partition that contains at least kernel and rootfs. In such case an -+ * extra parser is needed that will detect these dynamic partitions and -+ * report them to the MTD subsystem. If set this property stores an array -+ * of parser names to use when looking for subpartitions. - * size: the partition size; if defined as MTDPART_SIZ_FULL, the partition - * will extend to the end of the master MTD device. - * offset: absolute starting position within the master MTD device; if -@@ -38,6 +44,7 @@ - - struct mtd_partition { - const char *name; /* identifier string */ -+ const char *const *types; /* names of parsers to use if any */ - uint64_t size; /* partition size */ - uint64_t offset; /* offset within the master MTD space */ - uint32_t mask_flags; /* master MTD flags to mask out for this partition */ diff --git a/target/linux/generic/backport-4.9/065-v4.13-0008-mtd-extract-TRX-parser-out-of-bcm47xxpart-into-a-sep.patch b/target/linux/generic/backport-4.9/065-v4.13-0008-mtd-extract-TRX-parser-out-of-bcm47xxpart-into-a-sep.patch deleted file mode 100644 index 3761a46610..0000000000 --- a/target/linux/generic/backport-4.9/065-v4.13-0008-mtd-extract-TRX-parser-out-of-bcm47xxpart-into-a-sep.patch +++ /dev/null @@ -1,320 +0,0 @@ -From 99352afe8f169c95b294b6b9a8d0e18cd9e3c2a0 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= -Date: Wed, 21 Jun 2017 08:26:47 +0200 -Subject: [PATCH] mtd: extract TRX parser out of bcm47xxpart into a separated - module -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -This makes TRX parsing code reusable with other platforms and parsers. - -Please note this patch doesn't really change anything in the existing -code, just moves it. There is still some place for improvement (e.g. -working on non-hacky method of checking rootfs format) but it's not -really a subject of this change. - -Signed-off-by: Rafał Miłecki -Signed-off-by: Brian Norris ---- - drivers/mtd/Kconfig | 4 ++ - drivers/mtd/Makefile | 1 + - drivers/mtd/bcm47xxpart.c | 99 ++---------------------------- - drivers/mtd/parsers/Kconfig | 8 +++ - drivers/mtd/parsers/Makefile | 1 + - drivers/mtd/parsers/parser_trx.c | 126 +++++++++++++++++++++++++++++++++++++++ - 6 files changed, 145 insertions(+), 94 deletions(-) - create mode 100644 drivers/mtd/parsers/Kconfig - create mode 100644 drivers/mtd/parsers/Makefile - create mode 100644 drivers/mtd/parsers/parser_trx.c - ---- a/drivers/mtd/Kconfig -+++ b/drivers/mtd/Kconfig -@@ -155,6 +155,10 @@ config MTD_BCM47XX_PARTS - This provides partitions parser for devices based on BCM47xx - boards. - -+menu "Partition parsers" -+source "drivers/mtd/parsers/Kconfig" -+endmenu -+ - comment "User Modules And Translation Layers" - - # ---- a/drivers/mtd/Makefile -+++ b/drivers/mtd/Makefile -@@ -13,6 +13,7 @@ obj-$(CONFIG_MTD_AFS_PARTS) += afs.o - obj-$(CONFIG_MTD_AR7_PARTS) += ar7part.o - obj-$(CONFIG_MTD_BCM63XX_PARTS) += bcm63xxpart.o - obj-$(CONFIG_MTD_BCM47XX_PARTS) += bcm47xxpart.o -+obj-y += parsers/ - - # 'Users' - code which presents functionality to userspace. - obj-$(CONFIG_MTD_BLKDEVS) += mtd_blkdevs.o ---- a/drivers/mtd/bcm47xxpart.c -+++ b/drivers/mtd/bcm47xxpart.c -@@ -43,7 +43,8 @@ - #define ML_MAGIC2 0x26594131 - #define TRX_MAGIC 0x30524448 - #define SHSQ_MAGIC 0x71736873 /* shsq (weird ZTE H218N endianness) */ --#define UBI_EC_MAGIC 0x23494255 /* UBI# */ -+ -+static const char * const trx_types[] = { "trx", NULL }; - - struct trx_header { - uint32_t magic; -@@ -62,89 +63,6 @@ static void bcm47xxpart_add_part(struct - part->mask_flags = mask_flags; - } - --static const char *bcm47xxpart_trx_data_part_name(struct mtd_info *master, -- size_t offset) --{ -- uint32_t buf; -- size_t bytes_read; -- int err; -- -- err = mtd_read(master, offset, sizeof(buf), &bytes_read, -- (uint8_t *)&buf); -- if (err && !mtd_is_bitflip(err)) { -- pr_err("mtd_read error while parsing (offset: 0x%X): %d\n", -- offset, err); -- goto out_default; -- } -- -- if (buf == UBI_EC_MAGIC) -- return "ubi"; -- --out_default: -- return "rootfs"; --} -- --static int bcm47xxpart_parse_trx(struct mtd_info *master, -- struct mtd_partition *trx, -- struct mtd_partition *parts, -- size_t parts_len) --{ -- struct trx_header header; -- size_t bytes_read; -- int curr_part = 0; -- int i, err; -- -- if (parts_len < 3) { -- pr_warn("No enough space to add TRX partitions!\n"); -- return -ENOMEM; -- } -- -- err = mtd_read(master, trx->offset, sizeof(header), &bytes_read, -- (uint8_t *)&header); -- if (err && !mtd_is_bitflip(err)) { -- pr_err("mtd_read error while reading TRX header: %d\n", err); -- return err; -- } -- -- i = 0; -- -- /* We have LZMA loader if offset[2] points to sth */ -- if (header.offset[2]) { -- bcm47xxpart_add_part(&parts[curr_part++], "loader", -- trx->offset + header.offset[i], 0); -- i++; -- } -- -- if (header.offset[i]) { -- bcm47xxpart_add_part(&parts[curr_part++], "linux", -- trx->offset + header.offset[i], 0); -- i++; -- } -- -- if (header.offset[i]) { -- size_t offset = trx->offset + header.offset[i]; -- const char *name = bcm47xxpart_trx_data_part_name(master, -- offset); -- -- bcm47xxpart_add_part(&parts[curr_part++], name, offset, 0); -- i++; -- } -- -- /* -- * Assume that every partition ends at the beginning of the one it is -- * followed by. -- */ -- for (i = 0; i < curr_part; i++) { -- u64 next_part_offset = (i < curr_part - 1) ? -- parts[i + 1].offset : -- trx->offset + trx->size; -- -- parts[i].size = next_part_offset - parts[i].offset; -- } -- -- return curr_part; --} -- - /** - * bcm47xxpart_bootpartition - gets index of TRX partition used by bootloader - * -@@ -362,17 +280,10 @@ static int bcm47xxpart_parse(struct mtd_ - for (i = 0; i < trx_num; i++) { - struct mtd_partition *trx = &parts[trx_parts[i]]; - -- if (i == bcm47xxpart_bootpartition()) { -- int num_parts; -- -- num_parts = bcm47xxpart_parse_trx(master, trx, -- parts + curr_part, -- BCM47XXPART_MAX_PARTS - curr_part); -- if (num_parts > 0) -- curr_part += num_parts; -- } else { -+ if (i == bcm47xxpart_bootpartition()) -+ trx->types = trx_types; -+ else - trx->name = "failsafe"; -- } - } - - *pparts = parts; ---- /dev/null -+++ b/drivers/mtd/parsers/Kconfig -@@ -0,0 +1,8 @@ -+config MTD_PARSER_TRX -+ tristate "Parser for TRX format partitions" -+ depends on MTD && (BCM47XX || ARCH_BCM_5301X || COMPILE_TEST) -+ help -+ TRX is a firmware format used by Broadcom on their devices. It -+ may contain up to 3/4 partitions (depending on the version). -+ This driver will parse TRX header and report at least two partitions: -+ kernel and rootfs. ---- /dev/null -+++ b/drivers/mtd/parsers/Makefile -@@ -0,0 +1 @@ -+obj-$(CONFIG_MTD_PARSER_TRX) += parser_trx.o ---- /dev/null -+++ b/drivers/mtd/parsers/parser_trx.c -@@ -0,0 +1,126 @@ -+/* -+ * Parser for TRX format partitions -+ * -+ * Copyright (C) 2012 - 2017 Rafał Miłecki -+ * -+ * 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 -+#include -+#include -+#include -+ -+#define TRX_PARSER_MAX_PARTS 4 -+ -+/* Magics */ -+#define TRX_MAGIC 0x30524448 -+#define UBI_EC_MAGIC 0x23494255 /* UBI# */ -+ -+struct trx_header { -+ uint32_t magic; -+ uint32_t length; -+ uint32_t crc32; -+ uint16_t flags; -+ uint16_t version; -+ uint32_t offset[3]; -+} __packed; -+ -+static const char *parser_trx_data_part_name(struct mtd_info *master, -+ size_t offset) -+{ -+ uint32_t buf; -+ size_t bytes_read; -+ int err; -+ -+ err = mtd_read(master, offset, sizeof(buf), &bytes_read, -+ (uint8_t *)&buf); -+ if (err && !mtd_is_bitflip(err)) { -+ pr_err("mtd_read error while parsing (offset: 0x%X): %d\n", -+ offset, err); -+ goto out_default; -+ } -+ -+ if (buf == UBI_EC_MAGIC) -+ return "ubi"; -+ -+out_default: -+ return "rootfs"; -+} -+ -+static int parser_trx_parse(struct mtd_info *mtd, -+ const struct mtd_partition **pparts, -+ struct mtd_part_parser_data *data) -+{ -+ struct mtd_partition *parts; -+ struct mtd_partition *part; -+ struct trx_header trx; -+ size_t bytes_read; -+ uint8_t curr_part = 0, i = 0; -+ int err; -+ -+ parts = kzalloc(sizeof(struct mtd_partition) * TRX_PARSER_MAX_PARTS, -+ GFP_KERNEL); -+ if (!parts) -+ return -ENOMEM; -+ -+ err = mtd_read(mtd, 0, sizeof(trx), &bytes_read, (uint8_t *)&trx); -+ if (err) { -+ pr_err("MTD reading error: %d\n", err); -+ kfree(parts); -+ return err; -+ } -+ -+ if (trx.magic != TRX_MAGIC) { -+ kfree(parts); -+ return -ENOENT; -+ } -+ -+ /* We have LZMA loader if there is address in offset[2] */ -+ if (trx.offset[2]) { -+ part = &parts[curr_part++]; -+ part->name = "loader"; -+ part->offset = trx.offset[i]; -+ i++; -+ } -+ -+ if (trx.offset[i]) { -+ part = &parts[curr_part++]; -+ part->name = "linux"; -+ part->offset = trx.offset[i]; -+ i++; -+ } -+ -+ if (trx.offset[i]) { -+ part = &parts[curr_part++]; -+ part->name = parser_trx_data_part_name(mtd, trx.offset[i]); -+ part->offset = trx.offset[i]; -+ i++; -+ } -+ -+ /* -+ * Assume that every partition ends at the beginning of the one it is -+ * followed by. -+ */ -+ for (i = 0; i < curr_part; i++) { -+ u64 next_part_offset = (i < curr_part - 1) ? -+ parts[i + 1].offset : mtd->size; -+ -+ parts[i].size = next_part_offset - parts[i].offset; -+ } -+ -+ *pparts = parts; -+ return i; -+}; -+ -+static struct mtd_part_parser mtd_parser_trx = { -+ .parse_fn = parser_trx_parse, -+ .name = "trx", -+}; -+module_mtd_part_parser(mtd_parser_trx); -+ -+MODULE_LICENSE("GPL v2"); -+MODULE_DESCRIPTION("Parser for TRX format partitions"); diff --git a/target/linux/generic/backport-4.9/066-v4.17-0001-mtd-move-code-adding-master-MTD-out-of-mtd_add_devic.patch b/target/linux/generic/backport-4.9/066-v4.17-0001-mtd-move-code-adding-master-MTD-out-of-mtd_add_devic.patch deleted file mode 100644 index 07a456d4c0..0000000000 --- a/target/linux/generic/backport-4.9/066-v4.17-0001-mtd-move-code-adding-master-MTD-out-of-mtd_add_devic.patch +++ /dev/null @@ -1,74 +0,0 @@ -From 2c77c57d22adb05b21cdb333a0c42bdfa0e19835 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= -Date: Tue, 16 Jan 2018 16:45:41 +0100 -Subject: [PATCH] mtd: move code adding master MTD out of - mtd_add_device_partitions() -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -This change is a small cleanup of mtd_device_parse_register(). When -using MTD_PARTITIONED_MASTER it makes sure a master MTD is registered -before dealing with partitions. The advantage of this is not mixing -code handling master MTD with code handling partitions. - -This commit doesn't change any behavior except from a slightly different -failure code path. The new code may need to call del_mtd_device when -something goes wrong. - -Signed-off-by: Rafał Miłecki -Signed-off-by: Boris Brezillon ---- - drivers/mtd/mtdcore.c | 25 +++++++++++++------------ - 1 file changed, 13 insertions(+), 12 deletions(-) - ---- a/drivers/mtd/mtdcore.c -+++ b/drivers/mtd/mtdcore.c -@@ -631,20 +631,12 @@ static int mtd_add_device_partitions(str - { - const struct mtd_partition *real_parts = parts->parts; - int nbparts = parts->nr_parts; -- int ret; - -- if (nbparts == 0 || IS_ENABLED(CONFIG_MTD_PARTITIONED_MASTER)) { -- ret = add_mtd_device(mtd); -- if (ret) -- return ret; -- } -+ if (!nbparts && !device_is_registered(&mtd->dev)) -+ return add_mtd_device(mtd); - -- if (nbparts > 0) { -- ret = add_mtd_partitions(mtd, real_parts, nbparts); -- if (ret && IS_ENABLED(CONFIG_MTD_PARTITIONED_MASTER)) -- del_mtd_device(mtd); -- return ret; -- } -+ if (nbparts > 0) -+ return add_mtd_partitions(mtd, real_parts, nbparts); - - return 0; - } -@@ -704,6 +696,12 @@ int mtd_device_parse_register(struct mtd - - mtd_set_dev_defaults(mtd); - -+ if (IS_ENABLED(CONFIG_MTD_PARTITIONED_MASTER)) { -+ ret = add_mtd_device(mtd); -+ if (ret) -+ return ret; -+ } -+ - memset(&parsed, 0, sizeof(parsed)); - - ret = parse_mtd_partitions(mtd, types, &parsed, parser_data); -@@ -743,6 +741,9 @@ int mtd_device_parse_register(struct mtd - out: - /* Cleanup any parsed partitions */ - mtd_part_parser_cleanup(&parsed); -+ if (ret && device_is_registered(&mtd->dev)) -+ del_mtd_device(mtd); -+ - return ret; - } - EXPORT_SYMBOL_GPL(mtd_device_parse_register); diff --git a/target/linux/generic/backport-4.9/066-v4.17-0002-mtd-get-rid-of-the-mtd_add_device_partitions.patch b/target/linux/generic/backport-4.9/066-v4.17-0002-mtd-get-rid-of-the-mtd_add_device_partitions.patch deleted file mode 100644 index b629d430a4..0000000000 --- a/target/linux/generic/backport-4.9/066-v4.17-0002-mtd-get-rid-of-the-mtd_add_device_partitions.patch +++ /dev/null @@ -1,93 +0,0 @@ -From 0dbe4ea78d69756efeb0bba0764f6bd4a9ee9567 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= -Date: Tue, 16 Jan 2018 16:45:42 +0100 -Subject: [PATCH] mtd: get rid of the mtd_add_device_partitions() -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -This simplifies code a bit by: -1) Avoiding an extra (tiny) function -2) Checking for amount of parsed (found) partitions just once -3) Avoiding clearing/filling struct mtd_partitions manually - -With this commit proper functions are called directly from the -mtd_device_parse_register(). It doesn't need to use minor tricks like -memsetting struct to 0 to trigger an expected -mtd_add_device_partitions() behavior. - -Signed-off-by: Rafał Miłecki -Signed-off-by: Boris Brezillon ---- - drivers/mtd/mtdcore.c | 43 ++++++++++++------------------------------- - 1 file changed, 12 insertions(+), 31 deletions(-) - ---- a/drivers/mtd/mtdcore.c -+++ b/drivers/mtd/mtdcore.c -@@ -626,21 +626,6 @@ out_error: - return ret; - } - --static int mtd_add_device_partitions(struct mtd_info *mtd, -- struct mtd_partitions *parts) --{ -- const struct mtd_partition *real_parts = parts->parts; -- int nbparts = parts->nr_parts; -- -- if (!nbparts && !device_is_registered(&mtd->dev)) -- return add_mtd_device(mtd); -- -- if (nbparts > 0) -- return add_mtd_partitions(mtd, real_parts, nbparts); -- -- return 0; --} -- - /* - * Set a few defaults based on the parent devices, if not provided by the - * driver -@@ -691,7 +676,7 @@ int mtd_device_parse_register(struct mtd - const struct mtd_partition *parts, - int nr_parts) - { -- struct mtd_partitions parsed; -+ struct mtd_partitions parsed = { }; - int ret; - - mtd_set_dev_defaults(mtd); -@@ -702,24 +687,20 @@ int mtd_device_parse_register(struct mtd - return ret; - } - -- memset(&parsed, 0, sizeof(parsed)); -- -+ /* Prefer parsed partitions over driver-provided fallback */ - ret = parse_mtd_partitions(mtd, types, &parsed, parser_data); -- if ((ret < 0 || parsed.nr_parts == 0) && parts && nr_parts) { -- /* Fall back to driver-provided partitions */ -- parsed = (struct mtd_partitions){ -- .parts = parts, -- .nr_parts = nr_parts, -- }; -- } else if (ret < 0) { -- /* Didn't come up with parsed OR fallback partitions */ -- pr_info("mtd: failed to find partitions; one or more parsers reports errors (%d)\n", -- ret); -- /* Don't abort on errors; we can still use unpartitioned MTD */ -- memset(&parsed, 0, sizeof(parsed)); -+ if (!ret && parsed.nr_parts) { -+ parts = parsed.parts; -+ nr_parts = parsed.nr_parts; - } - -- ret = mtd_add_device_partitions(mtd, &parsed); -+ if (nr_parts) -+ ret = add_mtd_partitions(mtd, parts, nr_parts); -+ else if (!device_is_registered(&mtd->dev)) -+ ret = add_mtd_device(mtd); -+ else -+ ret = 0; -+ - if (ret) - goto out; - diff --git a/target/linux/generic/backport-4.9/067-v4.17-0001-mtd-partitions-add-of_match_table-parser-matching-fo.patch b/target/linux/generic/backport-4.9/067-v4.17-0001-mtd-partitions-add-of_match_table-parser-matching-fo.patch deleted file mode 100644 index 60eace2a34..0000000000 --- a/target/linux/generic/backport-4.9/067-v4.17-0001-mtd-partitions-add-of_match_table-parser-matching-fo.patch +++ /dev/null @@ -1,200 +0,0 @@ -From 5b644aa012f67fd211138a067b9f351f30bdcc60 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= -Date: Wed, 14 Mar 2018 13:10:42 +0100 -Subject: [PATCH] mtd: partitions: add of_match_table parser matching for the - "ofpart" type -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -In order to properly support compatibility strings as described in the -bindings/mtd/partition.txt "ofpart" type should be treated as an -indication for looking into OF. MTD should check "compatible" property -and search for a matching parser rather than blindly trying the one -supporting "fixed-partitions". - -It also means that existing "fixed-partitions" parser should get renamed -to use a more meaningful name. - -This commit achievies that aim by introducing a new mtd_part_of_parse(). -It works by looking for a matching parser for every string in the -"compatibility" property (starting with the most specific one). - -Please note that driver-specified parsers still take a precedence. It's -assumed that driver providing a parser type has a good reason for that -(e.g. having platform data with device-specific info). Also doing -otherwise could break existing setups. The same applies to using default -parsers (including "cmdlinepart") as some overwrite DT data with cmdline -argument. - -Partition parsers can now provide an of_match_table to enable -flash<-->parser matching via device tree as documented in the -mtd/partition.txt. - -This support is currently limited to built-in parsers as it uses -request_module() and friends. This should be sufficient for most cases -though as compiling parsers as modules isn't a common choice. - -Signed-off-by: Brian Norris -Signed-off-by: Rafał Miłecki -Tested-by: Peter Rosin -Reviewed-by: Richard Weinberger -Signed-off-by: Boris Brezillon ---- - drivers/mtd/mtdpart.c | 116 +++++++++++++++++++++++++++++++++++++---- - include/linux/mtd/partitions.h | 1 + - 2 files changed, 108 insertions(+), 9 deletions(-) - ---- a/drivers/mtd/mtdpart.c -+++ b/drivers/mtd/mtdpart.c -@@ -30,6 +30,7 @@ - #include - #include - #include -+#include - - #include "mtdcore.h" - -@@ -886,6 +887,92 @@ static int mtd_part_do_parse(struct mtd_ - } - - /** -+ * mtd_part_get_compatible_parser - find MTD parser by a compatible string -+ * -+ * @compat: compatible string describing partitions in a device tree -+ * -+ * MTD parsers can specify supported partitions by providing a table of -+ * compatibility strings. This function finds a parser that advertises support -+ * for a passed value of "compatible". -+ */ -+static struct mtd_part_parser *mtd_part_get_compatible_parser(const char *compat) -+{ -+ struct mtd_part_parser *p, *ret = NULL; -+ -+ spin_lock(&part_parser_lock); -+ -+ list_for_each_entry(p, &part_parsers, list) { -+ const struct of_device_id *matches; -+ -+ matches = p->of_match_table; -+ if (!matches) -+ continue; -+ -+ for (; matches->compatible[0]; matches++) { -+ if (!strcmp(matches->compatible, compat) && -+ try_module_get(p->owner)) { -+ ret = p; -+ break; -+ } -+ } -+ -+ if (ret) -+ break; -+ } -+ -+ spin_unlock(&part_parser_lock); -+ -+ return ret; -+} -+ -+static int mtd_part_of_parse(struct mtd_info *master, -+ struct mtd_partitions *pparts) -+{ -+ struct mtd_part_parser *parser; -+ struct device_node *np; -+ struct property *prop; -+ const char *compat; -+ const char *fixed = "ofpart"; -+ int ret, err = 0; -+ -+ np = of_get_child_by_name(mtd_get_of_node(master), "partitions"); -+ of_property_for_each_string(np, "compatible", prop, compat) { -+ parser = mtd_part_get_compatible_parser(compat); -+ if (!parser) -+ continue; -+ ret = mtd_part_do_parse(parser, master, pparts, NULL); -+ if (ret > 0) { -+ of_node_put(np); -+ return ret; -+ } -+ mtd_part_parser_put(parser); -+ if (ret < 0 && !err) -+ err = ret; -+ } -+ of_node_put(np); -+ -+ /* -+ * For backward compatibility we have to try the "ofpart" -+ * parser. It supports old DT format with partitions specified as a -+ * direct subnodes of a flash device DT node without any compatibility -+ * specified we could match. -+ */ -+ parser = mtd_part_parser_get(fixed); -+ if (!parser && !request_module("%s", fixed)) -+ parser = mtd_part_parser_get(fixed); -+ if (parser) { -+ ret = mtd_part_do_parse(parser, master, pparts, NULL); -+ if (ret > 0) -+ return ret; -+ mtd_part_parser_put(parser); -+ if (ret < 0 && !err) -+ err = ret; -+ } -+ -+ return err; -+} -+ -+/** - * parse_mtd_partitions - parse MTD partitions - * @master: the master partition (describes whole MTD device) - * @types: names of partition parsers to try or %NULL -@@ -917,19 +1004,30 @@ int parse_mtd_partitions(struct mtd_info - types = default_mtd_part_types; - - for ( ; *types; types++) { -- pr_debug("%s: parsing partitions %s\n", master->name, *types); -- parser = mtd_part_parser_get(*types); -- if (!parser && !request_module("%s", *types)) -+ /* -+ * ofpart is a special type that means OF partitioning info -+ * should be used. It requires a bit different logic so it is -+ * handled in a separated function. -+ */ -+ if (!strcmp(*types, "ofpart")) { -+ ret = mtd_part_of_parse(master, pparts); -+ } else { -+ pr_debug("%s: parsing partitions %s\n", master->name, -+ *types); - parser = mtd_part_parser_get(*types); -- pr_debug("%s: got parser %s\n", master->name, -- parser ? parser->name : NULL); -- if (!parser) -- continue; -- ret = mtd_part_do_parse(parser, master, pparts, data); -+ if (!parser && !request_module("%s", *types)) -+ parser = mtd_part_parser_get(*types); -+ pr_debug("%s: got parser %s\n", master->name, -+ parser ? parser->name : NULL); -+ if (!parser) -+ continue; -+ ret = mtd_part_do_parse(parser, master, pparts, data); -+ if (ret <= 0) -+ mtd_part_parser_put(parser); -+ } - /* Found partitions! */ - if (ret > 0) - return 0; -- mtd_part_parser_put(parser); - /* - * Stash the first error we see; only report it if no parser - * succeeds ---- a/include/linux/mtd/partitions.h -+++ b/include/linux/mtd/partitions.h -@@ -77,6 +77,7 @@ struct mtd_part_parser { - struct list_head list; - struct module *owner; - const char *name; -+ const struct of_device_id *of_match_table; - int (*parse_fn)(struct mtd_info *, const struct mtd_partition **, - struct mtd_part_parser_data *); - void (*cleanup)(const struct mtd_partition *pparts, int nr_parts); diff --git a/target/linux/generic/backport-4.9/067-v4.17-0002-mtd-rename-ofpart-parser-to-fixed-partitions-as-it-f.patch b/target/linux/generic/backport-4.9/067-v4.17-0002-mtd-rename-ofpart-parser-to-fixed-partitions-as-it-f.patch deleted file mode 100644 index 59f53df101..0000000000 --- a/target/linux/generic/backport-4.9/067-v4.17-0002-mtd-rename-ofpart-parser-to-fixed-partitions-as-it-f.patch +++ /dev/null @@ -1,74 +0,0 @@ -From c0faf43482e7f7dfb6d61847cb93d17748560b24 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= -Date: Wed, 14 Mar 2018 13:10:43 +0100 -Subject: [PATCH] mtd: rename "ofpart" parser to "fixed-partitions" as it fits - it better -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Type "ofpart" means that OF should be used to get partitioning info and -this driver supports "fixed-partitions" binding only. Renaming it should -lead to less confusion especially when parsers for new compatibility -strings start to appear. - -Signed-off-by: Rafał Miłecki -Reviewed-by: Richard Weinberger -Signed-off-by: Boris Brezillon ---- - drivers/mtd/mtdpart.c | 4 ++-- - drivers/mtd/ofpart.c | 11 ++++++----- - 2 files changed, 8 insertions(+), 7 deletions(-) - ---- a/drivers/mtd/mtdpart.c -+++ b/drivers/mtd/mtdpart.c -@@ -932,7 +932,7 @@ static int mtd_part_of_parse(struct mtd_ - struct device_node *np; - struct property *prop; - const char *compat; -- const char *fixed = "ofpart"; -+ const char *fixed = "fixed-partitions"; - int ret, err = 0; - - np = of_get_child_by_name(mtd_get_of_node(master), "partitions"); -@@ -952,7 +952,7 @@ static int mtd_part_of_parse(struct mtd_ - of_node_put(np); - - /* -- * For backward compatibility we have to try the "ofpart" -+ * For backward compatibility we have to try the "fixed-partitions" - * parser. It supports old DT format with partitions specified as a - * direct subnodes of a flash device DT node without any compatibility - * specified we could match. ---- a/drivers/mtd/ofpart.c -+++ b/drivers/mtd/ofpart.c -@@ -25,9 +25,9 @@ static bool node_has_compatible(struct d - return of_get_property(pp, "compatible", NULL); - } - --static int parse_ofpart_partitions(struct mtd_info *master, -- const struct mtd_partition **pparts, -- struct mtd_part_parser_data *data) -+static int parse_fixed_partitions(struct mtd_info *master, -+ const struct mtd_partition **pparts, -+ struct mtd_part_parser_data *data) - { - struct mtd_partition *parts; - struct device_node *mtd_node; -@@ -141,8 +141,8 @@ ofpart_none: - } - - static struct mtd_part_parser ofpart_parser = { -- .parse_fn = parse_ofpart_partitions, -- .name = "ofpart", -+ .parse_fn = parse_fixed_partitions, -+ .name = "fixed-partitions", - }; - - static int parse_ofoldpart_partitions(struct mtd_info *master, -@@ -230,4 +230,5 @@ MODULE_AUTHOR("Vitaly Wool, David Gibson - * with the same name. Since we provide the ofoldpart parser, we should have - * the corresponding alias. - */ -+MODULE_ALIAS("fixed-partitions"); - MODULE_ALIAS("ofoldpart"); diff --git a/target/linux/generic/backport-4.9/067-v4.17-0003-mtd-ofpart-add-of_match_table-with-fixed-partitions.patch b/target/linux/generic/backport-4.9/067-v4.17-0003-mtd-ofpart-add-of_match_table-with-fixed-partitions.patch deleted file mode 100644 index d6958c3eac..0000000000 --- a/target/linux/generic/backport-4.9/067-v4.17-0003-mtd-ofpart-add-of_match_table-with-fixed-partitions.patch +++ /dev/null @@ -1,44 +0,0 @@ -From 97b0c7c0df3efd7048ed39d7e2dee34cafd55887 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= -Date: Wed, 14 Mar 2018 13:10:44 +0100 -Subject: [PATCH] mtd: ofpart: add of_match_table with "fixed-partitions" -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -This allows using this parser with any flash driver that takes care of -setting of_node (using mtd_set_of_node helper) correctly. Up to now -support for "fixed-partitions" DT compatibility string was working only -with flash drivers that were specifying "ofpart" (manually or by letting -mtd use the default set of parsers). - -This matches existing bindings documentation. - -Signed-off-by: Rafał Miłecki -Reviewed-by: Brian Norris -Tested-by: Brian Norris -Reviewed-by: Richard Weinberger -Signed-off-by: Boris Brezillon ---- - drivers/mtd/ofpart.c | 7 +++++++ - 1 file changed, 7 insertions(+) - ---- a/drivers/mtd/ofpart.c -+++ b/drivers/mtd/ofpart.c -@@ -140,9 +140,16 @@ ofpart_none: - return ret; - } - -+static const struct of_device_id parse_ofpart_match_table[] = { -+ { .compatible = "fixed-partitions" }, -+ {}, -+}; -+MODULE_DEVICE_TABLE(of, parse_ofpart_match_table); -+ - static struct mtd_part_parser ofpart_parser = { - .parse_fn = parse_fixed_partitions, - .name = "fixed-partitions", -+ .of_match_table = parse_ofpart_match_table, - }; - - static int parse_ofoldpart_partitions(struct mtd_info *master, diff --git a/target/linux/generic/backport-4.9/068-v4.18-0001-mtd-move-code-adding-registering-partitions-to-the-p.patch b/target/linux/generic/backport-4.9/068-v4.18-0001-mtd-move-code-adding-registering-partitions-to-the-p.patch deleted file mode 100644 index 29aa3b9e8d..0000000000 --- a/target/linux/generic/backport-4.9/068-v4.18-0001-mtd-move-code-adding-registering-partitions-to-the-p.patch +++ /dev/null @@ -1,168 +0,0 @@ -From 5ac67ce36cfe38b4c104a42ce52c5c8d526f1c95 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= -Date: Tue, 27 Mar 2018 22:35:41 +0200 -Subject: [PATCH] mtd: move code adding (registering) partitions to the - parse_mtd_partitions() -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -This commit slightly simplifies the code. Every parse_mtd_partitions() -caller (out of two existing ones) had to add partitions & cleanup parser -on its own. This moves that responsibility into the function. - -That change also allows dropping struct mtd_partitions argument. - -There is one minor behavior change caused by this cleanup. If -parse_mtd_partitions() fails to add partitions (add_mtd_partitions() -return an error) then mtd_device_parse_register() will still try to -add (register) fallback partitions. It's a real corner case affecting -one of uncommon error paths and shouldn't cause any harm. - -Signed-off-by: Rafał Miłecki -Signed-off-by: Boris Brezillon ---- - drivers/mtd/mtdcore.c | 14 ++++---------- - drivers/mtd/mtdcore.h | 1 - - drivers/mtd/mtdpart.c | 44 ++++++++++++++++---------------------------- - 3 files changed, 20 insertions(+), 39 deletions(-) - ---- a/drivers/mtd/mtdcore.c -+++ b/drivers/mtd/mtdcore.c -@@ -676,7 +676,6 @@ int mtd_device_parse_register(struct mtd - const struct mtd_partition *parts, - int nr_parts) - { -- struct mtd_partitions parsed = { }; - int ret; - - mtd_set_dev_defaults(mtd); -@@ -688,13 +687,10 @@ int mtd_device_parse_register(struct mtd - } - - /* Prefer parsed partitions over driver-provided fallback */ -- ret = parse_mtd_partitions(mtd, types, &parsed, parser_data); -- if (!ret && parsed.nr_parts) { -- parts = parsed.parts; -- nr_parts = parsed.nr_parts; -- } -- -- if (nr_parts) -+ ret = parse_mtd_partitions(mtd, types, parser_data); -+ if (ret > 0) -+ ret = 0; -+ else if (nr_parts) - ret = add_mtd_partitions(mtd, parts, nr_parts); - else if (!device_is_registered(&mtd->dev)) - ret = add_mtd_device(mtd); -@@ -720,8 +716,6 @@ int mtd_device_parse_register(struct mtd - } - - out: -- /* Cleanup any parsed partitions */ -- mtd_part_parser_cleanup(&parsed); - if (ret && device_is_registered(&mtd->dev)) - del_mtd_device(mtd); - ---- a/drivers/mtd/mtdcore.h -+++ b/drivers/mtd/mtdcore.h -@@ -14,7 +14,6 @@ int del_mtd_partitions(struct mtd_info * - struct mtd_partitions; - - int parse_mtd_partitions(struct mtd_info *master, const char * const *types, -- struct mtd_partitions *pparts, - struct mtd_part_parser_data *data); - - void mtd_part_parser_cleanup(struct mtd_partitions *parts); ---- a/drivers/mtd/mtdpart.c -+++ b/drivers/mtd/mtdpart.c -@@ -383,20 +383,7 @@ static inline void free_partition(struct - */ - static int mtd_parse_part(struct mtd_part *slave, const char *const *types) - { -- struct mtd_partitions parsed; -- int err; -- -- err = parse_mtd_partitions(&slave->mtd, types, &parsed, NULL); -- if (err) -- return err; -- else if (!parsed.nr_parts) -- return -ENOENT; -- -- err = add_mtd_partitions(&slave->mtd, parsed.parts, parsed.nr_parts); -- -- mtd_part_parser_cleanup(&parsed); -- -- return err; -+ return parse_mtd_partitions(&slave->mtd, types, NULL); - } - - static struct mtd_part *allocate_partition(struct mtd_info *parent, -@@ -973,30 +960,27 @@ static int mtd_part_of_parse(struct mtd_ - } - - /** -- * parse_mtd_partitions - parse MTD partitions -+ * parse_mtd_partitions - parse and register MTD partitions -+ * - * @master: the master partition (describes whole MTD device) - * @types: names of partition parsers to try or %NULL -- * @pparts: info about partitions found is returned here - * @data: MTD partition parser-specific data - * -- * This function tries to find partition on MTD device @master. It uses MTD -- * partition parsers, specified in @types. However, if @types is %NULL, then -- * the default list of parsers is used. The default list contains only the -+ * This function tries to find & register partitions on MTD device @master. It -+ * uses MTD partition parsers, specified in @types. However, if @types is %NULL, -+ * then the default list of parsers is used. The default list contains only the - * "cmdlinepart" and "ofpart" parsers ATM. - * Note: If there are more then one parser in @types, the kernel only takes the - * partitions parsed out by the first parser. - * - * This function may return: - * o a negative error code in case of failure -- * o zero otherwise, and @pparts will describe the partitions, number of -- * partitions, and the parser which parsed them. Caller must release -- * resources with mtd_part_parser_cleanup() when finished with the returned -- * data. -+ * o number of found partitions otherwise - */ - int parse_mtd_partitions(struct mtd_info *master, const char *const *types, -- struct mtd_partitions *pparts, - struct mtd_part_parser_data *data) - { -+ struct mtd_partitions pparts = { }; - struct mtd_part_parser *parser; - int ret, err = 0; - -@@ -1010,7 +994,7 @@ int parse_mtd_partitions(struct mtd_info - * handled in a separated function. - */ - if (!strcmp(*types, "ofpart")) { -- ret = mtd_part_of_parse(master, pparts); -+ ret = mtd_part_of_parse(master, &pparts); - } else { - pr_debug("%s: parsing partitions %s\n", master->name, - *types); -@@ -1021,13 +1005,17 @@ int parse_mtd_partitions(struct mtd_info - parser ? parser->name : NULL); - if (!parser) - continue; -- ret = mtd_part_do_parse(parser, master, pparts, data); -+ ret = mtd_part_do_parse(parser, master, &pparts, data); - if (ret <= 0) - mtd_part_parser_put(parser); - } - /* Found partitions! */ -- if (ret > 0) -- return 0; -+ if (ret > 0) { -+ err = add_mtd_partitions(master, pparts.parts, -+ pparts.nr_parts); -+ mtd_part_parser_cleanup(&pparts); -+ return err ? err : pparts.nr_parts; -+ } - /* - * Stash the first error we see; only report it if no parser - * succeeds diff --git a/target/linux/generic/backport-4.9/069-v4.18-mtd-bcm47xxpart-improve-handling-TRX-partition-size.patch b/target/linux/generic/backport-4.9/069-v4.18-mtd-bcm47xxpart-improve-handling-TRX-partition-size.patch deleted file mode 100644 index e08f8dad32..0000000000 --- a/target/linux/generic/backport-4.9/069-v4.18-mtd-bcm47xxpart-improve-handling-TRX-partition-size.patch +++ /dev/null @@ -1,70 +0,0 @@ -From 237ea0d4762cc14d0fc80e80d61f0f08e1050c7f Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= -Date: Thu, 12 Apr 2018 07:24:52 +0200 -Subject: [PATCH] mtd: bcm47xxpart: improve handling TRX partition size -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -When bcm47xxpart finds a TRX partition (container) it's supposed to jump -to the end of it and keep looking for more partitions. TRX and its -subpartitions are handled by a separate parser. - -The problem with old code was relying on the length specified in a TRX -header. That isn't reliable as TRX is commonly modified to have checksum -cover only non-changing subpartitions. Otherwise modifying e.g. a rootfs -would result in CRC32 mismatch and bootloader refusing to boot a -firmware. - -Fix it by trying better to figure out a real TRX size. We can securely -assume that TRX has to cover all subpartitions and the last one is at -least of a block size in size. Then compare it with a length field. - -This makes code more optimal & reliable thanks to skipping data that -shouldn't be parsed. - -Signed-off-by: Rafał Miłecki -Signed-off-by: Boris Brezillon ---- - drivers/mtd/bcm47xxpart.c | 22 ++++++++++++++++++---- - 1 file changed, 18 insertions(+), 4 deletions(-) - ---- a/drivers/mtd/bcm47xxpart.c -+++ b/drivers/mtd/bcm47xxpart.c -@@ -186,6 +186,8 @@ static int bcm47xxpart_parse(struct mtd_ - /* TRX */ - if (buf[0x000 / 4] == TRX_MAGIC) { - struct trx_header *trx; -+ uint32_t last_subpart; -+ uint32_t trx_size; - - if (trx_num >= ARRAY_SIZE(trx_parts)) - pr_warn("No enough space to store another TRX found at 0x%X\n", -@@ -195,11 +197,23 @@ static int bcm47xxpart_parse(struct mtd_ - bcm47xxpart_add_part(&parts[curr_part++], "firmware", - offset, 0); - -- /* Jump to the end of TRX */ -+ /* -+ * Try to find TRX size. The "length" field isn't fully -+ * reliable as it could be decreased to make CRC32 cover -+ * only part of TRX data. It's commonly used as checksum -+ * can't cover e.g. ever-changing rootfs partition. -+ * Use offsets as helpers for assuming min TRX size. -+ */ - trx = (struct trx_header *)buf; -- offset = roundup(offset + trx->length, blocksize); -- /* Next loop iteration will increase the offset */ -- offset -= blocksize; -+ last_subpart = max3(trx->offset[0], trx->offset[1], -+ trx->offset[2]); -+ trx_size = max(trx->length, last_subpart + blocksize); -+ -+ /* -+ * Skip the TRX data. Decrease offset by block size as -+ * the next loop iteration will increase it. -+ */ -+ offset += roundup(trx_size, blocksize) - blocksize; - continue; - } - diff --git a/target/linux/generic/backport-4.9/070-bcma-from-4.11.patch b/target/linux/generic/backport-4.9/070-bcma-from-4.11.patch deleted file mode 100644 index a3b0321986..0000000000 --- a/target/linux/generic/backport-4.9/070-bcma-from-4.11.patch +++ /dev/null @@ -1,85 +0,0 @@ ---- a/drivers/bcma/main.c -+++ b/drivers/bcma/main.c -@@ -136,17 +136,17 @@ static bool bcma_is_core_needed_early(u1 - return false; - } - --static struct device_node *bcma_of_find_child_device(struct platform_device *parent, -+static struct device_node *bcma_of_find_child_device(struct device *parent, - struct bcma_device *core) - { - struct device_node *node; - u64 size; - const __be32 *reg; - -- if (!parent || !parent->dev.of_node) -+ if (!parent->of_node) - return NULL; - -- for_each_child_of_node(parent->dev.of_node, node) { -+ for_each_child_of_node(parent->of_node, node) { - reg = of_get_address(node, 0, &size, NULL); - if (!reg) - continue; -@@ -156,7 +156,7 @@ static struct device_node *bcma_of_find_ - return NULL; - } - --static int bcma_of_irq_parse(struct platform_device *parent, -+static int bcma_of_irq_parse(struct device *parent, - struct bcma_device *core, - struct of_phandle_args *out_irq, int num) - { -@@ -169,7 +169,7 @@ static int bcma_of_irq_parse(struct plat - return rc; - } - -- out_irq->np = parent->dev.of_node; -+ out_irq->np = parent->of_node; - out_irq->args_count = 1; - out_irq->args[0] = num; - -@@ -177,13 +177,13 @@ static int bcma_of_irq_parse(struct plat - return of_irq_parse_raw(laddr, out_irq); - } - --static unsigned int bcma_of_get_irq(struct platform_device *parent, -+static unsigned int bcma_of_get_irq(struct device *parent, - struct bcma_device *core, int num) - { - struct of_phandle_args out_irq; - int ret; - -- if (!IS_ENABLED(CONFIG_OF_IRQ) || !parent || !parent->dev.of_node) -+ if (!IS_ENABLED(CONFIG_OF_IRQ) || !parent->of_node) - return 0; - - ret = bcma_of_irq_parse(parent, core, &out_irq, num); -@@ -196,7 +196,7 @@ static unsigned int bcma_of_get_irq(stru - return irq_create_of_mapping(&out_irq); - } - --static void bcma_of_fill_device(struct platform_device *parent, -+static void bcma_of_fill_device(struct device *parent, - struct bcma_device *core) - { - struct device_node *node; -@@ -227,7 +227,7 @@ unsigned int bcma_core_irq(struct bcma_d - return mips_irq <= 4 ? mips_irq + 2 : 0; - } - if (bus->host_pdev) -- return bcma_of_get_irq(bus->host_pdev, core, num); -+ return bcma_of_get_irq(&bus->host_pdev->dev, core, num); - return 0; - case BCMA_HOSTTYPE_SDIO: - return 0; -@@ -253,7 +253,8 @@ void bcma_prepare_core(struct bcma_bus * - if (IS_ENABLED(CONFIG_OF) && bus->host_pdev) { - core->dma_dev = &bus->host_pdev->dev; - core->dev.parent = &bus->host_pdev->dev; -- bcma_of_fill_device(bus->host_pdev, core); -+ if (core->dev.parent) -+ bcma_of_fill_device(core->dev.parent, core); - } else { - core->dev.dma_mask = &core->dev.coherent_dma_mask; - core->dma_dev = &core->dev; diff --git a/target/linux/generic/backport-4.9/071-v4.10-0001-net-bgmac-allocate-struct-bgmac-just-once-don-t-copy.patch b/target/linux/generic/backport-4.9/071-v4.10-0001-net-bgmac-allocate-struct-bgmac-just-once-don-t-copy.patch deleted file mode 100644 index 4b667bc2f3..0000000000 --- a/target/linux/generic/backport-4.9/071-v4.10-0001-net-bgmac-allocate-struct-bgmac-just-once-don-t-copy.patch +++ /dev/null @@ -1,139 +0,0 @@ -From 34a5102c3235c470a6c77fba16cb971964d9c136 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= -Date: Tue, 31 Jan 2017 19:37:54 +0100 -Subject: [PATCH 1/3] net: bgmac: allocate struct bgmac just once & don't copy - it -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -So far were were allocating struct bgmac in 3 places: platform code, -bcma code and shared bgmac_enet_probe function. The reason for this was -bgmac_enet_probe: -1) Requiring early-filled struct bgmac -2) Calling alloc_etherdev on its own in order to use netdev_priv later - -This solution got few drawbacks: -1) Was duplicating allocating code -2) Required copying early-filled struct -3) Resulted in platform/bcma code having access only to unused struct - -Solve this situation by simply extracting some probe code into the new -bgmac_alloc function. - -Signed-off-by: Rafał Miłecki -Reviewed-by: Florian Fainelli -Signed-off-by: David S. Miller ---- - drivers/net/ethernet/broadcom/bgmac-bcma.c | 4 +--- - drivers/net/ethernet/broadcom/bgmac-platform.c | 2 +- - drivers/net/ethernet/broadcom/bgmac.c | 25 +++++++++++++++++-------- - drivers/net/ethernet/broadcom/bgmac.h | 3 ++- - 4 files changed, 21 insertions(+), 13 deletions(-) - ---- a/drivers/net/ethernet/broadcom/bgmac-bcma.c -+++ b/drivers/net/ethernet/broadcom/bgmac-bcma.c -@@ -100,12 +100,11 @@ static int bgmac_probe(struct bcma_devic - const u8 *mac = NULL; - int err; - -- bgmac = kzalloc(sizeof(*bgmac), GFP_KERNEL); -+ bgmac = bgmac_alloc(&core->dev); - if (!bgmac) - return -ENOMEM; - - bgmac->bcma.core = core; -- bgmac->dev = &core->dev; - bgmac->dma_dev = core->dma_dev; - bgmac->irq = core->irq; - -@@ -292,7 +291,6 @@ static int bgmac_probe(struct bcma_devic - err1: - bcma_mdio_mii_unregister(bgmac->mii_bus); - err: -- kfree(bgmac); - bcma_set_drvdata(core, NULL); - - return err; ---- a/drivers/net/ethernet/broadcom/bgmac-platform.c -+++ b/drivers/net/ethernet/broadcom/bgmac-platform.c -@@ -93,7 +93,7 @@ static int bgmac_probe(struct platform_d - struct resource *regs; - const u8 *mac_addr; - -- bgmac = devm_kzalloc(&pdev->dev, sizeof(*bgmac), GFP_KERNEL); -+ bgmac = bgmac_alloc(&pdev->dev); - if (!bgmac) - return -ENOMEM; - ---- a/drivers/net/ethernet/broadcom/bgmac.c -+++ b/drivers/net/ethernet/broadcom/bgmac.c -@@ -1460,22 +1460,32 @@ static int bgmac_phy_connect(struct bgma - return 0; - } - --int bgmac_enet_probe(struct bgmac *info) -+struct bgmac *bgmac_alloc(struct device *dev) - { - struct net_device *net_dev; - struct bgmac *bgmac; -- int err; - - /* Allocation and references */ -- net_dev = alloc_etherdev(sizeof(*bgmac)); -+ net_dev = devm_alloc_etherdev(dev, sizeof(*bgmac)); - if (!net_dev) -- return -ENOMEM; -+ return NULL; - - net_dev->netdev_ops = &bgmac_netdev_ops; - net_dev->ethtool_ops = &bgmac_ethtool_ops; -+ - bgmac = netdev_priv(net_dev); -- memcpy(bgmac, info, sizeof(*bgmac)); -+ bgmac->dev = dev; - bgmac->net_dev = net_dev; -+ -+ return bgmac; -+} -+EXPORT_SYMBOL_GPL(bgmac_alloc); -+ -+int bgmac_enet_probe(struct bgmac *bgmac) -+{ -+ struct net_device *net_dev = bgmac->net_dev; -+ int err; -+ - net_dev->irq = bgmac->irq; - SET_NETDEV_DEV(net_dev, bgmac->dev); - -@@ -1502,7 +1512,7 @@ int bgmac_enet_probe(struct bgmac *info) - err = bgmac_dma_alloc(bgmac); - if (err) { - dev_err(bgmac->dev, "Unable to alloc memory for DMA\n"); -- goto err_netdev_free; -+ goto err_out; - } - - bgmac->int_mask = BGMAC_IS_ERRMASK | BGMAC_IS_RX | BGMAC_IS_TX_MASK; -@@ -1538,8 +1548,7 @@ err_phy_disconnect: - phy_disconnect(net_dev->phydev); - err_dma_free: - bgmac_dma_free(bgmac); --err_netdev_free: -- free_netdev(net_dev); -+err_out: - - return err; - } ---- a/drivers/net/ethernet/broadcom/bgmac.h -+++ b/drivers/net/ethernet/broadcom/bgmac.h -@@ -515,7 +515,8 @@ struct bgmac { - u32 set); - }; - --int bgmac_enet_probe(struct bgmac *info); -+struct bgmac *bgmac_alloc(struct device *dev); -+int bgmac_enet_probe(struct bgmac *bgmac); - void bgmac_enet_remove(struct bgmac *bgmac); - - struct mii_bus *bcma_mdio_mii_register(struct bcma_device *core, u8 phyaddr); diff --git a/target/linux/generic/backport-4.9/071-v4.10-0002-net-bgmac-drop-struct-bcma_mdio-we-don-t-need-anymor.patch b/target/linux/generic/backport-4.9/071-v4.10-0002-net-bgmac-drop-struct-bcma_mdio-we-don-t-need-anymor.patch deleted file mode 100644 index 5e3d33375a..0000000000 --- a/target/linux/generic/backport-4.9/071-v4.10-0002-net-bgmac-drop-struct-bcma_mdio-we-don-t-need-anymor.patch +++ /dev/null @@ -1,261 +0,0 @@ -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= -Date: Tue, 31 Jan 2017 19:37:55 +0100 -Subject: [PATCH] net: bgmac: drop struct bcma_mdio we don't need anymore -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Adding struct bcma_mdio was a workaround for bcma code not having access -to the struct bgmac used in the core code. Now we don't duplicate this -struct we can just use it internally in bcma code. - -This simplifies code & allows access to all bgmac driver details from -all places in bcma code. - -Signed-off-by: Rafał Miłecki -Reviewed-by: Florian Fainelli -Signed-off-by: David S. Miller ---- - ---- a/drivers/net/ethernet/broadcom/bgmac-bcma.c -+++ b/drivers/net/ethernet/broadcom/bgmac-bcma.c -@@ -166,7 +166,7 @@ static int bgmac_probe(struct bcma_devic - - if (!bgmac_is_bcm4707_family(core) && - !(ci->id == BCMA_CHIP_ID_BCM53573 && core->core_unit == 1)) { -- mii_bus = bcma_mdio_mii_register(core, bgmac->phyaddr); -+ mii_bus = bcma_mdio_mii_register(bgmac); - if (IS_ERR(mii_bus)) { - err = PTR_ERR(mii_bus); - goto err; ---- a/drivers/net/ethernet/broadcom/bgmac-bcma-mdio.c -+++ b/drivers/net/ethernet/broadcom/bgmac-bcma-mdio.c -@@ -12,11 +12,6 @@ - #include - #include "bgmac.h" - --struct bcma_mdio { -- struct bcma_device *core; -- u8 phyaddr; --}; -- - static bool bcma_mdio_wait_value(struct bcma_device *core, u16 reg, u32 mask, - u32 value, int timeout) - { -@@ -37,7 +32,7 @@ static bool bcma_mdio_wait_value(struct - * PHY ops - **************************************************/ - --static u16 bcma_mdio_phy_read(struct bcma_mdio *bcma_mdio, u8 phyaddr, u8 reg) -+static u16 bcma_mdio_phy_read(struct bgmac *bgmac, u8 phyaddr, u8 reg) - { - struct bcma_device *core; - u16 phy_access_addr; -@@ -56,12 +51,12 @@ static u16 bcma_mdio_phy_read(struct bcm - BUILD_BUG_ON(BGMAC_PC_MCT_SHIFT != BCMA_GMAC_CMN_PC_MCT_SHIFT); - BUILD_BUG_ON(BGMAC_PC_MTE != BCMA_GMAC_CMN_PC_MTE); - -- if (bcma_mdio->core->id.id == BCMA_CORE_4706_MAC_GBIT) { -- core = bcma_mdio->core->bus->drv_gmac_cmn.core; -+ if (bgmac->bcma.core->id.id == BCMA_CORE_4706_MAC_GBIT) { -+ core = bgmac->bcma.core->bus->drv_gmac_cmn.core; - phy_access_addr = BCMA_GMAC_CMN_PHY_ACCESS; - phy_ctl_addr = BCMA_GMAC_CMN_PHY_CTL; - } else { -- core = bcma_mdio->core; -+ core = bgmac->bcma.core; - phy_access_addr = BGMAC_PHY_ACCESS; - phy_ctl_addr = BGMAC_PHY_CNTL; - } -@@ -87,7 +82,7 @@ static u16 bcma_mdio_phy_read(struct bcm - } - - /* http://bcm-v4.sipsolutions.net/mac-gbit/gmac/chipphywr */ --static int bcma_mdio_phy_write(struct bcma_mdio *bcma_mdio, u8 phyaddr, u8 reg, -+static int bcma_mdio_phy_write(struct bgmac *bgmac, u8 phyaddr, u8 reg, - u16 value) - { - struct bcma_device *core; -@@ -95,12 +90,12 @@ static int bcma_mdio_phy_write(struct bc - u16 phy_ctl_addr; - u32 tmp; - -- if (bcma_mdio->core->id.id == BCMA_CORE_4706_MAC_GBIT) { -- core = bcma_mdio->core->bus->drv_gmac_cmn.core; -+ if (bgmac->bcma.core->id.id == BCMA_CORE_4706_MAC_GBIT) { -+ core = bgmac->bcma.core->bus->drv_gmac_cmn.core; - phy_access_addr = BCMA_GMAC_CMN_PHY_ACCESS; - phy_ctl_addr = BCMA_GMAC_CMN_PHY_CTL; - } else { -- core = bcma_mdio->core; -+ core = bgmac->bcma.core; - phy_access_addr = BGMAC_PHY_ACCESS; - phy_ctl_addr = BGMAC_PHY_CNTL; - } -@@ -110,8 +105,8 @@ static int bcma_mdio_phy_write(struct bc - tmp |= phyaddr; - bcma_write32(core, phy_ctl_addr, tmp); - -- bcma_write32(bcma_mdio->core, BGMAC_INT_STATUS, BGMAC_IS_MDIO); -- if (bcma_read32(bcma_mdio->core, BGMAC_INT_STATUS) & BGMAC_IS_MDIO) -+ bcma_write32(bgmac->bcma.core, BGMAC_INT_STATUS, BGMAC_IS_MDIO); -+ if (bcma_read32(bgmac->bcma.core, BGMAC_INT_STATUS) & BGMAC_IS_MDIO) - dev_warn(&core->dev, "Error setting MDIO int\n"); - - tmp = BGMAC_PA_START; -@@ -132,39 +127,39 @@ static int bcma_mdio_phy_write(struct bc - } - - /* http://bcm-v4.sipsolutions.net/mac-gbit/gmac/chipphyinit */ --static void bcma_mdio_phy_init(struct bcma_mdio *bcma_mdio) -+static void bcma_mdio_phy_init(struct bgmac *bgmac) - { -- struct bcma_chipinfo *ci = &bcma_mdio->core->bus->chipinfo; -+ struct bcma_chipinfo *ci = &bgmac->bcma.core->bus->chipinfo; - u8 i; - - if (ci->id == BCMA_CHIP_ID_BCM5356) { - for (i = 0; i < 5; i++) { -- bcma_mdio_phy_write(bcma_mdio, i, 0x1f, 0x008b); -- bcma_mdio_phy_write(bcma_mdio, i, 0x15, 0x0100); -- bcma_mdio_phy_write(bcma_mdio, i, 0x1f, 0x000f); -- bcma_mdio_phy_write(bcma_mdio, i, 0x12, 0x2aaa); -- bcma_mdio_phy_write(bcma_mdio, i, 0x1f, 0x000b); -+ bcma_mdio_phy_write(bgmac, i, 0x1f, 0x008b); -+ bcma_mdio_phy_write(bgmac, i, 0x15, 0x0100); -+ bcma_mdio_phy_write(bgmac, i, 0x1f, 0x000f); -+ bcma_mdio_phy_write(bgmac, i, 0x12, 0x2aaa); -+ bcma_mdio_phy_write(bgmac, i, 0x1f, 0x000b); - } - } - if ((ci->id == BCMA_CHIP_ID_BCM5357 && ci->pkg != 10) || - (ci->id == BCMA_CHIP_ID_BCM4749 && ci->pkg != 10) || - (ci->id == BCMA_CHIP_ID_BCM53572 && ci->pkg != 9)) { -- struct bcma_drv_cc *cc = &bcma_mdio->core->bus->drv_cc; -+ struct bcma_drv_cc *cc = &bgmac->bcma.core->bus->drv_cc; - - bcma_chipco_chipctl_maskset(cc, 2, ~0xc0000000, 0); - bcma_chipco_chipctl_maskset(cc, 4, ~0x80000000, 0); - for (i = 0; i < 5; i++) { -- bcma_mdio_phy_write(bcma_mdio, i, 0x1f, 0x000f); -- bcma_mdio_phy_write(bcma_mdio, i, 0x16, 0x5284); -- bcma_mdio_phy_write(bcma_mdio, i, 0x1f, 0x000b); -- bcma_mdio_phy_write(bcma_mdio, i, 0x17, 0x0010); -- bcma_mdio_phy_write(bcma_mdio, i, 0x1f, 0x000f); -- bcma_mdio_phy_write(bcma_mdio, i, 0x16, 0x5296); -- bcma_mdio_phy_write(bcma_mdio, i, 0x17, 0x1073); -- bcma_mdio_phy_write(bcma_mdio, i, 0x17, 0x9073); -- bcma_mdio_phy_write(bcma_mdio, i, 0x16, 0x52b6); -- bcma_mdio_phy_write(bcma_mdio, i, 0x17, 0x9273); -- bcma_mdio_phy_write(bcma_mdio, i, 0x1f, 0x000b); -+ bcma_mdio_phy_write(bgmac, i, 0x1f, 0x000f); -+ bcma_mdio_phy_write(bgmac, i, 0x16, 0x5284); -+ bcma_mdio_phy_write(bgmac, i, 0x1f, 0x000b); -+ bcma_mdio_phy_write(bgmac, i, 0x17, 0x0010); -+ bcma_mdio_phy_write(bgmac, i, 0x1f, 0x000f); -+ bcma_mdio_phy_write(bgmac, i, 0x16, 0x5296); -+ bcma_mdio_phy_write(bgmac, i, 0x17, 0x1073); -+ bcma_mdio_phy_write(bgmac, i, 0x17, 0x9073); -+ bcma_mdio_phy_write(bgmac, i, 0x16, 0x52b6); -+ bcma_mdio_phy_write(bgmac, i, 0x17, 0x9273); -+ bcma_mdio_phy_write(bgmac, i, 0x1f, 0x000b); - } - } - } -@@ -172,17 +167,17 @@ static void bcma_mdio_phy_init(struct bc - /* http://bcm-v4.sipsolutions.net/mac-gbit/gmac/chipphyreset */ - static int bcma_mdio_phy_reset(struct mii_bus *bus) - { -- struct bcma_mdio *bcma_mdio = bus->priv; -- u8 phyaddr = bcma_mdio->phyaddr; -+ struct bgmac *bgmac = bus->priv; -+ u8 phyaddr = bgmac->phyaddr; - -- if (bcma_mdio->phyaddr == BGMAC_PHY_NOREGS) -+ if (phyaddr == BGMAC_PHY_NOREGS) - return 0; - -- bcma_mdio_phy_write(bcma_mdio, phyaddr, MII_BMCR, BMCR_RESET); -+ bcma_mdio_phy_write(bgmac, phyaddr, MII_BMCR, BMCR_RESET); - udelay(100); -- if (bcma_mdio_phy_read(bcma_mdio, phyaddr, MII_BMCR) & BMCR_RESET) -- dev_err(&bcma_mdio->core->dev, "PHY reset failed\n"); -- bcma_mdio_phy_init(bcma_mdio); -+ if (bcma_mdio_phy_read(bgmac, phyaddr, MII_BMCR) & BMCR_RESET) -+ dev_err(bgmac->dev, "PHY reset failed\n"); -+ bcma_mdio_phy_init(bgmac); - - return 0; - } -@@ -202,16 +197,12 @@ static int bcma_mdio_mii_write(struct mi - return bcma_mdio_phy_write(bus->priv, mii_id, regnum, value); - } - --struct mii_bus *bcma_mdio_mii_register(struct bcma_device *core, u8 phyaddr) -+struct mii_bus *bcma_mdio_mii_register(struct bgmac *bgmac) - { -- struct bcma_mdio *bcma_mdio; -+ struct bcma_device *core = bgmac->bcma.core; - struct mii_bus *mii_bus; - int err; - -- bcma_mdio = kzalloc(sizeof(*bcma_mdio), GFP_KERNEL); -- if (!bcma_mdio) -- return ERR_PTR(-ENOMEM); -- - mii_bus = mdiobus_alloc(); - if (!mii_bus) { - err = -ENOMEM; -@@ -221,15 +212,12 @@ struct mii_bus *bcma_mdio_mii_register(s - mii_bus->name = "bcma_mdio mii bus"; - sprintf(mii_bus->id, "%s-%d-%d", "bcma_mdio", core->bus->num, - core->core_unit); -- mii_bus->priv = bcma_mdio; -+ mii_bus->priv = bgmac; - mii_bus->read = bcma_mdio_mii_read; - mii_bus->write = bcma_mdio_mii_write; - mii_bus->reset = bcma_mdio_phy_reset; - mii_bus->parent = &core->dev; -- mii_bus->phy_mask = ~(1 << phyaddr); -- -- bcma_mdio->core = core; -- bcma_mdio->phyaddr = phyaddr; -+ mii_bus->phy_mask = ~(1 << bgmac->phyaddr); - - err = mdiobus_register(mii_bus); - if (err) { -@@ -242,23 +230,17 @@ struct mii_bus *bcma_mdio_mii_register(s - err_free_bus: - mdiobus_free(mii_bus); - err: -- kfree(bcma_mdio); - return ERR_PTR(err); - } - EXPORT_SYMBOL_GPL(bcma_mdio_mii_register); - - void bcma_mdio_mii_unregister(struct mii_bus *mii_bus) - { -- struct bcma_mdio *bcma_mdio; -- - if (!mii_bus) - return; - -- bcma_mdio = mii_bus->priv; -- - mdiobus_unregister(mii_bus); - mdiobus_free(mii_bus); -- kfree(bcma_mdio); - } - EXPORT_SYMBOL_GPL(bcma_mdio_mii_unregister); - ---- a/drivers/net/ethernet/broadcom/bgmac.h -+++ b/drivers/net/ethernet/broadcom/bgmac.h -@@ -519,7 +519,7 @@ struct bgmac *bgmac_alloc(struct device - int bgmac_enet_probe(struct bgmac *bgmac); - void bgmac_enet_remove(struct bgmac *bgmac); - --struct mii_bus *bcma_mdio_mii_register(struct bcma_device *core, u8 phyaddr); -+struct mii_bus *bcma_mdio_mii_register(struct bgmac *bgmac); - void bcma_mdio_mii_unregister(struct mii_bus *mii_bus); - - static inline u32 bgmac_read(struct bgmac *bgmac, u16 offset) diff --git a/target/linux/generic/backport-4.9/071-v4.10-0003-net-bgmac-use-PHY-subsystem-for-initializing-PHY.patch b/target/linux/generic/backport-4.9/071-v4.10-0003-net-bgmac-use-PHY-subsystem-for-initializing-PHY.patch deleted file mode 100644 index d1be3e3f4c..0000000000 --- a/target/linux/generic/backport-4.9/071-v4.10-0003-net-bgmac-use-PHY-subsystem-for-initializing-PHY.patch +++ /dev/null @@ -1,53 +0,0 @@ -From 8e6f31baba7e2c13ab7e954fe6179420a7545a8b Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= -Date: Tue, 31 Jan 2017 19:37:56 +0100 -Subject: [PATCH 3/3] net: bgmac: use PHY subsystem for initializing PHY -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -This adds support for using bgmac with PHYs supported by standalone PHY -drivers. Having any PHY initialization in bgmac is hacky and shouldn't -be extended but rather removed if anyone has hardware to test it. - -Signed-off-by: Rafał Miłecki -Reviewed-by: Florian Fainelli -Signed-off-by: David S. Miller ---- - drivers/net/ethernet/broadcom/bgmac-bcma-mdio.c | 10 ++++++++++ - 1 file changed, 10 insertions(+) - ---- a/drivers/net/ethernet/broadcom/bgmac-bcma-mdio.c -+++ b/drivers/net/ethernet/broadcom/bgmac-bcma-mdio.c -@@ -132,6 +132,10 @@ static void bcma_mdio_phy_init(struct bg - struct bcma_chipinfo *ci = &bgmac->bcma.core->bus->chipinfo; - u8 i; - -+ /* For some legacy hardware we do chipset-based PHY initialization here -+ * without even detecting PHY ID. It's hacky and should be cleaned as -+ * soon as someone can test it. -+ */ - if (ci->id == BCMA_CHIP_ID_BCM5356) { - for (i = 0; i < 5; i++) { - bcma_mdio_phy_write(bgmac, i, 0x1f, 0x008b); -@@ -140,6 +144,7 @@ static void bcma_mdio_phy_init(struct bg - bcma_mdio_phy_write(bgmac, i, 0x12, 0x2aaa); - bcma_mdio_phy_write(bgmac, i, 0x1f, 0x000b); - } -+ return; - } - if ((ci->id == BCMA_CHIP_ID_BCM5357 && ci->pkg != 10) || - (ci->id == BCMA_CHIP_ID_BCM4749 && ci->pkg != 10) || -@@ -161,7 +166,12 @@ static void bcma_mdio_phy_init(struct bg - bcma_mdio_phy_write(bgmac, i, 0x17, 0x9273); - bcma_mdio_phy_write(bgmac, i, 0x1f, 0x000b); - } -+ return; - } -+ -+ /* For all other hw do initialization using PHY subsystem. */ -+ if (bgmac->net_dev && bgmac->net_dev->phydev) -+ phy_init_hw(bgmac->net_dev->phydev); - } - - /* http://bcm-v4.sipsolutions.net/mac-gbit/gmac/chipphyreset */ diff --git a/target/linux/generic/backport-4.9/071-v4.15-0001-net-bgmac-enable-master-mode-for-BCM54210E-and-B5021.patch b/target/linux/generic/backport-4.9/071-v4.15-0001-net-bgmac-enable-master-mode-for-BCM54210E-and-B5021.patch deleted file mode 100644 index 772ee61c08..0000000000 --- a/target/linux/generic/backport-4.9/071-v4.15-0001-net-bgmac-enable-master-mode-for-BCM54210E-and-B5021.patch +++ /dev/null @@ -1,50 +0,0 @@ -From 12acd136913ccdf394eeb2bc8686ff5505368119 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= -Date: Thu, 12 Oct 2017 10:21:26 +0200 -Subject: [PATCH] net: bgmac: enable master mode for BCM54210E and B50212E PHYs -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -There are 4 very similar PHYs: -0x600d84a1: BCM54210E (rev B0) -0x600d84a2: BCM54210E (rev B1) -0x600d84a5: B50212E (rev B0) -0x600d84a6: B50212E (rev B1) -that need setting master mode manually. It's because they run in slave -mode by default with Automatic Slave/Master configuration disabled which -can lead to unreliable connection with massive ping loss. - -So far it was reported for a board with BCM47189 SoC and B50212E B1 PHY -connected to the bgmac supported ethernet device. Telling PHY driver to -setup PHY properly solves this issue. - -Signed-off-by: Rafał Miłecki -Signed-off-by: David S. Miller ---- - drivers/net/ethernet/broadcom/bgmac-bcma.c | 8 +++++++- - 1 file changed, 7 insertions(+), 1 deletion(-) - ---- a/drivers/net/ethernet/broadcom/bgmac-bcma.c -+++ b/drivers/net/ethernet/broadcom/bgmac-bcma.c -@@ -166,13 +166,19 @@ static int bgmac_probe(struct bcma_devic - - if (!bgmac_is_bcm4707_family(core) && - !(ci->id == BCMA_CHIP_ID_BCM53573 && core->core_unit == 1)) { -+ struct phy_device *phydev; -+ - mii_bus = bcma_mdio_mii_register(bgmac); - if (IS_ERR(mii_bus)) { - err = PTR_ERR(mii_bus); - goto err; - } -- - bgmac->mii_bus = mii_bus; -+ -+ phydev = mdiobus_get_phy(bgmac->mii_bus, bgmac->phyaddr); -+ if (ci->id == BCMA_CHIP_ID_BCM53573 && phydev && -+ (phydev->drv->phy_id & phydev->drv->phy_id_mask) == PHY_ID_BCM54210E) -+ phydev->dev_flags |= PHY_BRCM_EN_MASTER_MODE; - } - - if (core->bus->hosttype == BCMA_HOSTTYPE_PCI) { diff --git a/target/linux/generic/backport-4.9/072-bcma-from-4.12.patch b/target/linux/generic/backport-4.9/072-bcma-from-4.12.patch deleted file mode 100644 index 23f2656ab5..0000000000 --- a/target/linux/generic/backport-4.9/072-bcma-from-4.12.patch +++ /dev/null @@ -1,47 +0,0 @@ ---- a/drivers/bcma/driver_gpio.c -+++ b/drivers/bcma/driver_gpio.c -@@ -185,8 +185,7 @@ int bcma_gpio_init(struct bcma_drv_cc *c - chip->owner = THIS_MODULE; - chip->parent = bcma_bus_get_host_dev(bus); - #if IS_BUILTIN(CONFIG_OF) -- if (cc->core->bus->hosttype == BCMA_HOSTTYPE_SOC) -- chip->of_node = cc->core->dev.of_node; -+ chip->of_node = cc->core->dev.of_node; - #endif - switch (bus->chipinfo.id) { - case BCMA_CHIP_ID_BCM4707: ---- a/drivers/bcma/main.c -+++ b/drivers/bcma/main.c -@@ -201,9 +201,6 @@ static void bcma_of_fill_device(struct d - { - struct device_node *node; - -- if (!IS_ENABLED(CONFIG_OF_IRQ)) -- return; -- - node = bcma_of_find_child_device(parent, core); - if (node) - core->dev.of_node = node; -@@ -242,19 +239,18 @@ void bcma_prepare_core(struct bcma_bus * - core->dev.release = bcma_release_core_dev; - core->dev.bus = &bcma_bus_type; - dev_set_name(&core->dev, "bcma%d:%d", bus->num, core->core_index); -+ core->dev.parent = bcma_bus_get_host_dev(bus); -+ if (core->dev.parent) -+ bcma_of_fill_device(core->dev.parent, core); - - switch (bus->hosttype) { - case BCMA_HOSTTYPE_PCI: -- core->dev.parent = &bus->host_pci->dev; - core->dma_dev = &bus->host_pci->dev; - core->irq = bus->host_pci->irq; - break; - case BCMA_HOSTTYPE_SOC: - if (IS_ENABLED(CONFIG_OF) && bus->host_pdev) { - core->dma_dev = &bus->host_pdev->dev; -- core->dev.parent = &bus->host_pdev->dev; -- if (core->dev.parent) -- bcma_of_fill_device(core->dev.parent, core); - } else { - core->dev.dma_mask = &core->dev.coherent_dma_mask; - core->dma_dev = &core->dev; diff --git a/target/linux/generic/backport-4.9/075-v4.10-0001-net-phy-broadcom-Update-Auxiliary-Control-Register-m.patch b/target/linux/generic/backport-4.9/075-v4.10-0001-net-phy-broadcom-Update-Auxiliary-Control-Register-m.patch deleted file mode 100644 index 9279a7c84c..0000000000 --- a/target/linux/generic/backport-4.9/075-v4.10-0001-net-phy-broadcom-Update-Auxiliary-Control-Register-m.patch +++ /dev/null @@ -1,34 +0,0 @@ -From: Xo Wang -Date: Fri, 21 Oct 2016 10:20:12 -0700 -Subject: [PATCH] net: phy: broadcom: Update Auxiliary Control Register macros - -Add the RXD-to-RXC skew (delay) time bit in the Miscellaneous Control -shadow register and a mask for the shadow selector field. - -Remove a re-definition of MII_BCM54XX_AUXCTL_SHDWSEL_AUXCTL. - -Signed-off-by: Xo Wang -Reviewed-by: Florian Fainelli -Reviewed-by: Joel Stanley -Signed-off-by: David S. Miller ---- - ---- a/include/linux/brcmphy.h -+++ b/include/linux/brcmphy.h -@@ -101,6 +101,7 @@ - * AUXILIARY CONTROL SHADOW ACCESS REGISTERS. (PHY REG 0x18) - */ - #define MII_BCM54XX_AUXCTL_SHDWSEL_AUXCTL 0x0000 -+#define MII_BCM54XX_AUXCTL_MISC_RXD_RXC_SKEW 0x0100 - #define MII_BCM54XX_AUXCTL_ACTL_TX_6DB 0x0400 - #define MII_BCM54XX_AUXCTL_ACTL_SMDSP_ENA 0x0800 - -@@ -109,7 +110,7 @@ - #define MII_BCM54XX_AUXCTL_MISC_RDSEL_MISC 0x7000 - #define MII_BCM54XX_AUXCTL_SHDWSEL_MISC 0x0007 - --#define MII_BCM54XX_AUXCTL_SHDWSEL_AUXCTL 0x0000 -+#define MII_BCM54XX_AUXCTL_SHDWSEL_MASK 0x0007 - - /* - * Broadcom LED source encodings. These are used in BCM5461, BCM5481, diff --git a/target/linux/generic/backport-4.9/075-v4.10-0002-net-phy-broadcom-Add-support-for-BCM54612E.patch b/target/linux/generic/backport-4.9/075-v4.10-0002-net-phy-broadcom-Add-support-for-BCM54612E.patch deleted file mode 100644 index 4caa7b193d..0000000000 --- a/target/linux/generic/backport-4.9/075-v4.10-0002-net-phy-broadcom-Add-support-for-BCM54612E.patch +++ /dev/null @@ -1,94 +0,0 @@ -From: Xo Wang -Date: Fri, 21 Oct 2016 10:20:13 -0700 -Subject: [PATCH] net: phy: broadcom: Add support for BCM54612E - -This PHY has internal delays enabled after reset. This clears the -internal delay enables unless the interface specifically requests them. - -Signed-off-by: Xo Wang -Reviewed-by: Florian Fainelli -Reviewed-by: Joel Stanley -Signed-off-by: David S. Miller ---- - ---- a/drivers/net/phy/broadcom.c -+++ b/drivers/net/phy/broadcom.c -@@ -337,6 +337,41 @@ static int bcm5481_config_aneg(struct ph - return ret; - } - -+static int bcm54612e_config_aneg(struct phy_device *phydev) -+{ -+ int ret; -+ -+ /* First, auto-negotiate. */ -+ ret = genphy_config_aneg(phydev); -+ -+ /* Clear TX internal delay unless requested. */ -+ if ((phydev->interface != PHY_INTERFACE_MODE_RGMII_ID) && -+ (phydev->interface != PHY_INTERFACE_MODE_RGMII_TXID)) { -+ /* Disable TXD to GTXCLK clock delay (default set) */ -+ /* Bit 9 is the only field in shadow register 00011 */ -+ bcm_phy_write_shadow(phydev, 0x03, 0); -+ } -+ -+ /* Clear RX internal delay unless requested. */ -+ if ((phydev->interface != PHY_INTERFACE_MODE_RGMII_ID) && -+ (phydev->interface != PHY_INTERFACE_MODE_RGMII_RXID)) { -+ u16 reg; -+ -+ /* Errata: reads require filling in the write selector field */ -+ bcm54xx_auxctl_write(phydev, MII_BCM54XX_AUXCTL_SHDWSEL_MISC, -+ MII_BCM54XX_AUXCTL_MISC_RDSEL_MISC); -+ reg = phy_read(phydev, MII_BCM54XX_AUX_CTL); -+ /* Disable RXD to RXC delay (default set) */ -+ reg &= ~MII_BCM54XX_AUXCTL_MISC_RXD_RXC_SKEW; -+ /* Clear shadow selector field */ -+ reg &= ~MII_BCM54XX_AUXCTL_SHDWSEL_MASK; -+ bcm54xx_auxctl_write(phydev, MII_BCM54XX_AUXCTL_SHDWSEL_MISC, -+ MII_BCM54XX_AUXCTL_MISC_WREN | reg); -+ } -+ -+ return ret; -+} -+ - static int brcm_phy_setbits(struct phy_device *phydev, int reg, int set) - { - int val; -@@ -485,6 +520,18 @@ static struct phy_driver broadcom_driver - .ack_interrupt = bcm_phy_ack_intr, - .config_intr = bcm_phy_config_intr, - }, { -+ .phy_id = PHY_ID_BCM54612E, -+ .phy_id_mask = 0xfffffff0, -+ .name = "Broadcom BCM54612E", -+ .features = PHY_GBIT_FEATURES | -+ SUPPORTED_Pause | SUPPORTED_Asym_Pause, -+ .flags = PHY_HAS_MAGICANEG | PHY_HAS_INTERRUPT, -+ .config_init = bcm54xx_config_init, -+ .config_aneg = bcm54612e_config_aneg, -+ .read_status = genphy_read_status, -+ .ack_interrupt = bcm_phy_ack_intr, -+ .config_intr = bcm_phy_config_intr, -+}, { - .phy_id = PHY_ID_BCM54616S, - .phy_id_mask = 0xfffffff0, - .name = "Broadcom BCM54616S", -@@ -600,6 +647,7 @@ static struct mdio_device_id __maybe_unu - { PHY_ID_BCM5411, 0xfffffff0 }, - { PHY_ID_BCM5421, 0xfffffff0 }, - { PHY_ID_BCM5461, 0xfffffff0 }, -+ { PHY_ID_BCM54612E, 0xfffffff0 }, - { PHY_ID_BCM54616S, 0xfffffff0 }, - { PHY_ID_BCM5464, 0xfffffff0 }, - { PHY_ID_BCM5481, 0xfffffff0 }, ---- a/include/linux/brcmphy.h -+++ b/include/linux/brcmphy.h -@@ -18,6 +18,7 @@ - #define PHY_ID_BCM5421 0x002060e0 - #define PHY_ID_BCM5464 0x002060b0 - #define PHY_ID_BCM5461 0x002060c0 -+#define PHY_ID_BCM54612E 0x03625e60 - #define PHY_ID_BCM54616S 0x03625d10 - #define PHY_ID_BCM57780 0x03625d90 - diff --git a/target/linux/generic/backport-4.9/075-v4.10-0003-net-phy-broadcom-add-bcm54xx_auxctl_read.patch b/target/linux/generic/backport-4.9/075-v4.10-0003-net-phy-broadcom-add-bcm54xx_auxctl_read.patch deleted file mode 100644 index c9b3b5911e..0000000000 --- a/target/linux/generic/backport-4.9/075-v4.10-0003-net-phy-broadcom-add-bcm54xx_auxctl_read.patch +++ /dev/null @@ -1,41 +0,0 @@ -From: Jon Mason -Date: Fri, 4 Nov 2016 01:10:56 -0400 -Subject: [PATCH] net: phy: broadcom: add bcm54xx_auxctl_read - -Add a helper function to read the AUXCTL register for the BCM54xx. This -mirrors the bcm54xx_auxctl_write function already present in the code. - -Signed-off-by: Jon Mason -Reviewed-by: Florian Fainelli -Signed-off-by: David S. Miller ---- - ---- a/drivers/net/phy/broadcom.c -+++ b/drivers/net/phy/broadcom.c -@@ -30,6 +30,16 @@ MODULE_DESCRIPTION("Broadcom PHY driver" - MODULE_AUTHOR("Maciej W. Rozycki"); - MODULE_LICENSE("GPL"); - -+static int bcm54xx_auxctl_read(struct phy_device *phydev, u16 regnum) -+{ -+ /* The register must be written to both the Shadow Register Select and -+ * the Shadow Read Register Selector -+ */ -+ phy_write(phydev, MII_BCM54XX_AUX_CTL, regnum | -+ regnum << MII_BCM54XX_AUXCTL_SHDWSEL_READ_SHIFT); -+ return phy_read(phydev, MII_BCM54XX_AUX_CTL); -+} -+ - static int bcm54xx_auxctl_write(struct phy_device *phydev, u16 regnum, u16 val) - { - return phy_write(phydev, MII_BCM54XX_AUX_CTL, regnum | val); ---- a/include/linux/brcmphy.h -+++ b/include/linux/brcmphy.h -@@ -110,6 +110,7 @@ - #define MII_BCM54XX_AUXCTL_MISC_FORCE_AMDIX 0x0200 - #define MII_BCM54XX_AUXCTL_MISC_RDSEL_MISC 0x7000 - #define MII_BCM54XX_AUXCTL_SHDWSEL_MISC 0x0007 -+#define MII_BCM54XX_AUXCTL_SHDWSEL_READ_SHIFT 12 - - #define MII_BCM54XX_AUXCTL_SHDWSEL_MASK 0x0007 - diff --git a/target/linux/generic/backport-4.9/075-v4.10-0004-net-phy-broadcom-Add-BCM54810-PHY-entry.patch b/target/linux/generic/backport-4.9/075-v4.10-0004-net-phy-broadcom-Add-BCM54810-PHY-entry.patch deleted file mode 100644 index 3d61ec6369..0000000000 --- a/target/linux/generic/backport-4.9/075-v4.10-0004-net-phy-broadcom-Add-BCM54810-PHY-entry.patch +++ /dev/null @@ -1,176 +0,0 @@ -From: Jon Mason -Date: Fri, 4 Nov 2016 01:10:58 -0400 -Subject: [PATCH] net: phy: broadcom: Add BCM54810 PHY entry - -The BCM54810 PHY requires some semi-unique configuration, which results -in some additional configuration in addition to the standard config. -Also, some users of the BCM54810 require the PHY lanes to be swapped. -Since there is no way to detect this, add a device tree query to see if -it is applicable. - -Inspired-by: Vikas Soni -Signed-off-by: Jon Mason -Reviewed-by: Florian Fainelli -Reviewed-by: Andrew Lunn -Signed-off-by: David S. Miller ---- - ---- a/drivers/net/phy/broadcom.c -+++ b/drivers/net/phy/broadcom.c -@@ -18,7 +18,7 @@ - #include - #include - #include -- -+#include - - #define BRCM_PHY_MODEL(phydev) \ - ((phydev)->drv->phy_id & (phydev)->drv->phy_id_mask) -@@ -45,6 +45,34 @@ static int bcm54xx_auxctl_write(struct p - return phy_write(phydev, MII_BCM54XX_AUX_CTL, regnum | val); - } - -+static int bcm54810_config(struct phy_device *phydev) -+{ -+ int rc, val; -+ -+ val = bcm_phy_read_exp(phydev, BCM54810_EXP_BROADREACH_LRE_MISC_CTL); -+ val &= ~BCM54810_EXP_BROADREACH_LRE_MISC_CTL_EN; -+ rc = bcm_phy_write_exp(phydev, BCM54810_EXP_BROADREACH_LRE_MISC_CTL, -+ val); -+ if (rc < 0) -+ return rc; -+ -+ val = bcm54xx_auxctl_read(phydev, MII_BCM54XX_AUXCTL_SHDWSEL_MISC); -+ val &= ~MII_BCM54XX_AUXCTL_SHDWSEL_MISC_RGMII_SKEW_EN; -+ val |= MII_BCM54XX_AUXCTL_MISC_WREN; -+ rc = bcm54xx_auxctl_write(phydev, MII_BCM54XX_AUXCTL_SHDWSEL_MISC, -+ val); -+ if (rc < 0) -+ return rc; -+ -+ val = bcm_phy_read_shadow(phydev, BCM54810_SHD_CLK_CTL); -+ val &= ~BCM54810_SHD_CLK_CTL_GTXCLK_EN; -+ rc = bcm_phy_write_shadow(phydev, BCM54810_SHD_CLK_CTL, val); -+ if (rc < 0) -+ return rc; -+ -+ return 0; -+} -+ - /* Needs SMDSP clock enabled via bcm54xx_phydsp_config() */ - static int bcm50610_a0_workaround(struct phy_device *phydev) - { -@@ -217,6 +245,12 @@ static int bcm54xx_config_init(struct ph - (phydev->dev_flags & PHY_BRCM_AUTO_PWRDWN_ENABLE)) - bcm54xx_adjust_rxrefclk(phydev); - -+ if (BRCM_PHY_MODEL(phydev) == PHY_ID_BCM54810) { -+ err = bcm54810_config(phydev); -+ if (err) -+ return err; -+ } -+ - bcm54xx_phydsp_config(phydev); - - return 0; -@@ -314,6 +348,7 @@ static int bcm5482_read_status(struct ph - - static int bcm5481_config_aneg(struct phy_device *phydev) - { -+ struct device_node *np = phydev->mdio.dev.of_node; - int ret; - - /* Aneg firsly. */ -@@ -344,6 +379,14 @@ static int bcm5481_config_aneg(struct ph - phy_write(phydev, 0x18, reg); - } - -+ if (of_property_read_bool(np, "enet-phy-lane-swap")) { -+ /* Lane Swap - Undocumented register...magic! */ -+ ret = bcm_phy_write_exp(phydev, MII_BCM54XX_EXP_SEL_ER + 0x9, -+ 0x11B); -+ if (ret < 0) -+ return ret; -+ } -+ - return ret; - } - -@@ -578,6 +621,18 @@ static struct phy_driver broadcom_driver - .ack_interrupt = bcm_phy_ack_intr, - .config_intr = bcm_phy_config_intr, - }, { -+ .phy_id = PHY_ID_BCM54810, -+ .phy_id_mask = 0xfffffff0, -+ .name = "Broadcom BCM54810", -+ .features = PHY_GBIT_FEATURES | -+ SUPPORTED_Pause | SUPPORTED_Asym_Pause, -+ .flags = PHY_HAS_MAGICANEG | PHY_HAS_INTERRUPT, -+ .config_init = bcm54xx_config_init, -+ .config_aneg = bcm5481_config_aneg, -+ .read_status = genphy_read_status, -+ .ack_interrupt = bcm_phy_ack_intr, -+ .config_intr = bcm_phy_config_intr, -+}, { - .phy_id = PHY_ID_BCM5482, - .phy_id_mask = 0xfffffff0, - .name = "Broadcom BCM5482", -@@ -661,6 +716,7 @@ static struct mdio_device_id __maybe_unu - { PHY_ID_BCM54616S, 0xfffffff0 }, - { PHY_ID_BCM5464, 0xfffffff0 }, - { PHY_ID_BCM5481, 0xfffffff0 }, -+ { PHY_ID_BCM54810, 0xfffffff0 }, - { PHY_ID_BCM5482, 0xfffffff0 }, - { PHY_ID_BCM50610, 0xfffffff0 }, - { PHY_ID_BCM50610M, 0xfffffff0 }, ---- a/drivers/net/phy/Kconfig -+++ b/drivers/net/phy/Kconfig -@@ -204,7 +204,7 @@ config BROADCOM_PHY - select BCM_NET_PHYLIB - ---help--- - Currently supports the BCM5411, BCM5421, BCM5461, BCM54616S, BCM5464, -- BCM5481 and BCM5482 PHYs. -+ BCM5481, BCM54810 and BCM5482 PHYs. - - config CICADA_PHY - tristate "Cicada PHYs" ---- a/include/linux/brcmphy.h -+++ b/include/linux/brcmphy.h -@@ -13,6 +13,7 @@ - #define PHY_ID_BCM5241 0x0143bc30 - #define PHY_ID_BCMAC131 0x0143bc70 - #define PHY_ID_BCM5481 0x0143bca0 -+#define PHY_ID_BCM54810 0x03625d00 - #define PHY_ID_BCM5482 0x0143bcb0 - #define PHY_ID_BCM5411 0x00206070 - #define PHY_ID_BCM5421 0x002060e0 -@@ -56,6 +57,7 @@ - #define PHY_BRCM_EXT_IBND_TX_ENABLE 0x00002000 - #define PHY_BRCM_CLEAR_RGMII_MODE 0x00004000 - #define PHY_BRCM_DIS_TXCRXC_NOENRGY 0x00008000 -+ - /* Broadcom BCM7xxx specific workarounds */ - #define PHY_BRCM_7XXX_REV(x) (((x) >> 8) & 0xff) - #define PHY_BRCM_7XXX_PATCH(x) ((x) & 0xff) -@@ -111,6 +113,7 @@ - #define MII_BCM54XX_AUXCTL_MISC_RDSEL_MISC 0x7000 - #define MII_BCM54XX_AUXCTL_SHDWSEL_MISC 0x0007 - #define MII_BCM54XX_AUXCTL_SHDWSEL_READ_SHIFT 12 -+#define MII_BCM54XX_AUXCTL_SHDWSEL_MISC_RGMII_SKEW_EN (1 << 8) - - #define MII_BCM54XX_AUXCTL_SHDWSEL_MASK 0x0007 - -@@ -192,6 +195,12 @@ - #define BCM5482_SSD_SGMII_SLAVE_EN 0x0002 /* Slave mode enable */ - #define BCM5482_SSD_SGMII_SLAVE_AD 0x0001 /* Slave auto-detection */ - -+/* BCM54810 Registers */ -+#define BCM54810_EXP_BROADREACH_LRE_MISC_CTL (MII_BCM54XX_EXP_SEL_ER + 0x90) -+#define BCM54810_EXP_BROADREACH_LRE_MISC_CTL_EN (1 << 0) -+#define BCM54810_SHD_CLK_CTL 0x3 -+#define BCM54810_SHD_CLK_CTL_GTXCLK_EN (1 << 9) -+ - - /*****************************************************************************/ - /* Fast Ethernet Transceiver definitions. */ diff --git a/target/linux/generic/backport-4.9/075-v4.10-0005-net-phy-broadcom-Move-bcm54xx_auxctl_-read-write-to-.patch b/target/linux/generic/backport-4.9/075-v4.10-0005-net-phy-broadcom-Move-bcm54xx_auxctl_-read-write-to-.patch deleted file mode 100644 index c8bf54c781..0000000000 --- a/target/linux/generic/backport-4.9/075-v4.10-0005-net-phy-broadcom-Move-bcm54xx_auxctl_-read-write-to-.patch +++ /dev/null @@ -1,74 +0,0 @@ -From: Florian Fainelli -Date: Tue, 22 Nov 2016 11:40:54 -0800 -Subject: [PATCH] net: phy: broadcom: Move bcm54xx_auxctl_{read, write} to - common library - -We are going to need these functions to implement support for Broadcom -Wirespeed, aka downshift. - -Signed-off-by: Florian Fainelli -Signed-off-by: David S. Miller ---- - ---- a/drivers/net/phy/bcm-phy-lib.c -+++ b/drivers/net/phy/bcm-phy-lib.c -@@ -50,6 +50,23 @@ int bcm_phy_read_exp(struct phy_device * - } - EXPORT_SYMBOL_GPL(bcm_phy_read_exp); - -+int bcm54xx_auxctl_read(struct phy_device *phydev, u16 regnum) -+{ -+ /* The register must be written to both the Shadow Register Select and -+ * the Shadow Read Register Selector -+ */ -+ phy_write(phydev, MII_BCM54XX_AUX_CTL, regnum | -+ regnum << MII_BCM54XX_AUXCTL_SHDWSEL_READ_SHIFT); -+ return phy_read(phydev, MII_BCM54XX_AUX_CTL); -+} -+EXPORT_SYMBOL_GPL(bcm54xx_auxctl_read); -+ -+int bcm54xx_auxctl_write(struct phy_device *phydev, u16 regnum, u16 val) -+{ -+ return phy_write(phydev, MII_BCM54XX_AUX_CTL, regnum | val); -+} -+EXPORT_SYMBOL(bcm54xx_auxctl_write); -+ - int bcm_phy_write_misc(struct phy_device *phydev, - u16 reg, u16 chl, u16 val) - { ---- a/drivers/net/phy/bcm-phy-lib.h -+++ b/drivers/net/phy/bcm-phy-lib.h -@@ -26,6 +26,9 @@ static inline int bcm_phy_write_exp_sel( - return bcm_phy_write_exp(phydev, reg | MII_BCM54XX_EXP_SEL_ER, val); - } - -+int bcm54xx_auxctl_write(struct phy_device *phydev, u16 regnum, u16 val); -+int bcm54xx_auxctl_read(struct phy_device *phydev, u16 regnum); -+ - int bcm_phy_write_misc(struct phy_device *phydev, - u16 reg, u16 chl, u16 value); - int bcm_phy_read_misc(struct phy_device *phydev, ---- a/drivers/net/phy/broadcom.c -+++ b/drivers/net/phy/broadcom.c -@@ -30,21 +30,6 @@ MODULE_DESCRIPTION("Broadcom PHY driver" - MODULE_AUTHOR("Maciej W. Rozycki"); - MODULE_LICENSE("GPL"); - --static int bcm54xx_auxctl_read(struct phy_device *phydev, u16 regnum) --{ -- /* The register must be written to both the Shadow Register Select and -- * the Shadow Read Register Selector -- */ -- phy_write(phydev, MII_BCM54XX_AUX_CTL, regnum | -- regnum << MII_BCM54XX_AUXCTL_SHDWSEL_READ_SHIFT); -- return phy_read(phydev, MII_BCM54XX_AUX_CTL); --} -- --static int bcm54xx_auxctl_write(struct phy_device *phydev, u16 regnum, u16 val) --{ -- return phy_write(phydev, MII_BCM54XX_AUX_CTL, regnum | val); --} -- - static int bcm54810_config(struct phy_device *phydev) - { - int rc, val; diff --git a/target/linux/generic/backport-4.9/076-v4.11-0001-net-phy-broadcom-Allow-enabling-or-disabling-of-EEE.patch b/target/linux/generic/backport-4.9/076-v4.11-0001-net-phy-broadcom-Allow-enabling-or-disabling-of-EEE.patch deleted file mode 100644 index 35eee772dd..0000000000 --- a/target/linux/generic/backport-4.9/076-v4.11-0001-net-phy-broadcom-Allow-enabling-or-disabling-of-EEE.patch +++ /dev/null @@ -1,87 +0,0 @@ -From: Florian Fainelli -Date: Tue, 22 Nov 2016 11:40:56 -0800 -Subject: [PATCH] net: phy: broadcom: Allow enabling or disabling of EEE - -In preparation for adding support for Wirespeed/downshift, we need to -change bcm_phy_eee_enable() to allow enabling or disabling EEE, so make -the function take an extra enable/disable boolean parameter and rename -it to illustrate it sets EEE, not necessarily just enables it. - -Signed-off-by: Florian Fainelli -Signed-off-by: David S. Miller ---- - ---- a/drivers/net/phy/bcm7xxx.c -+++ b/drivers/net/phy/bcm7xxx.c -@@ -199,7 +199,7 @@ static int bcm7xxx_28nm_config_init(stru - if (ret) - return ret; - -- ret = bcm_phy_enable_eee(phydev); -+ ret = bcm_phy_set_eee(phydev, true); - if (ret) - return ret; - ---- a/drivers/net/phy/bcm-cygnus.c -+++ b/drivers/net/phy/bcm-cygnus.c -@@ -104,7 +104,7 @@ static int bcm_cygnus_config_init(struct - return rc; - - /* Advertise EEE */ -- rc = bcm_phy_enable_eee(phydev); -+ rc = bcm_phy_set_eee(phydev, true); - if (rc) - return rc; - ---- a/drivers/net/phy/bcm-phy-lib.c -+++ b/drivers/net/phy/bcm-phy-lib.c -@@ -195,7 +195,7 @@ int bcm_phy_enable_apd(struct phy_device - } - EXPORT_SYMBOL_GPL(bcm_phy_enable_apd); - --int bcm_phy_enable_eee(struct phy_device *phydev) -+int bcm_phy_set_eee(struct phy_device *phydev, bool enable) - { - int val; - -@@ -205,7 +205,10 @@ int bcm_phy_enable_eee(struct phy_device - if (val < 0) - return val; - -- val |= LPI_FEATURE_EN | LPI_FEATURE_EN_DIG1000X; -+ if (enable) -+ val |= LPI_FEATURE_EN | LPI_FEATURE_EN_DIG1000X; -+ else -+ val &= ~(LPI_FEATURE_EN | LPI_FEATURE_EN_DIG1000X); - - phy_write_mmd_indirect(phydev, BRCM_CL45VEN_EEE_CONTROL, - MDIO_MMD_AN, (u32)val); -@@ -216,14 +219,17 @@ int bcm_phy_enable_eee(struct phy_device - if (val < 0) - return val; - -- val |= (MDIO_AN_EEE_ADV_100TX | MDIO_AN_EEE_ADV_1000T); -+ if (enable) -+ val |= (MDIO_AN_EEE_ADV_100TX | MDIO_AN_EEE_ADV_1000T); -+ else -+ val &= ~(MDIO_AN_EEE_ADV_100TX | MDIO_AN_EEE_ADV_1000T); - - phy_write_mmd_indirect(phydev, BCM_CL45VEN_EEE_ADV, - MDIO_MMD_AN, (u32)val); - - return 0; - } --EXPORT_SYMBOL_GPL(bcm_phy_enable_eee); -+EXPORT_SYMBOL_GPL(bcm_phy_set_eee); - - MODULE_DESCRIPTION("Broadcom PHY Library"); - MODULE_LICENSE("GPL v2"); ---- a/drivers/net/phy/bcm-phy-lib.h -+++ b/drivers/net/phy/bcm-phy-lib.h -@@ -43,5 +43,5 @@ int bcm_phy_config_intr(struct phy_devic - - int bcm_phy_enable_apd(struct phy_device *phydev, bool dll_pwr_down); - --int bcm_phy_enable_eee(struct phy_device *phydev); -+int bcm_phy_set_eee(struct phy_device *phydev, bool enable); - #endif /* _LINUX_BCM_PHY_LIB_H */ diff --git a/target/linux/generic/backport-4.9/076-v4.11-0002-net-phy-broadcom-Add-support-code-for-reading-PHY-co.patch b/target/linux/generic/backport-4.9/076-v4.11-0002-net-phy-broadcom-Add-support-code-for-reading-PHY-co.patch deleted file mode 100644 index 83cfe1f5d3..0000000000 --- a/target/linux/generic/backport-4.9/076-v4.11-0002-net-phy-broadcom-Add-support-code-for-reading-PHY-co.patch +++ /dev/null @@ -1,125 +0,0 @@ -From: Florian Fainelli -Date: Tue, 29 Nov 2016 09:57:17 -0800 -Subject: [PATCH] net: phy: broadcom: Add support code for reading PHY counters - -Broadcom PHYs expose a number of PHY error counters: receive errors, -false carrier sense, SerDes BER count, local and remote receive errors. -Add support code to allow retrieving these error counters. Since the -Broadcom PHY library code is used by several drivers, make it possible -for them to specify the storage for the software copy of the statistics. - -Signed-off-by: Florian Fainelli -Signed-off-by: David S. Miller ---- - ---- a/drivers/net/phy/bcm-phy-lib.c -+++ b/drivers/net/phy/bcm-phy-lib.c -@@ -17,6 +17,7 @@ - #include - #include - #include -+#include - - #define MII_BCM_CHANNEL_WIDTH 0x2000 - #define BCM_CL45VEN_EEE_ADV 0x3c -@@ -231,6 +232,75 @@ int bcm_phy_set_eee(struct phy_device *p - } - EXPORT_SYMBOL_GPL(bcm_phy_set_eee); - -+struct bcm_phy_hw_stat { -+ const char *string; -+ u8 reg; -+ u8 shift; -+ u8 bits; -+}; -+ -+/* Counters freeze at either 0xffff or 0xff, better than nothing */ -+static const struct bcm_phy_hw_stat bcm_phy_hw_stats[] = { -+ { "phy_receive_errors", MII_BRCM_CORE_BASE12, 0, 16 }, -+ { "phy_serdes_ber_errors", MII_BRCM_CORE_BASE13, 8, 8 }, -+ { "phy_false_carrier_sense_errors", MII_BRCM_CORE_BASE13, 0, 8 }, -+ { "phy_local_rcvr_nok", MII_BRCM_CORE_BASE14, 8, 8 }, -+ { "phy_remote_rcv_nok", MII_BRCM_CORE_BASE14, 0, 8 }, -+}; -+ -+int bcm_phy_get_sset_count(struct phy_device *phydev) -+{ -+ return ARRAY_SIZE(bcm_phy_hw_stats); -+} -+EXPORT_SYMBOL_GPL(bcm_phy_get_sset_count); -+ -+void bcm_phy_get_strings(struct phy_device *phydev, u8 *data) -+{ -+ unsigned int i; -+ -+ for (i = 0; i < ARRAY_SIZE(bcm_phy_hw_stats); i++) -+ memcpy(data + i * ETH_GSTRING_LEN, -+ bcm_phy_hw_stats[i].string, ETH_GSTRING_LEN); -+} -+EXPORT_SYMBOL_GPL(bcm_phy_get_strings); -+ -+#ifndef UINT64_MAX -+#define UINT64_MAX (u64)(~((u64)0)) -+#endif -+ -+/* Caller is supposed to provide appropriate storage for the library code to -+ * access the shadow copy -+ */ -+static u64 bcm_phy_get_stat(struct phy_device *phydev, u64 *shadow, -+ unsigned int i) -+{ -+ struct bcm_phy_hw_stat stat = bcm_phy_hw_stats[i]; -+ int val; -+ u64 ret; -+ -+ val = phy_read(phydev, stat.reg); -+ if (val < 0) { -+ ret = UINT64_MAX; -+ } else { -+ val >>= stat.shift; -+ val = val & ((1 << stat.bits) - 1); -+ shadow[i] += val; -+ ret = shadow[i]; -+ } -+ -+ return ret; -+} -+ -+void bcm_phy_get_stats(struct phy_device *phydev, u64 *shadow, -+ struct ethtool_stats *stats, u64 *data) -+{ -+ unsigned int i; -+ -+ for (i = 0; i < ARRAY_SIZE(bcm_phy_hw_stats); i++) -+ data[i] = bcm_phy_get_stat(phydev, shadow, i); -+} -+EXPORT_SYMBOL_GPL(bcm_phy_get_stats); -+ - MODULE_DESCRIPTION("Broadcom PHY Library"); - MODULE_LICENSE("GPL v2"); - MODULE_AUTHOR("Broadcom Corporation"); ---- a/drivers/net/phy/bcm-phy-lib.h -+++ b/drivers/net/phy/bcm-phy-lib.h -@@ -44,4 +44,10 @@ int bcm_phy_config_intr(struct phy_devic - int bcm_phy_enable_apd(struct phy_device *phydev, bool dll_pwr_down); - - int bcm_phy_set_eee(struct phy_device *phydev, bool enable); -+ -+int bcm_phy_get_sset_count(struct phy_device *phydev); -+void bcm_phy_get_strings(struct phy_device *phydev, u8 *data); -+void bcm_phy_get_stats(struct phy_device *phydev, u64 *shadow, -+ struct ethtool_stats *stats, u64 *data); -+ - #endif /* _LINUX_BCM_PHY_LIB_H */ ---- a/include/linux/brcmphy.h -+++ b/include/linux/brcmphy.h -@@ -234,6 +234,9 @@ - #define LPI_FEATURE_EN_DIG1000X 0x4000 - - /* Core register definitions*/ -+#define MII_BRCM_CORE_BASE12 0x12 -+#define MII_BRCM_CORE_BASE13 0x13 -+#define MII_BRCM_CORE_BASE14 0x14 - #define MII_BRCM_CORE_BASE1E 0x1E - #define MII_BRCM_CORE_EXPB0 0xB0 - #define MII_BRCM_CORE_EXPB1 0xB1 diff --git a/target/linux/generic/backport-4.9/076-v4.11-0003-net-phy-bcm7xxx-Add-entry-for-BCM7278.patch b/target/linux/generic/backport-4.9/076-v4.11-0003-net-phy-bcm7xxx-Add-entry-for-BCM7278.patch deleted file mode 100644 index 8034f4b217..0000000000 --- a/target/linux/generic/backport-4.9/076-v4.11-0003-net-phy-bcm7xxx-Add-entry-for-BCM7278.patch +++ /dev/null @@ -1,38 +0,0 @@ -From: Florian Fainelli -Date: Fri, 20 Jan 2017 12:36:33 -0800 -Subject: [PATCH] net: phy: bcm7xxx: Add entry for BCM7278 - -Add support for the BCM7278 28nm process Gigabit Ethernet PHY. - -Signed-off-by: Florian Fainelli -Signed-off-by: David S. Miller ---- - ---- a/drivers/net/phy/bcm7xxx.c -+++ b/drivers/net/phy/bcm7xxx.c -@@ -334,6 +334,7 @@ static int bcm7xxx_suspend(struct phy_de - - static struct phy_driver bcm7xxx_driver[] = { - BCM7XXX_28NM_GPHY(PHY_ID_BCM7250, "Broadcom BCM7250"), -+ BCM7XXX_28NM_GPHY(PHY_ID_BCM7278, "Broadcom BCM7278"), - BCM7XXX_28NM_GPHY(PHY_ID_BCM7364, "Broadcom BCM7364"), - BCM7XXX_28NM_GPHY(PHY_ID_BCM7366, "Broadcom BCM7366"), - BCM7XXX_28NM_GPHY(PHY_ID_BCM7439, "Broadcom BCM7439"), -@@ -348,6 +349,7 @@ static struct phy_driver bcm7xxx_driver[ - - static struct mdio_device_id __maybe_unused bcm7xxx_tbl[] = { - { PHY_ID_BCM7250, 0xfffffff0, }, -+ { PHY_ID_BCM7278, 0xfffffff0, }, - { PHY_ID_BCM7364, 0xfffffff0, }, - { PHY_ID_BCM7366, 0xfffffff0, }, - { PHY_ID_BCM7346, 0xfffffff0, }, ---- a/include/linux/brcmphy.h -+++ b/include/linux/brcmphy.h -@@ -24,6 +24,7 @@ - #define PHY_ID_BCM57780 0x03625d90 - - #define PHY_ID_BCM7250 0xae025280 -+#define PHY_ID_BCM7278 0xae0251a0 - #define PHY_ID_BCM7364 0xae025260 - #define PHY_ID_BCM7366 0x600d8490 - #define PHY_ID_BCM7346 0x600d8650 diff --git a/target/linux/generic/backport-4.9/076-v4.11-0004-net-phy-bcm7xxx-Implement-EGPHY-workaround-for-7278.patch b/target/linux/generic/backport-4.9/076-v4.11-0004-net-phy-bcm7xxx-Implement-EGPHY-workaround-for-7278.patch deleted file mode 100644 index 7aa4ee2c79..0000000000 --- a/target/linux/generic/backport-4.9/076-v4.11-0004-net-phy-bcm7xxx-Implement-EGPHY-workaround-for-7278.patch +++ /dev/null @@ -1,68 +0,0 @@ -From: Florian Fainelli -Date: Fri, 20 Jan 2017 12:36:34 -0800 -Subject: [PATCH] net: phy: bcm7xxx: Implement EGPHY workaround for 7278 - -Implement the HW design team recommended workaround in for 7278. Since -the GPHY now returns its revision information in MII_PHYS_ID[23] we need -to check whether the revision provided in flags is 0 or not. - -Signed-off-by: Florian Fainelli -Signed-off-by: David S. Miller ---- - ---- a/drivers/net/phy/bcm7xxx.c -+++ b/drivers/net/phy/bcm7xxx.c -@@ -163,12 +163,43 @@ static int bcm7xxx_28nm_e0_plus_afe_conf - return 0; - } - -+static int bcm7xxx_28nm_a0_patch_afe_config_init(struct phy_device *phydev) -+{ -+ /* +1 RC_CAL codes for RL centering for both LT and HT conditions */ -+ bcm_phy_write_misc(phydev, AFE_RXCONFIG_2, 0xd003); -+ -+ /* Cut master bias current by 2% to compensate for RC_CAL offset */ -+ bcm_phy_write_misc(phydev, DSP_TAP10, 0x791b); -+ -+ /* Improve hybrid leakage */ -+ bcm_phy_write_misc(phydev, AFE_HPF_TRIM_OTHERS, 0x10e3); -+ -+ /* Change rx_on_tune 8 to 0xf */ -+ bcm_phy_write_misc(phydev, 0x21, 0x2, 0x87f6); -+ -+ /* Change 100Tx EEE bandwidth */ -+ bcm_phy_write_misc(phydev, 0x22, 0x2, 0x017d); -+ -+ /* Enable ffe zero detection for Vitesse interoperability */ -+ bcm_phy_write_misc(phydev, 0x26, 0x2, 0x0015); -+ -+ r_rc_cal_reset(phydev); -+ -+ return 0; -+} -+ - static int bcm7xxx_28nm_config_init(struct phy_device *phydev) - { - u8 rev = PHY_BRCM_7XXX_REV(phydev->dev_flags); - u8 patch = PHY_BRCM_7XXX_PATCH(phydev->dev_flags); - int ret = 0; - -+ /* Newer devices have moved the revision information back into a -+ * standard location in MII_PHYS_ID[23] -+ */ -+ if (rev == 0) -+ rev = phydev->phy_id & ~phydev->drv->phy_id_mask; -+ - pr_info_once("%s: %s PHY revision: 0x%02x, patch: %d\n", - phydev_name(phydev), phydev->drv->name, rev, patch); - -@@ -192,6 +223,9 @@ static int bcm7xxx_28nm_config_init(stru - case 0x10: - ret = bcm7xxx_28nm_e0_plus_afe_config_init(phydev); - break; -+ case 0x01: -+ ret = bcm7xxx_28nm_a0_patch_afe_config_init(phydev); -+ break; - default: - break; - } diff --git a/target/linux/generic/backport-4.9/076-v4.11-0005-net-phy-broadcom-use-auxctl-reading-helper-in-BCM546.patch b/target/linux/generic/backport-4.9/076-v4.11-0005-net-phy-broadcom-use-auxctl-reading-helper-in-BCM546.patch deleted file mode 100644 index 554e3117d8..0000000000 --- a/target/linux/generic/backport-4.9/076-v4.11-0005-net-phy-broadcom-use-auxctl-reading-helper-in-BCM546.patch +++ /dev/null @@ -1,45 +0,0 @@ -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= -Date: Wed, 25 Jan 2017 21:00:25 +0100 -Subject: [PATCH] net: phy: broadcom: use auxctl reading helper in BCM54612E - code -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Starting with commit 5b4e29005123 ("net: phy: broadcom: add -bcm54xx_auxctl_read") we have a reading helper so use it and avoid code -duplication. -It also means we don't need MII_BCM54XX_AUXCTL_SHDWSEL_MISC define as -it's the same as MII_BCM54XX_AUXCTL_SHDWSEL_MISC just for reading needs -(same value shifted by 12 bits). - -Signed-off-by: Rafał Miłecki -Reviewed-by: Florian Fainelli -Signed-off-by: David S. Miller ---- - ---- a/drivers/net/phy/broadcom.c -+++ b/drivers/net/phy/broadcom.c -@@ -395,10 +395,8 @@ static int bcm54612e_config_aneg(struct - (phydev->interface != PHY_INTERFACE_MODE_RGMII_RXID)) { - u16 reg; - -- /* Errata: reads require filling in the write selector field */ -- bcm54xx_auxctl_write(phydev, MII_BCM54XX_AUXCTL_SHDWSEL_MISC, -- MII_BCM54XX_AUXCTL_MISC_RDSEL_MISC); -- reg = phy_read(phydev, MII_BCM54XX_AUX_CTL); -+ reg = bcm54xx_auxctl_read(phydev, -+ MII_BCM54XX_AUXCTL_SHDWSEL_MISC); - /* Disable RXD to RXC delay (default set) */ - reg &= ~MII_BCM54XX_AUXCTL_MISC_RXD_RXC_SKEW; - /* Clear shadow selector field */ ---- a/include/linux/brcmphy.h -+++ b/include/linux/brcmphy.h -@@ -111,7 +111,6 @@ - - #define MII_BCM54XX_AUXCTL_MISC_WREN 0x8000 - #define MII_BCM54XX_AUXCTL_MISC_FORCE_AMDIX 0x0200 --#define MII_BCM54XX_AUXCTL_MISC_RDSEL_MISC 0x7000 - #define MII_BCM54XX_AUXCTL_SHDWSEL_MISC 0x0007 - #define MII_BCM54XX_AUXCTL_SHDWSEL_READ_SHIFT 12 - #define MII_BCM54XX_AUXCTL_SHDWSEL_MISC_RGMII_SKEW_EN (1 << 8) diff --git a/target/linux/generic/backport-4.9/076-v4.11-0006-net-phy-broadcom-add-support-for-BCM54210E.patch b/target/linux/generic/backport-4.9/076-v4.11-0006-net-phy-broadcom-add-support-for-BCM54210E.patch deleted file mode 100644 index 5fa7e88c53..0000000000 --- a/target/linux/generic/backport-4.9/076-v4.11-0006-net-phy-broadcom-add-support-for-BCM54210E.patch +++ /dev/null @@ -1,89 +0,0 @@ -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= -Date: Fri, 27 Jan 2017 14:07:01 +0100 -Subject: [PATCH] net: phy: broadcom: add support for BCM54210E -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -It's Broadcom PHY simply described as single-port -RGMII 10/100/1000BASE-T PHY. It requires disabling delay skew and GTXCLK -bits. - -Signed-off-by: Rafał Miłecki -Signed-off-by: David S. Miller ---- - ---- a/drivers/net/phy/broadcom.c -+++ b/drivers/net/phy/broadcom.c -@@ -30,6 +30,22 @@ MODULE_DESCRIPTION("Broadcom PHY driver" - MODULE_AUTHOR("Maciej W. Rozycki"); - MODULE_LICENSE("GPL"); - -+static int bcm54210e_config_init(struct phy_device *phydev) -+{ -+ int val; -+ -+ val = bcm54xx_auxctl_read(phydev, MII_BCM54XX_AUXCTL_SHDWSEL_MISC); -+ val &= ~MII_BCM54XX_AUXCTL_SHDWSEL_MISC_RGMII_SKEW_EN; -+ val |= MII_BCM54XX_AUXCTL_MISC_WREN; -+ bcm54xx_auxctl_write(phydev, MII_BCM54XX_AUXCTL_SHDWSEL_MISC, val); -+ -+ val = bcm_phy_read_shadow(phydev, BCM54810_SHD_CLK_CTL); -+ val &= ~BCM54810_SHD_CLK_CTL_GTXCLK_EN; -+ bcm_phy_write_shadow(phydev, BCM54810_SHD_CLK_CTL, val); -+ -+ return 0; -+} -+ - static int bcm54810_config(struct phy_device *phydev) - { - int rc, val; -@@ -230,7 +246,11 @@ static int bcm54xx_config_init(struct ph - (phydev->dev_flags & PHY_BRCM_AUTO_PWRDWN_ENABLE)) - bcm54xx_adjust_rxrefclk(phydev); - -- if (BRCM_PHY_MODEL(phydev) == PHY_ID_BCM54810) { -+ if (BRCM_PHY_MODEL(phydev) == PHY_ID_BCM54210E) { -+ err = bcm54210e_config_init(phydev); -+ if (err) -+ return err; -+ } else if (BRCM_PHY_MODEL(phydev) == PHY_ID_BCM54810) { - err = bcm54810_config(phydev); - if (err) - return err; -@@ -544,6 +564,17 @@ static struct phy_driver broadcom_driver - .ack_interrupt = bcm_phy_ack_intr, - .config_intr = bcm_phy_config_intr, - }, { -+ .phy_id = PHY_ID_BCM54210E, -+ .phy_id_mask = 0xfffffff0, -+ .name = "Broadcom BCM54210E", -+ .features = PHY_GBIT_FEATURES, -+ .flags = PHY_HAS_MAGICANEG | PHY_HAS_INTERRUPT, -+ .config_init = bcm54xx_config_init, -+ .config_aneg = genphy_config_aneg, -+ .read_status = genphy_read_status, -+ .ack_interrupt = bcm_phy_ack_intr, -+ .config_intr = bcm_phy_config_intr, -+}, { - .phy_id = PHY_ID_BCM5461, - .phy_id_mask = 0xfffffff0, - .name = "Broadcom BCM5461", -@@ -694,6 +725,7 @@ module_phy_driver(broadcom_drivers); - static struct mdio_device_id __maybe_unused broadcom_tbl[] = { - { PHY_ID_BCM5411, 0xfffffff0 }, - { PHY_ID_BCM5421, 0xfffffff0 }, -+ { PHY_ID_BCM54210E, 0xfffffff0 }, - { PHY_ID_BCM5461, 0xfffffff0 }, - { PHY_ID_BCM54612E, 0xfffffff0 }, - { PHY_ID_BCM54616S, 0xfffffff0 }, ---- a/include/linux/brcmphy.h -+++ b/include/linux/brcmphy.h -@@ -17,6 +17,7 @@ - #define PHY_ID_BCM5482 0x0143bcb0 - #define PHY_ID_BCM5411 0x00206070 - #define PHY_ID_BCM5421 0x002060e0 -+#define PHY_ID_BCM54210E 0x600d84a0 - #define PHY_ID_BCM5464 0x002060b0 - #define PHY_ID_BCM5461 0x002060c0 - #define PHY_ID_BCM54612E 0x03625e60 diff --git a/target/linux/generic/backport-4.9/076-v4.11-0007-net-phy-broadcom-rehook-BCM54612E-specific-init.patch b/target/linux/generic/backport-4.9/076-v4.11-0007-net-phy-broadcom-rehook-BCM54612E-specific-init.patch deleted file mode 100644 index b7326c3df4..0000000000 --- a/target/linux/generic/backport-4.9/076-v4.11-0007-net-phy-broadcom-rehook-BCM54612E-specific-init.patch +++ /dev/null @@ -1,121 +0,0 @@ -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= -Date: Tue, 31 Jan 2017 22:54:54 +0100 -Subject: [PATCH] net: phy: broadcom: rehook BCM54612E specific init -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -This extra BCM54612E code in PHY driver isn't really aneg specific. Even -without it aneg works OK but the problem is no packets pass through PHY. - -Moreover putting this code inside config_aneg callback didn't allow -resuming PHY correctly. When driver called phy_stop and phy_start it was -putting PHY machine into RESUMING state. After that machine was -switching into AN and NOLINK without ever calling phy_start_aneg. This -prevented this extra setup from being called and PHY didn't work. - -This change has been verified to fix network on BCM47186B0 SoC device -with BCM54612E. - -Signed-off-by: Rafał Miłecki -Reviewed-by: Florian Fainelli -Signed-off-by: David S. Miller ---- - ---- a/drivers/net/phy/broadcom.c -+++ b/drivers/net/phy/broadcom.c -@@ -46,6 +46,34 @@ static int bcm54210e_config_init(struct - return 0; - } - -+static int bcm54612e_config_init(struct phy_device *phydev) -+{ -+ /* Clear TX internal delay unless requested. */ -+ if ((phydev->interface != PHY_INTERFACE_MODE_RGMII_ID) && -+ (phydev->interface != PHY_INTERFACE_MODE_RGMII_TXID)) { -+ /* Disable TXD to GTXCLK clock delay (default set) */ -+ /* Bit 9 is the only field in shadow register 00011 */ -+ bcm_phy_write_shadow(phydev, 0x03, 0); -+ } -+ -+ /* Clear RX internal delay unless requested. */ -+ if ((phydev->interface != PHY_INTERFACE_MODE_RGMII_ID) && -+ (phydev->interface != PHY_INTERFACE_MODE_RGMII_RXID)) { -+ u16 reg; -+ -+ reg = bcm54xx_auxctl_read(phydev, -+ MII_BCM54XX_AUXCTL_SHDWSEL_MISC); -+ /* Disable RXD to RXC delay (default set) */ -+ reg &= ~MII_BCM54XX_AUXCTL_SHDWSEL_MISC_RGMII_SKEW_EN; -+ /* Clear shadow selector field */ -+ reg &= ~MII_BCM54XX_AUXCTL_SHDWSEL_MASK; -+ bcm54xx_auxctl_write(phydev, MII_BCM54XX_AUXCTL_SHDWSEL_MISC, -+ MII_BCM54XX_AUXCTL_MISC_WREN | reg); -+ } -+ -+ return 0; -+} -+ - static int bcm54810_config(struct phy_device *phydev) - { - int rc, val; -@@ -250,6 +278,10 @@ static int bcm54xx_config_init(struct ph - err = bcm54210e_config_init(phydev); - if (err) - return err; -+ } else if (BRCM_PHY_MODEL(phydev) == PHY_ID_BCM54612E) { -+ err = bcm54612e_config_init(phydev); -+ if (err) -+ return err; - } else if (BRCM_PHY_MODEL(phydev) == PHY_ID_BCM54810) { - err = bcm54810_config(phydev); - if (err) -@@ -395,39 +427,6 @@ static int bcm5481_config_aneg(struct ph - return ret; - } - --static int bcm54612e_config_aneg(struct phy_device *phydev) --{ -- int ret; -- -- /* First, auto-negotiate. */ -- ret = genphy_config_aneg(phydev); -- -- /* Clear TX internal delay unless requested. */ -- if ((phydev->interface != PHY_INTERFACE_MODE_RGMII_ID) && -- (phydev->interface != PHY_INTERFACE_MODE_RGMII_TXID)) { -- /* Disable TXD to GTXCLK clock delay (default set) */ -- /* Bit 9 is the only field in shadow register 00011 */ -- bcm_phy_write_shadow(phydev, 0x03, 0); -- } -- -- /* Clear RX internal delay unless requested. */ -- if ((phydev->interface != PHY_INTERFACE_MODE_RGMII_ID) && -- (phydev->interface != PHY_INTERFACE_MODE_RGMII_RXID)) { -- u16 reg; -- -- reg = bcm54xx_auxctl_read(phydev, -- MII_BCM54XX_AUXCTL_SHDWSEL_MISC); -- /* Disable RXD to RXC delay (default set) */ -- reg &= ~MII_BCM54XX_AUXCTL_MISC_RXD_RXC_SKEW; -- /* Clear shadow selector field */ -- reg &= ~MII_BCM54XX_AUXCTL_SHDWSEL_MASK; -- bcm54xx_auxctl_write(phydev, MII_BCM54XX_AUXCTL_SHDWSEL_MISC, -- MII_BCM54XX_AUXCTL_MISC_WREN | reg); -- } -- -- return ret; --} -- - static int brcm_phy_setbits(struct phy_device *phydev, int reg, int set) - { - int val; -@@ -594,7 +593,7 @@ static struct phy_driver broadcom_driver - SUPPORTED_Pause | SUPPORTED_Asym_Pause, - .flags = PHY_HAS_MAGICANEG | PHY_HAS_INTERRUPT, - .config_init = bcm54xx_config_init, -- .config_aneg = bcm54612e_config_aneg, -+ .config_aneg = genphy_config_aneg, - .read_status = genphy_read_status, - .ack_interrupt = bcm_phy_ack_intr, - .config_intr = bcm_phy_config_intr, diff --git a/target/linux/generic/backport-4.9/076-v4.15-0001-net-phy-broadcom-support-new-device-flag-for-setting.patch b/target/linux/generic/backport-4.9/076-v4.15-0001-net-phy-broadcom-support-new-device-flag-for-setting.patch deleted file mode 100644 index 334c444692..0000000000 --- a/target/linux/generic/backport-4.9/076-v4.15-0001-net-phy-broadcom-support-new-device-flag-for-setting.patch +++ /dev/null @@ -1,54 +0,0 @@ -From 2355a6546a053b1c16ebefd6ce1f0cccc00e1da5 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= -Date: Thu, 12 Oct 2017 10:21:25 +0200 -Subject: [PATCH] net: phy: broadcom: support new device flag for setting - master mode -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Some of Broadcom's PHYs run by default in slave mode with Automatic -Slave/Master configuration disabled. It stops them from working properly -with some devices. - -So far it has been verified for BCM54210E and BCM50212E which don't -work well with Intel's I217-LM and I218-LM: -http://ark.intel.com/products/60019/Intel-Ethernet-Connection-I217-LM -http://ark.intel.com/products/71307/Intel-Ethernet-Connection-I218-LM -I was told there is massive ping loss. - -This commit adds support for a new flag which can be set by an ethernet -driver to fixup PHY setup. - -Signed-off-by: Rafał Miłecki -Signed-off-by: David S. Miller ---- - drivers/net/phy/broadcom.c | 6 ++++++ - include/linux/brcmphy.h | 1 + - 2 files changed, 7 insertions(+) - ---- a/drivers/net/phy/broadcom.c -+++ b/drivers/net/phy/broadcom.c -@@ -43,6 +43,12 @@ static int bcm54210e_config_init(struct - val &= ~BCM54810_SHD_CLK_CTL_GTXCLK_EN; - bcm_phy_write_shadow(phydev, BCM54810_SHD_CLK_CTL, val); - -+ if (phydev->dev_flags & PHY_BRCM_EN_MASTER_MODE) { -+ val = phy_read(phydev, MII_CTRL1000); -+ val |= CTL1000_AS_MASTER | CTL1000_ENABLE_MASTER; -+ phy_write(phydev, MII_CTRL1000, val); -+ } -+ - return 0; - } - ---- a/include/linux/brcmphy.h -+++ b/include/linux/brcmphy.h -@@ -59,6 +59,7 @@ - #define PHY_BRCM_EXT_IBND_TX_ENABLE 0x00002000 - #define PHY_BRCM_CLEAR_RGMII_MODE 0x00004000 - #define PHY_BRCM_DIS_TXCRXC_NOENRGY 0x00008000 -+#define PHY_BRCM_EN_MASTER_MODE 0x00010000 - - /* Broadcom BCM7xxx specific workarounds */ - #define PHY_BRCM_7XXX_REV(x) (((x) >> 8) & 0xff) diff --git a/target/linux/generic/backport-4.9/080-0001-leds-core-add-OF-variants-of-LED-registering-functio.patch b/target/linux/generic/backport-4.9/080-0001-leds-core-add-OF-variants-of-LED-registering-functio.patch deleted file mode 100644 index 5b1b307aec..0000000000 --- a/target/linux/generic/backport-4.9/080-0001-leds-core-add-OF-variants-of-LED-registering-functio.patch +++ /dev/null @@ -1,120 +0,0 @@ -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= -Date: Mon, 6 Mar 2017 06:19:44 +0100 -Subject: [PATCH] leds: core: add OF variants of LED registering functions -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -These new functions allow passing an additional device_node argument -that will be internally set for created LED device. Thanks to this LED -core code and triggers will be able to access DT node for reading extra -info. - -The easiest solution for achieving this was reworking old functions to -more generic ones & adding simple defines for API compatibility. - -Signed-off-by: Rafał Miłecki -Acked-by: Pavel Machek -Signed-off-by: Jacek Anaszewski ---- - drivers/leds/led-class.c | 26 ++++++++++++++++---------- - include/linux/leds.h | 14 ++++++++++---- - 2 files changed, 26 insertions(+), 14 deletions(-) - ---- a/drivers/leds/led-class.c -+++ b/drivers/leds/led-class.c -@@ -181,11 +181,14 @@ static int led_classdev_next_name(const - } - - /** -- * led_classdev_register - register a new object of led_classdev class. -- * @parent: The device to register. -+ * of_led_classdev_register - register a new object of led_classdev class. -+ * -+ * @parent: parent of LED device - * @led_cdev: the led_classdev structure for this device. -+ * @np: DT node describing this LED - */ --int led_classdev_register(struct device *parent, struct led_classdev *led_cdev) -+int of_led_classdev_register(struct device *parent, struct device_node *np, -+ struct led_classdev *led_cdev) - { - char name[64]; - int ret; -@@ -198,6 +201,7 @@ int led_classdev_register(struct device - led_cdev, led_cdev->groups, "%s", name); - if (IS_ERR(led_cdev->dev)) - return PTR_ERR(led_cdev->dev); -+ led_cdev->dev->of_node = np; - - if (ret) - dev_warn(parent, "Led %s renamed to %s due to name collision", -@@ -228,7 +232,7 @@ int led_classdev_register(struct device - - return 0; - } --EXPORT_SYMBOL_GPL(led_classdev_register); -+EXPORT_SYMBOL_GPL(of_led_classdev_register); - - /** - * led_classdev_unregister - unregisters a object of led_properties class. -@@ -270,12 +274,14 @@ static void devm_led_classdev_release(st - } - - /** -- * devm_led_classdev_register - resource managed led_classdev_register() -- * @parent: The device to register. -+ * devm_of_led_classdev_register - resource managed led_classdev_register() -+ * -+ * @parent: parent of LED device - * @led_cdev: the led_classdev structure for this device. - */ --int devm_led_classdev_register(struct device *parent, -- struct led_classdev *led_cdev) -+int devm_of_led_classdev_register(struct device *parent, -+ struct device_node *np, -+ struct led_classdev *led_cdev) - { - struct led_classdev **dr; - int rc; -@@ -284,7 +290,7 @@ int devm_led_classdev_register(struct de - if (!dr) - return -ENOMEM; - -- rc = led_classdev_register(parent, led_cdev); -+ rc = of_led_classdev_register(parent, np, led_cdev); - if (rc) { - devres_free(dr); - return rc; -@@ -295,7 +301,7 @@ int devm_led_classdev_register(struct de - - return 0; - } --EXPORT_SYMBOL_GPL(devm_led_classdev_register); -+EXPORT_SYMBOL_GPL(devm_of_led_classdev_register); - - static int devm_led_classdev_match(struct device *dev, void *res, void *data) - { ---- a/include/linux/leds.h -+++ b/include/linux/leds.h -@@ -109,10 +109,16 @@ struct led_classdev { - struct mutex led_access; - }; - --extern int led_classdev_register(struct device *parent, -- struct led_classdev *led_cdev); --extern int devm_led_classdev_register(struct device *parent, -- struct led_classdev *led_cdev); -+extern int of_led_classdev_register(struct device *parent, -+ struct device_node *np, -+ struct led_classdev *led_cdev); -+#define led_classdev_register(parent, led_cdev) \ -+ of_led_classdev_register(parent, NULL, led_cdev) -+extern int devm_of_led_classdev_register(struct device *parent, -+ struct device_node *np, -+ struct led_classdev *led_cdev); -+#define devm_led_classdev_register(parent, led_cdev) \ -+ devm_of_led_classdev_register(parent, NULL, led_cdev) - extern void led_classdev_unregister(struct led_classdev *led_cdev); - extern void devm_led_classdev_unregister(struct device *parent, - struct led_classdev *led_cdev); diff --git a/target/linux/generic/backport-4.9/080-0002-leds-gpio-use-OF-variant-of-LED-registering-function.patch b/target/linux/generic/backport-4.9/080-0002-leds-gpio-use-OF-variant-of-LED-registering-function.patch deleted file mode 100644 index 0247fffb2a..0000000000 --- a/target/linux/generic/backport-4.9/080-0002-leds-gpio-use-OF-variant-of-LED-registering-function.patch +++ /dev/null @@ -1,60 +0,0 @@ -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= -Date: Mon, 6 Mar 2017 06:19:45 +0100 -Subject: [PATCH] leds: gpio: use OF variant of LED registering function -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -In leds-gpio we support LEDs specified in DT so we should use -(devm_)of_led_classdev_register. This allows passing DT node as argument -for use by the LED subsystem. - -Signed-off-by: Rafał Miłecki -Acked-by: Pavel Machek -Signed-off-by: Jacek Anaszewski ---- - drivers/leds/leds-gpio.c | 12 ++++++------ - 1 file changed, 6 insertions(+), 6 deletions(-) - ---- a/drivers/leds/leds-gpio.c -+++ b/drivers/leds/leds-gpio.c -@@ -77,7 +77,7 @@ static int gpio_blink_set(struct led_cla - - static int create_gpio_led(const struct gpio_led *template, - struct gpio_led_data *led_dat, struct device *parent, -- gpio_blink_set_t blink_set) -+ struct device_node *np, gpio_blink_set_t blink_set) - { - int ret, state; - -@@ -139,7 +139,7 @@ static int create_gpio_led(const struct - if (ret < 0) - return ret; - -- return devm_led_classdev_register(parent, &led_dat->cdev); -+ return devm_of_led_classdev_register(parent, np, &led_dat->cdev); - } - - struct gpio_leds_priv { -@@ -206,7 +206,7 @@ static struct gpio_leds_priv *gpio_leds_ - if (fwnode_property_present(child, "panic-indicator")) - led.panic_indicator = 1; - -- ret = create_gpio_led(&led, led_dat, dev, NULL); -+ ret = create_gpio_led(&led, led_dat, dev, np, NULL); - if (ret < 0) { - fwnode_handle_put(child); - return ERR_PTR(ret); -@@ -240,9 +240,9 @@ static int gpio_led_probe(struct platfor - - priv->num_leds = pdata->num_leds; - for (i = 0; i < priv->num_leds; i++) { -- ret = create_gpio_led(&pdata->leds[i], -- &priv->leds[i], -- &pdev->dev, pdata->gpio_blink_set); -+ ret = create_gpio_led(&pdata->leds[i], &priv->leds[i], -+ &pdev->dev, NULL, -+ pdata->gpio_blink_set); - if (ret < 0) - return ret; - } diff --git a/target/linux/generic/backport-4.9/081-0001-thermal-bcm2835-add-thermal-driver-for-bcm2835-SoC.patch b/target/linux/generic/backport-4.9/081-0001-thermal-bcm2835-add-thermal-driver-for-bcm2835-SoC.patch deleted file mode 100644 index d1ef21ed0a..0000000000 --- a/target/linux/generic/backport-4.9/081-0001-thermal-bcm2835-add-thermal-driver-for-bcm2835-SoC.patch +++ /dev/null @@ -1,365 +0,0 @@ -From bcb7dd9ef206f7d646ed8dac6fe7772083714253 Mon Sep 17 00:00:00 2001 -From: Stefan Wahren -Date: Fri, 31 Mar 2017 20:03:06 +0000 -Subject: [PATCH] thermal: bcm2835: add thermal driver for bcm2835 SoC -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Add basic thermal driver for bcm2835 SoC. - -This driver currently make sure that tsense HW block is set up -correctly. - -Tested-by: Rafał Miłecki -Signed-off-by: Martin Sperl -Signed-off-by: Stefan Wahren -Acked-by: Eric Anholt -Acked-by: Eduardo Valentin -Signed-off-by: Eduardo Valentin ---- - drivers/thermal/Kconfig | 8 + - drivers/thermal/Makefile | 1 + - drivers/thermal/bcm2835_thermal.c | 314 ++++++++++++++++++++++++++++++++++++++ - 3 files changed, 323 insertions(+) - create mode 100644 drivers/thermal/bcm2835_thermal.c - ---- a/drivers/thermal/Kconfig -+++ b/drivers/thermal/Kconfig -@@ -434,4 +434,12 @@ depends on (ARCH_QCOM && OF) || COMPILE_ - source "drivers/thermal/qcom/Kconfig" - endmenu - -+config BCM2835_THERMAL -+ tristate "Thermal sensors on bcm2835 SoC" -+ depends on ARCH_BCM2835 || COMPILE_TEST -+ depends on HAS_IOMEM -+ depends on THERMAL_OF -+ help -+ Support for thermal sensors on Broadcom bcm2835 SoCs. -+ - endif ---- a/drivers/thermal/Makefile -+++ b/drivers/thermal/Makefile -@@ -55,3 +55,4 @@ obj-$(CONFIG_TEGRA_SOCTHERM) += tegra/ - obj-$(CONFIG_HISI_THERMAL) += hisi_thermal.o - obj-$(CONFIG_MTK_THERMAL) += mtk_thermal.o - obj-$(CONFIG_GENERIC_ADC_THERMAL) += thermal-generic-adc.o -+obj-$(CONFIG_BCM2835_THERMAL) += bcm2835_thermal.o ---- /dev/null -+++ b/drivers/thermal/bcm2835_thermal.c -@@ -0,0 +1,314 @@ -+/* -+ * Driver for Broadcom BCM2835 SoC temperature sensor -+ * -+ * Copyright (C) 2016 Martin Sperl -+ * -+ * 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 -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+#define BCM2835_TS_TSENSCTL 0x00 -+#define BCM2835_TS_TSENSSTAT 0x04 -+ -+#define BCM2835_TS_TSENSCTL_PRWDW BIT(0) -+#define BCM2835_TS_TSENSCTL_RSTB BIT(1) -+ -+/* -+ * bandgap reference voltage in 6 mV increments -+ * 000b = 1178 mV, 001b = 1184 mV, ... 111b = 1220 mV -+ */ -+#define BCM2835_TS_TSENSCTL_CTRL_BITS 3 -+#define BCM2835_TS_TSENSCTL_CTRL_SHIFT 2 -+#define BCM2835_TS_TSENSCTL_CTRL_MASK \ -+ GENMASK(BCM2835_TS_TSENSCTL_CTRL_BITS + \ -+ BCM2835_TS_TSENSCTL_CTRL_SHIFT - 1, \ -+ BCM2835_TS_TSENSCTL_CTRL_SHIFT) -+#define BCM2835_TS_TSENSCTL_CTRL_DEFAULT 1 -+#define BCM2835_TS_TSENSCTL_EN_INT BIT(5) -+#define BCM2835_TS_TSENSCTL_DIRECT BIT(6) -+#define BCM2835_TS_TSENSCTL_CLR_INT BIT(7) -+#define BCM2835_TS_TSENSCTL_THOLD_SHIFT 8 -+#define BCM2835_TS_TSENSCTL_THOLD_BITS 10 -+#define BCM2835_TS_TSENSCTL_THOLD_MASK \ -+ GENMASK(BCM2835_TS_TSENSCTL_THOLD_BITS + \ -+ BCM2835_TS_TSENSCTL_THOLD_SHIFT - 1, \ -+ BCM2835_TS_TSENSCTL_THOLD_SHIFT) -+/* -+ * time how long the block to be asserted in reset -+ * which based on a clock counter (TSENS clock assumed) -+ */ -+#define BCM2835_TS_TSENSCTL_RSTDELAY_SHIFT 18 -+#define BCM2835_TS_TSENSCTL_RSTDELAY_BITS 8 -+#define BCM2835_TS_TSENSCTL_REGULEN BIT(26) -+ -+#define BCM2835_TS_TSENSSTAT_DATA_BITS 10 -+#define BCM2835_TS_TSENSSTAT_DATA_SHIFT 0 -+#define BCM2835_TS_TSENSSTAT_DATA_MASK \ -+ GENMASK(BCM2835_TS_TSENSSTAT_DATA_BITS + \ -+ BCM2835_TS_TSENSSTAT_DATA_SHIFT - 1, \ -+ BCM2835_TS_TSENSSTAT_DATA_SHIFT) -+#define BCM2835_TS_TSENSSTAT_VALID BIT(10) -+#define BCM2835_TS_TSENSSTAT_INTERRUPT BIT(11) -+ -+struct bcm2835_thermal_data { -+ struct thermal_zone_device *tz; -+ void __iomem *regs; -+ struct clk *clk; -+ struct dentry *debugfsdir; -+}; -+ -+static int bcm2835_thermal_adc2temp(u32 adc, int offset, int slope) -+{ -+ return offset + slope * adc; -+} -+ -+static int bcm2835_thermal_temp2adc(int temp, int offset, int slope) -+{ -+ temp -= offset; -+ temp /= slope; -+ -+ if (temp < 0) -+ temp = 0; -+ if (temp >= BIT(BCM2835_TS_TSENSSTAT_DATA_BITS)) -+ temp = BIT(BCM2835_TS_TSENSSTAT_DATA_BITS) - 1; -+ -+ return temp; -+} -+ -+static int bcm2835_thermal_get_temp(void *d, int *temp) -+{ -+ struct bcm2835_thermal_data *data = d; -+ u32 val = readl(data->regs + BCM2835_TS_TSENSSTAT); -+ -+ if (!(val & BCM2835_TS_TSENSSTAT_VALID)) -+ return -EIO; -+ -+ val &= BCM2835_TS_TSENSSTAT_DATA_MASK; -+ -+ *temp = bcm2835_thermal_adc2temp( -+ val, -+ thermal_zone_get_offset(data->tz), -+ thermal_zone_get_slope(data->tz)); -+ -+ return 0; -+} -+ -+static const struct debugfs_reg32 bcm2835_thermal_regs[] = { -+ { -+ .name = "ctl", -+ .offset = 0 -+ }, -+ { -+ .name = "stat", -+ .offset = 4 -+ } -+}; -+ -+static void bcm2835_thermal_debugfs(struct platform_device *pdev) -+{ -+ struct thermal_zone_device *tz = platform_get_drvdata(pdev); -+ struct bcm2835_thermal_data *data = tz->devdata; -+ struct debugfs_regset32 *regset; -+ -+ data->debugfsdir = debugfs_create_dir("bcm2835_thermal", NULL); -+ if (!data->debugfsdir) -+ return; -+ -+ regset = devm_kzalloc(&pdev->dev, sizeof(*regset), GFP_KERNEL); -+ if (!regset) -+ return; -+ -+ regset->regs = bcm2835_thermal_regs; -+ regset->nregs = ARRAY_SIZE(bcm2835_thermal_regs); -+ regset->base = data->regs; -+ -+ debugfs_create_regset32("regset", 0444, data->debugfsdir, regset); -+} -+ -+static struct thermal_zone_of_device_ops bcm2835_thermal_ops = { -+ .get_temp = bcm2835_thermal_get_temp, -+}; -+ -+/* -+ * Note: as per Raspberry Foundation FAQ -+ * (https://www.raspberrypi.org/help/faqs/#performanceOperatingTemperature) -+ * the recommended temperature range for the SoC -40C to +85C -+ * so the trip limit is set to 80C. -+ * this applies to all the BCM283X SoC -+ */ -+ -+static const struct of_device_id bcm2835_thermal_of_match_table[] = { -+ { -+ .compatible = "brcm,bcm2835-thermal", -+ }, -+ { -+ .compatible = "brcm,bcm2836-thermal", -+ }, -+ { -+ .compatible = "brcm,bcm2837-thermal", -+ }, -+ {}, -+}; -+MODULE_DEVICE_TABLE(of, bcm2835_thermal_of_match_table); -+ -+static int bcm2835_thermal_probe(struct platform_device *pdev) -+{ -+ const struct of_device_id *match; -+ struct thermal_zone_device *tz; -+ struct bcm2835_thermal_data *data; -+ struct resource *res; -+ int err = 0; -+ u32 val; -+ unsigned long rate; -+ -+ data = devm_kzalloc(&pdev->dev, sizeof(*data), GFP_KERNEL); -+ if (!data) -+ return -ENOMEM; -+ -+ match = of_match_device(bcm2835_thermal_of_match_table, -+ &pdev->dev); -+ if (!match) -+ return -EINVAL; -+ -+ res = platform_get_resource(pdev, IORESOURCE_MEM, 0); -+ data->regs = devm_ioremap_resource(&pdev->dev, res); -+ if (IS_ERR(data->regs)) { -+ err = PTR_ERR(data->regs); -+ dev_err(&pdev->dev, "Could not get registers: %d\n", err); -+ return err; -+ } -+ -+ data->clk = devm_clk_get(&pdev->dev, NULL); -+ if (IS_ERR(data->clk)) { -+ err = PTR_ERR(data->clk); -+ if (err != -EPROBE_DEFER) -+ dev_err(&pdev->dev, "Could not get clk: %d\n", err); -+ return err; -+ } -+ -+ err = clk_prepare_enable(data->clk); -+ if (err) -+ return err; -+ -+ rate = clk_get_rate(data->clk); -+ if ((rate < 1920000) || (rate > 5000000)) -+ dev_warn(&pdev->dev, -+ "Clock %pCn running at %pCr Hz is outside of the recommended range: 1.92 to 5MHz\n", -+ data->clk, data->clk); -+ -+ /* register of thermal sensor and get info from DT */ -+ tz = thermal_zone_of_sensor_register(&pdev->dev, 0, data, -+ &bcm2835_thermal_ops); -+ if (IS_ERR(tz)) { -+ err = PTR_ERR(tz); -+ dev_err(&pdev->dev, -+ "Failed to register the thermal device: %d\n", -+ err); -+ goto err_clk; -+ } -+ -+ /* -+ * right now the FW does set up the HW-block, so we are not -+ * touching the configuration registers. -+ * But if the HW is not enabled, then set it up -+ * using "sane" values used by the firmware right now. -+ */ -+ val = readl(data->regs + BCM2835_TS_TSENSCTL); -+ if (!(val & BCM2835_TS_TSENSCTL_RSTB)) { -+ int trip_temp, offset, slope; -+ -+ slope = thermal_zone_get_slope(tz); -+ offset = thermal_zone_get_offset(tz); -+ /* -+ * For now we deal only with critical, otherwise -+ * would need to iterate -+ */ -+ err = tz->ops->get_trip_temp(tz, 0, &trip_temp); -+ if (err < 0) { -+ err = PTR_ERR(tz); -+ dev_err(&pdev->dev, -+ "Not able to read trip_temp: %d\n", -+ err); -+ goto err_tz; -+ } -+ -+ /* set bandgap reference voltage and enable voltage regulator */ -+ val = (BCM2835_TS_TSENSCTL_CTRL_DEFAULT << -+ BCM2835_TS_TSENSCTL_CTRL_SHIFT) | -+ BCM2835_TS_TSENSCTL_REGULEN; -+ -+ /* use the recommended reset duration */ -+ val |= (0xFE << BCM2835_TS_TSENSCTL_RSTDELAY_SHIFT); -+ -+ /* trip_adc value from info */ -+ val |= bcm2835_thermal_temp2adc(trip_temp, -+ offset, -+ slope) -+ << BCM2835_TS_TSENSCTL_THOLD_SHIFT; -+ -+ /* write the value back to the register as 2 steps */ -+ writel(val, data->regs + BCM2835_TS_TSENSCTL); -+ val |= BCM2835_TS_TSENSCTL_RSTB; -+ writel(val, data->regs + BCM2835_TS_TSENSCTL); -+ } -+ -+ data->tz = tz; -+ -+ platform_set_drvdata(pdev, tz); -+ -+ bcm2835_thermal_debugfs(pdev); -+ -+ return 0; -+err_tz: -+ thermal_zone_of_sensor_unregister(&pdev->dev, tz); -+err_clk: -+ clk_disable_unprepare(data->clk); -+ -+ return err; -+} -+ -+static int bcm2835_thermal_remove(struct platform_device *pdev) -+{ -+ struct thermal_zone_device *tz = platform_get_drvdata(pdev); -+ struct bcm2835_thermal_data *data = tz->devdata; -+ -+ debugfs_remove_recursive(data->debugfsdir); -+ thermal_zone_of_sensor_unregister(&pdev->dev, tz); -+ clk_disable_unprepare(data->clk); -+ -+ return 0; -+} -+ -+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("Martin Sperl"); -+MODULE_DESCRIPTION("Thermal driver for bcm2835 chip"); -+MODULE_LICENSE("GPL"); diff --git a/target/linux/generic/backport-4.9/081-0002-thermal-broadcom-add-Northstar-thermal-driver.patch b/target/linux/generic/backport-4.9/081-0002-thermal-broadcom-add-Northstar-thermal-driver.patch deleted file mode 100644 index 8ba8cb57eb..0000000000 --- a/target/linux/generic/backport-4.9/081-0002-thermal-broadcom-add-Northstar-thermal-driver.patch +++ /dev/null @@ -1,173 +0,0 @@ -From a94cb7eeecc4104a6874339f90c5d0647359c102 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= -Date: Mon, 3 Apr 2017 17:48:29 +0200 -Subject: [PATCH] thermal: broadcom: add Northstar thermal driver -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Northstar is a SoC family commonly used in home routers. This commit -adds a driver for checking CPU temperature. As Northstar Plus seems to -also have this IP block this new symbol gets ARCH_BCM_IPROC dependency. - -Signed-off-by: Rafał Miłecki -Signed-off-by: Jon Mason -Signed-off-by: Eduardo Valentin ---- - drivers/thermal/Kconfig | 5 ++ - drivers/thermal/Makefile | 1 + - drivers/thermal/broadcom/Kconfig | 8 +++ - drivers/thermal/broadcom/Makefile | 1 + - drivers/thermal/broadcom/ns-thermal.c | 105 ++++++++++++++++++++++++++++++++++ - 5 files changed, 120 insertions(+) - create mode 100644 drivers/thermal/broadcom/Kconfig - create mode 100644 drivers/thermal/broadcom/Makefile - create mode 100644 drivers/thermal/broadcom/ns-thermal.c - ---- a/drivers/thermal/Kconfig -+++ b/drivers/thermal/Kconfig -@@ -381,6 +381,11 @@ config MTK_THERMAL - Enable this option if you want to have support for thermal management - controller present in Mediatek SoCs - -+menu "Broadcom thermal drivers" -+depends on ARCH_BCM || COMPILE_TEST -+source "drivers/thermal/broadcom/Kconfig" -+endmenu -+ - menu "Texas Instruments thermal drivers" - depends on ARCH_HAS_BANDGAP || COMPILE_TEST - depends on HAS_IOMEM ---- a/drivers/thermal/Makefile -+++ b/drivers/thermal/Makefile -@@ -26,6 +26,7 @@ thermal_sys-$(CONFIG_CLOCK_THERMAL) += c - thermal_sys-$(CONFIG_DEVFREQ_THERMAL) += devfreq_cooling.o - - # platform thermal drivers -+obj-y += broadcom/ - obj-$(CONFIG_QCOM_SPMI_TEMP_ALARM) += qcom-spmi-temp-alarm.o - obj-$(CONFIG_SPEAR_THERMAL) += spear_thermal.o - obj-$(CONFIG_ROCKCHIP_THERMAL) += rockchip_thermal.o ---- /dev/null -+++ b/drivers/thermal/broadcom/Kconfig -@@ -0,0 +1,8 @@ -+config BCM_NS_THERMAL -+ tristate "Northstar thermal driver" -+ depends on ARCH_BCM_IPROC || COMPILE_TEST -+ help -+ Northstar is a family of SoCs that includes e.g. BCM4708, BCM47081, -+ BCM4709 and BCM47094. It contains DMU (Device Management Unit) block -+ with a thermal sensor that allows checking CPU temperature. This -+ driver provides support for it. ---- /dev/null -+++ b/drivers/thermal/broadcom/Makefile -@@ -0,0 +1 @@ -+obj-$(CONFIG_BCM_NS_THERMAL) += ns-thermal.o ---- /dev/null -+++ b/drivers/thermal/broadcom/ns-thermal.c -@@ -0,0 +1,105 @@ -+/* -+ * Copyright (C) 2017 Rafał Miłecki -+ * -+ * 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 -+#include -+#include -+#include -+ -+#define PVTMON_CONTROL0 0x00 -+#define PVTMON_CONTROL0_SEL_MASK 0x0000000e -+#define PVTMON_CONTROL0_SEL_TEMP_MONITOR 0x00000000 -+#define PVTMON_CONTROL0_SEL_TEST_MODE 0x0000000e -+#define PVTMON_STATUS 0x08 -+ -+struct ns_thermal { -+ struct thermal_zone_device *tz; -+ void __iomem *pvtmon; -+}; -+ -+static int ns_thermal_get_temp(void *data, int *temp) -+{ -+ struct ns_thermal *ns_thermal = data; -+ int offset = thermal_zone_get_offset(ns_thermal->tz); -+ int slope = thermal_zone_get_slope(ns_thermal->tz); -+ u32 val; -+ -+ val = readl(ns_thermal->pvtmon + PVTMON_CONTROL0); -+ if ((val & PVTMON_CONTROL0_SEL_MASK) != PVTMON_CONTROL0_SEL_TEMP_MONITOR) { -+ /* Clear current mode selection */ -+ val &= ~PVTMON_CONTROL0_SEL_MASK; -+ -+ /* Set temp monitor mode (it's the default actually) */ -+ val |= PVTMON_CONTROL0_SEL_TEMP_MONITOR; -+ -+ writel(val, ns_thermal->pvtmon + PVTMON_CONTROL0); -+ } -+ -+ val = readl(ns_thermal->pvtmon + PVTMON_STATUS); -+ *temp = slope * val + offset; -+ -+ return 0; -+} -+ -+static const struct thermal_zone_of_device_ops ns_thermal_ops = { -+ .get_temp = ns_thermal_get_temp, -+}; -+ -+static int ns_thermal_probe(struct platform_device *pdev) -+{ -+ struct device *dev = &pdev->dev; -+ struct ns_thermal *ns_thermal; -+ -+ ns_thermal = devm_kzalloc(dev, sizeof(*ns_thermal), GFP_KERNEL); -+ if (!ns_thermal) -+ return -ENOMEM; -+ -+ ns_thermal->pvtmon = of_iomap(dev_of_node(dev), 0); -+ if (WARN_ON(!ns_thermal->pvtmon)) -+ return -ENOENT; -+ -+ ns_thermal->tz = devm_thermal_zone_of_sensor_register(dev, 0, -+ ns_thermal, -+ &ns_thermal_ops); -+ if (IS_ERR(ns_thermal->tz)) { -+ iounmap(ns_thermal->pvtmon); -+ return PTR_ERR(ns_thermal->tz); -+ } -+ -+ platform_set_drvdata(pdev, ns_thermal); -+ -+ return 0; -+} -+ -+static int ns_thermal_remove(struct platform_device *pdev) -+{ -+ struct ns_thermal *ns_thermal = platform_get_drvdata(pdev); -+ -+ iounmap(ns_thermal->pvtmon); -+ -+ return 0; -+} -+ -+static const struct of_device_id ns_thermal_of_match[] = { -+ { .compatible = "brcm,ns-thermal", }, -+ {}, -+}; -+MODULE_DEVICE_TABLE(of, ns_thermal_of_match); -+ -+static struct platform_driver ns_thermal_driver = { -+ .probe = ns_thermal_probe, -+ .remove = ns_thermal_remove, -+ .driver = { -+ .name = "ns-thermal", -+ .of_match_table = ns_thermal_of_match, -+ }, -+}; -+module_platform_driver(ns_thermal_driver); -+ -+MODULE_DESCRIPTION("Northstar thermal driver"); -+MODULE_LICENSE("GPL v2"); diff --git a/target/linux/generic/backport-4.9/082-0001-usb-core-read-USB-ports-from-DT-in-the-usbport-LED-t.patch b/target/linux/generic/backport-4.9/082-0001-usb-core-read-USB-ports-from-DT-in-the-usbport-LED-t.patch deleted file mode 100644 index 65d17c8a9e..0000000000 --- a/target/linux/generic/backport-4.9/082-0001-usb-core-read-USB-ports-from-DT-in-the-usbport-LED-t.patch +++ /dev/null @@ -1,106 +0,0 @@ -From 4f04c210d031667e503d6538a72345a36f3b5d71 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= -Date: Thu, 8 Jun 2017 18:08:32 +0200 -Subject: [PATCH] usb: core: read USB ports from DT in the usbport LED trigger - driver -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -This uses DT info to read relation description of LEDs and USB ports. If -DT has properly described LEDs, trigger will know when to turn them on. - -Signed-off-by: Rafał Miłecki -Signed-off-by: Greg Kroah-Hartman ---- - drivers/usb/core/ledtrig-usbport.c | 56 ++++++++++++++++++++++++++++++++++++++ - 1 file changed, 56 insertions(+) - ---- a/drivers/usb/core/ledtrig-usbport.c -+++ b/drivers/usb/core/ledtrig-usbport.c -@@ -11,8 +11,10 @@ - #include - #include - #include -+#include - #include - #include -+#include - - struct usbport_trig_data { - struct led_classdev *led_cdev; -@@ -123,6 +125,57 @@ static const struct attribute_group port - * Adding & removing ports - ***************************************/ - -+/** -+ * usbport_trig_port_observed - Check if port should be observed -+ */ -+static bool usbport_trig_port_observed(struct usbport_trig_data *usbport_data, -+ struct usb_device *usb_dev, int port1) -+{ -+ struct device *dev = usbport_data->led_cdev->dev; -+ struct device_node *led_np = dev->of_node; -+ struct of_phandle_args args; -+ struct device_node *port_np; -+ int count, i; -+ -+ if (!led_np) -+ return false; -+ -+ /* Get node of port being added */ -+ port_np = usb_of_get_child_node(usb_dev->dev.of_node, port1); -+ if (!port_np) -+ return false; -+ -+ /* Amount of trigger sources for this LED */ -+ count = of_count_phandle_with_args(led_np, "trigger-sources", -+ "#trigger-source-cells"); -+ if (count < 0) { -+ dev_warn(dev, "Failed to get trigger sources for %s\n", -+ led_np->full_name); -+ return false; -+ } -+ -+ /* Check list of sources for this specific port */ -+ for (i = 0; i < count; i++) { -+ int err; -+ -+ err = of_parse_phandle_with_args(led_np, "trigger-sources", -+ "#trigger-source-cells", i, -+ &args); -+ if (err) { -+ dev_err(dev, "Failed to get trigger source phandle at index %d: %d\n", -+ i, err); -+ continue; -+ } -+ -+ of_node_put(args.np); -+ -+ if (args.np == port_np) -+ return true; -+ } -+ -+ return false; -+} -+ - static int usbport_trig_add_port(struct usbport_trig_data *usbport_data, - struct usb_device *usb_dev, - const char *hub_name, int portnum) -@@ -141,6 +194,8 @@ static int usbport_trig_add_port(struct - port->data = usbport_data; - port->hub = usb_dev; - port->portnum = portnum; -+ port->observed = usbport_trig_port_observed(usbport_data, usb_dev, -+ portnum); - - len = strlen(hub_name) + 8; - port->port_name = kzalloc(len, GFP_KERNEL); -@@ -255,6 +310,7 @@ static void usbport_trig_activate(struct - if (err) - goto err_free; - usb_for_each_dev(usbport_data, usbport_trig_add_usb_dev_ports); -+ usbport_trig_update_count(usbport_data); - - /* Notifications */ - usbport_data->nb.notifier_call = usbport_trig_notify, diff --git a/target/linux/generic/backport-4.9/085-v4.16-0001-i2c-gpio-Enable-working-over-slow-can_sleep-GPIOs.patch b/target/linux/generic/backport-4.9/085-v4.16-0001-i2c-gpio-Enable-working-over-slow-can_sleep-GPIOs.patch deleted file mode 100644 index ead6675e0b..0000000000 --- a/target/linux/generic/backport-4.9/085-v4.16-0001-i2c-gpio-Enable-working-over-slow-can_sleep-GPIOs.patch +++ /dev/null @@ -1,84 +0,0 @@ -From f11a04464ae57e8db1bb7634547842b43e36a898 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Jan=20Kundr=C3=A1t?= -Date: Fri, 22 Dec 2017 22:47:16 +0100 -Subject: i2c: gpio: Enable working over slow can_sleep GPIOs -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -"Slow" GPIOs (usually those connected over an SPI or an I2C bus) are, -well, slow in their operation. It is generally a good idea to avoid -using them for time-critical operation, but sometimes the hardware just -sucks, and the software has to cope. In addition to that, the I2C bus -itself does not actually define any strict timing limits; the bus is -free to go all the way down to DC. The timeouts (and therefore the -slowest acceptable frequency) are present only in SMBus. - -The `can_sleep` is IMHO a wrong concept to use here. My SPI-to-quad-UART -chip (MAX14830) is connected via a 26MHz SPI bus, and it happily drives -SCL at 200kHz (5µs pulses) during my benchmarks. That's faster than the -maximal allowed speed of the traditional I2C. - -The previous version of this code did not really block operation over -slow GPIO pins, anyway. Instead, it just resorted to printing a warning -with a backtrace each time a GPIO pin was accessed, thereby slowing -things down even more. - -Finally, it's not just me. A similar patch was originally submitted in -2015 [1]. - -[1] https://patchwork.ozlabs.org/patch/450956/ - -Signed-off-by: Jan Kundrát -Acked-by: Uwe Kleine-König -Signed-off-by: Wolfram Sang ---- - drivers/i2c/busses/i2c-gpio.c | 11 +++++++---- - 1 file changed, 7 insertions(+), 4 deletions(-) - ---- a/drivers/i2c/busses/i2c-gpio.c -+++ b/drivers/i2c/busses/i2c-gpio.c -@@ -44,7 +44,7 @@ static void i2c_gpio_setsda_val(void *da - { - struct i2c_gpio_platform_data *pdata = data; - -- gpio_set_value(pdata->sda_pin, state); -+ gpio_set_value_cansleep(pdata->sda_pin, state); - } - - /* Toggle SCL by changing the direction of the pin. */ -@@ -68,21 +68,21 @@ static void i2c_gpio_setscl_val(void *da - { - struct i2c_gpio_platform_data *pdata = data; - -- gpio_set_value(pdata->scl_pin, state); -+ gpio_set_value_cansleep(pdata->scl_pin, state); - } - - static int i2c_gpio_getsda(void *data) - { - struct i2c_gpio_platform_data *pdata = data; - -- return gpio_get_value(pdata->sda_pin); -+ return gpio_get_value_cansleep(pdata->sda_pin); - } - - static int i2c_gpio_getscl(void *data) - { - struct i2c_gpio_platform_data *pdata = data; - -- return gpio_get_value(pdata->scl_pin); -+ return gpio_get_value_cansleep(pdata->scl_pin); - } - - static int of_i2c_gpio_get_pins(struct device_node *np, -@@ -175,6 +175,9 @@ static int i2c_gpio_probe(struct platfor - memcpy(pdata, dev_get_platdata(&pdev->dev), sizeof(*pdata)); - } - -+ if (gpiod_cansleep(gpio_to_desc(pdata->sda_pin)) || gpiod_cansleep(gpio_to_desc(pdata->scl_pin))) -+ dev_warn(&pdev->dev, "Slow GPIO pins might wreak havoc into I2C/SMBus bus timing"); -+ - if (pdata->sda_is_open_drain) { - gpio_direction_output(pdata->sda_pin, 1); - bit_data->setsda = i2c_gpio_setsda_val; diff --git a/target/linux/generic/backport-4.9/087-regmap-make-LZO-cache-optional.patch b/target/linux/generic/backport-4.9/087-regmap-make-LZO-cache-optional.patch deleted file mode 100644 index c26994ee35..0000000000 --- a/target/linux/generic/backport-4.9/087-regmap-make-LZO-cache-optional.patch +++ /dev/null @@ -1,69 +0,0 @@ -From de88e9b0354c2e3ff8eae3f97afe43a34f5ed239 Mon Sep 17 00:00:00 2001 -From: Jonas Gorski -Date: Sat, 13 May 2017 13:03:21 +0200 -Subject: [PATCH] regmap: make LZO cache optional - -Commit 2cbbb579bcbe3 ("regmap: Add the LZO cache support") added support -for LZO compression in regcache, but there were never any users added -afterwards. Since LZO support itself has its own size, it currently is -rather a deoptimization. - -So make it optional by introducing a symbol that can be selected by -drivers wanting to make use of it. - -Saves e.g. ~46 kB on MIPS (size of LZO support + regcache LZO code). - -Signed-off-by: Jonas Gorski ---- -I tried using google to find any users (even out-of-tree ones), but at -best I found a single driver submission that was switched to RBTREE in -subsequent resubmissions (MFD_SMSC). - -One could maybe also just drop the code because of no users for 5 years, -but that would be up to the maintainer(s) to decide. - - drivers/base/regmap/Kconfig | 5 ++++- - drivers/base/regmap/Makefile | 3 ++- - drivers/base/regmap/regcache.c | 2 ++ - 3 files changed, 8 insertions(+), 2 deletions(-) - ---- a/drivers/base/regmap/Kconfig -+++ b/drivers/base/regmap/Kconfig -@@ -4,9 +4,12 @@ - - config REGMAP - default y if (REGMAP_I2C || REGMAP_SPI || REGMAP_SPMI || REGMAP_AC97 || REGMAP_MMIO || REGMAP_IRQ) -+ select IRQ_DOMAIN if REGMAP_IRQ -+ bool -+ -+config REGCACHE_COMPRESSED - select LZO_COMPRESS - select LZO_DECOMPRESS -- select IRQ_DOMAIN if REGMAP_IRQ - bool - - config REGMAP_AC97 ---- a/drivers/base/regmap/Makefile -+++ b/drivers/base/regmap/Makefile -@@ -2,7 +2,8 @@ - CFLAGS_regmap.o := -I$(src) - - obj-$(CONFIG_REGMAP) += regmap.o regcache.o --obj-$(CONFIG_REGMAP) += regcache-rbtree.o regcache-lzo.o regcache-flat.o -+obj-$(CONFIG_REGMAP) += regcache-rbtree.o regcache-flat.o -+obj-$(CONFIG_REGCACHE_COMPRESSED) += regcache-lzo.o - obj-$(CONFIG_DEBUG_FS) += regmap-debugfs.o - obj-$(CONFIG_REGMAP_AC97) += regmap-ac97.o - obj-$(CONFIG_REGMAP_I2C) += regmap-i2c.o ---- a/drivers/base/regmap/regcache.c -+++ b/drivers/base/regmap/regcache.c -@@ -21,7 +21,9 @@ - - static const struct regcache_ops *cache_types[] = { - ®cache_rbtree_ops, -+#if IS_ENABLED(CONFIG_REGCACHE_COMPRESSED) - ®cache_lzo_ops, -+#endif - ®cache_flat_ops, - }; - diff --git a/target/linux/generic/backport-4.9/090-net-generalize-napi_complete_done.patch b/target/linux/generic/backport-4.9/090-net-generalize-napi_complete_done.patch deleted file mode 100644 index 20e7ae0654..0000000000 --- a/target/linux/generic/backport-4.9/090-net-generalize-napi_complete_done.patch +++ /dev/null @@ -1,1412 +0,0 @@ -From 6ad20165d376fa07919a70e4f43dfae564601829 Mon Sep 17 00:00:00 2001 -From: Eric Dumazet -Date: Mon, 30 Jan 2017 08:22:01 -0800 -Subject: drivers: net: generalize napi_complete_done() - -napi_complete_done() allows to opt-in for gro_flush_timeout, -added back in linux-3.19, commit 3b47d30396ba -("net: gro: add a per device gro flush timer") - -This allows for more efficient GRO aggregation without -sacrifying latencies. - -Signed-off-by: Eric Dumazet -Signed-off-by: David S. Miller ---- - drivers/net/can/at91_can.c | 2 +- - drivers/net/can/c_can/c_can.c | 2 +- - drivers/net/can/flexcan.c | 2 +- - drivers/net/can/ifi_canfd/ifi_canfd.c | 2 +- - drivers/net/can/janz-ican3.c | 2 +- - drivers/net/can/m_can/m_can.c | 2 +- - drivers/net/can/rcar/rcar_can.c | 2 +- - drivers/net/can/rcar/rcar_canfd.c | 2 +- - drivers/net/can/xilinx_can.c | 2 +- - drivers/net/ethernet/3com/typhoon.c | 2 +- - drivers/net/ethernet/adi/bfin_mac.c | 2 +- - drivers/net/ethernet/agere/et131x.c | 2 +- - drivers/net/ethernet/altera/altera_tse_main.c | 2 +- - drivers/net/ethernet/apm/xgene/xgene_enet_main.c | 2 +- - drivers/net/ethernet/aquantia/atlantic/aq_vec.c | 2 +- - drivers/net/ethernet/arc/emac_main.c | 2 +- - drivers/net/ethernet/atheros/alx/main.c | 2 +- - drivers/net/ethernet/atheros/atl1c/atl1c_main.c | 2 +- - drivers/net/ethernet/atheros/atl1e/atl1e_main.c | 2 +- - drivers/net/ethernet/atheros/atlx/atl1.c | 2 +- - drivers/net/ethernet/broadcom/b44.c | 2 +- - drivers/net/ethernet/broadcom/bcm63xx_enet.c | 2 +- - drivers/net/ethernet/broadcom/bgmac.c | 2 +- - drivers/net/ethernet/broadcom/bnx2.c | 4 ++-- - drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c | 2 +- - drivers/net/ethernet/broadcom/bnxt/bnxt.c | 2 +- - drivers/net/ethernet/broadcom/sb1250-mac.c | 2 +- - drivers/net/ethernet/brocade/bna/bnad.c | 2 +- - drivers/net/ethernet/cadence/macb.c | 2 +- - drivers/net/ethernet/calxeda/xgmac.c | 2 +- - drivers/net/ethernet/cavium/liquidio/lio_main.c | 2 +- - drivers/net/ethernet/cavium/liquidio/lio_vf_main.c | 2 +- - drivers/net/ethernet/cavium/octeon/octeon_mgmt.c | 2 +- - drivers/net/ethernet/cavium/thunder/nicvf_main.c | 2 +- - drivers/net/ethernet/chelsio/cxgb/sge.c | 2 +- - drivers/net/ethernet/chelsio/cxgb3/sge.c | 4 ++-- - drivers/net/ethernet/chelsio/cxgb4vf/sge.c | 2 +- - drivers/net/ethernet/cisco/enic/enic_main.c | 4 ++-- - drivers/net/ethernet/dec/tulip/interrupt.c | 6 +++--- - drivers/net/ethernet/dnet.c | 2 +- - drivers/net/ethernet/emulex/benet/be_main.c | 2 +- - drivers/net/ethernet/ethoc.c | 2 +- - drivers/net/ethernet/ezchip/nps_enet.c | 2 +- - drivers/net/ethernet/freescale/dpaa/dpaa_eth.c | 2 +- - drivers/net/ethernet/freescale/fec_main.c | 2 +- - .../net/ethernet/freescale/fs_enet/fs_enet-main.c | 2 +- - drivers/net/ethernet/freescale/gianfar.c | 4 ++-- - drivers/net/ethernet/freescale/ucc_geth.c | 2 +- - drivers/net/ethernet/hisilicon/hip04_eth.c | 2 +- - drivers/net/ethernet/hisilicon/hisi_femac.c | 2 +- - drivers/net/ethernet/hisilicon/hix5hd2_gmac.c | 2 +- - drivers/net/ethernet/ibm/ibmveth.c | 2 +- - drivers/net/ethernet/ibm/ibmvnic.c | 2 +- - drivers/net/ethernet/intel/e100.c | 2 +- - drivers/net/ethernet/intel/ixgb/ixgb_main.c | 2 +- - drivers/net/ethernet/korina.c | 2 +- - drivers/net/ethernet/lantiq_etop.c | 21 +++++++++------------ - drivers/net/ethernet/marvell/mv643xx_eth.c | 2 +- - drivers/net/ethernet/marvell/mvneta.c | 6 ++---- - drivers/net/ethernet/marvell/mvpp2.c | 2 +- - drivers/net/ethernet/marvell/pxa168_eth.c | 2 +- - drivers/net/ethernet/moxa/moxart_ether.c | 2 +- - drivers/net/ethernet/myricom/myri10ge/myri10ge.c | 2 +- - drivers/net/ethernet/natsemi/natsemi.c | 2 +- - drivers/net/ethernet/neterion/s2io.c | 4 ++-- - drivers/net/ethernet/neterion/vxge/vxge-main.c | 6 +++--- - drivers/net/ethernet/nvidia/forcedeth.c | 2 +- - drivers/net/ethernet/nxp/lpc_eth.c | 2 +- - .../net/ethernet/oki-semi/pch_gbe/pch_gbe_main.c | 2 +- - drivers/net/ethernet/pasemi/pasemi_mac.c | 2 +- - .../net/ethernet/qlogic/netxen/netxen_nic_main.c | 2 +- - drivers/net/ethernet/qlogic/qede/qede_fp.c | 2 +- - drivers/net/ethernet/qlogic/qlcnic/qlcnic_io.c | 10 +++++----- - drivers/net/ethernet/qlogic/qlge/qlge_main.c | 2 +- - drivers/net/ethernet/qualcomm/emac/emac.c | 2 +- - drivers/net/ethernet/realtek/r8169.c | 2 +- - drivers/net/ethernet/rocker/rocker_main.c | 2 +- - drivers/net/ethernet/samsung/sxgbe/sxgbe_main.c | 2 +- - drivers/net/ethernet/sfc/efx.c | 2 +- - drivers/net/ethernet/sfc/falcon/efx.c | 2 +- - drivers/net/ethernet/smsc/smsc9420.c | 2 +- - drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 2 +- - drivers/net/ethernet/sun/niu.c | 2 +- - drivers/net/ethernet/sun/sungem.c | 2 +- - drivers/net/ethernet/sun/sunvnet_common.c | 2 +- - drivers/net/ethernet/tehuti/tehuti.c | 2 +- - drivers/net/ethernet/ti/cpsw.c | 2 +- - drivers/net/ethernet/ti/davinci_emac.c | 2 +- - drivers/net/ethernet/ti/netcp_core.c | 2 +- - drivers/net/ethernet/tile/tilegx.c | 2 +- - drivers/net/ethernet/tile/tilepro.c | 2 +- - drivers/net/ethernet/toshiba/ps3_gelic_net.c | 2 +- - drivers/net/ethernet/toshiba/spider_net.c | 2 +- - drivers/net/ethernet/toshiba/tc35815.c | 2 +- - drivers/net/ethernet/tundra/tsi108_eth.c | 2 +- - drivers/net/ethernet/via/via-rhine.c | 2 +- - drivers/net/ethernet/via/via-velocity.c | 2 +- - drivers/net/ethernet/wiznet/w5100.c | 2 +- - drivers/net/ethernet/wiznet/w5300.c | 2 +- - drivers/net/fjes/fjes_main.c | 2 +- - drivers/net/vmxnet3/vmxnet3_drv.c | 4 ++-- - drivers/net/wan/fsl_ucc_hdlc.c | 2 +- - drivers/net/wan/hd64572.c | 2 +- - drivers/net/wireless/ath/ath10k/pci.c | 2 +- - drivers/net/wireless/ath/wil6210/netdev.c | 2 +- - drivers/net/xen-netback/interface.c | 2 +- - drivers/net/xen-netfront.c | 2 +- - drivers/staging/octeon/ethernet-rx.c | 2 +- - drivers/staging/unisys/visornic/visornic_main.c | 2 +- - 109 files changed, 132 insertions(+), 137 deletions(-) - ---- a/drivers/net/can/at91_can.c -+++ b/drivers/net/can/at91_can.c -@@ -813,7 +813,7 @@ static int at91_poll(struct napi_struct - u32 reg_ier = AT91_IRQ_ERR_FRAME; - reg_ier |= get_irq_mb_rx(priv) & ~AT91_MB_MASK(priv->rx_next); - -- napi_complete(napi); -+ napi_complete_done(napi, work_done); - at91_write(priv, AT91_IER, reg_ier); - } - ---- a/drivers/net/can/c_can/c_can.c -+++ b/drivers/net/can/c_can/c_can.c -@@ -1070,7 +1070,7 @@ static int c_can_poll(struct napi_struct - - end: - if (work_done < quota) { -- napi_complete(napi); -+ napi_complete_done(napi, work_done); - /* enable all IRQs if we are not in bus off state */ - if (priv->can.state != CAN_STATE_BUS_OFF) - c_can_irq_control(priv, true); ---- a/drivers/net/can/flexcan.c -+++ b/drivers/net/can/flexcan.c -@@ -703,7 +703,7 @@ static int flexcan_poll(struct napi_stru - work_done += flexcan_poll_bus_err(dev, reg_esr); - - if (work_done < quota) { -- napi_complete(napi); -+ napi_complete_done(napi, work_done); - /* enable IRQs */ - flexcan_write(FLEXCAN_IFLAG_DEFAULT, ®s->imask1); - flexcan_write(priv->reg_ctrl_default, ®s->ctrl); ---- a/drivers/net/can/ifi_canfd/ifi_canfd.c -+++ b/drivers/net/can/ifi_canfd/ifi_canfd.c -@@ -589,7 +589,7 @@ static int ifi_canfd_poll(struct napi_st - work_done += ifi_canfd_do_rx_poll(ndev, quota - work_done); - - if (work_done < quota) { -- napi_complete(napi); -+ napi_complete_done(napi, work_done); - ifi_canfd_irq_enable(ndev, 1); - } - ---- a/drivers/net/can/janz-ican3.c -+++ b/drivers/net/can/janz-ican3.c -@@ -1475,7 +1475,7 @@ static int ican3_napi(struct napi_struct - /* We have processed all packets that the adapter had, but it - * was less than our budget, stop polling */ - if (received < budget) -- napi_complete(napi); -+ napi_complete_done(napi, received); - - spin_lock_irqsave(&mod->lock, flags); - ---- a/drivers/net/can/m_can/m_can.c -+++ b/drivers/net/can/m_can/m_can.c -@@ -730,7 +730,7 @@ static int m_can_poll(struct napi_struct - work_done += m_can_do_rx_poll(dev, (quota - work_done)); - - if (work_done < quota) { -- napi_complete(napi); -+ napi_complete_done(napi, work_done); - m_can_enable_all_interrupts(priv); - } - ---- a/drivers/net/can/rcar/rcar_can.c -+++ b/drivers/net/can/rcar/rcar_can.c -@@ -698,7 +698,7 @@ static int rcar_can_rx_poll(struct napi_ - } - /* All packets processed */ - if (num_pkts < quota) { -- napi_complete(napi); -+ napi_complete_done(napi, num_pkts); - priv->ier |= RCAR_CAN_IER_RXFIE; - writeb(priv->ier, &priv->regs->ier); - } ---- a/drivers/net/can/rcar/rcar_canfd.c -+++ b/drivers/net/can/rcar/rcar_canfd.c -@@ -1512,7 +1512,7 @@ static int rcar_canfd_rx_poll(struct nap - - /* All packets processed */ - if (num_pkts < quota) { -- napi_complete(napi); -+ napi_complete_done(napi, num_pkts); - /* Enable Rx FIFO interrupts */ - rcar_canfd_set_bit(priv->base, RCANFD_RFCC(ridx), - RCANFD_RFCC_RFIE); ---- a/drivers/net/can/xilinx_can.c -+++ b/drivers/net/can/xilinx_can.c -@@ -838,7 +838,7 @@ static int xcan_rx_poll(struct napi_stru - } - - if (work_done < quota) { -- napi_complete(napi); -+ napi_complete_done(napi, work_done); - ier = priv->read_reg(priv, XCAN_IER_OFFSET); - ier |= XCAN_IXR_RXNEMP_MASK; - priv->write_reg(priv, XCAN_IER_OFFSET, ier); ---- a/drivers/net/ethernet/3com/typhoon.c -+++ b/drivers/net/ethernet/3com/typhoon.c -@@ -1748,7 +1748,7 @@ typhoon_poll(struct napi_struct *napi, i - } - - if (work_done < budget) { -- napi_complete(napi); -+ napi_complete_done(napi, work_done); - iowrite32(TYPHOON_INTR_NONE, - tp->ioaddr + TYPHOON_REG_INTR_MASK); - typhoon_post_pci_writes(tp->ioaddr); ---- a/drivers/net/ethernet/adi/bfin_mac.c -+++ b/drivers/net/ethernet/adi/bfin_mac.c -@@ -1274,7 +1274,7 @@ static int bfin_mac_poll(struct napi_str - } - - if (i < budget) { -- napi_complete(napi); -+ napi_complete_done(napi, i); - if (test_and_clear_bit(BFIN_MAC_RX_IRQ_DISABLED, &lp->flags)) - enable_irq(IRQ_MAC_RX); - } ---- a/drivers/net/ethernet/agere/et131x.c -+++ b/drivers/net/ethernet/agere/et131x.c -@@ -3573,7 +3573,7 @@ static int et131x_poll(struct napi_struc - et131x_handle_send_pkts(adapter); - - if (work_done < budget) { -- napi_complete(&adapter->napi); -+ napi_complete_done(&adapter->napi, work_done); - et131x_enable_interrupts(adapter); - } - ---- a/drivers/net/ethernet/altera/altera_tse_main.c -+++ b/drivers/net/ethernet/altera/altera_tse_main.c -@@ -491,7 +491,7 @@ static int tse_poll(struct napi_struct * - - if (rxcomplete < budget) { - -- napi_complete(napi); -+ napi_complete_done(napi, rxcomplete); - - netdev_dbg(priv->dev, - "NAPI Complete, did %d packets with budget %d\n", ---- a/drivers/net/ethernet/apm/xgene/xgene_enet_main.c -+++ b/drivers/net/ethernet/apm/xgene/xgene_enet_main.c -@@ -655,7 +655,7 @@ static int xgene_enet_napi(struct napi_s - processed = xgene_enet_process_ring(ring, budget); - - if (processed != budget) { -- napi_complete(napi); -+ napi_complete_done(napi, processed); - enable_irq(ring->irq); - } - ---- a/drivers/net/ethernet/arc/emac_main.c -+++ b/drivers/net/ethernet/arc/emac_main.c -@@ -284,7 +284,7 @@ static int arc_emac_poll(struct napi_str - - work_done = arc_emac_rx(ndev, budget); - if (work_done < budget) { -- napi_complete(napi); -+ napi_complete_done(napi, work_done); - arc_reg_or(priv, R_ENABLE, RXINT_MASK | TXINT_MASK); - } - ---- a/drivers/net/ethernet/atheros/alx/main.c -+++ b/drivers/net/ethernet/atheros/alx/main.c -@@ -292,7 +292,7 @@ static int alx_poll(struct napi_struct * - if (!tx_complete || work == budget) - return budget; - -- napi_complete(&alx->napi); -+ napi_complete_done(&alx->napi, work); - - /* enable interrupt */ - if (alx->flags & ALX_FLAG_USING_MSIX) { ---- a/drivers/net/ethernet/atheros/atl1c/atl1c_main.c -+++ b/drivers/net/ethernet/atheros/atl1c/atl1c_main.c -@@ -1886,7 +1886,7 @@ static int atl1c_clean(struct napi_struc - - if (work_done < budget) { - quit_polling: -- napi_complete(napi); -+ napi_complete_done(napi, work_done); - adapter->hw.intr_mask |= ISR_RX_PKT; - AT_WRITE_REG(&adapter->hw, REG_IMR, adapter->hw.intr_mask); - } ---- a/drivers/net/ethernet/atheros/atl1e/atl1e_main.c -+++ b/drivers/net/ethernet/atheros/atl1e/atl1e_main.c -@@ -1532,7 +1532,7 @@ static int atl1e_clean(struct napi_struc - /* If no Tx and not enough Rx work done, exit the polling mode */ - if (work_done < budget) { - quit_polling: -- napi_complete(napi); -+ napi_complete_done(napi, work_done); - imr_data = AT_READ_REG(&adapter->hw, REG_IMR); - AT_WRITE_REG(&adapter->hw, REG_IMR, imr_data | ISR_RX_EVENT); - /* test debug */ ---- a/drivers/net/ethernet/atheros/atlx/atl1.c -+++ b/drivers/net/ethernet/atheros/atlx/atl1.c -@@ -2457,7 +2457,7 @@ static int atl1_rings_clean(struct napi_ - if (work_done >= budget) - return work_done; - -- napi_complete(napi); -+ napi_complete_done(napi, work_done); - /* re-enable Interrupt */ - if (likely(adapter->int_enabled)) - atlx_imr_set(adapter, IMR_NORMAL_MASK); ---- a/drivers/net/ethernet/broadcom/b44.c -+++ b/drivers/net/ethernet/broadcom/b44.c -@@ -902,7 +902,7 @@ static int b44_poll(struct napi_struct * - } - - if (work_done < budget) { -- napi_complete(napi); -+ napi_complete_done(napi, work_done); - b44_enable_ints(bp); - } - ---- a/drivers/net/ethernet/broadcom/bcm63xx_enet.c -+++ b/drivers/net/ethernet/broadcom/bcm63xx_enet.c -@@ -511,7 +511,7 @@ static int bcm_enet_poll(struct napi_str - - /* no more packet in rx/tx queue, remove device from poll - * queue */ -- napi_complete(napi); -+ napi_complete_done(napi, rx_work_done); - - /* restore rx/tx interrupt */ - enet_dmac_writel(priv, priv->dma_chan_int_mask, ---- a/drivers/net/ethernet/broadcom/bgmac.c -+++ b/drivers/net/ethernet/broadcom/bgmac.c -@@ -1146,7 +1146,7 @@ static int bgmac_poll(struct napi_struct - return weight; - - if (handled < weight) { -- napi_complete(napi); -+ napi_complete_done(napi, handled); - bgmac_chip_intrs_on(bgmac); - } - ---- a/drivers/net/ethernet/broadcom/bnx2.c -+++ b/drivers/net/ethernet/broadcom/bnx2.c -@@ -3522,7 +3522,7 @@ static int bnx2_poll_msix(struct napi_st - rmb(); - if (likely(!bnx2_has_fast_work(bnapi))) { - -- napi_complete(napi); -+ napi_complete_done(napi, work_done); - BNX2_WR(bp, BNX2_PCICFG_INT_ACK_CMD, bnapi->int_num | - BNX2_PCICFG_INT_ACK_CMD_INDEX_VALID | - bnapi->last_status_idx); -@@ -3559,7 +3559,7 @@ static int bnx2_poll(struct napi_struct - - rmb(); - if (likely(!bnx2_has_work(bnapi))) { -- napi_complete(napi); -+ napi_complete_done(napi, work_done); - if (likely(bp->flags & BNX2_FLAG_USING_MSI_OR_MSIX)) { - BNX2_WR(bp, BNX2_PCICFG_INT_ACK_CMD, - BNX2_PCICFG_INT_ACK_CMD_INDEX_VALID | ---- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c -+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c -@@ -3236,7 +3236,7 @@ static int bnx2x_poll(struct napi_struct - * has been updated when NAPI was scheduled. - */ - if (IS_FCOE_FP(fp)) { -- napi_complete(napi); -+ napi_complete_done(napi, rx_work_done); - } else { - bnx2x_update_fpsb_idx(fp); - /* bnx2x_has_rx_work() reads the status block, ---- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c -+++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c -@@ -1781,7 +1781,7 @@ static int bnxt_poll_nitroa0(struct napi - } - - if (!bnxt_has_work(bp, cpr) && rx_pkts < budget) { -- napi_complete(napi); -+ napi_complete_done(napi, rx_pkts); - BNXT_CP_DB_REARM(cpr->cp_doorbell, cpr->cp_raw_cons); - } - return rx_pkts; ---- a/drivers/net/ethernet/broadcom/sb1250-mac.c -+++ b/drivers/net/ethernet/broadcom/sb1250-mac.c -@@ -2545,7 +2545,7 @@ static int sbmac_poll(struct napi_struct - sbdma_tx_process(sc, &(sc->sbm_txdma), 1); - - if (work_done < budget) { -- napi_complete(napi); -+ napi_complete_done(napi, work_done); - - #ifdef CONFIG_SBMAC_COALESCE - __raw_writeq(((M_MAC_INT_EOP_COUNT | M_MAC_INT_EOP_TIMER) << S_MAC_TX_CH0) | ---- a/drivers/net/ethernet/brocade/bna/bnad.c -+++ b/drivers/net/ethernet/brocade/bna/bnad.c -@@ -1881,7 +1881,7 @@ bnad_napi_poll_rx(struct napi_struct *na - return rcvd; - - poll_exit: -- napi_complete(napi); -+ napi_complete_done(napi, rcvd); - - rx_ctrl->rx_complete++; - ---- a/drivers/net/ethernet/cadence/macb.c -+++ b/drivers/net/ethernet/cadence/macb.c -@@ -1069,7 +1069,7 @@ static int macb_poll(struct napi_struct - - work_done = bp->macbgem_ops.mog_rx(bp, budget); - if (work_done < budget) { -- napi_complete(napi); -+ napi_complete_done(napi, work_done); - - /* Packets received while interrupts were disabled */ - status = macb_readl(bp, RSR); ---- a/drivers/net/ethernet/calxeda/xgmac.c -+++ b/drivers/net/ethernet/calxeda/xgmac.c -@@ -1247,7 +1247,7 @@ static int xgmac_poll(struct napi_struct - work_done = xgmac_rx(priv, budget); - - if (work_done < budget) { -- napi_complete(napi); -+ napi_complete_done(napi, work_done); - __raw_writel(DMA_INTR_DEFAULT_MASK, priv->base + XGMAC_DMA_INTR_ENA); - } - return work_done; ---- a/drivers/net/ethernet/cavium/liquidio/lio_main.c -+++ b/drivers/net/ethernet/cavium/liquidio/lio_main.c -@@ -2433,7 +2433,7 @@ static int liquidio_napi_poll(struct nap - } - - if ((work_done < budget) && (tx_done)) { -- napi_complete(napi); -+ napi_complete_done(napi, work_done); - octeon_process_droq_poll_cmd(droq->oct_dev, droq->q_no, - POLL_EVENT_ENABLE_INTR, 0); - return 0; ---- a/drivers/net/ethernet/cavium/octeon/octeon_mgmt.c -+++ b/drivers/net/ethernet/cavium/octeon/octeon_mgmt.c -@@ -501,7 +501,7 @@ static int octeon_mgmt_napi_poll(struct - - if (work_done < budget) { - /* We stopped because no more packets were available. */ -- napi_complete(napi); -+ napi_complete_done(napi, work_done); - octeon_mgmt_enable_rx_irq(p); - } - octeon_mgmt_update_rx_stats(netdev); ---- a/drivers/net/ethernet/cavium/thunder/nicvf_main.c -+++ b/drivers/net/ethernet/cavium/thunder/nicvf_main.c -@@ -737,7 +737,7 @@ static int nicvf_poll(struct napi_struct - - if (work_done < budget) { - /* Slow packet rate, exit polling */ -- napi_complete(napi); -+ napi_complete_done(napi, work_done); - /* Re-enable interrupts */ - cq_head = nicvf_queue_reg_read(nic, NIC_QSET_CQ_0_7_HEAD, - cq->cq_idx); ---- a/drivers/net/ethernet/chelsio/cxgb/sge.c -+++ b/drivers/net/ethernet/chelsio/cxgb/sge.c -@@ -1605,7 +1605,7 @@ int t1_poll(struct napi_struct *napi, in - int work_done = process_responses(adapter, budget); - - if (likely(work_done < budget)) { -- napi_complete(napi); -+ napi_complete_done(napi, work_done); - writel(adapter->sge->respQ.cidx, - adapter->regs + A_SG_SLEEPING); - } ---- a/drivers/net/ethernet/chelsio/cxgb3/sge.c -+++ b/drivers/net/ethernet/chelsio/cxgb3/sge.c -@@ -1843,7 +1843,7 @@ static int ofld_poll(struct napi_struct - __skb_queue_head_init(&queue); - skb_queue_splice_init(&q->rx_queue, &queue); - if (skb_queue_empty(&queue)) { -- napi_complete(napi); -+ napi_complete_done(napi, work_done); - spin_unlock_irq(&q->lock); - return work_done; - } -@@ -2414,7 +2414,7 @@ static int napi_rx_handler(struct napi_s - int work_done = process_responses(adap, qs, budget); - - if (likely(work_done < budget)) { -- napi_complete(napi); -+ napi_complete_done(napi, work_done); - - /* - * Because we don't atomically flush the following ---- a/drivers/net/ethernet/chelsio/cxgb4vf/sge.c -+++ b/drivers/net/ethernet/chelsio/cxgb4vf/sge.c -@@ -1889,7 +1889,7 @@ static int napi_rx_handler(struct napi_s - u32 val; - - if (likely(work_done < budget)) { -- napi_complete(napi); -+ napi_complete_done(napi, work_done); - intr_params = rspq->next_intr_params; - rspq->next_intr_params = rspq->intr_params; - } else ---- a/drivers/net/ethernet/cisco/enic/enic_main.c -+++ b/drivers/net/ethernet/cisco/enic/enic_main.c -@@ -1339,7 +1339,7 @@ static int enic_poll(struct napi_struct - * exit polling - */ - -- napi_complete(napi); -+ napi_complete_done(napi, rq_work_done); - if (enic->rx_coalesce_setting.use_adaptive_rx_coalesce) - enic_set_int_moderation(enic, &enic->rq[0]); - vnic_intr_unmask(&enic->intr[intr]); -@@ -1496,7 +1496,7 @@ static int enic_poll_msix_rq(struct napi - * exit polling - */ - -- napi_complete(napi); -+ napi_complete_done(napi, work_done); - if (enic->rx_coalesce_setting.use_adaptive_rx_coalesce) - enic_set_int_moderation(enic, &enic->rq[rq]); - vnic_intr_unmask(&enic->intr[intr]); ---- a/drivers/net/ethernet/dec/tulip/interrupt.c -+++ b/drivers/net/ethernet/dec/tulip/interrupt.c -@@ -319,8 +319,8 @@ int tulip_poll(struct napi_struct *napi, - - /* Remove us from polling list and enable RX intr. */ - -- napi_complete(napi); -- iowrite32(tulip_tbl[tp->chip_id].valid_intrs, tp->base_addr+CSR7); -+ napi_complete_done(napi, work_done); -+ iowrite32(tulip_tbl[tp->chip_id].valid_intrs, tp->base_addr+CSR7); - - /* The last op happens after poll completion. Which means the following: - * 1. it can race with disabling irqs in irq handler -@@ -355,7 +355,7 @@ int tulip_poll(struct napi_struct *napi, - * before we did napi_complete(). See? We would lose it. */ - - /* remove ourselves from the polling list */ -- napi_complete(napi); -+ napi_complete_done(napi, work_done); - - return work_done; - } ---- a/drivers/net/ethernet/dnet.c -+++ b/drivers/net/ethernet/dnet.c -@@ -415,7 +415,7 @@ static int dnet_poll(struct napi_struct - /* We processed all packets available. Tell NAPI it can - * stop polling then re-enable rx interrupts. - */ -- napi_complete(napi); -+ napi_complete_done(napi, npackets); - int_enable = dnet_readl(bp, INTR_ENB); - int_enable |= DNET_INTR_SRC_RX_CMDFIFOAF; - dnet_writel(bp, int_enable, INTR_ENB); ---- a/drivers/net/ethernet/emulex/benet/be_main.c -+++ b/drivers/net/ethernet/emulex/benet/be_main.c -@@ -3344,7 +3344,7 @@ int be_poll(struct napi_struct *napi, in - be_process_mcc(adapter); - - if (max_work < budget) { -- napi_complete(napi); -+ napi_complete_done(napi, max_work); - - /* Skyhawk EQ_DB has a provision to set the rearm to interrupt - * delay via a delay multiplier encoding value ---- a/drivers/net/ethernet/ethoc.c -+++ b/drivers/net/ethernet/ethoc.c -@@ -614,7 +614,7 @@ static int ethoc_poll(struct napi_struct - tx_work_done = ethoc_tx(priv->netdev, budget); - - if (rx_work_done < budget && tx_work_done < budget) { -- napi_complete(napi); -+ napi_complete_done(napi, rx_work_done); - ethoc_enable_irq(priv, INT_MASK_TX | INT_MASK_RX); - } - ---- a/drivers/net/ethernet/ezchip/nps_enet.c -+++ b/drivers/net/ethernet/ezchip/nps_enet.c -@@ -192,7 +192,7 @@ static int nps_enet_poll(struct napi_str - if (work_done < budget) { - u32 buf_int_enable_value = 0; - -- napi_complete(napi); -+ napi_complete_done(napi, work_done); - - /* set tx_done and rx_rdy bits */ - buf_int_enable_value |= NPS_ENET_ENABLE << RX_RDY_SHIFT; ---- a/drivers/net/ethernet/freescale/fec_main.c -+++ b/drivers/net/ethernet/freescale/fec_main.c -@@ -1623,7 +1623,7 @@ static int fec_enet_rx_napi(struct napi_ - fec_enet_tx(ndev); - - if (pkts < budget) { -- napi_complete(napi); -+ napi_complete_done(napi, pkts); - writel(FEC_DEFAULT_IMASK, fep->hwp + FEC_IMASK); - } - return pkts; ---- a/drivers/net/ethernet/freescale/fs_enet/fs_enet-main.c -+++ b/drivers/net/ethernet/freescale/fs_enet/fs_enet-main.c -@@ -301,7 +301,7 @@ static int fs_enet_napi(struct napi_stru - - if (received < budget && tx_left) { - /* done */ -- napi_complete(napi); -+ napi_complete_done(napi, received); - (*fep->ops->napi_enable)(dev); - - return received; ---- a/drivers/net/ethernet/freescale/gianfar.c -+++ b/drivers/net/ethernet/freescale/gianfar.c -@@ -3197,7 +3197,7 @@ static int gfar_poll_rx_sq(struct napi_s - - if (work_done < budget) { - u32 imask; -- napi_complete(napi); -+ napi_complete_done(napi, work_done); - /* Clear the halt bit in RSTAT */ - gfar_write(®s->rstat, gfargrp->rstat); - -@@ -3286,7 +3286,7 @@ static int gfar_poll_rx(struct napi_stru - - if (!num_act_queues) { - u32 imask; -- napi_complete(napi); -+ napi_complete_done(napi, work_done); - - /* Clear the halt bit in RSTAT */ - gfar_write(®s->rstat, gfargrp->rstat); ---- a/drivers/net/ethernet/freescale/ucc_geth.c -+++ b/drivers/net/ethernet/freescale/ucc_geth.c -@@ -3303,7 +3303,7 @@ static int ucc_geth_poll(struct napi_str - howmany += ucc_geth_rx(ugeth, i, budget - howmany); - - if (howmany < budget) { -- napi_complete(napi); -+ napi_complete_done(napi, howmany); - setbits32(ugeth->uccf->p_uccm, UCCE_RX_EVENTS | UCCE_TX_EVENTS); - } - ---- a/drivers/net/ethernet/hisilicon/hip04_eth.c -+++ b/drivers/net/ethernet/hisilicon/hip04_eth.c -@@ -555,7 +555,7 @@ refill: - priv->reg_inten |= RCV_INT; - writel_relaxed(priv->reg_inten, priv->base + PPE_INTEN); - } -- napi_complete(napi); -+ napi_complete_done(napi, rx); - done: - /* clean up tx descriptors and start a new timer if necessary */ - tx_remaining = hip04_tx_reclaim(ndev, false); ---- a/drivers/net/ethernet/hisilicon/hisi_femac.c -+++ b/drivers/net/ethernet/hisilicon/hisi_femac.c -@@ -330,7 +330,7 @@ static int hisi_femac_poll(struct napi_s - } while (ints & DEF_INT_MASK); - - if (work_done < budget) { -- napi_complete(napi); -+ napi_complete_done(napi, work_done); - hisi_femac_irq_enable(priv, DEF_INT_MASK & - (~IRQ_INT_TX_PER_PACKET)); - } ---- a/drivers/net/ethernet/hisilicon/hix5hd2_gmac.c -+++ b/drivers/net/ethernet/hisilicon/hix5hd2_gmac.c -@@ -578,7 +578,7 @@ static int hix5hd2_poll(struct napi_stru - } while (ints & DEF_INT_MASK); - - if (work_done < budget) { -- napi_complete(napi); -+ napi_complete_done(napi, work_done); - hix5hd2_irq_enable(priv); - } - ---- a/drivers/net/ethernet/ibm/ibmveth.c -+++ b/drivers/net/ethernet/ibm/ibmveth.c -@@ -1324,7 +1324,7 @@ restart_poll: - ibmveth_replenish_task(adapter); - - if (frames_processed < budget) { -- napi_complete(napi); -+ napi_complete_done(napi, frames_processed); - - /* We think we are done - reenable interrupts, - * then check once more to make sure we are done. ---- a/drivers/net/ethernet/ibm/ibmvnic.c -+++ b/drivers/net/ethernet/ibm/ibmvnic.c -@@ -1028,7 +1028,7 @@ restart_poll: - - if (frames_processed < budget) { - enable_scrq_irq(adapter, adapter->rx_scrq[scrq_num]); -- napi_complete(napi); -+ napi_complete_done(napi, frames_processed); - if (pending_scrq(adapter, adapter->rx_scrq[scrq_num]) && - napi_reschedule(napi)) { - disable_scrq_irq(adapter, adapter->rx_scrq[scrq_num]); ---- a/drivers/net/ethernet/intel/e100.c -+++ b/drivers/net/ethernet/intel/e100.c -@@ -2253,7 +2253,7 @@ static int e100_poll(struct napi_struct - - /* If budget not fully consumed, exit the polling mode */ - if (work_done < budget) { -- napi_complete(napi); -+ napi_complete_done(napi, work_done); - e100_enable_irq(nic); - } - ---- a/drivers/net/ethernet/intel/ixgb/ixgb_main.c -+++ b/drivers/net/ethernet/intel/ixgb/ixgb_main.c -@@ -1825,7 +1825,7 @@ ixgb_clean(struct napi_struct *napi, int - - /* If budget not fully consumed, exit the polling mode */ - if (work_done < budget) { -- napi_complete(napi); -+ napi_complete_done(napi, work_done); - if (!test_bit(__IXGB_DOWN, &adapter->flags)) - ixgb_irq_enable(adapter); - } ---- a/drivers/net/ethernet/korina.c -+++ b/drivers/net/ethernet/korina.c -@@ -464,7 +464,7 @@ static int korina_poll(struct napi_struc - - work_done = korina_rx(dev, budget); - if (work_done < budget) { -- napi_complete(napi); -+ napi_complete_done(napi, work_done); - - writel(readl(&lp->rx_dma_regs->dmasm) & - ~(DMA_STAT_DONE | DMA_STAT_HALT | DMA_STAT_ERR), ---- a/drivers/net/ethernet/lantiq_etop.c -+++ b/drivers/net/ethernet/lantiq_etop.c -@@ -156,24 +156,21 @@ ltq_etop_poll_rx(struct napi_struct *nap - { - struct ltq_etop_chan *ch = container_of(napi, - struct ltq_etop_chan, napi); -- int rx = 0; -- int complete = 0; -+ int work_done = 0; - -- while ((rx < budget) && !complete) { -+ while (work_done < budget) { - struct ltq_dma_desc *desc = &ch->dma.desc_base[ch->dma.desc]; - -- if ((desc->ctl & (LTQ_DMA_OWN | LTQ_DMA_C)) == LTQ_DMA_C) { -- ltq_etop_hw_receive(ch); -- rx++; -- } else { -- complete = 1; -- } -+ if ((desc->ctl & (LTQ_DMA_OWN | LTQ_DMA_C)) != LTQ_DMA_C) -+ break; -+ ltq_etop_hw_receive(ch); -+ work_done++; - } -- if (complete || !rx) { -- napi_complete(&ch->napi); -+ if (work_done < budget) { -+ napi_complete_done(&ch->napi, work_done); - ltq_dma_ack_irq(&ch->dma); - } -- return rx; -+ return work_done; - } - - static int ---- a/drivers/net/ethernet/marvell/mv643xx_eth.c -+++ b/drivers/net/ethernet/marvell/mv643xx_eth.c -@@ -2312,7 +2312,7 @@ static int mv643xx_eth_poll(struct napi_ - if (work_done < budget) { - if (mp->oom) - mod_timer(&mp->rx_oom, jiffies + (HZ / 10)); -- napi_complete(napi); -+ napi_complete_done(napi, work_done); - wrlp(mp, INT_MASK, mp->int_mask); - } - ---- a/drivers/net/ethernet/marvell/mvneta.c -+++ b/drivers/net/ethernet/marvell/mvneta.c -@@ -2702,11 +2702,9 @@ static int mvneta_poll(struct napi_struc - rx_done = mvneta_rx_swbm(pp, budget, &pp->rxqs[rx_queue]); - } - -- budget -= rx_done; -- -- if (budget > 0) { -+ if (rx_done < budget) { - cause_rx_tx = 0; -- napi_complete(&port->napi); -+ napi_complete_done(&port->napi, rx_done); - enable_percpu_irq(pp->dev->irq, 0); - } - ---- a/drivers/net/ethernet/marvell/mvpp2.c -+++ b/drivers/net/ethernet/marvell/mvpp2.c -@@ -5406,7 +5406,7 @@ static int mvpp2_poll(struct napi_struct - - if (budget > 0) { - cause_rx = 0; -- napi_complete(napi); -+ napi_complete_done(napi, rx_done); - - mvpp2_interrupts_enable(port); - } ---- a/drivers/net/ethernet/marvell/pxa168_eth.c -+++ b/drivers/net/ethernet/marvell/pxa168_eth.c -@@ -1264,7 +1264,7 @@ static int pxa168_rx_poll(struct napi_st - } - work_done = rxq_process(dev, budget); - if (work_done < budget) { -- napi_complete(napi); -+ napi_complete_done(napi, work_done); - wrl(pep, INT_MASK, ALL_INTS); - } - ---- a/drivers/net/ethernet/moxa/moxart_ether.c -+++ b/drivers/net/ethernet/moxa/moxart_ether.c -@@ -270,7 +270,7 @@ rx_next: - } - - if (rx < budget) { -- napi_complete(napi); -+ napi_complete_done(napi, rx); - } - - priv->reg_imr |= RPKT_FINISH_M; ---- a/drivers/net/ethernet/myricom/myri10ge/myri10ge.c -+++ b/drivers/net/ethernet/myricom/myri10ge/myri10ge.c -@@ -1678,7 +1678,7 @@ static int myri10ge_poll(struct napi_str - - myri10ge_ss_unlock_napi(ss); - if (work_done < budget) { -- napi_complete(napi); -+ napi_complete_done(napi, work_done); - put_be32(htonl(3), ss->irq_claim); - } - return work_done; ---- a/drivers/net/ethernet/natsemi/natsemi.c -+++ b/drivers/net/ethernet/natsemi/natsemi.c -@@ -2261,7 +2261,7 @@ static int natsemi_poll(struct napi_stru - np->intr_status = readl(ioaddr + IntrStatus); - } while (np->intr_status); - -- napi_complete(napi); -+ napi_complete_done(napi, work_done); - - /* Reenable interrupts providing nothing is trying to shut - * the chip down. */ ---- a/drivers/net/ethernet/neterion/s2io.c -+++ b/drivers/net/ethernet/neterion/s2io.c -@@ -2783,7 +2783,7 @@ static int s2io_poll_msix(struct napi_st - s2io_chk_rx_buffers(nic, ring); - - if (pkts_processed < budget_org) { -- napi_complete(napi); -+ napi_complete_done(napi, pkts_processed); - /*Re Enable MSI-Rx Vector*/ - addr = (u8 __iomem *)&bar0->xmsi_mask_reg; - addr += 7 - ring->ring_no; -@@ -2817,7 +2817,7 @@ static int s2io_poll_inta(struct napi_st - break; - } - if (pkts_processed < budget_org) { -- napi_complete(napi); -+ napi_complete_done(napi, pkts_processed); - /* Re enable the Rx interrupts for the ring */ - writeq(0, &bar0->rx_traffic_mask); - readl(&bar0->rx_traffic_mask); ---- a/drivers/net/ethernet/neterion/vxge/vxge-main.c -+++ b/drivers/net/ethernet/neterion/vxge/vxge-main.c -@@ -1823,8 +1823,8 @@ static int vxge_poll_msix(struct napi_st - vxge_hw_vpath_poll_rx(ring->handle); - pkts_processed = ring->pkts_processed; - -- if (ring->pkts_processed < budget_org) { -- napi_complete(napi); -+ if (pkts_processed < budget_org) { -+ napi_complete_done(napi, pkts_processed); - - /* Re enable the Rx interrupts for the vpath */ - vxge_hw_channel_msix_unmask( -@@ -1863,7 +1863,7 @@ static int vxge_poll_inta(struct napi_st - VXGE_COMPLETE_ALL_TX(vdev); - - if (pkts_processed < budget_org) { -- napi_complete(napi); -+ napi_complete_done(napi, pkts_processed); - /* Re enable the Rx interrupts for the ring */ - vxge_hw_device_unmask_all(hldev); - vxge_hw_device_flush_io(hldev); ---- a/drivers/net/ethernet/nvidia/forcedeth.c -+++ b/drivers/net/ethernet/nvidia/forcedeth.c -@@ -3756,7 +3756,7 @@ static int nv_napi_poll(struct napi_stru - if (rx_work < budget) { - /* re-enable interrupts - (msix not enabled in napi) */ -- napi_complete(napi); -+ napi_complete_done(napi, rx_work); - - writel(np->irqmask, base + NvRegIrqMask); - } ---- a/drivers/net/ethernet/nxp/lpc_eth.c -+++ b/drivers/net/ethernet/nxp/lpc_eth.c -@@ -999,7 +999,7 @@ static int lpc_eth_poll(struct napi_stru - rx_done = __lpc_handle_recv(ndev, budget); - - if (rx_done < budget) { -- napi_complete(napi); -+ napi_complete_done(napi, rx_done); - lpc_eth_enable_int(pldat->net_base); - } - ---- a/drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_main.c -+++ b/drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_main.c -@@ -2391,7 +2391,7 @@ static int pch_gbe_napi_poll(struct napi - poll_end_flag = true; - - if (poll_end_flag) { -- napi_complete(napi); -+ napi_complete_done(napi, work_done); - pch_gbe_irq_enable(adapter); - } - ---- a/drivers/net/ethernet/pasemi/pasemi_mac.c -+++ b/drivers/net/ethernet/pasemi/pasemi_mac.c -@@ -1575,7 +1575,7 @@ static int pasemi_mac_poll(struct napi_s - pkts = pasemi_mac_clean_rx(rx_ring(mac), budget); - if (pkts < budget) { - /* all done, no more packets present */ -- napi_complete(napi); -+ napi_complete_done(napi, pkts); - - pasemi_mac_restart_rx_intr(mac); - pasemi_mac_restart_tx_intr(mac); ---- a/drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c -+++ b/drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c -@@ -2391,7 +2391,7 @@ static int netxen_nic_poll(struct napi_s - work_done = budget; - - if (work_done < budget) { -- napi_complete(&sds_ring->napi); -+ napi_complete_done(&sds_ring->napi, work_done); - if (test_bit(__NX_DEV_UP, &adapter->state)) - netxen_nic_enable_int(sds_ring); - } ---- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_io.c -+++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_io.c -@@ -975,7 +975,7 @@ static int qlcnic_poll(struct napi_struc - work_done = budget; - - if (work_done < budget) { -- napi_complete(&sds_ring->napi); -+ napi_complete_done(&sds_ring->napi, work_done); - if (test_bit(__QLCNIC_DEV_UP, &adapter->state)) { - qlcnic_enable_sds_intr(adapter, sds_ring); - qlcnic_enable_tx_intr(adapter, tx_ring); -@@ -1019,7 +1019,7 @@ static int qlcnic_rx_poll(struct napi_st - work_done = qlcnic_process_rcv_ring(sds_ring, budget); - - if (work_done < budget) { -- napi_complete(&sds_ring->napi); -+ napi_complete_done(&sds_ring->napi, work_done); - if (test_bit(__QLCNIC_DEV_UP, &adapter->state)) - qlcnic_enable_sds_intr(adapter, sds_ring); - } -@@ -1966,7 +1966,7 @@ static int qlcnic_83xx_msix_sriov_vf_pol - work_done = budget; - - if (work_done < budget) { -- napi_complete(&sds_ring->napi); -+ napi_complete_done(&sds_ring->napi, work_done); - qlcnic_enable_sds_intr(adapter, sds_ring); - } - -@@ -1994,7 +1994,7 @@ static int qlcnic_83xx_poll(struct napi_ - work_done = budget; - - if (work_done < budget) { -- napi_complete(&sds_ring->napi); -+ napi_complete_done(&sds_ring->napi, work_done); - qlcnic_enable_sds_intr(adapter, sds_ring); - } - -@@ -2032,7 +2032,7 @@ static int qlcnic_83xx_rx_poll(struct na - adapter = sds_ring->adapter; - work_done = qlcnic_83xx_process_rcv_ring(sds_ring, budget); - if (work_done < budget) { -- napi_complete(&sds_ring->napi); -+ napi_complete_done(&sds_ring->napi, work_done); - if (test_bit(__QLCNIC_DEV_UP, &adapter->state)) - qlcnic_enable_sds_intr(adapter, sds_ring); - } ---- a/drivers/net/ethernet/qlogic/qlge/qlge_main.c -+++ b/drivers/net/ethernet/qlogic/qlge/qlge_main.c -@@ -2334,7 +2334,7 @@ static int ql_napi_poll_msix(struct napi - } - - if (work_done < budget) { -- napi_complete(napi); -+ napi_complete_done(napi, work_done); - ql_enable_completion_interrupt(qdev, rx_ring->irq); - } - return work_done; ---- a/drivers/net/ethernet/qualcomm/emac/emac.c -+++ b/drivers/net/ethernet/qualcomm/emac/emac.c -@@ -129,7 +129,7 @@ static int emac_napi_rtx(struct napi_str - emac_mac_rx_process(adpt, rx_q, &work_done, budget); - - if (work_done < budget) { -- napi_complete(napi); -+ napi_complete_done(napi, work_done); - - irq->mask |= rx_q->intr; - writel(irq->mask, adpt->base + EMAC_INT_MASK); ---- a/drivers/net/ethernet/realtek/r8169.c -+++ b/drivers/net/ethernet/realtek/r8169.c -@@ -7578,7 +7578,7 @@ static int rtl8169_poll(struct napi_stru - } - - if (work_done < budget) { -- napi_complete(napi); -+ napi_complete_done(napi, work_done); - - rtl_irq_enable(tp, enable_mask); - mmiowb(); ---- a/drivers/net/ethernet/rocker/rocker_main.c -+++ b/drivers/net/ethernet/rocker/rocker_main.c -@@ -2480,7 +2480,7 @@ static int rocker_port_poll_rx(struct na - } - - if (credits < budget) -- napi_complete(napi); -+ napi_complete_done(napi, credits); - - rocker_dma_ring_credits_set(rocker, &rocker_port->rx_ring, credits); - ---- a/drivers/net/ethernet/samsung/sxgbe/sxgbe_main.c -+++ b/drivers/net/ethernet/samsung/sxgbe/sxgbe_main.c -@@ -1578,7 +1578,7 @@ static int sxgbe_poll(struct napi_struct - - work_done = sxgbe_rx(priv, budget); - if (work_done < budget) { -- napi_complete(napi); -+ napi_complete_done(napi, work_done); - priv->hw->dma->enable_dma_irq(priv->ioaddr, qnum); - } - ---- a/drivers/net/ethernet/sfc/efx.c -+++ b/drivers/net/ethernet/sfc/efx.c -@@ -332,7 +332,7 @@ static int efx_poll(struct napi_struct * - * since efx_nic_eventq_read_ack() will have no effect if - * interrupts have already been disabled. - */ -- napi_complete(napi); -+ napi_complete_done(napi, spent); - efx_nic_eventq_read_ack(channel); - } - ---- a/drivers/net/ethernet/smsc/smsc9420.c -+++ b/drivers/net/ethernet/smsc/smsc9420.c -@@ -869,7 +869,7 @@ static int smsc9420_rx_poll(struct napi_ - smsc9420_pci_flush_write(pd); - - if (work_done < budget) { -- napi_complete(&pd->napi); -+ napi_complete_done(&pd->napi, work_done); - - /* re-enable RX DMA interrupts */ - dma_intr_ena = smsc9420_reg_read(pd, DMAC_INTR_ENA); ---- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c -+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c -@@ -2706,7 +2706,7 @@ static int stmmac_poll(struct napi_struc - - work_done = stmmac_rx(priv, budget); - if (work_done < budget) { -- napi_complete(napi); -+ napi_complete_done(napi, work_done); - stmmac_enable_dma_irq(priv); - } - return work_done; ---- a/drivers/net/ethernet/sun/niu.c -+++ b/drivers/net/ethernet/sun/niu.c -@@ -3785,7 +3785,7 @@ static int niu_poll(struct napi_struct * - work_done = niu_poll_core(np, lp, budget); - - if (work_done < budget) { -- napi_complete(napi); -+ napi_complete_done(napi, work_done); - niu_ldg_rearm(np, lp, 1); - } - return work_done; ---- a/drivers/net/ethernet/sun/sungem.c -+++ b/drivers/net/ethernet/sun/sungem.c -@@ -924,7 +924,7 @@ static int gem_poll(struct napi_struct * - gp->status = readl(gp->regs + GREG_STAT); - } while (gp->status & GREG_STAT_NAPI); - -- napi_complete(napi); -+ napi_complete_done(napi, work_done); - gem_enable_ints(gp); - - return work_done; ---- a/drivers/net/ethernet/sun/sunvnet_common.c -+++ b/drivers/net/ethernet/sun/sunvnet_common.c -@@ -850,7 +850,7 @@ int sunvnet_poll_common(struct napi_stru - int processed = vnet_event_napi(port, budget); - - if (processed < budget) { -- napi_complete(napi); -+ napi_complete_done(napi, processed); - port->rx_event &= ~LDC_EVENT_DATA_READY; - vio_set_intr(vio->vdev->rx_ino, HV_INTR_ENABLED); - } ---- a/drivers/net/ethernet/tehuti/tehuti.c -+++ b/drivers/net/ethernet/tehuti/tehuti.c -@@ -303,7 +303,7 @@ static int bdx_poll(struct napi_struct * - * device lock and allow waiting tasks (eg rmmod) to advance) */ - priv->napi_stop = 0; - -- napi_complete(napi); -+ napi_complete_done(napi, work_done); - bdx_enable_interrupts(priv); - } - return work_done; ---- a/drivers/net/ethernet/ti/cpsw.c -+++ b/drivers/net/ethernet/ti/cpsw.c -@@ -843,7 +843,7 @@ static int cpsw_rx_poll(struct napi_stru - } - - if (num_rx < budget) { -- napi_complete(napi_rx); -+ napi_complete_done(napi_rx, num_rx); - writel(0xff, &cpsw->wr_regs->rx_en); - if (cpsw->quirk_irq && cpsw->rx_irq_disabled) { - cpsw->rx_irq_disabled = false; ---- a/drivers/net/ethernet/ti/davinci_emac.c -+++ b/drivers/net/ethernet/ti/davinci_emac.c -@@ -1295,7 +1295,7 @@ static int emac_poll(struct napi_struct - &emac_rxhost_errcodes[cause][0], ch); - } - } else if (num_rx_pkts < budget) { -- napi_complete(napi); -+ napi_complete_done(napi, num_rx_pkts); - emac_int_enable(priv); - } - ---- a/drivers/net/ethernet/ti/netcp_core.c -+++ b/drivers/net/ethernet/ti/netcp_core.c -@@ -939,7 +939,7 @@ static int netcp_rx_poll(struct napi_str - - netcp_rxpool_refill(netcp); - if (packets < budget) { -- napi_complete(&netcp->rx_napi); -+ napi_complete_done(&netcp->rx_napi, packets); - knav_queue_enable_notify(netcp->rx_queue); - } - ---- a/drivers/net/ethernet/tile/tilegx.c -+++ b/drivers/net/ethernet/tile/tilegx.c -@@ -678,7 +678,7 @@ static int tile_net_poll(struct napi_str - } - - /* There are no packets left. */ -- napi_complete(&info_mpipe->napi); -+ napi_complete_done(&info_mpipe->napi, work); - - md = &mpipe_data[instance]; - /* Re-enable hypervisor interrupts. */ ---- a/drivers/net/ethernet/tile/tilepro.c -+++ b/drivers/net/ethernet/tile/tilepro.c -@@ -842,7 +842,7 @@ static int tile_net_poll(struct napi_str - } - } - -- napi_complete(&info->napi); -+ napi_complete_done(&info->napi, work); - - if (!priv->active) - goto done; ---- a/drivers/net/ethernet/toshiba/ps3_gelic_net.c -+++ b/drivers/net/ethernet/toshiba/ps3_gelic_net.c -@@ -1109,7 +1109,7 @@ static int gelic_net_poll(struct napi_st - } - - if (packets_done < budget) { -- napi_complete(napi); -+ napi_complete_done(napi, packets_done); - gelic_card_rx_irq_on(card); - } - return packets_done; ---- a/drivers/net/ethernet/toshiba/spider_net.c -+++ b/drivers/net/ethernet/toshiba/spider_net.c -@@ -1270,7 +1270,7 @@ static int spider_net_poll(struct napi_s - /* if all packets are in the stack, enable interrupts and return 0 */ - /* if not, return 1 */ - if (packets_done < budget) { -- napi_complete(napi); -+ napi_complete_done(napi, packets_done); - spider_net_rx_irq_on(card); - card->ignore_rx_ramfull = 0; - } ---- a/drivers/net/ethernet/toshiba/tc35815.c -+++ b/drivers/net/ethernet/toshiba/tc35815.c -@@ -1639,7 +1639,7 @@ static int tc35815_poll(struct napi_stru - spin_unlock(&lp->rx_lock); - - if (received < budget) { -- napi_complete(napi); -+ napi_complete_done(napi, received); - /* enable interrupts */ - tc_writel(tc_readl(&tr->DMA_Ctl) & ~DMA_IntMask, &tr->DMA_Ctl); - } ---- a/drivers/net/ethernet/tundra/tsi108_eth.c -+++ b/drivers/net/ethernet/tundra/tsi108_eth.c -@@ -887,7 +887,7 @@ static int tsi108_poll(struct napi_struc - - if (num_received < budget) { - data->rxpending = 0; -- napi_complete(napi); -+ napi_complete_done(napi, num_received); - - TSI_WRITE(TSI108_EC_INTMASK, - TSI_READ(TSI108_EC_INTMASK) ---- a/drivers/net/ethernet/via/via-rhine.c -+++ b/drivers/net/ethernet/via/via-rhine.c -@@ -861,7 +861,7 @@ static int rhine_napipoll(struct napi_st - } - - if (work_done < budget) { -- napi_complete(napi); -+ napi_complete_done(napi, work_done); - iowrite16(enable_mask, ioaddr + IntrEnable); - mmiowb(); - } ---- a/drivers/net/ethernet/via/via-velocity.c -+++ b/drivers/net/ethernet/via/via-velocity.c -@@ -2160,7 +2160,7 @@ static int velocity_poll(struct napi_str - velocity_tx_srv(vptr); - /* If budget not fully consumed, exit the polling mode */ - if (rx_done < budget) { -- napi_complete(napi); -+ napi_complete_done(napi, rx_done); - mac_enable_int(vptr->mac_regs); - } - spin_unlock_irqrestore(&vptr->lock, flags); ---- a/drivers/net/ethernet/wiznet/w5100.c -+++ b/drivers/net/ethernet/wiznet/w5100.c -@@ -915,7 +915,7 @@ static int w5100_napi_poll(struct napi_s - } - - if (rx_count < budget) { -- napi_complete(napi); -+ napi_complete_done(napi, rx_count); - w5100_enable_intr(priv); - } - ---- a/drivers/net/ethernet/wiznet/w5300.c -+++ b/drivers/net/ethernet/wiznet/w5300.c -@@ -417,7 +417,7 @@ static int w5300_napi_poll(struct napi_s - } - - if (rx_count < budget) { -- napi_complete(napi); -+ napi_complete_done(napi, rx_count); - w5300_write(priv, W5300_IMR, IR_S0); - mmiowb(); - } ---- a/drivers/net/fjes/fjes_main.c -+++ b/drivers/net/fjes/fjes_main.c -@@ -1122,7 +1122,7 @@ static int fjes_poll(struct napi_struct - } - - if (work_done < budget) { -- napi_complete(napi); -+ napi_complete_done(napi, work_done); - - if (adapter->unset_rx_last) { - adapter->rx_last_jiffies = jiffies; ---- a/drivers/net/vmxnet3/vmxnet3_drv.c -+++ b/drivers/net/vmxnet3/vmxnet3_drv.c -@@ -1873,7 +1873,7 @@ vmxnet3_poll(struct napi_struct *napi, i - rxd_done = vmxnet3_do_poll(rx_queue->adapter, budget); - - if (rxd_done < budget) { -- napi_complete(napi); -+ napi_complete_done(napi, rxd_done); - vmxnet3_enable_all_intrs(rx_queue->adapter); - } - return rxd_done; -@@ -1904,7 +1904,7 @@ vmxnet3_poll_rx_only(struct napi_struct - rxd_done = vmxnet3_rq_rx_complete(rq, adapter, budget); - - if (rxd_done < budget) { -- napi_complete(napi); -+ napi_complete_done(napi, rxd_done); - vmxnet3_enable_intr(adapter, rq->comp_ring.intr_idx); - } - return rxd_done; ---- a/drivers/net/wan/fsl_ucc_hdlc.c -+++ b/drivers/net/wan/fsl_ucc_hdlc.c -@@ -573,7 +573,7 @@ static int ucc_hdlc_poll(struct napi_str - howmany += hdlc_rx_done(priv, budget - howmany); - - if (howmany < budget) { -- napi_complete(napi); -+ napi_complete_done(napi, howmany); - qe_setbits32(priv->uccf->p_uccm, - (UCCE_HDLC_RX_EVENTS | UCCE_HDLC_TX_EVENTS) << 16); - } ---- a/drivers/net/wan/hd64572.c -+++ b/drivers/net/wan/hd64572.c -@@ -341,7 +341,7 @@ static int sca_poll(struct napi_struct * - received = sca_rx_done(port, budget); - - if (received < budget) { -- napi_complete(napi); -+ napi_complete_done(napi, received); - enable_intr(port); - } - ---- a/drivers/net/wireless/ath/ath10k/pci.c -+++ b/drivers/net/wireless/ath/ath10k/pci.c -@@ -2804,7 +2804,7 @@ static int ath10k_pci_napi_poll(struct n - done = ath10k_htt_txrx_compl_task(ar, budget); - - if (done < budget) { -- napi_complete(ctx); -+ napi_complete_done(ctx, done); - /* In case of MSI, it is possible that interrupts are received - * while NAPI poll is inprogress. So pending interrupts that are - * received after processing all copy engine pipes by NAPI poll ---- a/drivers/net/wireless/ath/wil6210/netdev.c -+++ b/drivers/net/wireless/ath/wil6210/netdev.c -@@ -84,7 +84,7 @@ static int wil6210_netdev_poll_rx(struct - done = budget - quota; - - if (done < budget) { -- napi_complete(napi); -+ napi_complete_done(napi, done); - wil6210_unmask_irq_rx(wil); - wil_dbg_txrx(wil, "NAPI RX complete\n"); - } ---- a/drivers/net/xen-netback/interface.c -+++ b/drivers/net/xen-netback/interface.c -@@ -104,7 +104,7 @@ static int xenvif_poll(struct napi_struc - work_done = xenvif_tx_action(queue, budget); - - if (work_done < budget) { -- napi_complete(napi); -+ napi_complete_done(napi, work_done); - /* If the queue is rate-limited, it shall be - * rescheduled in the timer callback. - */ ---- a/drivers/net/xen-netfront.c -+++ b/drivers/net/xen-netfront.c -@@ -1070,7 +1070,7 @@ err: - if (work_done < budget) { - int more_to_do = 0; - -- napi_complete(napi); -+ napi_complete_done(napi, work_done); - - RING_FINAL_CHECK_FOR_RESPONSES(&queue->rx, more_to_do); - if (more_to_do) ---- a/drivers/staging/octeon/ethernet-rx.c -+++ b/drivers/staging/octeon/ethernet-rx.c -@@ -429,7 +429,7 @@ static int cvm_oct_napi_poll(struct napi - - if (rx_count < budget) { - /* No more work */ -- napi_complete(napi); -+ napi_complete_done(napi, rx_count); - enable_irq(rx_group->irq); - } - return rx_count; ---- a/drivers/staging/unisys/visornic/visornic_main.c -+++ b/drivers/staging/unisys/visornic/visornic_main.c -@@ -1657,7 +1657,7 @@ static int visornic_poll(struct napi_str - - /* If there aren't any more packets to receive stop the poll */ - if (rx_count < budget) -- napi_complete(napi); -+ napi_complete_done(napi, rx_count); - - return rx_count; - } diff --git a/target/linux/generic/backport-4.9/094-v4.12-0001-ip6_tunnel-Fix-missing-tunnel-encapsulation-limit-op.patch b/target/linux/generic/backport-4.9/094-v4.12-0001-ip6_tunnel-Fix-missing-tunnel-encapsulation-limit-op.patch deleted file mode 100644 index 7c3c5608c5..0000000000 --- a/target/linux/generic/backport-4.9/094-v4.12-0001-ip6_tunnel-Fix-missing-tunnel-encapsulation-limit-op.patch +++ /dev/null @@ -1,50 +0,0 @@ -From 89a23c8b528bd2c89f3981573d6cd7d23840c8a6 Mon Sep 17 00:00:00 2001 -From: Craig Gallek -Date: Wed, 26 Apr 2017 14:37:45 -0400 -Subject: [PATCH] ip6_tunnel: Fix missing tunnel encapsulation limit option - -The IPv6 tunneling code tries to insert IPV6_TLV_TNL_ENCAP_LIMIT and -IPV6_TLV_PADN options when an encapsulation limit is defined (the -default is a limit of 4). An MTU adjustment is done to account for -these options as well. However, the options are never present in the -generated packets. - -The issue appears to be a subtlety between IPV6_DSTOPTS and -IPV6_RTHDRDSTOPTS defined in RFC 3542. When the IPIP tunnel driver was -written, the encap limit options were included as IPV6_RTHDRDSTOPTS in -dst0opt of struct ipv6_txoptions. Later, ipv6_push_nfrags_opts was -(correctly) updated to require IPV6_RTHDR options when IPV6_RTHDRDSTOPTS -are to be used. This caused the options to no longer be included in v6 -encapsulated packets. - -The fix is to use IPV6_DSTOPTS (in dst1opt of struct ipv6_txoptions) -instead. IPV6_DSTOPTS do not have the additional IPV6_RTHDR requirement. - -Fixes: 1df64a8569c7: ("[IPV6]: Add ip6ip6 tunnel driver.") -Fixes: 333fad5364d6: ("[IPV6]: Support several new sockopt / ancillary data in Advanced API (RFC3542)") -Signed-off-by: Craig Gallek -Signed-off-by: David S. Miller ---- - net/ipv6/ip6_tunnel.c | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - ---- a/net/ipv6/ip6_tunnel.c -+++ b/net/ipv6/ip6_tunnel.c -@@ -958,7 +958,7 @@ static void init_tel_txopt(struct ipv6_t - opt->dst_opt[5] = IPV6_TLV_PADN; - opt->dst_opt[6] = 1; - -- opt->ops.dst0opt = (struct ipv6_opt_hdr *) opt->dst_opt; -+ opt->ops.dst1opt = (struct ipv6_opt_hdr *) opt->dst_opt; - opt->ops.opt_nflen = 8; - } - -@@ -1200,7 +1200,7 @@ route_lookup: - - if (encap_limit >= 0) { - init_tel_txopt(&opt, encap_limit); -- ipv6_push_nfrag_opts(skb, &opt.ops, &proto, NULL); -+ ipv6_push_frag_opts(skb, &opt.ops, &proto); - } - - skb_push(skb, sizeof(struct ipv6hdr)); diff --git a/target/linux/generic/backport-4.9/094-v4.12-0002-ipv6-Need-to-export-ipv6_push_frag_opts-for-tunnelin.patch b/target/linux/generic/backport-4.9/094-v4.12-0002-ipv6-Need-to-export-ipv6_push_frag_opts-for-tunnelin.patch deleted file mode 100644 index d102e7bb85..0000000000 --- a/target/linux/generic/backport-4.9/094-v4.12-0002-ipv6-Need-to-export-ipv6_push_frag_opts-for-tunnelin.patch +++ /dev/null @@ -1,31 +0,0 @@ -From 5b8481fa42ac58484d633b558579e302aead64c1 Mon Sep 17 00:00:00 2001 -From: "David S. Miller" -Date: Mon, 1 May 2017 15:10:20 -0400 -Subject: [PATCH] ipv6: Need to export ipv6_push_frag_opts for tunneling now. - -Since that change also made the nfrag function not necessary -for exports, remove it. - -Fixes: 89a23c8b528b ("ip6_tunnel: Fix missing tunnel encapsulation limit option") -Signed-off-by: David S. Miller ---- - net/ipv6/exthdrs.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - ---- a/net/ipv6/exthdrs.c -+++ b/net/ipv6/exthdrs.c -@@ -729,13 +729,13 @@ void ipv6_push_nfrag_opts(struct sk_buff - if (opt->hopopt) - ipv6_push_exthdr(skb, proto, NEXTHDR_HOP, opt->hopopt); - } --EXPORT_SYMBOL(ipv6_push_nfrag_opts); - - void ipv6_push_frag_opts(struct sk_buff *skb, struct ipv6_txoptions *opt, u8 *proto) - { - if (opt->dst1opt) - ipv6_push_exthdr(skb, proto, NEXTHDR_DEST, opt->dst1opt); - } -+EXPORT_SYMBOL(ipv6_push_frag_opts); - - struct ipv6_txoptions * - ipv6_dup_options(struct sock *sk, struct ipv6_txoptions *opt) diff --git a/target/linux/generic/backport-4.9/095-Allow-class-e-address-assignment-via-ifconfig-ioctl.patch b/target/linux/generic/backport-4.9/095-Allow-class-e-address-assignment-via-ifconfig-ioctl.patch deleted file mode 100644 index 38ae076678..0000000000 --- a/target/linux/generic/backport-4.9/095-Allow-class-e-address-assignment-via-ifconfig-ioctl.patch +++ /dev/null @@ -1,79 +0,0 @@ -From 46bf067870156abd61fe24d14c2486d15b8b502c Mon Sep 17 00:00:00 2001 -From: Dave Taht -Date: Fri, 14 Dec 2018 18:38:40 +0000 -Subject: [PATCH 1/1] Allow class-e address assignment in ifconfig and early - boot - -While the linux kernel became mostly "class-e clean" a decade ago, -and most distributions long ago switched to the iproute2 suite -of utilities, which allow class-e (240.0.0.0/4) address assignment, -distributions relying on busybox, toybox and other forms of -ifconfig cannot assign class-e addresses without this kernel patch. - -With this patch, also, a boot command line on these addresses is feasible: -(ip=248.0.1.2::248.0.1.1:255.255.255.0). - -While CIDR has been obsolete for 2 decades, and a survey of all the -userspace open source code in the world shows most IN_whatever macros -are also obsolete... rather than obsolete CIDR from this ioctl entirely, -this patch merely enables class-e assignment, sanely. - -H/T to Vince Fuller and his original patch here: - https://lkml.org/lkml/2008/1/7/370 - -Signed-off-by: Dave Taht -Reviewed-by: John Gilmore ---- - include/uapi/linux/in.h | 8 ++++++-- - net/ipv4/devinet.c | 4 +++- - net/ipv4/ipconfig.c | 2 ++ - 3 files changed, 11 insertions(+), 3 deletions(-) - ---- a/include/uapi/linux/in.h -+++ b/include/uapi/linux/in.h -@@ -266,8 +266,12 @@ struct sockaddr_in { - #define IN_MULTICAST(a) IN_CLASSD(a) - #define IN_MULTICAST_NET 0xF0000000 - --#define IN_EXPERIMENTAL(a) ((((long int) (a)) & 0xf0000000) == 0xf0000000) --#define IN_BADCLASS(a) IN_EXPERIMENTAL((a)) -+#define IN_BADCLASS(a) (((long int) (a) ) == (long int)0xffffffff) -+#define IN_EXPERIMENTAL(a) IN_BADCLASS((a)) -+ -+#define IN_CLASSE(a) ((((long int) (a)) & 0xf0000000) == 0xf0000000) -+#define IN_CLASSE_NET 0xffffffff -+#define IN_CLASSE_NSHIFT 0 - - /* Address to accept any incoming messages. */ - #define INADDR_ANY ((unsigned long int) 0x00000000) ---- a/net/ipv4/devinet.c -+++ b/net/ipv4/devinet.c -@@ -898,7 +898,7 @@ static int inet_abc_len(__be32 addr) - { - int rc = -1; /* Something else, probably a multicast. */ - -- if (ipv4_is_zeronet(addr)) -+ if (ipv4_is_zeronet(addr) || ipv4_is_lbcast(addr)) - rc = 0; - else { - __u32 haddr = ntohl(addr); -@@ -909,6 +909,8 @@ static int inet_abc_len(__be32 addr) - rc = 16; - else if (IN_CLASSC(haddr)) - rc = 24; -+ else if (IN_CLASSE(haddr)) -+ rc = 32; - } - - return rc; ---- a/net/ipv4/ipconfig.c -+++ b/net/ipv4/ipconfig.c -@@ -455,6 +455,8 @@ static int __init ic_defaults(void) - ic_netmask = htonl(IN_CLASSB_NET); - else if (IN_CLASSC(ntohl(ic_myaddr))) - ic_netmask = htonl(IN_CLASSC_NET); -+ else if (IN_CLASSE(ntohl(ic_myaddr))) -+ ic_netmask = htonl(IN_CLASSE_NET); - else { - pr_err("IP-Config: Unable to guess netmask for address %pI4\n", - &ic_myaddr); diff --git a/target/linux/generic/backport-4.9/095-v4.13-0001-rtc-ds1307-add-ds1308-variant.patch b/target/linux/generic/backport-4.9/095-v4.13-0001-rtc-ds1307-add-ds1308-variant.patch deleted file mode 100644 index 963466143c..0000000000 --- a/target/linux/generic/backport-4.9/095-v4.13-0001-rtc-ds1307-add-ds1308-variant.patch +++ /dev/null @@ -1,51 +0,0 @@ -From 300a7735becf55f7fd18f8cd3dc3b945a0cab712 Mon Sep 17 00:00:00 2001 -From: Sean Nyekjaer -Date: Thu, 8 Jun 2017 12:36:54 +0200 -Subject: rtc: ds1307: add ds1308 variant - -The ds1308 variant is very similar to the already supported ds1338 -variant, it have more debug registers and a square wave clock output. - -Signed-off-by: Sean Nyekjaer -Signed-off-by: Alexandre Belloni ---- - drivers/rtc/rtc-ds1307.c | 12 ++++++++++++ - 1 file changed, 12 insertions(+) - ---- a/drivers/rtc/rtc-ds1307.c -+++ b/drivers/rtc/rtc-ds1307.c -@@ -31,6 +31,7 @@ - */ - enum ds_type { - ds_1307, -+ ds_1308, - ds_1337, - ds_1338, - ds_1339, -@@ -144,6 +145,10 @@ static struct chip_desc chips[last_ds_ty - .nvram_offset = 8, - .nvram_size = 56, - }, -+ [ds_1308] = { -+ .nvram_offset = 8, -+ .nvram_size = 56, -+ }, - [ds_1337] = { - .alarm = 1, - }, -@@ -175,6 +180,7 @@ static struct chip_desc chips[last_ds_ty - - static const struct i2c_device_id ds1307_id[] = { - { "ds1307", ds_1307 }, -+ { "ds1308", ds_1308 }, - { "ds1337", ds_1337 }, - { "ds1338", ds_1338 }, - { "ds1339", ds_1339 }, -@@ -1488,6 +1494,7 @@ read_rtc: - goto read_rtc; - } - break; -+ case ds_1308: - case ds_1338: - /* clock halted? turn it on, so clock can tick. */ - if (tmp & DS1307_BIT_CH) diff --git a/target/linux/generic/backport-4.9/096-v4.20-netfilter-ipv6-Preserve-link-scope-traffic-original-.patch b/target/linux/generic/backport-4.9/096-v4.20-netfilter-ipv6-Preserve-link-scope-traffic-original-.patch deleted file mode 100644 index bfb7690dec..0000000000 --- a/target/linux/generic/backport-4.9/096-v4.20-netfilter-ipv6-Preserve-link-scope-traffic-original-.patch +++ /dev/null @@ -1,32 +0,0 @@ -From 508b09046c0f21678652fb66fd1e9959d55591d2 Mon Sep 17 00:00:00 2001 -From: Alin Nastac -Date: Wed, 21 Nov 2018 14:00:30 +0100 -Subject: [PATCH] netfilter: ipv6: Preserve link scope traffic original oif - -When ip6_route_me_harder is invoked, it resets outgoing interface of: - - link-local scoped packets sent by neighbor discovery - - multicast packets sent by MLD host - - multicast packets send by MLD proxy daemon that sets outgoing - interface through IPV6_PKTINFO ipi6_ifindex - -Link-local and multicast packets must keep their original oif after -ip6_route_me_harder is called. - -Signed-off-by: Alin Nastac -Signed-off-by: Pablo Neira Ayuso ---- - net/ipv6/netfilter.c | 3 ++- - 1 file changed, 2 insertions(+), 1 deletion(-) - ---- a/net/ipv6/netfilter.c -+++ b/net/ipv6/netfilter.c -@@ -24,7 +24,8 @@ int ip6_route_me_harder(struct net *net, - unsigned int hh_len; - struct dst_entry *dst; - struct flowi6 fl6 = { -- .flowi6_oif = skb->sk ? skb->sk->sk_bound_dev_if : 0, -+ .flowi6_oif = skb->sk && skb->sk->sk_bound_dev_if ? skb->sk->sk_bound_dev_if : -+ rt6_need_strict(&iph->daddr) ? skb_dst(skb)->dev->ifindex : 0, - .flowi6_mark = skb->mark, - .daddr = iph->daddr, - .saddr = iph->saddr, diff --git a/target/linux/generic/backport-4.9/101-arm-cns3xxx-use-actual-size-reads-for-PCIe.patch b/target/linux/generic/backport-4.9/101-arm-cns3xxx-use-actual-size-reads-for-PCIe.patch deleted file mode 100644 index 2b3384391a..0000000000 --- a/target/linux/generic/backport-4.9/101-arm-cns3xxx-use-actual-size-reads-for-PCIe.patch +++ /dev/null @@ -1,46 +0,0 @@ -From 4cc30de79d293f1e8c5f50ae3a9c005def9564a0 Mon Sep 17 00:00:00 2001 -From: Koen Vandeputte -Date: Mon, 7 Jan 2019 14:14:27 +0100 -Subject: [PATCH 2/2] arm: cns3xxx: use actual size reads for PCIe - -commit 802b7c06adc7 ("ARM: cns3xxx: Convert PCI to use generic config accessors") -reimplemented cns3xxx_pci_read_config() using pci_generic_config_read32(), -which preserved the property of only doing 32-bit reads. - -It also replaced cns3xxx_pci_write_config() with pci_generic_config_write(), -so it changed writes from always being 32 bits to being the actual size, -which works just fine. - -Due to: -- The documentation does not mention that only 32 bit access is allowed. -- Writes are already executed using the actual size -- Extensive testing shows that 8b, 16b and 32b reads work as intended - -It makes perfectly sense to also swap 32 bit reading in favor of actual size. - -Fixes: 802b7c06adc7 ("ARM: cns3xxx: Convert PCI to use generic config accessors") -Suggested-by: Bjorn Helgaas -Signed-off-by: Koen Vandeputte -CC: Arnd Bergmann -CC: Krzysztof Halasa -CC: Olof Johansson -CC: Robin Leblon -CC: Rob Herring -CC: Russell King -CC: Tim Harvey -CC: stable@vger.kernel.org # v4.0+ ---- - arch/arm/mach-cns3xxx/pcie.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - ---- a/arch/arm/mach-cns3xxx/pcie.c -+++ b/arch/arm/mach-cns3xxx/pcie.c -@@ -93,7 +93,7 @@ static int cns3xxx_pci_read_config(struc - u32 mask = (0x1ull << (size * 8)) - 1; - int shift = (where % 4) * 8; - -- ret = pci_generic_config_read32(bus, devfn, where, size, val); -+ ret = pci_generic_config_read(bus, devfn, where, size, val); - - if (ret == PCIBIOS_SUCCESSFUL && !bus->number && !devfn && - (where & 0xffc) == PCI_CLASS_REVISION) diff --git a/target/linux/generic/backport-4.9/400-v4.16-leds-trigger-Introduce-a-NETDEV-trigger.patch b/target/linux/generic/backport-4.9/400-v4.16-leds-trigger-Introduce-a-NETDEV-trigger.patch deleted file mode 100644 index bd58df63c0..0000000000 --- a/target/linux/generic/backport-4.9/400-v4.16-leds-trigger-Introduce-a-NETDEV-trigger.patch +++ /dev/null @@ -1,588 +0,0 @@ -From 06f502f57d0d7728f9fa0f157ec5e4111ddb98f6 Mon Sep 17 00:00:00 2001 -From: Ben Whitten -Date: Sun, 10 Dec 2017 21:17:55 +0000 -Subject: [PATCH] leds: trigger: Introduce a NETDEV trigger - -This commit introduces a NETDEV trigger for named device -activity. Available triggers are link, rx, and tx. - -Signed-off-by: Ben Whitten -Acked-by: Pavel Machek -Signed-off-by: Jacek Anaszewski ---- - .../ABI/testing/sysfs-class-led-trigger-netdev | 45 ++ - drivers/leds/trigger/Kconfig | 7 + - drivers/leds/trigger/Makefile | 1 + - drivers/leds/trigger/ledtrig-netdev.c | 496 +++++++++++++++++++++ - 4 files changed, 549 insertions(+) - create mode 100644 Documentation/ABI/testing/sysfs-class-led-trigger-netdev - create mode 100644 drivers/leds/trigger/ledtrig-netdev.c - ---- /dev/null -+++ b/Documentation/ABI/testing/sysfs-class-led-trigger-netdev -@@ -0,0 +1,45 @@ -+What: /sys/class/leds//device_name -+Date: Dec 2017 -+KernelVersion: 4.16 -+Contact: linux-leds@vger.kernel.org -+Description: -+ Specifies the network device name to monitor. -+ -+What: /sys/class/leds//interval -+Date: Dec 2017 -+KernelVersion: 4.16 -+Contact: linux-leds@vger.kernel.org -+Description: -+ Specifies the duration of the LED blink in milliseconds. -+ Defaults to 50 ms. -+ -+What: /sys/class/leds//link -+Date: Dec 2017 -+KernelVersion: 4.16 -+Contact: linux-leds@vger.kernel.org -+Description: -+ Signal the link state of the named network device. -+ If set to 0 (default), the LED's normal state is off. -+ If set to 1, the LED's normal state reflects the link state -+ of the named network device. -+ Setting this value also immediately changes the LED state. -+ -+What: /sys/class/leds//tx -+Date: Dec 2017 -+KernelVersion: 4.16 -+Contact: linux-leds@vger.kernel.org -+Description: -+ Signal transmission of data on the named network device. -+ If set to 0 (default), the LED will not blink on transmission. -+ If set to 1, the LED will blink for the milliseconds specified -+ in interval to signal transmission. -+ -+What: /sys/class/leds//rx -+Date: Dec 2017 -+KernelVersion: 4.16 -+Contact: linux-leds@vger.kernel.org -+Description: -+ Signal reception of data on the named network device. -+ If set to 0 (default), the LED will not blink on reception. -+ If set to 1, the LED will blink for the milliseconds specified -+ in interval to signal reception. ---- a/drivers/leds/trigger/Kconfig -+++ b/drivers/leds/trigger/Kconfig -@@ -126,4 +126,11 @@ config LEDS_TRIGGER_PANIC - a different trigger. - If unsure, say Y. - -+config LEDS_TRIGGER_NETDEV -+ tristate "LED Netdev Trigger" -+ depends on NET && LEDS_TRIGGERS -+ help -+ This allows LEDs to be controlled by network device activity. -+ If unsure, say Y. -+ - endif # LEDS_TRIGGERS ---- a/drivers/leds/trigger/Makefile -+++ b/drivers/leds/trigger/Makefile -@@ -10,3 +10,4 @@ obj-$(CONFIG_LEDS_TRIGGER_DEFAULT_ON) += - obj-$(CONFIG_LEDS_TRIGGER_TRANSIENT) += ledtrig-transient.o - obj-$(CONFIG_LEDS_TRIGGER_CAMERA) += ledtrig-camera.o - obj-$(CONFIG_LEDS_TRIGGER_PANIC) += ledtrig-panic.o -+obj-$(CONFIG_LEDS_TRIGGER_NETDEV) += ledtrig-netdev.o ---- /dev/null -+++ b/drivers/leds/trigger/ledtrig-netdev.c -@@ -0,0 +1,496 @@ -+// SPDX-License-Identifier: GPL-2.0 -+// Copyright 2017 Ben Whitten -+// Copyright 2007 Oliver Jowett -+// -+// LED Kernel Netdev Trigger -+// -+// Toggles the LED to reflect the link and traffic state of a named net device -+// -+// Derived from ledtrig-timer.c which is: -+// Copyright 2005-2006 Openedhand Ltd. -+// Author: Richard Purdie -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include "../leds.h" -+ -+/* -+ * Configurable sysfs attributes: -+ * -+ * device_name - network device name to monitor -+ * interval - duration of LED blink, in milliseconds -+ * link - LED's normal state reflects whether the link is up -+ * (has carrier) or not -+ * tx - LED blinks on transmitted data -+ * rx - LED blinks on receive data -+ * -+ */ -+ -+struct led_netdev_data { -+ spinlock_t lock; -+ -+ struct delayed_work work; -+ struct notifier_block notifier; -+ -+ struct led_classdev *led_cdev; -+ struct net_device *net_dev; -+ -+ char device_name[IFNAMSIZ]; -+ atomic_t interval; -+ unsigned int last_activity; -+ -+ unsigned long mode; -+#define NETDEV_LED_LINK 0 -+#define NETDEV_LED_TX 1 -+#define NETDEV_LED_RX 2 -+#define NETDEV_LED_MODE_LINKUP 3 -+}; -+ -+enum netdev_led_attr { -+ NETDEV_ATTR_LINK, -+ NETDEV_ATTR_TX, -+ NETDEV_ATTR_RX -+}; -+ -+static void set_baseline_state(struct led_netdev_data *trigger_data) -+{ -+ int current_brightness; -+ struct led_classdev *led_cdev = trigger_data->led_cdev; -+ -+ current_brightness = led_cdev->brightness; -+ if (current_brightness) -+ led_cdev->blink_brightness = current_brightness; -+ if (!led_cdev->blink_brightness) -+ led_cdev->blink_brightness = led_cdev->max_brightness; -+ -+ if (!test_bit(NETDEV_LED_MODE_LINKUP, &trigger_data->mode)) -+ led_set_brightness(led_cdev, LED_OFF); -+ else { -+ if (test_bit(NETDEV_LED_LINK, &trigger_data->mode)) -+ led_set_brightness(led_cdev, -+ led_cdev->blink_brightness); -+ else -+ led_set_brightness(led_cdev, LED_OFF); -+ -+ /* If we are looking for RX/TX start periodically -+ * checking stats -+ */ -+ if (test_bit(NETDEV_LED_TX, &trigger_data->mode) || -+ test_bit(NETDEV_LED_RX, &trigger_data->mode)) -+ schedule_delayed_work(&trigger_data->work, 0); -+ } -+} -+ -+static ssize_t device_name_show(struct device *dev, -+ struct device_attribute *attr, char *buf) -+{ -+ struct led_classdev *led_cdev = dev_get_drvdata(dev); -+ struct led_netdev_data *trigger_data = led_cdev->trigger_data; -+ ssize_t len; -+ -+ spin_lock_bh(&trigger_data->lock); -+ len = sprintf(buf, "%s\n", trigger_data->device_name); -+ spin_unlock_bh(&trigger_data->lock); -+ -+ return len; -+} -+ -+static ssize_t device_name_store(struct device *dev, -+ struct device_attribute *attr, const char *buf, -+ size_t size) -+{ -+ struct led_classdev *led_cdev = dev_get_drvdata(dev); -+ struct led_netdev_data *trigger_data = led_cdev->trigger_data; -+ -+ if (size >= IFNAMSIZ) -+ return -EINVAL; -+ -+ cancel_delayed_work_sync(&trigger_data->work); -+ -+ spin_lock_bh(&trigger_data->lock); -+ -+ if (trigger_data->net_dev) { -+ dev_put(trigger_data->net_dev); -+ trigger_data->net_dev = NULL; -+ } -+ -+ strncpy(trigger_data->device_name, buf, size); -+ if (size > 0 && trigger_data->device_name[size - 1] == '\n') -+ trigger_data->device_name[size - 1] = 0; -+ -+ if (trigger_data->device_name[0] != 0) -+ trigger_data->net_dev = -+ dev_get_by_name(&init_net, trigger_data->device_name); -+ -+ clear_bit(NETDEV_LED_MODE_LINKUP, &trigger_data->mode); -+ if (trigger_data->net_dev != NULL) -+ if (netif_carrier_ok(trigger_data->net_dev)) -+ set_bit(NETDEV_LED_MODE_LINKUP, &trigger_data->mode); -+ -+ trigger_data->last_activity = 0; -+ -+ set_baseline_state(trigger_data); -+ spin_unlock_bh(&trigger_data->lock); -+ -+ return size; -+} -+ -+static DEVICE_ATTR_RW(device_name); -+ -+static ssize_t netdev_led_attr_show(struct device *dev, char *buf, -+ enum netdev_led_attr attr) -+{ -+ struct led_classdev *led_cdev = dev_get_drvdata(dev); -+ struct led_netdev_data *trigger_data = led_cdev->trigger_data; -+ int bit; -+ -+ switch (attr) { -+ case NETDEV_ATTR_LINK: -+ bit = NETDEV_LED_LINK; -+ break; -+ case NETDEV_ATTR_TX: -+ bit = NETDEV_LED_TX; -+ break; -+ case NETDEV_ATTR_RX: -+ bit = NETDEV_LED_RX; -+ break; -+ default: -+ return -EINVAL; -+ } -+ -+ return sprintf(buf, "%u\n", test_bit(bit, &trigger_data->mode)); -+} -+ -+static ssize_t netdev_led_attr_store(struct device *dev, const char *buf, -+ size_t size, enum netdev_led_attr attr) -+{ -+ struct led_classdev *led_cdev = dev_get_drvdata(dev); -+ struct led_netdev_data *trigger_data = led_cdev->trigger_data; -+ unsigned long state; -+ int ret; -+ int bit; -+ -+ ret = kstrtoul(buf, 0, &state); -+ if (ret) -+ return ret; -+ -+ switch (attr) { -+ case NETDEV_ATTR_LINK: -+ bit = NETDEV_LED_LINK; -+ break; -+ case NETDEV_ATTR_TX: -+ bit = NETDEV_LED_TX; -+ break; -+ case NETDEV_ATTR_RX: -+ bit = NETDEV_LED_RX; -+ break; -+ default: -+ return -EINVAL; -+ } -+ -+ cancel_delayed_work_sync(&trigger_data->work); -+ -+ if (state) -+ set_bit(bit, &trigger_data->mode); -+ else -+ clear_bit(bit, &trigger_data->mode); -+ -+ set_baseline_state(trigger_data); -+ -+ return size; -+} -+ -+static ssize_t link_show(struct device *dev, -+ struct device_attribute *attr, char *buf) -+{ -+ return netdev_led_attr_show(dev, buf, NETDEV_ATTR_LINK); -+} -+ -+static ssize_t link_store(struct device *dev, -+ struct device_attribute *attr, const char *buf, size_t size) -+{ -+ return netdev_led_attr_store(dev, buf, size, NETDEV_ATTR_LINK); -+} -+ -+static DEVICE_ATTR_RW(link); -+ -+static ssize_t tx_show(struct device *dev, -+ struct device_attribute *attr, char *buf) -+{ -+ return netdev_led_attr_show(dev, buf, NETDEV_ATTR_TX); -+} -+ -+static ssize_t tx_store(struct device *dev, -+ struct device_attribute *attr, const char *buf, size_t size) -+{ -+ return netdev_led_attr_store(dev, buf, size, NETDEV_ATTR_TX); -+} -+ -+static DEVICE_ATTR_RW(tx); -+ -+static ssize_t rx_show(struct device *dev, -+ struct device_attribute *attr, char *buf) -+{ -+ return netdev_led_attr_show(dev, buf, NETDEV_ATTR_RX); -+} -+ -+static ssize_t rx_store(struct device *dev, -+ struct device_attribute *attr, const char *buf, size_t size) -+{ -+ return netdev_led_attr_store(dev, buf, size, NETDEV_ATTR_RX); -+} -+ -+static DEVICE_ATTR_RW(rx); -+ -+static ssize_t interval_show(struct device *dev, -+ struct device_attribute *attr, char *buf) -+{ -+ struct led_classdev *led_cdev = dev_get_drvdata(dev); -+ struct led_netdev_data *trigger_data = led_cdev->trigger_data; -+ -+ return sprintf(buf, "%u\n", -+ jiffies_to_msecs(atomic_read(&trigger_data->interval))); -+} -+ -+static ssize_t interval_store(struct device *dev, -+ struct device_attribute *attr, const char *buf, -+ size_t size) -+{ -+ struct led_classdev *led_cdev = dev_get_drvdata(dev); -+ struct led_netdev_data *trigger_data = led_cdev->trigger_data; -+ unsigned long value; -+ int ret; -+ -+ ret = kstrtoul(buf, 0, &value); -+ if (ret) -+ return ret; -+ -+ /* impose some basic bounds on the timer interval */ -+ if (value >= 5 && value <= 10000) { -+ cancel_delayed_work_sync(&trigger_data->work); -+ -+ atomic_set(&trigger_data->interval, msecs_to_jiffies(value)); -+ set_baseline_state(trigger_data); /* resets timer */ -+ } -+ -+ return size; -+} -+ -+static DEVICE_ATTR_RW(interval); -+ -+static int netdev_trig_notify(struct notifier_block *nb, -+ unsigned long evt, void *dv) -+{ -+ struct net_device *dev = -+ netdev_notifier_info_to_dev((struct netdev_notifier_info *)dv); -+ struct led_netdev_data *trigger_data = container_of(nb, -+ struct -+ led_netdev_data, -+ notifier); -+ -+ if (evt != NETDEV_UP && evt != NETDEV_DOWN && evt != NETDEV_CHANGE -+ && evt != NETDEV_REGISTER && evt != NETDEV_UNREGISTER -+ && evt != NETDEV_CHANGENAME) -+ return NOTIFY_DONE; -+ -+ if (strcmp(dev->name, trigger_data->device_name)) -+ return NOTIFY_DONE; -+ -+ cancel_delayed_work_sync(&trigger_data->work); -+ -+ spin_lock_bh(&trigger_data->lock); -+ -+ clear_bit(NETDEV_LED_MODE_LINKUP, &trigger_data->mode); -+ switch (evt) { -+ case NETDEV_REGISTER: -+ if (trigger_data->net_dev) -+ dev_put(trigger_data->net_dev); -+ dev_hold(dev); -+ trigger_data->net_dev = dev; -+ break; -+ case NETDEV_CHANGENAME: -+ case NETDEV_UNREGISTER: -+ if (trigger_data->net_dev) { -+ dev_put(trigger_data->net_dev); -+ trigger_data->net_dev = NULL; -+ } -+ break; -+ case NETDEV_UP: -+ case NETDEV_CHANGE: -+ if (netif_carrier_ok(dev)) -+ set_bit(NETDEV_LED_MODE_LINKUP, &trigger_data->mode); -+ break; -+ } -+ -+ set_baseline_state(trigger_data); -+ -+ spin_unlock_bh(&trigger_data->lock); -+ -+ return NOTIFY_DONE; -+} -+ -+/* here's the real work! */ -+static void netdev_trig_work(struct work_struct *work) -+{ -+ struct led_netdev_data *trigger_data = container_of(work, -+ struct -+ led_netdev_data, -+ work.work); -+ struct rtnl_link_stats64 *dev_stats; -+ unsigned int new_activity; -+ struct rtnl_link_stats64 temp; -+ unsigned long interval; -+ int invert; -+ -+ /* If we dont have a device, insure we are off */ -+ if (!trigger_data->net_dev) { -+ led_set_brightness(trigger_data->led_cdev, LED_OFF); -+ return; -+ } -+ -+ /* If we are not looking for RX/TX then return */ -+ if (!test_bit(NETDEV_LED_TX, &trigger_data->mode) && -+ !test_bit(NETDEV_LED_RX, &trigger_data->mode)) -+ return; -+ -+ dev_stats = dev_get_stats(trigger_data->net_dev, &temp); -+ new_activity = -+ (test_bit(NETDEV_LED_TX, &trigger_data->mode) ? -+ dev_stats->tx_packets : 0) + -+ (test_bit(NETDEV_LED_RX, &trigger_data->mode) ? -+ dev_stats->rx_packets : 0); -+ -+ if (trigger_data->last_activity != new_activity) { -+ led_stop_software_blink(trigger_data->led_cdev); -+ -+ invert = test_bit(NETDEV_LED_LINK, &trigger_data->mode); -+ interval = jiffies_to_msecs( -+ atomic_read(&trigger_data->interval)); -+ /* base state is ON (link present) */ -+ led_blink_set_oneshot(trigger_data->led_cdev, -+ &interval, -+ &interval, -+ invert); -+ trigger_data->last_activity = new_activity; -+ } -+ -+ schedule_delayed_work(&trigger_data->work, -+ (atomic_read(&trigger_data->interval)*2)); -+} -+ -+static void netdev_trig_activate(struct led_classdev *led_cdev) -+{ -+ struct led_netdev_data *trigger_data; -+ int rc; -+ -+ trigger_data = kzalloc(sizeof(struct led_netdev_data), GFP_KERNEL); -+ if (!trigger_data) -+ return; -+ -+ spin_lock_init(&trigger_data->lock); -+ -+ trigger_data->notifier.notifier_call = netdev_trig_notify; -+ trigger_data->notifier.priority = 10; -+ -+ INIT_DELAYED_WORK(&trigger_data->work, netdev_trig_work); -+ -+ trigger_data->led_cdev = led_cdev; -+ trigger_data->net_dev = NULL; -+ trigger_data->device_name[0] = 0; -+ -+ trigger_data->mode = 0; -+ atomic_set(&trigger_data->interval, msecs_to_jiffies(50)); -+ trigger_data->last_activity = 0; -+ -+ led_cdev->trigger_data = trigger_data; -+ -+ rc = device_create_file(led_cdev->dev, &dev_attr_device_name); -+ if (rc) -+ goto err_out; -+ rc = device_create_file(led_cdev->dev, &dev_attr_link); -+ if (rc) -+ goto err_out_device_name; -+ rc = device_create_file(led_cdev->dev, &dev_attr_rx); -+ if (rc) -+ goto err_out_link; -+ rc = device_create_file(led_cdev->dev, &dev_attr_tx); -+ if (rc) -+ goto err_out_rx; -+ rc = device_create_file(led_cdev->dev, &dev_attr_interval); -+ if (rc) -+ goto err_out_tx; -+ rc = register_netdevice_notifier(&trigger_data->notifier); -+ if (rc) -+ goto err_out_interval; -+ return; -+ -+err_out_interval: -+ device_remove_file(led_cdev->dev, &dev_attr_interval); -+err_out_tx: -+ device_remove_file(led_cdev->dev, &dev_attr_tx); -+err_out_rx: -+ device_remove_file(led_cdev->dev, &dev_attr_rx); -+err_out_link: -+ device_remove_file(led_cdev->dev, &dev_attr_link); -+err_out_device_name: -+ device_remove_file(led_cdev->dev, &dev_attr_device_name); -+err_out: -+ led_cdev->trigger_data = NULL; -+ kfree(trigger_data); -+} -+ -+static void netdev_trig_deactivate(struct led_classdev *led_cdev) -+{ -+ struct led_netdev_data *trigger_data = led_cdev->trigger_data; -+ -+ if (trigger_data) { -+ unregister_netdevice_notifier(&trigger_data->notifier); -+ -+ device_remove_file(led_cdev->dev, &dev_attr_device_name); -+ device_remove_file(led_cdev->dev, &dev_attr_link); -+ device_remove_file(led_cdev->dev, &dev_attr_rx); -+ device_remove_file(led_cdev->dev, &dev_attr_tx); -+ device_remove_file(led_cdev->dev, &dev_attr_interval); -+ -+ cancel_delayed_work_sync(&trigger_data->work); -+ -+ if (trigger_data->net_dev) -+ dev_put(trigger_data->net_dev); -+ -+ kfree(trigger_data); -+ } -+} -+ -+static struct led_trigger netdev_led_trigger = { -+ .name = "netdev", -+ .activate = netdev_trig_activate, -+ .deactivate = netdev_trig_deactivate, -+}; -+ -+static int __init netdev_trig_init(void) -+{ -+ return led_trigger_register(&netdev_led_trigger); -+} -+ -+static void __exit netdev_trig_exit(void) -+{ -+ led_trigger_unregister(&netdev_led_trigger); -+} -+ -+module_init(netdev_trig_init); -+module_exit(netdev_trig_exit); -+ -+MODULE_AUTHOR("Ben Whitten "); -+MODULE_AUTHOR("Oliver Jowett "); -+MODULE_DESCRIPTION("Netdev LED trigger"); -+MODULE_LICENSE("GPL v2"); diff --git a/target/linux/generic/backport-4.9/400-v4.18-mtd-bcm47xxpart-add-of_match_table-with-a-new-DT-bin.patch b/target/linux/generic/backport-4.9/400-v4.18-mtd-bcm47xxpart-add-of_match_table-with-a-new-DT-bin.patch deleted file mode 100644 index 94a4776751..0000000000 --- a/target/linux/generic/backport-4.9/400-v4.18-mtd-bcm47xxpart-add-of_match_table-with-a-new-DT-bin.patch +++ /dev/null @@ -1,47 +0,0 @@ -From cf589ce71e84d3b8811c65740645af254c5248c0 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= -Date: Wed, 9 May 2018 10:17:29 +0200 -Subject: [PATCH] mtd: bcm47xxpart: add of_match_table with a new DT binding -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -This allows using bcm47xxpart parser to find partitions on flash -described in DT using the "brcm,bcm947xx-cfe-partitions" compatible -property. It means this parser doesn't have to be explicitly selected by -a flash driver anymore. It can be used e.g. together with a generic -m25p80 / spi-nor if device is just properly described. - -Signed-off-by: Rafał Miłecki -Signed-off-by: Boris Brezillon ---- - drivers/mtd/bcm47xxpart.c | 7 +++++++ - 1 file changed, 7 insertions(+) - ---- a/drivers/mtd/bcm47xxpart.c -+++ b/drivers/mtd/bcm47xxpart.c -@@ -15,6 +15,7 @@ - #include - #include - #include -+#include - - #include - -@@ -304,9 +305,16 @@ static int bcm47xxpart_parse(struct mtd_ - return curr_part; - }; - -+static const struct of_device_id bcm47xxpart_of_match_table[] = { -+ { .compatible = "brcm,bcm947xx-cfe-partitions" }, -+ {}, -+}; -+MODULE_DEVICE_TABLE(of, bcm47xxpart_of_match_table); -+ - static struct mtd_part_parser bcm47xxpart_mtd_parser = { - .parse_fn = bcm47xxpart_parse, - .name = "bcm47xxpart", -+ .of_match_table = bcm47xxpart_of_match_table, - }; - module_mtd_part_parser(bcm47xxpart_mtd_parser); - diff --git a/target/linux/generic/backport-4.9/401-v4.19-mtd-parsers-trx-add-of_match_table-with-the-new-DT-b.patch b/target/linux/generic/backport-4.9/401-v4.19-mtd-parsers-trx-add-of_match_table-with-the-new-DT-b.patch deleted file mode 100644 index b92382c1e9..0000000000 --- a/target/linux/generic/backport-4.9/401-v4.19-mtd-parsers-trx-add-of_match_table-with-the-new-DT-b.patch +++ /dev/null @@ -1,45 +0,0 @@ -From 98534a58c8a40cdc9e3bcb04d74719fbcedfeb52 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= -Date: Tue, 26 Jun 2018 00:05:08 +0200 -Subject: [PATCH] mtd: parsers: trx: add of_match_table with the new DT binding -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -This allows using TRX parser to find TRX partitions on flash device -described in DT using a proper binding. It's useful for devices storing -firmware on a separated flash and having rootfs partition in it. - -Signed-off-by: Rafał Miłecki -Signed-off-by: Boris Brezillon ---- - drivers/mtd/parsers/parser_trx.c | 7 +++++++ - 1 file changed, 7 insertions(+) - ---- a/drivers/mtd/parsers/parser_trx.c -+++ b/drivers/mtd/parsers/parser_trx.c -@@ -13,6 +13,7 @@ - #include - #include - #include -+#include - - #define TRX_PARSER_MAX_PARTS 4 - -@@ -116,9 +117,16 @@ static int parser_trx_parse(struct mtd_i - return i; - }; - -+static const struct of_device_id mtd_parser_trx_of_match_table[] = { -+ { .compatible = "brcm,trx" }, -+ {}, -+}; -+MODULE_DEVICE_TABLE(of, mtd_parser_trx_of_match_table); -+ - static struct mtd_part_parser mtd_parser_trx = { - .parse_fn = parser_trx_parse, - .name = "trx", -+ .of_match_table = mtd_parser_trx_of_match_table, - }; - module_mtd_part_parser(mtd_parser_trx); - diff --git a/target/linux/generic/backport-4.9/402-v4.19-mtd-partitions-use-DT-info-for-parsing-partitions-wi.patch b/target/linux/generic/backport-4.9/402-v4.19-mtd-partitions-use-DT-info-for-parsing-partitions-wi.patch deleted file mode 100644 index 4186f5599f..0000000000 --- a/target/linux/generic/backport-4.9/402-v4.19-mtd-partitions-use-DT-info-for-parsing-partitions-wi.patch +++ /dev/null @@ -1,102 +0,0 @@ -From 76a832254ab05502c9394cc51ded6f0abe0e0bee Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= -Date: Fri, 13 Jul 2018 16:32:21 +0200 -Subject: [PATCH] mtd: partitions: use DT info for parsing partitions with - "compatible" prop -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -So far only flash devices could be described in DT regarding partitions -parsing. That could be done with "partitions" subnode and a proper -"compatible" string. - -Some devices may use hierarchical (multi-level) layouts and may mix used -layouts (fixed and dynamic). Describing that in DT is done by specifying -"compatible" for DT-represented partition plus optionally more -properties and/or subnodes. - -To support such layouts each DT partition has to be checked for -additional description. - -Please note this implementation will work in parallel with support for -partition type specified for non-DT setups. That already works since -commit 1a0915be1926 ("mtd: partitions: add support for partition -parsers"). - -Signed-off-by: Rafał Miłecki -Signed-off-by: Boris Brezillon ---- - drivers/mtd/mtdpart.c | 33 +++++++++++++-------------------- - 1 file changed, 13 insertions(+), 20 deletions(-) - ---- a/drivers/mtd/mtdpart.c -+++ b/drivers/mtd/mtdpart.c -@@ -370,22 +370,6 @@ static inline void free_partition(struct - kfree(p); - } - --/** -- * mtd_parse_part - parse MTD partition looking for subpartitions -- * -- * @slave: part that is supposed to be a container and should be parsed -- * @types: NULL-terminated array with names of partition parsers to try -- * -- * Some partitions are kind of containers with extra subpartitions (volumes). -- * There can be various formats of such containers. This function tries to use -- * specified parsers to analyze given partition and registers found -- * subpartitions on success. -- */ --static int mtd_parse_part(struct mtd_part *slave, const char *const *types) --{ -- return parse_mtd_partitions(&slave->mtd, types, NULL); --} -- - static struct mtd_part *allocate_partition(struct mtd_info *parent, - const struct mtd_partition *part, int partno, - uint64_t cur_offset) -@@ -775,8 +759,8 @@ int add_mtd_partitions(struct mtd_info * - - add_mtd_device(&slave->mtd); - mtd_add_partition_attrs(slave); -- if (parts[i].types) -- mtd_parse_part(slave, parts[i].types); -+ /* Look for subpartitions */ -+ parse_mtd_partitions(&slave->mtd, parts[i].types, NULL); - - cur_offset = slave->offset + slave->mtd.size; - } -@@ -852,6 +836,12 @@ static const char * const default_mtd_pa - NULL - }; - -+/* Check DT only when looking for subpartitions. */ -+static const char * const default_subpartition_types[] = { -+ "ofpart", -+ NULL -+}; -+ - static int mtd_part_do_parse(struct mtd_part_parser *parser, - struct mtd_info *master, - struct mtd_partitions *pparts, -@@ -922,7 +912,9 @@ static int mtd_part_of_parse(struct mtd_ - const char *fixed = "fixed-partitions"; - int ret, err = 0; - -- np = of_get_child_by_name(mtd_get_of_node(master), "partitions"); -+ np = mtd_get_of_node(master); -+ if (!mtd_is_partition(master)) -+ np = of_get_child_by_name(np, "partitions"); - of_property_for_each_string(np, "compatible", prop, compat) { - parser = mtd_part_get_compatible_parser(compat); - if (!parser) -@@ -985,7 +977,8 @@ int parse_mtd_partitions(struct mtd_info - int ret, err = 0; - - if (!types) -- types = default_mtd_part_types; -+ types = mtd_is_partition(master) ? default_subpartition_types : -+ default_mtd_part_types; - - for ( ; *types; types++) { - /* diff --git a/target/linux/generic/config-3.18 b/target/linux/generic/config-3.18 deleted file mode 100644 index 96e4dfd533..0000000000 --- a/target/linux/generic/config-3.18 +++ /dev/null @@ -1,4667 +0,0 @@ -CONFIG_32BIT=y -# CONFIG_6LOWPAN is not set -# CONFIG_6PACK is not set -# CONFIG_8139CP is not set -# CONFIG_8139TOO is not set -# CONFIG_9P_FS is not set -# CONFIG_AB3100_CORE is not set -# CONFIG_AB8500_CORE is not set -# CONFIG_ABX500_CORE is not set -# CONFIG_ACCESSIBILITY is not set -# CONFIG_ACENIC is not set -# CONFIG_ACERHDF is not set -# CONFIG_ACORN_PARTITION is not set -# CONFIG_ACPI_APEI is not set -# CONFIG_ACPI_BUTTON is not set -# CONFIG_ACPI_CUSTOM_METHOD is not set -# CONFIG_ACPI_EXTLOG is not set -# CONFIG_ACPI_HED is not set -# CONFIG_ACPI_INT3403_THERMAL is not set -# CONFIG_ACPI_POWER_METER is not set -# CONFIG_ACPI_QUICKSTART is not set -# CONFIG_ACPI_REDUCED_HARDWARE_ONLY is not set -# CONFIG_AD2S1200 is not set -# CONFIG_AD2S1210 is not set -# CONFIG_AD2S90 is not set -# CONFIG_AD5064 is not set -# CONFIG_AD525X_DPOT 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_AD5930 is not set -# CONFIG_AD5933 is not set -# CONFIG_AD7150 is not set -# CONFIG_AD7152 is not set -# CONFIG_AD7192 is not set -# CONFIG_AD7266 is not set -# CONFIG_AD7280 is not set -# CONFIG_AD7291 is not set -# CONFIG_AD7298 is not set -# CONFIG_AD7303 is not set -# CONFIG_AD7476 is not set -# CONFIG_AD7606 is not set -# CONFIG_AD7746 is not set -# CONFIG_AD7780 is not set -# CONFIG_AD7791 is not set -# CONFIG_AD7793 is not set -# CONFIG_AD7816 is not set -# CONFIG_AD7887 is not set -# CONFIG_AD7923 is not set -# CONFIG_AD799X is not set -# CONFIG_AD8366 is not set -# CONFIG_AD9523 is not set -# CONFIG_AD9832 is not set -# CONFIG_AD9834 is not set -# CONFIG_AD9850 is not set -# CONFIG_AD9852 is not set -# CONFIG_AD9910 is not set -# CONFIG_AD9951 is not set -# CONFIG_ADAPTEC_STARFIRE is not set -# 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 -# CONFIG_ADF4350 is not set -# CONFIG_ADFS_FS is not set -# CONFIG_ADIS16060 is not set -# CONFIG_ADIS16080 is not set -# CONFIG_ADIS16130 is not set -# CONFIG_ADIS16136 is not set -# 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_ADIS16255 is not set -# CONFIG_ADIS16260 is not set -# CONFIG_ADIS16400 is not set -# CONFIG_ADIS16480 is not set -# CONFIG_ADJD_S311 is not set -# CONFIG_ADM6996_PHY is not set -# CONFIG_ADM8211 is not set -# CONFIG_ADT7316 is not set -CONFIG_ADVISE_SYSCALLS=y -# CONFIG_ADXRS450 is not set -CONFIG_AEABI=y -# CONFIG_AFFS_FS is not set -# CONFIG_AFS_FS is not set -# CONFIG_AF_RXRPC is not set -# CONFIG_AGP is not set -# CONFIG_AHCI_MVEBU is not set -CONFIG_AIO=y -# CONFIG_AIRO is not set -# CONFIG_AIRO_CS is not set -# CONFIG_AIX_PARTITION is not set -# CONFIG_AK09911 is not set -# CONFIG_AK8975 is not set -# CONFIG_AL3320A is not set -# CONFIG_ALCHEMY_GPIO_INDIRECT is not set -# CONFIG_ALIM7101_WDT is not set -CONFIG_ALLOW_DEV_COREDUMP=y -# CONFIG_ALTERA_STAPL is not set -# CONFIG_ALTERA_TSE is not set -# CONFIG_ALX is not set -# CONFIG_AM335X_PHY_USB is not set -# CONFIG_AMD8111_ETH is not set -# CONFIG_AMD_PHY is not set -# CONFIG_AMD_XGBE is not set -# CONFIG_AMD_XGBE_PHY is not set -# CONFIG_AMIGA_PARTITION is not set -# CONFIG_AMILO_RFKILL is not set -# CONFIG_ANDROID is not set -CONFIG_ANON_INODES=y -# CONFIG_APDS9300 is not set -# CONFIG_APDS9802ALS is not set -# CONFIG_APM8018X is not set -# CONFIG_APPLICOM is not set -# CONFIG_AR5523 is not set -# CONFIG_AR7 is not set -# CONFIG_AR8216_PHY is not set -# CONFIG_AR8216_PHY_LEDS is not set -# CONFIG_ARCH_AT91 is not set -# CONFIG_ARCH_BCM is not set -# CONFIG_ARCH_BCM2835 is not set -# CONFIG_ARCH_BCMRING is not set -# CONFIG_ARCH_BERLIN is not set -# CONFIG_ARCH_CLPS711X is not set -# CONFIG_ARCH_CNS3XXX is not set -# CONFIG_ARCH_DAVINCI is not set -# CONFIG_ARCH_DMA_ADDR_T_64BIT is not set -# CONFIG_ARCH_DOVE is not set -# CONFIG_ARCH_EBSA110 is not set -# CONFIG_ARCH_EP93XX is not set -# CONFIG_ARCH_EXYNOS is not set -CONFIG_ARCH_FLATMEM_ENABLE=y -# CONFIG_ARCH_FOOTBRIDGE is not set -# CONFIG_ARCH_GEMINI is not set -# CONFIG_ARCH_H720X is not set -# CONFIG_ARCH_HAS_ILOG2_U32 is not set -# CONFIG_ARCH_HAS_ILOG2_U64 is not set -# CONFIG_ARCH_HI3xxx is not set -# CONFIG_ARCH_HIGHBANK is not set -# CONFIG_ARCH_HISI is not set -# CONFIG_ARCH_INTEGRATOR is not set -# CONFIG_ARCH_IOP13XX is not set -# CONFIG_ARCH_IOP32X is not set -# CONFIG_ARCH_IOP33X is not set -# CONFIG_ARCH_IXP2000 is not set -# CONFIG_ARCH_IXP23XX is not set -# CONFIG_ARCH_IXP4XX is not set -# CONFIG_ARCH_KEYSTONE is not set -# CONFIG_ARCH_KIRKWOOD is not set -# CONFIG_ARCH_KS8695 is not set -# CONFIG_ARCH_LPC32XX is not set -# CONFIG_ARCH_MEDIATEK is not set -# CONFIG_ARCH_MESON is not set -# CONFIG_ARCH_MMP is not set -# CONFIG_ARCH_MSM is not set -# CONFIG_ARCH_MSM_DT is not set -# CONFIG_ARCH_MSM_NODT is not set -# CONFIG_ARCH_MULTIPLATFORM is not set -# CONFIG_ARCH_MULTI_V6 is not set -# CONFIG_ARCH_MULTI_V7 is not set -# CONFIG_ARCH_MV78XX0 is not set -# CONFIG_ARCH_MVEBU is not set -# CONFIG_ARCH_MXC is not set -# CONFIG_ARCH_MXS is not set -# CONFIG_ARCH_NEEDS_CPU_IDLE_COUPLED is not set -# CONFIG_ARCH_NETX is not set -# CONFIG_ARCH_NOMADIK is not set -# CONFIG_ARCH_NSPIRE is not set -# CONFIG_ARCH_NUC93X is not set -# CONFIG_ARCH_OMAP is not set -# CONFIG_ARCH_OMAP1 is not set -# CONFIG_ARCH_OMAP2PLUS is not set -# CONFIG_ARCH_OMAP3 is not set -# CONFIG_ARCH_OMAP4 is not set -# CONFIG_ARCH_ORION5X is not set -# CONFIG_ARCH_PHYS_ADDR_T_64BIT is not set -# CONFIG_ARCH_PICOXCELL is not set -# CONFIG_ARCH_PNX4008 is not set -# CONFIG_ARCH_PRIMA2 is not set -# CONFIG_ARCH_PXA is not set -# CONFIG_ARCH_QCOM is not set -# CONFIG_ARCH_REALVIEW is not set -# CONFIG_ARCH_ROCKCHIP is not set -# CONFIG_ARCH_RPC is not set -# CONFIG_ARCH_S3C24XX is not set -# CONFIG_ARCH_S3C64XX is not set -# CONFIG_ARCH_S5P64X0 is not set -# CONFIG_ARCH_S5PC100 is not set -# CONFIG_ARCH_S5PV210 is not set -# CONFIG_ARCH_SA1100 is not set -# CONFIG_ARCH_SHARK is not set -# CONFIG_ARCH_SHMOBILE is not set -# CONFIG_ARCH_SHMOBILE_LEGACY is not set -# CONFIG_ARCH_SHMOBILE_MULTI is not set -# CONFIG_ARCH_SIRF is not set -# CONFIG_ARCH_SOCFPGA is not set -# CONFIG_ARCH_STI is not set -# CONFIG_ARCH_SUNXI is not set -# CONFIG_ARCH_SUPPORTS_MSI is not set -# CONFIG_ARCH_TCC_926 is not set -# CONFIG_ARCH_TEGRA is not set -# CONFIG_ARCH_U300 is not set -# CONFIG_ARCH_U8500 is not set -# CONFIG_ARCH_VERSATILE is not set -# CONFIG_ARCH_VEXPRESS is not set -# CONFIG_ARCH_VIRT is not set -# CONFIG_ARCH_VT8500 is not set -# CONFIG_ARCH_W90X900 is not set -# CONFIG_ARCH_WM8505 is not set -# CONFIG_ARCH_WM8850 is not set -# CONFIG_ARCH_ZYNQ is not set -# CONFIG_ARCNET is not set -# CONFIG_ARC_EMAC is not set -# CONFIG_ARM_APPENDED_DTB is not set -# CONFIG_ARM_ARCH_TIMER is not set -# CONFIG_ARM_AT91_ETHER is not set -# CONFIG_ARM_CCI is not set -# CONFIG_ARM_CCN is not set -CONFIG_ARM_CPU_TOPOLOGY=y -CONFIG_ARM_DMA_MEM_BUFFERABLE=y -# CONFIG_ARM_ERRATA_326103 is not set -# CONFIG_ARM_ERRATA_364296 is not set -# CONFIG_ARM_ERRATA_411920 is not set -# CONFIG_ARM_ERRATA_430973 is not set -# CONFIG_ARM_ERRATA_458693 is not set -# CONFIG_ARM_ERRATA_460075 is not set -# CONFIG_ARM_ERRATA_643719 is not set -# CONFIG_ARM_ERRATA_720789 is not set -# CONFIG_ARM_ERRATA_742230 is not set -# CONFIG_ARM_ERRATA_742231 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_773022 is not set -# CONFIG_ARM_ERRATA_775420 is not set -# CONFIG_ARM_ERRATA_798181 is not set -# CONFIG_ARM_KPROBES_TEST is not set -# CONFIG_ARM_PATCH_PHYS_VIRT is not set -# CONFIG_ARM_PSCI is not set -# CONFIG_ARM_PTDUMP is not set -# CONFIG_ARM_UNWIND is not set -# CONFIG_ARM_VIRT_EXT is not set -CONFIG_ARPD=y -# CONFIG_ARTHUR is not set -# CONFIG_AS3935 is not set -# CONFIG_ASUS_OLED is not set -# CONFIG_ASYMMETRIC_KEY_TYPE is not set -# CONFIG_ASYNC_RAID6_TEST is not set -# CONFIG_ASYNC_TX_DMA is not set -# CONFIG_AT76C50X_USB is not set -# CONFIG_AT803X_PHY is not set -# CONFIG_ATA is not set -# CONFIG_ATAGS is not set -CONFIG_ATAGS_PROC=y -# CONFIG_ATALK is not set -# CONFIG_ATARI_PARTITION is not set -# CONFIG_ATA_ACPI is not set -CONFIG_ATA_BMDMA=y -# CONFIG_ATA_GENERIC is not set -# CONFIG_ATA_NONSTANDARD is not set -# CONFIG_ATA_OVER_ETH is not set -# CONFIG_ATA_PIIX is not set -CONFIG_ATA_SFF=y -# CONFIG_ATA_VERBOSE_ERROR is not set -# CONFIG_ATH10K is not set -# CONFIG_ATH5K is not set -# CONFIG_ATH6KL is not set -# CONFIG_ATH6K_LEGACY is not set -# CONFIG_ATH79 is not set -# CONFIG_ATH9K is not set -# CONFIG_ATH9K_HTC is not set -# CONFIG_ATH_CARDS is not set -# CONFIG_ATH_DEBUG is not set -# CONFIG_ATL1 is not set -# CONFIG_ATL1C is not set -# CONFIG_ATL1E is not set -# CONFIG_ATL2 is not set -# CONFIG_ATM is not set -# CONFIG_ATMEL is not set -# CONFIG_ATMEL_PIT is not set -# CONFIG_ATMEL_PWM is not set -# CONFIG_ATMEL_SSC is not set -# CONFIG_ATM_AMBASSADOR is not set -# CONFIG_ATM_BR2684 is not set -CONFIG_ATM_BR2684_IPFILTER=y -# CONFIG_ATM_CLIP is not set -CONFIG_ATM_CLIP_NO_ICMP=y -# CONFIG_ATM_DRIVERS is not set -# CONFIG_ATM_DUMMY is not set -# CONFIG_ATM_ENI is not set -# CONFIG_ATM_FIRESTREAM is not set -# CONFIG_ATM_FORE200E is not set -# CONFIG_ATM_HE is not set -# CONFIG_ATM_HORIZON is not set -# CONFIG_ATM_IA is not set -# CONFIG_ATM_IDT77252 is not set -# CONFIG_ATM_LANAI is not set -# CONFIG_ATM_LANE is not set -# CONFIG_ATM_MPOA is not set -# CONFIG_ATM_NICSTAR is not set -# CONFIG_ATM_SOLOS is not set -# CONFIG_ATM_TCP is not set -# CONFIG_ATM_ZATM is not set -# CONFIG_ATOMIC64_SELFTEST is not set -# CONFIG_ATP is not set -# CONFIG_AUDIT is not set -# CONFIG_AUDIT_ARCH_COMPAT_GENERIC is not set -# CONFIG_AUDIT_LOGINUID_IMMUTABLE is not set -# CONFIG_AUTOFS4_FS is not set -# CONFIG_AUTO_ZRELADDR is not set -# CONFIG_AUXDISPLAY is not set -# CONFIG_AVERAGE is not set -# CONFIG_AX25 is not set -# CONFIG_AX25_DAMA_SLAVE is not set -# CONFIG_AX88796 is not set -# CONFIG_B43 is not set -# CONFIG_B43LEGACY is not set -# CONFIG_B44 is not set -# CONFIG_BACKLIGHT_BD6107 is not set -# CONFIG_BACKLIGHT_GPIO is not set -# CONFIG_BACKLIGHT_LCD_SUPPORT is not set -# CONFIG_BACKLIGHT_LM3630 is not set -# CONFIG_BACKLIGHT_LM3630A is not set -# CONFIG_BACKLIGHT_LM3639 is not set -# CONFIG_BACKLIGHT_LP855X is not set -# CONFIG_BACKLIGHT_LV5207LP is not set -# CONFIG_BACKLIGHT_PANDORA is not set -# CONFIG_BACKLIGHT_SAHARA is not set -# CONFIG_BACKTRACE_SELF_TEST is not set -CONFIG_BASE_FULL=y -CONFIG_BASE_SMALL=0 -# CONFIG_BATMAN_ADV is not set -# CONFIG_BATTERY_BQ27x00 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_GOLDFISH is not set -# CONFIG_BATTERY_MAX17040 is not set -# CONFIG_BATTERY_MAX17042 is not set -# CONFIG_BATTERY_SBS is not set -# CONFIG_BAYCOM_EPP is not set -# CONFIG_BAYCOM_PAR is not set -# CONFIG_BAYCOM_SER_FDX is not set -# CONFIG_BAYCOM_SER_HDX is not set -# CONFIG_BCACHE is not set -# CONFIG_BCM47XX is not set -# CONFIG_BCM63XX is not set -# CONFIG_BCM63XX_PHY is not set -# CONFIG_BCM7XXX_PHY is not set -# CONFIG_BCM87XX_PHY is not set -# CONFIG_BCMA is not set -# CONFIG_BCMA_DRIVER_GPIO is not set -CONFIG_BCMA_POSSIBLE=y -# CONFIG_BCMGENET is not set -# CONFIG_BCM_KONA_USB2_PHY is not set -# CONFIG_BCM_WIMAX is not set -# CONFIG_BDI_SWITCH is not set -# CONFIG_BE2ISCSI is not set -# CONFIG_BE2NET is not set -# CONFIG_BEFS_FS is not set -# CONFIG_BFS_FS is not set -# CONFIG_BGMAC is not set -# CONFIG_BIG_KEYS is not set -# CONFIG_BIG_LITTLE is not set -# CONFIG_BINARY_PRINTF is not set -# CONFIG_BINFMT_AOUT is not set -CONFIG_BINFMT_ELF=y -# CONFIG_BINFMT_MISC is not set -CONFIG_BINFMT_SCRIPT=y -CONFIG_BITREVERSE=y -# CONFIG_BLK_CMDLINE_PARSER is not set -# CONFIG_BLK_CPQ_CISS_DA is not set -# CONFIG_BLK_CPQ_DA is not set -CONFIG_BLK_DEV=y -# CONFIG_BLK_DEV_3W_XXXX_RAID is not set -# CONFIG_BLK_DEV_4DRIVES is not set -# CONFIG_BLK_DEV_AEC62XX is not set -# CONFIG_BLK_DEV_ALI14XX is not set -# CONFIG_BLK_DEV_ALI15X3 is not set -# CONFIG_BLK_DEV_AMD74XX is not set -# CONFIG_BLK_DEV_ATIIXP is not set -# CONFIG_BLK_DEV_BSG is not set -# CONFIG_BLK_DEV_BSGLIB is not set -# CONFIG_BLK_DEV_CMD640 is not set -# CONFIG_BLK_DEV_CMD64X is not set -# CONFIG_BLK_DEV_COW_COMMON is not set -# CONFIG_BLK_DEV_CRYPTOLOOP is not set -# CONFIG_BLK_DEV_CS5520 is not set -# CONFIG_BLK_DEV_CS5530 is not set -# CONFIG_BLK_DEV_CS5535 is not set -# CONFIG_BLK_DEV_CS5536 is not set -# CONFIG_BLK_DEV_CY82C693 is not set -# CONFIG_BLK_DEV_DAC960 is not set -# CONFIG_BLK_DEV_DELKIN is not set -# CONFIG_BLK_DEV_DRBD is not set -# CONFIG_BLK_DEV_DTC2278 is not set -# CONFIG_BLK_DEV_FD is not set -# CONFIG_BLK_DEV_GENERIC is not set -# CONFIG_BLK_DEV_HD is not set -# CONFIG_BLK_DEV_HPT366 is not set -# CONFIG_BLK_DEV_HT6560B is not set -# CONFIG_BLK_DEV_IDEACPI is not set -# CONFIG_BLK_DEV_IDECD is not set -# CONFIG_BLK_DEV_IDECS is not set -# CONFIG_BLK_DEV_IDEPCI is not set -# CONFIG_BLK_DEV_IDEPNP is not set -# CONFIG_BLK_DEV_IDETAPE is not set -# CONFIG_BLK_DEV_IDE_AU1XXX is not set -# CONFIG_BLK_DEV_IDE_SATA is not set -CONFIG_BLK_DEV_INITRD=y -# CONFIG_BLK_DEV_INTEGRITY is not set -# CONFIG_BLK_DEV_IO_TRACE is not set -# CONFIG_BLK_DEV_IT8172 is not set -# CONFIG_BLK_DEV_IT8213 is not set -# CONFIG_BLK_DEV_IT821X is not set -# CONFIG_BLK_DEV_JMICRON is not set -# CONFIG_BLK_DEV_LOOP is not set -CONFIG_BLK_DEV_LOOP_MIN_COUNT=8 -# CONFIG_BLK_DEV_NBD is not set -# CONFIG_BLK_DEV_NS87415 is not set -# CONFIG_BLK_DEV_NULL_BLK is not set -# CONFIG_BLK_DEV_NVME is not set -# CONFIG_BLK_DEV_OFFBOARD is not set -# CONFIG_BLK_DEV_OPTI621 is not set -# CONFIG_BLK_DEV_PCIESSD_MTIP32XX is not set -# CONFIG_BLK_DEV_PDC202XX_NEW is not set -# CONFIG_BLK_DEV_PDC202XX_OLD is not set -# CONFIG_BLK_DEV_PIIX is not set -# CONFIG_BLK_DEV_PLATFORM is not set -# CONFIG_BLK_DEV_QD65XX is not set -# CONFIG_BLK_DEV_RAM is not set -# CONFIG_BLK_DEV_RBD is not set -# CONFIG_BLK_DEV_RSXX is not set -# CONFIG_BLK_DEV_RZ1000 is not set -# CONFIG_BLK_DEV_SC1200 is not set -# CONFIG_BLK_DEV_SD is not set -# CONFIG_BLK_DEV_SIIMAGE is not set -# CONFIG_BLK_DEV_SIS5513 is not set -# CONFIG_BLK_DEV_SKD is not set -# CONFIG_BLK_DEV_SL82C105 is not set -# CONFIG_BLK_DEV_SLC90E66 is not set -# CONFIG_BLK_DEV_SR is not set -# CONFIG_BLK_DEV_SVWKS is not set -# CONFIG_BLK_DEV_SX8 is not set -# CONFIG_BLK_DEV_TC86C001 is not set -# CONFIG_BLK_DEV_THROTTLING is not set -# CONFIG_BLK_DEV_TRIFLEX is not set -# CONFIG_BLK_DEV_TRM290 is not set -# CONFIG_BLK_DEV_UB is not set -# CONFIG_BLK_DEV_UMC8672 is not set -# CONFIG_BLK_DEV_UMEM is not set -# CONFIG_BLK_DEV_VIA82CXXX is not set -# CONFIG_BLK_DEV_XIP is not set -CONFIG_BLOCK=y -# CONFIG_BMA180 is not set -# CONFIG_BMC150_ACCEL is not set -# CONFIG_BMG160 is not set -# CONFIG_BMP085 is not set -# CONFIG_BMP085_I2C is not set -# CONFIG_BMP085_SPI is not set -# CONFIG_BNA is not set -# CONFIG_BNX2 is not set -# CONFIG_BNX2X is not set -# CONFIG_BONDING is not set -# CONFIG_BOOKE_WDT is not set -CONFIG_BOOKE_WDT_DEFAULT_TIMEOUT=3 -# CONFIG_BOOT_PRINTK_DELAY is not set -CONFIG_BOOT_RAW=y -# CONFIG_BPCTL is not set -CONFIG_BPF=y -# CONFIG_BPF_JIT is not set -CONFIG_BPF_SYSCALL=y -# CONFIG_BPQETHER is not set -CONFIG_BQL=y -CONFIG_BRANCH_PROFILE_NONE=y -# CONFIG_BRCMFMAC is not set -# CONFIG_BRCMSMAC is not set -# CONFIG_BRCMSTB_GISB_ARB is not set -CONFIG_BRIDGE=y -# CONFIG_BRIDGE_EBT_802_3 is not set -# CONFIG_BRIDGE_EBT_AMONG is not set -# CONFIG_BRIDGE_EBT_ARP is not set -# CONFIG_BRIDGE_EBT_ARPREPLY is not set -# CONFIG_BRIDGE_EBT_BROUTE is not set -# CONFIG_BRIDGE_EBT_DNAT is not set -# CONFIG_BRIDGE_EBT_IP is not set -# CONFIG_BRIDGE_EBT_IP6 is not set -# CONFIG_BRIDGE_EBT_LIMIT is not set -# CONFIG_BRIDGE_EBT_LOG is not set -# CONFIG_BRIDGE_EBT_MARK is not set -# CONFIG_BRIDGE_EBT_MARK_T is not set -# CONFIG_BRIDGE_EBT_NFLOG is not set -# CONFIG_BRIDGE_EBT_PKTTYPE is not set -# CONFIG_BRIDGE_EBT_REDIRECT is not set -# CONFIG_BRIDGE_EBT_SNAT is not set -# CONFIG_BRIDGE_EBT_STP is not set -# CONFIG_BRIDGE_EBT_T_FILTER is not set -# CONFIG_BRIDGE_EBT_T_NAT is not set -# CONFIG_BRIDGE_EBT_ULOG is not set -# CONFIG_BRIDGE_EBT_VLAN is not set -CONFIG_BRIDGE_IGMP_SNOOPING=y -# CONFIG_BRIDGE_NETFILTER is not set -# CONFIG_BRIDGE_NF_EBTABLES is not set -# CONFIG_BRIDGE_VLAN_FILTERING is not set -# CONFIG_BROADCOM_PHY is not set -CONFIG_BROKEN_ON_SMP=y -# CONFIG_BSD_DISKLABEL is not set -# CONFIG_BSD_PROCESS_ACCT is not set -# CONFIG_BSD_PROCESS_ACCT_V3 is not set -# CONFIG_BT is not set -# CONFIG_BTRFS_ASSERT is not set -# CONFIG_BTRFS_DEBUG is not set -# CONFIG_BTRFS_FS is not set -# CONFIG_BTRFS_FS_POSIX_ACL is not set -# CONFIG_BTRFS_FS_RUN_SANITY_TESTS is not set -# CONFIG_BT_ATH3K is not set -# CONFIG_BT_BNEP is not set -CONFIG_BT_BNEP_MC_FILTER=y -CONFIG_BT_BNEP_PROTO_FILTER=y -# CONFIG_BT_CMTP is not set -# CONFIG_BT_HCIBCM203X is not set -# CONFIG_BT_HCIBFUSB is not set -# CONFIG_BT_HCIBLUECARD is not set -# CONFIG_BT_HCIBPA10X is not set -# CONFIG_BT_HCIBT3C is not set -# CONFIG_BT_HCIBTSDIO is not set -# CONFIG_BT_HCIBTUART is not set -# CONFIG_BT_HCIBTUSB is not set -# CONFIG_BT_HCIDTL1 is not set -# CONFIG_BT_HCIUART is not set -# CONFIG_BT_HCIUART_3WIRE is not set -# CONFIG_BT_HCIUART_ATH3K is not set -CONFIG_BT_HCIUART_BCSP=y -CONFIG_BT_HCIUART_H4=y -# CONFIG_BT_HCIUART_LL is not set -# CONFIG_BT_HCIVHCI is not set -# CONFIG_BT_HIDP is not set -CONFIG_BT_L2CAP=y -# CONFIG_BT_MRVL is not set -# CONFIG_BT_RFCOMM is not set -CONFIG_BT_RFCOMM_TTY=y -CONFIG_BT_SCO=y -CONFIG_BUG=y -CONFIG_BUILDTIME_EXTABLE_SORT=y -# CONFIG_BUILD_BIN2C is not set -# CONFIG_C2PORT is not set -# CONFIG_CADENCE_WATCHDOG is not set -# CONFIG_CAIF is not set -# CONFIG_CAN is not set -# CONFIG_CAN_GS_USB is not set -# CONFIG_CAN_M_CAN is not set -# CONFIG_CAN_RCAR is not set -# CONFIG_CAPI_AVM is not set -# CONFIG_CAPI_EICON is not set -# CONFIG_CAPI_TRACE is not set -CONFIG_CARDBUS=y -# CONFIG_CARDMAN_4000 is not set -# CONFIG_CARDMAN_4040 is not set -# CONFIG_CARL9170 is not set -# CONFIG_CARMA_FPGA is not set -# CONFIG_CARMA_FPGA_PROGRAM is not set -# CONFIG_CASSINI is not set -CONFIG_CAVIUM_OCTEON_HELPER=y -# CONFIG_CAVIUM_OCTEON_REFERENCE_BOARD is not set -# CONFIG_CAVIUM_OCTEON_SIMULATOR is not set -# CONFIG_CAVIUM_OCTEON_SOC is not set -# CONFIG_CB710_CORE is not set -# 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_CDROM_PKTCDVD is not set -# CONFIG_CED1401 is not set -# CONFIG_CEPH_FS is not set -# CONFIG_CEPH_LIB is not set -# CONFIG_CFG80211 is not set -# CONFIG_CFG80211_CERTIFICATION_ONUS is not set -# CONFIG_CFG80211_DEBUGFS is not set -# CONFIG_CFG80211_DEFAULT_PS is not set -# CONFIG_CFG80211_DEVELOPER_WARNINGS is not set -# CONFIG_CFG80211_INTERNAL_REGDB is not set -# CONFIG_CFG80211_REG_DEBUG is not set -# CONFIG_CFG80211_WEXT is not set -# CONFIG_CGROUPS is not set -# CONFIG_CGROUP_DEBUG is not set -# CONFIG_CGROUP_NET_PRIO is not set -# CONFIG_CHARGER_BQ2415X is not set -# CONFIG_CHARGER_BQ24190 is not set -# CONFIG_CHARGER_BQ24735 is not set -# CONFIG_CHARGER_GPIO is not set -# CONFIG_CHARGER_ISP1704 is not set -# CONFIG_CHARGER_LP8727 is not set -# CONFIG_CHARGER_MANAGER is not set -# CONFIG_CHARGER_MAX8903 is not set -# CONFIG_CHARGER_SMB347 is not set -# CONFIG_CHARGER_TWL4030 is not set -# CONFIG_CHECKPOINT_RESTORE is not set -# CONFIG_CHELSIO_T1 is not set -# CONFIG_CHELSIO_T3 is not set -# CONFIG_CHELSIO_T4 is not set -# CONFIG_CHELSIO_T4VF is not set -# CONFIG_CHROME_PLATFORMS is not set -# CONFIG_CHR_DEV_OSST is not set -# CONFIG_CHR_DEV_SCH is not set -# CONFIG_CHR_DEV_SG is not set -# CONFIG_CHR_DEV_ST is not set -# CONFIG_CICADA_PHY is not set -# CONFIG_CIFS is not set -# CONFIG_CIFS_ACL is not set -# CONFIG_CIFS_DEBUG is not set -# CONFIG_CIFS_DEBUG2 is not set -# CONFIG_CIFS_FSCACHE is not set -# CONFIG_CIFS_NFSD_EXPORT is not set -CONFIG_CIFS_POSIX=y -# CONFIG_CIFS_SMB2 is not set -CONFIG_CIFS_STATS=y -# CONFIG_CIFS_STATS2 is not set -# CONFIG_CIFS_WEAK_PW_HASH is not set -# CONFIG_CIFS_XATTR is not set -# CONFIG_CLEANCACHE is not set -# CONFIG_CLKSRC_VERSATILE is not set -CONFIG_CLS_U32_MARK=y -# CONFIG_CLS_U32_PERF is not set -# CONFIG_CM32181 is not set -# CONFIG_CM36651 is not set -# CONFIG_CMA is not set -CONFIG_CMDLINE="" -# CONFIG_CMDLINE_BOOL is not set -# CONFIG_CMDLINE_EXTEND is not set -# CONFIG_CMDLINE_FORCE is not set -# CONFIG_CMDLINE_FROM_BOOTLOADER is not set -# CONFIG_CMDLINE_PARTITION is not set -# CONFIG_CNIC is not set -# CONFIG_CODA_FS is not set -# CONFIG_CODE_PATCHING_SELFTEST is not set -# CONFIG_COMEDI is not set -# CONFIG_COMMON_CLK_DEBUG is not set -# CONFIG_COMMON_CLK_PXA is not set -# CONFIG_COMMON_CLK_QCOM is not set -# CONFIG_COMMON_CLK_SI5351 is not set -# CONFIG_COMMON_CLK_SI570 is not set -CONFIG_COMPACTION=y -# CONFIG_COMPAL_LAPTOP is not set -# CONFIG_COMPAT_BRK is not set -# CONFIG_COMPILE_TEST is not set -# CONFIG_CONFIGFS_FS is not set -# CONFIG_CONNECTOR is not set -CONFIG_CONSTRUCTORS=y -# CONFIG_CONTEXT_SWITCH_TRACER is not set -# CONFIG_COPS is not set -# CONFIG_CORDIC is not set -# CONFIG_COREDUMP is not set -# CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set -# CONFIG_CPA_DEBUG is not set -# CONFIG_CPU_DCACHE_DISABLE is not set -# CONFIG_CPU_FREQ is not set -# CONFIG_CPU_IDLE is not set -# CONFIG_CPU_IDLE_GOV_MENU is not set -# CONFIG_CPU_IDLE_MULTIPLE_DRIVERS is not set -# CONFIG_CRAMFS is not set -CONFIG_CRASHLOG=y -# CONFIG_CRASH_DUMP is not set -# CONFIG_CRC16 is not set -CONFIG_CRC32=y -# CONFIG_CRC32_BIT is not set -CONFIG_CRC32_SARWATE=y -# CONFIG_CRC32_SELFTEST is not set -# CONFIG_CRC32_SLICEBY4 is not set -# CONFIG_CRC32_SLICEBY8 is not set -# CONFIG_CRC7 is not set -# CONFIG_CRC8 is not set -# CONFIG_CRC_CCITT is not set -# CONFIG_CRC_ITU_T is not set -# CONFIG_CRC_T10DIF is not set -CONFIG_CROSS_COMPILE="" -# CONFIG_CROSS_MEMORY_ATTACH is not set -CONFIG_CRYPTO=y -# CONFIG_CRYPTO_AEAD is not set -CONFIG_CRYPTO_AES=y -# CONFIG_CRYPTO_AES_586 is not set -# CONFIG_CRYPTO_AES_ARM is not set -# CONFIG_CRYPTO_AES_ARM_BS is not set -# CONFIG_CRYPTO_AES_NI_INTEL is not set -CONFIG_CRYPTO_ALGAPI=y -CONFIG_CRYPTO_ALGAPI2=y -# CONFIG_CRYPTO_ANSI_CPRNG is not set -# CONFIG_CRYPTO_ANUBIS is not set -CONFIG_CRYPTO_ARC4=y -# CONFIG_CRYPTO_AUTHENC is not set -CONFIG_CRYPTO_BLKCIPHER=y -CONFIG_CRYPTO_BLKCIPHER2=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_CBC is not set -# CONFIG_CRYPTO_CCM is not set -# CONFIG_CRYPTO_CMAC is not set -# CONFIG_CRYPTO_CRC32 is not set -# CONFIG_CRYPTO_CRC32C is not set -# CONFIG_CRYPTO_CRC32C_INTEL is not set -# CONFIG_CRYPTO_CRCT10DIF is not set -# CONFIG_CRYPTO_CRYPTD is not set -# CONFIG_CRYPTO_CTR is not set -# CONFIG_CRYPTO_CTS is not set -# CONFIG_CRYPTO_DEFLATE is not set -# CONFIG_CRYPTO_DES is not set -# CONFIG_CRYPTO_DEV_ATMEL_AES is not set -# CONFIG_CRYPTO_DEV_ATMEL_SHA is not set -# CONFIG_CRYPTO_DEV_ATMEL_TDES is not set -# CONFIG_CRYPTO_DEV_CCP is not set -# CONFIG_CRYPTO_DEV_FSL_CAAM is not set -# CONFIG_CRYPTO_DEV_HIFN_795X is not set -# CONFIG_CRYPTO_DEV_MV_CESA is not set -# CONFIG_CRYPTO_DEV_QAT_DH895xCC is not set -# CONFIG_CRYPTO_DEV_QCE is not set -# CONFIG_CRYPTO_DEV_SAHARA is not set -# CONFIG_CRYPTO_DEV_TALITOS is not set -# CONFIG_CRYPTO_DRBG_CTR is not set -# CONFIG_CRYPTO_DRBG_MENU is not set -# CONFIG_CRYPTO_ECB is not set -# CONFIG_CRYPTO_FCRYPT is not set -# CONFIG_CRYPTO_FIPS is not set -# CONFIG_CRYPTO_GCM is not set -# CONFIG_CRYPTO_GF128MUL is not set -# CONFIG_CRYPTO_GHASH is not set -# CONFIG_CRYPTO_GHASH_CLMUL_NI_INTEL is not set -# CONFIG_CRYPTO_HASH is not set -# CONFIG_CRYPTO_HMAC is not set -# CONFIG_CRYPTO_HW is not set -# CONFIG_CRYPTO_KHAZAD is not set -# CONFIG_CRYPTO_LRW is not set -# CONFIG_CRYPTO_LZ4 is not set -# CONFIG_CRYPTO_LZ4HC is not set -# CONFIG_CRYPTO_LZO is not set -# CONFIG_CRYPTO_MANAGER is not set -# CONFIG_CRYPTO_MANAGER2 is not set -CONFIG_CRYPTO_MANAGER_DISABLE_TESTS=y -# CONFIG_CRYPTO_MCRYPTD is not set -# CONFIG_CRYPTO_MD4 is not set -# CONFIG_CRYPTO_MD5 is not set -# CONFIG_CRYPTO_MICHAEL_MIC is not set -# CONFIG_CRYPTO_NULL is not set -# CONFIG_CRYPTO_PCBC is not set -# CONFIG_CRYPTO_PCOMP is not set -# CONFIG_CRYPTO_PCOMP2 is not set -CONFIG_CRYPTO_PCRYPT=y -# 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_RNG is not set -# CONFIG_CRYPTO_SALSA20 is not set -# CONFIG_CRYPTO_SALSA20_586 is not set -# CONFIG_CRYPTO_SEED is not set -# CONFIG_CRYPTO_SEQIV is not set -# CONFIG_CRYPTO_SERPENT is not set -# CONFIG_CRYPTO_SHA1 is not set -# CONFIG_CRYPTO_SHA1_ARM is not set -# CONFIG_CRYPTO_SHA256 is not set -# CONFIG_CRYPTO_SHA512 is not set -# CONFIG_CRYPTO_TEA is not set -# CONFIG_CRYPTO_TEST is not set -# CONFIG_CRYPTO_TGR192 is not set -# CONFIG_CRYPTO_TWOFISH is not set -# CONFIG_CRYPTO_TWOFISH_586 is not set -# CONFIG_CRYPTO_TWOFISH_COMMON is not set -# CONFIG_CRYPTO_USER is not set -# CONFIG_CRYPTO_USER_API_HASH is not set -# CONFIG_CRYPTO_USER_API_SKCIPHER is not set -# CONFIG_CRYPTO_VMAC is not set -# CONFIG_CRYPTO_WP512 is not set -# CONFIG_CRYPTO_XCBC is not set -# CONFIG_CRYPTO_XTS is not set -# CONFIG_CRYPTO_ZLIB is not set -# CONFIG_CRYSTALHD is not set -# CONFIG_CS5535_MFGPT is not set -# CONFIG_CS89x0 is not set -# CONFIG_CUSE is not set -# CONFIG_CW1200 is not set -# CONFIG_CXL_BASE is not set -# CONFIG_CXT1E1 is not set -# CONFIG_CYPRESS_FIRMWARE is not set -# CONFIG_DAVICOM_PHY is not set -# CONFIG_DCB is not set -# CONFIG_DDR is not set -# CONFIG_DE600 is not set -# CONFIG_DE620 is not set -# CONFIG_DEBUG_ATOMIC_SLEEP is not set -# CONFIG_DEBUG_BLOCK_EXT_DEVT is not set -# CONFIG_DEBUG_BUGVERBOSE is not set -# CONFIG_DEBUG_CREDENTIALS is not set -# CONFIG_DEBUG_DEVRES is not set -# CONFIG_DEBUG_DRIVER is not set -# CONFIG_DEBUG_FORCE_WEAK_PER_CPU is not set -CONFIG_DEBUG_FS=y -# CONFIG_DEBUG_GPIO is not set -# CONFIG_DEBUG_HIGHMEM is not set -# CONFIG_DEBUG_ICEDCC is not set -# CONFIG_DEBUG_INFO is not set -# CONFIG_DEBUG_INFO_DWARF4 is not set -CONFIG_DEBUG_INFO_REDUCED=y -# CONFIG_DEBUG_INFO_SPLIT is not set -CONFIG_DEBUG_KERNEL=y -# CONFIG_DEBUG_KMEMLEAK is not set -# CONFIG_DEBUG_KOBJECT is not set -# CONFIG_DEBUG_KOBJECT_RELEASE is not set -# CONFIG_DEBUG_LIST is not set -# CONFIG_DEBUG_LL is not set -# CONFIG_DEBUG_LL_UART_8250 is not set -# CONFIG_DEBUG_LL_UART_PL01X is not set -# CONFIG_DEBUG_LOCKDEP is not set -# CONFIG_DEBUG_LOCKING_API_SELFTESTS is not set -# CONFIG_DEBUG_LOCK_ALLOC is not set -# CONFIG_DEBUG_MEMORY_INIT is not set -# CONFIG_DEBUG_MUTEXES is not set -# CONFIG_DEBUG_NOTIFIERS is not set -# CONFIG_DEBUG_NX_TEST is not set -# CONFIG_DEBUG_OBJECTS is not set -# CONFIG_DEBUG_PAGEALLOC is not set -# CONFIG_DEBUG_PERF_USE_VMALLOC is not set -# CONFIG_DEBUG_PER_CPU_MAPS is not set -# CONFIG_DEBUG_PINCTRL is not set -# CONFIG_DEBUG_PI_LIST is not set -# CONFIG_DEBUG_PREEMPT is not set -# CONFIG_DEBUG_RODATA is not set -# CONFIG_DEBUG_RT_MUTEXES is not set -# CONFIG_DEBUG_SECTION_MISMATCH is not set -# CONFIG_DEBUG_SEMIHOSTING is not set -# CONFIG_DEBUG_SET_MODULE_RONX is not set -# CONFIG_DEBUG_SG is not set -# CONFIG_DEBUG_SHIRQ is not set -# CONFIG_DEBUG_SLAB is not set -# CONFIG_DEBUG_SPINLOCK is not set -# CONFIG_DEBUG_STACKOVERFLOW is not set -# CONFIG_DEBUG_STACK_USAGE is not set -# CONFIG_DEBUG_STRICT_USER_COPY_CHECKS is not set -# CONFIG_DEBUG_UART_BCM63XX is not set -# CONFIG_DEBUG_VM is not set -# CONFIG_DEBUG_WRITECOUNT is not set -# CONFIG_DEBUG_WW_MUTEX_SLOWPATH is not set -# CONFIG_DEBUG_ZBOOT is not set -# CONFIG_DECNET is not set -CONFIG_DEFAULT_CUBIC=y -CONFIG_DEFAULT_DEADLINE=y -CONFIG_DEFAULT_HOSTNAME="(none)" -CONFIG_DEFAULT_IOSCHED="deadline" -CONFIG_DEFAULT_MESSAGE_LOGLEVEL=4 -CONFIG_DEFAULT_MMAP_MIN_ADDR=4096 -# CONFIG_DEFAULT_NOOP is not set -# CONFIG_DEFAULT_RENO is not set -CONFIG_DEFAULT_SECURITY="" -CONFIG_DEFAULT_SECURITY_DAC=y -CONFIG_DEFAULT_TCP_CONG="cubic" -CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config" -# CONFIG_DELL_SMO8800 is not set -# CONFIG_DEPRECATED_PARAM_STRUCT is not set -# CONFIG_DETECT_HUNG_TASK is not set -# CONFIG_DEVKMEM is not set -CONFIG_DEVPORT=y -# CONFIG_DEVPTS_MULTIPLE_INSTANCES is not set -# CONFIG_DEVTMPFS is not set -# CONFIG_DEVTMPFS_MOUNT is not set -# CONFIG_DGAP is not set -# CONFIG_DGNC is not set -# CONFIG_DGRP is not set -# CONFIG_DHT11 is not set -CONFIG_DISABLE_DEV_COREDUMP=y -# CONFIG_DISCONTIGMEM_MANUAL is not set -# CONFIG_DISPLAY_CONNECTOR_ANALOG_TV is not set -# CONFIG_DISPLAY_CONNECTOR_DVI is not set -# CONFIG_DISPLAY_CONNECTOR_HDMI is not set -# CONFIG_DISPLAY_ENCODER_TFP410 is not set -# CONFIG_DISPLAY_ENCODER_TPD12S015 is not set -# CONFIG_DISPLAY_PANEL_DPI is not set -# CONFIG_DISPLAY_PANEL_LGPHILIPS_LB035Q02 is not set -# CONFIG_DISPLAY_PANEL_TPO_TD028TTEC1 is not set -# CONFIG_DISPLAY_PANEL_TPO_TD043MTEA1 is not set -# CONFIG_DISPLAY_SUPPORT is not set -# CONFIG_DL2K is not set -# CONFIG_DLM is not set -# CONFIG_DM9000 is not set -# CONFIG_DMADEVICES is not set -# CONFIG_DMADEVICES_DEBUG is not set -# CONFIG_DMASCC is not set -# CONFIG_DMATEST is not set -# CONFIG_DMA_API_DEBUG is not set -# CONFIG_DMA_ENGINE is not set -# CONFIG_DMA_SHARED_BUFFER is not set -# CONFIG_DM_CACHE is not set -# CONFIG_DM_DEBUG is not set -# CONFIG_DM_DELAY is not set -# CONFIG_DM_ERA is not set -# CONFIG_DM_FLAKEY is not set -# CONFIG_DM_LOG_USERSPACE is not set -# CONFIG_DM_MULTIPATH is not set -# CONFIG_DM_RAID is not set -# CONFIG_DM_SWITCH is not set -# CONFIG_DM_THIN_PROVISIONING is not set -# CONFIG_DM_UEVENT is not set -# CONFIG_DM_VERITY is not set -# CONFIG_DM_ZERO is not set -# CONFIG_DNET is not set -# CONFIG_DNOTIFY is not set -# CONFIG_DNS_RESOLVER is not set -CONFIG_DOUBLEFAULT=y -CONFIG_DQL=y -# CONFIG_DRAGONRISE_FF is not set -# CONFIG_DRM is not set -# CONFIG_DS1682 is not set -# CONFIG_DTLK is not set -# CONFIG_DUMMY is not set -CONFIG_DUMMY_CONSOLE_COLUMNS=80 -CONFIG_DUMMY_CONSOLE_ROWS=25 -# CONFIG_DUMMY_IRQ is not set -# CONFIG_DVB_AU8522_V4L is not set -# CONFIG_DVB_CORE is not set -# CONFIG_DVB_DUMMY_FE is not set -# CONFIG_DVB_TUNER_DIB0070 is not set -# CONFIG_DVB_TUNER_DIB0090 is not set -# CONFIG_DWC3_HOST_USB3_LPM_ENABLE is not set -# CONFIG_DW_DMAC is not set -# CONFIG_DW_WATCHDOG is not set -# CONFIG_DX_SEP is not set -# CONFIG_DYNAMIC_DEBUG is not set -# CONFIG_E100 is not set -# CONFIG_E1000 is not set -# CONFIG_E1000E is not set -# CONFIG_E2100 is not set -# CONFIG_EARLY_PRINTK_8250 is not set -# CONFIG_EASYCAP is not set -# CONFIG_ECHO is not set -# CONFIG_ECONET is not set -# CONFIG_ECRYPT_FS is not set -# CONFIG_EDAC is not set -# CONFIG_EEPROM_93CX6 is not set -# CONFIG_EEPROM_93XX46 is not set -# CONFIG_EEPROM_AT24 is not set -# CONFIG_EEPROM_AT25 is not set -# CONFIG_EEPROM_DIGSY_MTC_CFG is not set -# CONFIG_EEPROM_LEGACY is not set -# CONFIG_EEPROM_MAX6875 is not set -# CONFIG_EEXPRESS is not set -# CONFIG_EEXPRESS_PRO is not set -CONFIG_EFI_PARTITION=y -# CONFIG_EFS_FS is not set -# CONFIG_ELF_CORE is not set -# CONFIG_EMAC_ROCKCHIP is not set -CONFIG_EMBEDDED=y -# CONFIG_EM_TIMER_STI is not set -# CONFIG_ENABLE_MUST_CHECK is not set -CONFIG_ENABLE_WARN_DEPRECATED=y -# CONFIG_ENC28J60 is not set -# CONFIG_ENCLOSURE_SERVICES is not set -# CONFIG_ENCRYPTED_KEYS is not set -# CONFIG_ENIC is not set -# CONFIG_EPAPR_PARAVIRT is not set -# CONFIG_EPIC100 is not set -CONFIG_EPOLL=y -# CONFIG_EQUALIZER is not set -# CONFIG_ET131X is not set -# CONFIG_ETH16I is not set -CONFIG_ETHERNET=y -# CONFIG_ETHOC is not set -CONFIG_EVENTFD=y -# CONFIG_EVENT_POWER_TRACING_DEPRECATED is not set -# CONFIG_EWRK3 is not set -CONFIG_EXPERIMENTAL=y -CONFIG_EXPERT=y -# CONFIG_EXPORTFS is not set -# CONFIG_EXT2_FS is not set -# CONFIG_EXT2_FS_XATTR is not set -# CONFIG_EXT2_FS_XIP is not set -# CONFIG_EXT3_DEFAULTS_TO_ORDERED is not set -# CONFIG_EXT3_FS is not set -# CONFIG_EXT3_FS_XATTR is not set -# CONFIG_EXT4_DEBUG is not set -# CONFIG_EXT4_FS is not set -# CONFIG_EXT4_FS_POSIX_ACL is not set -# CONFIG_EXT4_FS_SECURITY is not set -CONFIG_EXT4_FS_XATTR=y -CONFIG_EXT4_USE_FOR_EXT23=y -# CONFIG_EXTCON is not set -CONFIG_EXTRA_FIRMWARE="" -CONFIG_EXTRA_TARGETS="" -# CONFIG_EXYNOS_ADC is not set -# CONFIG_EXYNOS_VIDEO is not set -# CONFIG_EZX_PCAP is not set -# CONFIG_F2FS_FS is not set -# CONFIG_F2FS_FS_POSIX_ACL is not set -# CONFIG_FAIR_GROUP_SCHED is not set -# CONFIG_FANOTIFY is not set -CONFIG_FAT_DEFAULT_CODEPAGE=437 -CONFIG_FAT_DEFAULT_IOCHARSET="iso8859-1" -# CONFIG_FAT_FS is not set -# CONFIG_FAULT_INJECTION is not set -# CONFIG_FB is not set -# CONFIG_FB_3DFX is not set -# CONFIG_FB_ARC is not set -# CONFIG_FB_ARK is not set -# CONFIG_FB_ARMCLCD is not set -# CONFIG_FB_ASILIANT is not set -# CONFIG_FB_ATY is not set -# CONFIG_FB_ATY128 is not set -# CONFIG_FB_AUO_K190X is not set -# CONFIG_FB_BACKLIGHT is not set -# CONFIG_FB_BOOT_VESA_SUPPORT is not set -# CONFIG_FB_BROADSHEET is not set -# CONFIG_FB_CARMINE is not set -# CONFIG_FB_CFB_COPYAREA is not set -# CONFIG_FB_CFB_FILLRECT is not set -# CONFIG_FB_CFB_IMAGEBLIT is not set -# CONFIG_FB_CFB_REV_PIXELS_IN_BYTE is not set -# CONFIG_FB_CIRRUS is not set -# CONFIG_FB_CYBER2000 is not set -# CONFIG_FB_DA8XX is not set -# CONFIG_FB_DDC is not set -# CONFIG_FB_FOREIGN_ENDIAN is not set -# CONFIG_FB_GEODE is not set -# CONFIG_FB_GOLDFISH is not set -# CONFIG_FB_HGA is not set -# CONFIG_FB_I740 is not set -# CONFIG_FB_IBM_GXT4500 is not set -# CONFIG_FB_IMSTT is not set -# CONFIG_FB_IMX is not set -# CONFIG_FB_KYRO is not set -# CONFIG_FB_LE80578 is not set -# CONFIG_FB_MACMODES is not set -# CONFIG_FB_MATROX is not set -# CONFIG_FB_MB862XX is not set -# CONFIG_FB_METRONOME is not set -# CONFIG_FB_MODE_HELPERS is not set -# CONFIG_FB_MXS is not set -# CONFIG_FB_N411 is not set -# CONFIG_FB_NEOMAGIC is not set -# CONFIG_FB_NVIDIA is not set -# CONFIG_FB_OF is not set -# CONFIG_FB_OPENCORES is not set -# CONFIG_FB_PM2 is not set -# CONFIG_FB_PM3 is not set -# CONFIG_FB_PS3 is not set -# CONFIG_FB_PXA is not set -# CONFIG_FB_RADEON is not set -# CONFIG_FB_RIVA is not set -# CONFIG_FB_S1D13XXX is not set -# CONFIG_FB_S3 is not set -# CONFIG_FB_SAVAGE is not set -# CONFIG_FB_SIMPLE is not set -# CONFIG_FB_SIS is not set -# CONFIG_FB_SM7XX is not set -# CONFIG_FB_SMSCUFX is not set -# CONFIG_FB_SSD1307 is not set -# CONFIG_FB_SVGALIB is not set -# CONFIG_FB_SYS_COPYAREA is not set -# CONFIG_FB_SYS_FILLRECT is not set -# CONFIG_FB_SYS_FOPS is not set -# CONFIG_FB_SYS_IMAGEBLIT is not set -# CONFIG_FB_TILEBLITTING is not set -# CONFIG_FB_TMIO is not set -# CONFIG_FB_TRIDENT is not set -# CONFIG_FB_UDL is not set -# CONFIG_FB_UVESA is not set -# CONFIG_FB_VGA16 is not set -# CONFIG_FB_VIA is not set -# CONFIG_FB_VIRTUAL is not set -# CONFIG_FB_VOODOO1 is not set -# CONFIG_FB_VT8623 is not set -# CONFIG_FB_XGI is not set -# CONFIG_FCOE is not set -# CONFIG_FCOE_FNIC is not set -# CONFIG_FDDI is not set -# CONFIG_FEALNX is not set -# CONFIG_FENCE_TRACE is not set -# CONFIG_FHANDLE is not set -CONFIG_FIB_RULES=y -CONFIG_FILE_LOCKING=y -# CONFIG_FIREWIRE is not set -# CONFIG_FIREWIRE_NOSY is not set -# CONFIG_FIREWIRE_SERIAL is not set -# CONFIG_FIRMWARE_EDID is not set -# CONFIG_FIRMWARE_IN_KERNEL is not set -# CONFIG_FIRMWARE_MEMMAP is not set -# CONFIG_FIXED_PHY is not set -CONFIG_FLATMEM=y -CONFIG_FLATMEM_MANUAL=y -CONFIG_FLAT_NODE_MEM_MAP=y -# CONFIG_FM10K is not set -# CONFIG_FMC is not set -# CONFIG_FORCEDETH is not set -CONFIG_FORCE_MAX_ZONEORDER=11 -# CONFIG_FRAMEBUFFER_CONSOLE is not set -# CONFIG_FRAME_POINTER is not set -CONFIG_FRAME_WARN=1024 -# CONFIG_FREEZER is not set -# CONFIG_FRONTSWAP is not set -# CONFIG_FSCACHE is not set -# CONFIG_FSL_EDMA is not set -# CONFIG_FSL_XGMAC_MDIO is not set -CONFIG_FSNOTIFY=y -# CONFIG_FS_POSIX_ACL is not set -# CONFIG_FT1000 is not set -# CONFIG_FTGMAC100 is not set -# CONFIG_FTL is not set -# CONFIG_FTMAC100 is not set -# CONFIG_FTRACE is not set -# CONFIG_FTRACE_STARTUP_TEST is not set -# CONFIG_FTR_FIXUP_SELFTEST is not set -# CONFIG_FUJITSU_TABLET is not set -# CONFIG_FUNCTION_TRACER is not set -# CONFIG_FUSE_FS is not set -# CONFIG_FUSION is not set -# CONFIG_FUSION_FC is not set -# CONFIG_FUSION_SAS is not set -# CONFIG_FUSION_SPI is not set -CONFIG_FUTEX=y -CONFIG_FW_LOADER=y -CONFIG_FW_LOADER_USER_HELPER=y -CONFIG_FW_LOADER_USER_HELPER_FALLBACK=y -CONFIG_GACT_PROB=y -# CONFIG_GADGET_UAC1 is not set -# CONFIG_GAMEPORT is not set -# CONFIG_GATEWORKS_GW16083 is not set -# CONFIG_GCOV is not set -# CONFIG_GCOV_KERNEL is not set -# CONFIG_GENERIC_ADC_BATTERY is not set -CONFIG_GENERIC_CALIBRATE_DELAY=y -# CONFIG_GENERIC_CPU_DEVICES is not set -CONFIG_GENERIC_HARDIRQS=y -CONFIG_GENERIC_HWEIGHT=y -CONFIG_GENERIC_IRQ_PROBE=y -CONFIG_GENERIC_NET_UTILS=y -# CONFIG_GENERIC_PHY is not set -CONFIG_GENERIC_TIME=y -# CONFIG_GENEVE is not set -# CONFIG_GENWQE is not set -# CONFIG_GFS2_FS is not set -# CONFIG_GIGASET_CAPI is not set -# CONFIG_GIGASET_DEBUG is not set -# CONFIG_GLOB_SELFTEST is not set -# CONFIG_GP2AP020A00F is not set -# CONFIG_GPIOLIB is not set -# CONFIG_GPIO_74X164 is not set -# CONFIG_GPIO_ADNP is not set -# CONFIG_GPIO_ADP5588 is not set -# CONFIG_GPIO_AMD8111 is not set -# CONFIG_GPIO_BCM_KONA is not set -# CONFIG_GPIO_BT8XX is not set -# CONFIG_GPIO_CS5535 is not set -# 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_ICH is not set -# CONFIG_GPIO_IT8761E is not set -# CONFIG_GPIO_LANGWELL is not set -# CONFIG_GPIO_MAX7300 is not set -# CONFIG_GPIO_MAX7301 is not set -# CONFIG_GPIO_MAX732X is not set -# CONFIG_GPIO_MC33880 is not set -# CONFIG_GPIO_MCP23S08 is not set -# CONFIG_GPIO_ML_IOH is not set -# CONFIG_GPIO_PCA953X is not set -# CONFIG_GPIO_PCF857X is not set -# CONFIG_GPIO_PCH is not set -# CONFIG_GPIO_PL061 is not set -# CONFIG_GPIO_RCAR is not set -# CONFIG_GPIO_RDC321X is not set -# CONFIG_GPIO_SCH is not set -# CONFIG_GPIO_SCH311X is not set -# CONFIG_GPIO_SX150X is not set -# CONFIG_GPIO_SYSCON is not set -# CONFIG_GPIO_SYSFS is not set -# CONFIG_GPIO_TS5500 is not set -# CONFIG_GPIO_VX855 is not set -# CONFIG_GPIO_WATCHDOG is not set -# CONFIG_GPIO_WDT is not set -# CONFIG_GPIO_XILINX is not set -# CONFIG_GPIO_ZEVIO is not set -# CONFIG_GREENASIA_FF is not set -# CONFIG_GS_FPGABOOT is not set -# CONFIG_HAMACHI is not set -# CONFIG_HAMRADIO is not set -# CONFIG_HAPPYMEAL is not set -# CONFIG_HARDLOCKUP_DETECTOR is not set -# CONFIG_HAVE_AOUT is not set -# CONFIG_HAVE_ARM_ARCH_TIMER is not set -CONFIG_HAVE_KPROBES=y -CONFIG_HAVE_KRETPROBES=y -# CONFIG_HCALL_STATS is not set -# CONFIG_HDLC is not set -# CONFIG_HDLC_CISCO is not set -# CONFIG_HDLC_FR is not set -# CONFIG_HDLC_PPP is not set -# CONFIG_HDLC_RAW is not set -# CONFIG_HDLC_RAW_ETH is not set -# CONFIG_HDQ_MASTER_OMAP is not set -# CONFIG_HEADERS_CHECK is not set -# CONFIG_HERMES is not set -# CONFIG_HFSPLUS_FS is not set -# CONFIG_HFSPLUS_FS_POSIX_ACL is not set -# CONFIG_HFS_FS is not set -# CONFIG_HFS_FS_POSIX_ACL is not set -# CONFIG_HIBERNATION is not set -# CONFIG_HID is not set -# CONFIG_HIDRAW is not set -# CONFIG_HID_A4TECH is not set -# CONFIG_HID_ACRUX is not set -# CONFIG_HID_ACRUX_FF is not set -# CONFIG_HID_APPLE is not set -# CONFIG_HID_APPLEIR is not set -# CONFIG_HID_AUREAL is not set -# CONFIG_HID_BELKIN is not set -# CONFIG_HID_CHERRY is not set -# CONFIG_HID_CHICONY is not set -# CONFIG_HID_CP2112 is not set -# CONFIG_HID_CYPRESS is not set -# CONFIG_HID_DRAGONRISE is not set -# CONFIG_HID_ELECOM is not set -# CONFIG_HID_ELO is not set -# CONFIG_HID_EMS_FF is not set -# CONFIG_HID_EZKEY is not set -# CONFIG_HID_GENERIC is not set -# CONFIG_HID_GREENASIA is not set -# CONFIG_HID_GT683R is not set -# CONFIG_HID_GYRATION is not set -# CONFIG_HID_HOLTEK is not set -# CONFIG_HID_HUION is not set -# CONFIG_HID_ICADE is not set -# CONFIG_HID_KENSINGTON is not set -# CONFIG_HID_KEYTOUCH is not set -# CONFIG_HID_KYE is not set -# CONFIG_HID_LCPOWER is not set -# CONFIG_HID_LENOVO is not set -# CONFIG_HID_LENOVO_TPKBD is not set -# CONFIG_HID_LOGITECH is not set -# CONFIG_HID_LOGITECH_DJ is not set -# CONFIG_HID_LOGITECH_HIDPP is not set -# CONFIG_HID_MAGICMOUSE is not set -# CONFIG_HID_MICROSOFT is not set -# CONFIG_HID_MONTEREY is not set -# CONFIG_HID_MULTITOUCH is not set -# CONFIG_HID_NTRIG is not set -# CONFIG_HID_ORTEK is not set -# CONFIG_HID_PANTHERLORD is not set -# CONFIG_HID_PENMOUNT is not set -# CONFIG_HID_PETALYNX is not set -# CONFIG_HID_PICOLCD is not set -# CONFIG_HID_PID is not set -# CONFIG_HID_PRIMAX is not set -# CONFIG_HID_PRODIKEYS is not set -# CONFIG_HID_PS3REMOTE is not set -# CONFIG_HID_QUANTA is not set -# CONFIG_HID_RMI is not set -# CONFIG_HID_ROCCAT is not set -# CONFIG_HID_ROCCAT_ARVO is not set -# CONFIG_HID_ROCCAT_KONE is not set -# CONFIG_HID_ROCCAT_KONEPLUS is not set -# CONFIG_HID_ROCCAT_KOVAPLUS is not set -# CONFIG_HID_ROCCAT_PYRA is not set -# CONFIG_HID_SAITEK is not set -# CONFIG_HID_SAMSUNG is not set -# CONFIG_HID_SENSOR_HUB is not set -# CONFIG_HID_SMARTJOYPLUS is not set -# CONFIG_HID_SONY is not set -# CONFIG_HID_SPEEDLINK is not set -# CONFIG_HID_STEELSERIES is not set -# CONFIG_HID_SUNPLUS is not set -# CONFIG_HID_SUPPORT is not set -# CONFIG_HID_THINGM is not set -# CONFIG_HID_THRUSTMASTER is not set -# CONFIG_HID_TIVO is not set -# CONFIG_HID_TOPSEED is not set -# CONFIG_HID_TWINHAN is not set -# CONFIG_HID_UCLOGIC is not set -# CONFIG_HID_WACOM is not set -# CONFIG_HID_WALTOP is not set -# CONFIG_HID_WIIMOTE is not set -# CONFIG_HID_XINMO is not set -# CONFIG_HID_ZEROPLUS is not set -# CONFIG_HID_ZYDACRON is not set -# CONFIG_HIGHMEM is not set -CONFIG_HIGH_RES_TIMERS=y -# CONFIG_HIPPI is not set -# CONFIG_HIX5HD2_GMAC is not set -# CONFIG_HMC6352 is not set -# CONFIG_HOSTAP is not set -# CONFIG_HOSTAP_CS is not set -# CONFIG_HOSTAP_PCI is not set -# CONFIG_HOSTAP_PLX is not set -CONFIG_HOTPLUG=y -# CONFIG_HOTPLUG_CPU is not set -# CONFIG_HOTPLUG_PCI is not set -# CONFIG_HP100 is not set -CONFIG_HPET_MMAP_DEFAULT=y -# CONFIG_HPFS_FS is not set -# CONFIG_HPLAN is not set -# CONFIG_HPLAN_PLUS is not set -# CONFIG_HP_ILO is not set -# CONFIG_HP_WIRELESS is not set -# CONFIG_HSI is not set -# CONFIG_HSR is not set -# CONFIG_HTC_EGPIO is not set -# CONFIG_HTC_I2CPLD is not set -# CONFIG_HTC_PASIC3 is not set -# CONFIG_HUGETLB_PAGE is not set -# CONFIG_HVC_DCC is not set -# CONFIG_HVC_UDBG is not set -# CONFIG_HWMON is not set -# CONFIG_HWMON_DEBUG_CHIP is not set -# CONFIG_HWMON_VID is not set -# CONFIG_HWSPINLOCK_OMAP is not set -CONFIG_HW_PERF_EVENTS=y -# CONFIG_HW_RANDOM is not set -# CONFIG_HW_RANDOM_AMD is not set -# CONFIG_HW_RANDOM_ATMEL is not set -# CONFIG_HW_RANDOM_EXYNOS is not set -# CONFIG_HW_RANDOM_GEODE is not set -# CONFIG_HW_RANDOM_INTEL is not set -# CONFIG_HW_RANDOM_OMAP3_ROM is not set -# CONFIG_HW_RANDOM_PPC4XX is not set -# CONFIG_HW_RANDOM_TIMERIOMEM is not set -# CONFIG_HW_RANDOM_TPM is not set -# CONFIG_HW_RANDOM_VIA is not set -# CONFIG_HYPERV is not set -# CONFIG_HYSDN is not set -CONFIG_HZ=100 -CONFIG_HZ_100=y -# CONFIG_HZ_1000 is not set -# CONFIG_HZ_1024 is not set -# CONFIG_HZ_128 is not set -# CONFIG_HZ_200 is not set -# CONFIG_HZ_250 is not set -# CONFIG_HZ_256 is not set -# CONFIG_HZ_300 is not set -# CONFIG_HZ_48 is not set -# CONFIG_HZ_500 is not set -# CONFIG_HZ_PERIODIC is not set -# CONFIG_I2C is not set -# CONFIG_I2C_ALGOBIT is not set -# CONFIG_I2C_ALGOPCA is not set -# CONFIG_I2C_ALGOPCF is not set -# 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_ARB_GPIO_CHALLENGE is not set -# CONFIG_I2C_AU1550 is not set -# CONFIG_I2C_BCM2835 is not set -# CONFIG_I2C_CBUS_GPIO is not set -# CONFIG_I2C_CHARDEV is not set -# CONFIG_I2C_COMPAT is not set -# CONFIG_I2C_DEBUG_ALGO is not set -# CONFIG_I2C_DEBUG_BUS is not set -# CONFIG_I2C_DEBUG_CORE is not set -# CONFIG_I2C_DESIGNWARE is not set -# CONFIG_I2C_DESIGNWARE_PCI is not set -# CONFIG_I2C_DESIGNWARE_PLATFORM is not set -# CONFIG_I2C_DIOLAN_U2C is not set -# CONFIG_I2C_EG20T is not set -# CONFIG_I2C_ELEKTOR is not set -# CONFIG_I2C_GPIO is not set -# CONFIG_I2C_HELPER_AUTO is not set -# CONFIG_I2C_HID is not set -# CONFIG_I2C_I801 is not set -# CONFIG_I2C_IBM_IIC is not set -# CONFIG_I2C_INTEL_MID is not set -# CONFIG_I2C_ISCH is not set -# CONFIG_I2C_ISMT is not set -# CONFIG_I2C_MPC is not set -# CONFIG_I2C_MUX is not set -# CONFIG_I2C_MUX_PINCTRL is not set -# CONFIG_I2C_MV64XXX is not set -# CONFIG_I2C_NFORCE2 is not set -# CONFIG_I2C_NOMADIK is not set -# CONFIG_I2C_OCORES is not set -# CONFIG_I2C_OCTEON is not set -# CONFIG_I2C_PARPORT is not set -# CONFIG_I2C_PARPORT_LIGHT is not set -# CONFIG_I2C_PCA_ISA is not set -# CONFIG_I2C_PCA_PLATFORM is not set -# CONFIG_I2C_PIIX4 is not set -# CONFIG_I2C_PXA_PCI is not set -# CONFIG_I2C_RCAR is not set -# CONFIG_I2C_RK3X is not set -# CONFIG_I2C_ROBOTFUZZ_OSIF is not set -# CONFIG_I2C_SCMI is not set -# CONFIG_I2C_SH_MOBILE is not set -# CONFIG_I2C_SIMTEC is not set -# CONFIG_I2C_SIS5595 is not set -# CONFIG_I2C_SIS630 is not set -# CONFIG_I2C_SIS96X is not set -# CONFIG_I2C_SMBUS is not set -# CONFIG_I2C_STUB is not set -# CONFIG_I2C_TAOS_EVM is not set -# CONFIG_I2C_TINY_USB is not set -# CONFIG_I2C_VERSATILE is not set -# CONFIG_I2C_VIA is not set -# CONFIG_I2C_VIAPRO is not set -# CONFIG_I2C_XILINX is not set -# CONFIG_I2O is not set -# CONFIG_I40E is not set -# CONFIG_I40EVF is not set -# CONFIG_I6300ESB_WDT is not set -# CONFIG_I82092 is not set -# CONFIG_I82365 is not set -# CONFIG_IBM_ASM is not set -# CONFIG_IBM_EMAC_DEBUG is not set -# CONFIG_IBM_EMAC_EMAC4 is not set -# CONFIG_IBM_EMAC_MAL_CLR_ICINTSTAT is not set -# CONFIG_IBM_EMAC_MAL_COMMON_ERR is not set -# CONFIG_IBM_EMAC_NO_FLOW_CTRL is not set -# CONFIG_IBM_EMAC_RGMII is not set -# CONFIG_IBM_EMAC_TAH is not set -# CONFIG_IBM_EMAC_ZMII is not set -# CONFIG_ICPLUS_PHY is not set -# CONFIG_ICS932S401 is not set -# CONFIG_IDE is not set -# CONFIG_IDEAPAD_LAPTOP is not set -# CONFIG_IDE_GD is not set -# CONFIG_IDE_PHISON is not set -# CONFIG_IDE_PROC_FS is not set -# CONFIG_IDE_TASK_IOCTL is not set -# CONFIG_IEEE802154 is not set -# CONFIG_IEEE802154_FAKEHARD is not set -# CONFIG_IFB is not set -# CONFIG_IGB is not set -# CONFIG_IGBVF is not set -# CONFIG_IIO is not set -# CONFIG_IIO_BUFFER_CB is not set -CONFIG_IIO_CONSUMERS_PER_TRIGGER=2 -# CONFIG_IIO_GPIO_TRIGGER is not set -# CONFIG_IIO_INTERRUPT_TRIGGER is not set -# CONFIG_IIO_PERIODIC_RTC_TRIGGER is not set -# CONFIG_IIO_SIMPLE_DUMMY is not set -# CONFIG_IIO_ST_ACCEL_3AXIS is not set -# CONFIG_IIO_ST_GYRO_3AXIS is not set -# CONFIG_IIO_ST_MAGN_3AXIS is not set -# CONFIG_IIO_ST_PRESS is not set -# CONFIG_IIO_SYSFS_TRIGGER is not set -# CONFIG_IKCONFIG is not set -# CONFIG_IKCONFIG_PROC is not set -# CONFIG_IMAGE_CMDLINE_HACK is not set -# CONFIG_IMX_IPUV3_CORE is not set -CONFIG_INET=y -# CONFIG_INET6_AH is not set -# CONFIG_INET6_ESP is not set -# CONFIG_INET6_IPCOMP is not set -# CONFIG_INET6_TUNNEL is not set -# CONFIG_INET6_XFRM_MODE_BEET is not set -# CONFIG_INET6_XFRM_MODE_ROUTEOPTIMIZATION is not set -# CONFIG_INET6_XFRM_MODE_TRANSPORT is not set -# CONFIG_INET6_XFRM_MODE_TUNNEL is not set -# CONFIG_INET6_XFRM_TUNNEL is not set -# CONFIG_INET_AH is not set -# CONFIG_INET_DIAG is not set -# CONFIG_INET_ESP is not set -# CONFIG_INET_IPCOMP is not set -# CONFIG_INET_LRO is not set -# CONFIG_INET_TCP_DIAG is not set -# CONFIG_INET_TUNNEL is not set -# CONFIG_INET_UDP_DIAG is not set -# CONFIG_INET_XFRM_MODE_BEET is not set -# CONFIG_INET_XFRM_MODE_TRANSPORT is not set -# CONFIG_INET_XFRM_MODE_TUNNEL is not set -# CONFIG_INET_XFRM_TUNNEL is not set -# CONFIG_INFINIBAND is not set -# CONFIG_INFTL is not set -# CONFIG_INITRAMFS_COMPRESSION_BZIP2 is not set -# CONFIG_INITRAMFS_COMPRESSION_GZIP is not set -# CONFIG_INITRAMFS_COMPRESSION_LZMA is not set -CONFIG_INITRAMFS_COMPRESSION_NONE=y -CONFIG_INIT_ENV_ARG_LIMIT=32 -# CONFIG_INLINE_READ_LOCK is not set -# CONFIG_INLINE_READ_LOCK_BH is not set -# CONFIG_INLINE_READ_LOCK_IRQ is not set -# CONFIG_INLINE_READ_LOCK_IRQSAVE is not set -# CONFIG_INLINE_READ_TRYLOCK is not set -CONFIG_INLINE_READ_UNLOCK=y -# CONFIG_INLINE_READ_UNLOCK_BH is not set -CONFIG_INLINE_READ_UNLOCK_IRQ=y -# CONFIG_INLINE_READ_UNLOCK_IRQRESTORE is not set -# CONFIG_INLINE_SPIN_LOCK is not set -# CONFIG_INLINE_SPIN_LOCK_BH is not set -# CONFIG_INLINE_SPIN_LOCK_IRQ is not set -# CONFIG_INLINE_SPIN_LOCK_IRQSAVE is not set -# CONFIG_INLINE_SPIN_TRYLOCK is not set -# CONFIG_INLINE_SPIN_TRYLOCK_BH is not set -CONFIG_INLINE_SPIN_UNLOCK=y -# CONFIG_INLINE_SPIN_UNLOCK_BH is not set -CONFIG_INLINE_SPIN_UNLOCK_IRQ=y -# CONFIG_INLINE_SPIN_UNLOCK_IRQRESTORE is not set -# CONFIG_INLINE_WRITE_LOCK is not set -# CONFIG_INLINE_WRITE_LOCK_BH is not set -# CONFIG_INLINE_WRITE_LOCK_IRQ is not set -# CONFIG_INLINE_WRITE_LOCK_IRQSAVE is not set -# CONFIG_INLINE_WRITE_TRYLOCK is not set -CONFIG_INLINE_WRITE_UNLOCK=y -# CONFIG_INLINE_WRITE_UNLOCK_BH is not set -CONFIG_INLINE_WRITE_UNLOCK_IRQ=y -# CONFIG_INLINE_WRITE_UNLOCK_IRQRESTORE is not set -CONFIG_INOTIFY_USER=y -# CONFIG_INPUT is not set -# CONFIG_INPUT_AD714X is not set -# CONFIG_INPUT_ADXL34X is not set -# CONFIG_INPUT_APANEL is not set -# CONFIG_INPUT_ATI_REMOTE is not set -# CONFIG_INPUT_ATI_REMOTE2 is not set -# CONFIG_INPUT_ATLAS_BTNS is not set -# CONFIG_INPUT_BMA150 is not set -# CONFIG_INPUT_CM109 is not set -# CONFIG_INPUT_CMA3000 is not set -# CONFIG_INPUT_DRV260X_HAPTICS is not set -# CONFIG_INPUT_DRV2667_HAPTICS is not set -# CONFIG_INPUT_EVBUG is not set -# CONFIG_INPUT_EVDEV is not set -# CONFIG_INPUT_FF_MEMLESS is not set -# CONFIG_INPUT_GP2A is not set -# CONFIG_INPUT_GPIO_BEEPER is not set -# CONFIG_INPUT_GPIO_ROTARY_ENCODER is not set -# CONFIG_INPUT_GPIO_TILT_POLLED is not set -# CONFIG_INPUT_IDEAPAD_SLIDEBAR is not set -# CONFIG_INPUT_IMS_PCU is not set -# CONFIG_INPUT_JOYDEV is not set -# CONFIG_INPUT_JOYSTICK is not set -# CONFIG_INPUT_KEYBOARD is not set -# CONFIG_INPUT_KEYSPAN_REMOTE is not set -# CONFIG_INPUT_KXTJ9 is not set -# CONFIG_INPUT_MATRIXKMAP is not set -CONFIG_INPUT_MISC=y -# CONFIG_INPUT_MMA8450 is not set -# CONFIG_INPUT_MOUSE is not set -# CONFIG_INPUT_MOUSEDEV is not set -# CONFIG_INPUT_MPU3050 is not set -# CONFIG_INPUT_PCF8574 is not set -# CONFIG_INPUT_PCSPKR is not set -# CONFIG_INPUT_POLLDEV is not set -# CONFIG_INPUT_POWERMATE is not set -# CONFIG_INPUT_PWM_BEEPER is not set -# CONFIG_INPUT_SOC_BUTTON_ARRAY is not set -# CONFIG_INPUT_SPARSEKMAP is not set -# CONFIG_INPUT_TABLET is not set -# CONFIG_INPUT_TOUCHSCREEN is not set -# CONFIG_INPUT_UINPUT is not set -# CONFIG_INPUT_WISTRON_BTNS is not set -# CONFIG_INPUT_YEALINK is not set -# CONFIG_INT340X_THERMAL is not set -# CONFIG_INTEL_IDLE is not set -# CONFIG_INTEL_MEI is not set -# CONFIG_INTEL_MEI_ME is not set -# CONFIG_INTEL_MEI_TXE is not set -# CONFIG_INTEL_MIC_CARD is not set -# CONFIG_INTEL_MIC_HOST is not set -# CONFIG_INTEL_MID_PTI is not set -# CONFIG_INTEL_OAKTRAIL is not set -# CONFIG_INTEL_RST is not set -# CONFIG_INTEL_SMARTCONNECT is not set -# CONFIG_INTEL_SOC_PMIC is not set -# CONFIG_INTERVAL_TREE_TEST is not set -# CONFIG_INV_MPU6050_IIO is not set -# CONFIG_IOMMU_SUPPORT is not set -# CONFIG_IOSCHED_CFQ is not set -CONFIG_IOSCHED_DEADLINE=y -CONFIG_IOSCHED_NOOP=y -# CONFIG_IP1000 is not set -# CONFIG_IP17XX_PHY is not set -# CONFIG_IP6_NF_FILTER is not set -# CONFIG_IP6_NF_IPTABLES is not set -# CONFIG_IP6_NF_MANGLE is not set -# 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_HL is not set -# CONFIG_IP6_NF_MATCH_IPV6HEADER is not set -# CONFIG_IP6_NF_MATCH_MH is not set -# CONFIG_IP6_NF_MATCH_OPTS is not set -# CONFIG_IP6_NF_MATCH_RPFILTER is not set -# CONFIG_IP6_NF_MATCH_RT is not set -# CONFIG_IP6_NF_NAT is not set -# CONFIG_IP6_NF_QUEUE is not set -# CONFIG_IP6_NF_RAW is not set -# CONFIG_IP6_NF_TARGET_HL is not set -# CONFIG_IP6_NF_TARGET_LOG is not set -# CONFIG_IP6_NF_TARGET_REJECT is not set -# CONFIG_IP6_NF_TARGET_SYNPROXY is not set -# CONFIG_IPACK_BUS is not set -# CONFIG_IPC_NS is not set -# CONFIG_IPMI_HANDLER is not set -# CONFIG_IPV6 is not set -# CONFIG_IPV6_MIP6 is not set -# CONFIG_IPV6_MROUTE is not set -# CONFIG_IPV6_MROUTE_MULTIPLE_TABLES is not set -# CONFIG_IPV6_MULTIPLE_TABLES is not set -CONFIG_IPV6_NDISC_NODETYPE=y -# CONFIG_IPV6_OPTIMISTIC_DAD is not set -# CONFIG_IPV6_PRIVACY is not set -# CONFIG_IPV6_ROUTER_PREF is not set -# CONFIG_IPV6_ROUTE_INFO is not set -# CONFIG_IPV6_SIT is not set -# CONFIG_IPV6_SIT_6RD is not set -# CONFIG_IPV6_TUNNEL is not set -# CONFIG_IPV6_VTI is not set -# CONFIG_IPW2100 is not set -# CONFIG_IPW2100_DEBUG is not set -CONFIG_IPW2100_MONITOR=y -# CONFIG_IPW2200 is not set -# CONFIG_IPW2200_DEBUG is not set -CONFIG_IPW2200_MONITOR=y -# CONFIG_IPW2200_PROMISCUOUS is not set -# CONFIG_IPW2200_QOS is not set -# CONFIG_IPW2200_RADIOTAP is not set -# CONFIG_IPWIRELESS is not set -# CONFIG_IPX is not set -CONFIG_IP_ADVANCED_ROUTER=y -# CONFIG_IP_DCCP is not set -# CONFIG_IP_FIB_TRIE_STATS is not set -# CONFIG_IP_MROUTE is not set -CONFIG_IP_MROUTE_MULTIPLE_TABLES=y -CONFIG_IP_MULTICAST=y -CONFIG_IP_MULTIPLE_TABLES=y -# CONFIG_IP_NF_ARPFILTER is not set -# CONFIG_IP_NF_ARPTABLES is not set -# CONFIG_IP_NF_ARP_MANGLE is not set -# CONFIG_IP_NF_FILTER is not set -# CONFIG_IP_NF_IPTABLES is not set -# CONFIG_IP_NF_MANGLE is not set -# 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_QUEUE is not set -# CONFIG_IP_NF_RAW is not set -# CONFIG_IP_NF_SECURITY is not set -# CONFIG_IP_NF_TARGET_CLUSTERIP is not set -# CONFIG_IP_NF_TARGET_ECN is not set -# CONFIG_IP_NF_TARGET_LOG is not set -# CONFIG_IP_NF_TARGET_MASQUERADE is not set -# CONFIG_IP_NF_TARGET_NETMAP is not set -# CONFIG_IP_NF_TARGET_REDIRECT is not set -# CONFIG_IP_NF_TARGET_REJECT is not set -# CONFIG_IP_NF_TARGET_SYNPROXY is not set -# CONFIG_IP_NF_TARGET_TTL is not set -# CONFIG_IP_NF_TARGET_ULOG is not set -# CONFIG_IP_PIMSM_V1 is not set -# CONFIG_IP_PIMSM_V2 is not set -# CONFIG_IP_PNP is not set -CONFIG_IP_ROUTE_MULTIPATH=y -CONFIG_IP_ROUTE_VERBOSE=y -# CONFIG_IP_SCTP is not set -# CONFIG_IP_SET is not set -# CONFIG_IP_VS is not set -# CONFIG_IRDA is not set -# CONFIG_IRQSOFF_TRACER is not set -# CONFIG_IRQ_ALL_CPUS is not set -# CONFIG_IRQ_DOMAIN_DEBUG is not set -# CONFIG_IRQ_TIME_ACCOUNTING is not set -# CONFIG_IR_GPIO_CIR is not set -# CONFIG_IR_HIX5HD2 is not set -# CONFIG_IR_IGUANA is not set -# CONFIG_IR_IMG is not set -# CONFIG_IR_IMON is not set -# CONFIG_IR_JVC_DECODER is not set -# CONFIG_IR_LIRC_CODEC is not set -# CONFIG_IR_MCEUSB is not set -# CONFIG_IR_NEC_DECODER is not set -# CONFIG_IR_RC5_DECODER is not set -# CONFIG_IR_RC5_SZ_DECODER is not set -# CONFIG_IR_RC6_DECODER is not set -# CONFIG_IR_REDRAT3 is not set -# CONFIG_IR_SONY_DECODER is not set -# CONFIG_IR_STREAMZAP is not set -# CONFIG_IR_TTUSBIR is not set -# CONFIG_ISCSI_BOOT_SYSFS is not set -# CONFIG_ISCSI_TCP is not set -CONFIG_ISDN=y -# CONFIG_ISDN_AUDIO is not set -# CONFIG_ISDN_CAPI is not set -# CONFIG_ISDN_CAPI_CAPIDRV is not set -# CONFIG_ISDN_DIVERSION is not set -# CONFIG_ISDN_DRV_ACT2000 is not set -# CONFIG_ISDN_DRV_AVMB1_VERBOSE_REASON is not set -# CONFIG_ISDN_DRV_GIGASET is not set -# CONFIG_ISDN_DRV_HISAX is not set -# CONFIG_ISDN_DRV_ICN is not set -# CONFIG_ISDN_DRV_LOOP is not set -# CONFIG_ISDN_DRV_PCBIT is not set -# CONFIG_ISDN_DRV_SC is not set -# CONFIG_ISDN_I4L is not set -# CONFIG_ISL29003 is not set -# CONFIG_ISL29020 is not set -# CONFIG_ISL29125 is not set -# CONFIG_ISO9660_FS is not set -# CONFIG_ISS4xx is not set -# CONFIG_ITG3200 is not set -# CONFIG_IWL3945 is not set -# CONFIG_IWLAGN is not set -# CONFIG_IWLWIFI is not set -# CONFIG_IWMC3200TOP is not set -# CONFIG_IXGB is not set -# CONFIG_IXGBE is not set -# CONFIG_IXGBEVF is not set -# CONFIG_JBD is not set -# CONFIG_JBD2_DEBUG is not set -# CONFIG_JBD_DEBUG is not set -# CONFIG_JFFS2_CMODE_FAVOURLZO is not set -# CONFIG_JFFS2_CMODE_NONE is not set -CONFIG_JFFS2_CMODE_PRIORITY=y -# CONFIG_JFFS2_CMODE_SIZE is not set -CONFIG_JFFS2_COMPRESSION_OPTIONS=y -CONFIG_JFFS2_FS=y -CONFIG_JFFS2_FS_DEBUG=0 -# CONFIG_JFFS2_FS_POSIX_ACL is not set -# CONFIG_JFFS2_FS_SECURITY is not set -# CONFIG_JFFS2_FS_WBUF_VERIFY is not set -CONFIG_JFFS2_FS_WRITEBUFFER=y -CONFIG_JFFS2_FS_XATTR=y -CONFIG_JFFS2_LZMA=y -# CONFIG_JFFS2_LZO is not set -CONFIG_JFFS2_RTIME=y -# CONFIG_JFFS2_RUBIN is not set -CONFIG_JFFS2_SUMMARY=y -# CONFIG_JFFS2_ZLIB is not set -# CONFIG_JFS_DEBUG is not set -# CONFIG_JFS_FS is not set -# CONFIG_JFS_POSIX_ACL is not set -# CONFIG_JFS_SECURITY is not set -# CONFIG_JFS_STATISTICS is not set -# CONFIG_JME is not set -CONFIG_JOLIET=y -# CONFIG_JUMP_LABEL is not set -# CONFIG_KALLSYMS is not set -# CONFIG_KALLSYMS_ALL is not set -# CONFIG_KALLSYMS_UNCOMPRESSED is not set -# CONFIG_KARMA_PARTITION is not set -# CONFIG_KERNEL_BZIP2 is not set -# CONFIG_KERNEL_GZIP is not set -# CONFIG_KERNEL_LZ4 is not set -# CONFIG_KERNEL_LZMA is not set -# CONFIG_KERNEL_LZO is not set -CONFIG_KERNEL_MODE_NEON=y -CONFIG_KERNEL_XZ=y -CONFIG_KERNFS=y -# CONFIG_KEXEC is not set -# CONFIG_KEYBOARD_ADP5588 is not set -# CONFIG_KEYBOARD_ADP5589 is not set -# CONFIG_KEYBOARD_ATKBD is not set -# CONFIG_KEYBOARD_CAP1106 is not set -# CONFIG_KEYBOARD_GPIO_POLLED is not set -# CONFIG_KEYBOARD_LKKBD is not set -# CONFIG_KEYBOARD_LM8323 is not set -# CONFIG_KEYBOARD_LM8333 is not set -# CONFIG_KEYBOARD_MATRIX 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_OMAP4 is not set -# CONFIG_KEYBOARD_OPENCORES is not set -# CONFIG_KEYBOARD_PXA27x is not set -# CONFIG_KEYBOARD_QT1070 is not set -# CONFIG_KEYBOARD_QT2160 is not set -# CONFIG_KEYBOARD_SAMSUNG is not set -# CONFIG_KEYBOARD_SH_KEYSC is not set -# CONFIG_KEYBOARD_STOWAWAY is not set -# CONFIG_KEYBOARD_SUNKBD is not set -# CONFIG_KEYBOARD_TCA6416 is not set -# CONFIG_KEYBOARD_TCA8418 is not set -# CONFIG_KEYBOARD_XTKBD is not set -# CONFIG_KEYS is not set -# CONFIG_KEYS_DEBUG_PROC_KEYS is not set -# CONFIG_KGDB is not set -# CONFIG_KMEMCHECK is not set -# CONFIG_KPROBES is not set -# CONFIG_KPROBES_SANITY_TEST is not set -# CONFIG_KS8842 is not set -# CONFIG_KS8851 is not set -# CONFIG_KS8851_MLL is not set -# CONFIG_KSM is not set -# CONFIG_KSZ884X_PCI is not set -CONFIG_KUSER_HELPERS=y -# CONFIG_KVM_GUEST is not set -# CONFIG_KXCJK1013 is not set -# CONFIG_KXSD9 is not set -# CONFIG_L2TP is not set -# CONFIG_L2TP_ETH is not set -# CONFIG_L2TP_IP is not set -# CONFIG_L2TP_V3 is not set -# CONFIG_LANMEDIA is not set -# CONFIG_LANTIQ is not set -# CONFIG_LAPB is not set -# CONFIG_LASAT is not set -# CONFIG_LATENCYTOP is not set -# CONFIG_LATTICE_ECP3_CONFIG is not set -CONFIG_LBDAF=y -# CONFIG_LCD_HX8357 is not set -# CONFIG_LCD_ILI922X is not set -# CONFIG_LCD_ILI9320 is not set -# CONFIG_LCD_LMS501KF03 is not set -# CONFIG_LDM_PARTITION is not set -# CONFIG_LEDS_ATMEL_PWM is not set -# CONFIG_LEDS_BD2802 is not set -# CONFIG_LEDS_BLINKM is not set -CONFIG_LEDS_CLASS=y -# CONFIG_LEDS_DAC124S085 is not set -# CONFIG_LEDS_GPIO is not set -CONFIG_LEDS_GPIO_OF=y -CONFIG_LEDS_GPIO_PLATFORM=y -# CONFIG_LEDS_INTEL_SS4200 is not set -# CONFIG_LEDS_LM3530 is not set -# CONFIG_LEDS_LM3556 is not set -# CONFIG_LEDS_LM355x is not set -# CONFIG_LEDS_LM3642 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_LT3593 is not set -# CONFIG_LEDS_NET5501 is not set -# CONFIG_LEDS_OT200 is not set -# CONFIG_LEDS_PCA9532 is not set -# CONFIG_LEDS_PCA955X is not set -# CONFIG_LEDS_PCA9633 is not set -# CONFIG_LEDS_PCA963X is not set -# CONFIG_LEDS_PCA9685 is not set -# CONFIG_LEDS_PWM is not set -# CONFIG_LEDS_RENESAS_TPU is not set -# CONFIG_LEDS_SYSCON is not set -# CONFIG_LEDS_TCA6507 is not set -CONFIG_LEDS_TRIGGERS=y -# CONFIG_LEDS_TRIGGER_BACKLIGHT is not set -# CONFIG_LEDS_TRIGGER_CAMERA is not set -# CONFIG_LEDS_TRIGGER_CPU is not set -CONFIG_LEDS_TRIGGER_DEFAULT_ON=y -# CONFIG_LEDS_TRIGGER_GPIO is not set -# CONFIG_LEDS_TRIGGER_HEARTBEAT is not set -# CONFIG_LEDS_TRIGGER_IDE_DISK is not set -CONFIG_LEDS_TRIGGER_NETDEV=y -# CONFIG_LEDS_TRIGGER_ONESHOT is not set -CONFIG_LEDS_TRIGGER_TIMER=y -# CONFIG_LEDS_TRIGGER_TRANSIENT is not set -# CONFIG_LEGACY_PTYS is not set -# CONFIG_LIB80211 is not set -# CONFIG_LIB80211_CRYPT_CCMP is not set -# CONFIG_LIB80211_CRYPT_TKIP is not set -# CONFIG_LIB80211_CRYPT_WEP is not set -# CONFIG_LIB80211_DEBUG is not set -# CONFIG_LIBCRC32C is not set -# CONFIG_LIBERTAS is not set -# CONFIG_LIBERTAS_THINFIRM is not set -# CONFIG_LIBERTAS_USB is not set -# CONFIG_LIBFC is not set -# CONFIG_LIBFCOE is not set -# CONFIG_LIBIPW_DEBUG is not set -# CONFIG_LINE6_USB is not set -# CONFIG_LIRC_STAGING is not set -# CONFIG_LIS3L02DQ is not set -# CONFIG_LKDTM is not set -CONFIG_LLC=y -# CONFIG_LLC2 is not set -CONFIG_LOCALVERSION="" -# CONFIG_LOCALVERSION_AUTO is not set -# CONFIG_LOCKD is not set -CONFIG_LOCKDEP_SUPPORT=y -CONFIG_LOCKD_V4=y -# CONFIG_LOCKUP_DETECTOR is not set -# CONFIG_LOCK_STAT is not set -# CONFIG_LOCK_TORTURE_TEST is not set -# CONFIG_LOGFS is not set -# CONFIG_LOGIG940_FF is not set -# CONFIG_LOGIRUMBLEPAD2_FF is not set -# CONFIG_LOGITECH_FF is not set -# CONFIG_LOGIWHEELS_FF is not set -# CONFIG_LOGO is not set -CONFIG_LOG_BUF_SHIFT=17 -CONFIG_LOG_CPU_MAX_BUF_SHIFT=12 -# CONFIG_LOONGSON_MC146818 is not set -# CONFIG_LP486E is not set -# CONFIG_LPC_ICH is not set -# CONFIG_LPC_SCH is not set -# CONFIG_LP_CONSOLE is not set -# CONFIG_LSI_ET1011C_PHY is not set -# CONFIG_LTE_GDM724X is not set -# CONFIG_LTPC is not set -# CONFIG_LTR501 is not set -# CONFIG_LUSTRE_FS is not set -# CONFIG_LXT_PHY is not set -# CONFIG_LZ4HC_COMPRESS is not set -# CONFIG_LZ4_COMPRESS is not set -# CONFIG_LZ4_DECOMPRESS is not set -CONFIG_LZMA_COMPRESS=y -CONFIG_LZMA_DECOMPRESS=y -# CONFIG_LZO_COMPRESS is not set -# CONFIG_LZO_DECOMPRESS is not set -# CONFIG_M25PXX_PREFER_SMALL_SECTOR_ERASE is not set -# CONFIG_MAC80211 is not set -# CONFIG_MAC80211_MESSAGE_TRACING is not set -# CONFIG_MACB is not set -# CONFIG_MACH_DECSTATION is not set -# CONFIG_MACH_JAZZ is not set -# CONFIG_MACH_JZ4740 is not set -# CONFIG_MACH_LOONGSON is not set -# CONFIG_MACH_LOONGSON1 is not set -# CONFIG_MACH_NO_WESTBRIDGE is not set -# CONFIG_MACH_TX39XX is not set -# CONFIG_MACH_TX49XX is not set -# CONFIG_MACH_VR41XX is not set -# CONFIG_MACINTOSH_DRIVERS is not set -# CONFIG_MACVLAN is not set -# CONFIG_MACVTAP is not set -# CONFIG_MAC_EMUMOUSEBTN is not set -# CONFIG_MAC_PARTITION is not set -# CONFIG_MAG3110 is not set -# CONFIG_MAGIC_SYSRQ is not set -CONFIG_MAGIC_SYSRQ_DEFAULT_ENABLE=0x1 -# CONFIG_MAILBOX is not set -# CONFIG_MANGLE_BOOTARGS is not set -# CONFIG_MARVELL_PHY is not set -# CONFIG_MAX1027 is not set -# CONFIG_MAX1363 is not set -# CONFIG_MAX517 is not set -# CONFIG_MAX5821 is not set -# CONFIG_MAX63XX_WATCHDOG is not set -# CONFIG_MCB is not set -# CONFIG_MCP320X is not set -# CONFIG_MCP3422 is not set -# CONFIG_MCP4725 is not set -# CONFIG_MCP4922 is not set -# CONFIG_MCPM is not set -# CONFIG_MD is not set -# CONFIG_MDIO_BCM_UNIMAC 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_MD_FAULTY is not set -# CONFIG_MEDIA_ANALOG_TV_SUPPORT is not set -# CONFIG_MEDIA_ATTACH is not set -# CONFIG_MEDIA_CAMERA_SUPPORT is not set -# CONFIG_MEDIA_CONTROLLER is not set -# CONFIG_MEDIA_DIGITAL_TV_SUPPORT is not set -# CONFIG_MEDIA_PARPORT_SUPPORT is not set -# CONFIG_MEDIA_PCI_SUPPORT is not set -# CONFIG_MEDIA_RADIO_SUPPORT is not set -# CONFIG_MEDIA_RC_SUPPORT is not set -# CONFIG_MEDIA_SDR_SUPPORT is not set -# CONFIG_MEDIA_SUBDRV_AUTOSELECT is not set -# CONFIG_MEDIA_SUPPORT is not set -# CONFIG_MEDIA_TUNER_CUSTOMISE is not set -# CONFIG_MEDIA_USB_SUPPORT is not set -# CONFIG_MEGARAID_LEGACY is not set -# CONFIG_MEGARAID_NEWGEN is not set -# CONFIG_MEGARAID_SAS is not set -# CONFIG_MEMORY is not set -# CONFIG_MEMORY_FAILURE is not set -# CONFIG_MEMSTICK is not set -# CONFIG_MEN_A21_WDT is not set -CONFIG_MESSAGE_LOGLEVEL_DEFAULT=4 -# CONFIG_MFD_88PM800 is not set -# CONFIG_MFD_88PM805 is not set -# CONFIG_MFD_88PM860X is not set -# CONFIG_MFD_AAT2870_CORE is not set -# CONFIG_MFD_ARIZONA_I2C is not set -# CONFIG_MFD_ARIZONA_SPI is not set -# CONFIG_MFD_AS3711 is not set -# CONFIG_MFD_AS3722 is not set -# CONFIG_MFD_ASIC3 is not set -# CONFIG_MFD_AXP20X is not set -# CONFIG_MFD_BCM590XX is not set -# CONFIG_MFD_CORE is not set -# CONFIG_MFD_CROS_EC is not set -# CONFIG_MFD_CS5535 is not set -# CONFIG_MFD_DA9052_I2C is not set -# CONFIG_MFD_DA9052_SPI is not set -# CONFIG_MFD_DA9055 is not set -# CONFIG_MFD_DA9063 is not set -# CONFIG_MFD_HI6421_PMIC is not set -# CONFIG_MFD_JANZ_CMODIO is not set -# CONFIG_MFD_KEMPLD is not set -# CONFIG_MFD_LM3533 is not set -# CONFIG_MFD_LP3943 is not set -# CONFIG_MFD_LP8788 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_MFD_MC13783 is not set -# CONFIG_MFD_MC13XXX is not set -# CONFIG_MFD_MC13XXX_I2C is not set -# CONFIG_MFD_MC13XXX_SPI is not set -# CONFIG_MFD_MENF21BMC is not set -# CONFIG_MFD_OMAP_USB_HOST is not set -# CONFIG_MFD_PALMAS is not set -# CONFIG_MFD_PCF50633 is not set -# CONFIG_MFD_PM8921_CORE is not set -# CONFIG_MFD_RC5T583 is not set -# CONFIG_MFD_RDC321X is not set -# CONFIG_MFD_RETU is not set -# CONFIG_MFD_RK808 is not set -# CONFIG_MFD_RN5T618 is not set -# CONFIG_MFD_RTSX_PCI is not set -# CONFIG_MFD_RTSX_USB is not set -# CONFIG_MFD_S5M_CORE 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_MFD_STMPE is not set -CONFIG_MFD_SUPPORT=y -# CONFIG_MFD_SYSCON is not set -# CONFIG_MFD_T7L66XB is not set -# CONFIG_MFD_TC3589X is not set -# CONFIG_MFD_TC6387XB is not set -# CONFIG_MFD_TC6393XB is not set -# CONFIG_MFD_TIMBERDALE is not set -# CONFIG_MFD_TI_AM335X_TSCADC is not set -# CONFIG_MFD_TMIO 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_MFD_VIPERBOARD is not set -# CONFIG_MFD_VX855 is not set -# CONFIG_MFD_WL1273_CORE is not set -# CONFIG_MFD_WM831X 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_WM8400 is not set -# CONFIG_MFD_WM8994 is not set -# CONFIG_MG_DISK is not set -# CONFIG_MICREL_KS8995MA is not set -# CONFIG_MICREL_PHY is not set -# CONFIG_MIGRATION is not set -CONFIG_MII=y -# CONFIG_MIKROTIK_RB532 is not set -# CONFIG_MINIX_FS is not set -# CONFIG_MINIX_FS_NATIVE_ENDIAN is not set -# CONFIG_MINIX_SUBPARTITION is not set -# CONFIG_MIPS_ALCHEMY is not set -# CONFIG_MIPS_COBALT is not set -# CONFIG_MIPS_FPU_EMULATOR is not set -# CONFIG_MIPS_MALTA is not set -# CONFIG_MIPS_O32_FP64_SUPPORT is not set -# CONFIG_MIPS_PARAVIRT is not set -# CONFIG_MIPS_SEAD3 is not set -# CONFIG_MIPS_SIM is not set -CONFIG_MISC_DEVICES=y -CONFIG_MISC_FILESYSTEMS=y -# CONFIG_MISDN is not set -# CONFIG_MISDN_AVMFRITZ is not set -# CONFIG_MISDN_HFCPCI is not set -# CONFIG_MISDN_HFCUSB is not set -# CONFIG_MISDN_INFINEON is not set -# CONFIG_MISDN_NETJET is not set -# CONFIG_MISDN_SPEEDFAX is not set -# CONFIG_MISDN_W6692 is not set -# CONFIG_MKISS is not set -# CONFIG_MLX4_CORE is not set -# CONFIG_MLX4_EN is not set -# CONFIG_MLX5_CORE is not set -# CONFIG_MLX90614 is not set -# CONFIG_MMA8452 is not set -# CONFIG_MMC is not set -# CONFIG_MMC_ARMMMCI is not set -# CONFIG_MMC_AU1X is not set -# CONFIG_MMC_BLOCK is not set -CONFIG_MMC_BLOCK_BOUNCE=y -CONFIG_MMC_BLOCK_MINORS=8 -# CONFIG_MMC_CB710 is not set -# CONFIG_MMC_CLKGATE is not set -# CONFIG_MMC_DEBUG is not set -# CONFIG_MMC_DW is not set -# CONFIG_MMC_MVSDIO is not set -# CONFIG_MMC_S3C is not set -# CONFIG_MMC_SDHCI is not set -# CONFIG_MMC_SDHCI_ACPI is not set -# CONFIG_MMC_SDHCI_BCM_KONA is not set -# CONFIG_MMC_SDHCI_MSM is not set -# CONFIG_MMC_SDHCI_OF_ARASAN is not set -# CONFIG_MMC_SDHCI_OF_ESDHC is not set -# CONFIG_MMC_SDHCI_OF_HLWD is not set -# CONFIG_MMC_SDHCI_PXAV2 is not set -# CONFIG_MMC_SDHCI_PXAV3 is not set -# CONFIG_MMC_SDRICOH_CS is not set -# CONFIG_MMC_SPI is not set -# CONFIG_MMC_TEST is not set -# CONFIG_MMC_UNSAFE_RESUME is not set -# CONFIG_MMC_USDHI6ROL0 is not set -# CONFIG_MMC_USHC is not set -# CONFIG_MMC_VIA_SDMMC is not set -# CONFIG_MMC_VUB300 is not set -# CONFIG_MMIOTRACE is not set -CONFIG_MMU=y -CONFIG_MODULES=y -# CONFIG_MODULE_COMPRESS is not set -# CONFIG_MODULE_FORCE_LOAD is not set -# CONFIG_MODULE_FORCE_UNLOAD is not set -# CONFIG_MODULE_SIG is not set -# CONFIG_MODULE_SRCVERSION_ALL is not set -CONFIG_MODULE_STRIPPED=y -CONFIG_MODULE_UNLOAD=y -# CONFIG_MODVERSIONS is not set -# CONFIG_MOUSE_APPLETOUCH is not set -# CONFIG_MOUSE_GPIO is not set -# CONFIG_MOUSE_INPORT is not set -# CONFIG_MOUSE_LOGIBM is not set -# CONFIG_MOUSE_PC110PAD is not set -# CONFIG_MOUSE_PS2_SENTELIC is not set -# CONFIG_MOUSE_SYNAPTICS_I2C is not set -# CONFIG_MOUSE_SYNAPTICS_USB is not set -# CONFIG_MPL115 is not set -# CONFIG_MPL3115 is not set -# CONFIG_MSDOS_FS is not set -CONFIG_MSDOS_PARTITION=y -# CONFIG_MSI_BITMAP_SELFTEST is not set -# CONFIG_MSI_LAPTOP is not set -CONFIG_MTD=y -# CONFIG_MTD_ABSENT is not set -# CONFIG_MTD_AFS_PARTS is not set -# CONFIG_MTD_ALAUDA is not set -# CONFIG_MTD_AR7_PARTS is not set -# CONFIG_MTD_ARM_INTEGRATOR is not set -CONFIG_MTD_BLKDEVS=y -CONFIG_MTD_BLOCK=y -# CONFIG_MTD_BLOCK2MTD is not set -CONFIG_MTD_CFI=y -# CONFIG_MTD_CFI_ADV_OPTIONS is not set -CONFIG_MTD_CFI_AMDSTD=y -# CONFIG_MTD_CFI_BE_BYTE_SWAP 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_LE_BYTE_SWAP is not set -CONFIG_MTD_CFI_NOSWAP=y -# CONFIG_MTD_CFI_STAA is not set -CONFIG_MTD_CFI_UTIL=y -CONFIG_MTD_CHAR=y -# CONFIG_MTD_CMDLINE_PARTS is not set -CONFIG_MTD_COMPLEX_MAPPINGS=y -# CONFIG_MTD_DATAFLASH is not set -# CONFIG_MTD_DEBUG is not set -# CONFIG_MTD_DOC2000 is not set -# CONFIG_MTD_DOC2001 is not set -# CONFIG_MTD_DOC2001PLUS is not set -# CONFIG_MTD_DOCG3 is not set -CONFIG_MTD_GEN_PROBE=y -# CONFIG_MTD_GPIO_ADDR is not set -# CONFIG_MTD_INTEL_VR_NOR is not set -# CONFIG_MTD_JEDECPROBE is not set -# CONFIG_MTD_LATCH_ADDR is not set -# CONFIG_MTD_LPDDR is not set -# CONFIG_MTD_LPDDR2_NVM is not set -# CONFIG_MTD_M25P80 is not set -CONFIG_MTD_MAP_BANK_WIDTH_1=y -# CONFIG_MTD_MAP_BANK_WIDTH_16 is not set -CONFIG_MTD_MAP_BANK_WIDTH_2=y -# CONFIG_MTD_MAP_BANK_WIDTH_32 is not set -CONFIG_MTD_MAP_BANK_WIDTH_4=y -# CONFIG_MTD_MAP_BANK_WIDTH_8 is not set -# CONFIG_MTD_MTDRAM is not set -# CONFIG_MTD_MYLOADER_PARTS is not set -# CONFIG_MTD_NAND is not set -# CONFIG_MTD_NAND_AMS_DELTA is not set -# CONFIG_MTD_NAND_AR934X is not set -# CONFIG_MTD_NAND_AR934X_HW_ECC is not set -# CONFIG_MTD_NAND_ATMEL is not set -# CONFIG_MTD_NAND_AU1550 is not set -# CONFIG_MTD_NAND_AUTCPU12 is not set -# CONFIG_MTD_NAND_BCH is not set -# CONFIG_MTD_NAND_BCM_UMI is not set -# CONFIG_MTD_NAND_BF5XX is not set -# CONFIG_MTD_NAND_CAFE is not set -# CONFIG_MTD_NAND_CM_X270 is not set -# CONFIG_MTD_NAND_CS553X is not set -# CONFIG_MTD_NAND_DAVINCI is not set -# CONFIG_MTD_NAND_DENALI is not set -CONFIG_MTD_NAND_DENALI_SCRATCH_REG_ADDR=0xff108018 -# CONFIG_MTD_NAND_DISKONCHIP is not set -# CONFIG_MTD_NAND_DOCG4 is not set -# CONFIG_MTD_NAND_ECC is not set -# CONFIG_MTD_NAND_ECC_BCH is not set -# CONFIG_MTD_NAND_ECC_SMC is not set -# CONFIG_MTD_NAND_FSL_ELBC is not set -# CONFIG_MTD_NAND_FSL_IFC is not set -# CONFIG_MTD_NAND_FSL_UPM is not set -# CONFIG_MTD_NAND_FSMC is not set -# CONFIG_MTD_NAND_GPIO is not set -# CONFIG_MTD_NAND_GPMI_NAND is not set -# CONFIG_MTD_NAND_H1900 is not set -CONFIG_MTD_NAND_IDS=y -# CONFIG_MTD_NAND_JZ4740 is not set -# CONFIG_MTD_NAND_MPC5121_NFC is not set -# CONFIG_MTD_NAND_MUSEUM_IDS is not set -# CONFIG_MTD_NAND_MXC is not set -# CONFIG_MTD_NAND_NANDSIM is not set -# CONFIG_MTD_NAND_NDFC is not set -# CONFIG_MTD_NAND_NOMADIK is not set -# CONFIG_MTD_NAND_NUC900 is not set -# CONFIG_MTD_NAND_OMAP2 is not set -# CONFIG_MTD_NAND_OMAP_BCH_BUILD is not set -# CONFIG_MTD_NAND_ORION is not set -# CONFIG_MTD_NAND_PASEMI is not set -# CONFIG_MTD_NAND_PLATFORM is not set -# CONFIG_MTD_NAND_PPCHAMELEONEVB is not set -# CONFIG_MTD_NAND_PXA3xx is not set -# CONFIG_MTD_NAND_RB4XX is not set -# CONFIG_MTD_NAND_RB750 is not set -# CONFIG_MTD_NAND_RICOH is not set -# CONFIG_MTD_NAND_RTC_FROM4 is not set -# CONFIG_MTD_NAND_S3C2410 is not set -# CONFIG_MTD_NAND_SHARPSL is not set -# CONFIG_MTD_NAND_SH_FLCTL is not set -# CONFIG_MTD_NAND_SOCRATES is not set -# CONFIG_MTD_NAND_SPIA is not set -# CONFIG_MTD_NAND_TMIO is not set -# CONFIG_MTD_NAND_TXX9NDFMC is not set -# CONFIG_MTD_NAND_VERIFY_WRITE is not set -CONFIG_MTD_OF_PARTS=y -# CONFIG_MTD_ONENAND is not set -# CONFIG_MTD_OOPS is not set -# CONFIG_MTD_OTP is not set -# CONFIG_MTD_PCI is not set -# CONFIG_MTD_PCMCIA is not set -# CONFIG_MTD_PHRAM is not set -# CONFIG_MTD_PHYSMAP is not set -# CONFIG_MTD_PHYSMAP_COMPAT is not set -CONFIG_MTD_PHYSMAP_OF=y -# CONFIG_MTD_PLATRAM is not set -# CONFIG_MTD_PMC551 is not set -# CONFIG_MTD_RAM is not set -CONFIG_MTD_REDBOOT_DIRECTORY_BLOCK=-1 -# CONFIG_MTD_REDBOOT_PARTS is not set -# CONFIG_MTD_REDBOOT_PARTS_READONLY is not set -# CONFIG_MTD_REDBOOT_PARTS_UNALLOCATED is not set -# CONFIG_MTD_ROM is not set -CONFIG_MTD_ROOTFS_ROOT_DEV=y -CONFIG_MTD_ROOTFS_SPLIT=y -# CONFIG_MTD_SLRAM is not set -# CONFIG_MTD_SM_COMMON is not set -# CONFIG_MTD_SPINAND_MT29F is not set -# CONFIG_MTD_SPI_NOR is not set -# CONFIG_MTD_SPI_NOR_USE_4K_SECTORS is not set -CONFIG_MTD_SPLIT=y -# CONFIG_MTD_SPLIT_BRNIMAGE_FW is not set -# CONFIG_MTD_SPLIT_EVA_FW is not set -# CONFIG_MTD_SPLIT_FIRMWARE is not set -CONFIG_MTD_SPLIT_FIRMWARE_NAME="firmware" -# CONFIG_MTD_SPLIT_FIT_FW is not set -# CONFIG_MTD_SPLIT_JIMAGE_FW is not set -# CONFIG_MTD_SPLIT_LZMA_FW is not set -# CONFIG_MTD_SPLIT_MINOR_FW is not set -# CONFIG_MTD_SPLIT_SEAMA_FW is not set -CONFIG_MTD_SPLIT_SQUASHFS_ROOT=y -CONFIG_MTD_SPLIT_SUPPORT=y -# CONFIG_MTD_SPLIT_TPLINK_FW is not set -# CONFIG_MTD_SPLIT_TRX_FW is not set -# CONFIG_MTD_SPLIT_UIMAGE_FW is not set -# CONFIG_MTD_SPLIT_WRGG_FW is not set -# CONFIG_MTD_SST25L is not set -# CONFIG_MTD_SWAP is not set -# CONFIG_MTD_TESTS is not set -# CONFIG_MTD_UBI is not set -# CONFIG_MTD_UIMAGE_SPLIT is not set -# CONFIG_MUTEX_SPIN_ON_OWNER is not set -# CONFIG_MV643XX_ETH is not set -# CONFIG_MVMDIO is not set -# CONFIG_MVSW6171_PHY is not set -# CONFIG_MVSW61XX_PHY is not set -# CONFIG_MVSWITCH_PHY is not set -# CONFIG_MWAVE is not set -# CONFIG_MWIFIEX is not set -# CONFIG_MWL8K is not set -# CONFIG_MYRI10GE is not set -# CONFIG_NAMESPACES is not set -# CONFIG_NATIONAL_PHY is not set -# CONFIG_NATSEMI is not set -# CONFIG_NAU7802 is not set -# CONFIG_NBPFAXI_DMA is not set -# CONFIG_NCP_FS is not set -# CONFIG_NE2000 is not set -# CONFIG_NE2K_PCI is not set -# CONFIG_NEC_MARKEINS is not set -CONFIG_NET=y -# CONFIG_NETCONSOLE is not set -CONFIG_NETDEVICES=y -CONFIG_NETDEV_1000=y -# CONFIG_NETDEV_10000 is not set -# CONFIG_NETFILTER is not set -# CONFIG_NETFILTER_ADVANCED is not set -# CONFIG_NETFILTER_DEBUG is not set -# CONFIG_NETFILTER_NETLINK is not set -# CONFIG_NETFILTER_NETLINK_ACCT is not set -# CONFIG_NETFILTER_NETLINK_LOG is not set -# CONFIG_NETFILTER_NETLINK_QUEUE is not set -# CONFIG_NETFILTER_NETLINK_QUEUE_CT is not set -# CONFIG_NETFILTER_TPROXY is not set -# CONFIG_NETFILTER_XTABLES is not set -# CONFIG_NETFILTER_XT_CONNMARK is not set -# CONFIG_NETFILTER_XT_MARK is not set -# 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 is not set -# CONFIG_NETFILTER_XT_MATCH_L2TP is not set -# CONFIG_NETFILTER_XT_MATCH_LAYER7 is not set -# CONFIG_NETFILTER_XT_MATCH_LAYER7_DEBUG 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 is not set -# CONFIG_NETFILTER_XT_MATCH_PHYSDEV is not set -# CONFIG_NETFILTER_XT_MATCH_PKTTYPE is not set -# CONFIG_NETFILTER_XT_MATCH_POLICY 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 is not set -# 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_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_CT 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_NOTRACK is not set -# CONFIG_NETFILTER_XT_TARGET_RATEEST is not set -# CONFIG_NETFILTER_XT_TARGET_REDIRECT is not set -# CONFIG_NETFILTER_XT_TARGET_TCPMSS is not set -# CONFIG_NETFILTER_XT_TARGET_TCPOPTSTRIP is not set -# CONFIG_NETFILTER_XT_TARGET_TEE is not set -# CONFIG_NETFILTER_XT_TARGET_TPROXY is not set -# CONFIG_NETFILTER_XT_TARGET_TRACE is not set -# CONFIG_NETLINK_DIAG is not set -# CONFIG_NETLINK_MMAP is not set -# CONFIG_NETPOLL is not set -# CONFIG_NETROM is not set -CONFIG_NETWORK_FILESYSTEMS=y -# CONFIG_NETWORK_PHY_TIMESTAMPING is not set -# CONFIG_NETWORK_SECMARK is not set -# CONFIG_NETXEN_NIC is not set -# CONFIG_NET_9P is not set -# CONFIG_NET_ACT_CSUM is not set -# CONFIG_NET_ACT_GACT is not set -# CONFIG_NET_ACT_IPT is not set -# CONFIG_NET_ACT_MIRRED is not set -# CONFIG_NET_ACT_NAT is not set -# CONFIG_NET_ACT_PEDIT is not set -# CONFIG_NET_ACT_POLICE is not set -# CONFIG_NET_ACT_SIMP is not set -# CONFIG_NET_ACT_SKBEDIT is not set -CONFIG_NET_CADENCE=y -# CONFIG_NET_CALXEDA_XGMAC is not set -CONFIG_NET_CLS=y -# CONFIG_NET_CLS_ACT is not set -# CONFIG_NET_CLS_BASIC is not set -# CONFIG_NET_CLS_BPF is not set -# CONFIG_NET_CLS_FLOW is not set -# CONFIG_NET_CLS_FW is not set -CONFIG_NET_CLS_IND=y -# CONFIG_NET_CLS_ROUTE4 is not set -# CONFIG_NET_CLS_RSVP is not set -# CONFIG_NET_CLS_RSVP6 is not set -# CONFIG_NET_CLS_TCINDEX is not set -# CONFIG_NET_CLS_U32 is not set -CONFIG_NET_CORE=y -# CONFIG_NET_DROP_MONITOR is not set -# CONFIG_NET_DSA is not set -# CONFIG_NET_DSA_BCM_SF2 is not set -# CONFIG_NET_DSA_MV88E6060 is not set -# CONFIG_NET_DSA_MV88E6123_61_65 is not set -# CONFIG_NET_DSA_MV88E6131 is not set -# CONFIG_NET_DSA_MV88E6171 is not set -# CONFIG_NET_DSA_MV88E6XXX is not set -# CONFIG_NET_DSA_MV88E6XXX_NEED_PPU is not set -# CONFIG_NET_DSA_TAG_DSA is not set -# CONFIG_NET_DSA_TAG_EDSA is not set -# CONFIG_NET_EMATCH is not set -# CONFIG_NET_EMATCH_CMP is not set -# CONFIG_NET_EMATCH_META is not set -# CONFIG_NET_EMATCH_NBYTE is not set -CONFIG_NET_EMATCH_STACK=32 -# CONFIG_NET_EMATCH_TEXT is not set -# CONFIG_NET_EMATCH_U32 is not set -CONFIG_NET_ETHERNET=y -# CONFIG_NET_FC is not set -# CONFIG_NET_FOU is not set -# CONFIG_NET_IPGRE is not set -CONFIG_NET_IPGRE_BROADCAST=y -# CONFIG_NET_IPGRE_DEMUX is not set -# CONFIG_NET_IPIP is not set -# CONFIG_NET_IPVTI is not set -# CONFIG_NET_IP_TUNNEL is not set -# CONFIG_NET_ISA is not set -# CONFIG_NET_KEY is not set -# CONFIG_NET_KEY_MIGRATE is not set -# CONFIG_NET_MPLS_GSO is not set -# CONFIG_NET_PACKET_ENGINE is not set -CONFIG_NET_PCI=y -# CONFIG_NET_PCMCIA is not set -# CONFIG_NET_PKTGEN is not set -# CONFIG_NET_POCKET is not set -# CONFIG_NET_POLL_CONTROLLER is not set -# CONFIG_NET_PTP_CLASSIFY is not set -CONFIG_NET_RX_BUSY_POLL=y -# CONFIG_NET_SB1000 is not set -CONFIG_NET_SCHED=y -# CONFIG_NET_SCH_ATM is not set -# CONFIG_NET_SCH_CBQ is not set -# CONFIG_NET_SCH_CHOKE is not set -# CONFIG_NET_SCH_CODEL is not set -# CONFIG_NET_SCH_DRR is not set -# CONFIG_NET_SCH_DSMARK is not set -CONFIG_NET_SCH_FIFO=y -# CONFIG_NET_SCH_FQ is not set -CONFIG_NET_SCH_FQ_CODEL=y -# CONFIG_NET_SCH_GRED is not set -# CONFIG_NET_SCH_HFSC is not set -# CONFIG_NET_SCH_HHF is not set -# CONFIG_NET_SCH_HTB is not set -# CONFIG_NET_SCH_INGRESS is not set -# CONFIG_NET_SCH_MQPRIO is not set -# CONFIG_NET_SCH_MULTIQ is not set -# CONFIG_NET_SCH_NETEM is not set -# CONFIG_NET_SCH_PIE is not set -# CONFIG_NET_SCH_PLUG is not set -# CONFIG_NET_SCH_PRIO is not set -# CONFIG_NET_SCH_QFQ is not set -# CONFIG_NET_SCH_RED is not set -# CONFIG_NET_SCH_SFB is not set -# CONFIG_NET_SCH_SFQ is not set -# CONFIG_NET_SCH_TBF is not set -# CONFIG_NET_SCH_TEQL is not set -# CONFIG_NET_SCTPPROBE is not set -# CONFIG_NET_TCPPROBE is not set -# CONFIG_NET_TEAM is not set -# CONFIG_NET_TULIP is not set -# CONFIG_NET_UDP_TUNNEL is not set -CONFIG_NET_VENDOR_3COM=y -CONFIG_NET_VENDOR_8390=y -CONFIG_NET_VENDOR_ADAPTEC=y -CONFIG_NET_VENDOR_AGERE=y -CONFIG_NET_VENDOR_ALTEON=y -CONFIG_NET_VENDOR_AMD=y -CONFIG_NET_VENDOR_ARC=y -CONFIG_NET_VENDOR_ATHEROS=y -CONFIG_NET_VENDOR_BROADCOM=y -CONFIG_NET_VENDOR_BROCADE=y -CONFIG_NET_VENDOR_CHELSIO=y -CONFIG_NET_VENDOR_CIRRUS=y -CONFIG_NET_VENDOR_CISCO=y -CONFIG_NET_VENDOR_DEC=y -CONFIG_NET_VENDOR_DLINK=y -CONFIG_NET_VENDOR_EMULEX=y -CONFIG_NET_VENDOR_EXAR=y -CONFIG_NET_VENDOR_FARADAY=y -CONFIG_NET_VENDOR_FREESCALE=y -CONFIG_NET_VENDOR_FUJITSU=y -CONFIG_NET_VENDOR_HISILICON=y -CONFIG_NET_VENDOR_HP=y -CONFIG_NET_VENDOR_I825XX=y -CONFIG_NET_VENDOR_IBM=y -CONFIG_NET_VENDOR_INTEL=y -CONFIG_NET_VENDOR_MARVELL=y -CONFIG_NET_VENDOR_MELLANOX=y -CONFIG_NET_VENDOR_MICREL=y -CONFIG_NET_VENDOR_MICROCHIP=y -CONFIG_NET_VENDOR_MYRI=y -CONFIG_NET_VENDOR_NATSEMI=y -CONFIG_NET_VENDOR_NVIDIA=y -CONFIG_NET_VENDOR_OKI=y -CONFIG_NET_VENDOR_QLOGIC=y -CONFIG_NET_VENDOR_QUALCOMM=y -CONFIG_NET_VENDOR_RDC=y -CONFIG_NET_VENDOR_REALTEK=y -CONFIG_NET_VENDOR_SAMSUNG=y -CONFIG_NET_VENDOR_SEEQ=y -CONFIG_NET_VENDOR_SILAN=y -CONFIG_NET_VENDOR_SILICOM=y -CONFIG_NET_VENDOR_SIS=y -CONFIG_NET_VENDOR_SMSC=y -CONFIG_NET_VENDOR_STMICRO=y -CONFIG_NET_VENDOR_SUN=y -CONFIG_NET_VENDOR_TEHUTI=y -CONFIG_NET_VENDOR_TI=y -CONFIG_NET_VENDOR_TOSHIBA=y -CONFIG_NET_VENDOR_VIA=y -# CONFIG_NET_VENDOR_WIZNET is not set -CONFIG_NET_VENDOR_XILINX=y -CONFIG_NET_VENDOR_XIRCOM=y -# CONFIG_NET_XGENE is not set -CONFIG_NEW_LEDS=y -# CONFIG_NFC is not set -# CONFIG_NFC_DEVICES is not set -# CONFIG_NFSD is not set -# CONFIG_NFSD_DEPRECATED is not set -# CONFIG_NFSD_V2_ACL is not set -CONFIG_NFSD_V3=y -# CONFIG_NFSD_V3_ACL is not set -# CONFIG_NFSD_V4 is not set -# CONFIG_NFS_ACL_SUPPORT is not set -CONFIG_NFS_COMMON=y -# CONFIG_NFS_FS is not set -# CONFIG_NFS_FSCACHE is not set -# CONFIG_NFS_SWAP is not set -# CONFIG_NFS_V2 is not set -CONFIG_NFS_V3=y -# CONFIG_NFS_V3_ACL is not set -# CONFIG_NFS_V4 is not set -# CONFIG_NFS_V4_1 is not set -# CONFIG_NFTL is not set -# CONFIG_NF_CONNTRACK is not set -# CONFIG_NF_CONNTRACK_AMANDA is not set -# CONFIG_NF_CONNTRACK_EVENTS is not set -# CONFIG_NF_CONNTRACK_FTP is not set -# CONFIG_NF_CONNTRACK_H323 is not set -# CONFIG_NF_CONNTRACK_IPV4 is not set -# CONFIG_NF_CONNTRACK_IPV6 is not set -# CONFIG_NF_CONNTRACK_IRC is not set -# CONFIG_NF_CONNTRACK_MARK is not set -# CONFIG_NF_CONNTRACK_NETBIOS_NS is not set -# CONFIG_NF_CONNTRACK_PPTP is not set -CONFIG_NF_CONNTRACK_PROCFS=y -# CONFIG_NF_CONNTRACK_PROC_COMPAT is not set -# CONFIG_NF_CONNTRACK_RTSP is not set -# CONFIG_NF_CONNTRACK_SANE is not set -# CONFIG_NF_CONNTRACK_SIP is not set -# CONFIG_NF_CONNTRACK_SNMP is not set -# CONFIG_NF_CONNTRACK_TFTP is not set -# CONFIG_NF_CONNTRACK_TIMEOUT is not set -# CONFIG_NF_CONNTRACK_TIMESTAMP is not set -# CONFIG_NF_CONNTRACK_ZONES is not set -# CONFIG_NF_CT_NETLINK is not set -# CONFIG_NF_CT_NETLINK_TIMEOUT is not set -# CONFIG_NF_CT_PROTO_DCCP is not set -# CONFIG_NF_CT_PROTO_GRE is not set -# CONFIG_NF_CT_PROTO_SCTP is not set -# CONFIG_NF_CT_PROTO_UDPLITE is not set -# CONFIG_NF_DEFRAG_IPV4 is not set -# CONFIG_NF_LOG_ARP is not set -# CONFIG_NF_LOG_IPV4 is not set -# CONFIG_NF_NAT is not set -# CONFIG_NF_NAT_AMANDA is not set -# CONFIG_NF_NAT_FTP is not set -# CONFIG_NF_NAT_H323 is not set -# CONFIG_NF_NAT_IPV6 is not set -# CONFIG_NF_NAT_IRC is not set -# CONFIG_NF_NAT_MASQUERADE_IPV4 is not set -# CONFIG_NF_NAT_MASQUERADE_IPV6 is not set -# CONFIG_NF_NAT_NEEDED is not set -# CONFIG_NF_NAT_PPTP is not set -# CONFIG_NF_NAT_PROTO_GRE is not set -# CONFIG_NF_NAT_RTSP is not set -# CONFIG_NF_NAT_SIP is not set -# CONFIG_NF_NAT_SNMP_BASIC is not set -# CONFIG_NF_NAT_TFTP is not set -# CONFIG_NF_REJECT_IPV4 is not set -# CONFIG_NF_REJECT_IPV6 is not set -# CONFIG_NF_TABLES is not set -# CONFIG_NI52 is not set -# CONFIG_NI65 is not set -# CONFIG_NILFS2_FS is not set -# CONFIG_NIU is not set -# CONFIG_NL80211_TESTMODE is not set -CONFIG_NLATTR=y -# CONFIG_NLMON is not set -# CONFIG_NLM_XLP_BOARD is not set -# CONFIG_NLM_XLR_BOARD is not set -# CONFIG_NLS is not set -# CONFIG_NLS_ASCII is not set -# CONFIG_NLS_CODEPAGE_1250 is not set -# CONFIG_NLS_CODEPAGE_1251 is not set -# CONFIG_NLS_CODEPAGE_437 is not set -# 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_874 is not set -# CONFIG_NLS_CODEPAGE_932 is not set -# CONFIG_NLS_CODEPAGE_936 is not set -# CONFIG_NLS_CODEPAGE_949 is not set -# CONFIG_NLS_CODEPAGE_950 is not set -CONFIG_NLS_DEFAULT="iso8859-1" -# CONFIG_NLS_ISO8859_1 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_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_8 is not set -# CONFIG_NLS_ISO8859_9 is not set -# CONFIG_NLS_KOI8_R is not set -# CONFIG_NLS_KOI8_U 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_ROMAN is not set -# CONFIG_NLS_MAC_ROMANIAN is not set -# CONFIG_NLS_MAC_TURKISH is not set -# CONFIG_NLS_UTF8 is not set -# CONFIG_NOP_USB_XCEIV is not set -# CONFIG_NORTEL_HERMES is not set -# CONFIG_NOTIFIER_ERROR_INJECTION is not set -# CONFIG_NOZOMI is not set -# CONFIG_NO_BOOTMEM is not set -# CONFIG_NO_HZ is not set -# CONFIG_NO_HZ_FULL is not set -# CONFIG_NO_HZ_IDLE is not set -# CONFIG_NO_IOPORT is not set -# CONFIG_NS83820 is not set -# CONFIG_NTFS_DEBUG is not set -# CONFIG_NTFS_FS is not set -# CONFIG_NTFS_RW is not set -# CONFIG_NTP_PPS is not set -# CONFIG_NVRAM is not set -# CONFIG_NV_TCO is not set -# CONFIG_NXP_STB220 is not set -# CONFIG_NXP_STB225 is not set -# CONFIG_N_GSM is not set -# CONFIG_OABI_COMPAT is not set -# CONFIG_OBS600 is not set -# CONFIG_OCFS2_FS is not set -# CONFIG_OC_ETM is not set -# CONFIG_OF_SELFTEST is not set -# CONFIG_OMAP2_DSS_DEBUG is not set -# CONFIG_OMAP2_DSS_DEBUGFS is not set -# CONFIG_OMAP2_DSS_SDI is not set -# CONFIG_OMAP_CONTROL_USB is not set -# CONFIG_OMAP_OCP2SCP is not set -# CONFIG_OMAP_USB2 is not set -# CONFIG_OMAP_USB3 is not set -# CONFIG_OMFS_FS is not set -# CONFIG_OPENVSWITCH is not set -# CONFIG_OPROFILE is not set -# CONFIG_OPROFILE_EVENT_MULTIPLEX is not set -# CONFIG_ORION_WATCHDOG is not set -# CONFIG_OSF_PARTITION is not set -CONFIG_OVERLAY_FS=y -# CONFIG_P54_COMMON is not set -CONFIG_PACKET=y -# CONFIG_PACKET_DIAG is not set -# CONFIG_PAGE_POISONING is not set -# CONFIG_PAGE_SIZE_16KB is not set -# CONFIG_PAGE_SIZE_32KB is not set -CONFIG_PAGE_SIZE_4KB=y -# CONFIG_PAGE_SIZE_64KB is not set -# CONFIG_PAGE_SIZE_8KB is not set -# CONFIG_PANEL is not set -CONFIG_PANIC_ON_OOPS=y -CONFIG_PANIC_ON_OOPS_VALUE=1 -CONFIG_PANIC_TIMEOUT=1 -# CONFIG_PANTHERLORD_FF is not set -# CONFIG_PARPORT is not set -# CONFIG_PARPORT_1284 is not set -# CONFIG_PARPORT_AX88796 is not set -# CONFIG_PARPORT_PC is not set -CONFIG_PARTITION_ADVANCED=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_CMD640_PCI is not set -# CONFIG_PATA_CMD64X is not set -# CONFIG_PATA_CS5520 is not set -# CONFIG_PATA_CS5530 is not set -# CONFIG_PATA_CS5535 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 -# CONFIG_PATA_HPT37X is not set -# CONFIG_PATA_HPT3X2N is not set -# CONFIG_PATA_HPT3X3 is not set -# CONFIG_PATA_ISAPNP is not set -# CONFIG_PATA_IT8213 is not set -# CONFIG_PATA_IT821X is not set -# CONFIG_PATA_JMICRON is not set -# CONFIG_PATA_LEGACY is not set -# CONFIG_PATA_MARVELL is not set -# CONFIG_PATA_MPIIX is not set -# CONFIG_PATA_NETCELL is not set -# CONFIG_PATA_NINJA32 is not set -# CONFIG_PATA_NS87410 is not set -# CONFIG_PATA_NS87415 is not set -# CONFIG_PATA_OCTEON_CF is not set -# CONFIG_PATA_OF_PLATFORM is not set -# CONFIG_PATA_OLDPIIX is not set -# CONFIG_PATA_OPTI is not set -# CONFIG_PATA_OPTIDMA is not set -# CONFIG_PATA_PCMCIA is not set -# CONFIG_PATA_PDC2027X is not set -# CONFIG_PATA_PDC_OLD is not set -# CONFIG_PATA_PLATFORM is not set -# CONFIG_PATA_QDI is not set -# CONFIG_PATA_RADISYS is not set -# CONFIG_PATA_RDC is not set -# CONFIG_PATA_RZ1000 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 -# 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 -# CONFIG_PATA_WINBOND_VLB is not set -# CONFIG_PC300TOO is not set -# CONFIG_PCCARD is not set -# CONFIG_PCH_GBE is not set -# CONFIG_PCH_PHUB is not set -# CONFIG_PCI200SYN is not set -# CONFIG_PCIEAER_INJECT is not set -# CONFIG_PCIEASPM is not set -# CONFIG_PCIEPORTBUS is not set -# CONFIG_PCIE_ECRC is not set -# CONFIG_PCIPCWATCHDOG is not set -# CONFIG_PCI_ATMEL is not set -# CONFIG_PCI_CNB20LE_QUIRK is not set -# CONFIG_PCI_DEBUG is not set -# CONFIG_PCI_DISABLE_COMMON_QUIRKS is not set -# CONFIG_PCI_HERMES is not set -# CONFIG_PCI_HOST_GENERIC is not set -# CONFIG_PCI_IOV is not set -# CONFIG_PCI_MSI is not set -# CONFIG_PCI_PASID is not set -# CONFIG_PCI_PRI is not set -CONFIG_PCI_QUIRKS=y -# CONFIG_PCI_REALLOC_ENABLE_AUTO is not set -# CONFIG_PCI_STUB is not set -CONFIG_PCI_SYSCALL=y -# CONFIG_PCMCIA is not set -# CONFIG_PCMCIA_3C574 is not set -# CONFIG_PCMCIA_3C589 is not set -# CONFIG_PCMCIA_AHA152X is not set -# CONFIG_PCMCIA_ATMEL is not set -# CONFIG_PCMCIA_AXNET is not set -# CONFIG_PCMCIA_DEBUG is not set -# CONFIG_PCMCIA_FDOMAIN is not set -# CONFIG_PCMCIA_FMVJ18X is not set -# CONFIG_PCMCIA_HERMES is not set -# CONFIG_PCMCIA_LOAD_CIS is not set -# CONFIG_PCMCIA_NINJA_SCSI is not set -# CONFIG_PCMCIA_NMCLAN is not set -# CONFIG_PCMCIA_PCNET is not set -# CONFIG_PCMCIA_QLOGIC is not set -# CONFIG_PCMCIA_RAYCS is not set -# CONFIG_PCMCIA_SMC91C92 is not set -# CONFIG_PCMCIA_SPECTRUM is not set -# CONFIG_PCMCIA_SYM53C500 is not set -# CONFIG_PCMCIA_WL3501 is not set -# CONFIG_PCMCIA_XIRC2PS is not set -# CONFIG_PCMCIA_XIRCOM is not set -# CONFIG_PCNET32 is not set -# CONFIG_PCSPKR_PLATFORM is not set -# CONFIG_PD6729 is not set -# CONFIG_PDA_POWER is not set -# CONFIG_PDC_ADMA is not set -# CONFIG_PERCPU_TEST is not set -# CONFIG_PERF_COUNTERS is not set -# CONFIG_PERF_EVENTS is not set -# CONFIG_PERSISTENT_KEYRINGS is not set -# CONFIG_PHANTOM is not set -# CONFIG_PHONE is not set -# CONFIG_PHONET is not set -# CONFIG_PHYLIB is not set -# CONFIG_PHYS_ADDR_T_64BIT is not set -# CONFIG_PHY_EXYNOS_DP_VIDEO is not set -# CONFIG_PHY_EXYNOS_MIPI_VIDEO is not set -# CONFIG_PHY_QCOM_DWC3 is not set -# CONFIG_PHY_SAMSUNG_USB2 is not set -# CONFIG_PID_IN_CONTEXTIDR is not set -# CONFIG_PID_NS is not set -CONFIG_PINCONF=y -# CONFIG_PINCTRL is not set -# CONFIG_PINCTRL_CAPRI is not set -# CONFIG_PINCTRL_EXYNOS is not set -# CONFIG_PINCTRL_EXYNOS5440 is not set -# CONFIG_PINCTRL_MSM8X74 is not set -CONFIG_PINCTRL_SINGLE=y -CONFIG_PINMUX=y -# CONFIG_PLAT_SPEAR is not set -# CONFIG_PLIP is not set -# CONFIG_PLX_HERMES is not set -# CONFIG_PM is not set -# CONFIG_PMBUS is not set -# CONFIG_PMC_MSP is not set -# CONFIG_PMC_YOSEMITE is not set -# CONFIG_PMIC_ADP5520 is not set -# CONFIG_PMIC_DA903X is not set -# CONFIG_PM_AUTOSLEEP is not set -# CONFIG_PM_DEVFREQ is not set -# CONFIG_PM_RUNTIME is not set -# CONFIG_PM_WAKELOCKS is not set -# CONFIG_PNX8550_JBS is not set -# CONFIG_PNX8550_STB810 is not set -# CONFIG_POHMELFS is not set -# CONFIG_POSIX_MQUEUE is not set -# CONFIG_POWERCAP is not set -# CONFIG_POWERTV is not set -# CONFIG_POWER_AVS is not set -# CONFIG_POWER_RESET is not set -# CONFIG_POWER_RESET_RESTART is not set -# CONFIG_POWER_RESET_VERSATILE is not set -# CONFIG_POWER_SUPPLY is not set -# CONFIG_POWER_SUPPLY_DEBUG is not set -# CONFIG_PPC4xx_GPIO is not set -# CONFIG_PPC_16K_PAGES is not set -# CONFIG_PPC_256K_PAGES is not set -CONFIG_PPC_4K_PAGES=y -# CONFIG_PPC_64K_PAGES is not set -# CONFIG_PPC_DISABLE_WERROR is not set -# CONFIG_PPC_EMULATED_STATS is not set -# CONFIG_PPC_EPAPR_HV_BYTECHAN is not set -# CONFIG_PPP is not set -# CONFIG_PPPOATM is not set -# CONFIG_PPPOE is not set -# CONFIG_PPPOL2TP is not set -# CONFIG_PPP_ASYNC is not set -# CONFIG_PPP_BSDCOMP is not set -# CONFIG_PPP_DEFLATE is not set -CONFIG_PPP_FILTER=y -# CONFIG_PPP_MPPE is not set -CONFIG_PPP_MULTILINK=y -# CONFIG_PPP_SYNC_TTY is not set -# CONFIG_PPS is not set -# CONFIG_PPS_CLIENT_GPIO is not set -# CONFIG_PPS_CLIENT_KTIMER is not set -# CONFIG_PPS_CLIENT_LDISC is not set -# CONFIG_PPS_CLIENT_PARPORT is not set -# CONFIG_PPS_DEBUG is not set -# CONFIG_PPTP is not set -# CONFIG_PREEMPT is not set -CONFIG_PREEMPT_NONE=y -# CONFIG_PREEMPT_TRACER is not set -# CONFIG_PREEMPT_VOLUNTARY is not set -CONFIG_PREVENT_FIRMWARE_BUILD=y -CONFIG_PRINTK=y -# CONFIG_PRINTK_TIME is not set -CONFIG_PRINT_STACK_DEPTH=64 -# CONFIG_PRISM2_USB is not set -# CONFIG_PRISM54 is not set -# CONFIG_PROBE_INITRD_HEADER is not set -CONFIG_PROC_FS=y -# CONFIG_PROC_KCORE is not set -# CONFIG_PROC_PAGE_MONITOR is not set -CONFIG_PROC_STRIPPED=y -CONFIG_PROC_SYSCTL=y -# CONFIG_PROFILE_ALL_BRANCHES is not set -# CONFIG_PROFILE_ANNOTATED_BRANCHES is not set -# CONFIG_PROFILING is not set -# CONFIG_PROVE_LOCKING is not set -# CONFIG_PROVE_RCU is not set -# CONFIG_PROVE_RCU_DELAY is not set -# CONFIG_PSB6970_PHY is not set -# CONFIG_PSTORE is not set -# CONFIG_PTP_1588_CLOCK is not set -# CONFIG_PTP_1588_CLOCK_IXP46X is not set -# CONFIG_PTP_1588_CLOCK_PCH is not set -# CONFIG_PWM is not set -# CONFIG_PWM_PCA9685 is not set -# CONFIG_QCA7000 is not set -# CONFIG_QLA3XXX is not set -# CONFIG_QLCNIC is not set -# CONFIG_QLGE is not set -# CONFIG_QNX4FS_FS is not set -# CONFIG_QNX6FS_FS is not set -# CONFIG_QSEMI_PHY is not set -# CONFIG_QUOTA is not set -# CONFIG_QUOTACTL is not set -# CONFIG_QUOTA_DEBUG is not set -# CONFIG_R3964 is not set -# CONFIG_R6040 is not set -# CONFIG_R8169 is not set -# CONFIG_R8187SE is not set -# CONFIG_R8188EU is not set -# CONFIG_R8712U is not set -# CONFIG_R8723AU is not set -# CONFIG_RADIO_ADAPTERS is not set -# CONFIG_RADIO_AZTECH is not set -# CONFIG_RADIO_CADET is not set -# CONFIG_RADIO_GEMTEK is not set -# CONFIG_RADIO_MAXIRADIO is not set -# CONFIG_RADIO_RTRACK is not set -# CONFIG_RADIO_RTRACK2 is not set -# CONFIG_RADIO_SF16FMI is not set -# CONFIG_RADIO_SF16FMR2 is not set -# CONFIG_RADIO_TERRATEC is not set -# CONFIG_RADIO_TRUST is not set -# CONFIG_RADIO_TYPHOON is not set -# CONFIG_RADIO_ZOLTRIX is not set -# CONFIG_RAID_ATTRS is not set -# CONFIG_RALINK is not set -# CONFIG_RAMOOPS is not set -# CONFIG_RANDOM32_SELFTEST is not set -# CONFIG_RAPIDIO is not set -# CONFIG_RAR_REGISTER is not set -# CONFIG_RAW_DRIVER is not set -# CONFIG_RBTREE_TEST is not set -# CONFIG_RCU_CPU_STALL_INFO is not set -CONFIG_RCU_CPU_STALL_TIMEOUT=60 -CONFIG_RCU_FANOUT=32 -# CONFIG_RCU_FANOUT_EXACT is not set -CONFIG_RCU_FANOUT_LEAF=16 -# CONFIG_RCU_FAST_NO_HZ is not set -# CONFIG_RCU_NOCB_CPU is not set -# CONFIG_RCU_TORTURE_TEST is not set -# CONFIG_RCU_TRACE is not set -# CONFIG_RCU_USER_QS is not set -# CONFIG_RC_ATI_REMOTE is not set -# CONFIG_RC_CORE is not set -# CONFIG_RC_DECODERS is not set -# CONFIG_RC_LOOPBACK is not set -# CONFIG_RC_MAP is not set -# CONFIG_RDS is not set -# CONFIG_RD_BZIP2 is not set -# CONFIG_RD_GZIP is not set -# CONFIG_RD_LZ4 is not set -# CONFIG_RD_LZMA is not set -# CONFIG_RD_LZO is not set -# CONFIG_RD_XZ is not set -# CONFIG_READABLE_ASM is not set -# CONFIG_REALTEK_PHY is not set -# CONFIG_REDWOOD is not set -# CONFIG_REGMAP is not set -# CONFIG_REGMAP_I2C is not set -# CONFIG_REGMAP_MMIO is not set -# CONFIG_REGMAP_SPI is not set -# CONFIG_REGULATOR is not set -# CONFIG_REGULATOR_ACT8865 is not set -# CONFIG_REGULATOR_AD5398 is not set -# CONFIG_REGULATOR_ANATOP is not set -# CONFIG_REGULATOR_BQ24022 is not set -# CONFIG_REGULATOR_DA9210 is not set -# CONFIG_REGULATOR_DA9211 is not set -# CONFIG_REGULATOR_FAN53555 is not set -# CONFIG_REGULATOR_FIXED_VOLTAGE is not set -# CONFIG_REGULATOR_GPIO is not set -# CONFIG_REGULATOR_ISL6271A is not set -# CONFIG_REGULATOR_ISL9305 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_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_TI_ABB 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_VIRTUAL_CONSUMER is not set -# CONFIG_REISERFS_CHECK is not set -# CONFIG_REISERFS_FS is not set -# CONFIG_REISERFS_FS_POSIX_ACL is not set -# CONFIG_REISERFS_FS_SECURITY is not set -# CONFIG_REISERFS_FS_XATTR is not set -# CONFIG_REISERFS_PROC_INFO is not set -# CONFIG_RELAY is not set -# CONFIG_RESET_CONTROLLER is not set -# CONFIG_RFD_FTL is not set -# CONFIG_RFKILL is not set -# CONFIG_RFKILL_INPUT is not set -# CONFIG_RFKILL_REGULATOR is not set -# CONFIG_RING_BUFFER_BENCHMARK is not set -# CONFIG_RING_BUFFER_STARTUP_TEST is not set -# CONFIG_ROMFS_FS is not set -# CONFIG_ROSE is not set -# CONFIG_RPCSEC_GSS_KRB5 is not set -# CONFIG_RT2X00 is not set -# CONFIG_RTC_CLASS is not set -# CONFIG_RTC_DEBUG is not set -# CONFIG_RTC_DRV_AU1XXX is not set -# CONFIG_RTC_DRV_BQ32K is not set -# CONFIG_RTC_DRV_BQ4802 is not set -CONFIG_RTC_DRV_CMOS=y -# CONFIG_RTC_DRV_DS1286 is not set -# CONFIG_RTC_DRV_DS1305 is not set -# CONFIG_RTC_DRV_DS1307 is not set -# CONFIG_RTC_DRV_DS1343 is not set -# CONFIG_RTC_DRV_DS1347 is not set -# CONFIG_RTC_DRV_DS1374 is not set -# CONFIG_RTC_DRV_DS1390 is not set -# CONFIG_RTC_DRV_DS1511 is not set -# CONFIG_RTC_DRV_DS1553 is not set -# CONFIG_RTC_DRV_DS1672 is not set -# CONFIG_RTC_DRV_DS1742 is not set -# CONFIG_RTC_DRV_DS2404 is not set -# CONFIG_RTC_DRV_DS3232 is not set -# CONFIG_RTC_DRV_DS3234 is not set -# CONFIG_RTC_DRV_EM3027 is not set -# CONFIG_RTC_DRV_EP93XX is not set -# CONFIG_RTC_DRV_FM3130 is not set -# CONFIG_RTC_DRV_GENERIC is not set -# CONFIG_RTC_DRV_HID_SENSOR_TIME is not set -# CONFIG_RTC_DRV_HYM8563 is not set -# CONFIG_RTC_DRV_ISL12022 is not set -# CONFIG_RTC_DRV_ISL12057 is not set -# CONFIG_RTC_DRV_ISL1208 is not set -# CONFIG_RTC_DRV_M41T80 is not set -# CONFIG_RTC_DRV_M41T93 is not set -# CONFIG_RTC_DRV_M41T94 is not set -# CONFIG_RTC_DRV_M48T35 is not set -# CONFIG_RTC_DRV_M48T59 is not set -# CONFIG_RTC_DRV_M48T86 is not set -# CONFIG_RTC_DRV_MAX6900 is not set -# CONFIG_RTC_DRV_MAX6902 is not set -# CONFIG_RTC_DRV_MCP795 is not set -# CONFIG_RTC_DRV_MOXART is not set -# CONFIG_RTC_DRV_MPC5121 is not set -# CONFIG_RTC_DRV_MSM6242 is not set -# CONFIG_RTC_DRV_OMAP is not set -# CONFIG_RTC_DRV_PCF2123 is not set -# CONFIG_RTC_DRV_PCF2127 is not set -# CONFIG_RTC_DRV_PCF85063 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_PL030 is not set -# CONFIG_RTC_DRV_PL031 is not set -# CONFIG_RTC_DRV_PS3 is not set -# CONFIG_RTC_DRV_PT7C4338 is not set -# CONFIG_RTC_DRV_R9701 is not set -# CONFIG_RTC_DRV_RP5C01 is not set -# CONFIG_RTC_DRV_RS5C348 is not set -# CONFIG_RTC_DRV_RS5C372 is not set -# CONFIG_RTC_DRV_RTC7301 is not set -# CONFIG_RTC_DRV_RV3029C2 is not set -# CONFIG_RTC_DRV_RX4581 is not set -# CONFIG_RTC_DRV_RX8025 is not set -# CONFIG_RTC_DRV_RX8581 is not set -# CONFIG_RTC_DRV_S35390A is not set -# CONFIG_RTC_DRV_SNVS is not set -# CONFIG_RTC_DRV_STK17TA8 is not set -# CONFIG_RTC_DRV_SUN6I is not set -# CONFIG_RTC_DRV_TEST is not set -# CONFIG_RTC_DRV_V3020 is not set -# CONFIG_RTC_DRV_X1205 is not set -# CONFIG_RTC_DRV_XGENE is not set -CONFIG_RTC_HCTOSYS=y -CONFIG_RTC_HCTOSYS_DEVICE="rtc0" -CONFIG_RTC_INTF_DEV=y -# CONFIG_RTC_INTF_DEV_UIE_EMUL is not set -CONFIG_RTC_INTF_PROC=y -CONFIG_RTC_INTF_SYSFS=y -CONFIG_RTC_LIB=y -CONFIG_RTC_SYSTOHC=y -# CONFIG_RTL8180 is not set -# CONFIG_RTL8187 is not set -# CONFIG_RTL8192E is not set -# CONFIG_RTL8192U is not set -# CONFIG_RTL8306_PHY is not set -# CONFIG_RTL8366RB_PHY is not set -# CONFIG_RTL8366S_PHY is not set -# CONFIG_RTL8366_SMI is not set -# CONFIG_RTL8366_SMI_DEBUG_FS is not set -# CONFIG_RTL8367B_PHY is not set -# CONFIG_RTL8367_PHY is not set -# CONFIG_RTLLIB is not set -# CONFIG_RTL_CARDS is not set -# CONFIG_RTS5139 is not set -# CONFIG_RTS5208 is not set -# CONFIG_RTS_PSTOR is not set -CONFIG_RT_MUTEXES=y -# CONFIG_RT_MUTEX_TESTER is not set -# CONFIG_RUNTIME_DEBUG is not set -CONFIG_RWSEM_GENERIC_SPINLOCK=y -# CONFIG_S2IO is not set -# CONFIG_SAMPLES is not set -# CONFIG_SAMSUNG_LAPTOP is not set -# CONFIG_SAMSUNG_USB2PHY is not set -# CONFIG_SAMSUNG_USB3PHY is not set -# CONFIG_SATA_ACARD_AHCI is not set -# CONFIG_SATA_AHCI is not set -# CONFIG_SATA_AHCI_PLATFORM is not set -# CONFIG_SATA_DWC is not set -# CONFIG_SATA_FSL is not set -# CONFIG_SATA_HIGHBANK is not set -# CONFIG_SATA_INIC162X is not set -# CONFIG_SATA_MV is not set -# CONFIG_SATA_NV is not set -# CONFIG_SATA_PMP is not set -# CONFIG_SATA_PROMISE is not set -# CONFIG_SATA_QSTOR is not set -# CONFIG_SATA_RCAR is not set -# CONFIG_SATA_SIL is not set -# CONFIG_SATA_SIL24 is not set -# CONFIG_SATA_SIS is not set -# CONFIG_SATA_SVW is not set -# CONFIG_SATA_SX4 is not set -# CONFIG_SATA_ULI is not set -# CONFIG_SATA_VIA is not set -# CONFIG_SATA_VITESSE is not set -# CONFIG_SBC_FITPC2_WATCHDOG is not set -# CONFIG_SBE_2T3E3 is not set -# CONFIG_SBYPASS is not set -# CONFIG_SC92031 is not set -# CONFIG_SCA3000 is not set -# CONFIG_SCC is not set -# CONFIG_SCHEDSTATS is not set -# CONFIG_SCHED_AUTOGROUP is not set -# CONFIG_SCHED_DEBUG is not set -# CONFIG_SCHED_MC is not set -CONFIG_SCHED_OMIT_FRAME_POINTER=y -# CONFIG_SCHED_SMT is not set -# CONFIG_SCHED_STACK_END_CHECK is not set -# CONFIG_SCHED_TRACER is not set -# CONFIG_SCSI is not set -# CONFIG_SCSI_3W_9XXX is not set -# CONFIG_SCSI_3W_SAS is not set -# CONFIG_SCSI_7000FASST is not set -# CONFIG_SCSI_AACRAID is not set -# CONFIG_SCSI_ACARD is not set -# CONFIG_SCSI_ADVANSYS is not set -# CONFIG_SCSI_AHA152X is not set -# CONFIG_SCSI_AHA1542 is not set -# CONFIG_SCSI_AIC79XX is not set -# CONFIG_SCSI_AIC7XXX is not set -# CONFIG_SCSI_AIC7XXX_OLD is not set -# CONFIG_SCSI_AIC94XX is not set -# CONFIG_SCSI_ARCMSR is not set -# CONFIG_SCSI_BFA_FC is not set -# CONFIG_SCSI_BNX2X_FCOE is not set -# CONFIG_SCSI_BNX2_ISCSI is not set -# CONFIG_SCSI_BUSLOGIC is not set -# CONFIG_SCSI_CHELSIO_FCOE is not set -# CONFIG_SCSI_CONSTANTS is not set -# CONFIG_SCSI_CXGB3_ISCSI is not set -# CONFIG_SCSI_CXGB4_ISCSI is not set -# CONFIG_SCSI_DC390T is not set -# CONFIG_SCSI_DC395x is not set -# CONFIG_SCSI_DEBUG is not set -# CONFIG_SCSI_DH is not set -CONFIG_SCSI_DMA=y -# CONFIG_SCSI_DMX3191D is not set -# CONFIG_SCSI_DPT_I2O is not set -# CONFIG_SCSI_DTC3280 is not set -# CONFIG_SCSI_EATA is not set -# CONFIG_SCSI_ESAS2R is not set -# CONFIG_SCSI_FC_ATTRS is not set -# CONFIG_SCSI_FUTURE_DOMAIN is not set -# CONFIG_SCSI_GDTH is not set -# CONFIG_SCSI_GENERIC_NCR5380 is not set -# CONFIG_SCSI_GENERIC_NCR5380_MMIO is not set -# CONFIG_SCSI_HPSA is not set -# CONFIG_SCSI_HPTIOP is not set -# CONFIG_SCSI_IN2000 is not set -# CONFIG_SCSI_INIA100 is not set -# CONFIG_SCSI_INITIO is not set -# CONFIG_SCSI_IPR is not set -# CONFIG_SCSI_IPS is not set -# CONFIG_SCSI_ISCI is not set -# CONFIG_SCSI_ISCSI_ATTRS is not set -# CONFIG_SCSI_LOGGING is not set -CONFIG_SCSI_LOWLEVEL=y -# CONFIG_SCSI_LOWLEVEL_PCMCIA is not set -# CONFIG_SCSI_LPFC is not set -CONFIG_SCSI_MOD=y -# CONFIG_SCSI_MPT2SAS is not set -# CONFIG_SCSI_MPT3SAS is not set -# CONFIG_SCSI_MQ_DEFAULT is not set -CONFIG_SCSI_MULTI_LUN=y -# CONFIG_SCSI_MVSAS is not set -# CONFIG_SCSI_MVSAS_DEBUG is not set -# CONFIG_SCSI_MVUMI is not set -# CONFIG_SCSI_NCR53C406A is not set -# CONFIG_SCSI_NETLINK is not set -# CONFIG_SCSI_NSP32 is not set -# CONFIG_SCSI_OSD_INITIATOR is not set -# CONFIG_SCSI_PAS16 is not set -# CONFIG_SCSI_PM8001 is not set -# CONFIG_SCSI_PMCRAID is not set -CONFIG_SCSI_PROC_FS=y -# CONFIG_SCSI_QLA_FC is not set -# CONFIG_SCSI_QLA_ISCSI is not set -# CONFIG_SCSI_QLOGIC_1280 is not set -# CONFIG_SCSI_QLOGIC_FAS is not set -# CONFIG_SCSI_SAS_ATTRS is not set -# CONFIG_SCSI_SAS_LIBSAS is not set -# CONFIG_SCSI_SCAN_ASYNC is not set -# CONFIG_SCSI_SPI_ATTRS is not set -# CONFIG_SCSI_SRP is not set -# CONFIG_SCSI_SRP_ATTRS is not set -# CONFIG_SCSI_STEX is not set -# CONFIG_SCSI_SYM53C416 is not set -# CONFIG_SCSI_SYM53C8XX_2 is not set -# CONFIG_SCSI_T128 is not set -# CONFIG_SCSI_TGT is not set -# CONFIG_SCSI_U14_34F is not set -# CONFIG_SCSI_UFSHCD is not set -# CONFIG_SCSI_ULTRASTOR is not set -# CONFIG_SCSI_VIRTIO is not set -# CONFIG_SCx200_ACB is not set -# CONFIG_SDIO_UART is not set -# CONFIG_SECCOMP is not set -# CONFIG_SECURITY is not set -# CONFIG_SECURITYFS is not set -CONFIG_SECURITY_DMESG_RESTRICT=y -# CONFIG_SEEQ8005 is not set -CONFIG_SELECT_MEMORY_MODEL=y -# CONFIG_SENSORS_ABITUGURU is not set -# CONFIG_SENSORS_ABITUGURU3 is not set -# CONFIG_SENSORS_ACPI_POWER is not set -# CONFIG_SENSORS_AD7314 is not set -# CONFIG_SENSORS_AD7414 is not set -# CONFIG_SENSORS_AD7418 is not set -# CONFIG_SENSORS_ADC128D818 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_ADM1275 is not set -# CONFIG_SENSORS_ADM9240 is not set -# CONFIG_SENSORS_ADS1015 is not set -# CONFIG_SENSORS_ADS7828 is not set -# CONFIG_SENSORS_ADS7871 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_AMC6821 is not set -# CONFIG_SENSORS_APDS990X is not set -# CONFIG_SENSORS_APPLESMC is not set -# CONFIG_SENSORS_ASB100 is not set -# CONFIG_SENSORS_ASC7621 is not set -# CONFIG_SENSORS_ATK0110 is not set -# CONFIG_SENSORS_ATXP1 is not set -# CONFIG_SENSORS_BH1770 is not set -# CONFIG_SENSORS_BH1780 is not set -# CONFIG_SENSORS_CORETEMP is not set -# CONFIG_SENSORS_DME1737 is not set -# CONFIG_SENSORS_DS1621 is not set -# CONFIG_SENSORS_DS620 is not set -# CONFIG_SENSORS_EMC1403 is not set -# CONFIG_SENSORS_EMC2103 is not set -# CONFIG_SENSORS_EMC6W201 is not set -# CONFIG_SENSORS_F71805F is not set -# CONFIG_SENSORS_F71882FG is not set -# CONFIG_SENSORS_F75375S is not set -# CONFIG_SENSORS_FAM15H_POWER is not set -# CONFIG_SENSORS_FSCHMD 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_GSC is not set -# CONFIG_SENSORS_HDAPS is not set -# CONFIG_SENSORS_HIH6130 is not set -# CONFIG_SENSORS_HMC5843 is not set -# CONFIG_SENSORS_HMC5843_I2C is not set -# CONFIG_SENSORS_HMC5843_SPI is not set -# CONFIG_SENSORS_HTU21 is not set -# CONFIG_SENSORS_I5500 is not set -# CONFIG_SENSORS_I5K_AMB is not set -# CONFIG_SENSORS_IIO_HWMON is not set -# CONFIG_SENSORS_INA209 is not set -# CONFIG_SENSORS_INA2XX is not set -# CONFIG_SENSORS_ISL29018 is not set -# CONFIG_SENSORS_ISL29028 is not set -# CONFIG_SENSORS_IT87 is not set -# CONFIG_SENSORS_JC42 is not set -# CONFIG_SENSORS_JZ4740 is not set -# CONFIG_SENSORS_K10TEMP is not set -# CONFIG_SENSORS_K8TEMP is not set -# CONFIG_SENSORS_LINEAGE is not set -# CONFIG_SENSORS_LIS3LV02D is not set -# CONFIG_SENSORS_LIS3_I2C is not set -# CONFIG_SENSORS_LIS3_SPI is not set -# CONFIG_SENSORS_LM25066 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_LTC2945 is not set -# CONFIG_SENSORS_LTC2978 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_MAX16064 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_MAX34440 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_MAX8688 is not set -# CONFIG_SENSORS_MCP3021 is not set -# CONFIG_SENSORS_NCT6683 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_SENSORS_PMBUS is not set -# CONFIG_SENSORS_POWR1220 is not set -# CONFIG_SENSORS_SCH5627 is not set -# CONFIG_SENSORS_SCH5636 is not set -# CONFIG_SENSORS_SCH56XX_COMMON is not set -# 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_SMM665 is not set -# CONFIG_SENSORS_SMSC47B397 is not set -# CONFIG_SENSORS_SMSC47M1 is not set -# CONFIG_SENSORS_SMSC47M192 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_TPS40422 is not set -# CONFIG_SENSORS_TSL2550 is not set -# CONFIG_SENSORS_TSL2563 is not set -# CONFIG_SENSORS_UCD9000 is not set -# CONFIG_SENSORS_UCD9200 is not set -# CONFIG_SENSORS_VEXPRESS is not set -# CONFIG_SENSORS_VIA686A is not set -# CONFIG_SENSORS_VIA_CPUTEMP is not set -# CONFIG_SENSORS_VT1211 is not set -# CONFIG_SENSORS_VT8231 is not set -# CONFIG_SENSORS_W83627EHF is not set -# CONFIG_SENSORS_W83627HF 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_ZL6100 is not set -CONFIG_SERIAL_8250=y -# CONFIG_SERIAL_8250_ACCENT is not set -# CONFIG_SERIAL_8250_BOCA is not set -CONFIG_SERIAL_8250_CONSOLE=y -# CONFIG_SERIAL_8250_CS is not set -# CONFIG_SERIAL_8250_DEPRECATED_OPTIONS is not set -# CONFIG_SERIAL_8250_DETECT_IRQ is not set -CONFIG_SERIAL_8250_DMA=y -# CONFIG_SERIAL_8250_DW is not set -# CONFIG_SERIAL_8250_EM is not set -# CONFIG_SERIAL_8250_EXAR_ST16C554 is not set -# CONFIG_SERIAL_8250_EXTENDED is not set -# CONFIG_SERIAL_8250_FINTEK is not set -# CONFIG_SERIAL_8250_FOURPORT is not set -# CONFIG_SERIAL_8250_HUB6 is not set -# CONFIG_SERIAL_8250_MANY_PORTS is not set -CONFIG_SERIAL_8250_NR_UARTS=2 -# CONFIG_SERIAL_8250_PCI is not set -# CONFIG_SERIAL_8250_RSA is not set -CONFIG_SERIAL_8250_RUNTIME_UARTS=2 -# CONFIG_SERIAL_8250_SYSRQ 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_CORE=y -CONFIG_SERIAL_CORE_CONSOLE=y -CONFIG_SERIAL_EARLYCON=y -# CONFIG_SERIAL_EARLYCON_ARM_SEMIHOST is not set -# CONFIG_SERIAL_FSL_LPUART is not set -# CONFIG_SERIAL_GRLIB_GAISLER_APBUART is not set -# CONFIG_SERIAL_IFX6X60 is not set -# CONFIG_SERIAL_JSM is not set -# CONFIG_SERIAL_MAX3100 is not set -# CONFIG_SERIAL_MAX3107 is not set -# CONFIG_SERIAL_MAX310X is not set -# CONFIG_SERIAL_MFD_HSU is not set -# CONFIG_SERIAL_NONSTANDARD is not set -# CONFIG_SERIAL_OF_PLATFORM is not set -# CONFIG_SERIAL_OF_PLATFORM_NWPSERIAL is not set -# CONFIG_SERIAL_PCH_UART is not set -# CONFIG_SERIAL_RP2 is not set -# CONFIG_SERIAL_SC16IS7XX is not set -# CONFIG_SERIAL_SCCNXP is not set -# CONFIG_SERIAL_SH_SCI is not set -# CONFIG_SERIAL_ST_ASC is not set -# CONFIG_SERIAL_TIMBERDALE is not set -# CONFIG_SERIAL_UARTLITE is not set -# CONFIG_SERIAL_XILINX_PS_UART is not set -# CONFIG_SERIO is not set -# CONFIG_SERIO_ALTERA_PS2 is not set -# CONFIG_SERIO_AMBAKMI is not set -# CONFIG_SERIO_ARC_PS2 is not set -# CONFIG_SERIO_I8042 is not set -# CONFIG_SERIO_LIBPS2 is not set -# CONFIG_SERIO_PARKBD is not set -# CONFIG_SERIO_PCIPS2 is not set -# CONFIG_SERIO_PS2MULT is not set -# CONFIG_SERIO_RAW is not set -# CONFIG_SERIO_SERPORT is not set -# CONFIG_SFC is not set -# CONFIG_SFI is not set -# CONFIG_SGETMASK_SYSCALL is not set -# CONFIG_SGI_IOC4 is not set -# CONFIG_SGI_IP22 is not set -# CONFIG_SGI_IP27 is not set -# CONFIG_SGI_IP28 is not set -# CONFIG_SGI_IP32 is not set -# CONFIG_SGI_PARTITION is not set -CONFIG_SHMEM=y -# CONFIG_SH_ETH 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_SI7005 is not set -# CONFIG_SIBYTE_BIGSUR is not set -# CONFIG_SIBYTE_CARMEL is not set -# CONFIG_SIBYTE_CRHINE is not set -# CONFIG_SIBYTE_CRHONE is not set -# CONFIG_SIBYTE_LITTLESUR is not set -# CONFIG_SIBYTE_RHONE is not set -# CONFIG_SIBYTE_SENTOSA is not set -# CONFIG_SIBYTE_SWARM is not set -# CONFIG_SIGMA is not set -CONFIG_SIGNALFD=y -# CONFIG_SIMPLE_GPIO is not set -# CONFIG_SIS190 is not set -# CONFIG_SIS900 is not set -# CONFIG_SKGE is not set -# CONFIG_SKY2 is not set -# CONFIG_SKY2_DEBUG is not set -CONFIG_SLAB=y -CONFIG_SLABINFO=y -# CONFIG_SLHC is not set -# CONFIG_SLICOSS is not set -# CONFIG_SLIP is not set -# CONFIG_SLOB is not set -# CONFIG_SLUB is not set -# CONFIG_SLUB_DEBUG is not set -# CONFIG_SLUB_STATS is not set -# CONFIG_SMARTJOYPLUS_FF is not set -# CONFIG_SMC911X is not set -# CONFIG_SMC9194 is not set -# CONFIG_SMC91X is not set -# CONFIG_SMP is not set -# CONFIG_SMSC911X is not set -# CONFIG_SMSC9420 is not set -# CONFIG_SMSC_PHY is not set -# CONFIG_SM_FTL is not set -# CONFIG_SND is not set -# CONFIG_SND_AC97_POWER_SAVE is not set -# CONFIG_SND_AD1816A is not set -# CONFIG_SND_AD1848 is not set -# CONFIG_SND_AD1889 is not set -# CONFIG_SND_ADLIB is not set -# CONFIG_SND_ALI5451 is not set -# CONFIG_SND_ALOOP is not set -# CONFIG_SND_ALS100 is not set -# CONFIG_SND_ALS300 is not set -# CONFIG_SND_ALS4000 is not set -# CONFIG_SND_ARM is not set -# CONFIG_SND_ASIHPI is not set -# CONFIG_SND_ATIIXP is not set -# CONFIG_SND_ATIIXP_MODEM is not set -# CONFIG_SND_ATMEL_AC97C is not set -# CONFIG_SND_ATMEL_SOC 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_AZT2320 is not set -# CONFIG_SND_AZT3328 is not set -# CONFIG_SND_BCD2000 is not set -# CONFIG_SND_BT87X is not set -# CONFIG_SND_CA0106 is not set -# CONFIG_SND_CMI8330 is not set -# CONFIG_SND_CMIPCI is not set -# CONFIG_SND_CS4231 is not set -# CONFIG_SND_CS4236 is not set -# CONFIG_SND_CS4281 is not set -# CONFIG_SND_CS46XX is not set -# CONFIG_SND_CS5530 is not set -# CONFIG_SND_CS5535AUDIO is not set -# CONFIG_SND_CTXFI is not set -# CONFIG_SND_DARLA20 is not set -# CONFIG_SND_DARLA24 is not set -# CONFIG_SND_DEBUG is not set -# CONFIG_SND_DESIGNWARE_I2S is not set -CONFIG_SND_DRIVERS=y -# CONFIG_SND_DUMMY is not set -# CONFIG_SND_DYNAMIC_MINORS is not set -# CONFIG_SND_ECHO3G 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_ES1688 is not set -# CONFIG_SND_ES18XX is not set -# CONFIG_SND_ES1938 is not set -# CONFIG_SND_ES1968 is not set -# CONFIG_SND_FIREWIRE is not set -# CONFIG_SND_FM801 is not set -# CONFIG_SND_GINA20 is not set -# CONFIG_SND_GINA24 is not set -# CONFIG_SND_GUSCLASSIC is not set -# CONFIG_SND_GUSEXTREME is not set -# CONFIG_SND_GUSMAX is not set -# CONFIG_SND_HDA_INPUT_JACK is not set -# CONFIG_SND_HDA_INTEL is not set -CONFIG_SND_HDA_POWER_SAVE_DEFAULT=0 -CONFIG_SND_HDA_PREALLOC_SIZE=64 -# CONFIG_SND_HDSP is not set -# CONFIG_SND_HDSPM is not set -# CONFIG_SND_HRTIMER is not set -# CONFIG_SND_HWDEP is not set -# CONFIG_SND_ICE1712 is not set -# CONFIG_SND_ICE1724 is not set -# CONFIG_SND_INDIGO is not set -# CONFIG_SND_INDIGODJ is not set -# CONFIG_SND_INDIGODJX is not set -# CONFIG_SND_INDIGOIO is not set -# CONFIG_SND_INDIGOIOX is not set -# CONFIG_SND_INTEL8X0 is not set -# CONFIG_SND_INTEL8X0M is not set -# CONFIG_SND_INTERWAVE is not set -# CONFIG_SND_INTERWAVE_STB is not set -# CONFIG_SND_ISA is not set -# CONFIG_SND_KIRKWOOD_SOC is not set -# CONFIG_SND_KORG1212 is not set -# CONFIG_SND_LAYLA20 is not set -# CONFIG_SND_LAYLA24 is not set -# CONFIG_SND_LOLA is not set -# CONFIG_SND_LX6464ES is not set -# CONFIG_SND_MAESTRO3 is not set -# CONFIG_SND_MIA is not set -# CONFIG_SND_MIPS is not set -# CONFIG_SND_MIRO is not set -# CONFIG_SND_MIXART is not set -# CONFIG_SND_MIXER_OSS is not set -# CONFIG_SND_MONA is not set -# CONFIG_SND_MPC52xx_SOC_EFIKA is not set -# CONFIG_SND_MPU401 is not set -# CONFIG_SND_MTPAV is not set -# CONFIG_SND_MTS64 is not set -# CONFIG_SND_MXS_SOC is not set -# CONFIG_SND_NM256 is not set -# CONFIG_SND_OPL3SA2 is not set -# CONFIG_SND_OPTI92X_AD1848 is not set -# CONFIG_SND_OPTI92X_CS4231 is not set -# CONFIG_SND_OPTI93X is not set -CONFIG_SND_OSSEMUL=y -# CONFIG_SND_OXYGEN is not set -CONFIG_SND_PCI=y -# CONFIG_SND_PCM is not set -# CONFIG_SND_PCMCIA is not set -# CONFIG_SND_PCM_OSS is not set -CONFIG_SND_PCM_OSS_PLUGINS=y -# CONFIG_SND_PCXHR is not set -# CONFIG_SND_PDAUDIOCF is not set -# CONFIG_SND_PORTMAN2X4 is not set -# CONFIG_SND_POWERPC_SOC is not set -# CONFIG_SND_PPC is not set -# CONFIG_SND_RAWMIDI 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_RTCTIMER is not set -# CONFIG_SND_SB16 is not set -# CONFIG_SND_SB8 is not set -# CONFIG_SND_SBAWE is not set -# CONFIG_SND_SEQUENCER is not set -# CONFIG_SND_SERIAL_U16550 is not set -# CONFIG_SND_SIMPLE_CARD is not set -# CONFIG_SND_SIS7019 is not set -# CONFIG_SND_SOC 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_AK4642 is not set -# CONFIG_SND_SOC_AK5386 is not set -# CONFIG_SND_SOC_ALC5623 is not set -# CONFIG_SND_SOC_AU1XAUDIO is not set -# CONFIG_SND_SOC_AU1XPSC is not set -# CONFIG_SND_SOC_CACHE_LZO is not set -# CONFIG_SND_SOC_CS35L32 is not set -# CONFIG_SND_SOC_CS4265 is not set -# CONFIG_SND_SOC_CS4270 is not set -# CONFIG_SND_SOC_CS4271 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_CS42XX8_I2C is not set -# CONFIG_SND_SOC_ES8328 is not set -# CONFIG_SND_SOC_EUKREA_TLV320 is not set -# CONFIG_SND_SOC_FSL_ASOC_CARD is not set -# CONFIG_SND_SOC_FSL_ASRC is not set -# CONFIG_SND_SOC_FSL_ESAI is not set -# CONFIG_SND_SOC_FSL_SAI is not set -# CONFIG_SND_SOC_FSL_SPDIF is not set -# CONFIG_SND_SOC_HDMI_CODEC is not set -# CONFIG_SND_SOC_IMX_ES8328 is not set -# CONFIG_SND_SOC_IMX_SPDIF is not set -# CONFIG_SND_SOC_IMX_WM8962 is not set -# CONFIG_SND_SOC_INTEL_SST is not set -# CONFIG_SND_SOC_MPC5200_AC97 is not set -# CONFIG_SND_SOC_MPC5200_I2S 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_SGTL5000 is not set -# CONFIG_SND_SOC_SIRF_AUDIO_CODEC is not set -# CONFIG_SND_SOC_SPDIF is not set -# CONFIG_SND_SOC_SSM2602_I2C is not set -# CONFIG_SND_SOC_SSM2602_SPI is not set -# CONFIG_SND_SOC_SSM4567 is not set -# CONFIG_SND_SOC_STA350 is not set -# CONFIG_SND_SOC_TAS2552 is not set -# CONFIG_SND_SOC_TAS5086 is not set -# CONFIG_SND_SOC_TLV320AIC31XX is not set -# CONFIG_SND_SOC_TLV320AIC3X is not set -# CONFIG_SND_SOC_TPA6130A2 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 is not set -# CONFIG_SND_SOC_WM8903 is not set -# CONFIG_SND_SOC_WM8962 is not set -# CONFIG_SND_SOC_WM8978 is not set -# CONFIG_SND_SONICVIBES is not set -# CONFIG_SND_SPI is not set -# CONFIG_SND_SSCAPE is not set -# CONFIG_SND_SUPPORT_OLD_API is not set -# CONFIG_SND_TIMER is not set -# CONFIG_SND_TRIDENT is not set -CONFIG_SND_USB=y -# CONFIG_SND_USB_6FIRE is not set -# CONFIG_SND_USB_AUDIO is not set -# CONFIG_SND_USB_CAIAQ is not set -# CONFIG_SND_USB_HIFACE is not set -# CONFIG_SND_USB_UA101 is not set -# CONFIG_SND_USB_US122L is not set -# CONFIG_SND_USB_USX2Y is not set -# CONFIG_SND_VERBOSE_PRINTK is not set -CONFIG_SND_VERBOSE_PROCFS=y -# 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_VXPOCKET is not set -# CONFIG_SND_WAVEFRONT is not set -# CONFIG_SND_YMFPCI is not set -# CONFIG_SNI_RM is not set -# CONFIG_SOC_AM33XX is not set -# CONFIG_SOC_AM43XX is not set -# CONFIG_SOC_CAMERA is not set -# CONFIG_SOC_DRA7XX is not set -# CONFIG_SOC_HAS_OMAP2_SDRC is not set -# CONFIG_SOC_OMAP5 is not set -# CONFIG_SOC_TI is not set -# CONFIG_SOFT_WATCHDOG is not set -# CONFIG_SOLARIS_X86_PARTITION is not set -# CONFIG_SOLO6X10 is not set -# CONFIG_SONYPI is not set -# CONFIG_SONY_LAPTOP is not set -# CONFIG_SOUND is not set -# CONFIG_SOUND_PRIME is not set -# CONFIG_SP5100_TCO is not set -# CONFIG_SPARSEMEM_MANUAL is not set -# CONFIG_SPARSEMEM_STATIC is not set -# CONFIG_SPARSEMEM_VMEMMAP_ENABLE is not set -# CONFIG_SPARSE_IRQ is not set -# CONFIG_SPARSE_RCU_POINTER is not set -# CONFIG_SPEAKUP is not set -# CONFIG_SPI is not set -# CONFIG_SPINLOCK_TEST is not set -# CONFIG_SPI_ALTERA is not set -# CONFIG_SPI_AU1550 is not set -# CONFIG_SPI_BCM2835 is not set -# CONFIG_SPI_BITBANG is not set -# CONFIG_SPI_BUTTERFLY is not set -# CONFIG_SPI_CADENCE is not set -# CONFIG_SPI_DEBUG is not set -# CONFIG_SPI_DESIGNWARE is not set -# CONFIG_SPI_FSL_DSPI is not set -# CONFIG_SPI_FSL_ESPI is not set -# CONFIG_SPI_FSL_SPI is not set -# CONFIG_SPI_GPIO is not set -# CONFIG_SPI_GPIO_OLD is not set -# CONFIG_SPI_LM70_LLP is not set -# CONFIG_SPI_MASTER is not set -# CONFIG_SPI_MPC52xx is not set -# CONFIG_SPI_MPC52xx_PSC is not set -# CONFIG_SPI_OCTEON is not set -# CONFIG_SPI_OC_TINY is not set -# CONFIG_SPI_ORION is not set -# CONFIG_SPI_PL022 is not set -# CONFIG_SPI_PPC4xx is not set -# CONFIG_SPI_PXA2XX is not set -# CONFIG_SPI_PXA2XX_PCI is not set -# CONFIG_SPI_RAMIPS is not set -# CONFIG_SPI_ROCKCHIP is not set -# CONFIG_SPI_SC18IS602 is not set -# CONFIG_SPI_SPIDEV is not set -# CONFIG_SPI_TI_QSPI is not set -# CONFIG_SPI_TLE62X0 is not set -# CONFIG_SPI_TOPCLIFF_PCH is not set -# CONFIG_SPI_XCOMM is not set -# CONFIG_SPI_XILINX is not set -# CONFIG_SPI_XWAY is not set -CONFIG_SPLIT_PTLOCK_CPUS=4 -# CONFIG_SPMI is not set -CONFIG_SQUASHFS=y -# CONFIG_SQUASHFS_4K_DEVBLK_SIZE is not set -# CONFIG_SQUASHFS_DECOMP_MULTI is not set -CONFIG_SQUASHFS_DECOMP_MULTI_PERCPU=y -# CONFIG_SQUASHFS_DECOMP_SINGLE is not set -CONFIG_SQUASHFS_EMBEDDED=y -# CONFIG_SQUASHFS_FILE_CACHE is not set -CONFIG_SQUASHFS_FILE_DIRECT=y -CONFIG_SQUASHFS_FRAGMENT_CACHE_SIZE=3 -# CONFIG_SQUASHFS_LZO is not set -# CONFIG_SQUASHFS_XATTR is not set -CONFIG_SQUASHFS_XZ=y -# CONFIG_SQUASHFS_ZLIB is not set -# CONFIG_SRAM is not set -# CONFIG_SSB is not set -# CONFIG_SSBI is not set -# CONFIG_SSB_DEBUG is not set -# CONFIG_SSB_DRIVER_GPIO is not set -# CONFIG_SSB_PCMCIAHOST is not set -CONFIG_SSB_POSSIBLE=y -# CONFIG_SSB_SDIOHOST is not set -# CONFIG_SSB_SILENT is not set -# CONFIG_SSFDC is not set -# CONFIG_STACKTRACE is not set -CONFIG_STACKTRACE_SUPPORT=y -# CONFIG_STACK_TRACER is not set -CONFIG_STAGING=y -# CONFIG_STAGING_MEDIA is not set -CONFIG_STANDALONE=y -CONFIG_STDBINUTILS=y -# CONFIG_STE10XP is not set -# CONFIG_STE_MODEM_RPROC is not set -# CONFIG_STMMAC_ETH is not set -# CONFIG_STMMAC_PCI is not set -# CONFIG_STMMAC_PLATFORM is not set -CONFIG_STP=y -# CONFIG_STRICT_DEVMEM is not set -CONFIG_STRIP_ASM_SYMS=y -# CONFIG_STUB_POULSBO is not set -# CONFIG_SUNDANCE is not set -# CONFIG_SUNGEM is not set -# CONFIG_SUNRPC is not set -# CONFIG_SUNRPC_DEBUG is not set -# CONFIG_SUNRPC_GSS is not set -# CONFIG_SUN_PARTITION is not set -# CONFIG_SUSPEND is not set -CONFIG_SWAP=y -# CONFIG_SWCONFIG is not set -# CONFIG_SWCONFIG_B53 is not set -# CONFIG_SWCONFIG_B53_SPI_DRIVER is not set -# CONFIG_SWCONFIG_LEDS is not set -# CONFIG_SXGBE_ETH is not set -# CONFIG_SYNCLINK_CS is not set -CONFIG_SYN_COOKIES=y -CONFIG_SYSCTL=y -# CONFIG_SYSCTL_SYSCALL is not set -# CONFIG_SYSCTL_SYSCALL_CHECK is not set -CONFIG_SYSFS=y -# CONFIG_SYSFS_DEPRECATED is not set -# CONFIG_SYSFS_DEPRECATED_V2 is not set -# CONFIG_SYSFS_SYSCALL is not set -# CONFIG_SYSTEMPORT is not set -# CONFIG_SYSTEM_TRUSTED_KEYRING is not set -# CONFIG_SYSV68_PARTITION is not set -CONFIG_SYSVIPC=y -CONFIG_SYSVIPC_SYSCTL=y -# CONFIG_SYSV_FS is not set -# CONFIG_SYS_HYPERVISOR is not set -# CONFIG_T5403 is not set -# CONFIG_TARGET_CORE is not set -# CONFIG_TASKSTATS is not set -# CONFIG_TASKS_RCU is not set -# CONFIG_TC35815 is not set -# CONFIG_TCG_ATMEL is not set -# CONFIG_TCG_INFINEON is not set -# CONFIG_TCG_ST33_I2C is not set -# CONFIG_TCG_TIS is not set -# CONFIG_TCG_TIS_I2C_ATMEL is not set -# CONFIG_TCG_TIS_I2C_INFINEON is not set -# CONFIG_TCG_TIS_I2C_NUVOTON is not set -# CONFIG_TCG_TIS_ST33ZP24 is not set -# CONFIG_TCG_TPM is not set -# CONFIG_TCG_XEN is not set -# CONFIG_TCIC is not set -CONFIG_TCP_CONG_ADVANCED=y -# CONFIG_TCP_CONG_BIC is not set -CONFIG_TCP_CONG_CUBIC=y -# CONFIG_TCP_CONG_DCTCP is not set -# CONFIG_TCP_CONG_HSTCP is not set -# CONFIG_TCP_CONG_HTCP is not set -# CONFIG_TCP_CONG_HYBLA is not set -# CONFIG_TCP_CONG_ILLINOIS is not set -# CONFIG_TCP_CONG_LP is not set -# CONFIG_TCP_CONG_SCALABLE is not set -# CONFIG_TCP_CONG_VEGAS is not set -# CONFIG_TCP_CONG_VENO is not set -# CONFIG_TCP_CONG_WESTWOOD is not set -# CONFIG_TCP_CONG_YEAH is not set -# CONFIG_TCP_MD5SIG is not set -# CONFIG_TCS3414 is not set -# CONFIG_TCS3472 is not set -# CONFIG_TEGRA_HOST1X is not set -# CONFIG_TEHUTI is not set -# CONFIG_TEST_BPF is not set -# CONFIG_TEST_FIRMWARE is not set -# CONFIG_TEST_KSTRTOX is not set -# CONFIG_TEST_LIST_SORT is not set -# CONFIG_TEST_LKM is not set -# CONFIG_TEST_MODULE is not set -# CONFIG_TEST_POWER is not set -# CONFIG_TEST_RHASHTABLE is not set -# CONFIG_TEST_STRING_HELPERS is not set -# CONFIG_TEST_UDELAY is not set -# CONFIG_TEST_USER_COPY is not set -CONFIG_TEXTSEARCH=y -# CONFIG_TEXTSEARCH_BM is not set -# CONFIG_TEXTSEARCH_FSM is not set -# CONFIG_TEXTSEARCH_KMP is not set -# CONFIG_THERMAL is not set -# CONFIG_THERMAL_GOV_BANG_BANG is not set -# CONFIG_THERMAL_HWMON is not set -# CONFIG_THRUSTMASTER_FF is not set -# CONFIG_THUNDERBOLT is not set -# CONFIG_TICK_CPU_ACCOUNTING is not set -CONFIG_TICK_ONESHOT=y -# CONFIG_TIFM_CORE is not set -# CONFIG_TIGON3 is not set -# CONFIG_TIMB_DMA is not set -CONFIG_TIMERFD=y -# CONFIG_TIMER_STATS is not set -CONFIG_TINY_RCU=y -# CONFIG_TIPC is not set -# CONFIG_TI_ADC081C is not set -# CONFIG_TI_ADC128S052 is not set -# CONFIG_TI_AM335X_ADC is not set -# CONFIG_TI_CPSW is not set -# CONFIG_TI_CPTS is not set -# CONFIG_TI_DAC7512 is not set -# CONFIG_TI_DAVINCI_CPDMA is not set -# CONFIG_TI_DAVINCI_MDIO is not set -# CONFIG_TI_ST is not set -# CONFIG_TLAN is not set -# CONFIG_TMD_HERMES is not set -# CONFIG_TMP006 is not set -CONFIG_TMPFS=y -# CONFIG_TMPFS_POSIX_ACL is not set -CONFIG_TMPFS_XATTR=y -# CONFIG_TORTURE_TEST is not set -# CONFIG_TOSHIBA_HAPS is not set -# CONFIG_TOUCHSCREEN_AD7877 is not set -# CONFIG_TOUCHSCREEN_AD7879 is not set -# CONFIG_TOUCHSCREEN_AD7879_I2C is not set -# CONFIG_TOUCHSCREEN_AD7879_SPI is not set -# CONFIG_TOUCHSCREEN_ADS7846 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_CLEARPAD_TM1217 is not set -# CONFIG_TOUCHSCREEN_CY8CTMG110 is not set -# CONFIG_TOUCHSCREEN_CYTTSP4_CORE is not set -# CONFIG_TOUCHSCREEN_CYTTSP_CORE is not set -# CONFIG_TOUCHSCREEN_DYNAPRO is not set -# CONFIG_TOUCHSCREEN_EDT_FT5X06 is not set -# CONFIG_TOUCHSCREEN_EETI is not set -# CONFIG_TOUCHSCREEN_EGALAX is not set -# CONFIG_TOUCHSCREEN_ELO is not set -# CONFIG_TOUCHSCREEN_FUJITSU is not set -# CONFIG_TOUCHSCREEN_GUNZE is not set -# CONFIG_TOUCHSCREEN_HAMPSHIRE is not set -# CONFIG_TOUCHSCREEN_ILI210X is not set -# CONFIG_TOUCHSCREEN_INEXIO is not set -# CONFIG_TOUCHSCREEN_MAX11801 is not set -# CONFIG_TOUCHSCREEN_MCS5000 is not set -# CONFIG_TOUCHSCREEN_MK712 is not set -# CONFIG_TOUCHSCREEN_MMS114 is not set -# CONFIG_TOUCHSCREEN_MTOUCH is not set -# CONFIG_TOUCHSCREEN_PENMOUNT is not set -# CONFIG_TOUCHSCREEN_PIXCIR is not set -# CONFIG_TOUCHSCREEN_S3C2410 is not set -# CONFIG_TOUCHSCREEN_ST1232 is not set -# CONFIG_TOUCHSCREEN_SUR40 is not set -# CONFIG_TOUCHSCREEN_SYNAPTICS_I2C_RMI4 is not set -# CONFIG_TOUCHSCREEN_TOUCHIT213 is not set -# CONFIG_TOUCHSCREEN_TOUCHRIGHT is not set -# CONFIG_TOUCHSCREEN_TOUCHWIN is not set -# CONFIG_TOUCHSCREEN_TPS6507X is not set -# CONFIG_TOUCHSCREEN_TSC2005 is not set -# CONFIG_TOUCHSCREEN_TSC2007 is not set -# CONFIG_TOUCHSCREEN_TSC_SERIO is not set -# CONFIG_TOUCHSCREEN_USB_COMPOSITE is not set -# CONFIG_TOUCHSCREEN_W90X900 is not set -# CONFIG_TOUCHSCREEN_WACOM_I2C is not set -# CONFIG_TOUCHSCREEN_WACOM_W8001 is not set -# CONFIG_TOUCHSCREEN_WM97XX is not set -# CONFIG_TOUCHSCREEN_ZFORCE is not set -# CONFIG_TPS6105X is not set -# CONFIG_TPS65010 is not set -# CONFIG_TPS6507X is not set -# CONFIG_TR is not set -# CONFIG_TRACEPOINT_BENCHMARK is not set -# CONFIG_TRACER_SNAPSHOT is not set -# CONFIG_TRACER_SNAPSHOT_PER_CPU_SWAP is not set -# CONFIG_TRACE_BRANCH_PROFILING is not set -CONFIG_TRACE_IRQFLAGS_SUPPORT=y -# CONFIG_TRACE_SINK is not set -CONFIG_TRACING_SUPPORT=y -CONFIG_TRAD_SIGNALS=y -# CONFIG_TRANSPARENT_HUGEPAGE is not set -# CONFIG_TRANZPORT is not set -# CONFIG_TREE_PREEMPT_RCU is not set -# CONFIG_TREE_RCU is not set -# CONFIG_TREE_RCU_TRACE is not set -# CONFIG_TRUSTED_KEYS is not set -# CONFIG_TSL2583 is not set -# CONFIG_TSL2x7x is not set -# CONFIG_TSL4531 is not set -CONFIG_TTY=y -# CONFIG_TTY_PRINTK is not set -# CONFIG_TUN is not set -# CONFIG_TWL4030_CORE is not set -# CONFIG_TWL4030_MADC is not set -# CONFIG_TWL6030_GPADC is not set -# CONFIG_TWL6040_CORE is not set -# CONFIG_TYPHOON is not set -# CONFIG_UACCESS_WITH_MEMCPY is not set -# CONFIG_UCB1400_CORE is not set -# CONFIG_UDF_FS is not set -CONFIG_UDF_NLS=y -CONFIG_UEVENT_HELPER=y -CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug" -# CONFIG_UFS_FS is not set -# CONFIG_UHID is not set -CONFIG_UIDGID_STRICT_TYPE_CHECKS=y -# CONFIG_UIO is not set -# CONFIG_ULTRA is not set -# CONFIG_ULTRIX_PARTITION is not set -CONFIG_UNIX=y -CONFIG_UNIX98_PTYS=y -# CONFIG_UNIXWARE_DISKLABEL is not set -# CONFIG_UNIX_DIAG is not set -# CONFIG_UNUSED_SYMBOLS is not set -# CONFIG_UPROBES is not set -# CONFIG_UPROBE_EVENT is not set -# CONFIG_USB is not set -# CONFIG_USBIP_CORE is not set -# CONFIG_USBPCWATCHDOG is not set -# CONFIG_USB_ACM is not set -# CONFIG_USB_ADUTUX is not set -CONFIG_USB_ALI_M5632=y -# CONFIG_USB_AMD5536UDC is not set -CONFIG_USB_AN2720=y -# CONFIG_USB_ANNOUNCE_NEW_DEVICES is not set -# CONFIG_USB_APPLEDISPLAY is not set -CONFIG_USB_ARCH_HAS_EHCI=y -CONFIG_USB_ARCH_HAS_HCD=y -CONFIG_USB_ARCH_HAS_OHCI=y -CONFIG_USB_ARMLINUX=y -# CONFIG_USB_ATM is not set -CONFIG_USB_BELKIN=y -# CONFIG_USB_BTMTK is not set -# CONFIG_USB_C67X00_HCD is not set -# CONFIG_USB_CATC is not set -# CONFIG_USB_CDC_COMPOSITE is not set -# CONFIG_USB_CHIPIDEA is not set -# CONFIG_USB_CONFIGFS is not set -# CONFIG_USB_CXACRU is not set -# CONFIG_USB_CYPRESS_CY7C63 is not set -# CONFIG_USB_CYTHERM is not set -# CONFIG_USB_DEBUG is not set -CONFIG_USB_DEFAULT_PERSIST=y -CONFIG_USB_DEVICEFS=y -# CONFIG_USB_DEVICE_CLASS is not set -# CONFIG_USB_DSBR is not set -# CONFIG_USB_DUMMY_HCD is not set -# CONFIG_USB_DWC2 is not set -# CONFIG_USB_DWC2_DUAL_ROLE is not set -# CONFIG_USB_DWC2_HOST is not set -# CONFIG_USB_DWC2_PERIPHERAL is not set -# CONFIG_USB_DWC3 is not set -# CONFIG_USB_DWC3_EXYNOS is not set -# CONFIG_USB_DWC3_KEYSTONE is not set -# CONFIG_USB_DWC3_PCI is not set -# CONFIG_USB_DWC3_QCOM is not set -# CONFIG_USB_DWC_OTG_LPM is not set -# CONFIG_USB_DYNAMIC_MINORS is not set -# CONFIG_USB_EG20T is not set -# CONFIG_USB_EHCI_HCD_AT91 is not set -# CONFIG_USB_EHCI_HCD_PPC_OF is not set -# CONFIG_USB_EHCI_MSM is not set -# CONFIG_USB_EHCI_MV is not set -CONFIG_USB_EHCI_ROOT_HUB_TT=y -CONFIG_USB_EHCI_TT_NEWSCHED=y -# CONFIG_USB_EHSET_TEST_FIXTURE is not set -# CONFIG_USB_EMI26 is not set -# CONFIG_USB_EMI62 is not set -# CONFIG_USB_ENESTORAGE is not set -# CONFIG_USB_EPSON2888 is not set -# CONFIG_USB_ET61X251 is not set -CONFIG_USB_EZUSB=y -# CONFIG_USB_EZUSB_FX2 is not set -# CONFIG_USB_FILE_STORAGE is not set -# CONFIG_USB_FOTG210_HCD is not set -# CONFIG_USB_FOTG210_UDC is not set -# CONFIG_USB_FSL_USB2 is not set -# CONFIG_USB_FTDI_ELAN is not set -# CONFIG_USB_FUNCTIONFS is not set -# CONFIG_USB_FUSB300 is not set -# CONFIG_USB_FUSBH200_HCD is not set -# CONFIG_USB_GADGET is not set -# CONFIG_USB_GADGETFS is not set -# 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_STORAGE_NUM_BUFFERS=2 -CONFIG_USB_GADGET_VBUS_DRAW=2 -# CONFIG_USB_GADGET_XILINX is not set -# CONFIG_USB_GL860 is not set -# CONFIG_USB_GOKU is not set -# CONFIG_USB_GPIO_VBUS is not set -# CONFIG_USB_GR_UDC is not set -# CONFIG_USB_GSPCA is not set -# CONFIG_USB_GSPCA_BENQ is not set -# CONFIG_USB_GSPCA_CONEX is not set -# CONFIG_USB_GSPCA_CPIA1 is not set -# CONFIG_USB_GSPCA_DTCS033 is not set -# CONFIG_USB_GSPCA_ETOMS is not set -# CONFIG_USB_GSPCA_FINEPIX is not set -# CONFIG_USB_GSPCA_JEILINJ is not set -# CONFIG_USB_GSPCA_JL2005BCD is not set -# CONFIG_USB_GSPCA_KINECT is not set -# CONFIG_USB_GSPCA_KONICA is not set -# CONFIG_USB_GSPCA_MARS is not set -# CONFIG_USB_GSPCA_MR97310A is not set -# CONFIG_USB_GSPCA_NW80X is not set -# CONFIG_USB_GSPCA_OV519 is not set -# CONFIG_USB_GSPCA_OV534 is not set -# CONFIG_USB_GSPCA_OV534_9 is not set -# CONFIG_USB_GSPCA_PAC207 is not set -# CONFIG_USB_GSPCA_PAC7302 is not set -# CONFIG_USB_GSPCA_PAC7311 is not set -# CONFIG_USB_GSPCA_SE401 is not set -# CONFIG_USB_GSPCA_SN9C2028 is not set -# CONFIG_USB_GSPCA_SN9C20X is not set -# CONFIG_USB_GSPCA_SONIXB is not set -# CONFIG_USB_GSPCA_SONIXJ is not set -# CONFIG_USB_GSPCA_SPCA1528 is not set -# CONFIG_USB_GSPCA_SPCA500 is not set -# CONFIG_USB_GSPCA_SPCA501 is not set -# CONFIG_USB_GSPCA_SPCA505 is not set -# CONFIG_USB_GSPCA_SPCA506 is not set -# CONFIG_USB_GSPCA_SPCA508 is not set -# CONFIG_USB_GSPCA_SPCA561 is not set -# CONFIG_USB_GSPCA_SQ905 is not set -# CONFIG_USB_GSPCA_SQ905C is not set -# CONFIG_USB_GSPCA_SQ930X is not set -# CONFIG_USB_GSPCA_STK014 is not set -# CONFIG_USB_GSPCA_STK1135 is not set -# CONFIG_USB_GSPCA_STV0680 is not set -# CONFIG_USB_GSPCA_SUNPLUS is not set -# CONFIG_USB_GSPCA_T613 is not set -# CONFIG_USB_GSPCA_TOPRO is not set -# CONFIG_USB_GSPCA_TV8532 is not set -# CONFIG_USB_GSPCA_VC032X is not set -# CONFIG_USB_GSPCA_VICAM is not set -# CONFIG_USB_GSPCA_XIRLINK_CIT is not set -# CONFIG_USB_GSPCA_ZC3XX is not set -# CONFIG_USB_G_ACM_MS is not set -# CONFIG_USB_G_DBGP is not set -# CONFIG_USB_G_HID is not set -# CONFIG_USB_G_MULTI is not set -# CONFIG_USB_G_NCM is not set -# CONFIG_USB_G_NOKIA is not set -# CONFIG_USB_G_PRINTER is not set -# CONFIG_USB_G_SERIAL is not set -# CONFIG_USB_G_WEBCAM is not set -# CONFIG_USB_HCD_TEST_MODE is not set -# CONFIG_USB_HID is not set -# CONFIG_USB_HIDDEV is not set -# CONFIG_USB_HSIC_USB3503 is not set -# CONFIG_USB_HSO is not set -# CONFIG_USB_HWA_HCD is not set -# CONFIG_USB_IBMCAM is not set -# CONFIG_USB_IDMOUSE is not set -# CONFIG_USB_INPUT_IMS_PCU is not set -# CONFIG_USB_IOWARRIOR is not set -# CONFIG_USB_IPHETH is not set -# CONFIG_USB_IP_COMMON is not set -# CONFIG_USB_ISIGHTFW is not set -# CONFIG_USB_ISP116X_HCD is not set -# CONFIG_USB_ISP1301 is not set -# CONFIG_USB_ISP1362_HCD is not set -# CONFIG_USB_ISP1760_HCD is not set -# CONFIG_USB_KAWETH is not set -# CONFIG_USB_KBD is not set -# CONFIG_USB_KC2190 is not set -# CONFIG_USB_KONICAWC is not set -# CONFIG_USB_LCD is not set -# CONFIG_USB_LD is not set -# CONFIG_USB_LED is not set -# CONFIG_USB_LED_TRIG is not set -# CONFIG_USB_LEGOTOWER is not set -# CONFIG_USB_LIBUSUAL is not set -# CONFIG_USB_LINK_LAYER_TEST is not set -# CONFIG_USB_M5602 is not set -# CONFIG_USB_M66592 is not set -# CONFIG_USB_MASS_STORAGE is not set -# CONFIG_USB_MAX3421_HCD is not set -# CONFIG_USB_MDC800 is not set -# CONFIG_USB_MICROTEK is not set -# CONFIG_USB_MIDI_GADGET is not set -# CONFIG_USB_MON is not set -# CONFIG_USB_MOUSE is not set -# CONFIG_USB_MSM_OTG is not set -# CONFIG_USB_MUSB_HDRC is not set -# CONFIG_USB_MV_U3D is not set -# CONFIG_USB_MV_UDC is not set -# CONFIG_USB_MXS_PHY is not set -# CONFIG_USB_NET2272 is not set -# CONFIG_USB_NET2280 is not set -# CONFIG_USB_NET_AX88179_178A is not set -# CONFIG_USB_NET_AX8817X is not set -# CONFIG_USB_NET_CDCETHER is not set -# CONFIG_USB_NET_CDC_EEM is not set -# CONFIG_USB_NET_CDC_MBIM is not set -# CONFIG_USB_NET_CDC_NCM is not set -# CONFIG_USB_NET_CDC_SUBSET is not set -# CONFIG_USB_NET_CX82310_ETH is not set -# CONFIG_USB_NET_DM9601 is not set -# CONFIG_USB_NET_DRIVERS is not set -# CONFIG_USB_NET_GL620A is not set -# CONFIG_USB_NET_HUAWEI_CDC_NCM is not set -# CONFIG_USB_NET_INT51X1 is not set -# CONFIG_USB_NET_KALMIA is not set -# CONFIG_USB_NET_MCS7830 is not set -# CONFIG_USB_NET_NET1080 is not set -# CONFIG_USB_NET_PLUSB is not set -# CONFIG_USB_NET_QMI_WWAN is not set -# CONFIG_USB_NET_RNDIS_HOST is not set -# CONFIG_USB_NET_RNDIS_WLAN is not set -# CONFIG_USB_NET_SMSC75XX is not set -# CONFIG_USB_NET_SMSC95XX is not set -# CONFIG_USB_NET_SR9700 is not set -# CONFIG_USB_NET_SR9800 is not set -# CONFIG_USB_NET_ZAURUS is not set -# CONFIG_USB_OHCI_HCD is not set -# CONFIG_USB_OHCI_HCD_PCI is not set -# CONFIG_USB_OHCI_HCD_PPC_OF is not set -# CONFIG_USB_OHCI_HCD_PPC_OF_BE is not set -# CONFIG_USB_OHCI_HCD_PPC_OF_LE is not set -# CONFIG_USB_OHCI_HCD_PPC_SOC is not set -# CONFIG_USB_OHCI_HCD_SSB is not set -CONFIG_USB_OHCI_LITTLE_ENDIAN=y -# CONFIG_USB_OTG is not set -# CONFIG_USB_OTG_BLACKLIST_HUB is not set -# CONFIG_USB_OTG_FSM is not set -# CONFIG_USB_OTG_WHITELIST is not set -# CONFIG_USB_OXU210HP_HCD is not set -# CONFIG_USB_PEGASUS is not set -# CONFIG_USB_PHY is not set -# CONFIG_USB_PRINTER is not set -# CONFIG_USB_PWC_INPUT_EVDEV is not set -# CONFIG_USB_PXA27X is not set -# CONFIG_USB_R8A66597 is not set -# CONFIG_USB_R8A66597_HCD is not set -# CONFIG_USB_RCAR_PHY is not set -# CONFIG_USB_RENESAS_USBHS is not set -# CONFIG_USB_RIO500 is not set -# CONFIG_USB_RTL8150 is not set -# CONFIG_USB_RTL8152 is not set -# CONFIG_USB_S2255 is not set -# CONFIG_USB_S3C_HSOTG is not set -# CONFIG_USB_SE401 is not set -# CONFIG_USB_SERIAL 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_CP210X is not set -# CONFIG_USB_SERIAL_CYBERJACK is not set -# CONFIG_USB_SERIAL_CYPRESS_M8 is not set -# CONFIG_USB_SERIAL_DEBUG is not set -# CONFIG_USB_SERIAL_DIGI_ACCELEPORT is not set -# CONFIG_USB_SERIAL_EDGEPORT is not set -# CONFIG_USB_SERIAL_EDGEPORT_TI is not set -# CONFIG_USB_SERIAL_EMPEG is not set -# CONFIG_USB_SERIAL_F81232 is not set -# CONFIG_USB_SERIAL_FTDI_SIO is not set -# CONFIG_USB_SERIAL_FUNSOFT is not set -# CONFIG_USB_SERIAL_GARMIN is not set -CONFIG_USB_SERIAL_GENERIC=y -# CONFIG_USB_SERIAL_HP4X is not set -# CONFIG_USB_SERIAL_IPAQ is not set -# CONFIG_USB_SERIAL_IPW is not set -# CONFIG_USB_SERIAL_IR is not set -# CONFIG_USB_SERIAL_IUU is not set -# CONFIG_USB_SERIAL_KEYSPAN is not set -CONFIG_USB_SERIAL_KEYSPAN_MPR=y -# CONFIG_USB_SERIAL_KEYSPAN_PDA is not set -CONFIG_USB_SERIAL_KEYSPAN_USA18X=y -CONFIG_USB_SERIAL_KEYSPAN_USA19=y -CONFIG_USB_SERIAL_KEYSPAN_USA19QI=y -CONFIG_USB_SERIAL_KEYSPAN_USA19QW=y -CONFIG_USB_SERIAL_KEYSPAN_USA19W=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_USA49W=y -CONFIG_USB_SERIAL_KEYSPAN_USA49WLC=y -# 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_MOS7715_PARPORT is not set -# CONFIG_USB_SERIAL_MOS7720 is not set -# CONFIG_USB_SERIAL_MOS7840 is not set -# CONFIG_USB_SERIAL_MOTOROLA is not set -# CONFIG_USB_SERIAL_MXUPORT is not set -# CONFIG_USB_SERIAL_NAVMAN is not set -# CONFIG_USB_SERIAL_OMNINET is not set -# CONFIG_USB_SERIAL_OPTICON is not set -# CONFIG_USB_SERIAL_OPTION is not set -# CONFIG_USB_SERIAL_OTI6858 is not set -# CONFIG_USB_SERIAL_PL2303 is not set -# CONFIG_USB_SERIAL_QCAUX is not set -# CONFIG_USB_SERIAL_QT2 is not set -# CONFIG_USB_SERIAL_QUALCOMM is not set -# CONFIG_USB_SERIAL_QUATECH2 is not set -# CONFIG_USB_SERIAL_QUATECH_USB2 is not set -# CONFIG_USB_SERIAL_SAFE is not set -CONFIG_USB_SERIAL_SAFE_PADDED=y -# CONFIG_USB_SERIAL_SIEMENS_MPI is not set -# CONFIG_USB_SERIAL_SIERRAWIRELESS is not set -# CONFIG_USB_SERIAL_SIMPLE is not set -# CONFIG_USB_SERIAL_SPCP8X5 is not set -# CONFIG_USB_SERIAL_SSU100 is not set -# CONFIG_USB_SERIAL_SYMBOL is not set -# CONFIG_USB_SERIAL_TI is not set -# CONFIG_USB_SERIAL_VISOR is not set -# CONFIG_USB_SERIAL_VIVOPAY_SERIAL is not set -# CONFIG_USB_SERIAL_WHITEHEAT is not set -# CONFIG_USB_SERIAL_WISHBONE is not set -# CONFIG_USB_SERIAL_XIRCOM is not set -# CONFIG_USB_SERIAL_XSENS_MT is not set -# CONFIG_USB_SERIAL_ZIO is not set -# CONFIG_USB_SERIAL_ZTE is not set -# CONFIG_USB_SEVSEG is not set -# CONFIG_USB_SIERRA_NET is not set -# CONFIG_USB_SISUSBVGA is not set -# CONFIG_USB_SL811_HCD is not set -# CONFIG_USB_SN9C102 is not set -# CONFIG_USB_SPEEDTOUCH is not set -# CONFIG_USB_STKWEBCAM is not set -# CONFIG_USB_STORAGE is not set -# CONFIG_USB_STORAGE_ALAUDA is not set -# CONFIG_USB_STORAGE_CYPRESS_ATACB is not set -# CONFIG_USB_STORAGE_DATAFAB is not set -# CONFIG_USB_STORAGE_DEBUG is not set -# CONFIG_USB_STORAGE_ENE_UB6250 is not set -# CONFIG_USB_STORAGE_FREECOM is not set -# CONFIG_USB_STORAGE_ISD200 is not set -# CONFIG_USB_STORAGE_JUMPSHOT is not set -# CONFIG_USB_STORAGE_KARMA is not set -# CONFIG_USB_STORAGE_ONETOUCH is not set -# CONFIG_USB_STORAGE_REALTEK is not set -# CONFIG_USB_STORAGE_SDDR09 is not set -# CONFIG_USB_STORAGE_SDDR55 is not set -# CONFIG_USB_STORAGE_USBAT is not set -# CONFIG_USB_STV06XX is not set -# CONFIG_USB_SUPPORT is not set -# CONFIG_USB_SUSPEND is not set -# CONFIG_USB_SWITCH_FSA9480 is not set -# CONFIG_USB_TEST is not set -# CONFIG_USB_TMC is not set -# CONFIG_USB_TRANCEVIBRATOR is not set -# CONFIG_USB_UAS is not set -# CONFIG_USB_UEAGLEATM is not set -# CONFIG_USB_ULPI is not set -# CONFIG_USB_USBNET is not set -# CONFIG_USB_USS720 is not set -# CONFIG_USB_VIDEO_CLASS is not set -CONFIG_USB_VIDEO_CLASS_INPUT_EVDEV=y -# CONFIG_USB_VL600 is not set -# CONFIG_USB_WDM is not set -# CONFIG_USB_WHCI_HCD is not set -# CONFIG_USB_WPAN_HCD is not set -# CONFIG_USB_WUSB is not set -# CONFIG_USB_WUSB_CBAF is not set -# CONFIG_USB_XHCI_HCD is not set -# CONFIG_USB_XUSBATM is not set -# CONFIG_USB_YUREX is not set -# CONFIG_USB_ZD1201 is not set -# CONFIG_USB_ZERO is not set -# CONFIG_USB_ZR364XX is not set -# CONFIG_USELIB is not set -# CONFIG_USE_GENERIC_SMP_HELPERS is not set -# CONFIG_USE_OF is not set -# CONFIG_UTS_NS is not set -# CONFIG_UWB is not set -# CONFIG_V4L_MEM2MEM_DRIVERS is not set -# CONFIG_V4L_TEST_DRIVERS is not set -# CONFIG_VCNL4000 is not set -# CONFIG_VETH is not set -# CONFIG_VEXPRESS_CONFIG is not set -# CONFIG_VF610_ADC is not set -# CONFIG_VFAT_FS is not set -# CONFIG_VGASTATE is not set -# CONFIG_VGA_ARB is not set -# CONFIG_VGA_SWITCHEROO is not set -# CONFIG_VIA_RHINE is not set -# CONFIG_VIA_VELOCITY is not set -# CONFIG_VIDEO_ADV7170 is not set -# CONFIG_VIDEO_ADV7175 is not set -# CONFIG_VIDEO_ADV7180 is not set -# CONFIG_VIDEO_ADV7183 is not set -# CONFIG_VIDEO_ADV7343 is not set -# CONFIG_VIDEO_ADV7393 is not set -# CONFIG_VIDEO_ADV_DEBUG is not set -# CONFIG_VIDEO_AK881X is not set -# CONFIG_VIDEO_BT819 is not set -# CONFIG_VIDEO_BT848 is not set -# CONFIG_VIDEO_BT856 is not set -# CONFIG_VIDEO_BT866 is not set -# CONFIG_VIDEO_BWQCAM is not set -# CONFIG_VIDEO_CAFE_CCIC is not set -# CONFIG_VIDEO_CAPTURE_DRIVERS is not set -# CONFIG_VIDEO_CPIA is not set -# CONFIG_VIDEO_CQCAM is not set -# CONFIG_VIDEO_CS5345 is not set -# CONFIG_VIDEO_CS53L32A is not set -# CONFIG_VIDEO_CX231XX is not set -# CONFIG_VIDEO_CX2341X is not set -# CONFIG_VIDEO_CX25840 is not set -# CONFIG_VIDEO_CX88 is not set -# CONFIG_VIDEO_DEV is not set -# CONFIG_VIDEO_DM6446_CCDC is not set -# CONFIG_VIDEO_DT3155 is not set -# CONFIG_VIDEO_EM28XX is not set -# CONFIG_VIDEO_FIXED_MINOR_RANGES is not set -# CONFIG_VIDEO_GO7007 is not set -# CONFIG_VIDEO_HDPVR is not set -# CONFIG_VIDEO_HELPER_CHIPS_AUTO is not set -# CONFIG_VIDEO_HEXIUM_GEMINI is not set -# CONFIG_VIDEO_HEXIUM_ORION is not set -# CONFIG_VIDEO_IR_I2C is not set -# CONFIG_VIDEO_IVTV is not set -# CONFIG_VIDEO_KS0127 is not set -# CONFIG_VIDEO_M52790 is not set -# CONFIG_VIDEO_MEDIA is not set -# CONFIG_VIDEO_MEM2MEM_TESTDEV is not set -# CONFIG_VIDEO_ML86V7667 is not set -# CONFIG_VIDEO_MSP3400 is not set -# CONFIG_VIDEO_MT9V011 is not set -# CONFIG_VIDEO_MXB is not set -# CONFIG_VIDEO_NOON010PC30 is not set -# CONFIG_VIDEO_OMAP2_VOUT is not set -# CONFIG_VIDEO_OUTPUT_CONTROL is not set -# CONFIG_VIDEO_OV7640 is not set -# CONFIG_VIDEO_OV7670 is not set -# CONFIG_VIDEO_PMS is not set -# CONFIG_VIDEO_PVRUSB2 is not set -# CONFIG_VIDEO_SAA6588 is not set -# CONFIG_VIDEO_SAA6752HS is not set -# CONFIG_VIDEO_SAA7110 is not set -# CONFIG_VIDEO_SAA711X is not set -# CONFIG_VIDEO_SAA7127 is not set -# CONFIG_VIDEO_SAA7134 is not set -# CONFIG_VIDEO_SAA717X is not set -# CONFIG_VIDEO_SAA7185 is not set -# CONFIG_VIDEO_SAA7191 is not set -# CONFIG_VIDEO_SH_MOBILE_CEU is not set -# CONFIG_VIDEO_SONY_BTF_MPX is not set -# CONFIG_VIDEO_SR030PC30 is not set -# CONFIG_VIDEO_TCM825X is not set -# CONFIG_VIDEO_TDA7432 is not set -# CONFIG_VIDEO_TDA9840 is not set -# CONFIG_VIDEO_TEA6415C is not set -# CONFIG_VIDEO_TEA6420 is not set -# CONFIG_VIDEO_THS7303 is not set -# CONFIG_VIDEO_THS8200 is not set -# CONFIG_VIDEO_TIMBERDALE is not set -# CONFIG_VIDEO_TLV320AIC23B is not set -# CONFIG_VIDEO_TM6000 is not set -# CONFIG_VIDEO_TVAUDIO is not set -# CONFIG_VIDEO_TVP514X is not set -# CONFIG_VIDEO_TVP5150 is not set -# CONFIG_VIDEO_TVP7002 is not set -# CONFIG_VIDEO_TW2804 is not set -# CONFIG_VIDEO_TW9903 is not set -# CONFIG_VIDEO_TW9906 is not set -# CONFIG_VIDEO_UDA1342 is not set -# CONFIG_VIDEO_UPD64031A is not set -# CONFIG_VIDEO_UPD64083 is not set -# CONFIG_VIDEO_USBTV is not set -# CONFIG_VIDEO_USBVISION is not set -# CONFIG_VIDEO_V4L2 is not set -# CONFIG_VIDEO_V4L2_COMMON is not set -# CONFIG_VIDEO_V4L2_INT_DEVICE is not set -# CONFIG_VIDEO_VIVI is not set -# CONFIG_VIDEO_VP27SMPX is not set -# CONFIG_VIDEO_VPX3220 is not set -# CONFIG_VIDEO_VS6624 is not set -# CONFIG_VIDEO_WM8739 is not set -# CONFIG_VIDEO_WM8775 is not set -# CONFIG_VIDEO_ZORAN is not set -# CONFIG_VIRQ_DEBUG is not set -# CONFIG_VIRTIO_BALLOON is not set -# CONFIG_VIRTIO_MMIO is not set -# CONFIG_VIRTIO_PCI is not set -# CONFIG_VIRTUALIZATION is not set -# CONFIG_VIRT_CPU_ACCOUNTING_GEN is not set -# CONFIG_VIRT_DRIVERS is not set -CONFIG_VIRT_TO_BUS=y -# CONFIG_VITESSE_PHY is not set -CONFIG_VLAN_8021Q=y -# CONFIG_VLAN_8021Q_GVRP is not set -# CONFIG_VLAN_8021Q_MVRP is not set -# CONFIG_VME_BUS is not set -# CONFIG_VMSPLIT_1G is not set -# CONFIG_VMSPLIT_2G is not set -# CONFIG_VMSPLIT_2G_OPT is not set -CONFIG_VMSPLIT_3G=y -# CONFIG_VMSPLIT_3G_OPT is not set -# CONFIG_VMWARE_PVSCSI is not set -# CONFIG_VMXNET3 is not set -# CONFIG_VM_EVENT_COUNTERS is not set -# CONFIG_VORTEX is not set -# CONFIG_VSOCKETS is not set -# CONFIG_VT is not set -# CONFIG_VT6655 is not set -# CONFIG_VT6656 is not set -# CONFIG_VXFS_FS is not set -# CONFIG_VXGE is not set -# CONFIG_VXLAN is not set -# CONFIG_W1 is not set -# CONFIG_W1_CON is not set -# CONFIG_W1_MASTER_DS1WM is not set -# CONFIG_W1_MASTER_DS2482 is not set -# CONFIG_W1_MASTER_DS2490 is not set -# CONFIG_W1_MASTER_GPIO is not set -# CONFIG_W1_MASTER_MATROX is not set -# CONFIG_W1_SLAVE_BQ27000 is not set -# CONFIG_W1_SLAVE_DS2406 is not set -# CONFIG_W1_SLAVE_DS2408 is not set -# CONFIG_W1_SLAVE_DS2413 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_SMEM is not set -# CONFIG_W1_SLAVE_THERM is not set -# CONFIG_W35UND is not set -# CONFIG_W83627HF_WDT is not set -# CONFIG_W83697HF_WDT is not set -# CONFIG_W83877F_WDT is not set -# CONFIG_W83977F_WDT is not set -# CONFIG_WAN is not set -# CONFIG_WANXL is not set -# CONFIG_WAN_ROUTER is not set -CONFIG_WATCHDOG=y -# CONFIG_WATCHDOG_CORE is not set -# CONFIG_WATCHDOG_NOWAYOUT is not set -# CONFIG_WD80x3 is not set -# CONFIG_WDTPCI is not set -CONFIG_WEXT_CORE=y -CONFIG_WEXT_PRIV=y -CONFIG_WEXT_PROC=y -CONFIG_WEXT_SPY=y -CONFIG_WILINK_PLATFORM_DATA=y -# CONFIG_WIMAX is not set -# CONFIG_WIMAX_GDM72XX is not set -CONFIG_WIRELESS=y -CONFIG_WIRELESS_EXT=y -# CONFIG_WIRELESS_EXT_SYSFS is not set -# CONFIG_WL1251 is not set -# CONFIG_WL12XX is not set -# CONFIG_WL18XX is not set -# CONFIG_WLAGS49_H2 is not set -# CONFIG_WLAGS49_H25 is not set -CONFIG_WLAN=y -# CONFIG_WLCORE is not set -CONFIG_WL_TI=y -CONFIG_WQ_POWER_EFFICIENT_DEFAULT=y -# CONFIG_WR_PPMC is not set -# CONFIG_X25 is not set -# CONFIG_X86_DEBUG_STATIC_CPU_HAS is not set -# CONFIG_X86_PKG_TEMP_THERMAL is not set -CONFIG_X86_SYSFB=y -# CONFIG_XEN is not set -CONFIG_XFRM=y -# CONFIG_XFRM_IPCOMP is not set -# CONFIG_XFRM_MIGRATE is not set -# CONFIG_XFRM_STATISTICS is not set -# CONFIG_XFRM_SUB_POLICY is not set -# CONFIG_XFRM_USER is not set -# CONFIG_XFS_DEBUG is not set -# CONFIG_XFS_FS is not set -# CONFIG_XFS_POSIX_ACL is not set -# CONFIG_XFS_QUOTA is not set -# CONFIG_XFS_RT is not set -# CONFIG_XFS_WARN is not set -# CONFIG_XILINX_AXI_EMAC is not set -# CONFIG_XILINX_EMACLITE is not set -# CONFIG_XILINX_LL_TEMAC is not set -# CONFIG_XILINX_WATCHDOG is not set -# CONFIG_XILLYBUS is not set -# CONFIG_XIP_KERNEL is not set -# CONFIG_XMON is not set -# CONFIG_XVMALLOC is not set -CONFIG_XZ_DEC=y -# CONFIG_XZ_DEC_ARM is not set -# CONFIG_XZ_DEC_ARMTHUMB is not set -# CONFIG_XZ_DEC_BCJ is not set -# CONFIG_XZ_DEC_IA64 is not set -# CONFIG_XZ_DEC_POWERPC is not set -# CONFIG_XZ_DEC_SPARC is not set -# CONFIG_XZ_DEC_TEST is not set -# CONFIG_XZ_DEC_X86 is not set -# CONFIG_YAM is not set -# CONFIG_YELLOWFIN is not set -# CONFIG_YENTA is not set -# CONFIG_YENTA_O2 is not set -# CONFIG_YENTA_RICOH is not set -# CONFIG_YENTA_TI is not set -# CONFIG_YENTA_TOSHIBA is not set -# CONFIG_ZBUD is not set -# CONFIG_ZD1211RW is not set -# CONFIG_ZD1211RW_DEBUG is not set -# CONFIG_ZEROPLUS_FF is not set -# CONFIG_ZISOFS is not set -# CONFIG_ZLIB_DEFLATE is not set -# CONFIG_ZLIB_INFLATE is not set -# CONFIG_ZNET is not set -CONFIG_ZONE_DMA=y -CONFIG_ZONE_DMA_FLAG=1 -# CONFIG_ZPOOL is not set -# CONFIG_ZRAM is not set -# CONFIG_ZRAM_LZ4_COMPRESS is not set -# CONFIG_ZSMALLOC is not set diff --git a/target/linux/generic/config-4.14 b/target/linux/generic/config-4.14 index cabdd9d01d..8aaa54b8ff 100644 --- a/target/linux/generic/config-4.14 +++ b/target/linux/generic/config-4.14 @@ -285,6 +285,7 @@ CONFIG_ARCH_MMAP_RND_COMPAT_BITS_MIN=8 # CONFIG_ARM64_ERRATUM_845719 is not set # CONFIG_ARM64_ERRATUM_858921 is not set # CONFIG_ARM64_RELOC_TEST is not set +CONFIG_ARM64_SW_TTBR0_PAN=y # CONFIG_ARM_APPENDED_DTB is not set # CONFIG_ARM_ARCH_TIMER is not set # CONFIG_ARM_BIG_LITTLE_CPUFREQ is not set @@ -728,11 +729,13 @@ CONFIG_CC_STACKPROTECTOR_NONE=y # CONFIG_CDROM_PKTCDVD is not set # CONFIG_CEPH_FS is not set # CONFIG_CEPH_LIB is not set +# CONFIG_CFQ_GROUP_IOSCHED is not set # CONFIG_CFG80211 is not set # CONFIG_CFG80211_CERTIFICATION_ONUS is not set # CONFIG_CGROUPS is not set # CONFIG_CGROUP_BPF is not set # CONFIG_CGROUP_DEBUG is not set +# CONFIG_CGROUP_HUGETLB is not set # CONFIG_CGROUP_NET_CLASSID is not set # CONFIG_CGROUP_NET_PRIO is not set # CONFIG_CGROUP_RDMA is not set @@ -818,6 +821,7 @@ CONFIG_CMDLINE="" # CONFIG_COMMON_CLK_XLNX_CLKWZRD is not set CONFIG_COMPACTION=y # CONFIG_COMPAL_LAPTOP is not set +# CONFIG_COMPAT is not set # CONFIG_COMPAT_BRK is not set # CONFIG_COMPILE_TEST is not set # CONFIG_CONFIGFS_FS is not set @@ -900,6 +904,8 @@ CONFIG_CRYPTO_BLKCIPHER2=y # CONFIG_CRYPTO_DEFLATE is not set # CONFIG_CRYPTO_DES is not set # CONFIG_CRYPTO_DEV_ATMEL_AES is not set +# CONFIG_CRYPTO_DEV_ATMEL_AUTHENC is not set +# CONFIG_CRYPTO_DEV_ATMEL_ECC is not set # CONFIG_CRYPTO_DEV_ATMEL_SHA is not set # CONFIG_CRYPTO_DEV_ATMEL_TDES is not set # CONFIG_CRYPTO_DEV_CAVIUM_ZIP is not set @@ -1049,12 +1055,10 @@ CONFIG_DEBUG_KERNEL=y # CONFIG_DEBUG_PINCTRL is not set # CONFIG_DEBUG_PI_LIST is not set # CONFIG_DEBUG_PREEMPT is not set -# CONFIG_DEBUG_RODATA is not set # CONFIG_DEBUG_RODATA_TEST is not set # CONFIG_DEBUG_RT_MUTEXES is not set # CONFIG_DEBUG_SECTION_MISMATCH is not set # CONFIG_DEBUG_SEMIHOSTING is not set -# CONFIG_DEBUG_SET_MODULE_RONX is not set # CONFIG_DEBUG_SG is not set # CONFIG_DEBUG_SHIRQ is not set # CONFIG_DEBUG_SLAB is not set @@ -1151,7 +1155,6 @@ CONFIG_DOUBLEFAULT=y CONFIG_DQL=y # CONFIG_DRAGONRISE_FF is not set # CONFIG_DRM is not set -# CONFIG_DRM_I915 is not set # CONFIG_DRM_AMDGPU is not set # CONFIG_DRM_AMDGPU_CIK is not set # CONFIG_DRM_AMDGPU_GART_DEBUGFS is not set @@ -1181,6 +1184,7 @@ CONFIG_DQL=y # CONFIG_DRM_I2C_CH7006 is not set # CONFIG_DRM_I2C_NXP_TDA998X is not set # CONFIG_DRM_I2C_SIL164 is not set +# CONFIG_DRM_I915 is not set # CONFIG_DRM_LEGACY is not set # CONFIG_DRM_LIB_RANDOM is not set # CONFIG_DRM_LOAD_EDID_FIRMWARE is not set @@ -1222,6 +1226,7 @@ CONFIG_DQL=y # CONFIG_DRM_UDL is not set # CONFIG_DRM_VBOXVIDEO is not set # CONFIG_DRM_VGEM is not set +# CONFIG_DRM_VIRTIO_GPU is not set # CONFIG_DRM_VMWGFX is not set # CONFIG_DS1682 is not set # CONFIG_DS1803 is not set @@ -1353,8 +1358,8 @@ CONFIG_FAT_DEFAULT_IOCHARSET="iso8859-1" # CONFIG_FB_CYBER2000 is not set # CONFIG_FB_DA8XX is not set # CONFIG_FB_DDC is not set -# CONFIG_FB_FOREIGN_ENDIAN is not set # CONFIG_FB_FLEX is not set +# CONFIG_FB_FOREIGN_ENDIAN is not set # CONFIG_FB_GEODE is not set # CONFIG_FB_GOLDFISH is not set # CONFIG_FB_HGA is not set @@ -1592,7 +1597,8 @@ CONFIG_GENERIC_NET_UTILS=y # CONFIG_HAMACHI is not set # CONFIG_HAMRADIO is not set # CONFIG_HAPPYMEAL is not set -# CONFIG_HARDENED_USERCOPY is not set +CONFIG_HARDENED_USERCOPY=y +# CONFIG_HARDENED_USERCOPY_PAGESPAN is not set # CONFIG_HARDLOCKUP_DETECTOR is not set # CONFIG_HAVE_AOUT is not set CONFIG_HAVE_ARCH_HARDENED_USERCOPY=y @@ -1766,6 +1772,7 @@ CONFIG_HW_PERF_EVENTS=y # CONFIG_HW_RANDOM_GEODE is not set # CONFIG_HW_RANDOM_INTEL is not set # CONFIG_HW_RANDOM_IPROC_RNG200 is not set +# CONFIG_HW_RANDOM_OMAP is not set # CONFIG_HW_RANDOM_OMAP3_ROM is not set # CONFIG_HW_RANDOM_PPC4XX is not set # CONFIG_HW_RANDOM_TIMERIOMEM is not set @@ -2280,6 +2287,7 @@ CONFIG_KERNFS=y # CONFIG_KEYBOARD_SUNKBD is not set # CONFIG_KEYBOARD_TCA6416 is not set # CONFIG_KEYBOARD_TCA8418 is not set +# CONFIG_KEYBOARD_TEGRA is not set # CONFIG_KEYBOARD_TM2_TOUCHKEY is not set # CONFIG_KEYBOARD_TWL4030 is not set # CONFIG_KEYBOARD_XTKBD is not set @@ -2325,6 +2333,7 @@ CONFIG_LBDAF=y # CONFIG_LCD_S6E63M0 is not set # CONFIG_LCD_TDO24M is not set # CONFIG_LCD_VGG2432A4 is not set +CONFIG_LDISC_AUTOLOAD=y # CONFIG_LDM_PARTITION is not set CONFIG_LD_DEAD_CODE_DATA_ELIMINATION=y # CONFIG_LEDS_BCM6328 is not set @@ -3335,6 +3344,7 @@ CONFIG_NMI_LOG_BUF_SHIFT=13 # CONFIG_NOP_USB_XCEIV is not set # CONFIG_NORTEL_HERMES is not set # CONFIG_NOTIFIER_ERROR_INJECTION is not set +# CONFIG_NOUVEAU_LEGACY_CTX_SUPPORT is not set # CONFIG_NOZOMI is not set # CONFIG_NO_BOOTMEM is not set # CONFIG_NO_HZ is not set @@ -3372,7 +3382,7 @@ CONFIG_NMI_LOG_BUF_SHIFT=13 # CONFIG_OPROFILE is not set # CONFIG_OPROFILE_EVENT_MULTIPLEX is not set # CONFIG_OPT3001 is not set -# CONFIG_OPTIMIZE_INLINING is not set +CONFIG_OPTIMIZE_INLINING=y # CONFIG_ORANGEFS_FS is not set # CONFIG_ORION_WATCHDOG is not set # CONFIG_OSF_PARTITION is not set @@ -4986,8 +4996,8 @@ CONFIG_TMPFS_XATTR=y # CONFIG_TOSHIBA_HAPS is not set # CONFIG_TOUCHSCREEN_88PM860X is not set # CONFIG_TOUCHSCREEN_AD7877 is not set -# CONFIG_TOUCHSCREEN_AD7879_I2C is not set # CONFIG_TOUCHSCREEN_AD7879 is not set +# CONFIG_TOUCHSCREEN_AD7879_I2C is not set # CONFIG_TOUCHSCREEN_AD7879_SPI is not set # CONFIG_TOUCHSCREEN_ADS7846 is not set # CONFIG_TOUCHSCREEN_AR1021_I2C is not set @@ -5061,8 +5071,8 @@ CONFIG_TMPFS_XATTR=y # CONFIG_TOUCHSCREEN_TS4800 is not set # CONFIG_TOUCHSCREEN_TSC2004 is not set # CONFIG_TOUCHSCREEN_TSC2005 is not set -# CONFIG_TOUCHSCREEN_TSC2007_IIO is not set # CONFIG_TOUCHSCREEN_TSC2007 is not set +# CONFIG_TOUCHSCREEN_TSC2007_IIO is not set # CONFIG_TOUCHSCREEN_TSC200X_CORE is not set # CONFIG_TOUCHSCREEN_TSC_SERIO is not set # CONFIG_TOUCHSCREEN_UCB1400 is not set @@ -5093,8 +5103,8 @@ CONFIG_TMPFS_XATTR=y # CONFIG_TOUCHSCREEN_WM9705 is not set # CONFIG_TOUCHSCREEN_WM9712 is not set # CONFIG_TOUCHSCREEN_WM9713 is not set -# CONFIG_TOUCHSCREEN_WM97XX_ATMEL is not set # CONFIG_TOUCHSCREEN_WM97XX is not set +# CONFIG_TOUCHSCREEN_WM97XX_ATMEL is not set # CONFIG_TOUCHSCREEN_WM97XX_MAINSTONE is not set # CONFIG_TOUCHSCREEN_WM97XX_ZYLONITE is not set # CONFIG_TOUCHSCREEN_ZET6223 is not set @@ -5159,7 +5169,7 @@ CONFIG_UNIX98_PTYS=y # CONFIG_UNIX_DIAG is not set # CONFIG_UNUSED_SYMBOLS is not set # CONFIG_UPROBES is not set -# CONFIG_UPROBE_EVENT is not set +# CONFIG_UPROBE_EVENTS is not set # CONFIG_US5182D is not set # CONFIG_USB is not set # CONFIG_USBIP_CORE is not set @@ -5498,6 +5508,7 @@ CONFIG_USB_VIDEO_CLASS_INPUT_EVDEV=y # CONFIG_USB_WUSB is not set # CONFIG_USB_WUSB_CBAF is not set # CONFIG_USB_XHCI_HCD is not set +# CONFIG_USB_XHCI_TEGRA is not set # CONFIG_USB_XUSBATM is not set # CONFIG_USB_YUREX is not set # CONFIG_USB_ZD1201 is not set diff --git a/target/linux/generic/config-4.19 b/target/linux/generic/config-4.19 deleted file mode 100644 index 288c2c5836..0000000000 --- a/target/linux/generic/config-4.19 +++ /dev/null @@ -1,6063 +0,0 @@ -# CONFIG_104_QUAD_8 is not set -CONFIG_32BIT=y -# CONFIG_6LOWPAN is not set -# CONFIG_6LOWPAN_DEBUGFS is not set -# CONFIG_6PACK is not set -# CONFIG_8139CP is not set -# CONFIG_8139TOO is not set -# CONFIG_9P_FS is not set -# CONFIG_AB3100_CORE is not set -# CONFIG_AB8500_CORE is not set -# CONFIG_ABP060MG is not set -# CONFIG_ABX500_CORE is not set -# CONFIG_ACCESSIBILITY is not set -# CONFIG_ACENIC is not set -# CONFIG_ACERHDF is not set -# CONFIG_ACER_WIRELESS is not set -# CONFIG_ACORN_PARTITION is not set -# CONFIG_ACPI_ALS is not set -# CONFIG_ACPI_APEI is not set -# CONFIG_ACPI_BUTTON is not set -# CONFIG_ACPI_CONFIGFS is not set -# CONFIG_ACPI_CUSTOM_METHOD is not set -# CONFIG_ACPI_EXTLOG is not set -# CONFIG_ACPI_HED is not set -# CONFIG_ACPI_NFIT is not set -# CONFIG_ACPI_REDUCED_HARDWARE_ONLY is not set -# CONFIG_ACPI_TABLE_UPGRADE is not set -# CONFIG_ACPI_VIDEO is not set -# CONFIG_AD2S1200 is not set -# CONFIG_AD2S1210 is not set -# CONFIG_AD2S90 is not set -# CONFIG_AD5064 is not set -# CONFIG_AD525X_DPOT is not set -# CONFIG_AD5272 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_AD5592R is not set -# CONFIG_AD5593R is not set -# CONFIG_AD5624R_SPI is not set -# CONFIG_AD5686 is not set -# CONFIG_AD5686_SPI is not set -# CONFIG_AD5696_I2C is not set -# CONFIG_AD5755 is not set -# CONFIG_AD5758 is not set -# CONFIG_AD5761 is not set -# CONFIG_AD5764 is not set -# CONFIG_AD5791 is not set -# CONFIG_AD5933 is not set -# CONFIG_AD7150 is not set -# CONFIG_AD7152 is not set -# CONFIG_AD7192 is not set -# CONFIG_AD7266 is not set -# CONFIG_AD7280 is not set -# CONFIG_AD7291 is not set -# CONFIG_AD7298 is not set -# CONFIG_AD7303 is not set -# CONFIG_AD7476 is not set -# CONFIG_AD7606 is not set -# CONFIG_AD7746 is not set -# CONFIG_AD7766 is not set -# CONFIG_AD7780 is not set -# CONFIG_AD7791 is not set -# CONFIG_AD7793 is not set -# CONFIG_AD7816 is not set -# CONFIG_AD7887 is not set -# CONFIG_AD7923 is not set -# CONFIG_AD799X is not set -# CONFIG_AD8366 is not set -# CONFIG_AD8801 is not set -# CONFIG_AD9523 is not set -# CONFIG_AD9832 is not set -# CONFIG_AD9834 is not set -# CONFIG_ADAPTEC_STARFIRE is not set -# 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 -# CONFIG_ADF4350 is not set -# CONFIG_ADFS_FS is not set -# CONFIG_ADIS16060 is not set -# CONFIG_ADIS16080 is not set -# CONFIG_ADIS16130 is not set -# CONFIG_ADIS16136 is not set -# 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_ADIS16260 is not set -# CONFIG_ADIS16400 is not set -# CONFIG_ADIS16480 is not set -# CONFIG_ADJD_S311 is not set -# CONFIG_ADM6996_PHY is not set -# CONFIG_ADM8211 is not set -# CONFIG_ADT7316 is not set -CONFIG_ADVISE_SYSCALLS=y -# CONFIG_ADXL345_I2C is not set -# CONFIG_ADXL345_SPI is not set -# CONFIG_ADXRS450 is not set -CONFIG_AEABI=y -# CONFIG_AFE4403 is not set -# CONFIG_AFE4404 is not set -# CONFIG_AFFS_FS is not set -# CONFIG_AFS_FS is not set -# CONFIG_AF_KCM is not set -# CONFIG_AF_RXRPC is not set -# CONFIG_AF_RXRPC_INJECT_LOSS is not set -# CONFIG_AF_RXRPC_IPV6 is not set -# CONFIG_AGP is not set -# CONFIG_AHCI_CEVA is not set -# CONFIG_AHCI_IMX is not set -# CONFIG_AHCI_MVEBU is not set -# CONFIG_AHCI_QORIQ is not set -CONFIG_AIO=y -# CONFIG_AIRO is not set -# CONFIG_AIRO_CS is not set -# CONFIG_AIX_PARTITION is not set -# CONFIG_AK09911 is not set -# CONFIG_AK8974 is not set -# CONFIG_AK8975 is not set -# CONFIG_AL3320A is not set -# CONFIG_ALIM7101_WDT is not set -CONFIG_ALLOW_DEV_COREDUMP=y -# CONFIG_ALTERA_MBOX is not set -# CONFIG_ALTERA_MSGDMA is not set -# CONFIG_ALTERA_STAPL is not set -# CONFIG_ALTERA_TSE is not set -# CONFIG_ALX is not set -# CONFIG_AM2315 is not set -# CONFIG_AM335X_PHY_USB is not set -# CONFIG_AMBA_PL08X is not set -# CONFIG_AMD8111_ETH is not set -# CONFIG_AMD_MEM_ENCRYPT is not set -# CONFIG_AMD_PHY is not set -# CONFIG_AMD_XGBE is not set -# CONFIG_AMD_XGBE_HAVE_ECC is not set -# CONFIG_AMIGA_PARTITION is not set -# CONFIG_AMILO_RFKILL is not set -# CONFIG_ANDROID is not set -CONFIG_ANON_INODES=y -# CONFIG_APDS9300 is not set -# CONFIG_APDS9802ALS is not set -# CONFIG_APDS9960 is not set -# CONFIG_APM8018X is not set -# CONFIG_APM_EMULATION is not set -# CONFIG_APPLE_GMUX is not set -# CONFIG_APPLE_PROPERTIES is not set -# CONFIG_APPLICOM is not set -# CONFIG_AQTION is not set -# CONFIG_AQUANTIA_PHY is not set -# CONFIG_AR5523 is not set -# CONFIG_AR7 is not set -# CONFIG_AR8216_PHY is not set -# CONFIG_AR8216_PHY_LEDS is not set -# CONFIG_ARCH_ACTIONS is not set -# CONFIG_ARCH_ALPINE is not set -# CONFIG_ARCH_ARTPEC is not set -# CONFIG_ARCH_ASPEED is not set -# CONFIG_ARCH_AT91 is not set -# CONFIG_ARCH_BCM is not set -# CONFIG_ARCH_BCM2835 is not set -# CONFIG_ARCH_BCM_21664 is not set -# CONFIG_ARCH_BCM_23550 is not set -# CONFIG_ARCH_BCM_281XX is not set -# CONFIG_ARCH_BCM_5301X is not set -# CONFIG_ARCH_BCM_53573 is not set -# CONFIG_ARCH_BCM_63XX is not set -# CONFIG_ARCH_BCM_CYGNUS is not set -# CONFIG_ARCH_BCM_IPROC is not set -# CONFIG_ARCH_BCM_NSP is not set -# CONFIG_ARCH_BERLIN is not set -# CONFIG_ARCH_BRCMSTB is not set -# CONFIG_ARCH_CLPS711X is not set -# CONFIG_ARCH_CNS3XXX is not set -# CONFIG_ARCH_DAVINCI is not set -# CONFIG_ARCH_DIGICOLOR is not set -# CONFIG_ARCH_DMA_ADDR_T_64BIT is not set -# CONFIG_ARCH_DOVE is not set -# CONFIG_ARCH_EBSA110 is not set -# CONFIG_ARCH_EP93XX is not set -# CONFIG_ARCH_EXYNOS is not set -CONFIG_ARCH_FLATMEM_ENABLE=y -# CONFIG_ARCH_FOOTBRIDGE is not set -# CONFIG_ARCH_GEMINI is not set -CONFIG_ARCH_HAS_DEVMEM_IS_ALLOWED=y -# CONFIG_ARCH_HAS_ILOG2_U32 is not set -# CONFIG_ARCH_HAS_ILOG2_U64 is not set -CONFIG_ARCH_HAS_UBSAN_SANITIZE_ALL=y -# CONFIG_ARCH_HI3xxx is not set -# CONFIG_ARCH_HIGHBANK is not set -# CONFIG_ARCH_HISI is not set -# CONFIG_ARCH_INTEGRATOR 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_K3 is not set -# CONFIG_ARCH_KEYSTONE is not set -# CONFIG_ARCH_KS8695 is not set -# CONFIG_ARCH_LAYERSCAPE is not set -# CONFIG_ARCH_LG1K is not set -# CONFIG_ARCH_LPC32XX is not set -# CONFIG_ARCH_MEDIATEK is not set -# CONFIG_ARCH_MESON is not set -CONFIG_ARCH_MMAP_RND_BITS=8 -CONFIG_ARCH_MMAP_RND_BITS_MAX=16 -CONFIG_ARCH_MMAP_RND_BITS_MIN=8 -CONFIG_ARCH_MMAP_RND_COMPAT_BITS_MAX=16 -CONFIG_ARCH_MMAP_RND_COMPAT_BITS_MIN=8 -# CONFIG_ARCH_MMP is not set -# CONFIG_ARCH_MULTIPLATFORM is not set -# CONFIG_ARCH_MULTI_V6 is not set -# CONFIG_ARCH_MULTI_V7 is not set -# CONFIG_ARCH_MV78XX0 is not set -# CONFIG_ARCH_MVEBU is not set -# CONFIG_ARCH_MXC is not set -# CONFIG_ARCH_MXS is not set -# CONFIG_ARCH_NEEDS_CPU_IDLE_COUPLED is not set -# CONFIG_ARCH_NETX is not set -# CONFIG_ARCH_NOMADIK is not set -# CONFIG_ARCH_NPCM is not set -# CONFIG_ARCH_NSPIRE is not set -# CONFIG_ARCH_OMAP is not set -# CONFIG_ARCH_OMAP1 is not set -# CONFIG_ARCH_OMAP2 is not set -# CONFIG_ARCH_OMAP2PLUS is not set -# CONFIG_ARCH_OMAP3 is not set -# CONFIG_ARCH_OMAP4 is not set -# CONFIG_ARCH_ORION5X is not set -# CONFIG_ARCH_OXNAS is not set -# CONFIG_ARCH_PHYS_ADDR_T_64BIT is not set -# CONFIG_ARCH_PICOXCELL is not set -# CONFIG_ARCH_PRIMA2 is not set -# CONFIG_ARCH_PXA is not set -# CONFIG_ARCH_QCOM is not set -# CONFIG_ARCH_REALTEK is not set -# CONFIG_ARCH_REALVIEW is not set -# CONFIG_ARCH_RENESAS is not set -# CONFIG_ARCH_ROCKCHIP is not set -# CONFIG_ARCH_RPC is not set -# CONFIG_ARCH_S3C24XX is not set -# CONFIG_ARCH_S3C64XX is not set -# CONFIG_ARCH_S5PV210 is not set -# CONFIG_ARCH_SA1100 is not set -# CONFIG_ARCH_SEATTLE is not set -# CONFIG_ARCH_SHMOBILE is not set -# CONFIG_ARCH_SHMOBILE_MULTI is not set -# CONFIG_ARCH_SIRF is not set -# CONFIG_ARCH_SOCFPGA is not set -# CONFIG_ARCH_SPRD is not set -# CONFIG_ARCH_STI is not set -# CONFIG_ARCH_STM32 is not set -# CONFIG_ARCH_STRATIX10 is not set -# CONFIG_ARCH_SUNXI is not set -# CONFIG_ARCH_SYNQUACER is not set -# CONFIG_ARCH_TANGO is not set -# CONFIG_ARCH_TEGRA is not set -# CONFIG_ARCH_THUNDER is not set -# CONFIG_ARCH_THUNDER2 is not set -# CONFIG_ARCH_U300 is not set -# CONFIG_ARCH_U8500 is not set -# CONFIG_ARCH_UNIPHIER is not set -# CONFIG_ARCH_VERSATILE is not set -# CONFIG_ARCH_VEXPRESS is not set -# CONFIG_ARCH_VIRT is not set -# CONFIG_ARCH_VT8500 is not set -# CONFIG_ARCH_VULCAN is not set -# CONFIG_ARCH_W90X900 is not set -# CONFIG_ARCH_WANTS_THP_SWAP is not set -# CONFIG_ARCH_WANTS_UBSAN_NO_NULL is not set -# CONFIG_ARCH_WM8505 is not set -# CONFIG_ARCH_WM8750 is not set -# CONFIG_ARCH_WM8850 is not set -# CONFIG_ARCH_XGENE is not set -# CONFIG_ARCH_ZX is not set -# CONFIG_ARCH_ZYNQ is not set -# CONFIG_ARCH_ZYNQMP is not set -# CONFIG_ARCNET is not set -# CONFIG_ARC_EMAC is not set -# CONFIG_ARM64_ERRATUM_1024718 is not set -# CONFIG_ARM64_ERRATUM_819472 is not set -# CONFIG_ARM64_ERRATUM_824069 is not set -# CONFIG_ARM64_ERRATUM_826319 is not set -# CONFIG_ARM64_ERRATUM_827319 is not set -# CONFIG_ARM64_ERRATUM_832075 is not set -# CONFIG_ARM64_ERRATUM_834220 is not set -# CONFIG_ARM64_ERRATUM_843419 is not set -# CONFIG_ARM64_ERRATUM_845719 is not set -# CONFIG_ARM64_ERRATUM_858921 is not set -# CONFIG_ARM64_RAS_EXTN is not set -# CONFIG_ARM64_RELOC_TEST is not set -# CONFIG_ARM_APPENDED_DTB is not set -# CONFIG_ARM_ARCH_TIMER is not set -# CONFIG_ARM_BIG_LITTLE_CPUFREQ is not set -# CONFIG_ARM_CCI is not set -# CONFIG_ARM_CCI400_PMU is not set -# CONFIG_ARM_CCI5xx_PMU is not set -# CONFIG_ARM_CCI_PMU is not set -# CONFIG_ARM_CCN is not set -# CONFIG_ARM_CPUIDLE is not set -CONFIG_ARM_CPU_TOPOLOGY=y -# CONFIG_ARM_CRYPTO is not set -CONFIG_ARM_DMA_MEM_BUFFERABLE=y -# CONFIG_ARM_DSU_PMU is not set -# CONFIG_ARM_ERRATA_326103 is not set -# CONFIG_ARM_ERRATA_364296 is not set -# CONFIG_ARM_ERRATA_411920 is not set -# CONFIG_ARM_ERRATA_430973 is not set -# CONFIG_ARM_ERRATA_458693 is not set -# CONFIG_ARM_ERRATA_460075 is not set -# CONFIG_ARM_ERRATA_643719 is not set -# CONFIG_ARM_ERRATA_720789 is not set -# CONFIG_ARM_ERRATA_742230 is not set -# CONFIG_ARM_ERRATA_742231 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_773022 is not set -# CONFIG_ARM_ERRATA_775420 is not set -# CONFIG_ARM_ERRATA_798181 is not set -# CONFIG_ARM_ERRATA_818325_852422 is not set -# CONFIG_ARM_ERRATA_821420 is not set -# CONFIG_ARM_ERRATA_825619 is not set -# CONFIG_ARM_ERRATA_852421 is not set -# CONFIG_ARM_ERRATA_852423 is not set -CONFIG_ARM_GIC_MAX_NR=1 -# CONFIG_ARM_KERNMEM_PERMS is not set -# CONFIG_ARM_KIRKWOOD_CPUFREQ is not set -# CONFIG_ARM_KPROBES_TEST is not set -# CONFIG_ARM_MHU is not set -# CONFIG_ARM_MODULE_PLTS is not set -# CONFIG_ARM_PATCH_PHYS_VIRT is not set -# CONFIG_ARM_PSCI is not set -# CONFIG_ARM_PSCI_CHECKER is not set -# CONFIG_ARM_PTDUMP is not set -# CONFIG_ARM_PTDUMP_DEBUGFS is not set -# CONFIG_ARM_SBSA_WATCHDOG is not set -# CONFIG_ARM_SCPI_PROTOCOL is not set -# CONFIG_ARM_SDE_INTERFACE is not set -# CONFIG_ARM_SPE_PMU is not set -# CONFIG_ARM_TIMER_SP804 is not set -# CONFIG_ARM_UNWIND is not set -# CONFIG_ARM_VIRT_EXT is not set -# CONFIG_AS3935 is not set -# CONFIG_ASIX_PHY is not set -# CONFIG_ASM9260_TIMER is not set -# CONFIG_ASUS_LAPTOP is not set -# CONFIG_ASUS_WIRELESS is not set -# CONFIG_ASYMMETRIC_KEY_TYPE is not set -# CONFIG_ASYMMETRIC_PUBLIC_KEY_SUBTYPE is not set -# CONFIG_ASYNC_RAID6_TEST is not set -# CONFIG_ASYNC_TX_DMA is not set -# CONFIG_AT76C50X_USB is not set -# CONFIG_AT803X_PHY is not set -# CONFIG_AT91_SAMA5D2_ADC is not set -# CONFIG_ATA is not set -# CONFIG_ATAGS is not set -CONFIG_ATAGS_PROC=y -# CONFIG_ATALK is not set -# CONFIG_ATARI_PARTITION is not set -# CONFIG_ATA_ACPI is not set -CONFIG_ATA_BMDMA=y -# CONFIG_ATA_GENERIC is not set -# CONFIG_ATA_NONSTANDARD is not set -# CONFIG_ATA_OVER_ETH is not set -# CONFIG_ATA_PIIX is not set -CONFIG_ATA_SFF=y -# CONFIG_ATA_VERBOSE_ERROR is not set -# CONFIG_ATH10K is not set -# CONFIG_ATH25 is not set -# CONFIG_ATH5K is not set -# CONFIG_ATH6KL is not set -# CONFIG_ATH79 is not set -# CONFIG_ATH9K is not set -# CONFIG_ATH9K_HTC is not set -# CONFIG_ATH_DEBUG is not set -# CONFIG_ATL1 is not set -# CONFIG_ATL1C is not set -# CONFIG_ATL1E is not set -# CONFIG_ATL2 is not set -# CONFIG_ATLAS_PH_SENSOR is not set -# CONFIG_ATM is not set -# CONFIG_ATMEL is not set -# CONFIG_ATMEL_PIT is not set -# CONFIG_ATMEL_SSC is not set -# CONFIG_ATM_AMBASSADOR is not set -# CONFIG_ATM_BR2684 is not set -CONFIG_ATM_BR2684_IPFILTER=y -# CONFIG_ATM_CLIP is not set -CONFIG_ATM_CLIP_NO_ICMP=y -# CONFIG_ATM_DRIVERS is not set -# CONFIG_ATM_DUMMY is not set -# CONFIG_ATM_ENI is not set -# CONFIG_ATM_FIRESTREAM is not set -# CONFIG_ATM_FORE200E is not set -# CONFIG_ATM_HE is not set -# CONFIG_ATM_HORIZON is not set -# CONFIG_ATM_IA is not set -# CONFIG_ATM_IDT77252 is not set -# CONFIG_ATM_LANAI is not set -# CONFIG_ATM_LANE is not set -# CONFIG_ATM_MPOA is not set -# CONFIG_ATM_NICSTAR is not set -# CONFIG_ATM_SOLOS is not set -# CONFIG_ATM_TCP is not set -# CONFIG_ATM_ZATM is not set -# CONFIG_ATOMIC64_SELFTEST is not set -# CONFIG_ATP is not set -# CONFIG_AUDIT is not set -# CONFIG_AUDIT_ARCH_COMPAT_GENERIC is not set -# CONFIG_AURORA_NB8800 is not set -# CONFIG_AUTOFS4_FS is not set -# CONFIG_AUTOFS_FS is not set -# CONFIG_AUTO_ZRELADDR is not set -# CONFIG_AUXDISPLAY is not set -# CONFIG_AX25 is not set -# CONFIG_AX25_DAMA_SLAVE is not set -# CONFIG_AX88796 is not set -# CONFIG_AXP20X_ADC is not set -# CONFIG_AXP20X_POWER is not set -# CONFIG_AXP288_ADC is not set -# CONFIG_AXP288_FUEL_GAUGE is not set -# CONFIG_B43 is not set -# CONFIG_B43LEGACY is not set -# CONFIG_B44 is not set -# CONFIG_B53 is not set -# CONFIG_BACKLIGHT_ADP8860 is not set -# CONFIG_BACKLIGHT_ADP8870 is not set -# CONFIG_BACKLIGHT_APPLE is not set -# CONFIG_BACKLIGHT_ARCXCNN is not set -# CONFIG_BACKLIGHT_BD6107 is not set -# CONFIG_BACKLIGHT_GENERIC is not set -# CONFIG_BACKLIGHT_GPIO is not set -# CONFIG_BACKLIGHT_LCD_SUPPORT is not set -# CONFIG_BACKLIGHT_LM3630A is not set -# CONFIG_BACKLIGHT_LM3639 is not set -# CONFIG_BACKLIGHT_LP855X is not set -# CONFIG_BACKLIGHT_LV5207LP is not set -# CONFIG_BACKLIGHT_PANDORA is not set -# CONFIG_BACKLIGHT_PM8941_WLED is not set -# CONFIG_BACKLIGHT_PWM is not set -# CONFIG_BACKLIGHT_RPI is not set -# CONFIG_BACKLIGHT_SAHARA is not set -# CONFIG_BACKTRACE_SELF_TEST is not set -CONFIG_BASE_FULL=y -CONFIG_BASE_SMALL=0 -# CONFIG_BATMAN_ADV is not set -# CONFIG_BATTERY_BQ27XXX is not set -# CONFIG_BATTERY_BQ27XXX_HDQ 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_GAUGE_LTC2941 is not set -# CONFIG_BATTERY_GOLDFISH is not set -# CONFIG_BATTERY_LEGO_EV3 is not set -# CONFIG_BATTERY_MAX17040 is not set -# CONFIG_BATTERY_MAX17042 is not set -# CONFIG_BATTERY_MAX1721X is not set -# CONFIG_BATTERY_SBS is not set -# CONFIG_BAYCOM_EPP is not set -# CONFIG_BAYCOM_PAR is not set -# CONFIG_BAYCOM_SER_FDX is not set -# CONFIG_BAYCOM_SER_HDX is not set -# CONFIG_BCACHE is not set -# CONFIG_BCM47XX is not set -# CONFIG_BCM63XX is not set -# CONFIG_BCM63XX_PHY is not set -# CONFIG_BCM7038_WDT is not set -# CONFIG_BCM7XXX_PHY is not set -# CONFIG_BCM87XX_PHY is not set -# CONFIG_BCMA is not set -# CONFIG_BCMA_DRIVER_GPIO is not set -CONFIG_BCMA_POSSIBLE=y -# CONFIG_BCMGENET is not set -# CONFIG_BCM_IPROC_ADC is not set -# CONFIG_BCM_KONA_USB2_PHY is not set -# CONFIG_BCM_SBA_RAID is not set -# CONFIG_BDI_SWITCH is not set -# CONFIG_BE2ISCSI is not set -# CONFIG_BE2NET is not set -# CONFIG_BEFS_FS is not set -# CONFIG_BFS_FS is not set -# CONFIG_BGMAC is not set -# CONFIG_BH1750 is not set -# CONFIG_BH1780 is not set -# CONFIG_BIG_KEYS is not set -# CONFIG_BIG_LITTLE is not set -# CONFIG_BINARY_PRINTF is not set -# CONFIG_BINFMT_AOUT is not set -CONFIG_BINFMT_ELF=y -# CONFIG_BINFMT_ELF_FDPIC is not set -# CONFIG_BINFMT_FLAT is not set -# CONFIG_BINFMT_MISC is not set -CONFIG_BINFMT_SCRIPT=y -CONFIG_BITREVERSE=y -# CONFIG_BLK_CMDLINE_PARSER is not set -# CONFIG_BLK_CPQ_CISS_DA is not set -# CONFIG_BLK_CPQ_DA is not set -# CONFIG_BLK_DEBUG_FS is not set -CONFIG_BLK_DEV=y -# CONFIG_BLK_DEV_3W_XXXX_RAID is not set -# CONFIG_BLK_DEV_4DRIVES is not set -# CONFIG_BLK_DEV_AEC62XX is not set -# CONFIG_BLK_DEV_ALI14XX is not set -# CONFIG_BLK_DEV_ALI15X3 is not set -# CONFIG_BLK_DEV_AMD74XX is not set -# CONFIG_BLK_DEV_ATIIXP is not set -# CONFIG_BLK_DEV_BSG is not set -# CONFIG_BLK_DEV_BSGLIB is not set -# CONFIG_BLK_DEV_CMD640 is not set -# CONFIG_BLK_DEV_CMD64X is not set -# CONFIG_BLK_DEV_COW_COMMON is not set -# CONFIG_BLK_DEV_CRYPTOLOOP is not set -# CONFIG_BLK_DEV_CS5520 is not set -# CONFIG_BLK_DEV_CS5530 is not set -# CONFIG_BLK_DEV_CS5535 is not set -# CONFIG_BLK_DEV_CS5536 is not set -# CONFIG_BLK_DEV_CY82C693 is not set -# CONFIG_BLK_DEV_DAC960 is not set -# CONFIG_BLK_DEV_DELKIN is not set -# CONFIG_BLK_DEV_DRBD is not set -# CONFIG_BLK_DEV_DTC2278 is not set -# CONFIG_BLK_DEV_FD is not set -# CONFIG_BLK_DEV_GENERIC is not set -# CONFIG_BLK_DEV_HD is not set -# CONFIG_BLK_DEV_HPT366 is not set -# CONFIG_BLK_DEV_HT6560B is not set -# CONFIG_BLK_DEV_IDEACPI is not set -# CONFIG_BLK_DEV_IDECD is not set -# CONFIG_BLK_DEV_IDECS is not set -# CONFIG_BLK_DEV_IDEPCI is not set -# CONFIG_BLK_DEV_IDEPNP is not set -# CONFIG_BLK_DEV_IDETAPE is not set -# CONFIG_BLK_DEV_IDE_AU1XXX is not set -# CONFIG_BLK_DEV_IDE_SATA is not set -CONFIG_BLK_DEV_INITRD=y -# CONFIG_BLK_DEV_INTEGRITY is not set -# CONFIG_BLK_DEV_IO_TRACE is not set -# CONFIG_BLK_DEV_IT8172 is not set -# CONFIG_BLK_DEV_IT8213 is not set -# CONFIG_BLK_DEV_IT821X is not set -# CONFIG_BLK_DEV_JMICRON is not set -# CONFIG_BLK_DEV_LOOP is not set -CONFIG_BLK_DEV_LOOP_MIN_COUNT=8 -# CONFIG_BLK_DEV_NBD is not set -# CONFIG_BLK_DEV_NS87415 is not set -# CONFIG_BLK_DEV_NULL_BLK is not set -# CONFIG_BLK_DEV_NVME is not set -# CONFIG_BLK_DEV_OFFBOARD is not set -# CONFIG_BLK_DEV_OPTI621 is not set -# CONFIG_BLK_DEV_PCIESSD_MTIP32XX is not set -# CONFIG_BLK_DEV_PDC202XX_NEW is not set -# CONFIG_BLK_DEV_PDC202XX_OLD is not set -# CONFIG_BLK_DEV_PIIX is not set -# CONFIG_BLK_DEV_PLATFORM is not set -# CONFIG_BLK_DEV_PMEM is not set -# CONFIG_BLK_DEV_QD65XX is not set -# CONFIG_BLK_DEV_RAM is not set -# CONFIG_BLK_DEV_RBD is not set -# CONFIG_BLK_DEV_RSXX is not set -# CONFIG_BLK_DEV_RZ1000 is not set -# CONFIG_BLK_DEV_SC1200 is not set -# CONFIG_BLK_DEV_SD is not set -# CONFIG_BLK_DEV_SIIMAGE is not set -# CONFIG_BLK_DEV_SIS5513 is not set -# CONFIG_BLK_DEV_SKD is not set -# CONFIG_BLK_DEV_SL82C105 is not set -# CONFIG_BLK_DEV_SLC90E66 is not set -# CONFIG_BLK_DEV_SR is not set -# CONFIG_BLK_DEV_SVWKS is not set -# CONFIG_BLK_DEV_SX8 is not set -# CONFIG_BLK_DEV_TC86C001 is not set -# CONFIG_BLK_DEV_THROTTLING is not set -# CONFIG_BLK_DEV_TRIFLEX is not set -# CONFIG_BLK_DEV_TRM290 is not set -# CONFIG_BLK_DEV_UMC8672 is not set -# CONFIG_BLK_DEV_UMEM is not set -# CONFIG_BLK_DEV_VIA82CXXX is not set -# CONFIG_BLK_DEV_ZONED is not set -# CONFIG_BLK_SED_OPAL is not set -# CONFIG_BLK_WBT is not set -CONFIG_BLOCK=y -# CONFIG_BMA180 is not set -# CONFIG_BMA220 is not set -# CONFIG_BMC150_ACCEL is not set -# CONFIG_BMC150_MAGN is not set -# CONFIG_BMC150_MAGN_I2C is not set -# CONFIG_BMC150_MAGN_SPI is not set -# CONFIG_BME680 is not set -# CONFIG_BMG160 is not set -# CONFIG_BMI160_I2C is not set -# CONFIG_BMI160_SPI is not set -# CONFIG_BMIPS_GENERIC is not set -# CONFIG_BMP085 is not set -# CONFIG_BMP085_I2C is not set -# CONFIG_BMP085_SPI is not set -# CONFIG_BMP280 is not set -# CONFIG_BNA is not set -# CONFIG_BNX2 is not set -# CONFIG_BNX2X is not set -# CONFIG_BNXT is not set -# CONFIG_BONDING is not set -# CONFIG_BOOKE_WDT is not set -CONFIG_BOOKE_WDT_DEFAULT_TIMEOUT=3 -# CONFIG_BOOT_PRINTK_DELAY is not set -CONFIG_BOOT_RAW=y -CONFIG_BPF=y -# CONFIG_BPFILTER is not set -CONFIG_BPF_JIT=y -# CONFIG_BPF_JIT_ALWAYS_ON is not set -# CONFIG_BPF_STREAM_PARSER is not set -CONFIG_BPF_SYSCALL=y -# CONFIG_BPQETHER is not set -CONFIG_BQL=y -CONFIG_BRANCH_PROFILE_NONE=y -# CONFIG_BRCMFMAC is not set -# CONFIG_BRCMSMAC is not set -# CONFIG_BRCMSTB_GISB_ARB is not set -CONFIG_BRIDGE=y -# CONFIG_BRIDGE_EBT_802_3 is not set -# CONFIG_BRIDGE_EBT_AMONG is not set -# CONFIG_BRIDGE_EBT_ARP is not set -# CONFIG_BRIDGE_EBT_ARPREPLY is not set -# CONFIG_BRIDGE_EBT_BROUTE is not set -# CONFIG_BRIDGE_EBT_DNAT is not set -# CONFIG_BRIDGE_EBT_IP is not set -# CONFIG_BRIDGE_EBT_IP6 is not set -# CONFIG_BRIDGE_EBT_LIMIT is not set -# CONFIG_BRIDGE_EBT_LOG is not set -# CONFIG_BRIDGE_EBT_MARK is not set -# CONFIG_BRIDGE_EBT_MARK_T is not set -# CONFIG_BRIDGE_EBT_NFLOG is not set -# CONFIG_BRIDGE_EBT_PKTTYPE is not set -# CONFIG_BRIDGE_EBT_REDIRECT is not set -# CONFIG_BRIDGE_EBT_SNAT is not set -# CONFIG_BRIDGE_EBT_STP is not set -# CONFIG_BRIDGE_EBT_T_FILTER is not set -# CONFIG_BRIDGE_EBT_T_NAT is not set -# CONFIG_BRIDGE_EBT_VLAN is not set -CONFIG_BRIDGE_IGMP_SNOOPING=y -# CONFIG_BRIDGE_NETFILTER is not set -# CONFIG_BRIDGE_NF_EBTABLES is not set -CONFIG_BRIDGE_VLAN_FILTERING=y -# CONFIG_BROADCOM_PHY is not set -CONFIG_BROKEN_ON_SMP=y -# CONFIG_BSD_DISKLABEL is not set -# CONFIG_BSD_PROCESS_ACCT is not set -# CONFIG_BSD_PROCESS_ACCT_V3 is not set -# CONFIG_BT is not set -# CONFIG_BTRFS_ASSERT is not set -# CONFIG_BTRFS_DEBUG is not set -# CONFIG_BTRFS_FS is not set -# CONFIG_BTRFS_FS_POSIX_ACL is not set -# CONFIG_BTRFS_FS_REF_VERIFY is not set -# CONFIG_BTRFS_FS_RUN_SANITY_TESTS is not set -# CONFIG_BT_ATH3K is not set -# CONFIG_BT_BNEP is not set -CONFIG_BT_BNEP_MC_FILTER=y -CONFIG_BT_BNEP_PROTO_FILTER=y -# CONFIG_BT_BREDR is not set -# CONFIG_BT_CMTP is not set -# CONFIG_BT_HCIBCM203X is not set -# CONFIG_BT_HCIBFUSB is not set -# CONFIG_BT_HCIBLUECARD is not set -# CONFIG_BT_HCIBPA10X is not set -# CONFIG_BT_HCIBT3C is not set -# CONFIG_BT_HCIBTSDIO is not set -# CONFIG_BT_HCIBTUART is not set -# CONFIG_BT_HCIBTUSB is not set -# CONFIG_BT_HCIBTUSB_AUTOSUSPEND is not set -# CONFIG_BT_HCIBTUSB_RTL is not set -# CONFIG_BT_HCIDTL1 is not set -# CONFIG_BT_HCIUART is not set -# CONFIG_BT_HCIUART_3WIRE is not set -# CONFIG_BT_HCIUART_AG6XX is not set -# CONFIG_BT_HCIUART_ATH3K is not set -CONFIG_BT_HCIUART_BCSP=y -CONFIG_BT_HCIUART_H4=y -# CONFIG_BT_HCIUART_LL is not set -# CONFIG_BT_HCIUART_MRVL is not set -# CONFIG_BT_HCIUART_QCA is not set -# CONFIG_BT_HCIVHCI is not set -# CONFIG_BT_HIDP is not set -# CONFIG_BT_HS is not set -# CONFIG_BT_LE is not set -# CONFIG_BT_LEDS is not set -# CONFIG_BT_MRVL is not set -# CONFIG_BT_RFCOMM is not set -CONFIG_BT_RFCOMM_TTY=y -# CONFIG_BT_SELFTEST is not set -CONFIG_BUG=y -# CONFIG_BUG_ON_DATA_CORRUPTION is not set -CONFIG_BUILDTIME_EXTABLE_SORT=y -# CONFIG_BUILD_BIN2C is not set -CONFIG_BUILD_SALT="" -# CONFIG_C2PORT is not set -CONFIG_CACHE_L2X0_PMU=y -# CONFIG_CADENCE_WATCHDOG is not set -# CONFIG_CAIF is not set -# CONFIG_CAN is not set -# CONFIG_CAN_BCM is not set -# CONFIG_CAN_DEBUG_DEVICES is not set -# CONFIG_CAN_DEV is not set -# CONFIG_CAN_GS_USB is not set -# CONFIG_CAN_GW is not set -# CONFIG_CAN_HI311X is not set -# CONFIG_CAN_IFI_CANFD is not set -# CONFIG_CAN_MCBA_USB is not set -# CONFIG_CAN_M_CAN is not set -# CONFIG_CAN_PEAK_PCIEFD is not set -# CONFIG_CAN_RAW is not set -# CONFIG_CAN_RCAR is not set -# CONFIG_CAN_RCAR_CANFD is not set -# CONFIG_CAN_SLCAN is not set -# CONFIG_CAN_SUN4I is not set -# CONFIG_CAN_UCAN is not set -# CONFIG_CAN_VCAN is not set -# CONFIG_CAN_VXCAN is not set -# CONFIG_CAPI_AVM is not set -# CONFIG_CAPI_EICON is not set -# CONFIG_CAPI_TRACE is not set -CONFIG_CARDBUS=y -# CONFIG_CARDMAN_4000 is not set -# CONFIG_CARDMAN_4040 is not set -# CONFIG_CARL9170 is not set -# CONFIG_CASSINI is not set -# CONFIG_CAVIUM_CPT is not set -# CONFIG_CAVIUM_ERRATUM_22375 is not set -# CONFIG_CAVIUM_ERRATUM_23144 is not set -# CONFIG_CAVIUM_ERRATUM_23154 is not set -# CONFIG_CAVIUM_ERRATUM_27456 is not set -# CONFIG_CAVIUM_ERRATUM_30115 is not set -# CONFIG_CAVIUM_OCTEON_SOC is not set -# CONFIG_CAVIUM_PTP is not set -# CONFIG_CB710_CORE is not set -# CONFIG_CC10001_ADC is not set -# CONFIG_CCS811 is not set -CONFIG_CC_HAS_SANCOV_TRACE_PC=y -CONFIG_CC_HAS_STACKPROTECTOR_NONE=y -CONFIG_CC_IS_GCC=y -CONFIG_CC_OPTIMIZE_FOR_PERFORMANCE=y -# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set -# CONFIG_CDROM_PKTCDVD is not set -# CONFIG_CEPH_FS is not set -# CONFIG_CEPH_LIB is not set -# CONFIG_CFG80211 is not set -# CONFIG_CFG80211_CERTIFICATION_ONUS is not set -# CONFIG_CGROUPS is not set -# CONFIG_CGROUP_BPF is not set -# CONFIG_CGROUP_DEBUG is not set -# CONFIG_CGROUP_NET_CLASSID is not set -# CONFIG_CGROUP_NET_PRIO is not set -# CONFIG_CGROUP_RDMA is not set -# CONFIG_CHARGER_ADP5061 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_DETECTOR_MAX14656 is not set -# CONFIG_CHARGER_GPIO is not set -# CONFIG_CHARGER_ISP1704 is not set -# CONFIG_CHARGER_LP8727 is not set -# CONFIG_CHARGER_LTC3651 is not set -# CONFIG_CHARGER_MANAGER is not set -# CONFIG_CHARGER_MAX8903 is not set -# CONFIG_CHARGER_RT9455 is not set -# CONFIG_CHARGER_SBS is not set -# CONFIG_CHARGER_SMB347 is not set -# CONFIG_CHARGER_TWL4030 is not set -# CONFIG_CHASH_STATS is not set -# CONFIG_CHASH_SELFTEST is not set -# CONFIG_CHECKPOINT_RESTORE is not set -# CONFIG_CHELSIO_T1 is not set -# CONFIG_CHELSIO_T3 is not set -# CONFIG_CHELSIO_T4 is not set -# CONFIG_CHELSIO_T4VF is not set -# CONFIG_CHROME_PLATFORMS is not set -# CONFIG_CHR_DEV_OSST is not set -# CONFIG_CHR_DEV_SCH is not set -# CONFIG_CHR_DEV_SG is not set -# CONFIG_CHR_DEV_ST is not set -# CONFIG_CICADA_PHY is not set -# CONFIG_CIFS is not set -# CONFIG_CIFS_ACL is not set -CONFIG_CIFS_ALLOW_INSECURE_LEGACY=y -# CONFIG_CIFS_DEBUG is not set -# CONFIG_CIFS_DEBUG2 is not set -# CONFIG_CIFS_FSCACHE is not set -# CONFIG_CIFS_NFSD_EXPORT is not set -CONFIG_CIFS_POSIX=y -# CONFIG_CIFS_SMB2 is not set -CONFIG_CIFS_STATS=y -# CONFIG_CIFS_STATS2 is not set -# CONFIG_CIFS_WEAK_PW_HASH is not set -# CONFIG_CIFS_XATTR is not set -# CONFIG_CIO_DAC is not set -CONFIG_CLANG_VERSION=0 -# CONFIG_CLEANCACHE is not set -# CONFIG_CLKSRC_VERSATILE is not set -# CONFIG_CLK_HSDK is not set -# CONFIG_CLK_QORIQ is not set -# CONFIG_CLOCK_THERMAL is not set -CONFIG_CLS_U32_MARK=y -# CONFIG_CLS_U32_PERF is not set -# CONFIG_CM32181 is not set -# CONFIG_CM3232 is not set -# CONFIG_CM3323 is not set -# CONFIG_CM3605 is not set -# CONFIG_CM36651 is not set -# CONFIG_CMA is not set -CONFIG_CMDLINE="" -# CONFIG_CMDLINE_BOOL is not set -# CONFIG_CMDLINE_EXTEND is not set -# CONFIG_CMDLINE_FORCE is not set -# CONFIG_CMDLINE_FROM_BOOTLOADER is not set -# CONFIG_CMDLINE_PARTITION is not set -# CONFIG_CNIC is not set -# CONFIG_CODA_FS is not set -# CONFIG_CODE_PATCHING_SELFTEST is not set -# CONFIG_COMEDI 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_COMMON_CLK_IPROC is not set -# CONFIG_COMMON_CLK_MAX9485 is not set -# CONFIG_COMMON_CLK_NXP is not set -# CONFIG_COMMON_CLK_PIC32 is not set -# CONFIG_COMMON_CLK_PWM is not set -# CONFIG_COMMON_CLK_PXA is not set -# CONFIG_COMMON_CLK_QCOM is not set -# CONFIG_COMMON_CLK_SI514 is not set -# CONFIG_COMMON_CLK_SI5351 is not set -# CONFIG_COMMON_CLK_SI544 is not set -# CONFIG_COMMON_CLK_SI570 is not set -# CONFIG_COMMON_CLK_VC5 is not set -# CONFIG_COMMON_CLK_VERSATILE is not set -# CONFIG_COMMON_CLK_XGENE is not set -# CONFIG_COMMON_CLK_XLNX_CLKWZRD is not set -CONFIG_COMPACTION=y -# CONFIG_COMPAL_LAPTOP is not set -# CONFIG_COMPAT_BRK is not set -# CONFIG_COMPILE_TEST is not set -# CONFIG_CONFIGFS_FS is not set -# CONFIG_CONFIG_KVM_AMD_SEV is not set -# CONFIG_CONNECTOR is not set -CONFIG_CONSOLE_LOGLEVEL_DEFAULT=7 -CONFIG_CONSOLE_LOGLEVEL_QUIET=4 -CONFIG_CONSTRUCTORS=y -# CONFIG_CONTEXT_SWITCH_TRACER is not set -# CONFIG_COPS is not set -# CONFIG_CORDIC is not set -# CONFIG_COREDUMP is not set -# CONFIG_CORESIGHT is not set -# CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set -# CONFIG_CORTINA_PHY is not set -# CONFIG_CPA_DEBUG is not set -# CONFIG_CPU_DCACHE_DISABLE is not set -# CONFIG_CPU_FREQ is not set -# CONFIG_CPU_FREQ_DEFAULT_GOV_CONSERVATIVE is not set -# CONFIG_CPU_FREQ_DEFAULT_GOV_ONDEMAND is not set -# CONFIG_CPU_FREQ_DEFAULT_GOV_POWERSAVE is not set -# CONFIG_CPU_FREQ_DEFAULT_GOV_SCHEDUTIL is not set -# CONFIG_CPU_FREQ_DEFAULT_GOV_USERSPACE is not set -# CONFIG_CPU_FREQ_GOV_SCHEDUTIL is not set -# CONFIG_CPU_FREQ_STAT_DETAILS is not set -# CONFIG_CPU_IDLE is not set -# CONFIG_CPU_IDLE_GOV_MENU is not set -# CONFIG_CPU_IDLE_MULTIPLE_DRIVERS is not set -# CONFIG_CPU_ISOLATION is not set -# CONFIG_CPU_NO_EFFICIENT_FFS is not set -CONFIG_CPU_SW_DOMAIN_PAN=y -# CONFIG_CRAMFS is not set -CONFIG_CRAMFS_BLOCKDEV=y -# CONFIG_CRAMFS_MTD is not set -CONFIG_CRASHLOG=y -# CONFIG_CRASH_DUMP is not set -# CONFIG_CRC16 is not set -CONFIG_CRC32=y -# CONFIG_CRC32_BIT is not set -CONFIG_CRC32_SARWATE=y -# CONFIG_CRC32_SELFTEST is not set -# CONFIG_CRC32_SLICEBY4 is not set -# CONFIG_CRC32_SLICEBY8 is not set -# CONFIG_CRC4 is not set -# CONFIG_CRC64 is not set -# CONFIG_CRC7 is not set -# CONFIG_CRC8 is not set -# CONFIG_CRC_CCITT is not set -# CONFIG_CRC_ITU_T is not set -# CONFIG_CRC_T10DIF is not set -CONFIG_CROSS_COMPILE="" -# CONFIG_CROSS_MEMORY_ATTACH is not set -CONFIG_CRYPTO=y -# CONFIG_CRYPTO_842 is not set -# CONFIG_CRYPTO_AEAD is not set -# CONFIG_CRYPTO_AEGIS128 is not set -# CONFIG_CRYPTO_AEGIS128L is not set -# CONFIG_CRYPTO_AEGIS128L_AESNI_SSE2 is not set -# CONFIG_CRYPTO_AEGIS128_AESNI_SSE2 is not set -# CONFIG_CRYPTO_AEGIS256 is not set -# CONFIG_CRYPTO_AEGIS256_AESNI_SSE2 is not set -CONFIG_CRYPTO_AES=y -# CONFIG_CRYPTO_AES_586 is not set -# CONFIG_CRYPTO_AES_ARM is not set -# CONFIG_CRYPTO_AES_ARM_BS is not set -# CONFIG_CRYPTO_AES_NI_INTEL is not set -# CONFIG_CRYPTO_AES_TI is not set -CONFIG_CRYPTO_ALGAPI=y -CONFIG_CRYPTO_ALGAPI2=y -# CONFIG_CRYPTO_ANSI_CPRNG is not set -# CONFIG_CRYPTO_ANUBIS is not set -CONFIG_CRYPTO_ARC4=y -# CONFIG_CRYPTO_AUTHENC is not set -CONFIG_CRYPTO_BLKCIPHER=y -CONFIG_CRYPTO_BLKCIPHER2=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_CBC is not set -# CONFIG_CRYPTO_CCM is not set -# CONFIG_CRYPTO_CFB is not set -# CONFIG_CRYPTO_CHACHA20 is not set -# CONFIG_CRYPTO_CHACHA20POLY1305 is not set -# CONFIG_CRYPTO_CMAC is not set -# CONFIG_CRYPTO_CRC32 is not set -# CONFIG_CRYPTO_CRC32C is not set -# CONFIG_CRYPTO_CRC32C_INTEL is not set -# CONFIG_CRYPTO_CRCT10DIF is not set -# CONFIG_CRYPTO_CRYPTD is not set -# CONFIG_CRYPTO_CTR is not set -# CONFIG_CRYPTO_CTS is not set -# CONFIG_CRYPTO_DEFLATE is not set -# CONFIG_CRYPTO_DES is not set -# CONFIG_CRYPTO_DEV_ATMEL_AES is not set -# CONFIG_CRYPTO_DEV_ATMEL_SHA is not set -# CONFIG_CRYPTO_DEV_ATMEL_TDES is not set -# CONFIG_CRYPTO_DEV_CAVIUM_ZIP is not set -# CONFIG_CRYPTO_DEV_CCP is not set -# CONFIG_CRYPTO_DEV_CCREE is not set -# CONFIG_CRYPTO_DEV_FSL_CAAM is not set -# CONFIG_CRYPTO_DEV_FSL_CAAM_CRYPTO_API_DESC is not set -# CONFIG_CRYPTO_DEV_HIFN_795X is not set -# CONFIG_CRYPTO_DEV_HISI_SEC is not set -# CONFIG_CRYPTO_DEV_IMGTEC_HASH is not set -# CONFIG_CRYPTO_DEV_MARVELL_CESA is not set -# CONFIG_CRYPTO_DEV_MV_CESA is not set -# CONFIG_CRYPTO_DEV_MXC_SCC is not set -# CONFIG_CRYPTO_DEV_MXS_DCP is not set -# CONFIG_CRYPTO_DEV_NITROX_CNN55XX is not set -# CONFIG_CRYPTO_DEV_QAT_C3XXX is not set -# CONFIG_CRYPTO_DEV_QAT_C3XXXVF is not set -# CONFIG_CRYPTO_DEV_QAT_C62X is not set -# CONFIG_CRYPTO_DEV_QAT_C62XVF is not set -# CONFIG_CRYPTO_DEV_QAT_DH895xCC is not set -# CONFIG_CRYPTO_DEV_QAT_DH895xCCVF is not set -# CONFIG_CRYPTO_DEV_QCE is not set -# CONFIG_CRYPTO_DEV_S5P is not set -# CONFIG_CRYPTO_DEV_SAFEXCEL is not set -# CONFIG_CRYPTO_DEV_SAHARA is not set -# CONFIG_CRYPTO_DEV_SP_PSP is not set -# CONFIG_CRYPTO_DEV_TALITOS is not set -# CONFIG_CRYPTO_DEV_VIRTIO is not set -# CONFIG_CRYPTO_DH is not set -# CONFIG_CRYPTO_DRBG_CTR is not set -# CONFIG_CRYPTO_DRBG_HASH is not set -# CONFIG_CRYPTO_DRBG_MENU is not set -# CONFIG_CRYPTO_ECB is not set -# CONFIG_CRYPTO_ECDH is not set -# CONFIG_CRYPTO_ECHAINIV is not set -# CONFIG_CRYPTO_FCRYPT is not set -# CONFIG_CRYPTO_FIPS is not set -# CONFIG_CRYPTO_GCM is not set -# CONFIG_CRYPTO_GF128MUL is not set -# CONFIG_CRYPTO_GHASH is not set -# CONFIG_CRYPTO_GHASH_CLMUL_NI_INTEL is not set -# CONFIG_CRYPTO_HASH is not set -# CONFIG_CRYPTO_HMAC is not set -# CONFIG_CRYPTO_HW is not set -# CONFIG_CRYPTO_JITTERENTROPY is not set -# CONFIG_CRYPTO_KEYWRAP is not set -# CONFIG_CRYPTO_KHAZAD is not set -# CONFIG_CRYPTO_LRW is not set -# CONFIG_CRYPTO_LZ4 is not set -# CONFIG_CRYPTO_LZ4HC is not set -# CONFIG_CRYPTO_LZO is not set -# CONFIG_CRYPTO_MANAGER is not set -# CONFIG_CRYPTO_MANAGER2 is not set -CONFIG_CRYPTO_MANAGER_DISABLE_TESTS=y -# CONFIG_CRYPTO_MCRYPTD is not set -# CONFIG_CRYPTO_MD4 is not set -# CONFIG_CRYPTO_MD5 is not set -# CONFIG_CRYPTO_MICHAEL_MIC is not set -# CONFIG_CRYPTO_MORUS1280 is not set -# CONFIG_CRYPTO_MORUS1280_AVX2 is not set -# CONFIG_CRYPTO_MORUS1280_SSE2 is not set -# CONFIG_CRYPTO_MORUS640 is not set -# CONFIG_CRYPTO_MORUS640_SSE2 is not set -# CONFIG_CRYPTO_NULL is not set -# CONFIG_CRYPTO_PCBC is not set -# CONFIG_CRYPTO_PCOMP is not set -# CONFIG_CRYPTO_PCOMP2 is not set -CONFIG_CRYPTO_PCRYPT=y -# CONFIG_CRYPTO_POLY1305 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_RNG is not set -# CONFIG_CRYPTO_RSA is not set -# CONFIG_CRYPTO_SALSA20 is not set -# CONFIG_CRYPTO_SALSA20_586 is not set -# CONFIG_CRYPTO_SEED is not set -# CONFIG_CRYPTO_SEQIV is not set -# CONFIG_CRYPTO_SERPENT is not set -# CONFIG_CRYPTO_SHA1 is not set -# CONFIG_CRYPTO_SHA1_ARM is not set -# CONFIG_CRYPTO_SHA256 is not set -# CONFIG_CRYPTO_SHA3 is not set -# CONFIG_CRYPTO_SHA512 is not set -# CONFIG_CRYPTO_SM3 is not set -# CONFIG_CRYPTO_SM4 is not set -# CONFIG_CRYPTO_SPECK is not set -# CONFIG_CRYPTO_TEA is not set -# CONFIG_CRYPTO_TEST is not set -# CONFIG_CRYPTO_TGR192 is not set -# CONFIG_CRYPTO_TWOFISH is not set -# CONFIG_CRYPTO_TWOFISH_586 is not set -# CONFIG_CRYPTO_TWOFISH_COMMON is not set -# CONFIG_CRYPTO_USER is not set -# CONFIG_CRYPTO_USER_API_AEAD is not set -# CONFIG_CRYPTO_USER_API_HASH is not set -# CONFIG_CRYPTO_USER_API_RNG is not set -# CONFIG_CRYPTO_USER_API_SKCIPHER is not set -# CONFIG_CRYPTO_VMAC is not set -# CONFIG_CRYPTO_WP512 is not set -# CONFIG_CRYPTO_XCBC is not set -# CONFIG_CRYPTO_XTS is not set -# CONFIG_CRYPTO_ZLIB is not set -# CONFIG_CRYPTO_ZSTD is not set -# CONFIG_CS5535_MFGPT is not set -# CONFIG_CS89x0 is not set -# CONFIG_CUSE is not set -# CONFIG_CW1200 is not set -# CONFIG_CXL_AFU_DRIVER_OPS is not set -# CONFIG_CXL_BASE is not set -# CONFIG_CXL_EEH is not set -# CONFIG_CXL_KERNEL_API is not set -# CONFIG_CXL_LIB is not set -# CONFIG_CYPRESS_FIRMWARE is not set -# CONFIG_DA280 is not set -# CONFIG_DA311 is not set -# CONFIG_DAVICOM_PHY is not set -# CONFIG_DAX is not set -# CONFIG_DCB is not set -# CONFIG_DDR is not set -# CONFIG_DEBUG_ALIGN_RODATA is not set -# CONFIG_DEBUG_ATOMIC_SLEEP is not set -# CONFIG_DEBUG_BLOCK_EXT_DEVT is not set -# CONFIG_DEBUG_BUGVERBOSE is not set -# CONFIG_DEBUG_CREDENTIALS is not set -# CONFIG_DEBUG_DEVRES is not set -# CONFIG_DEBUG_DRIVER is not set -# CONFIG_DEBUG_FORCE_WEAK_PER_CPU is not set -CONFIG_DEBUG_FS=y -# CONFIG_DEBUG_GPIO is not set -# CONFIG_DEBUG_HIGHMEM is not set -# CONFIG_DEBUG_ICEDCC is not set -# CONFIG_DEBUG_INFO is not set -# CONFIG_DEBUG_INFO_DWARF4 is not set -CONFIG_DEBUG_INFO_REDUCED=y -# CONFIG_DEBUG_INFO_SPLIT is not set -CONFIG_DEBUG_KERNEL=y -# CONFIG_DEBUG_KMEMLEAK is not set -# CONFIG_DEBUG_KOBJECT is not set -# CONFIG_DEBUG_KOBJECT_RELEASE is not set -# CONFIG_DEBUG_LIST is not set -# CONFIG_DEBUG_LL is not set -# CONFIG_DEBUG_LL_UART_8250 is not set -# CONFIG_DEBUG_LL_UART_PL01X is not set -# CONFIG_DEBUG_LOCKDEP is not set -# CONFIG_DEBUG_LOCKING_API_SELFTESTS is not set -# CONFIG_DEBUG_LOCK_ALLOC is not set -# CONFIG_DEBUG_MEMORY_INIT is not set -# CONFIG_DEBUG_MUTEXES is not set -# CONFIG_DEBUG_NOTIFIERS is not set -# CONFIG_DEBUG_NX_TEST is not set -# CONFIG_DEBUG_OBJECTS is not set -# CONFIG_DEBUG_PAGEALLOC is not set -# CONFIG_DEBUG_PAGE_REF is not set -# CONFIG_DEBUG_PERF_USE_VMALLOC is not set -# CONFIG_DEBUG_PER_CPU_MAPS is not set -# CONFIG_DEBUG_PINCTRL is not set -# CONFIG_DEBUG_PI_LIST is not set -# CONFIG_DEBUG_PREEMPT is not set -# CONFIG_DEBUG_RODATA is not set -# CONFIG_DEBUG_RODATA_TEST is not set -# CONFIG_DEBUG_RSEQ is not set -# CONFIG_DEBUG_RT_MUTEXES is not set -# CONFIG_DEBUG_RWSEMS is not set -# CONFIG_DEBUG_SECTION_MISMATCH is not set -# CONFIG_DEBUG_SEMIHOSTING is not set -# CONFIG_DEBUG_SET_MODULE_RONX is not set -# CONFIG_DEBUG_SG is not set -# CONFIG_DEBUG_SHIRQ is not set -# CONFIG_DEBUG_SLAB is not set -# CONFIG_DEBUG_SPINLOCK is not set -# CONFIG_DEBUG_STACKOVERFLOW is not set -# CONFIG_DEBUG_STACK_USAGE is not set -# CONFIG_DEBUG_STRICT_USER_COPY_CHECKS is not set -# CONFIG_DEBUG_TEST_DRIVER_REMOVE is not set -# CONFIG_DEBUG_TIMEKEEPING is not set -# CONFIG_DEBUG_UART_8250_PALMCHIP is not set -# CONFIG_DEBUG_UART_BCM63XX is not set -# CONFIG_DEBUG_VIRTUAL is not set -# CONFIG_DEBUG_VM is not set -# CONFIG_DEBUG_WQ_FORCE_RR_CPU is not set -# CONFIG_DEBUG_WW_MUTEX_SLOWPATH is not set -# CONFIG_DEBUG_WX is not set -# CONFIG_DEBUG_ZBOOT is not set -# CONFIG_DECNET is not set -CONFIG_DEFAULT_CUBIC=y -CONFIG_DEFAULT_DEADLINE=y -CONFIG_DEFAULT_HOSTNAME="(none)" -CONFIG_DEFAULT_IOSCHED="deadline" -CONFIG_DEFAULT_MMAP_MIN_ADDR=4096 -# CONFIG_DEFAULT_NOOP is not set -# CONFIG_DEFAULT_RENO is not set -CONFIG_DEFAULT_SECURITY="" -CONFIG_DEFAULT_SECURITY_DAC=y -CONFIG_DEFAULT_TCP_CONG="cubic" -CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config" -# CONFIG_DEFERRED_STRUCT_PAGE_INIT is not set -# CONFIG_DELL_LAPTOP is not set -# CONFIG_DELL_RBTN is not set -# CONFIG_DELL_SMBIOS is not set -# CONFIG_DELL_SMO8800 is not set -# CONFIG_DEPRECATED_PARAM_STRUCT is not set -# CONFIG_DETECT_HUNG_TASK is not set -# CONFIG_DEVKMEM is not set -# CONFIG_DEVMEM is not set -CONFIG_DEVPORT=y -# CONFIG_DEVPTS_MULTIPLE_INSTANCES is not set -# CONFIG_DEVTMPFS is not set -# CONFIG_DEVTMPFS_MOUNT is not set -# CONFIG_DEV_DAX is not set -# CONFIG_DGAP is not set -# CONFIG_DGNC is not set -# CONFIG_DHT11 is not set -# CONFIG_DISCONTIGMEM_MANUAL is not set -# CONFIG_DISPLAY_CONNECTOR_ANALOG_TV is not set -# CONFIG_DISPLAY_CONNECTOR_DVI is not set -# CONFIG_DISPLAY_CONNECTOR_HDMI is not set -# CONFIG_DISPLAY_ENCODER_TFP410 is not set -# CONFIG_DISPLAY_ENCODER_TPD12S015 is not set -# CONFIG_DISPLAY_PANEL_DPI is not set -# CONFIG_DISPLAY_PANEL_LGPHILIPS_LB035Q02 is not set -# CONFIG_DISPLAY_PANEL_TPO_TD028TTEC1 is not set -# CONFIG_DISPLAY_PANEL_TPO_TD043MTEA1 is not set -# CONFIG_DL2K is not set -# CONFIG_DLM is not set -# CONFIG_DM9000 is not set -# CONFIG_DMADEVICES is not set -# CONFIG_DMADEVICES_DEBUG is not set -# CONFIG_DMARD06 is not set -# CONFIG_DMARD09 is not set -# CONFIG_DMARD10 is not set -# CONFIG_DMASCC is not set -# CONFIG_DMATEST is not set -# CONFIG_DMA_API_DEBUG is not set -# CONFIG_DMA_ENGINE is not set -# CONFIG_DMA_FENCE_TRACE is not set -# CONFIG_DMA_NOOP_OPS is not set -# CONFIG_DMA_SHARED_BUFFER is not set -# CONFIG_DMA_VIRT_OPS is not set -# CONFIG_DM_CACHE is not set -# CONFIG_DM_DEBUG is not set -# CONFIG_DM_DELAY is not set -# CONFIG_DM_ERA is not set -# CONFIG_DM_FLAKEY is not set -# CONFIG_DM_INTEGRITY is not set -# CONFIG_DM_LOG_USERSPACE is not set -# CONFIG_DM_LOG_WRITES is not set -# CONFIG_DM_MQ_DEFAULT is not set -# CONFIG_DM_MULTIPATH is not set -# CONFIG_DM_RAID is not set -# CONFIG_DM_SWITCH is not set -# CONFIG_DM_THIN_PROVISIONING is not set -# CONFIG_DM_UEVENT is not set -# CONFIG_DM_UNSTRIPED is not set -# CONFIG_DM_VERITY is not set -# CONFIG_DM_WRITECACHE is not set -# CONFIG_DM_ZERO is not set -# CONFIG_DNET is not set -# CONFIG_DNOTIFY is not set -# CONFIG_DNS_RESOLVER is not set -CONFIG_DOUBLEFAULT=y -# CONFIG_DP83822_PHY is not set -# CONFIG_DP83848_PHY is not set -# CONFIG_DP83867_PHY is not set -# CONFIG_DP83TC811_PHY is not set -# CONFIG_DPOT_DAC is not set -CONFIG_DQL=y -# CONFIG_DRAGONRISE_FF is not set -# CONFIG_DRM is not set -# CONFIG_DRM_I915 is not set -# CONFIG_DRM_AMDGPU is not set -# CONFIG_DRM_AMDGPU_CIK is not set -# CONFIG_DRM_AMDGPU_GART_DEBUGFS is not set -# CONFIG_DRM_AMDGPU_SI is not set -# CONFIG_DRM_AMDGPU_USERPTR is not set -# CONFIG_DRM_AMD_ACP is not set -# CONFIG_DRM_ANALOGIX_ANX78XX is not set -# CONFIG_DRM_ARCPGU is not set -# CONFIG_DRM_ARMADA is not set -# CONFIG_DRM_AST is not set -# CONFIG_DRM_BOCHS is not set -# CONFIG_DRM_CDNS_DSI is not set -# CONFIG_DRM_CIRRUS_QEMU is not set -# CONFIG_DRM_DEBUG_MM is not set -# CONFIG_DRM_DEBUG_SELFTEST is not set -# CONFIG_DRM_DP_AUX_CHARDEV is not set -# CONFIG_DRM_DP_CEC is not set -# CONFIG_DRM_DUMB_VGA_DAC is not set -# CONFIG_DRM_DW_HDMI_CEC is not set -# CONFIG_DRM_ETNAVIV is not set -# CONFIG_DRM_EXYNOS is not set -# CONFIG_DRM_FBDEV_EMULATION is not set -# CONFIG_DRM_FBDEV_LEAK_PHYS_SMEM is not set -# CONFIG_DRM_FSL_DCU is not set -# CONFIG_DRM_GMA500 is not set -# CONFIG_DRM_HDLCD is not set -# CONFIG_DRM_HISI_HIBMC is not set -# CONFIG_DRM_HISI_KIRIN is not set -# CONFIG_DRM_I2C_ADV7511 is not set -# CONFIG_DRM_I2C_CH7006 is not set -# CONFIG_DRM_I2C_NXP_TDA9950 is not set -# CONFIG_DRM_I2C_NXP_TDA998X is not set -# CONFIG_DRM_I2C_SIL164 is not set -# CONFIG_DRM_LEGACY is not set -# CONFIG_DRM_LIB_RANDOM is not set -# CONFIG_DRM_LOAD_EDID_FIRMWARE is not set -# CONFIG_DRM_LVDS_ENCODER is not set -# CONFIG_DRM_MALI_DISPLAY is not set -# CONFIG_DRM_MEGACHIPS_STDPXXXX_GE_B850V3_FW is not set -# CONFIG_DRM_MGAG200 is not set -# CONFIG_DRM_MXSFB is not set -# CONFIG_DRM_NOUVEAU is not set -# CONFIG_DRM_NXP_PTN3460 is not set -# CONFIG_DRM_OMAP is not set -# CONFIG_DRM_PANEL_ARM_VERSATILE is not set -# CONFIG_DRM_PANEL_ILITEK_IL9322 is not set -# CONFIG_DRM_PANEL_JDI_LT070ME05000 is not set -# CONFIG_DRM_PANEL_LG_LG4573 is not set -# CONFIG_DRM_PANEL_LVDS is not set -# CONFIG_DRM_PANEL_PANASONIC_VVX10F034N00 is not set -# CONFIG_DRM_PANEL_RASPBERRYPI_TOUCHSCREEN is not set -# CONFIG_DRM_PANEL_SAMSUNG_LD9040 is not set -# CONFIG_DRM_PANEL_SAMSUNG_S6E8AA0 is not set -# CONFIG_DRM_PANEL_SEIKO_43WVF1G is not set -# CONFIG_DRM_PANEL_SHARP_LQ101R1SX01 is not set -# CONFIG_DRM_PANEL_SHARP_LS043T1LE01 is not set -# CONFIG_DRM_PANEL_SITRONIX_ST7789V is not set -# CONFIG_DRM_PARADE_PS8622 is not set -# CONFIG_DRM_PL111 is not set -# CONFIG_DRM_QXL is not set -# CONFIG_DRM_RADEON is not set -# CONFIG_DRM_RADEON_USERPTR is not set -# CONFIG_DRM_RCAR_DW_HDMI is not set -# CONFIG_DRM_RCAR_LVDS is not set -# CONFIG_DRM_SII902X is not set -# CONFIG_DRM_SII9234 is not set -# CONFIG_DRM_SIL_SII8620 is not set -# CONFIG_DRM_STI is not set -# CONFIG_DRM_STM is not set -# CONFIG_DRM_SUN4I is not set -# CONFIG_DRM_THINE_THC63LVD1024 is not set -# CONFIG_DRM_TILCDC is not set -# CONFIG_DRM_TINYDRM is not set -# CONFIG_DRM_TI_TFP410 is not set -# CONFIG_DRM_TOSHIBA_TC358767 is not set -# CONFIG_DRM_UDL is not set -# CONFIG_DRM_VBOXVIDEO is not set -# CONFIG_DRM_VGEM is not set -# CONFIG_DRM_VKMS is not set -# CONFIG_DRM_VMWGFX is not set -# CONFIG_DRM_XEN is not set -# CONFIG_DS1682 is not set -# CONFIG_DS1803 is not set -# CONFIG_DS4424 is not set -# CONFIG_DST_CACHE is not set -# CONFIG_DTLK is not set -# CONFIG_DUMMY is not set -CONFIG_DUMMY_CONSOLE_COLUMNS=80 -CONFIG_DUMMY_CONSOLE_ROWS=25 -# CONFIG_DUMMY_IRQ is not set -# CONFIG_DVB_AU8522_V4L is not set -# CONFIG_DVB_CORE is not set -# CONFIG_DVB_DUMMY_FE is not set -# CONFIG_DVB_TUNER_DIB0070 is not set -# CONFIG_DVB_TUNER_DIB0090 is not set -# CONFIG_DWC_XLGMAC is not set -# CONFIG_DWMAC_IPQ806X is not set -# CONFIG_DWMAC_LPC18XX is not set -# CONFIG_DWMAC_MESON is not set -# CONFIG_DWMAC_ROCKCHIP is not set -# CONFIG_DWMAC_SOCFPGA is not set -# CONFIG_DWMAC_STI is not set -# CONFIG_DW_AXI_DMAC is not set -# CONFIG_DW_DMAC is not set -# CONFIG_DW_DMAC_PCI is not set -# CONFIG_DW_WATCHDOG is not set -# CONFIG_DYNAMIC_DEBUG is not set -# CONFIG_E100 is not set -# CONFIG_E1000 is not set -# CONFIG_E1000E is not set -# CONFIG_E1000E_HWTS is not set -# CONFIG_EARLY_PRINTK_8250 is not set -# CONFIG_EARLY_PRINTK_USB_XDBC is not set -# CONFIG_EBC_C384_WDT is not set -# CONFIG_ECHO is not set -# CONFIG_ECRYPT_FS is not set -# CONFIG_EDAC is not set -# CONFIG_EEEPC_LAPTOP is not set -# CONFIG_EEPROM_93CX6 is not set -# CONFIG_EEPROM_93XX46 is not set -# CONFIG_EEPROM_AT24 is not set -# CONFIG_EEPROM_AT25 is not set -# CONFIG_EEPROM_DIGSY_MTC_CFG is not set -# CONFIG_EEPROM_IDT_89HPESX is not set -# CONFIG_EEPROM_LEGACY is not set -# CONFIG_EEPROM_MAX6875 is not set -# CONFIG_EFI is not set -CONFIG_EFI_PARTITION=y -# CONFIG_EFS_FS is not set -CONFIG_ELFCORE=y -# CONFIG_ELF_CORE is not set -# CONFIG_EMAC_ROCKCHIP is not set -CONFIG_EMBEDDED=y -# CONFIG_EM_TIMER_STI is not set -# CONFIG_ENABLE_MUST_CHECK is not set -CONFIG_ENABLE_WARN_DEPRECATED=y -# CONFIG_ENA_ETHERNET is not set -# CONFIG_ENC28J60 is not set -# CONFIG_ENCLOSURE_SERVICES is not set -# CONFIG_ENCRYPTED_KEYS is not set -# CONFIG_ENCX24J600 is not set -# CONFIG_ENIC is not set -# CONFIG_ENVELOPE_DETECTOR is not set -# CONFIG_EPAPR_PARAVIRT is not set -# CONFIG_EPIC100 is not set -CONFIG_EPOLL=y -# CONFIG_EQUALIZER is not set -# CONFIG_EROFS_FS is not set -# CONFIG_ET131X is not set -CONFIG_ETHERNET=y -# CONFIG_ETHOC is not set -CONFIG_EVENTFD=y -CONFIG_EXPERT=y -CONFIG_EXPORTFS=y -# CONFIG_EXPORTFS_BLOCK_OPS is not set -# CONFIG_EXT2_FS is not set -# CONFIG_EXT2_FS_XATTR is not set -# CONFIG_EXT3_FS is not set -# CONFIG_EXT4_DEBUG is not set -# CONFIG_EXT4_ENCRYPTION is not set -# CONFIG_EXT4_FS is not set -# CONFIG_EXT4_FS_POSIX_ACL is not set -# CONFIG_EXT4_FS_SECURITY is not set -CONFIG_EXT4_USE_FOR_EXT2=y -# CONFIG_EXTCON is not set -# CONFIG_EXTCON_ADC_JACK is not set -# CONFIG_EXTCON_AXP288 is not set -# CONFIG_EXTCON_GPIO is not set -# CONFIG_EXTCON_INTEL_INT3496 is not set -# CONFIG_EXTCON_MAX3355 is not set -# CONFIG_EXTCON_QCOM_SPMI_MISC is not set -# CONFIG_EXTCON_RT8973A is not set -# CONFIG_EXTCON_SM5502 is not set -# CONFIG_EXTCON_USB_GPIO is not set -CONFIG_EXTRA_FIRMWARE="" -CONFIG_EXTRA_TARGETS="" -# CONFIG_EXYNOS_ADC is not set -# CONFIG_EXYNOS_VIDEO is not set -# CONFIG_EZCHIP_NPS_MANAGEMENT_ENET is not set -# CONFIG_EZX_PCAP is not set -# CONFIG_F2FS_FAULT_INJECTION is not set -# CONFIG_F2FS_FS is not set -# CONFIG_F2FS_FS_ENCRYPTION is not set -# CONFIG_F2FS_FS_POSIX_ACL is not set -# CONFIG_F2FS_IO_TRACE is not set -# CONFIG_FAILOVER is not set -# CONFIG_FAIR_GROUP_SCHED is not set -# CONFIG_FANOTIFY is not set -CONFIG_FAT_DEFAULT_CODEPAGE=437 -CONFIG_FAT_DEFAULT_IOCHARSET="iso8859-1" -# CONFIG_FAT_DEFAULT_UTF8 is not set -# CONFIG_FAT_FS is not set -# CONFIG_FAULT_INJECTION is not set -# CONFIG_FB is not set -# CONFIG_FB_3DFX is not set -# CONFIG_FB_ARC is not set -# CONFIG_FB_ARK is not set -# CONFIG_FB_ARMCLCD is not set -# CONFIG_FB_ASILIANT is not set -# CONFIG_FB_ATY is not set -# CONFIG_FB_ATY128 is not set -# CONFIG_FB_AUO_K190X is not set -# CONFIG_FB_BACKLIGHT is not set -# CONFIG_FB_BIG_ENDIAN is not set -# CONFIG_FB_BOOT_VESA_SUPPORT is not set -# CONFIG_FB_BOTH_ENDIAN is not set -# CONFIG_FB_BROADSHEET is not set -# CONFIG_FB_CARMINE is not set -# CONFIG_FB_CFB_COPYAREA is not set -# CONFIG_FB_CFB_FILLRECT is not set -# CONFIG_FB_CFB_IMAGEBLIT is not set -# CONFIG_FB_CFB_REV_PIXELS_IN_BYTE is not set -# CONFIG_FB_CIRRUS is not set -# CONFIG_FB_CYBER2000 is not set -# CONFIG_FB_DA8XX is not set -# CONFIG_FB_DDC is not set -# CONFIG_FB_FOREIGN_ENDIAN is not set -# CONFIG_FB_FLEX is not set -# CONFIG_FB_GEODE is not set -# CONFIG_FB_GOLDFISH is not set -# CONFIG_FB_HGA is not set -# CONFIG_FB_I740 is not set -# CONFIG_FB_IBM_GXT4500 is not set -# CONFIG_FB_IMSTT is not set -# CONFIG_FB_IMX is not set -# CONFIG_FB_KYRO is not set -# CONFIG_FB_LE80578 is not set -# CONFIG_FB_LITTLE_ENDIAN is not set -# CONFIG_FB_MACMODES is not set -# CONFIG_FB_MATROX is not set -# CONFIG_FB_MB862XX is not set -# CONFIG_FB_METRONOME is not set -# CONFIG_FB_MODE_HELPERS is not set -# CONFIG_FB_MXS is not set -# CONFIG_FB_N411 is not set -# CONFIG_FB_NEOMAGIC is not set -CONFIG_FB_NOTIFY=y -# CONFIG_FB_NVIDIA is not set -# CONFIG_FB_OF is not set -# CONFIG_FB_OMAP2 is not set -# CONFIG_FB_OPENCORES is not set -# CONFIG_FB_PM2 is not set -# CONFIG_FB_PM3 is not set -# CONFIG_FB_PS3 is not set -# CONFIG_FB_PXA is not set -# CONFIG_FB_RADEON is not set -# CONFIG_FB_RIVA is not set -# CONFIG_FB_S1D13XXX is not set -# CONFIG_FB_S3 is not set -# CONFIG_FB_SAVAGE is not set -# CONFIG_FB_SIMPLE is not set -# CONFIG_FB_SIS is not set -# CONFIG_FB_SM712 is not set -# CONFIG_FB_SM750 is not set -# CONFIG_FB_SMSCUFX is not set -# CONFIG_FB_SSD1307 is not set -# CONFIG_FB_SVGALIB is not set -# CONFIG_FB_SYS_COPYAREA is not set -# CONFIG_FB_SYS_FILLRECT is not set -# CONFIG_FB_SYS_FOPS is not set -# CONFIG_FB_SYS_IMAGEBLIT is not set -# CONFIG_FB_TFT is not set -# CONFIG_FB_TFT_AGM1264K_FL is not set -# CONFIG_FB_TFT_BD663474 is not set -# CONFIG_FB_TFT_FBTFT_DEVICE is not set -# CONFIG_FB_TFT_HX8340BN is not set -# CONFIG_FB_TFT_HX8347D is not set -# CONFIG_FB_TFT_HX8353D is not set -# CONFIG_FB_TFT_HX8357D is not set -# CONFIG_FB_TFT_ILI9163 is not set -# CONFIG_FB_TFT_ILI9320 is not set -# CONFIG_FB_TFT_ILI9325 is not set -# CONFIG_FB_TFT_ILI9340 is not set -# CONFIG_FB_TFT_ILI9341 is not set -# CONFIG_FB_TFT_ILI9481 is not set -# CONFIG_FB_TFT_ILI9486 is not set -# CONFIG_FB_TFT_PCD8544 is not set -# CONFIG_FB_TFT_RA8875 is not set -# CONFIG_FB_TFT_S6D02A1 is not set -# CONFIG_FB_TFT_S6D1121 is not set -# CONFIG_FB_TFT_SH1106 is not set -# CONFIG_FB_TFT_SSD1289 is not set -# CONFIG_FB_TFT_SSD1305 is not set -# CONFIG_FB_TFT_SSD1306 is not set -# CONFIG_FB_TFT_SSD1325 is not set -# CONFIG_FB_TFT_SSD1331 is not set -# CONFIG_FB_TFT_SSD1351 is not set -# CONFIG_FB_TFT_ST7735R is not set -# CONFIG_FB_TFT_ST7789V is not set -# CONFIG_FB_TFT_TINYLCD is not set -# CONFIG_FB_TFT_TLS8204 is not set -# CONFIG_FB_TFT_UC1611 is not set -# CONFIG_FB_TFT_UC1701 is not set -# CONFIG_FB_TFT_UPD161704 is not set -# CONFIG_FB_TFT_WATTEROTT is not set -# CONFIG_FB_TILEBLITTING is not set -# CONFIG_FB_TMIO is not set -# CONFIG_FB_TRIDENT is not set -# CONFIG_FB_UDL is not set -# CONFIG_FB_UVESA is not set -# CONFIG_FB_VGA16 is not set -# CONFIG_FB_VIA is not set -# CONFIG_FB_VIRTUAL is not set -# CONFIG_FB_VOODOO1 is not set -# CONFIG_FB_VT8623 is not set -# CONFIG_FB_XGI is not set -# CONFIG_FCOE is not set -# CONFIG_FCOE_FNIC is not set -# CONFIG_FDDI is not set -# CONFIG_FEALNX is not set -# CONFIG_FENCE_TRACE is not set -# CONFIG_FHANDLE is not set -CONFIG_FIB_RULES=y -CONFIG_FILE_LOCKING=y -# CONFIG_FIND_BIT_BENCHMARK is not set -# CONFIG_FIREWIRE is not set -# CONFIG_FIREWIRE_NOSY is not set -# CONFIG_FIREWIRE_SERIAL is not set -# CONFIG_FIRMWARE_EDID is not set -# CONFIG_FIRMWARE_IN_KERNEL is not set -# CONFIG_FIRMWARE_MEMMAP is not set -# CONFIG_FIXED_PHY is not set -CONFIG_FLATMEM=y -CONFIG_FLATMEM_MANUAL=y -CONFIG_FLAT_NODE_MEM_MAP=y -# CONFIG_FM10K is not set -# CONFIG_FMC is not set -# CONFIG_FORCEDETH is not set -CONFIG_FORCE_MAX_ZONEORDER=11 -CONFIG_FORTIFY_SOURCE=y -# CONFIG_FPGA is not set -# CONFIG_FRAMEBUFFER_CONSOLE is not set -# CONFIG_FRAMEBUFFER_CONSOLE_DEFERRED_TAKEOVER is not set -# CONFIG_FRAME_POINTER is not set -CONFIG_FRAME_WARN=1024 -# CONFIG_FREEZER is not set -# CONFIG_FRONTSWAP is not set -# CONFIG_FSCACHE is not set -# CONFIG_FSI is not set -# CONFIG_FSL_EDMA is not set -# CONFIG_FSL_ERRATUM_A008585 is not set -# CONFIG_FSL_MC_BUS is not set -# CONFIG_FSL_PQ_MDIO is not set -# CONFIG_FSL_XGMAC_MDIO is not set -CONFIG_FSNOTIFY=y -# CONFIG_FS_DAX is not set -# CONFIG_FS_ENCRYPTION is not set -# CONFIG_FS_POSIX_ACL is not set -# CONFIG_FTGMAC100 is not set -# CONFIG_FTL is not set -# CONFIG_FTMAC100 is not set -# CONFIG_FTRACE is not set -# CONFIG_FTRACE_STARTUP_TEST is not set -# CONFIG_FTR_FIXUP_SELFTEST is not set -# CONFIG_FTWDT010_WATCHDOG is not set -# CONFIG_FUJITSU_ES is not set -# CONFIG_FUJITSU_LAPTOP is not set -# CONFIG_FUJITSU_TABLET is not set -# CONFIG_FUNCTION_TRACER is not set -# CONFIG_FUSE_FS is not set -# CONFIG_FUSION is not set -# CONFIG_FUSION_FC is not set -# CONFIG_FUSION_SAS is not set -# CONFIG_FUSION_SPI is not set -CONFIG_FUTEX=y -CONFIG_FUTEX_PI=y -# CONFIG_FW_CFG_SYSFS is not set -CONFIG_FW_LOADER=y -CONFIG_FW_LOADER_USER_HELPER=y -CONFIG_FW_LOADER_USER_HELPER_FALLBACK=y -CONFIG_GACT_PROB=y -# CONFIG_GADGET_UAC1 is not set -# CONFIG_GAMEPORT is not set -# CONFIG_GATEWORKS_GW16083 is not set -# CONFIG_GCC_PLUGINS is not set -CONFIG_GCC_VERSION=70400 -# CONFIG_GCOV is not set -# CONFIG_GCOV_KERNEL is not set -# CONFIG_GDB_SCRIPTS is not set -# CONFIG_GEMINI_ETHERNET is not set -# CONFIG_GENERIC_ADC_BATTERY is not set -# CONFIG_GENERIC_ADC_THERMAL is not set -CONFIG_GENERIC_CALIBRATE_DELAY=y -# CONFIG_GENERIC_CPU_DEVICES is not set -CONFIG_GENERIC_HWEIGHT=y -# CONFIG_GENERIC_IRQ_DEBUGFS is not set -CONFIG_GENERIC_IRQ_PROBE=y -CONFIG_GENERIC_NET_UTILS=y -# CONFIG_GENERIC_PHY is not set -# CONFIG_GENEVE is not set -# CONFIG_GENWQE is not set -# CONFIG_GFS2_FS is not set -# CONFIG_GIGASET_CAPI is not set -# CONFIG_GIGASET_DEBUG is not set -# CONFIG_GIGASET_DUMMYLL is not set -# CONFIG_GLOB_SELFTEST is not set -# CONFIG_GNSS is not set -# CONFIG_GOLDFISH is not set -# CONFIG_GOOGLE_FIRMWARE is not set -# CONFIG_GP2AP020A00F is not set -# CONFIG_GPD_POCKET_FAN is not set -# CONFIG_GPIOLIB is not set -CONFIG_GPIOLIB_FASTPATH_LIMIT=512 -# CONFIG_GPIO_104_DIO_48E is not set -# CONFIG_GPIO_104_IDIO_16 is not set -# CONFIG_GPIO_104_IDI_48 is not set -# CONFIG_GPIO_74X164 is not set -# CONFIG_GPIO_74XX_MMIO is not set -# CONFIG_GPIO_ADNP is not set -# CONFIG_GPIO_ADP5588 is not set -# CONFIG_GPIO_ALTERA is not set -# CONFIG_GPIO_AMD8111 is not set -# CONFIG_GPIO_AMDPT is not set -# CONFIG_GPIO_BCM_KONA is not set -# CONFIG_GPIO_BT8XX is not set -# CONFIG_GPIO_CS5535 is not set -# CONFIG_GPIO_DWAPB is not set -# CONFIG_GPIO_EM is not set -# CONFIG_GPIO_EXAR is not set -# CONFIG_GPIO_F7188X is not set -# CONFIG_GPIO_FTGPIO010 is not set -# CONFIG_GPIO_GENERIC_PLATFORM is not set -# CONFIG_GPIO_GPIO_MM is not set -# CONFIG_GPIO_GRGPIO is not set -# CONFIG_GPIO_HLWD is not set -# CONFIG_GPIO_ICH is not set -# CONFIG_GPIO_IT87 is not set -# CONFIG_GPIO_LYNXPOINT is not set -# CONFIG_GPIO_MAX3191X is not set -# CONFIG_GPIO_MAX7300 is not set -# CONFIG_GPIO_MAX7301 is not set -# CONFIG_GPIO_MAX732X is not set -# CONFIG_GPIO_MB86S7X is not set -# CONFIG_GPIO_MC33880 is not set -# CONFIG_GPIO_MCP23S08 is not set -# CONFIG_GPIO_ML_IOH is not set -# CONFIG_GPIO_MOCKUP is not set -# CONFIG_GPIO_MPC8XXX is not set -# CONFIG_GPIO_PCA953X is not set -# CONFIG_GPIO_PCF857X is not set -# CONFIG_GPIO_PCH is not set -# CONFIG_GPIO_PCIE_IDIO_24 is not set -# CONFIG_GPIO_PCI_IDIO_16 is not set -# CONFIG_GPIO_PISOSR is not set -# CONFIG_GPIO_PL061 is not set -# CONFIG_GPIO_RCAR is not set -# CONFIG_GPIO_RDC321X is not set -# CONFIG_GPIO_SCH is not set -# CONFIG_GPIO_SCH311X is not set -# CONFIG_GPIO_SX150X is not set -# CONFIG_GPIO_SYSCON is not set -# CONFIG_GPIO_SYSFS is not set -# CONFIG_GPIO_TPIC2810 is not set -# CONFIG_GPIO_TS4900 is not set -# CONFIG_GPIO_TS5500 is not set -# CONFIG_GPIO_VX855 is not set -# CONFIG_GPIO_WATCHDOG is not set -# CONFIG_GPIO_WINBOND is not set -# CONFIG_GPIO_WS16C48 is not set -# CONFIG_GPIO_XGENE is not set -# CONFIG_GPIO_XILINX is not set -# CONFIG_GPIO_XRA1403 is not set -# CONFIG_GPIO_ZEVIO is not set -# CONFIG_GPIO_ZX is not set -# CONFIG_GREENASIA_FF is not set -# CONFIG_GREYBUS is not set -# CONFIG_GS_FPGABOOT is not set -# CONFIG_GTP is not set -# CONFIG_GUP_BENCHMARK is not set -# CONFIG_HAMACHI is not set -# CONFIG_HAMRADIO is not set -# CONFIG_HAPPYMEAL is not set -# CONFIG_HARDENED_USERCOPY is not set -CONFIG_HARDEN_EL2_VECTORS=y -# CONFIG_HARDLOCKUP_DETECTOR is not set -# CONFIG_HAVE_AOUT is not set -CONFIG_HAVE_ARCH_HARDENED_USERCOPY=y -# CONFIG_HAVE_ARCH_HASH is not set -CONFIG_HAVE_ARCH_MMAP_RND_BITS=y -# CONFIG_HAVE_ARCH_VMAP_STACK is not set -CONFIG_HAVE_ARCH_WITHIN_STACK_FRAMES=y -# CONFIG_HAVE_ARM_ARCH_TIMER is not set -CONFIG_HAVE_EXIT_THREAD=y -CONFIG_HAVE_GCC_PLUGINS=y -CONFIG_HAVE_HARDENED_USERCOPY_ALLOCATOR=y -CONFIG_HAVE_KERNEL_BZIP2=y -CONFIG_HAVE_KERNEL_CAT=y -CONFIG_HAVE_KERNEL_GZIP=y -CONFIG_HAVE_KERNEL_LZ4=y -CONFIG_HAVE_KERNEL_LZMA=y -CONFIG_HAVE_KERNEL_LZO=y -CONFIG_HAVE_KERNEL_XZ=y -CONFIG_HAVE_KPROBES=y -CONFIG_HAVE_KRETPROBES=y -CONFIG_HAVE_NMI=y -CONFIG_HAVE_STACKPROTECTOR=y -# CONFIG_HCALL_STATS is not set -# CONFIG_HDC100X is not set -# CONFIG_HDLC is not set -# CONFIG_HDLC_CISCO is not set -# CONFIG_HDLC_FR is not set -# CONFIG_HDLC_PPP is not set -# CONFIG_HDLC_RAW is not set -# CONFIG_HDLC_RAW_ETH is not set -# CONFIG_HDMI_LPE_AUDIO is not set -# CONFIG_HDQ_MASTER_OMAP is not set -# CONFIG_HEADERS_CHECK is not set -# CONFIG_HERMES is not set -# CONFIG_HFSPLUS_FS is not set -# CONFIG_HFSPLUS_FS_POSIX_ACL is not set -# CONFIG_HFS_FS is not set -# CONFIG_HFS_FS_POSIX_ACL is not set -# CONFIG_HI8435 is not set -# CONFIG_HIBERNATION is not set -# CONFIG_HID is not set -# CONFIG_HIDRAW is not set -# CONFIG_HID_A4TECH is not set -# CONFIG_HID_ACCUTOUCH is not set -# CONFIG_HID_ACRUX is not set -# CONFIG_HID_ACRUX_FF is not set -# CONFIG_HID_ALPS is not set -# CONFIG_HID_APPLE is not set -# CONFIG_HID_APPLEIR is not set -# CONFIG_HID_ASUS is not set -# CONFIG_HID_AUREAL is not set -# CONFIG_HID_BATTERY_STRENGTH is not set -# CONFIG_HID_BELKIN is not set -# CONFIG_HID_BETOP_FF is not set -# CONFIG_HID_CHERRY is not set -# CONFIG_HID_CHICONY is not set -# CONFIG_HID_CMEDIA is not set -# CONFIG_HID_CORSAIR is not set -# CONFIG_HID_COUGAR is not set -# CONFIG_HID_CP2112 is not set -# CONFIG_HID_CYPRESS is not set -# CONFIG_HID_DRAGONRISE is not set -# CONFIG_HID_ELAN is not set -# CONFIG_HID_ELECOM is not set -# CONFIG_HID_ELO is not set -# CONFIG_HID_EMS_FF is not set -# CONFIG_HID_EZKEY is not set -# CONFIG_HID_GEMBIRD is not set -# CONFIG_HID_GENERIC is not set -# CONFIG_HID_GFRM is not set -# CONFIG_HID_GOOGLE_HAMMER is not set -# CONFIG_HID_GREENASIA is not set -# CONFIG_HID_GT683R is not set -# CONFIG_HID_GYRATION is not set -# CONFIG_HID_HOLTEK is not set -# CONFIG_HID_ICADE is not set -# CONFIG_HID_ITE is not set -# CONFIG_HID_JABRA is not set -# CONFIG_HID_KENSINGTON is not set -# CONFIG_HID_KEYTOUCH is not set -# CONFIG_HID_KYE is not set -# CONFIG_HID_LCPOWER is not set -# CONFIG_HID_LED is not set -# CONFIG_HID_LENOVO is not set -# CONFIG_HID_LOGITECH is not set -# CONFIG_HID_LOGITECH_DJ is not set -# CONFIG_HID_LOGITECH_HIDPP is not set -# CONFIG_HID_MAGICMOUSE is not set -# CONFIG_HID_MAYFLASH is not set -# CONFIG_HID_MICROSOFT is not set -# CONFIG_HID_MONTEREY is not set -# CONFIG_HID_MULTITOUCH is not set -# CONFIG_HID_NTI is not set -# CONFIG_HID_NTRIG is not set -# CONFIG_HID_ORTEK is not set -# CONFIG_HID_PANTHERLORD is not set -# CONFIG_HID_PENMOUNT is not set -# CONFIG_HID_PETALYNX is not set -# CONFIG_HID_PICOLCD is not set -# CONFIG_HID_PID is not set -# CONFIG_HID_PLANTRONICS is not set -# CONFIG_HID_PRIMAX is not set -# CONFIG_HID_PRODIKEYS is not set -# CONFIG_HID_REDRAGON is not set -# CONFIG_HID_RETRODE is not set -# CONFIG_HID_RMI is not set -# CONFIG_HID_ROCCAT is not set -# CONFIG_HID_SAITEK is not set -# CONFIG_HID_SAMSUNG is not set -# CONFIG_HID_SENSOR_HUB is not set -# CONFIG_HID_SMARTJOYPLUS is not set -# CONFIG_HID_SONY is not set -# CONFIG_HID_SPEEDLINK is not set -# CONFIG_HID_STEAM is not set -# CONFIG_HID_STEELSERIES is not set -# CONFIG_HID_SUNPLUS is not set -# CONFIG_HID_THINGM is not set -# CONFIG_HID_THRUSTMASTER is not set -# CONFIG_HID_TIVO is not set -# CONFIG_HID_TOPSEED is not set -# CONFIG_HID_TWINHAN is not set -# CONFIG_HID_UCLOGIC is not set -# CONFIG_HID_UDRAW_PS3 is not set -# CONFIG_HID_WACOM is not set -# CONFIG_HID_WALTOP is not set -# CONFIG_HID_WIIMOTE is not set -# CONFIG_HID_XINMO is not set -# CONFIG_HID_ZEROPLUS is not set -# CONFIG_HID_ZYDACRON is not set -# CONFIG_HIGHMEM is not set -CONFIG_HIGH_RES_TIMERS=y -# CONFIG_HINIC is not set -# CONFIG_HIP04_ETH is not set -# CONFIG_HIPPI is not set -# CONFIG_HISILICON_ERRATUM_161010101 is not set -# CONFIG_HISILICON_ERRATUM_161600802 is not set -# CONFIG_HISI_FEMAC is not set -# CONFIG_HIX5HD2_GMAC is not set -# CONFIG_HMC6352 is not set -# CONFIG_HNS is not set -# CONFIG_HNS3 is not set -# CONFIG_HNS_DSAF is not set -# CONFIG_HNS_ENET is not set -# CONFIG_HOSTAP is not set -# CONFIG_HOSTAP_CS is not set -# CONFIG_HOSTAP_PCI is not set -# CONFIG_HOSTAP_PLX is not set -# CONFIG_HOTPLUG_CPU is not set -# CONFIG_HOTPLUG_PCI is not set -# CONFIG_HP03 is not set -# CONFIG_HP100 is not set -# CONFIG_HP206C is not set -CONFIG_HPET_MMAP_DEFAULT=y -# CONFIG_HPFS_FS is not set -# CONFIG_HP_ILO is not set -# CONFIG_HP_WIRELESS is not set -# CONFIG_HSI is not set -# CONFIG_HSR is not set -# CONFIG_HTC_EGPIO is not set -# CONFIG_HTC_I2CPLD is not set -# CONFIG_HTC_PASIC3 is not set -# CONFIG_HTS221 is not set -# CONFIG_HTU21 is not set -# CONFIG_HUGETLB_PAGE is not set -# CONFIG_HVC_DCC is not set -# CONFIG_HVC_UDBG is not set -# CONFIG_HWLAT_TRACER is not set -# CONFIG_HWMON is not set -# CONFIG_HWMON_DEBUG_CHIP is not set -# CONFIG_HWMON_VID is not set -# CONFIG_HWSPINLOCK is not set -# CONFIG_HWSPINLOCK_OMAP is not set -CONFIG_HW_PERF_EVENTS=y -# CONFIG_HW_RANDOM is not set -# CONFIG_HW_RANDOM_AMD is not set -# CONFIG_HW_RANDOM_ATMEL is not set -# CONFIG_HW_RANDOM_CAVIUM is not set -# CONFIG_HW_RANDOM_EXYNOS is not set -# CONFIG_HW_RANDOM_GEODE is not set -# CONFIG_HW_RANDOM_INTEL is not set -# CONFIG_HW_RANDOM_IPROC_RNG200 is not set -# CONFIG_HW_RANDOM_OMAP3_ROM is not set -# CONFIG_HW_RANDOM_PPC4XX is not set -# CONFIG_HW_RANDOM_TIMERIOMEM is not set -CONFIG_HW_RANDOM_TPM=y -# CONFIG_HW_RANDOM_VIA is not set -# CONFIG_HW_RANDOM_VIRTIO is not set -# CONFIG_HX711 is not set -# CONFIG_HYPERV is not set -# CONFIG_HYPERV_TSCPAGE is not set -# CONFIG_HYSDN is not set -CONFIG_HZ=100 -CONFIG_HZ_100=y -# CONFIG_HZ_1000 is not set -# CONFIG_HZ_1024 is not set -# CONFIG_HZ_128 is not set -# CONFIG_HZ_200 is not set -# CONFIG_HZ_24 is not set -# CONFIG_HZ_250 is not set -# CONFIG_HZ_256 is not set -# CONFIG_HZ_300 is not set -# CONFIG_HZ_48 is not set -# CONFIG_HZ_500 is not set -# CONFIG_HZ_PERIODIC is not set -# CONFIG_I2C is not set -# CONFIG_I2C_ALGOBIT is not set -# CONFIG_I2C_ALGOPCA is not set -# CONFIG_I2C_ALGOPCF is not set -# 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_ARB_GPIO_CHALLENGE is not set -# CONFIG_I2C_AU1550 is not set -# CONFIG_I2C_BCM2835 is not set -# CONFIG_I2C_BCM_IPROC is not set -# CONFIG_I2C_CADENCE is not set -# CONFIG_I2C_CBUS_GPIO is not set -# CONFIG_I2C_CHARDEV is not set -# CONFIG_I2C_COMPAT is not set -# CONFIG_I2C_DEBUG_ALGO is not set -# CONFIG_I2C_DEBUG_BUS is not set -# CONFIG_I2C_DEBUG_CORE is not set -# CONFIG_I2C_DEMUX_PINCTRL is not set -# CONFIG_I2C_DESIGNWARE_PCI is not set -# CONFIG_I2C_DESIGNWARE_PLATFORM is not set -# CONFIG_I2C_DIOLAN_U2C is not set -# CONFIG_I2C_EG20T is not set -# CONFIG_I2C_ELEKTOR is not set -# CONFIG_I2C_EMEV2 is not set -# CONFIG_I2C_GPIO is not set -# CONFIG_I2C_GPIO_FAULT_INJECTOR is not set -# CONFIG_I2C_HELPER_AUTO is not set -# CONFIG_I2C_HID is not set -# CONFIG_I2C_I801 is not set -# CONFIG_I2C_IBM_IIC is not set -# CONFIG_I2C_IMG is not set -# CONFIG_I2C_ISCH is not set -# CONFIG_I2C_ISMT is not set -# CONFIG_I2C_MLXCPLD is not set -# CONFIG_I2C_MPC is not set -# CONFIG_I2C_MUX is not set -# CONFIG_I2C_MUX_GPIO is not set -# CONFIG_I2C_MUX_GPMUX is not set -# CONFIG_I2C_MUX_LTC4306 is not set -# CONFIG_I2C_MUX_MLXCPLD 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_MV64XXX is not set -# CONFIG_I2C_NFORCE2 is not set -# CONFIG_I2C_NOMADIK is not set -# CONFIG_I2C_OCORES is not set -# CONFIG_I2C_OCTEON is not set -# CONFIG_I2C_PARPORT is not set -# CONFIG_I2C_PARPORT_LIGHT is not set -# CONFIG_I2C_PCA_ISA is not set -# CONFIG_I2C_PCA_PLATFORM is not set -# CONFIG_I2C_PIIX4 is not set -# CONFIG_I2C_PXA_PCI is not set -# CONFIG_I2C_RCAR is not set -# CONFIG_I2C_RK3X is not set -# CONFIG_I2C_ROBOTFUZZ_OSIF is not set -# CONFIG_I2C_S3C2410 is not set -# CONFIG_I2C_SCMI is not set -# CONFIG_I2C_SH_MOBILE is not set -# CONFIG_I2C_SIMTEC is not set -# CONFIG_I2C_SIS5595 is not set -# CONFIG_I2C_SIS630 is not set -# CONFIG_I2C_SIS96X is not set -# CONFIG_I2C_SLAVE is not set -# CONFIG_I2C_SMBUS is not set -# CONFIG_I2C_STUB is not set -# CONFIG_I2C_TAOS_EVM is not set -# CONFIG_I2C_THUNDERX is not set -# CONFIG_I2C_TINY_USB is not set -# CONFIG_I2C_VERSATILE is not set -# CONFIG_I2C_VIA is not set -# CONFIG_I2C_VIAPRO is not set -# CONFIG_I2C_XILINX is not set -# CONFIG_I40E is not set -# CONFIG_I40EVF is not set -# CONFIG_I6300ESB_WDT is not set -# CONFIG_I82092 is not set -# CONFIG_I82365 is not set -# CONFIG_IAQCORE is not set -# CONFIG_IBM_ASM is not set -# CONFIG_IBM_EMAC_DEBUG is not set -# CONFIG_IBM_EMAC_EMAC4 is not set -# CONFIG_IBM_EMAC_MAL_CLR_ICINTSTAT is not set -# CONFIG_IBM_EMAC_MAL_COMMON_ERR is not set -# CONFIG_IBM_EMAC_NO_FLOW_CTRL is not set -# CONFIG_IBM_EMAC_RGMII is not set -# CONFIG_IBM_EMAC_TAH is not set -# CONFIG_IBM_EMAC_ZMII is not set -# CONFIG_ICE is not set -# CONFIG_ICPLUS_PHY is not set -# CONFIG_ICS932S401 is not set -# CONFIG_IDE is not set -# CONFIG_IDEAPAD_LAPTOP is not set -# CONFIG_IDE_GD is not set -# CONFIG_IDE_PROC_FS is not set -# CONFIG_IDE_TASK_IOCTL is not set -# CONFIG_IDLE_PAGE_TRACKING is not set -# CONFIG_IEEE802154 is not set -# CONFIG_IEEE802154_ADF7242 is not set -# CONFIG_IEEE802154_ATUSB is not set -# CONFIG_IEEE802154_CA8210 is not set -# CONFIG_IEEE802154_HWSIM is not set -# CONFIG_IEEE802154_MCR20A is not set -# CONFIG_IFB is not set -# CONFIG_IGB is not set -# CONFIG_IGBVF is not set -# CONFIG_IIO is not set -# CONFIG_IIO_BUFFER_CB is not set -# CONFIG_IIO_BUFFER_HW_CONSUMER is not set -# CONFIG_IIO_CONFIGFS is not set -CONFIG_IIO_CONSUMERS_PER_TRIGGER=2 -# CONFIG_IIO_CROS_EC_ACCEL_LEGACY is not set -# CONFIG_IIO_INTERRUPT_TRIGGER is not set -# CONFIG_IIO_MUX is not set -# CONFIG_IIO_PERIODIC_RTC_TRIGGER is not set -# CONFIG_IIO_RESCALE is not set -# CONFIG_IIO_SIMPLE_DUMMY is not set -# CONFIG_IIO_SSP_SENSORHUB is not set -# CONFIG_IIO_ST_ACCEL_3AXIS is not set -# CONFIG_IIO_ST_GYRO_3AXIS is not set -# CONFIG_IIO_ST_LSM6DSX is not set -# CONFIG_IIO_ST_MAGN_3AXIS is not set -# CONFIG_IIO_ST_PRESS is not set -# CONFIG_IIO_SW_DEVICE is not set -# CONFIG_IIO_SW_TRIGGER is not set -# CONFIG_IIO_SYSFS_TRIGGER is not set -# CONFIG_IKCONFIG is not set -# CONFIG_IKCONFIG_PROC is not set -# CONFIG_IMAGE_CMDLINE_HACK is not set -# CONFIG_IMGPDC_WDT is not set -# CONFIG_IMG_MDC_DMA is not set -# CONFIG_IMX7D_ADC is not set -# CONFIG_IMX_IPUV3_CORE is not set -# CONFIG_IMX_THERMAL is not set -# CONFIG_INA2XX_ADC is not set -# CONFIG_INDIRECT_PIO is not set -CONFIG_INET=y -# CONFIG_INET6_AH is not set -# CONFIG_INET6_ESP is not set -# CONFIG_INET6_IPCOMP is not set -# CONFIG_INET6_TUNNEL is not set -# CONFIG_INET6_XFRM_MODE_BEET is not set -# CONFIG_INET6_XFRM_MODE_ROUTEOPTIMIZATION is not set -# CONFIG_INET6_XFRM_MODE_TRANSPORT is not set -# CONFIG_INET6_XFRM_MODE_TUNNEL is not set -# CONFIG_INET6_XFRM_TUNNEL is not set -# CONFIG_INET_AH is not set -# CONFIG_INET_DIAG is not set -# CONFIG_INET_ESP is not set -# CONFIG_INET_IPCOMP is not set -# CONFIG_INET_LRO is not set -# CONFIG_INET_TCP_DIAG is not set -# CONFIG_INET_TUNNEL is not set -# CONFIG_INET_UDP_DIAG is not set -# CONFIG_INET_XFRM_MODE_BEET is not set -# CONFIG_INET_XFRM_MODE_TRANSPORT is not set -# CONFIG_INET_XFRM_MODE_TUNNEL is not set -# CONFIG_INET_XFRM_TUNNEL is not set -# CONFIG_INFINIBAND is not set -# CONFIG_INFTL is not set -CONFIG_INIT_ENV_ARG_LIMIT=32 -# CONFIG_INLINE_READ_LOCK is not set -# CONFIG_INLINE_READ_LOCK_BH is not set -# CONFIG_INLINE_READ_LOCK_IRQ is not set -# CONFIG_INLINE_READ_LOCK_IRQSAVE is not set -# CONFIG_INLINE_READ_TRYLOCK is not set -CONFIG_INLINE_READ_UNLOCK=y -# CONFIG_INLINE_READ_UNLOCK_BH is not set -CONFIG_INLINE_READ_UNLOCK_IRQ=y -# CONFIG_INLINE_READ_UNLOCK_IRQRESTORE is not set -# CONFIG_INLINE_SPIN_LOCK is not set -# CONFIG_INLINE_SPIN_LOCK_BH is not set -# CONFIG_INLINE_SPIN_LOCK_IRQ is not set -# CONFIG_INLINE_SPIN_LOCK_IRQSAVE is not set -# CONFIG_INLINE_SPIN_TRYLOCK is not set -# CONFIG_INLINE_SPIN_TRYLOCK_BH is not set -# CONFIG_INLINE_SPIN_UNLOCK_BH is not set -CONFIG_INLINE_SPIN_UNLOCK_IRQ=y -# CONFIG_INLINE_SPIN_UNLOCK_IRQRESTORE is not set -# CONFIG_INLINE_WRITE_LOCK is not set -# CONFIG_INLINE_WRITE_LOCK_BH is not set -# CONFIG_INLINE_WRITE_LOCK_IRQ is not set -# CONFIG_INLINE_WRITE_LOCK_IRQSAVE is not set -# CONFIG_INLINE_WRITE_TRYLOCK is not set -CONFIG_INLINE_WRITE_UNLOCK=y -# CONFIG_INLINE_WRITE_UNLOCK_BH is not set -CONFIG_INLINE_WRITE_UNLOCK_IRQ=y -# CONFIG_INLINE_WRITE_UNLOCK_IRQRESTORE is not set -CONFIG_INOTIFY_USER=y -# CONFIG_INPUT is not set -# CONFIG_INPUT_AD714X is not set -# CONFIG_INPUT_ADXL34X is not set -# CONFIG_INPUT_APANEL is not set -# CONFIG_INPUT_ATI_REMOTE2 is not set -# CONFIG_INPUT_ATLAS_BTNS is not set -# CONFIG_INPUT_ATMEL_CAPTOUCH is not set -# CONFIG_INPUT_AXP20X_PEK is not set -# CONFIG_INPUT_BMA150 is not set -# CONFIG_INPUT_CM109 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_INPUT_E3X0_BUTTON is not set -# CONFIG_INPUT_EVBUG is not set -# CONFIG_INPUT_EVDEV is not set -# CONFIG_INPUT_FF_MEMLESS is not set -# CONFIG_INPUT_GP2A is not set -# CONFIG_INPUT_GPIO_BEEPER is not set -# CONFIG_INPUT_GPIO_DECODER is not set -# CONFIG_INPUT_GPIO_ROTARY_ENCODER is not set -# CONFIG_INPUT_GPIO_TILT_POLLED is not set -# CONFIG_INPUT_IDEAPAD_SLIDEBAR is not set -# CONFIG_INPUT_IMS_PCU is not set -# CONFIG_INPUT_JOYDEV is not set -# CONFIG_INPUT_JOYSTICK is not set -# CONFIG_INPUT_KEYBOARD is not set -# CONFIG_INPUT_KEYSPAN_REMOTE is not set -# CONFIG_INPUT_KXTJ9 is not set -# CONFIG_INPUT_LEDS is not set -# CONFIG_INPUT_MATRIXKMAP is not set -# CONFIG_INPUT_MAX8997_HAPTIC is not set -CONFIG_INPUT_MISC=y -# CONFIG_INPUT_MMA8450 is not set -# CONFIG_INPUT_MOUSE is not set -# CONFIG_INPUT_MOUSEDEV is not set -# CONFIG_INPUT_MPU3050 is not set -# CONFIG_INPUT_PALMAS_PWRBUTTON is not set -# CONFIG_INPUT_PCF8574 is not set -# CONFIG_INPUT_PCSPKR is not set -# CONFIG_INPUT_POLLDEV is not set -# CONFIG_INPUT_POWERMATE is not set -# CONFIG_INPUT_PWM_BEEPER is not set -# CONFIG_INPUT_PWM_VIBRA is not set -# CONFIG_INPUT_REGULATOR_HAPTIC is not set -# CONFIG_INPUT_SOC_BUTTON_ARRAY is not set -# CONFIG_INPUT_SPARSEKMAP is not set -# CONFIG_INPUT_TABLET is not set -# CONFIG_INPUT_TOUCHSCREEN is not set -# CONFIG_INPUT_TPS65218_PWRBUTTON is not set -# CONFIG_INPUT_TWL4030_PWRBUTTON is not set -# CONFIG_INPUT_TWL4030_VIBRA is not set -# CONFIG_INPUT_TWL6040_VIBRA is not set -# CONFIG_INPUT_UINPUT is not set -# CONFIG_INPUT_WISTRON_BTNS is not set -# CONFIG_INPUT_YEALINK is not set -# CONFIG_INT340X_THERMAL is not set -# CONFIG_INTEL_CHT_INT33FE is not set -# CONFIG_INTEL_HID_EVENT is not set -# CONFIG_INTEL_IDLE is not set -# CONFIG_INTEL_IDMA64 is not set -# CONFIG_INTEL_IOATDMA is not set -# CONFIG_INTEL_ISH_HID is not set -# CONFIG_INTEL_MEI is not set -# CONFIG_INTEL_MEI_ME is not set -# CONFIG_INTEL_MEI_TXE is not set -# CONFIG_INTEL_MIC_CARD is not set -# CONFIG_INTEL_MIC_HOST is not set -# CONFIG_INTEL_MID_PTI is not set -# CONFIG_INTEL_OAKTRAIL is not set -# CONFIG_INTEL_PMC_CORE is not set -# CONFIG_INTEL_PUNIT_IPC is not set -# CONFIG_INTEL_RST is not set -# CONFIG_INTEL_SMARTCONNECT is not set -# CONFIG_INTEL_SOC_PMIC is not set -# CONFIG_INTEL_SOC_PMIC_CHTDC_TI is not set -# CONFIG_INTEL_SOC_PMIC_CHTWC is not set -# CONFIG_INTEL_TH is not set -# CONFIG_INTEL_VBTN is not set -# CONFIG_INTEL_XWAY_PHY is not set -# CONFIG_INTERVAL_TREE_TEST is not set -# CONFIG_INV_MPU6050_I2C is not set -# CONFIG_INV_MPU6050_IIO is not set -# CONFIG_INV_MPU6050_SPI is not set -# CONFIG_IOMMU_SUPPORT is not set -# CONFIG_IOSCHED_BFQ is not set -# CONFIG_IOSCHED_CFQ is not set -CONFIG_IOSCHED_DEADLINE=y -CONFIG_IOSCHED_NOOP=y -CONFIG_IO_STRICT_DEVMEM=y -# CONFIG_IP17XX_PHY is not set -# CONFIG_IP6_NF_FILTER is not set -# CONFIG_IP6_NF_IPTABLES is not set -# CONFIG_IP6_NF_MANGLE is not set -# 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_HL is not set -# CONFIG_IP6_NF_MATCH_IPV6HEADER is not set -# CONFIG_IP6_NF_MATCH_MH is not set -# CONFIG_IP6_NF_MATCH_OPTS is not set -# CONFIG_IP6_NF_MATCH_RPFILTER is not set -# CONFIG_IP6_NF_MATCH_RT is not set -# CONFIG_IP6_NF_MATCH_SRH is not set -# CONFIG_IP6_NF_NAT is not set -# CONFIG_IP6_NF_RAW is not set -# CONFIG_IP6_NF_SECURITY is not set -# CONFIG_IP6_NF_TARGET_HL is not set -# CONFIG_IP6_NF_TARGET_REJECT is not set -# CONFIG_IP6_NF_TARGET_SYNPROXY is not set -# CONFIG_IPACK_BUS is not set -# CONFIG_IPC_NS is not set -# CONFIG_IPMI_HANDLER is not set -# CONFIG_IPV6 is not set -# CONFIG_IPV6_FOU is not set -# CONFIG_IPV6_FOU_TUNNEL is not set -# CONFIG_IPV6_ILA is not set -# CONFIG_IPV6_MIP6 is not set -# CONFIG_IPV6_MROUTE is not set -# CONFIG_IPV6_MROUTE_MULTIPLE_TABLES is not set -# CONFIG_IPV6_MULTIPLE_TABLES is not set -CONFIG_IPV6_NDISC_NODETYPE=y -# CONFIG_IPV6_OPTIMISTIC_DAD is not set -# CONFIG_IPV6_ROUTER_PREF is not set -# CONFIG_IPV6_ROUTE_INFO is not set -# CONFIG_IPV6_SEG6_HMAC is not set -# CONFIG_IPV6_SEG6_LWTUNNEL is not set -# CONFIG_IPV6_SIT is not set -# CONFIG_IPV6_SIT_6RD is not set -# CONFIG_IPV6_TUNNEL is not set -# CONFIG_IPV6_VTI is not set -# CONFIG_IPVLAN is not set -# CONFIG_IPW2100 is not set -# CONFIG_IPW2100_DEBUG is not set -CONFIG_IPW2100_MONITOR=y -# CONFIG_IPW2200 is not set -# CONFIG_IPW2200_DEBUG is not set -CONFIG_IPW2200_MONITOR=y -# CONFIG_IPW2200_PROMISCUOUS is not set -# CONFIG_IPW2200_QOS is not set -# CONFIG_IPW2200_RADIOTAP is not set -# CONFIG_IPWIRELESS is not set -# CONFIG_IPX is not set -CONFIG_IP_ADVANCED_ROUTER=y -# CONFIG_IP_DCCP is not set -# CONFIG_IP_FIB_TRIE_STATS is not set -# CONFIG_IP_MROUTE is not set -CONFIG_IP_MROUTE_MULTIPLE_TABLES=y -CONFIG_IP_MULTICAST=y -CONFIG_IP_MULTIPLE_TABLES=y -# CONFIG_IP_NF_ARPFILTER is not set -# CONFIG_IP_NF_ARPTABLES is not set -# CONFIG_IP_NF_ARP_MANGLE is not set -# CONFIG_IP_NF_FILTER is not set -# CONFIG_IP_NF_IPTABLES is not set -# CONFIG_IP_NF_MANGLE is not set -# 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_RAW is not set -# CONFIG_IP_NF_SECURITY is not set -# CONFIG_IP_NF_TARGET_CLUSTERIP is not set -# CONFIG_IP_NF_TARGET_ECN is not set -# CONFIG_IP_NF_TARGET_MASQUERADE is not set -# CONFIG_IP_NF_TARGET_NETMAP is not set -# CONFIG_IP_NF_TARGET_REDIRECT is not set -# CONFIG_IP_NF_TARGET_REJECT is not set -# CONFIG_IP_NF_TARGET_SYNPROXY is not set -# CONFIG_IP_NF_TARGET_TTL is not set -# CONFIG_IP_PIMSM_V1 is not set -# CONFIG_IP_PIMSM_V2 is not set -# CONFIG_IP_PNP is not set -CONFIG_IP_ROUTE_MULTIPATH=y -CONFIG_IP_ROUTE_VERBOSE=y -# CONFIG_IP_SCTP is not set -# CONFIG_IP_SET is not set -# CONFIG_IP_SET_HASH_IPMAC is not set -# CONFIG_IP_VS is not set -# CONFIG_IP_VS_MH is not set -CONFIG_IP_VS_MH_TAB_INDEX=10 -# CONFIG_IRDA is not set -# CONFIG_IRQSOFF_TRACER is not set -# CONFIG_IRQ_ALL_CPUS is not set -# CONFIG_IRQ_DOMAIN_DEBUG is not set -# CONFIG_IRQ_POLL is not set -# CONFIG_IRQ_TIME_ACCOUNTING is not set -# CONFIG_IR_GPIO_CIR is not set -# CONFIG_IR_HIX5HD2 is not set -# CONFIG_IR_IGORPLUGUSB is not set -# CONFIG_IR_IGUANA is not set -# CONFIG_IR_IMG is not set -# CONFIG_IR_IMON is not set -# CONFIG_IR_JVC_DECODER is not set -# CONFIG_IR_LIRC_CODEC is not set -# CONFIG_IR_MCEUSB is not set -# CONFIG_IR_NEC_DECODER is not set -# CONFIG_IR_RC5_DECODER is not set -# CONFIG_IR_RC6_DECODER is not set -# CONFIG_IR_REDRAT3 is not set -# CONFIG_IR_SONY_DECODER is not set -# CONFIG_IR_STREAMZAP is not set -# CONFIG_IR_TTUSBIR is not set -# CONFIG_ISA_BUS is not set -# CONFIG_ISA_BUS_API is not set -# CONFIG_ISCSI_BOOT_SYSFS is not set -# CONFIG_ISCSI_TCP is not set -CONFIG_ISDN=y -# CONFIG_ISDN_AUDIO is not set -# CONFIG_ISDN_CAPI is not set -# CONFIG_ISDN_CAPI_CAPIDRV is not set -# CONFIG_ISDN_DIVERSION is not set -# CONFIG_ISDN_DRV_ACT2000 is not set -# CONFIG_ISDN_DRV_GIGASET is not set -# CONFIG_ISDN_DRV_HISAX is not set -# CONFIG_ISDN_DRV_ICN is not set -# CONFIG_ISDN_DRV_LOOP is not set -# CONFIG_ISDN_DRV_PCBIT is not set -# CONFIG_ISDN_DRV_SC is not set -# CONFIG_ISDN_I4L is not set -# CONFIG_ISL29003 is not set -# CONFIG_ISL29020 is not set -# CONFIG_ISL29125 is not set -# CONFIG_ISL29501 is not set -# CONFIG_ISO9660_FS is not set -# CONFIG_ISS4xx is not set -# CONFIG_ITG3200 is not set -# CONFIG_IWL3945 is not set -# CONFIG_IWLWIFI is not set -# CONFIG_IXGB is not set -# CONFIG_IXGBE is not set -# CONFIG_IXGBEVF is not set -# CONFIG_JAILHOUSE_GUEST is not set -# CONFIG_JBD2_DEBUG is not set -# CONFIG_JFFS2_CMODE_FAVOURLZO is not set -# CONFIG_JFFS2_CMODE_NONE is not set -CONFIG_JFFS2_CMODE_PRIORITY=y -# CONFIG_JFFS2_CMODE_SIZE is not set -CONFIG_JFFS2_COMPRESSION_OPTIONS=y -CONFIG_JFFS2_FS=y -CONFIG_JFFS2_FS_DEBUG=0 -# CONFIG_JFFS2_FS_POSIX_ACL is not set -# CONFIG_JFFS2_FS_SECURITY is not set -# CONFIG_JFFS2_FS_WBUF_VERIFY is not set -CONFIG_JFFS2_FS_WRITEBUFFER=y -CONFIG_JFFS2_FS_XATTR=y -CONFIG_JFFS2_LZMA=y -# CONFIG_JFFS2_LZO is not set -CONFIG_JFFS2_RTIME=y -# CONFIG_JFFS2_RUBIN is not set -CONFIG_JFFS2_SUMMARY=y -# CONFIG_JFFS2_ZLIB is not set -# CONFIG_JFS_DEBUG is not set -# CONFIG_JFS_FS is not set -# CONFIG_JFS_POSIX_ACL is not set -# CONFIG_JFS_SECURITY is not set -# CONFIG_JFS_STATISTICS is not set -# CONFIG_JME is not set -CONFIG_JOLIET=y -# CONFIG_JSA1212 is not set -# CONFIG_JUMP_LABEL is not set -# CONFIG_KALLSYMS is not set -# CONFIG_KALLSYMS_ABSOLUTE_PERCPU is not set -# CONFIG_KALLSYMS_ALL is not set -CONFIG_KALLSYMS_BASE_RELATIVE=y -# CONFIG_KALLSYMS_UNCOMPRESSED is not set -# CONFIG_KARMA_PARTITION is not set -# CONFIG_KASAN is not set -# CONFIG_KCOV is not set -# CONFIG_KERNEL_BZIP2 is not set -# CONFIG_KERNEL_CAT is not set -# CONFIG_KERNEL_GZIP is not set -# CONFIG_KERNEL_LZ4 is not set -# CONFIG_KERNEL_LZMA is not set -# CONFIG_KERNEL_LZO is not set -CONFIG_KERNEL_MODE_NEON=y -CONFIG_KERNEL_XZ=y -CONFIG_KERNFS=y -# CONFIG_KEXEC is not set -# CONFIG_KEXEC_FILE is not set -# CONFIG_KEYBOARD_ADC is not set -# CONFIG_KEYBOARD_ADP5588 is not set -# CONFIG_KEYBOARD_ADP5589 is not set -# CONFIG_KEYBOARD_ATKBD is not set -# CONFIG_KEYBOARD_BCM is not set -# CONFIG_KEYBOARD_CAP11XX is not set -# CONFIG_KEYBOARD_DLINK_DIR685 is not set -# CONFIG_KEYBOARD_GPIO is not set -# CONFIG_KEYBOARD_GPIO_POLLED is not set -# CONFIG_KEYBOARD_LKKBD is not set -# CONFIG_KEYBOARD_LM8323 is not set -# CONFIG_KEYBOARD_LM8333 is not set -# CONFIG_KEYBOARD_MATRIX 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_OMAP4 is not set -# CONFIG_KEYBOARD_OPENCORES is not set -# CONFIG_KEYBOARD_PXA27x is not set -# CONFIG_KEYBOARD_QT1070 is not set -# CONFIG_KEYBOARD_QT2160 is not set -# CONFIG_KEYBOARD_SAMSUNG is not set -# CONFIG_KEYBOARD_SH_KEYSC is not set -# CONFIG_KEYBOARD_SNVS_PWRKEY is not set -# CONFIG_KEYBOARD_STMPE is not set -# CONFIG_KEYBOARD_STOWAWAY is not set -# CONFIG_KEYBOARD_SUNKBD is not set -# CONFIG_KEYBOARD_TCA6416 is not set -# CONFIG_KEYBOARD_TCA8418 is not set -# CONFIG_KEYBOARD_TM2_TOUCHKEY is not set -# CONFIG_KEYBOARD_TWL4030 is not set -# CONFIG_KEYBOARD_XTKBD is not set -# CONFIG_KEYS is not set -# CONFIG_KEY_DH_OPERATIONS is not set -# CONFIG_KGDB is not set -# CONFIG_KMEMCHECK is not set -# CONFIG_KMX61 is not set -# CONFIG_KPROBES is not set -# CONFIG_KPROBES_SANITY_TEST is not set -# CONFIG_KS7010 is not set -# CONFIG_KS8842 is not set -# CONFIG_KS8851 is not set -# CONFIG_KS8851_MLL is not set -# CONFIG_KSM is not set -# CONFIG_KSZ884X_PCI is not set -CONFIG_KUSER_HELPERS=y -# CONFIG_KVM_AMD is not set -# CONFIG_KVM_GUEST is not set -# CONFIG_KVM_INTEL is not set -# CONFIG_KXCJK1013 is not set -# CONFIG_KXSD9 is not set -# CONFIG_L2TP is not set -# CONFIG_L2TP_ETH is not set -# CONFIG_L2TP_IP is not set -# CONFIG_L2TP_V3 is not set -# CONFIG_LAN743X is not set -# CONFIG_LANMEDIA is not set -# CONFIG_LANTIQ is not set -# CONFIG_LAPB is not set -# CONFIG_LASAT is not set -# CONFIG_LATENCYTOP is not set -# CONFIG_LATTICE_ECP3_CONFIG is not set -CONFIG_LBDAF=y -# CONFIG_LCD_AMS369FG06 is not set -# CONFIG_LCD_HX8357 is not set -# CONFIG_LCD_ILI922X is not set -# CONFIG_LCD_ILI9320 is not set -# CONFIG_LCD_L4F00242T03 is not set -# CONFIG_LCD_LD9040 is not set -# CONFIG_LCD_LMS283GF05 is not set -# CONFIG_LCD_LMS501KF03 is not set -# CONFIG_LCD_LTV350QV is not set -# CONFIG_LCD_OTM3225A is not set -# CONFIG_LCD_S6E63M0 is not set -# CONFIG_LCD_TDO24M is not set -# CONFIG_LCD_VGG2432A4 is not set -# CONFIG_LDM_PARTITION is not set -CONFIG_LD_DEAD_CODE_DATA_ELIMINATION=y -# CONFIG_LEDS_APU is not set -# CONFIG_LEDS_BCM6328 is not set -# CONFIG_LEDS_BCM6358 is not set -# CONFIG_LEDS_BD2802 is not set -# CONFIG_LEDS_BLINKM is not set -CONFIG_LEDS_BRIGHTNESS_HW_CHANGED=y -CONFIG_LEDS_CLASS=y -# CONFIG_LEDS_CLASS_FLASH is not set -# CONFIG_LEDS_CR0014114 is not set -# CONFIG_LEDS_DAC124S085 is not set -# CONFIG_LEDS_GPIO is not set -# CONFIG_LEDS_INTEL_SS4200 is not set -# CONFIG_LEDS_IS31FL319X is not set -# CONFIG_LEDS_IS31FL32XX is not set -# CONFIG_LEDS_LM3530 is not set -# CONFIG_LEDS_LM355x is not set -# CONFIG_LEDS_LM3642 is not set -# CONFIG_LEDS_LM3692X is not set -# CONFIG_LEDS_LP3944 is not set -# CONFIG_LEDS_LP3952 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_LT3593 is not set -# CONFIG_LEDS_MLXCPLD is not set -# CONFIG_LEDS_MLXREG is not set -# CONFIG_LEDS_NIC78BX is not set -# CONFIG_LEDS_NS2 is not set -# CONFIG_LEDS_OT200 is not set -# CONFIG_LEDS_PCA9532 is not set -# CONFIG_LEDS_PCA955X is not set -# CONFIG_LEDS_PCA963X is not set -# CONFIG_LEDS_PWM is not set -# CONFIG_LEDS_REGULATOR is not set -# CONFIG_LEDS_SYSCON is not set -# CONFIG_LEDS_TCA6507 is not set -# CONFIG_LEDS_TLC591XX is not set -CONFIG_LEDS_TRIGGERS=y -# CONFIG_LEDS_TRIGGER_ACTIVITY is not set -# CONFIG_LEDS_TRIGGER_BACKLIGHT is not set -# CONFIG_LEDS_TRIGGER_CAMERA is not set -# CONFIG_LEDS_TRIGGER_CPU is not set -CONFIG_LEDS_TRIGGER_DEFAULT_ON=y -# CONFIG_LEDS_TRIGGER_DISK is not set -# CONFIG_LEDS_TRIGGER_GPIO is not set -# CONFIG_LEDS_TRIGGER_HEARTBEAT is not set -# CONFIG_LEDS_TRIGGER_IDE_DISK is not set -# CONFIG_LEDS_TRIGGER_MTD is not set -CONFIG_LEDS_TRIGGER_NETDEV=y -# CONFIG_LEDS_TRIGGER_ONESHOT is not set -# CONFIG_LEDS_TRIGGER_PANIC is not set -CONFIG_LEDS_TRIGGER_TIMER=y -# CONFIG_LEDS_TRIGGER_TRANSIENT is not set -# CONFIG_LEDS_USER is not set -# CONFIG_LED_TRIGGER_PHY is not set -# CONFIG_LEGACY_PTYS is not set -# CONFIG_LGUEST is not set -# CONFIG_LIB80211 is not set -# CONFIG_LIB80211_CRYPT_CCMP is not set -# CONFIG_LIB80211_CRYPT_TKIP is not set -# CONFIG_LIB80211_CRYPT_WEP is not set -# CONFIG_LIB80211_DEBUG is not set -# CONFIG_LIBCRC32C is not set -# CONFIG_LIBERTAS is not set -# CONFIG_LIBERTAS_THINFIRM is not set -# CONFIG_LIBERTAS_USB is not set -# CONFIG_LIBFC is not set -# CONFIG_LIBFCOE is not set -# CONFIG_LIBIPW_DEBUG is not set -# CONFIG_LIBNVDIMM is not set -# CONFIG_LIDAR_LITE_V2 is not set -# CONFIG_LIQUIDIO is not set -# CONFIG_LIQUIDIO_VF is not set -# CONFIG_LIS3L02DQ is not set -# CONFIG_LKDTM is not set -CONFIG_LLC=y -# CONFIG_LLC2 is not set -# CONFIG_LMP91000 is not set -# CONFIG_LNET is not set -CONFIG_LOCALVERSION="" -# CONFIG_LOCALVERSION_AUTO is not set -# CONFIG_LOCKD is not set -CONFIG_LOCKDEP_SUPPORT=y -CONFIG_LOCKD_V4=y -# CONFIG_LOCKUP_DETECTOR is not set -# CONFIG_LOCK_STAT is not set -# CONFIG_LOCK_TORTURE_TEST is not set -# CONFIG_LOGFS is not set -# CONFIG_LOGIG940_FF is not set -# CONFIG_LOGIRUMBLEPAD2_FF is not set -# CONFIG_LOGITECH_FF is not set -# CONFIG_LOGIWHEELS_FF is not set -# CONFIG_LOGO is not set -CONFIG_LOG_BUF_SHIFT=17 -CONFIG_LOG_CPU_MAX_BUF_SHIFT=12 -# CONFIG_LOONGSON_MC146818 is not set -# CONFIG_LPC_ICH is not set -# CONFIG_LPC_SCH is not set -# CONFIG_LP_CONSOLE is not set -# CONFIG_LSI_ET1011C_PHY is not set -# CONFIG_LTC2471 is not set -# CONFIG_LTC2485 is not set -# CONFIG_LTC2497 is not set -# CONFIG_LTC2632 is not set -# CONFIG_LTE_GDM724X is not set -# CONFIG_LTPC is not set -# CONFIG_LTR501 is not set -# CONFIG_LUSTRE_FS is not set -# CONFIG_LV0104CS is not set -# CONFIG_LWTUNNEL is not set -# CONFIG_LXT_PHY is not set -# CONFIG_LZ4HC_COMPRESS is not set -# CONFIG_LZ4_COMPRESS is not set -# CONFIG_LZ4_DECOMPRESS is not set -CONFIG_LZMA_COMPRESS=y -CONFIG_LZMA_DECOMPRESS=y -# CONFIG_LZO_COMPRESS is not set -# CONFIG_LZO_DECOMPRESS is not set -# CONFIG_M62332 is not set -# CONFIG_MAC80211 is not set -# CONFIG_MAC80211_MESSAGE_TRACING is not set -CONFIG_MAC80211_STA_HASH_MAX_SIZE=0 -# CONFIG_MACB is not set -# CONFIG_MACH_ASM9260 is not set -# CONFIG_MACH_DECSTATION is not set -# CONFIG_MACH_INGENIC is not set -# CONFIG_MACH_JAZZ is not set -# CONFIG_MACH_JZ4740 is not set -# CONFIG_MACH_LOONGSON32 is not set -# CONFIG_MACH_LOONGSON64 is not set -# CONFIG_MACH_PIC32 is not set -# CONFIG_MACH_PISTACHIO is not set -# CONFIG_MACH_TX39XX is not set -# CONFIG_MACH_TX49XX is not set -# CONFIG_MACH_VR41XX is not set -# CONFIG_MACH_XILFPGA is not set -# CONFIG_MACINTOSH_DRIVERS is not set -# CONFIG_MACSEC is not set -# CONFIG_MACVLAN is not set -# CONFIG_MACVTAP is not set -# CONFIG_MAC_EMUMOUSEBTN is not set -# CONFIG_MAC_PARTITION is not set -# CONFIG_MAG3110 is not set -# CONFIG_MAGIC_SYSRQ is not set -CONFIG_MAGIC_SYSRQ_DEFAULT_ENABLE=0x1 -# CONFIG_MAGIC_SYSRQ_SERIAL is not set -# CONFIG_MAILBOX is not set -# CONFIG_MANAGER_SBS is not set -# CONFIG_MANDATORY_FILE_LOCKING is not set -# CONFIG_MANGLE_BOOTARGS is not set -# CONFIG_MARVELL_10G_PHY is not set -# CONFIG_MARVELL_PHY is not set -# CONFIG_MAX1027 is not set -# CONFIG_MAX11100 is not set -# CONFIG_MAX1118 is not set -# CONFIG_MAX1363 is not set -# CONFIG_MAX30100 is not set -# CONFIG_MAX30102 is not set -# CONFIG_MAX44000 is not set -# CONFIG_MAX517 is not set -# CONFIG_MAX5481 is not set -# CONFIG_MAX5487 is not set -# CONFIG_MAX5821 is not set -# CONFIG_MAX63XX_WATCHDOG is not set -# CONFIG_MAX9611 is not set -# CONFIG_MAXIM_THERMOCOUPLE is not set -CONFIG_MAY_USE_DEVLINK=y -# CONFIG_MC3230 is not set -# CONFIG_MCB is not set -# CONFIG_MCP320X is not set -# CONFIG_MCP3422 is not set -# CONFIG_MCP4018 is not set -# CONFIG_MCP4131 is not set -# CONFIG_MCP4531 is not set -# CONFIG_MCP4725 is not set -# CONFIG_MCP4922 is not set -# CONFIG_MCPM is not set -# CONFIG_MD is not set -# CONFIG_MDIO_BCM_UNIMAC 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_DEVICE is not set -# CONFIG_MDIO_HISI_FEMAC is not set -# CONFIG_MDIO_MSCC_MIIM is not set -# CONFIG_MDIO_OCTEON is not set -# CONFIG_MDIO_THUNDER is not set -# CONFIG_MD_FAULTY is not set -# CONFIG_MEDIA_ANALOG_TV_SUPPORT is not set -# CONFIG_MEDIA_ATTACH is not set -# CONFIG_MEDIA_CAMERA_SUPPORT is not set -# CONFIG_MEDIA_CEC_SUPPORT is not set -# CONFIG_MEDIA_CONTROLLER is not set -# CONFIG_MEDIA_DIGITAL_TV_SUPPORT is not set -# CONFIG_MEDIA_PCI_SUPPORT is not set -# CONFIG_MEDIA_RADIO_SUPPORT is not set -# CONFIG_MEDIA_RC_SUPPORT is not set -# CONFIG_MEDIA_SDR_SUPPORT is not set -# CONFIG_MEDIA_SUBDRV_AUTOSELECT is not set -# CONFIG_MEDIA_SUPPORT is not set -# CONFIG_MEDIA_USB_SUPPORT is not set -# CONFIG_MEGARAID_LEGACY is not set -# CONFIG_MEGARAID_NEWGEN is not set -# CONFIG_MEGARAID_SAS is not set -# CONFIG_MELLANOX_PLATFORM is not set -CONFIG_MEMBARRIER=y -# CONFIG_MEMORY is not set -# CONFIG_MEMORY_FAILURE is not set -# CONFIG_MEMSTICK is not set -# CONFIG_MEMTEST is not set -# CONFIG_MEN_A21_WDT is not set -# CONFIG_MESON_SM is not set -CONFIG_MESSAGE_LOGLEVEL_DEFAULT=4 -# CONFIG_MFD_88PM800 is not set -# CONFIG_MFD_88PM805 is not set -# CONFIG_MFD_88PM860X is not set -# CONFIG_MFD_AAT2870_CORE is not set -# CONFIG_MFD_ACT8945A is not set -# CONFIG_MFD_ARIZONA_I2C is not set -# CONFIG_MFD_ARIZONA_SPI is not set -# CONFIG_MFD_AS3711 is not set -# CONFIG_MFD_AS3722 is not set -# CONFIG_MFD_ASIC3 is not set -# CONFIG_MFD_ATMEL_FLEXCOM is not set -# CONFIG_MFD_ATMEL_HLCDC is not set -# CONFIG_MFD_AXP20X is not set -# CONFIG_MFD_AXP20X_I2C is not set -# CONFIG_MFD_BCM590XX is not set -# CONFIG_MFD_BD9571MWV is not set -# CONFIG_MFD_CORE is not set -# CONFIG_MFD_CPCAP is not set -# CONFIG_MFD_CROS_EC is not set -# CONFIG_MFD_CS5535 is not set -# CONFIG_MFD_DA9052_I2C is not set -# CONFIG_MFD_DA9052_SPI 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_EXYNOS_LPASS is not set -# CONFIG_MFD_HI6421_PMIC is not set -# CONFIG_MFD_INTEL_QUARK_I2C_GPIO is not set -# CONFIG_MFD_JANZ_CMODIO is not set -# CONFIG_MFD_KEMPLD is not set -# CONFIG_MFD_LM3533 is not set -# CONFIG_MFD_LP3943 is not set -# CONFIG_MFD_LP8788 is not set -# CONFIG_MFD_MADERA is not set -# CONFIG_MFD_MAX14577 is not set -# CONFIG_MFD_MAX77620 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_MC13XXX is not set -# CONFIG_MFD_MC13XXX_I2C is not set -# CONFIG_MFD_MC13XXX_SPI is not set -# CONFIG_MFD_MENF21BMC is not set -# CONFIG_MFD_MT6397 is not set -# CONFIG_MFD_OMAP_USB_HOST is not set -# CONFIG_MFD_PALMAS is not set -# CONFIG_MFD_PCF50633 is not set -# CONFIG_MFD_PM8921_CORE is not set -# CONFIG_MFD_PM8XXX is not set -# CONFIG_MFD_RC5T583 is not set -# CONFIG_MFD_RDC321X is not set -# CONFIG_MFD_RETU is not set -# CONFIG_MFD_RK808 is not set -# CONFIG_MFD_RN5T618 is not set -# CONFIG_MFD_ROHM_BD718XX is not set -# CONFIG_MFD_RT5033 is not set -# CONFIG_MFD_RTSX_PCI is not set -# CONFIG_MFD_RTSX_USB is not set -# CONFIG_MFD_SEC_CORE is not set -# CONFIG_MFD_SI476X_CORE is not set -# CONFIG_MFD_SKY81452 is not set -# CONFIG_MFD_SM501 is not set -# CONFIG_MFD_SMSC is not set -# CONFIG_MFD_STMPE is not set -# CONFIG_MFD_SYSCON is not set -# CONFIG_MFD_T7L66XB is not set -# CONFIG_MFD_TC3589X is not set -# CONFIG_MFD_TC6387XB is not set -# CONFIG_MFD_TC6393XB is not set -# CONFIG_MFD_TIMBERDALE is not set -# CONFIG_MFD_TI_AM335X_TSCADC is not set -# CONFIG_MFD_TI_LMU is not set -# CONFIG_MFD_TI_LP873X is not set -# CONFIG_MFD_TI_LP87565 is not set -# CONFIG_MFD_TMIO 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_TPS68470 is not set -# CONFIG_MFD_TPS80031 is not set -# CONFIG_MFD_VIPERBOARD is not set -# CONFIG_MFD_VX855 is not set -# CONFIG_MFD_WL1273_CORE is not set -# CONFIG_MFD_WM831X 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_WM8400 is not set -# CONFIG_MFD_WM8994 is not set -# CONFIG_MG_DISK is not set -# CONFIG_MICREL_KS8995MA is not set -# CONFIG_MICREL_PHY is not set -# CONFIG_MICROCHIP_KSZ is not set -# CONFIG_MICROCHIP_PHY is not set -# CONFIG_MICROCHIP_T1_PHY is not set -# CONFIG_MICROSEMI_PHY is not set -# CONFIG_MIGRATION is not set -CONFIG_MII=y -# CONFIG_MIKROTIK_RB532 is not set -# CONFIG_MINIX_FS is not set -# CONFIG_MINIX_FS_NATIVE_ENDIAN is not set -# CONFIG_MINIX_SUBPARTITION is not set -# CONFIG_MIPS_ALCHEMY is not set -# CONFIG_MIPS_CDMM is not set -# CONFIG_MIPS_COBALT is not set -# CONFIG_MIPS_FPU_EMULATOR is not set -# CONFIG_MIPS_GENERIC is not set -# CONFIG_MIPS_MALTA is not set -# CONFIG_MIPS_O32_FP64_SUPPORT is not set -# CONFIG_MIPS_PARAVIRT is not set -# CONFIG_MIPS_PLATFORM_DEVICES is not set -# CONFIG_MIPS_SEAD3 is not set -CONFIG_MISC_FILESYSTEMS=y -# CONFIG_MISC_RTSX_PCI is not set -# CONFIG_MISC_RTSX_USB is not set -# CONFIG_MISDN is not set -# CONFIG_MISDN_AVMFRITZ is not set -# CONFIG_MISDN_HFCPCI is not set -# CONFIG_MISDN_HFCUSB is not set -# CONFIG_MISDN_INFINEON is not set -# CONFIG_MISDN_NETJET is not set -# CONFIG_MISDN_SPEEDFAX is not set -# CONFIG_MISDN_W6692 is not set -# CONFIG_MKISS is not set -# CONFIG_MLX4_CORE is not set -# CONFIG_MLX4_EN is not set -# CONFIG_MLX5_CORE is not set -# CONFIG_MLX90614 is not set -# CONFIG_MLX90632 is not set -# CONFIG_MLXFW is not set -# CONFIG_MLXSW_CORE is not set -# CONFIG_MLX_CPLD_PLATFORM is not set -# CONFIG_MLX_PLATFORM is not set -# CONFIG_MMA7455_I2C is not set -# CONFIG_MMA7455_SPI is not set -# CONFIG_MMA7660 is not set -# CONFIG_MMA8452 is not set -# CONFIG_MMA9551 is not set -# CONFIG_MMA9553 is not set -# CONFIG_MMC is not set -# CONFIG_MMC35240 is not set -# CONFIG_MMC_ARMMMCI is not set -# CONFIG_MMC_AU1X is not set -# CONFIG_MMC_BLOCK is not set -CONFIG_MMC_BLOCK_BOUNCE=y -CONFIG_MMC_BLOCK_MINORS=8 -# CONFIG_MMC_CAVIUM_THUNDERX is not set -# CONFIG_MMC_CB710 is not set -# CONFIG_MMC_CQHCI is not set -# CONFIG_MMC_DEBUG is not set -# CONFIG_MMC_DW is not set -# CONFIG_MMC_MTK is not set -# CONFIG_MMC_MVSDIO is not set -# CONFIG_MMC_S3C is not set -# CONFIG_MMC_SDHCI is not set -# CONFIG_MMC_SDHCI_ACPI is not set -# CONFIG_MMC_SDHCI_BCM_KONA is not set -# CONFIG_MMC_SDHCI_CADENCE is not set -# CONFIG_MMC_SDHCI_F_SDH30 is not set -# CONFIG_MMC_SDHCI_IPROC is not set -# CONFIG_MMC_SDHCI_MSM is not set -# CONFIG_MMC_SDHCI_OF_ARASAN is not set -# CONFIG_MMC_SDHCI_OF_AT91 is not set -# CONFIG_MMC_SDHCI_OF_DWCMSHC is not set -# CONFIG_MMC_SDHCI_OF_ESDHC is not set -# CONFIG_MMC_SDHCI_OF_HLWD is not set -# CONFIG_MMC_SDHCI_OMAP is not set -# CONFIG_MMC_SDHCI_PXAV2 is not set -# CONFIG_MMC_SDHCI_PXAV3 is not set -# CONFIG_MMC_SDHCI_S3C is not set -# CONFIG_MMC_SDHCI_XENON is not set -# CONFIG_MMC_SDRICOH_CS is not set -# CONFIG_MMC_SPI is not set -# CONFIG_MMC_TEST is not set -# CONFIG_MMC_TOSHIBA_PCI is not set -# CONFIG_MMC_USDHI6ROL0 is not set -# CONFIG_MMC_USHC is not set -# CONFIG_MMC_VIA_SDMMC is not set -# CONFIG_MMC_VUB300 is not set -# CONFIG_MMIOTRACE is not set -CONFIG_MMU=y -CONFIG_MODULES=y -# CONFIG_MODULE_COMPRESS is not set -# CONFIG_MODULE_FORCE_LOAD is not set -# CONFIG_MODULE_FORCE_UNLOAD is not set -# CONFIG_MODULE_SIG is not set -# CONFIG_MODULE_SRCVERSION_ALL is not set -CONFIG_MODULE_STRIPPED=y -CONFIG_MODULE_UNLOAD=y -# CONFIG_MODVERSIONS is not set -# CONFIG_MOST is not set -# CONFIG_MOUSE_APPLETOUCH is not set -# CONFIG_MOUSE_ELAN_I2C is not set -# CONFIG_MOUSE_GPIO is not set -# CONFIG_MOUSE_INPORT is not set -# CONFIG_MOUSE_LOGIBM is not set -# CONFIG_MOUSE_PC110PAD is not set -# CONFIG_MOUSE_PS2_FOCALTECH is not set -# CONFIG_MOUSE_PS2_SENTELIC is not set -# CONFIG_MOUSE_SYNAPTICS_I2C is not set -# CONFIG_MOUSE_SYNAPTICS_USB is not set -# CONFIG_MPL115 is not set -# CONFIG_MPL115_I2C is not set -# CONFIG_MPL115_SPI is not set -# CONFIG_MPL3115 is not set -# CONFIG_MPLS is not set -# CONFIG_MPU3050_I2C is not set -# CONFIG_MQ_IOSCHED_DEADLINE is not set -# CONFIG_MQ_IOSCHED_KYBER is not set -# CONFIG_MS5611 is not set -# CONFIG_MS5637 is not set -# CONFIG_MSDOS_FS is not set -CONFIG_MSDOS_PARTITION=y -# CONFIG_MSI_BITMAP_SELFTEST is not set -# CONFIG_MSI_LAPTOP is not set -CONFIG_MTD=y -# CONFIG_MTD_ABSENT is not set -# CONFIG_MTD_AFS_PARTS is not set -# CONFIG_MTD_AR7_PARTS is not set -CONFIG_MTD_BLKDEVS=y -CONFIG_MTD_BLOCK=y -# CONFIG_MTD_BLOCK2MTD is not set -CONFIG_MTD_CFI=y -# CONFIG_MTD_CFI_ADV_OPTIONS is not set -CONFIG_MTD_CFI_AMDSTD=y -# CONFIG_MTD_CFI_BE_BYTE_SWAP 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_LE_BYTE_SWAP is not set -CONFIG_MTD_CFI_NOSWAP=y -# CONFIG_MTD_CFI_STAA is not set -CONFIG_MTD_CFI_UTIL=y -# CONFIG_MTD_CMDLINE_PARTS is not set -CONFIG_MTD_COMPLEX_MAPPINGS=y -# CONFIG_MTD_DATAFLASH is not set -# CONFIG_MTD_DOCG3 is not set -CONFIG_MTD_GEN_PROBE=y -# CONFIG_MTD_GPIO_ADDR is not set -# CONFIG_MTD_INTEL_VR_NOR is not set -# CONFIG_MTD_JEDECPROBE is not set -# CONFIG_MTD_LATCH_ADDR is not set -# CONFIG_MTD_LPDDR is not set -# CONFIG_MTD_LPDDR2_NVM is not set -# CONFIG_MTD_M25P80 is not set -CONFIG_MTD_MAP_BANK_WIDTH_1=y -# CONFIG_MTD_MAP_BANK_WIDTH_16 is not set -CONFIG_MTD_MAP_BANK_WIDTH_2=y -# CONFIG_MTD_MAP_BANK_WIDTH_32 is not set -CONFIG_MTD_MAP_BANK_WIDTH_4=y -# CONFIG_MTD_MAP_BANK_WIDTH_8 is not set -# CONFIG_MTD_MCHP23K256 is not set -# CONFIG_MTD_MT81xx_NOR is not set -# CONFIG_MTD_MTDRAM is not set -# CONFIG_MTD_MYLOADER_PARTS is not set -# CONFIG_MTD_NAND is not set -# CONFIG_MTD_NAND_AMS_DELTA is not set -# CONFIG_MTD_NAND_AR934X is not set -# CONFIG_MTD_NAND_AR934X_HW_ECC is not set -# CONFIG_MTD_NAND_ATMEL is not set -# CONFIG_MTD_NAND_AU1550 is not set -# CONFIG_MTD_NAND_BCH is not set -# CONFIG_MTD_NAND_BF5XX is not set -# CONFIG_MTD_NAND_BRCMNAND is not set -# CONFIG_MTD_NAND_CAFE is not set -# CONFIG_MTD_NAND_CM_X270 is not set -# CONFIG_MTD_NAND_CS553X is not set -# CONFIG_MTD_NAND_DAVINCI is not set -# CONFIG_MTD_NAND_DENALI is not set -# CONFIG_MTD_NAND_DENALI_DT is not set -# CONFIG_MTD_NAND_DENALI_PCI is not set -CONFIG_MTD_NAND_DENALI_SCRATCH_REG_ADDR=0xff108018 -# CONFIG_MTD_NAND_DISKONCHIP is not set -# CONFIG_MTD_NAND_DOCG4 is not set -# CONFIG_MTD_NAND_ECC is not set -# CONFIG_MTD_NAND_ECC_BCH is not set -# CONFIG_MTD_NAND_ECC_SMC is not set -# CONFIG_MTD_NAND_FSL_ELBC is not set -# CONFIG_MTD_NAND_FSL_IFC is not set -# CONFIG_MTD_NAND_FSL_UPM is not set -# CONFIG_MTD_NAND_FSMC is not set -# CONFIG_MTD_NAND_GPIO is not set -# CONFIG_MTD_NAND_GPMI_NAND is not set -# CONFIG_MTD_NAND_HISI504 is not set -CONFIG_MTD_NAND_IDS=y -# CONFIG_MTD_NAND_JZ4740 is not set -# CONFIG_MTD_NAND_MPC5121_NFC is not set -# CONFIG_MTD_NAND_MTK is not set -# CONFIG_MTD_NAND_MXC is not set -# CONFIG_MTD_NAND_NANDSIM is not set -# CONFIG_MTD_NAND_NDFC is not set -# CONFIG_MTD_NAND_NUC900 is not set -# CONFIG_MTD_NAND_OMAP2 is not set -# CONFIG_MTD_NAND_OMAP_BCH_BUILD is not set -# CONFIG_MTD_NAND_ORION is not set -# CONFIG_MTD_NAND_PASEMI is not set -# CONFIG_MTD_NAND_PLATFORM is not set -# CONFIG_MTD_NAND_PXA3xx is not set -# CONFIG_MTD_NAND_RB4XX is not set -# CONFIG_MTD_NAND_RB750 is not set -# CONFIG_MTD_NAND_RICOH is not set -# CONFIG_MTD_NAND_S3C2410 is not set -# CONFIG_MTD_NAND_SHARPSL is not set -# CONFIG_MTD_NAND_SH_FLCTL is not set -# CONFIG_MTD_NAND_SOCRATES is not set -# CONFIG_MTD_NAND_TMIO is not set -# CONFIG_MTD_NAND_TXX9NDFMC is not set -CONFIG_MTD_OF_PARTS=y -# CONFIG_MTD_ONENAND is not set -# CONFIG_MTD_OOPS is not set -# CONFIG_MTD_OTP is not set -# CONFIG_MTD_PARTITIONED_MASTER is not set -# CONFIG_MTD_PCI is not set -# CONFIG_MTD_PCMCIA is not set -# CONFIG_MTD_PHRAM is not set -# CONFIG_MTD_PHYSMAP is not set -# CONFIG_MTD_PHYSMAP_COMPAT is not set -CONFIG_MTD_PHYSMAP_OF=y -# CONFIG_MTD_PHYSMAP_OF_GEMINI is not set -# CONFIG_MTD_PHYSMAP_OF_VERSATILE is not set -# CONFIG_MTD_PLATRAM is not set -# CONFIG_MTD_PMC551 is not set -# CONFIG_MTD_RAM is not set -CONFIG_MTD_REDBOOT_DIRECTORY_BLOCK=-1 -# CONFIG_MTD_REDBOOT_PARTS is not set -# CONFIG_MTD_REDBOOT_PARTS_READONLY is not set -# CONFIG_MTD_REDBOOT_PARTS_UNALLOCATED is not set -# CONFIG_MTD_ROM is not set -CONFIG_MTD_ROOTFS_ROOT_DEV=y -# CONFIG_MTD_SLRAM is not set -# CONFIG_MTD_SM_COMMON is not set -# CONFIG_MTD_SPINAND_MT29F is not set -# CONFIG_MTD_SPI_NAND is not set -# CONFIG_MTD_SPI_NOR is not set -# CONFIG_MTD_SPI_NOR_USE_4K_SECTORS is not set -CONFIG_MTD_SPI_NOR_USE_4K_SECTORS_LIMIT=4096 -CONFIG_MTD_SPLIT=y -# CONFIG_MTD_SPLIT_BRNIMAGE_FW is not set -# CONFIG_MTD_SPLIT_EVA_FW is not set -# CONFIG_MTD_SPLIT_FIRMWARE is not set -CONFIG_MTD_SPLIT_FIRMWARE_NAME="firmware" -# CONFIG_MTD_SPLIT_FIT_FW is not set -# CONFIG_MTD_SPLIT_JIMAGE_FW is not set -# CONFIG_MTD_SPLIT_LZMA_FW is not set -# CONFIG_MTD_SPLIT_MINOR_FW is not set -# CONFIG_MTD_SPLIT_SEAMA_FW is not set -CONFIG_MTD_SPLIT_SQUASHFS_ROOT=y -CONFIG_MTD_SPLIT_SUPPORT=y -# CONFIG_MTD_SPLIT_TPLINK_FW is not set -# CONFIG_MTD_SPLIT_TRX_FW is not set -# CONFIG_MTD_SPLIT_UIMAGE_FW is not set -# CONFIG_MTD_SPLIT_WRGG_FW is not set -# CONFIG_MTD_SST25L is not set -# CONFIG_MTD_SWAP is not set -# CONFIG_MTD_TESTS is not set -# CONFIG_MTD_UBI is not set -# CONFIG_MTD_UIMAGE_SPLIT is not set -# CONFIG_MTD_VIRT_CONCAT is not set -# CONFIG_MTK_MMC is not set -CONFIG_MULTIUSER=y -# CONFIG_MUTEX_SPIN_ON_OWNER is not set -# CONFIG_MV643XX_ETH is not set -# CONFIG_MVMDIO is not set -# CONFIG_MVNETA_BM is not set -# CONFIG_MVSW61XX_PHY is not set -# CONFIG_MVSWITCH_PHY is not set -# CONFIG_MV_XOR_V2 is not set -# CONFIG_MWAVE is not set -# CONFIG_MWL8K is not set -# CONFIG_MXC4005 is not set -# CONFIG_MXC6255 is not set -# CONFIG_MYRI10GE is not set -# CONFIG_NAMESPACES is not set -# CONFIG_NATIONAL_PHY is not set -# CONFIG_NATSEMI is not set -# CONFIG_NAU7802 is not set -# CONFIG_NBPFAXI_DMA is not set -# CONFIG_NCP_FS is not set -# CONFIG_NE2000 is not set -# CONFIG_NE2K_PCI is not set -# CONFIG_NEC_MARKEINS is not set -CONFIG_NET=y -# CONFIG_NETCONSOLE is not set -CONFIG_NETDEVICES=y -# CONFIG_NETDEVSIM is not set -# CONFIG_NETFILTER is not set -# CONFIG_NETFILTER_ADVANCED is not set -# CONFIG_NETFILTER_DEBUG is not set -# CONFIG_NETFILTER_INGRESS is not set -# CONFIG_NETFILTER_NETLINK is not set -# CONFIG_NETFILTER_NETLINK_ACCT is not set -# CONFIG_NETFILTER_NETLINK_GLUE_CT is not set -# CONFIG_NETFILTER_NETLINK_LOG is not set -# CONFIG_NETFILTER_NETLINK_OSF is not set -# CONFIG_NETFILTER_NETLINK_QUEUE is not set -# CONFIG_NETFILTER_XTABLES is not set -# CONFIG_NETFILTER_XT_CONNMARK is not set -# CONFIG_NETFILTER_XT_MARK is not set -# 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 is not set -# 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 is not set -# CONFIG_NETFILTER_XT_MATCH_PHYSDEV is not set -# CONFIG_NETFILTER_XT_MATCH_PKTTYPE is not set -# CONFIG_NETFILTER_XT_MATCH_POLICY 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 is not set -# 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_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_CT 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_NOTRACK is not set -# CONFIG_NETFILTER_XT_TARGET_RATEEST is not set -# CONFIG_NETFILTER_XT_TARGET_REDIRECT is not set -# CONFIG_NETFILTER_XT_TARGET_TCPMSS is not set -# CONFIG_NETFILTER_XT_TARGET_TCPOPTSTRIP is not set -# CONFIG_NETFILTER_XT_TARGET_TEE is not set -# CONFIG_NETFILTER_XT_TARGET_TPROXY is not set -# CONFIG_NETFILTER_XT_TARGET_TRACE is not set -# CONFIG_NETLINK_DIAG is not set -# CONFIG_NETLINK_MMAP is not set -# CONFIG_NETPOLL is not set -# CONFIG_NETROM is not set -CONFIG_NETWORK_FILESYSTEMS=y -# CONFIG_NETWORK_PHY_TIMESTAMPING is not set -# CONFIG_NETWORK_SECMARK is not set -# CONFIG_NETXEN_NIC is not set -# CONFIG_NET_9P is not set -# CONFIG_NET_ACT_BPF is not set -# CONFIG_NET_ACT_CSUM is not set -# CONFIG_NET_ACT_GACT is not set -# CONFIG_NET_ACT_IFE is not set -# CONFIG_NET_ACT_IPT is not set -# CONFIG_NET_ACT_MIRRED is not set -# CONFIG_NET_ACT_NAT is not set -# CONFIG_NET_ACT_PEDIT is not set -# CONFIG_NET_ACT_POLICE is not set -# CONFIG_NET_ACT_SAMPLE is not set -# CONFIG_NET_ACT_SIMP is not set -# CONFIG_NET_ACT_SKBEDIT is not set -# CONFIG_NET_ACT_SKBMOD is not set -# CONFIG_NET_ACT_TUNNEL_KEY is not set -# CONFIG_NET_ACT_VLAN is not set -CONFIG_NET_CADENCE=y -# CONFIG_NET_CALXEDA_XGMAC is not set -CONFIG_NET_CLS=y -# CONFIG_NET_CLS_ACT is not set -# CONFIG_NET_CLS_BASIC is not set -# CONFIG_NET_CLS_BPF is not set -# CONFIG_NET_CLS_FLOW is not set -# CONFIG_NET_CLS_FLOWER is not set -# CONFIG_NET_CLS_FW is not set -CONFIG_NET_CLS_IND=y -# CONFIG_NET_CLS_MATCHALL is not set -# CONFIG_NET_CLS_ROUTE4 is not set -# CONFIG_NET_CLS_RSVP is not set -# CONFIG_NET_CLS_RSVP6 is not set -# CONFIG_NET_CLS_TCINDEX is not set -# CONFIG_NET_CLS_U32 is not set -CONFIG_NET_CORE=y -# CONFIG_NET_DEVLINK is not set -# CONFIG_NET_DROP_MONITOR is not set -# CONFIG_NET_DSA is not set -# CONFIG_NET_DSA_BCM_SF2 is not set -# CONFIG_NET_DSA_LOOP is not set -# CONFIG_NET_DSA_MT7530 is not set -# CONFIG_NET_DSA_MV88E6060 is not set -# CONFIG_NET_DSA_MV88E6123_61_65 is not set -# CONFIG_NET_DSA_MV88E6131 is not set -# CONFIG_NET_DSA_MV88E6171 is not set -# CONFIG_NET_DSA_MV88E6352 is not set -# CONFIG_NET_DSA_MV88E6XXX is not set -# CONFIG_NET_DSA_MV88E6XXX_NEED_PPU is not set -# CONFIG_NET_DSA_QCA8K is not set -# CONFIG_NET_DSA_SMSC_LAN9303_I2C is not set -# CONFIG_NET_DSA_SMSC_LAN9303_MDIO is not set -# CONFIG_NET_DSA_TAG_DSA is not set -# CONFIG_NET_DSA_TAG_EDSA is not set -# CONFIG_NET_EMATCH is not set -# CONFIG_NET_EMATCH_CANID is not set -# CONFIG_NET_EMATCH_CMP is not set -# CONFIG_NET_EMATCH_IPT is not set -# CONFIG_NET_EMATCH_META is not set -# CONFIG_NET_EMATCH_NBYTE is not set -CONFIG_NET_EMATCH_STACK=32 -# CONFIG_NET_EMATCH_TEXT is not set -# CONFIG_NET_EMATCH_U32 is not set -# CONFIG_NET_FAILOVER is not set -# CONFIG_NET_FC is not set -# CONFIG_NET_FOU is not set -# CONFIG_NET_FOU_IP_TUNNELS is not set -# CONFIG_NET_IFE is not set -# CONFIG_NET_IPGRE is not set -CONFIG_NET_IPGRE_BROADCAST=y -# CONFIG_NET_IPGRE_DEMUX is not set -# CONFIG_NET_IPIP is not set -# CONFIG_NET_IPVTI is not set -# CONFIG_NET_IP_TUNNEL is not set -# CONFIG_NET_KEY is not set -# CONFIG_NET_KEY_MIGRATE is not set -# CONFIG_NET_L3_MASTER_DEV is not set -# CONFIG_NET_MPLS_GSO is not set -# CONFIG_NET_NCSI is not set -# CONFIG_NET_NSH is not set -# CONFIG_NET_PACKET_ENGINE is not set -# CONFIG_NET_PKTGEN is not set -# CONFIG_NET_POLL_CONTROLLER is not set -# CONFIG_NET_PTP_CLASSIFY is not set -CONFIG_NET_RX_BUSY_POLL=y -# CONFIG_NET_SB1000 is not set -CONFIG_NET_SCHED=y -# CONFIG_NET_SCH_ATM is not set -# CONFIG_NET_SCH_CAKE is not set -# CONFIG_NET_SCH_CBQ is not set -# CONFIG_NET_SCH_CBS is not set -# CONFIG_NET_SCH_CHOKE is not set -# CONFIG_NET_SCH_CODEL is not set -# CONFIG_NET_SCH_DEFAULT is not set -# CONFIG_NET_SCH_DRR is not set -# CONFIG_NET_SCH_DSMARK is not set -# CONFIG_NET_SCH_ETF is not set -CONFIG_NET_SCH_FIFO=y -# CONFIG_NET_SCH_FQ is not set -CONFIG_NET_SCH_FQ_CODEL=y -# CONFIG_NET_SCH_GRED is not set -# CONFIG_NET_SCH_HFSC is not set -# CONFIG_NET_SCH_HHF is not set -# CONFIG_NET_SCH_HTB is not set -# CONFIG_NET_SCH_INGRESS is not set -# CONFIG_NET_SCH_MQPRIO is not set -# CONFIG_NET_SCH_MULTIQ is not set -# CONFIG_NET_SCH_NETEM is not set -# CONFIG_NET_SCH_PIE is not set -# CONFIG_NET_SCH_PLUG is not set -# CONFIG_NET_SCH_PRIO is not set -# CONFIG_NET_SCH_QFQ is not set -# CONFIG_NET_SCH_RED is not set -# CONFIG_NET_SCH_SFB is not set -# CONFIG_NET_SCH_SFQ is not set -# CONFIG_NET_SCH_SKBPRIO is not set -# CONFIG_NET_SCH_TBF is not set -# CONFIG_NET_SCH_TEQL is not set -# CONFIG_NET_SCTPPROBE is not set -# CONFIG_NET_SWITCHDEV is not set -# CONFIG_NET_TCPPROBE is not set -# CONFIG_NET_TEAM is not set -# CONFIG_NET_TULIP is not set -# CONFIG_NET_UDP_TUNNEL is not set -CONFIG_NET_VENDOR_3COM=y -CONFIG_NET_VENDOR_8390=y -CONFIG_NET_VENDOR_ADAPTEC=y -CONFIG_NET_VENDOR_AGERE=y -CONFIG_NET_VENDOR_ALACRITECH=y -CONFIG_NET_VENDOR_ALTEON=y -CONFIG_NET_VENDOR_AMAZON=y -CONFIG_NET_VENDOR_AMD=y -CONFIG_NET_VENDOR_AQUANTIA=y -CONFIG_NET_VENDOR_ARC=y -CONFIG_NET_VENDOR_ATHEROS=y -CONFIG_NET_VENDOR_AURORA=y -CONFIG_NET_VENDOR_BROADCOM=y -CONFIG_NET_VENDOR_BROCADE=y -CONFIG_NET_VENDOR_CADENCE=y -CONFIG_NET_VENDOR_CAVIUM=y -CONFIG_NET_VENDOR_CHELSIO=y -CONFIG_NET_VENDOR_CIRRUS=y -CONFIG_NET_VENDOR_CISCO=y -CONFIG_NET_VENDOR_CORTINA=y -CONFIG_NET_VENDOR_DEC=y -CONFIG_NET_VENDOR_DLINK=y -CONFIG_NET_VENDOR_EMULEX=y -CONFIG_NET_VENDOR_EXAR=y -CONFIG_NET_VENDOR_EZCHIP=y -CONFIG_NET_VENDOR_FARADAY=y -CONFIG_NET_VENDOR_FREESCALE=y -CONFIG_NET_VENDOR_FUJITSU=y -CONFIG_NET_VENDOR_HISILICON=y -CONFIG_NET_VENDOR_HP=y -CONFIG_NET_VENDOR_HUAWEI=y -CONFIG_NET_VENDOR_I825XX=y -CONFIG_NET_VENDOR_IBM=y -CONFIG_NET_VENDOR_INTEL=y -CONFIG_NET_VENDOR_MARVELL=y -CONFIG_NET_VENDOR_MELLANOX=y -CONFIG_NET_VENDOR_MICREL=y -CONFIG_NET_VENDOR_MICROCHIP=y -CONFIG_NET_VENDOR_MICROSEMI=y -CONFIG_NET_VENDOR_MYRI=y -CONFIG_NET_VENDOR_NATSEMI=y -CONFIG_NET_VENDOR_NETERION=y -CONFIG_NET_VENDOR_NETRONOME=y -CONFIG_NET_VENDOR_NI=y -CONFIG_NET_VENDOR_NVIDIA=y -CONFIG_NET_VENDOR_OKI=y -CONFIG_NET_VENDOR_PACKET_ENGINES=y -CONFIG_NET_VENDOR_QLOGIC=y -CONFIG_NET_VENDOR_QUALCOMM=y -CONFIG_NET_VENDOR_RDC=y -CONFIG_NET_VENDOR_REALTEK=y -CONFIG_NET_VENDOR_RENESAS=y -CONFIG_NET_VENDOR_ROCKER=y -CONFIG_NET_VENDOR_SAMSUNG=y -CONFIG_NET_VENDOR_SEEQ=y -CONFIG_NET_VENDOR_SILAN=y -CONFIG_NET_VENDOR_SIS=y -CONFIG_NET_VENDOR_SMSC=y -CONFIG_NET_VENDOR_SOCIONEXT=y -CONFIG_NET_VENDOR_SOLARFLARE=y -CONFIG_NET_VENDOR_STMICRO=y -CONFIG_NET_VENDOR_SUN=y -CONFIG_NET_VENDOR_SYNOPSYS=y -CONFIG_NET_VENDOR_TEHUTI=y -CONFIG_NET_VENDOR_TI=y -CONFIG_NET_VENDOR_TOSHIBA=y -CONFIG_NET_VENDOR_VIA=y -CONFIG_NET_VENDOR_WIZNET=y -CONFIG_NET_VENDOR_XILINX=y -CONFIG_NET_VENDOR_XIRCOM=y -# CONFIG_NET_VRF is not set -# CONFIG_NET_XGENE is not set -CONFIG_NEW_LEDS=y -# CONFIG_NFC is not set -# CONFIG_NFP is not set -# CONFIG_NFSD is not set -# CONFIG_NFSD_V2_ACL is not set -CONFIG_NFSD_V3=y -# CONFIG_NFSD_V3_ACL is not set -# CONFIG_NFSD_V4 is not set -# CONFIG_NFS_ACL_SUPPORT is not set -CONFIG_NFS_COMMON=y -# CONFIG_NFS_FS is not set -# CONFIG_NFS_FSCACHE is not set -# CONFIG_NFS_SWAP is not set -# CONFIG_NFS_V2 is not set -CONFIG_NFS_V3=y -# CONFIG_NFS_V3_ACL is not set -# CONFIG_NFS_V4 is not set -# CONFIG_NFS_V4_1 is not set -# CONFIG_NFTL is not set -# CONFIG_NFT_BRIDGE_META is not set -# CONFIG_NFT_BRIDGE_REJECT is not set -# CONFIG_NFT_CONNLIMIT is not set -# CONFIG_NFT_DUP_IPV4 is not set -# CONFIG_NFT_DUP_IPV6 is not set -# CONFIG_NFT_FIB_IPV4 is not set -# CONFIG_NFT_FIB_IPV6 is not set -# CONFIG_NFT_FIB_NETDEV is not set -# CONFIG_NFT_FLOW_OFFLOAD is not set -# CONFIG_NFT_OBJREF is not set -# CONFIG_NFT_OSF is not set -# CONFIG_NFT_RT is not set -# CONFIG_NFT_SET_BITMAP is not set -# CONFIG_NFT_SOCKET is not set -# CONFIG_NFT_TPROXY is not set -# CONFIG_NFT_TUNNEL is not set -# CONFIG_NF_CONNTRACK is not set -# CONFIG_NF_CONNTRACK_AMANDA is not set -# CONFIG_NF_CONNTRACK_EVENTS is not set -# CONFIG_NF_CONNTRACK_FTP is not set -# CONFIG_NF_CONNTRACK_H323 is not set -# CONFIG_NF_CONNTRACK_IPV4 is not set -# CONFIG_NF_CONNTRACK_IPV6 is not set -# CONFIG_NF_CONNTRACK_IRC is not set -# CONFIG_NF_CONNTRACK_LABELS is not set -# CONFIG_NF_CONNTRACK_MARK is not set -# CONFIG_NF_CONNTRACK_NETBIOS_NS is not set -# CONFIG_NF_CONNTRACK_PPTP is not set -CONFIG_NF_CONNTRACK_PROCFS=y -# CONFIG_NF_CONNTRACK_PROC_COMPAT is not set -# CONFIG_NF_CONNTRACK_SANE is not set -# CONFIG_NF_CONNTRACK_SIP is not set -# CONFIG_NF_CONNTRACK_SNMP is not set -# CONFIG_NF_CONNTRACK_TFTP is not set -# CONFIG_NF_CONNTRACK_TIMEOUT is not set -# CONFIG_NF_CONNTRACK_TIMESTAMP is not set -# CONFIG_NF_CONNTRACK_ZONES is not set -# CONFIG_NF_CT_NETLINK is not set -# CONFIG_NF_CT_NETLINK_TIMEOUT is not set -# CONFIG_NF_CT_PROTO_DCCP is not set -# CONFIG_NF_CT_PROTO_GRE is not set -# CONFIG_NF_CT_PROTO_SCTP is not set -# CONFIG_NF_CT_PROTO_UDPLITE is not set -# CONFIG_NF_DEFRAG_IPV4 is not set -# CONFIG_NF_DUP_IPV4 is not set -# CONFIG_NF_DUP_IPV6 is not set -# CONFIG_NF_FLOW_TABLE is not set -# CONFIG_NF_LOG_ARP is not set -# CONFIG_NF_LOG_BRIDGE is not set -# CONFIG_NF_LOG_IPV4 is not set -# CONFIG_NF_LOG_NETDEV is not set -# CONFIG_NF_NAT is not set -# CONFIG_NF_NAT_AMANDA is not set -# CONFIG_NF_NAT_FTP is not set -# CONFIG_NF_NAT_H323 is not set -# CONFIG_NF_NAT_IPV6 is not set -# CONFIG_NF_NAT_IRC is not set -CONFIG_NF_NAT_MASQUERADE_IPV4=y -CONFIG_NF_NAT_MASQUERADE_IPV6=y -# CONFIG_NF_NAT_NEEDED is not set -# CONFIG_NF_NAT_PPTP is not set -# CONFIG_NF_NAT_PROTO_GRE is not set -# CONFIG_NF_NAT_SIP is not set -# CONFIG_NF_NAT_SNMP_BASIC is not set -# CONFIG_NF_NAT_TFTP is not set -# CONFIG_NF_REJECT_IPV4 is not set -# CONFIG_NF_REJECT_IPV6 is not set -# CONFIG_NF_SOCKET_IPV4 is not set -# CONFIG_NF_SOCKET_IPV6 is not set -# CONFIG_NF_TABLES is not set -CONFIG_NF_TABLES_ARP=y -CONFIG_NF_TABLES_BRIDGE=y -CONFIG_NF_TABLES_INET=y -CONFIG_NF_TABLES_IPV4=y -CONFIG_NF_TABLES_IPV6=y -CONFIG_NF_TABLES_NETDEV=y -# CONFIG_NF_TABLES_SET is not set -# CONFIG_NF_TPROXY_IPV4 is not set -# CONFIG_NF_TPROXY_IPV6 is not set -# CONFIG_NI65 is not set -# CONFIG_NI903X_WDT is not set -# CONFIG_NIC7018_WDT is not set -# CONFIG_NILFS2_FS is not set -# CONFIG_NIU is not set -CONFIG_NLATTR=y -# CONFIG_NLMON is not set -# CONFIG_NLM_XLP_BOARD is not set -# CONFIG_NLM_XLR_BOARD is not set -# CONFIG_NLS is not set -# CONFIG_NLS_ASCII is not set -# CONFIG_NLS_CODEPAGE_1250 is not set -# CONFIG_NLS_CODEPAGE_1251 is not set -# CONFIG_NLS_CODEPAGE_437 is not set -# 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_874 is not set -# CONFIG_NLS_CODEPAGE_932 is not set -# CONFIG_NLS_CODEPAGE_936 is not set -# CONFIG_NLS_CODEPAGE_949 is not set -# CONFIG_NLS_CODEPAGE_950 is not set -CONFIG_NLS_DEFAULT="iso8859-1" -# CONFIG_NLS_ISO8859_1 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_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_8 is not set -# CONFIG_NLS_ISO8859_9 is not set -# CONFIG_NLS_KOI8_R is not set -# CONFIG_NLS_KOI8_U 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_ROMAN is not set -# CONFIG_NLS_MAC_ROMANIAN is not set -# CONFIG_NLS_MAC_TURKISH is not set -# CONFIG_NLS_UTF8 is not set -CONFIG_NMI_LOG_BUF_SHIFT=13 -# CONFIG_NOP_USB_XCEIV is not set -# CONFIG_NORTEL_HERMES is not set -# CONFIG_NOTIFIER_ERROR_INJECTION is not set -# CONFIG_NOZOMI is not set -# CONFIG_NO_BOOTMEM is not set -# CONFIG_NO_HZ is not set -# CONFIG_NO_HZ_FULL is not set -# CONFIG_NO_HZ_IDLE is not set -# CONFIG_NS83820 is not set -# CONFIG_NTB is not set -# CONFIG_NTFS_DEBUG is not set -# CONFIG_NTFS_FS is not set -# CONFIG_NTFS_RW is not set -# CONFIG_NTP_PPS is not set -# CONFIG_NVM is not set -# CONFIG_NVMEM is not set -# CONFIG_NVMEM_BCM_OCOTP is not set -# CONFIG_NVMEM_IMX_OCOTP is not set -# CONFIG_NVME_FC is not set -# CONFIG_NVME_TARGET is not set -# CONFIG_NVRAM is not set -# CONFIG_NV_TCO is not set -# CONFIG_NXP_STB220 is not set -# CONFIG_NXP_STB225 is not set -# CONFIG_N_GSM is not set -# CONFIG_OABI_COMPAT is not set -# CONFIG_OBS600 is not set -# CONFIG_OCFS2_FS is not set -# CONFIG_OF_OVERLAY is not set -# CONFIG_OF_UNITTEST is not set -# CONFIG_OMAP2_DSS_DEBUG is not set -# CONFIG_OMAP2_DSS_DEBUGFS is not set -# CONFIG_OMAP2_DSS_SDI is not set -# CONFIG_OMAP_OCP2SCP is not set -# CONFIG_OMAP_USB2 is not set -# CONFIG_OMFS_FS is not set -# CONFIG_OPENVSWITCH is not set -# CONFIG_OPROFILE is not set -# CONFIG_OPROFILE_EVENT_MULTIPLEX is not set -# CONFIG_OPT3001 is not set -# CONFIG_OPTIMIZE_INLINING is not set -# CONFIG_ORANGEFS_FS is not set -# CONFIG_ORION_WATCHDOG is not set -# CONFIG_OSF_PARTITION is not set -CONFIG_OVERLAY_FS=y -# CONFIG_OVERLAY_FS_INDEX is not set -# CONFIG_OVERLAY_FS_METACOPY is not set -CONFIG_OVERLAY_FS_REDIRECT_ALWAYS_FOLLOW=y -# CONFIG_OVERLAY_FS_REDIRECT_DIR is not set -CONFIG_OVERLAY_FS_XINO_AUTO=y -# CONFIG_OWL_LOADER is not set -# CONFIG_P54_COMMON is not set -# CONFIG_PA12203001 is not set -CONFIG_PACKET=y -# CONFIG_PACKET_DIAG is not set -# CONFIG_PAGE_EXTENSION is not set -# CONFIG_PAGE_OWNER is not set -# CONFIG_PAGE_POISONING is not set -# CONFIG_PAGE_SIZE_16KB is not set -# CONFIG_PAGE_SIZE_32KB is not set -CONFIG_PAGE_SIZE_4KB=y -# CONFIG_PAGE_SIZE_64KB is not set -# CONFIG_PAGE_SIZE_8KB is not set -# CONFIG_PALMAS_GPADC is not set -# CONFIG_PANASONIC_LAPTOP is not set -# CONFIG_PANEL is not set -CONFIG_PANIC_ON_OOPS=y -CONFIG_PANIC_ON_OOPS_VALUE=1 -CONFIG_PANIC_TIMEOUT=1 -# CONFIG_PANTHERLORD_FF is not set -# CONFIG_PARAVIRT is not set -# CONFIG_PARAVIRT_TIME_ACCOUNTING is not set -# CONFIG_PARPORT is not set -# CONFIG_PARPORT_1284 is not set -# CONFIG_PARPORT_AX88796 is not set -# CONFIG_PARPORT_GSC is not set -# CONFIG_PARPORT_PC is not set -CONFIG_PARTITION_ADVANCED=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_CMD640_PCI is not set -# CONFIG_PATA_CMD64X is not set -# CONFIG_PATA_CS5520 is not set -# CONFIG_PATA_CS5530 is not set -# CONFIG_PATA_CS5535 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 -# CONFIG_PATA_HPT37X is not set -# CONFIG_PATA_HPT3X2N is not set -# CONFIG_PATA_HPT3X3 is not set -# CONFIG_PATA_IMX is not set -# CONFIG_PATA_ISAPNP is not set -# CONFIG_PATA_IT8213 is not set -# CONFIG_PATA_IT821X is not set -# CONFIG_PATA_JMICRON is not set -# CONFIG_PATA_LEGACY is not set -# CONFIG_PATA_MARVELL is not set -# CONFIG_PATA_MPIIX is not set -# CONFIG_PATA_NETCELL is not set -# CONFIG_PATA_NINJA32 is not set -# CONFIG_PATA_NS87410 is not set -# CONFIG_PATA_NS87415 is not set -# CONFIG_PATA_OCTEON_CF is not set -# CONFIG_PATA_OF_PLATFORM is not set -# CONFIG_PATA_OLDPIIX is not set -# CONFIG_PATA_OPTI is not set -# CONFIG_PATA_OPTIDMA is not set -# CONFIG_PATA_PCMCIA is not set -# CONFIG_PATA_PDC2027X is not set -# CONFIG_PATA_PDC_OLD is not set -# CONFIG_PATA_PLATFORM is not set -# CONFIG_PATA_QDI is not set -# CONFIG_PATA_RADISYS is not set -# CONFIG_PATA_RDC is not set -# CONFIG_PATA_RZ1000 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 -# 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 -# CONFIG_PATA_WINBOND_VLB is not set -# CONFIG_PC104 is not set -# CONFIG_PC300TOO is not set -# CONFIG_PCCARD is not set -# CONFIG_PCH_DMA is not set -# CONFIG_PCH_GBE is not set -# CONFIG_PCH_PHUB is not set -# CONFIG_PCI is not set -# CONFIG_PCI200SYN is not set -# CONFIG_PCIEAER_INJECT is not set -# CONFIG_PCIEASPM is not set -# CONFIG_PCIEPORTBUS is not set -# CONFIG_PCIE_ALTERA is not set -# CONFIG_PCIE_ARMADA_8K is not set -# CONFIG_PCIE_CADENCE_HOST is not set -# CONFIG_PCIE_DPC is not set -# CONFIG_PCIE_DW_PLAT is not set -# CONFIG_PCIE_DW_PLAT_HOST is not set -# CONFIG_PCIE_ECRC is not set -# CONFIG_PCIE_IPROC is not set -# CONFIG_PCIE_KIRIN is not set -# CONFIG_PCIE_PTM is not set -# CONFIG_PCIE_XILINX is not set -# CONFIG_PCIPCWATCHDOG is not set -# CONFIG_PCI_ATMEL is not set -# CONFIG_PCI_CNB20LE_QUIRK is not set -# CONFIG_PCI_DEBUG is not set -# CONFIG_PCI_DISABLE_COMMON_QUIRKS is not set -# CONFIG_PCI_ENDPOINT is not set -# CONFIG_PCI_ENDPOINT_TEST is not set -# CONFIG_PCI_FTPCI100 is not set -# CONFIG_PCI_HERMES is not set -# CONFIG_PCI_HISI is not set -# CONFIG_PCI_HOST_GENERIC is not set -# CONFIG_PCI_HOST_THUNDER_ECAM is not set -# CONFIG_PCI_HOST_THUNDER_PEM is not set -# CONFIG_PCI_IOV is not set -# CONFIG_PCI_LAYERSCAPE is not set -# CONFIG_PCI_MSI is not set -# CONFIG_PCI_PASID is not set -# CONFIG_PCI_PRI is not set -CONFIG_PCI_QUIRKS=y -# CONFIG_PCI_REALLOC_ENABLE_AUTO is not set -# CONFIG_PCI_STUB is not set -# CONFIG_PCI_SW_SWITCHTEC is not set -CONFIG_PCI_SYSCALL=y -# CONFIG_PCI_XGENE is not set -# CONFIG_PCMCIA is not set -# CONFIG_PCMCIA_3C574 is not set -# CONFIG_PCMCIA_3C589 is not set -# CONFIG_PCMCIA_AHA152X is not set -# CONFIG_PCMCIA_ATMEL is not set -# CONFIG_PCMCIA_AXNET is not set -# CONFIG_PCMCIA_DEBUG is not set -# CONFIG_PCMCIA_FDOMAIN is not set -# CONFIG_PCMCIA_FMVJ18X is not set -# CONFIG_PCMCIA_HERMES is not set -# CONFIG_PCMCIA_LOAD_CIS is not set -# CONFIG_PCMCIA_NINJA_SCSI is not set -# CONFIG_PCMCIA_NMCLAN is not set -# CONFIG_PCMCIA_PCNET is not set -# CONFIG_PCMCIA_QLOGIC is not set -# CONFIG_PCMCIA_RAYCS is not set -# CONFIG_PCMCIA_SMC91C92 is not set -# CONFIG_PCMCIA_SPECTRUM is not set -# CONFIG_PCMCIA_SYM53C500 is not set -# CONFIG_PCMCIA_WL3501 is not set -# CONFIG_PCMCIA_XIRC2PS is not set -# CONFIG_PCMCIA_XIRCOM is not set -# CONFIG_PCNET32 is not set -# CONFIG_PCSPKR_PLATFORM is not set -# CONFIG_PD6729 is not set -# CONFIG_PDA_POWER is not set -# CONFIG_PDC_ADMA is not set -# CONFIG_PERCPU_STATS is not set -# CONFIG_PERCPU_TEST is not set -# CONFIG_PERF_EVENTS is not set -# CONFIG_PERF_EVENTS_AMD_POWER is not set -# CONFIG_PERSISTENT_KEYRINGS is not set -# CONFIG_PHANTOM is not set -# CONFIG_PHONET is not set -# CONFIG_PHYLIB is not set -# CONFIG_PHYS_ADDR_T_64BIT is not set -# CONFIG_PHY_CPCAP_USB is not set -# CONFIG_PHY_EXYNOS_DP_VIDEO is not set -# CONFIG_PHY_EXYNOS_MIPI_VIDEO is not set -# CONFIG_PHY_MAPPHONE_MDM6600 is not set -# CONFIG_PHY_PXA_28NM_HSIC is not set -# CONFIG_PHY_PXA_28NM_USB2 is not set -# CONFIG_PHY_QCOM_DWC3 is not set -# CONFIG_PHY_QCOM_USB_HS is not set -# CONFIG_PHY_QCOM_USB_HSIC is not set -# CONFIG_PHY_SAMSUNG_USB2 is not set -# CONFIG_PHY_TUSB1210 is not set -# CONFIG_PHY_XGENE is not set -# CONFIG_PI433 is not set -# CONFIG_PID_IN_CONTEXTIDR is not set -# CONFIG_PID_NS is not set -CONFIG_PINCONF=y -# CONFIG_PINCTRL is not set -# CONFIG_PINCTRL_AMD is not set -# CONFIG_PINCTRL_AXP209 is not set -# CONFIG_PINCTRL_CEDARFORK is not set -# CONFIG_PINCTRL_EXYNOS is not set -# CONFIG_PINCTRL_EXYNOS5440 is not set -# CONFIG_PINCTRL_ICELAKE is not set -# CONFIG_PINCTRL_MCP23S08 is not set -# CONFIG_PINCTRL_MSM8X74 is not set -CONFIG_PINCTRL_SINGLE=y -# CONFIG_PINCTRL_SX150X is not set -CONFIG_PINMUX=y -# CONFIG_PKCS7_MESSAGE_PARSER is not set -# CONFIG_PL320_MBOX is not set -# CONFIG_PL330_DMA is not set -# CONFIG_PLATFORM_MHU is not set -# CONFIG_PLAT_SPEAR is not set -# CONFIG_PLIP is not set -CONFIG_PLUGIN_HOSTCC="" -# CONFIG_PLX_HERMES is not set -# CONFIG_PM is not set -# CONFIG_PMBUS is not set -# CONFIG_PMC_MSP is not set -# CONFIG_PMIC_ADP5520 is not set -# CONFIG_PMIC_DA903X is not set -# CONFIG_PM_AUTOSLEEP is not set -# CONFIG_PM_DEVFREQ is not set -# CONFIG_PM_WAKELOCKS is not set -# CONFIG_POSIX_MQUEUE is not set -CONFIG_POSIX_TIMERS=y -# CONFIG_POWERCAP is not set -# CONFIG_POWER_AVS is not set -# CONFIG_POWER_RESET is not set -# CONFIG_POWER_RESET_BRCMKONA is not set -# CONFIG_POWER_RESET_BRCMSTB is not set -# CONFIG_POWER_RESET_GPIO is not set -# CONFIG_POWER_RESET_GPIO_RESTART is not set -# CONFIG_POWER_RESET_LTC2952 is not set -# CONFIG_POWER_RESET_PIIX4_POWEROFF is not set -# CONFIG_POWER_RESET_RESTART is not set -# CONFIG_POWER_RESET_SYSCON is not set -# CONFIG_POWER_RESET_SYSCON_POWEROFF is not set -# CONFIG_POWER_RESET_VERSATILE is not set -# CONFIG_POWER_RESET_XGENE is not set -# CONFIG_POWER_SUPPLY is not set -# CONFIG_POWER_SUPPLY_DEBUG is not set -# CONFIG_PPC4xx_GPIO is not set -# CONFIG_PPC_16K_PAGES is not set -# CONFIG_PPC_256K_PAGES is not set -CONFIG_PPC_4K_PAGES=y -# CONFIG_PPC_64K_PAGES is not set -# CONFIG_PPC_DISABLE_WERROR is not set -# CONFIG_PPC_EMULATED_STATS is not set -# CONFIG_PPC_EPAPR_HV_BYTECHAN is not set -# CONFIG_PPP is not set -# CONFIG_PPPOATM is not set -# CONFIG_PPPOE is not set -# CONFIG_PPPOL2TP is not set -# CONFIG_PPP_ASYNC is not set -# CONFIG_PPP_BSDCOMP is not set -# CONFIG_PPP_DEFLATE is not set -CONFIG_PPP_FILTER=y -# CONFIG_PPP_MPPE is not set -CONFIG_PPP_MULTILINK=y -# CONFIG_PPP_SYNC_TTY is not set -# CONFIG_PPS is not set -# CONFIG_PPS_CLIENT_GPIO is not set -# CONFIG_PPS_CLIENT_KTIMER is not set -# CONFIG_PPS_CLIENT_LDISC is not set -# CONFIG_PPS_CLIENT_PARPORT is not set -# CONFIG_PPS_DEBUG is not set -# CONFIG_PPTP is not set -# CONFIG_PREEMPT is not set -CONFIG_PREEMPT_NONE=y -# CONFIG_PREEMPT_TRACER is not set -# CONFIG_PREEMPT_VOLUNTARY is not set -CONFIG_PREVENT_FIRMWARE_BUILD=y -CONFIG_PRINTK=y -CONFIG_PRINTK_NMI=y -CONFIG_PRINTK_SAFE_LOG_BUF_SHIFT=13 -# CONFIG_PRINTK_TIME is not set -CONFIG_PRINT_STACK_DEPTH=64 -# CONFIG_PRISM2_USB is not set -# CONFIG_PRISM54 is not set -# CONFIG_PROC_CHILDREN is not set -CONFIG_PROC_FS=y -# CONFIG_PROC_KCORE is not set -# CONFIG_PROC_PAGE_MONITOR is not set -CONFIG_PROC_STRIPPED=y -CONFIG_PROC_SYSCTL=y -# CONFIG_PROC_VMCORE_DEVICE_DUMP is not set -# CONFIG_PROFILE_ALL_BRANCHES is not set -# CONFIG_PROFILE_ANNOTATED_BRANCHES is not set -# CONFIG_PROFILING is not set -# CONFIG_PROVE_LOCKING is not set -# CONFIG_PROVE_RCU is not set -# CONFIG_PROVE_RCU_REPEATEDLY is not set -# CONFIG_PSAMPLE is not set -# CONFIG_PSB6970_PHY is not set -# CONFIG_PSTORE is not set -# CONFIG_PTP_1588_CLOCK is not set -# CONFIG_PTP_1588_CLOCK_IXP46X is not set -# CONFIG_PTP_1588_CLOCK_KVM is not set -# CONFIG_PTP_1588_CLOCK_PCH is not set -# CONFIG_PUBLIC_KEY_ALGO_RSA is not set -# CONFIG_PWM is not set -# CONFIG_PWM_FSL_FTM is not set -# CONFIG_PWM_PCA9685 is not set -CONFIG_PWRSEQ_EMMC=y -# CONFIG_PWRSEQ_SD8787 is not set -CONFIG_PWRSEQ_SIMPLE=y -# CONFIG_QCA7000 is not set -# CONFIG_QCA7000_SPI is not set -# CONFIG_QCA7000_UART is not set -# CONFIG_QCOM_EMAC is not set -# CONFIG_QCOM_FALKOR_ERRATUM_1003 is not set -# CONFIG_QCOM_FALKOR_ERRATUM_1009 is not set -# CONFIG_QCOM_FALKOR_ERRATUM_E1041 is not set -# CONFIG_QCOM_HIDMA is not set -# CONFIG_QCOM_HIDMA_MGMT is not set -# CONFIG_QCOM_QDF2400_ERRATUM_0065 is not set -# CONFIG_QCOM_SPMI_IADC is not set -# CONFIG_QCOM_SPMI_TEMP_ALARM is not set -# CONFIG_QCOM_SPMI_VADC is not set -# CONFIG_QED is not set -# CONFIG_QLA3XXX is not set -# CONFIG_QLCNIC is not set -# CONFIG_QLGE is not set -# CONFIG_QNX4FS_FS is not set -# CONFIG_QNX6FS_FS is not set -# CONFIG_QORIQ_CPUFREQ is not set -# CONFIG_QORIQ_THERMAL is not set -# CONFIG_QSEMI_PHY is not set -# CONFIG_QUEUED_LOCK_STAT is not set -# CONFIG_QUOTA is not set -# CONFIG_QUOTACTL is not set -# CONFIG_QUOTA_DEBUG is not set -# CONFIG_R3964 is not set -# CONFIG_R6040 is not set -# CONFIG_R8169 is not set -# CONFIG_R8188EU is not set -# CONFIG_R8712U is not set -# CONFIG_R8723AU is not set -# CONFIG_RADIO_ADAPTERS is not set -# CONFIG_RADIO_AZTECH is not set -# CONFIG_RADIO_CADET is not set -# CONFIG_RADIO_GEMTEK is not set -# CONFIG_RADIO_MAXIRADIO is not set -# CONFIG_RADIO_RTRACK is not set -# CONFIG_RADIO_RTRACK2 is not set -# CONFIG_RADIO_SF16FMI is not set -# CONFIG_RADIO_SF16FMR2 is not set -# CONFIG_RADIO_TERRATEC is not set -# CONFIG_RADIO_TRUST is not set -# CONFIG_RADIO_TYPHOON is not set -# CONFIG_RADIO_ZOLTRIX is not set -# CONFIG_RAID_ATTRS is not set -# CONFIG_RALINK is not set -# CONFIG_RANDOM32_SELFTEST is not set -# CONFIG_RANDOM_TRUST_CPU is not set -# CONFIG_RAPIDIO is not set -# CONFIG_RAS is not set -# CONFIG_RAW_DRIVER is not set -# CONFIG_RBTREE_TEST is not set -CONFIG_RCU_CPU_STALL_TIMEOUT=60 -# CONFIG_RCU_EQS_DEBUG is not set -# CONFIG_RCU_EXPEDITE_BOOT is not set -CONFIG_RCU_EXPERT=y -CONFIG_RCU_FANOUT=32 -CONFIG_RCU_FANOUT_LEAF=16 -# CONFIG_RCU_FAST_NO_HZ is not set -CONFIG_RCU_KTHREAD_PRIO=0 -# CONFIG_RCU_NOCB_CPU is not set -# CONFIG_RCU_PERF_TEST is not set -# CONFIG_RCU_TORTURE_TEST is not set -CONFIG_RCU_TORTURE_TEST_SLOW_INIT_DELAY=3 -# CONFIG_RCU_TRACE is not set -# CONFIG_RC_ATI_REMOTE is not set -# CONFIG_RC_CORE is not set -# CONFIG_RC_DECODERS is not set -# CONFIG_RC_LOOPBACK is not set -# CONFIG_RC_MAP is not set -# CONFIG_RDS is not set -# CONFIG_RD_BZIP2 is not set -# CONFIG_RD_GZIP is not set -# CONFIG_RD_LZ4 is not set -# CONFIG_RD_LZMA is not set -# CONFIG_RD_LZO is not set -# CONFIG_RD_XZ is not set -# CONFIG_READABLE_ASM is not set -# CONFIG_REALTEK_PHY is not set -# CONFIG_REDWOOD is not set -# CONFIG_REFCOUNT_FULL is not set -# CONFIG_REGMAP is not set -# CONFIG_REGMAP_I2C is not set -# CONFIG_REGMAP_MMIO is not set -# CONFIG_REGMAP_SPI is not set -# CONFIG_REGULATOR is not set -# CONFIG_REGULATOR_88PG86X is not set -# CONFIG_REGULATOR_ACT8865 is not set -# CONFIG_REGULATOR_AD5398 is not set -# CONFIG_REGULATOR_ANATOP is not set -# CONFIG_REGULATOR_DA9210 is not set -# CONFIG_REGULATOR_DA9211 is not set -# CONFIG_REGULATOR_DEBUG is not set -# CONFIG_REGULATOR_FAN53555 is not set -# CONFIG_REGULATOR_FIXED_VOLTAGE is not set -# CONFIG_REGULATOR_GPIO is not set -# CONFIG_REGULATOR_ISL6271A is not set -# CONFIG_REGULATOR_ISL9305 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_MT6311 is not set -# CONFIG_REGULATOR_PFUZE100 is not set -# CONFIG_REGULATOR_PV88060 is not set -# CONFIG_REGULATOR_PV88080 is not set -# CONFIG_REGULATOR_PV88090 is not set -# CONFIG_REGULATOR_PWM is not set -# CONFIG_REGULATOR_SY8106A is not set -# CONFIG_REGULATOR_TI_ABB 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_TPS65132 is not set -# CONFIG_REGULATOR_TPS6524X is not set -# CONFIG_REGULATOR_USERSPACE_CONSUMER is not set -# CONFIG_REGULATOR_VCTRL is not set -# CONFIG_REGULATOR_VIRTUAL_CONSUMER is not set -# CONFIG_REISERFS_CHECK is not set -# CONFIG_REISERFS_FS is not set -# CONFIG_REISERFS_FS_POSIX_ACL is not set -# CONFIG_REISERFS_FS_SECURITY is not set -# CONFIG_REISERFS_FS_XATTR is not set -# CONFIG_REISERFS_PROC_INFO is not set -# CONFIG_RELAY is not set -# CONFIG_RELOCATABLE is not set -# CONFIG_REMOTEPROC is not set -# CONFIG_RENESAS_PHY is not set -# CONFIG_RESET_ATH79 is not set -# CONFIG_RESET_BERLIN is not set -# CONFIG_RESET_CONTROLLER is not set -# CONFIG_RESET_IMX7 is not set -# CONFIG_RESET_LANTIQ is not set -# CONFIG_RESET_LPC18XX is not set -# CONFIG_RESET_MESON is not set -# CONFIG_RESET_PISTACHIO is not set -# CONFIG_RESET_SOCFPGA is not set -# CONFIG_RESET_STM32 is not set -# CONFIG_RESET_SUNXI is not set -# CONFIG_RESET_TEGRA_BPMP is not set -# CONFIG_RESET_TI_SYSCON is not set -# CONFIG_RESET_ZYNQ is not set -# CONFIG_RFD77402 is not set -# CONFIG_RFD_FTL is not set -CONFIG_RFKILL=y -# CONFIG_RFKILL_FULL is not set -# CONFIG_RFKILL_GPIO is not set -# CONFIG_RFKILL_INPUT is not set -# CONFIG_RFKILL_LEDS is not set -# CONFIG_RFKILL_REGULATOR is not set -# CONFIG_RING_BUFFER_BENCHMARK is not set -# CONFIG_RING_BUFFER_STARTUP_TEST is not set -# CONFIG_RMI4_CORE is not set -# CONFIG_RMNET is not set -# CONFIG_ROCKCHIP_PHY is not set -# CONFIG_ROCKER is not set -# CONFIG_ROMFS_FS is not set -# CONFIG_ROSE is not set -# CONFIG_RPCSEC_GSS_KRB5 is not set -# CONFIG_RPMSG_QCOM_GLINK_RPM is not set -# CONFIG_RPMSG_VIRTIO is not set -# CONFIG_RPR0521 is not set -# CONFIG_RSEQ is not set -# CONFIG_RT2X00 is not set -# CONFIG_RTC_CLASS is not set -# CONFIG_RTC_DEBUG is not set -# CONFIG_RTC_DRV_ABB5ZES3 is not set -# CONFIG_RTC_DRV_ABX80X is not set -# CONFIG_RTC_DRV_ARMADA38X is not set -# CONFIG_RTC_DRV_AU1XXX is not set -# CONFIG_RTC_DRV_BQ32K is not set -# CONFIG_RTC_DRV_BQ4802 is not set -CONFIG_RTC_DRV_CMOS=y -# CONFIG_RTC_DRV_DS1286 is not set -# CONFIG_RTC_DRV_DS1302 is not set -# CONFIG_RTC_DRV_DS1305 is not set -# CONFIG_RTC_DRV_DS1307 is not set -# CONFIG_RTC_DRV_DS1307_CENTURY is not set -# CONFIG_RTC_DRV_DS1307_HWMON is not set -# CONFIG_RTC_DRV_DS1343 is not set -# CONFIG_RTC_DRV_DS1347 is not set -# CONFIG_RTC_DRV_DS1374 is not set -# CONFIG_RTC_DRV_DS1390 is not set -# CONFIG_RTC_DRV_DS1511 is not set -# CONFIG_RTC_DRV_DS1553 is not set -# CONFIG_RTC_DRV_DS1672 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_DS3232 is not set -# CONFIG_RTC_DRV_DS3234 is not set -# CONFIG_RTC_DRV_EM3027 is not set -# CONFIG_RTC_DRV_EP93XX is not set -# CONFIG_RTC_DRV_FM3130 is not set -# CONFIG_RTC_DRV_FTRTC010 is not set -# CONFIG_RTC_DRV_GENERIC is not set -# CONFIG_RTC_DRV_HID_SENSOR_TIME is not set -# CONFIG_RTC_DRV_HYM8563 is not set -# CONFIG_RTC_DRV_ISL12022 is not set -# CONFIG_RTC_DRV_ISL12026 is not set -# CONFIG_RTC_DRV_ISL12057 is not set -# CONFIG_RTC_DRV_ISL1208 is not set -# CONFIG_RTC_DRV_M41T80 is not set -# CONFIG_RTC_DRV_M41T93 is not set -# CONFIG_RTC_DRV_M41T94 is not set -# CONFIG_RTC_DRV_M48T35 is not set -# CONFIG_RTC_DRV_M48T59 is not set -# CONFIG_RTC_DRV_M48T86 is not set -# CONFIG_RTC_DRV_MAX6900 is not set -# CONFIG_RTC_DRV_MAX6902 is not set -# CONFIG_RTC_DRV_MAX6916 is not set -# CONFIG_RTC_DRV_MCP795 is not set -# CONFIG_RTC_DRV_MOXART is not set -# CONFIG_RTC_DRV_MPC5121 is not set -# CONFIG_RTC_DRV_MSM6242 is not set -# CONFIG_RTC_DRV_OMAP is not set -# CONFIG_RTC_DRV_PCF2123 is not set -# CONFIG_RTC_DRV_PCF2127 is not set -# CONFIG_RTC_DRV_PCF85063 is not set -# CONFIG_RTC_DRV_PCF8523 is not set -# CONFIG_RTC_DRV_PCF85363 is not set -# CONFIG_RTC_DRV_PCF8563 is not set -# CONFIG_RTC_DRV_PCF8583 is not set -# CONFIG_RTC_DRV_PL030 is not set -# CONFIG_RTC_DRV_PL031 is not set -# CONFIG_RTC_DRV_PS3 is not set -# CONFIG_RTC_DRV_PT7C4338 is not set -# CONFIG_RTC_DRV_R7301 is not set -# CONFIG_RTC_DRV_R9701 is not set -# CONFIG_RTC_DRV_RP5C01 is not set -# CONFIG_RTC_DRV_RS5C348 is not set -# CONFIG_RTC_DRV_RS5C372 is not set -# CONFIG_RTC_DRV_RTC7301 is not set -# CONFIG_RTC_DRV_RV3029C2 is not set -# CONFIG_RTC_DRV_RV8803 is not set -# CONFIG_RTC_DRV_RX4581 is not set -# CONFIG_RTC_DRV_RX6110 is not set -# CONFIG_RTC_DRV_RX8010 is not set -# CONFIG_RTC_DRV_RX8025 is not set -# CONFIG_RTC_DRV_RX8581 is not set -# CONFIG_RTC_DRV_S35390A is not set -# CONFIG_RTC_DRV_SNVS is not set -# CONFIG_RTC_DRV_STK17TA8 is not set -# CONFIG_RTC_DRV_SUN6I is not set -# CONFIG_RTC_DRV_TEST is not set -# CONFIG_RTC_DRV_V3020 is not set -# CONFIG_RTC_DRV_X1205 is not set -# CONFIG_RTC_DRV_XGENE is not set -# CONFIG_RTC_DRV_ZYNQMP is not set -CONFIG_RTC_HCTOSYS=y -CONFIG_RTC_HCTOSYS_DEVICE="rtc0" -CONFIG_RTC_INTF_DEV=y -# CONFIG_RTC_INTF_DEV_UIE_EMUL is not set -CONFIG_RTC_INTF_PROC=y -CONFIG_RTC_INTF_SYSFS=y -CONFIG_RTC_LIB=y -# CONFIG_RTC_NVMEM is not set -CONFIG_RTC_SYSTOHC=y -CONFIG_RTC_SYSTOHC_DEVICE="rtc0" -# CONFIG_RTL8180 is not set -# CONFIG_RTL8187 is not set -# CONFIG_RTL8192E is not set -# CONFIG_RTL8192U is not set -# CONFIG_RTL8306_PHY is not set -# CONFIG_RTL8366RB_PHY is not set -# CONFIG_RTL8366S_PHY is not set -# CONFIG_RTL8366_SMI is not set -# CONFIG_RTL8366_SMI_DEBUG_FS is not set -# CONFIG_RTL8367B_PHY is not set -# CONFIG_RTL8367_PHY is not set -# CONFIG_RTLLIB is not set -# CONFIG_RTL_CARDS is not set -# CONFIG_RTS5208 is not set -CONFIG_RT_MUTEXES=y -# CONFIG_RUNTIME_DEBUG is not set -CONFIG_RUNTIME_TESTING_MENU=y -CONFIG_RWSEM_GENERIC_SPINLOCK=y -CONFIG_RXKAD=y -# CONFIG_S2IO is not set -# CONFIG_SAMPLES is not set -# CONFIG_SAMSUNG_LAPTOP is not set -# CONFIG_SATA_ACARD_AHCI is not set -# CONFIG_SATA_AHCI is not set -# CONFIG_SATA_AHCI_PLATFORM is not set -# CONFIG_SATA_DWC is not set -# CONFIG_SATA_FSL is not set -# CONFIG_SATA_HIGHBANK is not set -# CONFIG_SATA_INIC162X is not set -CONFIG_SATA_MOBILE_LPM_POLICY=0 -# CONFIG_SATA_MV is not set -# CONFIG_SATA_NV is not set -# CONFIG_SATA_PMP is not set -# CONFIG_SATA_PROMISE is not set -# CONFIG_SATA_QSTOR is not set -# CONFIG_SATA_RCAR is not set -# CONFIG_SATA_SIL is not set -# CONFIG_SATA_SIL24 is not set -# CONFIG_SATA_SIS is not set -# CONFIG_SATA_SVW is not set -# CONFIG_SATA_SX4 is not set -# CONFIG_SATA_ULI is not set -# CONFIG_SATA_VIA is not set -# CONFIG_SATA_VITESSE is not set -# CONFIG_SBC_FITPC2_WATCHDOG is not set -CONFIG_SBITMAP=y -# CONFIG_SC92031 is not set -# CONFIG_SCA3000 is not set -# CONFIG_SCACHE_DEBUGFS is not set -# CONFIG_SCC is not set -# CONFIG_SCHEDSTATS is not set -# CONFIG_SCHED_AUTOGROUP is not set -# CONFIG_SCHED_DEBUG is not set -CONFIG_SCHED_HRTICK=y -# CONFIG_SCHED_MC is not set -CONFIG_SCHED_OMIT_FRAME_POINTER=y -# CONFIG_SCHED_SMT is not set -# CONFIG_SCHED_STACK_END_CHECK is not set -# CONFIG_SCHED_TRACER is not set -# CONFIG_SCR24X is not set -# CONFIG_SCSI is not set -# CONFIG_SCSI_3W_9XXX is not set -# CONFIG_SCSI_3W_SAS is not set -# CONFIG_SCSI_7000FASST is not set -# CONFIG_SCSI_AACRAID is not set -# CONFIG_SCSI_ACARD is not set -# CONFIG_SCSI_ADVANSYS is not set -# CONFIG_SCSI_AHA152X is not set -# CONFIG_SCSI_AHA1542 is not set -# CONFIG_SCSI_AIC79XX is not set -# CONFIG_SCSI_AIC7XXX is not set -# CONFIG_SCSI_AIC94XX is not set -# CONFIG_SCSI_AM53C974 is not set -# CONFIG_SCSI_ARCMSR is not set -# CONFIG_SCSI_BFA_FC is not set -# CONFIG_SCSI_BNX2X_FCOE is not set -# CONFIG_SCSI_BNX2_ISCSI is not set -# CONFIG_SCSI_BUSLOGIC is not set -# CONFIG_SCSI_CHELSIO_FCOE is not set -# CONFIG_SCSI_CONSTANTS is not set -# CONFIG_SCSI_CXGB3_ISCSI is not set -# CONFIG_SCSI_CXGB4_ISCSI is not set -# CONFIG_SCSI_DC395x is not set -# CONFIG_SCSI_DEBUG is not set -# CONFIG_SCSI_DH is not set -CONFIG_SCSI_DMA=y -# CONFIG_SCSI_DMX3191D is not set -# CONFIG_SCSI_DPT_I2O is not set -# CONFIG_SCSI_DTC3280 is not set -# CONFIG_SCSI_EATA is not set -# CONFIG_SCSI_ESAS2R is not set -# CONFIG_SCSI_FC_ATTRS is not set -# CONFIG_SCSI_FUTURE_DOMAIN is not set -# CONFIG_SCSI_GDTH is not set -# CONFIG_SCSI_GENERIC_NCR5380 is not set -# CONFIG_SCSI_GENERIC_NCR5380_MMIO is not set -# CONFIG_SCSI_HISI_SAS is not set -# CONFIG_SCSI_HPSA is not set -# CONFIG_SCSI_HPTIOP is not set -# CONFIG_SCSI_IN2000 is not set -# CONFIG_SCSI_INIA100 is not set -# CONFIG_SCSI_INITIO is not set -# CONFIG_SCSI_IPR is not set -# CONFIG_SCSI_IPS is not set -# CONFIG_SCSI_ISCI is not set -# CONFIG_SCSI_ISCSI_ATTRS is not set -# CONFIG_SCSI_LOGGING is not set -CONFIG_SCSI_LOWLEVEL=y -# CONFIG_SCSI_LOWLEVEL_PCMCIA is not set -# CONFIG_SCSI_LPFC is not set -CONFIG_SCSI_MOD=y -# CONFIG_SCSI_MPT2SAS is not set -# CONFIG_SCSI_MPT3SAS is not set -# CONFIG_SCSI_MQ_DEFAULT is not set -# CONFIG_SCSI_MVSAS is not set -# CONFIG_SCSI_MVSAS_DEBUG is not set -# CONFIG_SCSI_MVUMI is not set -# CONFIG_SCSI_NCR53C406A is not set -# CONFIG_SCSI_NETLINK is not set -# CONFIG_SCSI_NSP32 is not set -# CONFIG_SCSI_OSD_INITIATOR is not set -# CONFIG_SCSI_PAS16 is not set -# CONFIG_SCSI_PM8001 is not set -# CONFIG_SCSI_PMCRAID is not set -CONFIG_SCSI_PROC_FS=y -# CONFIG_SCSI_QLA_FC is not set -# CONFIG_SCSI_QLA_ISCSI is not set -# CONFIG_SCSI_QLOGIC_1280 is not set -# CONFIG_SCSI_QLOGIC_FAS is not set -# CONFIG_SCSI_SAS_ATTRS is not set -# CONFIG_SCSI_SAS_LIBSAS is not set -# CONFIG_SCSI_SCAN_ASYNC is not set -# CONFIG_SCSI_SMARTPQI is not set -# CONFIG_SCSI_SNIC is not set -# CONFIG_SCSI_SPI_ATTRS is not set -# CONFIG_SCSI_SRP_ATTRS is not set -# CONFIG_SCSI_STEX is not set -# CONFIG_SCSI_SYM53C416 is not set -# CONFIG_SCSI_SYM53C8XX_2 is not set -# CONFIG_SCSI_T128 is not set -# CONFIG_SCSI_U14_34F is not set -# CONFIG_SCSI_UFSHCD is not set -# CONFIG_SCSI_ULTRASTOR is not set -# CONFIG_SCSI_VIRTIO is not set -# CONFIG_SCSI_WD719X is not set -# CONFIG_SCx200_ACB is not set -# CONFIG_SDIO_UART is not set -# CONFIG_SD_ADC_MODULATOR is not set -# CONFIG_SECCOMP is not set -CONFIG_SECTION_MISMATCH_WARN_ONLY=y -# CONFIG_SECURITY is not set -# CONFIG_SECURITYFS is not set -CONFIG_SECURITY_DMESG_RESTRICT=y -CONFIG_SELECT_MEMORY_MODEL=y -# CONFIG_SENSORS_ABITUGURU is not set -# CONFIG_SENSORS_ABITUGURU3 is not set -# CONFIG_SENSORS_ACPI_POWER is not set -# CONFIG_SENSORS_AD7314 is not set -# CONFIG_SENSORS_AD7414 is not set -# CONFIG_SENSORS_AD7418 is not set -# CONFIG_SENSORS_ADC128D818 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_ADM1275 is not set -# CONFIG_SENSORS_ADM9240 is not set -# CONFIG_SENSORS_ADS1015 is not set -# CONFIG_SENSORS_ADS7828 is not set -# CONFIG_SENSORS_ADS7871 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_AMC6821 is not set -# CONFIG_SENSORS_APDS990X is not set -# CONFIG_SENSORS_APPLESMC is not set -# CONFIG_SENSORS_ASB100 is not set -# CONFIG_SENSORS_ASC7621 is not set -# CONFIG_SENSORS_ASPEED is not set -# CONFIG_SENSORS_ATK0110 is not set -# CONFIG_SENSORS_ATXP1 is not set -# CONFIG_SENSORS_BH1770 is not set -# CONFIG_SENSORS_BH1780 is not set -# CONFIG_SENSORS_CORETEMP is not set -# CONFIG_SENSORS_DELL_SMM is not set -# CONFIG_SENSORS_DME1737 is not set -# CONFIG_SENSORS_DS1621 is not set -# CONFIG_SENSORS_DS620 is not set -# CONFIG_SENSORS_EMC1403 is not set -# CONFIG_SENSORS_EMC2103 is not set -# CONFIG_SENSORS_EMC6W201 is not set -# CONFIG_SENSORS_F71805F is not set -# CONFIG_SENSORS_F71882FG is not set -# CONFIG_SENSORS_F75375S is not set -# CONFIG_SENSORS_FAM15H_POWER is not set -# CONFIG_SENSORS_FSCHMD is not set -# CONFIG_SENSORS_FTSTEUTATES 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_GSC is not set -# CONFIG_SENSORS_HDAPS is not set -# CONFIG_SENSORS_HIH6130 is not set -# CONFIG_SENSORS_HMC5843 is not set -# CONFIG_SENSORS_HMC5843_I2C is not set -# CONFIG_SENSORS_HMC5843_SPI is not set -# CONFIG_SENSORS_HTU21 is not set -# CONFIG_SENSORS_I5500 is not set -# CONFIG_SENSORS_I5K_AMB is not set -# CONFIG_SENSORS_IBM_CFFPS is not set -# CONFIG_SENSORS_IIO_HWMON is not set -# CONFIG_SENSORS_INA209 is not set -# CONFIG_SENSORS_INA2XX is not set -# CONFIG_SENSORS_INA3221 is not set -# CONFIG_SENSORS_IR35221 is not set -# CONFIG_SENSORS_ISL29018 is not set -# CONFIG_SENSORS_ISL29028 is not set -# CONFIG_SENSORS_IT87 is not set -# CONFIG_SENSORS_JC42 is not set -# CONFIG_SENSORS_K10TEMP is not set -# CONFIG_SENSORS_K8TEMP is not set -# CONFIG_SENSORS_LINEAGE is not set -# CONFIG_SENSORS_LIS3LV02D is not set -# CONFIG_SENSORS_LIS3_I2C is not set -# CONFIG_SENSORS_LIS3_SPI is not set -# CONFIG_SENSORS_LM25066 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_LTC2945 is not set -# CONFIG_SENSORS_LTC2978 is not set -# CONFIG_SENSORS_LTC2990 is not set -# CONFIG_SENSORS_LTC3815 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_MAX16064 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_MAX20751 is not set -# CONFIG_SENSORS_MAX31722 is not set -# CONFIG_SENSORS_MAX31785 is not set -# CONFIG_SENSORS_MAX31790 is not set -# CONFIG_SENSORS_MAX34440 is not set -# CONFIG_SENSORS_MAX6621 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_MAX8688 is not set -# CONFIG_SENSORS_MCP3021 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_NPCM7XX is not set -# CONFIG_SENSORS_NSA320 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_SENSORS_PMBUS is not set -# CONFIG_SENSORS_POWR1220 is not set -# CONFIG_SENSORS_PWM_FAN is not set -# CONFIG_SENSORS_SCH5627 is not set -# CONFIG_SENSORS_SCH5636 is not set -# CONFIG_SENSORS_SCH56XX_COMMON is not set -# CONFIG_SENSORS_SHT15 is not set -# CONFIG_SENSORS_SHT21 is not set -# CONFIG_SENSORS_SHT3x is not set -# CONFIG_SENSORS_SHTC1 is not set -# CONFIG_SENSORS_SIS5595 is not set -# CONFIG_SENSORS_SMM665 is not set -# CONFIG_SENSORS_SMSC47B397 is not set -# CONFIG_SENSORS_SMSC47M1 is not set -# CONFIG_SENSORS_SMSC47M192 is not set -# CONFIG_SENSORS_STTS751 is not set -# CONFIG_SENSORS_TC654 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_TMP108 is not set -# CONFIG_SENSORS_TMP401 is not set -# CONFIG_SENSORS_TMP421 is not set -# CONFIG_SENSORS_TPS40422 is not set -# CONFIG_SENSORS_TPS53679 is not set -# CONFIG_SENSORS_TSL2550 is not set -# CONFIG_SENSORS_TSL2563 is not set -# CONFIG_SENSORS_UCD9000 is not set -# CONFIG_SENSORS_UCD9200 is not set -# CONFIG_SENSORS_VEXPRESS is not set -# CONFIG_SENSORS_VIA686A is not set -# CONFIG_SENSORS_VIA_CPUTEMP is not set -# CONFIG_SENSORS_VT1211 is not set -# CONFIG_SENSORS_VT8231 is not set -# CONFIG_SENSORS_W83627EHF is not set -# CONFIG_SENSORS_W83627HF is not set -# CONFIG_SENSORS_W83773G 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_XGENE is not set -# CONFIG_SENSORS_ZL6100 is not set -CONFIG_SERIAL_8250=y -# CONFIG_SERIAL_8250_ACCENT is not set -# CONFIG_SERIAL_8250_ASPEED_VUART is not set -# CONFIG_SERIAL_8250_BOCA is not set -CONFIG_SERIAL_8250_CONSOLE=y -# CONFIG_SERIAL_8250_CS is not set -# CONFIG_SERIAL_8250_DEPRECATED_OPTIONS is not set -# CONFIG_SERIAL_8250_DETECT_IRQ is not set -CONFIG_SERIAL_8250_DMA=y -# CONFIG_SERIAL_8250_DW is not set -# CONFIG_SERIAL_8250_EM is not set -# CONFIG_SERIAL_8250_EXAR is not set -# CONFIG_SERIAL_8250_EXAR_ST16C554 is not set -# CONFIG_SERIAL_8250_EXTENDED is not set -# CONFIG_SERIAL_8250_FINTEK is not set -# CONFIG_SERIAL_8250_FOURPORT is not set -# CONFIG_SERIAL_8250_HUB6 is not set -# CONFIG_SERIAL_8250_INGENIC is not set -# CONFIG_SERIAL_8250_LPSS is not set -# CONFIG_SERIAL_8250_MANY_PORTS is not set -# CONFIG_SERIAL_8250_MID is not set -# CONFIG_SERIAL_8250_MOXA is not set -CONFIG_SERIAL_8250_NR_UARTS=2 -# CONFIG_SERIAL_8250_PCI is not set -# CONFIG_SERIAL_8250_RSA is not set -# CONFIG_SERIAL_8250_RT288X is not set -CONFIG_SERIAL_8250_RUNTIME_UARTS=2 -# CONFIG_SERIAL_ALTERA_JTAGUART is not set -# CONFIG_SERIAL_ALTERA_UART is not set -# CONFIG_SERIAL_AMBA_PL010 is not set -# CONFIG_SERIAL_ARC is not set -# CONFIG_SERIAL_BCM63XX is not set -# CONFIG_SERIAL_CONEXANT_DIGICOLOR is not set -CONFIG_SERIAL_CORE=y -CONFIG_SERIAL_CORE_CONSOLE=y -# CONFIG_SERIAL_DEV_BUS is not set -CONFIG_SERIAL_EARLYCON=y -# CONFIG_SERIAL_EARLYCON_ARM_SEMIHOST is not set -# CONFIG_SERIAL_FSL_LPUART is not set -# CONFIG_SERIAL_GRLIB_GAISLER_APBUART is not set -# CONFIG_SERIAL_IFX6X60 is not set -# CONFIG_SERIAL_JSM is not set -# CONFIG_SERIAL_MAX3100 is not set -# CONFIG_SERIAL_MAX310X is not set -# CONFIG_SERIAL_NONSTANDARD is not set -# CONFIG_SERIAL_OF_PLATFORM is not set -# CONFIG_SERIAL_OF_PLATFORM_NWPSERIAL is not set -# CONFIG_SERIAL_PCH_UART is not set -# CONFIG_SERIAL_RP2 is not set -# CONFIG_SERIAL_SC16IS7XX is not set -# CONFIG_SERIAL_SCCNXP is not set -# CONFIG_SERIAL_SH_SCI is not set -# CONFIG_SERIAL_STM32 is not set -# CONFIG_SERIAL_ST_ASC is not set -# CONFIG_SERIAL_TIMBERDALE is not set -# CONFIG_SERIAL_UARTLITE is not set -# CONFIG_SERIAL_XILINX_PS_UART is not set -# CONFIG_SERIO is not set -# CONFIG_SERIO_ALTERA_PS2 is not set -# CONFIG_SERIO_AMBAKMI is not set -# CONFIG_SERIO_APBPS2 is not set -# CONFIG_SERIO_ARC_PS2 is not set -# CONFIG_SERIO_CT82C710 is not set -# CONFIG_SERIO_GPIO_PS2 is not set -# CONFIG_SERIO_I8042 is not set -# CONFIG_SERIO_LIBPS2 is not set -# CONFIG_SERIO_PARKBD is not set -# CONFIG_SERIO_PCIPS2 is not set -# CONFIG_SERIO_PS2MULT is not set -# CONFIG_SERIO_RAW is not set -# CONFIG_SERIO_SERPORT is not set -# CONFIG_SERIO_SUN4I_PS2 is not set -# CONFIG_SFC is not set -# CONFIG_SFC_FALCON is not set -# CONFIG_SFI is not set -# CONFIG_SGETMASK_SYSCALL is not set -# CONFIG_SGI_IOC4 is not set -# CONFIG_SGI_IP22 is not set -# CONFIG_SGI_IP27 is not set -# CONFIG_SGI_IP28 is not set -# CONFIG_SGI_IP32 is not set -# CONFIG_SGI_PARTITION is not set -# CONFIG_SG_POOL is not set -# CONFIG_SG_SPLIT is not set -CONFIG_SHMEM=y -# CONFIG_SH_ETH 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_SI1133 is not set -# CONFIG_SI1145 is not set -# CONFIG_SI7005 is not set -# CONFIG_SI7020 is not set -# CONFIG_SIBYTE_BIGSUR is not set -# CONFIG_SIBYTE_CARMEL is not set -# CONFIG_SIBYTE_CRHINE is not set -# CONFIG_SIBYTE_CRHONE is not set -# CONFIG_SIBYTE_LITTLESUR is not set -# CONFIG_SIBYTE_RHONE is not set -# CONFIG_SIBYTE_SENTOSA is not set -# CONFIG_SIBYTE_SWARM is not set -CONFIG_SIGNALFD=y -# CONFIG_SIGNED_PE_FILE_VERIFICATION is not set -# CONFIG_SIMPLE_GPIO is not set -# CONFIG_SIMPLE_PM_BUS is not set -# CONFIG_SIOX is not set -# CONFIG_SIS190 is not set -# CONFIG_SIS900 is not set -# CONFIG_SKGE is not set -# CONFIG_SKY2 is not set -# CONFIG_SKY2_DEBUG is not set -# CONFIG_SLAB is not set -CONFIG_SLABINFO=y -# CONFIG_SLAB_FREELIST_HARDENED is not set -# CONFIG_SLAB_FREELIST_RANDOM is not set -CONFIG_SLAB_MERGE_DEFAULT=y -# CONFIG_SLHC is not set -# CONFIG_SLICOSS is not set -# CONFIG_SLIMBUS is not set -# CONFIG_SLIP is not set -# CONFIG_SLOB is not set -CONFIG_SLUB=y -CONFIG_SLUB_CPU_PARTIAL=y -# CONFIG_SLUB_DEBUG is not set -# CONFIG_SLUB_DEBUG_ON is not set -# CONFIG_SLUB_MEMCG_SYSFS_ON is not set -# CONFIG_SLUB_STATS is not set -# CONFIG_SMARTJOYPLUS_FF is not set -# CONFIG_SMC911X is not set -# CONFIG_SMC9194 is not set -# CONFIG_SMC91X is not set -# CONFIG_SMP is not set -# CONFIG_SMSC911X is not set -# CONFIG_SMSC9420 is not set -# CONFIG_SMSC_PHY is not set -# CONFIG_SM_FTL is not set -# CONFIG_SND is not set -# CONFIG_SND_AC97_POWER_SAVE is not set -# CONFIG_SND_AD1816A is not set -# CONFIG_SND_AD1848 is not set -# CONFIG_SND_AD1889 is not set -# CONFIG_SND_ADLIB is not set -# CONFIG_SND_ALI5451 is not set -# CONFIG_SND_ALOOP is not set -# CONFIG_SND_ALS100 is not set -# CONFIG_SND_ALS300 is not set -# CONFIG_SND_ALS4000 is not set -# CONFIG_SND_ARM is not set -# CONFIG_SND_ASIHPI is not set -# CONFIG_SND_ATIIXP is not set -# CONFIG_SND_ATIIXP_MODEM is not set -# CONFIG_SND_ATMEL_AC97C is not set -# CONFIG_SND_ATMEL_SOC is not set -# CONFIG_SND_AU8810 is not set -# CONFIG_SND_AU8820 is not set -# CONFIG_SND_AU8830 is not set -# CONFIG_SND_AUDIO_GRAPH_CARD is not set -# CONFIG_SND_AUDIO_GRAPH_SCU_CARD is not set -# CONFIG_SND_AW2 is not set -# CONFIG_SND_AZT2320 is not set -# CONFIG_SND_AZT3328 is not set -# CONFIG_SND_BCD2000 is not set -# CONFIG_SND_BT87X is not set -# CONFIG_SND_CA0106 is not set -# CONFIG_SND_CMI8330 is not set -# CONFIG_SND_CMIPCI is not set -# CONFIG_SND_CS4231 is not set -# CONFIG_SND_CS4236 is not set -# CONFIG_SND_CS4281 is not set -# CONFIG_SND_CS46XX is not set -# CONFIG_SND_CS5530 is not set -# CONFIG_SND_CS5535AUDIO is not set -# CONFIG_SND_CTXFI is not set -# CONFIG_SND_DARLA20 is not set -# CONFIG_SND_DARLA24 is not set -# CONFIG_SND_DEBUG is not set -# CONFIG_SND_DESIGNWARE_I2S is not set -CONFIG_SND_DRIVERS=y -# CONFIG_SND_DUMMY is not set -# CONFIG_SND_DYNAMIC_MINORS is not set -# CONFIG_SND_ECHO3G is not set -# CONFIG_SND_EDMA_SOC is not set -# CONFIG_SND_EMU10K1 is not set -# CONFIG_SND_EMU10K1X is not set -# CONFIG_SND_EMU10K1_SEQ is not set -# CONFIG_SND_ENS1370 is not set -# CONFIG_SND_ENS1371 is not set -# CONFIG_SND_ES1688 is not set -# CONFIG_SND_ES18XX is not set -# CONFIG_SND_ES1938 is not set -# CONFIG_SND_ES1968 is not set -# CONFIG_SND_FIREWIRE is not set -# CONFIG_SND_FM801 is not set -# CONFIG_SND_GINA20 is not set -# CONFIG_SND_GINA24 is not set -# CONFIG_SND_GUSCLASSIC is not set -# CONFIG_SND_GUSEXTREME is not set -# CONFIG_SND_GUSMAX is not set -# CONFIG_SND_HDA_INTEL is not set -CONFIG_SND_HDA_POWER_SAVE_DEFAULT=0 -CONFIG_SND_HDA_PREALLOC_SIZE=64 -# CONFIG_SND_HDSP is not set -# CONFIG_SND_HDSPM is not set -# CONFIG_SND_HRTIMER is not set -# CONFIG_SND_HWDEP is not set -# CONFIG_SND_I2S_HI6210_I2S is not set -# CONFIG_SND_ICE1712 is not set -# CONFIG_SND_ICE1724 is not set -# CONFIG_SND_INDIGO is not set -# CONFIG_SND_INDIGODJ is not set -# CONFIG_SND_INDIGODJX is not set -# CONFIG_SND_INDIGOIO is not set -# CONFIG_SND_INDIGOIOX is not set -# CONFIG_SND_INTEL8X0 is not set -# CONFIG_SND_INTEL8X0M is not set -# CONFIG_SND_INTERWAVE is not set -# CONFIG_SND_INTERWAVE_STB is not set -# CONFIG_SND_ISA is not set -# CONFIG_SND_KIRKWOOD_SOC is not set -# CONFIG_SND_KORG1212 is not set -# CONFIG_SND_LAYLA20 is not set -# CONFIG_SND_LAYLA24 is not set -# CONFIG_SND_LOLA is not set -# CONFIG_SND_LX6464ES is not set -# CONFIG_SND_MAESTRO3 is not set -CONFIG_SND_MAX_CARDS=16 -# CONFIG_SND_MIA is not set -# CONFIG_SND_MIPS is not set -# CONFIG_SND_MIRO is not set -# CONFIG_SND_MIXART is not set -# CONFIG_SND_MIXER_OSS is not set -# CONFIG_SND_MONA is not set -# CONFIG_SND_MPC52xx_SOC_EFIKA is not set -# CONFIG_SND_MPU401 is not set -# CONFIG_SND_MTPAV is not set -# CONFIG_SND_MTS64 is not set -# CONFIG_SND_MXS_SOC is not set -# CONFIG_SND_NM256 is not set -# CONFIG_SND_OPL3SA2 is not set -# CONFIG_SND_OPL3_LIB_SEQ is not set -# CONFIG_SND_OPL4_LIB_SEQ is not set -# CONFIG_SND_OPTI92X_AD1848 is not set -# CONFIG_SND_OPTI92X_CS4231 is not set -# CONFIG_SND_OPTI93X is not set -CONFIG_SND_OSSEMUL=y -# CONFIG_SND_OXYGEN is not set -CONFIG_SND_PCI=y -# CONFIG_SND_PCM is not set -# CONFIG_SND_PCMCIA is not set -# CONFIG_SND_PCM_OSS is not set -CONFIG_SND_PCM_OSS_PLUGINS=y -# CONFIG_SND_PCM_TIMER is not set -# CONFIG_SND_PCM_XRUN_DEBUG is not set -# CONFIG_SND_PCXHR is not set -# CONFIG_SND_PDAUDIOCF is not set -# CONFIG_SND_PORTMAN2X4 is not set -# CONFIG_SND_POWERPC_SOC is not set -# CONFIG_SND_PPC is not set -CONFIG_SND_PROC_FS=y -# CONFIG_SND_RAWMIDI is not set -# CONFIG_SND_RAWMIDI_SEQ 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_RTCTIMER is not set -# CONFIG_SND_SB16 is not set -# CONFIG_SND_SB8 is not set -# CONFIG_SND_SBAWE is not set -# CONFIG_SND_SBAWE_SEQ is not set -# CONFIG_SND_SE6X is not set -# CONFIG_SND_SEQUENCER is not set -# CONFIG_SND_SERIAL_U16550 is not set -# CONFIG_SND_SIMPLE_CARD is not set -# CONFIG_SND_SIMPLE_SCU_CARD is not set -# CONFIG_SND_SIS7019 is not set -# CONFIG_SND_SOC is not set -# CONFIG_SND_SOC_AC97_CODEC is not set -# CONFIG_SND_SOC_ADAU1701 is not set -# CONFIG_SND_SOC_ADAU1761_I2C is not set -# CONFIG_SND_SOC_ADAU1761_SPI is not set -# CONFIG_SND_SOC_ADAU7002 is not set -# CONFIG_SND_SOC_AK4104 is not set -# CONFIG_SND_SOC_AK4458 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_AK5558 is not set -# CONFIG_SND_SOC_ALC5623 is not set -# CONFIG_SND_SOC_AMD_ACP is not set -# CONFIG_SND_SOC_AU1XAUDIO is not set -# CONFIG_SND_SOC_AU1XPSC is not set -# CONFIG_SND_SOC_BD28623 is not set -# CONFIG_SND_SOC_BT_SCO is not set -# CONFIG_SND_SOC_CS35L32 is not set -# CONFIG_SND_SOC_CS35L33 is not set -# CONFIG_SND_SOC_CS35L34 is not set -# CONFIG_SND_SOC_CS35L35 is not set -# CONFIG_SND_SOC_CS4265 is not set -# CONFIG_SND_SOC_CS4270 is not set -# CONFIG_SND_SOC_CS4271 is not set -# CONFIG_SND_SOC_CS4271_I2C is not set -# CONFIG_SND_SOC_CS4271_SPI is not set -# CONFIG_SND_SOC_CS42L42 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_CS42XX8_I2C is not set -# CONFIG_SND_SOC_CS43130 is not set -# CONFIG_SND_SOC_CS4349 is not set -# CONFIG_SND_SOC_CS53L30 is not set -# CONFIG_SND_SOC_DIO2125 is not set -# CONFIG_SND_SOC_ES7134 is not set -# CONFIG_SND_SOC_ES7241 is not set -# CONFIG_SND_SOC_ES8316 is not set -# CONFIG_SND_SOC_ES8328 is not set -# CONFIG_SND_SOC_ES8328_I2C is not set -# CONFIG_SND_SOC_ES8328_SPI is not set -# CONFIG_SND_SOC_EUKREA_TLV320 is not set -# CONFIG_SND_SOC_FSL_ASOC_CARD is not set -# CONFIG_SND_SOC_FSL_ASRC is not set -# CONFIG_SND_SOC_FSL_ESAI is not set -# CONFIG_SND_SOC_FSL_SAI is not set -# CONFIG_SND_SOC_FSL_SPDIF is not set -# CONFIG_SND_SOC_FSL_SSI is not set -# CONFIG_SND_SOC_GTM601 is not set -# CONFIG_SND_SOC_ICS43432 is not set -# CONFIG_SND_SOC_IMG is not set -# CONFIG_SND_SOC_IMX_AUDMUX is not set -# CONFIG_SND_SOC_IMX_ES8328 is not set -# CONFIG_SND_SOC_IMX_SPDIF is not set -# CONFIG_SND_SOC_IMX_WM8962 is not set -# CONFIG_SND_SOC_INNO_RK3036 is not set -# CONFIG_SND_SOC_INTEL_BAYTRAIL is not set -# CONFIG_SND_SOC_INTEL_BDW_RT5677_MACH is not set -# CONFIG_SND_SOC_INTEL_BXT_DA7219_MAX98357A_MACH is not set -# CONFIG_SND_SOC_INTEL_BXT_RT298_MACH is not set -# CONFIG_SND_SOC_INTEL_BYTCR_RT5640_MACH is not set -# CONFIG_SND_SOC_INTEL_BYTCR_RT5651_MACH is not set -# CONFIG_SND_SOC_INTEL_BYT_CHT_DA7213_MACH is not set -# CONFIG_SND_SOC_INTEL_BYT_CHT_ES8316_MACH is not set -# CONFIG_SND_SOC_INTEL_BYT_CHT_NOCODEC_MACH is not set -# CONFIG_SND_SOC_INTEL_BYT_MAX98090_MACH is not set -# CONFIG_SND_SOC_INTEL_BYT_RT5640_MACH is not set -# CONFIG_SND_SOC_INTEL_CHT_BSW_MAX98090_TI_MACH is not set -# CONFIG_SND_SOC_INTEL_CHT_BSW_NAU8824_MACH is not set -# CONFIG_SND_SOC_INTEL_CHT_BSW_RT5645_MACH is not set -# CONFIG_SND_SOC_INTEL_CHT_BSW_RT5672_MACH is not set -# CONFIG_SND_SOC_INTEL_HASWELL is not set -# CONFIG_SND_SOC_INTEL_KBL_RT5663_MAX98927_MACH is not set -# CONFIG_SND_SOC_INTEL_KBL_RT5663_RT5514_MAX98927_MACH is not set -# CONFIG_SND_SOC_INTEL_SKL_NAU88L25_MAX98357A_MACH is not set -# CONFIG_SND_SOC_INTEL_SKL_NAU88L25_SSM4567_MACH is not set -# CONFIG_SND_SOC_INTEL_SKL_RT286_MACH is not set -# CONFIG_SND_SOC_INTEL_SKYLAKE is not set -# CONFIG_SND_SOC_INTEL_SST is not set -CONFIG_SND_SOC_INTEL_SST_TOPLEVEL=y -# CONFIG_SND_SOC_MAX9759 is not set -# CONFIG_SND_SOC_MAX98373 is not set -# CONFIG_SND_SOC_MAX98504 is not set -# CONFIG_SND_SOC_MAX9860 is not set -# CONFIG_SND_SOC_MAX9867 is not set -# CONFIG_SND_SOC_MAX98927 is not set -# CONFIG_SND_SOC_MEDIATEK is not set -# CONFIG_SND_SOC_MPC5200_AC97 is not set -# CONFIG_SND_SOC_MPC5200_I2S is not set -# CONFIG_SND_SOC_MSM8916_WCD_ANALOG is not set -# CONFIG_SND_SOC_MSM8916_WCD_DIGITAL is not set -# CONFIG_SND_SOC_MT2701 is not set -# CONFIG_SND_SOC_MT6351 is not set -# CONFIG_SND_SOC_MT8173 is not set -# CONFIG_SND_SOC_NAU8540 is not set -# CONFIG_SND_SOC_NAU8810 is not set -# CONFIG_SND_SOC_NAU8824 is not set -# CONFIG_SND_SOC_PCM1681 is not set -# CONFIG_SND_SOC_PCM1789_I2C 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_PCM186X_I2C is not set -# CONFIG_SND_SOC_PCM186X_SPI is not set -# CONFIG_SND_SOC_PCM3168A_I2C is not set -# CONFIG_SND_SOC_PCM3168A_SPI is not set -# CONFIG_SND_SOC_PCM512x_I2C is not set -# CONFIG_SND_SOC_PCM512x_SPI is not set -# CONFIG_SND_SOC_QCOM is not set -# CONFIG_SND_SOC_RT5616 is not set -# 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_SIMPLE_AMPLIFIER is not set -# CONFIG_SND_SOC_SIRF_AUDIO_CODEC is not set -# CONFIG_SND_SOC_SPDIF is not set -# CONFIG_SND_SOC_SSM2305 is not set -# CONFIG_SND_SOC_SSM2602_I2C is not set -# CONFIG_SND_SOC_SSM2602_SPI 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_TAS5720 is not set -# CONFIG_SND_SOC_TAS6424 is not set -# CONFIG_SND_SOC_TDA7419 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_TLV320AIC32X4_I2C is not set -# CONFIG_SND_SOC_TLV320AIC32X4_SPI is not set -# CONFIG_SND_SOC_TLV320AIC3X is not set -# CONFIG_SND_SOC_TPA6130A2 is not set -# CONFIG_SND_SOC_TS3A227E is not set -# CONFIG_SND_SOC_TSCS42XX is not set -# CONFIG_SND_SOC_TSCS454 is not set -# CONFIG_SND_SOC_WM8510 is not set -# CONFIG_SND_SOC_WM8523 is not set -# CONFIG_SND_SOC_WM8524 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_WM8782 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_WM8960 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_WM8985 is not set -# CONFIG_SND_SOC_XTFPGA_I2S is not set -# CONFIG_SND_SOC_ZX_AUD96P22 is not set -# CONFIG_SND_SONICVIBES is not set -# CONFIG_SND_SPI is not set -# CONFIG_SND_SSCAPE is not set -# CONFIG_SND_SST_ATOM_HIFI2_PLATFORM_ACPI is not set -# CONFIG_SND_SST_ATOM_HIFI2_PLATFORM_PCI is not set -# CONFIG_SND_SUN4I_CODEC is not set -# CONFIG_SND_SUPPORT_OLD_API is not set -# CONFIG_SND_TIMER is not set -# CONFIG_SND_TRIDENT is not set -CONFIG_SND_USB=y -# CONFIG_SND_USB_6FIRE is not set -# CONFIG_SND_USB_AUDIO is not set -# CONFIG_SND_USB_CAIAQ is not set -# CONFIG_SND_USB_HIFACE is not set -# CONFIG_SND_USB_POD is not set -# CONFIG_SND_USB_PODHD is not set -# CONFIG_SND_USB_TONEPORT is not set -# CONFIG_SND_USB_UA101 is not set -# CONFIG_SND_USB_US122L is not set -# CONFIG_SND_USB_USX2Y is not set -# CONFIG_SND_USB_VARIAX is not set -# CONFIG_SND_VERBOSE_PRINTK is not set -CONFIG_SND_VERBOSE_PROCFS=y -# 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_VXPOCKET is not set -# CONFIG_SND_WAVEFRONT is not set -CONFIG_SND_X86=y -# CONFIG_SND_XEN_FRONTEND is not set -# CONFIG_SND_YMFPCI is not set -# CONFIG_SNI_RM is not set -# CONFIG_SOCIONEXT_SYNQUACER_PREITS is not set -# CONFIG_SOCK_CGROUP_DATA is not set -# CONFIG_SOC_AM33XX is not set -# CONFIG_SOC_AM43XX is not set -# CONFIG_SOC_BRCMSTB is not set -# CONFIG_SOC_CAMERA is not set -# CONFIG_SOC_DRA7XX is not set -# CONFIG_SOC_HAS_OMAP2_SDRC is not set -# CONFIG_SOC_OMAP5 is not set -# CONFIG_SOC_TI is not set -# CONFIG_SOFTLOCKUP_DETECTOR is not set -# CONFIG_SOFT_WATCHDOG is not set -# CONFIG_SOLARIS_X86_PARTITION is not set -# CONFIG_SONYPI is not set -# CONFIG_SONY_LAPTOP is not set -# CONFIG_SOUND is not set -# CONFIG_SOUNDWIRE is not set -# CONFIG_SOUND_OSS_CORE is not set -# CONFIG_SOUND_PRIME is not set -# CONFIG_SP5100_TCO is not set -# CONFIG_SPARSEMEM_MANUAL is not set -# CONFIG_SPARSEMEM_STATIC is not set -# CONFIG_SPARSEMEM_VMEMMAP_ENABLE is not set -# CONFIG_SPARSE_IRQ is not set -# CONFIG_SPARSE_RCU_POINTER is not set -# CONFIG_SPEAKUP is not set -# CONFIG_SPI is not set -# CONFIG_SPINLOCK_TEST is not set -# CONFIG_SPI_ALTERA is not set -# CONFIG_SPI_AU1550 is not set -# CONFIG_SPI_AXI_SPI_ENGINE is not set -# CONFIG_SPI_BCM2835 is not set -# CONFIG_SPI_BCM_QSPI is not set -# CONFIG_SPI_BITBANG is not set -# CONFIG_SPI_BUTTERFLY is not set -# CONFIG_SPI_CADENCE is not set -# CONFIG_SPI_CADENCE_QUADSPI is not set -# CONFIG_SPI_DEBUG is not set -# CONFIG_SPI_DESIGNWARE is not set -# CONFIG_SPI_FSL_DSPI is not set -# CONFIG_SPI_FSL_ESPI is not set -# CONFIG_SPI_FSL_SPI is not set -# CONFIG_SPI_GPIO is not set -# CONFIG_SPI_GPIO_OLD is not set -# CONFIG_SPI_IMG_SPFI is not set -# CONFIG_SPI_LM70_LLP is not set -# CONFIG_SPI_LOOPBACK_TEST is not set -# CONFIG_SPI_MASTER is not set -# CONFIG_SPI_MEM is not set -# CONFIG_SPI_MPC52xx is not set -# CONFIG_SPI_MPC52xx_PSC is not set -# CONFIG_SPI_OCTEON is not set -# CONFIG_SPI_OC_TINY is not set -# CONFIG_SPI_ORION is not set -# CONFIG_SPI_PL022 is not set -# CONFIG_SPI_PPC4xx is not set -# CONFIG_SPI_PXA2XX is not set -# CONFIG_SPI_PXA2XX_PCI is not set -# CONFIG_SPI_ROCKCHIP is not set -# CONFIG_SPI_S3C64XX is not set -# CONFIG_SPI_SC18IS602 is not set -# CONFIG_SPI_SLAVE is not set -# CONFIG_SPI_SPIDEV is not set -# CONFIG_SPI_THUNDERX is not set -# CONFIG_SPI_TI_QSPI is not set -# CONFIG_SPI_TLE62X0 is not set -# CONFIG_SPI_TOPCLIFF_PCH is not set -# CONFIG_SPI_XCOMM is not set -# CONFIG_SPI_XILINX is not set -# CONFIG_SPI_XWAY is not set -# CONFIG_SPI_ZYNQMP_GQSPI is not set -CONFIG_SPLIT_PTLOCK_CPUS=4 -# CONFIG_SPMI is not set -CONFIG_SQUASHFS=y -# CONFIG_SQUASHFS_4K_DEVBLK_SIZE is not set -# CONFIG_SQUASHFS_DECOMP_MULTI is not set -CONFIG_SQUASHFS_DECOMP_MULTI_PERCPU=y -# CONFIG_SQUASHFS_DECOMP_SINGLE is not set -CONFIG_SQUASHFS_EMBEDDED=y -# CONFIG_SQUASHFS_FILE_CACHE is not set -CONFIG_SQUASHFS_FILE_DIRECT=y -CONFIG_SQUASHFS_FRAGMENT_CACHE_SIZE=3 -# CONFIG_SQUASHFS_LZ4 is not set -# CONFIG_SQUASHFS_LZO is not set -# CONFIG_SQUASHFS_XATTR is not set -CONFIG_SQUASHFS_XZ=y -# CONFIG_SQUASHFS_ZLIB is not set -# CONFIG_SQUASHFS_ZSTD is not set -# CONFIG_SRAM is not set -# CONFIG_SRF04 is not set -# CONFIG_SRF08 is not set -# CONFIG_SSB is not set -# CONFIG_SSB_DEBUG is not set -# CONFIG_SSB_DRIVER_GPIO is not set -# CONFIG_SSB_HOST_SOC is not set -# CONFIG_SSB_PCMCIAHOST is not set -CONFIG_SSB_POSSIBLE=y -# CONFIG_SSB_SDIOHOST is not set -# CONFIG_SSB_SILENT is not set -# CONFIG_SSFDC is not set -# CONFIG_STACKPROTECTOR is not set -# CONFIG_STACKPROTECTOR_STRONG is not set -# CONFIG_STACKTRACE is not set -CONFIG_STACKTRACE_SUPPORT=y -# CONFIG_STACK_TRACER is not set -# CONFIG_STACK_VALIDATION is not set -CONFIG_STAGING=y -# CONFIG_STAGING_BOARD is not set -# CONFIG_STAGING_GASKET_FRAMEWORK is not set -# CONFIG_STAGING_MEDIA is not set -CONFIG_STANDALONE=y -# CONFIG_STATIC_KEYS_SELFTEST is not set -# CONFIG_STATIC_USERMODEHELPER is not set -CONFIG_STDBINUTILS=y -# CONFIG_STE10XP is not set -# CONFIG_STE_MODEM_RPROC is not set -# CONFIG_STK3310 is not set -# CONFIG_STK8312 is not set -# CONFIG_STK8BA50 is not set -# CONFIG_STM is not set -# CONFIG_STMMAC_ETH is not set -# CONFIG_STMMAC_PCI is not set -# CONFIG_STMMAC_PLATFORM is not set -# CONFIG_STM_DUMMY is not set -# CONFIG_STM_SOURCE_CONSOLE is not set -CONFIG_STP=y -# CONFIG_STREAM_PARSER is not set -# CONFIG_STRICT_DEVMEM is not set -CONFIG_STRICT_KERNEL_RWX=y -CONFIG_STRICT_MODULE_RWX=y -# CONFIG_STRING_SELFTEST is not set -CONFIG_STRIP_ASM_SYMS=y -# CONFIG_STX104 is not set -# CONFIG_ST_UVIS25 is not set -# CONFIG_SUN4I_GPADC is not set -# CONFIG_SUN50I_DE2_BUS is not set -# CONFIG_SUNDANCE is not set -# CONFIG_SUNGEM is not set -# CONFIG_SUNRPC is not set -# CONFIG_SUNRPC_DEBUG is not set -# CONFIG_SUNRPC_GSS is not set -# CONFIG_SUNXI_SRAM is not set -# CONFIG_SUN_PARTITION is not set -# CONFIG_SURFACE_3_BUTTON is not set -# CONFIG_SUSPEND is not set -# CONFIG_SUSPEND_SKIP_SYNC is not set -CONFIG_SWAP=y -# CONFIG_SWCONFIG is not set -# CONFIG_SWCONFIG_B53 is not set -# CONFIG_SWCONFIG_B53_SPI_DRIVER is not set -# CONFIG_SWCONFIG_LEDS is not set -# CONFIG_SW_SYNC is not set -# CONFIG_SX9500 is not set -# CONFIG_SXGBE_ETH is not set -# CONFIG_SYNCLINK_CS is not set -# CONFIG_SYNC_FILE is not set -# CONFIG_SYNOPSYS_DWC_ETH_QOS is not set -CONFIG_SYN_COOKIES=y -# CONFIG_SYSCON_REBOOT_MODE is not set -CONFIG_SYSCTL=y -# CONFIG_SYSCTL_SYSCALL is not set -CONFIG_SYSFS=y -# CONFIG_SYSFS_DEPRECATED is not set -# CONFIG_SYSFS_DEPRECATED_V2 is not set -# CONFIG_SYSFS_SYSCALL is not set -# CONFIG_SYSTEMPORT is not set -# CONFIG_SYSTEM_BLACKLIST_KEYRING is not set -# CONFIG_SYSTEM_DATA_VERIFICATION is not set -# CONFIG_SYSTEM_TRUSTED_KEYRING is not set -CONFIG_SYSTEM_TRUSTED_KEYS="" -# CONFIG_SYSV68_PARTITION is not set -CONFIG_SYSVIPC=y -CONFIG_SYSVIPC_SYSCTL=y -# CONFIG_SYSV_FS is not set -# CONFIG_SYS_HYPERVISOR is not set -# CONFIG_T5403 is not set -# CONFIG_TARGET_CORE is not set -# CONFIG_TASKSTATS is not set -# CONFIG_TASKS_RCU is not set -# CONFIG_TASK_XACCT is not set -# CONFIG_TC35815 is not set -# CONFIG_TCG_ATMEL is not set -# CONFIG_TCG_CRB is not set -# CONFIG_TCG_INFINEON is not set -# CONFIG_TCG_NSC is not set -# CONFIG_TCG_ST33_I2C is not set -# CONFIG_TCG_TIS is not set -# CONFIG_TCG_TIS_I2C_ATMEL is not set -# CONFIG_TCG_TIS_I2C_INFINEON is not set -# CONFIG_TCG_TIS_I2C_NUVOTON is not set -# CONFIG_TCG_TIS_SPI is not set -# CONFIG_TCG_TIS_ST33ZP24_I2C is not set -# CONFIG_TCG_TIS_ST33ZP24_SPI is not set -# CONFIG_TCG_TPM is not set -# CONFIG_TCG_VTPM_PROXY is not set -# CONFIG_TCG_XEN is not set -# CONFIG_TCIC is not set -CONFIG_TCP_CONG_ADVANCED=y -# CONFIG_TCP_CONG_BBR is not set -# CONFIG_TCP_CONG_BIC is not set -# CONFIG_TCP_CONG_CDG is not set -CONFIG_TCP_CONG_CUBIC=y -# CONFIG_TCP_CONG_DCTCP is not set -# CONFIG_TCP_CONG_HSTCP is not set -# CONFIG_TCP_CONG_HTCP is not set -# CONFIG_TCP_CONG_HYBLA is not set -# CONFIG_TCP_CONG_ILLINOIS is not set -# CONFIG_TCP_CONG_LP is not set -# CONFIG_TCP_CONG_NV is not set -# CONFIG_TCP_CONG_SCALABLE is not set -# CONFIG_TCP_CONG_VEGAS is not set -# CONFIG_TCP_CONG_VENO is not set -# CONFIG_TCP_CONG_WESTWOOD is not set -# CONFIG_TCP_CONG_YEAH is not set -# CONFIG_TCP_MD5SIG is not set -# CONFIG_TCS3414 is not set -# CONFIG_TCS3472 is not set -# CONFIG_TEE is not set -# CONFIG_TEGRA_AHB is not set -# CONFIG_TEGRA_HOST1X is not set -# CONFIG_TEHUTI is not set -# CONFIG_TERANETICS_PHY is not set -# CONFIG_TEST_ASYNC_DRIVER_PROBE is not set -# CONFIG_TEST_BITFIELD is not set -# CONFIG_TEST_BITMAP is not set -# CONFIG_TEST_BPF is not set -# CONFIG_TEST_FIRMWARE is not set -# CONFIG_TEST_HASH is not set -# CONFIG_TEST_HEXDUMP is not set -# CONFIG_TEST_IDA is not set -# CONFIG_TEST_KMOD is not set -# CONFIG_TEST_KSTRTOX is not set -# CONFIG_TEST_LIST_SORT is not set -# CONFIG_TEST_LKM is not set -# CONFIG_TEST_OVERFLOW is not set -# CONFIG_TEST_POWER is not set -# CONFIG_TEST_PRINTF is not set -# CONFIG_TEST_RHASHTABLE is not set -# CONFIG_TEST_SORT is not set -# CONFIG_TEST_STATIC_KEYS is not set -# CONFIG_TEST_STRING_HELPERS is not set -# CONFIG_TEST_SYSCTL is not set -# CONFIG_TEST_UDELAY is not set -# CONFIG_TEST_USER_COPY is not set -# CONFIG_TEST_UUID is not set -CONFIG_TEXTSEARCH=y -# CONFIG_TEXTSEARCH_BM is not set -# CONFIG_TEXTSEARCH_FSM is not set -# CONFIG_TEXTSEARCH_KMP is not set -# CONFIG_THERMAL is not set -# CONFIG_THERMAL_DEFAULT_GOV_FAIR_SHARE is not set -# CONFIG_THERMAL_DEFAULT_GOV_POWER_ALLOCATOR is not set -# CONFIG_THERMAL_DEFAULT_GOV_USER_SPACE is not set -# CONFIG_THERMAL_EMULATION is not set -# CONFIG_THERMAL_GOV_BANG_BANG is not set -# CONFIG_THERMAL_GOV_FAIR_SHARE is not set -# CONFIG_THERMAL_GOV_POWER_ALLOCATOR is not set -# CONFIG_THERMAL_GOV_USER_SPACE is not set -# CONFIG_THERMAL_HWMON is not set -# CONFIG_THERMAL_STATISTICS is not set -# CONFIG_THERMAL_WRITABLE_TRIPS is not set -# CONFIG_THINKPAD_ACPI is not set -CONFIG_THIN_ARCHIVES=y -# CONFIG_THRUSTMASTER_FF is not set -# CONFIG_THUNDERBOLT is not set -# CONFIG_THUNDER_NIC_BGX is not set -# CONFIG_THUNDER_NIC_PF is not set -# CONFIG_THUNDER_NIC_RGX is not set -# CONFIG_THUNDER_NIC_VF is not set -# CONFIG_TICK_CPU_ACCOUNTING is not set -CONFIG_TICK_ONESHOT=y -# CONFIG_TIFM_CORE is not set -# CONFIG_TIGON3 is not set -# CONFIG_TIMB_DMA is not set -CONFIG_TIMERFD=y -# CONFIG_TIMER_STATS is not set -CONFIG_TINY_RCU=y -# CONFIG_TIPC is not set -# CONFIG_TI_ADC081C is not set -# CONFIG_TI_ADC0832 is not set -# CONFIG_TI_ADC084S021 is not set -# CONFIG_TI_ADC108S102 is not set -# CONFIG_TI_ADC12138 is not set -# CONFIG_TI_ADC128S052 is not set -# CONFIG_TI_ADC161S626 is not set -# CONFIG_TI_ADS1015 is not set -# CONFIG_TI_ADS7950 is not set -# CONFIG_TI_ADS8688 is not set -# CONFIG_TI_AM335X_ADC is not set -# CONFIG_TI_CPSW is not set -# CONFIG_TI_CPSW_ALE is not set -# CONFIG_TI_CPTS is not set -# CONFIG_TI_DAC082S085 is not set -# CONFIG_TI_DAC5571 is not set -# CONFIG_TI_DAC7512 is not set -# CONFIG_TI_DAVINCI_CPDMA is not set -# CONFIG_TI_DAVINCI_MDIO is not set -# CONFIG_TI_ST is not set -# CONFIG_TI_SYSCON_RESET is not set -# CONFIG_TI_TLC4541 is not set -# CONFIG_TLAN is not set -# CONFIG_TLS is not set -# CONFIG_TMD_HERMES is not set -# CONFIG_TMP006 is not set -# CONFIG_TMP007 is not set -CONFIG_TMPFS=y -# CONFIG_TMPFS_POSIX_ACL is not set -CONFIG_TMPFS_XATTR=y -# CONFIG_TOPSTAR_LAPTOP is not set -# CONFIG_TORTURE_TEST is not set -# CONFIG_TOSHIBA_HAPS is not set -# CONFIG_TOUCHSCREEN_88PM860X is not set -# CONFIG_TOUCHSCREEN_AD7877 is not set -# CONFIG_TOUCHSCREEN_AD7879_I2C is not set -# CONFIG_TOUCHSCREEN_AD7879 is not set -# CONFIG_TOUCHSCREEN_AD7879_SPI is not set -# CONFIG_TOUCHSCREEN_ADC is not set -# CONFIG_TOUCHSCREEN_ADS7846 is not set -# CONFIG_TOUCHSCREEN_AR1021_I2C is not set -# CONFIG_TOUCHSCREEN_ATMEL_MXT is not set -# CONFIG_TOUCHSCREEN_ATMEL_MXT_T37 is not set -# CONFIG_TOUCHSCREEN_AUO_PIXCIR is not set -# CONFIG_TOUCHSCREEN_BU21013 is not set -# CONFIG_TOUCHSCREEN_BU21029 is not set -# CONFIG_TOUCHSCREEN_CHIPONE_ICN8318 is not set -# CONFIG_TOUCHSCREEN_CHIPONE_ICN8505 is not set -# CONFIG_TOUCHSCREEN_COLIBRI_VF50 is not set -# CONFIG_TOUCHSCREEN_CY8CTMG110 is not set -# CONFIG_TOUCHSCREEN_CYTTSP4_CORE is not set -# CONFIG_TOUCHSCREEN_CYTTSP4_I2C is not set -# CONFIG_TOUCHSCREEN_CYTTSP4_SPI is not set -# CONFIG_TOUCHSCREEN_CYTTSP_CORE is not set -# CONFIG_TOUCHSCREEN_CYTTSP_I2C is not set -# CONFIG_TOUCHSCREEN_CYTTSP_SPI is not set -# CONFIG_TOUCHSCREEN_DA9034 is not set -# CONFIG_TOUCHSCREEN_DA9052 is not set -# CONFIG_TOUCHSCREEN_DYNAPRO is not set -# CONFIG_TOUCHSCREEN_EDT_FT5X06 is not set -# CONFIG_TOUCHSCREEN_EETI is not set -# CONFIG_TOUCHSCREEN_EGALAX is not set -# CONFIG_TOUCHSCREEN_EGALAX_SERIAL is not set -# CONFIG_TOUCHSCREEN_EKTF2127 is not set -# CONFIG_TOUCHSCREEN_ELAN is not set -# CONFIG_TOUCHSCREEN_ELO is not set -# CONFIG_TOUCHSCREEN_EXC3000 is not set -# CONFIG_TOUCHSCREEN_FUJITSU is not set -# CONFIG_TOUCHSCREEN_GOODIX is not set -# CONFIG_TOUCHSCREEN_GUNZE is not set -# CONFIG_TOUCHSCREEN_HAMPSHIRE is not set -# CONFIG_TOUCHSCREEN_HIDEEP is not set -# CONFIG_TOUCHSCREEN_HP600 is not set -# CONFIG_TOUCHSCREEN_HP7XX is not set -# CONFIG_TOUCHSCREEN_HTCPEN is not set -# CONFIG_TOUCHSCREEN_ILI210X is not set -# CONFIG_TOUCHSCREEN_IMX6UL_TSC is not set -# CONFIG_TOUCHSCREEN_INEXIO is not set -# CONFIG_TOUCHSCREEN_IPAQ_MICRO is not set -# CONFIG_TOUCHSCREEN_IPROC is not set -# CONFIG_TOUCHSCREEN_LPC32XX is not set -# CONFIG_TOUCHSCREEN_MAX11801 is not set -# CONFIG_TOUCHSCREEN_MC13783 is not set -# CONFIG_TOUCHSCREEN_MCS5000 is not set -# CONFIG_TOUCHSCREEN_MELFAS_MIP4 is not set -# CONFIG_TOUCHSCREEN_MIGOR is not set -# CONFIG_TOUCHSCREEN_MK712 is not set -# CONFIG_TOUCHSCREEN_MMS114 is not set -# CONFIG_TOUCHSCREEN_MTOUCH is not set -# CONFIG_TOUCHSCREEN_MX25 is not set -# CONFIG_TOUCHSCREEN_MXS_LRADC is not set -# CONFIG_TOUCHSCREEN_PCAP is not set -# CONFIG_TOUCHSCREEN_PENMOUNT is not set -# CONFIG_TOUCHSCREEN_PIXCIR is not set -# CONFIG_TOUCHSCREEN_PROPERTIES is not set -# CONFIG_TOUCHSCREEN_RM_TS is not set -# CONFIG_TOUCHSCREEN_ROHM_BU21023 is not set -# CONFIG_TOUCHSCREEN_S3C2410 is not set -# CONFIG_TOUCHSCREEN_S6SY761 is not set -# CONFIG_TOUCHSCREEN_SILEAD is not set -# CONFIG_TOUCHSCREEN_SIS_I2C is not set -# CONFIG_TOUCHSCREEN_ST1232 is not set -# CONFIG_TOUCHSCREEN_STMFTS is not set -# CONFIG_TOUCHSCREEN_STMPE is not set -# CONFIG_TOUCHSCREEN_SUN4I is not set -# CONFIG_TOUCHSCREEN_SUR40 is not set -# CONFIG_TOUCHSCREEN_SURFACE3_SPI is not set -# CONFIG_TOUCHSCREEN_SX8654 is not set -# CONFIG_TOUCHSCREEN_TI_AM335X_TSC is not set -# CONFIG_TOUCHSCREEN_TOUCHIT213 is not set -# CONFIG_TOUCHSCREEN_TOUCHRIGHT is not set -# CONFIG_TOUCHSCREEN_TOUCHWIN is not set -# CONFIG_TOUCHSCREEN_TPS6507X is not set -# CONFIG_TOUCHSCREEN_TS4800 is not set -# CONFIG_TOUCHSCREEN_TSC2004 is not set -# CONFIG_TOUCHSCREEN_TSC2005 is not set -# CONFIG_TOUCHSCREEN_TSC2007_IIO is not set -# CONFIG_TOUCHSCREEN_TSC2007 is not set -# CONFIG_TOUCHSCREEN_TSC200X_CORE is not set -# CONFIG_TOUCHSCREEN_TSC_SERIO is not set -# CONFIG_TOUCHSCREEN_UCB1400 is not set -# CONFIG_TOUCHSCREEN_USB_3M is not set -# CONFIG_TOUCHSCREEN_USB_COMPOSITE is not set -# CONFIG_TOUCHSCREEN_USB_DMC_TSC10 is not set -# CONFIG_TOUCHSCREEN_USB_E2I is not set -# CONFIG_TOUCHSCREEN_USB_EASYTOUCH is not set -# CONFIG_TOUCHSCREEN_USB_EGALAX is not set -# CONFIG_TOUCHSCREEN_USB_ELO is not set -# CONFIG_TOUCHSCREEN_USB_ETT_TC45USB is not set -# CONFIG_TOUCHSCREEN_USB_ETURBO is not set -# CONFIG_TOUCHSCREEN_USB_GENERAL_TOUCH is not set -# CONFIG_TOUCHSCREEN_USB_GOTOP is not set -# CONFIG_TOUCHSCREEN_USB_GUNZE is not set -# CONFIG_TOUCHSCREEN_USB_IDEALTEK is not set -# CONFIG_TOUCHSCREEN_USB_IRTOUCH is not set -# CONFIG_TOUCHSCREEN_USB_ITM is not set -# CONFIG_TOUCHSCREEN_USB_JASTEC is not set -# CONFIG_TOUCHSCREEN_USB_NEXIO is not set -# CONFIG_TOUCHSCREEN_USB_PANJIT is not set -# CONFIG_TOUCHSCREEN_USB_ZYTRONIC is not set -# CONFIG_TOUCHSCREEN_W90X900 is not set -# CONFIG_TOUCHSCREEN_WACOM_I2C is not set -# CONFIG_TOUCHSCREEN_WACOM_W8001 is not set -# CONFIG_TOUCHSCREEN_WDT87XX_I2C is not set -# CONFIG_TOUCHSCREEN_WM831X is not set -# CONFIG_TOUCHSCREEN_WM9705 is not set -# CONFIG_TOUCHSCREEN_WM9712 is not set -# CONFIG_TOUCHSCREEN_WM9713 is not set -# CONFIG_TOUCHSCREEN_WM97XX is not set -# CONFIG_TOUCHSCREEN_WM97XX_MAINSTONE is not set -# CONFIG_TOUCHSCREEN_WM97XX_ZYLONITE is not set -# CONFIG_TOUCHSCREEN_ZET6223 is not set -# CONFIG_TOUCHSCREEN_ZFORCE is not set -# CONFIG_TPL0102 is not set -# CONFIG_TPS6105X is not set -# CONFIG_TPS65010 is not set -# CONFIG_TPS6507X is not set -# CONFIG_TRACEPOINT_BENCHMARK is not set -# CONFIG_TRACER_SNAPSHOT is not set -# CONFIG_TRACER_SNAPSHOT_PER_CPU_SWAP is not set -# CONFIG_TRACE_BRANCH_PROFILING is not set -# CONFIG_TRACE_EVAL_MAP_FILE is not set -CONFIG_TRACE_IRQFLAGS_SUPPORT=y -# CONFIG_TRACE_SINK is not set -# CONFIG_TRACING_EVENTS_GPIO is not set -CONFIG_TRACING_SUPPORT=y -CONFIG_TRAD_SIGNALS=y -# CONFIG_TRANSPARENT_HUGEPAGE is not set -# CONFIG_TREE_RCU is not set -# CONFIG_TREE_RCU_TRACE is not set -# CONFIG_TRIM_UNUSED_KSYMS is not set -# CONFIG_TRUSTED_KEYS is not set -# CONFIG_TSL2583 is not set -# CONFIG_TSL2772 is not set -# CONFIG_TSL2x7x is not set -# CONFIG_TSL4531 is not set -# CONFIG_TSYS01 is not set -# CONFIG_TSYS02D is not set -# CONFIG_TTPCI_EEPROM is not set -CONFIG_TTY=y -# CONFIG_TTY_PRINTK is not set -# CONFIG_TUN is not set -# CONFIG_TUN_VNET_CROSS_LE is not set -# CONFIG_TWL4030_CORE is not set -# CONFIG_TWL4030_MADC is not set -# CONFIG_TWL6030_GPADC is not set -# CONFIG_TWL6040_CORE is not set -# CONFIG_TYPEC is not set -# CONFIG_TYPEC_TCPM is not set -# CONFIG_TYPEC_UCSI is not set -# CONFIG_TYPHOON is not set -# CONFIG_UACCESS_WITH_MEMCPY is not set -# CONFIG_UBIFS_ATIME_SUPPORT is not set -# CONFIG_UBIFS_FS_ENCRYPTION is not set -CONFIG_UBIFS_FS_FORMAT4=y -# CONFIG_UBIFS_FS_SECURITY is not set -# CONFIG_UBIFS_FS_XATTR is not set -# CONFIG_UBSAN is not set -# CONFIG_UCB1400_CORE is not set -# CONFIG_UCSI is not set -# CONFIG_UDF_FS is not set -CONFIG_UEVENT_HELPER=y -CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug" -# CONFIG_UFS_FS is not set -# CONFIG_UHID is not set -CONFIG_UID16=y -# CONFIG_UIO is not set -# CONFIG_ULTRA is not set -# CONFIG_ULTRIX_PARTITION is not set -# CONFIG_UNISYSSPAR is not set -# CONFIG_UNISYS_VISORBUS is not set -CONFIG_UNIX=y -CONFIG_UNIX98_PTYS=y -# CONFIG_UNIXWARE_DISKLABEL is not set -# CONFIG_UNIX_DIAG is not set -# CONFIG_UNUSED_SYMBOLS is not set -# CONFIG_UPROBES is not set -# CONFIG_UPROBE_EVENT is not set -# CONFIG_US5182D is not set -# CONFIG_USB is not set -# CONFIG_USBIP_CORE is not set -CONFIG_USBIP_VHCI_HC_PORTS=8 -CONFIG_USBIP_VHCI_NR_HCS=1 -# CONFIG_USBIP_VUDC is not set -# CONFIG_USBPCWATCHDOG is not set -# CONFIG_USB_ACM is not set -# CONFIG_USB_ADUTUX is not set -CONFIG_USB_ALI_M5632=y -# CONFIG_USB_AMD5536UDC is not set -CONFIG_USB_AN2720=y -# CONFIG_USB_ANNOUNCE_NEW_DEVICES is not set -# CONFIG_USB_APPLEDISPLAY is not set -CONFIG_USB_ARCH_HAS_HCD=y -CONFIG_USB_ARMLINUX=y -# CONFIG_USB_ATM is not set -# CONFIG_USB_BDC_UDC is not set -CONFIG_USB_BELKIN=y -# CONFIG_USB_C67X00_HCD is not set -# CONFIG_USB_CATC is not set -# CONFIG_USB_CDC_COMPOSITE is not set -# CONFIG_USB_CHAOSKEY is not set -# CONFIG_USB_CHIPIDEA is not set -# CONFIG_USB_CONFIGFS is not set -# CONFIG_USB_CXACRU is not set -# CONFIG_USB_CYPRESS_CY7C63 is not set -# CONFIG_USB_CYTHERM is not set -CONFIG_USB_DEFAULT_PERSIST=y -# CONFIG_USB_DSBR is not set -# CONFIG_USB_DUMMY_HCD is not set -# CONFIG_USB_DWC2 is not set -# CONFIG_USB_DWC2_DEBUG is not set -# CONFIG_USB_DWC2_DUAL_ROLE is not set -# CONFIG_USB_DWC2_HOST is not set -# CONFIG_USB_DWC2_PERIPHERAL is not set -# CONFIG_USB_DWC3 is not set -# CONFIG_USB_DWC3_EXYNOS is not set -# CONFIG_USB_DWC3_HAPS is not set -# CONFIG_USB_DWC3_KEYSTONE is not set -# CONFIG_USB_DWC3_OF_SIMPLE is not set -# CONFIG_USB_DWC3_PCI is not set -# CONFIG_USB_DWC3_QCOM is not set -# CONFIG_USB_DWC3_ULPI is not set -# CONFIG_USB_DYNAMIC_MINORS is not set -# CONFIG_USB_EG20T is not set -# CONFIG_USB_EHCI_ATH79 is not set -# CONFIG_USB_EHCI_HCD_AT91 is not set -# CONFIG_USB_EHCI_HCD_OMAP is not set -# CONFIG_USB_EHCI_HCD_PPC_OF is not set -# CONFIG_USB_EHCI_MSM is not set -# CONFIG_USB_EHCI_MV is not set -CONFIG_USB_EHCI_ROOT_HUB_TT=y -CONFIG_USB_EHCI_TT_NEWSCHED=y -# CONFIG_USB_EHSET_TEST_FIXTURE is not set -# CONFIG_USB_EMI26 is not set -# CONFIG_USB_EMI62 is not set -# CONFIG_USB_EPSON2888 is not set -# CONFIG_USB_EZUSB_FX2 is not set -# CONFIG_USB_FOTG210_HCD is not set -# CONFIG_USB_FOTG210_UDC is not set -# CONFIG_USB_FSL_USB2 is not set -# CONFIG_USB_FTDI_ELAN is not set -# CONFIG_USB_FUNCTIONFS is not set -# CONFIG_USB_FUSB300 is not set -# CONFIG_USB_GADGET is not set -# CONFIG_USB_GADGETFS is not set -# 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_STORAGE_NUM_BUFFERS=2 -CONFIG_USB_GADGET_VBUS_DRAW=2 -# CONFIG_USB_GADGET_XILINX is not set -# CONFIG_USB_GL860 is not set -# CONFIG_USB_GOKU is not set -# CONFIG_USB_GPIO_VBUS is not set -# CONFIG_USB_GR_UDC is not set -# CONFIG_USB_GSPCA is not set -# CONFIG_USB_GSPCA_BENQ is not set -# CONFIG_USB_GSPCA_CONEX is not set -# CONFIG_USB_GSPCA_CPIA1 is not set -# CONFIG_USB_GSPCA_DTCS033 is not set -# CONFIG_USB_GSPCA_ETOMS is not set -# CONFIG_USB_GSPCA_FINEPIX is not set -# CONFIG_USB_GSPCA_JEILINJ is not set -# CONFIG_USB_GSPCA_JL2005BCD is not set -# CONFIG_USB_GSPCA_KINECT is not set -# CONFIG_USB_GSPCA_KONICA is not set -# CONFIG_USB_GSPCA_MARS is not set -# CONFIG_USB_GSPCA_MR97310A is not set -# CONFIG_USB_GSPCA_NW80X is not set -# CONFIG_USB_GSPCA_OV519 is not set -# CONFIG_USB_GSPCA_OV534 is not set -# CONFIG_USB_GSPCA_OV534_9 is not set -# CONFIG_USB_GSPCA_PAC207 is not set -# CONFIG_USB_GSPCA_PAC7302 is not set -# CONFIG_USB_GSPCA_PAC7311 is not set -# CONFIG_USB_GSPCA_SE401 is not set -# CONFIG_USB_GSPCA_SN9C2028 is not set -# CONFIG_USB_GSPCA_SN9C20X is not set -# CONFIG_USB_GSPCA_SONIXB is not set -# CONFIG_USB_GSPCA_SONIXJ is not set -# CONFIG_USB_GSPCA_SPCA1528 is not set -# CONFIG_USB_GSPCA_SPCA500 is not set -# CONFIG_USB_GSPCA_SPCA501 is not set -# CONFIG_USB_GSPCA_SPCA505 is not set -# CONFIG_USB_GSPCA_SPCA506 is not set -# CONFIG_USB_GSPCA_SPCA508 is not set -# CONFIG_USB_GSPCA_SPCA561 is not set -# CONFIG_USB_GSPCA_SQ905 is not set -# CONFIG_USB_GSPCA_SQ905C is not set -# CONFIG_USB_GSPCA_SQ930X is not set -# CONFIG_USB_GSPCA_STK014 is not set -# CONFIG_USB_GSPCA_STK1135 is not set -# CONFIG_USB_GSPCA_STV0680 is not set -# CONFIG_USB_GSPCA_SUNPLUS is not set -# CONFIG_USB_GSPCA_T613 is not set -# CONFIG_USB_GSPCA_TOPRO is not set -# CONFIG_USB_GSPCA_TOUPTEK is not set -# CONFIG_USB_GSPCA_TV8532 is not set -# CONFIG_USB_GSPCA_VC032X is not set -# CONFIG_USB_GSPCA_VICAM is not set -# CONFIG_USB_GSPCA_XIRLINK_CIT is not set -# CONFIG_USB_GSPCA_ZC3XX is not set -# CONFIG_USB_G_ACM_MS is not set -# CONFIG_USB_G_DBGP is not set -# CONFIG_USB_G_HID is not set -# CONFIG_USB_G_MULTI is not set -# CONFIG_USB_G_NCM is not set -# CONFIG_USB_G_NOKIA is not set -# CONFIG_USB_G_PRINTER is not set -# CONFIG_USB_G_SERIAL is not set -# CONFIG_USB_G_WEBCAM is not set -# CONFIG_USB_HCD_TEST_MODE is not set -# CONFIG_USB_HID is not set -# CONFIG_USB_HIDDEV is not set -# CONFIG_USB_HSIC_USB3503 is not set -# CONFIG_USB_HSIC_USB4604 is not set -# CONFIG_USB_HSO is not set -# CONFIG_USB_HUB_USB251XB is not set -# CONFIG_USB_HWA_HCD is not set -# CONFIG_USB_IDMOUSE is not set -# CONFIG_USB_IMX21_HCD is not set -# CONFIG_USB_IOWARRIOR is not set -# CONFIG_USB_IPHETH is not set -# CONFIG_USB_ISIGHTFW is not set -# CONFIG_USB_ISP116X_HCD is not set -# CONFIG_USB_ISP1301 is not set -# CONFIG_USB_ISP1362_HCD is not set -# CONFIG_USB_ISP1760 is not set -# CONFIG_USB_ISP1760_HCD is not set -# CONFIG_USB_KAWETH is not set -# CONFIG_USB_KBD is not set -# CONFIG_USB_KC2190 is not set -# CONFIG_USB_LAN78XX is not set -# CONFIG_USB_LCD is not set -# CONFIG_USB_LD is not set -# CONFIG_USB_LED is not set -# CONFIG_USB_LEDS_TRIGGER_USBPORT is not set -# CONFIG_USB_LED_TRIG is not set -# CONFIG_USB_LEGOTOWER is not set -# CONFIG_USB_LINK_LAYER_TEST is not set -# CONFIG_USB_M5602 is not set -# CONFIG_USB_M66592 is not set -# CONFIG_USB_MASS_STORAGE is not set -# CONFIG_USB_MAX3421_HCD is not set -# CONFIG_USB_MDC800 is not set -# CONFIG_USB_MICROTEK is not set -# CONFIG_USB_MIDI_GADGET is not set -# CONFIG_USB_MON is not set -# CONFIG_USB_MOUSE is not set -# CONFIG_USB_MSM_OTG is not set -# CONFIG_USB_MTU3 is not set -# CONFIG_USB_MUSB_HDRC is not set -# CONFIG_USB_MV_U3D is not set -# CONFIG_USB_MV_UDC is not set -# CONFIG_USB_MXS_PHY is not set -# CONFIG_USB_NET2272 is not set -# CONFIG_USB_NET2280 is not set -# CONFIG_USB_NET_AX88179_178A is not set -# CONFIG_USB_NET_AX8817X is not set -# CONFIG_USB_NET_CDCETHER is not set -# CONFIG_USB_NET_CDC_EEM is not set -# CONFIG_USB_NET_CDC_MBIM is not set -# CONFIG_USB_NET_CDC_NCM is not set -# CONFIG_USB_NET_CDC_SUBSET is not set -# CONFIG_USB_NET_CH9200 is not set -# CONFIG_USB_NET_CX82310_ETH is not set -# CONFIG_USB_NET_DM9601 is not set -# CONFIG_USB_NET_DRIVERS is not set -# CONFIG_USB_NET_GL620A is not set -# CONFIG_USB_NET_HUAWEI_CDC_NCM is not set -# CONFIG_USB_NET_INT51X1 is not set -# CONFIG_USB_NET_KALMIA is not set -# CONFIG_USB_NET_MCS7830 is not set -# CONFIG_USB_NET_NET1080 is not set -# CONFIG_USB_NET_PLUSB is not set -# CONFIG_USB_NET_QMI_WWAN is not set -# CONFIG_USB_NET_RNDIS_HOST is not set -# CONFIG_USB_NET_RNDIS_WLAN is not set -# CONFIG_USB_NET_SMSC75XX is not set -# CONFIG_USB_NET_SMSC95XX is not set -# CONFIG_USB_NET_SR9700 is not set -# CONFIG_USB_NET_SR9800 is not set -# CONFIG_USB_NET_ZAURUS is not set -# CONFIG_USB_OHCI_HCD is not set -# CONFIG_USB_OHCI_HCD_PCI is not set -# CONFIG_USB_OHCI_HCD_PPC_OF is not set -# CONFIG_USB_OHCI_HCD_PPC_OF_BE is not set -# CONFIG_USB_OHCI_HCD_PPC_OF_LE is not set -# CONFIG_USB_OHCI_HCD_SSB is not set -CONFIG_USB_OHCI_LITTLE_ENDIAN=y -# CONFIG_USB_OTG is not set -# CONFIG_USB_OTG_BLACKLIST_HUB is not set -# CONFIG_USB_OTG_FSM is not set -# CONFIG_USB_OTG_WHITELIST is not set -# CONFIG_USB_OXU210HP_HCD is not set -# CONFIG_USB_PCI is not set -# CONFIG_USB_PEGASUS is not set -# CONFIG_USB_PHY is not set -# CONFIG_USB_PRINTER is not set -# CONFIG_USB_PWC_INPUT_EVDEV is not set -# CONFIG_USB_PXA27X is not set -# CONFIG_USB_R8A66597 is not set -# CONFIG_USB_R8A66597_HCD is not set -# CONFIG_USB_RCAR_PHY is not set -# CONFIG_USB_RENESAS_USBHS is not set -# CONFIG_USB_RIO500 is not set -# CONFIG_USB_ROLE_SWITCH is not set -# CONFIG_USB_RTL8150 is not set -# CONFIG_USB_RTL8152 is not set -# CONFIG_USB_S2255 is not set -# CONFIG_USB_SERIAL 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_CP210X is not set -# CONFIG_USB_SERIAL_CYBERJACK is not set -# CONFIG_USB_SERIAL_CYPRESS_M8 is not set -# CONFIG_USB_SERIAL_DEBUG is not set -# CONFIG_USB_SERIAL_DIGI_ACCELEPORT is not set -# CONFIG_USB_SERIAL_EDGEPORT is not set -# CONFIG_USB_SERIAL_EDGEPORT_TI is not set -# CONFIG_USB_SERIAL_EMPEG is not set -# CONFIG_USB_SERIAL_F81232 is not set -# CONFIG_USB_SERIAL_F8153X is not set -# CONFIG_USB_SERIAL_FTDI_SIO is not set -# CONFIG_USB_SERIAL_GARMIN is not set -CONFIG_USB_SERIAL_GENERIC=y -# CONFIG_USB_SERIAL_IPAQ is not set -# CONFIG_USB_SERIAL_IPW is not set -# CONFIG_USB_SERIAL_IR is not set -# CONFIG_USB_SERIAL_IUU is not set -# CONFIG_USB_SERIAL_KEYSPAN is not set -CONFIG_USB_SERIAL_KEYSPAN_MPR=y -# CONFIG_USB_SERIAL_KEYSPAN_PDA is not set -CONFIG_USB_SERIAL_KEYSPAN_USA18X=y -CONFIG_USB_SERIAL_KEYSPAN_USA19=y -CONFIG_USB_SERIAL_KEYSPAN_USA19QI=y -CONFIG_USB_SERIAL_KEYSPAN_USA19QW=y -CONFIG_USB_SERIAL_KEYSPAN_USA19W=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_USA49W=y -CONFIG_USB_SERIAL_KEYSPAN_USA49WLC=y -# 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_MOS7715_PARPORT 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_OMNINET is not set -# CONFIG_USB_SERIAL_OPTICON is not set -# CONFIG_USB_SERIAL_OPTION is not set -# CONFIG_USB_SERIAL_OTI6858 is not set -# CONFIG_USB_SERIAL_PL2303 is not set -# CONFIG_USB_SERIAL_QCAUX is not set -# CONFIG_USB_SERIAL_QT2 is not set -# CONFIG_USB_SERIAL_QUALCOMM is not set -# CONFIG_USB_SERIAL_SAFE is not set -CONFIG_USB_SERIAL_SAFE_PADDED=y -# CONFIG_USB_SERIAL_SIERRAWIRELESS is not set -# CONFIG_USB_SERIAL_SIMPLE is not set -# CONFIG_USB_SERIAL_SPCP8X5 is not set -# CONFIG_USB_SERIAL_SSU100 is not set -# CONFIG_USB_SERIAL_SYMBOL is not set -# CONFIG_USB_SERIAL_TI is not set -# CONFIG_USB_SERIAL_UPD78F0730 is not set -# CONFIG_USB_SERIAL_VISOR is not set -# CONFIG_USB_SERIAL_WHITEHEAT is not set -# CONFIG_USB_SERIAL_WISHBONE is not set -# CONFIG_USB_SERIAL_XIRCOM is not set -# CONFIG_USB_SERIAL_XSENS_MT is not set -# CONFIG_USB_SEVSEG is not set -# CONFIG_USB_SIERRA_NET is not set -# CONFIG_USB_SISUSBVGA is not set -# CONFIG_USB_SL811_HCD is not set -# CONFIG_USB_SNP_UDC_PLAT is not set -# CONFIG_USB_SPEEDTOUCH is not set -# CONFIG_USB_STKWEBCAM is not set -# CONFIG_USB_STORAGE is not set -# CONFIG_USB_STORAGE_ALAUDA is not set -# CONFIG_USB_STORAGE_CYPRESS_ATACB is not set -# CONFIG_USB_STORAGE_DATAFAB is not set -# CONFIG_USB_STORAGE_DEBUG is not set -# CONFIG_USB_STORAGE_ENE_UB6250 is not set -# CONFIG_USB_STORAGE_FREECOM is not set -# CONFIG_USB_STORAGE_ISD200 is not set -# CONFIG_USB_STORAGE_JUMPSHOT is not set -# CONFIG_USB_STORAGE_KARMA is not set -# CONFIG_USB_STORAGE_ONETOUCH is not set -# CONFIG_USB_STORAGE_REALTEK is not set -# CONFIG_USB_STORAGE_SDDR09 is not set -# CONFIG_USB_STORAGE_SDDR55 is not set -# CONFIG_USB_STORAGE_USBAT is not set -# CONFIG_USB_STV06XX is not set -# CONFIG_USB_SUPPORT is not set -# CONFIG_USB_SWITCH_FSA9480 is not set -# CONFIG_USB_TEST is not set -# CONFIG_USB_TMC is not set -# CONFIG_USB_TRANCEVIBRATOR is not set -# CONFIG_USB_UAS is not set -# CONFIG_USB_UEAGLEATM is not set -# CONFIG_USB_ULPI is not set -# CONFIG_USB_ULPI_BUS is not set -# CONFIG_USB_USBNET is not set -# CONFIG_USB_USS720 is not set -# CONFIG_USB_VIDEO_CLASS is not set -CONFIG_USB_VIDEO_CLASS_INPUT_EVDEV=y -# CONFIG_USB_VL600 is not set -# CONFIG_USB_WDM is not set -# CONFIG_USB_WHCI_HCD is not set -# CONFIG_USB_WUSB is not set -# CONFIG_USB_WUSB_CBAF is not set -# CONFIG_USB_XHCI_DBGCAP is not set -# CONFIG_USB_XHCI_HCD is not set -# CONFIG_USB_XUSBATM is not set -# CONFIG_USB_YUREX is not set -# CONFIG_USB_ZD1201 is not set -# CONFIG_USB_ZERO is not set -# CONFIG_USB_ZR364XX is not set -# CONFIG_USELIB is not set -# CONFIG_USERFAULTFD is not set -# CONFIG_USE_OF is not set -# CONFIG_UTS_NS is not set -# CONFIG_UWB is not set -# CONFIG_U_SERIAL_CONSOLE is not set -# CONFIG_V4L_MEM2MEM_DRIVERS is not set -# CONFIG_V4L_TEST_DRIVERS is not set -# CONFIG_VBOXGUEST is not set -# CONFIG_VCNL4000 is not set -# CONFIG_VDSO is not set -# CONFIG_VEML6070 is not set -# CONFIG_VETH is not set -# CONFIG_VEXPRESS_CONFIG is not set -# CONFIG_VF610_ADC is not set -# CONFIG_VF610_DAC is not set -# CONFIG_VFAT_FS is not set -# CONFIG_VGASTATE is not set -# CONFIG_VGA_ARB is not set -# CONFIG_VGA_SWITCHEROO is not set -# CONFIG_VHOST_CROSS_ENDIAN_LEGACY is not set -# CONFIG_VHOST_NET is not set -# CONFIG_VHOST_VSOCK is not set -# CONFIG_VIA_RHINE is not set -# CONFIG_VIA_VELOCITY is not set -# CONFIG_VIDEO_ADV7170 is not set -# CONFIG_VIDEO_ADV7175 is not set -# CONFIG_VIDEO_ADV7180 is not set -# CONFIG_VIDEO_ADV7183 is not set -# CONFIG_VIDEO_ADV7343 is not set -# CONFIG_VIDEO_ADV7393 is not set -# CONFIG_VIDEO_ADV_DEBUG is not set -# CONFIG_VIDEO_AK881X is not set -# CONFIG_VIDEO_BT819 is not set -# CONFIG_VIDEO_BT848 is not set -# CONFIG_VIDEO_BT856 is not set -# CONFIG_VIDEO_BT866 is not set -# CONFIG_VIDEO_CADENCE is not set -# CONFIG_VIDEO_CAFE_CCIC is not set -# CONFIG_VIDEO_CS3308 is not set -# CONFIG_VIDEO_CS5345 is not set -# CONFIG_VIDEO_CS53L32A is not set -# CONFIG_VIDEO_CX231XX is not set -# CONFIG_VIDEO_CX2341X is not set -# CONFIG_VIDEO_CX25840 is not set -# CONFIG_VIDEO_CX88 is not set -# CONFIG_VIDEO_DEV is not set -# CONFIG_VIDEO_DM6446_CCDC is not set -# CONFIG_VIDEO_DT3155 is not set -# CONFIG_VIDEO_EM28XX is not set -# CONFIG_VIDEO_FIXED_MINOR_RANGES is not set -# CONFIG_VIDEO_GO7007 is not set -# CONFIG_VIDEO_HDPVR is not set -# CONFIG_VIDEO_HEXIUM_GEMINI is not set -# CONFIG_VIDEO_HEXIUM_ORION is not set -# CONFIG_VIDEO_I2C is not set -# CONFIG_VIDEO_IR_I2C is not set -# CONFIG_VIDEO_IVTV is not set -# CONFIG_VIDEO_KS0127 is not set -# CONFIG_VIDEO_M52790 is not set -# CONFIG_VIDEO_ML86V7667 is not set -# CONFIG_VIDEO_MSP3400 is not set -# CONFIG_VIDEO_MT9M111 is not set -# CONFIG_VIDEO_MT9T112 is not set -# CONFIG_VIDEO_MT9V011 is not set -# CONFIG_VIDEO_MT9V111 is not set -# CONFIG_VIDEO_MXB is not set -# CONFIG_VIDEO_NOON010PC30 is not set -# CONFIG_VIDEO_OMAP2_VOUT is not set -# CONFIG_VIDEO_OV2640 is not set -# CONFIG_VIDEO_OV2659 is not set -# CONFIG_VIDEO_OV5695 is not set -# CONFIG_VIDEO_OV6650 is not set -# CONFIG_VIDEO_OV7640 is not set -# CONFIG_VIDEO_OV7670 is not set -# CONFIG_VIDEO_OV772X is not set -# CONFIG_VIDEO_OV7740 is not set -# CONFIG_VIDEO_PVRUSB2 is not set -# CONFIG_VIDEO_RJ54N1 is not set -# CONFIG_VIDEO_SAA6588 is not set -# CONFIG_VIDEO_SAA6752HS is not set -# CONFIG_VIDEO_SAA7110 is not set -# CONFIG_VIDEO_SAA711X is not set -# CONFIG_VIDEO_SAA7127 is not set -# CONFIG_VIDEO_SAA7134 is not set -# CONFIG_VIDEO_SAA717X is not set -# CONFIG_VIDEO_SAA7185 is not set -# CONFIG_VIDEO_SH_MOBILE_CEU is not set -# CONFIG_VIDEO_SONY_BTF_MPX is not set -# CONFIG_VIDEO_SR030PC30 is not set -# CONFIG_VIDEO_TDA7432 is not set -# CONFIG_VIDEO_TDA9840 is not set -# CONFIG_VIDEO_TEA6415C is not set -# CONFIG_VIDEO_TEA6420 is not set -# CONFIG_VIDEO_THS7303 is not set -# CONFIG_VIDEO_THS8200 is not set -# CONFIG_VIDEO_TIMBERDALE is not set -# CONFIG_VIDEO_TLV320AIC23B is not set -# CONFIG_VIDEO_TM6000 is not set -# CONFIG_VIDEO_TVAUDIO is not set -# CONFIG_VIDEO_TVP514X is not set -# CONFIG_VIDEO_TVP5150 is not set -# CONFIG_VIDEO_TVP7002 is not set -# CONFIG_VIDEO_TW2804 is not set -# CONFIG_VIDEO_TW9903 is not set -# CONFIG_VIDEO_TW9906 is not set -# CONFIG_VIDEO_TW9910 is not set -# CONFIG_VIDEO_UDA1342 is not set -# CONFIG_VIDEO_UPD64031A is not set -# CONFIG_VIDEO_UPD64083 is not set -# CONFIG_VIDEO_USBTV is not set -# CONFIG_VIDEO_USBVISION is not set -# CONFIG_VIDEO_V4L2 is not set -# CONFIG_VIDEO_VP27SMPX is not set -# CONFIG_VIDEO_VPX3220 is not set -# CONFIG_VIDEO_VS6624 is not set -# CONFIG_VIDEO_WM8739 is not set -# CONFIG_VIDEO_WM8775 is not set -# CONFIG_VIDEO_ZORAN is not set -# CONFIG_VIRTIO_BALLOON is not set -# CONFIG_VIRTIO_BLK_SCSI is not set -# CONFIG_VIRTIO_INPUT is not set -CONFIG_VIRTIO_MENU=y -# CONFIG_VIRTIO_MMIO is not set -# CONFIG_VIRTIO_PCI is not set -# CONFIG_VIRTUALIZATION is not set -# CONFIG_VIRT_CPU_ACCOUNTING_GEN is not set -# CONFIG_VIRT_DRIVERS is not set -CONFIG_VIRT_TO_BUS=y -# CONFIG_VITESSE_PHY is not set -# CONFIG_VL6180 is not set -CONFIG_VLAN_8021Q=y -# CONFIG_VLAN_8021Q_GVRP is not set -# CONFIG_VLAN_8021Q_MVRP is not set -# CONFIG_VME_BUS is not set -# CONFIG_VMSPLIT_1G is not set -# CONFIG_VMSPLIT_2G is not set -# CONFIG_VMSPLIT_2G_OPT is not set -CONFIG_VMSPLIT_3G=y -# CONFIG_VMSPLIT_3G_OPT is not set -# CONFIG_VMWARE_PVSCSI is not set -# CONFIG_VMXNET3 is not set -# CONFIG_VM_EVENT_COUNTERS is not set -# CONFIG_VOP_BUS is not set -# CONFIG_VORTEX is not set -# CONFIG_VSOCKETS is not set -# CONFIG_VSOCKETS_DIAG is not set -# CONFIG_VT is not set -# CONFIG_VT6655 is not set -# CONFIG_VT6656 is not set -# CONFIG_VXFS_FS is not set -# CONFIG_VXGE is not set -# CONFIG_VXLAN is not set -# CONFIG_VZ89X is not set -# CONFIG_W1 is not set -# CONFIG_W1_CON is not set -# CONFIG_W1_MASTER_DS1WM is not set -# CONFIG_W1_MASTER_DS2482 is not set -# CONFIG_W1_MASTER_DS2490 is not set -# CONFIG_W1_MASTER_GPIO is not set -# CONFIG_W1_MASTER_MATROX is not set -# CONFIG_W1_SLAVE_BQ27000 is not set -# CONFIG_W1_SLAVE_DS2405 is not set -# CONFIG_W1_SLAVE_DS2406 is not set -# CONFIG_W1_SLAVE_DS2408 is not set -# CONFIG_W1_SLAVE_DS2413 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_DS2438 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_DS2805 is not set -# CONFIG_W1_SLAVE_DS28E04 is not set -# CONFIG_W1_SLAVE_DS28E17 is not set -# CONFIG_W1_SLAVE_SMEM is not set -# CONFIG_W1_SLAVE_THERM is not set -# CONFIG_W83627HF_WDT is not set -# CONFIG_W83877F_WDT is not set -# CONFIG_W83977F_WDT is not set -# CONFIG_WAN is not set -# CONFIG_WANXL is not set -# CONFIG_WARN_ALL_UNSEEDED_RANDOM is not set -CONFIG_WATCHDOG=y -# CONFIG_WATCHDOG_CORE is not set -CONFIG_WATCHDOG_HANDLE_BOOT_ENABLED=y -# CONFIG_WATCHDOG_NOWAYOUT is not set -# CONFIG_WATCHDOG_PRETIMEOUT_GOV is not set -# CONFIG_WATCHDOG_SYSFS is not set -# CONFIG_WD80x3 is not set -# CONFIG_WDAT_WDT is not set -# CONFIG_WDTPCI is not set -CONFIG_WEXT_CORE=y -CONFIG_WEXT_PRIV=y -CONFIG_WEXT_PROC=y -CONFIG_WEXT_SPY=y -CONFIG_WILINK_PLATFORM_DATA=y -# CONFIG_WIMAX is not set -# CONFIG_WIMAX_GDM72XX is not set -CONFIG_WIRELESS=y -CONFIG_WIRELESS_EXT=y -# CONFIG_WIRELESS_WDS is not set -# CONFIG_WIZNET_W5100 is not set -# CONFIG_WIZNET_W5300 is not set -# CONFIG_WL1251 is not set -# CONFIG_WL12XX is not set -# CONFIG_WL18XX is not set -CONFIG_WLAN=y -# CONFIG_WLAN_VENDOR_ADMTEK is not set -# CONFIG_WLAN_VENDOR_ATH is not set -# CONFIG_WLAN_VENDOR_ATMEL is not set -# CONFIG_WLAN_VENDOR_BROADCOM is not set -# CONFIG_WLAN_VENDOR_CISCO is not set -# CONFIG_WLAN_VENDOR_INTEL is not set -# CONFIG_WLAN_VENDOR_INTERSIL is not set -# CONFIG_WLAN_VENDOR_MARVELL is not set -# CONFIG_WLAN_VENDOR_MEDIATEK is not set -# CONFIG_WLAN_VENDOR_QUANTENNA is not set -# CONFIG_WLAN_VENDOR_RALINK is not set -# CONFIG_WLAN_VENDOR_REALTEK is not set -# CONFIG_WLAN_VENDOR_RSI is not set -# CONFIG_WLAN_VENDOR_ST is not set -# CONFIG_WLAN_VENDOR_TI is not set -# CONFIG_WLAN_VENDOR_ZYDAS is not set -# CONFIG_WLCORE is not set -# CONFIG_WL_MEDIATEK is not set -CONFIG_WL_TI=y -CONFIG_WQ_POWER_EFFICIENT_DEFAULT=y -# CONFIG_WQ_WATCHDOG is not set -# CONFIG_WW_MUTEX_SELFTEST is not set -# CONFIG_X25 is not set -# CONFIG_X509_CERTIFICATE_PARSER is not set -# CONFIG_X86_DEBUG_STATIC_CPU_HAS is not set -# CONFIG_X86_PKG_TEMP_THERMAL is not set -CONFIG_X86_SYSFB=y -# CONFIG_XDP_SOCKETS is not set -# CONFIG_XEN is not set -# CONFIG_XEN_GRANT_DMA_ALLOC is not set -# CONFIG_XEN_PVCALLS_FRONTEND is not set -CONFIG_XEN_SCRUB_PAGES_DEFAULT=y -CONFIG_XFRM=y -# CONFIG_XFRM_INTERFACE is not set -# CONFIG_XFRM_IPCOMP is not set -# CONFIG_XFRM_MIGRATE is not set -# CONFIG_XFRM_STATISTICS is not set -# CONFIG_XFRM_SUB_POLICY is not set -# CONFIG_XFRM_USER is not set -# CONFIG_XFS_DEBUG is not set -# CONFIG_XFS_FS is not set -# CONFIG_XFS_ONLINE_SCRUB is not set -# CONFIG_XFS_POSIX_ACL is not set -# CONFIG_XFS_QUOTA is not set -# CONFIG_XFS_RT is not set -# CONFIG_XFS_WARN is not set -# CONFIG_XILINX_AXI_EMAC is not set -# CONFIG_XILINX_DMA is not set -# CONFIG_XILINX_EMACLITE is not set -# CONFIG_XILINX_GMII2RGMII is not set -# CONFIG_XILINX_LL_TEMAC is not set -# CONFIG_XILINX_VCU is not set -# CONFIG_XILINX_WATCHDOG is not set -# CONFIG_XILINX_ZYNQMP_DMA is not set -# CONFIG_XILLYBUS is not set -# CONFIG_XIL_AXIS_FIFO is not set -# CONFIG_XIP_KERNEL is not set -# CONFIG_XMON is not set -CONFIG_XZ_DEC=y -# CONFIG_XZ_DEC_ARM is not set -# CONFIG_XZ_DEC_ARMTHUMB is not set -# CONFIG_XZ_DEC_BCJ is not set -# CONFIG_XZ_DEC_IA64 is not set -# CONFIG_XZ_DEC_POWERPC is not set -# CONFIG_XZ_DEC_SPARC is not set -# CONFIG_XZ_DEC_TEST is not set -# CONFIG_XZ_DEC_X86 is not set -# CONFIG_YAM is not set -# CONFIG_YELLOWFIN is not set -# CONFIG_YENTA is not set -# CONFIG_YENTA_O2 is not set -# CONFIG_YENTA_RICOH is not set -# CONFIG_YENTA_TI is not set -# CONFIG_YENTA_TOSHIBA is not set -# CONFIG_ZBUD is not set -# CONFIG_ZD1211RW is not set -# CONFIG_ZD1211RW_DEBUG is not set -# CONFIG_ZEROPLUS_FF is not set -# CONFIG_ZIIRAVE_WATCHDOG is not set -# CONFIG_ZISOFS is not set -# CONFIG_ZLIB_DEFLATE is not set -# CONFIG_ZLIB_INFLATE is not set -CONFIG_ZONE_DMA=y -# CONFIG_ZOPT2201 is not set -# CONFIG_ZPA2326 is not set -# CONFIG_ZPOOL is not set -# CONFIG_ZRAM is not set -# CONFIG_ZRAM_MEMORY_TRACKING is not set -# CONFIG_ZSMALLOC is not set -# CONFIG_ZX_TDM is not set diff --git a/target/linux/generic/config-4.9 b/target/linux/generic/config-4.9 deleted file mode 100644 index cdbc86e85b..0000000000 --- a/target/linux/generic/config-4.9 +++ /dev/null @@ -1,5339 +0,0 @@ -CONFIG_32BIT=y -# CONFIG_6LOWPAN is not set -# CONFIG_6LOWPAN_DEBUGFS is not set -# CONFIG_6PACK is not set -# CONFIG_8139CP is not set -# CONFIG_8139TOO is not set -# CONFIG_9P_FS is not set -# CONFIG_AB3100_CORE is not set -# CONFIG_AB8500_CORE is not set -# CONFIG_ABX500_CORE is not set -# CONFIG_ACCESSIBILITY is not set -# CONFIG_ACENIC is not set -# CONFIG_ACERHDF is not set -# CONFIG_ACORN_PARTITION is not set -# CONFIG_ACPI_ALS is not set -# CONFIG_ACPI_APEI is not set -# CONFIG_ACPI_BUTTON is not set -# CONFIG_ACPI_CONFIGFS is not set -# CONFIG_ACPI_CUSTOM_METHOD is not set -# CONFIG_ACPI_EXTLOG is not set -# CONFIG_ACPI_HED is not set -# CONFIG_ACPI_NFIT is not set -# CONFIG_ACPI_REDUCED_HARDWARE_ONLY is not set -# CONFIG_ACPI_TABLE_UPGRADE is not set -# CONFIG_ACPI_VIDEO is not set -# CONFIG_AD2S1200 is not set -# CONFIG_AD2S1210 is not set -# CONFIG_AD2S90 is not set -# CONFIG_AD5064 is not set -# CONFIG_AD525X_DPOT 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_AD5592R is not set -# CONFIG_AD5593R is not set -# CONFIG_AD5624R_SPI is not set -# CONFIG_AD5686 is not set -# CONFIG_AD5755 is not set -# CONFIG_AD5761 is not set -# CONFIG_AD5764 is not set -# CONFIG_AD5791 is not set -# CONFIG_AD5933 is not set -# CONFIG_AD7150 is not set -# CONFIG_AD7152 is not set -# CONFIG_AD7192 is not set -# CONFIG_AD7266 is not set -# CONFIG_AD7280 is not set -# CONFIG_AD7291 is not set -# CONFIG_AD7298 is not set -# CONFIG_AD7303 is not set -# CONFIG_AD7476 is not set -# CONFIG_AD7606 is not set -# CONFIG_AD7746 is not set -# CONFIG_AD7780 is not set -# CONFIG_AD7791 is not set -# CONFIG_AD7793 is not set -# CONFIG_AD7816 is not set -# CONFIG_AD7887 is not set -# CONFIG_AD7923 is not set -# CONFIG_AD799X is not set -# CONFIG_AD8366 is not set -# CONFIG_AD8801 is not set -# CONFIG_AD9523 is not set -# CONFIG_AD9832 is not set -# CONFIG_AD9834 is not set -# CONFIG_ADAPTEC_STARFIRE is not set -# 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 -# CONFIG_ADF4350 is not set -# CONFIG_ADFS_FS is not set -# CONFIG_ADIS16060 is not set -# CONFIG_ADIS16080 is not set -# CONFIG_ADIS16130 is not set -# CONFIG_ADIS16136 is not set -# 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_ADIS16260 is not set -# CONFIG_ADIS16400 is not set -# CONFIG_ADIS16480 is not set -# CONFIG_ADJD_S311 is not set -# CONFIG_ADM6996_PHY is not set -# CONFIG_ADM8211 is not set -# CONFIG_ADT7316 is not set -CONFIG_ADVISE_SYSCALLS=y -# CONFIG_ADXRS450 is not set -CONFIG_AEABI=y -# CONFIG_AFE4403 is not set -# CONFIG_AFE4404 is not set -# CONFIG_AFFS_FS is not set -# CONFIG_AFS_FS is not set -# CONFIG_AF_KCM is not set -# CONFIG_AF_RXRPC is not set -# CONFIG_AF_RXRPC_INJECT_LOSS is not set -# CONFIG_AF_RXRPC_IPV6 is not set -# CONFIG_AGP is not set -# CONFIG_AHCI_CEVA is not set -# CONFIG_AHCI_IMX is not set -# CONFIG_AHCI_MVEBU is not set -# CONFIG_AHCI_QORIQ is not set -CONFIG_AIO=y -# CONFIG_AIRO is not set -# CONFIG_AIRO_CS is not set -# CONFIG_AIX_PARTITION is not set -# CONFIG_AK09911 is not set -# CONFIG_AK8974 is not set -# CONFIG_AK8975 is not set -# CONFIG_AL3320A is not set -# CONFIG_ALIM7101_WDT is not set -CONFIG_ALLOW_DEV_COREDUMP=y -# CONFIG_ALTERA_MBOX is not set -# CONFIG_ALTERA_STAPL is not set -# CONFIG_ALTERA_TSE is not set -# CONFIG_ALX is not set -# CONFIG_AM2315 is not set -# CONFIG_AM335X_PHY_USB is not set -# CONFIG_AMBA_PL08X is not set -# CONFIG_AMD8111_ETH is not set -# CONFIG_AMD_PHY is not set -# CONFIG_AMD_XGBE is not set -# CONFIG_AMIGA_PARTITION is not set -# CONFIG_AMILO_RFKILL is not set -# CONFIG_ANDROID is not set -CONFIG_ANON_INODES=y -# CONFIG_APDS9300 is not set -# CONFIG_APDS9802ALS is not set -# CONFIG_APDS9960 is not set -# CONFIG_APM8018X is not set -# CONFIG_APM_EMULATION is not set -# CONFIG_APPLE_GMUX is not set -# CONFIG_APPLICOM is not set -# CONFIG_AQUANTIA_PHY is not set -# CONFIG_AR5523 is not set -# CONFIG_AR7 is not set -# CONFIG_AR8216_PHY is not set -# CONFIG_AR8216_PHY_LEDS is not set -# CONFIG_ARCH_ALPINE is not set -# CONFIG_ARCH_ARTPEC is not set -# CONFIG_ARCH_ASPEED is not set -# CONFIG_ARCH_AT91 is not set -# CONFIG_ARCH_BCM is not set -# CONFIG_ARCH_BCM2835 is not set -# CONFIG_ARCH_BCM_21664 is not set -# CONFIG_ARCH_BCM_23550 is not set -# CONFIG_ARCH_BCM_281XX is not set -# CONFIG_ARCH_BCM_5301X is not set -# CONFIG_ARCH_BCM_53573 is not set -# CONFIG_ARCH_BCM_63XX is not set -# CONFIG_ARCH_BCM_CYGNUS is not set -# CONFIG_ARCH_BCM_IPROC is not set -# CONFIG_ARCH_BCM_NSP is not set -# CONFIG_ARCH_BERLIN is not set -# CONFIG_ARCH_BRCMSTB is not set -# CONFIG_ARCH_CLPS711X is not set -# CONFIG_ARCH_CNS3XXX is not set -# CONFIG_ARCH_DAVINCI is not set -# CONFIG_ARCH_DIGICOLOR is not set -# CONFIG_ARCH_DMA_ADDR_T_64BIT is not set -# CONFIG_ARCH_DOVE is not set -# CONFIG_ARCH_EBSA110 is not set -# CONFIG_ARCH_EP93XX is not set -# CONFIG_ARCH_EXYNOS is not set -CONFIG_ARCH_FLATMEM_ENABLE=y -# CONFIG_ARCH_FOOTBRIDGE is not set -# CONFIG_ARCH_GEMINI is not set -CONFIG_ARCH_HAS_DEVMEM_IS_ALLOWED=y -# CONFIG_ARCH_HAS_ILOG2_U32 is not set -# CONFIG_ARCH_HAS_ILOG2_U64 is not set -CONFIG_ARCH_HAS_UBSAN_SANITIZE_ALL=y -# CONFIG_ARCH_HI3xxx is not set -# CONFIG_ARCH_HIGHBANK is not set -# CONFIG_ARCH_HISI is not set -# CONFIG_ARCH_INTEGRATOR 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_KEYSTONE is not set -# CONFIG_ARCH_KS8695 is not set -# CONFIG_ARCH_LAYERSCAPE is not set -# CONFIG_ARCH_LG1K is not set -# CONFIG_ARCH_LPC32XX is not set -# CONFIG_ARCH_MEDIATEK is not set -# CONFIG_ARCH_MESON is not set -CONFIG_ARCH_MMAP_RND_BITS=8 -CONFIG_ARCH_MMAP_RND_BITS_MAX=16 -CONFIG_ARCH_MMAP_RND_BITS_MIN=8 -CONFIG_ARCH_MMAP_RND_COMPAT_BITS_MAX=16 -CONFIG_ARCH_MMAP_RND_COMPAT_BITS_MIN=8 -# CONFIG_ARCH_MMP is not set -# CONFIG_ARCH_MULTIPLATFORM is not set -# CONFIG_ARCH_MULTI_V6 is not set -# CONFIG_ARCH_MULTI_V7 is not set -# CONFIG_ARCH_MV78XX0 is not set -# CONFIG_ARCH_MVEBU is not set -# CONFIG_ARCH_MXC is not set -# CONFIG_ARCH_MXS is not set -# CONFIG_ARCH_NEEDS_CPU_IDLE_COUPLED is not set -# CONFIG_ARCH_NETX is not set -# CONFIG_ARCH_NOMADIK is not set -# CONFIG_ARCH_NSPIRE is not set -# CONFIG_ARCH_OMAP is not set -# CONFIG_ARCH_OMAP1 is not set -# CONFIG_ARCH_OMAP2 is not set -# CONFIG_ARCH_OMAP2PLUS is not set -# CONFIG_ARCH_OMAP3 is not set -# CONFIG_ARCH_OMAP4 is not set -# CONFIG_ARCH_ORION5X is not set -# CONFIG_ARCH_OXNAS is not set -# CONFIG_ARCH_PHYS_ADDR_T_64BIT is not set -# CONFIG_ARCH_PICOXCELL is not set -# CONFIG_ARCH_PRIMA2 is not set -# CONFIG_ARCH_PXA is not set -# CONFIG_ARCH_QCOM is not set -# CONFIG_ARCH_REALVIEW is not set -# CONFIG_ARCH_RENESAS is not set -# CONFIG_ARCH_ROCKCHIP is not set -# CONFIG_ARCH_RPC is not set -# CONFIG_ARCH_S3C24XX is not set -# CONFIG_ARCH_S3C64XX is not set -# CONFIG_ARCH_S5PV210 is not set -# CONFIG_ARCH_SA1100 is not set -# CONFIG_ARCH_SEATTLE is not set -# CONFIG_ARCH_SHMOBILE is not set -# CONFIG_ARCH_SHMOBILE_MULTI is not set -# CONFIG_ARCH_SIRF is not set -# CONFIG_ARCH_SOCFPGA is not set -# CONFIG_ARCH_SPRD is not set -# CONFIG_ARCH_STI is not set -# CONFIG_ARCH_STRATIX10 is not set -# CONFIG_ARCH_SUNXI is not set -# CONFIG_ARCH_TANGO is not set -# CONFIG_ARCH_TEGRA is not set -# CONFIG_ARCH_THUNDER is not set -# CONFIG_ARCH_U300 is not set -# CONFIG_ARCH_U8500 is not set -# CONFIG_ARCH_UNIPHIER is not set -# CONFIG_ARCH_VERSATILE is not set -# CONFIG_ARCH_VEXPRESS is not set -# CONFIG_ARCH_VIRT is not set -# CONFIG_ARCH_VT8500 is not set -# CONFIG_ARCH_VULCAN is not set -# CONFIG_ARCH_W90X900 is not set -# CONFIG_ARCH_WANTS_UBSAN_NO_NULL is not set -# CONFIG_ARCH_WM8505 is not set -# CONFIG_ARCH_WM8750 is not set -# CONFIG_ARCH_WM8850 is not set -# CONFIG_ARCH_XGENE is not set -# CONFIG_ARCH_ZX is not set -# CONFIG_ARCH_ZYNQ is not set -# CONFIG_ARCH_ZYNQMP is not set -# CONFIG_ARCNET is not set -# CONFIG_ARC_EMAC is not set -# CONFIG_ARM64_ERRATUM_1024718 is not set -# CONFIG_ARM64_ERRATUM_819472 is not set -# CONFIG_ARM64_ERRATUM_824069 is not set -# CONFIG_ARM64_ERRATUM_826319 is not set -# CONFIG_ARM64_ERRATUM_827319 is not set -# CONFIG_ARM64_ERRATUM_832075 is not set -# CONFIG_ARM64_ERRATUM_834220 is not set -# CONFIG_ARM64_ERRATUM_843419 is not set -# CONFIG_ARM64_ERRATUM_845719 is not set -# CONFIG_ARM_APPENDED_DTB is not set -# CONFIG_ARM_ARCH_TIMER is not set -# CONFIG_ARM_BIG_LITTLE_CPUFREQ is not set -# CONFIG_ARM_CCI is not set -# CONFIG_ARM_CCI400_PMU is not set -# CONFIG_ARM_CCI5xx_PMU is not set -# CONFIG_ARM_CCN is not set -# CONFIG_ARM_CPUIDLE is not set -CONFIG_ARM_CPU_TOPOLOGY=y -# CONFIG_ARM_CRYPTO is not set -CONFIG_ARM_DMA_MEM_BUFFERABLE=y -# CONFIG_ARM_ERRATA_326103 is not set -# CONFIG_ARM_ERRATA_364296 is not set -# CONFIG_ARM_ERRATA_411920 is not set -# CONFIG_ARM_ERRATA_430973 is not set -# CONFIG_ARM_ERRATA_458693 is not set -# CONFIG_ARM_ERRATA_460075 is not set -# CONFIG_ARM_ERRATA_643719 is not set -# CONFIG_ARM_ERRATA_720789 is not set -# CONFIG_ARM_ERRATA_742230 is not set -# CONFIG_ARM_ERRATA_742231 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_773022 is not set -# CONFIG_ARM_ERRATA_775420 is not set -# CONFIG_ARM_ERRATA_798181 is not set -# CONFIG_ARM_ERRATA_818325_852422 is not set -# CONFIG_ARM_ERRATA_821420 is not set -# CONFIG_ARM_ERRATA_825619 is not set -# CONFIG_ARM_ERRATA_852421 is not set -# CONFIG_ARM_ERRATA_852423 is not set -CONFIG_ARM_GIC_MAX_NR=1 -# CONFIG_ARM_KERNMEM_PERMS is not set -# CONFIG_ARM_KIRKWOOD_CPUFREQ is not set -# CONFIG_ARM_KPROBES_TEST is not set -# CONFIG_ARM_MHU is not set -# CONFIG_ARM_MODULE_PLTS is not set -# CONFIG_ARM_PATCH_PHYS_VIRT is not set -# CONFIG_ARM_PSCI is not set -# CONFIG_ARM_PTDUMP is not set -# CONFIG_ARM_SBSA_WATCHDOG is not set -# CONFIG_ARM_SCPI_PROTOCOL is not set -# CONFIG_ARM_TIMER_SP804 is not set -# CONFIG_ARM_UNWIND is not set -# CONFIG_ARM_VIRT_EXT is not set -# CONFIG_AS3935 is not set -# CONFIG_ASM9260_TIMER is not set -# CONFIG_ASUS_LAPTOP is not set -# CONFIG_ASUS_WIRELESS is not set -# CONFIG_ASYMMETRIC_KEY_TYPE is not set -# CONFIG_ASYMMETRIC_PUBLIC_KEY_SUBTYPE is not set -# CONFIG_ASYNC_RAID6_TEST is not set -# CONFIG_ASYNC_TX_DMA is not set -# CONFIG_AT76C50X_USB is not set -# CONFIG_AT803X_PHY is not set -# CONFIG_AT91_SAMA5D2_ADC is not set -# CONFIG_ATA is not set -# CONFIG_ATAGS is not set -CONFIG_ATAGS_PROC=y -# CONFIG_ATALK is not set -# CONFIG_ATARI_PARTITION is not set -# CONFIG_ATA_ACPI is not set -CONFIG_ATA_BMDMA=y -# CONFIG_ATA_GENERIC is not set -# CONFIG_ATA_NONSTANDARD is not set -# CONFIG_ATA_OVER_ETH is not set -# CONFIG_ATA_PIIX is not set -CONFIG_ATA_SFF=y -# CONFIG_ATA_VERBOSE_ERROR is not set -# CONFIG_ATH10K is not set -# CONFIG_ATH25 is not set -# CONFIG_ATH5K is not set -# CONFIG_ATH6KL is not set -# CONFIG_ATH79 is not set -# CONFIG_ATH9K is not set -# CONFIG_ATH9K_HTC is not set -# CONFIG_ATH_DEBUG is not set -# CONFIG_ATL1 is not set -# CONFIG_ATL1C is not set -# CONFIG_ATL1E is not set -# CONFIG_ATL2 is not set -# CONFIG_ATLAS_PH_SENSOR is not set -# CONFIG_ATM is not set -# CONFIG_ATMEL is not set -# CONFIG_ATMEL_PIT is not set -# CONFIG_ATMEL_SSC is not set -# CONFIG_ATM_AMBASSADOR is not set -# CONFIG_ATM_BR2684 is not set -CONFIG_ATM_BR2684_IPFILTER=y -# CONFIG_ATM_CLIP is not set -CONFIG_ATM_CLIP_NO_ICMP=y -# CONFIG_ATM_DRIVERS is not set -# CONFIG_ATM_DUMMY is not set -# CONFIG_ATM_ENI is not set -# CONFIG_ATM_FIRESTREAM is not set -# CONFIG_ATM_FORE200E is not set -# CONFIG_ATM_HE is not set -# CONFIG_ATM_HORIZON is not set -# CONFIG_ATM_IA is not set -# CONFIG_ATM_IDT77252 is not set -# CONFIG_ATM_LANAI is not set -# CONFIG_ATM_LANE is not set -# CONFIG_ATM_MPOA is not set -# CONFIG_ATM_NICSTAR is not set -# CONFIG_ATM_SOLOS is not set -# CONFIG_ATM_TCP is not set -# CONFIG_ATM_ZATM is not set -# CONFIG_ATOMIC64_SELFTEST is not set -# CONFIG_ATP is not set -# CONFIG_AUDIT is not set -# CONFIG_AUDIT_ARCH_COMPAT_GENERIC is not set -# CONFIG_AURORA_NB8800 is not set -# CONFIG_AUTOFS4_FS is not set -# CONFIG_AUTO_ZRELADDR is not set -# CONFIG_AUXDISPLAY is not set -# CONFIG_AX25 is not set -# CONFIG_AX25_DAMA_SLAVE is not set -# CONFIG_AX88796 is not set -# CONFIG_AXP288_ADC is not set -# CONFIG_AXP288_FUEL_GAUGE is not set -# CONFIG_B43 is not set -# CONFIG_B43LEGACY is not set -# CONFIG_B44 is not set -# CONFIG_B53 is not set -# CONFIG_BACKLIGHT_ADP8860 is not set -# CONFIG_BACKLIGHT_ADP8870 is not set -# CONFIG_BACKLIGHT_APPLE is not set -# CONFIG_BACKLIGHT_BD6107 is not set -# CONFIG_BACKLIGHT_GENERIC is not set -# CONFIG_BACKLIGHT_GPIO is not set -# CONFIG_BACKLIGHT_LCD_SUPPORT is not set -# CONFIG_BACKLIGHT_LM3630A is not set -# CONFIG_BACKLIGHT_LM3639 is not set -# CONFIG_BACKLIGHT_LP855X is not set -# CONFIG_BACKLIGHT_LV5207LP is not set -# CONFIG_BACKLIGHT_PANDORA is not set -# CONFIG_BACKLIGHT_PM8941_WLED is not set -# CONFIG_BACKLIGHT_RPI is not set -# CONFIG_BACKLIGHT_SAHARA is not set -# CONFIG_BACKTRACE_SELF_TEST is not set -CONFIG_BASE_FULL=y -CONFIG_BASE_SMALL=0 -# CONFIG_BATMAN_ADV is not set -# CONFIG_BATTERY_BQ27XXX 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_GAUGE_LTC2941 is not set -# CONFIG_BATTERY_GOLDFISH is not set -# CONFIG_BATTERY_MAX17040 is not set -# CONFIG_BATTERY_MAX17042 is not set -# CONFIG_BATTERY_SBS is not set -# CONFIG_BAYCOM_EPP is not set -# CONFIG_BAYCOM_PAR is not set -# CONFIG_BAYCOM_SER_FDX is not set -# CONFIG_BAYCOM_SER_HDX is not set -# CONFIG_BCACHE is not set -# CONFIG_BCM47XX is not set -# CONFIG_BCM63XX is not set -# CONFIG_BCM63XX_PHY is not set -# CONFIG_BCM7038_WDT is not set -# CONFIG_BCM7XXX_PHY is not set -# CONFIG_BCM87XX_PHY is not set -# CONFIG_BCMA is not set -# CONFIG_BCMA_DRIVER_GPIO is not set -CONFIG_BCMA_POSSIBLE=y -# CONFIG_BCMGENET is not set -# CONFIG_BCM_IPROC_ADC is not set -# CONFIG_BCM_KONA_USB2_PHY is not set -# CONFIG_BDI_SWITCH is not set -# CONFIG_BE2ISCSI is not set -# CONFIG_BE2NET is not set -# CONFIG_BEFS_FS is not set -# CONFIG_BFS_FS is not set -# CONFIG_BGMAC is not set -# CONFIG_BH1750 is not set -# CONFIG_BH1780 is not set -# CONFIG_BIG_KEYS is not set -# CONFIG_BIG_LITTLE is not set -# CONFIG_BINARY_PRINTF is not set -# CONFIG_BINFMT_AOUT is not set -CONFIG_BINFMT_ELF=y -# CONFIG_BINFMT_FLAT is not set -# CONFIG_BINFMT_MISC is not set -CONFIG_BINFMT_SCRIPT=y -CONFIG_BITREVERSE=y -# CONFIG_BLK_CMDLINE_PARSER is not set -# CONFIG_BLK_CPQ_CISS_DA is not set -# CONFIG_BLK_CPQ_DA is not set -CONFIG_BLK_DEV=y -# CONFIG_BLK_DEV_3W_XXXX_RAID is not set -# CONFIG_BLK_DEV_4DRIVES is not set -# CONFIG_BLK_DEV_AEC62XX is not set -# CONFIG_BLK_DEV_ALI14XX is not set -# CONFIG_BLK_DEV_ALI15X3 is not set -# CONFIG_BLK_DEV_AMD74XX is not set -# CONFIG_BLK_DEV_ATIIXP is not set -# CONFIG_BLK_DEV_BSG is not set -# CONFIG_BLK_DEV_BSGLIB is not set -# CONFIG_BLK_DEV_CMD640 is not set -# CONFIG_BLK_DEV_CMD64X is not set -# CONFIG_BLK_DEV_COW_COMMON is not set -# CONFIG_BLK_DEV_CRYPTOLOOP is not set -# CONFIG_BLK_DEV_CS5520 is not set -# CONFIG_BLK_DEV_CS5530 is not set -# CONFIG_BLK_DEV_CS5535 is not set -# CONFIG_BLK_DEV_CS5536 is not set -# CONFIG_BLK_DEV_CY82C693 is not set -# CONFIG_BLK_DEV_DAC960 is not set -# CONFIG_BLK_DEV_DELKIN is not set -# CONFIG_BLK_DEV_DRBD is not set -# CONFIG_BLK_DEV_DTC2278 is not set -# CONFIG_BLK_DEV_FD is not set -# CONFIG_BLK_DEV_GENERIC is not set -# CONFIG_BLK_DEV_HD is not set -# CONFIG_BLK_DEV_HPT366 is not set -# CONFIG_BLK_DEV_HT6560B is not set -# CONFIG_BLK_DEV_IDEACPI is not set -# CONFIG_BLK_DEV_IDECD is not set -# CONFIG_BLK_DEV_IDECS is not set -# CONFIG_BLK_DEV_IDEPCI is not set -# CONFIG_BLK_DEV_IDEPNP is not set -# CONFIG_BLK_DEV_IDETAPE is not set -# CONFIG_BLK_DEV_IDE_AU1XXX is not set -# CONFIG_BLK_DEV_IDE_SATA is not set -CONFIG_BLK_DEV_INITRD=y -# CONFIG_BLK_DEV_INTEGRITY is not set -# CONFIG_BLK_DEV_IO_TRACE is not set -# CONFIG_BLK_DEV_IT8172 is not set -# CONFIG_BLK_DEV_IT8213 is not set -# CONFIG_BLK_DEV_IT821X is not set -# CONFIG_BLK_DEV_JMICRON is not set -# CONFIG_BLK_DEV_LOOP is not set -CONFIG_BLK_DEV_LOOP_MIN_COUNT=8 -# CONFIG_BLK_DEV_NBD is not set -# CONFIG_BLK_DEV_NS87415 is not set -# CONFIG_BLK_DEV_NULL_BLK is not set -# CONFIG_BLK_DEV_NVME is not set -# CONFIG_BLK_DEV_OFFBOARD is not set -# CONFIG_BLK_DEV_OPTI621 is not set -# CONFIG_BLK_DEV_PCIESSD_MTIP32XX is not set -# CONFIG_BLK_DEV_PDC202XX_NEW is not set -# CONFIG_BLK_DEV_PDC202XX_OLD is not set -# CONFIG_BLK_DEV_PIIX is not set -# CONFIG_BLK_DEV_PLATFORM is not set -# CONFIG_BLK_DEV_PMEM is not set -# CONFIG_BLK_DEV_QD65XX is not set -# CONFIG_BLK_DEV_RAM is not set -# CONFIG_BLK_DEV_RBD is not set -# CONFIG_BLK_DEV_RSXX is not set -# CONFIG_BLK_DEV_RZ1000 is not set -# CONFIG_BLK_DEV_SC1200 is not set -# CONFIG_BLK_DEV_SD is not set -# CONFIG_BLK_DEV_SIIMAGE is not set -# CONFIG_BLK_DEV_SIS5513 is not set -# CONFIG_BLK_DEV_SKD is not set -# CONFIG_BLK_DEV_SL82C105 is not set -# CONFIG_BLK_DEV_SLC90E66 is not set -# CONFIG_BLK_DEV_SR is not set -# CONFIG_BLK_DEV_SVWKS is not set -# CONFIG_BLK_DEV_SX8 is not set -# CONFIG_BLK_DEV_TC86C001 is not set -# CONFIG_BLK_DEV_THROTTLING is not set -# CONFIG_BLK_DEV_TRIFLEX is not set -# CONFIG_BLK_DEV_TRM290 is not set -# CONFIG_BLK_DEV_UMC8672 is not set -# CONFIG_BLK_DEV_UMEM is not set -# CONFIG_BLK_DEV_VIA82CXXX is not set -CONFIG_BLOCK=y -# CONFIG_BMA180 is not set -# CONFIG_BMA220 is not set -# CONFIG_BMC150_ACCEL is not set -# CONFIG_BMC150_MAGN is not set -# CONFIG_BMC150_MAGN_I2C is not set -# CONFIG_BMC150_MAGN_SPI is not set -# CONFIG_BMG160 is not set -# CONFIG_BMI160_I2C is not set -# CONFIG_BMI160_SPI is not set -# CONFIG_BMIPS_GENERIC is not set -# CONFIG_BMP085 is not set -# CONFIG_BMP085_I2C is not set -# CONFIG_BMP085_SPI is not set -# CONFIG_BMP280 is not set -# CONFIG_BNA is not set -# CONFIG_BNX2 is not set -# CONFIG_BNX2X is not set -# CONFIG_BNXT is not set -# CONFIG_BONDING is not set -# CONFIG_BOOKE_WDT is not set -CONFIG_BOOKE_WDT_DEFAULT_TIMEOUT=3 -# CONFIG_BOOT_PRINTK_DELAY is not set -CONFIG_BOOT_RAW=y -CONFIG_BPF=y -CONFIG_BPF_JIT=y -CONFIG_BPF_SYSCALL=y -# CONFIG_BPQETHER is not set -CONFIG_BQL=y -CONFIG_BRANCH_PROFILE_NONE=y -# CONFIG_BRCMFMAC is not set -# CONFIG_BRCMSMAC is not set -# CONFIG_BRCMSTB_GISB_ARB is not set -CONFIG_BRIDGE=y -# CONFIG_BRIDGE_EBT_802_3 is not set -# CONFIG_BRIDGE_EBT_AMONG is not set -# CONFIG_BRIDGE_EBT_ARP is not set -# CONFIG_BRIDGE_EBT_ARPREPLY is not set -# CONFIG_BRIDGE_EBT_BROUTE is not set -# CONFIG_BRIDGE_EBT_DNAT is not set -# CONFIG_BRIDGE_EBT_IP is not set -# CONFIG_BRIDGE_EBT_IP6 is not set -# CONFIG_BRIDGE_EBT_LIMIT is not set -# CONFIG_BRIDGE_EBT_LOG is not set -# CONFIG_BRIDGE_EBT_MARK is not set -# CONFIG_BRIDGE_EBT_MARK_T is not set -# CONFIG_BRIDGE_EBT_NFLOG is not set -# CONFIG_BRIDGE_EBT_PKTTYPE is not set -# CONFIG_BRIDGE_EBT_REDIRECT is not set -# CONFIG_BRIDGE_EBT_SNAT is not set -# CONFIG_BRIDGE_EBT_STP is not set -# CONFIG_BRIDGE_EBT_T_FILTER is not set -# CONFIG_BRIDGE_EBT_T_NAT is not set -# CONFIG_BRIDGE_EBT_VLAN is not set -CONFIG_BRIDGE_IGMP_SNOOPING=y -# CONFIG_BRIDGE_NETFILTER is not set -# CONFIG_BRIDGE_NF_EBTABLES is not set -CONFIG_BRIDGE_VLAN_FILTERING=y -# CONFIG_BROADCOM_PHY is not set -CONFIG_BROKEN_ON_SMP=y -# CONFIG_BSD_DISKLABEL is not set -# CONFIG_BSD_PROCESS_ACCT is not set -# CONFIG_BSD_PROCESS_ACCT_V3 is not set -# CONFIG_BT is not set -# CONFIG_BTRFS_ASSERT is not set -# CONFIG_BTRFS_DEBUG is not set -# CONFIG_BTRFS_FS is not set -# CONFIG_BTRFS_FS_POSIX_ACL is not set -# CONFIG_BTRFS_FS_RUN_SANITY_TESTS is not set -# CONFIG_BT_ATH3K is not set -# CONFIG_BT_BNEP is not set -CONFIG_BT_BNEP_MC_FILTER=y -CONFIG_BT_BNEP_PROTO_FILTER=y -# CONFIG_BT_BREDR is not set -# CONFIG_BT_CMTP is not set -# CONFIG_BT_HCIBCM203X is not set -# CONFIG_BT_HCIBFUSB is not set -# CONFIG_BT_HCIBLUECARD is not set -# CONFIG_BT_HCIBPA10X is not set -# CONFIG_BT_HCIBT3C is not set -# CONFIG_BT_HCIBTSDIO is not set -# CONFIG_BT_HCIBTUART is not set -# CONFIG_BT_HCIBTUSB is not set -# CONFIG_BT_HCIBTUSB_RTL is not set -# CONFIG_BT_HCIDTL1 is not set -# CONFIG_BT_HCIUART is not set -# CONFIG_BT_HCIUART_3WIRE is not set -# CONFIG_BT_HCIUART_AG6XX is not set -# CONFIG_BT_HCIUART_ATH3K is not set -CONFIG_BT_HCIUART_BCSP=y -CONFIG_BT_HCIUART_H4=y -# CONFIG_BT_HCIUART_LL is not set -# CONFIG_BT_HCIUART_MRVL is not set -# CONFIG_BT_HCIUART_QCA is not set -# CONFIG_BT_HCIVHCI is not set -# CONFIG_BT_HIDP is not set -# CONFIG_BT_HS is not set -# CONFIG_BT_LE is not set -# CONFIG_BT_LEDS is not set -# CONFIG_BT_MRVL is not set -# CONFIG_BT_RFCOMM is not set -CONFIG_BT_RFCOMM_TTY=y -# CONFIG_BT_SELFTEST is not set -CONFIG_BUG=y -CONFIG_BUILDTIME_EXTABLE_SORT=y -# CONFIG_BUILD_BIN2C is not set -# CONFIG_C2PORT is not set -CONFIG_CACHE_L2X0_PMU=y -# CONFIG_CADENCE_WATCHDOG is not set -# CONFIG_CAIF is not set -# CONFIG_CAN is not set -# CONFIG_CAN_BCM is not set -# CONFIG_CAN_DEBUG_DEVICES is not set -# CONFIG_CAN_DEV is not set -# CONFIG_CAN_GS_USB is not set -# CONFIG_CAN_GW is not set -# CONFIG_CAN_IFI_CANFD is not set -# CONFIG_CAN_M_CAN is not set -# CONFIG_CAN_RAW is not set -# CONFIG_CAN_RCAR is not set -# CONFIG_CAN_RCAR_CANFD is not set -# CONFIG_CAN_SLCAN is not set -# CONFIG_CAN_SUN4I is not set -# CONFIG_CAN_VCAN is not set -# CONFIG_CAPI_AVM is not set -# CONFIG_CAPI_EICON is not set -# CONFIG_CAPI_TRACE is not set -CONFIG_CARDBUS=y -# CONFIG_CARDMAN_4000 is not set -# CONFIG_CARDMAN_4040 is not set -# CONFIG_CARL9170 is not set -# CONFIG_CASSINI is not set -# CONFIG_CAVIUM_ERRATUM_22375 is not set -# CONFIG_CAVIUM_ERRATUM_23144 is not set -# CONFIG_CAVIUM_ERRATUM_23154 is not set -# CONFIG_CAVIUM_ERRATUM_27456 is not set -# CONFIG_CAVIUM_OCTEON_SOC is not set -# CONFIG_CB710_CORE is not set -# CONFIG_CC10001_ADC is not set -# 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_CDROM_PKTCDVD is not set -# CONFIG_CEPH_FS is not set -# CONFIG_CEPH_LIB is not set -# CONFIG_CFG80211 is not set -# CONFIG_CFG80211_CERTIFICATION_ONUS is not set -# CONFIG_CGROUPS is not set -# CONFIG_CGROUP_DEBUG is not set -# CONFIG_CGROUP_NET_CLASSID is not set -# CONFIG_CGROUP_NET_PRIO 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_GPIO is not set -# CONFIG_CHARGER_ISP1704 is not set -# CONFIG_CHARGER_LP8727 is not set -# CONFIG_CHARGER_MANAGER is not set -# CONFIG_CHARGER_MAX8903 is not set -# CONFIG_CHARGER_RT9455 is not set -# CONFIG_CHARGER_SMB347 is not set -# CONFIG_CHARGER_TWL4030 is not set -# CONFIG_CHECKPOINT_RESTORE is not set -# CONFIG_CHELSIO_T1 is not set -# CONFIG_CHELSIO_T3 is not set -# CONFIG_CHELSIO_T4 is not set -# CONFIG_CHELSIO_T4VF is not set -# CONFIG_CHROME_PLATFORMS is not set -# CONFIG_CHR_DEV_OSST is not set -# CONFIG_CHR_DEV_SCH is not set -# CONFIG_CHR_DEV_SG is not set -# CONFIG_CHR_DEV_ST is not set -# CONFIG_CICADA_PHY is not set -# CONFIG_CIFS is not set -# CONFIG_CIFS_ACL is not set -# CONFIG_CIFS_DEBUG is not set -# CONFIG_CIFS_DEBUG2 is not set -# CONFIG_CIFS_FSCACHE is not set -# CONFIG_CIFS_NFSD_EXPORT is not set -CONFIG_CIFS_POSIX=y -# CONFIG_CIFS_SMB2 is not set -CONFIG_CIFS_STATS=y -# CONFIG_CIFS_STATS2 is not set -# CONFIG_CIFS_WEAK_PW_HASH is not set -# CONFIG_CIFS_XATTR is not set -# CONFIG_CIO_DAC is not set -# CONFIG_CLEANCACHE is not set -# CONFIG_CLKSRC_VERSATILE is not set -# CONFIG_CLK_QORIQ is not set -# CONFIG_CLOCK_THERMAL is not set -CONFIG_CLS_U32_MARK=y -# CONFIG_CLS_U32_PERF is not set -# CONFIG_CM32181 is not set -# CONFIG_CM3232 is not set -# CONFIG_CM3323 is not set -# CONFIG_CM36651 is not set -# CONFIG_CMA is not set -CONFIG_CMDLINE="" -# CONFIG_CMDLINE_BOOL is not set -# CONFIG_CMDLINE_EXTEND is not set -# CONFIG_CMDLINE_FORCE is not set -# CONFIG_CMDLINE_FROM_BOOTLOADER is not set -# CONFIG_CMDLINE_PARTITION is not set -# CONFIG_CNIC is not set -# CONFIG_CODA_FS is not set -# CONFIG_CODE_PATCHING_SELFTEST is not set -# CONFIG_COMEDI 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_COMMON_CLK_IPROC is not set -# CONFIG_COMMON_CLK_NXP is not set -# CONFIG_COMMON_CLK_PIC32 is not set -# CONFIG_COMMON_CLK_PWM is not set -# CONFIG_COMMON_CLK_PXA is not set -# CONFIG_COMMON_CLK_QCOM is not set -# CONFIG_COMMON_CLK_SI514 is not set -# CONFIG_COMMON_CLK_SI5351 is not set -# CONFIG_COMMON_CLK_SI570 is not set -# CONFIG_COMMON_CLK_XLNX_CLKWZRD is not set -CONFIG_COMPACTION=y -# CONFIG_COMPAL_LAPTOP is not set -# CONFIG_COMPAT_BRK is not set -# CONFIG_COMPILE_TEST is not set -# CONFIG_CONFIGFS_FS is not set -# CONFIG_CONNECTOR is not set -CONFIG_CONSTRUCTORS=y -# CONFIG_CONTEXT_SWITCH_TRACER is not set -# CONFIG_COPS is not set -# CONFIG_CORDIC is not set -# CONFIG_COREDUMP is not set -# CONFIG_CORESIGHT is not set -# CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set -# CONFIG_CPA_DEBUG is not set -# CONFIG_CPU_DCACHE_DISABLE is not set -# CONFIG_CPU_FREQ is not set -# CONFIG_CPU_FREQ_DEFAULT_GOV_CONSERVATIVE is not set -# CONFIG_CPU_FREQ_DEFAULT_GOV_ONDEMAND is not set -# CONFIG_CPU_FREQ_DEFAULT_GOV_POWERSAVE is not set -# CONFIG_CPU_FREQ_DEFAULT_GOV_SCHEDUTIL is not set -# CONFIG_CPU_FREQ_DEFAULT_GOV_USERSPACE is not set -# CONFIG_CPU_FREQ_GOV_SCHEDUTIL is not set -# CONFIG_CPU_FREQ_STAT_DETAILS is not set -# CONFIG_CPU_IDLE is not set -# CONFIG_CPU_IDLE_GOV_MENU is not set -# CONFIG_CPU_IDLE_MULTIPLE_DRIVERS is not set -# CONFIG_CPU_NO_EFFICIENT_FFS is not set -CONFIG_CPU_SW_DOMAIN_PAN=y -# CONFIG_CRAMFS is not set -CONFIG_CRASHLOG=y -# CONFIG_CRASH_DUMP is not set -# CONFIG_CRC16 is not set -CONFIG_CRC32=y -# CONFIG_CRC32_BIT is not set -CONFIG_CRC32_SARWATE=y -# CONFIG_CRC32_SELFTEST is not set -# CONFIG_CRC32_SLICEBY4 is not set -# CONFIG_CRC32_SLICEBY8 is not set -# CONFIG_CRC7 is not set -# CONFIG_CRC8 is not set -# CONFIG_CRC_CCITT is not set -# CONFIG_CRC_ITU_T is not set -# CONFIG_CRC_T10DIF is not set -CONFIG_CROSS_COMPILE="" -# CONFIG_CROSS_MEMORY_ATTACH is not set -CONFIG_CRYPTO=y -# CONFIG_CRYPTO_842 is not set -# CONFIG_CRYPTO_AEAD is not set -CONFIG_CRYPTO_AES=y -# CONFIG_CRYPTO_AES_586 is not set -# CONFIG_CRYPTO_AES_ARM is not set -# CONFIG_CRYPTO_AES_ARM_BS is not set -# CONFIG_CRYPTO_AES_NI_INTEL is not set -CONFIG_CRYPTO_ALGAPI=y -CONFIG_CRYPTO_ALGAPI2=y -# CONFIG_CRYPTO_ANSI_CPRNG is not set -# CONFIG_CRYPTO_ANUBIS is not set -CONFIG_CRYPTO_ARC4=y -# CONFIG_CRYPTO_AUTHENC is not set -CONFIG_CRYPTO_BLKCIPHER=y -CONFIG_CRYPTO_BLKCIPHER2=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_CBC is not set -# CONFIG_CRYPTO_CCM is not set -# CONFIG_CRYPTO_CHACHA20 is not set -# CONFIG_CRYPTO_CHACHA20POLY1305 is not set -# CONFIG_CRYPTO_CMAC is not set -# CONFIG_CRYPTO_CRC32 is not set -# CONFIG_CRYPTO_CRC32C is not set -# CONFIG_CRYPTO_CRC32C_INTEL is not set -# CONFIG_CRYPTO_CRCT10DIF is not set -# CONFIG_CRYPTO_CRYPTD is not set -# CONFIG_CRYPTO_CTR is not set -# CONFIG_CRYPTO_CTS is not set -# CONFIG_CRYPTO_DEFLATE is not set -# CONFIG_CRYPTO_DES is not set -# CONFIG_CRYPTO_DEV_ATMEL_AES is not set -# CONFIG_CRYPTO_DEV_ATMEL_SHA is not set -# CONFIG_CRYPTO_DEV_ATMEL_TDES is not set -# CONFIG_CRYPTO_DEV_CCP is not set -# CONFIG_CRYPTO_DEV_FSL_CAAM is not set -# CONFIG_CRYPTO_DEV_HIFN_795X is not set -# CONFIG_CRYPTO_DEV_IMGTEC_HASH is not set -# CONFIG_CRYPTO_DEV_MARVELL_CESA is not set -# CONFIG_CRYPTO_DEV_MV_CESA is not set -# CONFIG_CRYPTO_DEV_MXC_SCC is not set -# CONFIG_CRYPTO_DEV_MXS_DCP is not set -# CONFIG_CRYPTO_DEV_QAT_C3XXX is not set -# CONFIG_CRYPTO_DEV_QAT_C3XXXVF is not set -# CONFIG_CRYPTO_DEV_QAT_C62X is not set -# CONFIG_CRYPTO_DEV_QAT_C62XVF is not set -# CONFIG_CRYPTO_DEV_QAT_DH895xCC is not set -# CONFIG_CRYPTO_DEV_QAT_DH895xCCVF is not set -# CONFIG_CRYPTO_DEV_QCE is not set -# CONFIG_CRYPTO_DEV_SAHARA is not set -# CONFIG_CRYPTO_DEV_TALITOS is not set -# CONFIG_CRYPTO_DH is not set -# CONFIG_CRYPTO_DRBG_CTR is not set -# CONFIG_CRYPTO_DRBG_HASH is not set -# CONFIG_CRYPTO_DRBG_MENU is not set -# CONFIG_CRYPTO_ECB is not set -# CONFIG_CRYPTO_ECDH is not set -# CONFIG_CRYPTO_ECHAINIV is not set -# CONFIG_CRYPTO_FCRYPT is not set -# CONFIG_CRYPTO_FIPS is not set -# CONFIG_CRYPTO_GCM is not set -# CONFIG_CRYPTO_GF128MUL is not set -# CONFIG_CRYPTO_GHASH is not set -# CONFIG_CRYPTO_GHASH_CLMUL_NI_INTEL is not set -# CONFIG_CRYPTO_HASH is not set -# CONFIG_CRYPTO_HMAC is not set -# CONFIG_CRYPTO_HW is not set -# CONFIG_CRYPTO_JITTERENTROPY is not set -# CONFIG_CRYPTO_KEYWRAP is not set -# CONFIG_CRYPTO_KHAZAD is not set -# CONFIG_CRYPTO_LRW is not set -# CONFIG_CRYPTO_LZ4 is not set -# CONFIG_CRYPTO_LZ4HC is not set -# CONFIG_CRYPTO_LZO is not set -# CONFIG_CRYPTO_MANAGER is not set -# CONFIG_CRYPTO_MANAGER2 is not set -CONFIG_CRYPTO_MANAGER_DISABLE_TESTS=y -# CONFIG_CRYPTO_MCRYPTD is not set -# CONFIG_CRYPTO_MD4 is not set -# CONFIG_CRYPTO_MD5 is not set -# CONFIG_CRYPTO_MICHAEL_MIC is not set -# CONFIG_CRYPTO_NULL is not set -# CONFIG_CRYPTO_PCBC is not set -# CONFIG_CRYPTO_PCOMP is not set -# CONFIG_CRYPTO_PCOMP2 is not set -CONFIG_CRYPTO_PCRYPT=y -# CONFIG_CRYPTO_POLY1305 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_RNG is not set -# CONFIG_CRYPTO_RSA is not set -# CONFIG_CRYPTO_SALSA20 is not set -# CONFIG_CRYPTO_SALSA20_586 is not set -# CONFIG_CRYPTO_SEED is not set -# CONFIG_CRYPTO_SEQIV is not set -# CONFIG_CRYPTO_SERPENT is not set -# CONFIG_CRYPTO_SHA1 is not set -# CONFIG_CRYPTO_SHA1_ARM is not set -# CONFIG_CRYPTO_SHA256 is not set -# CONFIG_CRYPTO_SHA3 is not set -# CONFIG_CRYPTO_SHA512 is not set -# CONFIG_CRYPTO_TEA is not set -# CONFIG_CRYPTO_TEST is not set -# CONFIG_CRYPTO_TGR192 is not set -# CONFIG_CRYPTO_TWOFISH is not set -# CONFIG_CRYPTO_TWOFISH_586 is not set -# CONFIG_CRYPTO_TWOFISH_COMMON is not set -# CONFIG_CRYPTO_USER is not set -# CONFIG_CRYPTO_USER_API_AEAD is not set -# CONFIG_CRYPTO_USER_API_HASH is not set -# CONFIG_CRYPTO_USER_API_RNG is not set -# CONFIG_CRYPTO_USER_API_SKCIPHER is not set -# CONFIG_CRYPTO_VMAC is not set -# CONFIG_CRYPTO_WP512 is not set -# CONFIG_CRYPTO_XCBC is not set -# CONFIG_CRYPTO_XTS is not set -# CONFIG_CRYPTO_ZLIB is not set -# CONFIG_CS5535_MFGPT is not set -# CONFIG_CS89x0 is not set -# CONFIG_CUSE is not set -# CONFIG_CW1200 is not set -# CONFIG_CXL_AFU_DRIVER_OPS is not set -# CONFIG_CXL_BASE is not set -# CONFIG_CXL_EEH is not set -# CONFIG_CXL_KERNEL_API is not set -# CONFIG_CYPRESS_FIRMWARE is not set -# CONFIG_DAVICOM_PHY is not set -# CONFIG_DCB is not set -# CONFIG_DDR is not set -# CONFIG_DEBUG_ATOMIC_SLEEP is not set -# CONFIG_DEBUG_BLOCK_EXT_DEVT is not set -# CONFIG_DEBUG_BUGVERBOSE is not set -# CONFIG_DEBUG_CREDENTIALS is not set -# CONFIG_DEBUG_DEVRES is not set -# CONFIG_DEBUG_DRIVER is not set -# CONFIG_DEBUG_FORCE_WEAK_PER_CPU is not set -CONFIG_DEBUG_FS=y -# CONFIG_DEBUG_GPIO is not set -# CONFIG_DEBUG_HIGHMEM is not set -# CONFIG_DEBUG_ICEDCC is not set -# CONFIG_DEBUG_INFO is not set -# CONFIG_DEBUG_INFO_DWARF4 is not set -CONFIG_DEBUG_INFO_REDUCED=y -# CONFIG_DEBUG_INFO_SPLIT is not set -CONFIG_DEBUG_KERNEL=y -# CONFIG_DEBUG_KMEMLEAK is not set -# CONFIG_DEBUG_KOBJECT is not set -# CONFIG_DEBUG_KOBJECT_RELEASE is not set -# CONFIG_DEBUG_LIST is not set -# CONFIG_DEBUG_LL is not set -# CONFIG_DEBUG_LL_UART_8250 is not set -# CONFIG_DEBUG_LL_UART_PL01X is not set -# CONFIG_DEBUG_LOCKDEP is not set -# CONFIG_DEBUG_LOCKING_API_SELFTESTS is not set -# CONFIG_DEBUG_LOCK_ALLOC is not set -# CONFIG_DEBUG_MEMORY_INIT is not set -# CONFIG_DEBUG_MUTEXES is not set -# CONFIG_DEBUG_NOTIFIERS is not set -# CONFIG_DEBUG_NX_TEST is not set -# CONFIG_DEBUG_OBJECTS is not set -# CONFIG_DEBUG_PAGEALLOC is not set -# CONFIG_DEBUG_PAGE_REF is not set -# CONFIG_DEBUG_PERF_USE_VMALLOC is not set -# CONFIG_DEBUG_PER_CPU_MAPS is not set -# CONFIG_DEBUG_PINCTRL is not set -# CONFIG_DEBUG_PI_LIST is not set -# CONFIG_DEBUG_PREEMPT is not set -# CONFIG_DEBUG_RODATA is not set -# CONFIG_DEBUG_RODATA_TEST is not set -# CONFIG_DEBUG_RT_MUTEXES is not set -# CONFIG_DEBUG_SECTION_MISMATCH is not set -# CONFIG_DEBUG_SEMIHOSTING is not set -# CONFIG_DEBUG_SET_MODULE_RONX is not set -# CONFIG_DEBUG_SG is not set -# CONFIG_DEBUG_SHIRQ is not set -# CONFIG_DEBUG_SLAB is not set -# CONFIG_DEBUG_SPINLOCK is not set -# CONFIG_DEBUG_STACKOVERFLOW is not set -# CONFIG_DEBUG_STACK_USAGE is not set -# CONFIG_DEBUG_STRICT_USER_COPY_CHECKS is not set -# CONFIG_DEBUG_TEST_DRIVER_REMOVE is not set -# CONFIG_DEBUG_TIMEKEEPING is not set -# CONFIG_DEBUG_UART_8250_PALMCHIP is not set -# CONFIG_DEBUG_UART_BCM63XX is not set -# CONFIG_DEBUG_VM is not set -# CONFIG_DEBUG_WQ_FORCE_RR_CPU is not set -# CONFIG_DEBUG_WW_MUTEX_SLOWPATH is not set -# CONFIG_DEBUG_WX is not set -# CONFIG_DEBUG_ZBOOT is not set -# CONFIG_DECNET is not set -CONFIG_DEFAULT_CUBIC=y -CONFIG_DEFAULT_DEADLINE=y -CONFIG_DEFAULT_HOSTNAME="(none)" -CONFIG_DEFAULT_IOSCHED="deadline" -CONFIG_DEFAULT_MMAP_MIN_ADDR=4096 -# CONFIG_DEFAULT_NOOP is not set -# CONFIG_DEFAULT_RENO is not set -CONFIG_DEFAULT_SECURITY="" -CONFIG_DEFAULT_SECURITY_DAC=y -CONFIG_DEFAULT_TCP_CONG="cubic" -CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config" -# CONFIG_DELL_RBTN is not set -# CONFIG_DELL_SMO8800 is not set -# CONFIG_DEPRECATED_PARAM_STRUCT is not set -# CONFIG_DETECT_HUNG_TASK is not set -# CONFIG_DEVKMEM is not set -# CONFIG_DEVMEM is not set -CONFIG_DEVPORT=y -# CONFIG_DEVPTS_MULTIPLE_INSTANCES is not set -# CONFIG_DEVTMPFS is not set -# CONFIG_DEVTMPFS_MOUNT is not set -# CONFIG_DGAP is not set -# CONFIG_DGNC is not set -# CONFIG_DHT11 is not set -# CONFIG_DISCONTIGMEM_MANUAL is not set -# CONFIG_DISPLAY_CONNECTOR_ANALOG_TV is not set -# CONFIG_DISPLAY_CONNECTOR_DVI is not set -# CONFIG_DISPLAY_CONNECTOR_HDMI is not set -# CONFIG_DISPLAY_ENCODER_TFP410 is not set -# CONFIG_DISPLAY_ENCODER_TPD12S015 is not set -# CONFIG_DISPLAY_PANEL_DPI is not set -# CONFIG_DISPLAY_PANEL_LGPHILIPS_LB035Q02 is not set -# CONFIG_DISPLAY_PANEL_TPO_TD028TTEC1 is not set -# CONFIG_DISPLAY_PANEL_TPO_TD043MTEA1 is not set -# CONFIG_DL2K is not set -# CONFIG_DLM is not set -# CONFIG_DM9000 is not set -# CONFIG_DMADEVICES is not set -# CONFIG_DMADEVICES_DEBUG is not set -# CONFIG_DMARD06 is not set -# CONFIG_DMARD09 is not set -# CONFIG_DMASCC is not set -# CONFIG_DMATEST is not set -# CONFIG_DMA_API_DEBUG is not set -# CONFIG_DMA_ENGINE is not set -# CONFIG_DMA_SHARED_BUFFER is not set -# CONFIG_DM_CACHE is not set -# CONFIG_DM_DEBUG is not set -# CONFIG_DM_DELAY is not set -# CONFIG_DM_ERA is not set -# CONFIG_DM_FLAKEY is not set -# CONFIG_DM_LOG_USERSPACE is not set -# CONFIG_DM_LOG_WRITES is not set -# CONFIG_DM_MQ_DEFAULT is not set -# CONFIG_DM_MULTIPATH is not set -# CONFIG_DM_RAID is not set -# CONFIG_DM_SWITCH is not set -# CONFIG_DM_THIN_PROVISIONING is not set -# CONFIG_DM_UEVENT is not set -# CONFIG_DM_VERITY is not set -# CONFIG_DM_ZERO is not set -# CONFIG_DNET is not set -# CONFIG_DNOTIFY is not set -# CONFIG_DNS_RESOLVER is not set -CONFIG_DOUBLEFAULT=y -# CONFIG_DP83848_PHY is not set -# CONFIG_DP83867_PHY is not set -CONFIG_DQL=y -# CONFIG_DRAGONRISE_FF is not set -# CONFIG_DRM is not set -# CONFIG_DRM_AMDGPU is not set -# CONFIG_DRM_ANALOGIX_ANX78XX is not set -# CONFIG_DRM_ARCPGU is not set -# CONFIG_DRM_ARMADA is not set -# CONFIG_DRM_AST is not set -# CONFIG_DRM_BOCHS is not set -# CONFIG_DRM_CIRRUS_QEMU is not set -# CONFIG_DRM_DP_AUX_CHARDEV is not set -# CONFIG_DRM_DUMB_VGA_DAC is not set -# CONFIG_DRM_ETNAVIV is not set -# CONFIG_DRM_EXYNOS is not set -# CONFIG_DRM_FBDEV_EMULATION is not set -# CONFIG_DRM_FSL_DCU is not set -# CONFIG_DRM_HDLCD is not set -# CONFIG_DRM_HISI_KIRIN is not set -# CONFIG_DRM_I2C_ADV7511 is not set -# CONFIG_DRM_I2C_CH7006 is not set -# CONFIG_DRM_I2C_NXP_TDA998X is not set -# CONFIG_DRM_I2C_SIL164 is not set -# CONFIG_DRM_LEGACY is not set -# CONFIG_DRM_LOAD_EDID_FIRMWARE is not set -# CONFIG_DRM_MALI_DISPLAY is not set -# CONFIG_DRM_MGAG200 is not set -# CONFIG_DRM_NOUVEAU is not set -# CONFIG_DRM_NXP_PTN3460 is not set -# CONFIG_DRM_OMAP is not set -# CONFIG_DRM_PANEL_JDI_LT070ME05000 is not set -# CONFIG_DRM_PANEL_LG_LG4573 is not set -# CONFIG_DRM_PANEL_PANASONIC_VVX10F034N00 is not set -# CONFIG_DRM_PANEL_RASPBERRYPI_TOUCHSCREEN is not set -# CONFIG_DRM_PANEL_SAMSUNG_LD9040 is not set -# CONFIG_DRM_PANEL_SAMSUNG_S6E8AA0 is not set -# CONFIG_DRM_PANEL_SHARP_LQ101R1SX01 is not set -# CONFIG_DRM_PANEL_SHARP_LS043T1LE01 is not set -# CONFIG_DRM_PARADE_PS8622 is not set -# CONFIG_DRM_QXL is not set -# CONFIG_DRM_RADEON is not set -# CONFIG_DRM_SII902X is not set -# CONFIG_DRM_STI is not set -# CONFIG_DRM_SUN4I is not set -# CONFIG_DRM_TILCDC is not set -# CONFIG_DRM_TOSHIBA_TC358767 is not set -# CONFIG_DRM_UDL is not set -# CONFIG_DRM_VGEM is not set -# CONFIG_DS1682 is not set -# CONFIG_DS1803 is not set -# CONFIG_DST_CACHE is not set -# CONFIG_DTLK is not set -# CONFIG_DUMMY is not set -CONFIG_DUMMY_CONSOLE_COLUMNS=80 -CONFIG_DUMMY_CONSOLE_ROWS=25 -# CONFIG_DUMMY_IRQ is not set -# CONFIG_DVB_AU8522_V4L is not set -# CONFIG_DVB_CORE is not set -# CONFIG_DVB_DUMMY_FE is not set -# CONFIG_DVB_TUNER_DIB0070 is not set -# CONFIG_DVB_TUNER_DIB0090 is not set -# CONFIG_DWMAC_IPQ806X is not set -# CONFIG_DWMAC_LPC18XX is not set -# CONFIG_DWMAC_MESON is not set -# CONFIG_DWMAC_ROCKCHIP is not set -# CONFIG_DWMAC_SOCFPGA is not set -# CONFIG_DWMAC_STI is not set -# CONFIG_DW_DMAC is not set -# CONFIG_DW_DMAC_PCI is not set -# CONFIG_DW_WATCHDOG is not set -# CONFIG_DYNAMIC_DEBUG is not set -# CONFIG_E100 is not set -# CONFIG_E1000 is not set -# CONFIG_E1000E is not set -# CONFIG_E1000E_HWTS is not set -# CONFIG_EARLY_PRINTK_8250 is not set -# CONFIG_ECHO is not set -# CONFIG_ECRYPT_FS is not set -# CONFIG_EDAC is not set -# CONFIG_EEEPC_LAPTOP is not set -# CONFIG_EEPROM_93CX6 is not set -# CONFIG_EEPROM_93XX46 is not set -# CONFIG_EEPROM_AT24 is not set -# CONFIG_EEPROM_AT25 is not set -# CONFIG_EEPROM_DIGSY_MTC_CFG is not set -# CONFIG_EEPROM_LEGACY is not set -# CONFIG_EEPROM_MAX6875 is not set -# CONFIG_EFI is not set -CONFIG_EFI_PARTITION=y -# CONFIG_EFS_FS is not set -CONFIG_ELFCORE=y -# CONFIG_ELF_CORE is not set -# CONFIG_EMAC_ROCKCHIP is not set -CONFIG_EMBEDDED=y -# CONFIG_EM_TIMER_STI is not set -# CONFIG_ENABLE_MUST_CHECK is not set -CONFIG_ENABLE_WARN_DEPRECATED=y -# CONFIG_ENA_ETHERNET is not set -# CONFIG_ENC28J60 is not set -# CONFIG_ENCLOSURE_SERVICES is not set -# CONFIG_ENCRYPTED_KEYS is not set -# CONFIG_ENCX24J600 is not set -# CONFIG_ENIC is not set -# CONFIG_EPAPR_PARAVIRT is not set -# CONFIG_EPIC100 is not set -CONFIG_EPOLL=y -# CONFIG_EQUALIZER is not set -# CONFIG_ET131X is not set -CONFIG_ETHERNET=y -# CONFIG_ETHOC is not set -CONFIG_EVENTFD=y -CONFIG_EXPERT=y -# CONFIG_EXPORTFS is not set -# CONFIG_EXPORTFS_BLOCK_OPS is not set -# CONFIG_EXT2_FS is not set -# CONFIG_EXT2_FS_XATTR is not set -# CONFIG_EXT3_FS is not set -# CONFIG_EXT4_DEBUG is not set -# CONFIG_EXT4_ENCRYPTION is not set -# CONFIG_EXT4_FS is not set -# CONFIG_EXT4_FS_POSIX_ACL is not set -# CONFIG_EXT4_FS_SECURITY is not set -CONFIG_EXT4_USE_FOR_EXT2=y -# CONFIG_EXTCON is not set -# CONFIG_EXTCON_ADC_JACK is not set -# CONFIG_EXTCON_AXP288 is not set -# CONFIG_EXTCON_GPIO is not set -# CONFIG_EXTCON_MAX3355 is not set -# CONFIG_EXTCON_QCOM_SPMI_MISC is not set -# CONFIG_EXTCON_RT8973A is not set -# CONFIG_EXTCON_SM5502 is not set -# CONFIG_EXTCON_USB_GPIO is not set -CONFIG_EXTRA_FIRMWARE="" -CONFIG_EXTRA_TARGETS="" -# CONFIG_EXYNOS_ADC is not set -# CONFIG_EXYNOS_VIDEO is not set -# CONFIG_EZCHIP_NPS_MANAGEMENT_ENET is not set -# CONFIG_EZX_PCAP is not set -# CONFIG_F2FS_FAULT_INJECTION is not set -# CONFIG_F2FS_FS is not set -# CONFIG_F2FS_FS_ENCRYPTION is not set -# CONFIG_F2FS_FS_POSIX_ACL is not set -# CONFIG_F2FS_IO_TRACE is not set -# CONFIG_FAIR_GROUP_SCHED is not set -# CONFIG_FANOTIFY is not set -CONFIG_FAT_DEFAULT_CODEPAGE=437 -CONFIG_FAT_DEFAULT_IOCHARSET="iso8859-1" -# CONFIG_FAT_DEFAULT_UTF8 is not set -# CONFIG_FAT_FS is not set -# CONFIG_FAULT_INJECTION is not set -# CONFIG_FB is not set -# CONFIG_FB_3DFX is not set -# CONFIG_FB_ARC is not set -# CONFIG_FB_ARK is not set -# CONFIG_FB_ARMCLCD is not set -# CONFIG_FB_ASILIANT is not set -# CONFIG_FB_ATY is not set -# CONFIG_FB_ATY128 is not set -# CONFIG_FB_AUO_K190X is not set -# CONFIG_FB_BACKLIGHT is not set -# CONFIG_FB_BIG_ENDIAN is not set -# CONFIG_FB_BOOT_VESA_SUPPORT is not set -# CONFIG_FB_BOTH_ENDIAN is not set -# CONFIG_FB_BROADSHEET is not set -# CONFIG_FB_CARMINE is not set -# CONFIG_FB_CFB_COPYAREA is not set -# CONFIG_FB_CFB_FILLRECT is not set -# CONFIG_FB_CFB_IMAGEBLIT is not set -# CONFIG_FB_CFB_REV_PIXELS_IN_BYTE is not set -# CONFIG_FB_CIRRUS is not set -# CONFIG_FB_CYBER2000 is not set -# CONFIG_FB_DA8XX is not set -# CONFIG_FB_DDC is not set -# CONFIG_FB_FOREIGN_ENDIAN is not set -# CONFIG_FB_GEODE is not set -# CONFIG_FB_GOLDFISH is not set -# CONFIG_FB_HGA is not set -# CONFIG_FB_I740 is not set -# CONFIG_FB_IBM_GXT4500 is not set -# CONFIG_FB_IMSTT is not set -# CONFIG_FB_IMX is not set -# CONFIG_FB_KYRO is not set -# CONFIG_FB_LE80578 is not set -# CONFIG_FB_LITTLE_ENDIAN is not set -# CONFIG_FB_MACMODES is not set -# CONFIG_FB_MATROX is not set -# CONFIG_FB_MB862XX is not set -# CONFIG_FB_METRONOME is not set -# CONFIG_FB_MODE_HELPERS is not set -# CONFIG_FB_MXS is not set -# CONFIG_FB_N411 is not set -# CONFIG_FB_NEOMAGIC is not set -CONFIG_FB_NOTIFY=y -# CONFIG_FB_NVIDIA is not set -# CONFIG_FB_OF is not set -# CONFIG_FB_OMAP2 is not set -# CONFIG_FB_OPENCORES is not set -# CONFIG_FB_PM2 is not set -# CONFIG_FB_PM3 is not set -# CONFIG_FB_PS3 is not set -# CONFIG_FB_PXA is not set -# CONFIG_FB_RADEON is not set -# CONFIG_FB_RIVA is not set -# CONFIG_FB_S1D13XXX is not set -# CONFIG_FB_S3 is not set -# CONFIG_FB_SAVAGE is not set -# CONFIG_FB_SIMPLE is not set -# CONFIG_FB_SIS is not set -# CONFIG_FB_SM712 is not set -# CONFIG_FB_SM750 is not set -# CONFIG_FB_SMSCUFX is not set -# CONFIG_FB_SSD1307 is not set -# CONFIG_FB_SVGALIB is not set -# CONFIG_FB_SYS_COPYAREA is not set -# CONFIG_FB_SYS_FILLRECT is not set -# CONFIG_FB_SYS_FOPS is not set -# CONFIG_FB_SYS_IMAGEBLIT is not set -# CONFIG_FB_TFT is not set -# CONFIG_FB_TILEBLITTING is not set -# CONFIG_FB_TMIO is not set -# CONFIG_FB_TRIDENT is not set -# CONFIG_FB_UDL is not set -# CONFIG_FB_UVESA is not set -# CONFIG_FB_VGA16 is not set -# CONFIG_FB_VIA is not set -# CONFIG_FB_VIRTUAL is not set -# CONFIG_FB_VOODOO1 is not set -# CONFIG_FB_VT8623 is not set -# CONFIG_FB_XGI is not set -# CONFIG_FCOE is not set -# CONFIG_FCOE_FNIC is not set -# CONFIG_FDDI is not set -# CONFIG_FEALNX is not set -# CONFIG_FENCE_TRACE is not set -# CONFIG_FHANDLE is not set -CONFIG_FIB_RULES=y -CONFIG_FILE_LOCKING=y -# CONFIG_FIREWIRE is not set -# CONFIG_FIREWIRE_NOSY is not set -# CONFIG_FIREWIRE_SERIAL is not set -# CONFIG_FIRMWARE_EDID is not set -# CONFIG_FIRMWARE_IN_KERNEL is not set -# CONFIG_FIRMWARE_MEMMAP is not set -# CONFIG_FIXED_PHY is not set -CONFIG_FLATMEM=y -CONFIG_FLATMEM_MANUAL=y -CONFIG_FLAT_NODE_MEM_MAP=y -# CONFIG_FM10K is not set -# CONFIG_FMC is not set -# CONFIG_FORCEDETH is not set -CONFIG_FORCE_MAX_ZONEORDER=11 -# CONFIG_FPGA is not set -# CONFIG_FRAMEBUFFER_CONSOLE is not set -# CONFIG_FRAME_POINTER is not set -CONFIG_FRAME_WARN=1024 -# CONFIG_FREEZER is not set -# CONFIG_FRONTSWAP is not set -# CONFIG_FSCACHE is not set -# CONFIG_FSL_EDMA is not set -# CONFIG_FSL_MC_BUS is not set -# CONFIG_FSL_PQ_MDIO is not set -# CONFIG_FSL_XGMAC_MDIO is not set -CONFIG_FSNOTIFY=y -# CONFIG_FS_DAX is not set -# CONFIG_FS_ENCRYPTION is not set -# CONFIG_FS_POSIX_ACL is not set -# CONFIG_FTGMAC100 is not set -# CONFIG_FTL is not set -# CONFIG_FTMAC100 is not set -# CONFIG_FTRACE is not set -# CONFIG_FTRACE_STARTUP_TEST is not set -# CONFIG_FTR_FIXUP_SELFTEST is not set -# CONFIG_FUJITSU_ES is not set -# CONFIG_FUJITSU_LAPTOP is not set -# CONFIG_FUJITSU_TABLET is not set -# CONFIG_FUNCTION_TRACER is not set -# CONFIG_FUSE_FS is not set -# CONFIG_FUSION is not set -# CONFIG_FUSION_FC is not set -# CONFIG_FUSION_SAS is not set -# CONFIG_FUSION_SPI is not set -CONFIG_FUTEX=y -# CONFIG_FW_CFG_SYSFS is not set -CONFIG_FW_LOADER=y -CONFIG_FW_LOADER_USER_HELPER=y -CONFIG_FW_LOADER_USER_HELPER_FALLBACK=y -CONFIG_GACT_PROB=y -# CONFIG_GADGET_UAC1 is not set -# CONFIG_GAMEPORT is not set -# CONFIG_GATEWORKS_GW16083 is not set -# CONFIG_GCC_PLUGINS is not set -# CONFIG_GCOV is not set -# CONFIG_GCOV_KERNEL is not set -# CONFIG_GDB_SCRIPTS is not set -# CONFIG_GENERIC_ADC_BATTERY is not set -# CONFIG_GENERIC_ADC_THERMAL is not set -CONFIG_GENERIC_CALIBRATE_DELAY=y -# CONFIG_GENERIC_CPU_DEVICES is not set -CONFIG_GENERIC_HWEIGHT=y -CONFIG_GENERIC_IRQ_PROBE=y -CONFIG_GENERIC_NET_UTILS=y -# CONFIG_GENERIC_PHY is not set -# CONFIG_GENEVE is not set -# CONFIG_GENWQE is not set -# CONFIG_GFS2_FS is not set -# CONFIG_GIGASET_CAPI is not set -# CONFIG_GIGASET_DEBUG is not set -# CONFIG_GIGASET_DUMMYLL is not set -# CONFIG_GLOB_SELFTEST is not set -# CONFIG_GOLDFISH is not set -# CONFIG_GP2AP020A00F is not set -# CONFIG_GPIOLIB is not set -# CONFIG_GPIO_74X164 is not set -# CONFIG_GPIO_74XX_MMIO is not set -# CONFIG_GPIO_ADNP is not set -# CONFIG_GPIO_ADP5588 is not set -# CONFIG_GPIO_ALTERA is not set -# CONFIG_GPIO_AMD8111 is not set -# CONFIG_GPIO_AMDPT is not set -# CONFIG_GPIO_BCM_KONA is not set -# CONFIG_GPIO_BT8XX is not set -# CONFIG_GPIO_CS5535 is not set -# CONFIG_GPIO_DWAPB is not set -# CONFIG_GPIO_EM is not set -# CONFIG_GPIO_F7188X is not set -# CONFIG_GPIO_GENERIC_PLATFORM is not set -# CONFIG_GPIO_GPIO_MM is not set -# CONFIG_GPIO_GRGPIO is not set -# CONFIG_GPIO_ICH is not set -# CONFIG_GPIO_IT87 is not set -# CONFIG_GPIO_LYNXPOINT is not set -# CONFIG_GPIO_MAX7300 is not set -# CONFIG_GPIO_MAX7301 is not set -# CONFIG_GPIO_MAX732X is not set -# CONFIG_GPIO_MC33880 is not set -# CONFIG_GPIO_MCP23S08 is not set -# CONFIG_GPIO_ML_IOH is not set -# CONFIG_GPIO_MOCKUP is not set -# CONFIG_GPIO_MPC8XXX is not set -# CONFIG_GPIO_PCA953X is not set -# CONFIG_GPIO_PCF857X is not set -# CONFIG_GPIO_PCH is not set -# CONFIG_GPIO_PISOSR is not set -# CONFIG_GPIO_PL061 is not set -# CONFIG_GPIO_RCAR is not set -# CONFIG_GPIO_RDC321X is not set -# CONFIG_GPIO_SCH is not set -# CONFIG_GPIO_SCH311X is not set -# CONFIG_GPIO_SX150X is not set -# CONFIG_GPIO_SYSCON is not set -# CONFIG_GPIO_SYSFS is not set -# CONFIG_GPIO_TPIC2810 is not set -# CONFIG_GPIO_TS4900 is not set -# CONFIG_GPIO_TS5500 is not set -# CONFIG_GPIO_VX855 is not set -# CONFIG_GPIO_WATCHDOG is not set -# CONFIG_GPIO_WS16C48 is not set -# CONFIG_GPIO_XGENE is not set -# CONFIG_GPIO_XILINX is not set -# CONFIG_GPIO_ZEVIO is not set -# CONFIG_GPIO_ZX is not set -# CONFIG_GREENASIA_FF is not set -# CONFIG_GREYBUS is not set -# CONFIG_GS_FPGABOOT is not set -# CONFIG_GTP is not set -# CONFIG_HAMACHI is not set -# CONFIG_HAMRADIO is not set -# CONFIG_HAPPYMEAL is not set -# CONFIG_HARDENED_USERCOPY is not set -# CONFIG_HARDLOCKUP_DETECTOR is not set -# CONFIG_HAVE_AOUT is not set -CONFIG_HAVE_ARCH_HARDENED_USERCOPY=y -# CONFIG_HAVE_ARCH_HASH is not set -CONFIG_HAVE_ARCH_MMAP_RND_BITS=y -# CONFIG_HAVE_ARCH_VMAP_STACK is not set -CONFIG_HAVE_ARCH_WITHIN_STACK_FRAMES=y -# CONFIG_HAVE_ARM_ARCH_TIMER is not set -CONFIG_HAVE_EXIT_THREAD=y -CONFIG_HAVE_GCC_PLUGINS=y -CONFIG_HAVE_HARDENED_USERCOPY_ALLOCATOR=y -CONFIG_HAVE_KERNEL_BZIP2=y -CONFIG_HAVE_KERNEL_CAT=y -CONFIG_HAVE_KERNEL_GZIP=y -CONFIG_HAVE_KERNEL_LZ4=y -CONFIG_HAVE_KERNEL_LZMA=y -CONFIG_HAVE_KERNEL_LZO=y -CONFIG_HAVE_KERNEL_XZ=y -CONFIG_HAVE_KPROBES=y -CONFIG_HAVE_KRETPROBES=y -CONFIG_HAVE_NMI=y -# CONFIG_HCALL_STATS is not set -# CONFIG_HDC100X is not set -# CONFIG_HDLC is not set -# CONFIG_HDLC_CISCO is not set -# CONFIG_HDLC_FR is not set -# CONFIG_HDLC_PPP is not set -# CONFIG_HDLC_RAW is not set -# CONFIG_HDLC_RAW_ETH is not set -# CONFIG_HDQ_MASTER_OMAP is not set -# CONFIG_HEADERS_CHECK is not set -# CONFIG_HERMES is not set -# CONFIG_HFSPLUS_FS is not set -# CONFIG_HFSPLUS_FS_POSIX_ACL is not set -# CONFIG_HFS_FS is not set -# CONFIG_HFS_FS_POSIX_ACL is not set -# CONFIG_HI8435 is not set -# CONFIG_HIBERNATION is not set -# CONFIG_HID is not set -# CONFIG_HIDRAW is not set -# CONFIG_HID_A4TECH is not set -# CONFIG_HID_ACRUX is not set -# CONFIG_HID_ACRUX_FF is not set -# CONFIG_HID_ALPS is not set -# CONFIG_HID_APPLE is not set -# CONFIG_HID_APPLEIR is not set -# CONFIG_HID_AUREAL is not set -# CONFIG_HID_BATTERY_STRENGTH is not set -# CONFIG_HID_BELKIN is not set -# CONFIG_HID_BETOP_FF is not set -# CONFIG_HID_CHERRY is not set -# CONFIG_HID_CHICONY is not set -# CONFIG_HID_CMEDIA is not set -# CONFIG_HID_CORSAIR is not set -# CONFIG_HID_CP2112 is not set -# CONFIG_HID_CYPRESS is not set -# CONFIG_HID_DRAGONRISE is not set -# CONFIG_HID_ELECOM is not set -# CONFIG_HID_ELO is not set -# CONFIG_HID_EMS_FF is not set -# CONFIG_HID_EZKEY is not set -# CONFIG_HID_GEMBIRD is not set -# CONFIG_HID_GENERIC is not set -# CONFIG_HID_GFRM is not set -# CONFIG_HID_GREENASIA is not set -# CONFIG_HID_GT683R is not set -# CONFIG_HID_GYRATION is not set -# CONFIG_HID_HOLTEK is not set -# CONFIG_HID_ICADE is not set -# CONFIG_HID_KENSINGTON is not set -# CONFIG_HID_KEYTOUCH is not set -# CONFIG_HID_KYE is not set -# CONFIG_HID_LCPOWER is not set -# CONFIG_HID_LED is not set -# CONFIG_HID_LENOVO is not set -# CONFIG_HID_LOGITECH is not set -# CONFIG_HID_LOGITECH_DJ is not set -# CONFIG_HID_LOGITECH_HIDPP is not set -# CONFIG_HID_MAGICMOUSE is not set -# CONFIG_HID_MICROSOFT is not set -# CONFIG_HID_MONTEREY is not set -# CONFIG_HID_MULTITOUCH is not set -# CONFIG_HID_NTRIG is not set -# CONFIG_HID_ORTEK is not set -# CONFIG_HID_PANTHERLORD is not set -# CONFIG_HID_PENMOUNT is not set -# CONFIG_HID_PETALYNX is not set -# CONFIG_HID_PICOLCD is not set -# CONFIG_HID_PID is not set -# CONFIG_HID_PLANTRONICS is not set -# CONFIG_HID_PRIMAX is not set -# CONFIG_HID_PRODIKEYS is not set -# CONFIG_HID_RMI is not set -# CONFIG_HID_ROCCAT is not set -# CONFIG_HID_SAITEK is not set -# CONFIG_HID_SAMSUNG is not set -# CONFIG_HID_SENSOR_HUB is not set -# CONFIG_HID_SMARTJOYPLUS is not set -# CONFIG_HID_SONY is not set -# CONFIG_HID_SPEEDLINK is not set -# CONFIG_HID_STEELSERIES is not set -# CONFIG_HID_SUNPLUS is not set -# CONFIG_HID_THINGM is not set -# CONFIG_HID_THRUSTMASTER is not set -# CONFIG_HID_TIVO is not set -# CONFIG_HID_TOPSEED is not set -# CONFIG_HID_TWINHAN is not set -# CONFIG_HID_UCLOGIC is not set -# CONFIG_HID_WACOM is not set -# CONFIG_HID_WALTOP is not set -# CONFIG_HID_WIIMOTE is not set -# CONFIG_HID_XINMO is not set -# CONFIG_HID_ZEROPLUS is not set -# CONFIG_HID_ZYDACRON is not set -# CONFIG_HIGHMEM is not set -CONFIG_HIGH_RES_TIMERS=y -# CONFIG_HIP04_ETH is not set -# CONFIG_HIPPI is not set -# CONFIG_HISI_FEMAC is not set -# CONFIG_HIX5HD2_GMAC is not set -# CONFIG_HMC6352 is not set -# CONFIG_HNS is not set -# CONFIG_HNS_DSAF is not set -# CONFIG_HNS_ENET is not set -# CONFIG_HOSTAP is not set -# CONFIG_HOSTAP_CS is not set -# CONFIG_HOSTAP_PCI is not set -# CONFIG_HOSTAP_PLX is not set -# CONFIG_HOTPLUG_CPU is not set -# CONFIG_HOTPLUG_PCI is not set -# CONFIG_HP03 is not set -# CONFIG_HP100 is not set -# CONFIG_HP206C is not set -CONFIG_HPET_MMAP_DEFAULT=y -# CONFIG_HPFS_FS is not set -# CONFIG_HP_ILO is not set -# CONFIG_HP_WIRELESS is not set -# CONFIG_HSI is not set -# CONFIG_HSR is not set -# CONFIG_HTC_EGPIO is not set -# CONFIG_HTC_I2CPLD is not set -# CONFIG_HTC_PASIC3 is not set -# CONFIG_HTU21 is not set -# CONFIG_HUGETLB_PAGE is not set -# CONFIG_HVC_DCC is not set -# CONFIG_HVC_UDBG is not set -# CONFIG_HWLAT_TRACER is not set -# CONFIG_HWMON is not set -# CONFIG_HWMON_DEBUG_CHIP is not set -# CONFIG_HWMON_VID is not set -# CONFIG_HWSPINLOCK_OMAP is not set -CONFIG_HW_PERF_EVENTS=y -# CONFIG_HW_RANDOM is not set -# CONFIG_HW_RANDOM_AMD is not set -# CONFIG_HW_RANDOM_ATMEL is not set -# CONFIG_HW_RANDOM_EXYNOS is not set -# CONFIG_HW_RANDOM_GEODE is not set -# CONFIG_HW_RANDOM_INTEL is not set -# CONFIG_HW_RANDOM_IPROC_RNG200 is not set -# CONFIG_HW_RANDOM_OMAP3_ROM is not set -# CONFIG_HW_RANDOM_PPC4XX is not set -# CONFIG_HW_RANDOM_TIMERIOMEM is not set -# CONFIG_HW_RANDOM_TPM is not set -# CONFIG_HW_RANDOM_VIA is not set -# CONFIG_HW_RANDOM_VIRTIO is not set -# CONFIG_HYPERV is not set -# CONFIG_HYSDN is not set -CONFIG_HZ=100 -CONFIG_HZ_100=y -# CONFIG_HZ_1000 is not set -# CONFIG_HZ_1024 is not set -# CONFIG_HZ_128 is not set -# CONFIG_HZ_200 is not set -# CONFIG_HZ_24 is not set -# CONFIG_HZ_250 is not set -# CONFIG_HZ_256 is not set -# CONFIG_HZ_300 is not set -# CONFIG_HZ_48 is not set -# CONFIG_HZ_500 is not set -# CONFIG_HZ_PERIODIC is not set -# CONFIG_I2C is not set -# CONFIG_I2C_ALGOBIT is not set -# CONFIG_I2C_ALGOPCA is not set -# CONFIG_I2C_ALGOPCF is not set -# 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_ARB_GPIO_CHALLENGE is not set -# CONFIG_I2C_AU1550 is not set -# CONFIG_I2C_BCM2835 is not set -# CONFIG_I2C_BCM_IPROC is not set -# CONFIG_I2C_CADENCE is not set -# CONFIG_I2C_CBUS_GPIO is not set -# CONFIG_I2C_CHARDEV is not set -# CONFIG_I2C_COMPAT is not set -# CONFIG_I2C_DEBUG_ALGO is not set -# CONFIG_I2C_DEBUG_BUS is not set -# CONFIG_I2C_DEBUG_CORE is not set -# CONFIG_I2C_DEMUX_PINCTRL is not set -# CONFIG_I2C_DESIGNWARE_PCI is not set -# CONFIG_I2C_DESIGNWARE_PLATFORM is not set -# CONFIG_I2C_DIOLAN_U2C is not set -# CONFIG_I2C_EG20T is not set -# CONFIG_I2C_ELEKTOR is not set -# CONFIG_I2C_EMEV2 is not set -# CONFIG_I2C_GPIO is not set -# CONFIG_I2C_HELPER_AUTO is not set -# CONFIG_I2C_HID is not set -# CONFIG_I2C_I801 is not set -# CONFIG_I2C_IBM_IIC is not set -# CONFIG_I2C_IMG is not set -# CONFIG_I2C_ISCH is not set -# CONFIG_I2C_ISMT is not set -# CONFIG_I2C_MPC is not set -# CONFIG_I2C_MUX 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_MV64XXX is not set -# CONFIG_I2C_NFORCE2 is not set -# CONFIG_I2C_NOMADIK is not set -# CONFIG_I2C_OCORES is not set -# CONFIG_I2C_OCTEON is not set -# CONFIG_I2C_PARPORT is not set -# CONFIG_I2C_PARPORT_LIGHT is not set -# CONFIG_I2C_PCA_ISA is not set -# CONFIG_I2C_PCA_PLATFORM is not set -# CONFIG_I2C_PIIX4 is not set -# CONFIG_I2C_PXA_PCI is not set -# CONFIG_I2C_RCAR is not set -# CONFIG_I2C_RK3X is not set -# CONFIG_I2C_ROBOTFUZZ_OSIF is not set -# CONFIG_I2C_SCMI is not set -# CONFIG_I2C_SH_MOBILE is not set -# CONFIG_I2C_SIMTEC is not set -# CONFIG_I2C_SIS5595 is not set -# CONFIG_I2C_SIS630 is not set -# CONFIG_I2C_SIS96X is not set -# CONFIG_I2C_SLAVE is not set -# CONFIG_I2C_SMBUS is not set -# CONFIG_I2C_STUB is not set -# CONFIG_I2C_TAOS_EVM is not set -# CONFIG_I2C_THUNDERX is not set -# CONFIG_I2C_TINY_USB is not set -# CONFIG_I2C_VERSATILE is not set -# CONFIG_I2C_VIA is not set -# CONFIG_I2C_VIAPRO is not set -# CONFIG_I2C_XILINX is not set -# CONFIG_I40E is not set -# CONFIG_I40EVF is not set -# CONFIG_I6300ESB_WDT is not set -# CONFIG_I82092 is not set -# CONFIG_I82365 is not set -# CONFIG_IAQCORE is not set -# CONFIG_IBM_ASM is not set -# CONFIG_IBM_EMAC_DEBUG is not set -# CONFIG_IBM_EMAC_EMAC4 is not set -# CONFIG_IBM_EMAC_MAL_CLR_ICINTSTAT is not set -# CONFIG_IBM_EMAC_MAL_COMMON_ERR is not set -# CONFIG_IBM_EMAC_NO_FLOW_CTRL is not set -# CONFIG_IBM_EMAC_RGMII is not set -# CONFIG_IBM_EMAC_TAH is not set -# CONFIG_IBM_EMAC_ZMII is not set -# CONFIG_ICPLUS_PHY is not set -# CONFIG_ICS932S401 is not set -# CONFIG_IDE is not set -# CONFIG_IDEAPAD_LAPTOP is not set -# CONFIG_IDE_GD is not set -# CONFIG_IDE_PROC_FS is not set -# CONFIG_IDE_TASK_IOCTL is not set -# CONFIG_IDLE_PAGE_TRACKING is not set -# CONFIG_IEEE802154 is not set -# CONFIG_IEEE802154_ADF7242 is not set -# CONFIG_IEEE802154_ATUSB is not set -# CONFIG_IFB is not set -# CONFIG_IGB is not set -# CONFIG_IGBVF is not set -# CONFIG_IIO is not set -# CONFIG_IIO_BUFFER_CB is not set -# CONFIG_IIO_CONFIGFS is not set -CONFIG_IIO_CONSUMERS_PER_TRIGGER=2 -# CONFIG_IIO_INTERRUPT_TRIGGER is not set -# CONFIG_IIO_PERIODIC_RTC_TRIGGER is not set -# CONFIG_IIO_SIMPLE_DUMMY is not set -# CONFIG_IIO_SSP_SENSORHUB is not set -# CONFIG_IIO_ST_ACCEL_3AXIS is not set -# CONFIG_IIO_ST_GYRO_3AXIS is not set -# CONFIG_IIO_ST_MAGN_3AXIS is not set -# CONFIG_IIO_ST_PRESS is not set -# CONFIG_IIO_SW_DEVICE is not set -# CONFIG_IIO_SW_TRIGGER is not set -# CONFIG_IIO_SYSFS_TRIGGER is not set -# CONFIG_IKCONFIG is not set -# CONFIG_IKCONFIG_PROC is not set -# CONFIG_IMAGE_CMDLINE_HACK is not set -# CONFIG_IMGPDC_WDT is not set -# CONFIG_IMG_MDC_DMA is not set -# CONFIG_IMX7D_ADC is not set -# CONFIG_IMX_IPUV3_CORE is not set -# CONFIG_IMX_THERMAL is not set -# CONFIG_INA2XX_ADC is not set -CONFIG_INET=y -# CONFIG_INET6_AH is not set -# CONFIG_INET6_ESP is not set -# CONFIG_INET6_IPCOMP is not set -# CONFIG_INET6_TUNNEL is not set -# CONFIG_INET6_XFRM_MODE_BEET is not set -# CONFIG_INET6_XFRM_MODE_ROUTEOPTIMIZATION is not set -# CONFIG_INET6_XFRM_MODE_TRANSPORT is not set -# CONFIG_INET6_XFRM_MODE_TUNNEL is not set -# CONFIG_INET6_XFRM_TUNNEL is not set -# CONFIG_INET_AH is not set -# CONFIG_INET_DIAG is not set -# CONFIG_INET_ESP is not set -# CONFIG_INET_IPCOMP is not set -# CONFIG_INET_LRO is not set -# CONFIG_INET_TCP_DIAG is not set -# CONFIG_INET_TUNNEL is not set -# CONFIG_INET_UDP_DIAG is not set -# CONFIG_INET_XFRM_MODE_BEET is not set -# CONFIG_INET_XFRM_MODE_TRANSPORT is not set -# CONFIG_INET_XFRM_MODE_TUNNEL is not set -# CONFIG_INET_XFRM_TUNNEL is not set -# CONFIG_INFINIBAND is not set -# CONFIG_INFTL is not set -CONFIG_INIT_ENV_ARG_LIMIT=32 -# CONFIG_INLINE_READ_LOCK is not set -# CONFIG_INLINE_READ_LOCK_BH is not set -# CONFIG_INLINE_READ_LOCK_IRQ is not set -# CONFIG_INLINE_READ_LOCK_IRQSAVE is not set -# CONFIG_INLINE_READ_TRYLOCK is not set -CONFIG_INLINE_READ_UNLOCK=y -# CONFIG_INLINE_READ_UNLOCK_BH is not set -CONFIG_INLINE_READ_UNLOCK_IRQ=y -# CONFIG_INLINE_READ_UNLOCK_IRQRESTORE is not set -# CONFIG_INLINE_SPIN_LOCK is not set -# CONFIG_INLINE_SPIN_LOCK_BH is not set -# CONFIG_INLINE_SPIN_LOCK_IRQ is not set -# CONFIG_INLINE_SPIN_LOCK_IRQSAVE is not set -# CONFIG_INLINE_SPIN_TRYLOCK is not set -# CONFIG_INLINE_SPIN_TRYLOCK_BH is not set -# CONFIG_INLINE_SPIN_UNLOCK_BH is not set -CONFIG_INLINE_SPIN_UNLOCK_IRQ=y -# CONFIG_INLINE_SPIN_UNLOCK_IRQRESTORE is not set -# CONFIG_INLINE_WRITE_LOCK is not set -# CONFIG_INLINE_WRITE_LOCK_BH is not set -# CONFIG_INLINE_WRITE_LOCK_IRQ is not set -# CONFIG_INLINE_WRITE_LOCK_IRQSAVE is not set -# CONFIG_INLINE_WRITE_TRYLOCK is not set -CONFIG_INLINE_WRITE_UNLOCK=y -# CONFIG_INLINE_WRITE_UNLOCK_BH is not set -CONFIG_INLINE_WRITE_UNLOCK_IRQ=y -# CONFIG_INLINE_WRITE_UNLOCK_IRQRESTORE is not set -CONFIG_INOTIFY_USER=y -# CONFIG_INPUT is not set -# CONFIG_INPUT_AD714X is not set -# CONFIG_INPUT_ADXL34X is not set -# CONFIG_INPUT_APANEL is not set -# CONFIG_INPUT_ATI_REMOTE2 is not set -# CONFIG_INPUT_ATLAS_BTNS is not set -# CONFIG_INPUT_ATMEL_CAPTOUCH is not set -# CONFIG_INPUT_AXP20X_PEK is not set -# CONFIG_INPUT_BMA150 is not set -# CONFIG_INPUT_CM109 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_INPUT_E3X0_BUTTON is not set -# CONFIG_INPUT_EVBUG is not set -# CONFIG_INPUT_EVDEV is not set -# CONFIG_INPUT_FF_MEMLESS is not set -# CONFIG_INPUT_GP2A is not set -# CONFIG_INPUT_GPIO_BEEPER is not set -# CONFIG_INPUT_GPIO_DECODER is not set -# CONFIG_INPUT_GPIO_ROTARY_ENCODER is not set -# CONFIG_INPUT_GPIO_TILT_POLLED is not set -# CONFIG_INPUT_IDEAPAD_SLIDEBAR is not set -# CONFIG_INPUT_IMS_PCU is not set -# CONFIG_INPUT_JOYDEV is not set -# CONFIG_INPUT_JOYSTICK is not set -# CONFIG_INPUT_KEYBOARD is not set -# CONFIG_INPUT_KEYSPAN_REMOTE is not set -# CONFIG_INPUT_KXTJ9 is not set -# CONFIG_INPUT_LEDS is not set -# CONFIG_INPUT_MATRIXKMAP is not set -# CONFIG_INPUT_MAX8997_HAPTIC is not set -CONFIG_INPUT_MISC=y -# CONFIG_INPUT_MMA8450 is not set -# CONFIG_INPUT_MOUSE is not set -# CONFIG_INPUT_MOUSEDEV is not set -# CONFIG_INPUT_MPU3050 is not set -# CONFIG_INPUT_PALMAS_PWRBUTTON is not set -# CONFIG_INPUT_PCF8574 is not set -# CONFIG_INPUT_PCSPKR is not set -# CONFIG_INPUT_POLLDEV is not set -# CONFIG_INPUT_POWERMATE is not set -# CONFIG_INPUT_PWM_BEEPER is not set -# CONFIG_INPUT_REGULATOR_HAPTIC is not set -# CONFIG_INPUT_SOC_BUTTON_ARRAY is not set -# CONFIG_INPUT_SPARSEKMAP is not set -# CONFIG_INPUT_TABLET is not set -# CONFIG_INPUT_TOUCHSCREEN is not set -# CONFIG_INPUT_TPS65218_PWRBUTTON is not set -# CONFIG_INPUT_TWL4030_PWRBUTTON is not set -# CONFIG_INPUT_TWL4030_VIBRA is not set -# CONFIG_INPUT_TWL6040_VIBRA is not set -# CONFIG_INPUT_UINPUT is not set -# CONFIG_INPUT_WISTRON_BTNS is not set -# CONFIG_INPUT_YEALINK is not set -# CONFIG_INT340X_THERMAL is not set -# CONFIG_INTEL_HID_EVENT is not set -# CONFIG_INTEL_IDLE is not set -# CONFIG_INTEL_IDMA64 is not set -# CONFIG_INTEL_IOATDMA is not set -# CONFIG_INTEL_ISH_HID is not set -# CONFIG_INTEL_MEI is not set -# CONFIG_INTEL_MEI_ME is not set -# CONFIG_INTEL_MEI_TXE is not set -# CONFIG_INTEL_MIC_CARD is not set -# CONFIG_INTEL_MIC_HOST is not set -# CONFIG_INTEL_MID_PTI is not set -# CONFIG_INTEL_OAKTRAIL is not set -# CONFIG_INTEL_PMC_CORE is not set -# CONFIG_INTEL_PUNIT_IPC is not set -# CONFIG_INTEL_RST is not set -# CONFIG_INTEL_SMARTCONNECT is not set -# CONFIG_INTEL_SOC_PMIC is not set -# CONFIG_INTEL_TH is not set -# CONFIG_INTEL_VBTN is not set -# CONFIG_INTEL_XWAY_PHY is not set -# CONFIG_INTERVAL_TREE_TEST is not set -# CONFIG_INV_MPU6050_I2C is not set -# CONFIG_INV_MPU6050_IIO is not set -# CONFIG_INV_MPU6050_SPI is not set -# CONFIG_IOMMU_SUPPORT is not set -# CONFIG_IOSCHED_CFQ is not set -CONFIG_IOSCHED_DEADLINE=y -CONFIG_IOSCHED_NOOP=y -CONFIG_IO_STRICT_DEVMEM=y -# CONFIG_IP17XX_PHY is not set -# CONFIG_IP6_NF_FILTER is not set -# CONFIG_IP6_NF_IPTABLES is not set -# CONFIG_IP6_NF_MANGLE is not set -# 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_HL is not set -# CONFIG_IP6_NF_MATCH_IPV6HEADER is not set -# CONFIG_IP6_NF_MATCH_MH is not set -# CONFIG_IP6_NF_MATCH_OPTS is not set -# CONFIG_IP6_NF_MATCH_RPFILTER is not set -# CONFIG_IP6_NF_MATCH_RT is not set -# CONFIG_IP6_NF_NAT is not set -# CONFIG_IP6_NF_RAW is not set -# CONFIG_IP6_NF_SECURITY is not set -# CONFIG_IP6_NF_TARGET_HL is not set -# CONFIG_IP6_NF_TARGET_REJECT is not set -# CONFIG_IP6_NF_TARGET_SYNPROXY is not set -# CONFIG_IPACK_BUS is not set -# CONFIG_IPC_NS is not set -# CONFIG_IPMI_HANDLER is not set -# CONFIG_IPV6 is not set -# CONFIG_IPV6_FOU is not set -# CONFIG_IPV6_FOU_TUNNEL is not set -# CONFIG_IPV6_ILA is not set -# CONFIG_IPV6_MIP6 is not set -# CONFIG_IPV6_MROUTE is not set -# CONFIG_IPV6_MROUTE_MULTIPLE_TABLES is not set -# CONFIG_IPV6_MULTIPLE_TABLES is not set -CONFIG_IPV6_NDISC_NODETYPE=y -# CONFIG_IPV6_OPTIMISTIC_DAD is not set -# CONFIG_IPV6_ROUTER_PREF is not set -# CONFIG_IPV6_ROUTE_INFO is not set -# CONFIG_IPV6_SIT is not set -# CONFIG_IPV6_SIT_6RD is not set -# CONFIG_IPV6_TUNNEL is not set -# CONFIG_IPV6_VTI is not set -# CONFIG_IPVLAN is not set -# CONFIG_IPW2100 is not set -# CONFIG_IPW2100_DEBUG is not set -CONFIG_IPW2100_MONITOR=y -# CONFIG_IPW2200 is not set -# CONFIG_IPW2200_DEBUG is not set -CONFIG_IPW2200_MONITOR=y -# CONFIG_IPW2200_PROMISCUOUS is not set -# CONFIG_IPW2200_QOS is not set -# CONFIG_IPW2200_RADIOTAP is not set -# CONFIG_IPWIRELESS is not set -# CONFIG_IPX is not set -CONFIG_IP_ADVANCED_ROUTER=y -# CONFIG_IP_DCCP is not set -# CONFIG_IP_FIB_TRIE_STATS is not set -# CONFIG_IP_MROUTE is not set -CONFIG_IP_MROUTE_MULTIPLE_TABLES=y -CONFIG_IP_MULTICAST=y -CONFIG_IP_MULTIPLE_TABLES=y -# CONFIG_IP_NF_ARPFILTER is not set -# CONFIG_IP_NF_ARPTABLES is not set -# CONFIG_IP_NF_ARP_MANGLE is not set -# CONFIG_IP_NF_FILTER is not set -# CONFIG_IP_NF_IPTABLES is not set -# CONFIG_IP_NF_MANGLE is not set -# 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_RAW is not set -# CONFIG_IP_NF_SECURITY is not set -# CONFIG_IP_NF_TARGET_CLUSTERIP is not set -# CONFIG_IP_NF_TARGET_ECN is not set -# CONFIG_IP_NF_TARGET_MASQUERADE is not set -# CONFIG_IP_NF_TARGET_NETMAP is not set -# CONFIG_IP_NF_TARGET_REDIRECT is not set -# CONFIG_IP_NF_TARGET_REJECT is not set -# CONFIG_IP_NF_TARGET_SYNPROXY is not set -# CONFIG_IP_NF_TARGET_TTL is not set -# CONFIG_IP_PIMSM_V1 is not set -# CONFIG_IP_PIMSM_V2 is not set -# CONFIG_IP_PNP is not set -CONFIG_IP_ROUTE_MULTIPATH=y -CONFIG_IP_ROUTE_VERBOSE=y -# CONFIG_IP_SCTP is not set -# CONFIG_IP_SET is not set -# CONFIG_IP_VS is not set -# CONFIG_IRDA is not set -# CONFIG_IRQSOFF_TRACER is not set -# CONFIG_IRQ_ALL_CPUS is not set -# CONFIG_IRQ_DOMAIN_DEBUG is not set -# CONFIG_IRQ_POLL is not set -# CONFIG_IRQ_TIME_ACCOUNTING is not set -# CONFIG_IR_GPIO_CIR is not set -# CONFIG_IR_HIX5HD2 is not set -# CONFIG_IR_IGORPLUGUSB is not set -# CONFIG_IR_IGUANA is not set -# CONFIG_IR_IMG is not set -# CONFIG_IR_IMON is not set -# CONFIG_IR_JVC_DECODER is not set -# CONFIG_IR_LIRC_CODEC is not set -# CONFIG_IR_MCEUSB is not set -# CONFIG_IR_NEC_DECODER is not set -# CONFIG_IR_RC5_DECODER is not set -# CONFIG_IR_RC6_DECODER is not set -# CONFIG_IR_REDRAT3 is not set -# CONFIG_IR_SONY_DECODER is not set -# CONFIG_IR_STREAMZAP is not set -# CONFIG_IR_TTUSBIR is not set -# CONFIG_ISA_BUS is not set -# CONFIG_ISA_BUS_API is not set -# CONFIG_ISCSI_BOOT_SYSFS is not set -# CONFIG_ISCSI_TCP is not set -CONFIG_ISDN=y -# CONFIG_ISDN_AUDIO is not set -# CONFIG_ISDN_CAPI is not set -# CONFIG_ISDN_CAPI_CAPIDRV is not set -# CONFIG_ISDN_DIVERSION is not set -# CONFIG_ISDN_DRV_ACT2000 is not set -# CONFIG_ISDN_DRV_GIGASET is not set -# CONFIG_ISDN_DRV_HISAX is not set -# CONFIG_ISDN_DRV_ICN is not set -# CONFIG_ISDN_DRV_LOOP is not set -# CONFIG_ISDN_DRV_PCBIT is not set -# CONFIG_ISDN_DRV_SC is not set -# CONFIG_ISDN_I4L is not set -# CONFIG_ISL29003 is not set -# CONFIG_ISL29020 is not set -# CONFIG_ISL29125 is not set -# CONFIG_ISO9660_FS is not set -# CONFIG_ISS4xx is not set -# CONFIG_ITG3200 is not set -# CONFIG_IWL3945 is not set -# CONFIG_IWLWIFI is not set -# CONFIG_IXGB is not set -# CONFIG_IXGBE is not set -# CONFIG_IXGBEVF is not set -# CONFIG_JBD2_DEBUG is not set -# CONFIG_JFFS2_CMODE_FAVOURLZO is not set -# CONFIG_JFFS2_CMODE_NONE is not set -CONFIG_JFFS2_CMODE_PRIORITY=y -# CONFIG_JFFS2_CMODE_SIZE is not set -CONFIG_JFFS2_COMPRESSION_OPTIONS=y -CONFIG_JFFS2_FS=y -CONFIG_JFFS2_FS_DEBUG=0 -# CONFIG_JFFS2_FS_POSIX_ACL is not set -# CONFIG_JFFS2_FS_SECURITY is not set -# CONFIG_JFFS2_FS_WBUF_VERIFY is not set -CONFIG_JFFS2_FS_WRITEBUFFER=y -CONFIG_JFFS2_FS_XATTR=y -CONFIG_JFFS2_LZMA=y -# CONFIG_JFFS2_LZO is not set -CONFIG_JFFS2_RTIME=y -# CONFIG_JFFS2_RUBIN is not set -CONFIG_JFFS2_SUMMARY=y -# CONFIG_JFFS2_ZLIB is not set -# CONFIG_JFS_DEBUG is not set -# CONFIG_JFS_FS is not set -# CONFIG_JFS_POSIX_ACL is not set -# CONFIG_JFS_SECURITY is not set -# CONFIG_JFS_STATISTICS is not set -# CONFIG_JME is not set -CONFIG_JOLIET=y -# CONFIG_JSA1212 is not set -# CONFIG_JUMP_LABEL is not set -# CONFIG_KALLSYMS is not set -# CONFIG_KALLSYMS_ABSOLUTE_PERCPU is not set -# CONFIG_KALLSYMS_ALL is not set -CONFIG_KALLSYMS_BASE_RELATIVE=y -# CONFIG_KALLSYMS_UNCOMPRESSED is not set -# CONFIG_KARMA_PARTITION is not set -# CONFIG_KASAN is not set -# CONFIG_KCOV is not set -# CONFIG_KERNEL_BZIP2 is not set -# CONFIG_KERNEL_CAT is not set -# CONFIG_KERNEL_GZIP is not set -# CONFIG_KERNEL_LZ4 is not set -# CONFIG_KERNEL_LZMA is not set -# CONFIG_KERNEL_LZO is not set -CONFIG_KERNEL_MODE_NEON=y -CONFIG_KERNEL_XZ=y -CONFIG_KERNFS=y -# CONFIG_KEXEC is not set -# CONFIG_KEYBOARD_ADC is not set -# CONFIG_KEYBOARD_ADP5588 is not set -# CONFIG_KEYBOARD_ADP5589 is not set -# CONFIG_KEYBOARD_ATKBD is not set -# CONFIG_KEYBOARD_BCM is not set -# CONFIG_KEYBOARD_CAP11XX is not set -# CONFIG_KEYBOARD_GPIO is not set -# CONFIG_KEYBOARD_GPIO_POLLED is not set -# CONFIG_KEYBOARD_LKKBD is not set -# CONFIG_KEYBOARD_LM8323 is not set -# CONFIG_KEYBOARD_LM8333 is not set -# CONFIG_KEYBOARD_MATRIX 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_OMAP4 is not set -# CONFIG_KEYBOARD_OPENCORES is not set -# CONFIG_KEYBOARD_PXA27x is not set -# CONFIG_KEYBOARD_QT1070 is not set -# CONFIG_KEYBOARD_QT2160 is not set -# CONFIG_KEYBOARD_SAMSUNG is not set -# CONFIG_KEYBOARD_SH_KEYSC is not set -# CONFIG_KEYBOARD_SNVS_PWRKEY is not set -# CONFIG_KEYBOARD_STMPE is not set -# CONFIG_KEYBOARD_STOWAWAY is not set -# CONFIG_KEYBOARD_SUNKBD is not set -# CONFIG_KEYBOARD_TCA6416 is not set -# CONFIG_KEYBOARD_TCA8418 is not set -# CONFIG_KEYBOARD_TWL4030 is not set -# CONFIG_KEYBOARD_XTKBD is not set -# CONFIG_KEYS is not set -# CONFIG_KEY_DH_OPERATIONS is not set -# CONFIG_KGDB is not set -# CONFIG_KMEMCHECK is not set -# CONFIG_KMX61 is not set -# CONFIG_KPROBES is not set -# CONFIG_KPROBES_SANITY_TEST is not set -# CONFIG_KS7010 is not set -# CONFIG_KS8842 is not set -# CONFIG_KS8851 is not set -# CONFIG_KS8851_MLL is not set -# CONFIG_KSM is not set -# CONFIG_KSZ884X_PCI is not set -CONFIG_KUSER_HELPERS=y -# CONFIG_KVM_AMD is not set -# CONFIG_KVM_GUEST is not set -# CONFIG_KVM_INTEL is not set -# CONFIG_KXCJK1013 is not set -# CONFIG_KXSD9 is not set -# CONFIG_L2TP is not set -# CONFIG_L2TP_ETH is not set -# CONFIG_L2TP_IP is not set -# CONFIG_L2TP_V3 is not set -# CONFIG_LANMEDIA is not set -# CONFIG_LANTIQ is not set -# CONFIG_LAPB is not set -# CONFIG_LASAT is not set -# CONFIG_LATENCYTOP is not set -# CONFIG_LATTICE_ECP3_CONFIG is not set -CONFIG_LBDAF=y -# CONFIG_LCD_AMS369FG06 is not set -# CONFIG_LCD_HX8357 is not set -# CONFIG_LCD_ILI922X is not set -# CONFIG_LCD_ILI9320 is not set -# CONFIG_LCD_L4F00242T03 is not set -# CONFIG_LCD_LD9040 is not set -# CONFIG_LCD_LMS283GF05 is not set -# CONFIG_LCD_LMS501KF03 is not set -# CONFIG_LCD_LTV350QV is not set -# CONFIG_LCD_S6E63M0 is not set -# CONFIG_LCD_TDO24M is not set -# CONFIG_LCD_VGG2432A4 is not set -# CONFIG_LDM_PARTITION is not set -CONFIG_LD_DEAD_CODE_DATA_ELIMINATION=y -# CONFIG_LEDS_BCM6328 is not set -# CONFIG_LEDS_BCM6358 is not set -# CONFIG_LEDS_BD2802 is not set -# CONFIG_LEDS_BLINKM is not set -CONFIG_LEDS_CLASS=y -# CONFIG_LEDS_CLASS_FLASH is not set -# CONFIG_LEDS_DAC124S085 is not set -# CONFIG_LEDS_GPIO is not set -# CONFIG_LEDS_INTEL_SS4200 is not set -# CONFIG_LEDS_IS31FL319X is not set -# CONFIG_LEDS_IS31FL32XX is not set -# CONFIG_LEDS_LM3530 is not set -# CONFIG_LEDS_LM355x is not set -# CONFIG_LEDS_LM3642 is not set -# CONFIG_LEDS_LP3944 is not set -# CONFIG_LEDS_LP3952 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_LT3593 is not set -# CONFIG_LEDS_MLXCPLD is not set -# CONFIG_LEDS_NS2 is not set -# CONFIG_LEDS_OT200 is not set -# CONFIG_LEDS_PCA9532 is not set -# CONFIG_LEDS_PCA955X is not set -# CONFIG_LEDS_PCA963X is not set -# CONFIG_LEDS_PWM is not set -# CONFIG_LEDS_REGULATOR is not set -# CONFIG_LEDS_SYSCON is not set -# CONFIG_LEDS_TCA6507 is not set -# CONFIG_LEDS_TLC591XX is not set -CONFIG_LEDS_TRIGGERS=y -# CONFIG_LEDS_TRIGGER_BACKLIGHT is not set -# CONFIG_LEDS_TRIGGER_CAMERA is not set -# CONFIG_LEDS_TRIGGER_CPU is not set -CONFIG_LEDS_TRIGGER_DEFAULT_ON=y -# CONFIG_LEDS_TRIGGER_DISK is not set -# CONFIG_LEDS_TRIGGER_GPIO is not set -# CONFIG_LEDS_TRIGGER_HEARTBEAT is not set -# CONFIG_LEDS_TRIGGER_IDE_DISK is not set -# CONFIG_LEDS_TRIGGER_MTD is not set -CONFIG_LEDS_TRIGGER_NETDEV=y -# CONFIG_LEDS_TRIGGER_ONESHOT is not set -# CONFIG_LEDS_TRIGGER_PANIC is not set -CONFIG_LEDS_TRIGGER_TIMER=y -# CONFIG_LEDS_TRIGGER_TRANSIENT is not set -# CONFIG_LEGACY_PTYS is not set -# CONFIG_LGUEST is not set -# CONFIG_LIB80211 is not set -# CONFIG_LIB80211_CRYPT_CCMP is not set -# CONFIG_LIB80211_CRYPT_TKIP is not set -# CONFIG_LIB80211_CRYPT_WEP is not set -# CONFIG_LIB80211_DEBUG is not set -# CONFIG_LIBCRC32C is not set -# CONFIG_LIBERTAS is not set -# CONFIG_LIBERTAS_THINFIRM is not set -# CONFIG_LIBERTAS_USB is not set -# CONFIG_LIBFC is not set -# CONFIG_LIBFCOE is not set -# CONFIG_LIBIPW_DEBUG is not set -# CONFIG_LIBNVDIMM is not set -# CONFIG_LIDAR_LITE_V2 is not set -# CONFIG_LIQUIDIO is not set -# CONFIG_LIRC_STAGING is not set -# CONFIG_LIS3L02DQ is not set -# CONFIG_LKDTM is not set -CONFIG_LLC=y -# CONFIG_LLC2 is not set -# CONFIG_LNET is not set -CONFIG_LOCALVERSION="" -# CONFIG_LOCALVERSION_AUTO is not set -# CONFIG_LOCKD is not set -CONFIG_LOCKDEP_SUPPORT=y -CONFIG_LOCKD_V4=y -# CONFIG_LOCKUP_DETECTOR is not set -# CONFIG_LOCK_STAT is not set -# CONFIG_LOCK_TORTURE_TEST is not set -# CONFIG_LOGFS is not set -# CONFIG_LOGIG940_FF is not set -# CONFIG_LOGIRUMBLEPAD2_FF is not set -# CONFIG_LOGITECH_FF is not set -# CONFIG_LOGIWHEELS_FF is not set -# CONFIG_LOGO is not set -CONFIG_LOG_BUF_SHIFT=17 -CONFIG_LOG_CPU_MAX_BUF_SHIFT=12 -# CONFIG_LOONGSON_MC146818 is not set -# CONFIG_LPC_ICH is not set -# CONFIG_LPC_SCH is not set -# CONFIG_LP_CONSOLE is not set -# CONFIG_LSI_ET1011C_PHY is not set -# CONFIG_LTC2485 is not set -# CONFIG_LTE_GDM724X is not set -# CONFIG_LTPC is not set -# CONFIG_LTR501 is not set -# CONFIG_LUSTRE_FS is not set -# CONFIG_LWTUNNEL is not set -# CONFIG_LXT_PHY is not set -# CONFIG_LZ4HC_COMPRESS is not set -# CONFIG_LZ4_COMPRESS is not set -# CONFIG_LZ4_DECOMPRESS is not set -CONFIG_LZMA_COMPRESS=y -CONFIG_LZMA_DECOMPRESS=y -# CONFIG_LZO_COMPRESS is not set -# CONFIG_LZO_DECOMPRESS is not set -# CONFIG_M62332 is not set -# CONFIG_MAC80211 is not set -# CONFIG_MAC80211_MESSAGE_TRACING is not set -CONFIG_MAC80211_STA_HASH_MAX_SIZE=0 -# CONFIG_MACB is not set -# CONFIG_MACH_ASM9260 is not set -# CONFIG_MACH_DECSTATION is not set -# CONFIG_MACH_INGENIC is not set -# CONFIG_MACH_JAZZ is not set -# CONFIG_MACH_JZ4740 is not set -# CONFIG_MACH_LOONGSON32 is not set -# CONFIG_MACH_LOONGSON64 is not set -# CONFIG_MACH_PIC32 is not set -# CONFIG_MACH_PISTACHIO is not set -# CONFIG_MACH_TX39XX is not set -# CONFIG_MACH_TX49XX is not set -# CONFIG_MACH_VR41XX is not set -# CONFIG_MACH_XILFPGA is not set -# CONFIG_MACINTOSH_DRIVERS is not set -# CONFIG_MACSEC is not set -# CONFIG_MACVLAN is not set -# CONFIG_MACVTAP is not set -# CONFIG_MAC_EMUMOUSEBTN is not set -# CONFIG_MAC_PARTITION is not set -# CONFIG_MAG3110 is not set -# CONFIG_MAGIC_SYSRQ is not set -CONFIG_MAGIC_SYSRQ_DEFAULT_ENABLE=0x1 -# CONFIG_MAGIC_SYSRQ_SERIAL is not set -# CONFIG_MAILBOX is not set -# CONFIG_MANDATORY_FILE_LOCKING is not set -# CONFIG_MANGLE_BOOTARGS is not set -# CONFIG_MARVELL_PHY is not set -# CONFIG_MAX1027 is not set -# CONFIG_MAX1363 is not set -# CONFIG_MAX30100 is not set -# CONFIG_MAX44000 is not set -# CONFIG_MAX517 is not set -# CONFIG_MAX5487 is not set -# CONFIG_MAX5821 is not set -# CONFIG_MAX63XX_WATCHDOG is not set -# CONFIG_MAXIM_THERMOCOUPLE is not set -CONFIG_MAY_USE_DEVLINK=y -# CONFIG_MC3230 is not set -# CONFIG_MCB is not set -# CONFIG_MCP320X is not set -# CONFIG_MCP3422 is not set -# CONFIG_MCP4131 is not set -# CONFIG_MCP4531 is not set -# CONFIG_MCP4725 is not set -# CONFIG_MCP4922 is not set -# CONFIG_MCPM is not set -# CONFIG_MD is not set -# CONFIG_MDIO_BCM_UNIMAC 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_HISI_FEMAC is not set -# CONFIG_MDIO_OCTEON is not set -# CONFIG_MDIO_THUNDER is not set -# CONFIG_MD_FAULTY is not set -# CONFIG_MEDIA_ANALOG_TV_SUPPORT is not set -# CONFIG_MEDIA_ATTACH is not set -# CONFIG_MEDIA_CAMERA_SUPPORT is not set -# CONFIG_MEDIA_CONTROLLER is not set -# CONFIG_MEDIA_DIGITAL_TV_SUPPORT is not set -# CONFIG_MEDIA_PCI_SUPPORT is not set -# CONFIG_MEDIA_RADIO_SUPPORT is not set -# CONFIG_MEDIA_RC_SUPPORT is not set -# CONFIG_MEDIA_SDR_SUPPORT is not set -# CONFIG_MEDIA_SUBDRV_AUTOSELECT is not set -# CONFIG_MEDIA_SUPPORT is not set -# CONFIG_MEDIA_USB_SUPPORT is not set -# CONFIG_MEGARAID_LEGACY is not set -# CONFIG_MEGARAID_NEWGEN is not set -# CONFIG_MEGARAID_SAS is not set -CONFIG_MEMBARRIER=y -# CONFIG_MEMORY is not set -# CONFIG_MEMORY_FAILURE is not set -# CONFIG_MEMSTICK is not set -# CONFIG_MEMTEST is not set -# CONFIG_MEN_A21_WDT is not set -# CONFIG_MESON_SM is not set -CONFIG_MESSAGE_LOGLEVEL_DEFAULT=4 -# CONFIG_MFD_88PM800 is not set -# CONFIG_MFD_88PM805 is not set -# CONFIG_MFD_88PM860X is not set -# CONFIG_MFD_AAT2870_CORE is not set -# CONFIG_MFD_ACT8945A is not set -# CONFIG_MFD_ARIZONA_I2C is not set -# CONFIG_MFD_ARIZONA_SPI is not set -# CONFIG_MFD_AS3711 is not set -# CONFIG_MFD_AS3722 is not set -# CONFIG_MFD_ASIC3 is not set -# CONFIG_MFD_ATMEL_FLEXCOM is not set -# CONFIG_MFD_ATMEL_HLCDC is not set -# CONFIG_MFD_AXP20X is not set -# CONFIG_MFD_AXP20X_I2C is not set -# CONFIG_MFD_BCM590XX is not set -# CONFIG_MFD_CORE is not set -# CONFIG_MFD_CROS_EC is not set -# CONFIG_MFD_CS5535 is not set -# CONFIG_MFD_DA9052_I2C is not set -# CONFIG_MFD_DA9052_SPI 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_EXYNOS_LPASS is not set -# CONFIG_MFD_HI6421_PMIC is not set -# CONFIG_MFD_JANZ_CMODIO is not set -# CONFIG_MFD_KEMPLD is not set -# CONFIG_MFD_LM3533 is not set -# CONFIG_MFD_LP3943 is not set -# CONFIG_MFD_LP8788 is not set -# CONFIG_MFD_MAX14577 is not set -# CONFIG_MFD_MAX77620 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_MC13XXX is not set -# CONFIG_MFD_MC13XXX_I2C is not set -# CONFIG_MFD_MC13XXX_SPI is not set -# CONFIG_MFD_MENF21BMC is not set -# CONFIG_MFD_MT6397 is not set -# CONFIG_MFD_OMAP_USB_HOST is not set -# CONFIG_MFD_PALMAS is not set -# CONFIG_MFD_PCF50633 is not set -# CONFIG_MFD_PM8921_CORE is not set -# CONFIG_MFD_RC5T583 is not set -# CONFIG_MFD_RDC321X is not set -# CONFIG_MFD_RETU is not set -# CONFIG_MFD_RK808 is not set -# CONFIG_MFD_RN5T618 is not set -# CONFIG_MFD_RT5033 is not set -# CONFIG_MFD_RTSX_PCI is not set -# CONFIG_MFD_RTSX_USB is not set -# CONFIG_MFD_SEC_CORE is not set -# CONFIG_MFD_SI476X_CORE is not set -# CONFIG_MFD_SKY81452 is not set -# CONFIG_MFD_SM501 is not set -# CONFIG_MFD_SMSC is not set -# CONFIG_MFD_STMPE is not set -# CONFIG_MFD_SYSCON is not set -# CONFIG_MFD_T7L66XB is not set -# CONFIG_MFD_TC3589X is not set -# CONFIG_MFD_TC6387XB is not set -# CONFIG_MFD_TC6393XB is not set -# CONFIG_MFD_TIMBERDALE is not set -# CONFIG_MFD_TI_AM335X_TSCADC is not set -# CONFIG_MFD_TI_LP873X is not set -# CONFIG_MFD_TMIO 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 -# CONFIG_MFD_VIPERBOARD is not set -# CONFIG_MFD_VX855 is not set -# CONFIG_MFD_WL1273_CORE is not set -# CONFIG_MFD_WM831X 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_WM8400 is not set -# CONFIG_MFD_WM8994 is not set -# CONFIG_MG_DISK is not set -# CONFIG_MICREL_KS8995MA is not set -# CONFIG_MICREL_PHY is not set -# CONFIG_MICROCHIP_PHY is not set -# CONFIG_MICROSEMI_PHY is not set -# CONFIG_MIGRATION is not set -CONFIG_MII=y -# CONFIG_MIKROTIK_RB532 is not set -# CONFIG_MINIX_FS is not set -# CONFIG_MINIX_FS_NATIVE_ENDIAN is not set -# CONFIG_MINIX_SUBPARTITION is not set -# CONFIG_MIPS_ALCHEMY is not set -# CONFIG_MIPS_CDMM is not set -# CONFIG_MIPS_COBALT is not set -# CONFIG_MIPS_FPU_EMULATOR is not set -# CONFIG_MIPS_GENERIC is not set -# CONFIG_MIPS_MALTA is not set -# CONFIG_MIPS_O32_FP64_SUPPORT is not set -# CONFIG_MIPS_PARAVIRT is not set -# CONFIG_MIPS_PLATFORM_DEVICES is not set -# CONFIG_MIPS_SEAD3 is not set -CONFIG_MISC_FILESYSTEMS=y -# CONFIG_MISDN is not set -# CONFIG_MISDN_AVMFRITZ is not set -# CONFIG_MISDN_HFCPCI is not set -# CONFIG_MISDN_HFCUSB is not set -# CONFIG_MISDN_INFINEON is not set -# CONFIG_MISDN_NETJET is not set -# CONFIG_MISDN_SPEEDFAX is not set -# CONFIG_MISDN_W6692 is not set -# CONFIG_MKISS is not set -# CONFIG_MLX4_CORE is not set -# CONFIG_MLX4_EN is not set -# CONFIG_MLX5_CORE is not set -# CONFIG_MLX90614 is not set -# CONFIG_MLXSW_CORE is not set -# CONFIG_MMA7455_I2C is not set -# CONFIG_MMA7455_SPI is not set -# CONFIG_MMA7660 is not set -# CONFIG_MMA8452 is not set -# CONFIG_MMA9551 is not set -# CONFIG_MMA9553 is not set -# CONFIG_MMC is not set -# CONFIG_MMC35240 is not set -# CONFIG_MMC_ARMMMCI is not set -# CONFIG_MMC_AU1X is not set -# CONFIG_MMC_BLOCK is not set -CONFIG_MMC_BLOCK_BOUNCE=y -CONFIG_MMC_BLOCK_MINORS=8 -# CONFIG_MMC_CB710 is not set -# CONFIG_MMC_DEBUG is not set -# CONFIG_MMC_DW is not set -# CONFIG_MMC_MTK is not set -# CONFIG_MMC_MVSDIO is not set -# CONFIG_MMC_S3C is not set -# CONFIG_MMC_SDHCI is not set -# CONFIG_MMC_SDHCI_ACPI is not set -# CONFIG_MMC_SDHCI_BCM_KONA is not set -# CONFIG_MMC_SDHCI_F_SDH30 is not set -# CONFIG_MMC_SDHCI_IPROC is not set -# CONFIG_MMC_SDHCI_MSM is not set -# CONFIG_MMC_SDHCI_OF_ARASAN is not set -# CONFIG_MMC_SDHCI_OF_AT91 is not set -# CONFIG_MMC_SDHCI_OF_ESDHC is not set -# CONFIG_MMC_SDHCI_OF_HLWD is not set -# CONFIG_MMC_SDHCI_PXAV2 is not set -# CONFIG_MMC_SDHCI_PXAV3 is not set -# CONFIG_MMC_SDRICOH_CS is not set -# CONFIG_MMC_SPI is not set -# CONFIG_MMC_TEST is not set -# CONFIG_MMC_TOSHIBA_PCI is not set -# CONFIG_MMC_USDHI6ROL0 is not set -# CONFIG_MMC_USHC is not set -# CONFIG_MMC_VIA_SDMMC is not set -# CONFIG_MMC_VUB300 is not set -# CONFIG_MMIOTRACE is not set -CONFIG_MMU=y -CONFIG_MODULES=y -# CONFIG_MODULE_COMPRESS is not set -# CONFIG_MODULE_FORCE_LOAD is not set -# CONFIG_MODULE_FORCE_UNLOAD is not set -# CONFIG_MODULE_SIG is not set -# CONFIG_MODULE_SRCVERSION_ALL is not set -CONFIG_MODULE_STRIPPED=y -CONFIG_MODULE_UNLOAD=y -# CONFIG_MODVERSIONS is not set -# CONFIG_MOST is not set -# CONFIG_MOUSE_APPLETOUCH is not set -# CONFIG_MOUSE_ELAN_I2C is not set -# CONFIG_MOUSE_GPIO is not set -# CONFIG_MOUSE_INPORT is not set -# CONFIG_MOUSE_LOGIBM is not set -# CONFIG_MOUSE_PC110PAD is not set -# CONFIG_MOUSE_PS2_FOCALTECH is not set -# CONFIG_MOUSE_PS2_SENTELIC is not set -# CONFIG_MOUSE_SYNAPTICS_I2C is not set -# CONFIG_MOUSE_SYNAPTICS_USB is not set -# CONFIG_MPL115 is not set -# CONFIG_MPL115_I2C is not set -# CONFIG_MPL115_SPI is not set -# CONFIG_MPL3115 is not set -# CONFIG_MPLS is not set -# CONFIG_MS5611 is not set -# CONFIG_MS5637 is not set -# CONFIG_MSDOS_FS is not set -CONFIG_MSDOS_PARTITION=y -# CONFIG_MSI_BITMAP_SELFTEST is not set -# CONFIG_MSI_LAPTOP is not set -CONFIG_MTD=y -# CONFIG_MTD_ABSENT is not set -# CONFIG_MTD_AFS_PARTS is not set -# CONFIG_MTD_AR7_PARTS is not set -CONFIG_MTD_BLKDEVS=y -CONFIG_MTD_BLOCK=y -# CONFIG_MTD_BLOCK2MTD is not set -CONFIG_MTD_CFI=y -# CONFIG_MTD_CFI_ADV_OPTIONS is not set -CONFIG_MTD_CFI_AMDSTD=y -# CONFIG_MTD_CFI_BE_BYTE_SWAP 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_LE_BYTE_SWAP is not set -CONFIG_MTD_CFI_NOSWAP=y -# CONFIG_MTD_CFI_STAA is not set -CONFIG_MTD_CFI_UTIL=y -# CONFIG_MTD_CMDLINE_PARTS is not set -CONFIG_MTD_COMPLEX_MAPPINGS=y -# CONFIG_MTD_DATAFLASH is not set -# CONFIG_MTD_DOCG3 is not set -CONFIG_MTD_GEN_PROBE=y -# CONFIG_MTD_GPIO_ADDR is not set -# CONFIG_MTD_INTEL_VR_NOR is not set -# CONFIG_MTD_JEDECPROBE is not set -# CONFIG_MTD_LATCH_ADDR is not set -# CONFIG_MTD_LPDDR is not set -# CONFIG_MTD_LPDDR2_NVM is not set -# CONFIG_MTD_M25P80 is not set -CONFIG_MTD_MAP_BANK_WIDTH_1=y -# CONFIG_MTD_MAP_BANK_WIDTH_16 is not set -CONFIG_MTD_MAP_BANK_WIDTH_2=y -# CONFIG_MTD_MAP_BANK_WIDTH_32 is not set -CONFIG_MTD_MAP_BANK_WIDTH_4=y -# CONFIG_MTD_MAP_BANK_WIDTH_8 is not set -# CONFIG_MTD_MT81xx_NOR is not set -# CONFIG_MTD_MTDRAM is not set -# CONFIG_MTD_MYLOADER_PARTS is not set -# CONFIG_MTD_NAND is not set -# CONFIG_MTD_NAND_AMS_DELTA is not set -# CONFIG_MTD_NAND_AR934X is not set -# CONFIG_MTD_NAND_AR934X_HW_ECC is not set -# CONFIG_MTD_NAND_ATMEL is not set -# CONFIG_MTD_NAND_AU1550 is not set -# CONFIG_MTD_NAND_BCH is not set -# CONFIG_MTD_NAND_BF5XX is not set -# CONFIG_MTD_NAND_BRCMNAND is not set -# CONFIG_MTD_NAND_CAFE is not set -# CONFIG_MTD_NAND_CM_X270 is not set -# CONFIG_MTD_NAND_CS553X is not set -# CONFIG_MTD_NAND_DAVINCI is not set -# CONFIG_MTD_NAND_DENALI is not set -# CONFIG_MTD_NAND_DENALI_DT is not set -# CONFIG_MTD_NAND_DENALI_PCI is not set -CONFIG_MTD_NAND_DENALI_SCRATCH_REG_ADDR=0xff108018 -# CONFIG_MTD_NAND_DISKONCHIP is not set -# CONFIG_MTD_NAND_DOCG4 is not set -# CONFIG_MTD_NAND_ECC is not set -# CONFIG_MTD_NAND_ECC_BCH is not set -# CONFIG_MTD_NAND_ECC_SMC is not set -# CONFIG_MTD_NAND_FSL_ELBC is not set -# CONFIG_MTD_NAND_FSL_IFC is not set -# CONFIG_MTD_NAND_FSL_UPM is not set -# CONFIG_MTD_NAND_FSMC is not set -# CONFIG_MTD_NAND_GPIO is not set -# CONFIG_MTD_NAND_GPMI_NAND is not set -# CONFIG_MTD_NAND_HISI504 is not set -CONFIG_MTD_NAND_IDS=y -# CONFIG_MTD_NAND_JZ4740 is not set -# CONFIG_MTD_NAND_MPC5121_NFC is not set -# CONFIG_MTD_NAND_MTK is not set -# CONFIG_MTD_NAND_MXC is not set -# CONFIG_MTD_NAND_NANDSIM is not set -# CONFIG_MTD_NAND_NDFC is not set -# CONFIG_MTD_NAND_NUC900 is not set -# CONFIG_MTD_NAND_OMAP2 is not set -# CONFIG_MTD_NAND_OMAP_BCH_BUILD is not set -# CONFIG_MTD_NAND_ORION is not set -# CONFIG_MTD_NAND_PASEMI is not set -# CONFIG_MTD_NAND_PLATFORM is not set -# CONFIG_MTD_NAND_PXA3xx is not set -# CONFIG_MTD_NAND_RB4XX is not set -# CONFIG_MTD_NAND_RB750 is not set -# CONFIG_MTD_NAND_RICOH is not set -# CONFIG_MTD_NAND_S3C2410 is not set -# CONFIG_MTD_NAND_SHARPSL is not set -# CONFIG_MTD_NAND_SH_FLCTL is not set -# CONFIG_MTD_NAND_SOCRATES is not set -# CONFIG_MTD_NAND_TMIO is not set -# CONFIG_MTD_NAND_TXX9NDFMC is not set -CONFIG_MTD_OF_PARTS=y -# CONFIG_MTD_ONENAND is not set -# CONFIG_MTD_OOPS is not set -# CONFIG_MTD_OTP is not set -# CONFIG_MTD_PARTITIONED_MASTER is not set -# CONFIG_MTD_PCI is not set -# CONFIG_MTD_PCMCIA is not set -# CONFIG_MTD_PHRAM is not set -# CONFIG_MTD_PHYSMAP is not set -# CONFIG_MTD_PHYSMAP_COMPAT is not set -CONFIG_MTD_PHYSMAP_OF=y -# CONFIG_MTD_PHYSMAP_OF_VERSATILE is not set -# CONFIG_MTD_PLATRAM is not set -# CONFIG_MTD_PMC551 is not set -# CONFIG_MTD_RAM is not set -CONFIG_MTD_REDBOOT_DIRECTORY_BLOCK=-1 -# CONFIG_MTD_REDBOOT_PARTS is not set -# CONFIG_MTD_REDBOOT_PARTS_READONLY is not set -# CONFIG_MTD_REDBOOT_PARTS_UNALLOCATED is not set -# CONFIG_MTD_ROM is not set -CONFIG_MTD_ROOTFS_ROOT_DEV=y -# CONFIG_MTD_SLRAM is not set -# CONFIG_MTD_SM_COMMON is not set -# CONFIG_MTD_SPINAND_MT29F is not set -# CONFIG_MTD_SPI_NOR is not set -# CONFIG_MTD_SPI_NOR_USE_4K_SECTORS is not set -CONFIG_MTD_SPI_NOR_USE_4K_SECTORS_LIMIT=4096 -CONFIG_MTD_SPLIT=y -# CONFIG_MTD_SPLIT_BRNIMAGE_FW is not set -# CONFIG_MTD_SPLIT_EVA_FW is not set -# CONFIG_MTD_SPLIT_FIRMWARE is not set -CONFIG_MTD_SPLIT_FIRMWARE_NAME="firmware" -# CONFIG_MTD_SPLIT_FIT_FW is not set -# CONFIG_MTD_SPLIT_JIMAGE_FW is not set -# CONFIG_MTD_SPLIT_LZMA_FW is not set -# CONFIG_MTD_SPLIT_MINOR_FW is not set -# CONFIG_MTD_SPLIT_SEAMA_FW is not set -CONFIG_MTD_SPLIT_SQUASHFS_ROOT=y -CONFIG_MTD_SPLIT_SUPPORT=y -# CONFIG_MTD_SPLIT_TPLINK_FW is not set -# CONFIG_MTD_SPLIT_TRX_FW is not set -# CONFIG_MTD_SPLIT_UIMAGE_FW is not set -# CONFIG_MTD_SPLIT_WRGG_FW is not set -# CONFIG_MTD_SST25L is not set -# CONFIG_MTD_SWAP is not set -# CONFIG_MTD_TESTS is not set -# CONFIG_MTD_UBI is not set -# CONFIG_MTD_UIMAGE_SPLIT is not set -CONFIG_MULTIUSER=y -# CONFIG_MUTEX_SPIN_ON_OWNER is not set -# CONFIG_MV643XX_ETH is not set -# CONFIG_MVMDIO is not set -# CONFIG_MVNETA_BM is not set -# CONFIG_MVSW61XX_PHY is not set -# CONFIG_MVSWITCH_PHY is not set -# CONFIG_MV_XOR_V2 is not set -# CONFIG_MWAVE is not set -# CONFIG_MWL8K is not set -# CONFIG_MXC4005 is not set -# CONFIG_MXC6255 is not set -# CONFIG_MYRI10GE is not set -# CONFIG_NAMESPACES is not set -# CONFIG_NATIONAL_PHY is not set -# CONFIG_NATSEMI is not set -# CONFIG_NAU7802 is not set -# CONFIG_NBPFAXI_DMA is not set -# CONFIG_NCP_FS is not set -# CONFIG_NE2000 is not set -# CONFIG_NE2K_PCI is not set -# CONFIG_NEC_MARKEINS is not set -CONFIG_NET=y -# CONFIG_NETCONSOLE is not set -CONFIG_NETDEVICES=y -# CONFIG_NETFILTER is not set -# CONFIG_NETFILTER_ADVANCED is not set -# CONFIG_NETFILTER_DEBUG is not set -# CONFIG_NETFILTER_INGRESS is not set -# CONFIG_NETFILTER_NETLINK is not set -# CONFIG_NETFILTER_NETLINK_ACCT is not set -# CONFIG_NETFILTER_NETLINK_GLUE_CT is not set -# CONFIG_NETFILTER_NETLINK_LOG is not set -# CONFIG_NETFILTER_NETLINK_QUEUE is not set -# CONFIG_NETFILTER_XTABLES is not set -# CONFIG_NETFILTER_XT_CONNMARK is not set -# CONFIG_NETFILTER_XT_MARK is not set -# 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 is not set -# 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 is not set -# CONFIG_NETFILTER_XT_MATCH_PHYSDEV is not set -# CONFIG_NETFILTER_XT_MATCH_PKTTYPE is not set -# CONFIG_NETFILTER_XT_MATCH_POLICY 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 is not set -# 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_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_CT 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_NOTRACK is not set -# CONFIG_NETFILTER_XT_TARGET_RATEEST is not set -# CONFIG_NETFILTER_XT_TARGET_REDIRECT is not set -# CONFIG_NETFILTER_XT_TARGET_TCPMSS is not set -# CONFIG_NETFILTER_XT_TARGET_TCPOPTSTRIP is not set -# CONFIG_NETFILTER_XT_TARGET_TEE is not set -# CONFIG_NETFILTER_XT_TARGET_TPROXY is not set -# CONFIG_NETFILTER_XT_TARGET_TRACE is not set -# CONFIG_NETLINK_DIAG is not set -# CONFIG_NETLINK_MMAP is not set -# CONFIG_NETPOLL is not set -# CONFIG_NETROM is not set -CONFIG_NETWORK_FILESYSTEMS=y -# CONFIG_NETWORK_PHY_TIMESTAMPING is not set -# CONFIG_NETWORK_SECMARK is not set -# CONFIG_NETXEN_NIC is not set -# CONFIG_NET_9P is not set -# CONFIG_NET_ACT_BPF is not set -# CONFIG_NET_ACT_CSUM is not set -# CONFIG_NET_ACT_GACT is not set -# CONFIG_NET_ACT_IFE is not set -# CONFIG_NET_ACT_IPT is not set -# CONFIG_NET_ACT_MIRRED is not set -# CONFIG_NET_ACT_NAT is not set -# CONFIG_NET_ACT_PEDIT is not set -# CONFIG_NET_ACT_POLICE is not set -# CONFIG_NET_ACT_SIMP is not set -# CONFIG_NET_ACT_SKBEDIT is not set -# CONFIG_NET_ACT_SKBMOD is not set -# CONFIG_NET_ACT_TUNNEL_KEY is not set -# CONFIG_NET_ACT_VLAN is not set -CONFIG_NET_CADENCE=y -# CONFIG_NET_CALXEDA_XGMAC is not set -CONFIG_NET_CLS=y -# CONFIG_NET_CLS_ACT is not set -# CONFIG_NET_CLS_BASIC is not set -# CONFIG_NET_CLS_BPF is not set -# CONFIG_NET_CLS_FLOW is not set -# CONFIG_NET_CLS_FLOWER is not set -# CONFIG_NET_CLS_FW is not set -CONFIG_NET_CLS_IND=y -# CONFIG_NET_CLS_MATCHALL is not set -# CONFIG_NET_CLS_ROUTE4 is not set -# CONFIG_NET_CLS_RSVP is not set -# CONFIG_NET_CLS_RSVP6 is not set -# CONFIG_NET_CLS_TCINDEX is not set -# CONFIG_NET_CLS_U32 is not set -CONFIG_NET_CORE=y -# CONFIG_NET_DEVLINK is not set -# CONFIG_NET_DROP_MONITOR is not set -# CONFIG_NET_DSA is not set -# CONFIG_NET_DSA_BCM_SF2 is not set -# CONFIG_NET_DSA_MV88E6060 is not set -# CONFIG_NET_DSA_MV88E6123_61_65 is not set -# CONFIG_NET_DSA_MV88E6131 is not set -# CONFIG_NET_DSA_MV88E6171 is not set -# CONFIG_NET_DSA_MV88E6352 is not set -# CONFIG_NET_DSA_MV88E6XXX is not set -# CONFIG_NET_DSA_MV88E6XXX_NEED_PPU is not set -# CONFIG_NET_DSA_QCA8K is not set -# CONFIG_NET_DSA_TAG_DSA is not set -# CONFIG_NET_DSA_TAG_EDSA is not set -# CONFIG_NET_EMATCH is not set -# CONFIG_NET_EMATCH_CANID is not set -# CONFIG_NET_EMATCH_CMP is not set -# CONFIG_NET_EMATCH_META is not set -# CONFIG_NET_EMATCH_NBYTE is not set -CONFIG_NET_EMATCH_STACK=32 -# CONFIG_NET_EMATCH_TEXT is not set -# CONFIG_NET_EMATCH_U32 is not set -# CONFIG_NET_FC is not set -# CONFIG_NET_FOU is not set -# CONFIG_NET_FOU_IP_TUNNELS is not set -# CONFIG_NET_IPGRE is not set -CONFIG_NET_IPGRE_BROADCAST=y -# CONFIG_NET_IPGRE_DEMUX is not set -# CONFIG_NET_IPIP is not set -# CONFIG_NET_IPVTI is not set -# CONFIG_NET_IP_TUNNEL is not set -# CONFIG_NET_KEY is not set -# CONFIG_NET_KEY_MIGRATE is not set -# CONFIG_NET_L3_MASTER_DEV is not set -# CONFIG_NET_MPLS_GSO is not set -# CONFIG_NET_NCSI is not set -# CONFIG_NET_PACKET_ENGINE is not set -# CONFIG_NET_PKTGEN is not set -# CONFIG_NET_POLL_CONTROLLER is not set -# CONFIG_NET_PTP_CLASSIFY is not set -CONFIG_NET_RX_BUSY_POLL=y -# CONFIG_NET_SB1000 is not set -CONFIG_NET_SCHED=y -# CONFIG_NET_SCH_ATM is not set -# CONFIG_NET_SCH_CBQ is not set -# CONFIG_NET_SCH_CHOKE is not set -# CONFIG_NET_SCH_CODEL is not set -# CONFIG_NET_SCH_DRR is not set -# CONFIG_NET_SCH_DSMARK is not set -CONFIG_NET_SCH_FIFO=y -# CONFIG_NET_SCH_FQ is not set -CONFIG_NET_SCH_FQ_CODEL=y -# CONFIG_NET_SCH_GRED is not set -# CONFIG_NET_SCH_HFSC is not set -# CONFIG_NET_SCH_HHF is not set -# CONFIG_NET_SCH_HTB is not set -# CONFIG_NET_SCH_INGRESS is not set -# CONFIG_NET_SCH_MQPRIO is not set -# CONFIG_NET_SCH_MULTIQ is not set -# CONFIG_NET_SCH_NETEM is not set -# CONFIG_NET_SCH_PIE is not set -# CONFIG_NET_SCH_PLUG is not set -# CONFIG_NET_SCH_PRIO is not set -# CONFIG_NET_SCH_QFQ is not set -# CONFIG_NET_SCH_RED is not set -# CONFIG_NET_SCH_SFB is not set -# CONFIG_NET_SCH_SFQ is not set -# CONFIG_NET_SCH_TBF is not set -# CONFIG_NET_SCH_TEQL is not set -# CONFIG_NET_SCTPPROBE is not set -# CONFIG_NET_SWITCHDEV is not set -# CONFIG_NET_TCPPROBE is not set -# CONFIG_NET_TEAM is not set -# CONFIG_NET_TULIP is not set -# CONFIG_NET_UDP_TUNNEL is not set -CONFIG_NET_VENDOR_3COM=y -CONFIG_NET_VENDOR_8390=y -CONFIG_NET_VENDOR_ADAPTEC=y -CONFIG_NET_VENDOR_AGERE=y -CONFIG_NET_VENDOR_ALTEON=y -CONFIG_NET_VENDOR_AMAZON=y -CONFIG_NET_VENDOR_AMD=y -CONFIG_NET_VENDOR_ARC=y -CONFIG_NET_VENDOR_ATHEROS=y -CONFIG_NET_VENDOR_AURORA=y -CONFIG_NET_VENDOR_BROADCOM=y -CONFIG_NET_VENDOR_BROCADE=y -CONFIG_NET_VENDOR_CAVIUM=y -CONFIG_NET_VENDOR_CHELSIO=y -CONFIG_NET_VENDOR_CIRRUS=y -CONFIG_NET_VENDOR_CISCO=y -CONFIG_NET_VENDOR_DEC=y -CONFIG_NET_VENDOR_DLINK=y -CONFIG_NET_VENDOR_EMULEX=y -CONFIG_NET_VENDOR_EXAR=y -CONFIG_NET_VENDOR_EZCHIP=y -CONFIG_NET_VENDOR_FARADAY=y -CONFIG_NET_VENDOR_FREESCALE=y -CONFIG_NET_VENDOR_FUJITSU=y -CONFIG_NET_VENDOR_HISILICON=y -CONFIG_NET_VENDOR_HP=y -CONFIG_NET_VENDOR_I825XX=y -CONFIG_NET_VENDOR_IBM=y -CONFIG_NET_VENDOR_INTEL=y -CONFIG_NET_VENDOR_MARVELL=y -CONFIG_NET_VENDOR_MELLANOX=y -CONFIG_NET_VENDOR_MICREL=y -CONFIG_NET_VENDOR_MICROCHIP=y -CONFIG_NET_VENDOR_MYRI=y -CONFIG_NET_VENDOR_NATSEMI=y -CONFIG_NET_VENDOR_NETRONOME=y -CONFIG_NET_VENDOR_NVIDIA=y -CONFIG_NET_VENDOR_OKI=y -CONFIG_NET_VENDOR_QLOGIC=y -CONFIG_NET_VENDOR_QUALCOMM=y -CONFIG_NET_VENDOR_RDC=y -CONFIG_NET_VENDOR_REALTEK=y -CONFIG_NET_VENDOR_RENESAS=y -CONFIG_NET_VENDOR_ROCKER=y -CONFIG_NET_VENDOR_SAMSUNG=y -CONFIG_NET_VENDOR_SEEQ=y -CONFIG_NET_VENDOR_SILAN=y -CONFIG_NET_VENDOR_SIS=y -CONFIG_NET_VENDOR_SMSC=y -CONFIG_NET_VENDOR_STMICRO=y -CONFIG_NET_VENDOR_SUN=y -CONFIG_NET_VENDOR_SYNOPSYS=y -CONFIG_NET_VENDOR_TEHUTI=y -CONFIG_NET_VENDOR_TI=y -CONFIG_NET_VENDOR_TOSHIBA=y -CONFIG_NET_VENDOR_VIA=y -CONFIG_NET_VENDOR_WIZNET=y -CONFIG_NET_VENDOR_XILINX=y -CONFIG_NET_VENDOR_XIRCOM=y -# CONFIG_NET_VRF is not set -# CONFIG_NET_XGENE is not set -CONFIG_NEW_LEDS=y -# CONFIG_NFC is not set -# CONFIG_NFP_NETVF is not set -# CONFIG_NFSD is not set -# CONFIG_NFSD_V2_ACL is not set -CONFIG_NFSD_V3=y -# CONFIG_NFSD_V3_ACL is not set -# CONFIG_NFSD_V4 is not set -# CONFIG_NFS_ACL_SUPPORT is not set -CONFIG_NFS_COMMON=y -# CONFIG_NFS_FS is not set -# CONFIG_NFS_FSCACHE is not set -# CONFIG_NFS_SWAP is not set -# CONFIG_NFS_V2 is not set -CONFIG_NFS_V3=y -# CONFIG_NFS_V3_ACL is not set -# CONFIG_NFS_V4 is not set -# CONFIG_NFS_V4_1 is not set -# CONFIG_NFTL is not set -# CONFIG_NFT_BRIDGE_META is not set -# CONFIG_NFT_BRIDGE_REJECT is not set -# CONFIG_NFT_DUP_IPV4 is not set -# CONFIG_NFT_DUP_IPV6 is not set -# CONFIG_NF_CONNTRACK is not set -# CONFIG_NF_CONNTRACK_AMANDA is not set -# CONFIG_NF_CONNTRACK_EVENTS is not set -# CONFIG_NF_CONNTRACK_FTP is not set -# CONFIG_NF_CONNTRACK_H323 is not set -# CONFIG_NF_CONNTRACK_IPV4 is not set -# CONFIG_NF_CONNTRACK_IPV6 is not set -# CONFIG_NF_CONNTRACK_IRC is not set -# CONFIG_NF_CONNTRACK_MARK is not set -# CONFIG_NF_CONNTRACK_NETBIOS_NS is not set -# CONFIG_NF_CONNTRACK_PPTP is not set -CONFIG_NF_CONNTRACK_PROCFS=y -# CONFIG_NF_CONNTRACK_PROC_COMPAT is not set -# CONFIG_NF_CONNTRACK_SANE is not set -# CONFIG_NF_CONNTRACK_SIP is not set -# CONFIG_NF_CONNTRACK_SNMP is not set -# CONFIG_NF_CONNTRACK_TFTP is not set -# CONFIG_NF_CONNTRACK_TIMEOUT is not set -# CONFIG_NF_CONNTRACK_TIMESTAMP is not set -# CONFIG_NF_CONNTRACK_ZONES is not set -# CONFIG_NF_CT_NETLINK is not set -# CONFIG_NF_CT_NETLINK_TIMEOUT is not set -# CONFIG_NF_CT_PROTO_DCCP is not set -# CONFIG_NF_CT_PROTO_GRE is not set -# CONFIG_NF_CT_PROTO_SCTP is not set -# CONFIG_NF_CT_PROTO_UDPLITE is not set -# CONFIG_NF_DEFRAG_IPV4 is not set -# CONFIG_NF_DUP_IPV4 is not set -# CONFIG_NF_DUP_IPV6 is not set -# CONFIG_NF_LOG_ARP is not set -# CONFIG_NF_LOG_IPV4 is not set -# CONFIG_NF_NAT is not set -# CONFIG_NF_NAT_AMANDA is not set -# CONFIG_NF_NAT_FTP is not set -# CONFIG_NF_NAT_H323 is not set -# CONFIG_NF_NAT_IPV6 is not set -# CONFIG_NF_NAT_IRC is not set -# CONFIG_NF_NAT_MASQUERADE_IPV4 is not set -# CONFIG_NF_NAT_MASQUERADE_IPV6 is not set -# CONFIG_NF_NAT_NEEDED is not set -# CONFIG_NF_NAT_PPTP is not set -# CONFIG_NF_NAT_PROTO_GRE is not set -# CONFIG_NF_NAT_SIP is not set -# CONFIG_NF_NAT_SNMP_BASIC is not set -# CONFIG_NF_NAT_TFTP is not set -# CONFIG_NF_REJECT_IPV4 is not set -# CONFIG_NF_REJECT_IPV6 is not set -# CONFIG_NF_TABLES is not set -# CONFIG_NF_TABLES_NETDEV is not set -# CONFIG_NI65 is not set -# CONFIG_NI903X_WDT is not set -# CONFIG_NILFS2_FS is not set -# CONFIG_NIU is not set -CONFIG_NLATTR=y -# CONFIG_NLMON is not set -# CONFIG_NLM_XLP_BOARD is not set -# CONFIG_NLM_XLR_BOARD is not set -# CONFIG_NLS is not set -# CONFIG_NLS_ASCII is not set -# CONFIG_NLS_CODEPAGE_1250 is not set -# CONFIG_NLS_CODEPAGE_1251 is not set -# CONFIG_NLS_CODEPAGE_437 is not set -# 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_874 is not set -# CONFIG_NLS_CODEPAGE_932 is not set -# CONFIG_NLS_CODEPAGE_936 is not set -# CONFIG_NLS_CODEPAGE_949 is not set -# CONFIG_NLS_CODEPAGE_950 is not set -CONFIG_NLS_DEFAULT="iso8859-1" -# CONFIG_NLS_ISO8859_1 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_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_8 is not set -# CONFIG_NLS_ISO8859_9 is not set -# CONFIG_NLS_KOI8_R is not set -# CONFIG_NLS_KOI8_U 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_ROMAN is not set -# CONFIG_NLS_MAC_ROMANIAN is not set -# CONFIG_NLS_MAC_TURKISH is not set -# CONFIG_NLS_UTF8 is not set -CONFIG_NMI_LOG_BUF_SHIFT=13 -# CONFIG_NOP_USB_XCEIV is not set -# CONFIG_NORTEL_HERMES is not set -# CONFIG_NOTIFIER_ERROR_INJECTION is not set -# CONFIG_NOZOMI is not set -# CONFIG_NO_BOOTMEM is not set -# CONFIG_NO_HZ is not set -# CONFIG_NO_HZ_FULL is not set -# CONFIG_NO_HZ_IDLE is not set -# CONFIG_NS83820 is not set -# CONFIG_NTB is not set -# CONFIG_NTFS_DEBUG is not set -# CONFIG_NTFS_FS is not set -# CONFIG_NTFS_RW is not set -# CONFIG_NTP_PPS is not set -# CONFIG_NVM is not set -# CONFIG_NVMEM is not set -# CONFIG_NVMEM_IMX_OCOTP is not set -# CONFIG_NVME_TARGET is not set -# CONFIG_NVRAM is not set -# CONFIG_NV_TCO is not set -# CONFIG_NXP_STB220 is not set -# CONFIG_NXP_STB225 is not set -# CONFIG_N_GSM is not set -# CONFIG_OABI_COMPAT is not set -# CONFIG_OBS600 is not set -# CONFIG_OCFS2_FS is not set -# CONFIG_OF_OVERLAY is not set -# CONFIG_OF_UNITTEST is not set -# CONFIG_OMAP2_DSS_DEBUG is not set -# CONFIG_OMAP2_DSS_DEBUGFS is not set -# CONFIG_OMAP2_DSS_SDI is not set -# CONFIG_OMAP_OCP2SCP is not set -# CONFIG_OMAP_USB2 is not set -# CONFIG_OMFS_FS is not set -# CONFIG_OPENVSWITCH is not set -# CONFIG_OPROFILE is not set -# CONFIG_OPROFILE_EVENT_MULTIPLEX is not set -# CONFIG_OPT3001 is not set -# CONFIG_OPTIMIZE_INLINING is not set -# CONFIG_ORANGEFS_FS is not set -# CONFIG_ORION_WATCHDOG is not set -# CONFIG_OSF_PARTITION is not set -CONFIG_OVERLAY_FS=y -# CONFIG_OWL_LOADER is not set -# CONFIG_P54_COMMON is not set -# CONFIG_PA12203001 is not set -CONFIG_PACKET=y -# CONFIG_PACKET_DIAG is not set -# CONFIG_PAGE_EXTENSION is not set -# CONFIG_PAGE_OWNER is not set -# CONFIG_PAGE_POISONING is not set -# CONFIG_PAGE_SIZE_16KB is not set -# CONFIG_PAGE_SIZE_32KB is not set -CONFIG_PAGE_SIZE_4KB=y -# CONFIG_PAGE_SIZE_64KB is not set -# CONFIG_PAGE_SIZE_8KB is not set -# CONFIG_PALMAS_GPADC is not set -# CONFIG_PANASONIC_LAPTOP is not set -# CONFIG_PANEL is not set -CONFIG_PANIC_ON_OOPS=y -CONFIG_PANIC_ON_OOPS_VALUE=1 -CONFIG_PANIC_TIMEOUT=1 -# CONFIG_PANTHERLORD_FF is not set -# CONFIG_PARAVIRT is not set -# CONFIG_PARAVIRT_TIME_ACCOUNTING is not set -# CONFIG_PARPORT is not set -# CONFIG_PARPORT_1284 is not set -# CONFIG_PARPORT_AX88796 is not set -# CONFIG_PARPORT_GSC is not set -# CONFIG_PARPORT_PC is not set -CONFIG_PARTITION_ADVANCED=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_CMD640_PCI is not set -# CONFIG_PATA_CMD64X is not set -# CONFIG_PATA_CS5520 is not set -# CONFIG_PATA_CS5530 is not set -# CONFIG_PATA_CS5535 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 -# CONFIG_PATA_HPT37X is not set -# CONFIG_PATA_HPT3X2N is not set -# CONFIG_PATA_HPT3X3 is not set -# CONFIG_PATA_IMX is not set -# CONFIG_PATA_ISAPNP is not set -# CONFIG_PATA_IT8213 is not set -# CONFIG_PATA_IT821X is not set -# CONFIG_PATA_JMICRON is not set -# CONFIG_PATA_LEGACY is not set -# CONFIG_PATA_MARVELL is not set -# CONFIG_PATA_MPIIX is not set -# CONFIG_PATA_NETCELL is not set -# CONFIG_PATA_NINJA32 is not set -# CONFIG_PATA_NS87410 is not set -# CONFIG_PATA_NS87415 is not set -# CONFIG_PATA_OCTEON_CF is not set -# CONFIG_PATA_OF_PLATFORM is not set -# CONFIG_PATA_OLDPIIX is not set -# CONFIG_PATA_OPTI is not set -# CONFIG_PATA_OPTIDMA is not set -# CONFIG_PATA_PCMCIA is not set -# CONFIG_PATA_PDC2027X is not set -# CONFIG_PATA_PDC_OLD is not set -# CONFIG_PATA_PLATFORM is not set -# CONFIG_PATA_QDI is not set -# CONFIG_PATA_RADISYS is not set -# CONFIG_PATA_RDC is not set -# CONFIG_PATA_RZ1000 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 -# 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 -# CONFIG_PATA_WINBOND_VLB is not set -# CONFIG_PC300TOO is not set -# CONFIG_PCCARD is not set -# CONFIG_PCH_DMA is not set -# CONFIG_PCH_GBE is not set -# CONFIG_PCH_PHUB is not set -# CONFIG_PCI is not set -# CONFIG_PCI200SYN is not set -# CONFIG_PCIEAER_INJECT is not set -# CONFIG_PCIEASPM is not set -# CONFIG_PCIEPORTBUS is not set -# CONFIG_PCIE_ALTERA is not set -# CONFIG_PCIE_ARMADA_8K is not set -# CONFIG_PCIE_DPC is not set -# CONFIG_PCIE_DW_PLAT is not set -# CONFIG_PCIE_ECRC is not set -# CONFIG_PCIE_IPROC is not set -# CONFIG_PCIE_PTM is not set -# CONFIG_PCIPCWATCHDOG is not set -# CONFIG_PCI_ATMEL is not set -# CONFIG_PCI_CNB20LE_QUIRK is not set -# CONFIG_PCI_DEBUG is not set -# CONFIG_PCI_DISABLE_COMMON_QUIRKS is not set -# CONFIG_PCI_HERMES is not set -# CONFIG_PCI_HOST_GENERIC is not set -# CONFIG_PCI_HOST_THUNDER_ECAM is not set -# CONFIG_PCI_HOST_THUNDER_PEM is not set -# CONFIG_PCI_IOV is not set -# CONFIG_PCI_LAYERSCAPE is not set -# CONFIG_PCI_MSI is not set -# CONFIG_PCI_PASID is not set -# CONFIG_PCI_PRI is not set -CONFIG_PCI_QUIRKS=y -# CONFIG_PCI_REALLOC_ENABLE_AUTO is not set -# CONFIG_PCI_STUB is not set -CONFIG_PCI_SYSCALL=y -# CONFIG_PCMCIA is not set -# CONFIG_PCMCIA_3C574 is not set -# CONFIG_PCMCIA_3C589 is not set -# CONFIG_PCMCIA_AHA152X is not set -# CONFIG_PCMCIA_ATMEL is not set -# CONFIG_PCMCIA_AXNET is not set -# CONFIG_PCMCIA_DEBUG is not set -# CONFIG_PCMCIA_FDOMAIN is not set -# CONFIG_PCMCIA_FMVJ18X is not set -# CONFIG_PCMCIA_HERMES is not set -# CONFIG_PCMCIA_LOAD_CIS is not set -# CONFIG_PCMCIA_NINJA_SCSI is not set -# CONFIG_PCMCIA_NMCLAN is not set -# CONFIG_PCMCIA_PCNET is not set -# CONFIG_PCMCIA_QLOGIC is not set -# CONFIG_PCMCIA_RAYCS is not set -# CONFIG_PCMCIA_SMC91C92 is not set -# CONFIG_PCMCIA_SPECTRUM is not set -# CONFIG_PCMCIA_SYM53C500 is not set -# CONFIG_PCMCIA_WL3501 is not set -# CONFIG_PCMCIA_XIRC2PS is not set -# CONFIG_PCMCIA_XIRCOM is not set -# CONFIG_PCNET32 is not set -# CONFIG_PCSPKR_PLATFORM is not set -# CONFIG_PD6729 is not set -# CONFIG_PDA_POWER is not set -# CONFIG_PDC_ADMA is not set -# CONFIG_PERCPU_TEST is not set -# CONFIG_PERF_EVENTS is not set -# CONFIG_PERF_EVENTS_AMD_POWER is not set -# CONFIG_PERSISTENT_KEYRINGS is not set -# CONFIG_PHANTOM is not set -# CONFIG_PHONET is not set -# CONFIG_PHYLIB is not set -# CONFIG_PHYS_ADDR_T_64BIT is not set -# CONFIG_PHY_EXYNOS_DP_VIDEO is not set -# CONFIG_PHY_EXYNOS_MIPI_VIDEO is not set -# CONFIG_PHY_PXA_28NM_HSIC is not set -# CONFIG_PHY_PXA_28NM_USB2 is not set -# CONFIG_PHY_QCOM_DWC3 is not set -# CONFIG_PHY_SAMSUNG_USB2 is not set -# CONFIG_PID_IN_CONTEXTIDR is not set -# CONFIG_PID_NS is not set -CONFIG_PINCONF=y -# CONFIG_PINCTRL is not set -# CONFIG_PINCTRL_AMD is not set -# CONFIG_PINCTRL_EXYNOS is not set -# CONFIG_PINCTRL_EXYNOS5440 is not set -# CONFIG_PINCTRL_MSM8X74 is not set -CONFIG_PINCTRL_SINGLE=y -CONFIG_PINMUX=y -# CONFIG_PKCS7_MESSAGE_PARSER is not set -# CONFIG_PL320_MBOX is not set -# CONFIG_PL330_DMA is not set -# CONFIG_PLATFORM_MHU is not set -# CONFIG_PLAT_SPEAR is not set -# CONFIG_PLIP is not set -# CONFIG_PLX_HERMES is not set -# CONFIG_PM is not set -# CONFIG_PMBUS is not set -# CONFIG_PMC_MSP is not set -# CONFIG_PMIC_ADP5520 is not set -# CONFIG_PMIC_DA903X is not set -# CONFIG_PM_AUTOSLEEP is not set -# CONFIG_PM_DEVFREQ is not set -# CONFIG_PM_WAKELOCKS is not set -# CONFIG_POSIX_MQUEUE is not set -# CONFIG_POWERCAP is not set -# CONFIG_POWER_AVS is not set -# CONFIG_POWER_RESET is not set -# CONFIG_POWER_RESET_BRCMKONA is not set -# CONFIG_POWER_RESET_BRCMSTB is not set -# CONFIG_POWER_RESET_GPIO is not set -# CONFIG_POWER_RESET_GPIO_RESTART is not set -# CONFIG_POWER_RESET_LTC2952 is not set -# CONFIG_POWER_RESET_RESTART is not set -# CONFIG_POWER_RESET_SYSCON is not set -# CONFIG_POWER_RESET_SYSCON_POWEROFF is not set -# CONFIG_POWER_RESET_VERSATILE is not set -# CONFIG_POWER_RESET_XGENE is not set -# CONFIG_POWER_SUPPLY is not set -# CONFIG_POWER_SUPPLY_DEBUG is not set -# CONFIG_PPC4xx_GPIO is not set -# CONFIG_PPC_16K_PAGES is not set -# CONFIG_PPC_256K_PAGES is not set -CONFIG_PPC_4K_PAGES=y -# CONFIG_PPC_64K_PAGES is not set -# CONFIG_PPC_DISABLE_WERROR is not set -# CONFIG_PPC_EMULATED_STATS is not set -# CONFIG_PPC_EPAPR_HV_BYTECHAN is not set -# CONFIG_PPP is not set -# CONFIG_PPPOATM is not set -# CONFIG_PPPOE is not set -# CONFIG_PPPOL2TP is not set -# CONFIG_PPP_ASYNC is not set -# CONFIG_PPP_BSDCOMP is not set -# CONFIG_PPP_DEFLATE is not set -CONFIG_PPP_FILTER=y -# CONFIG_PPP_MPPE is not set -CONFIG_PPP_MULTILINK=y -# CONFIG_PPP_SYNC_TTY is not set -# CONFIG_PPS is not set -# CONFIG_PPS_CLIENT_GPIO is not set -# CONFIG_PPS_CLIENT_KTIMER is not set -# CONFIG_PPS_CLIENT_LDISC is not set -# CONFIG_PPS_CLIENT_PARPORT is not set -# CONFIG_PPS_DEBUG is not set -# CONFIG_PPTP is not set -# CONFIG_PREEMPT is not set -CONFIG_PREEMPT_NONE=y -# CONFIG_PREEMPT_TRACER is not set -# CONFIG_PREEMPT_VOLUNTARY is not set -CONFIG_PREVENT_FIRMWARE_BUILD=y -CONFIG_PRINTK=y -CONFIG_PRINTK_NMI=y -# CONFIG_PRINTK_TIME is not set -CONFIG_PRINT_STACK_DEPTH=64 -# CONFIG_PRISM2_USB is not set -# CONFIG_PRISM54 is not set -# CONFIG_PROC_CHILDREN is not set -CONFIG_PROC_FS=y -# CONFIG_PROC_KCORE is not set -# CONFIG_PROC_PAGE_MONITOR is not set -CONFIG_PROC_STRIPPED=y -CONFIG_PROC_SYSCTL=y -# CONFIG_PROFILE_ALL_BRANCHES is not set -# CONFIG_PROFILE_ANNOTATED_BRANCHES is not set -# CONFIG_PROFILING is not set -# CONFIG_PROVE_LOCKING is not set -# CONFIG_PROVE_RCU is not set -# CONFIG_PROVE_RCU_REPEATEDLY is not set -# CONFIG_PSB6970_PHY is not set -# CONFIG_PSTORE is not set -# CONFIG_PTP_1588_CLOCK is not set -# CONFIG_PTP_1588_CLOCK_IXP46X is not set -# CONFIG_PTP_1588_CLOCK_PCH is not set -# CONFIG_PUBLIC_KEY_ALGO_RSA is not set -# CONFIG_PWM is not set -# CONFIG_PWM_FSL_FTM is not set -# CONFIG_PWM_PCA9685 is not set -CONFIG_PWRSEQ_EMMC=y -CONFIG_PWRSEQ_SIMPLE=y -# CONFIG_QCA7000 is not set -# CONFIG_QCOM_EMAC is not set -# CONFIG_QCOM_HIDMA is not set -# CONFIG_QCOM_HIDMA_MGMT is not set -# CONFIG_QCOM_QDF2400_ERRATUM_0065 is not set -# CONFIG_QCOM_SPMI_IADC is not set -# CONFIG_QCOM_SPMI_TEMP_ALARM is not set -# CONFIG_QCOM_SPMI_VADC is not set -# CONFIG_QED is not set -# CONFIG_QLA3XXX is not set -# CONFIG_QLCNIC is not set -# CONFIG_QLGE is not set -# CONFIG_QNX4FS_FS is not set -# CONFIG_QNX6FS_FS is not set -# CONFIG_QORIQ_CPUFREQ is not set -# CONFIG_QORIQ_THERMAL is not set -# CONFIG_QSEMI_PHY is not set -# CONFIG_QUEUED_LOCK_STAT is not set -# CONFIG_QUOTA is not set -# CONFIG_QUOTACTL is not set -# CONFIG_QUOTA_DEBUG is not set -# CONFIG_R3964 is not set -# CONFIG_R6040 is not set -# CONFIG_R8169 is not set -# CONFIG_R8188EU is not set -# CONFIG_R8712U is not set -# CONFIG_R8723AU is not set -# CONFIG_RADIO_ADAPTERS is not set -# CONFIG_RADIO_AZTECH is not set -# CONFIG_RADIO_CADET is not set -# CONFIG_RADIO_GEMTEK is not set -# CONFIG_RADIO_MAXIRADIO is not set -# CONFIG_RADIO_RTRACK is not set -# CONFIG_RADIO_RTRACK2 is not set -# CONFIG_RADIO_SF16FMI is not set -# CONFIG_RADIO_SF16FMR2 is not set -# CONFIG_RADIO_TERRATEC is not set -# CONFIG_RADIO_TRUST is not set -# CONFIG_RADIO_TYPHOON is not set -# CONFIG_RADIO_ZOLTRIX is not set -# CONFIG_RAID_ATTRS is not set -# CONFIG_RALINK is not set -# CONFIG_RANDOM32_SELFTEST is not set -# CONFIG_RAPIDIO is not set -# CONFIG_RAS is not set -# CONFIG_RAW_DRIVER is not set -# CONFIG_RBTREE_TEST is not set -CONFIG_RCU_CPU_STALL_TIMEOUT=60 -# CONFIG_RCU_EQS_DEBUG is not set -# CONFIG_RCU_EXPEDITE_BOOT is not set -CONFIG_RCU_EXPERT=y -CONFIG_RCU_FANOUT=32 -CONFIG_RCU_FANOUT_LEAF=16 -# CONFIG_RCU_FAST_NO_HZ is not set -CONFIG_RCU_KTHREAD_PRIO=0 -# CONFIG_RCU_NOCB_CPU is not set -# CONFIG_RCU_PERF_TEST is not set -# CONFIG_RCU_TORTURE_TEST is not set -CONFIG_RCU_TORTURE_TEST_SLOW_INIT_DELAY=3 -# CONFIG_RCU_TRACE is not set -# CONFIG_RC_ATI_REMOTE is not set -# CONFIG_RC_CORE is not set -# CONFIG_RC_DECODERS is not set -# CONFIG_RC_LOOPBACK is not set -# CONFIG_RC_MAP is not set -# CONFIG_RDS is not set -# CONFIG_RD_BZIP2 is not set -# CONFIG_RD_GZIP is not set -# CONFIG_RD_LZ4 is not set -# CONFIG_RD_LZMA is not set -# CONFIG_RD_LZO is not set -# CONFIG_RD_XZ is not set -# CONFIG_READABLE_ASM is not set -# CONFIG_REALTEK_PHY is not set -# CONFIG_REDWOOD is not set -# CONFIG_REGMAP is not set -# CONFIG_REGMAP_I2C is not set -# CONFIG_REGMAP_MMIO is not set -# CONFIG_REGMAP_SPI is not set -# CONFIG_REGULATOR is not set -# CONFIG_REGULATOR_ACT8865 is not set -# CONFIG_REGULATOR_AD5398 is not set -# CONFIG_REGULATOR_ANATOP is not set -# CONFIG_REGULATOR_DA9210 is not set -# CONFIG_REGULATOR_DA9211 is not set -# CONFIG_REGULATOR_DEBUG is not set -# CONFIG_REGULATOR_FAN53555 is not set -# CONFIG_REGULATOR_FIXED_VOLTAGE is not set -# CONFIG_REGULATOR_GPIO is not set -# CONFIG_REGULATOR_ISL6271A is not set -# CONFIG_REGULATOR_ISL9305 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_MT6311 is not set -# CONFIG_REGULATOR_PFUZE100 is not set -# CONFIG_REGULATOR_PV88060 is not set -# CONFIG_REGULATOR_PV88080 is not set -# CONFIG_REGULATOR_PV88090 is not set -# CONFIG_REGULATOR_PWM is not set -# CONFIG_REGULATOR_TI_ABB 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_USERSPACE_CONSUMER is not set -# CONFIG_REGULATOR_VIRTUAL_CONSUMER is not set -# CONFIG_REISERFS_CHECK is not set -# CONFIG_REISERFS_FS is not set -# CONFIG_REISERFS_FS_POSIX_ACL is not set -# CONFIG_REISERFS_FS_SECURITY is not set -# CONFIG_REISERFS_FS_XATTR is not set -# CONFIG_REISERFS_PROC_INFO is not set -# CONFIG_RELAY is not set -# CONFIG_RELOCATABLE is not set -# CONFIG_RESET_ATH79 is not set -# CONFIG_RESET_BERLIN is not set -# CONFIG_RESET_CONTROLLER is not set -# CONFIG_RESET_LPC18XX is not set -# CONFIG_RESET_MESON is not set -# CONFIG_RESET_PISTACHIO is not set -# CONFIG_RESET_SOCFPGA is not set -# CONFIG_RESET_STM32 is not set -# CONFIG_RESET_SUNXI is not set -# CONFIG_RESET_ZYNQ is not set -# CONFIG_RFD_FTL is not set -CONFIG_RFKILL=y -# CONFIG_RFKILL_FULL is not set -# CONFIG_RFKILL_GPIO is not set -# CONFIG_RFKILL_INPUT is not set -# CONFIG_RFKILL_LEDS is not set -# CONFIG_RFKILL_REGULATOR is not set -# CONFIG_RING_BUFFER_BENCHMARK is not set -# CONFIG_RING_BUFFER_STARTUP_TEST is not set -# CONFIG_RMI4_CORE is not set -# CONFIG_ROCKER is not set -# CONFIG_ROMFS_FS is not set -# CONFIG_ROSE is not set -# CONFIG_RPCSEC_GSS_KRB5 is not set -# CONFIG_RPR0521 is not set -# CONFIG_RT2X00 is not set -# CONFIG_RTC_CLASS is not set -# CONFIG_RTC_DEBUG is not set -# CONFIG_RTC_DRV_ABB5ZES3 is not set -# CONFIG_RTC_DRV_ABX80X is not set -# CONFIG_RTC_DRV_ARMADA38X is not set -# CONFIG_RTC_DRV_AU1XXX is not set -# CONFIG_RTC_DRV_BQ32K is not set -# CONFIG_RTC_DRV_BQ4802 is not set -CONFIG_RTC_DRV_CMOS=y -# CONFIG_RTC_DRV_DS1286 is not set -# CONFIG_RTC_DRV_DS1302 is not set -# CONFIG_RTC_DRV_DS1305 is not set -# CONFIG_RTC_DRV_DS1307 is not set -# CONFIG_RTC_DRV_DS1307_CENTURY is not set -# CONFIG_RTC_DRV_DS1307_HWMON is not set -# CONFIG_RTC_DRV_DS1343 is not set -# CONFIG_RTC_DRV_DS1347 is not set -# CONFIG_RTC_DRV_DS1374 is not set -# CONFIG_RTC_DRV_DS1390 is not set -# CONFIG_RTC_DRV_DS1511 is not set -# CONFIG_RTC_DRV_DS1553 is not set -# CONFIG_RTC_DRV_DS1672 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_DS3232 is not set -# CONFIG_RTC_DRV_DS3234 is not set -# CONFIG_RTC_DRV_EM3027 is not set -# CONFIG_RTC_DRV_EP93XX is not set -# CONFIG_RTC_DRV_FM3130 is not set -# CONFIG_RTC_DRV_GENERIC is not set -# CONFIG_RTC_DRV_HID_SENSOR_TIME is not set -# CONFIG_RTC_DRV_HYM8563 is not set -# CONFIG_RTC_DRV_ISL12022 is not set -# CONFIG_RTC_DRV_ISL12057 is not set -# CONFIG_RTC_DRV_ISL1208 is not set -# CONFIG_RTC_DRV_M41T80 is not set -# CONFIG_RTC_DRV_M41T93 is not set -# CONFIG_RTC_DRV_M41T94 is not set -# CONFIG_RTC_DRV_M48T35 is not set -# CONFIG_RTC_DRV_M48T59 is not set -# CONFIG_RTC_DRV_M48T86 is not set -# CONFIG_RTC_DRV_MAX6900 is not set -# CONFIG_RTC_DRV_MAX6902 is not set -# CONFIG_RTC_DRV_MAX6916 is not set -# CONFIG_RTC_DRV_MCP795 is not set -# CONFIG_RTC_DRV_MOXART is not set -# CONFIG_RTC_DRV_MPC5121 is not set -# CONFIG_RTC_DRV_MSM6242 is not set -# CONFIG_RTC_DRV_OMAP is not set -# CONFIG_RTC_DRV_PCF2123 is not set -# CONFIG_RTC_DRV_PCF2127 is not set -# CONFIG_RTC_DRV_PCF85063 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_PL030 is not set -# CONFIG_RTC_DRV_PL031 is not set -# CONFIG_RTC_DRV_PS3 is not set -# CONFIG_RTC_DRV_PT7C4338 is not set -# CONFIG_RTC_DRV_R9701 is not set -# CONFIG_RTC_DRV_RP5C01 is not set -# CONFIG_RTC_DRV_RS5C348 is not set -# CONFIG_RTC_DRV_RS5C372 is not set -# CONFIG_RTC_DRV_RTC7301 is not set -# CONFIG_RTC_DRV_RV3029C2 is not set -# CONFIG_RTC_DRV_RV8803 is not set -# CONFIG_RTC_DRV_RX4581 is not set -# CONFIG_RTC_DRV_RX6110 is not set -# CONFIG_RTC_DRV_RX8010 is not set -# CONFIG_RTC_DRV_RX8025 is not set -# CONFIG_RTC_DRV_RX8581 is not set -# CONFIG_RTC_DRV_S35390A is not set -# CONFIG_RTC_DRV_SNVS is not set -# CONFIG_RTC_DRV_STK17TA8 is not set -# CONFIG_RTC_DRV_SUN6I is not set -# CONFIG_RTC_DRV_TEST is not set -# CONFIG_RTC_DRV_V3020 is not set -# CONFIG_RTC_DRV_X1205 is not set -# CONFIG_RTC_DRV_XGENE is not set -# CONFIG_RTC_DRV_ZYNQMP is not set -CONFIG_RTC_HCTOSYS=y -CONFIG_RTC_HCTOSYS_DEVICE="rtc0" -CONFIG_RTC_INTF_DEV=y -# CONFIG_RTC_INTF_DEV_UIE_EMUL is not set -CONFIG_RTC_INTF_PROC=y -CONFIG_RTC_INTF_SYSFS=y -CONFIG_RTC_LIB=y -CONFIG_RTC_SYSTOHC=y -CONFIG_RTC_SYSTOHC_DEVICE="rtc0" -# CONFIG_RTL8180 is not set -# CONFIG_RTL8187 is not set -# CONFIG_RTL8192E is not set -# CONFIG_RTL8192U is not set -# CONFIG_RTL8306_PHY is not set -# CONFIG_RTL8366RB_PHY is not set -# CONFIG_RTL8366S_PHY is not set -# CONFIG_RTL8366_SMI is not set -# CONFIG_RTL8366_SMI_DEBUG_FS is not set -# CONFIG_RTL8367B_PHY is not set -# CONFIG_RTL8367_PHY is not set -# CONFIG_RTLLIB is not set -# CONFIG_RTL_CARDS is not set -# CONFIG_RTS5208 is not set -CONFIG_RT_MUTEXES=y -# CONFIG_RUNTIME_DEBUG is not set -CONFIG_RWSEM_GENERIC_SPINLOCK=y -CONFIG_RXKAD=y -# CONFIG_S2IO is not set -# CONFIG_SAMPLES is not set -# CONFIG_SAMSUNG_LAPTOP is not set -# CONFIG_SATA_ACARD_AHCI is not set -# CONFIG_SATA_AHCI is not set -# CONFIG_SATA_AHCI_PLATFORM is not set -# CONFIG_SATA_DWC is not set -# CONFIG_SATA_FSL is not set -# CONFIG_SATA_HIGHBANK is not set -# CONFIG_SATA_INIC162X is not set -# CONFIG_SATA_MV is not set -# CONFIG_SATA_NV is not set -# CONFIG_SATA_PMP is not set -# CONFIG_SATA_PROMISE is not set -# CONFIG_SATA_QSTOR is not set -# CONFIG_SATA_RCAR is not set -# CONFIG_SATA_SIL is not set -# CONFIG_SATA_SIL24 is not set -# CONFIG_SATA_SIS is not set -# CONFIG_SATA_SVW is not set -# CONFIG_SATA_SX4 is not set -# CONFIG_SATA_ULI is not set -# CONFIG_SATA_VIA is not set -# CONFIG_SATA_VITESSE is not set -# CONFIG_SBC_FITPC2_WATCHDOG is not set -CONFIG_SBITMAP=y -# CONFIG_SC92031 is not set -# CONFIG_SCA3000 is not set -# CONFIG_SCACHE_DEBUGFS is not set -# CONFIG_SCC is not set -# CONFIG_SCHEDSTATS is not set -# CONFIG_SCHED_AUTOGROUP is not set -# CONFIG_SCHED_DEBUG is not set -CONFIG_SCHED_HRTICK=y -# CONFIG_SCHED_MC is not set -CONFIG_SCHED_OMIT_FRAME_POINTER=y -# CONFIG_SCHED_SMT is not set -# CONFIG_SCHED_STACK_END_CHECK is not set -# CONFIG_SCHED_TRACER is not set -# CONFIG_SCSI is not set -# CONFIG_SCSI_3W_9XXX is not set -# CONFIG_SCSI_3W_SAS is not set -# CONFIG_SCSI_7000FASST is not set -# CONFIG_SCSI_AACRAID is not set -# CONFIG_SCSI_ACARD is not set -# CONFIG_SCSI_ADVANSYS is not set -# CONFIG_SCSI_AHA152X is not set -# CONFIG_SCSI_AHA1542 is not set -# CONFIG_SCSI_AIC79XX is not set -# CONFIG_SCSI_AIC7XXX is not set -# CONFIG_SCSI_AIC94XX is not set -# CONFIG_SCSI_AM53C974 is not set -# CONFIG_SCSI_ARCMSR is not set -# CONFIG_SCSI_BFA_FC is not set -# CONFIG_SCSI_BNX2X_FCOE is not set -# CONFIG_SCSI_BNX2_ISCSI is not set -# CONFIG_SCSI_BUSLOGIC is not set -# CONFIG_SCSI_CHELSIO_FCOE is not set -# CONFIG_SCSI_CONSTANTS is not set -# CONFIG_SCSI_CXGB3_ISCSI is not set -# CONFIG_SCSI_CXGB4_ISCSI is not set -# CONFIG_SCSI_DC395x is not set -# CONFIG_SCSI_DEBUG is not set -# CONFIG_SCSI_DH is not set -CONFIG_SCSI_DMA=y -# CONFIG_SCSI_DMX3191D is not set -# CONFIG_SCSI_DPT_I2O is not set -# CONFIG_SCSI_DTC3280 is not set -# CONFIG_SCSI_EATA is not set -# CONFIG_SCSI_ESAS2R is not set -# CONFIG_SCSI_FC_ATTRS is not set -# CONFIG_SCSI_FUTURE_DOMAIN is not set -# CONFIG_SCSI_GDTH is not set -# CONFIG_SCSI_GENERIC_NCR5380 is not set -# CONFIG_SCSI_GENERIC_NCR5380_MMIO is not set -# CONFIG_SCSI_HISI_SAS is not set -# CONFIG_SCSI_HPSA is not set -# CONFIG_SCSI_HPTIOP is not set -# CONFIG_SCSI_IN2000 is not set -# CONFIG_SCSI_INIA100 is not set -# CONFIG_SCSI_INITIO is not set -# CONFIG_SCSI_IPR is not set -# CONFIG_SCSI_IPS is not set -# CONFIG_SCSI_ISCI is not set -# CONFIG_SCSI_ISCSI_ATTRS is not set -# CONFIG_SCSI_LOGGING is not set -CONFIG_SCSI_LOWLEVEL=y -# CONFIG_SCSI_LOWLEVEL_PCMCIA is not set -# CONFIG_SCSI_LPFC is not set -CONFIG_SCSI_MOD=y -# CONFIG_SCSI_MPT2SAS is not set -# CONFIG_SCSI_MPT3SAS is not set -# CONFIG_SCSI_MQ_DEFAULT is not set -# CONFIG_SCSI_MVSAS is not set -# CONFIG_SCSI_MVSAS_DEBUG is not set -# CONFIG_SCSI_MVUMI is not set -# CONFIG_SCSI_NCR53C406A is not set -# CONFIG_SCSI_NETLINK is not set -# CONFIG_SCSI_NSP32 is not set -# CONFIG_SCSI_OSD_INITIATOR is not set -# CONFIG_SCSI_PAS16 is not set -# CONFIG_SCSI_PM8001 is not set -# CONFIG_SCSI_PMCRAID is not set -CONFIG_SCSI_PROC_FS=y -# CONFIG_SCSI_QLA_FC is not set -# CONFIG_SCSI_QLA_ISCSI is not set -# CONFIG_SCSI_QLOGIC_1280 is not set -# CONFIG_SCSI_QLOGIC_FAS is not set -# CONFIG_SCSI_SAS_ATTRS is not set -# CONFIG_SCSI_SAS_LIBSAS is not set -# CONFIG_SCSI_SCAN_ASYNC is not set -# CONFIG_SCSI_SMARTPQI is not set -# CONFIG_SCSI_SNIC is not set -# CONFIG_SCSI_SPI_ATTRS is not set -# CONFIG_SCSI_SRP_ATTRS is not set -# CONFIG_SCSI_STEX is not set -# CONFIG_SCSI_SYM53C416 is not set -# CONFIG_SCSI_SYM53C8XX_2 is not set -# CONFIG_SCSI_T128 is not set -# CONFIG_SCSI_U14_34F is not set -# CONFIG_SCSI_UFSHCD is not set -# CONFIG_SCSI_ULTRASTOR is not set -# CONFIG_SCSI_VIRTIO is not set -# CONFIG_SCSI_WD719X is not set -# CONFIG_SCx200_ACB is not set -# CONFIG_SDIO_UART is not set -# CONFIG_SECCOMP is not set -CONFIG_SECTION_MISMATCH_WARN_ONLY=y -# CONFIG_SECURITY is not set -# CONFIG_SECURITYFS is not set -CONFIG_SECURITY_DMESG_RESTRICT=y -CONFIG_SELECT_MEMORY_MODEL=y -# CONFIG_SENSORS_ABITUGURU is not set -# CONFIG_SENSORS_ABITUGURU3 is not set -# CONFIG_SENSORS_ACPI_POWER is not set -# CONFIG_SENSORS_AD7314 is not set -# CONFIG_SENSORS_AD7414 is not set -# CONFIG_SENSORS_AD7418 is not set -# CONFIG_SENSORS_ADC128D818 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_ADM1275 is not set -# CONFIG_SENSORS_ADM9240 is not set -# CONFIG_SENSORS_ADS1015 is not set -# CONFIG_SENSORS_ADS7828 is not set -# CONFIG_SENSORS_ADS7871 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_AMC6821 is not set -# CONFIG_SENSORS_APDS990X is not set -# CONFIG_SENSORS_APPLESMC is not set -# CONFIG_SENSORS_ASB100 is not set -# CONFIG_SENSORS_ASC7621 is not set -# CONFIG_SENSORS_ATK0110 is not set -# CONFIG_SENSORS_ATXP1 is not set -# CONFIG_SENSORS_BH1770 is not set -# CONFIG_SENSORS_BH1780 is not set -# CONFIG_SENSORS_CORETEMP is not set -# CONFIG_SENSORS_DELL_SMM is not set -# CONFIG_SENSORS_DME1737 is not set -# CONFIG_SENSORS_DS1621 is not set -# CONFIG_SENSORS_DS620 is not set -# CONFIG_SENSORS_EMC1403 is not set -# CONFIG_SENSORS_EMC2103 is not set -# CONFIG_SENSORS_EMC6W201 is not set -# CONFIG_SENSORS_F71805F is not set -# CONFIG_SENSORS_F71882FG is not set -# CONFIG_SENSORS_F75375S is not set -# CONFIG_SENSORS_FAM15H_POWER is not set -# CONFIG_SENSORS_FSCHMD is not set -# CONFIG_SENSORS_FTSTEUTATES 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_GSC is not set -# CONFIG_SENSORS_HDAPS is not set -# CONFIG_SENSORS_HIH6130 is not set -# CONFIG_SENSORS_HMC5843 is not set -# CONFIG_SENSORS_HMC5843_I2C is not set -# CONFIG_SENSORS_HMC5843_SPI is not set -# CONFIG_SENSORS_HTU21 is not set -# CONFIG_SENSORS_I5500 is not set -# CONFIG_SENSORS_I5K_AMB is not set -# CONFIG_SENSORS_IIO_HWMON is not set -# CONFIG_SENSORS_INA209 is not set -# CONFIG_SENSORS_INA2XX is not set -# CONFIG_SENSORS_INA3221 is not set -# CONFIG_SENSORS_ISL29018 is not set -# CONFIG_SENSORS_ISL29028 is not set -# CONFIG_SENSORS_IT87 is not set -# CONFIG_SENSORS_JC42 is not set -# CONFIG_SENSORS_K10TEMP is not set -# CONFIG_SENSORS_K8TEMP is not set -# CONFIG_SENSORS_LINEAGE is not set -# CONFIG_SENSORS_LIS3LV02D is not set -# CONFIG_SENSORS_LIS3_I2C is not set -# CONFIG_SENSORS_LIS3_SPI is not set -# CONFIG_SENSORS_LM25066 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_LTC2945 is not set -# CONFIG_SENSORS_LTC2978 is not set -# CONFIG_SENSORS_LTC2990 is not set -# CONFIG_SENSORS_LTC3815 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_MAX16064 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_MAX20751 is not set -# CONFIG_SENSORS_MAX31722 is not set -# CONFIG_SENSORS_MAX31790 is not set -# CONFIG_SENSORS_MAX34440 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_MAX8688 is not set -# CONFIG_SENSORS_MCP3021 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_NSA320 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_SENSORS_PMBUS is not set -# CONFIG_SENSORS_POWR1220 is not set -# CONFIG_SENSORS_PWM_FAN is not set -# CONFIG_SENSORS_SCH5627 is not set -# CONFIG_SENSORS_SCH5636 is not set -# CONFIG_SENSORS_SCH56XX_COMMON is not set -# CONFIG_SENSORS_SHT15 is not set -# CONFIG_SENSORS_SHT21 is not set -# CONFIG_SENSORS_SHT3x is not set -# CONFIG_SENSORS_SHTC1 is not set -# CONFIG_SENSORS_SIS5595 is not set -# CONFIG_SENSORS_SMM665 is not set -# CONFIG_SENSORS_SMSC47B397 is not set -# CONFIG_SENSORS_SMSC47M1 is not set -# CONFIG_SENSORS_SMSC47M192 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_TPS40422 is not set -# CONFIG_SENSORS_TSL2550 is not set -# CONFIG_SENSORS_TSL2563 is not set -# CONFIG_SENSORS_UCD9000 is not set -# CONFIG_SENSORS_UCD9200 is not set -# CONFIG_SENSORS_VEXPRESS is not set -# CONFIG_SENSORS_VIA686A is not set -# CONFIG_SENSORS_VIA_CPUTEMP is not set -# CONFIG_SENSORS_VT1211 is not set -# CONFIG_SENSORS_VT8231 is not set -# CONFIG_SENSORS_W83627EHF is not set -# CONFIG_SENSORS_W83627HF 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_XGENE is not set -# CONFIG_SENSORS_ZL6100 is not set -CONFIG_SERIAL_8250=y -# CONFIG_SERIAL_8250_ACCENT is not set -# CONFIG_SERIAL_8250_BOCA is not set -CONFIG_SERIAL_8250_CONSOLE=y -# CONFIG_SERIAL_8250_CS is not set -# CONFIG_SERIAL_8250_DEPRECATED_OPTIONS is not set -# CONFIG_SERIAL_8250_DETECT_IRQ is not set -CONFIG_SERIAL_8250_DMA=y -# CONFIG_SERIAL_8250_DW is not set -# CONFIG_SERIAL_8250_EM is not set -# CONFIG_SERIAL_8250_EXAR_ST16C554 is not set -# CONFIG_SERIAL_8250_EXTENDED is not set -# CONFIG_SERIAL_8250_FINTEK is not set -# CONFIG_SERIAL_8250_FOURPORT is not set -# CONFIG_SERIAL_8250_HUB6 is not set -# CONFIG_SERIAL_8250_INGENIC is not set -# CONFIG_SERIAL_8250_LPSS is not set -# CONFIG_SERIAL_8250_MANY_PORTS is not set -# CONFIG_SERIAL_8250_MID is not set -# CONFIG_SERIAL_8250_MOXA is not set -CONFIG_SERIAL_8250_NR_UARTS=2 -# CONFIG_SERIAL_8250_PCI is not set -# CONFIG_SERIAL_8250_RSA is not set -# CONFIG_SERIAL_8250_RT288X is not set -CONFIG_SERIAL_8250_RUNTIME_UARTS=2 -# CONFIG_SERIAL_ALTERA_JTAGUART is not set -# CONFIG_SERIAL_ALTERA_UART is not set -# CONFIG_SERIAL_AMBA_PL010 is not set -# CONFIG_SERIAL_ARC is not set -# CONFIG_SERIAL_BCM63XX is not set -# CONFIG_SERIAL_CONEXANT_DIGICOLOR is not set -CONFIG_SERIAL_CORE=y -CONFIG_SERIAL_CORE_CONSOLE=y -CONFIG_SERIAL_EARLYCON=y -# CONFIG_SERIAL_EARLYCON_ARM_SEMIHOST is not set -# CONFIG_SERIAL_FSL_LPUART is not set -# CONFIG_SERIAL_GRLIB_GAISLER_APBUART is not set -# CONFIG_SERIAL_IFX6X60 is not set -# CONFIG_SERIAL_JSM is not set -# CONFIG_SERIAL_MAX3100 is not set -# CONFIG_SERIAL_MAX310X is not set -# CONFIG_SERIAL_NONSTANDARD is not set -# CONFIG_SERIAL_OF_PLATFORM is not set -# CONFIG_SERIAL_OF_PLATFORM_NWPSERIAL is not set -# CONFIG_SERIAL_PCH_UART is not set -# CONFIG_SERIAL_RP2 is not set -# CONFIG_SERIAL_SC16IS7XX is not set -# CONFIG_SERIAL_SCCNXP is not set -# CONFIG_SERIAL_SH_SCI is not set -# CONFIG_SERIAL_STM32 is not set -# CONFIG_SERIAL_ST_ASC is not set -# CONFIG_SERIAL_TIMBERDALE is not set -# CONFIG_SERIAL_UARTLITE is not set -# CONFIG_SERIAL_XILINX_PS_UART is not set -# CONFIG_SERIO is not set -# CONFIG_SERIO_ALTERA_PS2 is not set -# CONFIG_SERIO_AMBAKMI is not set -# CONFIG_SERIO_APBPS2 is not set -# CONFIG_SERIO_ARC_PS2 is not set -# CONFIG_SERIO_I8042 is not set -# CONFIG_SERIO_LIBPS2 is not set -# CONFIG_SERIO_PARKBD is not set -# CONFIG_SERIO_PCIPS2 is not set -# CONFIG_SERIO_PS2MULT is not set -# CONFIG_SERIO_RAW is not set -# CONFIG_SERIO_SERPORT is not set -# CONFIG_SERIO_SUN4I_PS2 is not set -# CONFIG_SFC is not set -# CONFIG_SFI is not set -# CONFIG_SGETMASK_SYSCALL is not set -# CONFIG_SGI_IOC4 is not set -# CONFIG_SGI_IP22 is not set -# CONFIG_SGI_IP27 is not set -# CONFIG_SGI_IP28 is not set -# CONFIG_SGI_IP32 is not set -# CONFIG_SGI_PARTITION is not set -# CONFIG_SG_POOL is not set -# CONFIG_SG_SPLIT is not set -CONFIG_SHMEM=y -# CONFIG_SH_ETH 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_SI1145 is not set -# CONFIG_SI7005 is not set -# CONFIG_SI7020 is not set -# CONFIG_SIBYTE_BIGSUR is not set -# CONFIG_SIBYTE_CARMEL is not set -# CONFIG_SIBYTE_CRHINE is not set -# CONFIG_SIBYTE_CRHONE is not set -# CONFIG_SIBYTE_LITTLESUR is not set -# CONFIG_SIBYTE_RHONE is not set -# CONFIG_SIBYTE_SENTOSA is not set -# CONFIG_SIBYTE_SWARM is not set -CONFIG_SIGNALFD=y -# CONFIG_SIGNED_PE_FILE_VERIFICATION is not set -# CONFIG_SIMPLE_GPIO is not set -# CONFIG_SIS190 is not set -# CONFIG_SIS900 is not set -# CONFIG_SKGE is not set -# CONFIG_SKY2 is not set -# CONFIG_SKY2_DEBUG is not set -# CONFIG_SLAB is not set -CONFIG_SLABINFO=y -# CONFIG_SLAB_FREELIST_RANDOM is not set -# CONFIG_SLHC is not set -# CONFIG_SLICOSS is not set -# CONFIG_SLIP is not set -# CONFIG_SLOB is not set -CONFIG_SLUB=y -CONFIG_SLUB_CPU_PARTIAL=y -# CONFIG_SLUB_DEBUG is not set -# CONFIG_SLUB_DEBUG_ON is not set -# CONFIG_SLUB_STATS is not set -# CONFIG_SMARTJOYPLUS_FF is not set -# CONFIG_SMC911X is not set -# CONFIG_SMC9194 is not set -# CONFIG_SMC91X is not set -# CONFIG_SMP is not set -# CONFIG_SMSC911X is not set -# CONFIG_SMSC9420 is not set -# CONFIG_SMSC_PHY is not set -# CONFIG_SM_FTL is not set -# CONFIG_SND is not set -# CONFIG_SND_AC97_POWER_SAVE is not set -# CONFIG_SND_AD1816A is not set -# CONFIG_SND_AD1848 is not set -# CONFIG_SND_AD1889 is not set -# CONFIG_SND_ADLIB is not set -# CONFIG_SND_ALI5451 is not set -# CONFIG_SND_ALOOP is not set -# CONFIG_SND_ALS100 is not set -# CONFIG_SND_ALS300 is not set -# CONFIG_SND_ALS4000 is not set -# CONFIG_SND_ARM is not set -# CONFIG_SND_ASIHPI is not set -# CONFIG_SND_ATIIXP is not set -# CONFIG_SND_ATIIXP_MODEM is not set -# CONFIG_SND_ATMEL_AC97C is not set -# CONFIG_SND_ATMEL_SOC 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_AZT2320 is not set -# CONFIG_SND_AZT3328 is not set -# CONFIG_SND_BCD2000 is not set -# CONFIG_SND_BT87X is not set -# CONFIG_SND_CA0106 is not set -# CONFIG_SND_CMI8330 is not set -# CONFIG_SND_CMIPCI is not set -# CONFIG_SND_CS4231 is not set -# CONFIG_SND_CS4236 is not set -# CONFIG_SND_CS4281 is not set -# CONFIG_SND_CS46XX is not set -# CONFIG_SND_CS5530 is not set -# CONFIG_SND_CS5535AUDIO is not set -# CONFIG_SND_CTXFI is not set -# CONFIG_SND_DARLA20 is not set -# CONFIG_SND_DARLA24 is not set -# CONFIG_SND_DEBUG is not set -# CONFIG_SND_DESIGNWARE_I2S is not set -CONFIG_SND_DRIVERS=y -# CONFIG_SND_DUMMY is not set -# CONFIG_SND_DYNAMIC_MINORS is not set -# CONFIG_SND_ECHO3G is not set -# CONFIG_SND_EDMA_SOC is not set -# CONFIG_SND_EMU10K1 is not set -# CONFIG_SND_EMU10K1X is not set -# CONFIG_SND_EMU10K1_SEQ is not set -# CONFIG_SND_ENS1370 is not set -# CONFIG_SND_ENS1371 is not set -# CONFIG_SND_ES1688 is not set -# CONFIG_SND_ES18XX is not set -# CONFIG_SND_ES1938 is not set -# CONFIG_SND_ES1968 is not set -# CONFIG_SND_FIREWIRE is not set -# CONFIG_SND_FM801 is not set -# CONFIG_SND_GINA20 is not set -# CONFIG_SND_GINA24 is not set -# CONFIG_SND_GUSCLASSIC is not set -# CONFIG_SND_GUSEXTREME is not set -# CONFIG_SND_GUSMAX is not set -# CONFIG_SND_HDA_INTEL is not set -CONFIG_SND_HDA_POWER_SAVE_DEFAULT=0 -CONFIG_SND_HDA_PREALLOC_SIZE=64 -# CONFIG_SND_HDSP is not set -# CONFIG_SND_HDSPM is not set -# CONFIG_SND_HRTIMER is not set -# CONFIG_SND_HWDEP is not set -# CONFIG_SND_ICE1712 is not set -# CONFIG_SND_ICE1724 is not set -# CONFIG_SND_INDIGO is not set -# CONFIG_SND_INDIGODJ is not set -# CONFIG_SND_INDIGODJX is not set -# CONFIG_SND_INDIGOIO is not set -# CONFIG_SND_INDIGOIOX is not set -# CONFIG_SND_INTEL8X0 is not set -# CONFIG_SND_INTEL8X0M is not set -# CONFIG_SND_INTERWAVE is not set -# CONFIG_SND_INTERWAVE_STB is not set -# CONFIG_SND_ISA is not set -# CONFIG_SND_KIRKWOOD_SOC is not set -# CONFIG_SND_KORG1212 is not set -# CONFIG_SND_LAYLA20 is not set -# CONFIG_SND_LAYLA24 is not set -# CONFIG_SND_LOLA is not set -# CONFIG_SND_LX6464ES is not set -# CONFIG_SND_MAESTRO3 is not set -# CONFIG_SND_MIA is not set -# CONFIG_SND_MIPS is not set -# CONFIG_SND_MIRO is not set -# CONFIG_SND_MIXART is not set -# CONFIG_SND_MIXER_OSS is not set -# CONFIG_SND_MONA is not set -# CONFIG_SND_MPC52xx_SOC_EFIKA is not set -# CONFIG_SND_MPU401 is not set -# CONFIG_SND_MTPAV is not set -# CONFIG_SND_MTS64 is not set -# CONFIG_SND_MXS_SOC is not set -# CONFIG_SND_NM256 is not set -# CONFIG_SND_OPL3SA2 is not set -# CONFIG_SND_OPL3_LIB_SEQ is not set -# CONFIG_SND_OPL4_LIB_SEQ is not set -# CONFIG_SND_OPTI92X_AD1848 is not set -# CONFIG_SND_OPTI92X_CS4231 is not set -# CONFIG_SND_OPTI93X is not set -CONFIG_SND_OSSEMUL=y -# CONFIG_SND_OXYGEN is not set -CONFIG_SND_PCI=y -# CONFIG_SND_PCM is not set -# CONFIG_SND_PCMCIA is not set -# CONFIG_SND_PCM_OSS is not set -CONFIG_SND_PCM_OSS_PLUGINS=y -# CONFIG_SND_PCM_TIMER is not set -# CONFIG_SND_PCM_XRUN_DEBUG is not set -# CONFIG_SND_PCXHR is not set -# CONFIG_SND_PDAUDIOCF is not set -# CONFIG_SND_PORTMAN2X4 is not set -# CONFIG_SND_POWERPC_SOC is not set -# CONFIG_SND_PPC is not set -CONFIG_SND_PROC_FS=y -# CONFIG_SND_RAWMIDI is not set -# CONFIG_SND_RAWMIDI_SEQ 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_RTCTIMER is not set -# CONFIG_SND_SB16 is not set -# CONFIG_SND_SB8 is not set -# CONFIG_SND_SBAWE is not set -# CONFIG_SND_SBAWE_SEQ is not set -# CONFIG_SND_SE6X is not set -# CONFIG_SND_SEQUENCER is not set -# CONFIG_SND_SERIAL_U16550 is not set -# CONFIG_SND_SIMPLE_CARD is not set -# CONFIG_SND_SIMPLE_SCU_CARD is not set -# CONFIG_SND_SIS7019 is not set -# CONFIG_SND_SOC is not set -# CONFIG_SND_SOC_AC97_CODEC is not set -# CONFIG_SND_SOC_ADAU1701 is not set -# CONFIG_SND_SOC_ADAU7002 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_AMD_ACP is not set -# CONFIG_SND_SOC_AU1XAUDIO is not set -# CONFIG_SND_SOC_AU1XPSC is not set -# CONFIG_SND_SOC_BT_SCO is not set -# CONFIG_SND_SOC_CS35L32 is not set -# CONFIG_SND_SOC_CS35L33 is not set -# CONFIG_SND_SOC_CS4265 is not set -# CONFIG_SND_SOC_CS4270 is not set -# CONFIG_SND_SOC_CS4271 is not set -# CONFIG_SND_SOC_CS4271_I2C is not set -# CONFIG_SND_SOC_CS4271_SPI 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_CS42XX8_I2C is not set -# CONFIG_SND_SOC_CS4349 is not set -# CONFIG_SND_SOC_CS53L30 is not set -# CONFIG_SND_SOC_ES8328 is not set -# CONFIG_SND_SOC_EUKREA_TLV320 is not set -# CONFIG_SND_SOC_FSL_ASOC_CARD is not set -# CONFIG_SND_SOC_FSL_ASRC is not set -# CONFIG_SND_SOC_FSL_ESAI is not set -# CONFIG_SND_SOC_FSL_SAI is not set -# CONFIG_SND_SOC_FSL_SPDIF is not set -# CONFIG_SND_SOC_FSL_SSI is not set -# CONFIG_SND_SOC_GTM601 is not set -# CONFIG_SND_SOC_ICS43432 is not set -# CONFIG_SND_SOC_IMG is not set -# CONFIG_SND_SOC_IMX_AUDMUX is not set -# CONFIG_SND_SOC_IMX_ES8328 is not set -# CONFIG_SND_SOC_IMX_SPDIF is not set -# CONFIG_SND_SOC_IMX_WM8962 is not set -# CONFIG_SND_SOC_INNO_RK3036 is not set -# CONFIG_SND_SOC_INTEL_BDW_RT5677_MACH is not set -# CONFIG_SND_SOC_INTEL_BXT_DA7219_MAX98357A_MACH is not set -# CONFIG_SND_SOC_INTEL_BXT_RT298_MACH is not set -# CONFIG_SND_SOC_INTEL_BYTCR_RT5640_MACH is not set -# CONFIG_SND_SOC_INTEL_BYTCR_RT5651_MACH is not set -# CONFIG_SND_SOC_INTEL_BYT_MAX98090_MACH is not set -# CONFIG_SND_SOC_INTEL_BYT_RT5640_MACH is not set -# CONFIG_SND_SOC_INTEL_CHT_BSW_MAX98090_TI_MACH is not set -# CONFIG_SND_SOC_INTEL_CHT_BSW_RT5645_MACH is not set -# CONFIG_SND_SOC_INTEL_CHT_BSW_RT5672_MACH is not set -# CONFIG_SND_SOC_INTEL_SKL_NAU88L25_MAX98357A_MACH is not set -# CONFIG_SND_SOC_INTEL_SKL_NAU88L25_SSM4567_MACH is not set -# CONFIG_SND_SOC_INTEL_SKL_RT286_MACH is not set -# CONFIG_SND_SOC_INTEL_SST is not set -# CONFIG_SND_SOC_MAX98504 is not set -# CONFIG_SND_SOC_MAX9860 is not set -# CONFIG_SND_SOC_MEDIATEK is not set -# CONFIG_SND_SOC_MPC5200_AC97 is not set -# CONFIG_SND_SOC_MPC5200_I2S is not set -# CONFIG_SND_SOC_MT2701 is not set -# CONFIG_SND_SOC_MT8173 is not set -# CONFIG_SND_SOC_NAU8810 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_I2C is not set -# CONFIG_SND_SOC_PCM512x_SPI is not set -# CONFIG_SND_SOC_QCOM is not set -# CONFIG_SND_SOC_RT5616 is not set -# 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_I2C is not set -# CONFIG_SND_SOC_SSM2602_SPI 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_TAS5720 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_TPA6130A2 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_WM8960 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_WM8985 is not set -# CONFIG_SND_SOC_XTFPGA_I2S is not set -# CONFIG_SND_SONICVIBES is not set -# CONFIG_SND_SPI is not set -# CONFIG_SND_SSCAPE is not set -# CONFIG_SND_SUN4I_CODEC is not set -# CONFIG_SND_SUPPORT_OLD_API is not set -# CONFIG_SND_TIMER is not set -# CONFIG_SND_TRIDENT is not set -CONFIG_SND_USB=y -# CONFIG_SND_USB_6FIRE is not set -# CONFIG_SND_USB_AUDIO is not set -# CONFIG_SND_USB_CAIAQ is not set -# CONFIG_SND_USB_HIFACE is not set -# CONFIG_SND_USB_POD is not set -# CONFIG_SND_USB_PODHD is not set -# CONFIG_SND_USB_TONEPORT is not set -# CONFIG_SND_USB_UA101 is not set -# CONFIG_SND_USB_US122L is not set -# CONFIG_SND_USB_USX2Y is not set -# CONFIG_SND_USB_VARIAX is not set -# CONFIG_SND_VERBOSE_PRINTK is not set -CONFIG_SND_VERBOSE_PROCFS=y -# 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_VXPOCKET is not set -# CONFIG_SND_WAVEFRONT is not set -# CONFIG_SND_YMFPCI is not set -# CONFIG_SNI_RM is not set -# CONFIG_SOCK_CGROUP_DATA is not set -# CONFIG_SOC_AM33XX is not set -# CONFIG_SOC_AM43XX is not set -# CONFIG_SOC_BRCMSTB is not set -# CONFIG_SOC_CAMERA is not set -# CONFIG_SOC_DRA7XX is not set -# CONFIG_SOC_HAS_OMAP2_SDRC is not set -# CONFIG_SOC_OMAP5 is not set -# CONFIG_SOC_TI is not set -# CONFIG_SOFT_WATCHDOG is not set -# CONFIG_SOLARIS_X86_PARTITION is not set -# CONFIG_SONYPI is not set -# CONFIG_SONY_LAPTOP is not set -# CONFIG_SOUND is not set -# CONFIG_SOUND_OSS_CORE is not set -# CONFIG_SOUND_PRIME is not set -# CONFIG_SP5100_TCO is not set -# CONFIG_SPARSEMEM_MANUAL is not set -# CONFIG_SPARSEMEM_STATIC is not set -# CONFIG_SPARSEMEM_VMEMMAP_ENABLE is not set -# CONFIG_SPARSE_IRQ is not set -# CONFIG_SPARSE_RCU_POINTER is not set -# CONFIG_SPEAKUP is not set -# CONFIG_SPI is not set -# CONFIG_SPINLOCK_TEST is not set -# CONFIG_SPI_ALTERA is not set -# CONFIG_SPI_AU1550 is not set -# CONFIG_SPI_AXI_SPI_ENGINE is not set -# CONFIG_SPI_BCM2835 is not set -# CONFIG_SPI_BCM_QSPI is not set -# CONFIG_SPI_BITBANG is not set -# CONFIG_SPI_BUTTERFLY is not set -# CONFIG_SPI_CADENCE is not set -# CONFIG_SPI_CADENCE_QUADSPI is not set -# CONFIG_SPI_DEBUG is not set -# CONFIG_SPI_DESIGNWARE is not set -# CONFIG_SPI_FSL_DSPI is not set -# CONFIG_SPI_FSL_ESPI is not set -# CONFIG_SPI_FSL_SPI is not set -# CONFIG_SPI_GPIO is not set -# CONFIG_SPI_GPIO_OLD is not set -# CONFIG_SPI_IMG_SPFI is not set -# CONFIG_SPI_LM70_LLP is not set -# CONFIG_SPI_LOOPBACK_TEST is not set -# CONFIG_SPI_MASTER is not set -# CONFIG_SPI_MPC52xx is not set -# CONFIG_SPI_MPC52xx_PSC is not set -# CONFIG_SPI_OCTEON is not set -# CONFIG_SPI_OC_TINY is not set -# CONFIG_SPI_ORION is not set -# CONFIG_SPI_PL022 is not set -# CONFIG_SPI_PPC4xx 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_SPIDEV is not set -# CONFIG_SPI_THUNDERX is not set -# CONFIG_SPI_TI_QSPI is not set -# CONFIG_SPI_TLE62X0 is not set -# CONFIG_SPI_TOPCLIFF_PCH is not set -# CONFIG_SPI_XCOMM is not set -# CONFIG_SPI_XILINX is not set -# CONFIG_SPI_XWAY is not set -# CONFIG_SPI_ZYNQMP_GQSPI is not set -CONFIG_SPLIT_PTLOCK_CPUS=4 -# CONFIG_SPMI is not set -CONFIG_SQUASHFS=y -# CONFIG_SQUASHFS_4K_DEVBLK_SIZE is not set -# CONFIG_SQUASHFS_DECOMP_MULTI is not set -CONFIG_SQUASHFS_DECOMP_MULTI_PERCPU=y -# CONFIG_SQUASHFS_DECOMP_SINGLE is not set -CONFIG_SQUASHFS_EMBEDDED=y -# CONFIG_SQUASHFS_FILE_CACHE is not set -CONFIG_SQUASHFS_FILE_DIRECT=y -CONFIG_SQUASHFS_FRAGMENT_CACHE_SIZE=3 -# CONFIG_SQUASHFS_LZ4 is not set -# CONFIG_SQUASHFS_LZO is not set -# CONFIG_SQUASHFS_XATTR is not set -CONFIG_SQUASHFS_XZ=y -# CONFIG_SQUASHFS_ZLIB is not set -# CONFIG_SRAM is not set -# CONFIG_SSB is not set -# CONFIG_SSB_DEBUG is not set -# CONFIG_SSB_DRIVER_GPIO is not set -# CONFIG_SSB_HOST_SOC is not set -# CONFIG_SSB_PCMCIAHOST is not set -CONFIG_SSB_POSSIBLE=y -# CONFIG_SSB_SDIOHOST is not set -# CONFIG_SSB_SILENT is not set -# CONFIG_SSFDC is not set -# CONFIG_STACKTRACE is not set -CONFIG_STACKTRACE_SUPPORT=y -# CONFIG_STACK_TRACER is not set -# CONFIG_STACK_VALIDATION is not set -CONFIG_STAGING=y -# CONFIG_STAGING_BOARD is not set -# CONFIG_STAGING_MEDIA is not set -CONFIG_STANDALONE=y -# CONFIG_STATIC_KEYS_SELFTEST is not set -CONFIG_STDBINUTILS=y -# CONFIG_STE10XP is not set -# CONFIG_STE_MODEM_RPROC is not set -# CONFIG_STK3310 is not set -# CONFIG_STK8312 is not set -# CONFIG_STK8BA50 is not set -# CONFIG_STM is not set -# CONFIG_STMMAC_ETH is not set -# CONFIG_STMMAC_PCI is not set -# CONFIG_STMMAC_PLATFORM is not set -# CONFIG_STM_DUMMY is not set -# CONFIG_STM_SOURCE_CONSOLE is not set -CONFIG_STP=y -# CONFIG_STREAM_PARSER is not set -# CONFIG_STRICT_DEVMEM is not set -CONFIG_STRIP_ASM_SYMS=y -# CONFIG_STX104 is not set -# CONFIG_SUNDANCE is not set -# CONFIG_SUNGEM is not set -# CONFIG_SUNRPC is not set -# CONFIG_SUNRPC_DEBUG is not set -# CONFIG_SUNRPC_GSS is not set -# CONFIG_SUNXI_SRAM is not set -# CONFIG_SUN_PARTITION is not set -# CONFIG_SUSPEND is not set -# CONFIG_SUSPEND_SKIP_SYNC is not set -CONFIG_SWAP=y -# CONFIG_SWCONFIG is not set -# CONFIG_SWCONFIG_B53 is not set -# CONFIG_SWCONFIG_B53_SPI_DRIVER is not set -# CONFIG_SWCONFIG_LEDS is not set -# CONFIG_SX9500 is not set -# CONFIG_SXGBE_ETH is not set -# CONFIG_SYNCLINK_CS is not set -# CONFIG_SYNC_FILE is not set -# CONFIG_SYNOPSYS_DWC_ETH_QOS is not set -CONFIG_SYN_COOKIES=y -# CONFIG_SYSCON_REBOOT_MODE is not set -CONFIG_SYSCTL=y -# CONFIG_SYSCTL_SYSCALL is not set -CONFIG_SYSFS=y -# CONFIG_SYSFS_DEPRECATED is not set -# CONFIG_SYSFS_DEPRECATED_V2 is not set -# CONFIG_SYSFS_SYSCALL is not set -# CONFIG_SYSTEMPORT is not set -# CONFIG_SYSTEM_DATA_VERIFICATION is not set -# CONFIG_SYSTEM_TRUSTED_KEYRING is not set -CONFIG_SYSTEM_TRUSTED_KEYS="" -# CONFIG_SYSV68_PARTITION is not set -CONFIG_SYSVIPC=y -CONFIG_SYSVIPC_SYSCTL=y -# CONFIG_SYSV_FS is not set -# CONFIG_SYS_HYPERVISOR is not set -# CONFIG_T5403 is not set -# CONFIG_TARGET_CORE is not set -# CONFIG_TASKSTATS is not set -# CONFIG_TASKS_RCU is not set -# CONFIG_TASK_XACCT is not set -# CONFIG_TC35815 is not set -# CONFIG_TCG_ATMEL is not set -# CONFIG_TCG_CRB is not set -# CONFIG_TCG_INFINEON is not set -# CONFIG_TCG_NSC is not set -# CONFIG_TCG_ST33_I2C is not set -# CONFIG_TCG_TIS is not set -# CONFIG_TCG_TIS_I2C_ATMEL is not set -# CONFIG_TCG_TIS_I2C_INFINEON is not set -# CONFIG_TCG_TIS_I2C_NUVOTON is not set -# CONFIG_TCG_TIS_SPI is not set -# CONFIG_TCG_TIS_ST33ZP24_I2C is not set -# CONFIG_TCG_TIS_ST33ZP24_SPI is not set -# CONFIG_TCG_TPM is not set -# CONFIG_TCG_VTPM_PROXY is not set -# CONFIG_TCG_XEN is not set -# CONFIG_TCIC is not set -CONFIG_TCP_CONG_ADVANCED=y -# CONFIG_TCP_CONG_BBR is not set -# CONFIG_TCP_CONG_BIC is not set -# CONFIG_TCP_CONG_CDG is not set -CONFIG_TCP_CONG_CUBIC=y -# CONFIG_TCP_CONG_DCTCP is not set -# CONFIG_TCP_CONG_HSTCP is not set -# CONFIG_TCP_CONG_HTCP is not set -# CONFIG_TCP_CONG_HYBLA is not set -# CONFIG_TCP_CONG_ILLINOIS is not set -# CONFIG_TCP_CONG_LP is not set -# CONFIG_TCP_CONG_NV is not set -# CONFIG_TCP_CONG_SCALABLE is not set -# CONFIG_TCP_CONG_VEGAS is not set -# CONFIG_TCP_CONG_VENO is not set -# CONFIG_TCP_CONG_WESTWOOD is not set -# CONFIG_TCP_CONG_YEAH is not set -# CONFIG_TCP_MD5SIG is not set -# CONFIG_TCS3414 is not set -# CONFIG_TCS3472 is not set -# CONFIG_TEGRA_AHB is not set -# CONFIG_TEGRA_HOST1X is not set -# CONFIG_TEHUTI is not set -# CONFIG_TERANETICS_PHY is not set -# CONFIG_TEST_BITMAP is not set -# CONFIG_TEST_BPF is not set -# CONFIG_TEST_FIRMWARE is not set -# CONFIG_TEST_HASH is not set -# CONFIG_TEST_HEXDUMP is not set -# CONFIG_TEST_KSTRTOX is not set -# CONFIG_TEST_LIST_SORT is not set -# CONFIG_TEST_LKM is not set -# CONFIG_TEST_POWER is not set -# CONFIG_TEST_PRINTF is not set -# CONFIG_TEST_RHASHTABLE is not set -# CONFIG_TEST_STATIC_KEYS is not set -# CONFIG_TEST_STRING_HELPERS is not set -# CONFIG_TEST_UDELAY is not set -# CONFIG_TEST_USER_COPY is not set -# CONFIG_TEST_UUID is not set -CONFIG_TEXTSEARCH=y -# CONFIG_TEXTSEARCH_BM is not set -# CONFIG_TEXTSEARCH_FSM is not set -# CONFIG_TEXTSEARCH_KMP is not set -# CONFIG_THERMAL is not set -# CONFIG_THERMAL_DEFAULT_GOV_FAIR_SHARE is not set -# CONFIG_THERMAL_DEFAULT_GOV_POWER_ALLOCATOR is not set -# CONFIG_THERMAL_DEFAULT_GOV_USER_SPACE is not set -# CONFIG_THERMAL_EMULATION is not set -# CONFIG_THERMAL_GOV_BANG_BANG is not set -# CONFIG_THERMAL_GOV_FAIR_SHARE is not set -# CONFIG_THERMAL_GOV_POWER_ALLOCATOR is not set -# CONFIG_THERMAL_GOV_USER_SPACE is not set -# CONFIG_THERMAL_HWMON is not set -# CONFIG_THERMAL_WRITABLE_TRIPS is not set -# CONFIG_THINKPAD_ACPI is not set -# CONFIG_THRUSTMASTER_FF is not set -# CONFIG_THUNDERBOLT is not set -# CONFIG_THUNDER_NIC_BGX is not set -# CONFIG_THUNDER_NIC_PF is not set -# CONFIG_THUNDER_NIC_RGX is not set -# CONFIG_THUNDER_NIC_VF is not set -# CONFIG_TICK_CPU_ACCOUNTING is not set -CONFIG_TICK_ONESHOT=y -# CONFIG_TIFM_CORE is not set -# CONFIG_TIGON3 is not set -# CONFIG_TIMB_DMA is not set -CONFIG_TIMERFD=y -# CONFIG_TIMER_STATS is not set -CONFIG_TINY_RCU=y -# CONFIG_TIPC is not set -# CONFIG_TI_ADC081C is not set -# CONFIG_TI_ADC0832 is not set -# CONFIG_TI_ADC12138 is not set -# CONFIG_TI_ADC128S052 is not set -# CONFIG_TI_ADC161S626 is not set -# CONFIG_TI_ADS1015 is not set -# CONFIG_TI_ADS8688 is not set -# CONFIG_TI_AM335X_ADC is not set -# CONFIG_TI_CPSW is not set -# CONFIG_TI_CPSW_ALE is not set -# CONFIG_TI_CPTS is not set -# CONFIG_TI_DAC7512 is not set -# CONFIG_TI_DAVINCI_CPDMA is not set -# CONFIG_TI_DAVINCI_MDIO is not set -# CONFIG_TI_ST is not set -# CONFIG_TI_SYSCON_RESET is not set -# CONFIG_TLAN is not set -# CONFIG_TMD_HERMES is not set -# CONFIG_TMP006 is not set -CONFIG_TMPFS=y -# CONFIG_TMPFS_POSIX_ACL is not set -CONFIG_TMPFS_XATTR=y -# CONFIG_TOPSTAR_LAPTOP is not set -# CONFIG_TORTURE_TEST is not set -# CONFIG_TOSHIBA_HAPS is not set -# CONFIG_TOUCHSCREEN_AD7877 is not set -# CONFIG_TOUCHSCREEN_AD7879 is not set -# CONFIG_TOUCHSCREEN_AD7879_I2C is not set -# CONFIG_TOUCHSCREEN_AD7879_SPI is not set -# CONFIG_TOUCHSCREEN_ADS7846 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_CYTTSP4_CORE is not set -# CONFIG_TOUCHSCREEN_CYTTSP_CORE is not set -# CONFIG_TOUCHSCREEN_DYNAPRO is not set -# CONFIG_TOUCHSCREEN_EDT_FT5X06 is not set -# CONFIG_TOUCHSCREEN_EETI is not set -# CONFIG_TOUCHSCREEN_EGALAX is not set -# CONFIG_TOUCHSCREEN_EGALAX_SERIAL is not set -# CONFIG_TOUCHSCREEN_EKTF2127 is not set -# CONFIG_TOUCHSCREEN_ELAN is not set -# CONFIG_TOUCHSCREEN_ELO is not set -# CONFIG_TOUCHSCREEN_FT6236 is not set -# CONFIG_TOUCHSCREEN_FUJITSU is not set -# CONFIG_TOUCHSCREEN_GOODIX is not set -# CONFIG_TOUCHSCREEN_GUNZE is not set -# CONFIG_TOUCHSCREEN_HAMPSHIRE is not set -# CONFIG_TOUCHSCREEN_ILI210X is not set -# CONFIG_TOUCHSCREEN_IMX6UL_TSC is not set -# CONFIG_TOUCHSCREEN_INEXIO is not set -# CONFIG_TOUCHSCREEN_MAX11801 is not set -# CONFIG_TOUCHSCREEN_MCS5000 is not set -# CONFIG_TOUCHSCREEN_MELFAS_MIP4 is not set -# CONFIG_TOUCHSCREEN_MK712 is not set -# CONFIG_TOUCHSCREEN_MMS114 is not set -# CONFIG_TOUCHSCREEN_MTOUCH is not set -# CONFIG_TOUCHSCREEN_PENMOUNT is not set -# CONFIG_TOUCHSCREEN_PIXCIR is not set -# CONFIG_TOUCHSCREEN_RM_TS is not set -# CONFIG_TOUCHSCREEN_ROHM_BU21023 is not set -# CONFIG_TOUCHSCREEN_S3C2410 is not set -# CONFIG_TOUCHSCREEN_SILEAD is not set -# CONFIG_TOUCHSCREEN_SIS_I2C is not set -# CONFIG_TOUCHSCREEN_ST1232 is not set -# CONFIG_TOUCHSCREEN_SUR40 is not set -# CONFIG_TOUCHSCREEN_SURFACE3_SPI is not set -# CONFIG_TOUCHSCREEN_SX8654 is not set -# CONFIG_TOUCHSCREEN_SYNAPTICS_I2C_RMI4 is not set -# CONFIG_TOUCHSCREEN_TOUCHIT213 is not set -# CONFIG_TOUCHSCREEN_TOUCHRIGHT is not set -# CONFIG_TOUCHSCREEN_TOUCHWIN is not set -# CONFIG_TOUCHSCREEN_TPS6507X is not set -# CONFIG_TOUCHSCREEN_TSC2004 is not set -# CONFIG_TOUCHSCREEN_TSC2005 is not set -# CONFIG_TOUCHSCREEN_TSC2007 is not set -# CONFIG_TOUCHSCREEN_TSC_SERIO is not set -# CONFIG_TOUCHSCREEN_USB_COMPOSITE is not set -# CONFIG_TOUCHSCREEN_W90X900 is not set -# CONFIG_TOUCHSCREEN_WACOM_I2C is not set -# CONFIG_TOUCHSCREEN_WACOM_W8001 is not set -# CONFIG_TOUCHSCREEN_WDT87XX_I2C is not set -# CONFIG_TOUCHSCREEN_WM97XX is not set -# CONFIG_TOUCHSCREEN_ZFORCE is not set -# CONFIG_TPL0102 is not set -# CONFIG_TPS6105X is not set -# CONFIG_TPS65010 is not set -# CONFIG_TPS6507X is not set -# CONFIG_TRACEPOINT_BENCHMARK is not set -# CONFIG_TRACER_SNAPSHOT is not set -# CONFIG_TRACER_SNAPSHOT_PER_CPU_SWAP is not set -# CONFIG_TRACE_BRANCH_PROFILING is not set -# CONFIG_TRACE_ENUM_MAP_FILE is not set -CONFIG_TRACE_IRQFLAGS_SUPPORT=y -# CONFIG_TRACE_SINK is not set -# CONFIG_TRACING_EVENTS_GPIO is not set -CONFIG_TRACING_SUPPORT=y -CONFIG_TRAD_SIGNALS=y -# CONFIG_TRANSPARENT_HUGEPAGE is not set -# CONFIG_TREE_RCU is not set -# CONFIG_TREE_RCU_TRACE is not set -# CONFIG_TRIM_UNUSED_KSYMS is not set -# CONFIG_TRUSTED_KEYS is not set -# CONFIG_TSL2583 is not set -# CONFIG_TSL2x7x is not set -# CONFIG_TSL4531 is not set -# CONFIG_TSYS01 is not set -# CONFIG_TSYS02D is not set -# CONFIG_TTPCI_EEPROM is not set -CONFIG_TTY=y -# CONFIG_TTY_PRINTK is not set -# CONFIG_TUN is not set -# CONFIG_TUN_VNET_CROSS_LE is not set -# CONFIG_TWL4030_CORE is not set -# CONFIG_TWL4030_MADC is not set -# CONFIG_TWL6030_GPADC is not set -# CONFIG_TWL6040_CORE is not set -# CONFIG_TYPHOON is not set -# CONFIG_UACCESS_WITH_MEMCPY is not set -# CONFIG_UBIFS_ATIME_SUPPORT is not set -# CONFIG_UBSAN is not set -# CONFIG_UCB1400_CORE is not set -# CONFIG_UCSI is not set -# CONFIG_UDF_FS is not set -CONFIG_UDF_NLS=y -CONFIG_UEVENT_HELPER=y -CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug" -# CONFIG_UFS_FS is not set -# CONFIG_UHID is not set -CONFIG_UID16=y -# CONFIG_UIO is not set -# CONFIG_ULTRA is not set -# CONFIG_ULTRIX_PARTITION is not set -CONFIG_UNIX=y -CONFIG_UNIX98_PTYS=y -# CONFIG_UNIXWARE_DISKLABEL is not set -# CONFIG_UNIX_DIAG is not set -# CONFIG_UNUSED_SYMBOLS is not set -# CONFIG_UPROBES is not set -# CONFIG_UPROBE_EVENT is not set -# CONFIG_US5182D is not set -# CONFIG_USB is not set -# CONFIG_USBIP_CORE is not set -CONFIG_USBIP_VHCI_HC_PORTS=8 -CONFIG_USBIP_VHCI_NR_HCS=1 -# CONFIG_USBIP_VUDC is not set -# CONFIG_USBPCWATCHDOG is not set -# CONFIG_USB_ACM is not set -# CONFIG_USB_ADUTUX is not set -CONFIG_USB_ALI_M5632=y -# CONFIG_USB_AMD5536UDC is not set -CONFIG_USB_AN2720=y -# CONFIG_USB_ANNOUNCE_NEW_DEVICES is not set -# CONFIG_USB_APPLEDISPLAY is not set -CONFIG_USB_ARCH_HAS_HCD=y -CONFIG_USB_ARMLINUX=y -# CONFIG_USB_ATM is not set -# CONFIG_USB_BDC_UDC is not set -CONFIG_USB_BELKIN=y -# CONFIG_USB_C67X00_HCD is not set -# CONFIG_USB_CATC is not set -# CONFIG_USB_CDC_COMPOSITE is not set -# CONFIG_USB_CHAOSKEY is not set -# CONFIG_USB_CHIPIDEA is not set -# CONFIG_USB_CONFIGFS is not set -# CONFIG_USB_CXACRU is not set -# CONFIG_USB_CYPRESS_CY7C63 is not set -# CONFIG_USB_CYTHERM is not set -CONFIG_USB_DEFAULT_PERSIST=y -# CONFIG_USB_DSBR is not set -# CONFIG_USB_DUMMY_HCD is not set -# CONFIG_USB_DWC2 is not set -# CONFIG_USB_DWC2_DEBUG is not set -# CONFIG_USB_DWC2_DUAL_ROLE is not set -# CONFIG_USB_DWC2_HOST is not set -# CONFIG_USB_DWC2_PERIPHERAL is not set -# CONFIG_USB_DWC3 is not set -# CONFIG_USB_DWC3_EXYNOS is not set -# CONFIG_USB_DWC3_KEYSTONE is not set -# CONFIG_USB_DWC3_OF_SIMPLE is not set -# CONFIG_USB_DWC3_PCI is not set -# CONFIG_USB_DWC3_QCOM is not set -# CONFIG_USB_DYNAMIC_MINORS is not set -# CONFIG_USB_EG20T is not set -# CONFIG_USB_EHCI_ATH79 is not set -# CONFIG_USB_EHCI_HCD_AT91 is not set -# CONFIG_USB_EHCI_HCD_OMAP is not set -# CONFIG_USB_EHCI_HCD_PPC_OF is not set -# CONFIG_USB_EHCI_MSM is not set -# CONFIG_USB_EHCI_MV is not set -CONFIG_USB_EHCI_ROOT_HUB_TT=y -CONFIG_USB_EHCI_TT_NEWSCHED=y -# CONFIG_USB_EHSET_TEST_FIXTURE is not set -# CONFIG_USB_EMI26 is not set -# CONFIG_USB_EMI62 is not set -# CONFIG_USB_EPSON2888 is not set -# CONFIG_USB_EZUSB_FX2 is not set -# CONFIG_USB_FOTG210_HCD is not set -# CONFIG_USB_FOTG210_UDC is not set -# CONFIG_USB_FSL_USB2 is not set -# CONFIG_USB_FTDI_ELAN is not set -# CONFIG_USB_FUNCTIONFS is not set -# CONFIG_USB_FUSB300 is not set -# CONFIG_USB_GADGET is not set -# CONFIG_USB_GADGETFS is not set -# 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_STORAGE_NUM_BUFFERS=2 -CONFIG_USB_GADGET_VBUS_DRAW=2 -# CONFIG_USB_GADGET_XILINX is not set -# CONFIG_USB_GL860 is not set -# CONFIG_USB_GOKU is not set -# CONFIG_USB_GPIO_VBUS is not set -# CONFIG_USB_GR_UDC is not set -# CONFIG_USB_GSPCA is not set -# CONFIG_USB_GSPCA_BENQ is not set -# CONFIG_USB_GSPCA_CONEX is not set -# CONFIG_USB_GSPCA_CPIA1 is not set -# CONFIG_USB_GSPCA_DTCS033 is not set -# CONFIG_USB_GSPCA_ETOMS is not set -# CONFIG_USB_GSPCA_FINEPIX is not set -# CONFIG_USB_GSPCA_JEILINJ is not set -# CONFIG_USB_GSPCA_JL2005BCD is not set -# CONFIG_USB_GSPCA_KINECT is not set -# CONFIG_USB_GSPCA_KONICA is not set -# CONFIG_USB_GSPCA_MARS is not set -# CONFIG_USB_GSPCA_MR97310A is not set -# CONFIG_USB_GSPCA_NW80X is not set -# CONFIG_USB_GSPCA_OV519 is not set -# CONFIG_USB_GSPCA_OV534 is not set -# CONFIG_USB_GSPCA_OV534_9 is not set -# CONFIG_USB_GSPCA_PAC207 is not set -# CONFIG_USB_GSPCA_PAC7302 is not set -# CONFIG_USB_GSPCA_PAC7311 is not set -# CONFIG_USB_GSPCA_SE401 is not set -# CONFIG_USB_GSPCA_SN9C2028 is not set -# CONFIG_USB_GSPCA_SN9C20X is not set -# CONFIG_USB_GSPCA_SONIXB is not set -# CONFIG_USB_GSPCA_SONIXJ is not set -# CONFIG_USB_GSPCA_SPCA1528 is not set -# CONFIG_USB_GSPCA_SPCA500 is not set -# CONFIG_USB_GSPCA_SPCA501 is not set -# CONFIG_USB_GSPCA_SPCA505 is not set -# CONFIG_USB_GSPCA_SPCA506 is not set -# CONFIG_USB_GSPCA_SPCA508 is not set -# CONFIG_USB_GSPCA_SPCA561 is not set -# CONFIG_USB_GSPCA_SQ905 is not set -# CONFIG_USB_GSPCA_SQ905C is not set -# CONFIG_USB_GSPCA_SQ930X is not set -# CONFIG_USB_GSPCA_STK014 is not set -# CONFIG_USB_GSPCA_STK1135 is not set -# CONFIG_USB_GSPCA_STV0680 is not set -# CONFIG_USB_GSPCA_SUNPLUS is not set -# CONFIG_USB_GSPCA_T613 is not set -# CONFIG_USB_GSPCA_TOPRO is not set -# CONFIG_USB_GSPCA_TOUPTEK is not set -# CONFIG_USB_GSPCA_TV8532 is not set -# CONFIG_USB_GSPCA_VC032X is not set -# CONFIG_USB_GSPCA_VICAM is not set -# CONFIG_USB_GSPCA_XIRLINK_CIT is not set -# CONFIG_USB_GSPCA_ZC3XX is not set -# CONFIG_USB_G_ACM_MS is not set -# CONFIG_USB_G_DBGP is not set -# CONFIG_USB_G_HID is not set -# CONFIG_USB_G_MULTI is not set -# CONFIG_USB_G_NCM is not set -# CONFIG_USB_G_NOKIA is not set -# CONFIG_USB_G_PRINTER is not set -# CONFIG_USB_G_SERIAL is not set -# CONFIG_USB_G_WEBCAM is not set -# CONFIG_USB_HCD_TEST_MODE is not set -# CONFIG_USB_HID is not set -# CONFIG_USB_HIDDEV is not set -# CONFIG_USB_HSIC_USB3503 is not set -# CONFIG_USB_HSIC_USB4604 is not set -# CONFIG_USB_HSO is not set -# CONFIG_USB_HWA_HCD is not set -# CONFIG_USB_IDMOUSE is not set -# CONFIG_USB_IOWARRIOR is not set -# CONFIG_USB_IPHETH is not set -# CONFIG_USB_ISIGHTFW is not set -# CONFIG_USB_ISP116X_HCD is not set -# CONFIG_USB_ISP1301 is not set -# CONFIG_USB_ISP1362_HCD is not set -# CONFIG_USB_ISP1760 is not set -# CONFIG_USB_ISP1760_HCD is not set -# CONFIG_USB_KAWETH is not set -# CONFIG_USB_KBD is not set -# CONFIG_USB_KC2190 is not set -# CONFIG_USB_LAN78XX is not set -# CONFIG_USB_LCD is not set -# CONFIG_USB_LD is not set -# CONFIG_USB_LED is not set -# CONFIG_USB_LEDS_TRIGGER_USBPORT is not set -# CONFIG_USB_LED_TRIG is not set -# CONFIG_USB_LEGOTOWER is not set -# CONFIG_USB_LINK_LAYER_TEST is not set -# CONFIG_USB_M5602 is not set -# CONFIG_USB_M66592 is not set -# CONFIG_USB_MASS_STORAGE is not set -# CONFIG_USB_MAX3421_HCD is not set -# CONFIG_USB_MDC800 is not set -# CONFIG_USB_MICROTEK is not set -# CONFIG_USB_MIDI_GADGET is not set -# CONFIG_USB_MON is not set -# CONFIG_USB_MOUSE is not set -# CONFIG_USB_MSM_OTG is not set -# CONFIG_USB_MUSB_HDRC is not set -# CONFIG_USB_MV_U3D is not set -# CONFIG_USB_MV_UDC is not set -# CONFIG_USB_MXS_PHY is not set -# CONFIG_USB_NET2272 is not set -# CONFIG_USB_NET2280 is not set -# CONFIG_USB_NET_AX88179_178A is not set -# CONFIG_USB_NET_AX8817X is not set -# CONFIG_USB_NET_CDCETHER is not set -# CONFIG_USB_NET_CDC_EEM is not set -# CONFIG_USB_NET_CDC_MBIM is not set -# CONFIG_USB_NET_CDC_NCM is not set -# CONFIG_USB_NET_CDC_SUBSET is not set -# CONFIG_USB_NET_CH9200 is not set -# CONFIG_USB_NET_CX82310_ETH is not set -# CONFIG_USB_NET_DM9601 is not set -# CONFIG_USB_NET_DRIVERS is not set -# CONFIG_USB_NET_GL620A is not set -# CONFIG_USB_NET_HUAWEI_CDC_NCM is not set -# CONFIG_USB_NET_INT51X1 is not set -# CONFIG_USB_NET_KALMIA is not set -# CONFIG_USB_NET_MCS7830 is not set -# CONFIG_USB_NET_NET1080 is not set -# CONFIG_USB_NET_PLUSB is not set -# CONFIG_USB_NET_QMI_WWAN is not set -# CONFIG_USB_NET_RNDIS_HOST is not set -# CONFIG_USB_NET_RNDIS_WLAN is not set -# CONFIG_USB_NET_SMSC75XX is not set -# CONFIG_USB_NET_SMSC95XX is not set -# CONFIG_USB_NET_SR9700 is not set -# CONFIG_USB_NET_SR9800 is not set -# CONFIG_USB_NET_ZAURUS is not set -# CONFIG_USB_OHCI_HCD is not set -# CONFIG_USB_OHCI_HCD_PCI is not set -# CONFIG_USB_OHCI_HCD_PPC_OF is not set -# CONFIG_USB_OHCI_HCD_PPC_OF_BE is not set -# CONFIG_USB_OHCI_HCD_PPC_OF_LE is not set -# CONFIG_USB_OHCI_HCD_SSB is not set -CONFIG_USB_OHCI_LITTLE_ENDIAN=y -# CONFIG_USB_OTG is not set -# CONFIG_USB_OTG_BLACKLIST_HUB is not set -# CONFIG_USB_OTG_FSM is not set -# CONFIG_USB_OTG_WHITELIST is not set -# CONFIG_USB_OXU210HP_HCD is not set -# CONFIG_USB_PEGASUS is not set -# CONFIG_USB_PHY is not set -# CONFIG_USB_PRINTER is not set -# CONFIG_USB_PWC_INPUT_EVDEV is not set -# CONFIG_USB_PXA27X is not set -# CONFIG_USB_R8A66597 is not set -# CONFIG_USB_R8A66597_HCD is not set -# CONFIG_USB_RCAR_PHY is not set -# CONFIG_USB_RENESAS_USBHS is not set -# CONFIG_USB_RIO500 is not set -# CONFIG_USB_RTL8150 is not set -# CONFIG_USB_RTL8152 is not set -# CONFIG_USB_S2255 is not set -# CONFIG_USB_SERIAL 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_CP210X is not set -# CONFIG_USB_SERIAL_CYBERJACK is not set -# CONFIG_USB_SERIAL_CYPRESS_M8 is not set -# CONFIG_USB_SERIAL_DEBUG is not set -# CONFIG_USB_SERIAL_DIGI_ACCELEPORT is not set -# CONFIG_USB_SERIAL_EDGEPORT is not set -# CONFIG_USB_SERIAL_EDGEPORT_TI is not set -# CONFIG_USB_SERIAL_EMPEG is not set -# CONFIG_USB_SERIAL_F81232 is not set -# CONFIG_USB_SERIAL_FTDI_SIO is not set -# CONFIG_USB_SERIAL_GARMIN is not set -CONFIG_USB_SERIAL_GENERIC=y -# CONFIG_USB_SERIAL_IPAQ is not set -# CONFIG_USB_SERIAL_IPW is not set -# CONFIG_USB_SERIAL_IR is not set -# CONFIG_USB_SERIAL_IUU is not set -# CONFIG_USB_SERIAL_KEYSPAN is not set -CONFIG_USB_SERIAL_KEYSPAN_MPR=y -# CONFIG_USB_SERIAL_KEYSPAN_PDA is not set -CONFIG_USB_SERIAL_KEYSPAN_USA18X=y -CONFIG_USB_SERIAL_KEYSPAN_USA19=y -CONFIG_USB_SERIAL_KEYSPAN_USA19QI=y -CONFIG_USB_SERIAL_KEYSPAN_USA19QW=y -CONFIG_USB_SERIAL_KEYSPAN_USA19W=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_USA49W=y -CONFIG_USB_SERIAL_KEYSPAN_USA49WLC=y -# 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_MOS7715_PARPORT 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_OMNINET is not set -# CONFIG_USB_SERIAL_OPTICON is not set -# CONFIG_USB_SERIAL_OPTION is not set -# CONFIG_USB_SERIAL_OTI6858 is not set -# CONFIG_USB_SERIAL_PL2303 is not set -# CONFIG_USB_SERIAL_QCAUX is not set -# CONFIG_USB_SERIAL_QT2 is not set -# CONFIG_USB_SERIAL_QUALCOMM is not set -# CONFIG_USB_SERIAL_SAFE is not set -CONFIG_USB_SERIAL_SAFE_PADDED=y -# CONFIG_USB_SERIAL_SIERRAWIRELESS is not set -# CONFIG_USB_SERIAL_SIMPLE is not set -# CONFIG_USB_SERIAL_SPCP8X5 is not set -# CONFIG_USB_SERIAL_SSU100 is not set -# CONFIG_USB_SERIAL_SYMBOL is not set -# CONFIG_USB_SERIAL_TI is not set -# CONFIG_USB_SERIAL_VISOR is not set -# CONFIG_USB_SERIAL_WHITEHEAT is not set -# CONFIG_USB_SERIAL_WISHBONE is not set -# CONFIG_USB_SERIAL_XIRCOM is not set -# CONFIG_USB_SERIAL_XSENS_MT is not set -# CONFIG_USB_SEVSEG is not set -# CONFIG_USB_SIERRA_NET is not set -# CONFIG_USB_SISUSBVGA is not set -# CONFIG_USB_SL811_HCD is not set -# CONFIG_USB_SPEEDTOUCH is not set -# CONFIG_USB_STKWEBCAM is not set -# CONFIG_USB_STORAGE is not set -# CONFIG_USB_STORAGE_ALAUDA is not set -# CONFIG_USB_STORAGE_CYPRESS_ATACB is not set -# CONFIG_USB_STORAGE_DATAFAB is not set -# CONFIG_USB_STORAGE_DEBUG is not set -# CONFIG_USB_STORAGE_ENE_UB6250 is not set -# CONFIG_USB_STORAGE_FREECOM is not set -# CONFIG_USB_STORAGE_ISD200 is not set -# CONFIG_USB_STORAGE_JUMPSHOT is not set -# CONFIG_USB_STORAGE_KARMA is not set -# CONFIG_USB_STORAGE_ONETOUCH is not set -# CONFIG_USB_STORAGE_REALTEK is not set -# CONFIG_USB_STORAGE_SDDR09 is not set -# CONFIG_USB_STORAGE_SDDR55 is not set -# CONFIG_USB_STORAGE_USBAT is not set -# CONFIG_USB_STV06XX is not set -# CONFIG_USB_SUPPORT is not set -# CONFIG_USB_SWITCH_FSA9480 is not set -# CONFIG_USB_TEST is not set -# CONFIG_USB_TMC is not set -# CONFIG_USB_TRANCEVIBRATOR is not set -# CONFIG_USB_UAS is not set -# CONFIG_USB_UEAGLEATM is not set -# CONFIG_USB_ULPI is not set -# CONFIG_USB_ULPI_BUS is not set -# CONFIG_USB_USBNET is not set -# CONFIG_USB_USS720 is not set -# CONFIG_USB_VIDEO_CLASS is not set -CONFIG_USB_VIDEO_CLASS_INPUT_EVDEV=y -# CONFIG_USB_VL600 is not set -# CONFIG_USB_WDM is not set -# CONFIG_USB_WHCI_HCD is not set -# CONFIG_USB_WUSB is not set -# CONFIG_USB_WUSB_CBAF is not set -# CONFIG_USB_XHCI_HCD is not set -# CONFIG_USB_XUSBATM is not set -# CONFIG_USB_YUREX is not set -# CONFIG_USB_ZD1201 is not set -# CONFIG_USB_ZERO is not set -# CONFIG_USB_ZR364XX is not set -# CONFIG_USELIB is not set -# CONFIG_USERFAULTFD is not set -# CONFIG_USE_OF is not set -# CONFIG_UTS_NS is not set -# CONFIG_UWB is not set -# CONFIG_U_SERIAL_CONSOLE is not set -# CONFIG_V4L_MEM2MEM_DRIVERS is not set -# CONFIG_V4L_TEST_DRIVERS is not set -# CONFIG_VCNL4000 is not set -# CONFIG_VDSO is not set -# CONFIG_VEML6070 is not set -# CONFIG_VETH is not set -# CONFIG_VEXPRESS_CONFIG is not set -# CONFIG_VF610_ADC is not set -# CONFIG_VF610_DAC is not set -# CONFIG_VFAT_FS is not set -# CONFIG_VGASTATE is not set -# CONFIG_VGA_ARB is not set -# CONFIG_VGA_SWITCHEROO is not set -# CONFIG_VHOST_CROSS_ENDIAN_LEGACY is not set -# CONFIG_VHOST_NET is not set -# CONFIG_VHOST_VSOCK is not set -# CONFIG_VIA_RHINE is not set -# CONFIG_VIA_VELOCITY is not set -# CONFIG_VIDEO_ADV7170 is not set -# CONFIG_VIDEO_ADV7175 is not set -# CONFIG_VIDEO_ADV7180 is not set -# CONFIG_VIDEO_ADV7183 is not set -# CONFIG_VIDEO_ADV7343 is not set -# CONFIG_VIDEO_ADV7393 is not set -# CONFIG_VIDEO_ADV_DEBUG is not set -# CONFIG_VIDEO_AK881X is not set -# CONFIG_VIDEO_BT819 is not set -# CONFIG_VIDEO_BT848 is not set -# CONFIG_VIDEO_BT856 is not set -# CONFIG_VIDEO_BT866 is not set -# CONFIG_VIDEO_CAFE_CCIC is not set -# CONFIG_VIDEO_CS3308 is not set -# CONFIG_VIDEO_CS5345 is not set -# CONFIG_VIDEO_CS53L32A is not set -# CONFIG_VIDEO_CX231XX is not set -# CONFIG_VIDEO_CX2341X is not set -# CONFIG_VIDEO_CX25840 is not set -# CONFIG_VIDEO_CX88 is not set -# CONFIG_VIDEO_DEV is not set -# CONFIG_VIDEO_DM6446_CCDC is not set -# CONFIG_VIDEO_DT3155 is not set -# CONFIG_VIDEO_EM28XX is not set -# CONFIG_VIDEO_FIXED_MINOR_RANGES is not set -# CONFIG_VIDEO_GO7007 is not set -# CONFIG_VIDEO_HDPVR is not set -# CONFIG_VIDEO_HEXIUM_GEMINI is not set -# CONFIG_VIDEO_HEXIUM_ORION is not set -# CONFIG_VIDEO_IR_I2C is not set -# CONFIG_VIDEO_IVTV is not set -# CONFIG_VIDEO_KS0127 is not set -# CONFIG_VIDEO_M52790 is not set -# CONFIG_VIDEO_ML86V7667 is not set -# CONFIG_VIDEO_MSP3400 is not set -# CONFIG_VIDEO_MT9M111 is not set -# CONFIG_VIDEO_MT9V011 is not set -# CONFIG_VIDEO_MXB is not set -# CONFIG_VIDEO_NOON010PC30 is not set -# CONFIG_VIDEO_OMAP2_VOUT is not set -# CONFIG_VIDEO_OV2659 is not set -# CONFIG_VIDEO_OV7640 is not set -# CONFIG_VIDEO_OV7670 is not set -# CONFIG_VIDEO_PVRUSB2 is not set -# CONFIG_VIDEO_SAA6588 is not set -# CONFIG_VIDEO_SAA6752HS is not set -# CONFIG_VIDEO_SAA7110 is not set -# CONFIG_VIDEO_SAA711X is not set -# CONFIG_VIDEO_SAA7127 is not set -# CONFIG_VIDEO_SAA7134 is not set -# CONFIG_VIDEO_SAA717X is not set -# CONFIG_VIDEO_SAA7185 is not set -# CONFIG_VIDEO_SH_MOBILE_CEU is not set -# CONFIG_VIDEO_SONY_BTF_MPX is not set -# CONFIG_VIDEO_SR030PC30 is not set -# CONFIG_VIDEO_TDA7432 is not set -# CONFIG_VIDEO_TDA9840 is not set -# CONFIG_VIDEO_TEA6415C is not set -# CONFIG_VIDEO_TEA6420 is not set -# CONFIG_VIDEO_THS7303 is not set -# CONFIG_VIDEO_THS8200 is not set -# CONFIG_VIDEO_TIMBERDALE is not set -# CONFIG_VIDEO_TLV320AIC23B is not set -# CONFIG_VIDEO_TM6000 is not set -# CONFIG_VIDEO_TVAUDIO is not set -# CONFIG_VIDEO_TVP514X is not set -# CONFIG_VIDEO_TVP5150 is not set -# CONFIG_VIDEO_TVP7002 is not set -# CONFIG_VIDEO_TW2804 is not set -# CONFIG_VIDEO_TW9903 is not set -# CONFIG_VIDEO_TW9906 is not set -# CONFIG_VIDEO_UDA1342 is not set -# CONFIG_VIDEO_UPD64031A is not set -# CONFIG_VIDEO_UPD64083 is not set -# CONFIG_VIDEO_USBTV is not set -# CONFIG_VIDEO_USBVISION is not set -# CONFIG_VIDEO_V4L2 is not set -# CONFIG_VIDEO_VP27SMPX is not set -# CONFIG_VIDEO_VPX3220 is not set -# CONFIG_VIDEO_VS6624 is not set -# CONFIG_VIDEO_WM8739 is not set -# CONFIG_VIDEO_WM8775 is not set -# CONFIG_VIDEO_ZORAN is not set -# CONFIG_VIRTIO_BALLOON is not set -# CONFIG_VIRTIO_INPUT is not set -# CONFIG_VIRTIO_MMIO is not set -# CONFIG_VIRTIO_PCI is not set -# CONFIG_VIRTUALIZATION is not set -# CONFIG_VIRT_CPU_ACCOUNTING_GEN is not set -# CONFIG_VIRT_DRIVERS is not set -CONFIG_VIRT_TO_BUS=y -# CONFIG_VITESSE_PHY is not set -CONFIG_VLAN_8021Q=y -# CONFIG_VLAN_8021Q_GVRP is not set -# CONFIG_VLAN_8021Q_MVRP is not set -# CONFIG_VME_BUS is not set -# CONFIG_VMSPLIT_1G is not set -# CONFIG_VMSPLIT_2G is not set -# CONFIG_VMSPLIT_2G_OPT is not set -CONFIG_VMSPLIT_3G=y -# CONFIG_VMSPLIT_3G_OPT is not set -# CONFIG_VMWARE_PVSCSI is not set -# CONFIG_VMXNET3 is not set -# CONFIG_VM_EVENT_COUNTERS is not set -# CONFIG_VOP_BUS is not set -# CONFIG_VORTEX is not set -# CONFIG_VSOCKETS is not set -# CONFIG_VT is not set -# CONFIG_VT6655 is not set -# CONFIG_VT6656 is not set -# CONFIG_VXFS_FS is not set -# CONFIG_VXGE is not set -# CONFIG_VXLAN is not set -# CONFIG_VZ89X is not set -# CONFIG_W1 is not set -# CONFIG_W1_CON is not set -# CONFIG_W1_MASTER_DS1WM is not set -# CONFIG_W1_MASTER_DS2482 is not set -# CONFIG_W1_MASTER_DS2490 is not set -# CONFIG_W1_MASTER_GPIO is not set -# CONFIG_W1_MASTER_MATROX is not set -# CONFIG_W1_SLAVE_BQ27000 is not set -# CONFIG_W1_SLAVE_DS2406 is not set -# CONFIG_W1_SLAVE_DS2408 is not set -# CONFIG_W1_SLAVE_DS2413 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_SMEM is not set -# CONFIG_W1_SLAVE_THERM is not set -# CONFIG_W83627HF_WDT is not set -# CONFIG_W83877F_WDT is not set -# CONFIG_W83977F_WDT is not set -# CONFIG_WAN is not set -# CONFIG_WANXL is not set -CONFIG_WATCHDOG=y -# CONFIG_WATCHDOG_CORE is not set -# CONFIG_WATCHDOG_NOWAYOUT is not set -# CONFIG_WATCHDOG_PRETIMEOUT_GOV is not set -# CONFIG_WATCHDOG_SYSFS is not set -# CONFIG_WD80x3 is not set -# CONFIG_WDAT_WDT is not set -# CONFIG_WDTPCI is not set -CONFIG_WEXT_CORE=y -CONFIG_WEXT_PRIV=y -CONFIG_WEXT_PROC=y -CONFIG_WEXT_SPY=y -CONFIG_WILINK_PLATFORM_DATA=y -# CONFIG_WIMAX is not set -# CONFIG_WIMAX_GDM72XX is not set -CONFIG_WIRELESS=y -CONFIG_WIRELESS_EXT=y -# CONFIG_WIZNET_W5100 is not set -# CONFIG_WIZNET_W5300 is not set -# CONFIG_WL1251 is not set -# CONFIG_WL12XX is not set -# CONFIG_WL18XX is not set -CONFIG_WLAN=y -# CONFIG_WLAN_VENDOR_ADMTEK is not set -# CONFIG_WLAN_VENDOR_ATH is not set -# CONFIG_WLAN_VENDOR_ATMEL is not set -# CONFIG_WLAN_VENDOR_BROADCOM is not set -# CONFIG_WLAN_VENDOR_CISCO is not set -# CONFIG_WLAN_VENDOR_INTEL is not set -# CONFIG_WLAN_VENDOR_INTERSIL is not set -# CONFIG_WLAN_VENDOR_MARVELL is not set -# CONFIG_WLAN_VENDOR_MEDIATEK is not set -# CONFIG_WLAN_VENDOR_RALINK is not set -# CONFIG_WLAN_VENDOR_REALTEK is not set -# CONFIG_WLAN_VENDOR_RSI is not set -# CONFIG_WLAN_VENDOR_ST is not set -# CONFIG_WLAN_VENDOR_TI is not set -# CONFIG_WLAN_VENDOR_ZYDAS is not set -# CONFIG_WLCORE is not set -# CONFIG_WL_MEDIATEK is not set -CONFIG_WL_TI=y -CONFIG_WQ_POWER_EFFICIENT_DEFAULT=y -# CONFIG_WQ_WATCHDOG is not set -# CONFIG_X25 is not set -# CONFIG_X509_CERTIFICATE_PARSER is not set -# CONFIG_X86_DEBUG_STATIC_CPU_HAS is not set -# CONFIG_X86_PKG_TEMP_THERMAL is not set -CONFIG_X86_SYSFB=y -# CONFIG_XEN is not set -CONFIG_XFRM=y -# CONFIG_XFRM_IPCOMP is not set -# CONFIG_XFRM_MIGRATE is not set -# CONFIG_XFRM_STATISTICS is not set -# CONFIG_XFRM_SUB_POLICY is not set -# CONFIG_XFRM_USER is not set -# CONFIG_XFS_DEBUG is not set -# CONFIG_XFS_FS is not set -# CONFIG_XFS_POSIX_ACL is not set -# CONFIG_XFS_QUOTA is not set -# CONFIG_XFS_RT is not set -# CONFIG_XFS_WARN is not set -# CONFIG_XILINX_AXI_EMAC is not set -# CONFIG_XILINX_DMA is not set -# CONFIG_XILINX_EMACLITE is not set -# CONFIG_XILINX_GMII2RGMII is not set -# CONFIG_XILINX_LL_TEMAC is not set -# CONFIG_XILINX_WATCHDOG is not set -# CONFIG_XILINX_ZYNQMP_DMA is not set -# CONFIG_XILLYBUS is not set -# CONFIG_XIP_KERNEL is not set -# CONFIG_XMON is not set -CONFIG_XZ_DEC=y -# CONFIG_XZ_DEC_ARM is not set -# CONFIG_XZ_DEC_ARMTHUMB is not set -# CONFIG_XZ_DEC_BCJ is not set -# CONFIG_XZ_DEC_IA64 is not set -# CONFIG_XZ_DEC_POWERPC is not set -# CONFIG_XZ_DEC_SPARC is not set -# CONFIG_XZ_DEC_TEST is not set -# CONFIG_XZ_DEC_X86 is not set -# CONFIG_YAM is not set -# CONFIG_YELLOWFIN is not set -# CONFIG_YENTA is not set -# CONFIG_YENTA_O2 is not set -# CONFIG_YENTA_RICOH is not set -# CONFIG_YENTA_TI is not set -# CONFIG_YENTA_TOSHIBA is not set -# CONFIG_ZBUD is not set -# CONFIG_ZD1211RW is not set -# CONFIG_ZD1211RW_DEBUG is not set -# CONFIG_ZEROPLUS_FF is not set -# CONFIG_ZIIRAVE_WATCHDOG is not set -# CONFIG_ZISOFS is not set -# CONFIG_ZLIB_DEFLATE is not set -# CONFIG_ZLIB_INFLATE is not set -CONFIG_ZONE_DMA=y -# CONFIG_ZPA2326 is not set -# CONFIG_ZPOOL is not set -# CONFIG_ZRAM is not set -# CONFIG_ZSMALLOC is not set diff --git a/target/linux/generic/files/drivers/misc/owl-loader.c b/target/linux/generic/files/drivers/misc/owl-loader.c index 5cbee79740..a4e55ad7b1 100644 --- a/target/linux/generic/files/drivers/misc/owl-loader.c +++ b/target/linux/generic/files/drivers/misc/owl-loader.c @@ -75,7 +75,7 @@ static int ath9k_pci_fixup(struct pci_dev *pdev, const u16 *cal_data, /* set pointer to first reg address */ for (data = (const void *) (cal_data + 3); - (const void *) data <= cal_end && data->reg != ~0; + (const void *) data <= cal_end && data->reg != (u16)~0; data++) { u32 val; u16 reg; diff --git a/target/linux/generic/files/drivers/mtd/mtdsplit/mtdsplit_wrgg.c b/target/linux/generic/files/drivers/mtd/mtdsplit/mtdsplit_wrgg.c index 5ce7625731..6c137c52ec 100644 --- a/target/linux/generic/files/drivers/mtd/mtdsplit/mtdsplit_wrgg.c +++ b/target/linux/generic/files/drivers/mtd/mtdsplit/mtdsplit_wrgg.c @@ -72,6 +72,16 @@ static int mtdsplit_parse_wrgg(struct mtd_info *master, /* sanity checks */ if (le32_to_cpu(hdr.magic1) == WRGG03_MAGIC) { kernel_ent_size = hdr_len + be32_to_cpu(hdr.size); + /* + * If this becomes silly big it's probably because the + * WRGG image is little-endian. + */ + if (kernel_ent_size > master->size) + kernel_ent_size = hdr_len + le32_to_cpu(hdr.size); + + /* Now what ?! It's neither */ + if (kernel_ent_size > master->size) + return -EINVAL; } else if (le32_to_cpu(hdr.magic1) == WRG_MAGIC) { kernel_ent_size = sizeof(struct wrg_header) + le32_to_cpu( ((struct wrg_header*)&hdr)->size); diff --git a/target/linux/generic/files/drivers/net/phy/ar8216.c b/target/linux/generic/files/drivers/net/phy/ar8216.c index 2f0be1b8da..683241cf1c 100644 --- a/target/linux/generic/files/drivers/net/phy/ar8216.c +++ b/target/linux/generic/files/drivers/net/phy/ar8216.c @@ -23,12 +23,14 @@ #include #include #include +#include +#include +#include #include #include #include #include #include -#include #include #include #include @@ -40,100 +42,112 @@ extern const struct ar8xxx_chip ar8327_chip; extern const struct ar8xxx_chip ar8337_chip; -#define AR8XXX_MIB_WORK_DELAY 2000 /* msecs */ +#define MIB_DESC_BASIC(_s , _o, _n) \ + { \ + .size = (_s), \ + .offset = (_o), \ + .name = (_n), \ + .type = AR8XXX_MIB_BASIC, \ + } -#define MIB_DESC(_s , _o, _n) \ - { \ - .size = (_s), \ - .offset = (_o), \ - .name = (_n), \ +#define MIB_DESC_EXT(_s , _o, _n) \ + { \ + .size = (_s), \ + .offset = (_o), \ + .name = (_n), \ + .type = AR8XXX_MIB_EXTENDED, \ } static const struct ar8xxx_mib_desc ar8216_mibs[] = { - MIB_DESC(1, AR8216_STATS_RXBROAD, "RxBroad"), - MIB_DESC(1, AR8216_STATS_RXPAUSE, "RxPause"), - MIB_DESC(1, AR8216_STATS_RXMULTI, "RxMulti"), - MIB_DESC(1, AR8216_STATS_RXFCSERR, "RxFcsErr"), - MIB_DESC(1, AR8216_STATS_RXALIGNERR, "RxAlignErr"), - MIB_DESC(1, AR8216_STATS_RXRUNT, "RxRunt"), - MIB_DESC(1, AR8216_STATS_RXFRAGMENT, "RxFragment"), - MIB_DESC(1, AR8216_STATS_RX64BYTE, "Rx64Byte"), - MIB_DESC(1, AR8216_STATS_RX128BYTE, "Rx128Byte"), - MIB_DESC(1, AR8216_STATS_RX256BYTE, "Rx256Byte"), - MIB_DESC(1, AR8216_STATS_RX512BYTE, "Rx512Byte"), - MIB_DESC(1, AR8216_STATS_RX1024BYTE, "Rx1024Byte"), - MIB_DESC(1, AR8216_STATS_RXMAXBYTE, "RxMaxByte"), - MIB_DESC(1, AR8216_STATS_RXTOOLONG, "RxTooLong"), - MIB_DESC(2, AR8216_STATS_RXGOODBYTE, "RxGoodByte"), - MIB_DESC(2, AR8216_STATS_RXBADBYTE, "RxBadByte"), - MIB_DESC(1, AR8216_STATS_RXOVERFLOW, "RxOverFlow"), - MIB_DESC(1, AR8216_STATS_FILTERED, "Filtered"), - MIB_DESC(1, AR8216_STATS_TXBROAD, "TxBroad"), - MIB_DESC(1, AR8216_STATS_TXPAUSE, "TxPause"), - MIB_DESC(1, AR8216_STATS_TXMULTI, "TxMulti"), - MIB_DESC(1, AR8216_STATS_TXUNDERRUN, "TxUnderRun"), - MIB_DESC(1, AR8216_STATS_TX64BYTE, "Tx64Byte"), - MIB_DESC(1, AR8216_STATS_TX128BYTE, "Tx128Byte"), - MIB_DESC(1, AR8216_STATS_TX256BYTE, "Tx256Byte"), - MIB_DESC(1, AR8216_STATS_TX512BYTE, "Tx512Byte"), - MIB_DESC(1, AR8216_STATS_TX1024BYTE, "Tx1024Byte"), - MIB_DESC(1, AR8216_STATS_TXMAXBYTE, "TxMaxByte"), - MIB_DESC(1, AR8216_STATS_TXOVERSIZE, "TxOverSize"), - MIB_DESC(2, AR8216_STATS_TXBYTE, "TxByte"), - MIB_DESC(1, AR8216_STATS_TXCOLLISION, "TxCollision"), - MIB_DESC(1, AR8216_STATS_TXABORTCOL, "TxAbortCol"), - MIB_DESC(1, AR8216_STATS_TXMULTICOL, "TxMultiCol"), - MIB_DESC(1, AR8216_STATS_TXSINGLECOL, "TxSingleCol"), - MIB_DESC(1, AR8216_STATS_TXEXCDEFER, "TxExcDefer"), - MIB_DESC(1, AR8216_STATS_TXDEFER, "TxDefer"), - MIB_DESC(1, AR8216_STATS_TXLATECOL, "TxLateCol"), + MIB_DESC_EXT(1, AR8216_STATS_RXBROAD, "RxBroad"), + MIB_DESC_EXT(1, AR8216_STATS_RXPAUSE, "RxPause"), + MIB_DESC_EXT(1, AR8216_STATS_RXMULTI, "RxMulti"), + MIB_DESC_EXT(1, AR8216_STATS_RXFCSERR, "RxFcsErr"), + MIB_DESC_EXT(1, AR8216_STATS_RXALIGNERR, "RxAlignErr"), + MIB_DESC_EXT(1, AR8216_STATS_RXRUNT, "RxRunt"), + MIB_DESC_EXT(1, AR8216_STATS_RXFRAGMENT, "RxFragment"), + MIB_DESC_EXT(1, AR8216_STATS_RX64BYTE, "Rx64Byte"), + MIB_DESC_EXT(1, AR8216_STATS_RX128BYTE, "Rx128Byte"), + MIB_DESC_EXT(1, AR8216_STATS_RX256BYTE, "Rx256Byte"), + MIB_DESC_EXT(1, AR8216_STATS_RX512BYTE, "Rx512Byte"), + MIB_DESC_EXT(1, AR8216_STATS_RX1024BYTE, "Rx1024Byte"), + MIB_DESC_EXT(1, AR8216_STATS_RXMAXBYTE, "RxMaxByte"), + MIB_DESC_EXT(1, AR8216_STATS_RXTOOLONG, "RxTooLong"), + MIB_DESC_BASIC(2, AR8216_STATS_RXGOODBYTE, "RxGoodByte"), + MIB_DESC_EXT(2, AR8216_STATS_RXBADBYTE, "RxBadByte"), + MIB_DESC_EXT(1, AR8216_STATS_RXOVERFLOW, "RxOverFlow"), + MIB_DESC_EXT(1, AR8216_STATS_FILTERED, "Filtered"), + MIB_DESC_EXT(1, AR8216_STATS_TXBROAD, "TxBroad"), + MIB_DESC_EXT(1, AR8216_STATS_TXPAUSE, "TxPause"), + MIB_DESC_EXT(1, AR8216_STATS_TXMULTI, "TxMulti"), + MIB_DESC_EXT(1, AR8216_STATS_TXUNDERRUN, "TxUnderRun"), + MIB_DESC_EXT(1, AR8216_STATS_TX64BYTE, "Tx64Byte"), + MIB_DESC_EXT(1, AR8216_STATS_TX128BYTE, "Tx128Byte"), + MIB_DESC_EXT(1, AR8216_STATS_TX256BYTE, "Tx256Byte"), + MIB_DESC_EXT(1, AR8216_STATS_TX512BYTE, "Tx512Byte"), + MIB_DESC_EXT(1, AR8216_STATS_TX1024BYTE, "Tx1024Byte"), + MIB_DESC_EXT(1, AR8216_STATS_TXMAXBYTE, "TxMaxByte"), + MIB_DESC_EXT(1, AR8216_STATS_TXOVERSIZE, "TxOverSize"), + MIB_DESC_BASIC(2, AR8216_STATS_TXBYTE, "TxByte"), + MIB_DESC_EXT(1, AR8216_STATS_TXCOLLISION, "TxCollision"), + MIB_DESC_EXT(1, AR8216_STATS_TXABORTCOL, "TxAbortCol"), + MIB_DESC_EXT(1, AR8216_STATS_TXMULTICOL, "TxMultiCol"), + MIB_DESC_EXT(1, AR8216_STATS_TXSINGLECOL, "TxSingleCol"), + MIB_DESC_EXT(1, AR8216_STATS_TXEXCDEFER, "TxExcDefer"), + MIB_DESC_EXT(1, AR8216_STATS_TXDEFER, "TxDefer"), + MIB_DESC_EXT(1, AR8216_STATS_TXLATECOL, "TxLateCol"), }; const struct ar8xxx_mib_desc ar8236_mibs[39] = { - MIB_DESC(1, AR8236_STATS_RXBROAD, "RxBroad"), - MIB_DESC(1, AR8236_STATS_RXPAUSE, "RxPause"), - MIB_DESC(1, AR8236_STATS_RXMULTI, "RxMulti"), - MIB_DESC(1, AR8236_STATS_RXFCSERR, "RxFcsErr"), - MIB_DESC(1, AR8236_STATS_RXALIGNERR, "RxAlignErr"), - MIB_DESC(1, AR8236_STATS_RXRUNT, "RxRunt"), - MIB_DESC(1, AR8236_STATS_RXFRAGMENT, "RxFragment"), - MIB_DESC(1, AR8236_STATS_RX64BYTE, "Rx64Byte"), - MIB_DESC(1, AR8236_STATS_RX128BYTE, "Rx128Byte"), - MIB_DESC(1, AR8236_STATS_RX256BYTE, "Rx256Byte"), - MIB_DESC(1, AR8236_STATS_RX512BYTE, "Rx512Byte"), - MIB_DESC(1, AR8236_STATS_RX1024BYTE, "Rx1024Byte"), - MIB_DESC(1, AR8236_STATS_RX1518BYTE, "Rx1518Byte"), - MIB_DESC(1, AR8236_STATS_RXMAXBYTE, "RxMaxByte"), - MIB_DESC(1, AR8236_STATS_RXTOOLONG, "RxTooLong"), - MIB_DESC(2, AR8236_STATS_RXGOODBYTE, "RxGoodByte"), - MIB_DESC(2, AR8236_STATS_RXBADBYTE, "RxBadByte"), - MIB_DESC(1, AR8236_STATS_RXOVERFLOW, "RxOverFlow"), - MIB_DESC(1, AR8236_STATS_FILTERED, "Filtered"), - MIB_DESC(1, AR8236_STATS_TXBROAD, "TxBroad"), - MIB_DESC(1, AR8236_STATS_TXPAUSE, "TxPause"), - MIB_DESC(1, AR8236_STATS_TXMULTI, "TxMulti"), - MIB_DESC(1, AR8236_STATS_TXUNDERRUN, "TxUnderRun"), - MIB_DESC(1, AR8236_STATS_TX64BYTE, "Tx64Byte"), - MIB_DESC(1, AR8236_STATS_TX128BYTE, "Tx128Byte"), - MIB_DESC(1, AR8236_STATS_TX256BYTE, "Tx256Byte"), - MIB_DESC(1, AR8236_STATS_TX512BYTE, "Tx512Byte"), - MIB_DESC(1, AR8236_STATS_TX1024BYTE, "Tx1024Byte"), - MIB_DESC(1, AR8236_STATS_TX1518BYTE, "Tx1518Byte"), - MIB_DESC(1, AR8236_STATS_TXMAXBYTE, "TxMaxByte"), - MIB_DESC(1, AR8236_STATS_TXOVERSIZE, "TxOverSize"), - MIB_DESC(2, AR8236_STATS_TXBYTE, "TxByte"), - MIB_DESC(1, AR8236_STATS_TXCOLLISION, "TxCollision"), - MIB_DESC(1, AR8236_STATS_TXABORTCOL, "TxAbortCol"), - MIB_DESC(1, AR8236_STATS_TXMULTICOL, "TxMultiCol"), - MIB_DESC(1, AR8236_STATS_TXSINGLECOL, "TxSingleCol"), - MIB_DESC(1, AR8236_STATS_TXEXCDEFER, "TxExcDefer"), - MIB_DESC(1, AR8236_STATS_TXDEFER, "TxDefer"), - MIB_DESC(1, AR8236_STATS_TXLATECOL, "TxLateCol"), + MIB_DESC_EXT(1, AR8236_STATS_RXBROAD, "RxBroad"), + MIB_DESC_EXT(1, AR8236_STATS_RXPAUSE, "RxPause"), + MIB_DESC_EXT(1, AR8236_STATS_RXMULTI, "RxMulti"), + MIB_DESC_EXT(1, AR8236_STATS_RXFCSERR, "RxFcsErr"), + MIB_DESC_EXT(1, AR8236_STATS_RXALIGNERR, "RxAlignErr"), + MIB_DESC_EXT(1, AR8236_STATS_RXRUNT, "RxRunt"), + MIB_DESC_EXT(1, AR8236_STATS_RXFRAGMENT, "RxFragment"), + MIB_DESC_EXT(1, AR8236_STATS_RX64BYTE, "Rx64Byte"), + MIB_DESC_EXT(1, AR8236_STATS_RX128BYTE, "Rx128Byte"), + MIB_DESC_EXT(1, AR8236_STATS_RX256BYTE, "Rx256Byte"), + MIB_DESC_EXT(1, AR8236_STATS_RX512BYTE, "Rx512Byte"), + MIB_DESC_EXT(1, AR8236_STATS_RX1024BYTE, "Rx1024Byte"), + MIB_DESC_EXT(1, AR8236_STATS_RX1518BYTE, "Rx1518Byte"), + MIB_DESC_EXT(1, AR8236_STATS_RXMAXBYTE, "RxMaxByte"), + MIB_DESC_EXT(1, AR8236_STATS_RXTOOLONG, "RxTooLong"), + MIB_DESC_BASIC(2, AR8236_STATS_RXGOODBYTE, "RxGoodByte"), + MIB_DESC_EXT(2, AR8236_STATS_RXBADBYTE, "RxBadByte"), + MIB_DESC_EXT(1, AR8236_STATS_RXOVERFLOW, "RxOverFlow"), + MIB_DESC_EXT(1, AR8236_STATS_FILTERED, "Filtered"), + MIB_DESC_EXT(1, AR8236_STATS_TXBROAD, "TxBroad"), + MIB_DESC_EXT(1, AR8236_STATS_TXPAUSE, "TxPause"), + MIB_DESC_EXT(1, AR8236_STATS_TXMULTI, "TxMulti"), + MIB_DESC_EXT(1, AR8236_STATS_TXUNDERRUN, "TxUnderRun"), + MIB_DESC_EXT(1, AR8236_STATS_TX64BYTE, "Tx64Byte"), + MIB_DESC_EXT(1, AR8236_STATS_TX128BYTE, "Tx128Byte"), + MIB_DESC_EXT(1, AR8236_STATS_TX256BYTE, "Tx256Byte"), + MIB_DESC_EXT(1, AR8236_STATS_TX512BYTE, "Tx512Byte"), + MIB_DESC_EXT(1, AR8236_STATS_TX1024BYTE, "Tx1024Byte"), + MIB_DESC_EXT(1, AR8236_STATS_TX1518BYTE, "Tx1518Byte"), + MIB_DESC_EXT(1, AR8236_STATS_TXMAXBYTE, "TxMaxByte"), + MIB_DESC_EXT(1, AR8236_STATS_TXOVERSIZE, "TxOverSize"), + MIB_DESC_BASIC(2, AR8236_STATS_TXBYTE, "TxByte"), + MIB_DESC_EXT(1, AR8236_STATS_TXCOLLISION, "TxCollision"), + MIB_DESC_EXT(1, AR8236_STATS_TXABORTCOL, "TxAbortCol"), + MIB_DESC_EXT(1, AR8236_STATS_TXMULTICOL, "TxMultiCol"), + MIB_DESC_EXT(1, AR8236_STATS_TXSINGLECOL, "TxSingleCol"), + MIB_DESC_EXT(1, AR8236_STATS_TXEXCDEFER, "TxExcDefer"), + MIB_DESC_EXT(1, AR8236_STATS_TXDEFER, "TxDefer"), + MIB_DESC_EXT(1, AR8236_STATS_TXLATECOL, "TxLateCol"), }; static DEFINE_MUTEX(ar8xxx_dev_list_lock); static LIST_HEAD(ar8xxx_dev_list); +static void +ar8xxx_mib_start(struct ar8xxx_priv *priv); +static void +ar8xxx_mib_stop(struct ar8xxx_priv *priv); + /* inspired by phy_poll_reset in drivers/net/phy/phy_device.c */ static int ar8xxx_phy_poll_reset(struct mii_bus *bus) @@ -188,7 +202,7 @@ ar8xxx_phy_init(struct ar8xxx_priv *priv) int i; struct mii_bus *bus; - bus = priv->mii_bus; + bus = priv->sw_mii_bus ?: priv->mii_bus; for (i = 0; i < AR8XXX_NUM_PHYS; i++) { if (priv->chip->phy_fixup) priv->chip->phy_fixup(priv, i); @@ -426,6 +440,8 @@ ar8xxx_mib_fetch_port_stat(struct ar8xxx_priv *priv, int port, bool flush) u64 t; mib = &priv->chip->mib_decs[i]; + if (mib->type > priv->mib_type) + continue; t = ar8xxx_read(priv, base + mib->offset); if (mib->size == 2) { u64 hi; @@ -651,7 +667,8 @@ ar8216_read_port_status(struct ar8xxx_priv *priv, int port) } static void -ar8216_setup_port(struct ar8xxx_priv *priv, int port, u32 members) +__ar8216_setup_port(struct ar8xxx_priv *priv, int port, u32 members, + bool ath_hdr_en) { u32 header; u32 egress, ingress; @@ -670,10 +687,7 @@ ar8216_setup_port(struct ar8xxx_priv *priv, int port, u32 members) ingress = AR8216_IN_PORT_ONLY; } - if (chip_is_ar8216(priv) && priv->vlan && port == AR8216_PORT_CPU) - header = AR8216_PORT_CTRL_HEADER; - else - header = 0; + header = ath_hdr_en ? AR8216_PORT_CTRL_HEADER : 0; ar8xxx_rmw(priv, AR8216_REG_PORT_CTRL(port), AR8216_PORT_CTRL_LEARN | AR8216_PORT_CTRL_VLAN_MODE | @@ -691,12 +705,23 @@ ar8216_setup_port(struct ar8xxx_priv *priv, int port, u32 members) (pvid << AR8216_PORT_VLAN_DEFAULT_ID_S)); } +static void +ar8216_setup_port(struct ar8xxx_priv *priv, int port, u32 members) +{ + return __ar8216_setup_port(priv, port, members, + chip_is_ar8216(priv) && priv->vlan && + port == AR8216_PORT_CPU); +} + static int ar8216_hw_init(struct ar8xxx_priv *priv) { if (priv->initialized) return 0; + ar8xxx_write(priv, AR8216_REG_CTRL, AR8216_CTRL_RESET); + ar8xxx_reg_wait(priv, AR8216_REG_CTRL, AR8216_CTRL_RESET, 0, 1000); + ar8xxx_phy_init(priv); priv->initialized = true; @@ -714,7 +739,8 @@ ar8216_init_globals(struct ar8xxx_priv *priv) } static void -ar8216_init_port(struct ar8xxx_priv *priv, int port) +__ar8216_init_port(struct ar8xxx_priv *priv, int port, + bool cpu_ge, bool flow_en) { /* Enable port learning and tx */ ar8xxx_write(priv, AR8216_REG_PORT_CTRL(port), @@ -726,12 +752,11 @@ ar8216_init_port(struct ar8xxx_priv *priv, int port) if (port == AR8216_PORT_CPU) { ar8xxx_write(priv, AR8216_REG_PORT_STATUS(port), AR8216_PORT_STATUS_LINK_UP | - (ar8xxx_has_gige(priv) ? - AR8216_PORT_SPEED_1000M : AR8216_PORT_SPEED_100M) | + (cpu_ge ? AR8216_PORT_SPEED_1000M : AR8216_PORT_SPEED_100M) | AR8216_PORT_STATUS_TXMAC | AR8216_PORT_STATUS_RXMAC | - (chip_is_ar8316(priv) ? AR8216_PORT_STATUS_RXFLOW : 0) | - (chip_is_ar8316(priv) ? AR8216_PORT_STATUS_TXFLOW : 0) | + (flow_en ? AR8216_PORT_STATUS_RXFLOW : 0) | + (flow_en ? AR8216_PORT_STATUS_TXFLOW : 0) | AR8216_PORT_STATUS_DUPLEX); } else { ar8xxx_write(priv, AR8216_REG_PORT_STATUS(port), @@ -739,6 +764,13 @@ ar8216_init_port(struct ar8xxx_priv *priv, int port) } } +static void +ar8216_init_port(struct ar8xxx_priv *priv, int port) +{ + __ar8216_init_port(priv, port, ar8xxx_has_gige(priv), + chip_is_ar8316(priv)); +} + static void ar8216_wait_atu_ready(struct ar8xxx_priv *priv, u16 r2, u16 r1) { @@ -806,6 +838,193 @@ static void ar8216_get_arl_entry(struct ar8xxx_priv *priv, } } +static int +ar8216_phy_read(struct ar8xxx_priv *priv, int addr, int regnum) +{ + u32 t, val = 0xffff; + int err; + + if (addr >= AR8216_NUM_PORTS) + return 0xffff; + t = (regnum << AR8216_MDIO_CTRL_REG_ADDR_S) | + (addr << AR8216_MDIO_CTRL_PHY_ADDR_S) | + AR8216_MDIO_CTRL_MASTER_EN | + AR8216_MDIO_CTRL_BUSY | + AR8216_MDIO_CTRL_CMD_READ; + + ar8xxx_write(priv, AR8216_REG_MDIO_CTRL, t); + err = ar8xxx_reg_wait(priv, AR8216_REG_MDIO_CTRL, + AR8216_MDIO_CTRL_BUSY, 0, 5); + if (!err) + val = ar8xxx_read(priv, AR8216_REG_MDIO_CTRL); + + return val & AR8216_MDIO_CTRL_DATA_M; +} + +static int +ar8216_phy_write(struct ar8xxx_priv *priv, int addr, int regnum, u16 val) +{ + u32 t; + int ret; + + if (addr >= AR8216_NUM_PORTS) + return -EINVAL; + + t = (addr << AR8216_MDIO_CTRL_PHY_ADDR_S) | + (regnum << AR8216_MDIO_CTRL_REG_ADDR_S) | + AR8216_MDIO_CTRL_MASTER_EN | + AR8216_MDIO_CTRL_BUSY | + AR8216_MDIO_CTRL_CMD_WRITE | + val; + + ar8xxx_write(priv, AR8216_REG_MDIO_CTRL, t); + ret = ar8xxx_reg_wait(priv, AR8216_REG_MDIO_CTRL, + AR8216_MDIO_CTRL_BUSY, 0, 5); + + return ret; +} + +static int +ar8229_hw_init(struct ar8xxx_priv *priv) +{ + int phy_if_mode; + + if (priv->initialized) + return 0; + + ar8xxx_write(priv, AR8216_REG_CTRL, AR8216_CTRL_RESET); + ar8xxx_reg_wait(priv, AR8216_REG_CTRL, AR8216_CTRL_RESET, 0, 1000); + + phy_if_mode = of_get_phy_mode(priv->pdev->of_node); + + if (phy_if_mode == PHY_INTERFACE_MODE_GMII) { + ar8xxx_write(priv, AR8229_REG_OPER_MODE0, + AR8229_OPER_MODE0_MAC_GMII_EN); + } else if (phy_if_mode == PHY_INTERFACE_MODE_MII) { + ar8xxx_write(priv, AR8229_REG_OPER_MODE0, + AR8229_OPER_MODE0_PHY_MII_EN); + } else { + pr_err("ar8229: unsupported mii mode\n"); + return -EINVAL; + } + + if (priv->port4_phy) { + ar8xxx_write(priv, AR8229_REG_OPER_MODE1, + AR8229_REG_OPER_MODE1_PHY4_MII_EN); + /* disable port5 to prevent mii conflict */ + ar8xxx_write(priv, AR8216_REG_PORT_STATUS(5), 0); + } + + ar8xxx_phy_init(priv); + + priv->initialized = true; + return 0; +} + +static void +ar8229_init_globals(struct ar8xxx_priv *priv) +{ + + /* Enable CPU port, and disable mirror port */ + ar8xxx_write(priv, AR8216_REG_GLOBAL_CPUPORT, + AR8216_GLOBAL_CPUPORT_EN | + (15 << AR8216_GLOBAL_CPUPORT_MIRROR_PORT_S)); + + /* Setup TAG priority mapping */ + ar8xxx_write(priv, AR8216_REG_TAG_PRIORITY, 0xfa50); + + /* Enable aging, MAC replacing */ + ar8xxx_write(priv, AR8216_REG_ATU_CTRL, + 0x2b /* 5 min age time */ | + AR8216_ATU_CTRL_AGE_EN | + AR8216_ATU_CTRL_LEARN_CHANGE); + + /* Enable ARP frame acknowledge */ + ar8xxx_reg_set(priv, AR8229_REG_QM_CTRL, + AR8229_QM_CTRL_ARP_EN); + + /* Enable Broadcast/Multicast frames transmitted to the CPU */ + ar8xxx_reg_set(priv, AR8216_REG_FLOOD_MASK, + AR8229_FLOOD_MASK_BC_DP(0) | + AR8229_FLOOD_MASK_MC_DP(0)); + + /* setup MTU */ + ar8xxx_rmw(priv, AR8216_REG_GLOBAL_CTRL, + AR8236_GCTRL_MTU, AR8236_GCTRL_MTU); + + /* Enable MIB counters */ + ar8xxx_reg_set(priv, AR8216_REG_MIB_FUNC, + AR8236_MIB_EN); + + /* setup Service TAG */ + ar8xxx_rmw(priv, AR8216_REG_SERVICE_TAG, AR8216_SERVICE_TAG_M, 0); +} + +static void +ar8229_init_port(struct ar8xxx_priv *priv, int port) +{ + __ar8216_init_port(priv, port, true, true); +} + + +static int +ar7240sw_hw_init(struct ar8xxx_priv *priv) +{ + if (priv->initialized) + return 0; + + ar8xxx_write(priv, AR8216_REG_CTRL, AR8216_CTRL_RESET); + ar8xxx_reg_wait(priv, AR8216_REG_CTRL, AR8216_CTRL_RESET, 0, 1000); + + priv->port4_phy = 1; + /* disable port5 to prevent mii conflict */ + ar8xxx_write(priv, AR8216_REG_PORT_STATUS(5), 0); + + ar8xxx_phy_init(priv); + + priv->initialized = true; + return 0; +} + +static void +ar7240sw_init_globals(struct ar8xxx_priv *priv) +{ + + /* Enable CPU port, and disable mirror port */ + ar8xxx_write(priv, AR8216_REG_GLOBAL_CPUPORT, + AR8216_GLOBAL_CPUPORT_EN | + (15 << AR8216_GLOBAL_CPUPORT_MIRROR_PORT_S)); + + /* Setup TAG priority mapping */ + ar8xxx_write(priv, AR8216_REG_TAG_PRIORITY, 0xfa50); + + /* Enable ARP frame acknowledge, aging, MAC replacing */ + ar8xxx_write(priv, AR8216_REG_ATU_CTRL, + AR8216_ATU_CTRL_RESERVED | + 0x2b /* 5 min age time */ | + AR8216_ATU_CTRL_AGE_EN | + AR8216_ATU_CTRL_ARP_EN | + AR8216_ATU_CTRL_LEARN_CHANGE); + + /* Enable Broadcast frames transmitted to the CPU */ + ar8xxx_reg_set(priv, AR8216_REG_FLOOD_MASK, + AR8236_FM_CPU_BROADCAST_EN); + + /* setup MTU */ + ar8xxx_rmw(priv, AR8216_REG_GLOBAL_CTRL, + AR8216_GCTRL_MTU, + AR8216_GCTRL_MTU); + + /* setup Service TAG */ + ar8xxx_rmw(priv, AR8216_REG_SERVICE_TAG, AR8216_SERVICE_TAG_M, 0); +} + +static void +ar7240sw_setup_port(struct ar8xxx_priv *priv, int port, u32 members) +{ + return __ar8216_setup_port(priv, port, members, false); +} + static void ar8236_setup_port(struct ar8xxx_priv *priv, int port, u32 members) { @@ -1239,6 +1458,62 @@ unlock: return ret; } +int +ar8xxx_sw_set_mib_poll_interval(struct switch_dev *dev, + const struct switch_attr *attr, + struct switch_val *val) +{ + struct ar8xxx_priv *priv = swdev_to_ar8xxx(dev); + + if (!ar8xxx_has_mib_counters(priv)) + return -EOPNOTSUPP; + + ar8xxx_mib_stop(priv); + priv->mib_poll_interval = val->value.i; + ar8xxx_mib_start(priv); + + return 0; +} + +int +ar8xxx_sw_get_mib_poll_interval(struct switch_dev *dev, + const struct switch_attr *attr, + struct switch_val *val) +{ + struct ar8xxx_priv *priv = swdev_to_ar8xxx(dev); + + if (!ar8xxx_has_mib_counters(priv)) + return -EOPNOTSUPP; + val->value.i = priv->mib_poll_interval; + return 0; +} + +int +ar8xxx_sw_set_mib_type(struct switch_dev *dev, + const struct switch_attr *attr, + struct switch_val *val) +{ + struct ar8xxx_priv *priv = swdev_to_ar8xxx(dev); + + if (!ar8xxx_has_mib_counters(priv)) + return -EOPNOTSUPP; + priv->mib_type = val->value.i; + return 0; +} + +int +ar8xxx_sw_get_mib_type(struct switch_dev *dev, + const struct switch_attr *attr, + struct switch_val *val) +{ + struct ar8xxx_priv *priv = swdev_to_ar8xxx(dev); + + if (!ar8xxx_has_mib_counters(priv)) + return -EOPNOTSUPP; + val->value.i = priv->mib_type; + return 0; +} + int ar8xxx_sw_set_mirror_rx_enable(struct switch_dev *dev, const struct switch_attr *attr, @@ -1410,7 +1685,7 @@ ar8xxx_sw_get_port_mib(struct switch_dev *dev, int i, len = 0; bool mib_stats_empty = true; - if (!ar8xxx_has_mib_counters(priv)) + if (!ar8xxx_has_mib_counters(priv) || !priv->mib_poll_interval) return -EOPNOTSUPP; port = val->port_vlan; @@ -1429,6 +1704,8 @@ ar8xxx_sw_get_port_mib(struct switch_dev *dev, mib_stats = &priv->mib_stats[port * chip->num_mibs]; for (i = 0; i < chip->num_mibs; i++) { + if (chip->mib_decs[i].type > priv->mib_type) + continue; mib_name = chip->mib_decs[i].name; mib_data = mib_stats[i]; len += snprintf(buf + len, sizeof(priv->buf) - len, @@ -1595,6 +1872,48 @@ ar8xxx_sw_set_flush_port_arl_table(struct switch_dev *dev, return ret; } +int +ar8xxx_sw_get_port_stats(struct switch_dev *dev, int port, + struct switch_port_stats *stats) +{ + struct ar8xxx_priv *priv = swdev_to_ar8xxx(dev); + u64 *mib_stats; + + if (!ar8xxx_has_mib_counters(priv) || !priv->mib_poll_interval) + return -EOPNOTSUPP; + + if (!(priv->chip->mib_rxb_id || priv->chip->mib_txb_id)) + return -EOPNOTSUPP; + + if (port >= dev->ports) + return -EINVAL; + + mutex_lock(&priv->mib_lock); + + mib_stats = &priv->mib_stats[port * priv->chip->num_mibs]; + + stats->tx_bytes = mib_stats[priv->chip->mib_txb_id]; + stats->rx_bytes = mib_stats[priv->chip->mib_rxb_id]; + + mutex_unlock(&priv->mib_lock); + return 0; +} + +static int +ar8xxx_phy_read(struct mii_bus *bus, int phy_addr, int reg_addr) +{ + struct ar8xxx_priv *priv = bus->priv; + return priv->chip->phy_read(priv, phy_addr, reg_addr); +} + +static int +ar8xxx_phy_write(struct mii_bus *bus, int phy_addr, int reg_addr, + u16 reg_val) +{ + struct ar8xxx_priv *priv = bus->priv; + return priv->chip->phy_write(priv, phy_addr, reg_addr, reg_val); +} + static const struct switch_attr ar8xxx_sw_attr_globals[] = { { .type = SWITCH_TYPE_INT, @@ -1610,6 +1929,20 @@ static const struct switch_attr ar8xxx_sw_attr_globals[] = { .description = "Reset all MIB counters", .set = ar8xxx_sw_set_reset_mibs, }, + { + .type = SWITCH_TYPE_INT, + .name = "ar8xxx_mib_poll_interval", + .description = "MIB polling interval in msecs (0 to disable)", + .set = ar8xxx_sw_set_mib_poll_interval, + .get = ar8xxx_sw_get_mib_poll_interval + }, + { + .type = SWITCH_TYPE_INT, + .name = "ar8xxx_mib_type", + .description = "MIB type (0=basic 1=extended)", + .set = ar8xxx_sw_set_mib_type, + .get = ar8xxx_sw_get_mib_type + }, { .type = SWITCH_TYPE_INT, .name = "enable_mirror_rx", @@ -1710,16 +2043,41 @@ static const struct switch_dev_ops ar8xxx_sw_ops = { .apply_config = ar8xxx_sw_hw_apply, .reset_switch = ar8xxx_sw_reset_switch, .get_port_link = ar8xxx_sw_get_port_link, -/* The following op is disabled as it hogs the CPU and degrades performance. - An implementation has been attempted in 4d8a66d but reading MIB data is slow - on ar8xxx switches. - - The high CPU load has been traced down to the ar8xxx_reg_wait() call in - ar8xxx_mib_op(), which has to usleep_range() till the MIB busy flag set by - the request to update the MIB counter is cleared. */ -#if 0 .get_port_stats = ar8xxx_sw_get_port_stats, -#endif +}; + +static const struct ar8xxx_chip ar7240sw_chip = { + .caps = AR8XXX_CAP_MIB_COUNTERS, + + .reg_port_stats_start = 0x20000, + .reg_port_stats_length = 0x100, + .reg_arl_ctrl = AR8216_REG_ATU_CTRL, + + .name = "Atheros AR724X/AR933X built-in", + .ports = AR7240SW_NUM_PORTS, + .vlans = AR8216_NUM_VLANS, + .swops = &ar8xxx_sw_ops, + + .hw_init = ar7240sw_hw_init, + .init_globals = ar7240sw_init_globals, + .init_port = ar8229_init_port, + .phy_read = ar8216_phy_read, + .phy_write = ar8216_phy_write, + .setup_port = ar7240sw_setup_port, + .read_port_status = ar8216_read_port_status, + .atu_flush = ar8216_atu_flush, + .atu_flush_port = ar8216_atu_flush_port, + .vtu_flush = ar8216_vtu_flush, + .vtu_load_vlan = ar8216_vtu_load_vlan, + .set_mirror_regs = ar8216_set_mirror_regs, + .get_arl_entry = ar8216_get_arl_entry, + .sw_hw_apply = ar8xxx_sw_hw_apply, + + .num_mibs = ARRAY_SIZE(ar8236_mibs), + .mib_decs = ar8236_mibs, + .mib_func = AR8216_REG_MIB_FUNC, + .mib_rxb_id = AR8236_MIB_RXB_ID, + .mib_txb_id = AR8236_MIB_TXB_ID, }; static const struct ar8xxx_chip ar8216_chip = { @@ -1749,7 +2107,43 @@ static const struct ar8xxx_chip ar8216_chip = { .num_mibs = ARRAY_SIZE(ar8216_mibs), .mib_decs = ar8216_mibs, - .mib_func = AR8216_REG_MIB_FUNC + .mib_func = AR8216_REG_MIB_FUNC, + .mib_rxb_id = AR8216_MIB_RXB_ID, + .mib_txb_id = AR8216_MIB_TXB_ID, +}; + +static const struct ar8xxx_chip ar8229_chip = { + .caps = AR8XXX_CAP_MIB_COUNTERS, + + .reg_port_stats_start = 0x20000, + .reg_port_stats_length = 0x100, + .reg_arl_ctrl = AR8216_REG_ATU_CTRL, + + .name = "Atheros AR8229", + .ports = AR8216_NUM_PORTS, + .vlans = AR8216_NUM_VLANS, + .swops = &ar8xxx_sw_ops, + + .hw_init = ar8229_hw_init, + .init_globals = ar8229_init_globals, + .init_port = ar8229_init_port, + .phy_read = ar8216_phy_read, + .phy_write = ar8216_phy_write, + .setup_port = ar8236_setup_port, + .read_port_status = ar8216_read_port_status, + .atu_flush = ar8216_atu_flush, + .atu_flush_port = ar8216_atu_flush_port, + .vtu_flush = ar8216_vtu_flush, + .vtu_load_vlan = ar8216_vtu_load_vlan, + .set_mirror_regs = ar8216_set_mirror_regs, + .get_arl_entry = ar8216_get_arl_entry, + .sw_hw_apply = ar8xxx_sw_hw_apply, + + .num_mibs = ARRAY_SIZE(ar8236_mibs), + .mib_decs = ar8236_mibs, + .mib_func = AR8216_REG_MIB_FUNC, + .mib_rxb_id = AR8236_MIB_RXB_ID, + .mib_txb_id = AR8236_MIB_TXB_ID, }; static const struct ar8xxx_chip ar8236_chip = { @@ -1779,7 +2173,9 @@ static const struct ar8xxx_chip ar8236_chip = { .num_mibs = ARRAY_SIZE(ar8236_mibs), .mib_decs = ar8236_mibs, - .mib_func = AR8216_REG_MIB_FUNC + .mib_func = AR8216_REG_MIB_FUNC, + .mib_rxb_id = AR8236_MIB_RXB_ID, + .mib_txb_id = AR8236_MIB_TXB_ID, }; static const struct ar8xxx_chip ar8316_chip = { @@ -1809,11 +2205,13 @@ static const struct ar8xxx_chip ar8316_chip = { .num_mibs = ARRAY_SIZE(ar8236_mibs), .mib_decs = ar8236_mibs, - .mib_func = AR8216_REG_MIB_FUNC + .mib_func = AR8216_REG_MIB_FUNC, + .mib_rxb_id = AR8236_MIB_RXB_ID, + .mib_txb_id = AR8236_MIB_TXB_ID, }; static int -ar8xxx_id_chip(struct ar8xxx_priv *priv) +ar8xxx_read_id(struct ar8xxx_priv *priv) { u32 val; u16 id; @@ -1838,6 +2236,17 @@ ar8xxx_id_chip(struct ar8xxx_priv *priv) priv->chip_ver = (id & AR8216_CTRL_VERSION) >> AR8216_CTRL_VERSION_S; priv->chip_rev = (id & AR8216_CTRL_REVISION); + return 0; +} + +static int +ar8xxx_id_chip(struct ar8xxx_priv *priv) +{ + int ret; + + ret = ar8xxx_read_id(priv); + if(ret) + return ret; switch (priv->chip_ver) { case AR8XXX_VER_AR8216: @@ -1869,7 +2278,7 @@ static void ar8xxx_mib_work_func(struct work_struct *work) { struct ar8xxx_priv *priv; - int err; + int err, i; priv = container_of(work, struct ar8xxx_priv, mib_work.work); @@ -1877,18 +2286,15 @@ ar8xxx_mib_work_func(struct work_struct *work) err = ar8xxx_mib_capture(priv); if (err) - goto next_port; - - ar8xxx_mib_fetch_port_stat(priv, priv->mib_next_port, false); + goto next_attempt; -next_port: - priv->mib_next_port++; - if (priv->mib_next_port >= priv->dev.ports) - priv->mib_next_port = 0; + for (i = 0; i < priv->dev.ports; i++) + ar8xxx_mib_fetch_port_stat(priv, i, false); +next_attempt: mutex_unlock(&priv->mib_lock); schedule_delayed_work(&priv->mib_work, - msecs_to_jiffies(AR8XXX_MIB_WORK_DELAY)); + msecs_to_jiffies(priv->mib_poll_interval)); } static int @@ -1914,17 +2320,17 @@ ar8xxx_mib_init(struct ar8xxx_priv *priv) static void ar8xxx_mib_start(struct ar8xxx_priv *priv) { - if (!ar8xxx_has_mib_counters(priv)) + if (!ar8xxx_has_mib_counters(priv) || !priv->mib_poll_interval) return; schedule_delayed_work(&priv->mib_work, - msecs_to_jiffies(AR8XXX_MIB_WORK_DELAY)); + msecs_to_jiffies(priv->mib_poll_interval)); } static void ar8xxx_mib_stop(struct ar8xxx_priv *priv) { - if (!ar8xxx_has_mib_counters(priv)) + if (!ar8xxx_has_mib_counters(priv) || !priv->mib_poll_interval) return; cancel_delayed_work_sync(&priv->mib_work); @@ -1964,10 +2370,6 @@ ar8xxx_probe_switch(struct ar8xxx_priv *priv) struct switch_dev *swdev; int ret; - ret = ar8xxx_id_chip(priv); - if (ret) - return ret; - chip = priv->chip; swdev = &priv->dev; @@ -2195,6 +2597,16 @@ ar8xxx_phy_probe(struct phy_device *phydev) } priv->mii_bus = phydev->mdio.bus; + priv->pdev = &phydev->mdio.dev; + + ret = of_property_read_u32(priv->pdev->of_node, "qca,mib-poll-interval", + &priv->mib_poll_interval); + if (ret) + priv->mib_poll_interval = 0; + + ret = ar8xxx_id_chip(priv); + if (ret) + goto free_priv; ret = ar8xxx_probe_switch(priv); if (ret) @@ -2321,5 +2733,172 @@ static struct phy_driver ar8xxx_phy_driver[] = { } }; -module_phy_driver(ar8xxx_phy_driver); +static const struct of_device_id ar8xxx_mdiodev_of_match[] = { + { + .compatible = "qca,ar7240sw", + .data = &ar7240sw_chip, + }, { + .compatible = "qca,ar8229", + .data = &ar8229_chip, + }, { + .compatible = "qca,ar8236", + .data = &ar8236_chip, + }, { + .compatible = "qca,ar8327", + .data = &ar8327_chip, + }, + { /* sentinel */ }, +}; + +static int +ar8xxx_mdiodev_probe(struct mdio_device *mdiodev) +{ + const struct of_device_id *match; + struct ar8xxx_priv *priv; + struct switch_dev *swdev; + struct device_node *mdio_node; + int ret; + + match = of_match_device(ar8xxx_mdiodev_of_match, &mdiodev->dev); + if (!match) + return -EINVAL; + + priv = ar8xxx_create(); + if (priv == NULL) + return -ENOMEM; + + priv->mii_bus = mdiodev->bus; + priv->pdev = &mdiodev->dev; + priv->chip = (const struct ar8xxx_chip *) match->data; + + ret = of_property_read_u32(priv->pdev->of_node, "qca,mib-poll-interval", + &priv->mib_poll_interval); + if (ret) + priv->mib_poll_interval = 0; + + ret = ar8xxx_read_id(priv); + if (ret) + goto free_priv; + + ret = ar8xxx_probe_switch(priv); + if (ret) + goto free_priv; + + if (priv->chip->phy_read && priv->chip->phy_write) { + priv->sw_mii_bus = devm_mdiobus_alloc(&mdiodev->dev); + priv->sw_mii_bus->name = "ar8xxx-mdio"; + priv->sw_mii_bus->read = ar8xxx_phy_read; + priv->sw_mii_bus->write = ar8xxx_phy_write; + priv->sw_mii_bus->priv = priv; + priv->sw_mii_bus->parent = &mdiodev->dev; + snprintf(priv->sw_mii_bus->id, MII_BUS_ID_SIZE, "%s", + dev_name(&mdiodev->dev)); + mdio_node = of_get_child_by_name(priv->pdev->of_node, "mdio-bus"); + ret = of_mdiobus_register(priv->sw_mii_bus, mdio_node); + if (ret) + goto free_priv; + } + + swdev = &priv->dev; + swdev->alias = dev_name(&mdiodev->dev); + + if (of_property_read_bool(priv->pdev->of_node, "qca,phy4-mii-enable")) { + priv->port4_phy = true; + swdev->ports--; + } + + ret = register_switch(swdev, NULL); + if (ret) + goto free_priv; + + pr_info("%s: %s rev. %u switch registered on %s\n", + swdev->devname, swdev->name, priv->chip_rev, + dev_name(&priv->mii_bus->dev)); + + mutex_lock(&ar8xxx_dev_list_lock); + list_add(&priv->list, &ar8xxx_dev_list); + mutex_unlock(&ar8xxx_dev_list_lock); + + priv->use_count++; + + ret = ar8xxx_start(priv); + if (ret) + goto err_unregister_switch; + + dev_set_drvdata(&mdiodev->dev, priv); + + return 0; + +err_unregister_switch: + if (--priv->use_count) + return ret; + + unregister_switch(&priv->dev); + +free_priv: + ar8xxx_free(priv); + return ret; +} + +static void +ar8xxx_mdiodev_remove(struct mdio_device *mdiodev) +{ + struct ar8xxx_priv *priv = dev_get_drvdata(&mdiodev->dev); + + if (WARN_ON(!priv)) + return; + + mutex_lock(&ar8xxx_dev_list_lock); + + if (--priv->use_count > 0) { + mutex_unlock(&ar8xxx_dev_list_lock); + return; + } + + list_del(&priv->list); + mutex_unlock(&ar8xxx_dev_list_lock); + + unregister_switch(&priv->dev); + ar8xxx_mib_stop(priv); + if(priv->sw_mii_bus) + mdiobus_unregister(priv->sw_mii_bus); + ar8xxx_free(priv); +} + +static struct mdio_driver ar8xxx_mdio_driver = { + .probe = ar8xxx_mdiodev_probe, + .remove = ar8xxx_mdiodev_remove, + .mdiodrv.driver = { + .name = "ar8xxx-switch", + .of_match_table = ar8xxx_mdiodev_of_match, + }, +}; + +static int __init ar8216_init(void) +{ + int ret; + + ret = phy_drivers_register(ar8xxx_phy_driver, + ARRAY_SIZE(ar8xxx_phy_driver), + THIS_MODULE); + if (ret) + return ret; + + ret = mdio_driver_register(&ar8xxx_mdio_driver); + if (ret) + phy_drivers_unregister(ar8xxx_phy_driver, + ARRAY_SIZE(ar8xxx_phy_driver)); + + return ret; +} +module_init(ar8216_init); + +static void __exit ar8216_exit(void) +{ + mdio_driver_unregister(&ar8xxx_mdio_driver); + phy_drivers_unregister(ar8xxx_phy_driver, + ARRAY_SIZE(ar8xxx_phy_driver)); +} +module_exit(ar8216_exit); + MODULE_LICENSE("GPL"); diff --git a/target/linux/generic/files/drivers/net/phy/ar8216.h b/target/linux/generic/files/drivers/net/phy/ar8216.h index 33f505cbe2..93170d5863 100644 --- a/target/linux/generic/files/drivers/net/phy/ar8216.h +++ b/target/linux/generic/files/drivers/net/phy/ar8216.h @@ -26,6 +26,7 @@ #define AR8216_PORT_CPU 0 #define AR8216_NUM_PORTS 6 #define AR8216_NUM_VLANS 16 +#define AR7240SW_NUM_PORTS 5 #define AR8316_NUM_VLANS 4096 /* size of the vlan table */ @@ -52,6 +53,8 @@ #define AR8216_REG_FLOOD_MASK 0x002C #define AR8216_FM_UNI_DEST_PORTS BITS(0, 6) #define AR8216_FM_MULTI_DEST_PORTS BITS(16, 6) +#define AR8229_FLOOD_MASK_MC_DP(_p) BIT(16 + (_p)) +#define AR8229_FLOOD_MASK_BC_DP(_p) BIT(25 + (_p)) #define AR8236_FM_CPU_BROADCAST_EN BIT(26) #define AR8236_FM_CPU_BCAST_FWD_EN BIT(25) @@ -127,6 +130,14 @@ #define AR8216_ATU_CTRL_AGE_TIME BITS(0, 16) #define AR8216_ATU_CTRL_AGE_TIME_S 0 #define AR8236_ATU_CTRL_RES BIT(20) +#define AR8216_ATU_CTRL_LEARN_CHANGE BIT(18) +#define AR8216_ATU_CTRL_RESERVED BIT(19) +#define AR8216_ATU_CTRL_ARP_EN BIT(20) + +#define AR8216_REG_TAG_PRIORITY 0x0070 + +#define AR8216_REG_SERVICE_TAG 0x0074 +#define AR8216_SERVICE_TAG_M BITS(0, 16) #define AR8216_REG_MIB_FUNC 0x0080 #define AR8216_MIB_TIMER BITS(0, 16) @@ -142,6 +153,16 @@ #define AR8216_REG_GLOBAL_CPUPORT 0x0078 #define AR8216_GLOBAL_CPUPORT_MIRROR_PORT BITS(4, 4) #define AR8216_GLOBAL_CPUPORT_MIRROR_PORT_S 4 +#define AR8216_GLOBAL_CPUPORT_EN BIT(8) + +#define AR8216_REG_MDIO_CTRL 0x98 +#define AR8216_MDIO_CTRL_DATA_M BITS(0, 16) +#define AR8216_MDIO_CTRL_REG_ADDR_S 16 +#define AR8216_MDIO_CTRL_PHY_ADDR_S 21 +#define AR8216_MDIO_CTRL_CMD_WRITE 0 +#define AR8216_MDIO_CTRL_CMD_READ BIT(27) +#define AR8216_MDIO_CTRL_MASTER_EN BIT(30) +#define AR8216_MDIO_CTRL_BUSY BIT(31) #define AR8216_PORT_OFFSET(_i) (0x0100 * (_i + 1)) #define AR8216_REG_PORT_STATUS(_i) (AR8216_PORT_OFFSET(_i) + 0x0000) @@ -237,6 +258,19 @@ #define AR8216_STATS_TXDEFER 0x98 #define AR8216_STATS_TXLATECOL 0x9c +#define AR8216_MIB_RXB_ID 14 /* RxGoodByte */ +#define AR8216_MIB_TXB_ID 29 /* TxByte */ + +#define AR8229_REG_OPER_MODE0 0x04 +#define AR8229_OPER_MODE0_MAC_GMII_EN BIT(6) +#define AR8229_OPER_MODE0_PHY_MII_EN BIT(10) + +#define AR8229_REG_OPER_MODE1 0x08 +#define AR8229_REG_OPER_MODE1_PHY4_MII_EN BIT(28) + +#define AR8229_REG_QM_CTRL 0x3c +#define AR8229_QM_CTRL_ARP_EN BIT(15) + #define AR8236_REG_PORT_VLAN(_i) (AR8216_PORT_OFFSET((_i)) + 0x0008) #define AR8236_PORT_VLAN_DEFAULT_ID BITS(16, 12) #define AR8236_PORT_VLAN_DEFAULT_ID_S 16 @@ -290,6 +324,9 @@ #define AR8236_STATS_TXDEFER 0xa0 #define AR8236_STATS_TXLATECOL 0xa4 +#define AR8236_MIB_RXB_ID 15 /* RxGoodByte */ +#define AR8236_MIB_TXB_ID 31 /* TxByte */ + #define AR8316_REG_POSTRIP 0x0008 #define AR8316_POSTRIP_MAC0_GMII_EN BIT(0) #define AR8316_POSTRIP_MAC0_RGMII_EN BIT(1) @@ -352,6 +389,12 @@ enum { AR8216_PORT_STATE_FORWARD = 4 }; +/* mib counter type */ +enum { + AR8XXX_MIB_BASIC = 0, + AR8XXX_MIB_EXTENDED = 1 +}; + enum { AR8XXX_VER_AR8216 = 0x01, AR8XXX_VER_AR8236 = 0x03, @@ -378,6 +421,7 @@ struct ar8xxx_mib_desc { unsigned int size; unsigned int offset; const char *name; + u8 type; }; struct ar8xxx_chip { @@ -414,16 +458,22 @@ struct ar8xxx_chip { u32 *status, enum arl_op op); int (*sw_hw_apply)(struct switch_dev *dev); void (*phy_rgmii_set)(struct ar8xxx_priv *priv, struct phy_device *phydev); + int (*phy_read)(struct ar8xxx_priv *priv, int addr, int regnum); + int (*phy_write)(struct ar8xxx_priv *priv, int addr, int regnum, u16 val); const struct ar8xxx_mib_desc *mib_decs; unsigned num_mibs; unsigned mib_func; + int mib_rxb_id; + int mib_txb_id; }; struct ar8xxx_priv { struct switch_dev dev; struct mii_bus *mii_bus; + struct mii_bus *sw_mii_bus; struct phy_device *phy; + struct device *pdev; int (*get_port_link)(unsigned port); @@ -445,8 +495,9 @@ struct ar8xxx_priv { struct mutex mib_lock; struct delayed_work mib_work; - int mib_next_port; u64 *mib_stats; + u32 mib_poll_interval; + u8 mib_type; struct list_head list; unsigned int use_count; @@ -501,6 +552,22 @@ ar8xxx_sw_set_reset_mibs(struct switch_dev *dev, const struct switch_attr *attr, struct switch_val *val); int +ar8xxx_sw_set_mib_poll_interval(struct switch_dev *dev, + const struct switch_attr *attr, + struct switch_val *val); +int +ar8xxx_sw_get_mib_poll_interval(struct switch_dev *dev, + const struct switch_attr *attr, + struct switch_val *val); +int +ar8xxx_sw_set_mib_type(struct switch_dev *dev, + const struct switch_attr *attr, + struct switch_val *val); +int +ar8xxx_sw_get_mib_type(struct switch_dev *dev, + const struct switch_attr *attr, + struct switch_val *val); +int ar8xxx_sw_set_mirror_rx_enable(struct switch_dev *dev, const struct switch_attr *attr, struct switch_val *val); @@ -572,6 +639,9 @@ ar8xxx_sw_set_flush_port_arl_table(struct switch_dev *dev, const struct switch_attr *attr, struct switch_val *val); int +ar8xxx_sw_get_port_stats(struct switch_dev *dev, int port, + struct switch_port_stats *stats); +int ar8216_wait_bit(struct ar8xxx_priv *priv, int reg, u32 mask, u32 val); static inline struct ar8xxx_priv * diff --git a/target/linux/generic/files/drivers/net/phy/ar8327.c b/target/linux/generic/files/drivers/net/phy/ar8327.c index 6c33229143..1878585b0c 100644 --- a/target/linux/generic/files/drivers/net/phy/ar8327.c +++ b/target/linux/generic/files/drivers/net/phy/ar8327.c @@ -662,8 +662,8 @@ ar8327_hw_init(struct ar8xxx_priv *priv) if (!priv->chip_data) return -ENOMEM; - if (priv->phy->mdio.dev.of_node) - ret = ar8327_hw_config_of(priv, priv->phy->mdio.dev.of_node); + if (priv->pdev->of_node) + ret = ar8327_hw_config_of(priv, priv->pdev->of_node); else ret = ar8327_hw_config_pdata(priv, priv->phy->mdio.dev.platform_data); @@ -1321,6 +1321,20 @@ static const struct switch_attr ar8327_sw_attr_globals[] = { .description = "Reset all MIB counters", .set = ar8xxx_sw_set_reset_mibs, }, + { + .type = SWITCH_TYPE_INT, + .name = "ar8xxx_mib_poll_interval", + .description = "MIB polling interval in msecs (0 to disable)", + .set = ar8xxx_sw_set_mib_poll_interval, + .get = ar8xxx_sw_get_mib_poll_interval + }, + { + .type = SWITCH_TYPE_INT, + .name = "ar8xxx_mib_type", + .description = "MIB type (0=basic 1=extended)", + .set = ar8xxx_sw_set_mib_type, + .get = ar8xxx_sw_get_mib_type + }, { .type = SWITCH_TYPE_INT, .name = "enable_mirror_rx", @@ -1457,16 +1471,7 @@ static const struct switch_dev_ops ar8327_sw_ops = { .apply_config = ar8327_sw_hw_apply, .reset_switch = ar8xxx_sw_reset_switch, .get_port_link = ar8xxx_sw_get_port_link, -/* The following op is disabled as it hogs the CPU and degrades performance. - An implementation has been attempted in 4d8a66d but reading MIB data is slow - on ar8xxx switches. - - The high CPU load has been traced down to the ar8xxx_reg_wait() call in - ar8xxx_mib_op(), which has to usleep_range() till the MIB busy flag set by - the request to update the MIB counter is cleared. */ -#if 0 .get_port_stats = ar8xxx_sw_get_port_stats, -#endif }; const struct ar8xxx_chip ar8327_chip = { @@ -1501,7 +1506,9 @@ const struct ar8xxx_chip ar8327_chip = { .num_mibs = ARRAY_SIZE(ar8236_mibs), .mib_decs = ar8236_mibs, - .mib_func = AR8327_REG_MIB_FUNC + .mib_func = AR8327_REG_MIB_FUNC, + .mib_rxb_id = AR8236_MIB_RXB_ID, + .mib_txb_id = AR8236_MIB_TXB_ID, }; const struct ar8xxx_chip ar8337_chip = { @@ -1537,5 +1544,7 @@ const struct ar8xxx_chip ar8337_chip = { .num_mibs = ARRAY_SIZE(ar8236_mibs), .mib_decs = ar8236_mibs, - .mib_func = AR8327_REG_MIB_FUNC + .mib_func = AR8327_REG_MIB_FUNC, + .mib_rxb_id = AR8236_MIB_RXB_ID, + .mib_txb_id = AR8236_MIB_TXB_ID, }; diff --git a/target/linux/generic/files/drivers/net/phy/b53/b53_mdio.c b/target/linux/generic/files/drivers/net/phy/b53/b53_mdio.c index 5934befc9e..6de8623612 100644 --- a/target/linux/generic/files/drivers/net/phy/b53/b53_mdio.c +++ b/target/linux/generic/files/drivers/net/phy/b53/b53_mdio.c @@ -294,12 +294,22 @@ static int b53_phy_probe(struct phy_device *phydev) if (ret) return ret; +#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 0, 0) + linkmode_zero(phydev->supported); + if (is5325(dev) || is5365(dev)) + linkmode_set_bit(ETHTOOL_LINK_MODE_100baseT_Full_BIT, phydev->supported); + else + linkmode_set_bit(ETHTOOL_LINK_MODE_1000baseT_Full_BIT, phydev->supported); + + linkmode_copy(phydev->advertising, phydev->supported); +#else if (is5325(dev) || is5365(dev)) phydev->supported = SUPPORTED_100baseT_Full; else phydev->supported = SUPPORTED_1000baseT_Full; phydev->advertising = phydev->supported; +#endif ret = b53_switch_register(dev); if (ret) { diff --git a/target/linux/generic/hack-4.14/202-reduce_module_size.patch b/target/linux/generic/hack-4.14/202-reduce_module_size.patch deleted file mode 100644 index 2cbb6add9a..0000000000 --- a/target/linux/generic/hack-4.14/202-reduce_module_size.patch +++ /dev/null @@ -1,24 +0,0 @@ -From fd66884da2f96d2a7ea73f58b1b86251b959a913 Mon Sep 17 00:00:00 2001 -From: Felix Fietkau -Date: Fri, 7 Jul 2017 16:56:19 +0200 -Subject: kernel: strip unnecessary symbol table information from kernel modules - -reduces default squashfs size on ar71xx by about 4k - -lede-commit: 058d331a39077f159ca8922f1f422a1346d6aa67 -Signed-off-by: Felix Fietkau ---- - Makefile | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - ---- a/Makefile -+++ b/Makefile -@@ -425,7 +425,7 @@ KBUILD_AFLAGS_KERNEL := - KBUILD_CFLAGS_KERNEL := - KBUILD_AFLAGS_MODULE := -DMODULE - KBUILD_CFLAGS_MODULE := -DMODULE --KBUILD_LDFLAGS_MODULE := -T $(srctree)/scripts/module-common.lds -+KBUILD_LDFLAGS_MODULE = -T $(srctree)/scripts/module-common.lds $(if $(CONFIG_PROFILING),,-s) - GCC_PLUGINS_CFLAGS := - - export ARCH SRCARCH SUBARCH CONFIG_SHELL HOSTCC HOSTCFLAGS CROSS_COMPILE AS LD diff --git a/target/linux/generic/hack-4.14/207-disable-modorder.patch b/target/linux/generic/hack-4.14/207-disable-modorder.patch index b45a8e3bc2..16b10e76b8 100644 --- a/target/linux/generic/hack-4.14/207-disable-modorder.patch +++ b/target/linux/generic/hack-4.14/207-disable-modorder.patch @@ -15,7 +15,7 @@ Signed-off-by: Felix Fietkau --- a/Makefile +++ b/Makefile -@@ -1240,7 +1240,6 @@ all: modules +@@ -1241,7 +1241,6 @@ all: modules PHONY += modules modules: $(vmlinux-dirs) $(if $(KBUILD_BUILTIN),vmlinux) modules.builtin @@ -23,7 +23,7 @@ Signed-off-by: Felix Fietkau @$(kecho) ' Building modules, stage 2.'; $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modpost -@@ -1269,7 +1268,6 @@ _modinst_: +@@ -1270,7 +1269,6 @@ _modinst_: rm -f $(MODLIB)/build ; \ ln -s $(CURDIR) $(MODLIB)/build ; \ fi diff --git a/target/linux/generic/hack-4.14/220-gc_sections.patch b/target/linux/generic/hack-4.14/220-gc_sections.patch index d257232403..7d791eb451 100644 --- a/target/linux/generic/hack-4.14/220-gc_sections.patch +++ b/target/linux/generic/hack-4.14/220-gc_sections.patch @@ -33,7 +33,7 @@ Signed-off-by: Gabor Juhos # Read KERNELRELEASE from include/config/kernel.release (if it exists) KERNELRELEASE = $(shell cat include/config/kernel.release 2> /dev/null) KERNELVERSION = $(VERSION)$(if $(PATCHLEVEL),.$(PATCHLEVEL)$(if $(SUBLEVEL),.$(SUBLEVEL)))$(EXTRAVERSION) -@@ -788,11 +793,6 @@ ifdef CONFIG_DEBUG_SECTION_MISMATCH +@@ -789,11 +794,6 @@ ifdef CONFIG_DEBUG_SECTION_MISMATCH KBUILD_CFLAGS += $(call cc-option, -fno-inline-functions-called-once) endif diff --git a/target/linux/generic/hack-4.14/259-regmap_dynamic.patch b/target/linux/generic/hack-4.14/259-regmap_dynamic.patch index 59dfbf3ad2..2cbd791b28 100644 --- a/target/linux/generic/hack-4.14/259-regmap_dynamic.patch +++ b/target/linux/generic/hack-4.14/259-regmap_dynamic.patch @@ -86,7 +86,7 @@ Signed-off-by: Felix Fietkau #include #include #include -@@ -2926,3 +2927,5 @@ static int __init regmap_initcall(void) +@@ -2928,3 +2929,5 @@ static int __init regmap_initcall(void) return 0; } postcore_initcall(regmap_initcall); diff --git a/target/linux/generic/hack-4.14/400-mt29f_spinand-fix-memleak.patch b/target/linux/generic/hack-4.14/400-mt29f_spinand-fix-memleak.patch new file mode 100644 index 0000000000..d479aba01a --- /dev/null +++ b/target/linux/generic/hack-4.14/400-mt29f_spinand-fix-memleak.patch @@ -0,0 +1,90 @@ +--- a/drivers/staging/mt29f_spinand/mt29f_spinand.c ++++ b/drivers/staging/mt29f_spinand/mt29f_spinand.c +@@ -492,7 +492,7 @@ static int spinand_program_page(struct s + #ifdef CONFIG_MTD_SPINAND_ONDIEECC + unsigned int i, j; + +- wbuf = devm_kzalloc(&spi_nand->dev, CACHE_BUF, GFP_KERNEL); ++ wbuf = kzalloc(CACHE_BUF, GFP_KERNEL); + if (!wbuf) + return -ENOMEM; + +@@ -500,7 +500,7 @@ static int spinand_program_page(struct s + retval = spinand_read_page(spi_nand, page_id, 0, CACHE_BUF, wbuf); + if (retval < 0) { + dev_err(&spi_nand->dev, "ecc error on read page!!!\n"); +- return retval; ++ goto cleanup; + } + + for (i = offset, j = 0; i < len; i++, j++) +@@ -510,7 +510,7 @@ static int spinand_program_page(struct s + retval = spinand_enable_ecc(spi_nand); + if (retval < 0) { + dev_err(&spi_nand->dev, "enable ecc failed!!\n"); +- return retval; ++ goto cleanup; + } + } + #else +@@ -519,7 +519,7 @@ static int spinand_program_page(struct s + retval = spinand_write_enable(spi_nand); + if (retval < 0) { + dev_err(&spi_nand->dev, "write enable failed!!\n"); +- return retval; ++ goto cleanup; + } + if (wait_till_ready(spi_nand)) + dev_err(&spi_nand->dev, "wait timedout!!!\n"); +@@ -527,23 +527,24 @@ static int spinand_program_page(struct s + retval = spinand_program_data_to_cache(spi_nand, page_id, + offset, len, wbuf); + if (retval < 0) +- return retval; ++ goto cleanup; + retval = spinand_program_execute(spi_nand, page_id); + if (retval < 0) +- return retval; ++ goto cleanup; + while (1) { + retval = spinand_read_status(spi_nand, &status); + if (retval < 0) { + dev_err(&spi_nand->dev, + "error %d reading status register\n", retval); +- return retval; ++ goto cleanup; + } + + if ((status & STATUS_OIP_MASK) == STATUS_READY) { + if ((status & STATUS_P_FAIL_MASK) == STATUS_P_FAIL) { + dev_err(&spi_nand->dev, + "program error, page %d\n", page_id); +- return -1; ++ retval = -1; ++ goto cleanup; + } + break; + } +@@ -553,13 +554,20 @@ static int spinand_program_page(struct s + retval = spinand_disable_ecc(spi_nand); + if (retval < 0) { + dev_err(&spi_nand->dev, "disable ecc failed!!\n"); +- return retval; ++ goto cleanup; + } + enable_hw_ecc = 0; + } ++ kfree(wbuf); + #endif +- + return 0; ++ ++cleanup: ++#ifdef CONFIG_MTD_SPINAND_ONDIEECC ++ kfree(wbuf); ++#endif ++ return retval; ++ + } + + /** diff --git a/target/linux/generic/hack-4.14/702-phy_add_aneg_done_function.patch b/target/linux/generic/hack-4.14/702-phy_add_aneg_done_function.patch index 24d3cdffa3..97bbee96a9 100644 --- a/target/linux/generic/hack-4.14/702-phy_add_aneg_done_function.patch +++ b/target/linux/generic/hack-4.14/702-phy_add_aneg_done_function.patch @@ -15,7 +15,7 @@ --- a/drivers/net/phy/phy_device.c +++ b/drivers/net/phy/phy_device.c -@@ -1455,6 +1455,9 @@ int genphy_update_link(struct phy_device +@@ -1461,6 +1461,9 @@ int genphy_update_link(struct phy_device { int status; diff --git a/target/linux/generic/hack-4.14/721-phy_packets.patch b/target/linux/generic/hack-4.14/721-phy_packets.patch index e3c1c34a4f..6cbb25429f 100644 --- a/target/linux/generic/hack-4.14/721-phy_packets.patch +++ b/target/linux/generic/hack-4.14/721-phy_packets.patch @@ -56,7 +56,7 @@ Signed-off-by: Felix Fietkau */ --- a/include/linux/skbuff.h +++ b/include/linux/skbuff.h -@@ -2512,6 +2512,10 @@ static inline int pskb_trim(struct sk_bu +@@ -2514,6 +2514,10 @@ static inline int pskb_trim(struct sk_bu return (len < skb->len) ? __pskb_trim(skb, len) : 0; } @@ -67,7 +67,7 @@ Signed-off-by: Felix Fietkau /** * pskb_trim_unique - remove end from a paged unique (not cloned) buffer * @skb: buffer to alter -@@ -2642,16 +2646,6 @@ static inline struct sk_buff *dev_alloc_ +@@ -2645,16 +2649,6 @@ static inline struct sk_buff *dev_alloc_ } diff --git a/target/linux/generic/hack-4.14/901-debloat_sock_diag.patch b/target/linux/generic/hack-4.14/901-debloat_sock_diag.patch index 36d69c1dfd..118b1a79c6 100644 --- a/target/linux/generic/hack-4.14/901-debloat_sock_diag.patch +++ b/target/linux/generic/hack-4.14/901-debloat_sock_diag.patch @@ -61,7 +61,7 @@ Signed-off-by: Felix Fietkau struct dst_entry *__sk_dst_check(struct sock *sk, u32 cookie) { struct dst_entry *dst = __sk_dst_get(sk); -@@ -1596,9 +1608,11 @@ void sk_destruct(struct sock *sk) +@@ -1593,9 +1605,11 @@ void sk_destruct(struct sock *sk) static void __sk_free(struct sock *sk) { diff --git a/target/linux/generic/hack-4.14/902-debloat_proc.patch b/target/linux/generic/hack-4.14/902-debloat_proc.patch index 9455380568..aedefb32b4 100644 --- a/target/linux/generic/hack-4.14/902-debloat_proc.patch +++ b/target/linux/generic/hack-4.14/902-debloat_proc.patch @@ -221,7 +221,7 @@ Signed-off-by: Felix Fietkau if (!root_irq_dir) --- a/kernel/time/timer_list.c +++ b/kernel/time/timer_list.c -@@ -389,6 +389,8 @@ static int __init init_timer_list_procfs +@@ -390,6 +390,8 @@ static int __init init_timer_list_procfs { struct proc_dir_entry *pe; @@ -232,7 +232,7 @@ Signed-off-by: Felix Fietkau return -ENOMEM; --- a/mm/vmalloc.c +++ b/mm/vmalloc.c -@@ -2770,6 +2770,8 @@ static const struct file_operations proc +@@ -2783,6 +2783,8 @@ static const struct file_operations proc static int __init proc_vmalloc_init(void) { @@ -243,7 +243,7 @@ Signed-off-by: Felix Fietkau } --- a/mm/vmstat.c +++ b/mm/vmstat.c -@@ -1955,10 +1955,12 @@ void __init init_mm_internals(void) +@@ -1950,10 +1950,12 @@ void __init init_mm_internals(void) start_shepherd_timer(); #endif #ifdef CONFIG_PROC_FS @@ -327,7 +327,7 @@ Signed-off-by: Felix Fietkau --- a/net/core/sock.c +++ b/net/core/sock.c -@@ -3382,6 +3382,8 @@ static __net_initdata struct pernet_oper +@@ -3379,6 +3379,8 @@ static __net_initdata struct pernet_oper static int __init proto_init(void) { @@ -381,7 +381,7 @@ Signed-off-by: Felix Fietkau --- a/net/ipv4/proc.c +++ b/net/ipv4/proc.c -@@ -558,6 +558,9 @@ static __net_initdata struct pernet_oper +@@ -559,6 +559,9 @@ static __net_initdata struct pernet_oper int __init ip_misc_proc_init(void) { diff --git a/target/linux/generic/hack-4.14/904-debloat_dma_buf.patch b/target/linux/generic/hack-4.14/904-debloat_dma_buf.patch index 4d9f947edc..195507996f 100644 --- a/target/linux/generic/hack-4.14/904-debloat_dma_buf.patch +++ b/target/linux/generic/hack-4.14/904-debloat_dma_buf.patch @@ -45,7 +45,7 @@ Signed-off-by: Felix Fietkau #include -@@ -1205,4 +1206,5 @@ static void __exit dma_buf_deinit(void) +@@ -1206,4 +1207,5 @@ static void __exit dma_buf_deinit(void) { dma_buf_uninit_debugfs(); } diff --git a/target/linux/generic/hack-4.14/911-kobject_add_broadcast_uevent.patch b/target/linux/generic/hack-4.14/911-kobject_add_broadcast_uevent.patch index 19400af189..bf46428854 100644 --- a/target/linux/generic/hack-4.14/911-kobject_add_broadcast_uevent.patch +++ b/target/linux/generic/hack-4.14/911-kobject_add_broadcast_uevent.patch @@ -30,7 +30,7 @@ Signed-off-by: Felix Fietkau #endif /* _KOBJECT_H_ */ --- a/lib/kobject_uevent.c +++ b/lib/kobject_uevent.c -@@ -599,6 +599,43 @@ int add_uevent_var(struct kobj_uevent_en +@@ -602,6 +602,43 @@ int add_uevent_var(struct kobj_uevent_en EXPORT_SYMBOL_GPL(add_uevent_var); #if defined(CONFIG_NET) diff --git a/target/linux/generic/hack-4.14/930-crashlog.patch b/target/linux/generic/hack-4.14/930-crashlog.patch index 17ba187925..1479a4c06d 100644 --- a/target/linux/generic/hack-4.14/930-crashlog.patch +++ b/target/linux/generic/hack-4.14/930-crashlog.patch @@ -54,7 +54,7 @@ Signed-off-by: Felix Fietkau depends on BROKEN || !FRV --- a/kernel/Makefile +++ b/kernel/Makefile -@@ -112,6 +112,7 @@ obj-$(CONFIG_CONTEXT_TRACKING) += contex +@@ -113,6 +113,7 @@ obj-$(CONFIG_CONTEXT_TRACKING) += contex obj-$(CONFIG_TORTURE_TEST) += torture.o obj-$(CONFIG_HAS_IOMEM) += memremap.o diff --git a/target/linux/generic/hack-4.19/202-reduce_module_size.patch b/target/linux/generic/hack-4.19/202-reduce_module_size.patch deleted file mode 100644 index 644a18c99c..0000000000 --- a/target/linux/generic/hack-4.19/202-reduce_module_size.patch +++ /dev/null @@ -1,24 +0,0 @@ -From fd66884da2f96d2a7ea73f58b1b86251b959a913 Mon Sep 17 00:00:00 2001 -From: Felix Fietkau -Date: Fri, 7 Jul 2017 16:56:19 +0200 -Subject: kernel: strip unnecessary symbol table information from kernel modules - -reduces default squashfs size on ar71xx by about 4k - -lede-commit: 058d331a39077f159ca8922f1f422a1346d6aa67 -Signed-off-by: Felix Fietkau ---- - Makefile | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - ---- a/Makefile -+++ b/Makefile -@@ -427,7 +427,7 @@ KBUILD_AFLAGS_KERNEL := - KBUILD_CFLAGS_KERNEL := - KBUILD_AFLAGS_MODULE := -DMODULE - KBUILD_CFLAGS_MODULE := -DMODULE --KBUILD_LDFLAGS_MODULE := -T $(srctree)/scripts/module-common.lds -+KBUILD_LDFLAGS_MODULE = -T $(srctree)/scripts/module-common.lds $(if $(CONFIG_PROFILING),,-s) - KBUILD_LDFLAGS := - GCC_PLUGINS_CFLAGS := - diff --git a/target/linux/generic/hack-4.19/204-module_strip.patch b/target/linux/generic/hack-4.19/204-module_strip.patch deleted file mode 100644 index 7fa5d8ddbc..0000000000 --- a/target/linux/generic/hack-4.19/204-module_strip.patch +++ /dev/null @@ -1,206 +0,0 @@ -From a779a482fb9b9f8fcdf8b2519c789b4b9bb5dd05 Mon Sep 17 00:00:00 2001 -From: Felix Fietkau -Date: Fri, 7 Jul 2017 16:56:48 +0200 -Subject: build: add a hack for removing non-essential module info - -Signed-off-by: Felix Fietkau ---- - include/linux/module.h | 13 ++++++++----- - include/linux/moduleparam.h | 15 ++++++++++++--- - init/Kconfig | 7 +++++++ - kernel/module.c | 5 ++++- - scripts/mod/modpost.c | 12 ++++++++++++ - 5 files changed, 43 insertions(+), 9 deletions(-) - ---- a/include/linux/module.h -+++ b/include/linux/module.h -@@ -160,6 +160,7 @@ extern void cleanup_module(void); - - /* Generic info of form tag = "info" */ - #define MODULE_INFO(tag, info) __MODULE_INFO(tag, tag, info) -+#define MODULE_INFO_STRIP(tag, info) __MODULE_INFO_STRIP(tag, tag, info) - - /* For userspace: you can also call me... */ - #define MODULE_ALIAS(_alias) MODULE_INFO(alias, _alias) -@@ -203,12 +204,12 @@ extern void cleanup_module(void); - * Author(s), use "Name " or just "Name", for multiple - * authors use multiple MODULE_AUTHOR() statements/lines. - */ --#define MODULE_AUTHOR(_author) MODULE_INFO(author, _author) -+#define MODULE_AUTHOR(_author) MODULE_INFO_STRIP(author, _author) - - /* What your module does. */ --#define MODULE_DESCRIPTION(_description) MODULE_INFO(description, _description) -+#define MODULE_DESCRIPTION(_description) MODULE_INFO_STRIP(description, _description) - --#ifdef MODULE -+#if defined(MODULE) && !defined(CONFIG_MODULE_STRIPPED) - /* Creates an alias so file2alias.c can find device table. */ - #define MODULE_DEVICE_TABLE(type, name) \ - extern typeof(name) __mod_##type##__##name##_device_table \ -@@ -235,7 +236,9 @@ extern typeof(name) __mod_##type##__##na - */ - - #if defined(MODULE) || !defined(CONFIG_SYSFS) --#define MODULE_VERSION(_version) MODULE_INFO(version, _version) -+#define MODULE_VERSION(_version) MODULE_INFO_STRIP(version, _version) -+#elif defined(CONFIG_MODULE_STRIPPED) -+#define MODULE_VERSION(_version) __MODULE_INFO_DISABLED(version) - #else - #define MODULE_VERSION(_version) \ - static struct module_version_attribute ___modver_attr = { \ -@@ -257,7 +260,7 @@ extern typeof(name) __mod_##type##__##na - /* Optional firmware file (or files) needed by the module - * format is simply firmware file name. Multiple firmware - * files require multiple MODULE_FIRMWARE() specifiers */ --#define MODULE_FIRMWARE(_firmware) MODULE_INFO(firmware, _firmware) -+#define MODULE_FIRMWARE(_firmware) MODULE_INFO_STRIP(firmware, _firmware) - - struct notifier_block; - ---- a/include/linux/moduleparam.h -+++ b/include/linux/moduleparam.h -@@ -17,6 +17,16 @@ - /* Chosen so that structs with an unsigned long line up. */ - #define MAX_PARAM_PREFIX_LEN (64 - sizeof(unsigned long)) - -+/* This struct is here for syntactic coherency, it is not used */ -+#define __MODULE_INFO_DISABLED(name) \ -+ struct __UNIQUE_ID(name) {} -+ -+#ifdef CONFIG_MODULE_STRIPPED -+#define __MODULE_INFO_STRIP(tag, name, info) __MODULE_INFO_DISABLED(name) -+#else -+#define __MODULE_INFO_STRIP(tag, name, info) __MODULE_INFO(tag, name, info) -+#endif -+ - #ifdef MODULE - #define __MODULE_INFO(tag, name, info) \ - static const char __UNIQUE_ID(name)[] \ -@@ -24,8 +34,7 @@ static const char __UNIQUE_ID(name)[] - = __stringify(tag) "=" info - #else /* !MODULE */ - /* This struct is here for syntactic coherency, it is not used */ --#define __MODULE_INFO(tag, name, info) \ -- struct __UNIQUE_ID(name) {} -+#define __MODULE_INFO(tag, name, info) __MODULE_INFO_DISABLED(name) - #endif - #define __MODULE_PARM_TYPE(name, _type) \ - __MODULE_INFO(parmtype, name##type, #name ":" _type) -@@ -33,7 +42,7 @@ static const char __UNIQUE_ID(name)[] - /* One for each parameter, describing how to use it. Some files do - multiple of these per line, so can't just use MODULE_INFO. */ - #define MODULE_PARM_DESC(_parm, desc) \ -- __MODULE_INFO(parm, _parm, #_parm ":" desc) -+ __MODULE_INFO_STRIP(parm, _parm, #_parm ":" desc) - - struct kernel_param; - ---- a/init/Kconfig -+++ b/init/Kconfig -@@ -1994,6 +1994,13 @@ config TRIM_UNUSED_KSYMS - - If unsure, or if you need to build out-of-tree modules, say N. - -+config MODULE_STRIPPED -+ bool "Reduce module size" -+ depends on MODULES -+ help -+ Remove module parameter descriptions, author info, version, aliases, -+ device tables, etc. -+ - endif # MODULES - - config MODULES_TREE_LOOKUP ---- a/kernel/module.c -+++ b/kernel/module.c -@@ -3004,9 +3004,11 @@ static int setup_load_info(struct load_i - - static int check_modinfo(struct module *mod, struct load_info *info, int flags) - { -- const char *modmagic = get_modinfo(info, "vermagic"); - int err; - -+#ifndef CONFIG_MODULE_STRIPPED -+ const char *modmagic = get_modinfo(info, "vermagic"); -+ - if (flags & MODULE_INIT_IGNORE_VERMAGIC) - modmagic = NULL; - -@@ -3027,6 +3029,7 @@ static int check_modinfo(struct module * - mod->name); - add_taint_module(mod, TAINT_OOT_MODULE, LOCKDEP_STILL_OK); - } -+#endif - - check_modinfo_retpoline(mod, info); - ---- a/scripts/mod/modpost.c -+++ b/scripts/mod/modpost.c -@@ -1971,7 +1971,9 @@ static void read_symbols(const char *mod - symname = remove_dot(info.strtab + sym->st_name); - - handle_modversions(mod, &info, sym, symname); -+#ifndef CONFIG_MODULE_STRIPPED - handle_moddevtable(mod, &info, sym, symname); -+#endif - } - if (!is_vmlinux(modname) || vmlinux_section_warnings) - check_sec_ref(mod, modname, &info); -@@ -2134,8 +2136,10 @@ static void add_header(struct buffer *b, - buf_printf(b, "\n"); - buf_printf(b, "BUILD_SALT;\n"); - buf_printf(b, "\n"); -+#ifndef CONFIG_MODULE_STRIPPED - buf_printf(b, "MODULE_INFO(vermagic, VERMAGIC_STRING);\n"); - buf_printf(b, "MODULE_INFO(name, KBUILD_MODNAME);\n"); -+#endif - buf_printf(b, "\n"); - buf_printf(b, "__visible struct module __this_module\n"); - buf_printf(b, "__attribute__((section(\".gnu.linkonce.this_module\"))) = {\n"); -@@ -2152,8 +2156,10 @@ static void add_header(struct buffer *b, - - static void add_intree_flag(struct buffer *b, int is_intree) - { -+#ifndef CONFIG_MODULE_STRIPPED - if (is_intree) - buf_printf(b, "\nMODULE_INFO(intree, \"Y\");\n"); -+#endif - } - - /* Cannot check for assembler */ -@@ -2166,8 +2172,10 @@ static void add_retpoline(struct buffer - - static void add_staging_flag(struct buffer *b, const char *name) - { -+#ifndef CONFIG_MODULE_STRIPPED - if (strstarts(name, "drivers/staging")) - buf_printf(b, "\nMODULE_INFO(staging, \"Y\");\n"); -+#endif - } - - /** -@@ -2266,11 +2274,13 @@ static void add_depends(struct buffer *b - - static void add_srcversion(struct buffer *b, struct module *mod) - { -+#ifndef CONFIG_MODULE_STRIPPED - if (mod->srcversion[0]) { - buf_printf(b, "\n"); - buf_printf(b, "MODULE_INFO(srcversion, \"%s\");\n", - mod->srcversion); - } -+#endif - } - - static void write_if_changed(struct buffer *b, const char *fname) -@@ -2507,7 +2517,9 @@ int main(int argc, char **argv) - add_staging_flag(&buf, mod->name); - err |= add_versions(&buf, mod); - add_depends(&buf, mod, modules); -+#ifndef CONFIG_MODULE_STRIPPED - add_moddevtable(&buf, mod); -+#endif - add_srcversion(&buf, mod); - - sprintf(fname, "%s.mod.c", mod->name); diff --git a/target/linux/generic/hack-4.19/207-disable-modorder.patch b/target/linux/generic/hack-4.19/207-disable-modorder.patch deleted file mode 100644 index 92c3343dd3..0000000000 --- a/target/linux/generic/hack-4.19/207-disable-modorder.patch +++ /dev/null @@ -1,44 +0,0 @@ -From c9ef4ab0f54356ee9f91d9676ea0ec123840ddc7 Mon Sep 17 00:00:00 2001 -From: Felix Fietkau -Date: Fri, 7 Jul 2017 16:57:33 +0200 -Subject: kernel: do not build modules.order - -It is not needed for anything on the system and skipping this saves some -build time, especially in cases where there is nothing to do. - -lede-commit: afc1675833a7bf5df094f59f7250369520646d04 -Signed-off-by: Felix Fietkau ---- - Makefile | 2 -- - scripts/Makefile.build | 2 +- - 2 files changed, 1 insertion(+), 3 deletions(-) - ---- a/Makefile -+++ b/Makefile -@@ -1227,7 +1227,6 @@ all: modules - - PHONY += modules - modules: $(vmlinux-dirs) $(if $(KBUILD_BUILTIN),vmlinux) modules.builtin -- $(Q)$(AWK) '!x[$$0]++' $(vmlinux-dirs:%=$(objtree)/%/modules.order) > $(objtree)/modules.order - @$(kecho) ' Building modules, stage 2.'; - $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modpost - -@@ -1256,7 +1255,6 @@ _modinst_: - rm -f $(MODLIB)/build ; \ - ln -s $(CURDIR) $(MODLIB)/build ; \ - fi -- @cp -f $(objtree)/modules.order $(MODLIB)/ - @cp -f $(objtree)/modules.builtin $(MODLIB)/ - $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modinst - ---- a/scripts/Makefile.build -+++ b/scripts/Makefile.build -@@ -78,7 +78,7 @@ modorder-target := $(obj)/modules.order - # We keep a list of all modules in $(MODVERDIR) - - __build: $(if $(KBUILD_BUILTIN),$(builtin-target) $(lib-target) $(extra-y)) \ -- $(if $(KBUILD_MODULES),$(obj-m) $(modorder-target)) \ -+ $(if $(KBUILD_MODULES),$(obj-m)) \ - $(subdir-ym) $(always) - @: - diff --git a/target/linux/generic/hack-4.19/210-darwin_scripts_include.patch b/target/linux/generic/hack-4.19/210-darwin_scripts_include.patch deleted file mode 100644 index be6adc0d11..0000000000 --- a/target/linux/generic/hack-4.19/210-darwin_scripts_include.patch +++ /dev/null @@ -1,3053 +0,0 @@ -From db7c30dcd9a0391bf13b62c9f91e144d762ef43a Mon Sep 17 00:00:00 2001 -From: Florian Fainelli -Date: Fri, 7 Jul 2017 17:00:49 +0200 -Subject: Add an OSX specific patch to make the kernel be compiled - -lede-commit: 3fc2a24f0422b2f55f9ed43f116db3111f700526 -Signed-off-by: Florian Fainelli ---- - scripts/kconfig/Makefile | 3 + - scripts/mod/elf.h | 3007 ++++++++++++++++++++++++++++++++++++++++++++ - scripts/mod/mk_elfconfig.c | 4 + - scripts/mod/modpost.h | 4 + - 4 files changed, 3018 insertions(+) - create mode 100644 scripts/mod/elf.h - ---- /dev/null -+++ b/scripts/mod/elf.h -@@ -0,0 +1,3007 @@ -+/* This file defines standard ELF types, structures, and macros. -+ Copyright (C) 1995-2012 Free Software Foundation, Inc. -+ This file is part of the GNU C Library. -+ -+ The GNU C Library 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. -+ -+ The GNU C Library is distributed in the hope that 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 the GNU C Library; if not, see -+ . */ -+ -+#ifndef _ELF_H -+#define _ELF_H 1 -+ -+/* Standard ELF types. */ -+ -+#include -+ -+/* Type for a 16-bit quantity. */ -+typedef uint16_t Elf32_Half; -+typedef uint16_t Elf64_Half; -+ -+/* Types for signed and unsigned 32-bit quantities. */ -+typedef uint32_t Elf32_Word; -+typedef int32_t Elf32_Sword; -+typedef uint32_t Elf64_Word; -+typedef int32_t Elf64_Sword; -+ -+/* Types for signed and unsigned 64-bit quantities. */ -+typedef uint64_t Elf32_Xword; -+typedef int64_t Elf32_Sxword; -+typedef uint64_t Elf64_Xword; -+typedef int64_t Elf64_Sxword; -+ -+/* Type of addresses. */ -+typedef uint32_t Elf32_Addr; -+typedef uint64_t Elf64_Addr; -+ -+/* Type of file offsets. */ -+typedef uint32_t Elf32_Off; -+typedef uint64_t Elf64_Off; -+ -+/* Type for section indices, which are 16-bit quantities. */ -+typedef uint16_t Elf32_Section; -+typedef uint16_t Elf64_Section; -+ -+/* Type for version symbol information. */ -+typedef Elf32_Half Elf32_Versym; -+typedef Elf64_Half Elf64_Versym; -+ -+ -+/* The ELF file header. This appears at the start of every ELF file. */ -+ -+#define EI_NIDENT (16) -+ -+typedef struct -+{ -+ unsigned char e_ident[EI_NIDENT]; /* Magic number and other info */ -+ Elf32_Half e_type; /* Object file type */ -+ Elf32_Half e_machine; /* Architecture */ -+ Elf32_Word e_version; /* Object file version */ -+ Elf32_Addr e_entry; /* Entry point virtual address */ -+ Elf32_Off e_phoff; /* Program header table file offset */ -+ Elf32_Off e_shoff; /* Section header table file offset */ -+ Elf32_Word e_flags; /* Processor-specific flags */ -+ Elf32_Half e_ehsize; /* ELF header size in bytes */ -+ Elf32_Half e_phentsize; /* Program header table entry size */ -+ Elf32_Half e_phnum; /* Program header table entry count */ -+ Elf32_Half e_shentsize; /* Section header table entry size */ -+ Elf32_Half e_shnum; /* Section header table entry count */ -+ Elf32_Half e_shstrndx; /* Section header string table index */ -+} Elf32_Ehdr; -+ -+typedef struct -+{ -+ unsigned char e_ident[EI_NIDENT]; /* Magic number and other info */ -+ Elf64_Half e_type; /* Object file type */ -+ Elf64_Half e_machine; /* Architecture */ -+ Elf64_Word e_version; /* Object file version */ -+ Elf64_Addr e_entry; /* Entry point virtual address */ -+ Elf64_Off e_phoff; /* Program header table file offset */ -+ Elf64_Off e_shoff; /* Section header table file offset */ -+ Elf64_Word e_flags; /* Processor-specific flags */ -+ Elf64_Half e_ehsize; /* ELF header size in bytes */ -+ Elf64_Half e_phentsize; /* Program header table entry size */ -+ Elf64_Half e_phnum; /* Program header table entry count */ -+ Elf64_Half e_shentsize; /* Section header table entry size */ -+ Elf64_Half e_shnum; /* Section header table entry count */ -+ Elf64_Half e_shstrndx; /* Section header string table index */ -+} Elf64_Ehdr; -+ -+/* Fields in the e_ident array. The EI_* macros are indices into the -+ array. The macros under each EI_* macro are the values the byte -+ may have. */ -+ -+#define EI_MAG0 0 /* File identification byte 0 index */ -+#define ELFMAG0 0x7f /* Magic number byte 0 */ -+ -+#define EI_MAG1 1 /* File identification byte 1 index */ -+#define ELFMAG1 'E' /* Magic number byte 1 */ -+ -+#define EI_MAG2 2 /* File identification byte 2 index */ -+#define ELFMAG2 'L' /* Magic number byte 2 */ -+ -+#define EI_MAG3 3 /* File identification byte 3 index */ -+#define ELFMAG3 'F' /* Magic number byte 3 */ -+ -+/* Conglomeration of the identification bytes, for easy testing as a word. */ -+#define ELFMAG "\177ELF" -+#define SELFMAG 4 -+ -+#define EI_CLASS 4 /* File class byte index */ -+#define ELFCLASSNONE 0 /* Invalid class */ -+#define ELFCLASS32 1 /* 32-bit objects */ -+#define ELFCLASS64 2 /* 64-bit objects */ -+#define ELFCLASSNUM 3 -+ -+#define EI_DATA 5 /* Data encoding byte index */ -+#define ELFDATANONE 0 /* Invalid data encoding */ -+#define ELFDATA2LSB 1 /* 2's complement, little endian */ -+#define ELFDATA2MSB 2 /* 2's complement, big endian */ -+#define ELFDATANUM 3 -+ -+#define EI_VERSION 6 /* File version byte index */ -+ /* Value must be EV_CURRENT */ -+ -+#define EI_OSABI 7 /* OS ABI identification */ -+#define ELFOSABI_NONE 0 /* UNIX System V ABI */ -+#define ELFOSABI_SYSV 0 /* Alias. */ -+#define ELFOSABI_HPUX 1 /* HP-UX */ -+#define ELFOSABI_NETBSD 2 /* NetBSD. */ -+#define ELFOSABI_GNU 3 /* Object uses GNU ELF extensions. */ -+#define ELFOSABI_LINUX ELFOSABI_GNU /* Compatibility alias. */ -+#define ELFOSABI_SOLARIS 6 /* Sun Solaris. */ -+#define ELFOSABI_AIX 7 /* IBM AIX. */ -+#define ELFOSABI_IRIX 8 /* SGI Irix. */ -+#define ELFOSABI_FREEBSD 9 /* FreeBSD. */ -+#define ELFOSABI_TRU64 10 /* Compaq TRU64 UNIX. */ -+#define ELFOSABI_MODESTO 11 /* Novell Modesto. */ -+#define ELFOSABI_OPENBSD 12 /* OpenBSD. */ -+#define ELFOSABI_ARM_AEABI 64 /* ARM EABI */ -+#define ELFOSABI_ARM 97 /* ARM */ -+#define ELFOSABI_STANDALONE 255 /* Standalone (embedded) application */ -+ -+#define EI_ABIVERSION 8 /* ABI version */ -+ -+#define EI_PAD 9 /* Byte index of padding bytes */ -+ -+/* Legal values for e_type (object file type). */ -+ -+#define ET_NONE 0 /* No file type */ -+#define ET_REL 1 /* Relocatable file */ -+#define ET_EXEC 2 /* Executable file */ -+#define ET_DYN 3 /* Shared object file */ -+#define ET_CORE 4 /* Core file */ -+#define ET_NUM 5 /* Number of defined types */ -+#define ET_LOOS 0xfe00 /* OS-specific range start */ -+#define ET_HIOS 0xfeff /* OS-specific range end */ -+#define ET_LOPROC 0xff00 /* Processor-specific range start */ -+#define ET_HIPROC 0xffff /* Processor-specific range end */ -+ -+/* Legal values for e_machine (architecture). */ -+ -+#define EM_NONE 0 /* No machine */ -+#define EM_M32 1 /* AT&T WE 32100 */ -+#define EM_SPARC 2 /* SUN SPARC */ -+#define EM_386 3 /* Intel 80386 */ -+#define EM_68K 4 /* Motorola m68k family */ -+#define EM_88K 5 /* Motorola m88k family */ -+#define EM_860 7 /* Intel 80860 */ -+#define EM_MIPS 8 /* MIPS R3000 big-endian */ -+#define EM_S370 9 /* IBM System/370 */ -+#define EM_MIPS_RS3_LE 10 /* MIPS R3000 little-endian */ -+ -+#define EM_PARISC 15 /* HPPA */ -+#define EM_VPP500 17 /* Fujitsu VPP500 */ -+#define EM_SPARC32PLUS 18 /* Sun's "v8plus" */ -+#define EM_960 19 /* Intel 80960 */ -+#define EM_PPC 20 /* PowerPC */ -+#define EM_PPC64 21 /* PowerPC 64-bit */ -+#define EM_S390 22 /* IBM S390 */ -+ -+#define EM_V800 36 /* NEC V800 series */ -+#define EM_FR20 37 /* Fujitsu FR20 */ -+#define EM_RH32 38 /* TRW RH-32 */ -+#define EM_RCE 39 /* Motorola RCE */ -+#define EM_ARM 40 /* ARM */ -+#define EM_FAKE_ALPHA 41 /* Digital Alpha */ -+#define EM_SH 42 /* Hitachi SH */ -+#define EM_SPARCV9 43 /* SPARC v9 64-bit */ -+#define EM_TRICORE 44 /* Siemens Tricore */ -+#define EM_ARC 45 /* Argonaut RISC Core */ -+#define EM_H8_300 46 /* Hitachi H8/300 */ -+#define EM_H8_300H 47 /* Hitachi H8/300H */ -+#define EM_H8S 48 /* Hitachi H8S */ -+#define EM_H8_500 49 /* Hitachi H8/500 */ -+#define EM_IA_64 50 /* Intel Merced */ -+#define EM_MIPS_X 51 /* Stanford MIPS-X */ -+#define EM_COLDFIRE 52 /* Motorola Coldfire */ -+#define EM_68HC12 53 /* Motorola M68HC12 */ -+#define EM_MMA 54 /* Fujitsu MMA Multimedia Accelerator*/ -+#define EM_PCP 55 /* Siemens PCP */ -+#define EM_NCPU 56 /* Sony nCPU embeeded RISC */ -+#define EM_NDR1 57 /* Denso NDR1 microprocessor */ -+#define EM_STARCORE 58 /* Motorola Start*Core processor */ -+#define EM_ME16 59 /* Toyota ME16 processor */ -+#define EM_ST100 60 /* STMicroelectronic ST100 processor */ -+#define EM_TINYJ 61 /* Advanced Logic Corp. Tinyj emb.fam*/ -+#define EM_X86_64 62 /* AMD x86-64 architecture */ -+#define EM_PDSP 63 /* Sony DSP Processor */ -+ -+#define EM_FX66 66 /* Siemens FX66 microcontroller */ -+#define EM_ST9PLUS 67 /* STMicroelectronics ST9+ 8/16 mc */ -+#define EM_ST7 68 /* STmicroelectronics ST7 8 bit mc */ -+#define EM_68HC16 69 /* Motorola MC68HC16 microcontroller */ -+#define EM_68HC11 70 /* Motorola MC68HC11 microcontroller */ -+#define EM_68HC08 71 /* Motorola MC68HC08 microcontroller */ -+#define EM_68HC05 72 /* Motorola MC68HC05 microcontroller */ -+#define EM_SVX 73 /* Silicon Graphics SVx */ -+#define EM_ST19 74 /* STMicroelectronics ST19 8 bit mc */ -+#define EM_VAX 75 /* Digital VAX */ -+#define EM_CRIS 76 /* Axis Communications 32-bit embedded processor */ -+#define EM_JAVELIN 77 /* Infineon Technologies 32-bit embedded processor */ -+#define EM_FIREPATH 78 /* Element 14 64-bit DSP Processor */ -+#define EM_ZSP 79 /* LSI Logic 16-bit DSP Processor */ -+#define EM_MMIX 80 /* Donald Knuth's educational 64-bit processor */ -+#define EM_HUANY 81 /* Harvard University machine-independent object files */ -+#define EM_PRISM 82 /* SiTera Prism */ -+#define EM_AVR 83 /* Atmel AVR 8-bit microcontroller */ -+#define EM_FR30 84 /* Fujitsu FR30 */ -+#define EM_D10V 85 /* Mitsubishi D10V */ -+#define EM_D30V 86 /* Mitsubishi D30V */ -+#define EM_V850 87 /* NEC v850 */ -+#define EM_M32R 88 /* Mitsubishi M32R */ -+#define EM_MN10300 89 /* Matsushita MN10300 */ -+#define EM_MN10200 90 /* Matsushita MN10200 */ -+#define EM_PJ 91 /* picoJava */ -+#define EM_OPENRISC 92 /* OpenRISC 32-bit embedded processor */ -+#define EM_ARC_A5 93 /* ARC Cores Tangent-A5 */ -+#define EM_XTENSA 94 /* Tensilica Xtensa Architecture */ -+#define EM_TILEPRO 188 /* Tilera TILEPro */ -+#define EM_TILEGX 191 /* Tilera TILE-Gx */ -+#define EM_NUM 192 -+ -+/* If it is necessary to assign new unofficial EM_* values, please -+ pick large random numbers (0x8523, 0xa7f2, etc.) to minimize the -+ chances of collision with official or non-GNU unofficial values. */ -+ -+#define EM_ALPHA 0x9026 -+ -+/* Legal values for e_version (version). */ -+ -+#define EV_NONE 0 /* Invalid ELF version */ -+#define EV_CURRENT 1 /* Current version */ -+#define EV_NUM 2 -+ -+/* Section header. */ -+ -+typedef struct -+{ -+ Elf32_Word sh_name; /* Section name (string tbl index) */ -+ Elf32_Word sh_type; /* Section type */ -+ Elf32_Word sh_flags; /* Section flags */ -+ Elf32_Addr sh_addr; /* Section virtual addr at execution */ -+ Elf32_Off sh_offset; /* Section file offset */ -+ Elf32_Word sh_size; /* Section size in bytes */ -+ Elf32_Word sh_link; /* Link to another section */ -+ Elf32_Word sh_info; /* Additional section information */ -+ Elf32_Word sh_addralign; /* Section alignment */ -+ Elf32_Word sh_entsize; /* Entry size if section holds table */ -+} Elf32_Shdr; -+ -+typedef struct -+{ -+ Elf64_Word sh_name; /* Section name (string tbl index) */ -+ Elf64_Word sh_type; /* Section type */ -+ Elf64_Xword sh_flags; /* Section flags */ -+ Elf64_Addr sh_addr; /* Section virtual addr at execution */ -+ Elf64_Off sh_offset; /* Section file offset */ -+ Elf64_Xword sh_size; /* Section size in bytes */ -+ Elf64_Word sh_link; /* Link to another section */ -+ Elf64_Word sh_info; /* Additional section information */ -+ Elf64_Xword sh_addralign; /* Section alignment */ -+ Elf64_Xword sh_entsize; /* Entry size if section holds table */ -+} Elf64_Shdr; -+ -+/* Special section indices. */ -+ -+#define SHN_UNDEF 0 /* Undefined section */ -+#define SHN_LORESERVE 0xff00 /* Start of reserved indices */ -+#define SHN_LOPROC 0xff00 /* Start of processor-specific */ -+#define SHN_BEFORE 0xff00 /* Order section before all others -+ (Solaris). */ -+#define SHN_AFTER 0xff01 /* Order section after all others -+ (Solaris). */ -+#define SHN_HIPROC 0xff1f /* End of processor-specific */ -+#define SHN_LOOS 0xff20 /* Start of OS-specific */ -+#define SHN_HIOS 0xff3f /* End of OS-specific */ -+#define SHN_ABS 0xfff1 /* Associated symbol is absolute */ -+#define SHN_COMMON 0xfff2 /* Associated symbol is common */ -+#define SHN_XINDEX 0xffff /* Index is in extra table. */ -+#define SHN_HIRESERVE 0xffff /* End of reserved indices */ -+ -+/* Legal values for sh_type (section type). */ -+ -+#define SHT_NULL 0 /* Section header table entry unused */ -+#define SHT_PROGBITS 1 /* Program data */ -+#define SHT_SYMTAB 2 /* Symbol table */ -+#define SHT_STRTAB 3 /* String table */ -+#define SHT_RELA 4 /* Relocation entries with addends */ -+#define SHT_HASH 5 /* Symbol hash table */ -+#define SHT_DYNAMIC 6 /* Dynamic linking information */ -+#define SHT_NOTE 7 /* Notes */ -+#define SHT_NOBITS 8 /* Program space with no data (bss) */ -+#define SHT_REL 9 /* Relocation entries, no addends */ -+#define SHT_SHLIB 10 /* Reserved */ -+#define SHT_DYNSYM 11 /* Dynamic linker symbol table */ -+#define SHT_INIT_ARRAY 14 /* Array of constructors */ -+#define SHT_FINI_ARRAY 15 /* Array of destructors */ -+#define SHT_PREINIT_ARRAY 16 /* Array of pre-constructors */ -+#define SHT_GROUP 17 /* Section group */ -+#define SHT_SYMTAB_SHNDX 18 /* Extended section indeces */ -+#define SHT_NUM 19 /* Number of defined types. */ -+#define SHT_LOOS 0x60000000 /* Start OS-specific. */ -+#define SHT_GNU_ATTRIBUTES 0x6ffffff5 /* Object attributes. */ -+#define SHT_GNU_HASH 0x6ffffff6 /* GNU-style hash table. */ -+#define SHT_GNU_LIBLIST 0x6ffffff7 /* Prelink library list */ -+#define SHT_CHECKSUM 0x6ffffff8 /* Checksum for DSO content. */ -+#define SHT_LOSUNW 0x6ffffffa /* Sun-specific low bound. */ -+#define SHT_SUNW_move 0x6ffffffa -+#define SHT_SUNW_COMDAT 0x6ffffffb -+#define SHT_SUNW_syminfo 0x6ffffffc -+#define SHT_GNU_verdef 0x6ffffffd /* Version definition section. */ -+#define SHT_GNU_verneed 0x6ffffffe /* Version needs section. */ -+#define SHT_GNU_versym 0x6fffffff /* Version symbol table. */ -+#define SHT_HISUNW 0x6fffffff /* Sun-specific high bound. */ -+#define SHT_HIOS 0x6fffffff /* End OS-specific type */ -+#define SHT_LOPROC 0x70000000 /* Start of processor-specific */ -+#define SHT_HIPROC 0x7fffffff /* End of processor-specific */ -+#define SHT_LOUSER 0x80000000 /* Start of application-specific */ -+#define SHT_HIUSER 0x8fffffff /* End of application-specific */ -+ -+/* Legal values for sh_flags (section flags). */ -+ -+#define SHF_WRITE (1 << 0) /* Writable */ -+#define SHF_ALLOC (1 << 1) /* Occupies memory during execution */ -+#define SHF_EXECINSTR (1 << 2) /* Executable */ -+#define SHF_MERGE (1 << 4) /* Might be merged */ -+#define SHF_STRINGS (1 << 5) /* Contains nul-terminated strings */ -+#define SHF_INFO_LINK (1 << 6) /* `sh_info' contains SHT index */ -+#define SHF_LINK_ORDER (1 << 7) /* Preserve order after combining */ -+#define SHF_OS_NONCONFORMING (1 << 8) /* Non-standard OS specific handling -+ required */ -+#define SHF_GROUP (1 << 9) /* Section is member of a group. */ -+#define SHF_TLS (1 << 10) /* Section hold thread-local data. */ -+#define SHF_MASKOS 0x0ff00000 /* OS-specific. */ -+#define SHF_MASKPROC 0xf0000000 /* Processor-specific */ -+#define SHF_ORDERED (1 << 30) /* Special ordering requirement -+ (Solaris). */ -+#define SHF_EXCLUDE (1 << 31) /* Section is excluded unless -+ referenced or allocated (Solaris).*/ -+ -+/* Section group handling. */ -+#define GRP_COMDAT 0x1 /* Mark group as COMDAT. */ -+ -+/* Symbol table entry. */ -+ -+typedef struct -+{ -+ Elf32_Word st_name; /* Symbol name (string tbl index) */ -+ Elf32_Addr st_value; /* Symbol value */ -+ Elf32_Word st_size; /* Symbol size */ -+ unsigned char st_info; /* Symbol type and binding */ -+ unsigned char st_other; /* Symbol visibility */ -+ Elf32_Section st_shndx; /* Section index */ -+} Elf32_Sym; -+ -+typedef struct -+{ -+ Elf64_Word st_name; /* Symbol name (string tbl index) */ -+ unsigned char st_info; /* Symbol type and binding */ -+ unsigned char st_other; /* Symbol visibility */ -+ Elf64_Section st_shndx; /* Section index */ -+ Elf64_Addr st_value; /* Symbol value */ -+ Elf64_Xword st_size; /* Symbol size */ -+} Elf64_Sym; -+ -+/* The syminfo section if available contains additional information about -+ every dynamic symbol. */ -+ -+typedef struct -+{ -+ Elf32_Half si_boundto; /* Direct bindings, symbol bound to */ -+ Elf32_Half si_flags; /* Per symbol flags */ -+} Elf32_Syminfo; -+ -+typedef struct -+{ -+ Elf64_Half si_boundto; /* Direct bindings, symbol bound to */ -+ Elf64_Half si_flags; /* Per symbol flags */ -+} Elf64_Syminfo; -+ -+/* Possible values for si_boundto. */ -+#define SYMINFO_BT_SELF 0xffff /* Symbol bound to self */ -+#define SYMINFO_BT_PARENT 0xfffe /* Symbol bound to parent */ -+#define SYMINFO_BT_LOWRESERVE 0xff00 /* Beginning of reserved entries */ -+ -+/* Possible bitmasks for si_flags. */ -+#define SYMINFO_FLG_DIRECT 0x0001 /* Direct bound symbol */ -+#define SYMINFO_FLG_PASSTHRU 0x0002 /* Pass-thru symbol for translator */ -+#define SYMINFO_FLG_COPY 0x0004 /* Symbol is a copy-reloc */ -+#define SYMINFO_FLG_LAZYLOAD 0x0008 /* Symbol bound to object to be lazy -+ loaded */ -+/* Syminfo version values. */ -+#define SYMINFO_NONE 0 -+#define SYMINFO_CURRENT 1 -+#define SYMINFO_NUM 2 -+ -+ -+/* How to extract and insert information held in the st_info field. */ -+ -+#define ELF32_ST_BIND(val) (((unsigned char) (val)) >> 4) -+#define ELF32_ST_TYPE(val) ((val) & 0xf) -+#define ELF32_ST_INFO(bind, type) (((bind) << 4) + ((type) & 0xf)) -+ -+/* Both Elf32_Sym and Elf64_Sym use the same one-byte st_info field. */ -+#define ELF64_ST_BIND(val) ELF32_ST_BIND (val) -+#define ELF64_ST_TYPE(val) ELF32_ST_TYPE (val) -+#define ELF64_ST_INFO(bind, type) ELF32_ST_INFO ((bind), (type)) -+ -+/* Legal values for ST_BIND subfield of st_info (symbol binding). */ -+ -+#define STB_LOCAL 0 /* Local symbol */ -+#define STB_GLOBAL 1 /* Global symbol */ -+#define STB_WEAK 2 /* Weak symbol */ -+#define STB_NUM 3 /* Number of defined types. */ -+#define STB_LOOS 10 /* Start of OS-specific */ -+#define STB_GNU_UNIQUE 10 /* Unique symbol. */ -+#define STB_HIOS 12 /* End of OS-specific */ -+#define STB_LOPROC 13 /* Start of processor-specific */ -+#define STB_HIPROC 15 /* End of processor-specific */ -+ -+/* Legal values for ST_TYPE subfield of st_info (symbol type). */ -+ -+#define STT_NOTYPE 0 /* Symbol type is unspecified */ -+#define STT_OBJECT 1 /* Symbol is a data object */ -+#define STT_FUNC 2 /* Symbol is a code object */ -+#define STT_SECTION 3 /* Symbol associated with a section */ -+#define STT_FILE 4 /* Symbol's name is file name */ -+#define STT_COMMON 5 /* Symbol is a common data object */ -+#define STT_TLS 6 /* Symbol is thread-local data object*/ -+#define STT_NUM 7 /* Number of defined types. */ -+#define STT_LOOS 10 /* Start of OS-specific */ -+#define STT_GNU_IFUNC 10 /* Symbol is indirect code object */ -+#define STT_HIOS 12 /* End of OS-specific */ -+#define STT_LOPROC 13 /* Start of processor-specific */ -+#define STT_HIPROC 15 /* End of processor-specific */ -+ -+ -+/* Symbol table indices are found in the hash buckets and chain table -+ of a symbol hash table section. This special index value indicates -+ the end of a chain, meaning no further symbols are found in that bucket. */ -+ -+#define STN_UNDEF 0 /* End of a chain. */ -+ -+ -+/* How to extract and insert information held in the st_other field. */ -+ -+#define ELF32_ST_VISIBILITY(o) ((o) & 0x03) -+ -+/* For ELF64 the definitions are the same. */ -+#define ELF64_ST_VISIBILITY(o) ELF32_ST_VISIBILITY (o) -+ -+/* Symbol visibility specification encoded in the st_other field. */ -+#define STV_DEFAULT 0 /* Default symbol visibility rules */ -+#define STV_INTERNAL 1 /* Processor specific hidden class */ -+#define STV_HIDDEN 2 /* Sym unavailable in other modules */ -+#define STV_PROTECTED 3 /* Not preemptible, not exported */ -+ -+ -+/* Relocation table entry without addend (in section of type SHT_REL). */ -+ -+typedef struct -+{ -+ Elf32_Addr r_offset; /* Address */ -+ Elf32_Word r_info; /* Relocation type and symbol index */ -+} Elf32_Rel; -+ -+/* I have seen two different definitions of the Elf64_Rel and -+ Elf64_Rela structures, so we'll leave them out until Novell (or -+ whoever) gets their act together. */ -+/* The following, at least, is used on Sparc v9, MIPS, and Alpha. */ -+ -+typedef struct -+{ -+ Elf64_Addr r_offset; /* Address */ -+ Elf64_Xword r_info; /* Relocation type and symbol index */ -+} Elf64_Rel; -+ -+/* Relocation table entry with addend (in section of type SHT_RELA). */ -+ -+typedef struct -+{ -+ Elf32_Addr r_offset; /* Address */ -+ Elf32_Word r_info; /* Relocation type and symbol index */ -+ Elf32_Sword r_addend; /* Addend */ -+} Elf32_Rela; -+ -+typedef struct -+{ -+ Elf64_Addr r_offset; /* Address */ -+ Elf64_Xword r_info; /* Relocation type and symbol index */ -+ Elf64_Sxword r_addend; /* Addend */ -+} Elf64_Rela; -+ -+/* How to extract and insert information held in the r_info field. */ -+ -+#define ELF32_R_SYM(val) ((val) >> 8) -+#define ELF32_R_TYPE(val) ((val) & 0xff) -+#define ELF32_R_INFO(sym, type) (((sym) << 8) + ((type) & 0xff)) -+ -+#define ELF64_R_SYM(i) ((i) >> 32) -+#define ELF64_R_TYPE(i) ((i) & 0xffffffff) -+#define ELF64_R_INFO(sym,type) ((((Elf64_Xword) (sym)) << 32) + (type)) -+ -+/* Program segment header. */ -+ -+typedef struct -+{ -+ Elf32_Word p_type; /* Segment type */ -+ Elf32_Off p_offset; /* Segment file offset */ -+ Elf32_Addr p_vaddr; /* Segment virtual address */ -+ Elf32_Addr p_paddr; /* Segment physical address */ -+ Elf32_Word p_filesz; /* Segment size in file */ -+ Elf32_Word p_memsz; /* Segment size in memory */ -+ Elf32_Word p_flags; /* Segment flags */ -+ Elf32_Word p_align; /* Segment alignment */ -+} Elf32_Phdr; -+ -+typedef struct -+{ -+ Elf64_Word p_type; /* Segment type */ -+ Elf64_Word p_flags; /* Segment flags */ -+ Elf64_Off p_offset; /* Segment file offset */ -+ Elf64_Addr p_vaddr; /* Segment virtual address */ -+ Elf64_Addr p_paddr; /* Segment physical address */ -+ Elf64_Xword p_filesz; /* Segment size in file */ -+ Elf64_Xword p_memsz; /* Segment size in memory */ -+ Elf64_Xword p_align; /* Segment alignment */ -+} Elf64_Phdr; -+ -+/* Special value for e_phnum. This indicates that the real number of -+ program headers is too large to fit into e_phnum. Instead the real -+ value is in the field sh_info of section 0. */ -+ -+#define PN_XNUM 0xffff -+ -+/* Legal values for p_type (segment type). */ -+ -+#define PT_NULL 0 /* Program header table entry unused */ -+#define PT_LOAD 1 /* Loadable program segment */ -+#define PT_DYNAMIC 2 /* Dynamic linking information */ -+#define PT_INTERP 3 /* Program interpreter */ -+#define PT_NOTE 4 /* Auxiliary information */ -+#define PT_SHLIB 5 /* Reserved */ -+#define PT_PHDR 6 /* Entry for header table itself */ -+#define PT_TLS 7 /* Thread-local storage segment */ -+#define PT_NUM 8 /* Number of defined types */ -+#define PT_LOOS 0x60000000 /* Start of OS-specific */ -+#define PT_GNU_EH_FRAME 0x6474e550 /* GCC .eh_frame_hdr segment */ -+#define PT_GNU_STACK 0x6474e551 /* Indicates stack executability */ -+#define PT_GNU_RELRO 0x6474e552 /* Read-only after relocation */ -+#define PT_LOSUNW 0x6ffffffa -+#define PT_SUNWBSS 0x6ffffffa /* Sun Specific segment */ -+#define PT_SUNWSTACK 0x6ffffffb /* Stack segment */ -+#define PT_HISUNW 0x6fffffff -+#define PT_HIOS 0x6fffffff /* End of OS-specific */ -+#define PT_LOPROC 0x70000000 /* Start of processor-specific */ -+#define PT_HIPROC 0x7fffffff /* End of processor-specific */ -+ -+/* Legal values for p_flags (segment flags). */ -+ -+#define PF_X (1 << 0) /* Segment is executable */ -+#define PF_W (1 << 1) /* Segment is writable */ -+#define PF_R (1 << 2) /* Segment is readable */ -+#define PF_MASKOS 0x0ff00000 /* OS-specific */ -+#define PF_MASKPROC 0xf0000000 /* Processor-specific */ -+ -+/* Legal values for note segment descriptor types for core files. */ -+ -+#define NT_PRSTATUS 1 /* Contains copy of prstatus struct */ -+#define NT_FPREGSET 2 /* Contains copy of fpregset struct */ -+#define NT_PRPSINFO 3 /* Contains copy of prpsinfo struct */ -+#define NT_PRXREG 4 /* Contains copy of prxregset struct */ -+#define NT_TASKSTRUCT 4 /* Contains copy of task structure */ -+#define NT_PLATFORM 5 /* String from sysinfo(SI_PLATFORM) */ -+#define NT_AUXV 6 /* Contains copy of auxv array */ -+#define NT_GWINDOWS 7 /* Contains copy of gwindows struct */ -+#define NT_ASRS 8 /* Contains copy of asrset struct */ -+#define NT_PSTATUS 10 /* Contains copy of pstatus struct */ -+#define NT_PSINFO 13 /* Contains copy of psinfo struct */ -+#define NT_PRCRED 14 /* Contains copy of prcred struct */ -+#define NT_UTSNAME 15 /* Contains copy of utsname struct */ -+#define NT_LWPSTATUS 16 /* Contains copy of lwpstatus struct */ -+#define NT_LWPSINFO 17 /* Contains copy of lwpinfo struct */ -+#define NT_PRFPXREG 20 /* Contains copy of fprxregset struct */ -+#define NT_PRXFPREG 0x46e62b7f /* Contains copy of user_fxsr_struct */ -+#define NT_PPC_VMX 0x100 /* PowerPC Altivec/VMX registers */ -+#define NT_PPC_SPE 0x101 /* PowerPC SPE/EVR registers */ -+#define NT_PPC_VSX 0x102 /* PowerPC VSX registers */ -+#define NT_386_TLS 0x200 /* i386 TLS slots (struct user_desc) */ -+#define NT_386_IOPERM 0x201 /* x86 io permission bitmap (1=deny) */ -+#define NT_X86_XSTATE 0x202 /* x86 extended state using xsave */ -+ -+/* Legal values for the note segment descriptor types for object files. */ -+ -+#define NT_VERSION 1 /* Contains a version string. */ -+ -+ -+/* Dynamic section entry. */ -+ -+typedef struct -+{ -+ Elf32_Sword d_tag; /* Dynamic entry type */ -+ union -+ { -+ Elf32_Word d_val; /* Integer value */ -+ Elf32_Addr d_ptr; /* Address value */ -+ } d_un; -+} Elf32_Dyn; -+ -+typedef struct -+{ -+ Elf64_Sxword d_tag; /* Dynamic entry type */ -+ union -+ { -+ Elf64_Xword d_val; /* Integer value */ -+ Elf64_Addr d_ptr; /* Address value */ -+ } d_un; -+} Elf64_Dyn; -+ -+/* Legal values for d_tag (dynamic entry type). */ -+ -+#define DT_NULL 0 /* Marks end of dynamic section */ -+#define DT_NEEDED 1 /* Name of needed library */ -+#define DT_PLTRELSZ 2 /* Size in bytes of PLT relocs */ -+#define DT_PLTGOT 3 /* Processor defined value */ -+#define DT_HASH 4 /* Address of symbol hash table */ -+#define DT_STRTAB 5 /* Address of string table */ -+#define DT_SYMTAB 6 /* Address of symbol table */ -+#define DT_RELA 7 /* Address of Rela relocs */ -+#define DT_RELASZ 8 /* Total size of Rela relocs */ -+#define DT_RELAENT 9 /* Size of one Rela reloc */ -+#define DT_STRSZ 10 /* Size of string table */ -+#define DT_SYMENT 11 /* Size of one symbol table entry */ -+#define DT_INIT 12 /* Address of init function */ -+#define DT_FINI 13 /* Address of termination function */ -+#define DT_SONAME 14 /* Name of shared object */ -+#define DT_RPATH 15 /* Library search path (deprecated) */ -+#define DT_SYMBOLIC 16 /* Start symbol search here */ -+#define DT_REL 17 /* Address of Rel relocs */ -+#define DT_RELSZ 18 /* Total size of Rel relocs */ -+#define DT_RELENT 19 /* Size of one Rel reloc */ -+#define DT_PLTREL 20 /* Type of reloc in PLT */ -+#define DT_DEBUG 21 /* For debugging; unspecified */ -+#define DT_TEXTREL 22 /* Reloc might modify .text */ -+#define DT_JMPREL 23 /* Address of PLT relocs */ -+#define DT_BIND_NOW 24 /* Process relocations of object */ -+#define DT_INIT_ARRAY 25 /* Array with addresses of init fct */ -+#define DT_FINI_ARRAY 26 /* Array with addresses of fini fct */ -+#define DT_INIT_ARRAYSZ 27 /* Size in bytes of DT_INIT_ARRAY */ -+#define DT_FINI_ARRAYSZ 28 /* Size in bytes of DT_FINI_ARRAY */ -+#define DT_RUNPATH 29 /* Library search path */ -+#define DT_FLAGS 30 /* Flags for the object being loaded */ -+#define DT_ENCODING 32 /* Start of encoded range */ -+#define DT_PREINIT_ARRAY 32 /* Array with addresses of preinit fct*/ -+#define DT_PREINIT_ARRAYSZ 33 /* size in bytes of DT_PREINIT_ARRAY */ -+#define DT_NUM 34 /* Number used */ -+#define DT_LOOS 0x6000000d /* Start of OS-specific */ -+#define DT_HIOS 0x6ffff000 /* End of OS-specific */ -+#define DT_LOPROC 0x70000000 /* Start of processor-specific */ -+#define DT_HIPROC 0x7fffffff /* End of processor-specific */ -+#define DT_PROCNUM DT_MIPS_NUM /* Most used by any processor */ -+ -+/* DT_* entries which fall between DT_VALRNGHI & DT_VALRNGLO use the -+ Dyn.d_un.d_val field of the Elf*_Dyn structure. This follows Sun's -+ approach. */ -+#define DT_VALRNGLO 0x6ffffd00 -+#define DT_GNU_PRELINKED 0x6ffffdf5 /* Prelinking timestamp */ -+#define DT_GNU_CONFLICTSZ 0x6ffffdf6 /* Size of conflict section */ -+#define DT_GNU_LIBLISTSZ 0x6ffffdf7 /* Size of library list */ -+#define DT_CHECKSUM 0x6ffffdf8 -+#define DT_PLTPADSZ 0x6ffffdf9 -+#define DT_MOVEENT 0x6ffffdfa -+#define DT_MOVESZ 0x6ffffdfb -+#define DT_FEATURE_1 0x6ffffdfc /* Feature selection (DTF_*). */ -+#define DT_POSFLAG_1 0x6ffffdfd /* Flags for DT_* entries, effecting -+ the following DT_* entry. */ -+#define DT_SYMINSZ 0x6ffffdfe /* Size of syminfo table (in bytes) */ -+#define DT_SYMINENT 0x6ffffdff /* Entry size of syminfo */ -+#define DT_VALRNGHI 0x6ffffdff -+#define DT_VALTAGIDX(tag) (DT_VALRNGHI - (tag)) /* Reverse order! */ -+#define DT_VALNUM 12 -+ -+/* DT_* entries which fall between DT_ADDRRNGHI & DT_ADDRRNGLO use the -+ Dyn.d_un.d_ptr field of the Elf*_Dyn structure. -+ -+ If any adjustment is made to the ELF object after it has been -+ built these entries will need to be adjusted. */ -+#define DT_ADDRRNGLO 0x6ffffe00 -+#define DT_GNU_HASH 0x6ffffef5 /* GNU-style hash table. */ -+#define DT_TLSDESC_PLT 0x6ffffef6 -+#define DT_TLSDESC_GOT 0x6ffffef7 -+#define DT_GNU_CONFLICT 0x6ffffef8 /* Start of conflict section */ -+#define DT_GNU_LIBLIST 0x6ffffef9 /* Library list */ -+#define DT_CONFIG 0x6ffffefa /* Configuration information. */ -+#define DT_DEPAUDIT 0x6ffffefb /* Dependency auditing. */ -+#define DT_AUDIT 0x6ffffefc /* Object auditing. */ -+#define DT_PLTPAD 0x6ffffefd /* PLT padding. */ -+#define DT_MOVETAB 0x6ffffefe /* Move table. */ -+#define DT_SYMINFO 0x6ffffeff /* Syminfo table. */ -+#define DT_ADDRRNGHI 0x6ffffeff -+#define DT_ADDRTAGIDX(tag) (DT_ADDRRNGHI - (tag)) /* Reverse order! */ -+#define DT_ADDRNUM 11 -+ -+/* The versioning entry types. The next are defined as part of the -+ GNU extension. */ -+#define DT_VERSYM 0x6ffffff0 -+ -+#define DT_RELACOUNT 0x6ffffff9 -+#define DT_RELCOUNT 0x6ffffffa -+ -+/* These were chosen by Sun. */ -+#define DT_FLAGS_1 0x6ffffffb /* State flags, see DF_1_* below. */ -+#define DT_VERDEF 0x6ffffffc /* Address of version definition -+ table */ -+#define DT_VERDEFNUM 0x6ffffffd /* Number of version definitions */ -+#define DT_VERNEED 0x6ffffffe /* Address of table with needed -+ versions */ -+#define DT_VERNEEDNUM 0x6fffffff /* Number of needed versions */ -+#define DT_VERSIONTAGIDX(tag) (DT_VERNEEDNUM - (tag)) /* Reverse order! */ -+#define DT_VERSIONTAGNUM 16 -+ -+/* Sun added these machine-independent extensions in the "processor-specific" -+ range. Be compatible. */ -+#define DT_AUXILIARY 0x7ffffffd /* Shared object to load before self */ -+#define DT_FILTER 0x7fffffff /* Shared object to get values from */ -+#define DT_EXTRATAGIDX(tag) ((Elf32_Word)-((Elf32_Sword) (tag) <<1>>1)-1) -+#define DT_EXTRANUM 3 -+ -+/* Values of `d_un.d_val' in the DT_FLAGS entry. */ -+#define DF_ORIGIN 0x00000001 /* Object may use DF_ORIGIN */ -+#define DF_SYMBOLIC 0x00000002 /* Symbol resolutions starts here */ -+#define DF_TEXTREL 0x00000004 /* Object contains text relocations */ -+#define DF_BIND_NOW 0x00000008 /* No lazy binding for this object */ -+#define DF_STATIC_TLS 0x00000010 /* Module uses the static TLS model */ -+ -+/* State flags selectable in the `d_un.d_val' element of the DT_FLAGS_1 -+ entry in the dynamic section. */ -+#define DF_1_NOW 0x00000001 /* Set RTLD_NOW for this object. */ -+#define DF_1_GLOBAL 0x00000002 /* Set RTLD_GLOBAL for this object. */ -+#define DF_1_GROUP 0x00000004 /* Set RTLD_GROUP for this object. */ -+#define DF_1_NODELETE 0x00000008 /* Set RTLD_NODELETE for this object.*/ -+#define DF_1_LOADFLTR 0x00000010 /* Trigger filtee loading at runtime.*/ -+#define DF_1_INITFIRST 0x00000020 /* Set RTLD_INITFIRST for this object*/ -+#define DF_1_NOOPEN 0x00000040 /* Set RTLD_NOOPEN for this object. */ -+#define DF_1_ORIGIN 0x00000080 /* $ORIGIN must be handled. */ -+#define DF_1_DIRECT 0x00000100 /* Direct binding enabled. */ -+#define DF_1_TRANS 0x00000200 -+#define DF_1_INTERPOSE 0x00000400 /* Object is used to interpose. */ -+#define DF_1_NODEFLIB 0x00000800 /* Ignore default lib search path. */ -+#define DF_1_NODUMP 0x00001000 /* Object can't be dldump'ed. */ -+#define DF_1_CONFALT 0x00002000 /* Configuration alternative created.*/ -+#define DF_1_ENDFILTEE 0x00004000 /* Filtee terminates filters search. */ -+#define DF_1_DISPRELDNE 0x00008000 /* Disp reloc applied at build time. */ -+#define DF_1_DISPRELPND 0x00010000 /* Disp reloc applied at run-time. */ -+ -+/* Flags for the feature selection in DT_FEATURE_1. */ -+#define DTF_1_PARINIT 0x00000001 -+#define DTF_1_CONFEXP 0x00000002 -+ -+/* Flags in the DT_POSFLAG_1 entry effecting only the next DT_* entry. */ -+#define DF_P1_LAZYLOAD 0x00000001 /* Lazyload following object. */ -+#define DF_P1_GROUPPERM 0x00000002 /* Symbols from next object are not -+ generally available. */ -+ -+/* Version definition sections. */ -+ -+typedef struct -+{ -+ Elf32_Half vd_version; /* Version revision */ -+ Elf32_Half vd_flags; /* Version information */ -+ Elf32_Half vd_ndx; /* Version Index */ -+ Elf32_Half vd_cnt; /* Number of associated aux entries */ -+ Elf32_Word vd_hash; /* Version name hash value */ -+ Elf32_Word vd_aux; /* Offset in bytes to verdaux array */ -+ Elf32_Word vd_next; /* Offset in bytes to next verdef -+ entry */ -+} Elf32_Verdef; -+ -+typedef struct -+{ -+ Elf64_Half vd_version; /* Version revision */ -+ Elf64_Half vd_flags; /* Version information */ -+ Elf64_Half vd_ndx; /* Version Index */ -+ Elf64_Half vd_cnt; /* Number of associated aux entries */ -+ Elf64_Word vd_hash; /* Version name hash value */ -+ Elf64_Word vd_aux; /* Offset in bytes to verdaux array */ -+ Elf64_Word vd_next; /* Offset in bytes to next verdef -+ entry */ -+} Elf64_Verdef; -+ -+ -+/* Legal values for vd_version (version revision). */ -+#define VER_DEF_NONE 0 /* No version */ -+#define VER_DEF_CURRENT 1 /* Current version */ -+#define VER_DEF_NUM 2 /* Given version number */ -+ -+/* Legal values for vd_flags (version information flags). */ -+#define VER_FLG_BASE 0x1 /* Version definition of file itself */ -+#define VER_FLG_WEAK 0x2 /* Weak version identifier */ -+ -+/* Versym symbol index values. */ -+#define VER_NDX_LOCAL 0 /* Symbol is local. */ -+#define VER_NDX_GLOBAL 1 /* Symbol is global. */ -+#define VER_NDX_LORESERVE 0xff00 /* Beginning of reserved entries. */ -+#define VER_NDX_ELIMINATE 0xff01 /* Symbol is to be eliminated. */ -+ -+/* Auxialiary version information. */ -+ -+typedef struct -+{ -+ Elf32_Word vda_name; /* Version or dependency names */ -+ Elf32_Word vda_next; /* Offset in bytes to next verdaux -+ entry */ -+} Elf32_Verdaux; -+ -+typedef struct -+{ -+ Elf64_Word vda_name; /* Version or dependency names */ -+ Elf64_Word vda_next; /* Offset in bytes to next verdaux -+ entry */ -+} Elf64_Verdaux; -+ -+ -+/* Version dependency section. */ -+ -+typedef struct -+{ -+ Elf32_Half vn_version; /* Version of structure */ -+ Elf32_Half vn_cnt; /* Number of associated aux entries */ -+ Elf32_Word vn_file; /* Offset of filename for this -+ dependency */ -+ Elf32_Word vn_aux; /* Offset in bytes to vernaux array */ -+ Elf32_Word vn_next; /* Offset in bytes to next verneed -+ entry */ -+} Elf32_Verneed; -+ -+typedef struct -+{ -+ Elf64_Half vn_version; /* Version of structure */ -+ Elf64_Half vn_cnt; /* Number of associated aux entries */ -+ Elf64_Word vn_file; /* Offset of filename for this -+ dependency */ -+ Elf64_Word vn_aux; /* Offset in bytes to vernaux array */ -+ Elf64_Word vn_next; /* Offset in bytes to next verneed -+ entry */ -+} Elf64_Verneed; -+ -+ -+/* Legal values for vn_version (version revision). */ -+#define VER_NEED_NONE 0 /* No version */ -+#define VER_NEED_CURRENT 1 /* Current version */ -+#define VER_NEED_NUM 2 /* Given version number */ -+ -+/* Auxiliary needed version information. */ -+ -+typedef struct -+{ -+ Elf32_Word vna_hash; /* Hash value of dependency name */ -+ Elf32_Half vna_flags; /* Dependency specific information */ -+ Elf32_Half vna_other; /* Unused */ -+ Elf32_Word vna_name; /* Dependency name string offset */ -+ Elf32_Word vna_next; /* Offset in bytes to next vernaux -+ entry */ -+} Elf32_Vernaux; -+ -+typedef struct -+{ -+ Elf64_Word vna_hash; /* Hash value of dependency name */ -+ Elf64_Half vna_flags; /* Dependency specific information */ -+ Elf64_Half vna_other; /* Unused */ -+ Elf64_Word vna_name; /* Dependency name string offset */ -+ Elf64_Word vna_next; /* Offset in bytes to next vernaux -+ entry */ -+} Elf64_Vernaux; -+ -+ -+/* Legal values for vna_flags. */ -+#define VER_FLG_WEAK 0x2 /* Weak version identifier */ -+ -+ -+/* Auxiliary vector. */ -+ -+/* This vector is normally only used by the program interpreter. The -+ usual definition in an ABI supplement uses the name auxv_t. The -+ vector is not usually defined in a standard file, but it -+ can't hurt. We rename it to avoid conflicts. The sizes of these -+ types are an arrangement between the exec server and the program -+ interpreter, so we don't fully specify them here. */ -+ -+typedef struct -+{ -+ uint32_t a_type; /* Entry type */ -+ union -+ { -+ uint32_t a_val; /* Integer value */ -+ /* We use to have pointer elements added here. We cannot do that, -+ though, since it does not work when using 32-bit definitions -+ on 64-bit platforms and vice versa. */ -+ } a_un; -+} Elf32_auxv_t; -+ -+typedef struct -+{ -+ uint64_t a_type; /* Entry type */ -+ union -+ { -+ uint64_t a_val; /* Integer value */ -+ /* We use to have pointer elements added here. We cannot do that, -+ though, since it does not work when using 32-bit definitions -+ on 64-bit platforms and vice versa. */ -+ } a_un; -+} Elf64_auxv_t; -+ -+/* Legal values for a_type (entry type). */ -+ -+#define AT_NULL 0 /* End of vector */ -+#define AT_IGNORE 1 /* Entry should be ignored */ -+#define AT_EXECFD 2 /* File descriptor of program */ -+#define AT_PHDR 3 /* Program headers for program */ -+#define AT_PHENT 4 /* Size of program header entry */ -+#define AT_PHNUM 5 /* Number of program headers */ -+#define AT_PAGESZ 6 /* System page size */ -+#define AT_BASE 7 /* Base address of interpreter */ -+#define AT_FLAGS 8 /* Flags */ -+#define AT_ENTRY 9 /* Entry point of program */ -+#define AT_NOTELF 10 /* Program is not ELF */ -+#define AT_UID 11 /* Real uid */ -+#define AT_EUID 12 /* Effective uid */ -+#define AT_GID 13 /* Real gid */ -+#define AT_EGID 14 /* Effective gid */ -+#define AT_CLKTCK 17 /* Frequency of times() */ -+ -+/* Some more special a_type values describing the hardware. */ -+#define AT_PLATFORM 15 /* String identifying platform. */ -+#define AT_HWCAP 16 /* Machine dependent hints about -+ processor capabilities. */ -+ -+/* This entry gives some information about the FPU initialization -+ performed by the kernel. */ -+#define AT_FPUCW 18 /* Used FPU control word. */ -+ -+/* Cache block sizes. */ -+#define AT_DCACHEBSIZE 19 /* Data cache block size. */ -+#define AT_ICACHEBSIZE 20 /* Instruction cache block size. */ -+#define AT_UCACHEBSIZE 21 /* Unified cache block size. */ -+ -+/* A special ignored value for PPC, used by the kernel to control the -+ interpretation of the AUXV. Must be > 16. */ -+#define AT_IGNOREPPC 22 /* Entry should be ignored. */ -+ -+#define AT_SECURE 23 /* Boolean, was exec setuid-like? */ -+ -+#define AT_BASE_PLATFORM 24 /* String identifying real platforms.*/ -+ -+#define AT_RANDOM 25 /* Address of 16 random bytes. */ -+ -+#define AT_EXECFN 31 /* Filename of executable. */ -+ -+/* Pointer to the global system page used for system calls and other -+ nice things. */ -+#define AT_SYSINFO 32 -+#define AT_SYSINFO_EHDR 33 -+ -+/* Shapes of the caches. Bits 0-3 contains associativity; bits 4-7 contains -+ log2 of line size; mask those to get cache size. */ -+#define AT_L1I_CACHESHAPE 34 -+#define AT_L1D_CACHESHAPE 35 -+#define AT_L2_CACHESHAPE 36 -+#define AT_L3_CACHESHAPE 37 -+ -+/* Note section contents. Each entry in the note section begins with -+ a header of a fixed form. */ -+ -+typedef struct -+{ -+ Elf32_Word n_namesz; /* Length of the note's name. */ -+ Elf32_Word n_descsz; /* Length of the note's descriptor. */ -+ Elf32_Word n_type; /* Type of the note. */ -+} Elf32_Nhdr; -+ -+typedef struct -+{ -+ Elf64_Word n_namesz; /* Length of the note's name. */ -+ Elf64_Word n_descsz; /* Length of the note's descriptor. */ -+ Elf64_Word n_type; /* Type of the note. */ -+} Elf64_Nhdr; -+ -+/* Known names of notes. */ -+ -+/* Solaris entries in the note section have this name. */ -+#define ELF_NOTE_SOLARIS "SUNW Solaris" -+ -+/* Note entries for GNU systems have this name. */ -+#define ELF_NOTE_GNU "GNU" -+ -+ -+/* Defined types of notes for Solaris. */ -+ -+/* Value of descriptor (one word) is desired pagesize for the binary. */ -+#define ELF_NOTE_PAGESIZE_HINT 1 -+ -+ -+/* Defined note types for GNU systems. */ -+ -+/* ABI information. The descriptor consists of words: -+ word 0: OS descriptor -+ word 1: major version of the ABI -+ word 2: minor version of the ABI -+ word 3: subminor version of the ABI -+*/ -+#define NT_GNU_ABI_TAG 1 -+#define ELF_NOTE_ABI NT_GNU_ABI_TAG /* Old name. */ -+ -+/* Known OSes. These values can appear in word 0 of an -+ NT_GNU_ABI_TAG note section entry. */ -+#define ELF_NOTE_OS_LINUX 0 -+#define ELF_NOTE_OS_GNU 1 -+#define ELF_NOTE_OS_SOLARIS2 2 -+#define ELF_NOTE_OS_FREEBSD 3 -+ -+/* Synthetic hwcap information. The descriptor begins with two words: -+ word 0: number of entries -+ word 1: bitmask of enabled entries -+ Then follow variable-length entries, one byte followed by a -+ '\0'-terminated hwcap name string. The byte gives the bit -+ number to test if enabled, (1U << bit) & bitmask. */ -+#define NT_GNU_HWCAP 2 -+ -+/* Build ID bits as generated by ld --build-id. -+ The descriptor consists of any nonzero number of bytes. */ -+#define NT_GNU_BUILD_ID 3 -+ -+/* Version note generated by GNU gold containing a version string. */ -+#define NT_GNU_GOLD_VERSION 4 -+ -+ -+/* Move records. */ -+typedef struct -+{ -+ Elf32_Xword m_value; /* Symbol value. */ -+ Elf32_Word m_info; /* Size and index. */ -+ Elf32_Word m_poffset; /* Symbol offset. */ -+ Elf32_Half m_repeat; /* Repeat count. */ -+ Elf32_Half m_stride; /* Stride info. */ -+} Elf32_Move; -+ -+typedef struct -+{ -+ Elf64_Xword m_value; /* Symbol value. */ -+ Elf64_Xword m_info; /* Size and index. */ -+ Elf64_Xword m_poffset; /* Symbol offset. */ -+ Elf64_Half m_repeat; /* Repeat count. */ -+ Elf64_Half m_stride; /* Stride info. */ -+} Elf64_Move; -+ -+/* Macro to construct move records. */ -+#define ELF32_M_SYM(info) ((info) >> 8) -+#define ELF32_M_SIZE(info) ((unsigned char) (info)) -+#define ELF32_M_INFO(sym, size) (((sym) << 8) + (unsigned char) (size)) -+ -+#define ELF64_M_SYM(info) ELF32_M_SYM (info) -+#define ELF64_M_SIZE(info) ELF32_M_SIZE (info) -+#define ELF64_M_INFO(sym, size) ELF32_M_INFO (sym, size) -+ -+ -+/* Motorola 68k specific definitions. */ -+ -+/* Values for Elf32_Ehdr.e_flags. */ -+#define EF_CPU32 0x00810000 -+ -+/* m68k relocs. */ -+ -+#define R_68K_NONE 0 /* No reloc */ -+#define R_68K_32 1 /* Direct 32 bit */ -+#define R_68K_16 2 /* Direct 16 bit */ -+#define R_68K_8 3 /* Direct 8 bit */ -+#define R_68K_PC32 4 /* PC relative 32 bit */ -+#define R_68K_PC16 5 /* PC relative 16 bit */ -+#define R_68K_PC8 6 /* PC relative 8 bit */ -+#define R_68K_GOT32 7 /* 32 bit PC relative GOT entry */ -+#define R_68K_GOT16 8 /* 16 bit PC relative GOT entry */ -+#define R_68K_GOT8 9 /* 8 bit PC relative GOT entry */ -+#define R_68K_GOT32O 10 /* 32 bit GOT offset */ -+#define R_68K_GOT16O 11 /* 16 bit GOT offset */ -+#define R_68K_GOT8O 12 /* 8 bit GOT offset */ -+#define R_68K_PLT32 13 /* 32 bit PC relative PLT address */ -+#define R_68K_PLT16 14 /* 16 bit PC relative PLT address */ -+#define R_68K_PLT8 15 /* 8 bit PC relative PLT address */ -+#define R_68K_PLT32O 16 /* 32 bit PLT offset */ -+#define R_68K_PLT16O 17 /* 16 bit PLT offset */ -+#define R_68K_PLT8O 18 /* 8 bit PLT offset */ -+#define R_68K_COPY 19 /* Copy symbol at runtime */ -+#define R_68K_GLOB_DAT 20 /* Create GOT entry */ -+#define R_68K_JMP_SLOT 21 /* Create PLT entry */ -+#define R_68K_RELATIVE 22 /* Adjust by program base */ -+#define R_68K_TLS_GD32 25 /* 32 bit GOT offset for GD */ -+#define R_68K_TLS_GD16 26 /* 16 bit GOT offset for GD */ -+#define R_68K_TLS_GD8 27 /* 8 bit GOT offset for GD */ -+#define R_68K_TLS_LDM32 28 /* 32 bit GOT offset for LDM */ -+#define R_68K_TLS_LDM16 29 /* 16 bit GOT offset for LDM */ -+#define R_68K_TLS_LDM8 30 /* 8 bit GOT offset for LDM */ -+#define R_68K_TLS_LDO32 31 /* 32 bit module-relative offset */ -+#define R_68K_TLS_LDO16 32 /* 16 bit module-relative offset */ -+#define R_68K_TLS_LDO8 33 /* 8 bit module-relative offset */ -+#define R_68K_TLS_IE32 34 /* 32 bit GOT offset for IE */ -+#define R_68K_TLS_IE16 35 /* 16 bit GOT offset for IE */ -+#define R_68K_TLS_IE8 36 /* 8 bit GOT offset for IE */ -+#define R_68K_TLS_LE32 37 /* 32 bit offset relative to -+ static TLS block */ -+#define R_68K_TLS_LE16 38 /* 16 bit offset relative to -+ static TLS block */ -+#define R_68K_TLS_LE8 39 /* 8 bit offset relative to -+ static TLS block */ -+#define R_68K_TLS_DTPMOD32 40 /* 32 bit module number */ -+#define R_68K_TLS_DTPREL32 41 /* 32 bit module-relative offset */ -+#define R_68K_TLS_TPREL32 42 /* 32 bit TP-relative offset */ -+/* Keep this the last entry. */ -+#define R_68K_NUM 43 -+ -+/* Intel 80386 specific definitions. */ -+ -+/* i386 relocs. */ -+ -+#define R_386_NONE 0 /* No reloc */ -+#define R_386_32 1 /* Direct 32 bit */ -+#define R_386_PC32 2 /* PC relative 32 bit */ -+#define R_386_GOT32 3 /* 32 bit GOT entry */ -+#define R_386_PLT32 4 /* 32 bit PLT address */ -+#define R_386_COPY 5 /* Copy symbol at runtime */ -+#define R_386_GLOB_DAT 6 /* Create GOT entry */ -+#define R_386_JMP_SLOT 7 /* Create PLT entry */ -+#define R_386_RELATIVE 8 /* Adjust by program base */ -+#define R_386_GOTOFF 9 /* 32 bit offset to GOT */ -+#define R_386_GOTPC 10 /* 32 bit PC relative offset to GOT */ -+#define R_386_32PLT 11 -+#define R_386_TLS_TPOFF 14 /* Offset in static TLS block */ -+#define R_386_TLS_IE 15 /* Address of GOT entry for static TLS -+ block offset */ -+#define R_386_TLS_GOTIE 16 /* GOT entry for static TLS block -+ offset */ -+#define R_386_TLS_LE 17 /* Offset relative to static TLS -+ block */ -+#define R_386_TLS_GD 18 /* Direct 32 bit for GNU version of -+ general dynamic thread local data */ -+#define R_386_TLS_LDM 19 /* Direct 32 bit for GNU version of -+ local dynamic thread local data -+ in LE code */ -+#define R_386_16 20 -+#define R_386_PC16 21 -+#define R_386_8 22 -+#define R_386_PC8 23 -+#define R_386_TLS_GD_32 24 /* Direct 32 bit for general dynamic -+ thread local data */ -+#define R_386_TLS_GD_PUSH 25 /* Tag for pushl in GD TLS code */ -+#define R_386_TLS_GD_CALL 26 /* Relocation for call to -+ __tls_get_addr() */ -+#define R_386_TLS_GD_POP 27 /* Tag for popl in GD TLS code */ -+#define R_386_TLS_LDM_32 28 /* Direct 32 bit for local dynamic -+ thread local data in LE code */ -+#define R_386_TLS_LDM_PUSH 29 /* Tag for pushl in LDM TLS code */ -+#define R_386_TLS_LDM_CALL 30 /* Relocation for call to -+ __tls_get_addr() in LDM code */ -+#define R_386_TLS_LDM_POP 31 /* Tag for popl in LDM TLS code */ -+#define R_386_TLS_LDO_32 32 /* Offset relative to TLS block */ -+#define R_386_TLS_IE_32 33 /* GOT entry for negated static TLS -+ block offset */ -+#define R_386_TLS_LE_32 34 /* Negated offset relative to static -+ TLS block */ -+#define R_386_TLS_DTPMOD32 35 /* ID of module containing symbol */ -+#define R_386_TLS_DTPOFF32 36 /* Offset in TLS block */ -+#define R_386_TLS_TPOFF32 37 /* Negated offset in static TLS block */ -+/* 38? */ -+#define R_386_TLS_GOTDESC 39 /* GOT offset for TLS descriptor. */ -+#define R_386_TLS_DESC_CALL 40 /* Marker of call through TLS -+ descriptor for -+ relaxation. */ -+#define R_386_TLS_DESC 41 /* TLS descriptor containing -+ pointer to code and to -+ argument, returning the TLS -+ offset for the symbol. */ -+#define R_386_IRELATIVE 42 /* Adjust indirectly by program base */ -+/* Keep this the last entry. */ -+#define R_386_NUM 43 -+ -+/* SUN SPARC specific definitions. */ -+ -+/* Legal values for ST_TYPE subfield of st_info (symbol type). */ -+ -+#define STT_SPARC_REGISTER 13 /* Global register reserved to app. */ -+ -+/* Values for Elf64_Ehdr.e_flags. */ -+ -+#define EF_SPARCV9_MM 3 -+#define EF_SPARCV9_TSO 0 -+#define EF_SPARCV9_PSO 1 -+#define EF_SPARCV9_RMO 2 -+#define EF_SPARC_LEDATA 0x800000 /* little endian data */ -+#define EF_SPARC_EXT_MASK 0xFFFF00 -+#define EF_SPARC_32PLUS 0x000100 /* generic V8+ features */ -+#define EF_SPARC_SUN_US1 0x000200 /* Sun UltraSPARC1 extensions */ -+#define EF_SPARC_HAL_R1 0x000400 /* HAL R1 extensions */ -+#define EF_SPARC_SUN_US3 0x000800 /* Sun UltraSPARCIII extensions */ -+ -+/* SPARC relocs. */ -+ -+#define R_SPARC_NONE 0 /* No reloc */ -+#define R_SPARC_8 1 /* Direct 8 bit */ -+#define R_SPARC_16 2 /* Direct 16 bit */ -+#define R_SPARC_32 3 /* Direct 32 bit */ -+#define R_SPARC_DISP8 4 /* PC relative 8 bit */ -+#define R_SPARC_DISP16 5 /* PC relative 16 bit */ -+#define R_SPARC_DISP32 6 /* PC relative 32 bit */ -+#define R_SPARC_WDISP30 7 /* PC relative 30 bit shifted */ -+#define R_SPARC_WDISP22 8 /* PC relative 22 bit shifted */ -+#define R_SPARC_HI22 9 /* High 22 bit */ -+#define R_SPARC_22 10 /* Direct 22 bit */ -+#define R_SPARC_13 11 /* Direct 13 bit */ -+#define R_SPARC_LO10 12 /* Truncated 10 bit */ -+#define R_SPARC_GOT10 13 /* Truncated 10 bit GOT entry */ -+#define R_SPARC_GOT13 14 /* 13 bit GOT entry */ -+#define R_SPARC_GOT22 15 /* 22 bit GOT entry shifted */ -+#define R_SPARC_PC10 16 /* PC relative 10 bit truncated */ -+#define R_SPARC_PC22 17 /* PC relative 22 bit shifted */ -+#define R_SPARC_WPLT30 18 /* 30 bit PC relative PLT address */ -+#define R_SPARC_COPY 19 /* Copy symbol at runtime */ -+#define R_SPARC_GLOB_DAT 20 /* Create GOT entry */ -+#define R_SPARC_JMP_SLOT 21 /* Create PLT entry */ -+#define R_SPARC_RELATIVE 22 /* Adjust by program base */ -+#define R_SPARC_UA32 23 /* Direct 32 bit unaligned */ -+ -+/* Additional Sparc64 relocs. */ -+ -+#define R_SPARC_PLT32 24 /* Direct 32 bit ref to PLT entry */ -+#define R_SPARC_HIPLT22 25 /* High 22 bit PLT entry */ -+#define R_SPARC_LOPLT10 26 /* Truncated 10 bit PLT entry */ -+#define R_SPARC_PCPLT32 27 /* PC rel 32 bit ref to PLT entry */ -+#define R_SPARC_PCPLT22 28 /* PC rel high 22 bit PLT entry */ -+#define R_SPARC_PCPLT10 29 /* PC rel trunc 10 bit PLT entry */ -+#define R_SPARC_10 30 /* Direct 10 bit */ -+#define R_SPARC_11 31 /* Direct 11 bit */ -+#define R_SPARC_64 32 /* Direct 64 bit */ -+#define R_SPARC_OLO10 33 /* 10bit with secondary 13bit addend */ -+#define R_SPARC_HH22 34 /* Top 22 bits of direct 64 bit */ -+#define R_SPARC_HM10 35 /* High middle 10 bits of ... */ -+#define R_SPARC_LM22 36 /* Low middle 22 bits of ... */ -+#define R_SPARC_PC_HH22 37 /* Top 22 bits of pc rel 64 bit */ -+#define R_SPARC_PC_HM10 38 /* High middle 10 bit of ... */ -+#define R_SPARC_PC_LM22 39 /* Low miggle 22 bits of ... */ -+#define R_SPARC_WDISP16 40 /* PC relative 16 bit shifted */ -+#define R_SPARC_WDISP19 41 /* PC relative 19 bit shifted */ -+#define R_SPARC_GLOB_JMP 42 /* was part of v9 ABI but was removed */ -+#define R_SPARC_7 43 /* Direct 7 bit */ -+#define R_SPARC_5 44 /* Direct 5 bit */ -+#define R_SPARC_6 45 /* Direct 6 bit */ -+#define R_SPARC_DISP64 46 /* PC relative 64 bit */ -+#define R_SPARC_PLT64 47 /* Direct 64 bit ref to PLT entry */ -+#define R_SPARC_HIX22 48 /* High 22 bit complemented */ -+#define R_SPARC_LOX10 49 /* Truncated 11 bit complemented */ -+#define R_SPARC_H44 50 /* Direct high 12 of 44 bit */ -+#define R_SPARC_M44 51 /* Direct mid 22 of 44 bit */ -+#define R_SPARC_L44 52 /* Direct low 10 of 44 bit */ -+#define R_SPARC_REGISTER 53 /* Global register usage */ -+#define R_SPARC_UA64 54 /* Direct 64 bit unaligned */ -+#define R_SPARC_UA16 55 /* Direct 16 bit unaligned */ -+#define R_SPARC_TLS_GD_HI22 56 -+#define R_SPARC_TLS_GD_LO10 57 -+#define R_SPARC_TLS_GD_ADD 58 -+#define R_SPARC_TLS_GD_CALL 59 -+#define R_SPARC_TLS_LDM_HI22 60 -+#define R_SPARC_TLS_LDM_LO10 61 -+#define R_SPARC_TLS_LDM_ADD 62 -+#define R_SPARC_TLS_LDM_CALL 63 -+#define R_SPARC_TLS_LDO_HIX22 64 -+#define R_SPARC_TLS_LDO_LOX10 65 -+#define R_SPARC_TLS_LDO_ADD 66 -+#define R_SPARC_TLS_IE_HI22 67 -+#define R_SPARC_TLS_IE_LO10 68 -+#define R_SPARC_TLS_IE_LD 69 -+#define R_SPARC_TLS_IE_LDX 70 -+#define R_SPARC_TLS_IE_ADD 71 -+#define R_SPARC_TLS_LE_HIX22 72 -+#define R_SPARC_TLS_LE_LOX10 73 -+#define R_SPARC_TLS_DTPMOD32 74 -+#define R_SPARC_TLS_DTPMOD64 75 -+#define R_SPARC_TLS_DTPOFF32 76 -+#define R_SPARC_TLS_DTPOFF64 77 -+#define R_SPARC_TLS_TPOFF32 78 -+#define R_SPARC_TLS_TPOFF64 79 -+#define R_SPARC_GOTDATA_HIX22 80 -+#define R_SPARC_GOTDATA_LOX10 81 -+#define R_SPARC_GOTDATA_OP_HIX22 82 -+#define R_SPARC_GOTDATA_OP_LOX10 83 -+#define R_SPARC_GOTDATA_OP 84 -+#define R_SPARC_H34 85 -+#define R_SPARC_SIZE32 86 -+#define R_SPARC_SIZE64 87 -+#define R_SPARC_WDISP10 88 -+#define R_SPARC_JMP_IREL 248 -+#define R_SPARC_IRELATIVE 249 -+#define R_SPARC_GNU_VTINHERIT 250 -+#define R_SPARC_GNU_VTENTRY 251 -+#define R_SPARC_REV32 252 -+/* Keep this the last entry. */ -+#define R_SPARC_NUM 253 -+ -+/* For Sparc64, legal values for d_tag of Elf64_Dyn. */ -+ -+#define DT_SPARC_REGISTER 0x70000001 -+#define DT_SPARC_NUM 2 -+ -+/* MIPS R3000 specific definitions. */ -+ -+/* Legal values for e_flags field of Elf32_Ehdr. */ -+ -+#define EF_MIPS_NOREORDER 1 /* A .noreorder directive was used */ -+#define EF_MIPS_PIC 2 /* Contains PIC code */ -+#define EF_MIPS_CPIC 4 /* Uses PIC calling sequence */ -+#define EF_MIPS_XGOT 8 -+#define EF_MIPS_64BIT_WHIRL 16 -+#define EF_MIPS_ABI2 32 -+#define EF_MIPS_ABI_ON32 64 -+#define EF_MIPS_ARCH 0xf0000000 /* MIPS architecture level */ -+ -+/* Legal values for MIPS architecture level. */ -+ -+#define EF_MIPS_ARCH_1 0x00000000 /* -mips1 code. */ -+#define EF_MIPS_ARCH_2 0x10000000 /* -mips2 code. */ -+#define EF_MIPS_ARCH_3 0x20000000 /* -mips3 code. */ -+#define EF_MIPS_ARCH_4 0x30000000 /* -mips4 code. */ -+#define EF_MIPS_ARCH_5 0x40000000 /* -mips5 code. */ -+#define EF_MIPS_ARCH_32 0x60000000 /* MIPS32 code. */ -+#define EF_MIPS_ARCH_64 0x70000000 /* MIPS64 code. */ -+ -+/* The following are non-official names and should not be used. */ -+ -+#define E_MIPS_ARCH_1 0x00000000 /* -mips1 code. */ -+#define E_MIPS_ARCH_2 0x10000000 /* -mips2 code. */ -+#define E_MIPS_ARCH_3 0x20000000 /* -mips3 code. */ -+#define E_MIPS_ARCH_4 0x30000000 /* -mips4 code. */ -+#define E_MIPS_ARCH_5 0x40000000 /* -mips5 code. */ -+#define E_MIPS_ARCH_32 0x60000000 /* MIPS32 code. */ -+#define E_MIPS_ARCH_64 0x70000000 /* MIPS64 code. */ -+ -+/* Special section indices. */ -+ -+#define SHN_MIPS_ACOMMON 0xff00 /* Allocated common symbols */ -+#define SHN_MIPS_TEXT 0xff01 /* Allocated test symbols. */ -+#define SHN_MIPS_DATA 0xff02 /* Allocated data symbols. */ -+#define SHN_MIPS_SCOMMON 0xff03 /* Small common symbols */ -+#define SHN_MIPS_SUNDEFINED 0xff04 /* Small undefined symbols */ -+ -+/* Legal values for sh_type field of Elf32_Shdr. */ -+ -+#define SHT_MIPS_LIBLIST 0x70000000 /* Shared objects used in link */ -+#define SHT_MIPS_MSYM 0x70000001 -+#define SHT_MIPS_CONFLICT 0x70000002 /* Conflicting symbols */ -+#define SHT_MIPS_GPTAB 0x70000003 /* Global data area sizes */ -+#define SHT_MIPS_UCODE 0x70000004 /* Reserved for SGI/MIPS compilers */ -+#define SHT_MIPS_DEBUG 0x70000005 /* MIPS ECOFF debugging information*/ -+#define SHT_MIPS_REGINFO 0x70000006 /* Register usage information */ -+#define SHT_MIPS_PACKAGE 0x70000007 -+#define SHT_MIPS_PACKSYM 0x70000008 -+#define SHT_MIPS_RELD 0x70000009 -+#define SHT_MIPS_IFACE 0x7000000b -+#define SHT_MIPS_CONTENT 0x7000000c -+#define SHT_MIPS_OPTIONS 0x7000000d /* Miscellaneous options. */ -+#define SHT_MIPS_SHDR 0x70000010 -+#define SHT_MIPS_FDESC 0x70000011 -+#define SHT_MIPS_EXTSYM 0x70000012 -+#define SHT_MIPS_DENSE 0x70000013 -+#define SHT_MIPS_PDESC 0x70000014 -+#define SHT_MIPS_LOCSYM 0x70000015 -+#define SHT_MIPS_AUXSYM 0x70000016 -+#define SHT_MIPS_OPTSYM 0x70000017 -+#define SHT_MIPS_LOCSTR 0x70000018 -+#define SHT_MIPS_LINE 0x70000019 -+#define SHT_MIPS_RFDESC 0x7000001a -+#define SHT_MIPS_DELTASYM 0x7000001b -+#define SHT_MIPS_DELTAINST 0x7000001c -+#define SHT_MIPS_DELTACLASS 0x7000001d -+#define SHT_MIPS_DWARF 0x7000001e /* DWARF debugging information. */ -+#define SHT_MIPS_DELTADECL 0x7000001f -+#define SHT_MIPS_SYMBOL_LIB 0x70000020 -+#define SHT_MIPS_EVENTS 0x70000021 /* Event section. */ -+#define SHT_MIPS_TRANSLATE 0x70000022 -+#define SHT_MIPS_PIXIE 0x70000023 -+#define SHT_MIPS_XLATE 0x70000024 -+#define SHT_MIPS_XLATE_DEBUG 0x70000025 -+#define SHT_MIPS_WHIRL 0x70000026 -+#define SHT_MIPS_EH_REGION 0x70000027 -+#define SHT_MIPS_XLATE_OLD 0x70000028 -+#define SHT_MIPS_PDR_EXCEPTION 0x70000029 -+ -+/* Legal values for sh_flags field of Elf32_Shdr. */ -+ -+#define SHF_MIPS_GPREL 0x10000000 /* Must be part of global data area */ -+#define SHF_MIPS_MERGE 0x20000000 -+#define SHF_MIPS_ADDR 0x40000000 -+#define SHF_MIPS_STRINGS 0x80000000 -+#define SHF_MIPS_NOSTRIP 0x08000000 -+#define SHF_MIPS_LOCAL 0x04000000 -+#define SHF_MIPS_NAMES 0x02000000 -+#define SHF_MIPS_NODUPE 0x01000000 -+ -+ -+/* Symbol tables. */ -+ -+/* MIPS specific values for `st_other'. */ -+#define STO_MIPS_DEFAULT 0x0 -+#define STO_MIPS_INTERNAL 0x1 -+#define STO_MIPS_HIDDEN 0x2 -+#define STO_MIPS_PROTECTED 0x3 -+#define STO_MIPS_PLT 0x8 -+#define STO_MIPS_SC_ALIGN_UNUSED 0xff -+ -+/* MIPS specific values for `st_info'. */ -+#define STB_MIPS_SPLIT_COMMON 13 -+ -+/* Entries found in sections of type SHT_MIPS_GPTAB. */ -+ -+typedef union -+{ -+ struct -+ { -+ Elf32_Word gt_current_g_value; /* -G value used for compilation */ -+ Elf32_Word gt_unused; /* Not used */ -+ } gt_header; /* First entry in section */ -+ struct -+ { -+ Elf32_Word gt_g_value; /* If this value were used for -G */ -+ Elf32_Word gt_bytes; /* This many bytes would be used */ -+ } gt_entry; /* Subsequent entries in section */ -+} Elf32_gptab; -+ -+/* Entry found in sections of type SHT_MIPS_REGINFO. */ -+ -+typedef struct -+{ -+ Elf32_Word ri_gprmask; /* General registers used */ -+ Elf32_Word ri_cprmask[4]; /* Coprocessor registers used */ -+ Elf32_Sword ri_gp_value; /* $gp register value */ -+} Elf32_RegInfo; -+ -+/* Entries found in sections of type SHT_MIPS_OPTIONS. */ -+ -+typedef struct -+{ -+ unsigned char kind; /* Determines interpretation of the -+ variable part of descriptor. */ -+ unsigned char size; /* Size of descriptor, including header. */ -+ Elf32_Section section; /* Section header index of section affected, -+ 0 for global options. */ -+ Elf32_Word info; /* Kind-specific information. */ -+} Elf_Options; -+ -+/* Values for `kind' field in Elf_Options. */ -+ -+#define ODK_NULL 0 /* Undefined. */ -+#define ODK_REGINFO 1 /* Register usage information. */ -+#define ODK_EXCEPTIONS 2 /* Exception processing options. */ -+#define ODK_PAD 3 /* Section padding options. */ -+#define ODK_HWPATCH 4 /* Hardware workarounds performed */ -+#define ODK_FILL 5 /* record the fill value used by the linker. */ -+#define ODK_TAGS 6 /* reserve space for desktop tools to write. */ -+#define ODK_HWAND 7 /* HW workarounds. 'AND' bits when merging. */ -+#define ODK_HWOR 8 /* HW workarounds. 'OR' bits when merging. */ -+ -+/* Values for `info' in Elf_Options for ODK_EXCEPTIONS entries. */ -+ -+#define OEX_FPU_MIN 0x1f /* FPE's which MUST be enabled. */ -+#define OEX_FPU_MAX 0x1f00 /* FPE's which MAY be enabled. */ -+#define OEX_PAGE0 0x10000 /* page zero must be mapped. */ -+#define OEX_SMM 0x20000 /* Force sequential memory mode? */ -+#define OEX_FPDBUG 0x40000 /* Force floating point debug mode? */ -+#define OEX_PRECISEFP OEX_FPDBUG -+#define OEX_DISMISS 0x80000 /* Dismiss invalid address faults? */ -+ -+#define OEX_FPU_INVAL 0x10 -+#define OEX_FPU_DIV0 0x08 -+#define OEX_FPU_OFLO 0x04 -+#define OEX_FPU_UFLO 0x02 -+#define OEX_FPU_INEX 0x01 -+ -+/* Masks for `info' in Elf_Options for an ODK_HWPATCH entry. */ -+ -+#define OHW_R4KEOP 0x1 /* R4000 end-of-page patch. */ -+#define OHW_R8KPFETCH 0x2 /* may need R8000 prefetch patch. */ -+#define OHW_R5KEOP 0x4 /* R5000 end-of-page patch. */ -+#define OHW_R5KCVTL 0x8 /* R5000 cvt.[ds].l bug. clean=1. */ -+ -+#define OPAD_PREFIX 0x1 -+#define OPAD_POSTFIX 0x2 -+#define OPAD_SYMBOL 0x4 -+ -+/* Entry found in `.options' section. */ -+ -+typedef struct -+{ -+ Elf32_Word hwp_flags1; /* Extra flags. */ -+ Elf32_Word hwp_flags2; /* Extra flags. */ -+} Elf_Options_Hw; -+ -+/* Masks for `info' in ElfOptions for ODK_HWAND and ODK_HWOR entries. */ -+ -+#define OHWA0_R4KEOP_CHECKED 0x00000001 -+#define OHWA1_R4KEOP_CLEAN 0x00000002 -+ -+/* MIPS relocs. */ -+ -+#define R_MIPS_NONE 0 /* No reloc */ -+#define R_MIPS_16 1 /* Direct 16 bit */ -+#define R_MIPS_32 2 /* Direct 32 bit */ -+#define R_MIPS_REL32 3 /* PC relative 32 bit */ -+#define R_MIPS_26 4 /* Direct 26 bit shifted */ -+#define R_MIPS_HI16 5 /* High 16 bit */ -+#define R_MIPS_LO16 6 /* Low 16 bit */ -+#define R_MIPS_GPREL16 7 /* GP relative 16 bit */ -+#define R_MIPS_LITERAL 8 /* 16 bit literal entry */ -+#define R_MIPS_GOT16 9 /* 16 bit GOT entry */ -+#define R_MIPS_PC16 10 /* PC relative 16 bit */ -+#define R_MIPS_CALL16 11 /* 16 bit GOT entry for function */ -+#define R_MIPS_GPREL32 12 /* GP relative 32 bit */ -+ -+#define R_MIPS_SHIFT5 16 -+#define R_MIPS_SHIFT6 17 -+#define R_MIPS_64 18 -+#define R_MIPS_GOT_DISP 19 -+#define R_MIPS_GOT_PAGE 20 -+#define R_MIPS_GOT_OFST 21 -+#define R_MIPS_GOT_HI16 22 -+#define R_MIPS_GOT_LO16 23 -+#define R_MIPS_SUB 24 -+#define R_MIPS_INSERT_A 25 -+#define R_MIPS_INSERT_B 26 -+#define R_MIPS_DELETE 27 -+#define R_MIPS_HIGHER 28 -+#define R_MIPS_HIGHEST 29 -+#define R_MIPS_CALL_HI16 30 -+#define R_MIPS_CALL_LO16 31 -+#define R_MIPS_SCN_DISP 32 -+#define R_MIPS_REL16 33 -+#define R_MIPS_ADD_IMMEDIATE 34 -+#define R_MIPS_PJUMP 35 -+#define R_MIPS_RELGOT 36 -+#define R_MIPS_JALR 37 -+#define R_MIPS_TLS_DTPMOD32 38 /* Module number 32 bit */ -+#define R_MIPS_TLS_DTPREL32 39 /* Module-relative offset 32 bit */ -+#define R_MIPS_TLS_DTPMOD64 40 /* Module number 64 bit */ -+#define R_MIPS_TLS_DTPREL64 41 /* Module-relative offset 64 bit */ -+#define R_MIPS_TLS_GD 42 /* 16 bit GOT offset for GD */ -+#define R_MIPS_TLS_LDM 43 /* 16 bit GOT offset for LDM */ -+#define R_MIPS_TLS_DTPREL_HI16 44 /* Module-relative offset, high 16 bits */ -+#define R_MIPS_TLS_DTPREL_LO16 45 /* Module-relative offset, low 16 bits */ -+#define R_MIPS_TLS_GOTTPREL 46 /* 16 bit GOT offset for IE */ -+#define R_MIPS_TLS_TPREL32 47 /* TP-relative offset, 32 bit */ -+#define R_MIPS_TLS_TPREL64 48 /* TP-relative offset, 64 bit */ -+#define R_MIPS_TLS_TPREL_HI16 49 /* TP-relative offset, high 16 bits */ -+#define R_MIPS_TLS_TPREL_LO16 50 /* TP-relative offset, low 16 bits */ -+#define R_MIPS_GLOB_DAT 51 -+#define R_MIPS_COPY 126 -+#define R_MIPS_JUMP_SLOT 127 -+/* Keep this the last entry. */ -+#define R_MIPS_NUM 128 -+ -+/* Legal values for p_type field of Elf32_Phdr. */ -+ -+#define PT_MIPS_REGINFO 0x70000000 /* Register usage information */ -+#define PT_MIPS_RTPROC 0x70000001 /* Runtime procedure table. */ -+#define PT_MIPS_OPTIONS 0x70000002 -+ -+/* Special program header types. */ -+ -+#define PF_MIPS_LOCAL 0x10000000 -+ -+/* Legal values for d_tag field of Elf32_Dyn. */ -+ -+#define DT_MIPS_RLD_VERSION 0x70000001 /* Runtime linker interface version */ -+#define DT_MIPS_TIME_STAMP 0x70000002 /* Timestamp */ -+#define DT_MIPS_ICHECKSUM 0x70000003 /* Checksum */ -+#define DT_MIPS_IVERSION 0x70000004 /* Version string (string tbl index) */ -+#define DT_MIPS_FLAGS 0x70000005 /* Flags */ -+#define DT_MIPS_BASE_ADDRESS 0x70000006 /* Base address */ -+#define DT_MIPS_MSYM 0x70000007 -+#define DT_MIPS_CONFLICT 0x70000008 /* Address of CONFLICT section */ -+#define DT_MIPS_LIBLIST 0x70000009 /* Address of LIBLIST section */ -+#define DT_MIPS_LOCAL_GOTNO 0x7000000a /* Number of local GOT entries */ -+#define DT_MIPS_CONFLICTNO 0x7000000b /* Number of CONFLICT entries */ -+#define DT_MIPS_LIBLISTNO 0x70000010 /* Number of LIBLIST entries */ -+#define DT_MIPS_SYMTABNO 0x70000011 /* Number of DYNSYM entries */ -+#define DT_MIPS_UNREFEXTNO 0x70000012 /* First external DYNSYM */ -+#define DT_MIPS_GOTSYM 0x70000013 /* First GOT entry in DYNSYM */ -+#define DT_MIPS_HIPAGENO 0x70000014 /* Number of GOT page table entries */ -+#define DT_MIPS_RLD_MAP 0x70000016 /* Address of run time loader map. */ -+#define DT_MIPS_DELTA_CLASS 0x70000017 /* Delta C++ class definition. */ -+#define DT_MIPS_DELTA_CLASS_NO 0x70000018 /* Number of entries in -+ DT_MIPS_DELTA_CLASS. */ -+#define DT_MIPS_DELTA_INSTANCE 0x70000019 /* Delta C++ class instances. */ -+#define DT_MIPS_DELTA_INSTANCE_NO 0x7000001a /* Number of entries in -+ DT_MIPS_DELTA_INSTANCE. */ -+#define DT_MIPS_DELTA_RELOC 0x7000001b /* Delta relocations. */ -+#define DT_MIPS_DELTA_RELOC_NO 0x7000001c /* Number of entries in -+ DT_MIPS_DELTA_RELOC. */ -+#define DT_MIPS_DELTA_SYM 0x7000001d /* Delta symbols that Delta -+ relocations refer to. */ -+#define DT_MIPS_DELTA_SYM_NO 0x7000001e /* Number of entries in -+ DT_MIPS_DELTA_SYM. */ -+#define DT_MIPS_DELTA_CLASSSYM 0x70000020 /* Delta symbols that hold the -+ class declaration. */ -+#define DT_MIPS_DELTA_CLASSSYM_NO 0x70000021 /* Number of entries in -+ DT_MIPS_DELTA_CLASSSYM. */ -+#define DT_MIPS_CXX_FLAGS 0x70000022 /* Flags indicating for C++ flavor. */ -+#define DT_MIPS_PIXIE_INIT 0x70000023 -+#define DT_MIPS_SYMBOL_LIB 0x70000024 -+#define DT_MIPS_LOCALPAGE_GOTIDX 0x70000025 -+#define DT_MIPS_LOCAL_GOTIDX 0x70000026 -+#define DT_MIPS_HIDDEN_GOTIDX 0x70000027 -+#define DT_MIPS_PROTECTED_GOTIDX 0x70000028 -+#define DT_MIPS_OPTIONS 0x70000029 /* Address of .options. */ -+#define DT_MIPS_INTERFACE 0x7000002a /* Address of .interface. */ -+#define DT_MIPS_DYNSTR_ALIGN 0x7000002b -+#define DT_MIPS_INTERFACE_SIZE 0x7000002c /* Size of the .interface section. */ -+#define DT_MIPS_RLD_TEXT_RESOLVE_ADDR 0x7000002d /* Address of rld_text_rsolve -+ function stored in GOT. */ -+#define DT_MIPS_PERF_SUFFIX 0x7000002e /* Default suffix of dso to be added -+ by rld on dlopen() calls. */ -+#define DT_MIPS_COMPACT_SIZE 0x7000002f /* (O32)Size of compact rel section. */ -+#define DT_MIPS_GP_VALUE 0x70000030 /* GP value for aux GOTs. */ -+#define DT_MIPS_AUX_DYNAMIC 0x70000031 /* Address of aux .dynamic. */ -+/* The address of .got.plt in an executable using the new non-PIC ABI. */ -+#define DT_MIPS_PLTGOT 0x70000032 -+/* The base of the PLT in an executable using the new non-PIC ABI if that -+ PLT is writable. For a non-writable PLT, this is omitted or has a zero -+ value. */ -+#define DT_MIPS_RWPLT 0x70000034 -+#define DT_MIPS_NUM 0x35 -+ -+/* Legal values for DT_MIPS_FLAGS Elf32_Dyn entry. */ -+ -+#define RHF_NONE 0 /* No flags */ -+#define RHF_QUICKSTART (1 << 0) /* Use quickstart */ -+#define RHF_NOTPOT (1 << 1) /* Hash size not power of 2 */ -+#define RHF_NO_LIBRARY_REPLACEMENT (1 << 2) /* Ignore LD_LIBRARY_PATH */ -+#define RHF_NO_MOVE (1 << 3) -+#define RHF_SGI_ONLY (1 << 4) -+#define RHF_GUARANTEE_INIT (1 << 5) -+#define RHF_DELTA_C_PLUS_PLUS (1 << 6) -+#define RHF_GUARANTEE_START_INIT (1 << 7) -+#define RHF_PIXIE (1 << 8) -+#define RHF_DEFAULT_DELAY_LOAD (1 << 9) -+#define RHF_REQUICKSTART (1 << 10) -+#define RHF_REQUICKSTARTED (1 << 11) -+#define RHF_CORD (1 << 12) -+#define RHF_NO_UNRES_UNDEF (1 << 13) -+#define RHF_RLD_ORDER_SAFE (1 << 14) -+ -+/* Entries found in sections of type SHT_MIPS_LIBLIST. */ -+ -+typedef struct -+{ -+ Elf32_Word l_name; /* Name (string table index) */ -+ Elf32_Word l_time_stamp; /* Timestamp */ -+ Elf32_Word l_checksum; /* Checksum */ -+ Elf32_Word l_version; /* Interface version */ -+ Elf32_Word l_flags; /* Flags */ -+} Elf32_Lib; -+ -+typedef struct -+{ -+ Elf64_Word l_name; /* Name (string table index) */ -+ Elf64_Word l_time_stamp; /* Timestamp */ -+ Elf64_Word l_checksum; /* Checksum */ -+ Elf64_Word l_version; /* Interface version */ -+ Elf64_Word l_flags; /* Flags */ -+} Elf64_Lib; -+ -+ -+/* Legal values for l_flags. */ -+ -+#define LL_NONE 0 -+#define LL_EXACT_MATCH (1 << 0) /* Require exact match */ -+#define LL_IGNORE_INT_VER (1 << 1) /* Ignore interface version */ -+#define LL_REQUIRE_MINOR (1 << 2) -+#define LL_EXPORTS (1 << 3) -+#define LL_DELAY_LOAD (1 << 4) -+#define LL_DELTA (1 << 5) -+ -+/* Entries found in sections of type SHT_MIPS_CONFLICT. */ -+ -+typedef Elf32_Addr Elf32_Conflict; -+ -+ -+/* HPPA specific definitions. */ -+ -+/* Legal values for e_flags field of Elf32_Ehdr. */ -+ -+#define EF_PARISC_TRAPNIL 0x00010000 /* Trap nil pointer dereference. */ -+#define EF_PARISC_EXT 0x00020000 /* Program uses arch. extensions. */ -+#define EF_PARISC_LSB 0x00040000 /* Program expects little endian. */ -+#define EF_PARISC_WIDE 0x00080000 /* Program expects wide mode. */ -+#define EF_PARISC_NO_KABP 0x00100000 /* No kernel assisted branch -+ prediction. */ -+#define EF_PARISC_LAZYSWAP 0x00400000 /* Allow lazy swapping. */ -+#define EF_PARISC_ARCH 0x0000ffff /* Architecture version. */ -+ -+/* Defined values for `e_flags & EF_PARISC_ARCH' are: */ -+ -+#define EFA_PARISC_1_0 0x020b /* PA-RISC 1.0 big-endian. */ -+#define EFA_PARISC_1_1 0x0210 /* PA-RISC 1.1 big-endian. */ -+#define EFA_PARISC_2_0 0x0214 /* PA-RISC 2.0 big-endian. */ -+ -+/* Additional section indeces. */ -+ -+#define SHN_PARISC_ANSI_COMMON 0xff00 /* Section for tenatively declared -+ symbols in ANSI C. */ -+#define SHN_PARISC_HUGE_COMMON 0xff01 /* Common blocks in huge model. */ -+ -+/* Legal values for sh_type field of Elf32_Shdr. */ -+ -+#define SHT_PARISC_EXT 0x70000000 /* Contains product specific ext. */ -+#define SHT_PARISC_UNWIND 0x70000001 /* Unwind information. */ -+#define SHT_PARISC_DOC 0x70000002 /* Debug info for optimized code. */ -+ -+/* Legal values for sh_flags field of Elf32_Shdr. */ -+ -+#define SHF_PARISC_SHORT 0x20000000 /* Section with short addressing. */ -+#define SHF_PARISC_HUGE 0x40000000 /* Section far from gp. */ -+#define SHF_PARISC_SBP 0x80000000 /* Static branch prediction code. */ -+ -+/* Legal values for ST_TYPE subfield of st_info (symbol type). */ -+ -+#define STT_PARISC_MILLICODE 13 /* Millicode function entry point. */ -+ -+#define STT_HP_OPAQUE (STT_LOOS + 0x1) -+#define STT_HP_STUB (STT_LOOS + 0x2) -+ -+/* HPPA relocs. */ -+ -+#define R_PARISC_NONE 0 /* No reloc. */ -+#define R_PARISC_DIR32 1 /* Direct 32-bit reference. */ -+#define R_PARISC_DIR21L 2 /* Left 21 bits of eff. address. */ -+#define R_PARISC_DIR17R 3 /* Right 17 bits of eff. address. */ -+#define R_PARISC_DIR17F 4 /* 17 bits of eff. address. */ -+#define R_PARISC_DIR14R 6 /* Right 14 bits of eff. address. */ -+#define R_PARISC_PCREL32 9 /* 32-bit rel. address. */ -+#define R_PARISC_PCREL21L 10 /* Left 21 bits of rel. address. */ -+#define R_PARISC_PCREL17R 11 /* Right 17 bits of rel. address. */ -+#define R_PARISC_PCREL17F 12 /* 17 bits of rel. address. */ -+#define R_PARISC_PCREL14R 14 /* Right 14 bits of rel. address. */ -+#define R_PARISC_DPREL21L 18 /* Left 21 bits of rel. address. */ -+#define R_PARISC_DPREL14R 22 /* Right 14 bits of rel. address. */ -+#define R_PARISC_GPREL21L 26 /* GP-relative, left 21 bits. */ -+#define R_PARISC_GPREL14R 30 /* GP-relative, right 14 bits. */ -+#define R_PARISC_LTOFF21L 34 /* LT-relative, left 21 bits. */ -+#define R_PARISC_LTOFF14R 38 /* LT-relative, right 14 bits. */ -+#define R_PARISC_SECREL32 41 /* 32 bits section rel. address. */ -+#define R_PARISC_SEGBASE 48 /* No relocation, set segment base. */ -+#define R_PARISC_SEGREL32 49 /* 32 bits segment rel. address. */ -+#define R_PARISC_PLTOFF21L 50 /* PLT rel. address, left 21 bits. */ -+#define R_PARISC_PLTOFF14R 54 /* PLT rel. address, right 14 bits. */ -+#define R_PARISC_LTOFF_FPTR32 57 /* 32 bits LT-rel. function pointer. */ -+#define R_PARISC_LTOFF_FPTR21L 58 /* LT-rel. fct ptr, left 21 bits. */ -+#define R_PARISC_LTOFF_FPTR14R 62 /* LT-rel. fct ptr, right 14 bits. */ -+#define R_PARISC_FPTR64 64 /* 64 bits function address. */ -+#define R_PARISC_PLABEL32 65 /* 32 bits function address. */ -+#define R_PARISC_PLABEL21L 66 /* Left 21 bits of fdesc address. */ -+#define R_PARISC_PLABEL14R 70 /* Right 14 bits of fdesc address. */ -+#define R_PARISC_PCREL64 72 /* 64 bits PC-rel. address. */ -+#define R_PARISC_PCREL22F 74 /* 22 bits PC-rel. address. */ -+#define R_PARISC_PCREL14WR 75 /* PC-rel. address, right 14 bits. */ -+#define R_PARISC_PCREL14DR 76 /* PC rel. address, right 14 bits. */ -+#define R_PARISC_PCREL16F 77 /* 16 bits PC-rel. address. */ -+#define R_PARISC_PCREL16WF 78 /* 16 bits PC-rel. address. */ -+#define R_PARISC_PCREL16DF 79 /* 16 bits PC-rel. address. */ -+#define R_PARISC_DIR64 80 /* 64 bits of eff. address. */ -+#define R_PARISC_DIR14WR 83 /* 14 bits of eff. address. */ -+#define R_PARISC_DIR14DR 84 /* 14 bits of eff. address. */ -+#define R_PARISC_DIR16F 85 /* 16 bits of eff. address. */ -+#define R_PARISC_DIR16WF 86 /* 16 bits of eff. address. */ -+#define R_PARISC_DIR16DF 87 /* 16 bits of eff. address. */ -+#define R_PARISC_GPREL64 88 /* 64 bits of GP-rel. address. */ -+#define R_PARISC_GPREL14WR 91 /* GP-rel. address, right 14 bits. */ -+#define R_PARISC_GPREL14DR 92 /* GP-rel. address, right 14 bits. */ -+#define R_PARISC_GPREL16F 93 /* 16 bits GP-rel. address. */ -+#define R_PARISC_GPREL16WF 94 /* 16 bits GP-rel. address. */ -+#define R_PARISC_GPREL16DF 95 /* 16 bits GP-rel. address. */ -+#define R_PARISC_LTOFF64 96 /* 64 bits LT-rel. address. */ -+#define R_PARISC_LTOFF14WR 99 /* LT-rel. address, right 14 bits. */ -+#define R_PARISC_LTOFF14DR 100 /* LT-rel. address, right 14 bits. */ -+#define R_PARISC_LTOFF16F 101 /* 16 bits LT-rel. address. */ -+#define R_PARISC_LTOFF16WF 102 /* 16 bits LT-rel. address. */ -+#define R_PARISC_LTOFF16DF 103 /* 16 bits LT-rel. address. */ -+#define R_PARISC_SECREL64 104 /* 64 bits section rel. address. */ -+#define R_PARISC_SEGREL64 112 /* 64 bits segment rel. address. */ -+#define R_PARISC_PLTOFF14WR 115 /* PLT-rel. address, right 14 bits. */ -+#define R_PARISC_PLTOFF14DR 116 /* PLT-rel. address, right 14 bits. */ -+#define R_PARISC_PLTOFF16F 117 /* 16 bits LT-rel. address. */ -+#define R_PARISC_PLTOFF16WF 118 /* 16 bits PLT-rel. address. */ -+#define R_PARISC_PLTOFF16DF 119 /* 16 bits PLT-rel. address. */ -+#define R_PARISC_LTOFF_FPTR64 120 /* 64 bits LT-rel. function ptr. */ -+#define R_PARISC_LTOFF_FPTR14WR 123 /* LT-rel. fct. ptr., right 14 bits. */ -+#define R_PARISC_LTOFF_FPTR14DR 124 /* LT-rel. fct. ptr., right 14 bits. */ -+#define R_PARISC_LTOFF_FPTR16F 125 /* 16 bits LT-rel. function ptr. */ -+#define R_PARISC_LTOFF_FPTR16WF 126 /* 16 bits LT-rel. function ptr. */ -+#define R_PARISC_LTOFF_FPTR16DF 127 /* 16 bits LT-rel. function ptr. */ -+#define R_PARISC_LORESERVE 128 -+#define R_PARISC_COPY 128 /* Copy relocation. */ -+#define R_PARISC_IPLT 129 /* Dynamic reloc, imported PLT */ -+#define R_PARISC_EPLT 130 /* Dynamic reloc, exported PLT */ -+#define R_PARISC_TPREL32 153 /* 32 bits TP-rel. address. */ -+#define R_PARISC_TPREL21L 154 /* TP-rel. address, left 21 bits. */ -+#define R_PARISC_TPREL14R 158 /* TP-rel. address, right 14 bits. */ -+#define R_PARISC_LTOFF_TP21L 162 /* LT-TP-rel. address, left 21 bits. */ -+#define R_PARISC_LTOFF_TP14R 166 /* LT-TP-rel. address, right 14 bits.*/ -+#define R_PARISC_LTOFF_TP14F 167 /* 14 bits LT-TP-rel. address. */ -+#define R_PARISC_TPREL64 216 /* 64 bits TP-rel. address. */ -+#define R_PARISC_TPREL14WR 219 /* TP-rel. address, right 14 bits. */ -+#define R_PARISC_TPREL14DR 220 /* TP-rel. address, right 14 bits. */ -+#define R_PARISC_TPREL16F 221 /* 16 bits TP-rel. address. */ -+#define R_PARISC_TPREL16WF 222 /* 16 bits TP-rel. address. */ -+#define R_PARISC_TPREL16DF 223 /* 16 bits TP-rel. address. */ -+#define R_PARISC_LTOFF_TP64 224 /* 64 bits LT-TP-rel. address. */ -+#define R_PARISC_LTOFF_TP14WR 227 /* LT-TP-rel. address, right 14 bits.*/ -+#define R_PARISC_LTOFF_TP14DR 228 /* LT-TP-rel. address, right 14 bits.*/ -+#define R_PARISC_LTOFF_TP16F 229 /* 16 bits LT-TP-rel. address. */ -+#define R_PARISC_LTOFF_TP16WF 230 /* 16 bits LT-TP-rel. address. */ -+#define R_PARISC_LTOFF_TP16DF 231 /* 16 bits LT-TP-rel. address. */ -+#define R_PARISC_GNU_VTENTRY 232 -+#define R_PARISC_GNU_VTINHERIT 233 -+#define R_PARISC_TLS_GD21L 234 /* GD 21-bit left. */ -+#define R_PARISC_TLS_GD14R 235 /* GD 14-bit right. */ -+#define R_PARISC_TLS_GDCALL 236 /* GD call to __t_g_a. */ -+#define R_PARISC_TLS_LDM21L 237 /* LD module 21-bit left. */ -+#define R_PARISC_TLS_LDM14R 238 /* LD module 14-bit right. */ -+#define R_PARISC_TLS_LDMCALL 239 /* LD module call to __t_g_a. */ -+#define R_PARISC_TLS_LDO21L 240 /* LD offset 21-bit left. */ -+#define R_PARISC_TLS_LDO14R 241 /* LD offset 14-bit right. */ -+#define R_PARISC_TLS_DTPMOD32 242 /* DTP module 32-bit. */ -+#define R_PARISC_TLS_DTPMOD64 243 /* DTP module 64-bit. */ -+#define R_PARISC_TLS_DTPOFF32 244 /* DTP offset 32-bit. */ -+#define R_PARISC_TLS_DTPOFF64 245 /* DTP offset 32-bit. */ -+#define R_PARISC_TLS_LE21L R_PARISC_TPREL21L -+#define R_PARISC_TLS_LE14R R_PARISC_TPREL14R -+#define R_PARISC_TLS_IE21L R_PARISC_LTOFF_TP21L -+#define R_PARISC_TLS_IE14R R_PARISC_LTOFF_TP14R -+#define R_PARISC_TLS_TPREL32 R_PARISC_TPREL32 -+#define R_PARISC_TLS_TPREL64 R_PARISC_TPREL64 -+#define R_PARISC_HIRESERVE 255 -+ -+/* Legal values for p_type field of Elf32_Phdr/Elf64_Phdr. */ -+ -+#define PT_HP_TLS (PT_LOOS + 0x0) -+#define PT_HP_CORE_NONE (PT_LOOS + 0x1) -+#define PT_HP_CORE_VERSION (PT_LOOS + 0x2) -+#define PT_HP_CORE_KERNEL (PT_LOOS + 0x3) -+#define PT_HP_CORE_COMM (PT_LOOS + 0x4) -+#define PT_HP_CORE_PROC (PT_LOOS + 0x5) -+#define PT_HP_CORE_LOADABLE (PT_LOOS + 0x6) -+#define PT_HP_CORE_STACK (PT_LOOS + 0x7) -+#define PT_HP_CORE_SHM (PT_LOOS + 0x8) -+#define PT_HP_CORE_MMF (PT_LOOS + 0x9) -+#define PT_HP_PARALLEL (PT_LOOS + 0x10) -+#define PT_HP_FASTBIND (PT_LOOS + 0x11) -+#define PT_HP_OPT_ANNOT (PT_LOOS + 0x12) -+#define PT_HP_HSL_ANNOT (PT_LOOS + 0x13) -+#define PT_HP_STACK (PT_LOOS + 0x14) -+ -+#define PT_PARISC_ARCHEXT 0x70000000 -+#define PT_PARISC_UNWIND 0x70000001 -+ -+/* Legal values for p_flags field of Elf32_Phdr/Elf64_Phdr. */ -+ -+#define PF_PARISC_SBP 0x08000000 -+ -+#define PF_HP_PAGE_SIZE 0x00100000 -+#define PF_HP_FAR_SHARED 0x00200000 -+#define PF_HP_NEAR_SHARED 0x00400000 -+#define PF_HP_CODE 0x01000000 -+#define PF_HP_MODIFY 0x02000000 -+#define PF_HP_LAZYSWAP 0x04000000 -+#define PF_HP_SBP 0x08000000 -+ -+ -+/* Alpha specific definitions. */ -+ -+/* Legal values for e_flags field of Elf64_Ehdr. */ -+ -+#define EF_ALPHA_32BIT 1 /* All addresses must be < 2GB. */ -+#define EF_ALPHA_CANRELAX 2 /* Relocations for relaxing exist. */ -+ -+/* Legal values for sh_type field of Elf64_Shdr. */ -+ -+/* These two are primerily concerned with ECOFF debugging info. */ -+#define SHT_ALPHA_DEBUG 0x70000001 -+#define SHT_ALPHA_REGINFO 0x70000002 -+ -+/* Legal values for sh_flags field of Elf64_Shdr. */ -+ -+#define SHF_ALPHA_GPREL 0x10000000 -+ -+/* Legal values for st_other field of Elf64_Sym. */ -+#define STO_ALPHA_NOPV 0x80 /* No PV required. */ -+#define STO_ALPHA_STD_GPLOAD 0x88 /* PV only used for initial ldgp. */ -+ -+/* Alpha relocs. */ -+ -+#define R_ALPHA_NONE 0 /* No reloc */ -+#define R_ALPHA_REFLONG 1 /* Direct 32 bit */ -+#define R_ALPHA_REFQUAD 2 /* Direct 64 bit */ -+#define R_ALPHA_GPREL32 3 /* GP relative 32 bit */ -+#define R_ALPHA_LITERAL 4 /* GP relative 16 bit w/optimization */ -+#define R_ALPHA_LITUSE 5 /* Optimization hint for LITERAL */ -+#define R_ALPHA_GPDISP 6 /* Add displacement to GP */ -+#define R_ALPHA_BRADDR 7 /* PC+4 relative 23 bit shifted */ -+#define R_ALPHA_HINT 8 /* PC+4 relative 16 bit shifted */ -+#define R_ALPHA_SREL16 9 /* PC relative 16 bit */ -+#define R_ALPHA_SREL32 10 /* PC relative 32 bit */ -+#define R_ALPHA_SREL64 11 /* PC relative 64 bit */ -+#define R_ALPHA_GPRELHIGH 17 /* GP relative 32 bit, high 16 bits */ -+#define R_ALPHA_GPRELLOW 18 /* GP relative 32 bit, low 16 bits */ -+#define R_ALPHA_GPREL16 19 /* GP relative 16 bit */ -+#define R_ALPHA_COPY 24 /* Copy symbol at runtime */ -+#define R_ALPHA_GLOB_DAT 25 /* Create GOT entry */ -+#define R_ALPHA_JMP_SLOT 26 /* Create PLT entry */ -+#define R_ALPHA_RELATIVE 27 /* Adjust by program base */ -+#define R_ALPHA_TLS_GD_HI 28 -+#define R_ALPHA_TLSGD 29 -+#define R_ALPHA_TLS_LDM 30 -+#define R_ALPHA_DTPMOD64 31 -+#define R_ALPHA_GOTDTPREL 32 -+#define R_ALPHA_DTPREL64 33 -+#define R_ALPHA_DTPRELHI 34 -+#define R_ALPHA_DTPRELLO 35 -+#define R_ALPHA_DTPREL16 36 -+#define R_ALPHA_GOTTPREL 37 -+#define R_ALPHA_TPREL64 38 -+#define R_ALPHA_TPRELHI 39 -+#define R_ALPHA_TPRELLO 40 -+#define R_ALPHA_TPREL16 41 -+/* Keep this the last entry. */ -+#define R_ALPHA_NUM 46 -+ -+/* Magic values of the LITUSE relocation addend. */ -+#define LITUSE_ALPHA_ADDR 0 -+#define LITUSE_ALPHA_BASE 1 -+#define LITUSE_ALPHA_BYTOFF 2 -+#define LITUSE_ALPHA_JSR 3 -+#define LITUSE_ALPHA_TLS_GD 4 -+#define LITUSE_ALPHA_TLS_LDM 5 -+ -+/* Legal values for d_tag of Elf64_Dyn. */ -+#define DT_ALPHA_PLTRO (DT_LOPROC + 0) -+#define DT_ALPHA_NUM 1 -+ -+/* PowerPC specific declarations */ -+ -+/* Values for Elf32/64_Ehdr.e_flags. */ -+#define EF_PPC_EMB 0x80000000 /* PowerPC embedded flag */ -+ -+/* Cygnus local bits below */ -+#define EF_PPC_RELOCATABLE 0x00010000 /* PowerPC -mrelocatable flag*/ -+#define EF_PPC_RELOCATABLE_LIB 0x00008000 /* PowerPC -mrelocatable-lib -+ flag */ -+ -+/* PowerPC relocations defined by the ABIs */ -+#define R_PPC_NONE 0 -+#define R_PPC_ADDR32 1 /* 32bit absolute address */ -+#define R_PPC_ADDR24 2 /* 26bit address, 2 bits ignored. */ -+#define R_PPC_ADDR16 3 /* 16bit absolute address */ -+#define R_PPC_ADDR16_LO 4 /* lower 16bit of absolute address */ -+#define R_PPC_ADDR16_HI 5 /* high 16bit of absolute address */ -+#define R_PPC_ADDR16_HA 6 /* adjusted high 16bit */ -+#define R_PPC_ADDR14 7 /* 16bit address, 2 bits ignored */ -+#define R_PPC_ADDR14_BRTAKEN 8 -+#define R_PPC_ADDR14_BRNTAKEN 9 -+#define R_PPC_REL24 10 /* PC relative 26 bit */ -+#define R_PPC_REL14 11 /* PC relative 16 bit */ -+#define R_PPC_REL14_BRTAKEN 12 -+#define R_PPC_REL14_BRNTAKEN 13 -+#define R_PPC_GOT16 14 -+#define R_PPC_GOT16_LO 15 -+#define R_PPC_GOT16_HI 16 -+#define R_PPC_GOT16_HA 17 -+#define R_PPC_PLTREL24 18 -+#define R_PPC_COPY 19 -+#define R_PPC_GLOB_DAT 20 -+#define R_PPC_JMP_SLOT 21 -+#define R_PPC_RELATIVE 22 -+#define R_PPC_LOCAL24PC 23 -+#define R_PPC_UADDR32 24 -+#define R_PPC_UADDR16 25 -+#define R_PPC_REL32 26 -+#define R_PPC_PLT32 27 -+#define R_PPC_PLTREL32 28 -+#define R_PPC_PLT16_LO 29 -+#define R_PPC_PLT16_HI 30 -+#define R_PPC_PLT16_HA 31 -+#define R_PPC_SDAREL16 32 -+#define R_PPC_SECTOFF 33 -+#define R_PPC_SECTOFF_LO 34 -+#define R_PPC_SECTOFF_HI 35 -+#define R_PPC_SECTOFF_HA 36 -+ -+/* PowerPC relocations defined for the TLS access ABI. */ -+#define R_PPC_TLS 67 /* none (sym+add)@tls */ -+#define R_PPC_DTPMOD32 68 /* word32 (sym+add)@dtpmod */ -+#define R_PPC_TPREL16 69 /* half16* (sym+add)@tprel */ -+#define R_PPC_TPREL16_LO 70 /* half16 (sym+add)@tprel@l */ -+#define R_PPC_TPREL16_HI 71 /* half16 (sym+add)@tprel@h */ -+#define R_PPC_TPREL16_HA 72 /* half16 (sym+add)@tprel@ha */ -+#define R_PPC_TPREL32 73 /* word32 (sym+add)@tprel */ -+#define R_PPC_DTPREL16 74 /* half16* (sym+add)@dtprel */ -+#define R_PPC_DTPREL16_LO 75 /* half16 (sym+add)@dtprel@l */ -+#define R_PPC_DTPREL16_HI 76 /* half16 (sym+add)@dtprel@h */ -+#define R_PPC_DTPREL16_HA 77 /* half16 (sym+add)@dtprel@ha */ -+#define R_PPC_DTPREL32 78 /* word32 (sym+add)@dtprel */ -+#define R_PPC_GOT_TLSGD16 79 /* half16* (sym+add)@got@tlsgd */ -+#define R_PPC_GOT_TLSGD16_LO 80 /* half16 (sym+add)@got@tlsgd@l */ -+#define R_PPC_GOT_TLSGD16_HI 81 /* half16 (sym+add)@got@tlsgd@h */ -+#define R_PPC_GOT_TLSGD16_HA 82 /* half16 (sym+add)@got@tlsgd@ha */ -+#define R_PPC_GOT_TLSLD16 83 /* half16* (sym+add)@got@tlsld */ -+#define R_PPC_GOT_TLSLD16_LO 84 /* half16 (sym+add)@got@tlsld@l */ -+#define R_PPC_GOT_TLSLD16_HI 85 /* half16 (sym+add)@got@tlsld@h */ -+#define R_PPC_GOT_TLSLD16_HA 86 /* half16 (sym+add)@got@tlsld@ha */ -+#define R_PPC_GOT_TPREL16 87 /* half16* (sym+add)@got@tprel */ -+#define R_PPC_GOT_TPREL16_LO 88 /* half16 (sym+add)@got@tprel@l */ -+#define R_PPC_GOT_TPREL16_HI 89 /* half16 (sym+add)@got@tprel@h */ -+#define R_PPC_GOT_TPREL16_HA 90 /* half16 (sym+add)@got@tprel@ha */ -+#define R_PPC_GOT_DTPREL16 91 /* half16* (sym+add)@got@dtprel */ -+#define R_PPC_GOT_DTPREL16_LO 92 /* half16* (sym+add)@got@dtprel@l */ -+#define R_PPC_GOT_DTPREL16_HI 93 /* half16* (sym+add)@got@dtprel@h */ -+#define R_PPC_GOT_DTPREL16_HA 94 /* half16* (sym+add)@got@dtprel@ha */ -+ -+/* The remaining relocs are from the Embedded ELF ABI, and are not -+ in the SVR4 ELF ABI. */ -+#define R_PPC_EMB_NADDR32 101 -+#define R_PPC_EMB_NADDR16 102 -+#define R_PPC_EMB_NADDR16_LO 103 -+#define R_PPC_EMB_NADDR16_HI 104 -+#define R_PPC_EMB_NADDR16_HA 105 -+#define R_PPC_EMB_SDAI16 106 -+#define R_PPC_EMB_SDA2I16 107 -+#define R_PPC_EMB_SDA2REL 108 -+#define R_PPC_EMB_SDA21 109 /* 16 bit offset in SDA */ -+#define R_PPC_EMB_MRKREF 110 -+#define R_PPC_EMB_RELSEC16 111 -+#define R_PPC_EMB_RELST_LO 112 -+#define R_PPC_EMB_RELST_HI 113 -+#define R_PPC_EMB_RELST_HA 114 -+#define R_PPC_EMB_BIT_FLD 115 -+#define R_PPC_EMB_RELSDA 116 /* 16 bit relative offset in SDA */ -+ -+/* Diab tool relocations. */ -+#define R_PPC_DIAB_SDA21_LO 180 /* like EMB_SDA21, but lower 16 bit */ -+#define R_PPC_DIAB_SDA21_HI 181 /* like EMB_SDA21, but high 16 bit */ -+#define R_PPC_DIAB_SDA21_HA 182 /* like EMB_SDA21, adjusted high 16 */ -+#define R_PPC_DIAB_RELSDA_LO 183 /* like EMB_RELSDA, but lower 16 bit */ -+#define R_PPC_DIAB_RELSDA_HI 184 /* like EMB_RELSDA, but high 16 bit */ -+#define R_PPC_DIAB_RELSDA_HA 185 /* like EMB_RELSDA, adjusted high 16 */ -+ -+/* GNU extension to support local ifunc. */ -+#define R_PPC_IRELATIVE 248 -+ -+/* GNU relocs used in PIC code sequences. */ -+#define R_PPC_REL16 249 /* half16 (sym+add-.) */ -+#define R_PPC_REL16_LO 250 /* half16 (sym+add-.)@l */ -+#define R_PPC_REL16_HI 251 /* half16 (sym+add-.)@h */ -+#define R_PPC_REL16_HA 252 /* half16 (sym+add-.)@ha */ -+ -+/* This is a phony reloc to handle any old fashioned TOC16 references -+ that may still be in object files. */ -+#define R_PPC_TOC16 255 -+ -+/* PowerPC specific values for the Dyn d_tag field. */ -+#define DT_PPC_GOT (DT_LOPROC + 0) -+#define DT_PPC_NUM 1 -+ -+/* PowerPC64 relocations defined by the ABIs */ -+#define R_PPC64_NONE R_PPC_NONE -+#define R_PPC64_ADDR32 R_PPC_ADDR32 /* 32bit absolute address */ -+#define R_PPC64_ADDR24 R_PPC_ADDR24 /* 26bit address, word aligned */ -+#define R_PPC64_ADDR16 R_PPC_ADDR16 /* 16bit absolute address */ -+#define R_PPC64_ADDR16_LO R_PPC_ADDR16_LO /* lower 16bits of address */ -+#define R_PPC64_ADDR16_HI R_PPC_ADDR16_HI /* high 16bits of address. */ -+#define R_PPC64_ADDR16_HA R_PPC_ADDR16_HA /* adjusted high 16bits. */ -+#define R_PPC64_ADDR14 R_PPC_ADDR14 /* 16bit address, word aligned */ -+#define R_PPC64_ADDR14_BRTAKEN R_PPC_ADDR14_BRTAKEN -+#define R_PPC64_ADDR14_BRNTAKEN R_PPC_ADDR14_BRNTAKEN -+#define R_PPC64_REL24 R_PPC_REL24 /* PC-rel. 26 bit, word aligned */ -+#define R_PPC64_REL14 R_PPC_REL14 /* PC relative 16 bit */ -+#define R_PPC64_REL14_BRTAKEN R_PPC_REL14_BRTAKEN -+#define R_PPC64_REL14_BRNTAKEN R_PPC_REL14_BRNTAKEN -+#define R_PPC64_GOT16 R_PPC_GOT16 -+#define R_PPC64_GOT16_LO R_PPC_GOT16_LO -+#define R_PPC64_GOT16_HI R_PPC_GOT16_HI -+#define R_PPC64_GOT16_HA R_PPC_GOT16_HA -+ -+#define R_PPC64_COPY R_PPC_COPY -+#define R_PPC64_GLOB_DAT R_PPC_GLOB_DAT -+#define R_PPC64_JMP_SLOT R_PPC_JMP_SLOT -+#define R_PPC64_RELATIVE R_PPC_RELATIVE -+ -+#define R_PPC64_UADDR32 R_PPC_UADDR32 -+#define R_PPC64_UADDR16 R_PPC_UADDR16 -+#define R_PPC64_REL32 R_PPC_REL32 -+#define R_PPC64_PLT32 R_PPC_PLT32 -+#define R_PPC64_PLTREL32 R_PPC_PLTREL32 -+#define R_PPC64_PLT16_LO R_PPC_PLT16_LO -+#define R_PPC64_PLT16_HI R_PPC_PLT16_HI -+#define R_PPC64_PLT16_HA R_PPC_PLT16_HA -+ -+#define R_PPC64_SECTOFF R_PPC_SECTOFF -+#define R_PPC64_SECTOFF_LO R_PPC_SECTOFF_LO -+#define R_PPC64_SECTOFF_HI R_PPC_SECTOFF_HI -+#define R_PPC64_SECTOFF_HA R_PPC_SECTOFF_HA -+#define R_PPC64_ADDR30 37 /* word30 (S + A - P) >> 2 */ -+#define R_PPC64_ADDR64 38 /* doubleword64 S + A */ -+#define R_PPC64_ADDR16_HIGHER 39 /* half16 #higher(S + A) */ -+#define R_PPC64_ADDR16_HIGHERA 40 /* half16 #highera(S + A) */ -+#define R_PPC64_ADDR16_HIGHEST 41 /* half16 #highest(S + A) */ -+#define R_PPC64_ADDR16_HIGHESTA 42 /* half16 #highesta(S + A) */ -+#define R_PPC64_UADDR64 43 /* doubleword64 S + A */ -+#define R_PPC64_REL64 44 /* doubleword64 S + A - P */ -+#define R_PPC64_PLT64 45 /* doubleword64 L + A */ -+#define R_PPC64_PLTREL64 46 /* doubleword64 L + A - P */ -+#define R_PPC64_TOC16 47 /* half16* S + A - .TOC */ -+#define R_PPC64_TOC16_LO 48 /* half16 #lo(S + A - .TOC.) */ -+#define R_PPC64_TOC16_HI 49 /* half16 #hi(S + A - .TOC.) */ -+#define R_PPC64_TOC16_HA 50 /* half16 #ha(S + A - .TOC.) */ -+#define R_PPC64_TOC 51 /* doubleword64 .TOC */ -+#define R_PPC64_PLTGOT16 52 /* half16* M + A */ -+#define R_PPC64_PLTGOT16_LO 53 /* half16 #lo(M + A) */ -+#define R_PPC64_PLTGOT16_HI 54 /* half16 #hi(M + A) */ -+#define R_PPC64_PLTGOT16_HA 55 /* half16 #ha(M + A) */ -+ -+#define R_PPC64_ADDR16_DS 56 /* half16ds* (S + A) >> 2 */ -+#define R_PPC64_ADDR16_LO_DS 57 /* half16ds #lo(S + A) >> 2 */ -+#define R_PPC64_GOT16_DS 58 /* half16ds* (G + A) >> 2 */ -+#define R_PPC64_GOT16_LO_DS 59 /* half16ds #lo(G + A) >> 2 */ -+#define R_PPC64_PLT16_LO_DS 60 /* half16ds #lo(L + A) >> 2 */ -+#define R_PPC64_SECTOFF_DS 61 /* half16ds* (R + A) >> 2 */ -+#define R_PPC64_SECTOFF_LO_DS 62 /* half16ds #lo(R + A) >> 2 */ -+#define R_PPC64_TOC16_DS 63 /* half16ds* (S + A - .TOC.) >> 2 */ -+#define R_PPC64_TOC16_LO_DS 64 /* half16ds #lo(S + A - .TOC.) >> 2 */ -+#define R_PPC64_PLTGOT16_DS 65 /* half16ds* (M + A) >> 2 */ -+#define R_PPC64_PLTGOT16_LO_DS 66 /* half16ds #lo(M + A) >> 2 */ -+ -+/* PowerPC64 relocations defined for the TLS access ABI. */ -+#define R_PPC64_TLS 67 /* none (sym+add)@tls */ -+#define R_PPC64_DTPMOD64 68 /* doubleword64 (sym+add)@dtpmod */ -+#define R_PPC64_TPREL16 69 /* half16* (sym+add)@tprel */ -+#define R_PPC64_TPREL16_LO 70 /* half16 (sym+add)@tprel@l */ -+#define R_PPC64_TPREL16_HI 71 /* half16 (sym+add)@tprel@h */ -+#define R_PPC64_TPREL16_HA 72 /* half16 (sym+add)@tprel@ha */ -+#define R_PPC64_TPREL64 73 /* doubleword64 (sym+add)@tprel */ -+#define R_PPC64_DTPREL16 74 /* half16* (sym+add)@dtprel */ -+#define R_PPC64_DTPREL16_LO 75 /* half16 (sym+add)@dtprel@l */ -+#define R_PPC64_DTPREL16_HI 76 /* half16 (sym+add)@dtprel@h */ -+#define R_PPC64_DTPREL16_HA 77 /* half16 (sym+add)@dtprel@ha */ -+#define R_PPC64_DTPREL64 78 /* doubleword64 (sym+add)@dtprel */ -+#define R_PPC64_GOT_TLSGD16 79 /* half16* (sym+add)@got@tlsgd */ -+#define R_PPC64_GOT_TLSGD16_LO 80 /* half16 (sym+add)@got@tlsgd@l */ -+#define R_PPC64_GOT_TLSGD16_HI 81 /* half16 (sym+add)@got@tlsgd@h */ -+#define R_PPC64_GOT_TLSGD16_HA 82 /* half16 (sym+add)@got@tlsgd@ha */ -+#define R_PPC64_GOT_TLSLD16 83 /* half16* (sym+add)@got@tlsld */ -+#define R_PPC64_GOT_TLSLD16_LO 84 /* half16 (sym+add)@got@tlsld@l */ -+#define R_PPC64_GOT_TLSLD16_HI 85 /* half16 (sym+add)@got@tlsld@h */ -+#define R_PPC64_GOT_TLSLD16_HA 86 /* half16 (sym+add)@got@tlsld@ha */ -+#define R_PPC64_GOT_TPREL16_DS 87 /* half16ds* (sym+add)@got@tprel */ -+#define R_PPC64_GOT_TPREL16_LO_DS 88 /* half16ds (sym+add)@got@tprel@l */ -+#define R_PPC64_GOT_TPREL16_HI 89 /* half16 (sym+add)@got@tprel@h */ -+#define R_PPC64_GOT_TPREL16_HA 90 /* half16 (sym+add)@got@tprel@ha */ -+#define R_PPC64_GOT_DTPREL16_DS 91 /* half16ds* (sym+add)@got@dtprel */ -+#define R_PPC64_GOT_DTPREL16_LO_DS 92 /* half16ds (sym+add)@got@dtprel@l */ -+#define R_PPC64_GOT_DTPREL16_HI 93 /* half16 (sym+add)@got@dtprel@h */ -+#define R_PPC64_GOT_DTPREL16_HA 94 /* half16 (sym+add)@got@dtprel@ha */ -+#define R_PPC64_TPREL16_DS 95 /* half16ds* (sym+add)@tprel */ -+#define R_PPC64_TPREL16_LO_DS 96 /* half16ds (sym+add)@tprel@l */ -+#define R_PPC64_TPREL16_HIGHER 97 /* half16 (sym+add)@tprel@higher */ -+#define R_PPC64_TPREL16_HIGHERA 98 /* half16 (sym+add)@tprel@highera */ -+#define R_PPC64_TPREL16_HIGHEST 99 /* half16 (sym+add)@tprel@highest */ -+#define R_PPC64_TPREL16_HIGHESTA 100 /* half16 (sym+add)@tprel@highesta */ -+#define R_PPC64_DTPREL16_DS 101 /* half16ds* (sym+add)@dtprel */ -+#define R_PPC64_DTPREL16_LO_DS 102 /* half16ds (sym+add)@dtprel@l */ -+#define R_PPC64_DTPREL16_HIGHER 103 /* half16 (sym+add)@dtprel@higher */ -+#define R_PPC64_DTPREL16_HIGHERA 104 /* half16 (sym+add)@dtprel@highera */ -+#define R_PPC64_DTPREL16_HIGHEST 105 /* half16 (sym+add)@dtprel@highest */ -+#define R_PPC64_DTPREL16_HIGHESTA 106 /* half16 (sym+add)@dtprel@highesta */ -+ -+/* GNU extension to support local ifunc. */ -+#define R_PPC64_JMP_IREL 247 -+#define R_PPC64_IRELATIVE 248 -+#define R_PPC64_REL16 249 /* half16 (sym+add-.) */ -+#define R_PPC64_REL16_LO 250 /* half16 (sym+add-.)@l */ -+#define R_PPC64_REL16_HI 251 /* half16 (sym+add-.)@h */ -+#define R_PPC64_REL16_HA 252 /* half16 (sym+add-.)@ha */ -+ -+/* PowerPC64 specific values for the Dyn d_tag field. */ -+#define DT_PPC64_GLINK (DT_LOPROC + 0) -+#define DT_PPC64_OPD (DT_LOPROC + 1) -+#define DT_PPC64_OPDSZ (DT_LOPROC + 2) -+#define DT_PPC64_NUM 3 -+ -+ -+/* ARM specific declarations */ -+ -+/* Processor specific flags for the ELF header e_flags field. */ -+#define EF_ARM_RELEXEC 0x01 -+#define EF_ARM_HASENTRY 0x02 -+#define EF_ARM_INTERWORK 0x04 -+#define EF_ARM_APCS_26 0x08 -+#define EF_ARM_APCS_FLOAT 0x10 -+#define EF_ARM_PIC 0x20 -+#define EF_ARM_ALIGN8 0x40 /* 8-bit structure alignment is in use */ -+#define EF_ARM_NEW_ABI 0x80 -+#define EF_ARM_OLD_ABI 0x100 -+#define EF_ARM_SOFT_FLOAT 0x200 -+#define EF_ARM_VFP_FLOAT 0x400 -+#define EF_ARM_MAVERICK_FLOAT 0x800 -+ -+ -+/* Other constants defined in the ARM ELF spec. version B-01. */ -+/* NB. These conflict with values defined above. */ -+#define EF_ARM_SYMSARESORTED 0x04 -+#define EF_ARM_DYNSYMSUSESEGIDX 0x08 -+#define EF_ARM_MAPSYMSFIRST 0x10 -+#define EF_ARM_EABIMASK 0XFF000000 -+ -+/* Constants defined in AAELF. */ -+#define EF_ARM_BE8 0x00800000 -+#define EF_ARM_LE8 0x00400000 -+ -+#define EF_ARM_EABI_VERSION(flags) ((flags) & EF_ARM_EABIMASK) -+#define EF_ARM_EABI_UNKNOWN 0x00000000 -+#define EF_ARM_EABI_VER1 0x01000000 -+#define EF_ARM_EABI_VER2 0x02000000 -+#define EF_ARM_EABI_VER3 0x03000000 -+#define EF_ARM_EABI_VER4 0x04000000 -+#define EF_ARM_EABI_VER5 0x05000000 -+ -+/* Additional symbol types for Thumb. */ -+#define STT_ARM_TFUNC STT_LOPROC /* A Thumb function. */ -+#define STT_ARM_16BIT STT_HIPROC /* A Thumb label. */ -+ -+/* ARM-specific values for sh_flags */ -+#define SHF_ARM_ENTRYSECT 0x10000000 /* Section contains an entry point */ -+#define SHF_ARM_COMDEF 0x80000000 /* Section may be multiply defined -+ in the input to a link step. */ -+ -+/* ARM-specific program header flags */ -+#define PF_ARM_SB 0x10000000 /* Segment contains the location -+ addressed by the static base. */ -+#define PF_ARM_PI 0x20000000 /* Position-independent segment. */ -+#define PF_ARM_ABS 0x40000000 /* Absolute segment. */ -+ -+/* Processor specific values for the Phdr p_type field. */ -+#define PT_ARM_EXIDX (PT_LOPROC + 1) /* ARM unwind segment. */ -+ -+/* Processor specific values for the Shdr sh_type field. */ -+#define SHT_ARM_EXIDX (SHT_LOPROC + 1) /* ARM unwind section. */ -+#define SHT_ARM_PREEMPTMAP (SHT_LOPROC + 2) /* Preemption details. */ -+#define SHT_ARM_ATTRIBUTES (SHT_LOPROC + 3) /* ARM attributes section. */ -+ -+ -+/* ARM relocs. */ -+ -+#define R_ARM_NONE 0 /* No reloc */ -+#define R_ARM_PC24 1 /* PC relative 26 bit branch */ -+#define R_ARM_ABS32 2 /* Direct 32 bit */ -+#define R_ARM_REL32 3 /* PC relative 32 bit */ -+#define R_ARM_PC13 4 -+#define R_ARM_ABS16 5 /* Direct 16 bit */ -+#define R_ARM_ABS12 6 /* Direct 12 bit */ -+#define R_ARM_THM_ABS5 7 -+#define R_ARM_ABS8 8 /* Direct 8 bit */ -+#define R_ARM_SBREL32 9 -+#define R_ARM_THM_PC22 10 -+#define R_ARM_THM_PC8 11 -+#define R_ARM_AMP_VCALL9 12 -+#define R_ARM_SWI24 13 /* Obsolete static relocation. */ -+#define R_ARM_TLS_DESC 13 /* Dynamic relocation. */ -+#define R_ARM_THM_SWI8 14 -+#define R_ARM_XPC25 15 -+#define R_ARM_THM_XPC22 16 -+#define R_ARM_TLS_DTPMOD32 17 /* ID of module containing symbol */ -+#define R_ARM_TLS_DTPOFF32 18 /* Offset in TLS block */ -+#define R_ARM_TLS_TPOFF32 19 /* Offset in static TLS block */ -+#define R_ARM_COPY 20 /* Copy symbol at runtime */ -+#define R_ARM_GLOB_DAT 21 /* Create GOT entry */ -+#define R_ARM_JUMP_SLOT 22 /* Create PLT entry */ -+#define R_ARM_RELATIVE 23 /* Adjust by program base */ -+#define R_ARM_GOTOFF 24 /* 32 bit offset to GOT */ -+#define R_ARM_GOTPC 25 /* 32 bit PC relative offset to GOT */ -+#define R_ARM_GOT32 26 /* 32 bit GOT entry */ -+#define R_ARM_PLT32 27 /* 32 bit PLT address */ -+#define R_ARM_ALU_PCREL_7_0 32 -+#define R_ARM_ALU_PCREL_15_8 33 -+#define R_ARM_ALU_PCREL_23_15 34 -+#define R_ARM_LDR_SBREL_11_0 35 -+#define R_ARM_ALU_SBREL_19_12 36 -+#define R_ARM_ALU_SBREL_27_20 37 -+#define R_ARM_TLS_GOTDESC 90 -+#define R_ARM_TLS_CALL 91 -+#define R_ARM_TLS_DESCSEQ 92 -+#define R_ARM_THM_TLS_CALL 93 -+#define R_ARM_GNU_VTENTRY 100 -+#define R_ARM_GNU_VTINHERIT 101 -+#define R_ARM_THM_PC11 102 /* thumb unconditional branch */ -+#define R_ARM_THM_PC9 103 /* thumb conditional branch */ -+#define R_ARM_TLS_GD32 104 /* PC-rel 32 bit for global dynamic -+ thread local data */ -+#define R_ARM_TLS_LDM32 105 /* PC-rel 32 bit for local dynamic -+ thread local data */ -+#define R_ARM_TLS_LDO32 106 /* 32 bit offset relative to TLS -+ block */ -+#define R_ARM_TLS_IE32 107 /* PC-rel 32 bit for GOT entry of -+ static TLS block offset */ -+#define R_ARM_TLS_LE32 108 /* 32 bit offset relative to static -+ TLS block */ -+#define R_ARM_THM_TLS_DESCSEQ 129 -+#define R_ARM_IRELATIVE 160 -+#define R_ARM_RXPC25 249 -+#define R_ARM_RSBREL32 250 -+#define R_ARM_THM_RPC22 251 -+#define R_ARM_RREL32 252 -+#define R_ARM_RABS22 253 -+#define R_ARM_RPC24 254 -+#define R_ARM_RBASE 255 -+/* Keep this the last entry. */ -+#define R_ARM_NUM 256 -+ -+/* IA-64 specific declarations. */ -+ -+/* Processor specific flags for the Ehdr e_flags field. */ -+#define EF_IA_64_MASKOS 0x0000000f /* os-specific flags */ -+#define EF_IA_64_ABI64 0x00000010 /* 64-bit ABI */ -+#define EF_IA_64_ARCH 0xff000000 /* arch. version mask */ -+ -+/* Processor specific values for the Phdr p_type field. */ -+#define PT_IA_64_ARCHEXT (PT_LOPROC + 0) /* arch extension bits */ -+#define PT_IA_64_UNWIND (PT_LOPROC + 1) /* ia64 unwind bits */ -+#define PT_IA_64_HP_OPT_ANOT (PT_LOOS + 0x12) -+#define PT_IA_64_HP_HSL_ANOT (PT_LOOS + 0x13) -+#define PT_IA_64_HP_STACK (PT_LOOS + 0x14) -+ -+/* Processor specific flags for the Phdr p_flags field. */ -+#define PF_IA_64_NORECOV 0x80000000 /* spec insns w/o recovery */ -+ -+/* Processor specific values for the Shdr sh_type field. */ -+#define SHT_IA_64_EXT (SHT_LOPROC + 0) /* extension bits */ -+#define SHT_IA_64_UNWIND (SHT_LOPROC + 1) /* unwind bits */ -+ -+/* Processor specific flags for the Shdr sh_flags field. */ -+#define SHF_IA_64_SHORT 0x10000000 /* section near gp */ -+#define SHF_IA_64_NORECOV 0x20000000 /* spec insns w/o recovery */ -+ -+/* Processor specific values for the Dyn d_tag field. */ -+#define DT_IA_64_PLT_RESERVE (DT_LOPROC + 0) -+#define DT_IA_64_NUM 1 -+ -+/* IA-64 relocations. */ -+#define R_IA64_NONE 0x00 /* none */ -+#define R_IA64_IMM14 0x21 /* symbol + addend, add imm14 */ -+#define R_IA64_IMM22 0x22 /* symbol + addend, add imm22 */ -+#define R_IA64_IMM64 0x23 /* symbol + addend, mov imm64 */ -+#define R_IA64_DIR32MSB 0x24 /* symbol + addend, data4 MSB */ -+#define R_IA64_DIR32LSB 0x25 /* symbol + addend, data4 LSB */ -+#define R_IA64_DIR64MSB 0x26 /* symbol + addend, data8 MSB */ -+#define R_IA64_DIR64LSB 0x27 /* symbol + addend, data8 LSB */ -+#define R_IA64_GPREL22 0x2a /* @gprel(sym + add), add imm22 */ -+#define R_IA64_GPREL64I 0x2b /* @gprel(sym + add), mov imm64 */ -+#define R_IA64_GPREL32MSB 0x2c /* @gprel(sym + add), data4 MSB */ -+#define R_IA64_GPREL32LSB 0x2d /* @gprel(sym + add), data4 LSB */ -+#define R_IA64_GPREL64MSB 0x2e /* @gprel(sym + add), data8 MSB */ -+#define R_IA64_GPREL64LSB 0x2f /* @gprel(sym + add), data8 LSB */ -+#define R_IA64_LTOFF22 0x32 /* @ltoff(sym + add), add imm22 */ -+#define R_IA64_LTOFF64I 0x33 /* @ltoff(sym + add), mov imm64 */ -+#define R_IA64_PLTOFF22 0x3a /* @pltoff(sym + add), add imm22 */ -+#define R_IA64_PLTOFF64I 0x3b /* @pltoff(sym + add), mov imm64 */ -+#define R_IA64_PLTOFF64MSB 0x3e /* @pltoff(sym + add), data8 MSB */ -+#define R_IA64_PLTOFF64LSB 0x3f /* @pltoff(sym + add), data8 LSB */ -+#define R_IA64_FPTR64I 0x43 /* @fptr(sym + add), mov imm64 */ -+#define R_IA64_FPTR32MSB 0x44 /* @fptr(sym + add), data4 MSB */ -+#define R_IA64_FPTR32LSB 0x45 /* @fptr(sym + add), data4 LSB */ -+#define R_IA64_FPTR64MSB 0x46 /* @fptr(sym + add), data8 MSB */ -+#define R_IA64_FPTR64LSB 0x47 /* @fptr(sym + add), data8 LSB */ -+#define R_IA64_PCREL60B 0x48 /* @pcrel(sym + add), brl */ -+#define R_IA64_PCREL21B 0x49 /* @pcrel(sym + add), ptb, call */ -+#define R_IA64_PCREL21M 0x4a /* @pcrel(sym + add), chk.s */ -+#define R_IA64_PCREL21F 0x4b /* @pcrel(sym + add), fchkf */ -+#define R_IA64_PCREL32MSB 0x4c /* @pcrel(sym + add), data4 MSB */ -+#define R_IA64_PCREL32LSB 0x4d /* @pcrel(sym + add), data4 LSB */ -+#define R_IA64_PCREL64MSB 0x4e /* @pcrel(sym + add), data8 MSB */ -+#define R_IA64_PCREL64LSB 0x4f /* @pcrel(sym + add), data8 LSB */ -+#define R_IA64_LTOFF_FPTR22 0x52 /* @ltoff(@fptr(s+a)), imm22 */ -+#define R_IA64_LTOFF_FPTR64I 0x53 /* @ltoff(@fptr(s+a)), imm64 */ -+#define R_IA64_LTOFF_FPTR32MSB 0x54 /* @ltoff(@fptr(s+a)), data4 MSB */ -+#define R_IA64_LTOFF_FPTR32LSB 0x55 /* @ltoff(@fptr(s+a)), data4 LSB */ -+#define R_IA64_LTOFF_FPTR64MSB 0x56 /* @ltoff(@fptr(s+a)), data8 MSB */ -+#define R_IA64_LTOFF_FPTR64LSB 0x57 /* @ltoff(@fptr(s+a)), data8 LSB */ -+#define R_IA64_SEGREL32MSB 0x5c /* @segrel(sym + add), data4 MSB */ -+#define R_IA64_SEGREL32LSB 0x5d /* @segrel(sym + add), data4 LSB */ -+#define R_IA64_SEGREL64MSB 0x5e /* @segrel(sym + add), data8 MSB */ -+#define R_IA64_SEGREL64LSB 0x5f /* @segrel(sym + add), data8 LSB */ -+#define R_IA64_SECREL32MSB 0x64 /* @secrel(sym + add), data4 MSB */ -+#define R_IA64_SECREL32LSB 0x65 /* @secrel(sym + add), data4 LSB */ -+#define R_IA64_SECREL64MSB 0x66 /* @secrel(sym + add), data8 MSB */ -+#define R_IA64_SECREL64LSB 0x67 /* @secrel(sym + add), data8 LSB */ -+#define R_IA64_REL32MSB 0x6c /* data 4 + REL */ -+#define R_IA64_REL32LSB 0x6d /* data 4 + REL */ -+#define R_IA64_REL64MSB 0x6e /* data 8 + REL */ -+#define R_IA64_REL64LSB 0x6f /* data 8 + REL */ -+#define R_IA64_LTV32MSB 0x74 /* symbol + addend, data4 MSB */ -+#define R_IA64_LTV32LSB 0x75 /* symbol + addend, data4 LSB */ -+#define R_IA64_LTV64MSB 0x76 /* symbol + addend, data8 MSB */ -+#define R_IA64_LTV64LSB 0x77 /* symbol + addend, data8 LSB */ -+#define R_IA64_PCREL21BI 0x79 /* @pcrel(sym + add), 21bit inst */ -+#define R_IA64_PCREL22 0x7a /* @pcrel(sym + add), 22bit inst */ -+#define R_IA64_PCREL64I 0x7b /* @pcrel(sym + add), 64bit inst */ -+#define R_IA64_IPLTMSB 0x80 /* dynamic reloc, imported PLT, MSB */ -+#define R_IA64_IPLTLSB 0x81 /* dynamic reloc, imported PLT, LSB */ -+#define R_IA64_COPY 0x84 /* copy relocation */ -+#define R_IA64_SUB 0x85 /* Addend and symbol difference */ -+#define R_IA64_LTOFF22X 0x86 /* LTOFF22, relaxable. */ -+#define R_IA64_LDXMOV 0x87 /* Use of LTOFF22X. */ -+#define R_IA64_TPREL14 0x91 /* @tprel(sym + add), imm14 */ -+#define R_IA64_TPREL22 0x92 /* @tprel(sym + add), imm22 */ -+#define R_IA64_TPREL64I 0x93 /* @tprel(sym + add), imm64 */ -+#define R_IA64_TPREL64MSB 0x96 /* @tprel(sym + add), data8 MSB */ -+#define R_IA64_TPREL64LSB 0x97 /* @tprel(sym + add), data8 LSB */ -+#define R_IA64_LTOFF_TPREL22 0x9a /* @ltoff(@tprel(s+a)), imm2 */ -+#define R_IA64_DTPMOD64MSB 0xa6 /* @dtpmod(sym + add), data8 MSB */ -+#define R_IA64_DTPMOD64LSB 0xa7 /* @dtpmod(sym + add), data8 LSB */ -+#define R_IA64_LTOFF_DTPMOD22 0xaa /* @ltoff(@dtpmod(sym + add)), imm22 */ -+#define R_IA64_DTPREL14 0xb1 /* @dtprel(sym + add), imm14 */ -+#define R_IA64_DTPREL22 0xb2 /* @dtprel(sym + add), imm22 */ -+#define R_IA64_DTPREL64I 0xb3 /* @dtprel(sym + add), imm64 */ -+#define R_IA64_DTPREL32MSB 0xb4 /* @dtprel(sym + add), data4 MSB */ -+#define R_IA64_DTPREL32LSB 0xb5 /* @dtprel(sym + add), data4 LSB */ -+#define R_IA64_DTPREL64MSB 0xb6 /* @dtprel(sym + add), data8 MSB */ -+#define R_IA64_DTPREL64LSB 0xb7 /* @dtprel(sym + add), data8 LSB */ -+#define R_IA64_LTOFF_DTPREL22 0xba /* @ltoff(@dtprel(s+a)), imm22 */ -+ -+/* SH specific declarations */ -+ -+/* Processor specific flags for the ELF header e_flags field. */ -+#define EF_SH_MACH_MASK 0x1f -+#define EF_SH_UNKNOWN 0x0 -+#define EF_SH1 0x1 -+#define EF_SH2 0x2 -+#define EF_SH3 0x3 -+#define EF_SH_DSP 0x4 -+#define EF_SH3_DSP 0x5 -+#define EF_SH4AL_DSP 0x6 -+#define EF_SH3E 0x8 -+#define EF_SH4 0x9 -+#define EF_SH2E 0xb -+#define EF_SH4A 0xc -+#define EF_SH2A 0xd -+#define EF_SH4_NOFPU 0x10 -+#define EF_SH4A_NOFPU 0x11 -+#define EF_SH4_NOMMU_NOFPU 0x12 -+#define EF_SH2A_NOFPU 0x13 -+#define EF_SH3_NOMMU 0x14 -+#define EF_SH2A_SH4_NOFPU 0x15 -+#define EF_SH2A_SH3_NOFPU 0x16 -+#define EF_SH2A_SH4 0x17 -+#define EF_SH2A_SH3E 0x18 -+ -+/* SH relocs. */ -+#define R_SH_NONE 0 -+#define R_SH_DIR32 1 -+#define R_SH_REL32 2 -+#define R_SH_DIR8WPN 3 -+#define R_SH_IND12W 4 -+#define R_SH_DIR8WPL 5 -+#define R_SH_DIR8WPZ 6 -+#define R_SH_DIR8BP 7 -+#define R_SH_DIR8W 8 -+#define R_SH_DIR8L 9 -+#define R_SH_SWITCH16 25 -+#define R_SH_SWITCH32 26 -+#define R_SH_USES 27 -+#define R_SH_COUNT 28 -+#define R_SH_ALIGN 29 -+#define R_SH_CODE 30 -+#define R_SH_DATA 31 -+#define R_SH_LABEL 32 -+#define R_SH_SWITCH8 33 -+#define R_SH_GNU_VTINHERIT 34 -+#define R_SH_GNU_VTENTRY 35 -+#define R_SH_TLS_GD_32 144 -+#define R_SH_TLS_LD_32 145 -+#define R_SH_TLS_LDO_32 146 -+#define R_SH_TLS_IE_32 147 -+#define R_SH_TLS_LE_32 148 -+#define R_SH_TLS_DTPMOD32 149 -+#define R_SH_TLS_DTPOFF32 150 -+#define R_SH_TLS_TPOFF32 151 -+#define R_SH_GOT32 160 -+#define R_SH_PLT32 161 -+#define R_SH_COPY 162 -+#define R_SH_GLOB_DAT 163 -+#define R_SH_JMP_SLOT 164 -+#define R_SH_RELATIVE 165 -+#define R_SH_GOTOFF 166 -+#define R_SH_GOTPC 167 -+/* Keep this the last entry. */ -+#define R_SH_NUM 256 -+ -+/* S/390 specific definitions. */ -+ -+/* Valid values for the e_flags field. */ -+ -+#define EF_S390_HIGH_GPRS 0x00000001 /* High GPRs kernel facility needed. */ -+ -+/* Additional s390 relocs */ -+ -+#define R_390_NONE 0 /* No reloc. */ -+#define R_390_8 1 /* Direct 8 bit. */ -+#define R_390_12 2 /* Direct 12 bit. */ -+#define R_390_16 3 /* Direct 16 bit. */ -+#define R_390_32 4 /* Direct 32 bit. */ -+#define R_390_PC32 5 /* PC relative 32 bit. */ -+#define R_390_GOT12 6 /* 12 bit GOT offset. */ -+#define R_390_GOT32 7 /* 32 bit GOT offset. */ -+#define R_390_PLT32 8 /* 32 bit PC relative PLT address. */ -+#define R_390_COPY 9 /* Copy symbol at runtime. */ -+#define R_390_GLOB_DAT 10 /* Create GOT entry. */ -+#define R_390_JMP_SLOT 11 /* Create PLT entry. */ -+#define R_390_RELATIVE 12 /* Adjust by program base. */ -+#define R_390_GOTOFF32 13 /* 32 bit offset to GOT. */ -+#define R_390_GOTPC 14 /* 32 bit PC relative offset to GOT. */ -+#define R_390_GOT16 15 /* 16 bit GOT offset. */ -+#define R_390_PC16 16 /* PC relative 16 bit. */ -+#define R_390_PC16DBL 17 /* PC relative 16 bit shifted by 1. */ -+#define R_390_PLT16DBL 18 /* 16 bit PC rel. PLT shifted by 1. */ -+#define R_390_PC32DBL 19 /* PC relative 32 bit shifted by 1. */ -+#define R_390_PLT32DBL 20 /* 32 bit PC rel. PLT shifted by 1. */ -+#define R_390_GOTPCDBL 21 /* 32 bit PC rel. GOT shifted by 1. */ -+#define R_390_64 22 /* Direct 64 bit. */ -+#define R_390_PC64 23 /* PC relative 64 bit. */ -+#define R_390_GOT64 24 /* 64 bit GOT offset. */ -+#define R_390_PLT64 25 /* 64 bit PC relative PLT address. */ -+#define R_390_GOTENT 26 /* 32 bit PC rel. to GOT entry >> 1. */ -+#define R_390_GOTOFF16 27 /* 16 bit offset to GOT. */ -+#define R_390_GOTOFF64 28 /* 64 bit offset to GOT. */ -+#define R_390_GOTPLT12 29 /* 12 bit offset to jump slot. */ -+#define R_390_GOTPLT16 30 /* 16 bit offset to jump slot. */ -+#define R_390_GOTPLT32 31 /* 32 bit offset to jump slot. */ -+#define R_390_GOTPLT64 32 /* 64 bit offset to jump slot. */ -+#define R_390_GOTPLTENT 33 /* 32 bit rel. offset to jump slot. */ -+#define R_390_PLTOFF16 34 /* 16 bit offset from GOT to PLT. */ -+#define R_390_PLTOFF32 35 /* 32 bit offset from GOT to PLT. */ -+#define R_390_PLTOFF64 36 /* 16 bit offset from GOT to PLT. */ -+#define R_390_TLS_LOAD 37 /* Tag for load insn in TLS code. */ -+#define R_390_TLS_GDCALL 38 /* Tag for function call in general -+ dynamic TLS code. */ -+#define R_390_TLS_LDCALL 39 /* Tag for function call in local -+ dynamic TLS code. */ -+#define R_390_TLS_GD32 40 /* Direct 32 bit for general dynamic -+ thread local data. */ -+#define R_390_TLS_GD64 41 /* Direct 64 bit for general dynamic -+ thread local data. */ -+#define R_390_TLS_GOTIE12 42 /* 12 bit GOT offset for static TLS -+ block offset. */ -+#define R_390_TLS_GOTIE32 43 /* 32 bit GOT offset for static TLS -+ block offset. */ -+#define R_390_TLS_GOTIE64 44 /* 64 bit GOT offset for static TLS -+ block offset. */ -+#define R_390_TLS_LDM32 45 /* Direct 32 bit for local dynamic -+ thread local data in LE code. */ -+#define R_390_TLS_LDM64 46 /* Direct 64 bit for local dynamic -+ thread local data in LE code. */ -+#define R_390_TLS_IE32 47 /* 32 bit address of GOT entry for -+ negated static TLS block offset. */ -+#define R_390_TLS_IE64 48 /* 64 bit address of GOT entry for -+ negated static TLS block offset. */ -+#define R_390_TLS_IEENT 49 /* 32 bit rel. offset to GOT entry for -+ negated static TLS block offset. */ -+#define R_390_TLS_LE32 50 /* 32 bit negated offset relative to -+ static TLS block. */ -+#define R_390_TLS_LE64 51 /* 64 bit negated offset relative to -+ static TLS block. */ -+#define R_390_TLS_LDO32 52 /* 32 bit offset relative to TLS -+ block. */ -+#define R_390_TLS_LDO64 53 /* 64 bit offset relative to TLS -+ block. */ -+#define R_390_TLS_DTPMOD 54 /* ID of module containing symbol. */ -+#define R_390_TLS_DTPOFF 55 /* Offset in TLS block. */ -+#define R_390_TLS_TPOFF 56 /* Negated offset in static TLS -+ block. */ -+#define R_390_20 57 /* Direct 20 bit. */ -+#define R_390_GOT20 58 /* 20 bit GOT offset. */ -+#define R_390_GOTPLT20 59 /* 20 bit offset to jump slot. */ -+#define R_390_TLS_GOTIE20 60 /* 20 bit GOT offset for static TLS -+ block offset. */ -+#define R_390_IRELATIVE 61 /* STT_GNU_IFUNC relocation. */ -+/* Keep this the last entry. */ -+#define R_390_NUM 62 -+ -+ -+/* CRIS relocations. */ -+#define R_CRIS_NONE 0 -+#define R_CRIS_8 1 -+#define R_CRIS_16 2 -+#define R_CRIS_32 3 -+#define R_CRIS_8_PCREL 4 -+#define R_CRIS_16_PCREL 5 -+#define R_CRIS_32_PCREL 6 -+#define R_CRIS_GNU_VTINHERIT 7 -+#define R_CRIS_GNU_VTENTRY 8 -+#define R_CRIS_COPY 9 -+#define R_CRIS_GLOB_DAT 10 -+#define R_CRIS_JUMP_SLOT 11 -+#define R_CRIS_RELATIVE 12 -+#define R_CRIS_16_GOT 13 -+#define R_CRIS_32_GOT 14 -+#define R_CRIS_16_GOTPLT 15 -+#define R_CRIS_32_GOTPLT 16 -+#define R_CRIS_32_GOTREL 17 -+#define R_CRIS_32_PLT_GOTREL 18 -+#define R_CRIS_32_PLT_PCREL 19 -+ -+#define R_CRIS_NUM 20 -+ -+ -+/* AMD x86-64 relocations. */ -+#define R_X86_64_NONE 0 /* No reloc */ -+#define R_X86_64_64 1 /* Direct 64 bit */ -+#define R_X86_64_PC32 2 /* PC relative 32 bit signed */ -+#define R_X86_64_GOT32 3 /* 32 bit GOT entry */ -+#define R_X86_64_PLT32 4 /* 32 bit PLT address */ -+#define R_X86_64_COPY 5 /* Copy symbol at runtime */ -+#define R_X86_64_GLOB_DAT 6 /* Create GOT entry */ -+#define R_X86_64_JUMP_SLOT 7 /* Create PLT entry */ -+#define R_X86_64_RELATIVE 8 /* Adjust by program base */ -+#define R_X86_64_GOTPCREL 9 /* 32 bit signed PC relative -+ offset to GOT */ -+#define R_X86_64_32 10 /* Direct 32 bit zero extended */ -+#define R_X86_64_32S 11 /* Direct 32 bit sign extended */ -+#define R_X86_64_16 12 /* Direct 16 bit zero extended */ -+#define R_X86_64_PC16 13 /* 16 bit sign extended pc relative */ -+#define R_X86_64_8 14 /* Direct 8 bit sign extended */ -+#define R_X86_64_PC8 15 /* 8 bit sign extended pc relative */ -+#define R_X86_64_DTPMOD64 16 /* ID of module containing symbol */ -+#define R_X86_64_DTPOFF64 17 /* Offset in module's TLS block */ -+#define R_X86_64_TPOFF64 18 /* Offset in initial TLS block */ -+#define R_X86_64_TLSGD 19 /* 32 bit signed PC relative offset -+ to two GOT entries for GD symbol */ -+#define R_X86_64_TLSLD 20 /* 32 bit signed PC relative offset -+ to two GOT entries for LD symbol */ -+#define R_X86_64_DTPOFF32 21 /* Offset in TLS block */ -+#define R_X86_64_GOTTPOFF 22 /* 32 bit signed PC relative offset -+ to GOT entry for IE symbol */ -+#define R_X86_64_TPOFF32 23 /* Offset in initial TLS block */ -+#define R_X86_64_PC64 24 /* PC relative 64 bit */ -+#define R_X86_64_GOTOFF64 25 /* 64 bit offset to GOT */ -+#define R_X86_64_GOTPC32 26 /* 32 bit signed pc relative -+ offset to GOT */ -+#define R_X86_64_GOT64 27 /* 64-bit GOT entry offset */ -+#define R_X86_64_GOTPCREL64 28 /* 64-bit PC relative offset -+ to GOT entry */ -+#define R_X86_64_GOTPC64 29 /* 64-bit PC relative offset to GOT */ -+#define R_X86_64_GOTPLT64 30 /* like GOT64, says PLT entry needed */ -+#define R_X86_64_PLTOFF64 31 /* 64-bit GOT relative offset -+ to PLT entry */ -+#define R_X86_64_SIZE32 32 /* Size of symbol plus 32-bit addend */ -+#define R_X86_64_SIZE64 33 /* Size of symbol plus 64-bit addend */ -+#define R_X86_64_GOTPC32_TLSDESC 34 /* GOT offset for TLS descriptor. */ -+#define R_X86_64_TLSDESC_CALL 35 /* Marker for call through TLS -+ descriptor. */ -+#define R_X86_64_TLSDESC 36 /* TLS descriptor. */ -+#define R_X86_64_IRELATIVE 37 /* Adjust indirectly by program base */ -+#define R_X86_64_RELATIVE64 38 /* 64-bit adjust by program base */ -+ -+#define R_X86_64_NUM 39 -+ -+ -+/* AM33 relocations. */ -+#define R_MN10300_NONE 0 /* No reloc. */ -+#define R_MN10300_32 1 /* Direct 32 bit. */ -+#define R_MN10300_16 2 /* Direct 16 bit. */ -+#define R_MN10300_8 3 /* Direct 8 bit. */ -+#define R_MN10300_PCREL32 4 /* PC-relative 32-bit. */ -+#define R_MN10300_PCREL16 5 /* PC-relative 16-bit signed. */ -+#define R_MN10300_PCREL8 6 /* PC-relative 8-bit signed. */ -+#define R_MN10300_GNU_VTINHERIT 7 /* Ancient C++ vtable garbage... */ -+#define R_MN10300_GNU_VTENTRY 8 /* ... collection annotation. */ -+#define R_MN10300_24 9 /* Direct 24 bit. */ -+#define R_MN10300_GOTPC32 10 /* 32-bit PCrel offset to GOT. */ -+#define R_MN10300_GOTPC16 11 /* 16-bit PCrel offset to GOT. */ -+#define R_MN10300_GOTOFF32 12 /* 32-bit offset from GOT. */ -+#define R_MN10300_GOTOFF24 13 /* 24-bit offset from GOT. */ -+#define R_MN10300_GOTOFF16 14 /* 16-bit offset from GOT. */ -+#define R_MN10300_PLT32 15 /* 32-bit PCrel to PLT entry. */ -+#define R_MN10300_PLT16 16 /* 16-bit PCrel to PLT entry. */ -+#define R_MN10300_GOT32 17 /* 32-bit offset to GOT entry. */ -+#define R_MN10300_GOT24 18 /* 24-bit offset to GOT entry. */ -+#define R_MN10300_GOT16 19 /* 16-bit offset to GOT entry. */ -+#define R_MN10300_COPY 20 /* Copy symbol at runtime. */ -+#define R_MN10300_GLOB_DAT 21 /* Create GOT entry. */ -+#define R_MN10300_JMP_SLOT 22 /* Create PLT entry. */ -+#define R_MN10300_RELATIVE 23 /* Adjust by program base. */ -+ -+#define R_MN10300_NUM 24 -+ -+ -+/* M32R relocs. */ -+#define R_M32R_NONE 0 /* No reloc. */ -+#define R_M32R_16 1 /* Direct 16 bit. */ -+#define R_M32R_32 2 /* Direct 32 bit. */ -+#define R_M32R_24 3 /* Direct 24 bit. */ -+#define R_M32R_10_PCREL 4 /* PC relative 10 bit shifted. */ -+#define R_M32R_18_PCREL 5 /* PC relative 18 bit shifted. */ -+#define R_M32R_26_PCREL 6 /* PC relative 26 bit shifted. */ -+#define R_M32R_HI16_ULO 7 /* High 16 bit with unsigned low. */ -+#define R_M32R_HI16_SLO 8 /* High 16 bit with signed low. */ -+#define R_M32R_LO16 9 /* Low 16 bit. */ -+#define R_M32R_SDA16 10 /* 16 bit offset in SDA. */ -+#define R_M32R_GNU_VTINHERIT 11 -+#define R_M32R_GNU_VTENTRY 12 -+/* M32R relocs use SHT_RELA. */ -+#define R_M32R_16_RELA 33 /* Direct 16 bit. */ -+#define R_M32R_32_RELA 34 /* Direct 32 bit. */ -+#define R_M32R_24_RELA 35 /* Direct 24 bit. */ -+#define R_M32R_10_PCREL_RELA 36 /* PC relative 10 bit shifted. */ -+#define R_M32R_18_PCREL_RELA 37 /* PC relative 18 bit shifted. */ -+#define R_M32R_26_PCREL_RELA 38 /* PC relative 26 bit shifted. */ -+#define R_M32R_HI16_ULO_RELA 39 /* High 16 bit with unsigned low */ -+#define R_M32R_HI16_SLO_RELA 40 /* High 16 bit with signed low */ -+#define R_M32R_LO16_RELA 41 /* Low 16 bit */ -+#define R_M32R_SDA16_RELA 42 /* 16 bit offset in SDA */ -+#define R_M32R_RELA_GNU_VTINHERIT 43 -+#define R_M32R_RELA_GNU_VTENTRY 44 -+#define R_M32R_REL32 45 /* PC relative 32 bit. */ -+ -+#define R_M32R_GOT24 48 /* 24 bit GOT entry */ -+#define R_M32R_26_PLTREL 49 /* 26 bit PC relative to PLT shifted */ -+#define R_M32R_COPY 50 /* Copy symbol at runtime */ -+#define R_M32R_GLOB_DAT 51 /* Create GOT entry */ -+#define R_M32R_JMP_SLOT 52 /* Create PLT entry */ -+#define R_M32R_RELATIVE 53 /* Adjust by program base */ -+#define R_M32R_GOTOFF 54 /* 24 bit offset to GOT */ -+#define R_M32R_GOTPC24 55 /* 24 bit PC relative offset to GOT */ -+#define R_M32R_GOT16_HI_ULO 56 /* High 16 bit GOT entry with unsigned -+ low */ -+#define R_M32R_GOT16_HI_SLO 57 /* High 16 bit GOT entry with signed -+ low */ -+#define R_M32R_GOT16_LO 58 /* Low 16 bit GOT entry */ -+#define R_M32R_GOTPC_HI_ULO 59 /* High 16 bit PC relative offset to -+ GOT with unsigned low */ -+#define R_M32R_GOTPC_HI_SLO 60 /* High 16 bit PC relative offset to -+ GOT with signed low */ -+#define R_M32R_GOTPC_LO 61 /* Low 16 bit PC relative offset to -+ GOT */ -+#define R_M32R_GOTOFF_HI_ULO 62 /* High 16 bit offset to GOT -+ with unsigned low */ -+#define R_M32R_GOTOFF_HI_SLO 63 /* High 16 bit offset to GOT -+ with signed low */ -+#define R_M32R_GOTOFF_LO 64 /* Low 16 bit offset to GOT */ -+#define R_M32R_NUM 256 /* Keep this the last entry. */ -+ -+ -+/* TILEPro relocations. */ -+#define R_TILEPRO_NONE 0 /* No reloc */ -+#define R_TILEPRO_32 1 /* Direct 32 bit */ -+#define R_TILEPRO_16 2 /* Direct 16 bit */ -+#define R_TILEPRO_8 3 /* Direct 8 bit */ -+#define R_TILEPRO_32_PCREL 4 /* PC relative 32 bit */ -+#define R_TILEPRO_16_PCREL 5 /* PC relative 16 bit */ -+#define R_TILEPRO_8_PCREL 6 /* PC relative 8 bit */ -+#define R_TILEPRO_LO16 7 /* Low 16 bit */ -+#define R_TILEPRO_HI16 8 /* High 16 bit */ -+#define R_TILEPRO_HA16 9 /* High 16 bit, adjusted */ -+#define R_TILEPRO_COPY 10 /* Copy relocation */ -+#define R_TILEPRO_GLOB_DAT 11 /* Create GOT entry */ -+#define R_TILEPRO_JMP_SLOT 12 /* Create PLT entry */ -+#define R_TILEPRO_RELATIVE 13 /* Adjust by program base */ -+#define R_TILEPRO_BROFF_X1 14 /* X1 pipe branch offset */ -+#define R_TILEPRO_JOFFLONG_X1 15 /* X1 pipe jump offset */ -+#define R_TILEPRO_JOFFLONG_X1_PLT 16 /* X1 pipe jump offset to PLT */ -+#define R_TILEPRO_IMM8_X0 17 /* X0 pipe 8-bit */ -+#define R_TILEPRO_IMM8_Y0 18 /* Y0 pipe 8-bit */ -+#define R_TILEPRO_IMM8_X1 19 /* X1 pipe 8-bit */ -+#define R_TILEPRO_IMM8_Y1 20 /* Y1 pipe 8-bit */ -+#define R_TILEPRO_MT_IMM15_X1 21 /* X1 pipe mtspr */ -+#define R_TILEPRO_MF_IMM15_X1 22 /* X1 pipe mfspr */ -+#define R_TILEPRO_IMM16_X0 23 /* X0 pipe 16-bit */ -+#define R_TILEPRO_IMM16_X1 24 /* X1 pipe 16-bit */ -+#define R_TILEPRO_IMM16_X0_LO 25 /* X0 pipe low 16-bit */ -+#define R_TILEPRO_IMM16_X1_LO 26 /* X1 pipe low 16-bit */ -+#define R_TILEPRO_IMM16_X0_HI 27 /* X0 pipe high 16-bit */ -+#define R_TILEPRO_IMM16_X1_HI 28 /* X1 pipe high 16-bit */ -+#define R_TILEPRO_IMM16_X0_HA 29 /* X0 pipe high 16-bit, adjusted */ -+#define R_TILEPRO_IMM16_X1_HA 30 /* X1 pipe high 16-bit, adjusted */ -+#define R_TILEPRO_IMM16_X0_PCREL 31 /* X0 pipe PC relative 16 bit */ -+#define R_TILEPRO_IMM16_X1_PCREL 32 /* X1 pipe PC relative 16 bit */ -+#define R_TILEPRO_IMM16_X0_LO_PCREL 33 /* X0 pipe PC relative low 16 bit */ -+#define R_TILEPRO_IMM16_X1_LO_PCREL 34 /* X1 pipe PC relative low 16 bit */ -+#define R_TILEPRO_IMM16_X0_HI_PCREL 35 /* X0 pipe PC relative high 16 bit */ -+#define R_TILEPRO_IMM16_X1_HI_PCREL 36 /* X1 pipe PC relative high 16 bit */ -+#define R_TILEPRO_IMM16_X0_HA_PCREL 37 /* X0 pipe PC relative ha() 16 bit */ -+#define R_TILEPRO_IMM16_X1_HA_PCREL 38 /* X1 pipe PC relative ha() 16 bit */ -+#define R_TILEPRO_IMM16_X0_GOT 39 /* X0 pipe 16-bit GOT offset */ -+#define R_TILEPRO_IMM16_X1_GOT 40 /* X1 pipe 16-bit GOT offset */ -+#define R_TILEPRO_IMM16_X0_GOT_LO 41 /* X0 pipe low 16-bit GOT offset */ -+#define R_TILEPRO_IMM16_X1_GOT_LO 42 /* X1 pipe low 16-bit GOT offset */ -+#define R_TILEPRO_IMM16_X0_GOT_HI 43 /* X0 pipe high 16-bit GOT offset */ -+#define R_TILEPRO_IMM16_X1_GOT_HI 44 /* X1 pipe high 16-bit GOT offset */ -+#define R_TILEPRO_IMM16_X0_GOT_HA 45 /* X0 pipe ha() 16-bit GOT offset */ -+#define R_TILEPRO_IMM16_X1_GOT_HA 46 /* X1 pipe ha() 16-bit GOT offset */ -+#define R_TILEPRO_MMSTART_X0 47 /* X0 pipe mm "start" */ -+#define R_TILEPRO_MMEND_X0 48 /* X0 pipe mm "end" */ -+#define R_TILEPRO_MMSTART_X1 49 /* X1 pipe mm "start" */ -+#define R_TILEPRO_MMEND_X1 50 /* X1 pipe mm "end" */ -+#define R_TILEPRO_SHAMT_X0 51 /* X0 pipe shift amount */ -+#define R_TILEPRO_SHAMT_X1 52 /* X1 pipe shift amount */ -+#define R_TILEPRO_SHAMT_Y0 53 /* Y0 pipe shift amount */ -+#define R_TILEPRO_SHAMT_Y1 54 /* Y1 pipe shift amount */ -+#define R_TILEPRO_DEST_IMM8_X1 55 /* X1 pipe destination 8-bit */ -+/* Relocs 56-59 are currently not defined. */ -+#define R_TILEPRO_TLS_GD_CALL 60 /* "jal" for TLS GD */ -+#define R_TILEPRO_IMM8_X0_TLS_GD_ADD 61 /* X0 pipe "addi" for TLS GD */ -+#define R_TILEPRO_IMM8_X1_TLS_GD_ADD 62 /* X1 pipe "addi" for TLS GD */ -+#define R_TILEPRO_IMM8_Y0_TLS_GD_ADD 63 /* Y0 pipe "addi" for TLS GD */ -+#define R_TILEPRO_IMM8_Y1_TLS_GD_ADD 64 /* Y1 pipe "addi" for TLS GD */ -+#define R_TILEPRO_TLS_IE_LOAD 65 /* "lw_tls" for TLS IE */ -+#define R_TILEPRO_IMM16_X0_TLS_GD 66 /* X0 pipe 16-bit TLS GD offset */ -+#define R_TILEPRO_IMM16_X1_TLS_GD 67 /* X1 pipe 16-bit TLS GD offset */ -+#define R_TILEPRO_IMM16_X0_TLS_GD_LO 68 /* X0 pipe low 16-bit TLS GD offset */ -+#define R_TILEPRO_IMM16_X1_TLS_GD_LO 69 /* X1 pipe low 16-bit TLS GD offset */ -+#define R_TILEPRO_IMM16_X0_TLS_GD_HI 70 /* X0 pipe high 16-bit TLS GD offset */ -+#define R_TILEPRO_IMM16_X1_TLS_GD_HI 71 /* X1 pipe high 16-bit TLS GD offset */ -+#define R_TILEPRO_IMM16_X0_TLS_GD_HA 72 /* X0 pipe ha() 16-bit TLS GD offset */ -+#define R_TILEPRO_IMM16_X1_TLS_GD_HA 73 /* X1 pipe ha() 16-bit TLS GD offset */ -+#define R_TILEPRO_IMM16_X0_TLS_IE 74 /* X0 pipe 16-bit TLS IE offset */ -+#define R_TILEPRO_IMM16_X1_TLS_IE 75 /* X1 pipe 16-bit TLS IE offset */ -+#define R_TILEPRO_IMM16_X0_TLS_IE_LO 76 /* X0 pipe low 16-bit TLS IE offset */ -+#define R_TILEPRO_IMM16_X1_TLS_IE_LO 77 /* X1 pipe low 16-bit TLS IE offset */ -+#define R_TILEPRO_IMM16_X0_TLS_IE_HI 78 /* X0 pipe high 16-bit TLS IE offset */ -+#define R_TILEPRO_IMM16_X1_TLS_IE_HI 79 /* X1 pipe high 16-bit TLS IE offset */ -+#define R_TILEPRO_IMM16_X0_TLS_IE_HA 80 /* X0 pipe ha() 16-bit TLS IE offset */ -+#define R_TILEPRO_IMM16_X1_TLS_IE_HA 81 /* X1 pipe ha() 16-bit TLS IE offset */ -+#define R_TILEPRO_TLS_DTPMOD32 82 /* ID of module containing symbol */ -+#define R_TILEPRO_TLS_DTPOFF32 83 /* Offset in TLS block */ -+#define R_TILEPRO_TLS_TPOFF32 84 /* Offset in static TLS block */ -+#define R_TILEPRO_IMM16_X0_TLS_LE 85 /* X0 pipe 16-bit TLS LE offset */ -+#define R_TILEPRO_IMM16_X1_TLS_LE 86 /* X1 pipe 16-bit TLS LE offset */ -+#define R_TILEPRO_IMM16_X0_TLS_LE_LO 87 /* X0 pipe low 16-bit TLS LE offset */ -+#define R_TILEPRO_IMM16_X1_TLS_LE_LO 88 /* X1 pipe low 16-bit TLS LE offset */ -+#define R_TILEPRO_IMM16_X0_TLS_LE_HI 89 /* X0 pipe high 16-bit TLS LE offset */ -+#define R_TILEPRO_IMM16_X1_TLS_LE_HI 90 /* X1 pipe high 16-bit TLS LE offset */ -+#define R_TILEPRO_IMM16_X0_TLS_LE_HA 91 /* X0 pipe ha() 16-bit TLS LE offset */ -+#define R_TILEPRO_IMM16_X1_TLS_LE_HA 92 /* X1 pipe ha() 16-bit TLS LE offset */ -+ -+#define R_TILEPRO_GNU_VTINHERIT 128 /* GNU C++ vtable hierarchy */ -+#define R_TILEPRO_GNU_VTENTRY 129 /* GNU C++ vtable member usage */ -+ -+#define R_TILEPRO_NUM 130 -+ -+ -+/* TILE-Gx relocations. */ -+#define R_TILEGX_NONE 0 /* No reloc */ -+#define R_TILEGX_64 1 /* Direct 64 bit */ -+#define R_TILEGX_32 2 /* Direct 32 bit */ -+#define R_TILEGX_16 3 /* Direct 16 bit */ -+#define R_TILEGX_8 4 /* Direct 8 bit */ -+#define R_TILEGX_64_PCREL 5 /* PC relative 64 bit */ -+#define R_TILEGX_32_PCREL 6 /* PC relative 32 bit */ -+#define R_TILEGX_16_PCREL 7 /* PC relative 16 bit */ -+#define R_TILEGX_8_PCREL 8 /* PC relative 8 bit */ -+#define R_TILEGX_HW0 9 /* hword 0 16-bit */ -+#define R_TILEGX_HW1 10 /* hword 1 16-bit */ -+#define R_TILEGX_HW2 11 /* hword 2 16-bit */ -+#define R_TILEGX_HW3 12 /* hword 3 16-bit */ -+#define R_TILEGX_HW0_LAST 13 /* last hword 0 16-bit */ -+#define R_TILEGX_HW1_LAST 14 /* last hword 1 16-bit */ -+#define R_TILEGX_HW2_LAST 15 /* last hword 2 16-bit */ -+#define R_TILEGX_COPY 16 /* Copy relocation */ -+#define R_TILEGX_GLOB_DAT 17 /* Create GOT entry */ -+#define R_TILEGX_JMP_SLOT 18 /* Create PLT entry */ -+#define R_TILEGX_RELATIVE 19 /* Adjust by program base */ -+#define R_TILEGX_BROFF_X1 20 /* X1 pipe branch offset */ -+#define R_TILEGX_JUMPOFF_X1 21 /* X1 pipe jump offset */ -+#define R_TILEGX_JUMPOFF_X1_PLT 22 /* X1 pipe jump offset to PLT */ -+#define R_TILEGX_IMM8_X0 23 /* X0 pipe 8-bit */ -+#define R_TILEGX_IMM8_Y0 24 /* Y0 pipe 8-bit */ -+#define R_TILEGX_IMM8_X1 25 /* X1 pipe 8-bit */ -+#define R_TILEGX_IMM8_Y1 26 /* Y1 pipe 8-bit */ -+#define R_TILEGX_DEST_IMM8_X1 27 /* X1 pipe destination 8-bit */ -+#define R_TILEGX_MT_IMM14_X1 28 /* X1 pipe mtspr */ -+#define R_TILEGX_MF_IMM14_X1 29 /* X1 pipe mfspr */ -+#define R_TILEGX_MMSTART_X0 30 /* X0 pipe mm "start" */ -+#define R_TILEGX_MMEND_X0 31 /* X0 pipe mm "end" */ -+#define R_TILEGX_SHAMT_X0 32 /* X0 pipe shift amount */ -+#define R_TILEGX_SHAMT_X1 33 /* X1 pipe shift amount */ -+#define R_TILEGX_SHAMT_Y0 34 /* Y0 pipe shift amount */ -+#define R_TILEGX_SHAMT_Y1 35 /* Y1 pipe shift amount */ -+#define R_TILEGX_IMM16_X0_HW0 36 /* X0 pipe hword 0 */ -+#define R_TILEGX_IMM16_X1_HW0 37 /* X1 pipe hword 0 */ -+#define R_TILEGX_IMM16_X0_HW1 38 /* X0 pipe hword 1 */ -+#define R_TILEGX_IMM16_X1_HW1 39 /* X1 pipe hword 1 */ -+#define R_TILEGX_IMM16_X0_HW2 40 /* X0 pipe hword 2 */ -+#define R_TILEGX_IMM16_X1_HW2 41 /* X1 pipe hword 2 */ -+#define R_TILEGX_IMM16_X0_HW3 42 /* X0 pipe hword 3 */ -+#define R_TILEGX_IMM16_X1_HW3 43 /* X1 pipe hword 3 */ -+#define R_TILEGX_IMM16_X0_HW0_LAST 44 /* X0 pipe last hword 0 */ -+#define R_TILEGX_IMM16_X1_HW0_LAST 45 /* X1 pipe last hword 0 */ -+#define R_TILEGX_IMM16_X0_HW1_LAST 46 /* X0 pipe last hword 1 */ -+#define R_TILEGX_IMM16_X1_HW1_LAST 47 /* X1 pipe last hword 1 */ -+#define R_TILEGX_IMM16_X0_HW2_LAST 48 /* X0 pipe last hword 2 */ -+#define R_TILEGX_IMM16_X1_HW2_LAST 49 /* X1 pipe last hword 2 */ -+#define R_TILEGX_IMM16_X0_HW0_PCREL 50 /* X0 pipe PC relative hword 0 */ -+#define R_TILEGX_IMM16_X1_HW0_PCREL 51 /* X1 pipe PC relative hword 0 */ -+#define R_TILEGX_IMM16_X0_HW1_PCREL 52 /* X0 pipe PC relative hword 1 */ -+#define R_TILEGX_IMM16_X1_HW1_PCREL 53 /* X1 pipe PC relative hword 1 */ -+#define R_TILEGX_IMM16_X0_HW2_PCREL 54 /* X0 pipe PC relative hword 2 */ -+#define R_TILEGX_IMM16_X1_HW2_PCREL 55 /* X1 pipe PC relative hword 2 */ -+#define R_TILEGX_IMM16_X0_HW3_PCREL 56 /* X0 pipe PC relative hword 3 */ -+#define R_TILEGX_IMM16_X1_HW3_PCREL 57 /* X1 pipe PC relative hword 3 */ -+#define R_TILEGX_IMM16_X0_HW0_LAST_PCREL 58 /* X0 pipe PC-rel last hword 0 */ -+#define R_TILEGX_IMM16_X1_HW0_LAST_PCREL 59 /* X1 pipe PC-rel last hword 0 */ -+#define R_TILEGX_IMM16_X0_HW1_LAST_PCREL 60 /* X0 pipe PC-rel last hword 1 */ -+#define R_TILEGX_IMM16_X1_HW1_LAST_PCREL 61 /* X1 pipe PC-rel last hword 1 */ -+#define R_TILEGX_IMM16_X0_HW2_LAST_PCREL 62 /* X0 pipe PC-rel last hword 2 */ -+#define R_TILEGX_IMM16_X1_HW2_LAST_PCREL 63 /* X1 pipe PC-rel last hword 2 */ -+#define R_TILEGX_IMM16_X0_HW0_GOT 64 /* X0 pipe hword 0 GOT offset */ -+#define R_TILEGX_IMM16_X1_HW0_GOT 65 /* X1 pipe hword 0 GOT offset */ -+/* Relocs 66-71 are currently not defined. */ -+#define R_TILEGX_IMM16_X0_HW0_LAST_GOT 72 /* X0 pipe last hword 0 GOT offset */ -+#define R_TILEGX_IMM16_X1_HW0_LAST_GOT 73 /* X1 pipe last hword 0 GOT offset */ -+#define R_TILEGX_IMM16_X0_HW1_LAST_GOT 74 /* X0 pipe last hword 1 GOT offset */ -+#define R_TILEGX_IMM16_X1_HW1_LAST_GOT 75 /* X1 pipe last hword 1 GOT offset */ -+/* Relocs 76-77 are currently not defined. */ -+#define R_TILEGX_IMM16_X0_HW0_TLS_GD 78 /* X0 pipe hword 0 TLS GD offset */ -+#define R_TILEGX_IMM16_X1_HW0_TLS_GD 79 /* X1 pipe hword 0 TLS GD offset */ -+#define R_TILEGX_IMM16_X0_HW0_TLS_LE 80 /* X0 pipe hword 0 TLS LE offset */ -+#define R_TILEGX_IMM16_X1_HW0_TLS_LE 81 /* X1 pipe hword 0 TLS LE offset */ -+#define R_TILEGX_IMM16_X0_HW0_LAST_TLS_LE 82 /* X0 pipe last hword 0 LE off */ -+#define R_TILEGX_IMM16_X1_HW0_LAST_TLS_LE 83 /* X1 pipe last hword 0 LE off */ -+#define R_TILEGX_IMM16_X0_HW1_LAST_TLS_LE 84 /* X0 pipe last hword 1 LE off */ -+#define R_TILEGX_IMM16_X1_HW1_LAST_TLS_LE 85 /* X1 pipe last hword 1 LE off */ -+#define R_TILEGX_IMM16_X0_HW0_LAST_TLS_GD 86 /* X0 pipe last hword 0 GD off */ -+#define R_TILEGX_IMM16_X1_HW0_LAST_TLS_GD 87 /* X1 pipe last hword 0 GD off */ -+#define R_TILEGX_IMM16_X0_HW1_LAST_TLS_GD 88 /* X0 pipe last hword 1 GD off */ -+#define R_TILEGX_IMM16_X1_HW1_LAST_TLS_GD 89 /* X1 pipe last hword 1 GD off */ -+/* Relocs 90-91 are currently not defined. */ -+#define R_TILEGX_IMM16_X0_HW0_TLS_IE 92 /* X0 pipe hword 0 TLS IE offset */ -+#define R_TILEGX_IMM16_X1_HW0_TLS_IE 93 /* X1 pipe hword 0 TLS IE offset */ -+/* Relocs 94-99 are currently not defined. */ -+#define R_TILEGX_IMM16_X0_HW0_LAST_TLS_IE 100 /* X0 pipe last hword 0 IE off */ -+#define R_TILEGX_IMM16_X1_HW0_LAST_TLS_IE 101 /* X1 pipe last hword 0 IE off */ -+#define R_TILEGX_IMM16_X0_HW1_LAST_TLS_IE 102 /* X0 pipe last hword 1 IE off */ -+#define R_TILEGX_IMM16_X1_HW1_LAST_TLS_IE 103 /* X1 pipe last hword 1 IE off */ -+/* Relocs 104-105 are currently not defined. */ -+#define R_TILEGX_TLS_DTPMOD64 106 /* 64-bit ID of symbol's module */ -+#define R_TILEGX_TLS_DTPOFF64 107 /* 64-bit offset in TLS block */ -+#define R_TILEGX_TLS_TPOFF64 108 /* 64-bit offset in static TLS block */ -+#define R_TILEGX_TLS_DTPMOD32 109 /* 32-bit ID of symbol's module */ -+#define R_TILEGX_TLS_DTPOFF32 110 /* 32-bit offset in TLS block */ -+#define R_TILEGX_TLS_TPOFF32 111 /* 32-bit offset in static TLS block */ -+#define R_TILEGX_TLS_GD_CALL 112 /* "jal" for TLS GD */ -+#define R_TILEGX_IMM8_X0_TLS_GD_ADD 113 /* X0 pipe "addi" for TLS GD */ -+#define R_TILEGX_IMM8_X1_TLS_GD_ADD 114 /* X1 pipe "addi" for TLS GD */ -+#define R_TILEGX_IMM8_Y0_TLS_GD_ADD 115 /* Y0 pipe "addi" for TLS GD */ -+#define R_TILEGX_IMM8_Y1_TLS_GD_ADD 116 /* Y1 pipe "addi" for TLS GD */ -+#define R_TILEGX_TLS_IE_LOAD 117 /* "ld_tls" for TLS IE */ -+#define R_TILEGX_IMM8_X0_TLS_ADD 118 /* X0 pipe "addi" for TLS GD/IE */ -+#define R_TILEGX_IMM8_X1_TLS_ADD 119 /* X1 pipe "addi" for TLS GD/IE */ -+#define R_TILEGX_IMM8_Y0_TLS_ADD 120 /* Y0 pipe "addi" for TLS GD/IE */ -+#define R_TILEGX_IMM8_Y1_TLS_ADD 121 /* Y1 pipe "addi" for TLS GD/IE */ -+ -+#define R_TILEGX_GNU_VTINHERIT 128 /* GNU C++ vtable hierarchy */ -+#define R_TILEGX_GNU_VTENTRY 129 /* GNU C++ vtable member usage */ -+ -+#define R_TILEGX_NUM 130 -+ -+#endif /* elf.h */ ---- a/scripts/mod/mk_elfconfig.c -+++ b/scripts/mod/mk_elfconfig.c -@@ -2,7 +2,11 @@ - #include - #include - #include -+#ifndef __APPLE__ - #include -+#else -+#include "elf.h" -+#endif - - int - main(int argc, char **argv) ---- a/scripts/mod/modpost.h -+++ b/scripts/mod/modpost.h -@@ -8,7 +8,11 @@ - #include - #include - #include -+#if !(defined(__APPLE__) || defined(__CYGWIN__)) - #include -+#else -+#include "elf.h" -+#endif - - #include "elfconfig.h" - diff --git a/target/linux/generic/hack-4.19/211-host_tools_portability.patch b/target/linux/generic/hack-4.19/211-host_tools_portability.patch deleted file mode 100644 index f3c285879c..0000000000 --- a/target/linux/generic/hack-4.19/211-host_tools_portability.patch +++ /dev/null @@ -1,40 +0,0 @@ -From 7f698012384ccb1ed10cc758acfd085096fdb307 Mon Sep 17 00:00:00 2001 -From: Felix Fietkau -Date: Fri, 7 Jul 2017 17:02:03 +0200 -Subject: kernel: fix linux 4.9 host tools portability issues - -Signed-off-by: Felix Fietkau ---- - tools/build/Build.include | 2 +- - tools/perf/pmu-events/jevents.c | 1 + - tools/perf/pmu-events/json.c | 1 - - 3 files changed, 2 insertions(+), 2 deletions(-) - ---- a/tools/build/Build.include -+++ b/tools/build/Build.include -@@ -98,4 +98,4 @@ cxx_flags = -Wp,-MD,$(depfile) -Wp,-MT,$ - ### - ## HOSTCC C flags - --host_c_flags = -Wp,-MD,$(depfile) -Wp,-MT,$@ $(KBUILD_HOSTCFLAGS) -D"BUILD_STR(s)=\#s" $(HOSTCFLAGS_$(basetarget).o) $(HOSTCFLAGS_$(obj)) -+host_c_flags = -MD -MF $(depfile) -MT $@ $(CHOSTFLAGS) -D"BUILD_STR(s)=\#s" $(CHOSTFLAGS_$(basetarget).o) $(CHOSTFLAGS_$(obj)) ---- a/tools/perf/pmu-events/jevents.c -+++ b/tools/perf/pmu-events/jevents.c -@@ -35,6 +35,7 @@ - #include - #include - #include -+#include - #include - #include - #include ---- a/tools/perf/pmu-events/json.c -+++ b/tools/perf/pmu-events/json.c -@@ -38,7 +38,6 @@ - #include - #include "jsmn.h" - #include "json.h" --#include - - - static char *mapfile(const char *fn, size_t *size) diff --git a/target/linux/generic/hack-4.19/212-byteshift_portability.patch b/target/linux/generic/hack-4.19/212-byteshift_portability.patch deleted file mode 100644 index 1a5ac87988..0000000000 --- a/target/linux/generic/hack-4.19/212-byteshift_portability.patch +++ /dev/null @@ -1,65 +0,0 @@ -From 48232d3d931c95953ce2ddfe7da7bb164aef6a73 Mon Sep 17 00:00:00 2001 -From: Felix Fietkau -Date: Fri, 7 Jul 2017 17:03:16 +0200 -Subject: linux-3.6: fix portability of some includes files in tools/ used on the host - -lede-commit: 6040b1d29ab1f047c5e49b748abcb6a3196add28 -Signed-off-by: Felix Fietkau ---- - tools/include/tools/be_byteshift.h | 4 ++++ - tools/include/tools/le_byteshift.h | 4 ++++ - tools/include/tools/linux_types.h | 22 ++++++++++++++++++++++ - 3 files changed, 30 insertions(+) - create mode 100644 tools/include/tools/linux_types.h - ---- a/tools/include/tools/be_byteshift.h -+++ b/tools/include/tools/be_byteshift.h -@@ -2,6 +2,10 @@ - #ifndef _TOOLS_BE_BYTESHIFT_H - #define _TOOLS_BE_BYTESHIFT_H - -+#ifndef __linux__ -+#include "linux_types.h" -+#endif -+ - #include - - static inline uint16_t __get_unaligned_be16(const uint8_t *p) ---- a/tools/include/tools/le_byteshift.h -+++ b/tools/include/tools/le_byteshift.h -@@ -2,6 +2,10 @@ - #ifndef _TOOLS_LE_BYTESHIFT_H - #define _TOOLS_LE_BYTESHIFT_H - -+#ifndef __linux__ -+#include "linux_types.h" -+#endif -+ - #include - - static inline uint16_t __get_unaligned_le16(const uint8_t *p) ---- /dev/null -+++ b/tools/include/tools/linux_types.h -@@ -0,0 +1,22 @@ -+#ifndef __LINUX_TYPES_H -+#define __LINUX_TYPES_H -+ -+#include -+ -+typedef uint8_t __u8; -+typedef uint8_t __be8; -+typedef uint8_t __le8; -+ -+typedef uint16_t __u16; -+typedef uint16_t __be16; -+typedef uint16_t __le16; -+ -+typedef uint32_t __u32; -+typedef uint32_t __be32; -+typedef uint32_t __le32; -+ -+typedef uint64_t __u64; -+typedef uint64_t __be64; -+typedef uint64_t __le64; -+ -+#endif diff --git a/target/linux/generic/hack-4.19/214-spidev_h_portability.patch b/target/linux/generic/hack-4.19/214-spidev_h_portability.patch deleted file mode 100644 index 093f600c85..0000000000 --- a/target/linux/generic/hack-4.19/214-spidev_h_portability.patch +++ /dev/null @@ -1,24 +0,0 @@ -From be9be95ff10e16a5b4ad36f903978d0cc5747024 Mon Sep 17 00:00:00 2001 -From: Felix Fietkau -Date: Fri, 7 Jul 2017 17:04:08 +0200 -Subject: kernel: fix linux/spi/spidev.h portability issues with musl - -Felix will try to get this define included into musl - -lede-commit: 795e7cf60de19e7a076a46874fab7bb88b43bbff -Signed-off-by: Felix Fietkau ---- - include/uapi/linux/spi/spidev.h | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - ---- a/include/uapi/linux/spi/spidev.h -+++ b/include/uapi/linux/spi/spidev.h -@@ -113,7 +113,7 @@ struct spi_ioc_transfer { - - /* not all platforms use or _IOC_TYPECHECK() ... */ - #define SPI_MSGSIZE(N) \ -- ((((N)*(sizeof (struct spi_ioc_transfer))) < (1 << _IOC_SIZEBITS)) \ -+ ((((N)*(sizeof (struct spi_ioc_transfer))) < (1 << 13)) \ - ? ((N)*(sizeof (struct spi_ioc_transfer))) : 0) - #define SPI_IOC_MESSAGE(N) _IOW(SPI_IOC_MAGIC, 0, char[SPI_MSGSIZE(N)]) - diff --git a/target/linux/generic/hack-4.19/220-gc_sections.patch b/target/linux/generic/hack-4.19/220-gc_sections.patch deleted file mode 100644 index 17fcc5cbd2..0000000000 --- a/target/linux/generic/hack-4.19/220-gc_sections.patch +++ /dev/null @@ -1,192 +0,0 @@ -From e3d8676f5722b7622685581e06e8f53e6138e3ab Mon Sep 17 00:00:00 2001 -From: Felix Fietkau -Date: Sat, 15 Jul 2017 23:42:36 +0200 -Subject: use -ffunction-sections, -fdata-sections and --gc-sections - -In combination with kernel symbol export stripping this significantly reduces -the kernel image size. Used on both ARM and MIPS architectures. - -Signed-off-by: Felix Fietkau -Signed-off-by: Jonas Gorski -Signed-off-by: Gabor Juhos ---- - Makefile | 10 +++---- - arch/arm/Kconfig | 1 + - arch/arm/boot/compressed/Makefile | 1 + - arch/arm/kernel/vmlinux.lds.S | 26 ++++++++-------- - arch/mips/Kconfig | 1 + - arch/mips/kernel/vmlinux.lds.S | 4 +-- - include/asm-generic/vmlinux.lds.h | 63 ++++++++++++++++++++------------------- - 7 files changed, 55 insertions(+), 51 deletions(-) - ---- a/Makefile -+++ b/Makefile -@@ -294,6 +294,11 @@ else - scripts/Kbuild.include: ; - include scripts/Kbuild.include - -+ifdef CONFIG_LD_DEAD_CODE_DATA_ELIMINATION -+KBUILD_CFLAGS_KERNEL += -ffunction-sections -fdata-sections -+LDFLAGS_vmlinux += --gc-sections -+endif -+ - # Read KERNELRELEASE from include/config/kernel.release (if it exists) - KERNELRELEASE = $(shell cat include/config/kernel.release 2> /dev/null) - KERNELVERSION = $(VERSION)$(if $(PATCHLEVEL),.$(PATCHLEVEL)$(if $(SUBLEVEL),.$(SUBLEVEL)))$(EXTRAVERSION) -@@ -785,11 +790,6 @@ ifdef CONFIG_DEBUG_SECTION_MISMATCH - KBUILD_CFLAGS += $(call cc-option, -fno-inline-functions-called-once) - endif - --ifdef CONFIG_LD_DEAD_CODE_DATA_ELIMINATION --KBUILD_CFLAGS_KERNEL += -ffunction-sections -fdata-sections --LDFLAGS_vmlinux += --gc-sections --endif -- - # arch Makefile may override CC so keep this after arch Makefile is included - NOSTDINC_FLAGS += -nostdinc -isystem $(shell $(CC) -print-file-name=include) - ---- a/arch/arm/Kconfig -+++ b/arch/arm/Kconfig -@@ -98,6 +98,7 @@ config ARM - select HAVE_UID16 - select HAVE_VIRT_CPU_ACCOUNTING_GEN - select IRQ_FORCED_THREADING -+ select HAVE_LD_DEAD_CODE_DATA_ELIMINATION - select MODULES_USE_ELF_REL - select NEED_DMA_MAP_STATE - select NO_BOOTMEM ---- a/arch/arm/boot/compressed/Makefile -+++ b/arch/arm/boot/compressed/Makefile -@@ -106,6 +106,7 @@ ifeq ($(CONFIG_FUNCTION_TRACER),y) - ORIG_CFLAGS := $(KBUILD_CFLAGS) - KBUILD_CFLAGS = $(subst -pg, , $(ORIG_CFLAGS)) - endif -+KBUILD_CFLAGS_KERNEL := $(patsubst -f%-sections,,$(KBUILD_CFLAGS_KERNEL)) - - # -fstack-protector-strong triggers protection checks in this code, - # but it is being used too early to link to meaningful stack_chk logic. ---- a/arch/arm/kernel/vmlinux.lds.S -+++ b/arch/arm/kernel/vmlinux.lds.S -@@ -100,24 +100,24 @@ SECTIONS - } - .init.arch.info : { - __arch_info_begin = .; -- *(.arch.info.init) -+ KEEP(*(.arch.info.init)) - __arch_info_end = .; - } - .init.tagtable : { - __tagtable_begin = .; -- *(.taglist.init) -+ KEEP(*(.taglist.init)) - __tagtable_end = .; - } - #ifdef CONFIG_SMP_ON_UP - .init.smpalt : { - __smpalt_begin = .; -- *(.alt.smp.init) -+ KEEP(*(.alt.smp.init)) - __smpalt_end = .; - } - #endif - .init.pv_table : { - __pv_table_begin = .; -- *(.pv_table) -+ KEEP(*(.pv_table)) - __pv_table_end = .; - } - ---- a/arch/arm/kernel/vmlinux.lds.h -+++ b/arch/arm/kernel/vmlinux.lds.h -@@ -22,13 +22,13 @@ - #define ARM_MMU_DISCARD(x) - #else - #define ARM_MMU_KEEP(x) --#define ARM_MMU_DISCARD(x) x -+#define ARM_MMU_DISCARD(x) KEEP(x) - #endif - - #define PROC_INFO \ - . = ALIGN(4); \ - __proc_info_begin = .; \ -- *(.proc.info.init) \ -+ KEEP(*(.proc.info.init)) \ - __proc_info_end = .; - - #define HYPERVISOR_TEXT \ -@@ -39,11 +39,11 @@ - #define IDMAP_TEXT \ - ALIGN_FUNCTION(); \ - __idmap_text_start = .; \ -- *(.idmap.text) \ -+ KEEP(*(.idmap.text)) \ - __idmap_text_end = .; \ - . = ALIGN(PAGE_SIZE); \ - __hyp_idmap_text_start = .; \ -- *(.hyp.idmap.text) \ -+ KEEP(*(.hyp.idmap.text)) \ - __hyp_idmap_text_end = .; - - #define ARM_DISCARD \ -@@ -86,12 +86,12 @@ - . = ALIGN(8); \ - .ARM.unwind_idx : { \ - __start_unwind_idx = .; \ -- *(.ARM.exidx*) \ -+ KEEP(*(.ARM.exidx*)) \ - __stop_unwind_idx = .; \ - } \ - .ARM.unwind_tab : { \ - __start_unwind_tab = .; \ -- *(.ARM.extab*) \ -+ KEEP(*(.ARM.extab*)) \ - __stop_unwind_tab = .; \ - } - -@@ -102,14 +102,14 @@ - #define ARM_VECTORS \ - __vectors_start = .; \ - .vectors 0xffff0000 : AT(__vectors_start) { \ -- *(.vectors) \ -+ KEEP(*(.vectors)) \ - } \ - . = __vectors_start + SIZEOF(.vectors); \ - __vectors_end = .; \ - \ - __stubs_start = .; \ - .stubs ADDR(.vectors) + 0x1000 : AT(__stubs_start) { \ -- *(.stubs) \ -+ KEEP(*(.stubs)) \ - } \ - . = __stubs_start + SIZEOF(.stubs); \ - __stubs_end = .; \ ---- a/arch/mips/Kconfig -+++ b/arch/mips/Kconfig -@@ -43,6 +43,7 @@ config MIPS - select HAVE_ARCH_TRANSPARENT_HUGEPAGE if CPU_SUPPORTS_HUGEPAGES && 64BIT - select HAVE_CBPF_JIT if (!64BIT && !CPU_MICROMIPS) - select HAVE_EBPF_JIT if (64BIT && !CPU_MICROMIPS) -+ select HAVE_LD_DEAD_CODE_DATA_ELIMINATION - select HAVE_CONTEXT_TRACKING - select HAVE_COPY_THREAD_TLS - select HAVE_C_RECORDMCOUNT ---- a/arch/mips/kernel/vmlinux.lds.S -+++ b/arch/mips/kernel/vmlinux.lds.S -@@ -72,7 +72,7 @@ SECTIONS - /* Exception table for data bus errors */ - __dbe_table : { - __start___dbe_table = .; -- *(__dbe_table) -+ KEEP(*(__dbe_table)) - __stop___dbe_table = .; - } - -@@ -123,7 +123,7 @@ SECTIONS - . = ALIGN(4); - .mips.machines.init : AT(ADDR(.mips.machines.init) - LOAD_OFFSET) { - __mips_machines_start = .; -- *(.mips.machines.init) -+ KEEP(*(.mips.machines.init)) - __mips_machines_end = .; - } - diff --git a/target/linux/generic/hack-4.19/221-module_exports.patch b/target/linux/generic/hack-4.19/221-module_exports.patch deleted file mode 100644 index cd5ae5830c..0000000000 --- a/target/linux/generic/hack-4.19/221-module_exports.patch +++ /dev/null @@ -1,101 +0,0 @@ -From b14784e7883390c20ed3ff904892255404a5914b Mon Sep 17 00:00:00 2001 -From: Felix Fietkau -Date: Fri, 7 Jul 2017 17:05:53 +0200 -Subject: add an optional config option for stripping all unnecessary symbol exports from the kernel image - -lede-commit: bb5a40c64b7c4f4848509fa0a6625055fc9e66cc -Signed-off-by: Felix Fietkau ---- - include/asm-generic/vmlinux.lds.h | 18 +++++++++++++++--- - include/linux/export.h | 9 ++++++++- - scripts/Makefile.build | 2 +- - 3 files changed, 24 insertions(+), 5 deletions(-) - ---- a/include/asm-generic/vmlinux.lds.h -+++ b/include/asm-generic/vmlinux.lds.h -@@ -54,6 +54,16 @@ - #define LOAD_OFFSET 0 - #endif - -+#ifndef SYMTAB_KEEP -+#define SYMTAB_KEEP KEEP(*(SORT(___ksymtab+*))) -+#define SYMTAB_KEEP_GPL KEEP(*(SORT(___ksymtab_gpl+*))) -+#endif -+ -+#ifndef SYMTAB_DISCARD -+#define SYMTAB_DISCARD -+#define SYMTAB_DISCARD_GPL -+#endif -+ - /* Align . to a 8 byte boundary equals to maximum function alignment. */ - #define ALIGN_FUNCTION() . = ALIGN(8) - -@@ -372,14 +382,14 @@ - /* Kernel symbol table: Normal symbols */ \ - __ksymtab : AT(ADDR(__ksymtab) - LOAD_OFFSET) { \ - __start___ksymtab = .; \ -- KEEP(*(SORT(___ksymtab+*))) \ -+ SYMTAB_KEEP \ - __stop___ksymtab = .; \ - } \ - \ - /* Kernel symbol table: GPL-only symbols */ \ - __ksymtab_gpl : AT(ADDR(__ksymtab_gpl) - LOAD_OFFSET) { \ - __start___ksymtab_gpl = .; \ -- KEEP(*(SORT(___ksymtab_gpl+*))) \ -+ SYMTAB_KEEP_GPL \ - __stop___ksymtab_gpl = .; \ - } \ - \ -@@ -441,7 +451,7 @@ - \ - /* Kernel symbol table: strings */ \ - __ksymtab_strings : AT(ADDR(__ksymtab_strings) - LOAD_OFFSET) { \ -- *(__ksymtab_strings) \ -+ *(__ksymtab_strings+*) \ - } \ - \ - /* __*init sections */ \ -@@ -841,6 +851,8 @@ - EXIT_TEXT \ - EXIT_DATA \ - EXIT_CALL \ -+ SYMTAB_DISCARD \ -+ SYMTAB_DISCARD_GPL \ - *(.discard) \ - *(.discard.*) \ - } ---- a/include/linux/export.h -+++ b/include/linux/export.h -@@ -74,12 +74,19 @@ struct kernel_symbol { - }; - #endif - -+#ifdef MODULE -+#define __EXPORT_SUFFIX(sym) -+#else -+#define __EXPORT_SUFFIX(sym) "+" #sym -+#endif -+ - /* For every exported symbol, place a struct in the __ksymtab section */ - #define ___EXPORT_SYMBOL(sym, sec) \ - extern typeof(sym) sym; \ - __CRC_SYMBOL(sym, sec) \ - static const char __kstrtab_##sym[] \ -- __attribute__((section("__ksymtab_strings"), used, aligned(1))) \ -+ __attribute__((section("__ksymtab_strings" \ -+ __EXPORT_SUFFIX(sym)), used, aligned(1))) \ - = #sym; \ - __KSYMTAB_ENTRY(sym, sec) - ---- a/scripts/Makefile.build -+++ b/scripts/Makefile.build -@@ -408,7 +408,7 @@ targets += $(extra-y) $(MAKECMDGOALS) $( - # Linker scripts preprocessor (.lds.S -> .lds) - # --------------------------------------------------------------------------- - quiet_cmd_cpp_lds_S = LDS $@ -- cmd_cpp_lds_S = $(CPP) $(cpp_flags) -P -U$(ARCH) \ -+ cmd_cpp_lds_S = $(CPP) $(EXTRA_LDSFLAGS) $(cpp_flags) -P -U$(ARCH) \ - -D__ASSEMBLY__ -DLINKER_SCRIPT -o $@ $< - - $(obj)/%.lds: $(src)/%.lds.S FORCE diff --git a/target/linux/generic/hack-4.19/230-openwrt_lzma_options.patch b/target/linux/generic/hack-4.19/230-openwrt_lzma_options.patch deleted file mode 100644 index 45f0f8dcfa..0000000000 --- a/target/linux/generic/hack-4.19/230-openwrt_lzma_options.patch +++ /dev/null @@ -1,71 +0,0 @@ -From b3d00b452467f621317953d9e4c6f9ae8dcfd271 Mon Sep 17 00:00:00 2001 -From: Imre Kaloz -Date: Fri, 7 Jul 2017 17:06:55 +0200 -Subject: use the librecmc lzma options for now - -lede-commit: 548de949f392049420a6a1feeef118b30ab8ea8c -Signed-off-by: Imre Kaloz ---- - lib/decompress.c | 1 + - scripts/Makefile.lib | 2 +- - usr/gen_initramfs_list.sh | 10 +++++----- - 3 files changed, 7 insertions(+), 6 deletions(-) - ---- a/lib/decompress.c -+++ b/lib/decompress.c -@@ -49,6 +49,7 @@ static const struct compress_format comp - { {0x1f, 0x9e}, "gzip", gunzip }, - { {0x42, 0x5a}, "bzip2", bunzip2 }, - { {0x5d, 0x00}, "lzma", unlzma }, -+ { {0x6d, 0x00}, "lzma-librecmc", unlzma }, - { {0xfd, 0x37}, "xz", unxz }, - { {0x89, 0x4c}, "lzo", unlzo }, - { {0x02, 0x21}, "lz4", unlz4 }, ---- a/scripts/Makefile.lib -+++ b/scripts/Makefile.lib -@@ -324,7 +324,7 @@ cmd_bzip2 = (cat $(filter-out FORCE,$^) - - quiet_cmd_lzma = LZMA $@ - cmd_lzma = (cat $(filter-out FORCE,$^) | \ -- lzma -9 && $(call size_append, $(filter-out FORCE,$^))) > $@ || \ -+ lzma e -d20 -lc1 -lp2 -pb2 -eos -si -so && $(call size_append, $(filter-out FORCE,$^))) > $@ || \ - (rm -f $@ ; false) - - quiet_cmd_lzo = LZO $@ ---- a/usr/gen_initramfs_list.sh -+++ b/usr/gen_initramfs_list.sh -@@ -229,7 +229,7 @@ cpio_list= - output="/dev/stdout" - output_file="" - is_cpio_compressed= --compr="gzip -n -9 -f" -+compr="gzip -n -9 -f -" - - arg="$1" - case "$arg" in -@@ -245,13 +245,13 @@ case "$arg" in - output=${cpio_list} - echo "$output_file" | grep -q "\.gz$" \ - && [ -x "`which gzip 2> /dev/null`" ] \ -- && compr="gzip -n -9 -f" -+ && compr="gzip -n -9 -f -" - echo "$output_file" | grep -q "\.bz2$" \ - && [ -x "`which bzip2 2> /dev/null`" ] \ -- && compr="bzip2 -9 -f" -+ && compr="bzip2 -9 -f -" - echo "$output_file" | grep -q "\.lzma$" \ - && [ -x "`which lzma 2> /dev/null`" ] \ -- && compr="lzma -9 -f" -+ && compr="lzma e -d20 -lc1 -lp2 -pb2 -eos -si -so" - echo "$output_file" | grep -q "\.xz$" \ - && [ -x "`which xz 2> /dev/null`" ] \ - && compr="xz --check=crc32 --lzma2=dict=1MiB" -@@ -320,7 +320,7 @@ if [ ! -z ${output_file} ]; then - if [ "${is_cpio_compressed}" = "compressed" ]; then - cat ${cpio_tfile} > ${output_file} - else -- (cat ${cpio_tfile} | ${compr} - > ${output_file}) \ -+ (cat ${cpio_tfile} | ${compr} > ${output_file}) \ - || (rm -f ${output_file} ; false) - fi - [ -z ${cpio_file} ] && rm ${cpio_tfile} diff --git a/target/linux/generic/hack-4.19/250-netfilter_depends.patch b/target/linux/generic/hack-4.19/250-netfilter_depends.patch deleted file mode 100644 index b29ca5190e..0000000000 --- a/target/linux/generic/hack-4.19/250-netfilter_depends.patch +++ /dev/null @@ -1,27 +0,0 @@ -From: Felix Fietkau -Subject: hack: net: remove bogus netfilter dependencies - -lede-commit: 589d2a377dee27d206fc3725325309cf649e4df6 -Signed-off-by: Felix Fietkau ---- - net/netfilter/Kconfig | 2 -- - 1 file changed, 2 deletions(-) - ---- a/net/netfilter/Kconfig -+++ b/net/netfilter/Kconfig -@@ -241,7 +241,6 @@ config NF_CONNTRACK_FTP - - config NF_CONNTRACK_H323 - tristate "H.323 protocol support" -- depends on IPV6 || IPV6=n - depends on NETFILTER_ADVANCED - help - H.323 is a VoIP signalling protocol from ITU-T. As one of the most -@@ -1076,7 +1075,6 @@ config NETFILTER_XT_TARGET_SECMARK - - config NETFILTER_XT_TARGET_TCPMSS - tristate '"TCPMSS" target support' -- depends on IPV6 || IPV6=n - default m if NETFILTER_ADVANCED=n - ---help--- - This option adds a `TCPMSS' target, which allows you to alter the diff --git a/target/linux/generic/hack-4.19/251-sound_kconfig.patch b/target/linux/generic/hack-4.19/251-sound_kconfig.patch deleted file mode 100644 index 2cfc2fab3a..0000000000 --- a/target/linux/generic/hack-4.19/251-sound_kconfig.patch +++ /dev/null @@ -1,197 +0,0 @@ -From da3c50704f14132f4adf80d48e9a4cd5d46e54c9 Mon Sep 17 00:00:00 2001 -From: John Crispin -Date: Fri, 7 Jul 2017 17:09:21 +0200 -Subject: kconfig: owrt specifc dependencies - -Signed-off-by: John Crispin ---- - crypto/Kconfig | 10 +++++----- - drivers/bcma/Kconfig | 1 + - drivers/ssb/Kconfig | 3 ++- - lib/Kconfig | 8 ++++---- - net/netfilter/Kconfig | 2 +- - net/wireless/Kconfig | 17 ++++++++++------- - sound/core/Kconfig | 4 ++-- - 7 files changed, 25 insertions(+), 20 deletions(-) - ---- a/crypto/Kconfig -+++ b/crypto/Kconfig -@@ -33,7 +33,7 @@ config CRYPTO_FIPS - this is. - - config CRYPTO_ALGAPI -- tristate -+ tristate "ALGAPI" - select CRYPTO_ALGAPI2 - help - This option provides the API for cryptographic algorithms. -@@ -42,7 +42,7 @@ config CRYPTO_ALGAPI2 - tristate - - config CRYPTO_AEAD -- tristate -+ tristate "AEAD" - select CRYPTO_AEAD2 - select CRYPTO_ALGAPI - -@@ -53,7 +53,7 @@ config CRYPTO_AEAD2 - select CRYPTO_RNG2 - - config CRYPTO_BLKCIPHER -- tristate -+ tristate "BLKCIPHER" - select CRYPTO_BLKCIPHER2 - select CRYPTO_ALGAPI - -@@ -64,7 +64,7 @@ config CRYPTO_BLKCIPHER2 - select CRYPTO_WORKQUEUE - - config CRYPTO_HASH -- tristate -+ tristate "HASH" - select CRYPTO_HASH2 - select CRYPTO_ALGAPI - -@@ -73,7 +73,7 @@ config CRYPTO_HASH2 - select CRYPTO_ALGAPI2 - - config CRYPTO_RNG -- tristate -+ tristate "RNG" - select CRYPTO_RNG2 - select CRYPTO_ALGAPI - ---- a/drivers/bcma/Kconfig -+++ b/drivers/bcma/Kconfig -@@ -16,6 +16,7 @@ if BCMA - # Support for Block-I/O. SELECT this from the driver that needs it. - config BCMA_BLOCKIO - bool -+ default y - - config BCMA_HOST_PCI_POSSIBLE - bool ---- a/drivers/ssb/Kconfig -+++ b/drivers/ssb/Kconfig -@@ -28,6 +28,7 @@ config SSB_SPROM - config SSB_BLOCKIO - bool - depends on SSB -+ default y - - config SSB_PCIHOST_POSSIBLE - bool -@@ -48,7 +49,7 @@ config SSB_PCIHOST - config SSB_B43_PCI_BRIDGE - bool - depends on SSB_PCIHOST -- default n -+ default y - - config SSB_PCMCIAHOST_POSSIBLE - bool ---- a/lib/Kconfig -+++ b/lib/Kconfig -@@ -377,16 +377,16 @@ config BCH_CONST_T - # Textsearch support is select'ed if needed - # - config TEXTSEARCH -- bool -+ bool "Textsearch support" - - config TEXTSEARCH_KMP -- tristate -+ tristate "Textsearch KMP" - - config TEXTSEARCH_BM -- tristate -+ tristate "Textsearch BM" - - config TEXTSEARCH_FSM -- tristate -+ tristate "Textsearch FSM" - - config BTREE - bool ---- a/net/netfilter/Kconfig -+++ b/net/netfilter/Kconfig -@@ -10,7 +10,7 @@ config NETFILTER_INGRESS - infrastructure. - - config NETFILTER_NETLINK -- tristate -+ tristate "Netfilter NFNETLINK interface" - - config NETFILTER_FAMILY_BRIDGE - bool ---- a/net/wireless/Kconfig -+++ b/net/wireless/Kconfig -@@ -1,5 +1,5 @@ - config WIRELESS_EXT -- bool -+ bool "Wireless extensions" - - config WEXT_CORE - def_bool y -@@ -11,10 +11,10 @@ config WEXT_PROC - depends on WEXT_CORE - - config WEXT_SPY -- bool -+ bool "WEXT_SPY" - - config WEXT_PRIV -- bool -+ bool "WEXT_PRIV" - - config CFG80211 - tristate "cfg80211 - wireless configuration API" -@@ -202,7 +202,7 @@ config CFG80211_WEXT_EXPORT - endif # CFG80211 - - config LIB80211 -- tristate -+ tristate "LIB80211" - default n - help - This options enables a library of common routines used -@@ -211,13 +211,16 @@ config LIB80211 - Drivers should select this themselves if needed. - - config LIB80211_CRYPT_WEP -- tristate -+ tristate "LIB80211_CRYPT_WEP" -+ select LIB80211 - - config LIB80211_CRYPT_CCMP -- tristate -+ tristate "LIB80211_CRYPT_CCMP" -+ select LIB80211 - - config LIB80211_CRYPT_TKIP -- tristate -+ tristate "LIB80211_CRYPT_TKIP" -+ select LIB80211 - - config LIB80211_DEBUG - bool "lib80211 debugging messages" ---- a/sound/core/Kconfig -+++ b/sound/core/Kconfig -@@ -16,7 +16,7 @@ config SND_DMAENGINE_PCM - tristate - - config SND_HWDEP -- tristate -+ tristate "Sound hardware support" - - config SND_SEQ_DEVICE - tristate -@@ -26,7 +26,7 @@ config SND_RAWMIDI - select SND_SEQ_DEVICE if SND_SEQUENCER != n - - config SND_COMPRESS_OFFLOAD -- tristate -+ tristate "Compression offloading support" - - config SND_JACK - bool diff --git a/target/linux/generic/hack-4.19/259-regmap_dynamic.patch b/target/linux/generic/hack-4.19/259-regmap_dynamic.patch deleted file mode 100644 index 335ec4afc5..0000000000 --- a/target/linux/generic/hack-4.19/259-regmap_dynamic.patch +++ /dev/null @@ -1,110 +0,0 @@ -From 811d9e2268a62b830cfe93cd8bc929afcb8b198b Mon Sep 17 00:00:00 2001 -From: Felix Fietkau -Date: Sat, 15 Jul 2017 21:12:38 +0200 -Subject: kernel: move regmap bloat out of the kernel image if it is only being used in modules - -lede-commit: 96f39119815028073583e4fca3a9c5fe9141e998 -Signed-off-by: Felix Fietkau ---- - drivers/base/regmap/Kconfig | 15 ++++++++++----- - drivers/base/regmap/Makefile | 12 ++++++++---- - drivers/base/regmap/regmap.c | 3 +++ - include/linux/regmap.h | 2 +- - 4 files changed, 22 insertions(+), 10 deletions(-) - ---- a/drivers/base/regmap/Kconfig -+++ b/drivers/base/regmap/Kconfig -@@ -4,9 +4,8 @@ - # subsystems should select the appropriate symbols. - - config REGMAP -- default y if (REGMAP_I2C || REGMAP_SPI || REGMAP_SPMI || REGMAP_W1 || REGMAP_AC97 || REGMAP_MMIO || REGMAP_IRQ) - select IRQ_DOMAIN if REGMAP_IRQ -- bool -+ tristate - - config REGCACHE_COMPRESSED - select LZO_COMPRESS -@@ -18,6 +17,7 @@ config REGMAP_AC97 - - config REGMAP_I2C - tristate -+ select REGMAP - depends on I2C - - config REGMAP_SLIMBUS -@@ -26,20 +26,26 @@ config REGMAP_SLIMBUS - - config REGMAP_SPI - tristate -+ select REGMAP -+ depends on SPI_MASTER - depends on SPI - - config REGMAP_SPMI -+ select REGMAP - tristate - depends on SPMI - - config REGMAP_W1 -+ select REGMAP - tristate - depends on W1 - - config REGMAP_MMIO - tristate -+ select REGMAP - - config REGMAP_IRQ -+ select REGMAP - bool - - config REGMAP_SOUNDWIRE ---- a/drivers/base/regmap/Makefile -+++ b/drivers/base/regmap/Makefile -@@ -2,10 +2,14 @@ - # For include/trace/define_trace.h to include trace.h - CFLAGS_regmap.o := -I$(src) - --obj-$(CONFIG_REGMAP) += regmap.o regcache.o --obj-$(CONFIG_REGMAP) += regcache-rbtree.o regcache-flat.o --obj-$(CONFIG_REGCACHE_COMPRESSED) += regcache-lzo.o --obj-$(CONFIG_DEBUG_FS) += regmap-debugfs.o -+regmap-core-objs = regmap.o regcache.o regcache-rbtree.o regcache-flat.o -+ifdef CONFIG_DEBUG_FS -+regmap-core-objs += regmap-debugfs.o -+endif -+ifdef CONFIG_REGCACHE_COMPRESSED -+regmap-core-objs += regcache-lzo.o -+endif -+obj-$(CONFIG_REGMAP) += regmap-core.o - obj-$(CONFIG_REGMAP_AC97) += regmap-ac97.o - obj-$(CONFIG_REGMAP_I2C) += regmap-i2c.o - obj-$(CONFIG_REGMAP_SLIMBUS) += regmap-slimbus.o ---- a/drivers/base/regmap/regmap.c -+++ b/drivers/base/regmap/regmap.c -@@ -13,6 +13,7 @@ - #include - #include - #include -+#include - #include - #include - #include -@@ -3037,3 +3038,5 @@ static int __init regmap_initcall(void) - return 0; - } - postcore_initcall(regmap_initcall); -+ -+MODULE_LICENSE("GPL"); ---- a/include/linux/regmap.h -+++ b/include/linux/regmap.h -@@ -187,7 +187,7 @@ struct reg_sequence { - pollret ?: ((cond) ? 0 : -ETIMEDOUT); \ - }) - --#ifdef CONFIG_REGMAP -+#if IS_REACHABLE(CONFIG_REGMAP) - - enum regmap_endian { - /* Unspecified -> 0 -> Backwards compatible default */ diff --git a/target/linux/generic/hack-4.19/260-crypto_test_dependencies.patch b/target/linux/generic/hack-4.19/260-crypto_test_dependencies.patch deleted file mode 100644 index f11f45437f..0000000000 --- a/target/linux/generic/hack-4.19/260-crypto_test_dependencies.patch +++ /dev/null @@ -1,60 +0,0 @@ -From fd1799b0bf5efa46dd3e6dfbbf3955564807e508 Mon Sep 17 00:00:00 2001 -From: Felix Fietkau -Date: Fri, 7 Jul 2017 17:12:51 +0200 -Subject: kernel: prevent cryptomgr from pulling in useless extra dependencies for tests that are not run - -Reduces kernel size after LZMA by about 5k on MIPS - -lede-commit: 044c316167e076479a344c59905e5b435b84a77f -Signed-off-by: Felix Fietkau ---- - crypto/Kconfig | 13 ++++++------- - crypto/algboss.c | 4 ++++ - 2 files changed, 10 insertions(+), 7 deletions(-) - ---- a/crypto/Kconfig -+++ b/crypto/Kconfig -@@ -144,13 +144,13 @@ config CRYPTO_MANAGER - cbc(aes). - - config CRYPTO_MANAGER2 -- def_tristate CRYPTO_MANAGER || (CRYPTO_MANAGER!=n && CRYPTO_ALGAPI=y) -- select CRYPTO_AEAD2 -- select CRYPTO_HASH2 -- select CRYPTO_BLKCIPHER2 -- select CRYPTO_AKCIPHER2 -- select CRYPTO_KPP2 -- select CRYPTO_ACOMP2 -+ def_tristate CRYPTO_MANAGER || (CRYPTO_MANAGER!=n && CRYPTO_ALGAPI=y && !CRYPTO_MANAGER_DISABLE_TESTS) -+ select CRYPTO_AEAD2 if !CRYPTO_MANAGER_DISABLE_TESTS -+ select CRYPTO_HASH2 if !CRYPTO_MANAGER_DISABLE_TESTS -+ select CRYPTO_BLKCIPHER2 if !CRYPTO_MANAGER_DISABLE_TESTS -+ select CRYPTO_AKCIPHER2 if !CRYPTO_MANAGER_DISABLE_TESTS -+ select CRYPTO_KPP2 if !CRYPTO_MANAGER_DISABLE_TESTS -+ select CRYPTO_ACOMP2 if !CRYPTO_MANAGER_DISABLE_TESTS - - config CRYPTO_USER - tristate "Userspace cryptographic algorithm configuration" -@@ -163,7 +163,6 @@ config CRYPTO_USER - config CRYPTO_MANAGER_DISABLE_TESTS - bool "Disable run-time self tests" - default y -- depends on CRYPTO_MANAGER2 - help - Disable run-time self tests that normally take place at - algorithm registration. ---- a/crypto/algboss.c -+++ b/crypto/algboss.c -@@ -247,8 +247,12 @@ static int cryptomgr_schedule_test(struc - type = alg->cra_flags; - - /* Do not test internal algorithms. */ -+#ifdef CONFIG_CRYPTO_MANAGER_DISABLE_TESTS -+ type |= CRYPTO_ALG_TESTED; -+#else - if (type & CRYPTO_ALG_INTERNAL) - type |= CRYPTO_ALG_TESTED; -+#endif - - param->type = type; - diff --git a/target/linux/generic/hack-4.19/280-rfkill-stubs.patch b/target/linux/generic/hack-4.19/280-rfkill-stubs.patch deleted file mode 100644 index 7bb7d26b90..0000000000 --- a/target/linux/generic/hack-4.19/280-rfkill-stubs.patch +++ /dev/null @@ -1,84 +0,0 @@ -From 236c1acdfef5958010ac9814a9872e0a46fd78ee Mon Sep 17 00:00:00 2001 -From: John Crispin -Date: Fri, 7 Jul 2017 17:13:44 +0200 -Subject: rfkill: add fake rfkill support - -allow building of modules depending on RFKILL even if RFKILL is not enabled. - -Signed-off-by: John Crispin ---- - include/linux/rfkill.h | 2 +- - net/Makefile | 2 +- - net/rfkill/Kconfig | 14 +++++++++----- - net/rfkill/Makefile | 2 +- - 4 files changed, 12 insertions(+), 8 deletions(-) - ---- a/include/linux/rfkill.h -+++ b/include/linux/rfkill.h -@@ -64,7 +64,7 @@ struct rfkill_ops { - int (*set_block)(void *data, bool blocked); - }; - --#if defined(CONFIG_RFKILL) || defined(CONFIG_RFKILL_MODULE) -+#if defined(CONFIG_RFKILL_FULL) || defined(CONFIG_RFKILL_FULL_MODULE) - /** - * rfkill_alloc - Allocate rfkill structure - * @name: name of the struct -- the string is not copied internally ---- a/net/Makefile -+++ b/net/Makefile -@@ -53,7 +53,7 @@ obj-$(CONFIG_TIPC) += tipc/ - obj-$(CONFIG_NETLABEL) += netlabel/ - obj-$(CONFIG_IUCV) += iucv/ - obj-$(CONFIG_SMC) += smc/ --obj-$(CONFIG_RFKILL) += rfkill/ -+obj-$(CONFIG_RFKILL_FULL) += rfkill/ - obj-$(CONFIG_NET_9P) += 9p/ - obj-$(CONFIG_CAIF) += caif/ - ifneq ($(CONFIG_DCB),) ---- a/net/rfkill/Kconfig -+++ b/net/rfkill/Kconfig -@@ -1,7 +1,11 @@ - # - # RF switch subsystem configuration - # --menuconfig RFKILL -+config RFKILL -+ bool -+ default y -+ -+menuconfig RFKILL_FULL - tristate "RF switch subsystem support" - help - Say Y here if you want to have control over RF switches -@@ -13,19 +17,19 @@ menuconfig RFKILL - # LED trigger support - config RFKILL_LEDS - bool -- depends on RFKILL -+ depends on RFKILL_FULL - depends on LEDS_TRIGGERS = y || RFKILL = LEDS_TRIGGERS - default y - - config RFKILL_INPUT - bool "RF switch input support" if EXPERT -- depends on RFKILL -+ depends on RFKILL_FULL - depends on INPUT = y || RFKILL = INPUT - default y if !EXPERT - - config RFKILL_GPIO - tristate "GPIO RFKILL driver" -- depends on RFKILL -+ depends on RFKILL_FULL - depends on GPIOLIB || COMPILE_TEST - default n - help ---- a/net/rfkill/Makefile -+++ b/net/rfkill/Makefile -@@ -4,5 +4,5 @@ - - rfkill-y += core.o - rfkill-$(CONFIG_RFKILL_INPUT) += input.o --obj-$(CONFIG_RFKILL) += rfkill.o -+obj-$(CONFIG_RFKILL_FULL) += rfkill.o - obj-$(CONFIG_RFKILL_GPIO) += rfkill-gpio.o diff --git a/target/linux/generic/hack-4.19/290-nvmem-make-CONFIG_NVMEM-tristate-again.patch b/target/linux/generic/hack-4.19/290-nvmem-make-CONFIG_NVMEM-tristate-again.patch deleted file mode 100644 index ad45dc9168..0000000000 --- a/target/linux/generic/hack-4.19/290-nvmem-make-CONFIG_NVMEM-tristate-again.patch +++ /dev/null @@ -1,33 +0,0 @@ -From 2579d9b982c7232f9354bcca5262e26a84c38799 Mon Sep 17 00:00:00 2001 -From: Hauke Mehrtens -Date: Fri, 2 Nov 2018 17:40:32 +0100 -Subject: [PATCH] nvmem: make CONFIG_NVMEM tristate again - -Only build it in when OF_NET is selected and make it possible to build -it as module otherwise. - -Signed-off-by: Hauke Mehrtens ---- - drivers/nvmem/Kconfig | 2 +- - drivers/of/Kconfig | 1 + - 2 files changed, 2 insertions(+), 1 deletion(-) - ---- a/drivers/nvmem/Kconfig -+++ b/drivers/nvmem/Kconfig -@@ -1,5 +1,5 @@ - menuconfig NVMEM -- bool "NVMEM Support" -+ tristate "NVMEM Support" - help - Support for NVMEM(Non Volatile Memory) devices like EEPROM, EFUSES... - ---- a/drivers/of/Kconfig -+++ b/drivers/of/Kconfig -@@ -71,6 +71,7 @@ config OF_IRQ - - config OF_NET - depends on NETDEVICES -+ select NVMEM - def_bool y - - config OF_MDIO diff --git a/target/linux/generic/hack-4.19/300-MIPS-r4k_cache-use-more-efficient-cache-blast.patch b/target/linux/generic/hack-4.19/300-MIPS-r4k_cache-use-more-efficient-cache-blast.patch deleted file mode 100644 index c07ccf9474..0000000000 --- a/target/linux/generic/hack-4.19/300-MIPS-r4k_cache-use-more-efficient-cache-blast.patch +++ /dev/null @@ -1,66 +0,0 @@ -From: Ben Menchaca -Date: Fri, 7 Jun 2013 18:35:22 -0500 -Subject: MIPS: r4k_cache: use more efficient cache blast - -Optimize the compiler output for larger cache blast cases that are -common for DMA-based networking. - -Signed-off-by: Ben Menchaca -Signed-off-by: Felix Fietkau ---- ---- a/arch/mips/include/asm/r4kcache.h -+++ b/arch/mips/include/asm/r4kcache.h -@@ -683,16 +683,48 @@ static inline void prot##extra##blast_## - unsigned long end) \ - { \ - unsigned long lsize = cpu_##desc##_line_size(); \ -+ unsigned long lsize_2 = lsize * 2; \ -+ unsigned long lsize_3 = lsize * 3; \ -+ unsigned long lsize_4 = lsize * 4; \ -+ unsigned long lsize_5 = lsize * 5; \ -+ unsigned long lsize_6 = lsize * 6; \ -+ unsigned long lsize_7 = lsize * 7; \ -+ unsigned long lsize_8 = lsize * 8; \ - unsigned long addr = start & ~(lsize - 1); \ -- unsigned long aend = (end - 1) & ~(lsize - 1); \ -+ unsigned long aend = (end + lsize - 1) & ~(lsize - 1); \ -+ int lines = (aend - addr) / lsize; \ - \ - __##pfx##flush_prologue \ - \ -- while (1) { \ -+ while (lines >= 8) { \ -+ prot##cache_op(hitop, addr); \ -+ prot##cache_op(hitop, addr + lsize); \ -+ prot##cache_op(hitop, addr + lsize_2); \ -+ prot##cache_op(hitop, addr + lsize_3); \ -+ prot##cache_op(hitop, addr + lsize_4); \ -+ prot##cache_op(hitop, addr + lsize_5); \ -+ prot##cache_op(hitop, addr + lsize_6); \ -+ prot##cache_op(hitop, addr + lsize_7); \ -+ addr += lsize_8; \ -+ lines -= 8; \ -+ } \ -+ \ -+ if (lines & 0x4) { \ -+ prot##cache_op(hitop, addr); \ -+ prot##cache_op(hitop, addr + lsize); \ -+ prot##cache_op(hitop, addr + lsize_2); \ -+ prot##cache_op(hitop, addr + lsize_3); \ -+ addr += lsize_4; \ -+ } \ -+ \ -+ if (lines & 0x2) { \ -+ prot##cache_op(hitop, addr); \ -+ prot##cache_op(hitop, addr + lsize); \ -+ addr += lsize_2; \ -+ } \ -+ \ -+ if (lines & 0x1) { \ - prot##cache_op(hitop, addr); \ -- if (addr == aend) \ -- break; \ -- addr += lsize; \ - } \ - \ - __##pfx##flush_epilogue \ diff --git a/target/linux/generic/hack-4.19/301-mips_image_cmdline_hack.patch b/target/linux/generic/hack-4.19/301-mips_image_cmdline_hack.patch deleted file mode 100644 index 3cd69426ab..0000000000 --- a/target/linux/generic/hack-4.19/301-mips_image_cmdline_hack.patch +++ /dev/null @@ -1,38 +0,0 @@ -From: John Crispin -Subject: hack: kernel: add generic image_cmdline hack to MIPS targets - -lede-commit: d59f5b3a987a48508257a0ddbaeadc7909f9f976 -Signed-off-by: Gabor Juhos ---- - arch/mips/Kconfig | 4 ++++ - arch/mips/kernel/head.S | 6 ++++++ - 2 files changed, 10 insertions(+) - ---- a/arch/mips/Kconfig -+++ b/arch/mips/Kconfig -@@ -1143,6 +1143,10 @@ config SYNC_R4K - config MIPS_MACHINE - def_bool n - -+config IMAGE_CMDLINE_HACK -+ bool "libreCMC specific image command line hack" -+ default n -+ - config NO_IOPORT_MAP - def_bool n - ---- a/arch/mips/kernel/head.S -+++ b/arch/mips/kernel/head.S -@@ -79,6 +79,12 @@ FEXPORT(__kernel_entry) - j kernel_entry - #endif - -+#ifdef CONFIG_IMAGE_CMDLINE_HACK -+ .ascii "CMDLINE:" -+EXPORT(__image_cmdline) -+ .fill 0x400 -+#endif /* CONFIG_IMAGE_CMDLINE_HACK */ -+ - __REF - - NESTED(kernel_entry, 16, sp) # kernel entry point diff --git a/target/linux/generic/hack-4.19/321-powerpc_crtsavres_prereq.patch b/target/linux/generic/hack-4.19/321-powerpc_crtsavres_prereq.patch deleted file mode 100644 index 26c385f011..0000000000 --- a/target/linux/generic/hack-4.19/321-powerpc_crtsavres_prereq.patch +++ /dev/null @@ -1,39 +0,0 @@ -From 107c0964cb8db7ca28ac5199426414fdab3c274d Mon Sep 17 00:00:00 2001 -From: "Alexandros C. Couloumbis" -Date: Fri, 7 Jul 2017 17:14:51 +0200 -Subject: hack: arch: powerpc: drop register save/restore library from modules - -Upstream GCC uses a libgcc function for saving/restoring registers. This -makes the code bigger, and upstream kernels need to carry that function -for every single kernel module. Our GCC is patched to avoid those -references, so we can drop the extra bloat for modules. - -lede-commit: e8e1084654f50904e6bf77b70b2de3f137d7b3ec -Signed-off-by: Alexandros C. Couloumbis ---- - arch/powerpc/Makefile | 1 - - 1 file changed, 1 deletion(-) - ---- a/arch/powerpc/Makefile -+++ b/arch/powerpc/Makefile -@@ -60,20 +60,6 @@ machine-$(CONFIG_PPC64) += 64 - machine-$(CONFIG_CPU_LITTLE_ENDIAN) += le - UTS_MACHINE := $(subst $(space),,$(machine-y)) - --# XXX This needs to be before we override LD below --ifdef CONFIG_PPC32 --KBUILD_LDFLAGS_MODULE += arch/powerpc/lib/crtsavres.o --else --KBUILD_LDFLAGS_MODULE += -T $(srctree)/arch/powerpc/kernel/module.lds --ifeq ($(call ld-ifversion, -ge, 225000000, y),y) --# Have the linker provide sfpr if possible. --# There is a corresponding test in arch/powerpc/lib/Makefile --KBUILD_LDFLAGS_MODULE += --save-restore-funcs --else --KBUILD_LDFLAGS_MODULE += arch/powerpc/lib/crtsavres.o --endif --endif -- - ifdef CONFIG_CPU_LITTLE_ENDIAN - KBUILD_CFLAGS += -mlittle-endian - KBUILD_LDFLAGS += -EL diff --git a/target/linux/generic/hack-4.19/531-debloat_lzma.patch b/target/linux/generic/hack-4.19/531-debloat_lzma.patch deleted file mode 100644 index 2e453cc2f2..0000000000 --- a/target/linux/generic/hack-4.19/531-debloat_lzma.patch +++ /dev/null @@ -1,1040 +0,0 @@ -From 3fd297761ac246c54d7723c57fca95c112b99465 Mon Sep 17 00:00:00 2001 -From: Felix Fietkau -Date: Sat, 15 Jul 2017 21:15:44 +0200 -Subject: lzma: de-bloat the lzma library used by jffs2 - -lede-commit: 3fd1dd08fbcbb78b34efefd32c3032e5c99108d6 -Signed-off-by: Felix Fietkau ---- - include/linux/lzma/LzFind.h | 17 --- - include/linux/lzma/LzmaDec.h | 101 --------------- - include/linux/lzma/LzmaEnc.h | 20 --- - lib/lzma/LzFind.c | 287 ++++--------------------------------------- - lib/lzma/LzmaDec.c | 86 +------------ - lib/lzma/LzmaEnc.c | 172 ++------------------------ - 6 files changed, 42 insertions(+), 641 deletions(-) - ---- a/include/linux/lzma/LzFind.h -+++ b/include/linux/lzma/LzFind.h -@@ -55,11 +55,6 @@ typedef struct _CMatchFinder - - #define Inline_MatchFinder_GetNumAvailableBytes(p) ((p)->streamPos - (p)->pos) - --int MatchFinder_NeedMove(CMatchFinder *p); --Byte *MatchFinder_GetPointerToCurrentPos(CMatchFinder *p); --void MatchFinder_MoveBlock(CMatchFinder *p); --void MatchFinder_ReadIfRequired(CMatchFinder *p); -- - void MatchFinder_Construct(CMatchFinder *p); - - /* Conditions: -@@ -70,12 +65,6 @@ int MatchFinder_Create(CMatchFinder *p, - UInt32 keepAddBufferBefore, UInt32 matchMaxLen, UInt32 keepAddBufferAfter, - ISzAlloc *alloc); - void MatchFinder_Free(CMatchFinder *p, ISzAlloc *alloc); --void MatchFinder_Normalize3(UInt32 subValue, CLzRef *items, UInt32 numItems); --void MatchFinder_ReduceOffsets(CMatchFinder *p, UInt32 subValue); -- --UInt32 * GetMatchesSpec1(UInt32 lenLimit, UInt32 curMatch, UInt32 pos, const Byte *buffer, CLzRef *son, -- UInt32 _cyclicBufferPos, UInt32 _cyclicBufferSize, UInt32 _cutValue, -- UInt32 *distances, UInt32 maxLen); - - /* - Conditions: -@@ -102,12 +91,6 @@ typedef struct _IMatchFinder - - void MatchFinder_CreateVTable(CMatchFinder *p, IMatchFinder *vTable); - --void MatchFinder_Init(CMatchFinder *p); --UInt32 Bt3Zip_MatchFinder_GetMatches(CMatchFinder *p, UInt32 *distances); --UInt32 Hc3Zip_MatchFinder_GetMatches(CMatchFinder *p, UInt32 *distances); --void Bt3Zip_MatchFinder_Skip(CMatchFinder *p, UInt32 num); --void Hc3Zip_MatchFinder_Skip(CMatchFinder *p, UInt32 num); -- - #ifdef __cplusplus - } - #endif ---- a/include/linux/lzma/LzmaDec.h -+++ b/include/linux/lzma/LzmaDec.h -@@ -31,14 +31,6 @@ typedef struct _CLzmaProps - UInt32 dicSize; - } CLzmaProps; - --/* LzmaProps_Decode - decodes properties --Returns: -- SZ_OK -- SZ_ERROR_UNSUPPORTED - Unsupported properties --*/ -- --SRes LzmaProps_Decode(CLzmaProps *p, const Byte *data, unsigned size); -- - - /* ---------- LZMA Decoder state ---------- */ - -@@ -70,8 +62,6 @@ typedef struct - - #define LzmaDec_Construct(p) { (p)->dic = 0; (p)->probs = 0; } - --void LzmaDec_Init(CLzmaDec *p); -- - /* There are two types of LZMA streams: - 0) Stream with end mark. That end mark adds about 6 bytes to compressed size. - 1) Stream without end mark. You must know exact uncompressed size to decompress such stream. */ -@@ -108,97 +98,6 @@ typedef enum - - /* ELzmaStatus is used only as output value for function call */ - -- --/* ---------- Interfaces ---------- */ -- --/* There are 3 levels of interfaces: -- 1) Dictionary Interface -- 2) Buffer Interface -- 3) One Call Interface -- You can select any of these interfaces, but don't mix functions from different -- groups for same object. */ -- -- --/* There are two variants to allocate state for Dictionary Interface: -- 1) LzmaDec_Allocate / LzmaDec_Free -- 2) LzmaDec_AllocateProbs / LzmaDec_FreeProbs -- You can use variant 2, if you set dictionary buffer manually. -- For Buffer Interface you must always use variant 1. -- --LzmaDec_Allocate* can return: -- SZ_OK -- SZ_ERROR_MEM - Memory allocation error -- SZ_ERROR_UNSUPPORTED - Unsupported properties --*/ -- --SRes LzmaDec_AllocateProbs(CLzmaDec *p, const Byte *props, unsigned propsSize, ISzAlloc *alloc); --void LzmaDec_FreeProbs(CLzmaDec *p, ISzAlloc *alloc); -- --SRes LzmaDec_Allocate(CLzmaDec *state, const Byte *prop, unsigned propsSize, ISzAlloc *alloc); --void LzmaDec_Free(CLzmaDec *state, ISzAlloc *alloc); -- --/* ---------- Dictionary Interface ---------- */ -- --/* You can use it, if you want to eliminate the overhead for data copying from -- dictionary to some other external buffer. -- You must work with CLzmaDec variables directly in this interface. -- -- STEPS: -- LzmaDec_Constr() -- LzmaDec_Allocate() -- for (each new stream) -- { -- LzmaDec_Init() -- while (it needs more decompression) -- { -- LzmaDec_DecodeToDic() -- use data from CLzmaDec::dic and update CLzmaDec::dicPos -- } -- } -- LzmaDec_Free() --*/ -- --/* LzmaDec_DecodeToDic -- -- The decoding to internal dictionary buffer (CLzmaDec::dic). -- You must manually update CLzmaDec::dicPos, if it reaches CLzmaDec::dicBufSize !!! -- --finishMode: -- It has meaning only if the decoding reaches output limit (dicLimit). -- LZMA_FINISH_ANY - Decode just dicLimit bytes. -- LZMA_FINISH_END - Stream must be finished after dicLimit. -- --Returns: -- SZ_OK -- status: -- LZMA_STATUS_FINISHED_WITH_MARK -- LZMA_STATUS_NOT_FINISHED -- LZMA_STATUS_NEEDS_MORE_INPUT -- LZMA_STATUS_MAYBE_FINISHED_WITHOUT_MARK -- SZ_ERROR_DATA - Data error --*/ -- --SRes LzmaDec_DecodeToDic(CLzmaDec *p, SizeT dicLimit, -- const Byte *src, SizeT *srcLen, ELzmaFinishMode finishMode, ELzmaStatus *status); -- -- --/* ---------- Buffer Interface ---------- */ -- --/* It's zlib-like interface. -- See LzmaDec_DecodeToDic description for information about STEPS and return results, -- but you must use LzmaDec_DecodeToBuf instead of LzmaDec_DecodeToDic and you don't need -- to work with CLzmaDec variables manually. -- --finishMode: -- It has meaning only if the decoding reaches output limit (*destLen). -- LZMA_FINISH_ANY - Decode just destLen bytes. -- LZMA_FINISH_END - Stream must be finished after (*destLen). --*/ -- --SRes LzmaDec_DecodeToBuf(CLzmaDec *p, Byte *dest, SizeT *destLen, -- const Byte *src, SizeT *srcLen, ELzmaFinishMode finishMode, ELzmaStatus *status); -- -- - /* ---------- One Call Interface ---------- */ - - /* LzmaDecode ---- a/include/linux/lzma/LzmaEnc.h -+++ b/include/linux/lzma/LzmaEnc.h -@@ -31,9 +31,6 @@ typedef struct _CLzmaEncProps - } CLzmaEncProps; - - void LzmaEncProps_Init(CLzmaEncProps *p); --void LzmaEncProps_Normalize(CLzmaEncProps *p); --UInt32 LzmaEncProps_GetDictSize(const CLzmaEncProps *props2); -- - - /* ---------- CLzmaEncHandle Interface ---------- */ - -@@ -53,26 +50,9 @@ CLzmaEncHandle LzmaEnc_Create(ISzAlloc * - void LzmaEnc_Destroy(CLzmaEncHandle p, ISzAlloc *alloc, ISzAlloc *allocBig); - SRes LzmaEnc_SetProps(CLzmaEncHandle p, const CLzmaEncProps *props); - SRes LzmaEnc_WriteProperties(CLzmaEncHandle p, Byte *properties, SizeT *size); --SRes LzmaEnc_Encode(CLzmaEncHandle p, ISeqOutStream *outStream, ISeqInStream *inStream, -- ICompressProgress *progress, ISzAlloc *alloc, ISzAlloc *allocBig); - SRes LzmaEnc_MemEncode(CLzmaEncHandle p, Byte *dest, SizeT *destLen, const Byte *src, SizeT srcLen, - int writeEndMark, ICompressProgress *progress, ISzAlloc *alloc, ISzAlloc *allocBig); - --/* ---------- One Call Interface ---------- */ -- --/* LzmaEncode --Return code: -- SZ_OK - OK -- SZ_ERROR_MEM - Memory allocation error -- SZ_ERROR_PARAM - Incorrect paramater -- SZ_ERROR_OUTPUT_EOF - output buffer overflow -- SZ_ERROR_THREAD - errors in multithreading functions (only for Mt version) --*/ -- --SRes LzmaEncode(Byte *dest, SizeT *destLen, const Byte *src, SizeT srcLen, -- const CLzmaEncProps *props, Byte *propsEncoded, SizeT *propsSize, int writeEndMark, -- ICompressProgress *progress, ISzAlloc *alloc, ISzAlloc *allocBig); -- - #ifdef __cplusplus - } - #endif ---- a/lib/lzma/LzFind.c -+++ b/lib/lzma/LzFind.c -@@ -14,9 +14,15 @@ - - #define kStartMaxLen 3 - -+#if 0 -+#define DIRECT_INPUT p->directInput -+#else -+#define DIRECT_INPUT 1 -+#endif -+ - static void LzInWindow_Free(CMatchFinder *p, ISzAlloc *alloc) - { -- if (!p->directInput) -+ if (!DIRECT_INPUT) - { - alloc->Free(alloc, p->bufferBase); - p->bufferBase = 0; -@@ -28,7 +34,7 @@ static void LzInWindow_Free(CMatchFinder - static int LzInWindow_Create(CMatchFinder *p, UInt32 keepSizeReserv, ISzAlloc *alloc) - { - UInt32 blockSize = p->keepSizeBefore + p->keepSizeAfter + keepSizeReserv; -- if (p->directInput) -+ if (DIRECT_INPUT) - { - p->blockSize = blockSize; - return 1; -@@ -42,12 +48,12 @@ static int LzInWindow_Create(CMatchFinde - return (p->bufferBase != 0); - } - --Byte *MatchFinder_GetPointerToCurrentPos(CMatchFinder *p) { return p->buffer; } --Byte MatchFinder_GetIndexByte(CMatchFinder *p, Int32 index) { return p->buffer[index]; } -+static Byte *MatchFinder_GetPointerToCurrentPos(CMatchFinder *p) { return p->buffer; } -+static Byte MatchFinder_GetIndexByte(CMatchFinder *p, Int32 index) { return p->buffer[index]; } - --UInt32 MatchFinder_GetNumAvailableBytes(CMatchFinder *p) { return p->streamPos - p->pos; } -+static UInt32 MatchFinder_GetNumAvailableBytes(CMatchFinder *p) { return p->streamPos - p->pos; } - --void MatchFinder_ReduceOffsets(CMatchFinder *p, UInt32 subValue) -+static void MatchFinder_ReduceOffsets(CMatchFinder *p, UInt32 subValue) - { - p->posLimit -= subValue; - p->pos -= subValue; -@@ -58,7 +64,7 @@ static void MatchFinder_ReadBlock(CMatch - { - if (p->streamEndWasReached || p->result != SZ_OK) - return; -- if (p->directInput) -+ if (DIRECT_INPUT) - { - UInt32 curSize = 0xFFFFFFFF - p->streamPos; - if (curSize > p->directInputRem) -@@ -89,7 +95,7 @@ static void MatchFinder_ReadBlock(CMatch - } - } - --void MatchFinder_MoveBlock(CMatchFinder *p) -+static void MatchFinder_MoveBlock(CMatchFinder *p) - { - memmove(p->bufferBase, - p->buffer - p->keepSizeBefore, -@@ -97,22 +103,14 @@ void MatchFinder_MoveBlock(CMatchFinder - p->buffer = p->bufferBase + p->keepSizeBefore; - } - --int MatchFinder_NeedMove(CMatchFinder *p) -+static int MatchFinder_NeedMove(CMatchFinder *p) - { -- if (p->directInput) -+ if (DIRECT_INPUT) - return 0; - /* if (p->streamEndWasReached) return 0; */ - return ((size_t)(p->bufferBase + p->blockSize - p->buffer) <= p->keepSizeAfter); - } - --void MatchFinder_ReadIfRequired(CMatchFinder *p) --{ -- if (p->streamEndWasReached) -- return; -- if (p->keepSizeAfter >= p->streamPos - p->pos) -- MatchFinder_ReadBlock(p); --} -- - static void MatchFinder_CheckAndMoveAndRead(CMatchFinder *p) - { - if (MatchFinder_NeedMove(p)) -@@ -268,7 +266,7 @@ static void MatchFinder_SetLimits(CMatch - p->posLimit = p->pos + limit; - } - --void MatchFinder_Init(CMatchFinder *p) -+static void MatchFinder_Init(CMatchFinder *p) - { - UInt32 i; - for (i = 0; i < p->hashSizeSum; i++) -@@ -287,7 +285,7 @@ static UInt32 MatchFinder_GetSubValue(CM - return (p->pos - p->historySize - 1) & kNormalizeMask; - } - --void MatchFinder_Normalize3(UInt32 subValue, CLzRef *items, UInt32 numItems) -+static void MatchFinder_Normalize3(UInt32 subValue, CLzRef *items, UInt32 numItems) - { - UInt32 i; - for (i = 0; i < numItems; i++) -@@ -319,38 +317,7 @@ static void MatchFinder_CheckLimits(CMat - MatchFinder_SetLimits(p); - } - --static UInt32 * Hc_GetMatchesSpec(UInt32 lenLimit, UInt32 curMatch, UInt32 pos, const Byte *cur, CLzRef *son, -- UInt32 _cyclicBufferPos, UInt32 _cyclicBufferSize, UInt32 cutValue, -- UInt32 *distances, UInt32 maxLen) --{ -- son[_cyclicBufferPos] = curMatch; -- for (;;) -- { -- UInt32 delta = pos - curMatch; -- if (cutValue-- == 0 || delta >= _cyclicBufferSize) -- return distances; -- { -- const Byte *pb = cur - delta; -- curMatch = son[_cyclicBufferPos - delta + ((delta > _cyclicBufferPos) ? _cyclicBufferSize : 0)]; -- if (pb[maxLen] == cur[maxLen] && *pb == *cur) -- { -- UInt32 len = 0; -- while (++len != lenLimit) -- if (pb[len] != cur[len]) -- break; -- if (maxLen < len) -- { -- *distances++ = maxLen = len; -- *distances++ = delta - 1; -- if (len == lenLimit) -- return distances; -- } -- } -- } -- } --} -- --UInt32 * GetMatchesSpec1(UInt32 lenLimit, UInt32 curMatch, UInt32 pos, const Byte *cur, CLzRef *son, -+static UInt32 * GetMatchesSpec1(UInt32 lenLimit, UInt32 curMatch, UInt32 pos, const Byte *cur, CLzRef *son, - UInt32 _cyclicBufferPos, UInt32 _cyclicBufferSize, UInt32 cutValue, - UInt32 *distances, UInt32 maxLen) - { -@@ -460,10 +427,10 @@ static void SkipMatchesSpec(UInt32 lenLi - p->buffer++; \ - if (++p->pos == p->posLimit) MatchFinder_CheckLimits(p); - --#define MOVE_POS_RET MOVE_POS return offset; -- - static void MatchFinder_MovePos(CMatchFinder *p) { MOVE_POS; } - -+#define MOVE_POS_RET MatchFinder_MovePos(p); return offset; -+ - #define GET_MATCHES_HEADER2(minLen, ret_op) \ - UInt32 lenLimit; UInt32 hashValue; const Byte *cur; UInt32 curMatch; \ - lenLimit = p->lenLimit; { if (lenLimit < minLen) { MatchFinder_MovePos(p); ret_op; }} \ -@@ -479,62 +446,7 @@ static void MatchFinder_MovePos(CMatchFi - distances + offset, maxLen) - distances); MOVE_POS_RET; - - #define SKIP_FOOTER \ -- SkipMatchesSpec(lenLimit, curMatch, MF_PARAMS(p)); MOVE_POS; -- --static UInt32 Bt2_MatchFinder_GetMatches(CMatchFinder *p, UInt32 *distances) --{ -- UInt32 offset; -- GET_MATCHES_HEADER(2) -- HASH2_CALC; -- curMatch = p->hash[hashValue]; -- p->hash[hashValue] = p->pos; -- offset = 0; -- GET_MATCHES_FOOTER(offset, 1) --} -- --UInt32 Bt3Zip_MatchFinder_GetMatches(CMatchFinder *p, UInt32 *distances) --{ -- UInt32 offset; -- GET_MATCHES_HEADER(3) -- HASH_ZIP_CALC; -- curMatch = p->hash[hashValue]; -- p->hash[hashValue] = p->pos; -- offset = 0; -- GET_MATCHES_FOOTER(offset, 2) --} -- --static UInt32 Bt3_MatchFinder_GetMatches(CMatchFinder *p, UInt32 *distances) --{ -- UInt32 hash2Value, delta2, maxLen, offset; -- GET_MATCHES_HEADER(3) -- -- HASH3_CALC; -- -- delta2 = p->pos - p->hash[hash2Value]; -- curMatch = p->hash[kFix3HashSize + hashValue]; -- -- p->hash[hash2Value] = -- p->hash[kFix3HashSize + hashValue] = p->pos; -- -- -- maxLen = 2; -- offset = 0; -- if (delta2 < p->cyclicBufferSize && *(cur - delta2) == *cur) -- { -- for (; maxLen != lenLimit; maxLen++) -- if (cur[(ptrdiff_t)maxLen - delta2] != cur[maxLen]) -- break; -- distances[0] = maxLen; -- distances[1] = delta2 - 1; -- offset = 2; -- if (maxLen == lenLimit) -- { -- SkipMatchesSpec(lenLimit, curMatch, MF_PARAMS(p)); -- MOVE_POS_RET; -- } -- } -- GET_MATCHES_FOOTER(offset, maxLen) --} -+ SkipMatchesSpec(lenLimit, curMatch, MF_PARAMS(p)); MatchFinder_MovePos(p); - - static UInt32 Bt4_MatchFinder_GetMatches(CMatchFinder *p, UInt32 *distances) - { -@@ -583,108 +495,6 @@ static UInt32 Bt4_MatchFinder_GetMatches - GET_MATCHES_FOOTER(offset, maxLen) - } - --static UInt32 Hc4_MatchFinder_GetMatches(CMatchFinder *p, UInt32 *distances) --{ -- UInt32 hash2Value, hash3Value, delta2, delta3, maxLen, offset; -- GET_MATCHES_HEADER(4) -- -- HASH4_CALC; -- -- delta2 = p->pos - p->hash[ hash2Value]; -- delta3 = p->pos - p->hash[kFix3HashSize + hash3Value]; -- curMatch = p->hash[kFix4HashSize + hashValue]; -- -- p->hash[ hash2Value] = -- p->hash[kFix3HashSize + hash3Value] = -- p->hash[kFix4HashSize + hashValue] = p->pos; -- -- maxLen = 1; -- offset = 0; -- if (delta2 < p->cyclicBufferSize && *(cur - delta2) == *cur) -- { -- distances[0] = maxLen = 2; -- distances[1] = delta2 - 1; -- offset = 2; -- } -- if (delta2 != delta3 && delta3 < p->cyclicBufferSize && *(cur - delta3) == *cur) -- { -- maxLen = 3; -- distances[offset + 1] = delta3 - 1; -- offset += 2; -- delta2 = delta3; -- } -- if (offset != 0) -- { -- for (; maxLen != lenLimit; maxLen++) -- if (cur[(ptrdiff_t)maxLen - delta2] != cur[maxLen]) -- break; -- distances[offset - 2] = maxLen; -- if (maxLen == lenLimit) -- { -- p->son[p->cyclicBufferPos] = curMatch; -- MOVE_POS_RET; -- } -- } -- if (maxLen < 3) -- maxLen = 3; -- offset = (UInt32)(Hc_GetMatchesSpec(lenLimit, curMatch, MF_PARAMS(p), -- distances + offset, maxLen) - (distances)); -- MOVE_POS_RET --} -- --UInt32 Hc3Zip_MatchFinder_GetMatches(CMatchFinder *p, UInt32 *distances) --{ -- UInt32 offset; -- GET_MATCHES_HEADER(3) -- HASH_ZIP_CALC; -- curMatch = p->hash[hashValue]; -- p->hash[hashValue] = p->pos; -- offset = (UInt32)(Hc_GetMatchesSpec(lenLimit, curMatch, MF_PARAMS(p), -- distances, 2) - (distances)); -- MOVE_POS_RET --} -- --static void Bt2_MatchFinder_Skip(CMatchFinder *p, UInt32 num) --{ -- do -- { -- SKIP_HEADER(2) -- HASH2_CALC; -- curMatch = p->hash[hashValue]; -- p->hash[hashValue] = p->pos; -- SKIP_FOOTER -- } -- while (--num != 0); --} -- --void Bt3Zip_MatchFinder_Skip(CMatchFinder *p, UInt32 num) --{ -- do -- { -- SKIP_HEADER(3) -- HASH_ZIP_CALC; -- curMatch = p->hash[hashValue]; -- p->hash[hashValue] = p->pos; -- SKIP_FOOTER -- } -- while (--num != 0); --} -- --static void Bt3_MatchFinder_Skip(CMatchFinder *p, UInt32 num) --{ -- do -- { -- UInt32 hash2Value; -- SKIP_HEADER(3) -- HASH3_CALC; -- curMatch = p->hash[kFix3HashSize + hashValue]; -- p->hash[hash2Value] = -- p->hash[kFix3HashSize + hashValue] = p->pos; -- SKIP_FOOTER -- } -- while (--num != 0); --} -- - static void Bt4_MatchFinder_Skip(CMatchFinder *p, UInt32 num) - { - do -@@ -701,61 +511,12 @@ static void Bt4_MatchFinder_Skip(CMatchF - while (--num != 0); - } - --static void Hc4_MatchFinder_Skip(CMatchFinder *p, UInt32 num) --{ -- do -- { -- UInt32 hash2Value, hash3Value; -- SKIP_HEADER(4) -- HASH4_CALC; -- curMatch = p->hash[kFix4HashSize + hashValue]; -- p->hash[ hash2Value] = -- p->hash[kFix3HashSize + hash3Value] = -- p->hash[kFix4HashSize + hashValue] = p->pos; -- p->son[p->cyclicBufferPos] = curMatch; -- MOVE_POS -- } -- while (--num != 0); --} -- --void Hc3Zip_MatchFinder_Skip(CMatchFinder *p, UInt32 num) --{ -- do -- { -- SKIP_HEADER(3) -- HASH_ZIP_CALC; -- curMatch = p->hash[hashValue]; -- p->hash[hashValue] = p->pos; -- p->son[p->cyclicBufferPos] = curMatch; -- MOVE_POS -- } -- while (--num != 0); --} -- - void MatchFinder_CreateVTable(CMatchFinder *p, IMatchFinder *vTable) - { - vTable->Init = (Mf_Init_Func)MatchFinder_Init; - vTable->GetIndexByte = (Mf_GetIndexByte_Func)MatchFinder_GetIndexByte; - vTable->GetNumAvailableBytes = (Mf_GetNumAvailableBytes_Func)MatchFinder_GetNumAvailableBytes; - vTable->GetPointerToCurrentPos = (Mf_GetPointerToCurrentPos_Func)MatchFinder_GetPointerToCurrentPos; -- if (!p->btMode) -- { -- vTable->GetMatches = (Mf_GetMatches_Func)Hc4_MatchFinder_GetMatches; -- vTable->Skip = (Mf_Skip_Func)Hc4_MatchFinder_Skip; -- } -- else if (p->numHashBytes == 2) -- { -- vTable->GetMatches = (Mf_GetMatches_Func)Bt2_MatchFinder_GetMatches; -- vTable->Skip = (Mf_Skip_Func)Bt2_MatchFinder_Skip; -- } -- else if (p->numHashBytes == 3) -- { -- vTable->GetMatches = (Mf_GetMatches_Func)Bt3_MatchFinder_GetMatches; -- vTable->Skip = (Mf_Skip_Func)Bt3_MatchFinder_Skip; -- } -- else -- { -- vTable->GetMatches = (Mf_GetMatches_Func)Bt4_MatchFinder_GetMatches; -- vTable->Skip = (Mf_Skip_Func)Bt4_MatchFinder_Skip; -- } -+ vTable->GetMatches = (Mf_GetMatches_Func)Bt4_MatchFinder_GetMatches; -+ vTable->Skip = (Mf_Skip_Func)Bt4_MatchFinder_Skip; - } ---- a/lib/lzma/LzmaDec.c -+++ b/lib/lzma/LzmaDec.c -@@ -682,7 +682,7 @@ static void LzmaDec_InitRc(CLzmaDec *p, - p->needFlush = 0; - } - --void LzmaDec_InitDicAndState(CLzmaDec *p, Bool initDic, Bool initState) -+static void LzmaDec_InitDicAndState(CLzmaDec *p, Bool initDic, Bool initState) - { - p->needFlush = 1; - p->remainLen = 0; -@@ -698,7 +698,7 @@ void LzmaDec_InitDicAndState(CLzmaDec *p - p->needInitState = 1; - } - --void LzmaDec_Init(CLzmaDec *p) -+static void LzmaDec_Init(CLzmaDec *p) - { - p->dicPos = 0; - LzmaDec_InitDicAndState(p, True, True); -@@ -716,7 +716,7 @@ static void LzmaDec_InitStateReal(CLzmaD - p->needInitState = 0; - } - --SRes LzmaDec_DecodeToDic(CLzmaDec *p, SizeT dicLimit, const Byte *src, SizeT *srcLen, -+static SRes LzmaDec_DecodeToDic(CLzmaDec *p, SizeT dicLimit, const Byte *src, SizeT *srcLen, - ELzmaFinishMode finishMode, ELzmaStatus *status) - { - SizeT inSize = *srcLen; -@@ -837,65 +837,13 @@ SRes LzmaDec_DecodeToDic(CLzmaDec *p, Si - return (p->code == 0) ? SZ_OK : SZ_ERROR_DATA; - } - --SRes LzmaDec_DecodeToBuf(CLzmaDec *p, Byte *dest, SizeT *destLen, const Byte *src, SizeT *srcLen, ELzmaFinishMode finishMode, ELzmaStatus *status) --{ -- SizeT outSize = *destLen; -- SizeT inSize = *srcLen; -- *srcLen = *destLen = 0; -- for (;;) -- { -- SizeT inSizeCur = inSize, outSizeCur, dicPos; -- ELzmaFinishMode curFinishMode; -- SRes res; -- if (p->dicPos == p->dicBufSize) -- p->dicPos = 0; -- dicPos = p->dicPos; -- if (outSize > p->dicBufSize - dicPos) -- { -- outSizeCur = p->dicBufSize; -- curFinishMode = LZMA_FINISH_ANY; -- } -- else -- { -- outSizeCur = dicPos + outSize; -- curFinishMode = finishMode; -- } -- -- res = LzmaDec_DecodeToDic(p, outSizeCur, src, &inSizeCur, curFinishMode, status); -- src += inSizeCur; -- inSize -= inSizeCur; -- *srcLen += inSizeCur; -- outSizeCur = p->dicPos - dicPos; -- memcpy(dest, p->dic + dicPos, outSizeCur); -- dest += outSizeCur; -- outSize -= outSizeCur; -- *destLen += outSizeCur; -- if (res != 0) -- return res; -- if (outSizeCur == 0 || outSize == 0) -- return SZ_OK; -- } --} -- --void LzmaDec_FreeProbs(CLzmaDec *p, ISzAlloc *alloc) -+static void LzmaDec_FreeProbs(CLzmaDec *p, ISzAlloc *alloc) - { - alloc->Free(alloc, p->probs); - p->probs = 0; - } - --static void LzmaDec_FreeDict(CLzmaDec *p, ISzAlloc *alloc) --{ -- alloc->Free(alloc, p->dic); -- p->dic = 0; --} -- --void LzmaDec_Free(CLzmaDec *p, ISzAlloc *alloc) --{ -- LzmaDec_FreeProbs(p, alloc); -- LzmaDec_FreeDict(p, alloc); --} -- --SRes LzmaProps_Decode(CLzmaProps *p, const Byte *data, unsigned size) -+static SRes LzmaProps_Decode(CLzmaProps *p, const Byte *data, unsigned size) - { - UInt32 dicSize; - Byte d; -@@ -935,7 +883,7 @@ static SRes LzmaDec_AllocateProbs2(CLzma - return SZ_OK; - } - --SRes LzmaDec_AllocateProbs(CLzmaDec *p, const Byte *props, unsigned propsSize, ISzAlloc *alloc) -+static SRes LzmaDec_AllocateProbs(CLzmaDec *p, const Byte *props, unsigned propsSize, ISzAlloc *alloc) - { - CLzmaProps propNew; - RINOK(LzmaProps_Decode(&propNew, props, propsSize)); -@@ -943,28 +891,6 @@ SRes LzmaDec_AllocateProbs(CLzmaDec *p, - p->prop = propNew; - return SZ_OK; - } -- --SRes LzmaDec_Allocate(CLzmaDec *p, const Byte *props, unsigned propsSize, ISzAlloc *alloc) --{ -- CLzmaProps propNew; -- SizeT dicBufSize; -- RINOK(LzmaProps_Decode(&propNew, props, propsSize)); -- RINOK(LzmaDec_AllocateProbs2(p, &propNew, alloc)); -- dicBufSize = propNew.dicSize; -- if (p->dic == 0 || dicBufSize != p->dicBufSize) -- { -- LzmaDec_FreeDict(p, alloc); -- p->dic = (Byte *)alloc->Alloc(alloc, dicBufSize); -- if (p->dic == 0) -- { -- LzmaDec_FreeProbs(p, alloc); -- return SZ_ERROR_MEM; -- } -- } -- p->dicBufSize = dicBufSize; -- p->prop = propNew; -- return SZ_OK; --} - - SRes LzmaDecode(Byte *dest, SizeT *destLen, const Byte *src, SizeT *srcLen, - const Byte *propData, unsigned propSize, ELzmaFinishMode finishMode, ---- a/lib/lzma/LzmaEnc.c -+++ b/lib/lzma/LzmaEnc.c -@@ -53,7 +53,7 @@ void LzmaEncProps_Init(CLzmaEncProps *p) - p->writeEndMark = 0; - } - --void LzmaEncProps_Normalize(CLzmaEncProps *p) -+static void LzmaEncProps_Normalize(CLzmaEncProps *p) - { - int level = p->level; - if (level < 0) level = 5; -@@ -76,7 +76,7 @@ void LzmaEncProps_Normalize(CLzmaEncProp - #endif - } - --UInt32 LzmaEncProps_GetDictSize(const CLzmaEncProps *props2) -+static UInt32 __maybe_unused LzmaEncProps_GetDictSize(const CLzmaEncProps *props2) - { - CLzmaEncProps props = *props2; - LzmaEncProps_Normalize(&props); -@@ -93,7 +93,7 @@ UInt32 LzmaEncProps_GetDictSize(const CL - - #define BSR2_RET(pos, res) { unsigned long i; _BitScanReverse(&i, (pos)); res = (i + i) + ((pos >> (i - 1)) & 1); } - --UInt32 GetPosSlot1(UInt32 pos) -+static UInt32 GetPosSlot1(UInt32 pos) - { - UInt32 res; - BSR2_RET(pos, res); -@@ -107,7 +107,7 @@ UInt32 GetPosSlot1(UInt32 pos) - #define kNumLogBits (9 + (int)sizeof(size_t) / 2) - #define kDicLogSizeMaxCompress ((kNumLogBits - 1) * 2 + 7) - --void LzmaEnc_FastPosInit(Byte *g_FastPos) -+static void LzmaEnc_FastPosInit(Byte *g_FastPos) - { - int c = 2, slotFast; - g_FastPos[0] = 0; -@@ -339,58 +339,6 @@ typedef struct - CSaveState saveState; - } CLzmaEnc; - --void LzmaEnc_SaveState(CLzmaEncHandle pp) --{ -- CLzmaEnc *p = (CLzmaEnc *)pp; -- CSaveState *dest = &p->saveState; -- int i; -- dest->lenEnc = p->lenEnc; -- dest->repLenEnc = p->repLenEnc; -- dest->state = p->state; -- -- for (i = 0; i < kNumStates; i++) -- { -- memcpy(dest->isMatch[i], p->isMatch[i], sizeof(p->isMatch[i])); -- memcpy(dest->isRep0Long[i], p->isRep0Long[i], sizeof(p->isRep0Long[i])); -- } -- for (i = 0; i < kNumLenToPosStates; i++) -- memcpy(dest->posSlotEncoder[i], p->posSlotEncoder[i], sizeof(p->posSlotEncoder[i])); -- memcpy(dest->isRep, p->isRep, sizeof(p->isRep)); -- memcpy(dest->isRepG0, p->isRepG0, sizeof(p->isRepG0)); -- memcpy(dest->isRepG1, p->isRepG1, sizeof(p->isRepG1)); -- memcpy(dest->isRepG2, p->isRepG2, sizeof(p->isRepG2)); -- memcpy(dest->posEncoders, p->posEncoders, sizeof(p->posEncoders)); -- memcpy(dest->posAlignEncoder, p->posAlignEncoder, sizeof(p->posAlignEncoder)); -- memcpy(dest->reps, p->reps, sizeof(p->reps)); -- memcpy(dest->litProbs, p->litProbs, (0x300 << p->lclp) * sizeof(CLzmaProb)); --} -- --void LzmaEnc_RestoreState(CLzmaEncHandle pp) --{ -- CLzmaEnc *dest = (CLzmaEnc *)pp; -- const CSaveState *p = &dest->saveState; -- int i; -- dest->lenEnc = p->lenEnc; -- dest->repLenEnc = p->repLenEnc; -- dest->state = p->state; -- -- for (i = 0; i < kNumStates; i++) -- { -- memcpy(dest->isMatch[i], p->isMatch[i], sizeof(p->isMatch[i])); -- memcpy(dest->isRep0Long[i], p->isRep0Long[i], sizeof(p->isRep0Long[i])); -- } -- for (i = 0; i < kNumLenToPosStates; i++) -- memcpy(dest->posSlotEncoder[i], p->posSlotEncoder[i], sizeof(p->posSlotEncoder[i])); -- memcpy(dest->isRep, p->isRep, sizeof(p->isRep)); -- memcpy(dest->isRepG0, p->isRepG0, sizeof(p->isRepG0)); -- memcpy(dest->isRepG1, p->isRepG1, sizeof(p->isRepG1)); -- memcpy(dest->isRepG2, p->isRepG2, sizeof(p->isRepG2)); -- memcpy(dest->posEncoders, p->posEncoders, sizeof(p->posEncoders)); -- memcpy(dest->posAlignEncoder, p->posAlignEncoder, sizeof(p->posAlignEncoder)); -- memcpy(dest->reps, p->reps, sizeof(p->reps)); -- memcpy(dest->litProbs, p->litProbs, (0x300 << dest->lclp) * sizeof(CLzmaProb)); --} -- - SRes LzmaEnc_SetProps(CLzmaEncHandle pp, const CLzmaEncProps *props2) - { - CLzmaEnc *p = (CLzmaEnc *)pp; -@@ -600,7 +548,7 @@ static void LitEnc_EncodeMatched(CRangeE - while (symbol < 0x10000); - } - --void LzmaEnc_InitPriceTables(UInt32 *ProbPrices) -+static void LzmaEnc_InitPriceTables(UInt32 *ProbPrices) - { - UInt32 i; - for (i = (1 << kNumMoveReducingBits) / 2; i < kBitModelTotal; i += (1 << kNumMoveReducingBits)) -@@ -1676,7 +1624,7 @@ static void FillDistancesPrices(CLzmaEnc - p->matchPriceCount = 0; - } - --void LzmaEnc_Construct(CLzmaEnc *p) -+static void LzmaEnc_Construct(CLzmaEnc *p) - { - RangeEnc_Construct(&p->rc); - MatchFinder_Construct(&p->matchFinderBase); -@@ -1709,7 +1657,7 @@ CLzmaEncHandle LzmaEnc_Create(ISzAlloc * - return p; - } - --void LzmaEnc_FreeLits(CLzmaEnc *p, ISzAlloc *alloc) -+static void LzmaEnc_FreeLits(CLzmaEnc *p, ISzAlloc *alloc) - { - alloc->Free(alloc, p->litProbs); - alloc->Free(alloc, p->saveState.litProbs); -@@ -1717,7 +1665,7 @@ void LzmaEnc_FreeLits(CLzmaEnc *p, ISzAl - p->saveState.litProbs = 0; - } - --void LzmaEnc_Destruct(CLzmaEnc *p, ISzAlloc *alloc, ISzAlloc *allocBig) -+static void LzmaEnc_Destruct(CLzmaEnc *p, ISzAlloc *alloc, ISzAlloc *allocBig) - { - #ifndef _7ZIP_ST - MatchFinderMt_Destruct(&p->matchFinderMt, allocBig); -@@ -1947,7 +1895,7 @@ static SRes LzmaEnc_Alloc(CLzmaEnc *p, U - return SZ_OK; - } - --void LzmaEnc_Init(CLzmaEnc *p) -+static void LzmaEnc_Init(CLzmaEnc *p) - { - UInt32 i; - p->state = 0; -@@ -2005,7 +1953,7 @@ void LzmaEnc_Init(CLzmaEnc *p) - p->lpMask = (1 << p->lp) - 1; - } - --void LzmaEnc_InitPrices(CLzmaEnc *p) -+static void LzmaEnc_InitPrices(CLzmaEnc *p) - { - if (!p->fastMode) - { -@@ -2037,26 +1985,6 @@ static SRes LzmaEnc_AllocAndInit(CLzmaEn - return SZ_OK; - } - --static SRes LzmaEnc_Prepare(CLzmaEncHandle pp, ISeqOutStream *outStream, ISeqInStream *inStream, -- ISzAlloc *alloc, ISzAlloc *allocBig) --{ -- CLzmaEnc *p = (CLzmaEnc *)pp; -- p->matchFinderBase.stream = inStream; -- p->needInit = 1; -- p->rc.outStream = outStream; -- return LzmaEnc_AllocAndInit(p, 0, alloc, allocBig); --} -- --SRes LzmaEnc_PrepareForLzma2(CLzmaEncHandle pp, -- ISeqInStream *inStream, UInt32 keepWindowSize, -- ISzAlloc *alloc, ISzAlloc *allocBig) --{ -- CLzmaEnc *p = (CLzmaEnc *)pp; -- p->matchFinderBase.stream = inStream; -- p->needInit = 1; -- return LzmaEnc_AllocAndInit(p, keepWindowSize, alloc, allocBig); --} -- - static void LzmaEnc_SetInputBuf(CLzmaEnc *p, const Byte *src, SizeT srcLen) - { - p->matchFinderBase.directInput = 1; -@@ -2064,7 +1992,7 @@ static void LzmaEnc_SetInputBuf(CLzmaEnc - p->matchFinderBase.directInputRem = srcLen; - } - --SRes LzmaEnc_MemPrepare(CLzmaEncHandle pp, const Byte *src, SizeT srcLen, -+static SRes LzmaEnc_MemPrepare(CLzmaEncHandle pp, const Byte *src, SizeT srcLen, - UInt32 keepWindowSize, ISzAlloc *alloc, ISzAlloc *allocBig) - { - CLzmaEnc *p = (CLzmaEnc *)pp; -@@ -2074,7 +2002,7 @@ SRes LzmaEnc_MemPrepare(CLzmaEncHandle p - return LzmaEnc_AllocAndInit(p, keepWindowSize, alloc, allocBig); - } - --void LzmaEnc_Finish(CLzmaEncHandle pp) -+static void LzmaEnc_Finish(CLzmaEncHandle pp) - { - #ifndef _7ZIP_ST - CLzmaEnc *p = (CLzmaEnc *)pp; -@@ -2107,53 +2035,6 @@ static size_t MyWrite(void *pp, const vo - return size; - } - -- --UInt32 LzmaEnc_GetNumAvailableBytes(CLzmaEncHandle pp) --{ -- const CLzmaEnc *p = (CLzmaEnc *)pp; -- return p->matchFinder.GetNumAvailableBytes(p->matchFinderObj); --} -- --const Byte *LzmaEnc_GetCurBuf(CLzmaEncHandle pp) --{ -- const CLzmaEnc *p = (CLzmaEnc *)pp; -- return p->matchFinder.GetPointerToCurrentPos(p->matchFinderObj) - p->additionalOffset; --} -- --SRes LzmaEnc_CodeOneMemBlock(CLzmaEncHandle pp, Bool reInit, -- Byte *dest, size_t *destLen, UInt32 desiredPackSize, UInt32 *unpackSize) --{ -- CLzmaEnc *p = (CLzmaEnc *)pp; -- UInt64 nowPos64; -- SRes res; -- CSeqOutStreamBuf outStream; -- -- outStream.funcTable.Write = MyWrite; -- outStream.data = dest; -- outStream.rem = *destLen; -- outStream.overflow = False; -- -- p->writeEndMark = False; -- p->finished = False; -- p->result = SZ_OK; -- -- if (reInit) -- LzmaEnc_Init(p); -- LzmaEnc_InitPrices(p); -- nowPos64 = p->nowPos64; -- RangeEnc_Init(&p->rc); -- p->rc.outStream = &outStream.funcTable; -- -- res = LzmaEnc_CodeOneBlock(p, True, desiredPackSize, *unpackSize); -- -- *unpackSize = (UInt32)(p->nowPos64 - nowPos64); -- *destLen -= outStream.rem; -- if (outStream.overflow) -- return SZ_ERROR_OUTPUT_EOF; -- -- return res; --} -- - static SRes LzmaEnc_Encode2(CLzmaEnc *p, ICompressProgress *progress) - { - SRes res = SZ_OK; -@@ -2184,13 +2065,6 @@ static SRes LzmaEnc_Encode2(CLzmaEnc *p, - return res; - } - --SRes LzmaEnc_Encode(CLzmaEncHandle pp, ISeqOutStream *outStream, ISeqInStream *inStream, ICompressProgress *progress, -- ISzAlloc *alloc, ISzAlloc *allocBig) --{ -- RINOK(LzmaEnc_Prepare(pp, outStream, inStream, alloc, allocBig)); -- return LzmaEnc_Encode2((CLzmaEnc *)pp, progress); --} -- - SRes LzmaEnc_WriteProperties(CLzmaEncHandle pp, Byte *props, SizeT *size) - { - CLzmaEnc *p = (CLzmaEnc *)pp; -@@ -2247,25 +2121,3 @@ SRes LzmaEnc_MemEncode(CLzmaEncHandle pp - return SZ_ERROR_OUTPUT_EOF; - return res; - } -- --SRes LzmaEncode(Byte *dest, SizeT *destLen, const Byte *src, SizeT srcLen, -- const CLzmaEncProps *props, Byte *propsEncoded, SizeT *propsSize, int writeEndMark, -- ICompressProgress *progress, ISzAlloc *alloc, ISzAlloc *allocBig) --{ -- CLzmaEnc *p = (CLzmaEnc *)LzmaEnc_Create(alloc); -- SRes res; -- if (p == 0) -- return SZ_ERROR_MEM; -- -- res = LzmaEnc_SetProps(p, props); -- if (res == SZ_OK) -- { -- res = LzmaEnc_WriteProperties(p, propsEncoded, propsSize); -- if (res == SZ_OK) -- res = LzmaEnc_MemEncode(p, dest, destLen, src, srcLen, -- writeEndMark, progress, alloc, allocBig); -- } -- -- LzmaEnc_Destroy(p, alloc, allocBig); -- return res; --} diff --git a/target/linux/generic/hack-4.19/640-bridge-only-accept-EAP-locally.patch b/target/linux/generic/hack-4.19/640-bridge-only-accept-EAP-locally.patch deleted file mode 100644 index 981d49b9c0..0000000000 --- a/target/linux/generic/hack-4.19/640-bridge-only-accept-EAP-locally.patch +++ /dev/null @@ -1,31 +0,0 @@ -From c6905cfdeb31a5c049db3da434b10fa0d3e83569 Mon Sep 17 00:00:00 2001 -From: Felix Fietkau -Date: Fri, 7 Jul 2017 17:18:54 +0200 -Subject: bridge: only accept EAP locally - -When bridging, do not forward EAP frames to other ports, only deliver -them locally, regardless of the state. - -Signed-off-by: Felix Fietkau ---- - net/bridge/br_input.c | 7 +++++-- - 1 file changed, 5 insertions(+), 2 deletions(-) - ---- a/net/bridge/br_input.c -+++ b/net/bridge/br_input.c -@@ -110,10 +110,14 @@ int br_handle_frame_finish(struct net *n - } - } - -+ BR_INPUT_SKB_CB(skb)->brdev = br->dev; -+ -+ if (skb->protocol == htons(ETH_P_PAE)) -+ return br_pass_frame_up(skb); -+ - if (p->state == BR_STATE_LEARNING) - goto drop; - -- BR_INPUT_SKB_CB(skb)->brdev = br->dev; - BR_INPUT_SKB_CB(skb)->src_port_isolated = !!(p->flags & BR_ISOLATED); - - if (IS_ENABLED(CONFIG_INET) && diff --git a/target/linux/generic/hack-4.19/647-netfilter-flow-acct.patch b/target/linux/generic/hack-4.19/647-netfilter-flow-acct.patch deleted file mode 100644 index 8b13a43fd5..0000000000 --- a/target/linux/generic/hack-4.19/647-netfilter-flow-acct.patch +++ /dev/null @@ -1,70 +0,0 @@ ---- a/include/net/netfilter/nf_flow_table.h -+++ b/include/net/netfilter/nf_flow_table.h -@@ -164,6 +164,8 @@ struct nf_flow_table_hw { - int nf_flow_table_hw_register(const struct nf_flow_table_hw *offload); - void nf_flow_table_hw_unregister(const struct nf_flow_table_hw *offload); - -+void nf_flow_table_acct(struct flow_offload *flow, struct sk_buff *skb, int dir); -+ - extern struct work_struct nf_flow_offload_hw_work; - - #define MODULE_ALIAS_NF_FLOWTABLE(family) \ ---- a/net/netfilter/nf_flow_table_core.c -+++ b/net/netfilter/nf_flow_table_core.c -@@ -11,6 +11,7 @@ - #include - #include - #include -+#include - - struct flow_offload_entry { - struct flow_offload flow; -@@ -148,6 +149,22 @@ void flow_offload_free(struct flow_offlo - } - EXPORT_SYMBOL_GPL(flow_offload_free); - -+void nf_flow_table_acct(struct flow_offload *flow, struct sk_buff *skb, int dir) -+{ -+ struct flow_offload_entry *entry; -+ struct nf_conn_acct *acct; -+ -+ entry = container_of(flow, struct flow_offload_entry, flow); -+ acct = nf_conn_acct_find(entry->ct); -+ if (acct) { -+ struct nf_conn_counter *counter = acct->counter; -+ -+ atomic64_inc(&counter[dir].packets); -+ atomic64_add(skb->len, &counter[dir].bytes); -+ } -+} -+EXPORT_SYMBOL_GPL(nf_flow_table_acct); -+ - static u32 flow_offload_hash(const void *data, u32 len, u32 seed) - { - const struct flow_offload_tuple *tuple = data; ---- a/net/netfilter/nf_flow_table_ip.c -+++ b/net/netfilter/nf_flow_table_ip.c -@@ -11,6 +11,7 @@ - #include - #include - #include -+ - /* For layer 4 checksum field offset. */ - #include - #include -@@ -265,6 +266,7 @@ nf_flow_offload_ip_hook(void *priv, stru - skb->dev = outdev; - nexthop = rt_nexthop(rt, flow->tuplehash[!dir].tuple.src_v4.s_addr); - skb_dst_set_noref(skb, &rt->dst); -+ nf_flow_table_acct(flow, skb, dir); - neigh_xmit(NEIGH_ARP_TABLE, outdev, &nexthop, skb); - - return NF_STOLEN; -@@ -482,6 +484,7 @@ nf_flow_offload_ipv6_hook(void *priv, st - skb->dev = outdev; - nexthop = rt6_nexthop(rt, &flow->tuplehash[!dir].tuple.src_v6); - skb_dst_set_noref(skb, &rt->dst); -+ nf_flow_table_acct(flow, skb, dir); - neigh_xmit(NEIGH_ND_TABLE, outdev, nexthop, skb); - - return NF_STOLEN; diff --git a/target/linux/generic/hack-4.19/650-netfilter-add-xt_OFFLOAD-target.patch b/target/linux/generic/hack-4.19/650-netfilter-add-xt_OFFLOAD-target.patch deleted file mode 100644 index ab1bb6aa81..0000000000 --- a/target/linux/generic/hack-4.19/650-netfilter-add-xt_OFFLOAD-target.patch +++ /dev/null @@ -1,499 +0,0 @@ -From: Felix Fietkau -Date: Tue, 20 Feb 2018 15:56:02 +0100 -Subject: [PATCH] netfilter: add xt_OFFLOAD target - -Signed-off-by: Felix Fietkau ---- - create mode 100644 net/netfilter/xt_OFFLOAD.c - ---- a/net/ipv4/netfilter/Kconfig -+++ b/net/ipv4/netfilter/Kconfig -@@ -63,8 +63,6 @@ config NF_TABLES_ARP - help - This option enables the ARP support for nf_tables. - --endif # NF_TABLES -- - config NF_FLOW_TABLE_IPV4 - tristate "Netfilter flow table IPv4 module" - depends on NF_FLOW_TABLE -@@ -73,6 +71,8 @@ config NF_FLOW_TABLE_IPV4 - - To compile it as a module, choose M here. - -+endif # NF_TABLES -+ - config NF_DUP_IPV4 - tristate "Netfilter IPv4 packet duplication to alternate destination" - depends on !NF_CONNTRACK || NF_CONNTRACK ---- a/net/ipv6/netfilter/Kconfig -+++ b/net/ipv6/netfilter/Kconfig -@@ -80,7 +80,6 @@ config NFT_FIB_IPV6 - multicast or blackhole. - - endif # NF_TABLES_IPV6 --endif # NF_TABLES - - config NF_FLOW_TABLE_IPV6 - tristate "Netfilter flow table IPv6 module" -@@ -90,6 +89,8 @@ config NF_FLOW_TABLE_IPV6 - - To compile it as a module, choose M here. - -+endif # NF_TABLES -+ - config NF_DUP_IPV6 - tristate "Netfilter IPv6 packet duplication to alternate destination" - depends on !NF_CONNTRACK || NF_CONNTRACK ---- a/net/netfilter/Kconfig -+++ b/net/netfilter/Kconfig -@@ -693,8 +693,6 @@ config NFT_FIB_NETDEV - - endif # NF_TABLES_NETDEV - --endif # NF_TABLES -- - config NF_FLOW_TABLE_INET - tristate "Netfilter flow table mixed IPv4/IPv6 module" - depends on NF_FLOW_TABLE -@@ -703,11 +701,12 @@ config NF_FLOW_TABLE_INET - - To compile it as a module, choose M here. - -+endif # NF_TABLES -+ - config NF_FLOW_TABLE - tristate "Netfilter flow table module" - depends on NETFILTER_INGRESS - depends on NF_CONNTRACK -- depends on NF_TABLES - help - This option adds the flow table core infrastructure. - -@@ -996,6 +995,15 @@ config NETFILTER_XT_TARGET_NOTRACK - depends on NETFILTER_ADVANCED - select NETFILTER_XT_TARGET_CT - -+config NETFILTER_XT_TARGET_FLOWOFFLOAD -+ tristate '"FLOWOFFLOAD" target support' -+ depends on NF_FLOW_TABLE -+ depends on NETFILTER_INGRESS -+ help -+ This option adds a `FLOWOFFLOAD' target, which uses the nf_flow_offload -+ module to speed up processing of packets by bypassing the usual -+ netfilter chains -+ - config NETFILTER_XT_TARGET_RATEEST - tristate '"RATEEST" target support' - depends on NETFILTER_ADVANCED ---- a/net/netfilter/Makefile -+++ b/net/netfilter/Makefile -@@ -144,6 +144,7 @@ obj-$(CONFIG_NETFILTER_XT_TARGET_CLASSIF - obj-$(CONFIG_NETFILTER_XT_TARGET_CONNSECMARK) += xt_CONNSECMARK.o - obj-$(CONFIG_NETFILTER_XT_TARGET_CT) += xt_CT.o - obj-$(CONFIG_NETFILTER_XT_TARGET_DSCP) += xt_DSCP.o -+obj-$(CONFIG_NETFILTER_XT_TARGET_FLOWOFFLOAD) += xt_FLOWOFFLOAD.o - obj-$(CONFIG_NETFILTER_XT_TARGET_HL) += xt_HL.o - obj-$(CONFIG_NETFILTER_XT_TARGET_HMARK) += xt_HMARK.o - obj-$(CONFIG_NETFILTER_XT_TARGET_LED) += xt_LED.o ---- /dev/null -+++ b/net/netfilter/xt_FLOWOFFLOAD.c -@@ -0,0 +1,368 @@ -+/* -+ * Copyright (C) 2018 Felix Fietkau -+ * -+ * 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 -+#include -+#include -+#include -+#include -+#include -+#include -+ -+static struct nf_flowtable nf_flowtable; -+static HLIST_HEAD(hooks); -+static DEFINE_SPINLOCK(hooks_lock); -+static struct delayed_work hook_work; -+ -+struct xt_flowoffload_hook { -+ struct hlist_node list; -+ struct nf_hook_ops ops; -+ struct net *net; -+ bool registered; -+ bool used; -+}; -+ -+static unsigned int -+xt_flowoffload_net_hook(void *priv, struct sk_buff *skb, -+ const struct nf_hook_state *state) -+{ -+ switch (skb->protocol) { -+ case htons(ETH_P_IP): -+ return nf_flow_offload_ip_hook(priv, skb, state); -+ case htons(ETH_P_IPV6): -+ return nf_flow_offload_ipv6_hook(priv, skb, state); -+ } -+ -+ return NF_ACCEPT; -+} -+ -+static int -+xt_flowoffload_create_hook(struct net_device *dev) -+{ -+ struct xt_flowoffload_hook *hook; -+ struct nf_hook_ops *ops; -+ -+ hook = kzalloc(sizeof(*hook), GFP_ATOMIC); -+ if (!hook) -+ return -ENOMEM; -+ -+ ops = &hook->ops; -+ ops->pf = NFPROTO_NETDEV; -+ ops->hooknum = NF_NETDEV_INGRESS; -+ ops->priority = 10; -+ ops->priv = &nf_flowtable; -+ ops->hook = xt_flowoffload_net_hook; -+ ops->dev = dev; -+ -+ hlist_add_head(&hook->list, &hooks); -+ mod_delayed_work(system_power_efficient_wq, &hook_work, 0); -+ -+ return 0; -+} -+ -+static struct xt_flowoffload_hook * -+flow_offload_lookup_hook(struct net_device *dev) -+{ -+ struct xt_flowoffload_hook *hook; -+ -+ hlist_for_each_entry(hook, &hooks, list) { -+ if (hook->ops.dev == dev) -+ return hook; -+ } -+ -+ return NULL; -+} -+ -+static void -+xt_flowoffload_check_device(struct net_device *dev) -+{ -+ struct xt_flowoffload_hook *hook; -+ -+ spin_lock_bh(&hooks_lock); -+ hook = flow_offload_lookup_hook(dev); -+ if (hook) -+ hook->used = true; -+ else -+ xt_flowoffload_create_hook(dev); -+ spin_unlock_bh(&hooks_lock); -+} -+ -+static void -+xt_flowoffload_register_hooks(void) -+{ -+ struct xt_flowoffload_hook *hook; -+ -+restart: -+ hlist_for_each_entry(hook, &hooks, list) { -+ if (hook->registered) -+ continue; -+ -+ hook->registered = true; -+ hook->net = dev_net(hook->ops.dev); -+ spin_unlock_bh(&hooks_lock); -+ nf_register_net_hook(hook->net, &hook->ops); -+ spin_lock_bh(&hooks_lock); -+ goto restart; -+ } -+ -+} -+ -+static void -+xt_flowoffload_cleanup_hooks(void) -+{ -+ struct xt_flowoffload_hook *hook; -+ -+restart: -+ hlist_for_each_entry(hook, &hooks, list) { -+ if (hook->used || !hook->registered) -+ continue; -+ -+ hlist_del(&hook->list); -+ spin_unlock_bh(&hooks_lock); -+ nf_unregister_net_hook(hook->net, &hook->ops); -+ kfree(hook); -+ spin_lock_bh(&hooks_lock); -+ goto restart; -+ } -+ -+} -+ -+static void -+xt_flowoffload_check_hook(struct flow_offload *flow, void *data) -+{ -+ struct flow_offload_tuple *tuple = &flow->tuplehash[0].tuple; -+ struct xt_flowoffload_hook *hook; -+ bool *found = data; -+ -+ spin_lock_bh(&hooks_lock); -+ hlist_for_each_entry(hook, &hooks, list) { -+ if (hook->ops.dev->ifindex != tuple->iifidx && -+ hook->ops.dev->ifindex != tuple->oifidx) -+ continue; -+ -+ hook->used = true; -+ *found = true; -+ } -+ spin_unlock_bh(&hooks_lock); -+} -+ -+static void -+xt_flowoffload_hook_work(struct work_struct *work) -+{ -+ struct xt_flowoffload_hook *hook; -+ bool found = false; -+ int err; -+ -+ spin_lock_bh(&hooks_lock); -+ xt_flowoffload_register_hooks(); -+ hlist_for_each_entry(hook, &hooks, list) -+ hook->used = false; -+ spin_unlock_bh(&hooks_lock); -+ -+ err = nf_flow_table_iterate(&nf_flowtable, xt_flowoffload_check_hook, -+ &found); -+ if (err && err != -EAGAIN) -+ goto out; -+ -+ spin_lock_bh(&hooks_lock); -+ xt_flowoffload_cleanup_hooks(); -+ spin_unlock_bh(&hooks_lock); -+ -+out: -+ if (found) -+ queue_delayed_work(system_power_efficient_wq, &hook_work, HZ); -+} -+ -+static bool -+xt_flowoffload_skip(struct sk_buff *skb) -+{ -+ struct ip_options *opt = &(IPCB(skb)->opt); -+ -+ if (unlikely(opt->optlen)) -+ return true; -+ if (skb_sec_path(skb)) -+ return true; -+ -+ return false; -+} -+ -+static struct dst_entry * -+xt_flowoffload_dst(const struct nf_conn *ct, enum ip_conntrack_dir dir, -+ const struct xt_action_param *par) -+{ -+ struct dst_entry *dst = NULL; -+ struct flowi fl; -+ -+ memset(&fl, 0, sizeof(fl)); -+ switch (xt_family(par)) { -+ case NFPROTO_IPV4: -+ fl.u.ip4.daddr = ct->tuplehash[dir].tuple.src.u3.ip; -+ break; -+ case NFPROTO_IPV6: -+ fl.u.ip6.saddr = ct->tuplehash[dir].tuple.dst.u3.in6; -+ fl.u.ip6.daddr = ct->tuplehash[dir].tuple.src.u3.in6; -+ break; -+ } -+ -+ nf_route(xt_net(par), &dst, &fl, false, xt_family(par)); -+ -+ return dst; -+} -+ -+static int -+xt_flowoffload_route(struct sk_buff *skb, const struct nf_conn *ct, -+ const struct xt_action_param *par, -+ struct nf_flow_route *route, enum ip_conntrack_dir dir) -+{ -+ struct dst_entry *this_dst, *other_dst; -+ -+ this_dst = xt_flowoffload_dst(ct, dir, par); -+ other_dst = xt_flowoffload_dst(ct, !dir, par); -+ if (!this_dst || !other_dst) -+ return -ENOENT; -+ -+ if (dst_xfrm(this_dst) || dst_xfrm(other_dst)) -+ return -EINVAL; -+ -+ route->tuple[dir].dst = this_dst; -+ route->tuple[dir].ifindex = xt_in(par)->ifindex; -+ route->tuple[!dir].dst = other_dst; -+ route->tuple[!dir].ifindex = xt_out(par)->ifindex; -+ -+ return 0; -+} -+ -+static unsigned int -+flowoffload_tg(struct sk_buff *skb, const struct xt_action_param *par) -+{ -+ const struct xt_flowoffload_target_info *info = par->targinfo; -+ enum ip_conntrack_info ctinfo; -+ enum ip_conntrack_dir dir; -+ struct nf_flow_route route; -+ struct flow_offload *flow; -+ struct nf_conn *ct; -+ -+ if (xt_flowoffload_skip(skb)) -+ return XT_CONTINUE; -+ -+ ct = nf_ct_get(skb, &ctinfo); -+ if (ct == NULL) -+ return XT_CONTINUE; -+ -+ switch (ct->tuplehash[IP_CT_DIR_ORIGINAL].tuple.dst.protonum) { -+ case IPPROTO_TCP: -+ if (ct->proto.tcp.state != TCP_CONNTRACK_ESTABLISHED) -+ return XT_CONTINUE; -+ break; -+ case IPPROTO_UDP: -+ break; -+ default: -+ return XT_CONTINUE; -+ } -+ -+ if (test_bit(IPS_HELPER_BIT, &ct->status)) -+ return XT_CONTINUE; -+ -+ if (ctinfo == IP_CT_NEW || -+ ctinfo == IP_CT_RELATED) -+ return XT_CONTINUE; -+ -+ if (!xt_in(par) || !xt_out(par)) -+ return XT_CONTINUE; -+ -+ if (test_and_set_bit(IPS_OFFLOAD_BIT, &ct->status)) -+ return XT_CONTINUE; -+ -+ dir = CTINFO2DIR(ctinfo); -+ -+ if (xt_flowoffload_route(skb, ct, par, &route, dir) < 0) -+ goto err_flow_route; -+ -+ flow = flow_offload_alloc(ct, &route); -+ if (!flow) -+ goto err_flow_alloc; -+ -+ if (flow_offload_add(&nf_flowtable, flow) < 0) -+ goto err_flow_add; -+ -+ xt_flowoffload_check_device(xt_in(par)); -+ xt_flowoffload_check_device(xt_out(par)); -+ -+ if (info->flags & XT_FLOWOFFLOAD_HW) -+ nf_flow_offload_hw_add(xt_net(par), flow, ct); -+ -+ return XT_CONTINUE; -+ -+err_flow_add: -+ flow_offload_free(flow); -+err_flow_alloc: -+ dst_release(route.tuple[!dir].dst); -+err_flow_route: -+ clear_bit(IPS_OFFLOAD_BIT, &ct->status); -+ return XT_CONTINUE; -+} -+ -+ -+static int flowoffload_chk(const struct xt_tgchk_param *par) -+{ -+ struct xt_flowoffload_target_info *info = par->targinfo; -+ -+ if (info->flags & ~XT_FLOWOFFLOAD_MASK) -+ return -EINVAL; -+ -+ return 0; -+} -+ -+static struct xt_target offload_tg_reg __read_mostly = { -+ .family = NFPROTO_UNSPEC, -+ .name = "FLOWOFFLOAD", -+ .revision = 0, -+ .targetsize = sizeof(struct xt_flowoffload_target_info), -+ .usersize = sizeof(struct xt_flowoffload_target_info), -+ .checkentry = flowoffload_chk, -+ .target = flowoffload_tg, -+ .me = THIS_MODULE, -+}; -+ -+static int xt_flowoffload_table_init(struct nf_flowtable *table) -+{ -+ table->flags = NF_FLOWTABLE_F_HW; -+ nf_flow_table_init(table); -+ return 0; -+} -+ -+static void xt_flowoffload_table_cleanup(struct nf_flowtable *table) -+{ -+ nf_flow_table_free(table); -+} -+ -+static int __init xt_flowoffload_tg_init(void) -+{ -+ int ret; -+ -+ INIT_DELAYED_WORK(&hook_work, xt_flowoffload_hook_work); -+ -+ ret = xt_flowoffload_table_init(&nf_flowtable); -+ if (ret) -+ return ret; -+ -+ ret = xt_register_target(&offload_tg_reg); -+ if (ret) -+ xt_flowoffload_table_cleanup(&nf_flowtable); -+ -+ return ret; -+} -+ -+static void __exit xt_flowoffload_tg_exit(void) -+{ -+ xt_unregister_target(&offload_tg_reg); -+ xt_flowoffload_table_cleanup(&nf_flowtable); -+} -+ -+MODULE_LICENSE("GPL"); -+module_init(xt_flowoffload_tg_init); -+module_exit(xt_flowoffload_tg_exit); ---- a/net/netfilter/nf_flow_table_core.c -+++ b/net/netfilter/nf_flow_table_core.c -@@ -6,7 +6,6 @@ - #include - #include - #include --#include - #include - #include - #include ---- /dev/null -+++ b/include/uapi/linux/netfilter/xt_FLOWOFFLOAD.h -@@ -0,0 +1,17 @@ -+/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ -+#ifndef _XT_FLOWOFFLOAD_H -+#define _XT_FLOWOFFLOAD_H -+ -+#include -+ -+enum { -+ XT_FLOWOFFLOAD_HW = 1 << 0, -+ -+ XT_FLOWOFFLOAD_MASK = XT_FLOWOFFLOAD_HW -+}; -+ -+struct xt_flowoffload_target_info { -+ __u32 flags; -+}; -+ -+#endif /* _XT_FLOWOFFLOAD_H */ diff --git a/target/linux/generic/hack-4.19/651-wireless_mesh_header.patch b/target/linux/generic/hack-4.19/651-wireless_mesh_header.patch deleted file mode 100644 index 965b431d01..0000000000 --- a/target/linux/generic/hack-4.19/651-wireless_mesh_header.patch +++ /dev/null @@ -1,24 +0,0 @@ -From 6d3bc769657b0ee7c7506dad9911111c4226a7ea Mon Sep 17 00:00:00 2001 -From: Imre Kaloz -Date: Fri, 7 Jul 2017 17:21:05 +0200 -Subject: mac80211: increase wireless mesh header size - -lede-commit 3d4466cfd8f75f717efdb1f96fdde3c70d865fc1 -Signed-off-by: Imre Kaloz ---- - include/linux/netdevice.h | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - ---- a/include/linux/netdevice.h -+++ b/include/linux/netdevice.h -@@ -140,8 +140,8 @@ static inline bool dev_xmit_complete(int - - #if defined(CONFIG_HYPERV_NET) - # define LL_MAX_HEADER 128 --#elif defined(CONFIG_WLAN) || IS_ENABLED(CONFIG_AX25) --# if defined(CONFIG_MAC80211_MESH) -+#elif defined(CONFIG_WLAN) || IS_ENABLED(CONFIG_AX25) || 1 -+# if defined(CONFIG_MAC80211_MESH) || 1 - # define LL_MAX_HEADER 128 - # else - # define LL_MAX_HEADER 96 diff --git a/target/linux/generic/hack-4.19/660-fq_codel_defaults.patch b/target/linux/generic/hack-4.19/660-fq_codel_defaults.patch deleted file mode 100644 index 42698c6451..0000000000 --- a/target/linux/generic/hack-4.19/660-fq_codel_defaults.patch +++ /dev/null @@ -1,27 +0,0 @@ -From a6ccb238939b25851474a279b20367fd24a0e816 Mon Sep 17 00:00:00 2001 -From: Felix Fietkau -Date: Fri, 7 Jul 2017 17:21:53 +0200 -Subject: hack: net: fq_codel: tune defaults for small devices - -Assume that x86_64 devices always have a big memory and do not need this -optimization compared to devices with only 32 MB or 64 MB RAM. - -Signed-off-by: Felix Fietkau ---- - net/sched/sch_fq_codel.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - ---- a/net/sched/sch_fq_codel.c -+++ b/net/sched/sch_fq_codel.c -@@ -474,7 +474,11 @@ static int fq_codel_init(struct Qdisc *s - - sch->limit = 10*1024; - q->flows_cnt = 1024; -+#ifdef CONFIG_X86_64 - q->memory_limit = 32 << 20; /* 32 MBytes */ -+#else -+ q->memory_limit = 4 << 20; /* 4 MBytes */ -+#endif - q->drop_batch_size = 64; - q->quantum = psched_mtu(qdisc_dev(sch)); - INIT_LIST_HEAD(&q->new_flows); diff --git a/target/linux/generic/hack-4.19/661-use_fq_codel_by_default.patch b/target/linux/generic/hack-4.19/661-use_fq_codel_by_default.patch deleted file mode 100644 index ce9d4b14f0..0000000000 --- a/target/linux/generic/hack-4.19/661-use_fq_codel_by_default.patch +++ /dev/null @@ -1,94 +0,0 @@ -From 1d418f7e88035ed7a94073f6354246c66e9193e9 Mon Sep 17 00:00:00 2001 -From: Felix Fietkau -Date: Fri, 7 Jul 2017 17:22:58 +0200 -Subject: fq_codel: switch default qdisc from pfifo_fast to fq_codel and remove pfifo_fast - -Signed-off-by: Felix Fietkau ---- - include/net/sch_generic.h | 3 ++- - net/sched/Kconfig | 3 ++- - net/sched/sch_api.c | 2 +- - net/sched/sch_fq_codel.c | 3 ++- - net/sched/sch_generic.c | 4 ++-- - 5 files changed, 9 insertions(+), 6 deletions(-) - ---- a/include/net/sch_generic.h -+++ b/include/net/sch_generic.h -@@ -486,12 +486,13 @@ extern struct Qdisc_ops noop_qdisc_ops; - extern struct Qdisc_ops pfifo_fast_ops; - extern struct Qdisc_ops mq_qdisc_ops; - extern struct Qdisc_ops noqueue_qdisc_ops; -+extern struct Qdisc_ops fq_codel_qdisc_ops; - extern const struct Qdisc_ops *default_qdisc_ops; - static inline const struct Qdisc_ops * - get_default_qdisc_ops(const struct net_device *dev, int ntx) - { - return ntx < dev->real_num_tx_queues ? -- default_qdisc_ops : &pfifo_fast_ops; -+ default_qdisc_ops : &fq_codel_qdisc_ops; - } - - struct Qdisc_class_common { ---- a/net/sched/Kconfig -+++ b/net/sched/Kconfig -@@ -3,8 +3,9 @@ - # - - menuconfig NET_SCHED -- bool "QoS and/or fair queueing" -+ def_bool y - select NET_SCH_FIFO -+ select NET_SCH_FQ_CODEL - ---help--- - When the kernel has several packets to send out over a network - device, it has to decide which ones to send first, which ones to ---- a/net/sched/sch_api.c -+++ b/net/sched/sch_api.c -@@ -2157,7 +2157,7 @@ static int __init pktsched_init(void) - return err; - } - -- register_qdisc(&pfifo_fast_ops); -+ register_qdisc(&fq_codel_qdisc_ops); - register_qdisc(&pfifo_qdisc_ops); - register_qdisc(&bfifo_qdisc_ops); - register_qdisc(&pfifo_head_drop_qdisc_ops); ---- a/net/sched/sch_fq_codel.c -+++ b/net/sched/sch_fq_codel.c -@@ -716,7 +716,7 @@ static const struct Qdisc_class_ops fq_c - .walk = fq_codel_walk, - }; - --static struct Qdisc_ops fq_codel_qdisc_ops __read_mostly = { -+struct Qdisc_ops fq_codel_qdisc_ops __read_mostly = { - .cl_ops = &fq_codel_class_ops, - .id = "fq_codel", - .priv_size = sizeof(struct fq_codel_sched_data), -@@ -731,6 +731,7 @@ static struct Qdisc_ops fq_codel_qdisc_o - .dump_stats = fq_codel_dump_stats, - .owner = THIS_MODULE, - }; -+EXPORT_SYMBOL(fq_codel_qdisc_ops); - - static int __init fq_codel_module_init(void) - { ---- a/net/sched/sch_generic.c -+++ b/net/sched/sch_generic.c -@@ -35,7 +35,7 @@ - #include - - /* Qdisc to use by default */ --const struct Qdisc_ops *default_qdisc_ops = &pfifo_fast_ops; -+const struct Qdisc_ops *default_qdisc_ops = &fq_codel_qdisc_ops; - EXPORT_SYMBOL(default_qdisc_ops); - - /* Main transmission queue. */ -@@ -1005,7 +1005,7 @@ static void attach_one_default_qdisc(str - void *_unused) - { - struct Qdisc *qdisc; -- const struct Qdisc_ops *ops = default_qdisc_ops; -+ const struct Qdisc_ops *ops = &fq_codel_qdisc_ops; - - if (dev->priv_flags & IFF_NO_QUEUE) - ops = &noqueue_qdisc_ops; diff --git a/target/linux/generic/hack-4.19/662-remove_pfifo_fast.patch b/target/linux/generic/hack-4.19/662-remove_pfifo_fast.patch deleted file mode 100644 index 8f54c516f9..0000000000 --- a/target/linux/generic/hack-4.19/662-remove_pfifo_fast.patch +++ /dev/null @@ -1,221 +0,0 @@ -From b531d492d5ef1cf9dba0f4888eb5fd8624a6d762 Mon Sep 17 00:00:00 2001 -From: Felix Fietkau -Date: Fri, 7 Jul 2017 17:23:42 +0200 -Subject: net: sched: switch default qdisc from pfifo_fast to fq_codel and remove pfifo_fast - -Signed-off-by: Felix Fietkau ---- - net/sched/sch_generic.c | 140 ------------------------------------------------ - 1 file changed, 140 deletions(-) - ---- a/net/sched/sch_generic.c -+++ b/net/sched/sch_generic.c -@@ -595,208 +595,6 @@ struct Qdisc_ops noqueue_qdisc_ops __rea - .owner = THIS_MODULE, - }; - --static const u8 prio2band[TC_PRIO_MAX + 1] = { -- 1, 2, 2, 2, 1, 2, 0, 0 , 1, 1, 1, 1, 1, 1, 1, 1 --}; -- --/* 3-band FIFO queue: old style, but should be a bit faster than -- generic prio+fifo combination. -- */ -- --#define PFIFO_FAST_BANDS 3 -- --/* -- * Private data for a pfifo_fast scheduler containing: -- * - rings for priority bands -- */ --struct pfifo_fast_priv { -- struct skb_array q[PFIFO_FAST_BANDS]; --}; -- --static inline struct skb_array *band2list(struct pfifo_fast_priv *priv, -- int band) --{ -- return &priv->q[band]; --} -- --static int pfifo_fast_enqueue(struct sk_buff *skb, struct Qdisc *qdisc, -- struct sk_buff **to_free) --{ -- int band = prio2band[skb->priority & TC_PRIO_MAX]; -- struct pfifo_fast_priv *priv = qdisc_priv(qdisc); -- struct skb_array *q = band2list(priv, band); -- unsigned int pkt_len = qdisc_pkt_len(skb); -- int err; -- -- err = skb_array_produce(q, skb); -- -- if (unlikely(err)) -- return qdisc_drop_cpu(skb, qdisc, to_free); -- -- qdisc_qstats_cpu_qlen_inc(qdisc); -- /* Note: skb can not be used after skb_array_produce(), -- * so we better not use qdisc_qstats_cpu_backlog_inc() -- */ -- this_cpu_add(qdisc->cpu_qstats->backlog, pkt_len); -- return NET_XMIT_SUCCESS; --} -- --static struct sk_buff *pfifo_fast_dequeue(struct Qdisc *qdisc) --{ -- struct pfifo_fast_priv *priv = qdisc_priv(qdisc); -- struct sk_buff *skb = NULL; -- int band; -- -- for (band = 0; band < PFIFO_FAST_BANDS && !skb; band++) { -- struct skb_array *q = band2list(priv, band); -- -- if (__skb_array_empty(q)) -- continue; -- -- skb = __skb_array_consume(q); -- } -- if (likely(skb)) { -- qdisc_qstats_cpu_backlog_dec(qdisc, skb); -- qdisc_bstats_cpu_update(qdisc, skb); -- qdisc_qstats_cpu_qlen_dec(qdisc); -- } -- -- return skb; --} -- --static struct sk_buff *pfifo_fast_peek(struct Qdisc *qdisc) --{ -- struct pfifo_fast_priv *priv = qdisc_priv(qdisc); -- struct sk_buff *skb = NULL; -- int band; -- -- for (band = 0; band < PFIFO_FAST_BANDS && !skb; band++) { -- struct skb_array *q = band2list(priv, band); -- -- skb = __skb_array_peek(q); -- } -- -- return skb; --} -- --static void pfifo_fast_reset(struct Qdisc *qdisc) --{ -- int i, band; -- struct pfifo_fast_priv *priv = qdisc_priv(qdisc); -- -- for (band = 0; band < PFIFO_FAST_BANDS; band++) { -- struct skb_array *q = band2list(priv, band); -- struct sk_buff *skb; -- -- /* NULL ring is possible if destroy path is due to a failed -- * skb_array_init() in pfifo_fast_init() case. -- */ -- if (!q->ring.queue) -- continue; -- -- while ((skb = __skb_array_consume(q)) != NULL) -- kfree_skb(skb); -- } -- -- for_each_possible_cpu(i) { -- struct gnet_stats_queue *q = per_cpu_ptr(qdisc->cpu_qstats, i); -- -- q->backlog = 0; -- q->qlen = 0; -- } --} -- --static int pfifo_fast_dump(struct Qdisc *qdisc, struct sk_buff *skb) --{ -- struct tc_prio_qopt opt = { .bands = PFIFO_FAST_BANDS }; -- -- memcpy(&opt.priomap, prio2band, TC_PRIO_MAX + 1); -- if (nla_put(skb, TCA_OPTIONS, sizeof(opt), &opt)) -- goto nla_put_failure; -- return skb->len; -- --nla_put_failure: -- return -1; --} -- --static int pfifo_fast_init(struct Qdisc *qdisc, struct nlattr *opt, -- struct netlink_ext_ack *extack) --{ -- unsigned int qlen = qdisc_dev(qdisc)->tx_queue_len; -- struct pfifo_fast_priv *priv = qdisc_priv(qdisc); -- int prio; -- -- /* guard against zero length rings */ -- if (!qlen) -- return -EINVAL; -- -- for (prio = 0; prio < PFIFO_FAST_BANDS; prio++) { -- struct skb_array *q = band2list(priv, prio); -- int err; -- -- err = skb_array_init(q, qlen, GFP_KERNEL); -- if (err) -- return -ENOMEM; -- } -- -- /* Can by-pass the queue discipline */ -- qdisc->flags |= TCQ_F_CAN_BYPASS; -- return 0; --} -- --static void pfifo_fast_destroy(struct Qdisc *sch) --{ -- struct pfifo_fast_priv *priv = qdisc_priv(sch); -- int prio; -- -- for (prio = 0; prio < PFIFO_FAST_BANDS; prio++) { -- struct skb_array *q = band2list(priv, prio); -- -- /* NULL ring is possible if destroy path is due to a failed -- * skb_array_init() in pfifo_fast_init() case. -- */ -- if (!q->ring.queue) -- continue; -- /* Destroy ring but no need to kfree_skb because a call to -- * pfifo_fast_reset() has already done that work. -- */ -- ptr_ring_cleanup(&q->ring, NULL); -- } --} -- --static int pfifo_fast_change_tx_queue_len(struct Qdisc *sch, -- unsigned int new_len) --{ -- struct pfifo_fast_priv *priv = qdisc_priv(sch); -- struct skb_array *bands[PFIFO_FAST_BANDS]; -- int prio; -- -- for (prio = 0; prio < PFIFO_FAST_BANDS; prio++) { -- struct skb_array *q = band2list(priv, prio); -- -- bands[prio] = q; -- } -- -- return skb_array_resize_multiple(bands, PFIFO_FAST_BANDS, new_len, -- GFP_KERNEL); --} -- --struct Qdisc_ops pfifo_fast_ops __read_mostly = { -- .id = "pfifo_fast", -- .priv_size = sizeof(struct pfifo_fast_priv), -- .enqueue = pfifo_fast_enqueue, -- .dequeue = pfifo_fast_dequeue, -- .peek = pfifo_fast_peek, -- .init = pfifo_fast_init, -- .destroy = pfifo_fast_destroy, -- .reset = pfifo_fast_reset, -- .dump = pfifo_fast_dump, -- .change_tx_queue_len = pfifo_fast_change_tx_queue_len, -- .owner = THIS_MODULE, -- .static_flags = TCQ_F_NOLOCK | TCQ_F_CPUSTATS, --}; --EXPORT_SYMBOL(pfifo_fast_ops); -- - static struct lock_class_key qdisc_tx_busylock; - static struct lock_class_key qdisc_running_key; - diff --git a/target/linux/generic/hack-4.19/700-swconfig_switch_drivers.patch b/target/linux/generic/hack-4.19/700-swconfig_switch_drivers.patch deleted file mode 100644 index 9fefb7c2f5..0000000000 --- a/target/linux/generic/hack-4.19/700-swconfig_switch_drivers.patch +++ /dev/null @@ -1,140 +0,0 @@ -From 36e516290611e613aa92996cb4339561452695b4 Mon Sep 17 00:00:00 2001 -From: Felix Fietkau -Date: Fri, 7 Jul 2017 17:24:23 +0200 -Subject: net: swconfig: adds librecmc switch layer - -Signed-off-by: Felix Fietkau ---- - drivers/net/phy/Kconfig | 83 +++++++++++++++++++++++++++++++++++++++++++++++ - drivers/net/phy/Makefile | 15 +++++++++ - include/uapi/linux/Kbuild | 1 + - 3 files changed, 99 insertions(+) - ---- a/drivers/net/phy/Kconfig -+++ b/drivers/net/phy/Kconfig -@@ -209,6 +209,89 @@ config LED_TRIGGER_PHY - for any speed known to the PHY. - - -+comment "Switch configuration API + drivers" -+ -+config SWCONFIG -+ tristate "Switch configuration API" -+ ---help--- -+ Switch configuration API using netlink. This allows -+ you to configure the VLAN features of certain switches. -+ -+config SWCONFIG_LEDS -+ bool "Switch LED trigger support" -+ depends on (SWCONFIG && LEDS_TRIGGERS) -+ -+config ADM6996_PHY -+ tristate "Driver for ADM6996 switches" -+ select SWCONFIG -+ ---help--- -+ Currently supports the ADM6996FC and ADM6996M switches. -+ Support for FC is very limited. -+ -+config AR8216_PHY -+ tristate "Driver for Atheros AR8216 switches" -+ select ETHERNET_PACKET_MANGLE -+ select SWCONFIG -+ -+config AR8216_PHY_LEDS -+ bool "Atheros AR8216 switch LED support" -+ depends on (AR8216_PHY && LEDS_CLASS) -+ -+source "drivers/net/phy/b53/Kconfig" -+ -+config IP17XX_PHY -+ tristate "Driver for IC+ IP17xx switches" -+ select SWCONFIG -+ -+config MVSWITCH_PHY -+ tristate "Driver for Marvell 88E6060 switches" -+ select ETHERNET_PACKET_MANGLE -+ -+config MVSW61XX_PHY -+ tristate "Driver for Marvell 88E6171/6172 switches" -+ select SWCONFIG -+ -+config PSB6970_PHY -+ tristate "Lantiq XWAY Tantos (PSB6970) Ethernet switch" -+ select SWCONFIG -+ select ETHERNET_PACKET_MANGLE -+ -+config RTL8306_PHY -+ tristate "Driver for Realtek RTL8306S switches" -+ select SWCONFIG -+ -+config RTL8366_SMI -+ tristate "Driver for the RTL8366 SMI interface" -+ depends on GPIOLIB -+ ---help--- -+ This module implements the SMI interface protocol which is used -+ by some RTL8366 ethernet switch devices via the generic GPIO API. -+ -+if RTL8366_SMI -+ -+config RTL8366_SMI_DEBUG_FS -+ bool "RTL8366 SMI interface debugfs support" -+ depends on DEBUG_FS -+ default n -+ -+config RTL8366S_PHY -+ tristate "Driver for the Realtek RTL8366S switch" -+ select SWCONFIG -+ -+config RTL8366RB_PHY -+ tristate "Driver for the Realtek RTL8366RB switch" -+ select SWCONFIG -+ -+config RTL8367_PHY -+ tristate "Driver for the Realtek RTL8367R/M switches" -+ select SWCONFIG -+ -+config RTL8367B_PHY -+ tristate "Driver fot the Realtek RTL8367R-VB switch" -+ select SWCONFIG -+ -+endif # RTL8366_SMI -+ - comment "MII PHY device drivers" - - config SFP ---- a/drivers/net/phy/Makefile -+++ b/drivers/net/phy/Makefile -@@ -22,6 +22,21 @@ libphy-$(CONFIG_LED_TRIGGER_PHY) += phy_ - obj-$(CONFIG_PHYLINK) += phylink.o - obj-$(CONFIG_PHYLIB) += libphy.o - -+obj-$(CONFIG_SWCONFIG) += swconfig.o -+obj-$(CONFIG_ADM6996_PHY) += adm6996.o -+obj-$(CONFIG_AR8216_PHY) += ar8216.o ar8327.o -+obj-$(CONFIG_SWCONFIG_B53) += b53/ -+obj-$(CONFIG_IP17XX_PHY) += ip17xx.o -+obj-$(CONFIG_MVSWITCH_PHY) += mvswitch.o -+obj-$(CONFIG_MVSW61XX_PHY) += mvsw61xx.o -+obj-$(CONFIG_PSB6970_PHY) += psb6970.o -+obj-$(CONFIG_RTL8306_PHY) += rtl8306.o -+obj-$(CONFIG_RTL8366_SMI) += rtl8366_smi.o -+obj-$(CONFIG_RTL8366S_PHY) += rtl8366s.o -+obj-$(CONFIG_RTL8366RB_PHY) += rtl8366rb.o -+obj-$(CONFIG_RTL8367_PHY) += rtl8367.o -+obj-$(CONFIG_RTL8367B_PHY) += rtl8367b.o -+ - obj-$(CONFIG_MDIO_BCM_IPROC) += mdio-bcm-iproc.o - obj-$(CONFIG_MDIO_BCM_UNIMAC) += mdio-bcm-unimac.o - obj-$(CONFIG_MDIO_BITBANG) += mdio-bitbang.o ---- a/include/linux/platform_data/b53.h -+++ b/include/linux/platform_data/b53.h -@@ -29,6 +29,9 @@ struct b53_platform_data { - u32 chip_id; - u16 enabled_ports; - -+ /* allow to specify an ethX alias */ -+ const char *alias; -+ - /* only used by MMAP'd driver */ - unsigned big_endian:1; - void __iomem *regs; diff --git a/target/linux/generic/hack-4.19/702-phy_add_aneg_done_function.patch b/target/linux/generic/hack-4.19/702-phy_add_aneg_done_function.patch deleted file mode 100644 index 85ffa1ac1b..0000000000 --- a/target/linux/generic/hack-4.19/702-phy_add_aneg_done_function.patch +++ /dev/null @@ -1,27 +0,0 @@ ---- a/include/linux/phy.h -+++ b/include/linux/phy.h -@@ -548,6 +548,12 @@ struct phy_driver { - /* Determines the negotiated speed and duplex */ - int (*read_status)(struct phy_device *phydev); - -+ /* -+ * Update the value in phydev->link to reflect the -+ * current link value -+ */ -+ int (*update_link)(struct phy_device *phydev); -+ - /* Clears any pending interrupts */ - int (*ack_interrupt)(struct phy_device *phydev); - ---- a/drivers/net/phy/phy_device.c -+++ b/drivers/net/phy/phy_device.c -@@ -1506,6 +1506,9 @@ int genphy_update_link(struct phy_device - { - int status; - -+ if (phydev->drv && phydev->drv->update_link) -+ return phydev->drv->update_link(phydev); -+ - /* Do a fake read */ - status = phy_read(phydev, MII_BMSR); - if (status < 0) diff --git a/target/linux/generic/hack-4.19/721-phy_packets.patch b/target/linux/generic/hack-4.19/721-phy_packets.patch deleted file mode 100644 index 421afbca18..0000000000 --- a/target/linux/generic/hack-4.19/721-phy_packets.patch +++ /dev/null @@ -1,176 +0,0 @@ -From ffe387740bbe88dd88bbe04d6375902708003d6e Mon Sep 17 00:00:00 2001 -From: Felix Fietkau -Date: Fri, 7 Jul 2017 17:25:00 +0200 -Subject: net: add packet mangeling patch - -Signed-off-by: Felix Fietkau ---- - include/linux/netdevice.h | 11 +++++++++++ - include/linux/skbuff.h | 14 ++++---------- - net/Kconfig | 6 ++++++ - net/core/dev.c | 18 ++++++++++++++---- - net/core/skbuff.c | 17 +++++++++++++++++ - net/ethernet/eth.c | 6 ++++++ - 6 files changed, 58 insertions(+), 14 deletions(-) - ---- a/include/linux/netdevice.h -+++ b/include/linux/netdevice.h -@@ -1512,6 +1512,7 @@ enum netdev_priv_flags { - IFF_FAILOVER = 1<<27, - IFF_FAILOVER_SLAVE = 1<<28, - IFF_L3MDEV_RX_HANDLER = 1<<29, -+ IFF_NO_IP_ALIGN = 1<<30, - }; - - #define IFF_802_1Q_VLAN IFF_802_1Q_VLAN -@@ -1543,6 +1544,7 @@ enum netdev_priv_flags { - #define IFF_FAILOVER IFF_FAILOVER - #define IFF_FAILOVER_SLAVE IFF_FAILOVER_SLAVE - #define IFF_L3MDEV_RX_HANDLER IFF_L3MDEV_RX_HANDLER -+#define IFF_NO_IP_ALIGN IFF_NO_IP_ALIGN - - /** - * struct net_device - The DEVICE structure. -@@ -1841,6 +1843,11 @@ struct net_device { - const struct tlsdev_ops *tlsdev_ops; - #endif - -+#ifdef CONFIG_ETHERNET_PACKET_MANGLE -+ void (*eth_mangle_rx)(struct net_device *dev, struct sk_buff *skb); -+ struct sk_buff *(*eth_mangle_tx)(struct net_device *dev, struct sk_buff *skb); -+#endif -+ - const struct header_ops *header_ops; - - unsigned int flags; -@@ -1916,6 +1923,10 @@ struct net_device { - struct mpls_dev __rcu *mpls_ptr; - #endif - -+#ifdef CONFIG_ETHERNET_PACKET_MANGLE -+ void *phy_ptr; /* PHY device specific data */ -+#endif -+ - /* - * Cache lines mostly used on receive path (including eth_type_trans()) - */ ---- a/include/linux/skbuff.h -+++ b/include/linux/skbuff.h -@@ -2527,6 +2527,10 @@ static inline int pskb_trim(struct sk_bu - return (len < skb->len) ? __pskb_trim(skb, len) : 0; - } - -+extern struct sk_buff *__netdev_alloc_skb_ip_align(struct net_device *dev, -+ unsigned int length, gfp_t gfp); -+ -+ - /** - * pskb_trim_unique - remove end from a paged unique (not cloned) buffer - * @skb: buffer to alter -@@ -2657,16 +2661,6 @@ static inline struct sk_buff *dev_alloc_ - } - - --static inline struct sk_buff *__netdev_alloc_skb_ip_align(struct net_device *dev, -- unsigned int length, gfp_t gfp) --{ -- struct sk_buff *skb = __netdev_alloc_skb(dev, length + NET_IP_ALIGN, gfp); -- -- if (NET_IP_ALIGN && skb) -- skb_reserve(skb, NET_IP_ALIGN); -- return skb; --} -- - static inline struct sk_buff *netdev_alloc_skb_ip_align(struct net_device *dev, - unsigned int length) - { ---- a/net/Kconfig -+++ b/net/Kconfig -@@ -25,6 +25,12 @@ menuconfig NET - - if NET - -+config ETHERNET_PACKET_MANGLE -+ bool -+ help -+ This option can be selected by phy drivers that need to mangle -+ packets going in or out of an ethernet device. -+ - config WANT_COMPAT_NETLINK_MESSAGES - bool - help ---- a/net/core/dev.c -+++ b/net/core/dev.c -@@ -3238,10 +3238,20 @@ static int xmit_one(struct sk_buff *skb, - if (!list_empty(&ptype_all) || !list_empty(&dev->ptype_all)) - dev_queue_xmit_nit(skb, dev); - -- len = skb->len; -- trace_net_dev_start_xmit(skb, dev); -- rc = netdev_start_xmit(skb, dev, txq, more); -- trace_net_dev_xmit(skb, rc, dev, len); -+#ifdef CONFIG_ETHERNET_PACKET_MANGLE -+ if (!dev->eth_mangle_tx || -+ (skb = dev->eth_mangle_tx(dev, skb)) != NULL) -+#else -+ if (1) -+#endif -+ { -+ len = skb->len; -+ trace_net_dev_start_xmit(skb, dev); -+ rc = netdev_start_xmit(skb, dev, txq, more); -+ trace_net_dev_xmit(skb, rc, dev, len); -+ } else { -+ rc = NETDEV_TX_OK; -+ } - - return rc; - } ---- a/net/core/skbuff.c -+++ b/net/core/skbuff.c -@@ -63,6 +63,7 @@ - #include - #include - #include -+#include - - #include - #include -@@ -503,6 +504,22 @@ skb_fail: - } - EXPORT_SYMBOL(__napi_alloc_skb); - -+struct sk_buff *__netdev_alloc_skb_ip_align(struct net_device *dev, -+ unsigned int length, gfp_t gfp) -+{ -+ struct sk_buff *skb = __netdev_alloc_skb(dev, length + NET_IP_ALIGN, gfp); -+ -+#ifdef CONFIG_ETHERNET_PACKET_MANGLE -+ if (dev && (dev->priv_flags & IFF_NO_IP_ALIGN)) -+ return skb; -+#endif -+ -+ if (NET_IP_ALIGN && skb) -+ skb_reserve(skb, NET_IP_ALIGN); -+ return skb; -+} -+EXPORT_SYMBOL(__netdev_alloc_skb_ip_align); -+ - void skb_add_rx_frag(struct sk_buff *skb, int i, struct page *page, int off, - int size, unsigned int truesize) - { ---- a/net/ethernet/eth.c -+++ b/net/ethernet/eth.c -@@ -172,6 +172,12 @@ __be16 eth_type_trans(struct sk_buff *sk - const struct ethhdr *eth; - - skb->dev = dev; -+ -+#ifdef CONFIG_ETHERNET_PACKET_MANGLE -+ if (dev->eth_mangle_rx) -+ dev->eth_mangle_rx(dev, skb); -+#endif -+ - skb_reset_mac_header(skb); - - eth = (struct ethhdr *)skb->data; diff --git a/target/linux/generic/hack-4.19/773-bgmac-add-srab-switch.patch b/target/linux/generic/hack-4.19/773-bgmac-add-srab-switch.patch deleted file mode 100644 index 3b4781657e..0000000000 --- a/target/linux/generic/hack-4.19/773-bgmac-add-srab-switch.patch +++ /dev/null @@ -1,98 +0,0 @@ -From 3cb240533ab787899dc7f17aa7d6c5b4810e2e58 Mon Sep 17 00:00:00 2001 -From: Hauke Mehrtens -Date: Fri, 7 Jul 2017 17:26:01 +0200 -Subject: bcm53xx: bgmac: use srab switch driver - -use the srab switch driver on these SoCs. - -Signed-off-by: Hauke Mehrtens ---- - drivers/net/ethernet/broadcom/bgmac-bcma.c | 1 + - drivers/net/ethernet/broadcom/bgmac.c | 24 ++++++++++++++++++++++++ - drivers/net/ethernet/broadcom/bgmac.h | 4 ++++ - 3 files changed, 29 insertions(+) - ---- a/drivers/net/ethernet/broadcom/bgmac-bcma.c -+++ b/drivers/net/ethernet/broadcom/bgmac-bcma.c -@@ -268,6 +268,7 @@ static int bgmac_probe(struct bcma_devic - bgmac->feature_flags |= BGMAC_FEAT_CLKCTLST; - bgmac->feature_flags |= BGMAC_FEAT_NO_RESET; - bgmac->feature_flags |= BGMAC_FEAT_FORCE_SPEED_2500; -+ bgmac->feature_flags |= BGMAC_FEAT_SRAB; - break; - default: - bgmac->feature_flags |= BGMAC_FEAT_CLKCTLST; ---- a/drivers/net/ethernet/broadcom/bgmac.c -+++ b/drivers/net/ethernet/broadcom/bgmac.c -@@ -12,6 +12,7 @@ - #include - #include - #include -+#include - #include - #include - #include -@@ -1409,6 +1410,17 @@ static const struct ethtool_ops bgmac_et - .set_link_ksettings = phy_ethtool_set_link_ksettings, - }; - -+static struct b53_platform_data bgmac_b53_pdata = { -+}; -+ -+static struct platform_device bgmac_b53_dev = { -+ .name = "b53-srab-switch", -+ .id = -1, -+ .dev = { -+ .platform_data = &bgmac_b53_pdata, -+ }, -+}; -+ - /************************************************** - * MII - **************************************************/ -@@ -1540,6 +1552,14 @@ int bgmac_enet_probe(struct bgmac *bgmac - net_dev->hw_features = net_dev->features; - net_dev->vlan_features = net_dev->features; - -+ if ((bgmac->feature_flags & BGMAC_FEAT_SRAB) && !bgmac_b53_pdata.regs) { -+ bgmac_b53_pdata.regs = ioremap_nocache(0x18007000, 0x1000); -+ -+ err = platform_device_register(&bgmac_b53_dev); -+ if (!err) -+ bgmac->b53_device = &bgmac_b53_dev; -+ } -+ - err = register_netdev(bgmac->net_dev); - if (err) { - dev_err(bgmac->dev, "Cannot register net device\n"); -@@ -1562,6 +1582,10 @@ EXPORT_SYMBOL_GPL(bgmac_enet_probe); - - void bgmac_enet_remove(struct bgmac *bgmac) - { -+ if (bgmac->b53_device) -+ platform_device_unregister(&bgmac_b53_dev); -+ bgmac->b53_device = NULL; -+ - unregister_netdev(bgmac->net_dev); - phy_disconnect(bgmac->net_dev->phydev); - netif_napi_del(&bgmac->napi); ---- a/drivers/net/ethernet/broadcom/bgmac.h -+++ b/drivers/net/ethernet/broadcom/bgmac.h -@@ -427,6 +427,7 @@ - #define BGMAC_FEAT_CC4_IF_SW_TYPE_RGMII BIT(18) - #define BGMAC_FEAT_CC7_IF_TYPE_RGMII BIT(19) - #define BGMAC_FEAT_IDM_MASK BIT(20) -+#define BGMAC_FEAT_SRAB BIT(21) - - struct bgmac_slot_info { - union { -@@ -532,6 +533,9 @@ struct bgmac { - void (*cmn_maskset32)(struct bgmac *bgmac, u16 offset, u32 mask, - u32 set); - int (*phy_connect)(struct bgmac *bgmac); -+ -+ /* platform device for associated switch */ -+ struct platform_device *b53_device; - }; - - struct bgmac *bgmac_alloc(struct device *dev); diff --git a/target/linux/generic/hack-4.19/835-misc-owl_loader.patch b/target/linux/generic/hack-4.19/835-misc-owl_loader.patch deleted file mode 100644 index bf0fa596ac..0000000000 --- a/target/linux/generic/hack-4.19/835-misc-owl_loader.patch +++ /dev/null @@ -1,52 +0,0 @@ -From dd36f935973d91644449bd9749f6062a2bed821b Mon Sep 17 00:00:00 2001 -From: Christian Lamparter -Date: Fri, 7 Jul 2017 17:26:46 +0200 -Subject: misc: owl-loader for delayed Atheros ath9k fixup - -Some devices (like the Cisco Meraki Z1 Cloud Managed Teleworker Gateway) -need to be able to initialize the PCIe wifi device. Normally, this is done -during the early stages of booting linux, because the necessary init code -is read from the memory mapped SPI and passed to pci_enable_ath9k_fixup. -However,this isn't possible for devices which have the init code for the -Atheros chip stored on NAND in an UBI volume. Hence, this module can be -used to initialze the chip when the user-space is ready to extract the -init code. - -Signed-off-by: Martin Blumenstingl -Signed-off-by: Christian Lamparter ---- - drivers/misc/Kconfig | 12 ++++++++++++ - drivers/misc/Makefile | 1 + - 2 files changed, 13 insertions(+) - ---- a/drivers/misc/Kconfig -+++ b/drivers/misc/Kconfig -@@ -164,6 +164,18 @@ config SGI_IOC4 - If you have an SGI Altix with an IOC4-based card say Y. - Otherwise say N. - -+config OWL_LOADER -+ tristate "Owl loader for initializing Atheros PCI(e) Wifi chips" -+ depends on PCI -+ ---help--- -+ This kernel module helps to initialize certain Qualcomm -+ Atheros' PCI(e) Wifi chips, which have the init data -+ (which contains the PCI device ID for example) stored -+ together with the calibration data in the file system. -+ -+ This is necessary for devices like the Cisco Meraki Z1, say M. -+ Otherwise say N. -+ - config TIFM_CORE - tristate "TI Flash Media interface support" - depends on PCI ---- a/drivers/misc/Makefile -+++ b/drivers/misc/Makefile -@@ -14,6 +14,7 @@ obj-$(CONFIG_ATMEL_TCLIB) += atmel_tclib - obj-$(CONFIG_DUMMY_IRQ) += dummy-irq.o - obj-$(CONFIG_ICS932S401) += ics932s401.o - obj-$(CONFIG_LKDTM) += lkdtm/ -+obj-$(CONFIG_OWL_LOADER) += owl-loader.o - obj-$(CONFIG_TIFM_CORE) += tifm_core.o - obj-$(CONFIG_TIFM_7XX1) += tifm_7xx1.o - obj-$(CONFIG_PHANTOM) += phantom.o diff --git a/target/linux/generic/hack-4.19/901-debloat_sock_diag.patch b/target/linux/generic/hack-4.19/901-debloat_sock_diag.patch deleted file mode 100644 index 33c8b72317..0000000000 --- a/target/linux/generic/hack-4.19/901-debloat_sock_diag.patch +++ /dev/null @@ -1,136 +0,0 @@ -From 3b6115d6b57a263bdc8c9b1df273bd4a7955eead Mon Sep 17 00:00:00 2001 -From: Felix Fietkau -Date: Sat, 8 Jul 2017 08:16:31 +0200 -Subject: debloat: add some debloat patches, strip down procfs and make O_DIRECT support optional, saves ~15K after lzma on MIPS - -Signed-off-by: Felix Fietkau ---- - net/Kconfig | 3 +++ - net/core/Makefile | 3 ++- - net/core/sock.c | 2 ++ - net/ipv4/Kconfig | 1 + - net/netlink/Kconfig | 1 + - net/packet/Kconfig | 1 + - net/unix/Kconfig | 1 + - 7 files changed, 11 insertions(+), 1 deletion(-) - ---- a/net/Kconfig -+++ b/net/Kconfig -@@ -98,6 +98,9 @@ source "net/netlabel/Kconfig" - - endif # if INET - -+config SOCK_DIAG -+ bool -+ - config NETWORK_SECMARK - bool "Security Marking" - help ---- a/net/core/Makefile -+++ b/net/core/Makefile -@@ -10,9 +10,10 @@ obj-$(CONFIG_SYSCTL) += sysctl_net_core. - - obj-y += dev.o ethtool.o dev_addr_lists.o dst.o netevent.o \ - neighbour.o rtnetlink.o utils.o link_watch.o filter.o \ -- sock_diag.o dev_ioctl.o tso.o sock_reuseport.o \ -+ dev_ioctl.o tso.o sock_reuseport.o \ - fib_notifier.o xdp.o - -+obj-$(CONFIG_SOCK_DIAG) += sock_diag.o - obj-y += net-sysfs.o - obj-$(CONFIG_PAGE_POOL) += page_pool.o - obj-$(CONFIG_PROC_FS) += net-procfs.o ---- a/net/core/sock.c -+++ b/net/core/sock.c -@@ -490,6 +490,18 @@ discard_and_relse: - } - EXPORT_SYMBOL(__sk_receive_skb); - -+u64 sock_gen_cookie(struct sock *sk) -+{ -+ while (1) { -+ u64 res = atomic64_read(&sk->sk_cookie); -+ -+ if (res) -+ return res; -+ res = atomic64_inc_return(&sock_net(sk)->cookie_gen); -+ atomic64_cmpxchg(&sk->sk_cookie, 0, res); -+ } -+} -+ - struct dst_entry *__sk_dst_check(struct sock *sk, u32 cookie) - { - struct dst_entry *dst = __sk_dst_get(sk); -@@ -1601,9 +1613,11 @@ static void __sk_free(struct sock *sk) - if (likely(sk->sk_net_refcnt)) - sock_inuse_add(sock_net(sk), -1); - -+#ifdef CONFIG_SOCK_DIAG - if (unlikely(sk->sk_net_refcnt && sock_diag_has_destroy_listeners(sk))) - sock_diag_broadcast_destroy(sk); - else -+#endif - sk_destruct(sk); - } - ---- a/net/core/sock_diag.c -+++ b/net/core/sock_diag.c -@@ -20,18 +20,6 @@ static int (*inet_rcv_compat)(struct sk_ - static DEFINE_MUTEX(sock_diag_table_mutex); - static struct workqueue_struct *broadcast_wq; - --u64 sock_gen_cookie(struct sock *sk) --{ -- while (1) { -- u64 res = atomic64_read(&sk->sk_cookie); -- -- if (res) -- return res; -- res = atomic64_inc_return(&sock_net(sk)->cookie_gen); -- atomic64_cmpxchg(&sk->sk_cookie, 0, res); -- } --} -- - int sock_diag_check_cookie(struct sock *sk, const __u32 *cookie) - { - u64 res; ---- a/net/ipv4/Kconfig -+++ b/net/ipv4/Kconfig -@@ -425,6 +425,7 @@ config INET_XFRM_MODE_BEET - - config INET_DIAG - tristate "INET: socket monitoring interface" -+ select SOCK_DIAG - default y - ---help--- - Support for INET (TCP, DCCP, etc) socket monitoring interface used by ---- a/net/netlink/Kconfig -+++ b/net/netlink/Kconfig -@@ -4,6 +4,7 @@ - - config NETLINK_DIAG - tristate "NETLINK: socket monitoring interface" -+ select SOCK_DIAG - default n - ---help--- - Support for NETLINK socket monitoring interface used by the ss tool. ---- a/net/packet/Kconfig -+++ b/net/packet/Kconfig -@@ -18,6 +18,7 @@ config PACKET - config PACKET_DIAG - tristate "Packet: sockets monitoring interface" - depends on PACKET -+ select SOCK_DIAG - default n - ---help--- - Support for PF_PACKET sockets monitoring interface used by the ss tool. ---- a/net/unix/Kconfig -+++ b/net/unix/Kconfig -@@ -22,6 +22,7 @@ config UNIX - config UNIX_DIAG - tristate "UNIX: socket monitoring interface" - depends on UNIX -+ select SOCK_DIAG - default n - ---help--- - Support for UNIX socket monitoring interface used by the ss tool. diff --git a/target/linux/generic/hack-4.19/902-debloat_proc.patch b/target/linux/generic/hack-4.19/902-debloat_proc.patch deleted file mode 100644 index 018efda8f7..0000000000 --- a/target/linux/generic/hack-4.19/902-debloat_proc.patch +++ /dev/null @@ -1,405 +0,0 @@ -From 9e3f1d0805b2d919904dd9a4ff0d956314cc3cba Mon Sep 17 00:00:00 2001 -From: Felix Fietkau -Date: Sat, 8 Jul 2017 08:20:09 +0200 -Subject: debloat: procfs - -Signed-off-by: Felix Fietkau ---- - fs/locks.c | 2 ++ - fs/proc/Kconfig | 5 +++++ - fs/proc/consoles.c | 3 +++ - fs/proc/proc_tty.c | 11 ++++++++++- - include/net/snmp.h | 18 +++++++++++++++++- - ipc/msg.c | 3 +++ - ipc/sem.c | 2 ++ - ipc/shm.c | 2 ++ - ipc/util.c | 3 +++ - kernel/exec_domain.c | 2 ++ - kernel/irq/proc.c | 9 +++++++++ - kernel/time/timer_list.c | 2 ++ - mm/vmalloc.c | 2 ++ - mm/vmstat.c | 8 +++++--- - net/8021q/vlanproc.c | 6 ++++++ - net/core/net-procfs.c | 18 ++++++++++++------ - net/core/sock.c | 2 ++ - net/ipv4/fib_trie.c | 18 ++++++++++++------ - net/ipv4/proc.c | 3 +++ - net/ipv4/route.c | 3 +++ - 20 files changed, 105 insertions(+), 17 deletions(-) - ---- a/fs/locks.c -+++ b/fs/locks.c -@@ -2786,6 +2786,8 @@ static const struct seq_operations locks - - static int __init proc_locks_init(void) - { -+ if (IS_ENABLED(CONFIG_PROC_STRIPPED)) -+ return 0; - proc_create_seq_private("locks", 0, NULL, &locks_seq_operations, - sizeof(struct locks_iterator), NULL); - return 0; ---- a/fs/proc/Kconfig -+++ b/fs/proc/Kconfig -@@ -97,3 +97,8 @@ config PROC_CHILDREN - - Say Y if you are running any user-space software which takes benefit from - this interface. For example, rkt is such a piece of software. -+ -+config PROC_STRIPPED -+ default n -+ depends on EXPERT -+ bool "Strip non-essential /proc functionality to reduce code size" ---- a/fs/proc/consoles.c -+++ b/fs/proc/consoles.c -@@ -93,6 +93,9 @@ static const struct seq_operations conso - - static int __init proc_consoles_init(void) - { -+ if (IS_ENABLED(CONFIG_PROC_STRIPPED)) -+ return 0; -+ - proc_create_seq("consoles", 0, NULL, &consoles_op); - return 0; - } ---- a/fs/proc/proc_tty.c -+++ b/fs/proc/proc_tty.c -@@ -133,7 +133,10 @@ static const struct seq_operations tty_d - void proc_tty_register_driver(struct tty_driver *driver) - { - struct proc_dir_entry *ent; -- -+ -+ if (IS_ENABLED(CONFIG_PROC_STRIPPED)) -+ return; -+ - if (!driver->driver_name || driver->proc_entry || - !driver->ops->proc_show) - return; -@@ -150,6 +153,9 @@ void proc_tty_unregister_driver(struct t - { - struct proc_dir_entry *ent; - -+ if (IS_ENABLED(CONFIG_PROC_STRIPPED)) -+ return; -+ - ent = driver->proc_entry; - if (!ent) - return; -@@ -164,6 +170,9 @@ void proc_tty_unregister_driver(struct t - */ - void __init proc_tty_init(void) - { -+ if (IS_ENABLED(CONFIG_PROC_STRIPPED)) -+ return; -+ - if (!proc_mkdir("tty", NULL)) - return; - proc_mkdir("tty/ldisc", NULL); /* Preserved: it's userspace visible */ ---- a/include/net/snmp.h -+++ b/include/net/snmp.h -@@ -123,6 +123,21 @@ struct linux_xfrm_mib { - #define DECLARE_SNMP_STAT(type, name) \ - extern __typeof__(type) __percpu *name - -+#ifdef CONFIG_PROC_STRIPPED -+#define __SNMP_STATS_DUMMY(mib) \ -+ do { (void) mib->mibs[0]; } while(0) -+ -+#define __SNMP_INC_STATS(mib, field) __SNMP_STATS_DUMMY(mib) -+#define SNMP_INC_STATS_ATOMIC_LONG(mib, field) __SNMP_STATS_DUMMY(mib) -+#define SNMP_INC_STATS(mib, field) __SNMP_STATS_DUMMY(mib) -+#define SNMP_DEC_STATS(mib, field) __SNMP_STATS_DUMMY(mib) -+#define __SNMP_ADD_STATS(mib, field, addend) __SNMP_STATS_DUMMY(mib) -+#define SNMP_ADD_STATS(mib, field, addend) __SNMP_STATS_DUMMY(mib) -+#define SNMP_UPD_PO_STATS(mib, basefield, addend) __SNMP_STATS_DUMMY(mib) -+#define __SNMP_UPD_PO_STATS(mib, basefield, addend) __SNMP_STATS_DUMMY(mib) -+ -+#else -+ - #define __SNMP_INC_STATS(mib, field) \ - __this_cpu_inc(mib->mibs[field]) - -@@ -153,8 +168,9 @@ struct linux_xfrm_mib { - __this_cpu_add(ptr[basefield##OCTETS], addend); \ - } while (0) - -+#endif - --#if BITS_PER_LONG==32 -+#if (BITS_PER_LONG==32) && !defined(CONFIG_PROC_STRIPPED) - - #define __SNMP_ADD_STATS64(mib, field, addend) \ - do { \ ---- a/ipc/msg.c -+++ b/ipc/msg.c -@@ -1291,6 +1291,9 @@ void __init msg_init(void) - { - msg_init_ns(&init_ipc_ns); - -+ if (IS_ENABLED(CONFIG_PROC_STRIPPED)) -+ return; -+ - ipc_init_proc_interface("sysvipc/msg", - " key msqid perms cbytes qnum lspid lrpid uid gid cuid cgid stime rtime ctime\n", - IPC_MSG_IDS, sysvipc_msg_proc_show); ---- a/ipc/sem.c -+++ b/ipc/sem.c -@@ -243,6 +243,8 @@ void sem_exit_ns(struct ipc_namespace *n - void __init sem_init(void) - { - sem_init_ns(&init_ipc_ns); -+ if (IS_ENABLED(CONFIG_PROC_STRIPPED)) -+ return; - ipc_init_proc_interface("sysvipc/sem", - " key semid perms nsems uid gid cuid cgid otime ctime\n", - IPC_SEM_IDS, sysvipc_sem_proc_show); ---- a/ipc/shm.c -+++ b/ipc/shm.c -@@ -144,6 +144,8 @@ pure_initcall(ipc_ns_init); - - void __init shm_init(void) - { -+ if (IS_ENABLED(CONFIG_PROC_STRIPPED)) -+ return; - ipc_init_proc_interface("sysvipc/shm", - #if BITS_PER_LONG <= 32 - " key shmid perms size cpid lpid nattch uid gid cuid cgid atime dtime ctime rss swap\n", ---- a/ipc/util.c -+++ b/ipc/util.c -@@ -140,6 +140,9 @@ void __init ipc_init_proc_interface(cons - struct proc_dir_entry *pde; - struct ipc_proc_iface *iface; - -+ if (IS_ENABLED(CONFIG_PROC_STRIPPED)) -+ return; -+ - iface = kmalloc(sizeof(*iface), GFP_KERNEL); - if (!iface) - return; ---- a/kernel/exec_domain.c -+++ b/kernel/exec_domain.c -@@ -29,6 +29,8 @@ static int execdomains_proc_show(struct - - static int __init proc_execdomains_init(void) - { -+ if (IS_ENABLED(CONFIG_PROC_STRIPPED)) -+ return 0; - proc_create_single("execdomains", 0, NULL, execdomains_proc_show); - return 0; - } ---- a/kernel/irq/proc.c -+++ b/kernel/irq/proc.c -@@ -333,6 +333,9 @@ void register_irq_proc(unsigned int irq, - void __maybe_unused *irqp = (void *)(unsigned long) irq; - char name [MAX_NAMELEN]; - -+ if (IS_ENABLED(CONFIG_PROC_STRIPPED) && !IS_ENABLED(CONFIG_SMP)) -+ return; -+ - if (!root_irq_dir || (desc->irq_data.chip == &no_irq_chip)) - return; - -@@ -386,6 +389,9 @@ void unregister_irq_proc(unsigned int ir - { - char name [MAX_NAMELEN]; - -+ if (IS_ENABLED(CONFIG_PROC_STRIPPED) && !IS_ENABLED(CONFIG_SMP)) -+ return; -+ - if (!root_irq_dir || !desc->dir) - return; - #ifdef CONFIG_SMP -@@ -424,6 +430,9 @@ void init_irq_proc(void) - unsigned int irq; - struct irq_desc *desc; - -+ if (IS_ENABLED(CONFIG_PROC_STRIPPED) && !IS_ENABLED(CONFIG_SMP)) -+ return; -+ - /* create /proc/irq */ - root_irq_dir = proc_mkdir("irq", NULL); - if (!root_irq_dir) ---- a/kernel/time/timer_list.c -+++ b/kernel/time/timer_list.c -@@ -374,6 +374,8 @@ static int __init init_timer_list_procfs - { - struct proc_dir_entry *pe; - -+ if (IS_ENABLED(CONFIG_PROC_STRIPPED)) -+ return 0; - pe = proc_create_seq_private("timer_list", 0400, NULL, &timer_list_sops, - sizeof(struct timer_list_iter), NULL); - if (!pe) ---- a/mm/vmalloc.c -+++ b/mm/vmalloc.c -@@ -2736,6 +2736,8 @@ static const struct seq_operations vmall - - static int __init proc_vmalloc_init(void) - { -+ if (IS_ENABLED(CONFIG_PROC_STRIPPED)) -+ return 0; - if (IS_ENABLED(CONFIG_NUMA)) - proc_create_seq_private("vmallocinfo", 0400, NULL, - &vmalloc_op, ---- a/mm/vmstat.c -+++ b/mm/vmstat.c -@@ -1972,10 +1972,12 @@ void __init init_mm_internals(void) - start_shepherd_timer(); - #endif - #ifdef CONFIG_PROC_FS -- proc_create_seq("buddyinfo", 0444, NULL, &fragmentation_op); -- proc_create_seq("pagetypeinfo", 0444, NULL, &pagetypeinfo_op); -+ if (!IS_ENABLED(CONFIG_PROC_STRIPPED)) { -+ proc_create_seq("buddyinfo", 0444, NULL, &fragmentation_op); -+ proc_create_seq("pagetypeinfo", 0444, NULL, &pagetypeinfo_op); -+ proc_create_seq("zoneinfo", 0444, NULL, &zoneinfo_op); -+ } - proc_create_seq("vmstat", 0444, NULL, &vmstat_op); -- proc_create_seq("zoneinfo", 0444, NULL, &zoneinfo_op); - #endif - } - ---- a/net/8021q/vlanproc.c -+++ b/net/8021q/vlanproc.c -@@ -96,6 +96,9 @@ void vlan_proc_cleanup(struct net *net) - { - struct vlan_net *vn = net_generic(net, vlan_net_id); - -+ if (IS_ENABLED(CONFIG_PROC_STRIPPED)) -+ return; -+ - if (vn->proc_vlan_conf) - remove_proc_entry(name_conf, vn->proc_vlan_dir); - -@@ -115,6 +118,9 @@ int __net_init vlan_proc_init(struct net - { - struct vlan_net *vn = net_generic(net, vlan_net_id); - -+ if (IS_ENABLED(CONFIG_PROC_STRIPPED)) -+ return 0; -+ - vn->proc_vlan_dir = proc_net_mkdir(net, name_root, net->proc_net); - if (!vn->proc_vlan_dir) - goto err; ---- a/net/core/net-procfs.c -+++ b/net/core/net-procfs.c -@@ -279,10 +279,12 @@ static int __net_init dev_proc_net_init( - if (!proc_create_net("dev", 0444, net->proc_net, &dev_seq_ops, - sizeof(struct seq_net_private))) - goto out; -- if (!proc_create_seq("softnet_stat", 0444, net->proc_net, -+ if (!IS_ENABLED(CONFIG_PROC_STRIPPED) && -+ !proc_create_seq("softnet_stat", 0444, net->proc_net, - &softnet_seq_ops)) - goto out_dev; -- if (!proc_create_net("ptype", 0444, net->proc_net, &ptype_seq_ops, -+ if (!IS_ENABLED(CONFIG_PROC_STRIPPED) && -+ !proc_create_net("ptype", 0444, net->proc_net, &ptype_seq_ops, - sizeof(struct seq_net_private))) - goto out_softnet; - -@@ -292,9 +294,11 @@ static int __net_init dev_proc_net_init( - out: - return rc; - out_ptype: -- remove_proc_entry("ptype", net->proc_net); -+ if (!IS_ENABLED(CONFIG_PROC_STRIPPED)) -+ remove_proc_entry("ptype", net->proc_net); - out_softnet: -- remove_proc_entry("softnet_stat", net->proc_net); -+ if (!IS_ENABLED(CONFIG_PROC_STRIPPED)) -+ remove_proc_entry("softnet_stat", net->proc_net); - out_dev: - remove_proc_entry("dev", net->proc_net); - goto out; -@@ -304,8 +308,10 @@ static void __net_exit dev_proc_net_exit - { - wext_proc_exit(net); - -- remove_proc_entry("ptype", net->proc_net); -- remove_proc_entry("softnet_stat", net->proc_net); -+ if (!IS_ENABLED(CONFIG_PROC_STRIPPED)) { -+ remove_proc_entry("ptype", net->proc_net); -+ remove_proc_entry("softnet_stat", net->proc_net); -+ } - remove_proc_entry("dev", net->proc_net); - } - ---- a/net/core/sock.c -+++ b/net/core/sock.c -@@ -3483,6 +3483,8 @@ static __net_initdata struct pernet_oper - - static int __init proto_init(void) - { -+ if (IS_ENABLED(CONFIG_PROC_STRIPPED)) -+ return 0; - return register_pernet_subsys(&proto_net_ops); - } - ---- a/net/ipv4/fib_trie.c -+++ b/net/ipv4/fib_trie.c -@@ -2717,11 +2717,13 @@ static const struct seq_operations fib_r - - int __net_init fib_proc_init(struct net *net) - { -- if (!proc_create_net("fib_trie", 0444, net->proc_net, &fib_trie_seq_ops, -+ if (!IS_ENABLED(CONFIG_PROC_STRIPPED) && -+ !proc_create_net("fib_trie", 0444, net->proc_net, &fib_trie_seq_ops, - sizeof(struct fib_trie_iter))) - goto out1; - -- if (!proc_create_net_single("fib_triestat", 0444, net->proc_net, -+ if (!IS_ENABLED(CONFIG_PROC_STRIPPED) && -+ !proc_create_net_single("fib_triestat", 0444, net->proc_net, - fib_triestat_seq_show, NULL)) - goto out2; - -@@ -2732,17 +2734,21 @@ int __net_init fib_proc_init(struct net - return 0; - - out3: -- remove_proc_entry("fib_triestat", net->proc_net); -+ if (!IS_ENABLED(CONFIG_PROC_STRIPPED)) -+ remove_proc_entry("fib_triestat", net->proc_net); - out2: -- remove_proc_entry("fib_trie", net->proc_net); -+ if (!IS_ENABLED(CONFIG_PROC_STRIPPED)) -+ remove_proc_entry("fib_trie", net->proc_net); - out1: - return -ENOMEM; - } - - void __net_exit fib_proc_exit(struct net *net) - { -- remove_proc_entry("fib_trie", net->proc_net); -- remove_proc_entry("fib_triestat", net->proc_net); -+ if (!IS_ENABLED(CONFIG_PROC_STRIPPED)) { -+ remove_proc_entry("fib_trie", net->proc_net); -+ remove_proc_entry("fib_triestat", net->proc_net); -+ } - remove_proc_entry("route", net->proc_net); - } - ---- a/net/ipv4/proc.c -+++ b/net/ipv4/proc.c -@@ -523,5 +523,8 @@ static __net_initdata struct pernet_oper - - int __init ip_misc_proc_init(void) - { -+ if (IS_ENABLED(CONFIG_PROC_STRIPPED)) -+ return 0; -+ - return register_pernet_subsys(&ip_proc_ops); - } ---- a/net/ipv4/route.c -+++ b/net/ipv4/route.c -@@ -410,6 +410,9 @@ static struct pernet_operations ip_rt_pr - - static int __init ip_rt_proc_init(void) - { -+ if (IS_ENABLED(CONFIG_PROC_STRIPPED)) -+ return 0; -+ - return register_pernet_subsys(&ip_rt_proc_ops); - } - diff --git a/target/linux/generic/hack-4.19/904-debloat_dma_buf.patch b/target/linux/generic/hack-4.19/904-debloat_dma_buf.patch deleted file mode 100644 index 9b686be77d..0000000000 --- a/target/linux/generic/hack-4.19/904-debloat_dma_buf.patch +++ /dev/null @@ -1,64 +0,0 @@ -From e3692cb2fcd5ba1244512a0f43b8118f65f1c375 Mon Sep 17 00:00:00 2001 -From: Felix Fietkau -Date: Sat, 8 Jul 2017 08:20:43 +0200 -Subject: debloat: dmabuf - -Signed-off-by: Felix Fietkau ---- - drivers/base/Kconfig | 2 +- - drivers/dma-buf/Makefile | 10 +++++++--- - drivers/dma-buf/dma-buf.c | 4 +++- - kernel/sched/core.c | 1 + - 4 files changed, 12 insertions(+), 5 deletions(-) - ---- a/drivers/base/Kconfig -+++ b/drivers/base/Kconfig -@@ -172,7 +172,7 @@ config SOC_BUS - source "drivers/base/regmap/Kconfig" - - config DMA_SHARED_BUFFER -- bool -+ tristate - default n - select ANON_INODES - select IRQ_WORK ---- a/drivers/dma-buf/Makefile -+++ b/drivers/dma-buf/Makefile -@@ -1,3 +1,7 @@ --obj-y := dma-buf.o dma-fence.o dma-fence-array.o reservation.o seqno-fence.o --obj-$(CONFIG_SYNC_FILE) += sync_file.o --obj-$(CONFIG_SW_SYNC) += sw_sync.o sync_debug.o -+obj-$(CONFIG_DMA_SHARED_BUFFER) := dma-shared-buffer.o -+ -+dma-buf-objs-y := dma-buf.o dma-fence.o dma-fence-array.o reservation.o seqno-fence.o -+dma-buf-objs-$(CONFIG_SYNC_FILE) += sync_file.o -+dma-buf-objs-$(CONFIG_SW_SYNC) += sw_sync.o sync_debug.o -+ -+dma-shared-buffer-objs := $(dma-buf-objs-y) ---- a/drivers/dma-buf/dma-buf.c -+++ b/drivers/dma-buf/dma-buf.c -@@ -34,6 +34,7 @@ - #include - #include - #include -+#include - - #include - -@@ -1158,4 +1159,5 @@ static void __exit dma_buf_deinit(void) - { - dma_buf_uninit_debugfs(); - } --__exitcall(dma_buf_deinit); -+module_exit(dma_buf_deinit); -+MODULE_LICENSE("GPL"); ---- a/kernel/sched/core.c -+++ b/kernel/sched/core.c -@@ -2127,6 +2127,7 @@ int wake_up_state(struct task_struct *p, - { - return try_to_wake_up(p, state, 0); - } -+EXPORT_SYMBOL_GPL(wake_up_state); - - /* - * Perform scheduler related setup for a newly forked process p. diff --git a/target/linux/generic/hack-4.19/910-kobject_uevent.patch b/target/linux/generic/hack-4.19/910-kobject_uevent.patch deleted file mode 100644 index c4c41ca400..0000000000 --- a/target/linux/generic/hack-4.19/910-kobject_uevent.patch +++ /dev/null @@ -1,32 +0,0 @@ -From 0d37e6edc09c99e683dd91ca0e83bbc0df8477b3 Mon Sep 17 00:00:00 2001 -From: Felix Fietkau -Date: Sun, 16 Jul 2017 16:56:10 +0200 -Subject: lib: add uevent_next_seqnum() - -Signed-off-by: Felix Fietkau ---- - include/linux/kobject.h | 5 +++++ - lib/kobject_uevent.c | 37 +++++++++++++++++++++++++++++++++++++ - 2 files changed, 42 insertions(+) - ---- a/lib/kobject_uevent.c -+++ b/lib/kobject_uevent.c -@@ -179,6 +179,18 @@ out: - return r; - } - -+u64 uevent_next_seqnum(void) -+{ -+ u64 seq; -+ -+ mutex_lock(&uevent_sock_mutex); -+ seq = ++uevent_seqnum; -+ mutex_unlock(&uevent_sock_mutex); -+ -+ return seq; -+} -+EXPORT_SYMBOL_GPL(uevent_next_seqnum); -+ - /** - * kobject_synth_uevent - send synthetic uevent with arguments - * diff --git a/target/linux/generic/hack-4.19/911-kobject_add_broadcast_uevent.patch b/target/linux/generic/hack-4.19/911-kobject_add_broadcast_uevent.patch deleted file mode 100644 index 888f3fc1e7..0000000000 --- a/target/linux/generic/hack-4.19/911-kobject_add_broadcast_uevent.patch +++ /dev/null @@ -1,76 +0,0 @@ -From 0d37e6edc09c99e683dd91ca0e83bbc0df8477b3 Mon Sep 17 00:00:00 2001 -From: Felix Fietkau -Date: Sun, 16 Jul 2017 16:56:10 +0200 -Subject: lib: add uevent_next_seqnum() - -Signed-off-by: Felix Fietkau ---- - include/linux/kobject.h | 5 +++++ - lib/kobject_uevent.c | 37 +++++++++++++++++++++++++++++++++++++ - 2 files changed, 42 insertions(+) - ---- a/include/linux/kobject.h -+++ b/include/linux/kobject.h -@@ -32,6 +32,8 @@ - #define UEVENT_NUM_ENVP 32 /* number of env pointers */ - #define UEVENT_BUFFER_SIZE 2048 /* buffer for the variables */ - -+struct sk_buff; -+ - #ifdef CONFIG_UEVENT_HELPER - /* path to the userspace helper executed on an event */ - extern char uevent_helper[]; -@@ -244,4 +246,7 @@ int kobject_synth_uevent(struct kobject - __printf(2, 3) - int add_uevent_var(struct kobj_uevent_env *env, const char *format, ...); - -+int broadcast_uevent(struct sk_buff *skb, __u32 pid, __u32 group, -+ gfp_t allocation); -+ - #endif /* _KOBJECT_H_ */ ---- a/lib/kobject_uevent.c -+++ b/lib/kobject_uevent.c -@@ -685,6 +685,43 @@ int add_uevent_var(struct kobj_uevent_en - EXPORT_SYMBOL_GPL(add_uevent_var); - - #if defined(CONFIG_NET) -+int broadcast_uevent(struct sk_buff *skb, __u32 pid, __u32 group, -+ gfp_t allocation) -+{ -+ struct uevent_sock *ue_sk; -+ int err = 0; -+ -+ /* send netlink message */ -+ mutex_lock(&uevent_sock_mutex); -+ list_for_each_entry(ue_sk, &uevent_sock_list, list) { -+ struct sock *uevent_sock = ue_sk->sk; -+ struct sk_buff *skb2; -+ -+ skb2 = skb_clone(skb, allocation); -+ if (!skb2) -+ break; -+ -+ err = netlink_broadcast(uevent_sock, skb2, pid, group, -+ allocation); -+ if (err) -+ break; -+ } -+ mutex_unlock(&uevent_sock_mutex); -+ -+ kfree_skb(skb); -+ return err; -+} -+#else -+int broadcast_uevent(struct sk_buff *skb, __u32 pid, __u32 group, -+ gfp_t allocation) -+{ -+ kfree_skb(skb); -+ return 0; -+} -+#endif -+EXPORT_SYMBOL_GPL(broadcast_uevent); -+ -+#if defined(CONFIG_NET) - static int uevent_net_broadcast(struct sock *usk, struct sk_buff *skb, - struct netlink_ext_ack *extack) - { diff --git a/target/linux/generic/hack-4.19/921-always-create-console-node-in-initramfs.patch b/target/linux/generic/hack-4.19/921-always-create-console-node-in-initramfs.patch deleted file mode 100644 index 316d2955c6..0000000000 --- a/target/linux/generic/hack-4.19/921-always-create-console-node-in-initramfs.patch +++ /dev/null @@ -1,40 +0,0 @@ -From 5d301596fdc72f6cb672f72eb3c66e7cddefb103 Mon Sep 17 00:00:00 2001 -From: Felix Fietkau -Date: Sat, 8 Jul 2017 08:26:02 +0200 -Subject: initramfs: always create console node - -Signed-off-by: Felix Fietkau ---- - usr/gen_initramfs_list.sh | 14 ++++++++++++++ - 1 file changed, 14 insertions(+) - ---- a/usr/gen_initramfs_list.sh -+++ b/usr/gen_initramfs_list.sh -@@ -59,6 +59,18 @@ default_initramfs() { - EOF - } - -+list_librecmc_initramfs() { -+ : -+} -+ -+librecmc_initramfs() { -+ # make sure that /dev/console exists -+ cat <<-EOF >> ${output} -+ dir /dev 0755 0 0 -+ nod /dev/console 0600 0 0 c 5 1 -+ EOF -+} -+ - filetype() { - local argv1="$1" - -@@ -180,6 +192,8 @@ dir_filelist() { - if [ "$(echo "${dirlist}" | wc -l)" -gt 1 ]; then - ${dep_list}print_mtime "$1" - -+ ${dep_list}librecmc_initramfs -+ - echo "${dirlist}" | \ - while read x; do - ${dep_list}parse ${x} diff --git a/target/linux/generic/hack-4.19/930-crashlog.patch b/target/linux/generic/hack-4.19/930-crashlog.patch deleted file mode 100644 index 4f303f9b8c..0000000000 --- a/target/linux/generic/hack-4.19/930-crashlog.patch +++ /dev/null @@ -1,338 +0,0 @@ -From 6b1ab74a9917012d0c559edc4ed299d9228ac89f Mon Sep 17 00:00:00 2001 -From: Felix Fietkau -Date: Sat, 8 Jul 2017 08:26:47 +0200 -Subject: kernel: add the new 'crashlog' feature - -this tries to store kernel oops/panic logs in a fixed location in RAM to -recover them available to user space using debugfs - -Signed-off-by: Felix Fietkau ---- - include/linux/crashlog.h | 17 ++++ - init/Kconfig | 4 + - kernel/Makefile | 1 + - kernel/crashlog.c | 213 +++++++++++++++++++++++++++++++++++++++++++++++ - kernel/module.c | 3 + - mm/bootmem.c | 2 + - mm/memblock.c | 5 ++ - 7 files changed, 245 insertions(+) - create mode 100644 include/linux/crashlog.h - create mode 100644 kernel/crashlog.c - ---- /dev/null -+++ b/include/linux/crashlog.h -@@ -0,0 +1,17 @@ -+#ifndef __CRASHLOG_H -+#define __CRASHLOG_H -+ -+#ifdef CONFIG_CRASHLOG -+void crashlog_init_bootmem(struct bootmem_data *bdata); -+void crashlog_init_memblock(phys_addr_t addr, phys_addr_t size); -+#else -+static inline void crashlog_init_bootmem(struct bootmem_data *bdata) -+{ -+} -+ -+static inline void crashlog_init_memblock(phys_addr_t addr, phys_addr_t size) -+{ -+} -+#endif -+ -+#endif ---- a/init/Kconfig -+++ b/init/Kconfig -@@ -1046,6 +1046,10 @@ config RELAY - - If unsure, say N. - -+config CRASHLOG -+ bool "Crash logging" -+ depends on (!NO_BOOTMEM || HAVE_MEMBLOCK) -+ - config BLK_DEV_INITRD - bool "Initial RAM filesystem and RAM disk (initramfs/initrd) support" - help ---- a/kernel/Makefile -+++ b/kernel/Makefile -@@ -116,6 +116,7 @@ obj-$(CONFIG_TORTURE_TEST) += torture.o - obj-$(CONFIG_HAS_IOMEM) += iomem.o - obj-$(CONFIG_ZONE_DEVICE) += memremap.o - obj-$(CONFIG_RSEQ) += rseq.o -+obj-$(CONFIG_CRASHLOG) += crashlog.o - - $(obj)/configs.o: $(obj)/config_data.h - ---- /dev/null -+++ b/kernel/crashlog.c -@@ -0,0 +1,213 @@ -+/* -+ * Crash information logger -+ * Copyright (C) 2010 Felix Fietkau -+ * -+ * Based on ramoops.c -+ * Copyright (C) 2010 Marco Stornelli -+ * -+ * 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 -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+#define CRASHLOG_PAGES 4 -+#define CRASHLOG_SIZE (CRASHLOG_PAGES * PAGE_SIZE) -+#define CRASHLOG_MAGIC 0xa1eedead -+ -+/* -+ * Start the log at 1M before the end of RAM, as some boot loaders like -+ * to use the end of the RAM for stack usage and other things -+ * If this fails, fall back to using the last part. -+ */ -+#define CRASHLOG_OFFSET (1024 * 1024) -+ -+struct crashlog_data { -+ u32 magic; -+ u32 len; -+ u8 data[]; -+}; -+ -+static struct debugfs_blob_wrapper crashlog_blob; -+static unsigned long crashlog_addr = 0; -+static struct crashlog_data *crashlog_buf; -+static struct kmsg_dumper dump; -+static bool first = true; -+ -+extern struct list_head *crashlog_modules; -+ -+static bool crashlog_set_addr(phys_addr_t addr, phys_addr_t size) -+{ -+ /* Limit to lower 64 MB to avoid highmem */ -+ phys_addr_t limit = 64 * 1024 * 1024; -+ -+ if (crashlog_addr) -+ return false; -+ -+ if (addr > limit) -+ return false; -+ -+ if (addr + size > limit) -+ size = limit - addr; -+ -+ crashlog_addr = addr; -+ -+ if (addr + size > CRASHLOG_OFFSET) -+ crashlog_addr += size - CRASHLOG_OFFSET; -+ -+ return true; -+} -+ -+#ifndef CONFIG_NO_BOOTMEM -+void __init crashlog_init_bootmem(bootmem_data_t *bdata) -+{ -+ phys_addr_t start, end; -+ -+ start = PFN_PHYS(bdata->node_low_pfn); -+ end = PFN_PHYS(bdata->node_min_pfn); -+ if (!crashlog_set_addr(start, end - start)) -+ return; -+ -+ if (reserve_bootmem(crashlog_addr, CRASHLOG_SIZE, BOOTMEM_EXCLUSIVE) < 0) { -+ printk("Crashlog failed to allocate RAM at address 0x%lx\n", -+ crashlog_addr); -+ crashlog_addr = 0; -+ } -+} -+#endif -+ -+#ifdef CONFIG_HAVE_MEMBLOCK -+void __init_memblock crashlog_init_memblock(phys_addr_t addr, phys_addr_t size) -+{ -+ if (!crashlog_set_addr(addr, size)) -+ return; -+ -+ if (memblock_reserve(crashlog_addr, CRASHLOG_SIZE)) { -+ printk("Crashlog failed to allocate RAM at address 0x%lx\n", -+ crashlog_addr); -+ crashlog_addr = 0; -+ } -+} -+#endif -+ -+static void __init crashlog_copy(void) -+{ -+ if (crashlog_buf->magic != CRASHLOG_MAGIC) -+ return; -+ -+ if (!crashlog_buf->len || crashlog_buf->len > -+ CRASHLOG_SIZE - sizeof(*crashlog_buf)) -+ return; -+ -+ crashlog_blob.size = crashlog_buf->len; -+ crashlog_blob.data = kmemdup(crashlog_buf->data, -+ crashlog_buf->len, GFP_KERNEL); -+ -+ debugfs_create_blob("crashlog", 0700, NULL, &crashlog_blob); -+} -+ -+static int get_maxlen(void) -+{ -+ return CRASHLOG_SIZE - sizeof(*crashlog_buf) - crashlog_buf->len; -+} -+ -+static void crashlog_printf(const char *fmt, ...) -+{ -+ va_list args; -+ int len = get_maxlen(); -+ -+ if (!len) -+ return; -+ -+ va_start(args, fmt); -+ crashlog_buf->len += vscnprintf( -+ &crashlog_buf->data[crashlog_buf->len], -+ len, fmt, args); -+ va_end(args); -+} -+ -+static void crashlog_do_dump(struct kmsg_dumper *dumper, -+ enum kmsg_dump_reason reason) -+{ -+ struct timeval tv; -+ struct module *m; -+ char *buf; -+ size_t len; -+ -+ if (!first) -+ crashlog_printf("\n===================================\n"); -+ -+ do_gettimeofday(&tv); -+ crashlog_printf("Time: %lu.%lu\n", -+ (long)tv.tv_sec, (long)tv.tv_usec); -+ -+ if (first) { -+ crashlog_printf("Modules:"); -+ list_for_each_entry(m, crashlog_modules, list) { -+ crashlog_printf("\t%s@%p+%x", m->name, -+ m->core_layout.base, m->core_layout.size, -+ m->init_layout.base, m->init_layout.size); -+ } -+ crashlog_printf("\n"); -+ first = false; -+ } -+ -+ buf = (char *)&crashlog_buf->data[crashlog_buf->len]; -+ -+ kmsg_dump_get_buffer(dumper, true, buf, get_maxlen(), &len); -+ -+ crashlog_buf->len += len; -+} -+ -+ -+int __init crashlog_init_fs(void) -+{ -+ struct page *pages[CRASHLOG_PAGES]; -+ pgprot_t prot; -+ int i; -+ -+ if (!crashlog_addr) { -+ printk("No memory allocated for crashlog\n"); -+ return -ENOMEM; -+ } -+ -+ printk("Crashlog allocated RAM at address 0x%lx\n", (unsigned long) crashlog_addr); -+ for (i = 0; i < CRASHLOG_PAGES; i++) -+ pages[i] = pfn_to_page((crashlog_addr >> PAGE_SHIFT) + i); -+ -+ prot = pgprot_writecombine(PAGE_KERNEL); -+ crashlog_buf = vmap(pages, CRASHLOG_PAGES, VM_MAP, prot); -+ -+ crashlog_copy(); -+ -+ crashlog_buf->magic = CRASHLOG_MAGIC; -+ crashlog_buf->len = 0; -+ -+ dump.max_reason = KMSG_DUMP_OOPS; -+ dump.dump = crashlog_do_dump; -+ kmsg_dump_register(&dump); -+ -+ return 0; -+} -+module_init(crashlog_init_fs); ---- a/kernel/module.c -+++ b/kernel/module.c -@@ -256,6 +256,9 @@ static void mod_update_bounds(struct mod - #ifdef CONFIG_KGDB_KDB - struct list_head *kdb_modules = &modules; /* kdb needs the list of modules */ - #endif /* CONFIG_KGDB_KDB */ -+#ifdef CONFIG_CRASHLOG -+struct list_head *crashlog_modules = &modules; -+#endif - - static void module_assert_mutex(void) - { ---- a/mm/bootmem.c -+++ b/mm/bootmem.c -@@ -15,6 +15,7 @@ - #include - #include - #include -+#include - #include - #include - #include -@@ -215,6 +216,7 @@ static unsigned long __init free_all_boo - if (!bdata->node_bootmem_map) - return 0; - -+ crashlog_init_bootmem(bdata); - map = bdata->node_bootmem_map; - start = bdata->node_min_pfn; - end = bdata->node_low_pfn; ---- a/mm/memblock.c -+++ b/mm/memblock.c -@@ -21,6 +21,7 @@ - #include - #include - #include -+#include - - #include - #include -@@ -547,6 +548,8 @@ static void __init_memblock memblock_ins - memblock_set_region_node(rgn, nid); - type->cnt++; - type->total_size += size; -+ if (type == &memblock.memory) -+ crashlog_init_memblock(base, size); - } - - /** -@@ -586,6 +589,8 @@ int __init_memblock memblock_add_range(s - type->regions[0].flags = flags; - memblock_set_region_node(&type->regions[0], nid); - type->total_size = size; -+ if (type == &memblock.memory) -+ crashlog_init_memblock(base, size); - return 0; - } - repeat: diff --git a/target/linux/generic/hack-4.19/940-cleanup-offload-hooks-on-netdev-unregister.patch b/target/linux/generic/hack-4.19/940-cleanup-offload-hooks-on-netdev-unregister.patch deleted file mode 100644 index 6638a5e949..0000000000 --- a/target/linux/generic/hack-4.19/940-cleanup-offload-hooks-on-netdev-unregister.patch +++ /dev/null @@ -1,91 +0,0 @@ -From ae56e27e30122f82d244f9eb35fcab8fa60e0d31 Mon Sep 17 00:00:00 2001 -From: Chen Minqiang -Date: Sun, 29 Apr 2018 14:08:57 +0800 -Subject: [PATCH] cleanup offload hooks on netdev unregister - -This should fix crashdump on reboot when FLOWOFFLOAD enabled - -kmsg: -[ 84.188081] Workqueue: events_power_efficient xt_flowoffload_hook_work [xt_FLOWOFFLOAD] -[ 84.209326] task: ffff88000ecd0c80 task.stack: ffffc90000068000 -[ 84.224706] RIP: 0010:__nf_unregister_net_hook+0x1/0x90 -[ 84.242911] RSP: 0018:ffffc9000006be30 EFLAGS: 00010202 -[ 84.257405] RAX: 0000000000000000 RBX: ffff88000c5b3228 RCX: 0000000100170001 -[ 84.292175] RDX: ffff88000ecd0c80 RSI: ffff88000c5b3228 RDI: 6b6b6b6b6b6b6b6b -[ 84.305095] RBP: ffffc9000006be58 R08: ffff88000c5b3578 R09: ffff88000c5b3538 -[ 84.325980] R10: ffffc9000006be50 R11: ffff88000fc1f310 R12: ffffffff81e6c580 -[ 84.396514] R13: ffff88000d1723d0 R14: ffff88000ec0fc00 R15: 0000000000000000 -[ 84.459500] FS: 0000000000000000(0000) GS:ffff88000fc00000(0000) knlGS:0000000000000000 -[ 84.525121] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 -[ 84.565460] CR2: 0000000000a931d8 CR3: 0000000001e08006 CR4: 00000000000606f0 -[ 84.638311] Call Trace: -[ 84.655229] ? nf_unregister_net_hook+0x88/0xd0 -[ 84.706898] xt_flowoffload_hook_work+0x12a/0x17a [xt_FLOWOFFLOAD] -[ 84.765504] process_one_work+0x1c4/0x310 -[ 84.799558] worker_thread+0x20b/0x3c0 -[ 84.850119] kthread+0x112/0x120 -[ 84.884839] ? process_one_work+0x310/0x310 -[ 84.923571] ? kthread_create_on_node+0x40/0x40 -[ 84.966100] ret_from_fork+0x35/0x40 -[ 84.981738] Code: 41 5c 41 5d 41 5e 41 5f 5d c3 48 8b 05 c1 f1 99 00 55 48 89 e5 48 85 c0 75 02 0f 0b e8 b9 f6 30 00 5d c3 0f 1f 80 00 00 00 00 55 <0f> b7 0f 48 89 e5 48 89 c8 48 c1 e0 04 48 8d 54 07 08 31 c0 eb -[ 85.100453] RIP: __nf_unregister_net_hook+0x1/0x90 RSP: ffffc9000006be30 -[ 85.111658] ---[ end trace 5c25a390045cac75 ]--- -[ 85.124535] Kernel panic - not syncing: Fatal exception - -Signed-off-by: Chen Minqiang ---- - net/netfilter/xt_FLOWOFFLOAD.c | 32 ++++++++++++++++++++++++++++++++ - 1 file changed, 32 insertions(+) - ---- a/net/netfilter/xt_FLOWOFFLOAD.c -+++ b/net/netfilter/xt_FLOWOFFLOAD.c -@@ -340,10 +340,41 @@ static void xt_flowoffload_table_cleanup - nf_flow_table_free(table); - } - -+static int flow_offload_netdev_event(struct notifier_block *this, -+ unsigned long event, void *ptr) -+{ -+ struct xt_flowoffload_hook *hook = NULL; -+ struct net_device *dev = netdev_notifier_info_to_dev(ptr); -+ -+ if (event != NETDEV_UNREGISTER) -+ return NOTIFY_DONE; -+ -+ spin_lock_bh(&hooks_lock); -+ hook = flow_offload_lookup_hook(dev); -+ if (hook) { -+ hlist_del(&hook->list); -+ } -+ spin_unlock_bh(&hooks_lock); -+ if (hook) { -+ nf_unregister_net_hook(hook->net, &hook->ops); -+ kfree(hook); -+ } -+ -+ nf_flow_table_cleanup(dev_net(dev), dev); -+ -+ return NOTIFY_DONE; -+} -+ -+static struct notifier_block flow_offload_netdev_notifier = { -+ .notifier_call = flow_offload_netdev_event, -+}; -+ - static int __init xt_flowoffload_tg_init(void) - { - int ret; - -+ register_netdevice_notifier(&flow_offload_netdev_notifier); -+ - INIT_DELAYED_WORK(&hook_work, xt_flowoffload_hook_work); - - ret = xt_flowoffload_table_init(&nf_flowtable); -@@ -361,6 +392,7 @@ static void __exit xt_flowoffload_tg_exi - { - xt_unregister_target(&offload_tg_reg); - xt_flowoffload_table_cleanup(&nf_flowtable); -+ unregister_netdevice_notifier(&flow_offload_netdev_notifier); - } - - MODULE_LICENSE("GPL"); diff --git a/target/linux/generic/hack-4.9/202-reduce_module_size.patch b/target/linux/generic/hack-4.9/202-reduce_module_size.patch deleted file mode 100644 index f744b945fe..0000000000 --- a/target/linux/generic/hack-4.9/202-reduce_module_size.patch +++ /dev/null @@ -1,24 +0,0 @@ -From fd66884da2f96d2a7ea73f58b1b86251b959a913 Mon Sep 17 00:00:00 2001 -From: Felix Fietkau -Date: Fri, 7 Jul 2017 16:56:19 +0200 -Subject: kernel: strip unnecessary symbol table information from kernel modules - -reduces default squashfs size on ar71xx by about 4k - -lede-commit: 058d331a39077f159ca8922f1f422a1346d6aa67 -Signed-off-by: Felix Fietkau ---- - Makefile | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - ---- a/Makefile -+++ b/Makefile -@@ -403,7 +403,7 @@ KBUILD_AFLAGS_KERNEL := - KBUILD_CFLAGS_KERNEL := - KBUILD_AFLAGS_MODULE := -DMODULE - KBUILD_CFLAGS_MODULE := -DMODULE --KBUILD_LDFLAGS_MODULE := -T $(srctree)/scripts/module-common.lds -+KBUILD_LDFLAGS_MODULE = -T $(srctree)/scripts/module-common.lds $(if $(CONFIG_PROFILING),,-s) - GCC_PLUGINS_CFLAGS := - - # Read KERNELRELEASE from include/config/kernel.release (if it exists) diff --git a/target/linux/generic/hack-4.9/204-module_strip.patch b/target/linux/generic/hack-4.9/204-module_strip.patch deleted file mode 100644 index fcca6bd02c..0000000000 --- a/target/linux/generic/hack-4.9/204-module_strip.patch +++ /dev/null @@ -1,214 +0,0 @@ -From a779a482fb9b9f8fcdf8b2519c789b4b9bb5dd05 Mon Sep 17 00:00:00 2001 -From: Felix Fietkau -Date: Fri, 7 Jul 2017 16:56:48 +0200 -Subject: build: add a hack for removing non-essential module info - -Signed-off-by: Felix Fietkau ---- - include/linux/module.h | 13 ++++++++----- - include/linux/moduleparam.h | 15 ++++++++++++--- - init/Kconfig | 7 +++++++ - kernel/module.c | 5 ++++- - scripts/mod/modpost.c | 12 ++++++++++++ - 5 files changed, 43 insertions(+), 9 deletions(-) - ---- a/include/linux/module.h -+++ b/include/linux/module.h -@@ -159,6 +159,7 @@ extern void cleanup_module(void); - - /* Generic info of form tag = "info" */ - #define MODULE_INFO(tag, info) __MODULE_INFO(tag, tag, info) -+#define MODULE_INFO_STRIP(tag, info) __MODULE_INFO_STRIP(tag, tag, info) - - /* For userspace: you can also call me... */ - #define MODULE_ALIAS(_alias) MODULE_INFO(alias, _alias) -@@ -202,12 +203,12 @@ extern void cleanup_module(void); - * Author(s), use "Name " or just "Name", for multiple - * authors use multiple MODULE_AUTHOR() statements/lines. - */ --#define MODULE_AUTHOR(_author) MODULE_INFO(author, _author) -+#define MODULE_AUTHOR(_author) MODULE_INFO_STRIP(author, _author) - - /* What your module does. */ --#define MODULE_DESCRIPTION(_description) MODULE_INFO(description, _description) -+#define MODULE_DESCRIPTION(_description) MODULE_INFO_STRIP(description, _description) - --#ifdef MODULE -+#if defined(MODULE) && !defined(CONFIG_MODULE_STRIPPED) - /* Creates an alias so file2alias.c can find device table. */ - #define MODULE_DEVICE_TABLE(type, name) \ - extern const typeof(name) __mod_##type##__##name##_device_table \ -@@ -234,7 +235,9 @@ extern const typeof(name) __mod_##type## - */ - - #if defined(MODULE) || !defined(CONFIG_SYSFS) --#define MODULE_VERSION(_version) MODULE_INFO(version, _version) -+#define MODULE_VERSION(_version) MODULE_INFO_STRIP(version, _version) -+#elif defined(CONFIG_MODULE_STRIPPED) -+#define MODULE_VERSION(_version) __MODULE_INFO_DISABLED(version) - #else - #define MODULE_VERSION(_version) \ - static struct module_version_attribute ___modver_attr = { \ -@@ -256,7 +259,7 @@ extern const typeof(name) __mod_##type## - /* Optional firmware file (or files) needed by the module - * format is simply firmware file name. Multiple firmware - * files require multiple MODULE_FIRMWARE() specifiers */ --#define MODULE_FIRMWARE(_firmware) MODULE_INFO(firmware, _firmware) -+#define MODULE_FIRMWARE(_firmware) MODULE_INFO_STRIP(firmware, _firmware) - - struct notifier_block; - ---- a/include/linux/moduleparam.h -+++ b/include/linux/moduleparam.h -@@ -16,6 +16,16 @@ - /* Chosen so that structs with an unsigned long line up. */ - #define MAX_PARAM_PREFIX_LEN (64 - sizeof(unsigned long)) - -+/* This struct is here for syntactic coherency, it is not used */ -+#define __MODULE_INFO_DISABLED(name) \ -+ struct __UNIQUE_ID(name) {} -+ -+#ifdef CONFIG_MODULE_STRIPPED -+#define __MODULE_INFO_STRIP(tag, name, info) __MODULE_INFO_DISABLED(name) -+#else -+#define __MODULE_INFO_STRIP(tag, name, info) __MODULE_INFO(tag, name, info) -+#endif -+ - #ifdef MODULE - #define __MODULE_INFO(tag, name, info) \ - static const char __UNIQUE_ID(name)[] \ -@@ -23,8 +33,7 @@ static const char __UNIQUE_ID(name)[] - = __stringify(tag) "=" info - #else /* !MODULE */ - /* This struct is here for syntactic coherency, it is not used */ --#define __MODULE_INFO(tag, name, info) \ -- struct __UNIQUE_ID(name) {} -+#define __MODULE_INFO(tag, name, info) __MODULE_INFO_DISABLED(name) - #endif - #define __MODULE_PARM_TYPE(name, _type) \ - __MODULE_INFO(parmtype, name##type, #name ":" _type) -@@ -32,7 +41,7 @@ static const char __UNIQUE_ID(name)[] - /* One for each parameter, describing how to use it. Some files do - multiple of these per line, so can't just use MODULE_INFO. */ - #define MODULE_PARM_DESC(_parm, desc) \ -- __MODULE_INFO(parm, _parm, #_parm ":" desc) -+ __MODULE_INFO_STRIP(parm, _parm, #_parm ":" desc) - - struct kernel_param; - ---- a/init/Kconfig -+++ b/init/Kconfig -@@ -2122,6 +2122,13 @@ config TRIM_UNUSED_KSYMS - - If unsure, or if you need to build out-of-tree modules, say N. - -+config MODULE_STRIPPED -+ bool "Reduce module size" -+ depends on MODULES -+ help -+ Remove module parameter descriptions, author info, version, aliases, -+ device tables, etc. -+ - endif # MODULES - - config MODULES_TREE_LOOKUP ---- a/kernel/module.c -+++ b/kernel/module.c -@@ -2968,9 +2968,11 @@ static struct module *setup_load_info(st - - static int check_modinfo(struct module *mod, struct load_info *info, int flags) - { -- const char *modmagic = get_modinfo(info, "vermagic"); - int err; - -+#ifndef CONFIG_MODULE_STRIPPED -+ const char *modmagic = get_modinfo(info, "vermagic"); -+ - if (flags & MODULE_INIT_IGNORE_VERMAGIC) - modmagic = NULL; - -@@ -2991,6 +2993,7 @@ static int check_modinfo(struct module * - mod->name); - add_taint_module(mod, TAINT_OOT_MODULE, LOCKDEP_STILL_OK); - } -+#endif - - check_modinfo_retpoline(mod, info); - ---- a/scripts/mod/modpost.c -+++ b/scripts/mod/modpost.c -@@ -1967,7 +1967,9 @@ static void read_symbols(char *modname) - symname = remove_dot(info.strtab + sym->st_name); - - handle_modversions(mod, &info, sym, symname); -+#ifndef CONFIG_MODULE_STRIPPED - handle_moddevtable(mod, &info, sym, symname); -+#endif - } - if (!is_vmlinux(modname) || - (is_vmlinux(modname) && vmlinux_section_warnings)) -@@ -2111,7 +2113,9 @@ static void add_header(struct buffer *b, - buf_printf(b, "#include \n"); - buf_printf(b, "#include \n"); - buf_printf(b, "\n"); -+#ifndef CONFIG_MODULE_STRIPPED - buf_printf(b, "MODULE_INFO(vermagic, VERMAGIC_STRING);\n"); -+#endif - buf_printf(b, "\n"); - buf_printf(b, "__visible struct module __this_module\n"); - buf_printf(b, "__attribute__((section(\".gnu.linkonce.this_module\"))) = {\n"); -@@ -2128,24 +2132,30 @@ static void add_header(struct buffer *b, - - static void add_intree_flag(struct buffer *b, int is_intree) - { -+#ifndef CONFIG_MODULE_STRIPPED - if (is_intree) - buf_printf(b, "\nMODULE_INFO(intree, \"Y\");\n"); -+#endif - } - - /* Cannot check for assembler */ - static void add_retpoline(struct buffer *b) - { -+#ifndef CONFIG_MODULE_STRIPPED - buf_printf(b, "\n#ifdef RETPOLINE\n"); - buf_printf(b, "MODULE_INFO(retpoline, \"Y\");\n"); - buf_printf(b, "#endif\n"); -+#endif - } - - static void add_staging_flag(struct buffer *b, const char *name) - { -+#ifndef CONFIG_MODULE_STRIPPED - static const char *staging_dir = "drivers/staging"; - - if (strncmp(staging_dir, name, strlen(staging_dir)) == 0) - buf_printf(b, "\nMODULE_INFO(staging, \"Y\");\n"); -+#endif - } - - /* In kernel, this size is defined in linux/module.h; -@@ -2249,11 +2259,13 @@ static void add_depends(struct buffer *b - - static void add_srcversion(struct buffer *b, struct module *mod) - { -+#ifndef CONFIG_MODULE_STRIPPED - if (mod->srcversion[0]) { - buf_printf(b, "\n"); - buf_printf(b, "MODULE_INFO(srcversion, \"%s\");\n", - mod->srcversion); - } -+#endif - } - - static void write_if_changed(struct buffer *b, const char *fname) -@@ -2488,7 +2500,9 @@ int main(int argc, char **argv) - add_staging_flag(&buf, mod->name); - err |= add_versions(&buf, mod); - add_depends(&buf, mod, modules); -+#ifndef CONFIG_MODULE_STRIPPED - add_moddevtable(&buf, mod); -+#endif - add_srcversion(&buf, mod); - - sprintf(fname, "%s.mod.c", mod->name); diff --git a/target/linux/generic/hack-4.9/207-disable-modorder.patch b/target/linux/generic/hack-4.9/207-disable-modorder.patch deleted file mode 100644 index 5f7eb64bd2..0000000000 --- a/target/linux/generic/hack-4.9/207-disable-modorder.patch +++ /dev/null @@ -1,44 +0,0 @@ -From c9ef4ab0f54356ee9f91d9676ea0ec123840ddc7 Mon Sep 17 00:00:00 2001 -From: Felix Fietkau -Date: Fri, 7 Jul 2017 16:57:33 +0200 -Subject: kernel: do not build modules.order - -It is not needed for anything on the system and skipping this saves some -build time, especially in cases where there is nothing to do. - -lede-commit: afc1675833a7bf5df094f59f7250369520646d04 -Signed-off-by: Felix Fietkau ---- - Makefile | 2 -- - scripts/Makefile.build | 2 +- - 2 files changed, 1 insertion(+), 3 deletions(-) - ---- a/Makefile -+++ b/Makefile -@@ -1231,7 +1231,6 @@ all: modules - - PHONY += modules - modules: $(vmlinux-dirs) $(if $(KBUILD_BUILTIN),vmlinux) modules.builtin -- $(Q)$(AWK) '!x[$$0]++' $(vmlinux-dirs:%=$(objtree)/%/modules.order) > $(objtree)/modules.order - @$(kecho) ' Building modules, stage 2.'; - $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modpost - $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.fwinst obj=firmware __fw_modbuild -@@ -1261,7 +1260,6 @@ _modinst_: - rm -f $(MODLIB)/build ; \ - ln -s $(CURDIR) $(MODLIB)/build ; \ - fi -- @cp -f $(objtree)/modules.order $(MODLIB)/ - @cp -f $(objtree)/modules.builtin $(MODLIB)/ - $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modinst - ---- a/scripts/Makefile.build -+++ b/scripts/Makefile.build -@@ -93,7 +93,7 @@ modorder-target := $(obj)/modules.order - # We keep a list of all modules in $(MODVERDIR) - - __build: $(if $(KBUILD_BUILTIN),$(builtin-target) $(lib-target) $(extra-y)) \ -- $(if $(KBUILD_MODULES),$(obj-m) $(modorder-target)) \ -+ $(if $(KBUILD_MODULES),$(obj-m)) \ - $(subdir-ym) $(always) - @: - diff --git a/target/linux/generic/hack-4.9/210-darwin_scripts_include.patch b/target/linux/generic/hack-4.9/210-darwin_scripts_include.patch deleted file mode 100644 index bdf4114aaa..0000000000 --- a/target/linux/generic/hack-4.9/210-darwin_scripts_include.patch +++ /dev/null @@ -1,3065 +0,0 @@ -From db7c30dcd9a0391bf13b62c9f91e144d762ef43a Mon Sep 17 00:00:00 2001 -From: Florian Fainelli -Date: Fri, 7 Jul 2017 17:00:49 +0200 -Subject: Add an OSX specific patch to make the kernel be compiled - -lede-commit: 3fc2a24f0422b2f55f9ed43f116db3111f700526 -Signed-off-by: Florian Fainelli ---- - scripts/kconfig/Makefile | 3 + - scripts/mod/elf.h | 3007 ++++++++++++++++++++++++++++++++++++++++++++ - scripts/mod/mk_elfconfig.c | 4 + - scripts/mod/modpost.h | 4 + - 4 files changed, 3018 insertions(+) - create mode 100644 scripts/mod/elf.h - ---- a/scripts/kconfig/Makefile -+++ b/scripts/kconfig/Makefile -@@ -163,6 +163,9 @@ check-lxdialog := $(srctree)/$(src)/lxd - # we really need to do so. (Do not call gcc as part of make mrproper) - HOST_EXTRACFLAGS += $(shell $(CONFIG_SHELL) $(check-lxdialog) -ccflags) \ - -DLOCALE -+ifeq ($(shell uname -s),Darwin) -+HOST_LOADLIBES += -lncurses -+endif - - # =========================================================================== - # Shared Makefile for the various kconfig executables: ---- /dev/null -+++ b/scripts/mod/elf.h -@@ -0,0 +1,3007 @@ -+/* This file defines standard ELF types, structures, and macros. -+ Copyright (C) 1995-2012 Free Software Foundation, Inc. -+ This file is part of the GNU C Library. -+ -+ The GNU C Library 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. -+ -+ The GNU C Library is distributed in the hope that 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 the GNU C Library; if not, see -+ . */ -+ -+#ifndef _ELF_H -+#define _ELF_H 1 -+ -+/* Standard ELF types. */ -+ -+#include -+ -+/* Type for a 16-bit quantity. */ -+typedef uint16_t Elf32_Half; -+typedef uint16_t Elf64_Half; -+ -+/* Types for signed and unsigned 32-bit quantities. */ -+typedef uint32_t Elf32_Word; -+typedef int32_t Elf32_Sword; -+typedef uint32_t Elf64_Word; -+typedef int32_t Elf64_Sword; -+ -+/* Types for signed and unsigned 64-bit quantities. */ -+typedef uint64_t Elf32_Xword; -+typedef int64_t Elf32_Sxword; -+typedef uint64_t Elf64_Xword; -+typedef int64_t Elf64_Sxword; -+ -+/* Type of addresses. */ -+typedef uint32_t Elf32_Addr; -+typedef uint64_t Elf64_Addr; -+ -+/* Type of file offsets. */ -+typedef uint32_t Elf32_Off; -+typedef uint64_t Elf64_Off; -+ -+/* Type for section indices, which are 16-bit quantities. */ -+typedef uint16_t Elf32_Section; -+typedef uint16_t Elf64_Section; -+ -+/* Type for version symbol information. */ -+typedef Elf32_Half Elf32_Versym; -+typedef Elf64_Half Elf64_Versym; -+ -+ -+/* The ELF file header. This appears at the start of every ELF file. */ -+ -+#define EI_NIDENT (16) -+ -+typedef struct -+{ -+ unsigned char e_ident[EI_NIDENT]; /* Magic number and other info */ -+ Elf32_Half e_type; /* Object file type */ -+ Elf32_Half e_machine; /* Architecture */ -+ Elf32_Word e_version; /* Object file version */ -+ Elf32_Addr e_entry; /* Entry point virtual address */ -+ Elf32_Off e_phoff; /* Program header table file offset */ -+ Elf32_Off e_shoff; /* Section header table file offset */ -+ Elf32_Word e_flags; /* Processor-specific flags */ -+ Elf32_Half e_ehsize; /* ELF header size in bytes */ -+ Elf32_Half e_phentsize; /* Program header table entry size */ -+ Elf32_Half e_phnum; /* Program header table entry count */ -+ Elf32_Half e_shentsize; /* Section header table entry size */ -+ Elf32_Half e_shnum; /* Section header table entry count */ -+ Elf32_Half e_shstrndx; /* Section header string table index */ -+} Elf32_Ehdr; -+ -+typedef struct -+{ -+ unsigned char e_ident[EI_NIDENT]; /* Magic number and other info */ -+ Elf64_Half e_type; /* Object file type */ -+ Elf64_Half e_machine; /* Architecture */ -+ Elf64_Word e_version; /* Object file version */ -+ Elf64_Addr e_entry; /* Entry point virtual address */ -+ Elf64_Off e_phoff; /* Program header table file offset */ -+ Elf64_Off e_shoff; /* Section header table file offset */ -+ Elf64_Word e_flags; /* Processor-specific flags */ -+ Elf64_Half e_ehsize; /* ELF header size in bytes */ -+ Elf64_Half e_phentsize; /* Program header table entry size */ -+ Elf64_Half e_phnum; /* Program header table entry count */ -+ Elf64_Half e_shentsize; /* Section header table entry size */ -+ Elf64_Half e_shnum; /* Section header table entry count */ -+ Elf64_Half e_shstrndx; /* Section header string table index */ -+} Elf64_Ehdr; -+ -+/* Fields in the e_ident array. The EI_* macros are indices into the -+ array. The macros under each EI_* macro are the values the byte -+ may have. */ -+ -+#define EI_MAG0 0 /* File identification byte 0 index */ -+#define ELFMAG0 0x7f /* Magic number byte 0 */ -+ -+#define EI_MAG1 1 /* File identification byte 1 index */ -+#define ELFMAG1 'E' /* Magic number byte 1 */ -+ -+#define EI_MAG2 2 /* File identification byte 2 index */ -+#define ELFMAG2 'L' /* Magic number byte 2 */ -+ -+#define EI_MAG3 3 /* File identification byte 3 index */ -+#define ELFMAG3 'F' /* Magic number byte 3 */ -+ -+/* Conglomeration of the identification bytes, for easy testing as a word. */ -+#define ELFMAG "\177ELF" -+#define SELFMAG 4 -+ -+#define EI_CLASS 4 /* File class byte index */ -+#define ELFCLASSNONE 0 /* Invalid class */ -+#define ELFCLASS32 1 /* 32-bit objects */ -+#define ELFCLASS64 2 /* 64-bit objects */ -+#define ELFCLASSNUM 3 -+ -+#define EI_DATA 5 /* Data encoding byte index */ -+#define ELFDATANONE 0 /* Invalid data encoding */ -+#define ELFDATA2LSB 1 /* 2's complement, little endian */ -+#define ELFDATA2MSB 2 /* 2's complement, big endian */ -+#define ELFDATANUM 3 -+ -+#define EI_VERSION 6 /* File version byte index */ -+ /* Value must be EV_CURRENT */ -+ -+#define EI_OSABI 7 /* OS ABI identification */ -+#define ELFOSABI_NONE 0 /* UNIX System V ABI */ -+#define ELFOSABI_SYSV 0 /* Alias. */ -+#define ELFOSABI_HPUX 1 /* HP-UX */ -+#define ELFOSABI_NETBSD 2 /* NetBSD. */ -+#define ELFOSABI_GNU 3 /* Object uses GNU ELF extensions. */ -+#define ELFOSABI_LINUX ELFOSABI_GNU /* Compatibility alias. */ -+#define ELFOSABI_SOLARIS 6 /* Sun Solaris. */ -+#define ELFOSABI_AIX 7 /* IBM AIX. */ -+#define ELFOSABI_IRIX 8 /* SGI Irix. */ -+#define ELFOSABI_FREEBSD 9 /* FreeBSD. */ -+#define ELFOSABI_TRU64 10 /* Compaq TRU64 UNIX. */ -+#define ELFOSABI_MODESTO 11 /* Novell Modesto. */ -+#define ELFOSABI_OPENBSD 12 /* OpenBSD. */ -+#define ELFOSABI_ARM_AEABI 64 /* ARM EABI */ -+#define ELFOSABI_ARM 97 /* ARM */ -+#define ELFOSABI_STANDALONE 255 /* Standalone (embedded) application */ -+ -+#define EI_ABIVERSION 8 /* ABI version */ -+ -+#define EI_PAD 9 /* Byte index of padding bytes */ -+ -+/* Legal values for e_type (object file type). */ -+ -+#define ET_NONE 0 /* No file type */ -+#define ET_REL 1 /* Relocatable file */ -+#define ET_EXEC 2 /* Executable file */ -+#define ET_DYN 3 /* Shared object file */ -+#define ET_CORE 4 /* Core file */ -+#define ET_NUM 5 /* Number of defined types */ -+#define ET_LOOS 0xfe00 /* OS-specific range start */ -+#define ET_HIOS 0xfeff /* OS-specific range end */ -+#define ET_LOPROC 0xff00 /* Processor-specific range start */ -+#define ET_HIPROC 0xffff /* Processor-specific range end */ -+ -+/* Legal values for e_machine (architecture). */ -+ -+#define EM_NONE 0 /* No machine */ -+#define EM_M32 1 /* AT&T WE 32100 */ -+#define EM_SPARC 2 /* SUN SPARC */ -+#define EM_386 3 /* Intel 80386 */ -+#define EM_68K 4 /* Motorola m68k family */ -+#define EM_88K 5 /* Motorola m88k family */ -+#define EM_860 7 /* Intel 80860 */ -+#define EM_MIPS 8 /* MIPS R3000 big-endian */ -+#define EM_S370 9 /* IBM System/370 */ -+#define EM_MIPS_RS3_LE 10 /* MIPS R3000 little-endian */ -+ -+#define EM_PARISC 15 /* HPPA */ -+#define EM_VPP500 17 /* Fujitsu VPP500 */ -+#define EM_SPARC32PLUS 18 /* Sun's "v8plus" */ -+#define EM_960 19 /* Intel 80960 */ -+#define EM_PPC 20 /* PowerPC */ -+#define EM_PPC64 21 /* PowerPC 64-bit */ -+#define EM_S390 22 /* IBM S390 */ -+ -+#define EM_V800 36 /* NEC V800 series */ -+#define EM_FR20 37 /* Fujitsu FR20 */ -+#define EM_RH32 38 /* TRW RH-32 */ -+#define EM_RCE 39 /* Motorola RCE */ -+#define EM_ARM 40 /* ARM */ -+#define EM_FAKE_ALPHA 41 /* Digital Alpha */ -+#define EM_SH 42 /* Hitachi SH */ -+#define EM_SPARCV9 43 /* SPARC v9 64-bit */ -+#define EM_TRICORE 44 /* Siemens Tricore */ -+#define EM_ARC 45 /* Argonaut RISC Core */ -+#define EM_H8_300 46 /* Hitachi H8/300 */ -+#define EM_H8_300H 47 /* Hitachi H8/300H */ -+#define EM_H8S 48 /* Hitachi H8S */ -+#define EM_H8_500 49 /* Hitachi H8/500 */ -+#define EM_IA_64 50 /* Intel Merced */ -+#define EM_MIPS_X 51 /* Stanford MIPS-X */ -+#define EM_COLDFIRE 52 /* Motorola Coldfire */ -+#define EM_68HC12 53 /* Motorola M68HC12 */ -+#define EM_MMA 54 /* Fujitsu MMA Multimedia Accelerator*/ -+#define EM_PCP 55 /* Siemens PCP */ -+#define EM_NCPU 56 /* Sony nCPU embeeded RISC */ -+#define EM_NDR1 57 /* Denso NDR1 microprocessor */ -+#define EM_STARCORE 58 /* Motorola Start*Core processor */ -+#define EM_ME16 59 /* Toyota ME16 processor */ -+#define EM_ST100 60 /* STMicroelectronic ST100 processor */ -+#define EM_TINYJ 61 /* Advanced Logic Corp. Tinyj emb.fam*/ -+#define EM_X86_64 62 /* AMD x86-64 architecture */ -+#define EM_PDSP 63 /* Sony DSP Processor */ -+ -+#define EM_FX66 66 /* Siemens FX66 microcontroller */ -+#define EM_ST9PLUS 67 /* STMicroelectronics ST9+ 8/16 mc */ -+#define EM_ST7 68 /* STmicroelectronics ST7 8 bit mc */ -+#define EM_68HC16 69 /* Motorola MC68HC16 microcontroller */ -+#define EM_68HC11 70 /* Motorola MC68HC11 microcontroller */ -+#define EM_68HC08 71 /* Motorola MC68HC08 microcontroller */ -+#define EM_68HC05 72 /* Motorola MC68HC05 microcontroller */ -+#define EM_SVX 73 /* Silicon Graphics SVx */ -+#define EM_ST19 74 /* STMicroelectronics ST19 8 bit mc */ -+#define EM_VAX 75 /* Digital VAX */ -+#define EM_CRIS 76 /* Axis Communications 32-bit embedded processor */ -+#define EM_JAVELIN 77 /* Infineon Technologies 32-bit embedded processor */ -+#define EM_FIREPATH 78 /* Element 14 64-bit DSP Processor */ -+#define EM_ZSP 79 /* LSI Logic 16-bit DSP Processor */ -+#define EM_MMIX 80 /* Donald Knuth's educational 64-bit processor */ -+#define EM_HUANY 81 /* Harvard University machine-independent object files */ -+#define EM_PRISM 82 /* SiTera Prism */ -+#define EM_AVR 83 /* Atmel AVR 8-bit microcontroller */ -+#define EM_FR30 84 /* Fujitsu FR30 */ -+#define EM_D10V 85 /* Mitsubishi D10V */ -+#define EM_D30V 86 /* Mitsubishi D30V */ -+#define EM_V850 87 /* NEC v850 */ -+#define EM_M32R 88 /* Mitsubishi M32R */ -+#define EM_MN10300 89 /* Matsushita MN10300 */ -+#define EM_MN10200 90 /* Matsushita MN10200 */ -+#define EM_PJ 91 /* picoJava */ -+#define EM_OPENRISC 92 /* OpenRISC 32-bit embedded processor */ -+#define EM_ARC_A5 93 /* ARC Cores Tangent-A5 */ -+#define EM_XTENSA 94 /* Tensilica Xtensa Architecture */ -+#define EM_TILEPRO 188 /* Tilera TILEPro */ -+#define EM_TILEGX 191 /* Tilera TILE-Gx */ -+#define EM_NUM 192 -+ -+/* If it is necessary to assign new unofficial EM_* values, please -+ pick large random numbers (0x8523, 0xa7f2, etc.) to minimize the -+ chances of collision with official or non-GNU unofficial values. */ -+ -+#define EM_ALPHA 0x9026 -+ -+/* Legal values for e_version (version). */ -+ -+#define EV_NONE 0 /* Invalid ELF version */ -+#define EV_CURRENT 1 /* Current version */ -+#define EV_NUM 2 -+ -+/* Section header. */ -+ -+typedef struct -+{ -+ Elf32_Word sh_name; /* Section name (string tbl index) */ -+ Elf32_Word sh_type; /* Section type */ -+ Elf32_Word sh_flags; /* Section flags */ -+ Elf32_Addr sh_addr; /* Section virtual addr at execution */ -+ Elf32_Off sh_offset; /* Section file offset */ -+ Elf32_Word sh_size; /* Section size in bytes */ -+ Elf32_Word sh_link; /* Link to another section */ -+ Elf32_Word sh_info; /* Additional section information */ -+ Elf32_Word sh_addralign; /* Section alignment */ -+ Elf32_Word sh_entsize; /* Entry size if section holds table */ -+} Elf32_Shdr; -+ -+typedef struct -+{ -+ Elf64_Word sh_name; /* Section name (string tbl index) */ -+ Elf64_Word sh_type; /* Section type */ -+ Elf64_Xword sh_flags; /* Section flags */ -+ Elf64_Addr sh_addr; /* Section virtual addr at execution */ -+ Elf64_Off sh_offset; /* Section file offset */ -+ Elf64_Xword sh_size; /* Section size in bytes */ -+ Elf64_Word sh_link; /* Link to another section */ -+ Elf64_Word sh_info; /* Additional section information */ -+ Elf64_Xword sh_addralign; /* Section alignment */ -+ Elf64_Xword sh_entsize; /* Entry size if section holds table */ -+} Elf64_Shdr; -+ -+/* Special section indices. */ -+ -+#define SHN_UNDEF 0 /* Undefined section */ -+#define SHN_LORESERVE 0xff00 /* Start of reserved indices */ -+#define SHN_LOPROC 0xff00 /* Start of processor-specific */ -+#define SHN_BEFORE 0xff00 /* Order section before all others -+ (Solaris). */ -+#define SHN_AFTER 0xff01 /* Order section after all others -+ (Solaris). */ -+#define SHN_HIPROC 0xff1f /* End of processor-specific */ -+#define SHN_LOOS 0xff20 /* Start of OS-specific */ -+#define SHN_HIOS 0xff3f /* End of OS-specific */ -+#define SHN_ABS 0xfff1 /* Associated symbol is absolute */ -+#define SHN_COMMON 0xfff2 /* Associated symbol is common */ -+#define SHN_XINDEX 0xffff /* Index is in extra table. */ -+#define SHN_HIRESERVE 0xffff /* End of reserved indices */ -+ -+/* Legal values for sh_type (section type). */ -+ -+#define SHT_NULL 0 /* Section header table entry unused */ -+#define SHT_PROGBITS 1 /* Program data */ -+#define SHT_SYMTAB 2 /* Symbol table */ -+#define SHT_STRTAB 3 /* String table */ -+#define SHT_RELA 4 /* Relocation entries with addends */ -+#define SHT_HASH 5 /* Symbol hash table */ -+#define SHT_DYNAMIC 6 /* Dynamic linking information */ -+#define SHT_NOTE 7 /* Notes */ -+#define SHT_NOBITS 8 /* Program space with no data (bss) */ -+#define SHT_REL 9 /* Relocation entries, no addends */ -+#define SHT_SHLIB 10 /* Reserved */ -+#define SHT_DYNSYM 11 /* Dynamic linker symbol table */ -+#define SHT_INIT_ARRAY 14 /* Array of constructors */ -+#define SHT_FINI_ARRAY 15 /* Array of destructors */ -+#define SHT_PREINIT_ARRAY 16 /* Array of pre-constructors */ -+#define SHT_GROUP 17 /* Section group */ -+#define SHT_SYMTAB_SHNDX 18 /* Extended section indeces */ -+#define SHT_NUM 19 /* Number of defined types. */ -+#define SHT_LOOS 0x60000000 /* Start OS-specific. */ -+#define SHT_GNU_ATTRIBUTES 0x6ffffff5 /* Object attributes. */ -+#define SHT_GNU_HASH 0x6ffffff6 /* GNU-style hash table. */ -+#define SHT_GNU_LIBLIST 0x6ffffff7 /* Prelink library list */ -+#define SHT_CHECKSUM 0x6ffffff8 /* Checksum for DSO content. */ -+#define SHT_LOSUNW 0x6ffffffa /* Sun-specific low bound. */ -+#define SHT_SUNW_move 0x6ffffffa -+#define SHT_SUNW_COMDAT 0x6ffffffb -+#define SHT_SUNW_syminfo 0x6ffffffc -+#define SHT_GNU_verdef 0x6ffffffd /* Version definition section. */ -+#define SHT_GNU_verneed 0x6ffffffe /* Version needs section. */ -+#define SHT_GNU_versym 0x6fffffff /* Version symbol table. */ -+#define SHT_HISUNW 0x6fffffff /* Sun-specific high bound. */ -+#define SHT_HIOS 0x6fffffff /* End OS-specific type */ -+#define SHT_LOPROC 0x70000000 /* Start of processor-specific */ -+#define SHT_HIPROC 0x7fffffff /* End of processor-specific */ -+#define SHT_LOUSER 0x80000000 /* Start of application-specific */ -+#define SHT_HIUSER 0x8fffffff /* End of application-specific */ -+ -+/* Legal values for sh_flags (section flags). */ -+ -+#define SHF_WRITE (1 << 0) /* Writable */ -+#define SHF_ALLOC (1 << 1) /* Occupies memory during execution */ -+#define SHF_EXECINSTR (1 << 2) /* Executable */ -+#define SHF_MERGE (1 << 4) /* Might be merged */ -+#define SHF_STRINGS (1 << 5) /* Contains nul-terminated strings */ -+#define SHF_INFO_LINK (1 << 6) /* `sh_info' contains SHT index */ -+#define SHF_LINK_ORDER (1 << 7) /* Preserve order after combining */ -+#define SHF_OS_NONCONFORMING (1 << 8) /* Non-standard OS specific handling -+ required */ -+#define SHF_GROUP (1 << 9) /* Section is member of a group. */ -+#define SHF_TLS (1 << 10) /* Section hold thread-local data. */ -+#define SHF_MASKOS 0x0ff00000 /* OS-specific. */ -+#define SHF_MASKPROC 0xf0000000 /* Processor-specific */ -+#define SHF_ORDERED (1 << 30) /* Special ordering requirement -+ (Solaris). */ -+#define SHF_EXCLUDE (1 << 31) /* Section is excluded unless -+ referenced or allocated (Solaris).*/ -+ -+/* Section group handling. */ -+#define GRP_COMDAT 0x1 /* Mark group as COMDAT. */ -+ -+/* Symbol table entry. */ -+ -+typedef struct -+{ -+ Elf32_Word st_name; /* Symbol name (string tbl index) */ -+ Elf32_Addr st_value; /* Symbol value */ -+ Elf32_Word st_size; /* Symbol size */ -+ unsigned char st_info; /* Symbol type and binding */ -+ unsigned char st_other; /* Symbol visibility */ -+ Elf32_Section st_shndx; /* Section index */ -+} Elf32_Sym; -+ -+typedef struct -+{ -+ Elf64_Word st_name; /* Symbol name (string tbl index) */ -+ unsigned char st_info; /* Symbol type and binding */ -+ unsigned char st_other; /* Symbol visibility */ -+ Elf64_Section st_shndx; /* Section index */ -+ Elf64_Addr st_value; /* Symbol value */ -+ Elf64_Xword st_size; /* Symbol size */ -+} Elf64_Sym; -+ -+/* The syminfo section if available contains additional information about -+ every dynamic symbol. */ -+ -+typedef struct -+{ -+ Elf32_Half si_boundto; /* Direct bindings, symbol bound to */ -+ Elf32_Half si_flags; /* Per symbol flags */ -+} Elf32_Syminfo; -+ -+typedef struct -+{ -+ Elf64_Half si_boundto; /* Direct bindings, symbol bound to */ -+ Elf64_Half si_flags; /* Per symbol flags */ -+} Elf64_Syminfo; -+ -+/* Possible values for si_boundto. */ -+#define SYMINFO_BT_SELF 0xffff /* Symbol bound to self */ -+#define SYMINFO_BT_PARENT 0xfffe /* Symbol bound to parent */ -+#define SYMINFO_BT_LOWRESERVE 0xff00 /* Beginning of reserved entries */ -+ -+/* Possible bitmasks for si_flags. */ -+#define SYMINFO_FLG_DIRECT 0x0001 /* Direct bound symbol */ -+#define SYMINFO_FLG_PASSTHRU 0x0002 /* Pass-thru symbol for translator */ -+#define SYMINFO_FLG_COPY 0x0004 /* Symbol is a copy-reloc */ -+#define SYMINFO_FLG_LAZYLOAD 0x0008 /* Symbol bound to object to be lazy -+ loaded */ -+/* Syminfo version values. */ -+#define SYMINFO_NONE 0 -+#define SYMINFO_CURRENT 1 -+#define SYMINFO_NUM 2 -+ -+ -+/* How to extract and insert information held in the st_info field. */ -+ -+#define ELF32_ST_BIND(val) (((unsigned char) (val)) >> 4) -+#define ELF32_ST_TYPE(val) ((val) & 0xf) -+#define ELF32_ST_INFO(bind, type) (((bind) << 4) + ((type) & 0xf)) -+ -+/* Both Elf32_Sym and Elf64_Sym use the same one-byte st_info field. */ -+#define ELF64_ST_BIND(val) ELF32_ST_BIND (val) -+#define ELF64_ST_TYPE(val) ELF32_ST_TYPE (val) -+#define ELF64_ST_INFO(bind, type) ELF32_ST_INFO ((bind), (type)) -+ -+/* Legal values for ST_BIND subfield of st_info (symbol binding). */ -+ -+#define STB_LOCAL 0 /* Local symbol */ -+#define STB_GLOBAL 1 /* Global symbol */ -+#define STB_WEAK 2 /* Weak symbol */ -+#define STB_NUM 3 /* Number of defined types. */ -+#define STB_LOOS 10 /* Start of OS-specific */ -+#define STB_GNU_UNIQUE 10 /* Unique symbol. */ -+#define STB_HIOS 12 /* End of OS-specific */ -+#define STB_LOPROC 13 /* Start of processor-specific */ -+#define STB_HIPROC 15 /* End of processor-specific */ -+ -+/* Legal values for ST_TYPE subfield of st_info (symbol type). */ -+ -+#define STT_NOTYPE 0 /* Symbol type is unspecified */ -+#define STT_OBJECT 1 /* Symbol is a data object */ -+#define STT_FUNC 2 /* Symbol is a code object */ -+#define STT_SECTION 3 /* Symbol associated with a section */ -+#define STT_FILE 4 /* Symbol's name is file name */ -+#define STT_COMMON 5 /* Symbol is a common data object */ -+#define STT_TLS 6 /* Symbol is thread-local data object*/ -+#define STT_NUM 7 /* Number of defined types. */ -+#define STT_LOOS 10 /* Start of OS-specific */ -+#define STT_GNU_IFUNC 10 /* Symbol is indirect code object */ -+#define STT_HIOS 12 /* End of OS-specific */ -+#define STT_LOPROC 13 /* Start of processor-specific */ -+#define STT_HIPROC 15 /* End of processor-specific */ -+ -+ -+/* Symbol table indices are found in the hash buckets and chain table -+ of a symbol hash table section. This special index value indicates -+ the end of a chain, meaning no further symbols are found in that bucket. */ -+ -+#define STN_UNDEF 0 /* End of a chain. */ -+ -+ -+/* How to extract and insert information held in the st_other field. */ -+ -+#define ELF32_ST_VISIBILITY(o) ((o) & 0x03) -+ -+/* For ELF64 the definitions are the same. */ -+#define ELF64_ST_VISIBILITY(o) ELF32_ST_VISIBILITY (o) -+ -+/* Symbol visibility specification encoded in the st_other field. */ -+#define STV_DEFAULT 0 /* Default symbol visibility rules */ -+#define STV_INTERNAL 1 /* Processor specific hidden class */ -+#define STV_HIDDEN 2 /* Sym unavailable in other modules */ -+#define STV_PROTECTED 3 /* Not preemptible, not exported */ -+ -+ -+/* Relocation table entry without addend (in section of type SHT_REL). */ -+ -+typedef struct -+{ -+ Elf32_Addr r_offset; /* Address */ -+ Elf32_Word r_info; /* Relocation type and symbol index */ -+} Elf32_Rel; -+ -+/* I have seen two different definitions of the Elf64_Rel and -+ Elf64_Rela structures, so we'll leave them out until Novell (or -+ whoever) gets their act together. */ -+/* The following, at least, is used on Sparc v9, MIPS, and Alpha. */ -+ -+typedef struct -+{ -+ Elf64_Addr r_offset; /* Address */ -+ Elf64_Xword r_info; /* Relocation type and symbol index */ -+} Elf64_Rel; -+ -+/* Relocation table entry with addend (in section of type SHT_RELA). */ -+ -+typedef struct -+{ -+ Elf32_Addr r_offset; /* Address */ -+ Elf32_Word r_info; /* Relocation type and symbol index */ -+ Elf32_Sword r_addend; /* Addend */ -+} Elf32_Rela; -+ -+typedef struct -+{ -+ Elf64_Addr r_offset; /* Address */ -+ Elf64_Xword r_info; /* Relocation type and symbol index */ -+ Elf64_Sxword r_addend; /* Addend */ -+} Elf64_Rela; -+ -+/* How to extract and insert information held in the r_info field. */ -+ -+#define ELF32_R_SYM(val) ((val) >> 8) -+#define ELF32_R_TYPE(val) ((val) & 0xff) -+#define ELF32_R_INFO(sym, type) (((sym) << 8) + ((type) & 0xff)) -+ -+#define ELF64_R_SYM(i) ((i) >> 32) -+#define ELF64_R_TYPE(i) ((i) & 0xffffffff) -+#define ELF64_R_INFO(sym,type) ((((Elf64_Xword) (sym)) << 32) + (type)) -+ -+/* Program segment header. */ -+ -+typedef struct -+{ -+ Elf32_Word p_type; /* Segment type */ -+ Elf32_Off p_offset; /* Segment file offset */ -+ Elf32_Addr p_vaddr; /* Segment virtual address */ -+ Elf32_Addr p_paddr; /* Segment physical address */ -+ Elf32_Word p_filesz; /* Segment size in file */ -+ Elf32_Word p_memsz; /* Segment size in memory */ -+ Elf32_Word p_flags; /* Segment flags */ -+ Elf32_Word p_align; /* Segment alignment */ -+} Elf32_Phdr; -+ -+typedef struct -+{ -+ Elf64_Word p_type; /* Segment type */ -+ Elf64_Word p_flags; /* Segment flags */ -+ Elf64_Off p_offset; /* Segment file offset */ -+ Elf64_Addr p_vaddr; /* Segment virtual address */ -+ Elf64_Addr p_paddr; /* Segment physical address */ -+ Elf64_Xword p_filesz; /* Segment size in file */ -+ Elf64_Xword p_memsz; /* Segment size in memory */ -+ Elf64_Xword p_align; /* Segment alignment */ -+} Elf64_Phdr; -+ -+/* Special value for e_phnum. This indicates that the real number of -+ program headers is too large to fit into e_phnum. Instead the real -+ value is in the field sh_info of section 0. */ -+ -+#define PN_XNUM 0xffff -+ -+/* Legal values for p_type (segment type). */ -+ -+#define PT_NULL 0 /* Program header table entry unused */ -+#define PT_LOAD 1 /* Loadable program segment */ -+#define PT_DYNAMIC 2 /* Dynamic linking information */ -+#define PT_INTERP 3 /* Program interpreter */ -+#define PT_NOTE 4 /* Auxiliary information */ -+#define PT_SHLIB 5 /* Reserved */ -+#define PT_PHDR 6 /* Entry for header table itself */ -+#define PT_TLS 7 /* Thread-local storage segment */ -+#define PT_NUM 8 /* Number of defined types */ -+#define PT_LOOS 0x60000000 /* Start of OS-specific */ -+#define PT_GNU_EH_FRAME 0x6474e550 /* GCC .eh_frame_hdr segment */ -+#define PT_GNU_STACK 0x6474e551 /* Indicates stack executability */ -+#define PT_GNU_RELRO 0x6474e552 /* Read-only after relocation */ -+#define PT_LOSUNW 0x6ffffffa -+#define PT_SUNWBSS 0x6ffffffa /* Sun Specific segment */ -+#define PT_SUNWSTACK 0x6ffffffb /* Stack segment */ -+#define PT_HISUNW 0x6fffffff -+#define PT_HIOS 0x6fffffff /* End of OS-specific */ -+#define PT_LOPROC 0x70000000 /* Start of processor-specific */ -+#define PT_HIPROC 0x7fffffff /* End of processor-specific */ -+ -+/* Legal values for p_flags (segment flags). */ -+ -+#define PF_X (1 << 0) /* Segment is executable */ -+#define PF_W (1 << 1) /* Segment is writable */ -+#define PF_R (1 << 2) /* Segment is readable */ -+#define PF_MASKOS 0x0ff00000 /* OS-specific */ -+#define PF_MASKPROC 0xf0000000 /* Processor-specific */ -+ -+/* Legal values for note segment descriptor types for core files. */ -+ -+#define NT_PRSTATUS 1 /* Contains copy of prstatus struct */ -+#define NT_FPREGSET 2 /* Contains copy of fpregset struct */ -+#define NT_PRPSINFO 3 /* Contains copy of prpsinfo struct */ -+#define NT_PRXREG 4 /* Contains copy of prxregset struct */ -+#define NT_TASKSTRUCT 4 /* Contains copy of task structure */ -+#define NT_PLATFORM 5 /* String from sysinfo(SI_PLATFORM) */ -+#define NT_AUXV 6 /* Contains copy of auxv array */ -+#define NT_GWINDOWS 7 /* Contains copy of gwindows struct */ -+#define NT_ASRS 8 /* Contains copy of asrset struct */ -+#define NT_PSTATUS 10 /* Contains copy of pstatus struct */ -+#define NT_PSINFO 13 /* Contains copy of psinfo struct */ -+#define NT_PRCRED 14 /* Contains copy of prcred struct */ -+#define NT_UTSNAME 15 /* Contains copy of utsname struct */ -+#define NT_LWPSTATUS 16 /* Contains copy of lwpstatus struct */ -+#define NT_LWPSINFO 17 /* Contains copy of lwpinfo struct */ -+#define NT_PRFPXREG 20 /* Contains copy of fprxregset struct */ -+#define NT_PRXFPREG 0x46e62b7f /* Contains copy of user_fxsr_struct */ -+#define NT_PPC_VMX 0x100 /* PowerPC Altivec/VMX registers */ -+#define NT_PPC_SPE 0x101 /* PowerPC SPE/EVR registers */ -+#define NT_PPC_VSX 0x102 /* PowerPC VSX registers */ -+#define NT_386_TLS 0x200 /* i386 TLS slots (struct user_desc) */ -+#define NT_386_IOPERM 0x201 /* x86 io permission bitmap (1=deny) */ -+#define NT_X86_XSTATE 0x202 /* x86 extended state using xsave */ -+ -+/* Legal values for the note segment descriptor types for object files. */ -+ -+#define NT_VERSION 1 /* Contains a version string. */ -+ -+ -+/* Dynamic section entry. */ -+ -+typedef struct -+{ -+ Elf32_Sword d_tag; /* Dynamic entry type */ -+ union -+ { -+ Elf32_Word d_val; /* Integer value */ -+ Elf32_Addr d_ptr; /* Address value */ -+ } d_un; -+} Elf32_Dyn; -+ -+typedef struct -+{ -+ Elf64_Sxword d_tag; /* Dynamic entry type */ -+ union -+ { -+ Elf64_Xword d_val; /* Integer value */ -+ Elf64_Addr d_ptr; /* Address value */ -+ } d_un; -+} Elf64_Dyn; -+ -+/* Legal values for d_tag (dynamic entry type). */ -+ -+#define DT_NULL 0 /* Marks end of dynamic section */ -+#define DT_NEEDED 1 /* Name of needed library */ -+#define DT_PLTRELSZ 2 /* Size in bytes of PLT relocs */ -+#define DT_PLTGOT 3 /* Processor defined value */ -+#define DT_HASH 4 /* Address of symbol hash table */ -+#define DT_STRTAB 5 /* Address of string table */ -+#define DT_SYMTAB 6 /* Address of symbol table */ -+#define DT_RELA 7 /* Address of Rela relocs */ -+#define DT_RELASZ 8 /* Total size of Rela relocs */ -+#define DT_RELAENT 9 /* Size of one Rela reloc */ -+#define DT_STRSZ 10 /* Size of string table */ -+#define DT_SYMENT 11 /* Size of one symbol table entry */ -+#define DT_INIT 12 /* Address of init function */ -+#define DT_FINI 13 /* Address of termination function */ -+#define DT_SONAME 14 /* Name of shared object */ -+#define DT_RPATH 15 /* Library search path (deprecated) */ -+#define DT_SYMBOLIC 16 /* Start symbol search here */ -+#define DT_REL 17 /* Address of Rel relocs */ -+#define DT_RELSZ 18 /* Total size of Rel relocs */ -+#define DT_RELENT 19 /* Size of one Rel reloc */ -+#define DT_PLTREL 20 /* Type of reloc in PLT */ -+#define DT_DEBUG 21 /* For debugging; unspecified */ -+#define DT_TEXTREL 22 /* Reloc might modify .text */ -+#define DT_JMPREL 23 /* Address of PLT relocs */ -+#define DT_BIND_NOW 24 /* Process relocations of object */ -+#define DT_INIT_ARRAY 25 /* Array with addresses of init fct */ -+#define DT_FINI_ARRAY 26 /* Array with addresses of fini fct */ -+#define DT_INIT_ARRAYSZ 27 /* Size in bytes of DT_INIT_ARRAY */ -+#define DT_FINI_ARRAYSZ 28 /* Size in bytes of DT_FINI_ARRAY */ -+#define DT_RUNPATH 29 /* Library search path */ -+#define DT_FLAGS 30 /* Flags for the object being loaded */ -+#define DT_ENCODING 32 /* Start of encoded range */ -+#define DT_PREINIT_ARRAY 32 /* Array with addresses of preinit fct*/ -+#define DT_PREINIT_ARRAYSZ 33 /* size in bytes of DT_PREINIT_ARRAY */ -+#define DT_NUM 34 /* Number used */ -+#define DT_LOOS 0x6000000d /* Start of OS-specific */ -+#define DT_HIOS 0x6ffff000 /* End of OS-specific */ -+#define DT_LOPROC 0x70000000 /* Start of processor-specific */ -+#define DT_HIPROC 0x7fffffff /* End of processor-specific */ -+#define DT_PROCNUM DT_MIPS_NUM /* Most used by any processor */ -+ -+/* DT_* entries which fall between DT_VALRNGHI & DT_VALRNGLO use the -+ Dyn.d_un.d_val field of the Elf*_Dyn structure. This follows Sun's -+ approach. */ -+#define DT_VALRNGLO 0x6ffffd00 -+#define DT_GNU_PRELINKED 0x6ffffdf5 /* Prelinking timestamp */ -+#define DT_GNU_CONFLICTSZ 0x6ffffdf6 /* Size of conflict section */ -+#define DT_GNU_LIBLISTSZ 0x6ffffdf7 /* Size of library list */ -+#define DT_CHECKSUM 0x6ffffdf8 -+#define DT_PLTPADSZ 0x6ffffdf9 -+#define DT_MOVEENT 0x6ffffdfa -+#define DT_MOVESZ 0x6ffffdfb -+#define DT_FEATURE_1 0x6ffffdfc /* Feature selection (DTF_*). */ -+#define DT_POSFLAG_1 0x6ffffdfd /* Flags for DT_* entries, effecting -+ the following DT_* entry. */ -+#define DT_SYMINSZ 0x6ffffdfe /* Size of syminfo table (in bytes) */ -+#define DT_SYMINENT 0x6ffffdff /* Entry size of syminfo */ -+#define DT_VALRNGHI 0x6ffffdff -+#define DT_VALTAGIDX(tag) (DT_VALRNGHI - (tag)) /* Reverse order! */ -+#define DT_VALNUM 12 -+ -+/* DT_* entries which fall between DT_ADDRRNGHI & DT_ADDRRNGLO use the -+ Dyn.d_un.d_ptr field of the Elf*_Dyn structure. -+ -+ If any adjustment is made to the ELF object after it has been -+ built these entries will need to be adjusted. */ -+#define DT_ADDRRNGLO 0x6ffffe00 -+#define DT_GNU_HASH 0x6ffffef5 /* GNU-style hash table. */ -+#define DT_TLSDESC_PLT 0x6ffffef6 -+#define DT_TLSDESC_GOT 0x6ffffef7 -+#define DT_GNU_CONFLICT 0x6ffffef8 /* Start of conflict section */ -+#define DT_GNU_LIBLIST 0x6ffffef9 /* Library list */ -+#define DT_CONFIG 0x6ffffefa /* Configuration information. */ -+#define DT_DEPAUDIT 0x6ffffefb /* Dependency auditing. */ -+#define DT_AUDIT 0x6ffffefc /* Object auditing. */ -+#define DT_PLTPAD 0x6ffffefd /* PLT padding. */ -+#define DT_MOVETAB 0x6ffffefe /* Move table. */ -+#define DT_SYMINFO 0x6ffffeff /* Syminfo table. */ -+#define DT_ADDRRNGHI 0x6ffffeff -+#define DT_ADDRTAGIDX(tag) (DT_ADDRRNGHI - (tag)) /* Reverse order! */ -+#define DT_ADDRNUM 11 -+ -+/* The versioning entry types. The next are defined as part of the -+ GNU extension. */ -+#define DT_VERSYM 0x6ffffff0 -+ -+#define DT_RELACOUNT 0x6ffffff9 -+#define DT_RELCOUNT 0x6ffffffa -+ -+/* These were chosen by Sun. */ -+#define DT_FLAGS_1 0x6ffffffb /* State flags, see DF_1_* below. */ -+#define DT_VERDEF 0x6ffffffc /* Address of version definition -+ table */ -+#define DT_VERDEFNUM 0x6ffffffd /* Number of version definitions */ -+#define DT_VERNEED 0x6ffffffe /* Address of table with needed -+ versions */ -+#define DT_VERNEEDNUM 0x6fffffff /* Number of needed versions */ -+#define DT_VERSIONTAGIDX(tag) (DT_VERNEEDNUM - (tag)) /* Reverse order! */ -+#define DT_VERSIONTAGNUM 16 -+ -+/* Sun added these machine-independent extensions in the "processor-specific" -+ range. Be compatible. */ -+#define DT_AUXILIARY 0x7ffffffd /* Shared object to load before self */ -+#define DT_FILTER 0x7fffffff /* Shared object to get values from */ -+#define DT_EXTRATAGIDX(tag) ((Elf32_Word)-((Elf32_Sword) (tag) <<1>>1)-1) -+#define DT_EXTRANUM 3 -+ -+/* Values of `d_un.d_val' in the DT_FLAGS entry. */ -+#define DF_ORIGIN 0x00000001 /* Object may use DF_ORIGIN */ -+#define DF_SYMBOLIC 0x00000002 /* Symbol resolutions starts here */ -+#define DF_TEXTREL 0x00000004 /* Object contains text relocations */ -+#define DF_BIND_NOW 0x00000008 /* No lazy binding for this object */ -+#define DF_STATIC_TLS 0x00000010 /* Module uses the static TLS model */ -+ -+/* State flags selectable in the `d_un.d_val' element of the DT_FLAGS_1 -+ entry in the dynamic section. */ -+#define DF_1_NOW 0x00000001 /* Set RTLD_NOW for this object. */ -+#define DF_1_GLOBAL 0x00000002 /* Set RTLD_GLOBAL for this object. */ -+#define DF_1_GROUP 0x00000004 /* Set RTLD_GROUP for this object. */ -+#define DF_1_NODELETE 0x00000008 /* Set RTLD_NODELETE for this object.*/ -+#define DF_1_LOADFLTR 0x00000010 /* Trigger filtee loading at runtime.*/ -+#define DF_1_INITFIRST 0x00000020 /* Set RTLD_INITFIRST for this object*/ -+#define DF_1_NOOPEN 0x00000040 /* Set RTLD_NOOPEN for this object. */ -+#define DF_1_ORIGIN 0x00000080 /* $ORIGIN must be handled. */ -+#define DF_1_DIRECT 0x00000100 /* Direct binding enabled. */ -+#define DF_1_TRANS 0x00000200 -+#define DF_1_INTERPOSE 0x00000400 /* Object is used to interpose. */ -+#define DF_1_NODEFLIB 0x00000800 /* Ignore default lib search path. */ -+#define DF_1_NODUMP 0x00001000 /* Object can't be dldump'ed. */ -+#define DF_1_CONFALT 0x00002000 /* Configuration alternative created.*/ -+#define DF_1_ENDFILTEE 0x00004000 /* Filtee terminates filters search. */ -+#define DF_1_DISPRELDNE 0x00008000 /* Disp reloc applied at build time. */ -+#define DF_1_DISPRELPND 0x00010000 /* Disp reloc applied at run-time. */ -+ -+/* Flags for the feature selection in DT_FEATURE_1. */ -+#define DTF_1_PARINIT 0x00000001 -+#define DTF_1_CONFEXP 0x00000002 -+ -+/* Flags in the DT_POSFLAG_1 entry effecting only the next DT_* entry. */ -+#define DF_P1_LAZYLOAD 0x00000001 /* Lazyload following object. */ -+#define DF_P1_GROUPPERM 0x00000002 /* Symbols from next object are not -+ generally available. */ -+ -+/* Version definition sections. */ -+ -+typedef struct -+{ -+ Elf32_Half vd_version; /* Version revision */ -+ Elf32_Half vd_flags; /* Version information */ -+ Elf32_Half vd_ndx; /* Version Index */ -+ Elf32_Half vd_cnt; /* Number of associated aux entries */ -+ Elf32_Word vd_hash; /* Version name hash value */ -+ Elf32_Word vd_aux; /* Offset in bytes to verdaux array */ -+ Elf32_Word vd_next; /* Offset in bytes to next verdef -+ entry */ -+} Elf32_Verdef; -+ -+typedef struct -+{ -+ Elf64_Half vd_version; /* Version revision */ -+ Elf64_Half vd_flags; /* Version information */ -+ Elf64_Half vd_ndx; /* Version Index */ -+ Elf64_Half vd_cnt; /* Number of associated aux entries */ -+ Elf64_Word vd_hash; /* Version name hash value */ -+ Elf64_Word vd_aux; /* Offset in bytes to verdaux array */ -+ Elf64_Word vd_next; /* Offset in bytes to next verdef -+ entry */ -+} Elf64_Verdef; -+ -+ -+/* Legal values for vd_version (version revision). */ -+#define VER_DEF_NONE 0 /* No version */ -+#define VER_DEF_CURRENT 1 /* Current version */ -+#define VER_DEF_NUM 2 /* Given version number */ -+ -+/* Legal values for vd_flags (version information flags). */ -+#define VER_FLG_BASE 0x1 /* Version definition of file itself */ -+#define VER_FLG_WEAK 0x2 /* Weak version identifier */ -+ -+/* Versym symbol index values. */ -+#define VER_NDX_LOCAL 0 /* Symbol is local. */ -+#define VER_NDX_GLOBAL 1 /* Symbol is global. */ -+#define VER_NDX_LORESERVE 0xff00 /* Beginning of reserved entries. */ -+#define VER_NDX_ELIMINATE 0xff01 /* Symbol is to be eliminated. */ -+ -+/* Auxialiary version information. */ -+ -+typedef struct -+{ -+ Elf32_Word vda_name; /* Version or dependency names */ -+ Elf32_Word vda_next; /* Offset in bytes to next verdaux -+ entry */ -+} Elf32_Verdaux; -+ -+typedef struct -+{ -+ Elf64_Word vda_name; /* Version or dependency names */ -+ Elf64_Word vda_next; /* Offset in bytes to next verdaux -+ entry */ -+} Elf64_Verdaux; -+ -+ -+/* Version dependency section. */ -+ -+typedef struct -+{ -+ Elf32_Half vn_version; /* Version of structure */ -+ Elf32_Half vn_cnt; /* Number of associated aux entries */ -+ Elf32_Word vn_file; /* Offset of filename for this -+ dependency */ -+ Elf32_Word vn_aux; /* Offset in bytes to vernaux array */ -+ Elf32_Word vn_next; /* Offset in bytes to next verneed -+ entry */ -+} Elf32_Verneed; -+ -+typedef struct -+{ -+ Elf64_Half vn_version; /* Version of structure */ -+ Elf64_Half vn_cnt; /* Number of associated aux entries */ -+ Elf64_Word vn_file; /* Offset of filename for this -+ dependency */ -+ Elf64_Word vn_aux; /* Offset in bytes to vernaux array */ -+ Elf64_Word vn_next; /* Offset in bytes to next verneed -+ entry */ -+} Elf64_Verneed; -+ -+ -+/* Legal values for vn_version (version revision). */ -+#define VER_NEED_NONE 0 /* No version */ -+#define VER_NEED_CURRENT 1 /* Current version */ -+#define VER_NEED_NUM 2 /* Given version number */ -+ -+/* Auxiliary needed version information. */ -+ -+typedef struct -+{ -+ Elf32_Word vna_hash; /* Hash value of dependency name */ -+ Elf32_Half vna_flags; /* Dependency specific information */ -+ Elf32_Half vna_other; /* Unused */ -+ Elf32_Word vna_name; /* Dependency name string offset */ -+ Elf32_Word vna_next; /* Offset in bytes to next vernaux -+ entry */ -+} Elf32_Vernaux; -+ -+typedef struct -+{ -+ Elf64_Word vna_hash; /* Hash value of dependency name */ -+ Elf64_Half vna_flags; /* Dependency specific information */ -+ Elf64_Half vna_other; /* Unused */ -+ Elf64_Word vna_name; /* Dependency name string offset */ -+ Elf64_Word vna_next; /* Offset in bytes to next vernaux -+ entry */ -+} Elf64_Vernaux; -+ -+ -+/* Legal values for vna_flags. */ -+#define VER_FLG_WEAK 0x2 /* Weak version identifier */ -+ -+ -+/* Auxiliary vector. */ -+ -+/* This vector is normally only used by the program interpreter. The -+ usual definition in an ABI supplement uses the name auxv_t. The -+ vector is not usually defined in a standard file, but it -+ can't hurt. We rename it to avoid conflicts. The sizes of these -+ types are an arrangement between the exec server and the program -+ interpreter, so we don't fully specify them here. */ -+ -+typedef struct -+{ -+ uint32_t a_type; /* Entry type */ -+ union -+ { -+ uint32_t a_val; /* Integer value */ -+ /* We use to have pointer elements added here. We cannot do that, -+ though, since it does not work when using 32-bit definitions -+ on 64-bit platforms and vice versa. */ -+ } a_un; -+} Elf32_auxv_t; -+ -+typedef struct -+{ -+ uint64_t a_type; /* Entry type */ -+ union -+ { -+ uint64_t a_val; /* Integer value */ -+ /* We use to have pointer elements added here. We cannot do that, -+ though, since it does not work when using 32-bit definitions -+ on 64-bit platforms and vice versa. */ -+ } a_un; -+} Elf64_auxv_t; -+ -+/* Legal values for a_type (entry type). */ -+ -+#define AT_NULL 0 /* End of vector */ -+#define AT_IGNORE 1 /* Entry should be ignored */ -+#define AT_EXECFD 2 /* File descriptor of program */ -+#define AT_PHDR 3 /* Program headers for program */ -+#define AT_PHENT 4 /* Size of program header entry */ -+#define AT_PHNUM 5 /* Number of program headers */ -+#define AT_PAGESZ 6 /* System page size */ -+#define AT_BASE 7 /* Base address of interpreter */ -+#define AT_FLAGS 8 /* Flags */ -+#define AT_ENTRY 9 /* Entry point of program */ -+#define AT_NOTELF 10 /* Program is not ELF */ -+#define AT_UID 11 /* Real uid */ -+#define AT_EUID 12 /* Effective uid */ -+#define AT_GID 13 /* Real gid */ -+#define AT_EGID 14 /* Effective gid */ -+#define AT_CLKTCK 17 /* Frequency of times() */ -+ -+/* Some more special a_type values describing the hardware. */ -+#define AT_PLATFORM 15 /* String identifying platform. */ -+#define AT_HWCAP 16 /* Machine dependent hints about -+ processor capabilities. */ -+ -+/* This entry gives some information about the FPU initialization -+ performed by the kernel. */ -+#define AT_FPUCW 18 /* Used FPU control word. */ -+ -+/* Cache block sizes. */ -+#define AT_DCACHEBSIZE 19 /* Data cache block size. */ -+#define AT_ICACHEBSIZE 20 /* Instruction cache block size. */ -+#define AT_UCACHEBSIZE 21 /* Unified cache block size. */ -+ -+/* A special ignored value for PPC, used by the kernel to control the -+ interpretation of the AUXV. Must be > 16. */ -+#define AT_IGNOREPPC 22 /* Entry should be ignored. */ -+ -+#define AT_SECURE 23 /* Boolean, was exec setuid-like? */ -+ -+#define AT_BASE_PLATFORM 24 /* String identifying real platforms.*/ -+ -+#define AT_RANDOM 25 /* Address of 16 random bytes. */ -+ -+#define AT_EXECFN 31 /* Filename of executable. */ -+ -+/* Pointer to the global system page used for system calls and other -+ nice things. */ -+#define AT_SYSINFO 32 -+#define AT_SYSINFO_EHDR 33 -+ -+/* Shapes of the caches. Bits 0-3 contains associativity; bits 4-7 contains -+ log2 of line size; mask those to get cache size. */ -+#define AT_L1I_CACHESHAPE 34 -+#define AT_L1D_CACHESHAPE 35 -+#define AT_L2_CACHESHAPE 36 -+#define AT_L3_CACHESHAPE 37 -+ -+/* Note section contents. Each entry in the note section begins with -+ a header of a fixed form. */ -+ -+typedef struct -+{ -+ Elf32_Word n_namesz; /* Length of the note's name. */ -+ Elf32_Word n_descsz; /* Length of the note's descriptor. */ -+ Elf32_Word n_type; /* Type of the note. */ -+} Elf32_Nhdr; -+ -+typedef struct -+{ -+ Elf64_Word n_namesz; /* Length of the note's name. */ -+ Elf64_Word n_descsz; /* Length of the note's descriptor. */ -+ Elf64_Word n_type; /* Type of the note. */ -+} Elf64_Nhdr; -+ -+/* Known names of notes. */ -+ -+/* Solaris entries in the note section have this name. */ -+#define ELF_NOTE_SOLARIS "SUNW Solaris" -+ -+/* Note entries for GNU systems have this name. */ -+#define ELF_NOTE_GNU "GNU" -+ -+ -+/* Defined types of notes for Solaris. */ -+ -+/* Value of descriptor (one word) is desired pagesize for the binary. */ -+#define ELF_NOTE_PAGESIZE_HINT 1 -+ -+ -+/* Defined note types for GNU systems. */ -+ -+/* ABI information. The descriptor consists of words: -+ word 0: OS descriptor -+ word 1: major version of the ABI -+ word 2: minor version of the ABI -+ word 3: subminor version of the ABI -+*/ -+#define NT_GNU_ABI_TAG 1 -+#define ELF_NOTE_ABI NT_GNU_ABI_TAG /* Old name. */ -+ -+/* Known OSes. These values can appear in word 0 of an -+ NT_GNU_ABI_TAG note section entry. */ -+#define ELF_NOTE_OS_LINUX 0 -+#define ELF_NOTE_OS_GNU 1 -+#define ELF_NOTE_OS_SOLARIS2 2 -+#define ELF_NOTE_OS_FREEBSD 3 -+ -+/* Synthetic hwcap information. The descriptor begins with two words: -+ word 0: number of entries -+ word 1: bitmask of enabled entries -+ Then follow variable-length entries, one byte followed by a -+ '\0'-terminated hwcap name string. The byte gives the bit -+ number to test if enabled, (1U << bit) & bitmask. */ -+#define NT_GNU_HWCAP 2 -+ -+/* Build ID bits as generated by ld --build-id. -+ The descriptor consists of any nonzero number of bytes. */ -+#define NT_GNU_BUILD_ID 3 -+ -+/* Version note generated by GNU gold containing a version string. */ -+#define NT_GNU_GOLD_VERSION 4 -+ -+ -+/* Move records. */ -+typedef struct -+{ -+ Elf32_Xword m_value; /* Symbol value. */ -+ Elf32_Word m_info; /* Size and index. */ -+ Elf32_Word m_poffset; /* Symbol offset. */ -+ Elf32_Half m_repeat; /* Repeat count. */ -+ Elf32_Half m_stride; /* Stride info. */ -+} Elf32_Move; -+ -+typedef struct -+{ -+ Elf64_Xword m_value; /* Symbol value. */ -+ Elf64_Xword m_info; /* Size and index. */ -+ Elf64_Xword m_poffset; /* Symbol offset. */ -+ Elf64_Half m_repeat; /* Repeat count. */ -+ Elf64_Half m_stride; /* Stride info. */ -+} Elf64_Move; -+ -+/* Macro to construct move records. */ -+#define ELF32_M_SYM(info) ((info) >> 8) -+#define ELF32_M_SIZE(info) ((unsigned char) (info)) -+#define ELF32_M_INFO(sym, size) (((sym) << 8) + (unsigned char) (size)) -+ -+#define ELF64_M_SYM(info) ELF32_M_SYM (info) -+#define ELF64_M_SIZE(info) ELF32_M_SIZE (info) -+#define ELF64_M_INFO(sym, size) ELF32_M_INFO (sym, size) -+ -+ -+/* Motorola 68k specific definitions. */ -+ -+/* Values for Elf32_Ehdr.e_flags. */ -+#define EF_CPU32 0x00810000 -+ -+/* m68k relocs. */ -+ -+#define R_68K_NONE 0 /* No reloc */ -+#define R_68K_32 1 /* Direct 32 bit */ -+#define R_68K_16 2 /* Direct 16 bit */ -+#define R_68K_8 3 /* Direct 8 bit */ -+#define R_68K_PC32 4 /* PC relative 32 bit */ -+#define R_68K_PC16 5 /* PC relative 16 bit */ -+#define R_68K_PC8 6 /* PC relative 8 bit */ -+#define R_68K_GOT32 7 /* 32 bit PC relative GOT entry */ -+#define R_68K_GOT16 8 /* 16 bit PC relative GOT entry */ -+#define R_68K_GOT8 9 /* 8 bit PC relative GOT entry */ -+#define R_68K_GOT32O 10 /* 32 bit GOT offset */ -+#define R_68K_GOT16O 11 /* 16 bit GOT offset */ -+#define R_68K_GOT8O 12 /* 8 bit GOT offset */ -+#define R_68K_PLT32 13 /* 32 bit PC relative PLT address */ -+#define R_68K_PLT16 14 /* 16 bit PC relative PLT address */ -+#define R_68K_PLT8 15 /* 8 bit PC relative PLT address */ -+#define R_68K_PLT32O 16 /* 32 bit PLT offset */ -+#define R_68K_PLT16O 17 /* 16 bit PLT offset */ -+#define R_68K_PLT8O 18 /* 8 bit PLT offset */ -+#define R_68K_COPY 19 /* Copy symbol at runtime */ -+#define R_68K_GLOB_DAT 20 /* Create GOT entry */ -+#define R_68K_JMP_SLOT 21 /* Create PLT entry */ -+#define R_68K_RELATIVE 22 /* Adjust by program base */ -+#define R_68K_TLS_GD32 25 /* 32 bit GOT offset for GD */ -+#define R_68K_TLS_GD16 26 /* 16 bit GOT offset for GD */ -+#define R_68K_TLS_GD8 27 /* 8 bit GOT offset for GD */ -+#define R_68K_TLS_LDM32 28 /* 32 bit GOT offset for LDM */ -+#define R_68K_TLS_LDM16 29 /* 16 bit GOT offset for LDM */ -+#define R_68K_TLS_LDM8 30 /* 8 bit GOT offset for LDM */ -+#define R_68K_TLS_LDO32 31 /* 32 bit module-relative offset */ -+#define R_68K_TLS_LDO16 32 /* 16 bit module-relative offset */ -+#define R_68K_TLS_LDO8 33 /* 8 bit module-relative offset */ -+#define R_68K_TLS_IE32 34 /* 32 bit GOT offset for IE */ -+#define R_68K_TLS_IE16 35 /* 16 bit GOT offset for IE */ -+#define R_68K_TLS_IE8 36 /* 8 bit GOT offset for IE */ -+#define R_68K_TLS_LE32 37 /* 32 bit offset relative to -+ static TLS block */ -+#define R_68K_TLS_LE16 38 /* 16 bit offset relative to -+ static TLS block */ -+#define R_68K_TLS_LE8 39 /* 8 bit offset relative to -+ static TLS block */ -+#define R_68K_TLS_DTPMOD32 40 /* 32 bit module number */ -+#define R_68K_TLS_DTPREL32 41 /* 32 bit module-relative offset */ -+#define R_68K_TLS_TPREL32 42 /* 32 bit TP-relative offset */ -+/* Keep this the last entry. */ -+#define R_68K_NUM 43 -+ -+/* Intel 80386 specific definitions. */ -+ -+/* i386 relocs. */ -+ -+#define R_386_NONE 0 /* No reloc */ -+#define R_386_32 1 /* Direct 32 bit */ -+#define R_386_PC32 2 /* PC relative 32 bit */ -+#define R_386_GOT32 3 /* 32 bit GOT entry */ -+#define R_386_PLT32 4 /* 32 bit PLT address */ -+#define R_386_COPY 5 /* Copy symbol at runtime */ -+#define R_386_GLOB_DAT 6 /* Create GOT entry */ -+#define R_386_JMP_SLOT 7 /* Create PLT entry */ -+#define R_386_RELATIVE 8 /* Adjust by program base */ -+#define R_386_GOTOFF 9 /* 32 bit offset to GOT */ -+#define R_386_GOTPC 10 /* 32 bit PC relative offset to GOT */ -+#define R_386_32PLT 11 -+#define R_386_TLS_TPOFF 14 /* Offset in static TLS block */ -+#define R_386_TLS_IE 15 /* Address of GOT entry for static TLS -+ block offset */ -+#define R_386_TLS_GOTIE 16 /* GOT entry for static TLS block -+ offset */ -+#define R_386_TLS_LE 17 /* Offset relative to static TLS -+ block */ -+#define R_386_TLS_GD 18 /* Direct 32 bit for GNU version of -+ general dynamic thread local data */ -+#define R_386_TLS_LDM 19 /* Direct 32 bit for GNU version of -+ local dynamic thread local data -+ in LE code */ -+#define R_386_16 20 -+#define R_386_PC16 21 -+#define R_386_8 22 -+#define R_386_PC8 23 -+#define R_386_TLS_GD_32 24 /* Direct 32 bit for general dynamic -+ thread local data */ -+#define R_386_TLS_GD_PUSH 25 /* Tag for pushl in GD TLS code */ -+#define R_386_TLS_GD_CALL 26 /* Relocation for call to -+ __tls_get_addr() */ -+#define R_386_TLS_GD_POP 27 /* Tag for popl in GD TLS code */ -+#define R_386_TLS_LDM_32 28 /* Direct 32 bit for local dynamic -+ thread local data in LE code */ -+#define R_386_TLS_LDM_PUSH 29 /* Tag for pushl in LDM TLS code */ -+#define R_386_TLS_LDM_CALL 30 /* Relocation for call to -+ __tls_get_addr() in LDM code */ -+#define R_386_TLS_LDM_POP 31 /* Tag for popl in LDM TLS code */ -+#define R_386_TLS_LDO_32 32 /* Offset relative to TLS block */ -+#define R_386_TLS_IE_32 33 /* GOT entry for negated static TLS -+ block offset */ -+#define R_386_TLS_LE_32 34 /* Negated offset relative to static -+ TLS block */ -+#define R_386_TLS_DTPMOD32 35 /* ID of module containing symbol */ -+#define R_386_TLS_DTPOFF32 36 /* Offset in TLS block */ -+#define R_386_TLS_TPOFF32 37 /* Negated offset in static TLS block */ -+/* 38? */ -+#define R_386_TLS_GOTDESC 39 /* GOT offset for TLS descriptor. */ -+#define R_386_TLS_DESC_CALL 40 /* Marker of call through TLS -+ descriptor for -+ relaxation. */ -+#define R_386_TLS_DESC 41 /* TLS descriptor containing -+ pointer to code and to -+ argument, returning the TLS -+ offset for the symbol. */ -+#define R_386_IRELATIVE 42 /* Adjust indirectly by program base */ -+/* Keep this the last entry. */ -+#define R_386_NUM 43 -+ -+/* SUN SPARC specific definitions. */ -+ -+/* Legal values for ST_TYPE subfield of st_info (symbol type). */ -+ -+#define STT_SPARC_REGISTER 13 /* Global register reserved to app. */ -+ -+/* Values for Elf64_Ehdr.e_flags. */ -+ -+#define EF_SPARCV9_MM 3 -+#define EF_SPARCV9_TSO 0 -+#define EF_SPARCV9_PSO 1 -+#define EF_SPARCV9_RMO 2 -+#define EF_SPARC_LEDATA 0x800000 /* little endian data */ -+#define EF_SPARC_EXT_MASK 0xFFFF00 -+#define EF_SPARC_32PLUS 0x000100 /* generic V8+ features */ -+#define EF_SPARC_SUN_US1 0x000200 /* Sun UltraSPARC1 extensions */ -+#define EF_SPARC_HAL_R1 0x000400 /* HAL R1 extensions */ -+#define EF_SPARC_SUN_US3 0x000800 /* Sun UltraSPARCIII extensions */ -+ -+/* SPARC relocs. */ -+ -+#define R_SPARC_NONE 0 /* No reloc */ -+#define R_SPARC_8 1 /* Direct 8 bit */ -+#define R_SPARC_16 2 /* Direct 16 bit */ -+#define R_SPARC_32 3 /* Direct 32 bit */ -+#define R_SPARC_DISP8 4 /* PC relative 8 bit */ -+#define R_SPARC_DISP16 5 /* PC relative 16 bit */ -+#define R_SPARC_DISP32 6 /* PC relative 32 bit */ -+#define R_SPARC_WDISP30 7 /* PC relative 30 bit shifted */ -+#define R_SPARC_WDISP22 8 /* PC relative 22 bit shifted */ -+#define R_SPARC_HI22 9 /* High 22 bit */ -+#define R_SPARC_22 10 /* Direct 22 bit */ -+#define R_SPARC_13 11 /* Direct 13 bit */ -+#define R_SPARC_LO10 12 /* Truncated 10 bit */ -+#define R_SPARC_GOT10 13 /* Truncated 10 bit GOT entry */ -+#define R_SPARC_GOT13 14 /* 13 bit GOT entry */ -+#define R_SPARC_GOT22 15 /* 22 bit GOT entry shifted */ -+#define R_SPARC_PC10 16 /* PC relative 10 bit truncated */ -+#define R_SPARC_PC22 17 /* PC relative 22 bit shifted */ -+#define R_SPARC_WPLT30 18 /* 30 bit PC relative PLT address */ -+#define R_SPARC_COPY 19 /* Copy symbol at runtime */ -+#define R_SPARC_GLOB_DAT 20 /* Create GOT entry */ -+#define R_SPARC_JMP_SLOT 21 /* Create PLT entry */ -+#define R_SPARC_RELATIVE 22 /* Adjust by program base */ -+#define R_SPARC_UA32 23 /* Direct 32 bit unaligned */ -+ -+/* Additional Sparc64 relocs. */ -+ -+#define R_SPARC_PLT32 24 /* Direct 32 bit ref to PLT entry */ -+#define R_SPARC_HIPLT22 25 /* High 22 bit PLT entry */ -+#define R_SPARC_LOPLT10 26 /* Truncated 10 bit PLT entry */ -+#define R_SPARC_PCPLT32 27 /* PC rel 32 bit ref to PLT entry */ -+#define R_SPARC_PCPLT22 28 /* PC rel high 22 bit PLT entry */ -+#define R_SPARC_PCPLT10 29 /* PC rel trunc 10 bit PLT entry */ -+#define R_SPARC_10 30 /* Direct 10 bit */ -+#define R_SPARC_11 31 /* Direct 11 bit */ -+#define R_SPARC_64 32 /* Direct 64 bit */ -+#define R_SPARC_OLO10 33 /* 10bit with secondary 13bit addend */ -+#define R_SPARC_HH22 34 /* Top 22 bits of direct 64 bit */ -+#define R_SPARC_HM10 35 /* High middle 10 bits of ... */ -+#define R_SPARC_LM22 36 /* Low middle 22 bits of ... */ -+#define R_SPARC_PC_HH22 37 /* Top 22 bits of pc rel 64 bit */ -+#define R_SPARC_PC_HM10 38 /* High middle 10 bit of ... */ -+#define R_SPARC_PC_LM22 39 /* Low miggle 22 bits of ... */ -+#define R_SPARC_WDISP16 40 /* PC relative 16 bit shifted */ -+#define R_SPARC_WDISP19 41 /* PC relative 19 bit shifted */ -+#define R_SPARC_GLOB_JMP 42 /* was part of v9 ABI but was removed */ -+#define R_SPARC_7 43 /* Direct 7 bit */ -+#define R_SPARC_5 44 /* Direct 5 bit */ -+#define R_SPARC_6 45 /* Direct 6 bit */ -+#define R_SPARC_DISP64 46 /* PC relative 64 bit */ -+#define R_SPARC_PLT64 47 /* Direct 64 bit ref to PLT entry */ -+#define R_SPARC_HIX22 48 /* High 22 bit complemented */ -+#define R_SPARC_LOX10 49 /* Truncated 11 bit complemented */ -+#define R_SPARC_H44 50 /* Direct high 12 of 44 bit */ -+#define R_SPARC_M44 51 /* Direct mid 22 of 44 bit */ -+#define R_SPARC_L44 52 /* Direct low 10 of 44 bit */ -+#define R_SPARC_REGISTER 53 /* Global register usage */ -+#define R_SPARC_UA64 54 /* Direct 64 bit unaligned */ -+#define R_SPARC_UA16 55 /* Direct 16 bit unaligned */ -+#define R_SPARC_TLS_GD_HI22 56 -+#define R_SPARC_TLS_GD_LO10 57 -+#define R_SPARC_TLS_GD_ADD 58 -+#define R_SPARC_TLS_GD_CALL 59 -+#define R_SPARC_TLS_LDM_HI22 60 -+#define R_SPARC_TLS_LDM_LO10 61 -+#define R_SPARC_TLS_LDM_ADD 62 -+#define R_SPARC_TLS_LDM_CALL 63 -+#define R_SPARC_TLS_LDO_HIX22 64 -+#define R_SPARC_TLS_LDO_LOX10 65 -+#define R_SPARC_TLS_LDO_ADD 66 -+#define R_SPARC_TLS_IE_HI22 67 -+#define R_SPARC_TLS_IE_LO10 68 -+#define R_SPARC_TLS_IE_LD 69 -+#define R_SPARC_TLS_IE_LDX 70 -+#define R_SPARC_TLS_IE_ADD 71 -+#define R_SPARC_TLS_LE_HIX22 72 -+#define R_SPARC_TLS_LE_LOX10 73 -+#define R_SPARC_TLS_DTPMOD32 74 -+#define R_SPARC_TLS_DTPMOD64 75 -+#define R_SPARC_TLS_DTPOFF32 76 -+#define R_SPARC_TLS_DTPOFF64 77 -+#define R_SPARC_TLS_TPOFF32 78 -+#define R_SPARC_TLS_TPOFF64 79 -+#define R_SPARC_GOTDATA_HIX22 80 -+#define R_SPARC_GOTDATA_LOX10 81 -+#define R_SPARC_GOTDATA_OP_HIX22 82 -+#define R_SPARC_GOTDATA_OP_LOX10 83 -+#define R_SPARC_GOTDATA_OP 84 -+#define R_SPARC_H34 85 -+#define R_SPARC_SIZE32 86 -+#define R_SPARC_SIZE64 87 -+#define R_SPARC_WDISP10 88 -+#define R_SPARC_JMP_IREL 248 -+#define R_SPARC_IRELATIVE 249 -+#define R_SPARC_GNU_VTINHERIT 250 -+#define R_SPARC_GNU_VTENTRY 251 -+#define R_SPARC_REV32 252 -+/* Keep this the last entry. */ -+#define R_SPARC_NUM 253 -+ -+/* For Sparc64, legal values for d_tag of Elf64_Dyn. */ -+ -+#define DT_SPARC_REGISTER 0x70000001 -+#define DT_SPARC_NUM 2 -+ -+/* MIPS R3000 specific definitions. */ -+ -+/* Legal values for e_flags field of Elf32_Ehdr. */ -+ -+#define EF_MIPS_NOREORDER 1 /* A .noreorder directive was used */ -+#define EF_MIPS_PIC 2 /* Contains PIC code */ -+#define EF_MIPS_CPIC 4 /* Uses PIC calling sequence */ -+#define EF_MIPS_XGOT 8 -+#define EF_MIPS_64BIT_WHIRL 16 -+#define EF_MIPS_ABI2 32 -+#define EF_MIPS_ABI_ON32 64 -+#define EF_MIPS_ARCH 0xf0000000 /* MIPS architecture level */ -+ -+/* Legal values for MIPS architecture level. */ -+ -+#define EF_MIPS_ARCH_1 0x00000000 /* -mips1 code. */ -+#define EF_MIPS_ARCH_2 0x10000000 /* -mips2 code. */ -+#define EF_MIPS_ARCH_3 0x20000000 /* -mips3 code. */ -+#define EF_MIPS_ARCH_4 0x30000000 /* -mips4 code. */ -+#define EF_MIPS_ARCH_5 0x40000000 /* -mips5 code. */ -+#define EF_MIPS_ARCH_32 0x60000000 /* MIPS32 code. */ -+#define EF_MIPS_ARCH_64 0x70000000 /* MIPS64 code. */ -+ -+/* The following are non-official names and should not be used. */ -+ -+#define E_MIPS_ARCH_1 0x00000000 /* -mips1 code. */ -+#define E_MIPS_ARCH_2 0x10000000 /* -mips2 code. */ -+#define E_MIPS_ARCH_3 0x20000000 /* -mips3 code. */ -+#define E_MIPS_ARCH_4 0x30000000 /* -mips4 code. */ -+#define E_MIPS_ARCH_5 0x40000000 /* -mips5 code. */ -+#define E_MIPS_ARCH_32 0x60000000 /* MIPS32 code. */ -+#define E_MIPS_ARCH_64 0x70000000 /* MIPS64 code. */ -+ -+/* Special section indices. */ -+ -+#define SHN_MIPS_ACOMMON 0xff00 /* Allocated common symbols */ -+#define SHN_MIPS_TEXT 0xff01 /* Allocated test symbols. */ -+#define SHN_MIPS_DATA 0xff02 /* Allocated data symbols. */ -+#define SHN_MIPS_SCOMMON 0xff03 /* Small common symbols */ -+#define SHN_MIPS_SUNDEFINED 0xff04 /* Small undefined symbols */ -+ -+/* Legal values for sh_type field of Elf32_Shdr. */ -+ -+#define SHT_MIPS_LIBLIST 0x70000000 /* Shared objects used in link */ -+#define SHT_MIPS_MSYM 0x70000001 -+#define SHT_MIPS_CONFLICT 0x70000002 /* Conflicting symbols */ -+#define SHT_MIPS_GPTAB 0x70000003 /* Global data area sizes */ -+#define SHT_MIPS_UCODE 0x70000004 /* Reserved for SGI/MIPS compilers */ -+#define SHT_MIPS_DEBUG 0x70000005 /* MIPS ECOFF debugging information*/ -+#define SHT_MIPS_REGINFO 0x70000006 /* Register usage information */ -+#define SHT_MIPS_PACKAGE 0x70000007 -+#define SHT_MIPS_PACKSYM 0x70000008 -+#define SHT_MIPS_RELD 0x70000009 -+#define SHT_MIPS_IFACE 0x7000000b -+#define SHT_MIPS_CONTENT 0x7000000c -+#define SHT_MIPS_OPTIONS 0x7000000d /* Miscellaneous options. */ -+#define SHT_MIPS_SHDR 0x70000010 -+#define SHT_MIPS_FDESC 0x70000011 -+#define SHT_MIPS_EXTSYM 0x70000012 -+#define SHT_MIPS_DENSE 0x70000013 -+#define SHT_MIPS_PDESC 0x70000014 -+#define SHT_MIPS_LOCSYM 0x70000015 -+#define SHT_MIPS_AUXSYM 0x70000016 -+#define SHT_MIPS_OPTSYM 0x70000017 -+#define SHT_MIPS_LOCSTR 0x70000018 -+#define SHT_MIPS_LINE 0x70000019 -+#define SHT_MIPS_RFDESC 0x7000001a -+#define SHT_MIPS_DELTASYM 0x7000001b -+#define SHT_MIPS_DELTAINST 0x7000001c -+#define SHT_MIPS_DELTACLASS 0x7000001d -+#define SHT_MIPS_DWARF 0x7000001e /* DWARF debugging information. */ -+#define SHT_MIPS_DELTADECL 0x7000001f -+#define SHT_MIPS_SYMBOL_LIB 0x70000020 -+#define SHT_MIPS_EVENTS 0x70000021 /* Event section. */ -+#define SHT_MIPS_TRANSLATE 0x70000022 -+#define SHT_MIPS_PIXIE 0x70000023 -+#define SHT_MIPS_XLATE 0x70000024 -+#define SHT_MIPS_XLATE_DEBUG 0x70000025 -+#define SHT_MIPS_WHIRL 0x70000026 -+#define SHT_MIPS_EH_REGION 0x70000027 -+#define SHT_MIPS_XLATE_OLD 0x70000028 -+#define SHT_MIPS_PDR_EXCEPTION 0x70000029 -+ -+/* Legal values for sh_flags field of Elf32_Shdr. */ -+ -+#define SHF_MIPS_GPREL 0x10000000 /* Must be part of global data area */ -+#define SHF_MIPS_MERGE 0x20000000 -+#define SHF_MIPS_ADDR 0x40000000 -+#define SHF_MIPS_STRINGS 0x80000000 -+#define SHF_MIPS_NOSTRIP 0x08000000 -+#define SHF_MIPS_LOCAL 0x04000000 -+#define SHF_MIPS_NAMES 0x02000000 -+#define SHF_MIPS_NODUPE 0x01000000 -+ -+ -+/* Symbol tables. */ -+ -+/* MIPS specific values for `st_other'. */ -+#define STO_MIPS_DEFAULT 0x0 -+#define STO_MIPS_INTERNAL 0x1 -+#define STO_MIPS_HIDDEN 0x2 -+#define STO_MIPS_PROTECTED 0x3 -+#define STO_MIPS_PLT 0x8 -+#define STO_MIPS_SC_ALIGN_UNUSED 0xff -+ -+/* MIPS specific values for `st_info'. */ -+#define STB_MIPS_SPLIT_COMMON 13 -+ -+/* Entries found in sections of type SHT_MIPS_GPTAB. */ -+ -+typedef union -+{ -+ struct -+ { -+ Elf32_Word gt_current_g_value; /* -G value used for compilation */ -+ Elf32_Word gt_unused; /* Not used */ -+ } gt_header; /* First entry in section */ -+ struct -+ { -+ Elf32_Word gt_g_value; /* If this value were used for -G */ -+ Elf32_Word gt_bytes; /* This many bytes would be used */ -+ } gt_entry; /* Subsequent entries in section */ -+} Elf32_gptab; -+ -+/* Entry found in sections of type SHT_MIPS_REGINFO. */ -+ -+typedef struct -+{ -+ Elf32_Word ri_gprmask; /* General registers used */ -+ Elf32_Word ri_cprmask[4]; /* Coprocessor registers used */ -+ Elf32_Sword ri_gp_value; /* $gp register value */ -+} Elf32_RegInfo; -+ -+/* Entries found in sections of type SHT_MIPS_OPTIONS. */ -+ -+typedef struct -+{ -+ unsigned char kind; /* Determines interpretation of the -+ variable part of descriptor. */ -+ unsigned char size; /* Size of descriptor, including header. */ -+ Elf32_Section section; /* Section header index of section affected, -+ 0 for global options. */ -+ Elf32_Word info; /* Kind-specific information. */ -+} Elf_Options; -+ -+/* Values for `kind' field in Elf_Options. */ -+ -+#define ODK_NULL 0 /* Undefined. */ -+#define ODK_REGINFO 1 /* Register usage information. */ -+#define ODK_EXCEPTIONS 2 /* Exception processing options. */ -+#define ODK_PAD 3 /* Section padding options. */ -+#define ODK_HWPATCH 4 /* Hardware workarounds performed */ -+#define ODK_FILL 5 /* record the fill value used by the linker. */ -+#define ODK_TAGS 6 /* reserve space for desktop tools to write. */ -+#define ODK_HWAND 7 /* HW workarounds. 'AND' bits when merging. */ -+#define ODK_HWOR 8 /* HW workarounds. 'OR' bits when merging. */ -+ -+/* Values for `info' in Elf_Options for ODK_EXCEPTIONS entries. */ -+ -+#define OEX_FPU_MIN 0x1f /* FPE's which MUST be enabled. */ -+#define OEX_FPU_MAX 0x1f00 /* FPE's which MAY be enabled. */ -+#define OEX_PAGE0 0x10000 /* page zero must be mapped. */ -+#define OEX_SMM 0x20000 /* Force sequential memory mode? */ -+#define OEX_FPDBUG 0x40000 /* Force floating point debug mode? */ -+#define OEX_PRECISEFP OEX_FPDBUG -+#define OEX_DISMISS 0x80000 /* Dismiss invalid address faults? */ -+ -+#define OEX_FPU_INVAL 0x10 -+#define OEX_FPU_DIV0 0x08 -+#define OEX_FPU_OFLO 0x04 -+#define OEX_FPU_UFLO 0x02 -+#define OEX_FPU_INEX 0x01 -+ -+/* Masks for `info' in Elf_Options for an ODK_HWPATCH entry. */ -+ -+#define OHW_R4KEOP 0x1 /* R4000 end-of-page patch. */ -+#define OHW_R8KPFETCH 0x2 /* may need R8000 prefetch patch. */ -+#define OHW_R5KEOP 0x4 /* R5000 end-of-page patch. */ -+#define OHW_R5KCVTL 0x8 /* R5000 cvt.[ds].l bug. clean=1. */ -+ -+#define OPAD_PREFIX 0x1 -+#define OPAD_POSTFIX 0x2 -+#define OPAD_SYMBOL 0x4 -+ -+/* Entry found in `.options' section. */ -+ -+typedef struct -+{ -+ Elf32_Word hwp_flags1; /* Extra flags. */ -+ Elf32_Word hwp_flags2; /* Extra flags. */ -+} Elf_Options_Hw; -+ -+/* Masks for `info' in ElfOptions for ODK_HWAND and ODK_HWOR entries. */ -+ -+#define OHWA0_R4KEOP_CHECKED 0x00000001 -+#define OHWA1_R4KEOP_CLEAN 0x00000002 -+ -+/* MIPS relocs. */ -+ -+#define R_MIPS_NONE 0 /* No reloc */ -+#define R_MIPS_16 1 /* Direct 16 bit */ -+#define R_MIPS_32 2 /* Direct 32 bit */ -+#define R_MIPS_REL32 3 /* PC relative 32 bit */ -+#define R_MIPS_26 4 /* Direct 26 bit shifted */ -+#define R_MIPS_HI16 5 /* High 16 bit */ -+#define R_MIPS_LO16 6 /* Low 16 bit */ -+#define R_MIPS_GPREL16 7 /* GP relative 16 bit */ -+#define R_MIPS_LITERAL 8 /* 16 bit literal entry */ -+#define R_MIPS_GOT16 9 /* 16 bit GOT entry */ -+#define R_MIPS_PC16 10 /* PC relative 16 bit */ -+#define R_MIPS_CALL16 11 /* 16 bit GOT entry for function */ -+#define R_MIPS_GPREL32 12 /* GP relative 32 bit */ -+ -+#define R_MIPS_SHIFT5 16 -+#define R_MIPS_SHIFT6 17 -+#define R_MIPS_64 18 -+#define R_MIPS_GOT_DISP 19 -+#define R_MIPS_GOT_PAGE 20 -+#define R_MIPS_GOT_OFST 21 -+#define R_MIPS_GOT_HI16 22 -+#define R_MIPS_GOT_LO16 23 -+#define R_MIPS_SUB 24 -+#define R_MIPS_INSERT_A 25 -+#define R_MIPS_INSERT_B 26 -+#define R_MIPS_DELETE 27 -+#define R_MIPS_HIGHER 28 -+#define R_MIPS_HIGHEST 29 -+#define R_MIPS_CALL_HI16 30 -+#define R_MIPS_CALL_LO16 31 -+#define R_MIPS_SCN_DISP 32 -+#define R_MIPS_REL16 33 -+#define R_MIPS_ADD_IMMEDIATE 34 -+#define R_MIPS_PJUMP 35 -+#define R_MIPS_RELGOT 36 -+#define R_MIPS_JALR 37 -+#define R_MIPS_TLS_DTPMOD32 38 /* Module number 32 bit */ -+#define R_MIPS_TLS_DTPREL32 39 /* Module-relative offset 32 bit */ -+#define R_MIPS_TLS_DTPMOD64 40 /* Module number 64 bit */ -+#define R_MIPS_TLS_DTPREL64 41 /* Module-relative offset 64 bit */ -+#define R_MIPS_TLS_GD 42 /* 16 bit GOT offset for GD */ -+#define R_MIPS_TLS_LDM 43 /* 16 bit GOT offset for LDM */ -+#define R_MIPS_TLS_DTPREL_HI16 44 /* Module-relative offset, high 16 bits */ -+#define R_MIPS_TLS_DTPREL_LO16 45 /* Module-relative offset, low 16 bits */ -+#define R_MIPS_TLS_GOTTPREL 46 /* 16 bit GOT offset for IE */ -+#define R_MIPS_TLS_TPREL32 47 /* TP-relative offset, 32 bit */ -+#define R_MIPS_TLS_TPREL64 48 /* TP-relative offset, 64 bit */ -+#define R_MIPS_TLS_TPREL_HI16 49 /* TP-relative offset, high 16 bits */ -+#define R_MIPS_TLS_TPREL_LO16 50 /* TP-relative offset, low 16 bits */ -+#define R_MIPS_GLOB_DAT 51 -+#define R_MIPS_COPY 126 -+#define R_MIPS_JUMP_SLOT 127 -+/* Keep this the last entry. */ -+#define R_MIPS_NUM 128 -+ -+/* Legal values for p_type field of Elf32_Phdr. */ -+ -+#define PT_MIPS_REGINFO 0x70000000 /* Register usage information */ -+#define PT_MIPS_RTPROC 0x70000001 /* Runtime procedure table. */ -+#define PT_MIPS_OPTIONS 0x70000002 -+ -+/* Special program header types. */ -+ -+#define PF_MIPS_LOCAL 0x10000000 -+ -+/* Legal values for d_tag field of Elf32_Dyn. */ -+ -+#define DT_MIPS_RLD_VERSION 0x70000001 /* Runtime linker interface version */ -+#define DT_MIPS_TIME_STAMP 0x70000002 /* Timestamp */ -+#define DT_MIPS_ICHECKSUM 0x70000003 /* Checksum */ -+#define DT_MIPS_IVERSION 0x70000004 /* Version string (string tbl index) */ -+#define DT_MIPS_FLAGS 0x70000005 /* Flags */ -+#define DT_MIPS_BASE_ADDRESS 0x70000006 /* Base address */ -+#define DT_MIPS_MSYM 0x70000007 -+#define DT_MIPS_CONFLICT 0x70000008 /* Address of CONFLICT section */ -+#define DT_MIPS_LIBLIST 0x70000009 /* Address of LIBLIST section */ -+#define DT_MIPS_LOCAL_GOTNO 0x7000000a /* Number of local GOT entries */ -+#define DT_MIPS_CONFLICTNO 0x7000000b /* Number of CONFLICT entries */ -+#define DT_MIPS_LIBLISTNO 0x70000010 /* Number of LIBLIST entries */ -+#define DT_MIPS_SYMTABNO 0x70000011 /* Number of DYNSYM entries */ -+#define DT_MIPS_UNREFEXTNO 0x70000012 /* First external DYNSYM */ -+#define DT_MIPS_GOTSYM 0x70000013 /* First GOT entry in DYNSYM */ -+#define DT_MIPS_HIPAGENO 0x70000014 /* Number of GOT page table entries */ -+#define DT_MIPS_RLD_MAP 0x70000016 /* Address of run time loader map. */ -+#define DT_MIPS_DELTA_CLASS 0x70000017 /* Delta C++ class definition. */ -+#define DT_MIPS_DELTA_CLASS_NO 0x70000018 /* Number of entries in -+ DT_MIPS_DELTA_CLASS. */ -+#define DT_MIPS_DELTA_INSTANCE 0x70000019 /* Delta C++ class instances. */ -+#define DT_MIPS_DELTA_INSTANCE_NO 0x7000001a /* Number of entries in -+ DT_MIPS_DELTA_INSTANCE. */ -+#define DT_MIPS_DELTA_RELOC 0x7000001b /* Delta relocations. */ -+#define DT_MIPS_DELTA_RELOC_NO 0x7000001c /* Number of entries in -+ DT_MIPS_DELTA_RELOC. */ -+#define DT_MIPS_DELTA_SYM 0x7000001d /* Delta symbols that Delta -+ relocations refer to. */ -+#define DT_MIPS_DELTA_SYM_NO 0x7000001e /* Number of entries in -+ DT_MIPS_DELTA_SYM. */ -+#define DT_MIPS_DELTA_CLASSSYM 0x70000020 /* Delta symbols that hold the -+ class declaration. */ -+#define DT_MIPS_DELTA_CLASSSYM_NO 0x70000021 /* Number of entries in -+ DT_MIPS_DELTA_CLASSSYM. */ -+#define DT_MIPS_CXX_FLAGS 0x70000022 /* Flags indicating for C++ flavor. */ -+#define DT_MIPS_PIXIE_INIT 0x70000023 -+#define DT_MIPS_SYMBOL_LIB 0x70000024 -+#define DT_MIPS_LOCALPAGE_GOTIDX 0x70000025 -+#define DT_MIPS_LOCAL_GOTIDX 0x70000026 -+#define DT_MIPS_HIDDEN_GOTIDX 0x70000027 -+#define DT_MIPS_PROTECTED_GOTIDX 0x70000028 -+#define DT_MIPS_OPTIONS 0x70000029 /* Address of .options. */ -+#define DT_MIPS_INTERFACE 0x7000002a /* Address of .interface. */ -+#define DT_MIPS_DYNSTR_ALIGN 0x7000002b -+#define DT_MIPS_INTERFACE_SIZE 0x7000002c /* Size of the .interface section. */ -+#define DT_MIPS_RLD_TEXT_RESOLVE_ADDR 0x7000002d /* Address of rld_text_rsolve -+ function stored in GOT. */ -+#define DT_MIPS_PERF_SUFFIX 0x7000002e /* Default suffix of dso to be added -+ by rld on dlopen() calls. */ -+#define DT_MIPS_COMPACT_SIZE 0x7000002f /* (O32)Size of compact rel section. */ -+#define DT_MIPS_GP_VALUE 0x70000030 /* GP value for aux GOTs. */ -+#define DT_MIPS_AUX_DYNAMIC 0x70000031 /* Address of aux .dynamic. */ -+/* The address of .got.plt in an executable using the new non-PIC ABI. */ -+#define DT_MIPS_PLTGOT 0x70000032 -+/* The base of the PLT in an executable using the new non-PIC ABI if that -+ PLT is writable. For a non-writable PLT, this is omitted or has a zero -+ value. */ -+#define DT_MIPS_RWPLT 0x70000034 -+#define DT_MIPS_NUM 0x35 -+ -+/* Legal values for DT_MIPS_FLAGS Elf32_Dyn entry. */ -+ -+#define RHF_NONE 0 /* No flags */ -+#define RHF_QUICKSTART (1 << 0) /* Use quickstart */ -+#define RHF_NOTPOT (1 << 1) /* Hash size not power of 2 */ -+#define RHF_NO_LIBRARY_REPLACEMENT (1 << 2) /* Ignore LD_LIBRARY_PATH */ -+#define RHF_NO_MOVE (1 << 3) -+#define RHF_SGI_ONLY (1 << 4) -+#define RHF_GUARANTEE_INIT (1 << 5) -+#define RHF_DELTA_C_PLUS_PLUS (1 << 6) -+#define RHF_GUARANTEE_START_INIT (1 << 7) -+#define RHF_PIXIE (1 << 8) -+#define RHF_DEFAULT_DELAY_LOAD (1 << 9) -+#define RHF_REQUICKSTART (1 << 10) -+#define RHF_REQUICKSTARTED (1 << 11) -+#define RHF_CORD (1 << 12) -+#define RHF_NO_UNRES_UNDEF (1 << 13) -+#define RHF_RLD_ORDER_SAFE (1 << 14) -+ -+/* Entries found in sections of type SHT_MIPS_LIBLIST. */ -+ -+typedef struct -+{ -+ Elf32_Word l_name; /* Name (string table index) */ -+ Elf32_Word l_time_stamp; /* Timestamp */ -+ Elf32_Word l_checksum; /* Checksum */ -+ Elf32_Word l_version; /* Interface version */ -+ Elf32_Word l_flags; /* Flags */ -+} Elf32_Lib; -+ -+typedef struct -+{ -+ Elf64_Word l_name; /* Name (string table index) */ -+ Elf64_Word l_time_stamp; /* Timestamp */ -+ Elf64_Word l_checksum; /* Checksum */ -+ Elf64_Word l_version; /* Interface version */ -+ Elf64_Word l_flags; /* Flags */ -+} Elf64_Lib; -+ -+ -+/* Legal values for l_flags. */ -+ -+#define LL_NONE 0 -+#define LL_EXACT_MATCH (1 << 0) /* Require exact match */ -+#define LL_IGNORE_INT_VER (1 << 1) /* Ignore interface version */ -+#define LL_REQUIRE_MINOR (1 << 2) -+#define LL_EXPORTS (1 << 3) -+#define LL_DELAY_LOAD (1 << 4) -+#define LL_DELTA (1 << 5) -+ -+/* Entries found in sections of type SHT_MIPS_CONFLICT. */ -+ -+typedef Elf32_Addr Elf32_Conflict; -+ -+ -+/* HPPA specific definitions. */ -+ -+/* Legal values for e_flags field of Elf32_Ehdr. */ -+ -+#define EF_PARISC_TRAPNIL 0x00010000 /* Trap nil pointer dereference. */ -+#define EF_PARISC_EXT 0x00020000 /* Program uses arch. extensions. */ -+#define EF_PARISC_LSB 0x00040000 /* Program expects little endian. */ -+#define EF_PARISC_WIDE 0x00080000 /* Program expects wide mode. */ -+#define EF_PARISC_NO_KABP 0x00100000 /* No kernel assisted branch -+ prediction. */ -+#define EF_PARISC_LAZYSWAP 0x00400000 /* Allow lazy swapping. */ -+#define EF_PARISC_ARCH 0x0000ffff /* Architecture version. */ -+ -+/* Defined values for `e_flags & EF_PARISC_ARCH' are: */ -+ -+#define EFA_PARISC_1_0 0x020b /* PA-RISC 1.0 big-endian. */ -+#define EFA_PARISC_1_1 0x0210 /* PA-RISC 1.1 big-endian. */ -+#define EFA_PARISC_2_0 0x0214 /* PA-RISC 2.0 big-endian. */ -+ -+/* Additional section indeces. */ -+ -+#define SHN_PARISC_ANSI_COMMON 0xff00 /* Section for tenatively declared -+ symbols in ANSI C. */ -+#define SHN_PARISC_HUGE_COMMON 0xff01 /* Common blocks in huge model. */ -+ -+/* Legal values for sh_type field of Elf32_Shdr. */ -+ -+#define SHT_PARISC_EXT 0x70000000 /* Contains product specific ext. */ -+#define SHT_PARISC_UNWIND 0x70000001 /* Unwind information. */ -+#define SHT_PARISC_DOC 0x70000002 /* Debug info for optimized code. */ -+ -+/* Legal values for sh_flags field of Elf32_Shdr. */ -+ -+#define SHF_PARISC_SHORT 0x20000000 /* Section with short addressing. */ -+#define SHF_PARISC_HUGE 0x40000000 /* Section far from gp. */ -+#define SHF_PARISC_SBP 0x80000000 /* Static branch prediction code. */ -+ -+/* Legal values for ST_TYPE subfield of st_info (symbol type). */ -+ -+#define STT_PARISC_MILLICODE 13 /* Millicode function entry point. */ -+ -+#define STT_HP_OPAQUE (STT_LOOS + 0x1) -+#define STT_HP_STUB (STT_LOOS + 0x2) -+ -+/* HPPA relocs. */ -+ -+#define R_PARISC_NONE 0 /* No reloc. */ -+#define R_PARISC_DIR32 1 /* Direct 32-bit reference. */ -+#define R_PARISC_DIR21L 2 /* Left 21 bits of eff. address. */ -+#define R_PARISC_DIR17R 3 /* Right 17 bits of eff. address. */ -+#define R_PARISC_DIR17F 4 /* 17 bits of eff. address. */ -+#define R_PARISC_DIR14R 6 /* Right 14 bits of eff. address. */ -+#define R_PARISC_PCREL32 9 /* 32-bit rel. address. */ -+#define R_PARISC_PCREL21L 10 /* Left 21 bits of rel. address. */ -+#define R_PARISC_PCREL17R 11 /* Right 17 bits of rel. address. */ -+#define R_PARISC_PCREL17F 12 /* 17 bits of rel. address. */ -+#define R_PARISC_PCREL14R 14 /* Right 14 bits of rel. address. */ -+#define R_PARISC_DPREL21L 18 /* Left 21 bits of rel. address. */ -+#define R_PARISC_DPREL14R 22 /* Right 14 bits of rel. address. */ -+#define R_PARISC_GPREL21L 26 /* GP-relative, left 21 bits. */ -+#define R_PARISC_GPREL14R 30 /* GP-relative, right 14 bits. */ -+#define R_PARISC_LTOFF21L 34 /* LT-relative, left 21 bits. */ -+#define R_PARISC_LTOFF14R 38 /* LT-relative, right 14 bits. */ -+#define R_PARISC_SECREL32 41 /* 32 bits section rel. address. */ -+#define R_PARISC_SEGBASE 48 /* No relocation, set segment base. */ -+#define R_PARISC_SEGREL32 49 /* 32 bits segment rel. address. */ -+#define R_PARISC_PLTOFF21L 50 /* PLT rel. address, left 21 bits. */ -+#define R_PARISC_PLTOFF14R 54 /* PLT rel. address, right 14 bits. */ -+#define R_PARISC_LTOFF_FPTR32 57 /* 32 bits LT-rel. function pointer. */ -+#define R_PARISC_LTOFF_FPTR21L 58 /* LT-rel. fct ptr, left 21 bits. */ -+#define R_PARISC_LTOFF_FPTR14R 62 /* LT-rel. fct ptr, right 14 bits. */ -+#define R_PARISC_FPTR64 64 /* 64 bits function address. */ -+#define R_PARISC_PLABEL32 65 /* 32 bits function address. */ -+#define R_PARISC_PLABEL21L 66 /* Left 21 bits of fdesc address. */ -+#define R_PARISC_PLABEL14R 70 /* Right 14 bits of fdesc address. */ -+#define R_PARISC_PCREL64 72 /* 64 bits PC-rel. address. */ -+#define R_PARISC_PCREL22F 74 /* 22 bits PC-rel. address. */ -+#define R_PARISC_PCREL14WR 75 /* PC-rel. address, right 14 bits. */ -+#define R_PARISC_PCREL14DR 76 /* PC rel. address, right 14 bits. */ -+#define R_PARISC_PCREL16F 77 /* 16 bits PC-rel. address. */ -+#define R_PARISC_PCREL16WF 78 /* 16 bits PC-rel. address. */ -+#define R_PARISC_PCREL16DF 79 /* 16 bits PC-rel. address. */ -+#define R_PARISC_DIR64 80 /* 64 bits of eff. address. */ -+#define R_PARISC_DIR14WR 83 /* 14 bits of eff. address. */ -+#define R_PARISC_DIR14DR 84 /* 14 bits of eff. address. */ -+#define R_PARISC_DIR16F 85 /* 16 bits of eff. address. */ -+#define R_PARISC_DIR16WF 86 /* 16 bits of eff. address. */ -+#define R_PARISC_DIR16DF 87 /* 16 bits of eff. address. */ -+#define R_PARISC_GPREL64 88 /* 64 bits of GP-rel. address. */ -+#define R_PARISC_GPREL14WR 91 /* GP-rel. address, right 14 bits. */ -+#define R_PARISC_GPREL14DR 92 /* GP-rel. address, right 14 bits. */ -+#define R_PARISC_GPREL16F 93 /* 16 bits GP-rel. address. */ -+#define R_PARISC_GPREL16WF 94 /* 16 bits GP-rel. address. */ -+#define R_PARISC_GPREL16DF 95 /* 16 bits GP-rel. address. */ -+#define R_PARISC_LTOFF64 96 /* 64 bits LT-rel. address. */ -+#define R_PARISC_LTOFF14WR 99 /* LT-rel. address, right 14 bits. */ -+#define R_PARISC_LTOFF14DR 100 /* LT-rel. address, right 14 bits. */ -+#define R_PARISC_LTOFF16F 101 /* 16 bits LT-rel. address. */ -+#define R_PARISC_LTOFF16WF 102 /* 16 bits LT-rel. address. */ -+#define R_PARISC_LTOFF16DF 103 /* 16 bits LT-rel. address. */ -+#define R_PARISC_SECREL64 104 /* 64 bits section rel. address. */ -+#define R_PARISC_SEGREL64 112 /* 64 bits segment rel. address. */ -+#define R_PARISC_PLTOFF14WR 115 /* PLT-rel. address, right 14 bits. */ -+#define R_PARISC_PLTOFF14DR 116 /* PLT-rel. address, right 14 bits. */ -+#define R_PARISC_PLTOFF16F 117 /* 16 bits LT-rel. address. */ -+#define R_PARISC_PLTOFF16WF 118 /* 16 bits PLT-rel. address. */ -+#define R_PARISC_PLTOFF16DF 119 /* 16 bits PLT-rel. address. */ -+#define R_PARISC_LTOFF_FPTR64 120 /* 64 bits LT-rel. function ptr. */ -+#define R_PARISC_LTOFF_FPTR14WR 123 /* LT-rel. fct. ptr., right 14 bits. */ -+#define R_PARISC_LTOFF_FPTR14DR 124 /* LT-rel. fct. ptr., right 14 bits. */ -+#define R_PARISC_LTOFF_FPTR16F 125 /* 16 bits LT-rel. function ptr. */ -+#define R_PARISC_LTOFF_FPTR16WF 126 /* 16 bits LT-rel. function ptr. */ -+#define R_PARISC_LTOFF_FPTR16DF 127 /* 16 bits LT-rel. function ptr. */ -+#define R_PARISC_LORESERVE 128 -+#define R_PARISC_COPY 128 /* Copy relocation. */ -+#define R_PARISC_IPLT 129 /* Dynamic reloc, imported PLT */ -+#define R_PARISC_EPLT 130 /* Dynamic reloc, exported PLT */ -+#define R_PARISC_TPREL32 153 /* 32 bits TP-rel. address. */ -+#define R_PARISC_TPREL21L 154 /* TP-rel. address, left 21 bits. */ -+#define R_PARISC_TPREL14R 158 /* TP-rel. address, right 14 bits. */ -+#define R_PARISC_LTOFF_TP21L 162 /* LT-TP-rel. address, left 21 bits. */ -+#define R_PARISC_LTOFF_TP14R 166 /* LT-TP-rel. address, right 14 bits.*/ -+#define R_PARISC_LTOFF_TP14F 167 /* 14 bits LT-TP-rel. address. */ -+#define R_PARISC_TPREL64 216 /* 64 bits TP-rel. address. */ -+#define R_PARISC_TPREL14WR 219 /* TP-rel. address, right 14 bits. */ -+#define R_PARISC_TPREL14DR 220 /* TP-rel. address, right 14 bits. */ -+#define R_PARISC_TPREL16F 221 /* 16 bits TP-rel. address. */ -+#define R_PARISC_TPREL16WF 222 /* 16 bits TP-rel. address. */ -+#define R_PARISC_TPREL16DF 223 /* 16 bits TP-rel. address. */ -+#define R_PARISC_LTOFF_TP64 224 /* 64 bits LT-TP-rel. address. */ -+#define R_PARISC_LTOFF_TP14WR 227 /* LT-TP-rel. address, right 14 bits.*/ -+#define R_PARISC_LTOFF_TP14DR 228 /* LT-TP-rel. address, right 14 bits.*/ -+#define R_PARISC_LTOFF_TP16F 229 /* 16 bits LT-TP-rel. address. */ -+#define R_PARISC_LTOFF_TP16WF 230 /* 16 bits LT-TP-rel. address. */ -+#define R_PARISC_LTOFF_TP16DF 231 /* 16 bits LT-TP-rel. address. */ -+#define R_PARISC_GNU_VTENTRY 232 -+#define R_PARISC_GNU_VTINHERIT 233 -+#define R_PARISC_TLS_GD21L 234 /* GD 21-bit left. */ -+#define R_PARISC_TLS_GD14R 235 /* GD 14-bit right. */ -+#define R_PARISC_TLS_GDCALL 236 /* GD call to __t_g_a. */ -+#define R_PARISC_TLS_LDM21L 237 /* LD module 21-bit left. */ -+#define R_PARISC_TLS_LDM14R 238 /* LD module 14-bit right. */ -+#define R_PARISC_TLS_LDMCALL 239 /* LD module call to __t_g_a. */ -+#define R_PARISC_TLS_LDO21L 240 /* LD offset 21-bit left. */ -+#define R_PARISC_TLS_LDO14R 241 /* LD offset 14-bit right. */ -+#define R_PARISC_TLS_DTPMOD32 242 /* DTP module 32-bit. */ -+#define R_PARISC_TLS_DTPMOD64 243 /* DTP module 64-bit. */ -+#define R_PARISC_TLS_DTPOFF32 244 /* DTP offset 32-bit. */ -+#define R_PARISC_TLS_DTPOFF64 245 /* DTP offset 32-bit. */ -+#define R_PARISC_TLS_LE21L R_PARISC_TPREL21L -+#define R_PARISC_TLS_LE14R R_PARISC_TPREL14R -+#define R_PARISC_TLS_IE21L R_PARISC_LTOFF_TP21L -+#define R_PARISC_TLS_IE14R R_PARISC_LTOFF_TP14R -+#define R_PARISC_TLS_TPREL32 R_PARISC_TPREL32 -+#define R_PARISC_TLS_TPREL64 R_PARISC_TPREL64 -+#define R_PARISC_HIRESERVE 255 -+ -+/* Legal values for p_type field of Elf32_Phdr/Elf64_Phdr. */ -+ -+#define PT_HP_TLS (PT_LOOS + 0x0) -+#define PT_HP_CORE_NONE (PT_LOOS + 0x1) -+#define PT_HP_CORE_VERSION (PT_LOOS + 0x2) -+#define PT_HP_CORE_KERNEL (PT_LOOS + 0x3) -+#define PT_HP_CORE_COMM (PT_LOOS + 0x4) -+#define PT_HP_CORE_PROC (PT_LOOS + 0x5) -+#define PT_HP_CORE_LOADABLE (PT_LOOS + 0x6) -+#define PT_HP_CORE_STACK (PT_LOOS + 0x7) -+#define PT_HP_CORE_SHM (PT_LOOS + 0x8) -+#define PT_HP_CORE_MMF (PT_LOOS + 0x9) -+#define PT_HP_PARALLEL (PT_LOOS + 0x10) -+#define PT_HP_FASTBIND (PT_LOOS + 0x11) -+#define PT_HP_OPT_ANNOT (PT_LOOS + 0x12) -+#define PT_HP_HSL_ANNOT (PT_LOOS + 0x13) -+#define PT_HP_STACK (PT_LOOS + 0x14) -+ -+#define PT_PARISC_ARCHEXT 0x70000000 -+#define PT_PARISC_UNWIND 0x70000001 -+ -+/* Legal values for p_flags field of Elf32_Phdr/Elf64_Phdr. */ -+ -+#define PF_PARISC_SBP 0x08000000 -+ -+#define PF_HP_PAGE_SIZE 0x00100000 -+#define PF_HP_FAR_SHARED 0x00200000 -+#define PF_HP_NEAR_SHARED 0x00400000 -+#define PF_HP_CODE 0x01000000 -+#define PF_HP_MODIFY 0x02000000 -+#define PF_HP_LAZYSWAP 0x04000000 -+#define PF_HP_SBP 0x08000000 -+ -+ -+/* Alpha specific definitions. */ -+ -+/* Legal values for e_flags field of Elf64_Ehdr. */ -+ -+#define EF_ALPHA_32BIT 1 /* All addresses must be < 2GB. */ -+#define EF_ALPHA_CANRELAX 2 /* Relocations for relaxing exist. */ -+ -+/* Legal values for sh_type field of Elf64_Shdr. */ -+ -+/* These two are primerily concerned with ECOFF debugging info. */ -+#define SHT_ALPHA_DEBUG 0x70000001 -+#define SHT_ALPHA_REGINFO 0x70000002 -+ -+/* Legal values for sh_flags field of Elf64_Shdr. */ -+ -+#define SHF_ALPHA_GPREL 0x10000000 -+ -+/* Legal values for st_other field of Elf64_Sym. */ -+#define STO_ALPHA_NOPV 0x80 /* No PV required. */ -+#define STO_ALPHA_STD_GPLOAD 0x88 /* PV only used for initial ldgp. */ -+ -+/* Alpha relocs. */ -+ -+#define R_ALPHA_NONE 0 /* No reloc */ -+#define R_ALPHA_REFLONG 1 /* Direct 32 bit */ -+#define R_ALPHA_REFQUAD 2 /* Direct 64 bit */ -+#define R_ALPHA_GPREL32 3 /* GP relative 32 bit */ -+#define R_ALPHA_LITERAL 4 /* GP relative 16 bit w/optimization */ -+#define R_ALPHA_LITUSE 5 /* Optimization hint for LITERAL */ -+#define R_ALPHA_GPDISP 6 /* Add displacement to GP */ -+#define R_ALPHA_BRADDR 7 /* PC+4 relative 23 bit shifted */ -+#define R_ALPHA_HINT 8 /* PC+4 relative 16 bit shifted */ -+#define R_ALPHA_SREL16 9 /* PC relative 16 bit */ -+#define R_ALPHA_SREL32 10 /* PC relative 32 bit */ -+#define R_ALPHA_SREL64 11 /* PC relative 64 bit */ -+#define R_ALPHA_GPRELHIGH 17 /* GP relative 32 bit, high 16 bits */ -+#define R_ALPHA_GPRELLOW 18 /* GP relative 32 bit, low 16 bits */ -+#define R_ALPHA_GPREL16 19 /* GP relative 16 bit */ -+#define R_ALPHA_COPY 24 /* Copy symbol at runtime */ -+#define R_ALPHA_GLOB_DAT 25 /* Create GOT entry */ -+#define R_ALPHA_JMP_SLOT 26 /* Create PLT entry */ -+#define R_ALPHA_RELATIVE 27 /* Adjust by program base */ -+#define R_ALPHA_TLS_GD_HI 28 -+#define R_ALPHA_TLSGD 29 -+#define R_ALPHA_TLS_LDM 30 -+#define R_ALPHA_DTPMOD64 31 -+#define R_ALPHA_GOTDTPREL 32 -+#define R_ALPHA_DTPREL64 33 -+#define R_ALPHA_DTPRELHI 34 -+#define R_ALPHA_DTPRELLO 35 -+#define R_ALPHA_DTPREL16 36 -+#define R_ALPHA_GOTTPREL 37 -+#define R_ALPHA_TPREL64 38 -+#define R_ALPHA_TPRELHI 39 -+#define R_ALPHA_TPRELLO 40 -+#define R_ALPHA_TPREL16 41 -+/* Keep this the last entry. */ -+#define R_ALPHA_NUM 46 -+ -+/* Magic values of the LITUSE relocation addend. */ -+#define LITUSE_ALPHA_ADDR 0 -+#define LITUSE_ALPHA_BASE 1 -+#define LITUSE_ALPHA_BYTOFF 2 -+#define LITUSE_ALPHA_JSR 3 -+#define LITUSE_ALPHA_TLS_GD 4 -+#define LITUSE_ALPHA_TLS_LDM 5 -+ -+/* Legal values for d_tag of Elf64_Dyn. */ -+#define DT_ALPHA_PLTRO (DT_LOPROC + 0) -+#define DT_ALPHA_NUM 1 -+ -+/* PowerPC specific declarations */ -+ -+/* Values for Elf32/64_Ehdr.e_flags. */ -+#define EF_PPC_EMB 0x80000000 /* PowerPC embedded flag */ -+ -+/* Cygnus local bits below */ -+#define EF_PPC_RELOCATABLE 0x00010000 /* PowerPC -mrelocatable flag*/ -+#define EF_PPC_RELOCATABLE_LIB 0x00008000 /* PowerPC -mrelocatable-lib -+ flag */ -+ -+/* PowerPC relocations defined by the ABIs */ -+#define R_PPC_NONE 0 -+#define R_PPC_ADDR32 1 /* 32bit absolute address */ -+#define R_PPC_ADDR24 2 /* 26bit address, 2 bits ignored. */ -+#define R_PPC_ADDR16 3 /* 16bit absolute address */ -+#define R_PPC_ADDR16_LO 4 /* lower 16bit of absolute address */ -+#define R_PPC_ADDR16_HI 5 /* high 16bit of absolute address */ -+#define R_PPC_ADDR16_HA 6 /* adjusted high 16bit */ -+#define R_PPC_ADDR14 7 /* 16bit address, 2 bits ignored */ -+#define R_PPC_ADDR14_BRTAKEN 8 -+#define R_PPC_ADDR14_BRNTAKEN 9 -+#define R_PPC_REL24 10 /* PC relative 26 bit */ -+#define R_PPC_REL14 11 /* PC relative 16 bit */ -+#define R_PPC_REL14_BRTAKEN 12 -+#define R_PPC_REL14_BRNTAKEN 13 -+#define R_PPC_GOT16 14 -+#define R_PPC_GOT16_LO 15 -+#define R_PPC_GOT16_HI 16 -+#define R_PPC_GOT16_HA 17 -+#define R_PPC_PLTREL24 18 -+#define R_PPC_COPY 19 -+#define R_PPC_GLOB_DAT 20 -+#define R_PPC_JMP_SLOT 21 -+#define R_PPC_RELATIVE 22 -+#define R_PPC_LOCAL24PC 23 -+#define R_PPC_UADDR32 24 -+#define R_PPC_UADDR16 25 -+#define R_PPC_REL32 26 -+#define R_PPC_PLT32 27 -+#define R_PPC_PLTREL32 28 -+#define R_PPC_PLT16_LO 29 -+#define R_PPC_PLT16_HI 30 -+#define R_PPC_PLT16_HA 31 -+#define R_PPC_SDAREL16 32 -+#define R_PPC_SECTOFF 33 -+#define R_PPC_SECTOFF_LO 34 -+#define R_PPC_SECTOFF_HI 35 -+#define R_PPC_SECTOFF_HA 36 -+ -+/* PowerPC relocations defined for the TLS access ABI. */ -+#define R_PPC_TLS 67 /* none (sym+add)@tls */ -+#define R_PPC_DTPMOD32 68 /* word32 (sym+add)@dtpmod */ -+#define R_PPC_TPREL16 69 /* half16* (sym+add)@tprel */ -+#define R_PPC_TPREL16_LO 70 /* half16 (sym+add)@tprel@l */ -+#define R_PPC_TPREL16_HI 71 /* half16 (sym+add)@tprel@h */ -+#define R_PPC_TPREL16_HA 72 /* half16 (sym+add)@tprel@ha */ -+#define R_PPC_TPREL32 73 /* word32 (sym+add)@tprel */ -+#define R_PPC_DTPREL16 74 /* half16* (sym+add)@dtprel */ -+#define R_PPC_DTPREL16_LO 75 /* half16 (sym+add)@dtprel@l */ -+#define R_PPC_DTPREL16_HI 76 /* half16 (sym+add)@dtprel@h */ -+#define R_PPC_DTPREL16_HA 77 /* half16 (sym+add)@dtprel@ha */ -+#define R_PPC_DTPREL32 78 /* word32 (sym+add)@dtprel */ -+#define R_PPC_GOT_TLSGD16 79 /* half16* (sym+add)@got@tlsgd */ -+#define R_PPC_GOT_TLSGD16_LO 80 /* half16 (sym+add)@got@tlsgd@l */ -+#define R_PPC_GOT_TLSGD16_HI 81 /* half16 (sym+add)@got@tlsgd@h */ -+#define R_PPC_GOT_TLSGD16_HA 82 /* half16 (sym+add)@got@tlsgd@ha */ -+#define R_PPC_GOT_TLSLD16 83 /* half16* (sym+add)@got@tlsld */ -+#define R_PPC_GOT_TLSLD16_LO 84 /* half16 (sym+add)@got@tlsld@l */ -+#define R_PPC_GOT_TLSLD16_HI 85 /* half16 (sym+add)@got@tlsld@h */ -+#define R_PPC_GOT_TLSLD16_HA 86 /* half16 (sym+add)@got@tlsld@ha */ -+#define R_PPC_GOT_TPREL16 87 /* half16* (sym+add)@got@tprel */ -+#define R_PPC_GOT_TPREL16_LO 88 /* half16 (sym+add)@got@tprel@l */ -+#define R_PPC_GOT_TPREL16_HI 89 /* half16 (sym+add)@got@tprel@h */ -+#define R_PPC_GOT_TPREL16_HA 90 /* half16 (sym+add)@got@tprel@ha */ -+#define R_PPC_GOT_DTPREL16 91 /* half16* (sym+add)@got@dtprel */ -+#define R_PPC_GOT_DTPREL16_LO 92 /* half16* (sym+add)@got@dtprel@l */ -+#define R_PPC_GOT_DTPREL16_HI 93 /* half16* (sym+add)@got@dtprel@h */ -+#define R_PPC_GOT_DTPREL16_HA 94 /* half16* (sym+add)@got@dtprel@ha */ -+ -+/* The remaining relocs are from the Embedded ELF ABI, and are not -+ in the SVR4 ELF ABI. */ -+#define R_PPC_EMB_NADDR32 101 -+#define R_PPC_EMB_NADDR16 102 -+#define R_PPC_EMB_NADDR16_LO 103 -+#define R_PPC_EMB_NADDR16_HI 104 -+#define R_PPC_EMB_NADDR16_HA 105 -+#define R_PPC_EMB_SDAI16 106 -+#define R_PPC_EMB_SDA2I16 107 -+#define R_PPC_EMB_SDA2REL 108 -+#define R_PPC_EMB_SDA21 109 /* 16 bit offset in SDA */ -+#define R_PPC_EMB_MRKREF 110 -+#define R_PPC_EMB_RELSEC16 111 -+#define R_PPC_EMB_RELST_LO 112 -+#define R_PPC_EMB_RELST_HI 113 -+#define R_PPC_EMB_RELST_HA 114 -+#define R_PPC_EMB_BIT_FLD 115 -+#define R_PPC_EMB_RELSDA 116 /* 16 bit relative offset in SDA */ -+ -+/* Diab tool relocations. */ -+#define R_PPC_DIAB_SDA21_LO 180 /* like EMB_SDA21, but lower 16 bit */ -+#define R_PPC_DIAB_SDA21_HI 181 /* like EMB_SDA21, but high 16 bit */ -+#define R_PPC_DIAB_SDA21_HA 182 /* like EMB_SDA21, adjusted high 16 */ -+#define R_PPC_DIAB_RELSDA_LO 183 /* like EMB_RELSDA, but lower 16 bit */ -+#define R_PPC_DIAB_RELSDA_HI 184 /* like EMB_RELSDA, but high 16 bit */ -+#define R_PPC_DIAB_RELSDA_HA 185 /* like EMB_RELSDA, adjusted high 16 */ -+ -+/* GNU extension to support local ifunc. */ -+#define R_PPC_IRELATIVE 248 -+ -+/* GNU relocs used in PIC code sequences. */ -+#define R_PPC_REL16 249 /* half16 (sym+add-.) */ -+#define R_PPC_REL16_LO 250 /* half16 (sym+add-.)@l */ -+#define R_PPC_REL16_HI 251 /* half16 (sym+add-.)@h */ -+#define R_PPC_REL16_HA 252 /* half16 (sym+add-.)@ha */ -+ -+/* This is a phony reloc to handle any old fashioned TOC16 references -+ that may still be in object files. */ -+#define R_PPC_TOC16 255 -+ -+/* PowerPC specific values for the Dyn d_tag field. */ -+#define DT_PPC_GOT (DT_LOPROC + 0) -+#define DT_PPC_NUM 1 -+ -+/* PowerPC64 relocations defined by the ABIs */ -+#define R_PPC64_NONE R_PPC_NONE -+#define R_PPC64_ADDR32 R_PPC_ADDR32 /* 32bit absolute address */ -+#define R_PPC64_ADDR24 R_PPC_ADDR24 /* 26bit address, word aligned */ -+#define R_PPC64_ADDR16 R_PPC_ADDR16 /* 16bit absolute address */ -+#define R_PPC64_ADDR16_LO R_PPC_ADDR16_LO /* lower 16bits of address */ -+#define R_PPC64_ADDR16_HI R_PPC_ADDR16_HI /* high 16bits of address. */ -+#define R_PPC64_ADDR16_HA R_PPC_ADDR16_HA /* adjusted high 16bits. */ -+#define R_PPC64_ADDR14 R_PPC_ADDR14 /* 16bit address, word aligned */ -+#define R_PPC64_ADDR14_BRTAKEN R_PPC_ADDR14_BRTAKEN -+#define R_PPC64_ADDR14_BRNTAKEN R_PPC_ADDR14_BRNTAKEN -+#define R_PPC64_REL24 R_PPC_REL24 /* PC-rel. 26 bit, word aligned */ -+#define R_PPC64_REL14 R_PPC_REL14 /* PC relative 16 bit */ -+#define R_PPC64_REL14_BRTAKEN R_PPC_REL14_BRTAKEN -+#define R_PPC64_REL14_BRNTAKEN R_PPC_REL14_BRNTAKEN -+#define R_PPC64_GOT16 R_PPC_GOT16 -+#define R_PPC64_GOT16_LO R_PPC_GOT16_LO -+#define R_PPC64_GOT16_HI R_PPC_GOT16_HI -+#define R_PPC64_GOT16_HA R_PPC_GOT16_HA -+ -+#define R_PPC64_COPY R_PPC_COPY -+#define R_PPC64_GLOB_DAT R_PPC_GLOB_DAT -+#define R_PPC64_JMP_SLOT R_PPC_JMP_SLOT -+#define R_PPC64_RELATIVE R_PPC_RELATIVE -+ -+#define R_PPC64_UADDR32 R_PPC_UADDR32 -+#define R_PPC64_UADDR16 R_PPC_UADDR16 -+#define R_PPC64_REL32 R_PPC_REL32 -+#define R_PPC64_PLT32 R_PPC_PLT32 -+#define R_PPC64_PLTREL32 R_PPC_PLTREL32 -+#define R_PPC64_PLT16_LO R_PPC_PLT16_LO -+#define R_PPC64_PLT16_HI R_PPC_PLT16_HI -+#define R_PPC64_PLT16_HA R_PPC_PLT16_HA -+ -+#define R_PPC64_SECTOFF R_PPC_SECTOFF -+#define R_PPC64_SECTOFF_LO R_PPC_SECTOFF_LO -+#define R_PPC64_SECTOFF_HI R_PPC_SECTOFF_HI -+#define R_PPC64_SECTOFF_HA R_PPC_SECTOFF_HA -+#define R_PPC64_ADDR30 37 /* word30 (S + A - P) >> 2 */ -+#define R_PPC64_ADDR64 38 /* doubleword64 S + A */ -+#define R_PPC64_ADDR16_HIGHER 39 /* half16 #higher(S + A) */ -+#define R_PPC64_ADDR16_HIGHERA 40 /* half16 #highera(S + A) */ -+#define R_PPC64_ADDR16_HIGHEST 41 /* half16 #highest(S + A) */ -+#define R_PPC64_ADDR16_HIGHESTA 42 /* half16 #highesta(S + A) */ -+#define R_PPC64_UADDR64 43 /* doubleword64 S + A */ -+#define R_PPC64_REL64 44 /* doubleword64 S + A - P */ -+#define R_PPC64_PLT64 45 /* doubleword64 L + A */ -+#define R_PPC64_PLTREL64 46 /* doubleword64 L + A - P */ -+#define R_PPC64_TOC16 47 /* half16* S + A - .TOC */ -+#define R_PPC64_TOC16_LO 48 /* half16 #lo(S + A - .TOC.) */ -+#define R_PPC64_TOC16_HI 49 /* half16 #hi(S + A - .TOC.) */ -+#define R_PPC64_TOC16_HA 50 /* half16 #ha(S + A - .TOC.) */ -+#define R_PPC64_TOC 51 /* doubleword64 .TOC */ -+#define R_PPC64_PLTGOT16 52 /* half16* M + A */ -+#define R_PPC64_PLTGOT16_LO 53 /* half16 #lo(M + A) */ -+#define R_PPC64_PLTGOT16_HI 54 /* half16 #hi(M + A) */ -+#define R_PPC64_PLTGOT16_HA 55 /* half16 #ha(M + A) */ -+ -+#define R_PPC64_ADDR16_DS 56 /* half16ds* (S + A) >> 2 */ -+#define R_PPC64_ADDR16_LO_DS 57 /* half16ds #lo(S + A) >> 2 */ -+#define R_PPC64_GOT16_DS 58 /* half16ds* (G + A) >> 2 */ -+#define R_PPC64_GOT16_LO_DS 59 /* half16ds #lo(G + A) >> 2 */ -+#define R_PPC64_PLT16_LO_DS 60 /* half16ds #lo(L + A) >> 2 */ -+#define R_PPC64_SECTOFF_DS 61 /* half16ds* (R + A) >> 2 */ -+#define R_PPC64_SECTOFF_LO_DS 62 /* half16ds #lo(R + A) >> 2 */ -+#define R_PPC64_TOC16_DS 63 /* half16ds* (S + A - .TOC.) >> 2 */ -+#define R_PPC64_TOC16_LO_DS 64 /* half16ds #lo(S + A - .TOC.) >> 2 */ -+#define R_PPC64_PLTGOT16_DS 65 /* half16ds* (M + A) >> 2 */ -+#define R_PPC64_PLTGOT16_LO_DS 66 /* half16ds #lo(M + A) >> 2 */ -+ -+/* PowerPC64 relocations defined for the TLS access ABI. */ -+#define R_PPC64_TLS 67 /* none (sym+add)@tls */ -+#define R_PPC64_DTPMOD64 68 /* doubleword64 (sym+add)@dtpmod */ -+#define R_PPC64_TPREL16 69 /* half16* (sym+add)@tprel */ -+#define R_PPC64_TPREL16_LO 70 /* half16 (sym+add)@tprel@l */ -+#define R_PPC64_TPREL16_HI 71 /* half16 (sym+add)@tprel@h */ -+#define R_PPC64_TPREL16_HA 72 /* half16 (sym+add)@tprel@ha */ -+#define R_PPC64_TPREL64 73 /* doubleword64 (sym+add)@tprel */ -+#define R_PPC64_DTPREL16 74 /* half16* (sym+add)@dtprel */ -+#define R_PPC64_DTPREL16_LO 75 /* half16 (sym+add)@dtprel@l */ -+#define R_PPC64_DTPREL16_HI 76 /* half16 (sym+add)@dtprel@h */ -+#define R_PPC64_DTPREL16_HA 77 /* half16 (sym+add)@dtprel@ha */ -+#define R_PPC64_DTPREL64 78 /* doubleword64 (sym+add)@dtprel */ -+#define R_PPC64_GOT_TLSGD16 79 /* half16* (sym+add)@got@tlsgd */ -+#define R_PPC64_GOT_TLSGD16_LO 80 /* half16 (sym+add)@got@tlsgd@l */ -+#define R_PPC64_GOT_TLSGD16_HI 81 /* half16 (sym+add)@got@tlsgd@h */ -+#define R_PPC64_GOT_TLSGD16_HA 82 /* half16 (sym+add)@got@tlsgd@ha */ -+#define R_PPC64_GOT_TLSLD16 83 /* half16* (sym+add)@got@tlsld */ -+#define R_PPC64_GOT_TLSLD16_LO 84 /* half16 (sym+add)@got@tlsld@l */ -+#define R_PPC64_GOT_TLSLD16_HI 85 /* half16 (sym+add)@got@tlsld@h */ -+#define R_PPC64_GOT_TLSLD16_HA 86 /* half16 (sym+add)@got@tlsld@ha */ -+#define R_PPC64_GOT_TPREL16_DS 87 /* half16ds* (sym+add)@got@tprel */ -+#define R_PPC64_GOT_TPREL16_LO_DS 88 /* half16ds (sym+add)@got@tprel@l */ -+#define R_PPC64_GOT_TPREL16_HI 89 /* half16 (sym+add)@got@tprel@h */ -+#define R_PPC64_GOT_TPREL16_HA 90 /* half16 (sym+add)@got@tprel@ha */ -+#define R_PPC64_GOT_DTPREL16_DS 91 /* half16ds* (sym+add)@got@dtprel */ -+#define R_PPC64_GOT_DTPREL16_LO_DS 92 /* half16ds (sym+add)@got@dtprel@l */ -+#define R_PPC64_GOT_DTPREL16_HI 93 /* half16 (sym+add)@got@dtprel@h */ -+#define R_PPC64_GOT_DTPREL16_HA 94 /* half16 (sym+add)@got@dtprel@ha */ -+#define R_PPC64_TPREL16_DS 95 /* half16ds* (sym+add)@tprel */ -+#define R_PPC64_TPREL16_LO_DS 96 /* half16ds (sym+add)@tprel@l */ -+#define R_PPC64_TPREL16_HIGHER 97 /* half16 (sym+add)@tprel@higher */ -+#define R_PPC64_TPREL16_HIGHERA 98 /* half16 (sym+add)@tprel@highera */ -+#define R_PPC64_TPREL16_HIGHEST 99 /* half16 (sym+add)@tprel@highest */ -+#define R_PPC64_TPREL16_HIGHESTA 100 /* half16 (sym+add)@tprel@highesta */ -+#define R_PPC64_DTPREL16_DS 101 /* half16ds* (sym+add)@dtprel */ -+#define R_PPC64_DTPREL16_LO_DS 102 /* half16ds (sym+add)@dtprel@l */ -+#define R_PPC64_DTPREL16_HIGHER 103 /* half16 (sym+add)@dtprel@higher */ -+#define R_PPC64_DTPREL16_HIGHERA 104 /* half16 (sym+add)@dtprel@highera */ -+#define R_PPC64_DTPREL16_HIGHEST 105 /* half16 (sym+add)@dtprel@highest */ -+#define R_PPC64_DTPREL16_HIGHESTA 106 /* half16 (sym+add)@dtprel@highesta */ -+ -+/* GNU extension to support local ifunc. */ -+#define R_PPC64_JMP_IREL 247 -+#define R_PPC64_IRELATIVE 248 -+#define R_PPC64_REL16 249 /* half16 (sym+add-.) */ -+#define R_PPC64_REL16_LO 250 /* half16 (sym+add-.)@l */ -+#define R_PPC64_REL16_HI 251 /* half16 (sym+add-.)@h */ -+#define R_PPC64_REL16_HA 252 /* half16 (sym+add-.)@ha */ -+ -+/* PowerPC64 specific values for the Dyn d_tag field. */ -+#define DT_PPC64_GLINK (DT_LOPROC + 0) -+#define DT_PPC64_OPD (DT_LOPROC + 1) -+#define DT_PPC64_OPDSZ (DT_LOPROC + 2) -+#define DT_PPC64_NUM 3 -+ -+ -+/* ARM specific declarations */ -+ -+/* Processor specific flags for the ELF header e_flags field. */ -+#define EF_ARM_RELEXEC 0x01 -+#define EF_ARM_HASENTRY 0x02 -+#define EF_ARM_INTERWORK 0x04 -+#define EF_ARM_APCS_26 0x08 -+#define EF_ARM_APCS_FLOAT 0x10 -+#define EF_ARM_PIC 0x20 -+#define EF_ARM_ALIGN8 0x40 /* 8-bit structure alignment is in use */ -+#define EF_ARM_NEW_ABI 0x80 -+#define EF_ARM_OLD_ABI 0x100 -+#define EF_ARM_SOFT_FLOAT 0x200 -+#define EF_ARM_VFP_FLOAT 0x400 -+#define EF_ARM_MAVERICK_FLOAT 0x800 -+ -+ -+/* Other constants defined in the ARM ELF spec. version B-01. */ -+/* NB. These conflict with values defined above. */ -+#define EF_ARM_SYMSARESORTED 0x04 -+#define EF_ARM_DYNSYMSUSESEGIDX 0x08 -+#define EF_ARM_MAPSYMSFIRST 0x10 -+#define EF_ARM_EABIMASK 0XFF000000 -+ -+/* Constants defined in AAELF. */ -+#define EF_ARM_BE8 0x00800000 -+#define EF_ARM_LE8 0x00400000 -+ -+#define EF_ARM_EABI_VERSION(flags) ((flags) & EF_ARM_EABIMASK) -+#define EF_ARM_EABI_UNKNOWN 0x00000000 -+#define EF_ARM_EABI_VER1 0x01000000 -+#define EF_ARM_EABI_VER2 0x02000000 -+#define EF_ARM_EABI_VER3 0x03000000 -+#define EF_ARM_EABI_VER4 0x04000000 -+#define EF_ARM_EABI_VER5 0x05000000 -+ -+/* Additional symbol types for Thumb. */ -+#define STT_ARM_TFUNC STT_LOPROC /* A Thumb function. */ -+#define STT_ARM_16BIT STT_HIPROC /* A Thumb label. */ -+ -+/* ARM-specific values for sh_flags */ -+#define SHF_ARM_ENTRYSECT 0x10000000 /* Section contains an entry point */ -+#define SHF_ARM_COMDEF 0x80000000 /* Section may be multiply defined -+ in the input to a link step. */ -+ -+/* ARM-specific program header flags */ -+#define PF_ARM_SB 0x10000000 /* Segment contains the location -+ addressed by the static base. */ -+#define PF_ARM_PI 0x20000000 /* Position-independent segment. */ -+#define PF_ARM_ABS 0x40000000 /* Absolute segment. */ -+ -+/* Processor specific values for the Phdr p_type field. */ -+#define PT_ARM_EXIDX (PT_LOPROC + 1) /* ARM unwind segment. */ -+ -+/* Processor specific values for the Shdr sh_type field. */ -+#define SHT_ARM_EXIDX (SHT_LOPROC + 1) /* ARM unwind section. */ -+#define SHT_ARM_PREEMPTMAP (SHT_LOPROC + 2) /* Preemption details. */ -+#define SHT_ARM_ATTRIBUTES (SHT_LOPROC + 3) /* ARM attributes section. */ -+ -+ -+/* ARM relocs. */ -+ -+#define R_ARM_NONE 0 /* No reloc */ -+#define R_ARM_PC24 1 /* PC relative 26 bit branch */ -+#define R_ARM_ABS32 2 /* Direct 32 bit */ -+#define R_ARM_REL32 3 /* PC relative 32 bit */ -+#define R_ARM_PC13 4 -+#define R_ARM_ABS16 5 /* Direct 16 bit */ -+#define R_ARM_ABS12 6 /* Direct 12 bit */ -+#define R_ARM_THM_ABS5 7 -+#define R_ARM_ABS8 8 /* Direct 8 bit */ -+#define R_ARM_SBREL32 9 -+#define R_ARM_THM_PC22 10 -+#define R_ARM_THM_PC8 11 -+#define R_ARM_AMP_VCALL9 12 -+#define R_ARM_SWI24 13 /* Obsolete static relocation. */ -+#define R_ARM_TLS_DESC 13 /* Dynamic relocation. */ -+#define R_ARM_THM_SWI8 14 -+#define R_ARM_XPC25 15 -+#define R_ARM_THM_XPC22 16 -+#define R_ARM_TLS_DTPMOD32 17 /* ID of module containing symbol */ -+#define R_ARM_TLS_DTPOFF32 18 /* Offset in TLS block */ -+#define R_ARM_TLS_TPOFF32 19 /* Offset in static TLS block */ -+#define R_ARM_COPY 20 /* Copy symbol at runtime */ -+#define R_ARM_GLOB_DAT 21 /* Create GOT entry */ -+#define R_ARM_JUMP_SLOT 22 /* Create PLT entry */ -+#define R_ARM_RELATIVE 23 /* Adjust by program base */ -+#define R_ARM_GOTOFF 24 /* 32 bit offset to GOT */ -+#define R_ARM_GOTPC 25 /* 32 bit PC relative offset to GOT */ -+#define R_ARM_GOT32 26 /* 32 bit GOT entry */ -+#define R_ARM_PLT32 27 /* 32 bit PLT address */ -+#define R_ARM_ALU_PCREL_7_0 32 -+#define R_ARM_ALU_PCREL_15_8 33 -+#define R_ARM_ALU_PCREL_23_15 34 -+#define R_ARM_LDR_SBREL_11_0 35 -+#define R_ARM_ALU_SBREL_19_12 36 -+#define R_ARM_ALU_SBREL_27_20 37 -+#define R_ARM_TLS_GOTDESC 90 -+#define R_ARM_TLS_CALL 91 -+#define R_ARM_TLS_DESCSEQ 92 -+#define R_ARM_THM_TLS_CALL 93 -+#define R_ARM_GNU_VTENTRY 100 -+#define R_ARM_GNU_VTINHERIT 101 -+#define R_ARM_THM_PC11 102 /* thumb unconditional branch */ -+#define R_ARM_THM_PC9 103 /* thumb conditional branch */ -+#define R_ARM_TLS_GD32 104 /* PC-rel 32 bit for global dynamic -+ thread local data */ -+#define R_ARM_TLS_LDM32 105 /* PC-rel 32 bit for local dynamic -+ thread local data */ -+#define R_ARM_TLS_LDO32 106 /* 32 bit offset relative to TLS -+ block */ -+#define R_ARM_TLS_IE32 107 /* PC-rel 32 bit for GOT entry of -+ static TLS block offset */ -+#define R_ARM_TLS_LE32 108 /* 32 bit offset relative to static -+ TLS block */ -+#define R_ARM_THM_TLS_DESCSEQ 129 -+#define R_ARM_IRELATIVE 160 -+#define R_ARM_RXPC25 249 -+#define R_ARM_RSBREL32 250 -+#define R_ARM_THM_RPC22 251 -+#define R_ARM_RREL32 252 -+#define R_ARM_RABS22 253 -+#define R_ARM_RPC24 254 -+#define R_ARM_RBASE 255 -+/* Keep this the last entry. */ -+#define R_ARM_NUM 256 -+ -+/* IA-64 specific declarations. */ -+ -+/* Processor specific flags for the Ehdr e_flags field. */ -+#define EF_IA_64_MASKOS 0x0000000f /* os-specific flags */ -+#define EF_IA_64_ABI64 0x00000010 /* 64-bit ABI */ -+#define EF_IA_64_ARCH 0xff000000 /* arch. version mask */ -+ -+/* Processor specific values for the Phdr p_type field. */ -+#define PT_IA_64_ARCHEXT (PT_LOPROC + 0) /* arch extension bits */ -+#define PT_IA_64_UNWIND (PT_LOPROC + 1) /* ia64 unwind bits */ -+#define PT_IA_64_HP_OPT_ANOT (PT_LOOS + 0x12) -+#define PT_IA_64_HP_HSL_ANOT (PT_LOOS + 0x13) -+#define PT_IA_64_HP_STACK (PT_LOOS + 0x14) -+ -+/* Processor specific flags for the Phdr p_flags field. */ -+#define PF_IA_64_NORECOV 0x80000000 /* spec insns w/o recovery */ -+ -+/* Processor specific values for the Shdr sh_type field. */ -+#define SHT_IA_64_EXT (SHT_LOPROC + 0) /* extension bits */ -+#define SHT_IA_64_UNWIND (SHT_LOPROC + 1) /* unwind bits */ -+ -+/* Processor specific flags for the Shdr sh_flags field. */ -+#define SHF_IA_64_SHORT 0x10000000 /* section near gp */ -+#define SHF_IA_64_NORECOV 0x20000000 /* spec insns w/o recovery */ -+ -+/* Processor specific values for the Dyn d_tag field. */ -+#define DT_IA_64_PLT_RESERVE (DT_LOPROC + 0) -+#define DT_IA_64_NUM 1 -+ -+/* IA-64 relocations. */ -+#define R_IA64_NONE 0x00 /* none */ -+#define R_IA64_IMM14 0x21 /* symbol + addend, add imm14 */ -+#define R_IA64_IMM22 0x22 /* symbol + addend, add imm22 */ -+#define R_IA64_IMM64 0x23 /* symbol + addend, mov imm64 */ -+#define R_IA64_DIR32MSB 0x24 /* symbol + addend, data4 MSB */ -+#define R_IA64_DIR32LSB 0x25 /* symbol + addend, data4 LSB */ -+#define R_IA64_DIR64MSB 0x26 /* symbol + addend, data8 MSB */ -+#define R_IA64_DIR64LSB 0x27 /* symbol + addend, data8 LSB */ -+#define R_IA64_GPREL22 0x2a /* @gprel(sym + add), add imm22 */ -+#define R_IA64_GPREL64I 0x2b /* @gprel(sym + add), mov imm64 */ -+#define R_IA64_GPREL32MSB 0x2c /* @gprel(sym + add), data4 MSB */ -+#define R_IA64_GPREL32LSB 0x2d /* @gprel(sym + add), data4 LSB */ -+#define R_IA64_GPREL64MSB 0x2e /* @gprel(sym + add), data8 MSB */ -+#define R_IA64_GPREL64LSB 0x2f /* @gprel(sym + add), data8 LSB */ -+#define R_IA64_LTOFF22 0x32 /* @ltoff(sym + add), add imm22 */ -+#define R_IA64_LTOFF64I 0x33 /* @ltoff(sym + add), mov imm64 */ -+#define R_IA64_PLTOFF22 0x3a /* @pltoff(sym + add), add imm22 */ -+#define R_IA64_PLTOFF64I 0x3b /* @pltoff(sym + add), mov imm64 */ -+#define R_IA64_PLTOFF64MSB 0x3e /* @pltoff(sym + add), data8 MSB */ -+#define R_IA64_PLTOFF64LSB 0x3f /* @pltoff(sym + add), data8 LSB */ -+#define R_IA64_FPTR64I 0x43 /* @fptr(sym + add), mov imm64 */ -+#define R_IA64_FPTR32MSB 0x44 /* @fptr(sym + add), data4 MSB */ -+#define R_IA64_FPTR32LSB 0x45 /* @fptr(sym + add), data4 LSB */ -+#define R_IA64_FPTR64MSB 0x46 /* @fptr(sym + add), data8 MSB */ -+#define R_IA64_FPTR64LSB 0x47 /* @fptr(sym + add), data8 LSB */ -+#define R_IA64_PCREL60B 0x48 /* @pcrel(sym + add), brl */ -+#define R_IA64_PCREL21B 0x49 /* @pcrel(sym + add), ptb, call */ -+#define R_IA64_PCREL21M 0x4a /* @pcrel(sym + add), chk.s */ -+#define R_IA64_PCREL21F 0x4b /* @pcrel(sym + add), fchkf */ -+#define R_IA64_PCREL32MSB 0x4c /* @pcrel(sym + add), data4 MSB */ -+#define R_IA64_PCREL32LSB 0x4d /* @pcrel(sym + add), data4 LSB */ -+#define R_IA64_PCREL64MSB 0x4e /* @pcrel(sym + add), data8 MSB */ -+#define R_IA64_PCREL64LSB 0x4f /* @pcrel(sym + add), data8 LSB */ -+#define R_IA64_LTOFF_FPTR22 0x52 /* @ltoff(@fptr(s+a)), imm22 */ -+#define R_IA64_LTOFF_FPTR64I 0x53 /* @ltoff(@fptr(s+a)), imm64 */ -+#define R_IA64_LTOFF_FPTR32MSB 0x54 /* @ltoff(@fptr(s+a)), data4 MSB */ -+#define R_IA64_LTOFF_FPTR32LSB 0x55 /* @ltoff(@fptr(s+a)), data4 LSB */ -+#define R_IA64_LTOFF_FPTR64MSB 0x56 /* @ltoff(@fptr(s+a)), data8 MSB */ -+#define R_IA64_LTOFF_FPTR64LSB 0x57 /* @ltoff(@fptr(s+a)), data8 LSB */ -+#define R_IA64_SEGREL32MSB 0x5c /* @segrel(sym + add), data4 MSB */ -+#define R_IA64_SEGREL32LSB 0x5d /* @segrel(sym + add), data4 LSB */ -+#define R_IA64_SEGREL64MSB 0x5e /* @segrel(sym + add), data8 MSB */ -+#define R_IA64_SEGREL64LSB 0x5f /* @segrel(sym + add), data8 LSB */ -+#define R_IA64_SECREL32MSB 0x64 /* @secrel(sym + add), data4 MSB */ -+#define R_IA64_SECREL32LSB 0x65 /* @secrel(sym + add), data4 LSB */ -+#define R_IA64_SECREL64MSB 0x66 /* @secrel(sym + add), data8 MSB */ -+#define R_IA64_SECREL64LSB 0x67 /* @secrel(sym + add), data8 LSB */ -+#define R_IA64_REL32MSB 0x6c /* data 4 + REL */ -+#define R_IA64_REL32LSB 0x6d /* data 4 + REL */ -+#define R_IA64_REL64MSB 0x6e /* data 8 + REL */ -+#define R_IA64_REL64LSB 0x6f /* data 8 + REL */ -+#define R_IA64_LTV32MSB 0x74 /* symbol + addend, data4 MSB */ -+#define R_IA64_LTV32LSB 0x75 /* symbol + addend, data4 LSB */ -+#define R_IA64_LTV64MSB 0x76 /* symbol + addend, data8 MSB */ -+#define R_IA64_LTV64LSB 0x77 /* symbol + addend, data8 LSB */ -+#define R_IA64_PCREL21BI 0x79 /* @pcrel(sym + add), 21bit inst */ -+#define R_IA64_PCREL22 0x7a /* @pcrel(sym + add), 22bit inst */ -+#define R_IA64_PCREL64I 0x7b /* @pcrel(sym + add), 64bit inst */ -+#define R_IA64_IPLTMSB 0x80 /* dynamic reloc, imported PLT, MSB */ -+#define R_IA64_IPLTLSB 0x81 /* dynamic reloc, imported PLT, LSB */ -+#define R_IA64_COPY 0x84 /* copy relocation */ -+#define R_IA64_SUB 0x85 /* Addend and symbol difference */ -+#define R_IA64_LTOFF22X 0x86 /* LTOFF22, relaxable. */ -+#define R_IA64_LDXMOV 0x87 /* Use of LTOFF22X. */ -+#define R_IA64_TPREL14 0x91 /* @tprel(sym + add), imm14 */ -+#define R_IA64_TPREL22 0x92 /* @tprel(sym + add), imm22 */ -+#define R_IA64_TPREL64I 0x93 /* @tprel(sym + add), imm64 */ -+#define R_IA64_TPREL64MSB 0x96 /* @tprel(sym + add), data8 MSB */ -+#define R_IA64_TPREL64LSB 0x97 /* @tprel(sym + add), data8 LSB */ -+#define R_IA64_LTOFF_TPREL22 0x9a /* @ltoff(@tprel(s+a)), imm2 */ -+#define R_IA64_DTPMOD64MSB 0xa6 /* @dtpmod(sym + add), data8 MSB */ -+#define R_IA64_DTPMOD64LSB 0xa7 /* @dtpmod(sym + add), data8 LSB */ -+#define R_IA64_LTOFF_DTPMOD22 0xaa /* @ltoff(@dtpmod(sym + add)), imm22 */ -+#define R_IA64_DTPREL14 0xb1 /* @dtprel(sym + add), imm14 */ -+#define R_IA64_DTPREL22 0xb2 /* @dtprel(sym + add), imm22 */ -+#define R_IA64_DTPREL64I 0xb3 /* @dtprel(sym + add), imm64 */ -+#define R_IA64_DTPREL32MSB 0xb4 /* @dtprel(sym + add), data4 MSB */ -+#define R_IA64_DTPREL32LSB 0xb5 /* @dtprel(sym + add), data4 LSB */ -+#define R_IA64_DTPREL64MSB 0xb6 /* @dtprel(sym + add), data8 MSB */ -+#define R_IA64_DTPREL64LSB 0xb7 /* @dtprel(sym + add), data8 LSB */ -+#define R_IA64_LTOFF_DTPREL22 0xba /* @ltoff(@dtprel(s+a)), imm22 */ -+ -+/* SH specific declarations */ -+ -+/* Processor specific flags for the ELF header e_flags field. */ -+#define EF_SH_MACH_MASK 0x1f -+#define EF_SH_UNKNOWN 0x0 -+#define EF_SH1 0x1 -+#define EF_SH2 0x2 -+#define EF_SH3 0x3 -+#define EF_SH_DSP 0x4 -+#define EF_SH3_DSP 0x5 -+#define EF_SH4AL_DSP 0x6 -+#define EF_SH3E 0x8 -+#define EF_SH4 0x9 -+#define EF_SH2E 0xb -+#define EF_SH4A 0xc -+#define EF_SH2A 0xd -+#define EF_SH4_NOFPU 0x10 -+#define EF_SH4A_NOFPU 0x11 -+#define EF_SH4_NOMMU_NOFPU 0x12 -+#define EF_SH2A_NOFPU 0x13 -+#define EF_SH3_NOMMU 0x14 -+#define EF_SH2A_SH4_NOFPU 0x15 -+#define EF_SH2A_SH3_NOFPU 0x16 -+#define EF_SH2A_SH4 0x17 -+#define EF_SH2A_SH3E 0x18 -+ -+/* SH relocs. */ -+#define R_SH_NONE 0 -+#define R_SH_DIR32 1 -+#define R_SH_REL32 2 -+#define R_SH_DIR8WPN 3 -+#define R_SH_IND12W 4 -+#define R_SH_DIR8WPL 5 -+#define R_SH_DIR8WPZ 6 -+#define R_SH_DIR8BP 7 -+#define R_SH_DIR8W 8 -+#define R_SH_DIR8L 9 -+#define R_SH_SWITCH16 25 -+#define R_SH_SWITCH32 26 -+#define R_SH_USES 27 -+#define R_SH_COUNT 28 -+#define R_SH_ALIGN 29 -+#define R_SH_CODE 30 -+#define R_SH_DATA 31 -+#define R_SH_LABEL 32 -+#define R_SH_SWITCH8 33 -+#define R_SH_GNU_VTINHERIT 34 -+#define R_SH_GNU_VTENTRY 35 -+#define R_SH_TLS_GD_32 144 -+#define R_SH_TLS_LD_32 145 -+#define R_SH_TLS_LDO_32 146 -+#define R_SH_TLS_IE_32 147 -+#define R_SH_TLS_LE_32 148 -+#define R_SH_TLS_DTPMOD32 149 -+#define R_SH_TLS_DTPOFF32 150 -+#define R_SH_TLS_TPOFF32 151 -+#define R_SH_GOT32 160 -+#define R_SH_PLT32 161 -+#define R_SH_COPY 162 -+#define R_SH_GLOB_DAT 163 -+#define R_SH_JMP_SLOT 164 -+#define R_SH_RELATIVE 165 -+#define R_SH_GOTOFF 166 -+#define R_SH_GOTPC 167 -+/* Keep this the last entry. */ -+#define R_SH_NUM 256 -+ -+/* S/390 specific definitions. */ -+ -+/* Valid values for the e_flags field. */ -+ -+#define EF_S390_HIGH_GPRS 0x00000001 /* High GPRs kernel facility needed. */ -+ -+/* Additional s390 relocs */ -+ -+#define R_390_NONE 0 /* No reloc. */ -+#define R_390_8 1 /* Direct 8 bit. */ -+#define R_390_12 2 /* Direct 12 bit. */ -+#define R_390_16 3 /* Direct 16 bit. */ -+#define R_390_32 4 /* Direct 32 bit. */ -+#define R_390_PC32 5 /* PC relative 32 bit. */ -+#define R_390_GOT12 6 /* 12 bit GOT offset. */ -+#define R_390_GOT32 7 /* 32 bit GOT offset. */ -+#define R_390_PLT32 8 /* 32 bit PC relative PLT address. */ -+#define R_390_COPY 9 /* Copy symbol at runtime. */ -+#define R_390_GLOB_DAT 10 /* Create GOT entry. */ -+#define R_390_JMP_SLOT 11 /* Create PLT entry. */ -+#define R_390_RELATIVE 12 /* Adjust by program base. */ -+#define R_390_GOTOFF32 13 /* 32 bit offset to GOT. */ -+#define R_390_GOTPC 14 /* 32 bit PC relative offset to GOT. */ -+#define R_390_GOT16 15 /* 16 bit GOT offset. */ -+#define R_390_PC16 16 /* PC relative 16 bit. */ -+#define R_390_PC16DBL 17 /* PC relative 16 bit shifted by 1. */ -+#define R_390_PLT16DBL 18 /* 16 bit PC rel. PLT shifted by 1. */ -+#define R_390_PC32DBL 19 /* PC relative 32 bit shifted by 1. */ -+#define R_390_PLT32DBL 20 /* 32 bit PC rel. PLT shifted by 1. */ -+#define R_390_GOTPCDBL 21 /* 32 bit PC rel. GOT shifted by 1. */ -+#define R_390_64 22 /* Direct 64 bit. */ -+#define R_390_PC64 23 /* PC relative 64 bit. */ -+#define R_390_GOT64 24 /* 64 bit GOT offset. */ -+#define R_390_PLT64 25 /* 64 bit PC relative PLT address. */ -+#define R_390_GOTENT 26 /* 32 bit PC rel. to GOT entry >> 1. */ -+#define R_390_GOTOFF16 27 /* 16 bit offset to GOT. */ -+#define R_390_GOTOFF64 28 /* 64 bit offset to GOT. */ -+#define R_390_GOTPLT12 29 /* 12 bit offset to jump slot. */ -+#define R_390_GOTPLT16 30 /* 16 bit offset to jump slot. */ -+#define R_390_GOTPLT32 31 /* 32 bit offset to jump slot. */ -+#define R_390_GOTPLT64 32 /* 64 bit offset to jump slot. */ -+#define R_390_GOTPLTENT 33 /* 32 bit rel. offset to jump slot. */ -+#define R_390_PLTOFF16 34 /* 16 bit offset from GOT to PLT. */ -+#define R_390_PLTOFF32 35 /* 32 bit offset from GOT to PLT. */ -+#define R_390_PLTOFF64 36 /* 16 bit offset from GOT to PLT. */ -+#define R_390_TLS_LOAD 37 /* Tag for load insn in TLS code. */ -+#define R_390_TLS_GDCALL 38 /* Tag for function call in general -+ dynamic TLS code. */ -+#define R_390_TLS_LDCALL 39 /* Tag for function call in local -+ dynamic TLS code. */ -+#define R_390_TLS_GD32 40 /* Direct 32 bit for general dynamic -+ thread local data. */ -+#define R_390_TLS_GD64 41 /* Direct 64 bit for general dynamic -+ thread local data. */ -+#define R_390_TLS_GOTIE12 42 /* 12 bit GOT offset for static TLS -+ block offset. */ -+#define R_390_TLS_GOTIE32 43 /* 32 bit GOT offset for static TLS -+ block offset. */ -+#define R_390_TLS_GOTIE64 44 /* 64 bit GOT offset for static TLS -+ block offset. */ -+#define R_390_TLS_LDM32 45 /* Direct 32 bit for local dynamic -+ thread local data in LE code. */ -+#define R_390_TLS_LDM64 46 /* Direct 64 bit for local dynamic -+ thread local data in LE code. */ -+#define R_390_TLS_IE32 47 /* 32 bit address of GOT entry for -+ negated static TLS block offset. */ -+#define R_390_TLS_IE64 48 /* 64 bit address of GOT entry for -+ negated static TLS block offset. */ -+#define R_390_TLS_IEENT 49 /* 32 bit rel. offset to GOT entry for -+ negated static TLS block offset. */ -+#define R_390_TLS_LE32 50 /* 32 bit negated offset relative to -+ static TLS block. */ -+#define R_390_TLS_LE64 51 /* 64 bit negated offset relative to -+ static TLS block. */ -+#define R_390_TLS_LDO32 52 /* 32 bit offset relative to TLS -+ block. */ -+#define R_390_TLS_LDO64 53 /* 64 bit offset relative to TLS -+ block. */ -+#define R_390_TLS_DTPMOD 54 /* ID of module containing symbol. */ -+#define R_390_TLS_DTPOFF 55 /* Offset in TLS block. */ -+#define R_390_TLS_TPOFF 56 /* Negated offset in static TLS -+ block. */ -+#define R_390_20 57 /* Direct 20 bit. */ -+#define R_390_GOT20 58 /* 20 bit GOT offset. */ -+#define R_390_GOTPLT20 59 /* 20 bit offset to jump slot. */ -+#define R_390_TLS_GOTIE20 60 /* 20 bit GOT offset for static TLS -+ block offset. */ -+#define R_390_IRELATIVE 61 /* STT_GNU_IFUNC relocation. */ -+/* Keep this the last entry. */ -+#define R_390_NUM 62 -+ -+ -+/* CRIS relocations. */ -+#define R_CRIS_NONE 0 -+#define R_CRIS_8 1 -+#define R_CRIS_16 2 -+#define R_CRIS_32 3 -+#define R_CRIS_8_PCREL 4 -+#define R_CRIS_16_PCREL 5 -+#define R_CRIS_32_PCREL 6 -+#define R_CRIS_GNU_VTINHERIT 7 -+#define R_CRIS_GNU_VTENTRY 8 -+#define R_CRIS_COPY 9 -+#define R_CRIS_GLOB_DAT 10 -+#define R_CRIS_JUMP_SLOT 11 -+#define R_CRIS_RELATIVE 12 -+#define R_CRIS_16_GOT 13 -+#define R_CRIS_32_GOT 14 -+#define R_CRIS_16_GOTPLT 15 -+#define R_CRIS_32_GOTPLT 16 -+#define R_CRIS_32_GOTREL 17 -+#define R_CRIS_32_PLT_GOTREL 18 -+#define R_CRIS_32_PLT_PCREL 19 -+ -+#define R_CRIS_NUM 20 -+ -+ -+/* AMD x86-64 relocations. */ -+#define R_X86_64_NONE 0 /* No reloc */ -+#define R_X86_64_64 1 /* Direct 64 bit */ -+#define R_X86_64_PC32 2 /* PC relative 32 bit signed */ -+#define R_X86_64_GOT32 3 /* 32 bit GOT entry */ -+#define R_X86_64_PLT32 4 /* 32 bit PLT address */ -+#define R_X86_64_COPY 5 /* Copy symbol at runtime */ -+#define R_X86_64_GLOB_DAT 6 /* Create GOT entry */ -+#define R_X86_64_JUMP_SLOT 7 /* Create PLT entry */ -+#define R_X86_64_RELATIVE 8 /* Adjust by program base */ -+#define R_X86_64_GOTPCREL 9 /* 32 bit signed PC relative -+ offset to GOT */ -+#define R_X86_64_32 10 /* Direct 32 bit zero extended */ -+#define R_X86_64_32S 11 /* Direct 32 bit sign extended */ -+#define R_X86_64_16 12 /* Direct 16 bit zero extended */ -+#define R_X86_64_PC16 13 /* 16 bit sign extended pc relative */ -+#define R_X86_64_8 14 /* Direct 8 bit sign extended */ -+#define R_X86_64_PC8 15 /* 8 bit sign extended pc relative */ -+#define R_X86_64_DTPMOD64 16 /* ID of module containing symbol */ -+#define R_X86_64_DTPOFF64 17 /* Offset in module's TLS block */ -+#define R_X86_64_TPOFF64 18 /* Offset in initial TLS block */ -+#define R_X86_64_TLSGD 19 /* 32 bit signed PC relative offset -+ to two GOT entries for GD symbol */ -+#define R_X86_64_TLSLD 20 /* 32 bit signed PC relative offset -+ to two GOT entries for LD symbol */ -+#define R_X86_64_DTPOFF32 21 /* Offset in TLS block */ -+#define R_X86_64_GOTTPOFF 22 /* 32 bit signed PC relative offset -+ to GOT entry for IE symbol */ -+#define R_X86_64_TPOFF32 23 /* Offset in initial TLS block */ -+#define R_X86_64_PC64 24 /* PC relative 64 bit */ -+#define R_X86_64_GOTOFF64 25 /* 64 bit offset to GOT */ -+#define R_X86_64_GOTPC32 26 /* 32 bit signed pc relative -+ offset to GOT */ -+#define R_X86_64_GOT64 27 /* 64-bit GOT entry offset */ -+#define R_X86_64_GOTPCREL64 28 /* 64-bit PC relative offset -+ to GOT entry */ -+#define R_X86_64_GOTPC64 29 /* 64-bit PC relative offset to GOT */ -+#define R_X86_64_GOTPLT64 30 /* like GOT64, says PLT entry needed */ -+#define R_X86_64_PLTOFF64 31 /* 64-bit GOT relative offset -+ to PLT entry */ -+#define R_X86_64_SIZE32 32 /* Size of symbol plus 32-bit addend */ -+#define R_X86_64_SIZE64 33 /* Size of symbol plus 64-bit addend */ -+#define R_X86_64_GOTPC32_TLSDESC 34 /* GOT offset for TLS descriptor. */ -+#define R_X86_64_TLSDESC_CALL 35 /* Marker for call through TLS -+ descriptor. */ -+#define R_X86_64_TLSDESC 36 /* TLS descriptor. */ -+#define R_X86_64_IRELATIVE 37 /* Adjust indirectly by program base */ -+#define R_X86_64_RELATIVE64 38 /* 64-bit adjust by program base */ -+ -+#define R_X86_64_NUM 39 -+ -+ -+/* AM33 relocations. */ -+#define R_MN10300_NONE 0 /* No reloc. */ -+#define R_MN10300_32 1 /* Direct 32 bit. */ -+#define R_MN10300_16 2 /* Direct 16 bit. */ -+#define R_MN10300_8 3 /* Direct 8 bit. */ -+#define R_MN10300_PCREL32 4 /* PC-relative 32-bit. */ -+#define R_MN10300_PCREL16 5 /* PC-relative 16-bit signed. */ -+#define R_MN10300_PCREL8 6 /* PC-relative 8-bit signed. */ -+#define R_MN10300_GNU_VTINHERIT 7 /* Ancient C++ vtable garbage... */ -+#define R_MN10300_GNU_VTENTRY 8 /* ... collection annotation. */ -+#define R_MN10300_24 9 /* Direct 24 bit. */ -+#define R_MN10300_GOTPC32 10 /* 32-bit PCrel offset to GOT. */ -+#define R_MN10300_GOTPC16 11 /* 16-bit PCrel offset to GOT. */ -+#define R_MN10300_GOTOFF32 12 /* 32-bit offset from GOT. */ -+#define R_MN10300_GOTOFF24 13 /* 24-bit offset from GOT. */ -+#define R_MN10300_GOTOFF16 14 /* 16-bit offset from GOT. */ -+#define R_MN10300_PLT32 15 /* 32-bit PCrel to PLT entry. */ -+#define R_MN10300_PLT16 16 /* 16-bit PCrel to PLT entry. */ -+#define R_MN10300_GOT32 17 /* 32-bit offset to GOT entry. */ -+#define R_MN10300_GOT24 18 /* 24-bit offset to GOT entry. */ -+#define R_MN10300_GOT16 19 /* 16-bit offset to GOT entry. */ -+#define R_MN10300_COPY 20 /* Copy symbol at runtime. */ -+#define R_MN10300_GLOB_DAT 21 /* Create GOT entry. */ -+#define R_MN10300_JMP_SLOT 22 /* Create PLT entry. */ -+#define R_MN10300_RELATIVE 23 /* Adjust by program base. */ -+ -+#define R_MN10300_NUM 24 -+ -+ -+/* M32R relocs. */ -+#define R_M32R_NONE 0 /* No reloc. */ -+#define R_M32R_16 1 /* Direct 16 bit. */ -+#define R_M32R_32 2 /* Direct 32 bit. */ -+#define R_M32R_24 3 /* Direct 24 bit. */ -+#define R_M32R_10_PCREL 4 /* PC relative 10 bit shifted. */ -+#define R_M32R_18_PCREL 5 /* PC relative 18 bit shifted. */ -+#define R_M32R_26_PCREL 6 /* PC relative 26 bit shifted. */ -+#define R_M32R_HI16_ULO 7 /* High 16 bit with unsigned low. */ -+#define R_M32R_HI16_SLO 8 /* High 16 bit with signed low. */ -+#define R_M32R_LO16 9 /* Low 16 bit. */ -+#define R_M32R_SDA16 10 /* 16 bit offset in SDA. */ -+#define R_M32R_GNU_VTINHERIT 11 -+#define R_M32R_GNU_VTENTRY 12 -+/* M32R relocs use SHT_RELA. */ -+#define R_M32R_16_RELA 33 /* Direct 16 bit. */ -+#define R_M32R_32_RELA 34 /* Direct 32 bit. */ -+#define R_M32R_24_RELA 35 /* Direct 24 bit. */ -+#define R_M32R_10_PCREL_RELA 36 /* PC relative 10 bit shifted. */ -+#define R_M32R_18_PCREL_RELA 37 /* PC relative 18 bit shifted. */ -+#define R_M32R_26_PCREL_RELA 38 /* PC relative 26 bit shifted. */ -+#define R_M32R_HI16_ULO_RELA 39 /* High 16 bit with unsigned low */ -+#define R_M32R_HI16_SLO_RELA 40 /* High 16 bit with signed low */ -+#define R_M32R_LO16_RELA 41 /* Low 16 bit */ -+#define R_M32R_SDA16_RELA 42 /* 16 bit offset in SDA */ -+#define R_M32R_RELA_GNU_VTINHERIT 43 -+#define R_M32R_RELA_GNU_VTENTRY 44 -+#define R_M32R_REL32 45 /* PC relative 32 bit. */ -+ -+#define R_M32R_GOT24 48 /* 24 bit GOT entry */ -+#define R_M32R_26_PLTREL 49 /* 26 bit PC relative to PLT shifted */ -+#define R_M32R_COPY 50 /* Copy symbol at runtime */ -+#define R_M32R_GLOB_DAT 51 /* Create GOT entry */ -+#define R_M32R_JMP_SLOT 52 /* Create PLT entry */ -+#define R_M32R_RELATIVE 53 /* Adjust by program base */ -+#define R_M32R_GOTOFF 54 /* 24 bit offset to GOT */ -+#define R_M32R_GOTPC24 55 /* 24 bit PC relative offset to GOT */ -+#define R_M32R_GOT16_HI_ULO 56 /* High 16 bit GOT entry with unsigned -+ low */ -+#define R_M32R_GOT16_HI_SLO 57 /* High 16 bit GOT entry with signed -+ low */ -+#define R_M32R_GOT16_LO 58 /* Low 16 bit GOT entry */ -+#define R_M32R_GOTPC_HI_ULO 59 /* High 16 bit PC relative offset to -+ GOT with unsigned low */ -+#define R_M32R_GOTPC_HI_SLO 60 /* High 16 bit PC relative offset to -+ GOT with signed low */ -+#define R_M32R_GOTPC_LO 61 /* Low 16 bit PC relative offset to -+ GOT */ -+#define R_M32R_GOTOFF_HI_ULO 62 /* High 16 bit offset to GOT -+ with unsigned low */ -+#define R_M32R_GOTOFF_HI_SLO 63 /* High 16 bit offset to GOT -+ with signed low */ -+#define R_M32R_GOTOFF_LO 64 /* Low 16 bit offset to GOT */ -+#define R_M32R_NUM 256 /* Keep this the last entry. */ -+ -+ -+/* TILEPro relocations. */ -+#define R_TILEPRO_NONE 0 /* No reloc */ -+#define R_TILEPRO_32 1 /* Direct 32 bit */ -+#define R_TILEPRO_16 2 /* Direct 16 bit */ -+#define R_TILEPRO_8 3 /* Direct 8 bit */ -+#define R_TILEPRO_32_PCREL 4 /* PC relative 32 bit */ -+#define R_TILEPRO_16_PCREL 5 /* PC relative 16 bit */ -+#define R_TILEPRO_8_PCREL 6 /* PC relative 8 bit */ -+#define R_TILEPRO_LO16 7 /* Low 16 bit */ -+#define R_TILEPRO_HI16 8 /* High 16 bit */ -+#define R_TILEPRO_HA16 9 /* High 16 bit, adjusted */ -+#define R_TILEPRO_COPY 10 /* Copy relocation */ -+#define R_TILEPRO_GLOB_DAT 11 /* Create GOT entry */ -+#define R_TILEPRO_JMP_SLOT 12 /* Create PLT entry */ -+#define R_TILEPRO_RELATIVE 13 /* Adjust by program base */ -+#define R_TILEPRO_BROFF_X1 14 /* X1 pipe branch offset */ -+#define R_TILEPRO_JOFFLONG_X1 15 /* X1 pipe jump offset */ -+#define R_TILEPRO_JOFFLONG_X1_PLT 16 /* X1 pipe jump offset to PLT */ -+#define R_TILEPRO_IMM8_X0 17 /* X0 pipe 8-bit */ -+#define R_TILEPRO_IMM8_Y0 18 /* Y0 pipe 8-bit */ -+#define R_TILEPRO_IMM8_X1 19 /* X1 pipe 8-bit */ -+#define R_TILEPRO_IMM8_Y1 20 /* Y1 pipe 8-bit */ -+#define R_TILEPRO_MT_IMM15_X1 21 /* X1 pipe mtspr */ -+#define R_TILEPRO_MF_IMM15_X1 22 /* X1 pipe mfspr */ -+#define R_TILEPRO_IMM16_X0 23 /* X0 pipe 16-bit */ -+#define R_TILEPRO_IMM16_X1 24 /* X1 pipe 16-bit */ -+#define R_TILEPRO_IMM16_X0_LO 25 /* X0 pipe low 16-bit */ -+#define R_TILEPRO_IMM16_X1_LO 26 /* X1 pipe low 16-bit */ -+#define R_TILEPRO_IMM16_X0_HI 27 /* X0 pipe high 16-bit */ -+#define R_TILEPRO_IMM16_X1_HI 28 /* X1 pipe high 16-bit */ -+#define R_TILEPRO_IMM16_X0_HA 29 /* X0 pipe high 16-bit, adjusted */ -+#define R_TILEPRO_IMM16_X1_HA 30 /* X1 pipe high 16-bit, adjusted */ -+#define R_TILEPRO_IMM16_X0_PCREL 31 /* X0 pipe PC relative 16 bit */ -+#define R_TILEPRO_IMM16_X1_PCREL 32 /* X1 pipe PC relative 16 bit */ -+#define R_TILEPRO_IMM16_X0_LO_PCREL 33 /* X0 pipe PC relative low 16 bit */ -+#define R_TILEPRO_IMM16_X1_LO_PCREL 34 /* X1 pipe PC relative low 16 bit */ -+#define R_TILEPRO_IMM16_X0_HI_PCREL 35 /* X0 pipe PC relative high 16 bit */ -+#define R_TILEPRO_IMM16_X1_HI_PCREL 36 /* X1 pipe PC relative high 16 bit */ -+#define R_TILEPRO_IMM16_X0_HA_PCREL 37 /* X0 pipe PC relative ha() 16 bit */ -+#define R_TILEPRO_IMM16_X1_HA_PCREL 38 /* X1 pipe PC relative ha() 16 bit */ -+#define R_TILEPRO_IMM16_X0_GOT 39 /* X0 pipe 16-bit GOT offset */ -+#define R_TILEPRO_IMM16_X1_GOT 40 /* X1 pipe 16-bit GOT offset */ -+#define R_TILEPRO_IMM16_X0_GOT_LO 41 /* X0 pipe low 16-bit GOT offset */ -+#define R_TILEPRO_IMM16_X1_GOT_LO 42 /* X1 pipe low 16-bit GOT offset */ -+#define R_TILEPRO_IMM16_X0_GOT_HI 43 /* X0 pipe high 16-bit GOT offset */ -+#define R_TILEPRO_IMM16_X1_GOT_HI 44 /* X1 pipe high 16-bit GOT offset */ -+#define R_TILEPRO_IMM16_X0_GOT_HA 45 /* X0 pipe ha() 16-bit GOT offset */ -+#define R_TILEPRO_IMM16_X1_GOT_HA 46 /* X1 pipe ha() 16-bit GOT offset */ -+#define R_TILEPRO_MMSTART_X0 47 /* X0 pipe mm "start" */ -+#define R_TILEPRO_MMEND_X0 48 /* X0 pipe mm "end" */ -+#define R_TILEPRO_MMSTART_X1 49 /* X1 pipe mm "start" */ -+#define R_TILEPRO_MMEND_X1 50 /* X1 pipe mm "end" */ -+#define R_TILEPRO_SHAMT_X0 51 /* X0 pipe shift amount */ -+#define R_TILEPRO_SHAMT_X1 52 /* X1 pipe shift amount */ -+#define R_TILEPRO_SHAMT_Y0 53 /* Y0 pipe shift amount */ -+#define R_TILEPRO_SHAMT_Y1 54 /* Y1 pipe shift amount */ -+#define R_TILEPRO_DEST_IMM8_X1 55 /* X1 pipe destination 8-bit */ -+/* Relocs 56-59 are currently not defined. */ -+#define R_TILEPRO_TLS_GD_CALL 60 /* "jal" for TLS GD */ -+#define R_TILEPRO_IMM8_X0_TLS_GD_ADD 61 /* X0 pipe "addi" for TLS GD */ -+#define R_TILEPRO_IMM8_X1_TLS_GD_ADD 62 /* X1 pipe "addi" for TLS GD */ -+#define R_TILEPRO_IMM8_Y0_TLS_GD_ADD 63 /* Y0 pipe "addi" for TLS GD */ -+#define R_TILEPRO_IMM8_Y1_TLS_GD_ADD 64 /* Y1 pipe "addi" for TLS GD */ -+#define R_TILEPRO_TLS_IE_LOAD 65 /* "lw_tls" for TLS IE */ -+#define R_TILEPRO_IMM16_X0_TLS_GD 66 /* X0 pipe 16-bit TLS GD offset */ -+#define R_TILEPRO_IMM16_X1_TLS_GD 67 /* X1 pipe 16-bit TLS GD offset */ -+#define R_TILEPRO_IMM16_X0_TLS_GD_LO 68 /* X0 pipe low 16-bit TLS GD offset */ -+#define R_TILEPRO_IMM16_X1_TLS_GD_LO 69 /* X1 pipe low 16-bit TLS GD offset */ -+#define R_TILEPRO_IMM16_X0_TLS_GD_HI 70 /* X0 pipe high 16-bit TLS GD offset */ -+#define R_TILEPRO_IMM16_X1_TLS_GD_HI 71 /* X1 pipe high 16-bit TLS GD offset */ -+#define R_TILEPRO_IMM16_X0_TLS_GD_HA 72 /* X0 pipe ha() 16-bit TLS GD offset */ -+#define R_TILEPRO_IMM16_X1_TLS_GD_HA 73 /* X1 pipe ha() 16-bit TLS GD offset */ -+#define R_TILEPRO_IMM16_X0_TLS_IE 74 /* X0 pipe 16-bit TLS IE offset */ -+#define R_TILEPRO_IMM16_X1_TLS_IE 75 /* X1 pipe 16-bit TLS IE offset */ -+#define R_TILEPRO_IMM16_X0_TLS_IE_LO 76 /* X0 pipe low 16-bit TLS IE offset */ -+#define R_TILEPRO_IMM16_X1_TLS_IE_LO 77 /* X1 pipe low 16-bit TLS IE offset */ -+#define R_TILEPRO_IMM16_X0_TLS_IE_HI 78 /* X0 pipe high 16-bit TLS IE offset */ -+#define R_TILEPRO_IMM16_X1_TLS_IE_HI 79 /* X1 pipe high 16-bit TLS IE offset */ -+#define R_TILEPRO_IMM16_X0_TLS_IE_HA 80 /* X0 pipe ha() 16-bit TLS IE offset */ -+#define R_TILEPRO_IMM16_X1_TLS_IE_HA 81 /* X1 pipe ha() 16-bit TLS IE offset */ -+#define R_TILEPRO_TLS_DTPMOD32 82 /* ID of module containing symbol */ -+#define R_TILEPRO_TLS_DTPOFF32 83 /* Offset in TLS block */ -+#define R_TILEPRO_TLS_TPOFF32 84 /* Offset in static TLS block */ -+#define R_TILEPRO_IMM16_X0_TLS_LE 85 /* X0 pipe 16-bit TLS LE offset */ -+#define R_TILEPRO_IMM16_X1_TLS_LE 86 /* X1 pipe 16-bit TLS LE offset */ -+#define R_TILEPRO_IMM16_X0_TLS_LE_LO 87 /* X0 pipe low 16-bit TLS LE offset */ -+#define R_TILEPRO_IMM16_X1_TLS_LE_LO 88 /* X1 pipe low 16-bit TLS LE offset */ -+#define R_TILEPRO_IMM16_X0_TLS_LE_HI 89 /* X0 pipe high 16-bit TLS LE offset */ -+#define R_TILEPRO_IMM16_X1_TLS_LE_HI 90 /* X1 pipe high 16-bit TLS LE offset */ -+#define R_TILEPRO_IMM16_X0_TLS_LE_HA 91 /* X0 pipe ha() 16-bit TLS LE offset */ -+#define R_TILEPRO_IMM16_X1_TLS_LE_HA 92 /* X1 pipe ha() 16-bit TLS LE offset */ -+ -+#define R_TILEPRO_GNU_VTINHERIT 128 /* GNU C++ vtable hierarchy */ -+#define R_TILEPRO_GNU_VTENTRY 129 /* GNU C++ vtable member usage */ -+ -+#define R_TILEPRO_NUM 130 -+ -+ -+/* TILE-Gx relocations. */ -+#define R_TILEGX_NONE 0 /* No reloc */ -+#define R_TILEGX_64 1 /* Direct 64 bit */ -+#define R_TILEGX_32 2 /* Direct 32 bit */ -+#define R_TILEGX_16 3 /* Direct 16 bit */ -+#define R_TILEGX_8 4 /* Direct 8 bit */ -+#define R_TILEGX_64_PCREL 5 /* PC relative 64 bit */ -+#define R_TILEGX_32_PCREL 6 /* PC relative 32 bit */ -+#define R_TILEGX_16_PCREL 7 /* PC relative 16 bit */ -+#define R_TILEGX_8_PCREL 8 /* PC relative 8 bit */ -+#define R_TILEGX_HW0 9 /* hword 0 16-bit */ -+#define R_TILEGX_HW1 10 /* hword 1 16-bit */ -+#define R_TILEGX_HW2 11 /* hword 2 16-bit */ -+#define R_TILEGX_HW3 12 /* hword 3 16-bit */ -+#define R_TILEGX_HW0_LAST 13 /* last hword 0 16-bit */ -+#define R_TILEGX_HW1_LAST 14 /* last hword 1 16-bit */ -+#define R_TILEGX_HW2_LAST 15 /* last hword 2 16-bit */ -+#define R_TILEGX_COPY 16 /* Copy relocation */ -+#define R_TILEGX_GLOB_DAT 17 /* Create GOT entry */ -+#define R_TILEGX_JMP_SLOT 18 /* Create PLT entry */ -+#define R_TILEGX_RELATIVE 19 /* Adjust by program base */ -+#define R_TILEGX_BROFF_X1 20 /* X1 pipe branch offset */ -+#define R_TILEGX_JUMPOFF_X1 21 /* X1 pipe jump offset */ -+#define R_TILEGX_JUMPOFF_X1_PLT 22 /* X1 pipe jump offset to PLT */ -+#define R_TILEGX_IMM8_X0 23 /* X0 pipe 8-bit */ -+#define R_TILEGX_IMM8_Y0 24 /* Y0 pipe 8-bit */ -+#define R_TILEGX_IMM8_X1 25 /* X1 pipe 8-bit */ -+#define R_TILEGX_IMM8_Y1 26 /* Y1 pipe 8-bit */ -+#define R_TILEGX_DEST_IMM8_X1 27 /* X1 pipe destination 8-bit */ -+#define R_TILEGX_MT_IMM14_X1 28 /* X1 pipe mtspr */ -+#define R_TILEGX_MF_IMM14_X1 29 /* X1 pipe mfspr */ -+#define R_TILEGX_MMSTART_X0 30 /* X0 pipe mm "start" */ -+#define R_TILEGX_MMEND_X0 31 /* X0 pipe mm "end" */ -+#define R_TILEGX_SHAMT_X0 32 /* X0 pipe shift amount */ -+#define R_TILEGX_SHAMT_X1 33 /* X1 pipe shift amount */ -+#define R_TILEGX_SHAMT_Y0 34 /* Y0 pipe shift amount */ -+#define R_TILEGX_SHAMT_Y1 35 /* Y1 pipe shift amount */ -+#define R_TILEGX_IMM16_X0_HW0 36 /* X0 pipe hword 0 */ -+#define R_TILEGX_IMM16_X1_HW0 37 /* X1 pipe hword 0 */ -+#define R_TILEGX_IMM16_X0_HW1 38 /* X0 pipe hword 1 */ -+#define R_TILEGX_IMM16_X1_HW1 39 /* X1 pipe hword 1 */ -+#define R_TILEGX_IMM16_X0_HW2 40 /* X0 pipe hword 2 */ -+#define R_TILEGX_IMM16_X1_HW2 41 /* X1 pipe hword 2 */ -+#define R_TILEGX_IMM16_X0_HW3 42 /* X0 pipe hword 3 */ -+#define R_TILEGX_IMM16_X1_HW3 43 /* X1 pipe hword 3 */ -+#define R_TILEGX_IMM16_X0_HW0_LAST 44 /* X0 pipe last hword 0 */ -+#define R_TILEGX_IMM16_X1_HW0_LAST 45 /* X1 pipe last hword 0 */ -+#define R_TILEGX_IMM16_X0_HW1_LAST 46 /* X0 pipe last hword 1 */ -+#define R_TILEGX_IMM16_X1_HW1_LAST 47 /* X1 pipe last hword 1 */ -+#define R_TILEGX_IMM16_X0_HW2_LAST 48 /* X0 pipe last hword 2 */ -+#define R_TILEGX_IMM16_X1_HW2_LAST 49 /* X1 pipe last hword 2 */ -+#define R_TILEGX_IMM16_X0_HW0_PCREL 50 /* X0 pipe PC relative hword 0 */ -+#define R_TILEGX_IMM16_X1_HW0_PCREL 51 /* X1 pipe PC relative hword 0 */ -+#define R_TILEGX_IMM16_X0_HW1_PCREL 52 /* X0 pipe PC relative hword 1 */ -+#define R_TILEGX_IMM16_X1_HW1_PCREL 53 /* X1 pipe PC relative hword 1 */ -+#define R_TILEGX_IMM16_X0_HW2_PCREL 54 /* X0 pipe PC relative hword 2 */ -+#define R_TILEGX_IMM16_X1_HW2_PCREL 55 /* X1 pipe PC relative hword 2 */ -+#define R_TILEGX_IMM16_X0_HW3_PCREL 56 /* X0 pipe PC relative hword 3 */ -+#define R_TILEGX_IMM16_X1_HW3_PCREL 57 /* X1 pipe PC relative hword 3 */ -+#define R_TILEGX_IMM16_X0_HW0_LAST_PCREL 58 /* X0 pipe PC-rel last hword 0 */ -+#define R_TILEGX_IMM16_X1_HW0_LAST_PCREL 59 /* X1 pipe PC-rel last hword 0 */ -+#define R_TILEGX_IMM16_X0_HW1_LAST_PCREL 60 /* X0 pipe PC-rel last hword 1 */ -+#define R_TILEGX_IMM16_X1_HW1_LAST_PCREL 61 /* X1 pipe PC-rel last hword 1 */ -+#define R_TILEGX_IMM16_X0_HW2_LAST_PCREL 62 /* X0 pipe PC-rel last hword 2 */ -+#define R_TILEGX_IMM16_X1_HW2_LAST_PCREL 63 /* X1 pipe PC-rel last hword 2 */ -+#define R_TILEGX_IMM16_X0_HW0_GOT 64 /* X0 pipe hword 0 GOT offset */ -+#define R_TILEGX_IMM16_X1_HW0_GOT 65 /* X1 pipe hword 0 GOT offset */ -+/* Relocs 66-71 are currently not defined. */ -+#define R_TILEGX_IMM16_X0_HW0_LAST_GOT 72 /* X0 pipe last hword 0 GOT offset */ -+#define R_TILEGX_IMM16_X1_HW0_LAST_GOT 73 /* X1 pipe last hword 0 GOT offset */ -+#define R_TILEGX_IMM16_X0_HW1_LAST_GOT 74 /* X0 pipe last hword 1 GOT offset */ -+#define R_TILEGX_IMM16_X1_HW1_LAST_GOT 75 /* X1 pipe last hword 1 GOT offset */ -+/* Relocs 76-77 are currently not defined. */ -+#define R_TILEGX_IMM16_X0_HW0_TLS_GD 78 /* X0 pipe hword 0 TLS GD offset */ -+#define R_TILEGX_IMM16_X1_HW0_TLS_GD 79 /* X1 pipe hword 0 TLS GD offset */ -+#define R_TILEGX_IMM16_X0_HW0_TLS_LE 80 /* X0 pipe hword 0 TLS LE offset */ -+#define R_TILEGX_IMM16_X1_HW0_TLS_LE 81 /* X1 pipe hword 0 TLS LE offset */ -+#define R_TILEGX_IMM16_X0_HW0_LAST_TLS_LE 82 /* X0 pipe last hword 0 LE off */ -+#define R_TILEGX_IMM16_X1_HW0_LAST_TLS_LE 83 /* X1 pipe last hword 0 LE off */ -+#define R_TILEGX_IMM16_X0_HW1_LAST_TLS_LE 84 /* X0 pipe last hword 1 LE off */ -+#define R_TILEGX_IMM16_X1_HW1_LAST_TLS_LE 85 /* X1 pipe last hword 1 LE off */ -+#define R_TILEGX_IMM16_X0_HW0_LAST_TLS_GD 86 /* X0 pipe last hword 0 GD off */ -+#define R_TILEGX_IMM16_X1_HW0_LAST_TLS_GD 87 /* X1 pipe last hword 0 GD off */ -+#define R_TILEGX_IMM16_X0_HW1_LAST_TLS_GD 88 /* X0 pipe last hword 1 GD off */ -+#define R_TILEGX_IMM16_X1_HW1_LAST_TLS_GD 89 /* X1 pipe last hword 1 GD off */ -+/* Relocs 90-91 are currently not defined. */ -+#define R_TILEGX_IMM16_X0_HW0_TLS_IE 92 /* X0 pipe hword 0 TLS IE offset */ -+#define R_TILEGX_IMM16_X1_HW0_TLS_IE 93 /* X1 pipe hword 0 TLS IE offset */ -+/* Relocs 94-99 are currently not defined. */ -+#define R_TILEGX_IMM16_X0_HW0_LAST_TLS_IE 100 /* X0 pipe last hword 0 IE off */ -+#define R_TILEGX_IMM16_X1_HW0_LAST_TLS_IE 101 /* X1 pipe last hword 0 IE off */ -+#define R_TILEGX_IMM16_X0_HW1_LAST_TLS_IE 102 /* X0 pipe last hword 1 IE off */ -+#define R_TILEGX_IMM16_X1_HW1_LAST_TLS_IE 103 /* X1 pipe last hword 1 IE off */ -+/* Relocs 104-105 are currently not defined. */ -+#define R_TILEGX_TLS_DTPMOD64 106 /* 64-bit ID of symbol's module */ -+#define R_TILEGX_TLS_DTPOFF64 107 /* 64-bit offset in TLS block */ -+#define R_TILEGX_TLS_TPOFF64 108 /* 64-bit offset in static TLS block */ -+#define R_TILEGX_TLS_DTPMOD32 109 /* 32-bit ID of symbol's module */ -+#define R_TILEGX_TLS_DTPOFF32 110 /* 32-bit offset in TLS block */ -+#define R_TILEGX_TLS_TPOFF32 111 /* 32-bit offset in static TLS block */ -+#define R_TILEGX_TLS_GD_CALL 112 /* "jal" for TLS GD */ -+#define R_TILEGX_IMM8_X0_TLS_GD_ADD 113 /* X0 pipe "addi" for TLS GD */ -+#define R_TILEGX_IMM8_X1_TLS_GD_ADD 114 /* X1 pipe "addi" for TLS GD */ -+#define R_TILEGX_IMM8_Y0_TLS_GD_ADD 115 /* Y0 pipe "addi" for TLS GD */ -+#define R_TILEGX_IMM8_Y1_TLS_GD_ADD 116 /* Y1 pipe "addi" for TLS GD */ -+#define R_TILEGX_TLS_IE_LOAD 117 /* "ld_tls" for TLS IE */ -+#define R_TILEGX_IMM8_X0_TLS_ADD 118 /* X0 pipe "addi" for TLS GD/IE */ -+#define R_TILEGX_IMM8_X1_TLS_ADD 119 /* X1 pipe "addi" for TLS GD/IE */ -+#define R_TILEGX_IMM8_Y0_TLS_ADD 120 /* Y0 pipe "addi" for TLS GD/IE */ -+#define R_TILEGX_IMM8_Y1_TLS_ADD 121 /* Y1 pipe "addi" for TLS GD/IE */ -+ -+#define R_TILEGX_GNU_VTINHERIT 128 /* GNU C++ vtable hierarchy */ -+#define R_TILEGX_GNU_VTENTRY 129 /* GNU C++ vtable member usage */ -+ -+#define R_TILEGX_NUM 130 -+ -+#endif /* elf.h */ ---- a/scripts/mod/mk_elfconfig.c -+++ b/scripts/mod/mk_elfconfig.c -@@ -1,7 +1,11 @@ - #include - #include - #include -+#ifndef __APPLE__ - #include -+#else -+#include "elf.h" -+#endif - - int - main(int argc, char **argv) ---- a/scripts/mod/modpost.h -+++ b/scripts/mod/modpost.h -@@ -7,7 +7,11 @@ - #include - #include - #include -+#if !(defined(__APPLE__) || defined(__CYGWIN__)) - #include -+#else -+#include "elf.h" -+#endif - - #include "elfconfig.h" - diff --git a/target/linux/generic/hack-4.9/211-host_tools_portability.patch b/target/linux/generic/hack-4.9/211-host_tools_portability.patch deleted file mode 100644 index e4d6851418..0000000000 --- a/target/linux/generic/hack-4.9/211-host_tools_portability.patch +++ /dev/null @@ -1,40 +0,0 @@ -From 7f698012384ccb1ed10cc758acfd085096fdb307 Mon Sep 17 00:00:00 2001 -From: Felix Fietkau -Date: Fri, 7 Jul 2017 17:02:03 +0200 -Subject: kernel: fix linux 4.9 host tools portability issues - -Signed-off-by: Felix Fietkau ---- - tools/build/Build.include | 2 +- - tools/perf/pmu-events/jevents.c | 1 + - tools/perf/pmu-events/json.c | 1 - - 3 files changed, 2 insertions(+), 2 deletions(-) - ---- a/tools/build/Build.include -+++ b/tools/build/Build.include -@@ -96,4 +96,4 @@ cxx_flags = -Wp,-MD,$(depfile),-MT,$@ $( - ### - ## HOSTCC C flags - --host_c_flags = -Wp,-MD,$(depfile),-MT,$@ $(CHOSTFLAGS) -D"BUILD_STR(s)=\#s" $(CHOSTFLAGS_$(basetarget).o) $(CHOSTFLAGS_$(obj)) -+host_c_flags = -MD -MF $(depfile) -MT $@ $(CHOSTFLAGS) -D"BUILD_STR(s)=\#s" $(CHOSTFLAGS_$(basetarget).o) $(CHOSTFLAGS_$(obj)) ---- a/tools/perf/pmu-events/jevents.c -+++ b/tools/perf/pmu-events/jevents.c -@@ -35,6 +35,7 @@ - #include - #include - #include -+#include - #include - #include - #include ---- a/tools/perf/pmu-events/json.c -+++ b/tools/perf/pmu-events/json.c -@@ -38,7 +38,6 @@ - #include - #include "jsmn.h" - #include "json.h" --#include - - - static char *mapfile(const char *fn, size_t *size) diff --git a/target/linux/generic/hack-4.9/212-byteshift_portability.patch b/target/linux/generic/hack-4.9/212-byteshift_portability.patch deleted file mode 100644 index 6def12d0cf..0000000000 --- a/target/linux/generic/hack-4.9/212-byteshift_portability.patch +++ /dev/null @@ -1,65 +0,0 @@ -From 48232d3d931c95953ce2ddfe7da7bb164aef6a73 Mon Sep 17 00:00:00 2001 -From: Felix Fietkau -Date: Fri, 7 Jul 2017 17:03:16 +0200 -Subject: linux-3.6: fix portability of some includes files in tools/ used on the host - -lede-commit: 6040b1d29ab1f047c5e49b748abcb6a3196add28 -Signed-off-by: Felix Fietkau ---- - tools/include/tools/be_byteshift.h | 4 ++++ - tools/include/tools/le_byteshift.h | 4 ++++ - tools/include/tools/linux_types.h | 22 ++++++++++++++++++++++ - 3 files changed, 30 insertions(+) - create mode 100644 tools/include/tools/linux_types.h - ---- a/tools/include/tools/be_byteshift.h -+++ b/tools/include/tools/be_byteshift.h -@@ -1,6 +1,10 @@ - #ifndef _TOOLS_BE_BYTESHIFT_H - #define _TOOLS_BE_BYTESHIFT_H - -+#ifndef __linux__ -+#include "linux_types.h" -+#endif -+ - #include - - static inline uint16_t __get_unaligned_be16(const uint8_t *p) ---- a/tools/include/tools/le_byteshift.h -+++ b/tools/include/tools/le_byteshift.h -@@ -1,6 +1,10 @@ - #ifndef _TOOLS_LE_BYTESHIFT_H - #define _TOOLS_LE_BYTESHIFT_H - -+#ifndef __linux__ -+#include "linux_types.h" -+#endif -+ - #include - - static inline uint16_t __get_unaligned_le16(const uint8_t *p) ---- /dev/null -+++ b/tools/include/tools/linux_types.h -@@ -0,0 +1,22 @@ -+#ifndef __LINUX_TYPES_H -+#define __LINUX_TYPES_H -+ -+#include -+ -+typedef uint8_t __u8; -+typedef uint8_t __be8; -+typedef uint8_t __le8; -+ -+typedef uint16_t __u16; -+typedef uint16_t __be16; -+typedef uint16_t __le16; -+ -+typedef uint32_t __u32; -+typedef uint32_t __be32; -+typedef uint32_t __le32; -+ -+typedef uint64_t __u64; -+typedef uint64_t __be64; -+typedef uint64_t __le64; -+ -+#endif diff --git a/target/linux/generic/hack-4.9/214-spidev_h_portability.patch b/target/linux/generic/hack-4.9/214-spidev_h_portability.patch deleted file mode 100644 index ad4706c821..0000000000 --- a/target/linux/generic/hack-4.9/214-spidev_h_portability.patch +++ /dev/null @@ -1,24 +0,0 @@ -From be9be95ff10e16a5b4ad36f903978d0cc5747024 Mon Sep 17 00:00:00 2001 -From: Felix Fietkau -Date: Fri, 7 Jul 2017 17:04:08 +0200 -Subject: kernel: fix linux/spi/spidev.h portability issues with musl - -Felix will try to get this define included into musl - -lede-commit: 795e7cf60de19e7a076a46874fab7bb88b43bbff -Signed-off-by: Felix Fietkau ---- - include/uapi/linux/spi/spidev.h | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - ---- a/include/uapi/linux/spi/spidev.h -+++ b/include/uapi/linux/spi/spidev.h -@@ -112,7 +112,7 @@ struct spi_ioc_transfer { - - /* not all platforms use or _IOC_TYPECHECK() ... */ - #define SPI_MSGSIZE(N) \ -- ((((N)*(sizeof (struct spi_ioc_transfer))) < (1 << _IOC_SIZEBITS)) \ -+ ((((N)*(sizeof (struct spi_ioc_transfer))) < (1 << 13)) \ - ? ((N)*(sizeof (struct spi_ioc_transfer))) : 0) - #define SPI_IOC_MESSAGE(N) _IOW(SPI_IOC_MAGIC, 0, char[SPI_MSGSIZE(N)]) - diff --git a/target/linux/generic/hack-4.9/220-gc_sections.patch b/target/linux/generic/hack-4.9/220-gc_sections.patch deleted file mode 100644 index e326412d0e..0000000000 --- a/target/linux/generic/hack-4.9/220-gc_sections.patch +++ /dev/null @@ -1,448 +0,0 @@ -From e3d8676f5722b7622685581e06e8f53e6138e3ab Mon Sep 17 00:00:00 2001 -From: Felix Fietkau -Date: Sat, 15 Jul 2017 23:42:36 +0200 -Subject: use -ffunction-sections, -fdata-sections and --gc-sections - -In combination with kernel symbol export stripping this significantly reduces -the kernel image size. Used on both ARM and MIPS architectures. - -Signed-off-by: Felix Fietkau -Signed-off-by: Jonas Gorski -Signed-off-by: Gabor Juhos ---- - Makefile | 10 +++---- - arch/arm/Kconfig | 1 + - arch/arm/boot/compressed/Makefile | 1 + - arch/arm/kernel/vmlinux.lds.S | 26 ++++++++-------- - arch/mips/Kconfig | 1 + - arch/mips/kernel/vmlinux.lds.S | 4 +-- - include/asm-generic/vmlinux.lds.h | 63 ++++++++++++++++++++------------------- - 7 files changed, 55 insertions(+), 51 deletions(-) - ---- a/Makefile -+++ b/Makefile -@@ -406,6 +406,11 @@ KBUILD_CFLAGS_MODULE := -DMODULE - KBUILD_LDFLAGS_MODULE = -T $(srctree)/scripts/module-common.lds $(if $(CONFIG_PROFILING),,-s) - GCC_PLUGINS_CFLAGS := - -+ifdef CONFIG_LD_DEAD_CODE_DATA_ELIMINATION -+KBUILD_CFLAGS_KERNEL += $(call cc-option,-ffunction-sections,) -+KBUILD_CFLAGS_KERNEL += $(call cc-option,-fdata-sections,) -+endif -+ - # Read KERNELRELEASE from include/config/kernel.release (if it exists) - KERNELRELEASE = $(shell cat include/config/kernel.release 2> /dev/null) - KERNELVERSION = $(VERSION)$(if $(PATCHLEVEL),.$(PATCHLEVEL)$(if $(SUBLEVEL),.$(SUBLEVEL)))$(EXTRAVERSION) -@@ -673,11 +678,6 @@ KBUILD_CFLAGS += $(call cc-disable-warni - KBUILD_CFLAGS += $(call cc-disable-warning, int-in-bool-context) - KBUILD_CFLAGS += $(call cc-disable-warning, attribute-alias) - --ifdef CONFIG_LD_DEAD_CODE_DATA_ELIMINATION --KBUILD_CFLAGS += $(call cc-option,-ffunction-sections,) --KBUILD_CFLAGS += $(call cc-option,-fdata-sections,) --endif -- - ifdef CONFIG_CC_OPTIMIZE_FOR_SIZE - KBUILD_CFLAGS += $(call cc-option,-Oz,-Os) - KBUILD_CFLAGS += $(call cc-disable-warning,maybe-uninitialized,) $(EXTRA_OPTIMIZATION) ---- a/arch/arm/Kconfig -+++ b/arch/arm/Kconfig -@@ -81,6 +81,7 @@ config ARM - select HAVE_UID16 - select HAVE_VIRT_CPU_ACCOUNTING_GEN - select IRQ_FORCED_THREADING -+ select LD_DEAD_CODE_DATA_ELIMINATION - select MODULES_USE_ELF_REL - select NO_BOOTMEM - select OF_EARLY_FLATTREE if OF ---- a/arch/arm/boot/compressed/Makefile -+++ b/arch/arm/boot/compressed/Makefile -@@ -102,6 +102,7 @@ ifeq ($(CONFIG_FUNCTION_TRACER),y) - ORIG_CFLAGS := $(KBUILD_CFLAGS) - KBUILD_CFLAGS = $(subst -pg, , $(ORIG_CFLAGS)) - endif -+KBUILD_CFLAGS_KERNEL := $(patsubst -f%-sections,,$(KBUILD_CFLAGS_KERNEL)) - - # -fstack-protector-strong triggers protection checks in this code, - # but it is being used too early to link to meaningful stack_chk logic. ---- a/arch/arm/kernel/vmlinux.lds.S -+++ b/arch/arm/kernel/vmlinux.lds.S -@@ -17,7 +17,7 @@ - #define PROC_INFO \ - . = ALIGN(4); \ - VMLINUX_SYMBOL(__proc_info_begin) = .; \ -- *(.proc.info.init) \ -+ KEEP(*(.proc.info.init)) \ - VMLINUX_SYMBOL(__proc_info_end) = .; - - #define HYPERVISOR_TEXT \ -@@ -28,11 +28,11 @@ - #define IDMAP_TEXT \ - ALIGN_FUNCTION(); \ - VMLINUX_SYMBOL(__idmap_text_start) = .; \ -- *(.idmap.text) \ -+ KEEP(*(.idmap.text)) \ - VMLINUX_SYMBOL(__idmap_text_end) = .; \ - . = ALIGN(PAGE_SIZE); \ - VMLINUX_SYMBOL(__hyp_idmap_text_start) = .; \ -- *(.hyp.idmap.text) \ -+ KEEP(*(.hyp.idmap.text)) \ - VMLINUX_SYMBOL(__hyp_idmap_text_end) = .; - - #ifdef CONFIG_HOTPLUG_CPU -@@ -105,7 +105,7 @@ SECTIONS - _stext = .; /* Text and read-only data */ - IDMAP_TEXT - __exception_text_start = .; -- *(.exception.text) -+ KEEP(*(.exception.text)) - __exception_text_end = .; - IRQENTRY_TEXT - SOFTIRQENTRY_TEXT -@@ -134,7 +134,7 @@ SECTIONS - __ex_table : AT(ADDR(__ex_table) - LOAD_OFFSET) { - __start___ex_table = .; - #ifdef CONFIG_MMU -- *(__ex_table) -+ KEEP(*(__ex_table)) - #endif - __stop___ex_table = .; - } -@@ -146,12 +146,12 @@ SECTIONS - . = ALIGN(8); - .ARM.unwind_idx : { - __start_unwind_idx = .; -- *(.ARM.exidx*) -+ KEEP(*(.ARM.exidx*)) - __stop_unwind_idx = .; - } - .ARM.unwind_tab : { - __start_unwind_tab = .; -- *(.ARM.extab*) -+ KEEP(*(.ARM.extab*)) - __stop_unwind_tab = .; - } - #endif -@@ -171,14 +171,14 @@ SECTIONS - */ - __vectors_start = .; - .vectors 0xffff0000 : AT(__vectors_start) { -- *(.vectors) -+ KEEP(*(.vectors)) - } - . = __vectors_start + SIZEOF(.vectors); - __vectors_end = .; - - __stubs_start = .; - .stubs ADDR(.vectors) + 0x1000 : AT(__stubs_start) { -- *(.stubs) -+ KEEP(*(.stubs)) - } - . = __stubs_start + SIZEOF(.stubs); - __stubs_end = .; -@@ -194,24 +194,24 @@ SECTIONS - } - .init.arch.info : { - __arch_info_begin = .; -- *(.arch.info.init) -+ KEEP(*(.arch.info.init)) - __arch_info_end = .; - } - .init.tagtable : { - __tagtable_begin = .; -- *(.taglist.init) -+ KEEP(*(.taglist.init)) - __tagtable_end = .; - } - #ifdef CONFIG_SMP_ON_UP - .init.smpalt : { - __smpalt_begin = .; -- *(.alt.smp.init) -+ KEEP(*(.alt.smp.init)) - __smpalt_end = .; - } - #endif - .init.pv_table : { - __pv_table_begin = .; -- *(.pv_table) -+ KEEP(*(.pv_table)) - __pv_table_end = .; - } - .init.data : { ---- a/arch/mips/Kconfig -+++ b/arch/mips/Kconfig -@@ -55,6 +55,7 @@ config MIPS - select CLONE_BACKWARDS - select HAVE_DEBUG_STACKOVERFLOW - select HAVE_CC_STACKPROTECTOR -+ select LD_DEAD_CODE_DATA_ELIMINATION - select CPU_PM if CPU_IDLE - select ARCH_HAS_TICK_BROADCAST if GENERIC_CLOCKEVENTS_BROADCAST - select ARCH_BINFMT_ELF_STATE ---- a/arch/mips/kernel/vmlinux.lds.S -+++ b/arch/mips/kernel/vmlinux.lds.S -@@ -71,7 +71,7 @@ SECTIONS - /* Exception table for data bus errors */ - __dbe_table : { - __start___dbe_table = .; -- *(__dbe_table) -+ KEEP(*(__dbe_table)) - __stop___dbe_table = .; - } - -@@ -121,7 +121,7 @@ SECTIONS - . = ALIGN(4); - .mips.machines.init : AT(ADDR(.mips.machines.init) - LOAD_OFFSET) { - __mips_machines_start = .; -- *(.mips.machines.init) -+ KEEP(*(.mips.machines.init)) - __mips_machines_end = .; - } - ---- a/include/asm-generic/vmlinux.lds.h -+++ b/include/asm-generic/vmlinux.lds.h -@@ -105,7 +105,7 @@ - #ifdef CONFIG_FTRACE_MCOUNT_RECORD - #define MCOUNT_REC() . = ALIGN(8); \ - VMLINUX_SYMBOL(__start_mcount_loc) = .; \ -- *(__mcount_loc) \ -+ KEEP(*(__mcount_loc)) \ - VMLINUX_SYMBOL(__stop_mcount_loc) = .; - #else - #define MCOUNT_REC() -@@ -113,7 +113,7 @@ - - #ifdef CONFIG_TRACE_BRANCH_PROFILING - #define LIKELY_PROFILE() VMLINUX_SYMBOL(__start_annotated_branch_profile) = .; \ -- *(_ftrace_annotated_branch) \ -+ KEEP(*(_ftrace_annotated_branch)) \ - VMLINUX_SYMBOL(__stop_annotated_branch_profile) = .; - #else - #define LIKELY_PROFILE() -@@ -121,7 +121,7 @@ - - #ifdef CONFIG_PROFILE_ALL_BRANCHES - #define BRANCH_PROFILE() VMLINUX_SYMBOL(__start_branch_profile) = .; \ -- *(_ftrace_branch) \ -+ KEEP(*(_ftrace_branch)) \ - VMLINUX_SYMBOL(__stop_branch_profile) = .; - #else - #define BRANCH_PROFILE() -@@ -130,7 +130,7 @@ - #ifdef CONFIG_KPROBES - #define KPROBE_BLACKLIST() . = ALIGN(8); \ - VMLINUX_SYMBOL(__start_kprobe_blacklist) = .; \ -- *(_kprobe_blacklist) \ -+ KEEP(*(_kprobe_blacklist)) \ - VMLINUX_SYMBOL(__stop_kprobe_blacklist) = .; - #else - #define KPROBE_BLACKLIST() -@@ -139,10 +139,10 @@ - #ifdef CONFIG_EVENT_TRACING - #define FTRACE_EVENTS() . = ALIGN(8); \ - VMLINUX_SYMBOL(__start_ftrace_events) = .; \ -- *(_ftrace_events) \ -+ KEEP(*(_ftrace_events)) \ - VMLINUX_SYMBOL(__stop_ftrace_events) = .; \ - VMLINUX_SYMBOL(__start_ftrace_enum_maps) = .; \ -- *(_ftrace_enum_map) \ -+ KEEP(*(_ftrace_enum_map)) \ - VMLINUX_SYMBOL(__stop_ftrace_enum_maps) = .; - #else - #define FTRACE_EVENTS() -@@ -163,7 +163,7 @@ - #ifdef CONFIG_FTRACE_SYSCALLS - #define TRACE_SYSCALLS() . = ALIGN(8); \ - VMLINUX_SYMBOL(__start_syscalls_metadata) = .; \ -- *(__syscalls_metadata) \ -+ KEEP(*(__syscalls_metadata)) \ - VMLINUX_SYMBOL(__stop_syscalls_metadata) = .; - #else - #define TRACE_SYSCALLS() -@@ -172,7 +172,7 @@ - #ifdef CONFIG_SERIAL_EARLYCON - #define EARLYCON_TABLE() . = ALIGN(8); \ - VMLINUX_SYMBOL(__earlycon_table) = .; \ -- *(__earlycon_table) \ -+ KEEP(*(__earlycon_table)) \ - VMLINUX_SYMBOL(__earlycon_table_end) = .; - #else - #define EARLYCON_TABLE() -@@ -185,8 +185,8 @@ - #define _OF_TABLE_1(name) \ - . = ALIGN(8); \ - VMLINUX_SYMBOL(__##name##_of_table) = .; \ -- *(__##name##_of_table) \ -- *(__##name##_of_table_end) -+ KEEP(*(__##name##_of_table)) \ -+ KEEP(*(__##name##_of_table_end)) - - #define CLKSRC_OF_TABLES() OF_TABLE(CONFIG_CLKSRC_OF, clksrc) - #define IRQCHIP_OF_MATCH_TABLE() OF_TABLE(CONFIG_IRQCHIP, irqchip) -@@ -209,7 +209,7 @@ - #define KERNEL_DTB() \ - STRUCT_ALIGN(); \ - VMLINUX_SYMBOL(__dtb_start) = .; \ -- *(.dtb.init.rodata) \ -+ KEEP(*(.dtb.init.rodata)) \ - VMLINUX_SYMBOL(__dtb_end) = .; - - /* -@@ -227,16 +227,17 @@ - /* implement dynamic printk debug */ \ - . = ALIGN(8); \ - VMLINUX_SYMBOL(__start___jump_table) = .; \ -- *(__jump_table) \ -+ KEEP(*(__jump_table)) \ - VMLINUX_SYMBOL(__stop___jump_table) = .; \ - . = ALIGN(8); \ - VMLINUX_SYMBOL(__start___verbose) = .; \ -- *(__verbose) \ -+ KEEP(*(__verbose)) \ - VMLINUX_SYMBOL(__stop___verbose) = .; \ - LIKELY_PROFILE() \ - BRANCH_PROFILE() \ - TRACE_PRINTKS() \ -- TRACEPOINT_STR() -+ TRACEPOINT_STR() \ -+ *(.data.[a-zA-Z_]*) - - /* - * Data section helpers -@@ -304,35 +305,35 @@ - /* PCI quirks */ \ - .pci_fixup : AT(ADDR(.pci_fixup) - LOAD_OFFSET) { \ - VMLINUX_SYMBOL(__start_pci_fixups_early) = .; \ -- *(.pci_fixup_early) \ -+ KEEP(*(.pci_fixup_early)) \ - VMLINUX_SYMBOL(__end_pci_fixups_early) = .; \ - VMLINUX_SYMBOL(__start_pci_fixups_header) = .; \ -- *(.pci_fixup_header) \ -+ KEEP(*(.pci_fixup_header)) \ - VMLINUX_SYMBOL(__end_pci_fixups_header) = .; \ - VMLINUX_SYMBOL(__start_pci_fixups_final) = .; \ -- *(.pci_fixup_final) \ -+ KEEP(*(.pci_fixup_final)) \ - VMLINUX_SYMBOL(__end_pci_fixups_final) = .; \ - VMLINUX_SYMBOL(__start_pci_fixups_enable) = .; \ -- *(.pci_fixup_enable) \ -+ KEEP(*(.pci_fixup_enable)) \ - VMLINUX_SYMBOL(__end_pci_fixups_enable) = .; \ - VMLINUX_SYMBOL(__start_pci_fixups_resume) = .; \ -- *(.pci_fixup_resume) \ -+ KEEP(*(.pci_fixup_resume)) \ - VMLINUX_SYMBOL(__end_pci_fixups_resume) = .; \ - VMLINUX_SYMBOL(__start_pci_fixups_resume_early) = .; \ -- *(.pci_fixup_resume_early) \ -+ KEEP(*(.pci_fixup_resume_early)) \ - VMLINUX_SYMBOL(__end_pci_fixups_resume_early) = .; \ - VMLINUX_SYMBOL(__start_pci_fixups_suspend) = .; \ -- *(.pci_fixup_suspend) \ -+ KEEP(*(.pci_fixup_suspend)) \ - VMLINUX_SYMBOL(__end_pci_fixups_suspend) = .; \ - VMLINUX_SYMBOL(__start_pci_fixups_suspend_late) = .; \ -- *(.pci_fixup_suspend_late) \ -+ KEEP(*(.pci_fixup_suspend_late)) \ - VMLINUX_SYMBOL(__end_pci_fixups_suspend_late) = .; \ - } \ - \ - /* Built-in firmware blobs */ \ - .builtin_fw : AT(ADDR(.builtin_fw) - LOAD_OFFSET) { \ - VMLINUX_SYMBOL(__start_builtin_fw) = .; \ -- *(.builtin_fw) \ -+ KEEP(*(.builtin_fw)) \ - VMLINUX_SYMBOL(__end_builtin_fw) = .; \ - } \ - \ -@@ -410,7 +411,7 @@ - \ - /* Kernel symbol table: strings */ \ - __ksymtab_strings : AT(ADDR(__ksymtab_strings) - LOAD_OFFSET) { \ -- KEEP(*(__ksymtab_strings)) \ -+ *(__ksymtab_strings) \ - } \ - \ - /* __*init sections */ \ -@@ -423,14 +424,14 @@ - /* Built-in module parameters. */ \ - __param : AT(ADDR(__param) - LOAD_OFFSET) { \ - VMLINUX_SYMBOL(__start___param) = .; \ -- *(__param) \ -+ KEEP(*(__param)) \ - VMLINUX_SYMBOL(__stop___param) = .; \ - } \ - \ - /* Built-in module versions. */ \ - __modver : AT(ADDR(__modver) - LOAD_OFFSET) { \ - VMLINUX_SYMBOL(__start___modver) = .; \ -- *(__modver) \ -+ KEEP(*(__modver)) \ - VMLINUX_SYMBOL(__stop___modver) = .; \ - . = ALIGN((align)); \ - VMLINUX_SYMBOL(__end_rodata) = .; \ -@@ -496,7 +497,7 @@ - #define ENTRY_TEXT \ - ALIGN_FUNCTION(); \ - VMLINUX_SYMBOL(__entry_text_start) = .; \ -- *(.entry.text) \ -+ KEEP(*(.entry.text)) \ - VMLINUX_SYMBOL(__entry_text_end) = .; - - #if defined(CONFIG_FUNCTION_GRAPH_TRACER) || defined(CONFIG_KASAN) -@@ -534,7 +535,7 @@ - . = ALIGN(align); \ - __ex_table : AT(ADDR(__ex_table) - LOAD_OFFSET) { \ - VMLINUX_SYMBOL(__start___ex_table) = .; \ -- *(__ex_table) \ -+ KEEP(*(__ex_table)) \ - VMLINUX_SYMBOL(__stop___ex_table) = .; \ - } - -@@ -550,9 +551,9 @@ - #ifdef CONFIG_CONSTRUCTORS - #define KERNEL_CTORS() . = ALIGN(8); \ - VMLINUX_SYMBOL(__ctors_start) = .; \ -- *(.ctors) \ -+ KEEP(*(.ctors)) \ - *(SORT(.init_array.*)) \ -- *(.init_array) \ -+ KEEP(*(.init_array)) \ - VMLINUX_SYMBOL(__ctors_end) = .; - #else - #define KERNEL_CTORS() -@@ -609,7 +610,7 @@ - #define SBSS(sbss_align) \ - . = ALIGN(sbss_align); \ - .sbss : AT(ADDR(.sbss) - LOAD_OFFSET) { \ -- *(.sbss) \ -+ *(.sbss .sbss.*) \ - *(.scommon) \ - } - -@@ -676,7 +677,7 @@ - . = ALIGN(8); \ - __bug_table : AT(ADDR(__bug_table) - LOAD_OFFSET) { \ - VMLINUX_SYMBOL(__start___bug_table) = .; \ -- *(__bug_table) \ -+ KEEP(*(__bug_table)) \ - VMLINUX_SYMBOL(__stop___bug_table) = .; \ - } - #else -@@ -688,7 +689,7 @@ - . = ALIGN(4); \ - .tracedata : AT(ADDR(.tracedata) - LOAD_OFFSET) { \ - VMLINUX_SYMBOL(__tracedata_start) = .; \ -- *(.tracedata) \ -+ KEEP(*(.tracedata)) \ - VMLINUX_SYMBOL(__tracedata_end) = .; \ - } - #else -@@ -705,7 +706,7 @@ - #define INIT_SETUP(initsetup_align) \ - . = ALIGN(initsetup_align); \ - VMLINUX_SYMBOL(__setup_start) = .; \ -- *(.init.setup) \ -+ KEEP(*(.init.setup)) \ - VMLINUX_SYMBOL(__setup_end) = .; - - #define INIT_CALLS_LEVEL(level) \ diff --git a/target/linux/generic/hack-4.9/221-module_exports.patch b/target/linux/generic/hack-4.9/221-module_exports.patch deleted file mode 100644 index f357d73d6a..0000000000 --- a/target/linux/generic/hack-4.9/221-module_exports.patch +++ /dev/null @@ -1,101 +0,0 @@ -From b14784e7883390c20ed3ff904892255404a5914b Mon Sep 17 00:00:00 2001 -From: Felix Fietkau -Date: Fri, 7 Jul 2017 17:05:53 +0200 -Subject: add an optional config option for stripping all unnecessary symbol exports from the kernel image - -lede-commit: bb5a40c64b7c4f4848509fa0a6625055fc9e66cc -Signed-off-by: Felix Fietkau ---- - include/asm-generic/vmlinux.lds.h | 18 +++++++++++++++--- - include/linux/export.h | 9 ++++++++- - scripts/Makefile.build | 2 +- - 3 files changed, 24 insertions(+), 5 deletions(-) - ---- a/include/asm-generic/vmlinux.lds.h -+++ b/include/asm-generic/vmlinux.lds.h -@@ -54,6 +54,16 @@ - #define LOAD_OFFSET 0 - #endif - -+#ifndef SYMTAB_KEEP -+#define SYMTAB_KEEP KEEP(*(SORT(___ksymtab+*))) -+#define SYMTAB_KEEP_GPL KEEP(*(SORT(___ksymtab_gpl+*))) -+#endif -+ -+#ifndef SYMTAB_DISCARD -+#define SYMTAB_DISCARD -+#define SYMTAB_DISCARD_GPL -+#endif -+ - #include - - /* Align . to a 8 byte boundary equals to maximum function alignment. */ -@@ -342,14 +352,14 @@ - /* Kernel symbol table: Normal symbols */ \ - __ksymtab : AT(ADDR(__ksymtab) - LOAD_OFFSET) { \ - VMLINUX_SYMBOL(__start___ksymtab) = .; \ -- KEEP(*(SORT(___ksymtab+*))) \ -+ SYMTAB_KEEP \ - VMLINUX_SYMBOL(__stop___ksymtab) = .; \ - } \ - \ - /* Kernel symbol table: GPL-only symbols */ \ - __ksymtab_gpl : AT(ADDR(__ksymtab_gpl) - LOAD_OFFSET) { \ - VMLINUX_SYMBOL(__start___ksymtab_gpl) = .; \ -- KEEP(*(SORT(___ksymtab_gpl+*))) \ -+ SYMTAB_KEEP_GPL \ - VMLINUX_SYMBOL(__stop___ksymtab_gpl) = .; \ - } \ - \ -@@ -411,7 +421,7 @@ - \ - /* Kernel symbol table: strings */ \ - __ksymtab_strings : AT(ADDR(__ksymtab_strings) - LOAD_OFFSET) { \ -- *(__ksymtab_strings) \ -+ *(__ksymtab_strings+*) \ - } \ - \ - /* __*init sections */ \ -@@ -763,6 +773,8 @@ - EXIT_TEXT \ - EXIT_DATA \ - EXIT_CALL \ -+ SYMTAB_DISCARD \ -+ SYMTAB_DISCARD_GPL \ - *(.discard) \ - *(.discard.*) \ - } ---- a/include/linux/export.h -+++ b/include/linux/export.h -@@ -53,12 +53,19 @@ extern struct module __this_module; - #define __CRC_SYMBOL(sym, sec) - #endif - -+#ifdef MODULE -+#define __EXPORT_SUFFIX(sym) -+#else -+#define __EXPORT_SUFFIX(sym) "+" #sym -+#endif -+ - /* For every exported symbol, place a struct in the __ksymtab section */ - #define ___EXPORT_SYMBOL(sym, sec) \ - extern typeof(sym) sym; \ - __CRC_SYMBOL(sym, sec) \ - static const char __kstrtab_##sym[] \ -- __attribute__((section("__ksymtab_strings"), aligned(1))) \ -+ __attribute__((section("__ksymtab_strings" \ -+ __EXPORT_SUFFIX(sym)), aligned(1))) \ - = VMLINUX_SYMBOL_STR(sym); \ - static const struct kernel_symbol __ksymtab_##sym \ - __used \ ---- a/scripts/Makefile.build -+++ b/scripts/Makefile.build -@@ -409,7 +409,7 @@ targets += $(extra-y) $(MAKECMDGOALS) $( - # Linker scripts preprocessor (.lds.S -> .lds) - # --------------------------------------------------------------------------- - quiet_cmd_cpp_lds_S = LDS $@ -- cmd_cpp_lds_S = $(CPP) $(cpp_flags) -P -C -U$(ARCH) \ -+ cmd_cpp_lds_S = $(CPP) $(EXTRA_LDSFLAGS) $(cpp_flags) -P -C -U$(ARCH) \ - -D__ASSEMBLY__ -DLINKER_SCRIPT -o $@ $< - - $(obj)/%.lds: $(src)/%.lds.S FORCE diff --git a/target/linux/generic/hack-4.9/230-openwrt_lzma_options.patch b/target/linux/generic/hack-4.9/230-openwrt_lzma_options.patch deleted file mode 100644 index b861b1dbb1..0000000000 --- a/target/linux/generic/hack-4.9/230-openwrt_lzma_options.patch +++ /dev/null @@ -1,71 +0,0 @@ -From b3d00b452467f621317953d9e4c6f9ae8dcfd271 Mon Sep 17 00:00:00 2001 -From: Imre Kaloz -Date: Fri, 7 Jul 2017 17:06:55 +0200 -Subject: use the librecmc lzma options for now - -lede-commit: 548de949f392049420a6a1feeef118b30ab8ea8c -Signed-off-by: Imre Kaloz ---- - lib/decompress.c | 1 + - scripts/Makefile.lib | 2 +- - scripts/gen_initramfs_list.sh | 10 +++++----- - 3 files changed, 7 insertions(+), 6 deletions(-) - ---- a/lib/decompress.c -+++ b/lib/decompress.c -@@ -48,6 +48,7 @@ static const struct compress_format comp - { {0x1f, 0x9e}, "gzip", gunzip }, - { {0x42, 0x5a}, "bzip2", bunzip2 }, - { {0x5d, 0x00}, "lzma", unlzma }, -+ { {0x6d, 0x00}, "lzma-librecmc", unlzma }, - { {0xfd, 0x37}, "xz", unxz }, - { {0x89, 0x4c}, "lzo", unlzo }, - { {0x02, 0x21}, "lz4", unlz4 }, ---- a/scripts/Makefile.lib -+++ b/scripts/Makefile.lib -@@ -344,7 +344,7 @@ cmd_bzip2 = (cat $(filter-out FORCE,$^) - - quiet_cmd_lzma = LZMA $@ - cmd_lzma = (cat $(filter-out FORCE,$^) | \ -- lzma -9 && $(call size_append, $(filter-out FORCE,$^))) > $@ || \ -+ lzma e -d20 -lc1 -lp2 -pb2 -eos -si -so && $(call size_append, $(filter-out FORCE,$^))) > $@ || \ - (rm -f $@ ; false) - - quiet_cmd_lzo = LZO $@ ---- a/scripts/gen_initramfs_list.sh -+++ b/scripts/gen_initramfs_list.sh -@@ -229,7 +229,7 @@ cpio_list= - output="/dev/stdout" - output_file="" - is_cpio_compressed= --compr="gzip -n -9 -f" -+compr="gzip -n -9 -f -" - - arg="$1" - case "$arg" in -@@ -245,13 +245,13 @@ case "$arg" in - output=${cpio_list} - echo "$output_file" | grep -q "\.gz$" \ - && [ -x "`which gzip 2> /dev/null`" ] \ -- && compr="gzip -n -9 -f" -+ && compr="gzip -n -9 -f -" - echo "$output_file" | grep -q "\.bz2$" \ - && [ -x "`which bzip2 2> /dev/null`" ] \ -- && compr="bzip2 -9 -f" -+ && compr="bzip2 -9 -f -" - echo "$output_file" | grep -q "\.lzma$" \ - && [ -x "`which lzma 2> /dev/null`" ] \ -- && compr="lzma -9 -f" -+ && compr="lzma e -d20 -lc1 -lp2 -pb2 -eos -si -so" - echo "$output_file" | grep -q "\.xz$" \ - && [ -x "`which xz 2> /dev/null`" ] \ - && compr="xz --check=crc32 --lzma2=dict=1MiB" -@@ -318,7 +318,7 @@ if [ ! -z ${output_file} ]; then - if [ "${is_cpio_compressed}" = "compressed" ]; then - cat ${cpio_tfile} > ${output_file} - else -- (cat ${cpio_tfile} | ${compr} - > ${output_file}) \ -+ (cat ${cpio_tfile} | ${compr} > ${output_file}) \ - || (rm -f ${output_file} ; false) - fi - [ -z ${cpio_file} ] && rm ${cpio_tfile} diff --git a/target/linux/generic/hack-4.9/250-netfilter_depends.patch b/target/linux/generic/hack-4.9/250-netfilter_depends.patch deleted file mode 100644 index f6e1c1d303..0000000000 --- a/target/linux/generic/hack-4.9/250-netfilter_depends.patch +++ /dev/null @@ -1,27 +0,0 @@ -From: Felix Fietkau -Subject: hack: net: remove bogus netfilter dependencies - -lede-commit: 589d2a377dee27d206fc3725325309cf649e4df6 -Signed-off-by: Felix Fietkau ---- - net/netfilter/Kconfig | 2 -- - 1 file changed, 2 deletions(-) - ---- a/net/netfilter/Kconfig -+++ b/net/netfilter/Kconfig -@@ -218,7 +218,6 @@ config NF_CONNTRACK_FTP - - config NF_CONNTRACK_H323 - tristate "H.323 protocol support" -- depends on IPV6 || IPV6=n - depends on NETFILTER_ADVANCED - help - H.323 is a VoIP signalling protocol from ITU-T. As one of the most -@@ -968,7 +967,6 @@ config NETFILTER_XT_TARGET_SECMARK - - config NETFILTER_XT_TARGET_TCPMSS - tristate '"TCPMSS" target support' -- depends on IPV6 || IPV6=n - default m if NETFILTER_ADVANCED=n - ---help--- - This option adds a `TCPMSS' target, which allows you to alter the diff --git a/target/linux/generic/hack-4.9/251-sound_kconfig.patch b/target/linux/generic/hack-4.9/251-sound_kconfig.patch deleted file mode 100644 index d01bdfb9b3..0000000000 --- a/target/linux/generic/hack-4.9/251-sound_kconfig.patch +++ /dev/null @@ -1,195 +0,0 @@ -From da3c50704f14132f4adf80d48e9a4cd5d46e54c9 Mon Sep 17 00:00:00 2001 -From: John Crispin -Date: Fri, 7 Jul 2017 17:09:21 +0200 -Subject: kconfig: owrt specifc dependencies - -Signed-off-by: John Crispin ---- - crypto/Kconfig | 10 +++++----- - drivers/bcma/Kconfig | 1 + - drivers/ssb/Kconfig | 3 ++- - lib/Kconfig | 8 ++++---- - net/netfilter/Kconfig | 2 +- - net/wireless/Kconfig | 17 ++++++++++------- - sound/core/Kconfig | 4 ++-- - 7 files changed, 25 insertions(+), 20 deletions(-) - ---- a/crypto/Kconfig -+++ b/crypto/Kconfig -@@ -32,7 +32,7 @@ config CRYPTO_FIPS - this is. - - config CRYPTO_ALGAPI -- tristate -+ tristate "ALGAPI" - select CRYPTO_ALGAPI2 - help - This option provides the API for cryptographic algorithms. -@@ -41,7 +41,7 @@ config CRYPTO_ALGAPI2 - tristate - - config CRYPTO_AEAD -- tristate -+ tristate "AEAD" - select CRYPTO_AEAD2 - select CRYPTO_ALGAPI - -@@ -52,7 +52,7 @@ config CRYPTO_AEAD2 - select CRYPTO_RNG2 - - config CRYPTO_BLKCIPHER -- tristate -+ tristate "BLKCIPHER" - select CRYPTO_BLKCIPHER2 - select CRYPTO_ALGAPI - -@@ -63,7 +63,7 @@ config CRYPTO_BLKCIPHER2 - select CRYPTO_WORKQUEUE - - config CRYPTO_HASH -- tristate -+ tristate "HASH" - select CRYPTO_HASH2 - select CRYPTO_ALGAPI - -@@ -72,7 +72,7 @@ config CRYPTO_HASH2 - select CRYPTO_ALGAPI2 - - config CRYPTO_RNG -- tristate -+ tristate "RNG" - select CRYPTO_RNG2 - select CRYPTO_ALGAPI - ---- a/drivers/bcma/Kconfig -+++ b/drivers/bcma/Kconfig -@@ -17,6 +17,7 @@ config BCMA - config BCMA_BLOCKIO - bool - depends on BCMA -+ default y - - config BCMA_HOST_PCI_POSSIBLE - bool ---- a/drivers/ssb/Kconfig -+++ b/drivers/ssb/Kconfig -@@ -29,6 +29,7 @@ config SSB_SPROM - config SSB_BLOCKIO - bool - depends on SSB -+ default y - - config SSB_PCIHOST_POSSIBLE - bool -@@ -49,7 +50,7 @@ config SSB_PCIHOST - config SSB_B43_PCI_BRIDGE - bool - depends on SSB_PCIHOST -- default n -+ default y - - config SSB_PCMCIAHOST_POSSIBLE - bool ---- a/lib/Kconfig -+++ b/lib/Kconfig -@@ -340,16 +340,16 @@ config BCH_CONST_T - # Textsearch support is select'ed if needed - # - config TEXTSEARCH -- bool -+ boolean "Textsearch support" - - config TEXTSEARCH_KMP -- tristate -+ tristate "Textsearch KMP" - - config TEXTSEARCH_BM -- tristate -+ tristate "Textsearch BM" - - config TEXTSEARCH_FSM -- tristate -+ tristate "Textsearch FSM" - - config BTREE - bool ---- a/net/netfilter/Kconfig -+++ b/net/netfilter/Kconfig -@@ -10,7 +10,7 @@ config NETFILTER_INGRESS - infrastructure. - - config NETFILTER_NETLINK -- tristate -+ tristate "Netfilter NFNETLINK interface" - - config NETFILTER_NETLINK_ACCT - tristate "Netfilter NFACCT over NFNETLINK interface" ---- a/net/wireless/Kconfig -+++ b/net/wireless/Kconfig -@@ -1,5 +1,5 @@ - config WIRELESS_EXT -- bool -+ bool "Wireless extensions" - - config WEXT_CORE - def_bool y -@@ -11,10 +11,10 @@ config WEXT_PROC - depends on WEXT_CORE - - config WEXT_SPY -- bool -+ bool "WEXT_SPY" - - config WEXT_PRIV -- bool -+ bool "WEXT_PRIV" - - config CFG80211 - tristate "cfg80211 - wireless configuration API" -@@ -188,7 +188,7 @@ config CFG80211_WEXT_EXPORT - wext compatibility symbols to be exported. - - config LIB80211 -- tristate -+ tristate "LIB80211" - default n - help - This options enables a library of common routines used -@@ -197,13 +197,16 @@ config LIB80211 - Drivers should select this themselves if needed. - - config LIB80211_CRYPT_WEP -- tristate -+ tristate "LIB80211_CRYPT_WEP" -+ select LIB80211 - - config LIB80211_CRYPT_CCMP -- tristate -+ tristate "LIB80211_CRYPT_CCMP" -+ select LIB80211 - - config LIB80211_CRYPT_TKIP -- tristate -+ tristate "LIB80211_CRYPT_TKIP" -+ select LIB80211 - - config LIB80211_DEBUG - bool "lib80211 debugging messages" ---- a/sound/core/Kconfig -+++ b/sound/core/Kconfig -@@ -16,13 +16,13 @@ config SND_DMAENGINE_PCM - tristate - - config SND_HWDEP -- tristate -+ tristate "Sound hardware support" - - config SND_RAWMIDI - tristate - - config SND_COMPRESS_OFFLOAD -- tristate -+ tristate "Compression offloading support" - - config SND_JACK - bool diff --git a/target/linux/generic/hack-4.9/259-regmap_dynamic.patch b/target/linux/generic/hack-4.9/259-regmap_dynamic.patch deleted file mode 100644 index 237c2099e9..0000000000 --- a/target/linux/generic/hack-4.9/259-regmap_dynamic.patch +++ /dev/null @@ -1,100 +0,0 @@ -From 811d9e2268a62b830cfe93cd8bc929afcb8b198b Mon Sep 17 00:00:00 2001 -From: Felix Fietkau -Date: Sat, 15 Jul 2017 21:12:38 +0200 -Subject: kernel: move regmap bloat out of the kernel image if it is only being used in modules - -lede-commit: 96f39119815028073583e4fca3a9c5fe9141e998 -Signed-off-by: Felix Fietkau ---- - drivers/base/regmap/Kconfig | 15 ++++++++++----- - drivers/base/regmap/Makefile | 12 ++++++++---- - drivers/base/regmap/regmap.c | 3 +++ - include/linux/regmap.h | 2 +- - 4 files changed, 22 insertions(+), 10 deletions(-) - ---- a/drivers/base/regmap/Kconfig -+++ b/drivers/base/regmap/Kconfig -@@ -3,9 +3,8 @@ - # subsystems should select the appropriate symbols. - - config REGMAP -- default y if (REGMAP_I2C || REGMAP_SPI || REGMAP_SPMI || REGMAP_AC97 || REGMAP_MMIO || REGMAP_IRQ) - select IRQ_DOMAIN if REGMAP_IRQ -- bool -+ tristate - - config REGCACHE_COMPRESSED - select LZO_COMPRESS -@@ -17,18 +16,24 @@ config REGMAP_AC97 - - config REGMAP_I2C - tristate -+ select REGMAP - depends on I2C - - config REGMAP_SPI - tristate -+ select REGMAP -+ depends on SPI_MASTER - depends on SPI - - config REGMAP_SPMI -+ select REGMAP - tristate - depends on SPMI - - config REGMAP_MMIO - tristate -+ select REGMAP - - config REGMAP_IRQ -+ select REGMAP - bool ---- a/drivers/base/regmap/Makefile -+++ b/drivers/base/regmap/Makefile -@@ -1,10 +1,14 @@ - # For include/trace/define_trace.h to include trace.h - CFLAGS_regmap.o := -I$(src) - --obj-$(CONFIG_REGMAP) += regmap.o regcache.o --obj-$(CONFIG_REGMAP) += regcache-rbtree.o regcache-flat.o --obj-$(CONFIG_REGCACHE_COMPRESSED) += regcache-lzo.o --obj-$(CONFIG_DEBUG_FS) += regmap-debugfs.o -+regmap-core-objs = regmap.o regcache.o regcache-rbtree.o regcache-flat.o -+ifdef CONFIG_DEBUG_FS -+regmap-core-objs += regmap-debugfs.o -+endif -+ifdef CONFIG_REGCACHE_COMPRESSED -+regmap-core-objs += regcache-lzo.o -+endif -+obj-$(CONFIG_REGMAP) += regmap-core.o - obj-$(CONFIG_REGMAP_AC97) += regmap-ac97.o - obj-$(CONFIG_REGMAP_I2C) += regmap-i2c.o - obj-$(CONFIG_REGMAP_SPI) += regmap-spi.o ---- a/drivers/base/regmap/regmap.c -+++ b/drivers/base/regmap/regmap.c -@@ -13,6 +13,7 @@ - #include - #include - #include -+#include - #include - #include - #include -@@ -2913,3 +2914,5 @@ static int __init regmap_initcall(void) - return 0; - } - postcore_initcall(regmap_initcall); -+ -+MODULE_LICENSE("GPL"); ---- a/include/linux/regmap.h -+++ b/include/linux/regmap.h -@@ -135,7 +135,7 @@ struct reg_sequence { - pollret ?: ((cond) ? 0 : -ETIMEDOUT); \ - }) - --#ifdef CONFIG_REGMAP -+#if IS_ENABLED(CONFIG_REGMAP) - - enum regmap_endian { - /* Unspecified -> 0 -> Backwards compatible default */ diff --git a/target/linux/generic/hack-4.9/260-crypto_test_dependencies.patch b/target/linux/generic/hack-4.9/260-crypto_test_dependencies.patch deleted file mode 100644 index f2570f5988..0000000000 --- a/target/linux/generic/hack-4.9/260-crypto_test_dependencies.patch +++ /dev/null @@ -1,62 +0,0 @@ -From fd1799b0bf5efa46dd3e6dfbbf3955564807e508 Mon Sep 17 00:00:00 2001 -From: Felix Fietkau -Date: Fri, 7 Jul 2017 17:12:51 +0200 -Subject: kernel: prevent cryptomgr from pulling in useless extra dependencies for tests that are not run - -Reduces kernel size after LZMA by about 5k on MIPS - -lede-commit: 044c316167e076479a344c59905e5b435b84a77f -Signed-off-by: Felix Fietkau ---- - crypto/Kconfig | 13 ++++++------- - crypto/algboss.c | 4 ++++ - 2 files changed, 10 insertions(+), 7 deletions(-) - ---- a/crypto/Kconfig -+++ b/crypto/Kconfig -@@ -132,12 +132,12 @@ config CRYPTO_MANAGER - cbc(aes). - - config CRYPTO_MANAGER2 -- def_tristate CRYPTO_MANAGER || (CRYPTO_MANAGER!=n && CRYPTO_ALGAPI=y) -- select CRYPTO_AEAD2 -- select CRYPTO_HASH2 -- select CRYPTO_BLKCIPHER2 -- select CRYPTO_AKCIPHER2 -- select CRYPTO_KPP2 -+ def_tristate CRYPTO_MANAGER || (CRYPTO_MANAGER!=n && CRYPTO_ALGAPI=y && !CRYPTO_MANAGER_DISABLE_TESTS) -+ select CRYPTO_AEAD2 if !CRYPTO_MANAGER_DISABLE_TESTS -+ select CRYPTO_HASH2 if !CRYPTO_MANAGER_DISABLE_TESTS -+ select CRYPTO_BLKCIPHER2 if !CRYPTO_MANAGER_DISABLE_TESTS -+ select CRYPTO_AKCIPHER2 if !CRYPTO_MANAGER_DISABLE_TESTS -+ select CRYPTO_KPP2 if !CRYPTO_MANAGER_DISABLE_TESTS - - config CRYPTO_USER - tristate "Userspace cryptographic algorithm configuration" -@@ -150,7 +150,6 @@ config CRYPTO_USER - config CRYPTO_MANAGER_DISABLE_TESTS - bool "Disable run-time self tests" - default y -- depends on CRYPTO_MANAGER2 - help - Disable run-time self tests that normally take place at - algorithm registration. ---- a/crypto/algboss.c -+++ b/crypto/algboss.c -@@ -248,12 +248,16 @@ static int cryptomgr_schedule_test(struc - type = alg->cra_flags; - - /* This piece of crap needs to disappear into per-type test hooks. */ -+#ifdef CONFIG_CRYPTO_MANAGER_DISABLE_TESTS -+ type |= CRYPTO_ALG_TESTED; -+#else - if (!((type ^ CRYPTO_ALG_TYPE_BLKCIPHER) & - CRYPTO_ALG_TYPE_BLKCIPHER_MASK) && !(type & CRYPTO_ALG_GENIV) && - ((alg->cra_flags & CRYPTO_ALG_TYPE_MASK) == - CRYPTO_ALG_TYPE_BLKCIPHER ? alg->cra_blkcipher.ivsize : - alg->cra_ablkcipher.ivsize)) - type |= CRYPTO_ALG_TESTED; -+#endif - - param->type = type; - diff --git a/target/linux/generic/hack-4.9/280-rfkill-stubs.patch b/target/linux/generic/hack-4.9/280-rfkill-stubs.patch deleted file mode 100644 index b4dcb45cf0..0000000000 --- a/target/linux/generic/hack-4.9/280-rfkill-stubs.patch +++ /dev/null @@ -1,94 +0,0 @@ -From 236c1acdfef5958010ac9814a9872e0a46fd78ee Mon Sep 17 00:00:00 2001 -From: John Crispin -Date: Fri, 7 Jul 2017 17:13:44 +0200 -Subject: rfkill: add fake rfkill support - -allow building of modules depending on RFKILL even if RFKILL is not enabled. - -Signed-off-by: John Crispin ---- - include/linux/rfkill.h | 2 +- - net/Makefile | 2 +- - net/rfkill/Kconfig | 14 +++++++++----- - net/rfkill/Makefile | 2 +- - 4 files changed, 12 insertions(+), 8 deletions(-) - ---- a/include/linux/rfkill.h -+++ b/include/linux/rfkill.h -@@ -64,7 +64,7 @@ struct rfkill_ops { - int (*set_block)(void *data, bool blocked); - }; - --#if defined(CONFIG_RFKILL) || defined(CONFIG_RFKILL_MODULE) -+#if defined(CONFIG_RFKILL_FULL) || defined(CONFIG_RFKILL_FULL_MODULE) - /** - * rfkill_alloc - allocate rfkill structure - * @name: name of the struct -- the string is not copied internally ---- a/net/Makefile -+++ b/net/Makefile -@@ -51,7 +51,7 @@ obj-$(CONFIG_MAC80211) += mac80211/ - obj-$(CONFIG_TIPC) += tipc/ - obj-$(CONFIG_NETLABEL) += netlabel/ - obj-$(CONFIG_IUCV) += iucv/ --obj-$(CONFIG_RFKILL) += rfkill/ -+obj-$(CONFIG_RFKILL_FULL) += rfkill/ - obj-$(CONFIG_NET_9P) += 9p/ - obj-$(CONFIG_CAIF) += caif/ - ifneq ($(CONFIG_DCB),) ---- a/net/rfkill/Kconfig -+++ b/net/rfkill/Kconfig -@@ -1,7 +1,11 @@ - # - # RF switch subsystem configuration - # --menuconfig RFKILL -+config RFKILL -+ bool -+ default y -+ -+menuconfig RFKILL_FULL - tristate "RF switch subsystem support" - help - Say Y here if you want to have control over RF switches -@@ -13,19 +17,19 @@ menuconfig RFKILL - # LED trigger support - config RFKILL_LEDS - bool -- depends on RFKILL -+ depends on RFKILL_FULL - depends on LEDS_TRIGGERS = y || RFKILL = LEDS_TRIGGERS - default y - - config RFKILL_INPUT - bool "RF switch input support" if EXPERT -- depends on RFKILL -+ depends on RFKILL_FULL - depends on INPUT = y || RFKILL = INPUT - default y if !EXPERT - - config RFKILL_REGULATOR - tristate "Generic rfkill regulator driver" -- depends on RFKILL || !RFKILL -+ depends on RFKILL_FULL || !RFKILL_FULL - depends on REGULATOR - help - This options enable controlling radio transmitters connected to -@@ -36,7 +40,7 @@ config RFKILL_REGULATOR - - config RFKILL_GPIO - tristate "GPIO RFKILL driver" -- depends on RFKILL -+ depends on RFKILL_FULL - depends on GPIOLIB || COMPILE_TEST - default n - help ---- a/net/rfkill/Makefile -+++ b/net/rfkill/Makefile -@@ -4,6 +4,6 @@ - - rfkill-y += core.o - rfkill-$(CONFIG_RFKILL_INPUT) += input.o --obj-$(CONFIG_RFKILL) += rfkill.o -+obj-$(CONFIG_RFKILL_FULL) += rfkill.o - obj-$(CONFIG_RFKILL_REGULATOR) += rfkill-regulator.o - obj-$(CONFIG_RFKILL_GPIO) += rfkill-gpio.o diff --git a/target/linux/generic/hack-4.9/300-MIPS-r4k_cache-use-more-efficient-cache-blast.patch b/target/linux/generic/hack-4.9/300-MIPS-r4k_cache-use-more-efficient-cache-blast.patch deleted file mode 100644 index 690b30ee9b..0000000000 --- a/target/linux/generic/hack-4.9/300-MIPS-r4k_cache-use-more-efficient-cache-blast.patch +++ /dev/null @@ -1,66 +0,0 @@ -From: Ben Menchaca -Date: Fri, 7 Jun 2013 18:35:22 -0500 -Subject: MIPS: r4k_cache: use more efficient cache blast - -Optimize the compiler output for larger cache blast cases that are -common for DMA-based networking. - -Signed-off-by: Ben Menchaca -Signed-off-by: Felix Fietkau ---- ---- a/arch/mips/include/asm/r4kcache.h -+++ b/arch/mips/include/asm/r4kcache.h -@@ -665,16 +665,48 @@ static inline void prot##extra##blast_## - unsigned long end) \ - { \ - unsigned long lsize = cpu_##desc##_line_size(); \ -+ unsigned long lsize_2 = lsize * 2; \ -+ unsigned long lsize_3 = lsize * 3; \ -+ unsigned long lsize_4 = lsize * 4; \ -+ unsigned long lsize_5 = lsize * 5; \ -+ unsigned long lsize_6 = lsize * 6; \ -+ unsigned long lsize_7 = lsize * 7; \ -+ unsigned long lsize_8 = lsize * 8; \ - unsigned long addr = start & ~(lsize - 1); \ -- unsigned long aend = (end - 1) & ~(lsize - 1); \ -+ unsigned long aend = (end + lsize - 1) & ~(lsize - 1); \ -+ int lines = (aend - addr) / lsize; \ - \ - __##pfx##flush_prologue \ - \ -- while (1) { \ -+ while (lines >= 8) { \ -+ prot##cache_op(hitop, addr); \ -+ prot##cache_op(hitop, addr + lsize); \ -+ prot##cache_op(hitop, addr + lsize_2); \ -+ prot##cache_op(hitop, addr + lsize_3); \ -+ prot##cache_op(hitop, addr + lsize_4); \ -+ prot##cache_op(hitop, addr + lsize_5); \ -+ prot##cache_op(hitop, addr + lsize_6); \ -+ prot##cache_op(hitop, addr + lsize_7); \ -+ addr += lsize_8; \ -+ lines -= 8; \ -+ } \ -+ \ -+ if (lines & 0x4) { \ -+ prot##cache_op(hitop, addr); \ -+ prot##cache_op(hitop, addr + lsize); \ -+ prot##cache_op(hitop, addr + lsize_2); \ -+ prot##cache_op(hitop, addr + lsize_3); \ -+ addr += lsize_4; \ -+ } \ -+ \ -+ if (lines & 0x2) { \ -+ prot##cache_op(hitop, addr); \ -+ prot##cache_op(hitop, addr + lsize); \ -+ addr += lsize_2; \ -+ } \ -+ \ -+ if (lines & 0x1) { \ - prot##cache_op(hitop, addr); \ -- if (addr == aend) \ -- break; \ -- addr += lsize; \ - } \ - \ - __##pfx##flush_epilogue \ diff --git a/target/linux/generic/hack-4.9/301-mips_image_cmdline_hack.patch b/target/linux/generic/hack-4.9/301-mips_image_cmdline_hack.patch deleted file mode 100644 index 948343600d..0000000000 --- a/target/linux/generic/hack-4.9/301-mips_image_cmdline_hack.patch +++ /dev/null @@ -1,38 +0,0 @@ -From: John Crispin -Subject: hack: kernel: add generic image_cmdline hack to MIPS targets - -lede-commit: d59f5b3a987a48508257a0ddbaeadc7909f9f976 -Signed-off-by: Gabor Juhos ---- - arch/mips/Kconfig | 4 ++++ - arch/mips/kernel/head.S | 6 ++++++ - 2 files changed, 10 insertions(+) - ---- a/arch/mips/Kconfig -+++ b/arch/mips/Kconfig -@@ -1159,6 +1159,10 @@ config SYNC_R4K - config MIPS_MACHINE - def_bool n - -+config IMAGE_CMDLINE_HACK -+ bool "libreCMC specific image command line hack" -+ default n -+ - config NO_IOPORT_MAP - def_bool n - ---- a/arch/mips/kernel/head.S -+++ b/arch/mips/kernel/head.S -@@ -79,6 +79,12 @@ FEXPORT(__kernel_entry) - j kernel_entry - #endif - -+#ifdef CONFIG_IMAGE_CMDLINE_HACK -+ .ascii "CMDLINE:" -+EXPORT(__image_cmdline) -+ .fill 0x400 -+#endif /* CONFIG_IMAGE_CMDLINE_HACK */ -+ - __REF - - NESTED(kernel_entry, 16, sp) # kernel entry point diff --git a/target/linux/generic/hack-4.9/321-powerpc_crtsavres_prereq.patch b/target/linux/generic/hack-4.9/321-powerpc_crtsavres_prereq.patch deleted file mode 100644 index 8c6ed8c207..0000000000 --- a/target/linux/generic/hack-4.9/321-powerpc_crtsavres_prereq.patch +++ /dev/null @@ -1,26 +0,0 @@ -From 107c0964cb8db7ca28ac5199426414fdab3c274d Mon Sep 17 00:00:00 2001 -From: "Alexandros C. Couloumbis" -Date: Fri, 7 Jul 2017 17:14:51 +0200 -Subject: hack: arch: powerpc: drop register save/restore library from modules - -Upstream GCC uses a libgcc function for saving/restoring registers. This -makes the code bigger, and upstream kernels need to carry that function -for every single kernel module. Our GCC is patched to avoid those -references, so we can drop the extra bloat for modules. - -lede-commit: e8e1084654f50904e6bf77b70b2de3f137d7b3ec -Signed-off-by: Alexandros C. Couloumbis ---- - arch/powerpc/Makefile | 1 - - 1 file changed, 1 deletion(-) - ---- a/arch/powerpc/Makefile -+++ b/arch/powerpc/Makefile -@@ -188,7 +188,6 @@ else - CHECKFLAGS += -D__LITTLE_ENDIAN__ - endif - --KBUILD_LDFLAGS_MODULE += arch/powerpc/lib/crtsavres.o - - ifeq ($(CONFIG_476FPE_ERR46),y) - KBUILD_LDFLAGS_MODULE += --ppc476-workaround \ diff --git a/target/linux/generic/hack-4.9/531-debloat_lzma.patch b/target/linux/generic/hack-4.9/531-debloat_lzma.patch deleted file mode 100644 index 2e453cc2f2..0000000000 --- a/target/linux/generic/hack-4.9/531-debloat_lzma.patch +++ /dev/null @@ -1,1040 +0,0 @@ -From 3fd297761ac246c54d7723c57fca95c112b99465 Mon Sep 17 00:00:00 2001 -From: Felix Fietkau -Date: Sat, 15 Jul 2017 21:15:44 +0200 -Subject: lzma: de-bloat the lzma library used by jffs2 - -lede-commit: 3fd1dd08fbcbb78b34efefd32c3032e5c99108d6 -Signed-off-by: Felix Fietkau ---- - include/linux/lzma/LzFind.h | 17 --- - include/linux/lzma/LzmaDec.h | 101 --------------- - include/linux/lzma/LzmaEnc.h | 20 --- - lib/lzma/LzFind.c | 287 ++++--------------------------------------- - lib/lzma/LzmaDec.c | 86 +------------ - lib/lzma/LzmaEnc.c | 172 ++------------------------ - 6 files changed, 42 insertions(+), 641 deletions(-) - ---- a/include/linux/lzma/LzFind.h -+++ b/include/linux/lzma/LzFind.h -@@ -55,11 +55,6 @@ typedef struct _CMatchFinder - - #define Inline_MatchFinder_GetNumAvailableBytes(p) ((p)->streamPos - (p)->pos) - --int MatchFinder_NeedMove(CMatchFinder *p); --Byte *MatchFinder_GetPointerToCurrentPos(CMatchFinder *p); --void MatchFinder_MoveBlock(CMatchFinder *p); --void MatchFinder_ReadIfRequired(CMatchFinder *p); -- - void MatchFinder_Construct(CMatchFinder *p); - - /* Conditions: -@@ -70,12 +65,6 @@ int MatchFinder_Create(CMatchFinder *p, - UInt32 keepAddBufferBefore, UInt32 matchMaxLen, UInt32 keepAddBufferAfter, - ISzAlloc *alloc); - void MatchFinder_Free(CMatchFinder *p, ISzAlloc *alloc); --void MatchFinder_Normalize3(UInt32 subValue, CLzRef *items, UInt32 numItems); --void MatchFinder_ReduceOffsets(CMatchFinder *p, UInt32 subValue); -- --UInt32 * GetMatchesSpec1(UInt32 lenLimit, UInt32 curMatch, UInt32 pos, const Byte *buffer, CLzRef *son, -- UInt32 _cyclicBufferPos, UInt32 _cyclicBufferSize, UInt32 _cutValue, -- UInt32 *distances, UInt32 maxLen); - - /* - Conditions: -@@ -102,12 +91,6 @@ typedef struct _IMatchFinder - - void MatchFinder_CreateVTable(CMatchFinder *p, IMatchFinder *vTable); - --void MatchFinder_Init(CMatchFinder *p); --UInt32 Bt3Zip_MatchFinder_GetMatches(CMatchFinder *p, UInt32 *distances); --UInt32 Hc3Zip_MatchFinder_GetMatches(CMatchFinder *p, UInt32 *distances); --void Bt3Zip_MatchFinder_Skip(CMatchFinder *p, UInt32 num); --void Hc3Zip_MatchFinder_Skip(CMatchFinder *p, UInt32 num); -- - #ifdef __cplusplus - } - #endif ---- a/include/linux/lzma/LzmaDec.h -+++ b/include/linux/lzma/LzmaDec.h -@@ -31,14 +31,6 @@ typedef struct _CLzmaProps - UInt32 dicSize; - } CLzmaProps; - --/* LzmaProps_Decode - decodes properties --Returns: -- SZ_OK -- SZ_ERROR_UNSUPPORTED - Unsupported properties --*/ -- --SRes LzmaProps_Decode(CLzmaProps *p, const Byte *data, unsigned size); -- - - /* ---------- LZMA Decoder state ---------- */ - -@@ -70,8 +62,6 @@ typedef struct - - #define LzmaDec_Construct(p) { (p)->dic = 0; (p)->probs = 0; } - --void LzmaDec_Init(CLzmaDec *p); -- - /* There are two types of LZMA streams: - 0) Stream with end mark. That end mark adds about 6 bytes to compressed size. - 1) Stream without end mark. You must know exact uncompressed size to decompress such stream. */ -@@ -108,97 +98,6 @@ typedef enum - - /* ELzmaStatus is used only as output value for function call */ - -- --/* ---------- Interfaces ---------- */ -- --/* There are 3 levels of interfaces: -- 1) Dictionary Interface -- 2) Buffer Interface -- 3) One Call Interface -- You can select any of these interfaces, but don't mix functions from different -- groups for same object. */ -- -- --/* There are two variants to allocate state for Dictionary Interface: -- 1) LzmaDec_Allocate / LzmaDec_Free -- 2) LzmaDec_AllocateProbs / LzmaDec_FreeProbs -- You can use variant 2, if you set dictionary buffer manually. -- For Buffer Interface you must always use variant 1. -- --LzmaDec_Allocate* can return: -- SZ_OK -- SZ_ERROR_MEM - Memory allocation error -- SZ_ERROR_UNSUPPORTED - Unsupported properties --*/ -- --SRes LzmaDec_AllocateProbs(CLzmaDec *p, const Byte *props, unsigned propsSize, ISzAlloc *alloc); --void LzmaDec_FreeProbs(CLzmaDec *p, ISzAlloc *alloc); -- --SRes LzmaDec_Allocate(CLzmaDec *state, const Byte *prop, unsigned propsSize, ISzAlloc *alloc); --void LzmaDec_Free(CLzmaDec *state, ISzAlloc *alloc); -- --/* ---------- Dictionary Interface ---------- */ -- --/* You can use it, if you want to eliminate the overhead for data copying from -- dictionary to some other external buffer. -- You must work with CLzmaDec variables directly in this interface. -- -- STEPS: -- LzmaDec_Constr() -- LzmaDec_Allocate() -- for (each new stream) -- { -- LzmaDec_Init() -- while (it needs more decompression) -- { -- LzmaDec_DecodeToDic() -- use data from CLzmaDec::dic and update CLzmaDec::dicPos -- } -- } -- LzmaDec_Free() --*/ -- --/* LzmaDec_DecodeToDic -- -- The decoding to internal dictionary buffer (CLzmaDec::dic). -- You must manually update CLzmaDec::dicPos, if it reaches CLzmaDec::dicBufSize !!! -- --finishMode: -- It has meaning only if the decoding reaches output limit (dicLimit). -- LZMA_FINISH_ANY - Decode just dicLimit bytes. -- LZMA_FINISH_END - Stream must be finished after dicLimit. -- --Returns: -- SZ_OK -- status: -- LZMA_STATUS_FINISHED_WITH_MARK -- LZMA_STATUS_NOT_FINISHED -- LZMA_STATUS_NEEDS_MORE_INPUT -- LZMA_STATUS_MAYBE_FINISHED_WITHOUT_MARK -- SZ_ERROR_DATA - Data error --*/ -- --SRes LzmaDec_DecodeToDic(CLzmaDec *p, SizeT dicLimit, -- const Byte *src, SizeT *srcLen, ELzmaFinishMode finishMode, ELzmaStatus *status); -- -- --/* ---------- Buffer Interface ---------- */ -- --/* It's zlib-like interface. -- See LzmaDec_DecodeToDic description for information about STEPS and return results, -- but you must use LzmaDec_DecodeToBuf instead of LzmaDec_DecodeToDic and you don't need -- to work with CLzmaDec variables manually. -- --finishMode: -- It has meaning only if the decoding reaches output limit (*destLen). -- LZMA_FINISH_ANY - Decode just destLen bytes. -- LZMA_FINISH_END - Stream must be finished after (*destLen). --*/ -- --SRes LzmaDec_DecodeToBuf(CLzmaDec *p, Byte *dest, SizeT *destLen, -- const Byte *src, SizeT *srcLen, ELzmaFinishMode finishMode, ELzmaStatus *status); -- -- - /* ---------- One Call Interface ---------- */ - - /* LzmaDecode ---- a/include/linux/lzma/LzmaEnc.h -+++ b/include/linux/lzma/LzmaEnc.h -@@ -31,9 +31,6 @@ typedef struct _CLzmaEncProps - } CLzmaEncProps; - - void LzmaEncProps_Init(CLzmaEncProps *p); --void LzmaEncProps_Normalize(CLzmaEncProps *p); --UInt32 LzmaEncProps_GetDictSize(const CLzmaEncProps *props2); -- - - /* ---------- CLzmaEncHandle Interface ---------- */ - -@@ -53,26 +50,9 @@ CLzmaEncHandle LzmaEnc_Create(ISzAlloc * - void LzmaEnc_Destroy(CLzmaEncHandle p, ISzAlloc *alloc, ISzAlloc *allocBig); - SRes LzmaEnc_SetProps(CLzmaEncHandle p, const CLzmaEncProps *props); - SRes LzmaEnc_WriteProperties(CLzmaEncHandle p, Byte *properties, SizeT *size); --SRes LzmaEnc_Encode(CLzmaEncHandle p, ISeqOutStream *outStream, ISeqInStream *inStream, -- ICompressProgress *progress, ISzAlloc *alloc, ISzAlloc *allocBig); - SRes LzmaEnc_MemEncode(CLzmaEncHandle p, Byte *dest, SizeT *destLen, const Byte *src, SizeT srcLen, - int writeEndMark, ICompressProgress *progress, ISzAlloc *alloc, ISzAlloc *allocBig); - --/* ---------- One Call Interface ---------- */ -- --/* LzmaEncode --Return code: -- SZ_OK - OK -- SZ_ERROR_MEM - Memory allocation error -- SZ_ERROR_PARAM - Incorrect paramater -- SZ_ERROR_OUTPUT_EOF - output buffer overflow -- SZ_ERROR_THREAD - errors in multithreading functions (only for Mt version) --*/ -- --SRes LzmaEncode(Byte *dest, SizeT *destLen, const Byte *src, SizeT srcLen, -- const CLzmaEncProps *props, Byte *propsEncoded, SizeT *propsSize, int writeEndMark, -- ICompressProgress *progress, ISzAlloc *alloc, ISzAlloc *allocBig); -- - #ifdef __cplusplus - } - #endif ---- a/lib/lzma/LzFind.c -+++ b/lib/lzma/LzFind.c -@@ -14,9 +14,15 @@ - - #define kStartMaxLen 3 - -+#if 0 -+#define DIRECT_INPUT p->directInput -+#else -+#define DIRECT_INPUT 1 -+#endif -+ - static void LzInWindow_Free(CMatchFinder *p, ISzAlloc *alloc) - { -- if (!p->directInput) -+ if (!DIRECT_INPUT) - { - alloc->Free(alloc, p->bufferBase); - p->bufferBase = 0; -@@ -28,7 +34,7 @@ static void LzInWindow_Free(CMatchFinder - static int LzInWindow_Create(CMatchFinder *p, UInt32 keepSizeReserv, ISzAlloc *alloc) - { - UInt32 blockSize = p->keepSizeBefore + p->keepSizeAfter + keepSizeReserv; -- if (p->directInput) -+ if (DIRECT_INPUT) - { - p->blockSize = blockSize; - return 1; -@@ -42,12 +48,12 @@ static int LzInWindow_Create(CMatchFinde - return (p->bufferBase != 0); - } - --Byte *MatchFinder_GetPointerToCurrentPos(CMatchFinder *p) { return p->buffer; } --Byte MatchFinder_GetIndexByte(CMatchFinder *p, Int32 index) { return p->buffer[index]; } -+static Byte *MatchFinder_GetPointerToCurrentPos(CMatchFinder *p) { return p->buffer; } -+static Byte MatchFinder_GetIndexByte(CMatchFinder *p, Int32 index) { return p->buffer[index]; } - --UInt32 MatchFinder_GetNumAvailableBytes(CMatchFinder *p) { return p->streamPos - p->pos; } -+static UInt32 MatchFinder_GetNumAvailableBytes(CMatchFinder *p) { return p->streamPos - p->pos; } - --void MatchFinder_ReduceOffsets(CMatchFinder *p, UInt32 subValue) -+static void MatchFinder_ReduceOffsets(CMatchFinder *p, UInt32 subValue) - { - p->posLimit -= subValue; - p->pos -= subValue; -@@ -58,7 +64,7 @@ static void MatchFinder_ReadBlock(CMatch - { - if (p->streamEndWasReached || p->result != SZ_OK) - return; -- if (p->directInput) -+ if (DIRECT_INPUT) - { - UInt32 curSize = 0xFFFFFFFF - p->streamPos; - if (curSize > p->directInputRem) -@@ -89,7 +95,7 @@ static void MatchFinder_ReadBlock(CMatch - } - } - --void MatchFinder_MoveBlock(CMatchFinder *p) -+static void MatchFinder_MoveBlock(CMatchFinder *p) - { - memmove(p->bufferBase, - p->buffer - p->keepSizeBefore, -@@ -97,22 +103,14 @@ void MatchFinder_MoveBlock(CMatchFinder - p->buffer = p->bufferBase + p->keepSizeBefore; - } - --int MatchFinder_NeedMove(CMatchFinder *p) -+static int MatchFinder_NeedMove(CMatchFinder *p) - { -- if (p->directInput) -+ if (DIRECT_INPUT) - return 0; - /* if (p->streamEndWasReached) return 0; */ - return ((size_t)(p->bufferBase + p->blockSize - p->buffer) <= p->keepSizeAfter); - } - --void MatchFinder_ReadIfRequired(CMatchFinder *p) --{ -- if (p->streamEndWasReached) -- return; -- if (p->keepSizeAfter >= p->streamPos - p->pos) -- MatchFinder_ReadBlock(p); --} -- - static void MatchFinder_CheckAndMoveAndRead(CMatchFinder *p) - { - if (MatchFinder_NeedMove(p)) -@@ -268,7 +266,7 @@ static void MatchFinder_SetLimits(CMatch - p->posLimit = p->pos + limit; - } - --void MatchFinder_Init(CMatchFinder *p) -+static void MatchFinder_Init(CMatchFinder *p) - { - UInt32 i; - for (i = 0; i < p->hashSizeSum; i++) -@@ -287,7 +285,7 @@ static UInt32 MatchFinder_GetSubValue(CM - return (p->pos - p->historySize - 1) & kNormalizeMask; - } - --void MatchFinder_Normalize3(UInt32 subValue, CLzRef *items, UInt32 numItems) -+static void MatchFinder_Normalize3(UInt32 subValue, CLzRef *items, UInt32 numItems) - { - UInt32 i; - for (i = 0; i < numItems; i++) -@@ -319,38 +317,7 @@ static void MatchFinder_CheckLimits(CMat - MatchFinder_SetLimits(p); - } - --static UInt32 * Hc_GetMatchesSpec(UInt32 lenLimit, UInt32 curMatch, UInt32 pos, const Byte *cur, CLzRef *son, -- UInt32 _cyclicBufferPos, UInt32 _cyclicBufferSize, UInt32 cutValue, -- UInt32 *distances, UInt32 maxLen) --{ -- son[_cyclicBufferPos] = curMatch; -- for (;;) -- { -- UInt32 delta = pos - curMatch; -- if (cutValue-- == 0 || delta >= _cyclicBufferSize) -- return distances; -- { -- const Byte *pb = cur - delta; -- curMatch = son[_cyclicBufferPos - delta + ((delta > _cyclicBufferPos) ? _cyclicBufferSize : 0)]; -- if (pb[maxLen] == cur[maxLen] && *pb == *cur) -- { -- UInt32 len = 0; -- while (++len != lenLimit) -- if (pb[len] != cur[len]) -- break; -- if (maxLen < len) -- { -- *distances++ = maxLen = len; -- *distances++ = delta - 1; -- if (len == lenLimit) -- return distances; -- } -- } -- } -- } --} -- --UInt32 * GetMatchesSpec1(UInt32 lenLimit, UInt32 curMatch, UInt32 pos, const Byte *cur, CLzRef *son, -+static UInt32 * GetMatchesSpec1(UInt32 lenLimit, UInt32 curMatch, UInt32 pos, const Byte *cur, CLzRef *son, - UInt32 _cyclicBufferPos, UInt32 _cyclicBufferSize, UInt32 cutValue, - UInt32 *distances, UInt32 maxLen) - { -@@ -460,10 +427,10 @@ static void SkipMatchesSpec(UInt32 lenLi - p->buffer++; \ - if (++p->pos == p->posLimit) MatchFinder_CheckLimits(p); - --#define MOVE_POS_RET MOVE_POS return offset; -- - static void MatchFinder_MovePos(CMatchFinder *p) { MOVE_POS; } - -+#define MOVE_POS_RET MatchFinder_MovePos(p); return offset; -+ - #define GET_MATCHES_HEADER2(minLen, ret_op) \ - UInt32 lenLimit; UInt32 hashValue; const Byte *cur; UInt32 curMatch; \ - lenLimit = p->lenLimit; { if (lenLimit < minLen) { MatchFinder_MovePos(p); ret_op; }} \ -@@ -479,62 +446,7 @@ static void MatchFinder_MovePos(CMatchFi - distances + offset, maxLen) - distances); MOVE_POS_RET; - - #define SKIP_FOOTER \ -- SkipMatchesSpec(lenLimit, curMatch, MF_PARAMS(p)); MOVE_POS; -- --static UInt32 Bt2_MatchFinder_GetMatches(CMatchFinder *p, UInt32 *distances) --{ -- UInt32 offset; -- GET_MATCHES_HEADER(2) -- HASH2_CALC; -- curMatch = p->hash[hashValue]; -- p->hash[hashValue] = p->pos; -- offset = 0; -- GET_MATCHES_FOOTER(offset, 1) --} -- --UInt32 Bt3Zip_MatchFinder_GetMatches(CMatchFinder *p, UInt32 *distances) --{ -- UInt32 offset; -- GET_MATCHES_HEADER(3) -- HASH_ZIP_CALC; -- curMatch = p->hash[hashValue]; -- p->hash[hashValue] = p->pos; -- offset = 0; -- GET_MATCHES_FOOTER(offset, 2) --} -- --static UInt32 Bt3_MatchFinder_GetMatches(CMatchFinder *p, UInt32 *distances) --{ -- UInt32 hash2Value, delta2, maxLen, offset; -- GET_MATCHES_HEADER(3) -- -- HASH3_CALC; -- -- delta2 = p->pos - p->hash[hash2Value]; -- curMatch = p->hash[kFix3HashSize + hashValue]; -- -- p->hash[hash2Value] = -- p->hash[kFix3HashSize + hashValue] = p->pos; -- -- -- maxLen = 2; -- offset = 0; -- if (delta2 < p->cyclicBufferSize && *(cur - delta2) == *cur) -- { -- for (; maxLen != lenLimit; maxLen++) -- if (cur[(ptrdiff_t)maxLen - delta2] != cur[maxLen]) -- break; -- distances[0] = maxLen; -- distances[1] = delta2 - 1; -- offset = 2; -- if (maxLen == lenLimit) -- { -- SkipMatchesSpec(lenLimit, curMatch, MF_PARAMS(p)); -- MOVE_POS_RET; -- } -- } -- GET_MATCHES_FOOTER(offset, maxLen) --} -+ SkipMatchesSpec(lenLimit, curMatch, MF_PARAMS(p)); MatchFinder_MovePos(p); - - static UInt32 Bt4_MatchFinder_GetMatches(CMatchFinder *p, UInt32 *distances) - { -@@ -583,108 +495,6 @@ static UInt32 Bt4_MatchFinder_GetMatches - GET_MATCHES_FOOTER(offset, maxLen) - } - --static UInt32 Hc4_MatchFinder_GetMatches(CMatchFinder *p, UInt32 *distances) --{ -- UInt32 hash2Value, hash3Value, delta2, delta3, maxLen, offset; -- GET_MATCHES_HEADER(4) -- -- HASH4_CALC; -- -- delta2 = p->pos - p->hash[ hash2Value]; -- delta3 = p->pos - p->hash[kFix3HashSize + hash3Value]; -- curMatch = p->hash[kFix4HashSize + hashValue]; -- -- p->hash[ hash2Value] = -- p->hash[kFix3HashSize + hash3Value] = -- p->hash[kFix4HashSize + hashValue] = p->pos; -- -- maxLen = 1; -- offset = 0; -- if (delta2 < p->cyclicBufferSize && *(cur - delta2) == *cur) -- { -- distances[0] = maxLen = 2; -- distances[1] = delta2 - 1; -- offset = 2; -- } -- if (delta2 != delta3 && delta3 < p->cyclicBufferSize && *(cur - delta3) == *cur) -- { -- maxLen = 3; -- distances[offset + 1] = delta3 - 1; -- offset += 2; -- delta2 = delta3; -- } -- if (offset != 0) -- { -- for (; maxLen != lenLimit; maxLen++) -- if (cur[(ptrdiff_t)maxLen - delta2] != cur[maxLen]) -- break; -- distances[offset - 2] = maxLen; -- if (maxLen == lenLimit) -- { -- p->son[p->cyclicBufferPos] = curMatch; -- MOVE_POS_RET; -- } -- } -- if (maxLen < 3) -- maxLen = 3; -- offset = (UInt32)(Hc_GetMatchesSpec(lenLimit, curMatch, MF_PARAMS(p), -- distances + offset, maxLen) - (distances)); -- MOVE_POS_RET --} -- --UInt32 Hc3Zip_MatchFinder_GetMatches(CMatchFinder *p, UInt32 *distances) --{ -- UInt32 offset; -- GET_MATCHES_HEADER(3) -- HASH_ZIP_CALC; -- curMatch = p->hash[hashValue]; -- p->hash[hashValue] = p->pos; -- offset = (UInt32)(Hc_GetMatchesSpec(lenLimit, curMatch, MF_PARAMS(p), -- distances, 2) - (distances)); -- MOVE_POS_RET --} -- --static void Bt2_MatchFinder_Skip(CMatchFinder *p, UInt32 num) --{ -- do -- { -- SKIP_HEADER(2) -- HASH2_CALC; -- curMatch = p->hash[hashValue]; -- p->hash[hashValue] = p->pos; -- SKIP_FOOTER -- } -- while (--num != 0); --} -- --void Bt3Zip_MatchFinder_Skip(CMatchFinder *p, UInt32 num) --{ -- do -- { -- SKIP_HEADER(3) -- HASH_ZIP_CALC; -- curMatch = p->hash[hashValue]; -- p->hash[hashValue] = p->pos; -- SKIP_FOOTER -- } -- while (--num != 0); --} -- --static void Bt3_MatchFinder_Skip(CMatchFinder *p, UInt32 num) --{ -- do -- { -- UInt32 hash2Value; -- SKIP_HEADER(3) -- HASH3_CALC; -- curMatch = p->hash[kFix3HashSize + hashValue]; -- p->hash[hash2Value] = -- p->hash[kFix3HashSize + hashValue] = p->pos; -- SKIP_FOOTER -- } -- while (--num != 0); --} -- - static void Bt4_MatchFinder_Skip(CMatchFinder *p, UInt32 num) - { - do -@@ -701,61 +511,12 @@ static void Bt4_MatchFinder_Skip(CMatchF - while (--num != 0); - } - --static void Hc4_MatchFinder_Skip(CMatchFinder *p, UInt32 num) --{ -- do -- { -- UInt32 hash2Value, hash3Value; -- SKIP_HEADER(4) -- HASH4_CALC; -- curMatch = p->hash[kFix4HashSize + hashValue]; -- p->hash[ hash2Value] = -- p->hash[kFix3HashSize + hash3Value] = -- p->hash[kFix4HashSize + hashValue] = p->pos; -- p->son[p->cyclicBufferPos] = curMatch; -- MOVE_POS -- } -- while (--num != 0); --} -- --void Hc3Zip_MatchFinder_Skip(CMatchFinder *p, UInt32 num) --{ -- do -- { -- SKIP_HEADER(3) -- HASH_ZIP_CALC; -- curMatch = p->hash[hashValue]; -- p->hash[hashValue] = p->pos; -- p->son[p->cyclicBufferPos] = curMatch; -- MOVE_POS -- } -- while (--num != 0); --} -- - void MatchFinder_CreateVTable(CMatchFinder *p, IMatchFinder *vTable) - { - vTable->Init = (Mf_Init_Func)MatchFinder_Init; - vTable->GetIndexByte = (Mf_GetIndexByte_Func)MatchFinder_GetIndexByte; - vTable->GetNumAvailableBytes = (Mf_GetNumAvailableBytes_Func)MatchFinder_GetNumAvailableBytes; - vTable->GetPointerToCurrentPos = (Mf_GetPointerToCurrentPos_Func)MatchFinder_GetPointerToCurrentPos; -- if (!p->btMode) -- { -- vTable->GetMatches = (Mf_GetMatches_Func)Hc4_MatchFinder_GetMatches; -- vTable->Skip = (Mf_Skip_Func)Hc4_MatchFinder_Skip; -- } -- else if (p->numHashBytes == 2) -- { -- vTable->GetMatches = (Mf_GetMatches_Func)Bt2_MatchFinder_GetMatches; -- vTable->Skip = (Mf_Skip_Func)Bt2_MatchFinder_Skip; -- } -- else if (p->numHashBytes == 3) -- { -- vTable->GetMatches = (Mf_GetMatches_Func)Bt3_MatchFinder_GetMatches; -- vTable->Skip = (Mf_Skip_Func)Bt3_MatchFinder_Skip; -- } -- else -- { -- vTable->GetMatches = (Mf_GetMatches_Func)Bt4_MatchFinder_GetMatches; -- vTable->Skip = (Mf_Skip_Func)Bt4_MatchFinder_Skip; -- } -+ vTable->GetMatches = (Mf_GetMatches_Func)Bt4_MatchFinder_GetMatches; -+ vTable->Skip = (Mf_Skip_Func)Bt4_MatchFinder_Skip; - } ---- a/lib/lzma/LzmaDec.c -+++ b/lib/lzma/LzmaDec.c -@@ -682,7 +682,7 @@ static void LzmaDec_InitRc(CLzmaDec *p, - p->needFlush = 0; - } - --void LzmaDec_InitDicAndState(CLzmaDec *p, Bool initDic, Bool initState) -+static void LzmaDec_InitDicAndState(CLzmaDec *p, Bool initDic, Bool initState) - { - p->needFlush = 1; - p->remainLen = 0; -@@ -698,7 +698,7 @@ void LzmaDec_InitDicAndState(CLzmaDec *p - p->needInitState = 1; - } - --void LzmaDec_Init(CLzmaDec *p) -+static void LzmaDec_Init(CLzmaDec *p) - { - p->dicPos = 0; - LzmaDec_InitDicAndState(p, True, True); -@@ -716,7 +716,7 @@ static void LzmaDec_InitStateReal(CLzmaD - p->needInitState = 0; - } - --SRes LzmaDec_DecodeToDic(CLzmaDec *p, SizeT dicLimit, const Byte *src, SizeT *srcLen, -+static SRes LzmaDec_DecodeToDic(CLzmaDec *p, SizeT dicLimit, const Byte *src, SizeT *srcLen, - ELzmaFinishMode finishMode, ELzmaStatus *status) - { - SizeT inSize = *srcLen; -@@ -837,65 +837,13 @@ SRes LzmaDec_DecodeToDic(CLzmaDec *p, Si - return (p->code == 0) ? SZ_OK : SZ_ERROR_DATA; - } - --SRes LzmaDec_DecodeToBuf(CLzmaDec *p, Byte *dest, SizeT *destLen, const Byte *src, SizeT *srcLen, ELzmaFinishMode finishMode, ELzmaStatus *status) --{ -- SizeT outSize = *destLen; -- SizeT inSize = *srcLen; -- *srcLen = *destLen = 0; -- for (;;) -- { -- SizeT inSizeCur = inSize, outSizeCur, dicPos; -- ELzmaFinishMode curFinishMode; -- SRes res; -- if (p->dicPos == p->dicBufSize) -- p->dicPos = 0; -- dicPos = p->dicPos; -- if (outSize > p->dicBufSize - dicPos) -- { -- outSizeCur = p->dicBufSize; -- curFinishMode = LZMA_FINISH_ANY; -- } -- else -- { -- outSizeCur = dicPos + outSize; -- curFinishMode = finishMode; -- } -- -- res = LzmaDec_DecodeToDic(p, outSizeCur, src, &inSizeCur, curFinishMode, status); -- src += inSizeCur; -- inSize -= inSizeCur; -- *srcLen += inSizeCur; -- outSizeCur = p->dicPos - dicPos; -- memcpy(dest, p->dic + dicPos, outSizeCur); -- dest += outSizeCur; -- outSize -= outSizeCur; -- *destLen += outSizeCur; -- if (res != 0) -- return res; -- if (outSizeCur == 0 || outSize == 0) -- return SZ_OK; -- } --} -- --void LzmaDec_FreeProbs(CLzmaDec *p, ISzAlloc *alloc) -+static void LzmaDec_FreeProbs(CLzmaDec *p, ISzAlloc *alloc) - { - alloc->Free(alloc, p->probs); - p->probs = 0; - } - --static void LzmaDec_FreeDict(CLzmaDec *p, ISzAlloc *alloc) --{ -- alloc->Free(alloc, p->dic); -- p->dic = 0; --} -- --void LzmaDec_Free(CLzmaDec *p, ISzAlloc *alloc) --{ -- LzmaDec_FreeProbs(p, alloc); -- LzmaDec_FreeDict(p, alloc); --} -- --SRes LzmaProps_Decode(CLzmaProps *p, const Byte *data, unsigned size) -+static SRes LzmaProps_Decode(CLzmaProps *p, const Byte *data, unsigned size) - { - UInt32 dicSize; - Byte d; -@@ -935,7 +883,7 @@ static SRes LzmaDec_AllocateProbs2(CLzma - return SZ_OK; - } - --SRes LzmaDec_AllocateProbs(CLzmaDec *p, const Byte *props, unsigned propsSize, ISzAlloc *alloc) -+static SRes LzmaDec_AllocateProbs(CLzmaDec *p, const Byte *props, unsigned propsSize, ISzAlloc *alloc) - { - CLzmaProps propNew; - RINOK(LzmaProps_Decode(&propNew, props, propsSize)); -@@ -943,28 +891,6 @@ SRes LzmaDec_AllocateProbs(CLzmaDec *p, - p->prop = propNew; - return SZ_OK; - } -- --SRes LzmaDec_Allocate(CLzmaDec *p, const Byte *props, unsigned propsSize, ISzAlloc *alloc) --{ -- CLzmaProps propNew; -- SizeT dicBufSize; -- RINOK(LzmaProps_Decode(&propNew, props, propsSize)); -- RINOK(LzmaDec_AllocateProbs2(p, &propNew, alloc)); -- dicBufSize = propNew.dicSize; -- if (p->dic == 0 || dicBufSize != p->dicBufSize) -- { -- LzmaDec_FreeDict(p, alloc); -- p->dic = (Byte *)alloc->Alloc(alloc, dicBufSize); -- if (p->dic == 0) -- { -- LzmaDec_FreeProbs(p, alloc); -- return SZ_ERROR_MEM; -- } -- } -- p->dicBufSize = dicBufSize; -- p->prop = propNew; -- return SZ_OK; --} - - SRes LzmaDecode(Byte *dest, SizeT *destLen, const Byte *src, SizeT *srcLen, - const Byte *propData, unsigned propSize, ELzmaFinishMode finishMode, ---- a/lib/lzma/LzmaEnc.c -+++ b/lib/lzma/LzmaEnc.c -@@ -53,7 +53,7 @@ void LzmaEncProps_Init(CLzmaEncProps *p) - p->writeEndMark = 0; - } - --void LzmaEncProps_Normalize(CLzmaEncProps *p) -+static void LzmaEncProps_Normalize(CLzmaEncProps *p) - { - int level = p->level; - if (level < 0) level = 5; -@@ -76,7 +76,7 @@ void LzmaEncProps_Normalize(CLzmaEncProp - #endif - } - --UInt32 LzmaEncProps_GetDictSize(const CLzmaEncProps *props2) -+static UInt32 __maybe_unused LzmaEncProps_GetDictSize(const CLzmaEncProps *props2) - { - CLzmaEncProps props = *props2; - LzmaEncProps_Normalize(&props); -@@ -93,7 +93,7 @@ UInt32 LzmaEncProps_GetDictSize(const CL - - #define BSR2_RET(pos, res) { unsigned long i; _BitScanReverse(&i, (pos)); res = (i + i) + ((pos >> (i - 1)) & 1); } - --UInt32 GetPosSlot1(UInt32 pos) -+static UInt32 GetPosSlot1(UInt32 pos) - { - UInt32 res; - BSR2_RET(pos, res); -@@ -107,7 +107,7 @@ UInt32 GetPosSlot1(UInt32 pos) - #define kNumLogBits (9 + (int)sizeof(size_t) / 2) - #define kDicLogSizeMaxCompress ((kNumLogBits - 1) * 2 + 7) - --void LzmaEnc_FastPosInit(Byte *g_FastPos) -+static void LzmaEnc_FastPosInit(Byte *g_FastPos) - { - int c = 2, slotFast; - g_FastPos[0] = 0; -@@ -339,58 +339,6 @@ typedef struct - CSaveState saveState; - } CLzmaEnc; - --void LzmaEnc_SaveState(CLzmaEncHandle pp) --{ -- CLzmaEnc *p = (CLzmaEnc *)pp; -- CSaveState *dest = &p->saveState; -- int i; -- dest->lenEnc = p->lenEnc; -- dest->repLenEnc = p->repLenEnc; -- dest->state = p->state; -- -- for (i = 0; i < kNumStates; i++) -- { -- memcpy(dest->isMatch[i], p->isMatch[i], sizeof(p->isMatch[i])); -- memcpy(dest->isRep0Long[i], p->isRep0Long[i], sizeof(p->isRep0Long[i])); -- } -- for (i = 0; i < kNumLenToPosStates; i++) -- memcpy(dest->posSlotEncoder[i], p->posSlotEncoder[i], sizeof(p->posSlotEncoder[i])); -- memcpy(dest->isRep, p->isRep, sizeof(p->isRep)); -- memcpy(dest->isRepG0, p->isRepG0, sizeof(p->isRepG0)); -- memcpy(dest->isRepG1, p->isRepG1, sizeof(p->isRepG1)); -- memcpy(dest->isRepG2, p->isRepG2, sizeof(p->isRepG2)); -- memcpy(dest->posEncoders, p->posEncoders, sizeof(p->posEncoders)); -- memcpy(dest->posAlignEncoder, p->posAlignEncoder, sizeof(p->posAlignEncoder)); -- memcpy(dest->reps, p->reps, sizeof(p->reps)); -- memcpy(dest->litProbs, p->litProbs, (0x300 << p->lclp) * sizeof(CLzmaProb)); --} -- --void LzmaEnc_RestoreState(CLzmaEncHandle pp) --{ -- CLzmaEnc *dest = (CLzmaEnc *)pp; -- const CSaveState *p = &dest->saveState; -- int i; -- dest->lenEnc = p->lenEnc; -- dest->repLenEnc = p->repLenEnc; -- dest->state = p->state; -- -- for (i = 0; i < kNumStates; i++) -- { -- memcpy(dest->isMatch[i], p->isMatch[i], sizeof(p->isMatch[i])); -- memcpy(dest->isRep0Long[i], p->isRep0Long[i], sizeof(p->isRep0Long[i])); -- } -- for (i = 0; i < kNumLenToPosStates; i++) -- memcpy(dest->posSlotEncoder[i], p->posSlotEncoder[i], sizeof(p->posSlotEncoder[i])); -- memcpy(dest->isRep, p->isRep, sizeof(p->isRep)); -- memcpy(dest->isRepG0, p->isRepG0, sizeof(p->isRepG0)); -- memcpy(dest->isRepG1, p->isRepG1, sizeof(p->isRepG1)); -- memcpy(dest->isRepG2, p->isRepG2, sizeof(p->isRepG2)); -- memcpy(dest->posEncoders, p->posEncoders, sizeof(p->posEncoders)); -- memcpy(dest->posAlignEncoder, p->posAlignEncoder, sizeof(p->posAlignEncoder)); -- memcpy(dest->reps, p->reps, sizeof(p->reps)); -- memcpy(dest->litProbs, p->litProbs, (0x300 << dest->lclp) * sizeof(CLzmaProb)); --} -- - SRes LzmaEnc_SetProps(CLzmaEncHandle pp, const CLzmaEncProps *props2) - { - CLzmaEnc *p = (CLzmaEnc *)pp; -@@ -600,7 +548,7 @@ static void LitEnc_EncodeMatched(CRangeE - while (symbol < 0x10000); - } - --void LzmaEnc_InitPriceTables(UInt32 *ProbPrices) -+static void LzmaEnc_InitPriceTables(UInt32 *ProbPrices) - { - UInt32 i; - for (i = (1 << kNumMoveReducingBits) / 2; i < kBitModelTotal; i += (1 << kNumMoveReducingBits)) -@@ -1676,7 +1624,7 @@ static void FillDistancesPrices(CLzmaEnc - p->matchPriceCount = 0; - } - --void LzmaEnc_Construct(CLzmaEnc *p) -+static void LzmaEnc_Construct(CLzmaEnc *p) - { - RangeEnc_Construct(&p->rc); - MatchFinder_Construct(&p->matchFinderBase); -@@ -1709,7 +1657,7 @@ CLzmaEncHandle LzmaEnc_Create(ISzAlloc * - return p; - } - --void LzmaEnc_FreeLits(CLzmaEnc *p, ISzAlloc *alloc) -+static void LzmaEnc_FreeLits(CLzmaEnc *p, ISzAlloc *alloc) - { - alloc->Free(alloc, p->litProbs); - alloc->Free(alloc, p->saveState.litProbs); -@@ -1717,7 +1665,7 @@ void LzmaEnc_FreeLits(CLzmaEnc *p, ISzAl - p->saveState.litProbs = 0; - } - --void LzmaEnc_Destruct(CLzmaEnc *p, ISzAlloc *alloc, ISzAlloc *allocBig) -+static void LzmaEnc_Destruct(CLzmaEnc *p, ISzAlloc *alloc, ISzAlloc *allocBig) - { - #ifndef _7ZIP_ST - MatchFinderMt_Destruct(&p->matchFinderMt, allocBig); -@@ -1947,7 +1895,7 @@ static SRes LzmaEnc_Alloc(CLzmaEnc *p, U - return SZ_OK; - } - --void LzmaEnc_Init(CLzmaEnc *p) -+static void LzmaEnc_Init(CLzmaEnc *p) - { - UInt32 i; - p->state = 0; -@@ -2005,7 +1953,7 @@ void LzmaEnc_Init(CLzmaEnc *p) - p->lpMask = (1 << p->lp) - 1; - } - --void LzmaEnc_InitPrices(CLzmaEnc *p) -+static void LzmaEnc_InitPrices(CLzmaEnc *p) - { - if (!p->fastMode) - { -@@ -2037,26 +1985,6 @@ static SRes LzmaEnc_AllocAndInit(CLzmaEn - return SZ_OK; - } - --static SRes LzmaEnc_Prepare(CLzmaEncHandle pp, ISeqOutStream *outStream, ISeqInStream *inStream, -- ISzAlloc *alloc, ISzAlloc *allocBig) --{ -- CLzmaEnc *p = (CLzmaEnc *)pp; -- p->matchFinderBase.stream = inStream; -- p->needInit = 1; -- p->rc.outStream = outStream; -- return LzmaEnc_AllocAndInit(p, 0, alloc, allocBig); --} -- --SRes LzmaEnc_PrepareForLzma2(CLzmaEncHandle pp, -- ISeqInStream *inStream, UInt32 keepWindowSize, -- ISzAlloc *alloc, ISzAlloc *allocBig) --{ -- CLzmaEnc *p = (CLzmaEnc *)pp; -- p->matchFinderBase.stream = inStream; -- p->needInit = 1; -- return LzmaEnc_AllocAndInit(p, keepWindowSize, alloc, allocBig); --} -- - static void LzmaEnc_SetInputBuf(CLzmaEnc *p, const Byte *src, SizeT srcLen) - { - p->matchFinderBase.directInput = 1; -@@ -2064,7 +1992,7 @@ static void LzmaEnc_SetInputBuf(CLzmaEnc - p->matchFinderBase.directInputRem = srcLen; - } - --SRes LzmaEnc_MemPrepare(CLzmaEncHandle pp, const Byte *src, SizeT srcLen, -+static SRes LzmaEnc_MemPrepare(CLzmaEncHandle pp, const Byte *src, SizeT srcLen, - UInt32 keepWindowSize, ISzAlloc *alloc, ISzAlloc *allocBig) - { - CLzmaEnc *p = (CLzmaEnc *)pp; -@@ -2074,7 +2002,7 @@ SRes LzmaEnc_MemPrepare(CLzmaEncHandle p - return LzmaEnc_AllocAndInit(p, keepWindowSize, alloc, allocBig); - } - --void LzmaEnc_Finish(CLzmaEncHandle pp) -+static void LzmaEnc_Finish(CLzmaEncHandle pp) - { - #ifndef _7ZIP_ST - CLzmaEnc *p = (CLzmaEnc *)pp; -@@ -2107,53 +2035,6 @@ static size_t MyWrite(void *pp, const vo - return size; - } - -- --UInt32 LzmaEnc_GetNumAvailableBytes(CLzmaEncHandle pp) --{ -- const CLzmaEnc *p = (CLzmaEnc *)pp; -- return p->matchFinder.GetNumAvailableBytes(p->matchFinderObj); --} -- --const Byte *LzmaEnc_GetCurBuf(CLzmaEncHandle pp) --{ -- const CLzmaEnc *p = (CLzmaEnc *)pp; -- return p->matchFinder.GetPointerToCurrentPos(p->matchFinderObj) - p->additionalOffset; --} -- --SRes LzmaEnc_CodeOneMemBlock(CLzmaEncHandle pp, Bool reInit, -- Byte *dest, size_t *destLen, UInt32 desiredPackSize, UInt32 *unpackSize) --{ -- CLzmaEnc *p = (CLzmaEnc *)pp; -- UInt64 nowPos64; -- SRes res; -- CSeqOutStreamBuf outStream; -- -- outStream.funcTable.Write = MyWrite; -- outStream.data = dest; -- outStream.rem = *destLen; -- outStream.overflow = False; -- -- p->writeEndMark = False; -- p->finished = False; -- p->result = SZ_OK; -- -- if (reInit) -- LzmaEnc_Init(p); -- LzmaEnc_InitPrices(p); -- nowPos64 = p->nowPos64; -- RangeEnc_Init(&p->rc); -- p->rc.outStream = &outStream.funcTable; -- -- res = LzmaEnc_CodeOneBlock(p, True, desiredPackSize, *unpackSize); -- -- *unpackSize = (UInt32)(p->nowPos64 - nowPos64); -- *destLen -= outStream.rem; -- if (outStream.overflow) -- return SZ_ERROR_OUTPUT_EOF; -- -- return res; --} -- - static SRes LzmaEnc_Encode2(CLzmaEnc *p, ICompressProgress *progress) - { - SRes res = SZ_OK; -@@ -2184,13 +2065,6 @@ static SRes LzmaEnc_Encode2(CLzmaEnc *p, - return res; - } - --SRes LzmaEnc_Encode(CLzmaEncHandle pp, ISeqOutStream *outStream, ISeqInStream *inStream, ICompressProgress *progress, -- ISzAlloc *alloc, ISzAlloc *allocBig) --{ -- RINOK(LzmaEnc_Prepare(pp, outStream, inStream, alloc, allocBig)); -- return LzmaEnc_Encode2((CLzmaEnc *)pp, progress); --} -- - SRes LzmaEnc_WriteProperties(CLzmaEncHandle pp, Byte *props, SizeT *size) - { - CLzmaEnc *p = (CLzmaEnc *)pp; -@@ -2247,25 +2121,3 @@ SRes LzmaEnc_MemEncode(CLzmaEncHandle pp - return SZ_ERROR_OUTPUT_EOF; - return res; - } -- --SRes LzmaEncode(Byte *dest, SizeT *destLen, const Byte *src, SizeT srcLen, -- const CLzmaEncProps *props, Byte *propsEncoded, SizeT *propsSize, int writeEndMark, -- ICompressProgress *progress, ISzAlloc *alloc, ISzAlloc *allocBig) --{ -- CLzmaEnc *p = (CLzmaEnc *)LzmaEnc_Create(alloc); -- SRes res; -- if (p == 0) -- return SZ_ERROR_MEM; -- -- res = LzmaEnc_SetProps(p, props); -- if (res == SZ_OK) -- { -- res = LzmaEnc_WriteProperties(p, propsEncoded, propsSize); -- if (res == SZ_OK) -- res = LzmaEnc_MemEncode(p, dest, destLen, src, srcLen, -- writeEndMark, progress, alloc, allocBig); -- } -- -- LzmaEnc_Destroy(p, alloc, allocBig); -- return res; --} diff --git a/target/linux/generic/hack-4.9/640-bridge-only-accept-EAP-locally.patch b/target/linux/generic/hack-4.9/640-bridge-only-accept-EAP-locally.patch deleted file mode 100644 index ba87420b32..0000000000 --- a/target/linux/generic/hack-4.9/640-bridge-only-accept-EAP-locally.patch +++ /dev/null @@ -1,32 +0,0 @@ -From c6905cfdeb31a5c049db3da434b10fa0d3e83569 Mon Sep 17 00:00:00 2001 -From: Felix Fietkau -Date: Fri, 7 Jul 2017 17:18:54 +0200 -Subject: bridge: only accept EAP locally - -When bridging, do not forward EAP frames to other ports, only deliver -them locally, regardless of the state. - -Signed-off-by: Felix Fietkau ---- - net/bridge/br_input.c | 7 +++++-- - 1 file changed, 5 insertions(+), 2 deletions(-) - ---- a/net/bridge/br_input.c -+++ b/net/bridge/br_input.c -@@ -164,11 +164,14 @@ int br_handle_frame_finish(struct net *n - } - } - -+ BR_INPUT_SKB_CB(skb)->brdev = br->dev; -+ -+ if (skb->protocol == htons(ETH_P_PAE)) -+ return br_pass_frame_up(skb); -+ - if (p->state == BR_STATE_LEARNING) - goto drop; - -- BR_INPUT_SKB_CB(skb)->brdev = br->dev; -- - if (IS_ENABLED(CONFIG_INET) && skb->protocol == htons(ETH_P_ARP)) - br_do_proxy_arp(skb, br, vid, p); - diff --git a/target/linux/generic/hack-4.9/641-bridge_port_isolate.patch b/target/linux/generic/hack-4.9/641-bridge_port_isolate.patch deleted file mode 100644 index a436dd2b1e..0000000000 --- a/target/linux/generic/hack-4.9/641-bridge_port_isolate.patch +++ /dev/null @@ -1,76 +0,0 @@ -From e988390850731aa1697ed09d47b0932fac1af175 Mon Sep 17 00:00:00 2001 -From: Felix Fietkau -Date: Fri, 7 Jul 2017 17:20:03 +0200 -Subject: bridge: port isolate - -Isolating individual bridge ports - -Signed-off-by: Felix Fietkau ---- - include/linux/if_bridge.h | 1 + - net/bridge/br_forward.c | 5 +++++ - net/bridge/br_input.c | 3 +++ - net/bridge/br_sysfs_if.c | 2 ++ - 4 files changed, 11 insertions(+) - ---- a/include/linux/if_bridge.h -+++ b/include/linux/if_bridge.h -@@ -47,6 +47,7 @@ struct br_ip_list { - #define BR_PROXYARP_WIFI BIT(10) - #define BR_MCAST_FLOOD BIT(11) - #define BR_MULTICAST_TO_UNICAST BIT(12) -+#define BR_ISOLATE_MODE BIT(13) - - #define BR_DEFAULT_AGEING_TIME (300 * HZ) - ---- a/net/bridge/br_forward.c -+++ b/net/bridge/br_forward.c -@@ -140,6 +140,9 @@ static int deliver_clone(const struct ne - void br_forward(const struct net_bridge_port *to, - struct sk_buff *skb, bool local_rcv, bool local_orig) - { -+ if (to->flags & BR_ISOLATE_MODE && !local_orig) -+ to = NULL; -+ - if (to && should_deliver(to, skb)) { - if (local_rcv) - deliver_clone(to, skb, local_orig); -@@ -205,6 +208,8 @@ void br_flood(struct net_bridge *br, str - struct net_bridge_port *p; - - list_for_each_entry_rcu(p, &br->port_list, list) { -+ if (!local_orig && (p->flags & BR_ISOLATE_MODE)) -+ continue; - /* Do not flood unicast traffic to ports that turn it off */ - if (pkt_type == BR_PKT_UNICAST && !(p->flags & BR_FLOOD)) - continue; ---- a/net/bridge/br_input.c -+++ b/net/bridge/br_input.c -@@ -175,6 +175,9 @@ int br_handle_frame_finish(struct net *n - if (IS_ENABLED(CONFIG_INET) && skb->protocol == htons(ETH_P_ARP)) - br_do_proxy_arp(skb, br, vid, p); - -+ if (p->flags & BR_ISOLATE_MODE) -+ return br_pass_frame_up(skb); -+ - switch (pkt_type) { - case BR_PKT_MULTICAST: - mdst = br_mdb_get(br, skb, vid); ---- a/net/bridge/br_sysfs_if.c -+++ b/net/bridge/br_sysfs_if.c -@@ -172,6 +172,7 @@ BRPORT_ATTR_FLAG(unicast_flood, BR_FLOOD - BRPORT_ATTR_FLAG(proxyarp, BR_PROXYARP); - BRPORT_ATTR_FLAG(proxyarp_wifi, BR_PROXYARP_WIFI); - BRPORT_ATTR_FLAG(multicast_flood, BR_MCAST_FLOOD); -+BRPORT_ATTR_FLAG(isolated, BR_ISOLATE_MODE); - - #ifdef CONFIG_BRIDGE_IGMP_SNOOPING - static ssize_t show_multicast_router(struct net_bridge_port *p, char *buf) -@@ -220,6 +221,7 @@ static const struct brport_attribute *br - &brport_attr_proxyarp, - &brport_attr_proxyarp_wifi, - &brport_attr_multicast_flood, -+ &brport_attr_isolated, - NULL - }; - diff --git a/target/linux/generic/hack-4.9/651-wireless_mesh_header.patch b/target/linux/generic/hack-4.9/651-wireless_mesh_header.patch deleted file mode 100644 index a4699ae8ed..0000000000 --- a/target/linux/generic/hack-4.9/651-wireless_mesh_header.patch +++ /dev/null @@ -1,24 +0,0 @@ -From 6d3bc769657b0ee7c7506dad9911111c4226a7ea Mon Sep 17 00:00:00 2001 -From: Imre Kaloz -Date: Fri, 7 Jul 2017 17:21:05 +0200 -Subject: mac80211: increase wireless mesh header size - -lede-commit 3d4466cfd8f75f717efdb1f96fdde3c70d865fc1 -Signed-off-by: Imre Kaloz ---- - include/linux/netdevice.h | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - ---- a/include/linux/netdevice.h -+++ b/include/linux/netdevice.h -@@ -137,8 +137,8 @@ static inline bool dev_xmit_complete(int - - #if defined(CONFIG_HYPERV_NET) - # define LL_MAX_HEADER 128 --#elif defined(CONFIG_WLAN) || IS_ENABLED(CONFIG_AX25) --# if defined(CONFIG_MAC80211_MESH) -+#elif defined(CONFIG_WLAN) || IS_ENABLED(CONFIG_AX25) || 1 -+# if defined(CONFIG_MAC80211_MESH) || 1 - # define LL_MAX_HEADER 128 - # else - # define LL_MAX_HEADER 96 diff --git a/target/linux/generic/hack-4.9/660-fq_codel_defaults.patch b/target/linux/generic/hack-4.9/660-fq_codel_defaults.patch deleted file mode 100644 index ea461e189d..0000000000 --- a/target/linux/generic/hack-4.9/660-fq_codel_defaults.patch +++ /dev/null @@ -1,27 +0,0 @@ -From a6ccb238939b25851474a279b20367fd24a0e816 Mon Sep 17 00:00:00 2001 -From: Felix Fietkau -Date: Fri, 7 Jul 2017 17:21:53 +0200 -Subject: hack: net: fq_codel: tune defaults for small devices - -Assume that x86_64 devices always have a big memory and do not need this -optimization compared to devices with only 32 MB or 64 MB RAM. - -Signed-off-by: Felix Fietkau ---- - net/sched/sch_fq_codel.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - ---- a/net/sched/sch_fq_codel.c -+++ b/net/sched/sch_fq_codel.c -@@ -485,7 +485,11 @@ static int fq_codel_init(struct Qdisc *s - - sch->limit = 10*1024; - q->flows_cnt = 1024; -+#ifdef CONFIG_X86_64 - q->memory_limit = 32 << 20; /* 32 MBytes */ -+#else -+ q->memory_limit = 4 << 20; /* 4 MBytes */ -+#endif - q->drop_batch_size = 64; - q->quantum = psched_mtu(qdisc_dev(sch)); - q->perturbation = prandom_u32(); diff --git a/target/linux/generic/hack-4.9/661-use_fq_codel_by_default.patch b/target/linux/generic/hack-4.9/661-use_fq_codel_by_default.patch deleted file mode 100644 index 34fc2a37c3..0000000000 --- a/target/linux/generic/hack-4.9/661-use_fq_codel_by_default.patch +++ /dev/null @@ -1,94 +0,0 @@ -From 1d418f7e88035ed7a94073f6354246c66e9193e9 Mon Sep 17 00:00:00 2001 -From: Felix Fietkau -Date: Fri, 7 Jul 2017 17:22:58 +0200 -Subject: fq_codel: switch default qdisc from pfifo_fast to fq_codel and remove pfifo_fast - -Signed-off-by: Felix Fietkau ---- - include/net/sch_generic.h | 3 ++- - net/sched/Kconfig | 3 ++- - net/sched/sch_api.c | 2 +- - net/sched/sch_fq_codel.c | 3 ++- - net/sched/sch_generic.c | 4 ++-- - 5 files changed, 9 insertions(+), 6 deletions(-) - ---- a/include/net/sch_generic.h -+++ b/include/net/sch_generic.h -@@ -339,12 +339,13 @@ extern struct Qdisc_ops noop_qdisc_ops; - extern struct Qdisc_ops pfifo_fast_ops; - extern struct Qdisc_ops mq_qdisc_ops; - extern struct Qdisc_ops noqueue_qdisc_ops; -+extern struct Qdisc_ops fq_codel_qdisc_ops; - extern const struct Qdisc_ops *default_qdisc_ops; - static inline const struct Qdisc_ops * - get_default_qdisc_ops(const struct net_device *dev, int ntx) - { - return ntx < dev->real_num_tx_queues ? -- default_qdisc_ops : &pfifo_fast_ops; -+ default_qdisc_ops : &fq_codel_qdisc_ops; - } - - struct Qdisc_class_common { ---- a/net/sched/Kconfig -+++ b/net/sched/Kconfig -@@ -3,8 +3,9 @@ - # - - menuconfig NET_SCHED -- bool "QoS and/or fair queueing" -+ def_bool y - select NET_SCH_FIFO -+ select NET_SCH_FQ_CODEL - ---help--- - When the kernel has several packets to send out over a network - device, it has to decide which ones to send first, which ones to ---- a/net/sched/sch_api.c -+++ b/net/sched/sch_api.c -@@ -1977,7 +1977,7 @@ static int __init pktsched_init(void) - return err; - } - -- register_qdisc(&pfifo_fast_ops); -+ register_qdisc(&fq_codel_qdisc_ops); - register_qdisc(&pfifo_qdisc_ops); - register_qdisc(&bfifo_qdisc_ops); - register_qdisc(&pfifo_head_drop_qdisc_ops); ---- a/net/sched/sch_fq_codel.c -+++ b/net/sched/sch_fq_codel.c -@@ -715,7 +715,7 @@ static const struct Qdisc_class_ops fq_c - .walk = fq_codel_walk, - }; - --static struct Qdisc_ops fq_codel_qdisc_ops __read_mostly = { -+struct Qdisc_ops fq_codel_qdisc_ops __read_mostly = { - .cl_ops = &fq_codel_class_ops, - .id = "fq_codel", - .priv_size = sizeof(struct fq_codel_sched_data), -@@ -730,6 +730,7 @@ static struct Qdisc_ops fq_codel_qdisc_o - .dump_stats = fq_codel_dump_stats, - .owner = THIS_MODULE, - }; -+EXPORT_SYMBOL(fq_codel_qdisc_ops); - - static int __init fq_codel_module_init(void) - { ---- a/net/sched/sch_generic.c -+++ b/net/sched/sch_generic.c -@@ -31,7 +31,7 @@ - #include - - /* Qdisc to use by default */ --const struct Qdisc_ops *default_qdisc_ops = &pfifo_fast_ops; -+const struct Qdisc_ops *default_qdisc_ops = &fq_codel_qdisc_ops; - EXPORT_SYMBOL(default_qdisc_ops); - - /* Main transmission queue. */ -@@ -760,7 +760,7 @@ static void attach_one_default_qdisc(str - void *_unused) - { - struct Qdisc *qdisc; -- const struct Qdisc_ops *ops = default_qdisc_ops; -+ const struct Qdisc_ops *ops = &fq_codel_qdisc_ops; - - if (dev->priv_flags & IFF_NO_QUEUE) - ops = &noqueue_qdisc_ops; diff --git a/target/linux/generic/hack-4.9/662-remove_pfifo_fast.patch b/target/linux/generic/hack-4.9/662-remove_pfifo_fast.patch deleted file mode 100644 index d9fba6288d..0000000000 --- a/target/linux/generic/hack-4.9/662-remove_pfifo_fast.patch +++ /dev/null @@ -1,159 +0,0 @@ -From b531d492d5ef1cf9dba0f4888eb5fd8624a6d762 Mon Sep 17 00:00:00 2001 -From: Felix Fietkau -Date: Fri, 7 Jul 2017 17:23:42 +0200 -Subject: net: sched: switch default qdisc from pfifo_fast to fq_codel and remove pfifo_fast - -Signed-off-by: Felix Fietkau ---- - net/sched/sch_generic.c | 140 ------------------------------------------------ - 1 file changed, 140 deletions(-) - ---- a/net/sched/sch_generic.c -+++ b/net/sched/sch_generic.c -@@ -449,146 +449,6 @@ struct Qdisc_ops noqueue_qdisc_ops __rea - .owner = THIS_MODULE, - }; - --static const u8 prio2band[TC_PRIO_MAX + 1] = { -- 1, 2, 2, 2, 1, 2, 0, 0 , 1, 1, 1, 1, 1, 1, 1, 1 --}; -- --/* 3-band FIFO queue: old style, but should be a bit faster than -- generic prio+fifo combination. -- */ -- --#define PFIFO_FAST_BANDS 3 -- --/* -- * Private data for a pfifo_fast scheduler containing: -- * - queues for the three band -- * - bitmap indicating which of the bands contain skbs -- */ --struct pfifo_fast_priv { -- u32 bitmap; -- struct qdisc_skb_head q[PFIFO_FAST_BANDS]; --}; -- --/* -- * Convert a bitmap to the first band number where an skb is queued, where: -- * bitmap=0 means there are no skbs on any band. -- * bitmap=1 means there is an skb on band 0. -- * bitmap=7 means there are skbs on all 3 bands, etc. -- */ --static const int bitmap2band[] = {-1, 0, 1, 0, 2, 0, 1, 0}; -- --static inline struct qdisc_skb_head *band2list(struct pfifo_fast_priv *priv, -- int band) --{ -- return priv->q + band; --} -- --static int pfifo_fast_enqueue(struct sk_buff *skb, struct Qdisc *qdisc, -- struct sk_buff **to_free) --{ -- if (qdisc->q.qlen < qdisc_dev(qdisc)->tx_queue_len) { -- int band = prio2band[skb->priority & TC_PRIO_MAX]; -- struct pfifo_fast_priv *priv = qdisc_priv(qdisc); -- struct qdisc_skb_head *list = band2list(priv, band); -- -- priv->bitmap |= (1 << band); -- qdisc->q.qlen++; -- return __qdisc_enqueue_tail(skb, qdisc, list); -- } -- -- return qdisc_drop(skb, qdisc, to_free); --} -- --static struct sk_buff *pfifo_fast_dequeue(struct Qdisc *qdisc) --{ -- struct pfifo_fast_priv *priv = qdisc_priv(qdisc); -- int band = bitmap2band[priv->bitmap]; -- -- if (likely(band >= 0)) { -- struct qdisc_skb_head *qh = band2list(priv, band); -- struct sk_buff *skb = __qdisc_dequeue_head(qh); -- -- if (likely(skb != NULL)) { -- qdisc_qstats_backlog_dec(qdisc, skb); -- qdisc_bstats_update(qdisc, skb); -- } -- -- qdisc->q.qlen--; -- if (qh->qlen == 0) -- priv->bitmap &= ~(1 << band); -- -- return skb; -- } -- -- return NULL; --} -- --static struct sk_buff *pfifo_fast_peek(struct Qdisc *qdisc) --{ -- struct pfifo_fast_priv *priv = qdisc_priv(qdisc); -- int band = bitmap2band[priv->bitmap]; -- -- if (band >= 0) { -- struct qdisc_skb_head *qh = band2list(priv, band); -- -- return qh->head; -- } -- -- return NULL; --} -- --static void pfifo_fast_reset(struct Qdisc *qdisc) --{ -- int prio; -- struct pfifo_fast_priv *priv = qdisc_priv(qdisc); -- -- for (prio = 0; prio < PFIFO_FAST_BANDS; prio++) -- __qdisc_reset_queue(band2list(priv, prio)); -- -- priv->bitmap = 0; -- qdisc->qstats.backlog = 0; -- qdisc->q.qlen = 0; --} -- --static int pfifo_fast_dump(struct Qdisc *qdisc, struct sk_buff *skb) --{ -- struct tc_prio_qopt opt = { .bands = PFIFO_FAST_BANDS }; -- -- memcpy(&opt.priomap, prio2band, TC_PRIO_MAX + 1); -- if (nla_put(skb, TCA_OPTIONS, sizeof(opt), &opt)) -- goto nla_put_failure; -- return skb->len; -- --nla_put_failure: -- return -1; --} -- --static int pfifo_fast_init(struct Qdisc *qdisc, struct nlattr *opt) --{ -- int prio; -- struct pfifo_fast_priv *priv = qdisc_priv(qdisc); -- -- for (prio = 0; prio < PFIFO_FAST_BANDS; prio++) -- qdisc_skb_head_init(band2list(priv, prio)); -- -- /* Can by-pass the queue discipline */ -- qdisc->flags |= TCQ_F_CAN_BYPASS; -- return 0; --} -- --struct Qdisc_ops pfifo_fast_ops __read_mostly = { -- .id = "pfifo_fast", -- .priv_size = sizeof(struct pfifo_fast_priv), -- .enqueue = pfifo_fast_enqueue, -- .dequeue = pfifo_fast_dequeue, -- .peek = pfifo_fast_peek, -- .init = pfifo_fast_init, -- .reset = pfifo_fast_reset, -- .dump = pfifo_fast_dump, -- .owner = THIS_MODULE, --}; --EXPORT_SYMBOL(pfifo_fast_ops); -- - static struct lock_class_key qdisc_tx_busylock; - static struct lock_class_key qdisc_running_key; - diff --git a/target/linux/generic/hack-4.9/700-swconfig_switch_drivers.patch b/target/linux/generic/hack-4.9/700-swconfig_switch_drivers.patch deleted file mode 100644 index 241a47c863..0000000000 --- a/target/linux/generic/hack-4.9/700-swconfig_switch_drivers.patch +++ /dev/null @@ -1,150 +0,0 @@ -From 36e516290611e613aa92996cb4339561452695b4 Mon Sep 17 00:00:00 2001 -From: Felix Fietkau -Date: Fri, 7 Jul 2017 17:24:23 +0200 -Subject: net: swconfig: adds librecmc switch layer - -Signed-off-by: Felix Fietkau ---- - drivers/net/phy/Kconfig | 83 +++++++++++++++++++++++++++++++++++++++++++++++ - drivers/net/phy/Makefile | 15 +++++++++ - include/uapi/linux/Kbuild | 1 + - 3 files changed, 99 insertions(+) - ---- a/drivers/net/phy/Kconfig -+++ b/drivers/net/phy/Kconfig -@@ -147,6 +147,89 @@ config MDIO_XGENE - This module provides a driver for the MDIO busses found in the - APM X-Gene SoC's. - -+comment "Switch configuration API + drivers" -+ -+config SWCONFIG -+ tristate "Switch configuration API" -+ ---help--- -+ Switch configuration API using netlink. This allows -+ you to configure the VLAN features of certain switches. -+ -+config SWCONFIG_LEDS -+ bool "Switch LED trigger support" -+ depends on (SWCONFIG && LEDS_TRIGGERS) -+ -+config ADM6996_PHY -+ tristate "Driver for ADM6996 switches" -+ select SWCONFIG -+ ---help--- -+ Currently supports the ADM6996FC and ADM6996M switches. -+ Support for FC is very limited. -+ -+config AR8216_PHY -+ tristate "Driver for Atheros AR8216 switches" -+ select ETHERNET_PACKET_MANGLE -+ select SWCONFIG -+ -+config AR8216_PHY_LEDS -+ bool "Atheros AR8216 switch LED support" -+ depends on (AR8216_PHY && LEDS_CLASS) -+ -+source "drivers/net/phy/b53/Kconfig" -+ -+config IP17XX_PHY -+ tristate "Driver for IC+ IP17xx switches" -+ select SWCONFIG -+ -+config MVSWITCH_PHY -+ tristate "Driver for Marvell 88E6060 switches" -+ select ETHERNET_PACKET_MANGLE -+ -+config MVSW61XX_PHY -+ tristate "Driver for Marvell 88E6171/6172 switches" -+ select SWCONFIG -+ -+config PSB6970_PHY -+ tristate "Lantiq XWAY Tantos (PSB6970) Ethernet switch" -+ select SWCONFIG -+ select ETHERNET_PACKET_MANGLE -+ -+config RTL8306_PHY -+ tristate "Driver for Realtek RTL8306S switches" -+ select SWCONFIG -+ -+config RTL8366_SMI -+ tristate "Driver for the RTL8366 SMI interface" -+ depends on GPIOLIB -+ ---help--- -+ This module implements the SMI interface protocol which is used -+ by some RTL8366 ethernet switch devices via the generic GPIO API. -+ -+if RTL8366_SMI -+ -+config RTL8366_SMI_DEBUG_FS -+ bool "RTL8366 SMI interface debugfs support" -+ depends on DEBUG_FS -+ default n -+ -+config RTL8366S_PHY -+ tristate "Driver for the Realtek RTL8366S switch" -+ select SWCONFIG -+ -+config RTL8366RB_PHY -+ tristate "Driver for the Realtek RTL8366RB switch" -+ select SWCONFIG -+ -+config RTL8367_PHY -+ tristate "Driver for the Realtek RTL8367R/M switches" -+ select SWCONFIG -+ -+config RTL8367B_PHY -+ tristate "Driver fot the Realtek RTL8367R-VB switch" -+ select SWCONFIG -+ -+endif # RTL8366_SMI -+ - comment "MII PHY device drivers" - - config AMD_PHY ---- a/drivers/net/phy/Makefile -+++ b/drivers/net/phy/Makefile -@@ -5,6 +5,21 @@ libphy-$(CONFIG_SWPHY) += swphy.o - - obj-$(CONFIG_PHYLIB) += libphy.o - -+obj-$(CONFIG_SWCONFIG) += swconfig.o -+obj-$(CONFIG_ADM6996_PHY) += adm6996.o -+obj-$(CONFIG_AR8216_PHY) += ar8216.o ar8327.o -+obj-$(CONFIG_SWCONFIG_B53) += b53/ -+obj-$(CONFIG_IP17XX_PHY) += ip17xx.o -+obj-$(CONFIG_MVSWITCH_PHY) += mvswitch.o -+obj-$(CONFIG_MVSW61XX_PHY) += mvsw61xx.o -+obj-$(CONFIG_PSB6970_PHY) += psb6970.o -+obj-$(CONFIG_RTL8306_PHY) += rtl8306.o -+obj-$(CONFIG_RTL8366_SMI) += rtl8366_smi.o -+obj-$(CONFIG_RTL8366S_PHY) += rtl8366s.o -+obj-$(CONFIG_RTL8366RB_PHY) += rtl8366rb.o -+obj-$(CONFIG_RTL8367_PHY) += rtl8367.o -+obj-$(CONFIG_RTL8367B_PHY) += rtl8367b.o -+ - obj-$(CONFIG_MDIO_BCM_IPROC) += mdio-bcm-iproc.o - obj-$(CONFIG_MDIO_BCM_UNIMAC) += mdio-bcm-unimac.o - obj-$(CONFIG_MDIO_BITBANG) += mdio-bitbang.o ---- a/include/uapi/linux/Kbuild -+++ b/include/uapi/linux/Kbuild -@@ -399,6 +399,7 @@ header-y += stddef.h - header-y += string.h - header-y += suspend_ioctls.h - header-y += swab.h -+header-y += switch.h - header-y += synclink.h - header-y += sync_file.h - header-y += sysctl.h ---- a/include/linux/platform_data/b53.h -+++ b/include/linux/platform_data/b53.h -@@ -25,6 +25,9 @@ struct b53_platform_data { - u32 chip_id; - u16 enabled_ports; - -+ /* allow to specify an ethX alias */ -+ const char *alias; -+ - /* only used by MMAP'd driver */ - unsigned big_endian:1; - void __iomem *regs; diff --git a/target/linux/generic/hack-4.9/702-phy_add_aneg_done_function.patch b/target/linux/generic/hack-4.9/702-phy_add_aneg_done_function.patch deleted file mode 100644 index 1862375be2..0000000000 --- a/target/linux/generic/hack-4.9/702-phy_add_aneg_done_function.patch +++ /dev/null @@ -1,27 +0,0 @@ ---- a/include/linux/phy.h -+++ b/include/linux/phy.h -@@ -495,6 +495,12 @@ struct phy_driver { - /* Determines the negotiated speed and duplex */ - int (*read_status)(struct phy_device *phydev); - -+ /* -+ * Update the value in phydev->link to reflect the -+ * current link value -+ */ -+ int (*update_link)(struct phy_device *phydev); -+ - /* Clears any pending interrupts */ - int (*ack_interrupt)(struct phy_device *phydev); - ---- a/drivers/net/phy/phy_device.c -+++ b/drivers/net/phy/phy_device.c -@@ -1309,6 +1309,9 @@ int genphy_update_link(struct phy_device - { - int status; - -+ if (phydev->drv && phydev->drv->update_link) -+ return phydev->drv->update_link(phydev); -+ - /* Do a fake read */ - status = phy_read(phydev, MII_BMSR); - if (status < 0) diff --git a/target/linux/generic/hack-4.9/710-phy-add-mdio_register_board_info.patch b/target/linux/generic/hack-4.9/710-phy-add-mdio_register_board_info.patch deleted file mode 100644 index 217cf4a486..0000000000 --- a/target/linux/generic/hack-4.9/710-phy-add-mdio_register_board_info.patch +++ /dev/null @@ -1,197 +0,0 @@ ---- a/drivers/net/phy/mdio_bus.c -+++ b/drivers/net/phy/mdio_bus.c -@@ -80,6 +80,8 @@ bool mdiobus_is_registered_device(struct - } - EXPORT_SYMBOL(mdiobus_is_registered_device); - -+#include "mdio-boardinfo.h" -+ - /** - * mdiobus_alloc_size - allocate a mii_bus structure - * @size: extra amount of memory to allocate for private storage. -@@ -401,6 +403,17 @@ void mdiobus_free(struct mii_bus *bus) - } - EXPORT_SYMBOL(mdiobus_free); - -+static void mdiobus_setup_phydev_from_boardinfo(struct mii_bus *bus, -+ struct phy_device *phydev, -+ struct mdio_board_info *bi) -+{ -+ if (strcmp(bus->id, bi->bus_id) || -+ bi->phy_addr != phydev->mdio.addr) -+ return; -+ -+ phydev->mdio.dev.platform_data = (void *) bi->platform_data; -+} -+ - /** - * mdiobus_scan - scan a bus for MDIO devices. - * @bus: mii_bus to scan -@@ -416,6 +429,7 @@ EXPORT_SYMBOL(mdiobus_free); - struct phy_device *mdiobus_scan(struct mii_bus *bus, int addr) - { - struct phy_device *phydev; -+ struct mdio_board_entry *be; - int err; - - phydev = get_phy_device(bus, addr, false); -@@ -428,6 +442,12 @@ struct phy_device *mdiobus_scan(struct m - */ - of_mdiobus_link_mdiodev(bus, &phydev->mdio); - -+ mutex_lock(&__mdio_board_lock); -+ list_for_each_entry(be, &__mdio_board_list, list) -+ mdiobus_setup_phydev_from_boardinfo(bus, phydev, -+ &be->board_info); -+ mutex_unlock(&__mdio_board_lock); -+ - err = phy_device_register(phydev); - if (err) { - phy_device_free(phydev); ---- a/include/linux/phy.h -+++ b/include/linux/phy.h -@@ -870,6 +870,23 @@ void mdio_bus_exit(void); - - extern struct bus_type mdio_bus_type; - -+struct mdio_board_info { -+ const char *bus_id; -+ int phy_addr; -+ -+ const void *platform_data; -+}; -+ -+#ifdef CONFIG_MDIO_BOARDINFO -+int mdiobus_register_board_info(const struct mdio_board_info *info, unsigned n); -+#else -+static inline int -+mdiobus_register_board_info(const struct mdio_board_info *info, unsigned n) -+{ -+ return 0; -+} -+#endif -+ - /** - * module_phy_driver() - Helper macro for registering PHY drivers - * @__phy_drivers: array of PHY drivers to register ---- a/drivers/net/phy/Kconfig -+++ b/drivers/net/phy/Kconfig -@@ -149,6 +149,10 @@ config MDIO_XGENE - - comment "Switch configuration API + drivers" - -+config MDIO_BOARDINFO -+ bool -+ default y -+ - config SWCONFIG - tristate "Switch configuration API" - ---help--- ---- a/drivers/net/phy/Makefile -+++ b/drivers/net/phy/Makefile -@@ -3,6 +3,8 @@ - libphy-y := phy.o phy_device.o mdio_bus.o mdio_device.o - libphy-$(CONFIG_SWPHY) += swphy.o - -+obj-$(CONFIG_MDIO_BOARDINFO) += mdio-boardinfo.o -+ - obj-$(CONFIG_PHYLIB) += libphy.o - - obj-$(CONFIG_SWCONFIG) += swconfig.o ---- /dev/null -+++ b/drivers/net/phy/mdio-boardinfo.c -@@ -0,0 +1,58 @@ -+/* -+ * mdio-boardinfo.c - collect pre-declarations of PHY devices -+ * -+ * 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 -+#include -+#include -+#include -+#include -+#include -+ -+#include "mdio-boardinfo.h" -+ -+/* -+ * These symbols are exported ONLY FOR the mdio_bus component. -+ * No other users will be supported. -+ */ -+ -+LIST_HEAD(__mdio_board_list); -+EXPORT_SYMBOL_GPL(__mdio_board_list); -+ -+DEFINE_MUTEX(__mdio_board_lock); -+EXPORT_SYMBOL_GPL(__mdio_board_lock); -+ -+/** -+ * mdio_register_board_info - register PHY devices for a given board -+ * @info: array of chip descriptors -+ * @n: how many descriptors are provided -+ * Context: can sleep -+ * -+ * The board info passed can safely be __initdata ... but be careful of -+ * any embedded pointers (platform_data, etc), they're copied as-is. -+ */ -+int __init -+mdiobus_register_board_info(struct mdio_board_info const *info, unsigned n) -+{ -+ struct mdio_board_entry *be; -+ int i; -+ -+ be = kzalloc(n * sizeof(*be), GFP_KERNEL); -+ if (!be) -+ return -ENOMEM; -+ -+ for (i = 0; i < n; i++, be++, info++) { -+ memcpy(&be->board_info, info, sizeof(*info)); -+ mutex_lock(&__mdio_board_lock); -+ list_add_tail(&be->list, &__mdio_board_list); -+ mutex_unlock(&__mdio_board_lock); -+ } -+ -+ return 0; -+} ---- /dev/null -+++ b/drivers/net/phy/mdio-boardinfo.h -@@ -0,0 +1,22 @@ -+/* -+ * mdio-boardinfo.h - boardinfo interface internal to the mdio_bus component -+ * -+ * 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 -+ -+struct mdio_board_entry { -+ struct list_head list; -+ struct mdio_board_info board_info; -+}; -+ -+/* __mdio_board_lock protects __mdio_board_list -+ * only mdio_bus components are allowed to use these symbols. -+ */ -+extern struct mutex __mdio_board_lock; -+extern struct list_head __mdio_board_list; ---- a/drivers/net/Makefile -+++ b/drivers/net/Makefile -@@ -17,7 +17,7 @@ obj-$(CONFIG_MII) += mii.o - obj-$(CONFIG_MDIO) += mdio.o - obj-$(CONFIG_NET) += Space.o loopback.o - obj-$(CONFIG_NETCONSOLE) += netconsole.o --obj-$(CONFIG_PHYLIB) += phy/ -+obj-y += phy/ - obj-$(CONFIG_RIONET) += rionet.o - obj-$(CONFIG_NET_TEAM) += team/ - obj-$(CONFIG_TUN) += tun.o diff --git a/target/linux/generic/hack-4.9/721-phy_packets.patch b/target/linux/generic/hack-4.9/721-phy_packets.patch deleted file mode 100644 index d22c873032..0000000000 --- a/target/linux/generic/hack-4.9/721-phy_packets.patch +++ /dev/null @@ -1,176 +0,0 @@ -From ffe387740bbe88dd88bbe04d6375902708003d6e Mon Sep 17 00:00:00 2001 -From: Felix Fietkau -Date: Fri, 7 Jul 2017 17:25:00 +0200 -Subject: net: add packet mangeling patch - -Signed-off-by: Felix Fietkau ---- - include/linux/netdevice.h | 11 +++++++++++ - include/linux/skbuff.h | 14 ++++---------- - net/Kconfig | 6 ++++++ - net/core/dev.c | 18 ++++++++++++++---- - net/core/skbuff.c | 17 +++++++++++++++++ - net/ethernet/eth.c | 6 ++++++ - 6 files changed, 58 insertions(+), 14 deletions(-) - ---- a/include/linux/netdevice.h -+++ b/include/linux/netdevice.h -@@ -1400,6 +1400,7 @@ enum netdev_priv_flags { - IFF_PHONY_HEADROOM = 1<<26, - IFF_MACSEC = 1<<27, - IFF_L3MDEV_RX_HANDLER = 1<<28, -+ IFF_NO_IP_ALIGN = 1<<29, - }; - - #define IFF_802_1Q_VLAN IFF_802_1Q_VLAN -@@ -1430,6 +1431,7 @@ enum netdev_priv_flags { - #define IFF_RXFH_CONFIGURED IFF_RXFH_CONFIGURED - #define IFF_MACSEC IFF_MACSEC - #define IFF_L3MDEV_RX_HANDLER IFF_L3MDEV_RX_HANDLER -+#define IFF_NO_IP_ALIGN IFF_NO_IP_ALIGN - - /** - * struct net_device - The DEVICE structure. -@@ -1716,6 +1718,11 @@ struct net_device { - const struct ndisc_ops *ndisc_ops; - #endif - -+#ifdef CONFIG_ETHERNET_PACKET_MANGLE -+ void (*eth_mangle_rx)(struct net_device *dev, struct sk_buff *skb); -+ struct sk_buff *(*eth_mangle_tx)(struct net_device *dev, struct sk_buff *skb); -+#endif -+ - const struct header_ops *header_ops; - - unsigned int flags; -@@ -1783,6 +1790,10 @@ struct net_device { - struct mpls_dev __rcu *mpls_ptr; - #endif - -+#ifdef CONFIG_ETHERNET_PACKET_MANGLE -+ void *phy_ptr; /* PHY device specific data */ -+#endif -+ - /* - * Cache lines mostly used on receive path (including eth_type_trans()) - */ ---- a/include/linux/skbuff.h -+++ b/include/linux/skbuff.h -@@ -2339,6 +2339,10 @@ static inline int pskb_trim(struct sk_bu - return (len < skb->len) ? __pskb_trim(skb, len) : 0; - } - -+extern struct sk_buff *__netdev_alloc_skb_ip_align(struct net_device *dev, -+ unsigned int length, gfp_t gfp); -+ -+ - /** - * pskb_trim_unique - remove end from a paged unique (not cloned) buffer - * @skb: buffer to alter -@@ -2459,16 +2463,6 @@ static inline struct sk_buff *dev_alloc_ - } - - --static inline struct sk_buff *__netdev_alloc_skb_ip_align(struct net_device *dev, -- unsigned int length, gfp_t gfp) --{ -- struct sk_buff *skb = __netdev_alloc_skb(dev, length + NET_IP_ALIGN, gfp); -- -- if (NET_IP_ALIGN && skb) -- skb_reserve(skb, NET_IP_ALIGN); -- return skb; --} -- - static inline struct sk_buff *netdev_alloc_skb_ip_align(struct net_device *dev, - unsigned int length) - { ---- a/net/Kconfig -+++ b/net/Kconfig -@@ -25,6 +25,12 @@ menuconfig NET - - if NET - -+config ETHERNET_PACKET_MANGLE -+ bool -+ help -+ This option can be selected by phy drivers that need to mangle -+ packets going in or out of an ethernet device. -+ - config WANT_COMPAT_NETLINK_MESSAGES - bool - help ---- a/net/core/dev.c -+++ b/net/core/dev.c -@@ -2972,10 +2972,20 @@ static int xmit_one(struct sk_buff *skb, - if (!list_empty(&ptype_all) || !list_empty(&dev->ptype_all)) - dev_queue_xmit_nit(skb, dev); - -- len = skb->len; -- trace_net_dev_start_xmit(skb, dev); -- rc = netdev_start_xmit(skb, dev, txq, more); -- trace_net_dev_xmit(skb, rc, dev, len); -+#ifdef CONFIG_ETHERNET_PACKET_MANGLE -+ if (!dev->eth_mangle_tx || -+ (skb = dev->eth_mangle_tx(dev, skb)) != NULL) -+#else -+ if (1) -+#endif -+ { -+ len = skb->len; -+ trace_net_dev_start_xmit(skb, dev); -+ rc = netdev_start_xmit(skb, dev, txq, more); -+ trace_net_dev_xmit(skb, rc, dev, len); -+ } else { -+ rc = NETDEV_TX_OK; -+ } - - return rc; - } ---- a/net/core/skbuff.c -+++ b/net/core/skbuff.c -@@ -64,6 +64,7 @@ - #include - #include - #include -+#include - - #include - #include -@@ -533,6 +534,22 @@ skb_fail: - } - EXPORT_SYMBOL(__napi_alloc_skb); - -+struct sk_buff *__netdev_alloc_skb_ip_align(struct net_device *dev, -+ unsigned int length, gfp_t gfp) -+{ -+ struct sk_buff *skb = __netdev_alloc_skb(dev, length + NET_IP_ALIGN, gfp); -+ -+#ifdef CONFIG_ETHERNET_PACKET_MANGLE -+ if (dev && (dev->priv_flags & IFF_NO_IP_ALIGN)) -+ return skb; -+#endif -+ -+ if (NET_IP_ALIGN && skb) -+ skb_reserve(skb, NET_IP_ALIGN); -+ return skb; -+} -+EXPORT_SYMBOL(__netdev_alloc_skb_ip_align); -+ - void skb_add_rx_frag(struct sk_buff *skb, int i, struct page *page, int off, - int size, unsigned int truesize) - { ---- a/net/ethernet/eth.c -+++ b/net/ethernet/eth.c -@@ -171,6 +171,12 @@ __be16 eth_type_trans(struct sk_buff *sk - const struct ethhdr *eth; - - skb->dev = dev; -+ -+#ifdef CONFIG_ETHERNET_PACKET_MANGLE -+ if (dev->eth_mangle_rx) -+ dev->eth_mangle_rx(dev, skb); -+#endif -+ - skb_reset_mac_header(skb); - - eth = (struct ethhdr *)skb->data; diff --git a/target/linux/generic/hack-4.9/773-bgmac-add-srab-switch.patch b/target/linux/generic/hack-4.9/773-bgmac-add-srab-switch.patch deleted file mode 100644 index 55ebae7143..0000000000 --- a/target/linux/generic/hack-4.9/773-bgmac-add-srab-switch.patch +++ /dev/null @@ -1,98 +0,0 @@ -From 3cb240533ab787899dc7f17aa7d6c5b4810e2e58 Mon Sep 17 00:00:00 2001 -From: Hauke Mehrtens -Date: Fri, 7 Jul 2017 17:26:01 +0200 -Subject: bcm53xx: bgmac: use srab switch driver - -use the srab switch driver on these SoCs. - -Signed-off-by: Hauke Mehrtens ---- - drivers/net/ethernet/broadcom/bgmac-bcma.c | 1 + - drivers/net/ethernet/broadcom/bgmac.c | 24 ++++++++++++++++++++++++ - drivers/net/ethernet/broadcom/bgmac.h | 4 ++++ - 3 files changed, 29 insertions(+) - ---- a/drivers/net/ethernet/broadcom/bgmac-bcma.c -+++ b/drivers/net/ethernet/broadcom/bgmac-bcma.c -@@ -243,6 +243,7 @@ static int bgmac_probe(struct bcma_devic - bgmac->feature_flags |= BGMAC_FEAT_CLKCTLST; - bgmac->feature_flags |= BGMAC_FEAT_NO_RESET; - bgmac->feature_flags |= BGMAC_FEAT_FORCE_SPEED_2500; -+ bgmac->feature_flags |= BGMAC_FEAT_SRAB; - break; - case BCMA_CHIP_ID_BCM53573: - bgmac->feature_flags |= BGMAC_FEAT_CLKCTLST; ---- a/drivers/net/ethernet/broadcom/bgmac.c -+++ b/drivers/net/ethernet/broadcom/bgmac.c -@@ -11,6 +11,7 @@ - - #include - #include -+#include - #include - #include "bgmac.h" - -@@ -1388,6 +1389,17 @@ static const struct ethtool_ops bgmac_et - .set_link_ksettings = phy_ethtool_set_link_ksettings, - }; - -+static struct b53_platform_data bgmac_b53_pdata = { -+}; -+ -+static struct platform_device bgmac_b53_dev = { -+ .name = "b53-srab-switch", -+ .id = -1, -+ .dev = { -+ .platform_data = &bgmac_b53_pdata, -+ }, -+}; -+ - /************************************************** - * MII - **************************************************/ -@@ -1534,6 +1546,14 @@ int bgmac_enet_probe(struct bgmac *bgmac - net_dev->hw_features = net_dev->features; - net_dev->vlan_features = net_dev->features; - -+ if ((bgmac->feature_flags & BGMAC_FEAT_SRAB) && !bgmac_b53_pdata.regs) { -+ bgmac_b53_pdata.regs = ioremap_nocache(0x18007000, 0x1000); -+ -+ err = platform_device_register(&bgmac_b53_dev); -+ if (!err) -+ bgmac->b53_device = &bgmac_b53_dev; -+ } -+ - err = register_netdev(bgmac->net_dev); - if (err) { - dev_err(bgmac->dev, "Cannot register net device\n"); -@@ -1556,6 +1576,10 @@ EXPORT_SYMBOL_GPL(bgmac_enet_probe); - - void bgmac_enet_remove(struct bgmac *bgmac) - { -+ if (bgmac->b53_device) -+ platform_device_unregister(&bgmac_b53_dev); -+ bgmac->b53_device = NULL; -+ - unregister_netdev(bgmac->net_dev); - phy_disconnect(bgmac->net_dev->phydev); - netif_napi_del(&bgmac->napi); ---- a/drivers/net/ethernet/broadcom/bgmac.h -+++ b/drivers/net/ethernet/broadcom/bgmac.h -@@ -409,6 +409,7 @@ - #define BGMAC_FEAT_CC4_IF_SW_TYPE BIT(17) - #define BGMAC_FEAT_CC4_IF_SW_TYPE_RGMII BIT(18) - #define BGMAC_FEAT_CC7_IF_TYPE_RGMII BIT(19) -+#define BGMAC_FEAT_SRAB BIT(20) - - struct bgmac_slot_info { - union { -@@ -513,6 +514,9 @@ struct bgmac { - u32 (*get_bus_clock)(struct bgmac *bgmac); - void (*cmn_maskset32)(struct bgmac *bgmac, u16 offset, u32 mask, - u32 set); -+ -+ /* platform device for associated switch */ -+ struct platform_device *b53_device; - }; - - struct bgmac *bgmac_alloc(struct device *dev); diff --git a/target/linux/generic/hack-4.9/835-misc-owl_loader.patch b/target/linux/generic/hack-4.9/835-misc-owl_loader.patch deleted file mode 100644 index 07cd4e580a..0000000000 --- a/target/linux/generic/hack-4.9/835-misc-owl_loader.patch +++ /dev/null @@ -1,52 +0,0 @@ -From dd36f935973d91644449bd9749f6062a2bed821b Mon Sep 17 00:00:00 2001 -From: Christian Lamparter -Date: Fri, 7 Jul 2017 17:26:46 +0200 -Subject: misc: owl-loader for delayed Atheros ath9k fixup - -Some devices (like the Cisco Meraki Z1 Cloud Managed Teleworker Gateway) -need to be able to initialize the PCIe wifi device. Normally, this is done -during the early stages of booting linux, because the necessary init code -is read from the memory mapped SPI and passed to pci_enable_ath9k_fixup. -However,this isn't possible for devices which have the init code for the -Atheros chip stored on NAND in an UBI volume. Hence, this module can be -used to initialze the chip when the user-space is ready to extract the -init code. - -Signed-off-by: Martin Blumenstingl -Signed-off-by: Christian Lamparter ---- - drivers/misc/Kconfig | 12 ++++++++++++ - drivers/misc/Makefile | 1 + - 2 files changed, 13 insertions(+) - ---- a/drivers/misc/Kconfig -+++ b/drivers/misc/Kconfig -@@ -151,6 +151,18 @@ config SGI_IOC4 - If you have an SGI Altix with an IOC4-based card say Y. - Otherwise say N. - -+config OWL_LOADER -+ tristate "Owl loader for initializing Atheros PCI(e) Wifi chips" -+ depends on PCI -+ ---help--- -+ This kernel module helps to initialize certain Qualcomm -+ Atheros' PCI(e) Wifi chips, which have the init data -+ (which contains the PCI device ID for example) stored -+ together with the calibration data in the file system. -+ -+ This is necessary for devices like the Cisco Meraki Z1, say M. -+ Otherwise say N. -+ - config TIFM_CORE - tristate "TI Flash Media interface support" - depends on PCI ---- a/drivers/misc/Makefile -+++ b/drivers/misc/Makefile -@@ -12,6 +12,7 @@ obj-$(CONFIG_ATMEL_TCLIB) += atmel_tclib - obj-$(CONFIG_DUMMY_IRQ) += dummy-irq.o - obj-$(CONFIG_ICS932S401) += ics932s401.o - obj-$(CONFIG_LKDTM) += lkdtm.o -+obj-$(CONFIG_OWL_LOADER) += owl-loader.o - obj-$(CONFIG_TIFM_CORE) += tifm_core.o - obj-$(CONFIG_TIFM_7XX1) += tifm_7xx1.o - obj-$(CONFIG_PHANTOM) += phantom.o diff --git a/target/linux/generic/hack-4.9/901-debloat_sock_diag.patch b/target/linux/generic/hack-4.9/901-debloat_sock_diag.patch deleted file mode 100644 index 1d33ab3e6f..0000000000 --- a/target/linux/generic/hack-4.9/901-debloat_sock_diag.patch +++ /dev/null @@ -1,95 +0,0 @@ -From 3b6115d6b57a263bdc8c9b1df273bd4a7955eead Mon Sep 17 00:00:00 2001 -From: Felix Fietkau -Date: Sat, 8 Jul 2017 08:16:31 +0200 -Subject: debloat: add some debloat patches, strip down procfs and make O_DIRECT support optional, saves ~15K after lzma on MIPS - -Signed-off-by: Felix Fietkau ---- - net/Kconfig | 3 +++ - net/core/Makefile | 3 ++- - net/core/sock.c | 2 ++ - net/ipv4/Kconfig | 1 + - net/netlink/Kconfig | 1 + - net/packet/Kconfig | 1 + - net/unix/Kconfig | 1 + - 7 files changed, 11 insertions(+), 1 deletion(-) - ---- a/net/Kconfig -+++ b/net/Kconfig -@@ -95,6 +95,9 @@ source "net/netlabel/Kconfig" - - endif # if INET - -+config SOCK_DIAG -+ bool -+ - config NETWORK_SECMARK - bool "Security Marking" - help ---- a/net/core/Makefile -+++ b/net/core/Makefile -@@ -9,8 +9,9 @@ obj-$(CONFIG_SYSCTL) += sysctl_net_core. - - obj-y += dev.o ethtool.o dev_addr_lists.o dst.o netevent.o \ - neighbour.o rtnetlink.o utils.o link_watch.o filter.o \ -- sock_diag.o dev_ioctl.o tso.o sock_reuseport.o -+ dev_ioctl.o tso.o sock_reuseport.o - -+obj-$(CONFIG_SOCK_DIAG) += sock_diag.o - obj-$(CONFIG_XFRM) += flow.o - obj-y += net-sysfs.o - obj-$(CONFIG_PROC_FS) += net-procfs.o ---- a/net/core/sock.c -+++ b/net/core/sock.c -@@ -1458,9 +1458,11 @@ void sk_destruct(struct sock *sk) - - static void __sk_free(struct sock *sk) - { -+#ifdef CONFIG_SOCK_DIAG - if (unlikely(sk->sk_net_refcnt && sock_diag_has_destroy_listeners(sk))) - sock_diag_broadcast_destroy(sk); - else -+#endif - sk_destruct(sk); - } - ---- a/net/ipv4/Kconfig -+++ b/net/ipv4/Kconfig -@@ -408,6 +408,7 @@ config INET_XFRM_MODE_BEET - - config INET_DIAG - tristate "INET: socket monitoring interface" -+ select SOCK_DIAG - default y - ---help--- - Support for INET (TCP, DCCP, etc) socket monitoring interface used by ---- a/net/netlink/Kconfig -+++ b/net/netlink/Kconfig -@@ -4,6 +4,7 @@ - - config NETLINK_DIAG - tristate "NETLINK: socket monitoring interface" -+ select SOCK_DIAG - default n - ---help--- - Support for NETLINK socket monitoring interface used by the ss tool. ---- a/net/packet/Kconfig -+++ b/net/packet/Kconfig -@@ -18,6 +18,7 @@ config PACKET - config PACKET_DIAG - tristate "Packet: sockets monitoring interface" - depends on PACKET -+ select SOCK_DIAG - default n - ---help--- - Support for PF_PACKET sockets monitoring interface used by the ss tool. ---- a/net/unix/Kconfig -+++ b/net/unix/Kconfig -@@ -22,6 +22,7 @@ config UNIX - config UNIX_DIAG - tristate "UNIX: socket monitoring interface" - depends on UNIX -+ select SOCK_DIAG - default n - ---help--- - Support for UNIX socket monitoring interface used by the ss tool. diff --git a/target/linux/generic/hack-4.9/902-debloat_proc.patch b/target/linux/generic/hack-4.9/902-debloat_proc.patch deleted file mode 100644 index 91d1d28351..0000000000 --- a/target/linux/generic/hack-4.9/902-debloat_proc.patch +++ /dev/null @@ -1,406 +0,0 @@ -From 9e3f1d0805b2d919904dd9a4ff0d956314cc3cba Mon Sep 17 00:00:00 2001 -From: Felix Fietkau -Date: Sat, 8 Jul 2017 08:20:09 +0200 -Subject: debloat: procfs - -Signed-off-by: Felix Fietkau ---- - fs/locks.c | 2 ++ - fs/proc/Kconfig | 5 +++++ - fs/proc/consoles.c | 3 +++ - fs/proc/proc_tty.c | 11 ++++++++++- - include/net/snmp.h | 18 +++++++++++++++++- - ipc/msg.c | 3 +++ - ipc/sem.c | 2 ++ - ipc/shm.c | 2 ++ - ipc/util.c | 3 +++ - kernel/exec_domain.c | 2 ++ - kernel/irq/proc.c | 9 +++++++++ - kernel/time/timer_list.c | 2 ++ - mm/vmalloc.c | 2 ++ - mm/vmstat.c | 8 +++++--- - net/8021q/vlanproc.c | 6 ++++++ - net/core/net-procfs.c | 18 ++++++++++++------ - net/core/sock.c | 2 ++ - net/ipv4/fib_trie.c | 18 ++++++++++++------ - net/ipv4/proc.c | 3 +++ - net/ipv4/route.c | 3 +++ - 20 files changed, 105 insertions(+), 17 deletions(-) - ---- a/fs/locks.c -+++ b/fs/locks.c -@@ -2802,6 +2802,8 @@ static const struct file_operations proc - - static int __init proc_locks_init(void) - { -+ if (IS_ENABLED(CONFIG_PROC_STRIPPED)) -+ return 0; - proc_create("locks", 0, NULL, &proc_locks_operations); - return 0; - } ---- a/fs/proc/Kconfig -+++ b/fs/proc/Kconfig -@@ -81,3 +81,8 @@ config PROC_CHILDREN - - Say Y if you are running any user-space software which takes benefit from - this interface. For example, rkt is such a piece of software. -+ -+config PROC_STRIPPED -+ default n -+ depends on EXPERT -+ bool "Strip non-essential /proc functionality to reduce code size" ---- a/fs/proc/consoles.c -+++ b/fs/proc/consoles.c -@@ -106,6 +106,9 @@ static const struct file_operations proc - - static int __init proc_consoles_init(void) - { -+ if (IS_ENABLED(CONFIG_PROC_STRIPPED)) -+ return 0; -+ - proc_create("consoles", 0, NULL, &proc_consoles_operations); - return 0; - } ---- a/fs/proc/proc_tty.c -+++ b/fs/proc/proc_tty.c -@@ -144,7 +144,10 @@ static const struct file_operations proc - void proc_tty_register_driver(struct tty_driver *driver) - { - struct proc_dir_entry *ent; -- -+ -+ if (IS_ENABLED(CONFIG_PROC_STRIPPED)) -+ return; -+ - if (!driver->driver_name || driver->proc_entry || - !driver->ops->proc_fops) - return; -@@ -161,6 +164,9 @@ void proc_tty_unregister_driver(struct t - { - struct proc_dir_entry *ent; - -+ if (IS_ENABLED(CONFIG_PROC_STRIPPED)) -+ return; -+ - ent = driver->proc_entry; - if (!ent) - return; -@@ -175,6 +181,9 @@ void proc_tty_unregister_driver(struct t - */ - void __init proc_tty_init(void) - { -+ if (IS_ENABLED(CONFIG_PROC_STRIPPED)) -+ return; -+ - if (!proc_mkdir("tty", NULL)) - return; - proc_mkdir("tty/ldisc", NULL); /* Preserved: it's userspace visible */ ---- a/include/net/snmp.h -+++ b/include/net/snmp.h -@@ -123,6 +123,21 @@ struct linux_xfrm_mib { - #define DECLARE_SNMP_STAT(type, name) \ - extern __typeof__(type) __percpu *name - -+#ifdef CONFIG_PROC_STRIPPED -+#define __SNMP_STATS_DUMMY(mib) \ -+ do { (void) mib->mibs[0]; } while(0) -+ -+#define __SNMP_INC_STATS(mib, field) __SNMP_STATS_DUMMY(mib) -+#define SNMP_INC_STATS_ATOMIC_LONG(mib, field) __SNMP_STATS_DUMMY(mib) -+#define SNMP_INC_STATS(mib, field) __SNMP_STATS_DUMMY(mib) -+#define SNMP_DEC_STATS(mib, field) __SNMP_STATS_DUMMY(mib) -+#define __SNMP_ADD_STATS(mib, field, addend) __SNMP_STATS_DUMMY(mib) -+#define SNMP_ADD_STATS(mib, field, addend) __SNMP_STATS_DUMMY(mib) -+#define SNMP_UPD_PO_STATS(mib, basefield, addend) __SNMP_STATS_DUMMY(mib) -+#define __SNMP_UPD_PO_STATS(mib, basefield, addend) __SNMP_STATS_DUMMY(mib) -+ -+#else -+ - #define __SNMP_INC_STATS(mib, field) \ - __this_cpu_inc(mib->mibs[field]) - -@@ -153,8 +168,9 @@ struct linux_xfrm_mib { - __this_cpu_add(ptr[basefield##OCTETS], addend); \ - } while (0) - -+#endif - --#if BITS_PER_LONG==32 -+#if (BITS_PER_LONG==32) && !defined(CONFIG_PROC_STRIPPED) - - #define __SNMP_ADD_STATS64(mib, field, addend) \ - do { \ ---- a/ipc/msg.c -+++ b/ipc/msg.c -@@ -1061,6 +1061,9 @@ void __init msg_init(void) - { - msg_init_ns(&init_ipc_ns); - -+ if (IS_ENABLED(CONFIG_PROC_STRIPPED)) -+ return; -+ - ipc_init_proc_interface("sysvipc/msg", - " key msqid perms cbytes qnum lspid lrpid uid gid cuid cgid stime rtime ctime\n", - IPC_MSG_IDS, sysvipc_msg_proc_show); ---- a/ipc/sem.c -+++ b/ipc/sem.c -@@ -205,6 +205,8 @@ void sem_exit_ns(struct ipc_namespace *n - void __init sem_init(void) - { - sem_init_ns(&init_ipc_ns); -+ if (IS_ENABLED(CONFIG_PROC_STRIPPED)) -+ return; - ipc_init_proc_interface("sysvipc/sem", - " key semid perms nsems uid gid cuid cgid otime ctime\n", - IPC_SEM_IDS, sysvipc_sem_proc_show); ---- a/ipc/shm.c -+++ b/ipc/shm.c -@@ -118,6 +118,8 @@ pure_initcall(ipc_ns_init); - - void __init shm_init(void) - { -+ if (IS_ENABLED(CONFIG_PROC_STRIPPED)) -+ return; - ipc_init_proc_interface("sysvipc/shm", - #if BITS_PER_LONG <= 32 - " key shmid perms size cpid lpid nattch uid gid cuid cgid atime dtime ctime rss swap\n", ---- a/ipc/util.c -+++ b/ipc/util.c -@@ -121,6 +121,9 @@ void __init ipc_init_proc_interface(cons - struct proc_dir_entry *pde; - struct ipc_proc_iface *iface; - -+ if (IS_ENABLED(CONFIG_PROC_STRIPPED)) -+ return; -+ - iface = kmalloc(sizeof(*iface), GFP_KERNEL); - if (!iface) - return; ---- a/kernel/exec_domain.c -+++ b/kernel/exec_domain.c -@@ -41,6 +41,8 @@ static const struct file_operations exec - - static int __init proc_execdomains_init(void) - { -+ if (IS_ENABLED(CONFIG_PROC_STRIPPED)) -+ return 0; - proc_create("execdomains", 0, NULL, &execdomains_proc_fops); - return 0; - } ---- a/kernel/irq/proc.c -+++ b/kernel/irq/proc.c -@@ -326,6 +326,9 @@ void register_irq_proc(unsigned int irq, - static DEFINE_MUTEX(register_lock); - char name [MAX_NAMELEN]; - -+ if (IS_ENABLED(CONFIG_PROC_STRIPPED) && !IS_ENABLED(CONFIG_SMP)) -+ return; -+ - if (!root_irq_dir || (desc->irq_data.chip == &no_irq_chip)) - return; - -@@ -374,6 +377,9 @@ void unregister_irq_proc(unsigned int ir - { - char name [MAX_NAMELEN]; - -+ if (IS_ENABLED(CONFIG_PROC_STRIPPED) && !IS_ENABLED(CONFIG_SMP)) -+ return; -+ - if (!root_irq_dir || !desc->dir) - return; - #ifdef CONFIG_SMP -@@ -408,6 +414,9 @@ void init_irq_proc(void) - unsigned int irq; - struct irq_desc *desc; - -+ if (IS_ENABLED(CONFIG_PROC_STRIPPED) && !IS_ENABLED(CONFIG_SMP)) -+ return; -+ - /* create /proc/irq */ - root_irq_dir = proc_mkdir("irq", NULL); - if (!root_irq_dir) ---- a/kernel/time/timer_list.c -+++ b/kernel/time/timer_list.c -@@ -399,6 +399,9 @@ static int __init init_timer_list_procfs - { - struct proc_dir_entry *pe; - -+ if (IS_ENABLED(CONFIG_PROC_STRIPPED)) -+ return 0; -+ - pe = proc_create("timer_list", 0400, NULL, &timer_list_fops); - if (!pe) - return -ENOMEM; ---- a/mm/vmalloc.c -+++ b/mm/vmalloc.c -@@ -2714,6 +2714,8 @@ static const struct file_operations proc - - static int __init proc_vmalloc_init(void) - { -+ if (IS_ENABLED(CONFIG_PROC_STRIPPED)) -+ return 0; - proc_create("vmallocinfo", S_IRUSR, NULL, &proc_vmalloc_operations); - return 0; - } ---- a/mm/vmstat.c -+++ b/mm/vmstat.c -@@ -1798,10 +1798,12 @@ static int __init setup_vmstat(void) - cpu_notifier_register_done(); - #endif - #ifdef CONFIG_PROC_FS -- proc_create("buddyinfo", S_IRUGO, NULL, &fragmentation_file_operations); -- proc_create("pagetypeinfo", S_IRUGO, NULL, &pagetypeinfo_file_ops); -+ if (!IS_ENABLED(CONFIG_PROC_STRIPPED)) { -+ proc_create("buddyinfo", S_IRUGO, NULL, &fragmentation_file_operations); -+ proc_create("pagetypeinfo", S_IRUGO, NULL, &pagetypeinfo_file_ops); -+ proc_create("zoneinfo", S_IRUGO, NULL, &proc_zoneinfo_file_operations); -+ } - proc_create("vmstat", S_IRUGO, NULL, &proc_vmstat_file_operations); -- proc_create("zoneinfo", S_IRUGO, NULL, &proc_zoneinfo_file_operations); - #endif - return 0; - } ---- a/net/8021q/vlanproc.c -+++ b/net/8021q/vlanproc.c -@@ -127,6 +127,9 @@ void vlan_proc_cleanup(struct net *net) - { - struct vlan_net *vn = net_generic(net, vlan_net_id); - -+ if (IS_ENABLED(CONFIG_PROC_STRIPPED)) -+ return; -+ - if (vn->proc_vlan_conf) - remove_proc_entry(name_conf, vn->proc_vlan_dir); - -@@ -146,6 +149,9 @@ int __net_init vlan_proc_init(struct net - { - struct vlan_net *vn = net_generic(net, vlan_net_id); - -+ if (IS_ENABLED(CONFIG_PROC_STRIPPED)) -+ return 0; -+ - vn->proc_vlan_dir = proc_net_mkdir(net, name_root, net->proc_net); - if (!vn->proc_vlan_dir) - goto err; ---- a/net/core/net-procfs.c -+++ b/net/core/net-procfs.c -@@ -319,10 +319,12 @@ static int __net_init dev_proc_net_init( - - if (!proc_create("dev", S_IRUGO, net->proc_net, &dev_seq_fops)) - goto out; -- if (!proc_create("softnet_stat", S_IRUGO, net->proc_net, -+ if (!IS_ENABLED(CONFIG_PROC_STRIPPED) && -+ !proc_create("softnet_stat", S_IRUGO, net->proc_net, - &softnet_seq_fops)) - goto out_dev; -- if (!proc_create("ptype", S_IRUGO, net->proc_net, &ptype_seq_fops)) -+ if (!IS_ENABLED(CONFIG_PROC_STRIPPED) && -+ !proc_create("ptype", S_IRUGO, net->proc_net, &ptype_seq_fops)) - goto out_softnet; - - if (wext_proc_init(net)) -@@ -331,9 +333,11 @@ static int __net_init dev_proc_net_init( - out: - return rc; - out_ptype: -- remove_proc_entry("ptype", net->proc_net); -+ if (!IS_ENABLED(CONFIG_PROC_STRIPPED)) -+ remove_proc_entry("ptype", net->proc_net); - out_softnet: -- remove_proc_entry("softnet_stat", net->proc_net); -+ if (!IS_ENABLED(CONFIG_PROC_STRIPPED)) -+ remove_proc_entry("softnet_stat", net->proc_net); - out_dev: - remove_proc_entry("dev", net->proc_net); - goto out; -@@ -343,8 +347,10 @@ static void __net_exit dev_proc_net_exit - { - wext_proc_exit(net); - -- remove_proc_entry("ptype", net->proc_net); -- remove_proc_entry("softnet_stat", net->proc_net); -+ if (!IS_ENABLED(CONFIG_PROC_STRIPPED)) { -+ remove_proc_entry("ptype", net->proc_net); -+ remove_proc_entry("softnet_stat", net->proc_net); -+ } - remove_proc_entry("dev", net->proc_net); - } - ---- a/net/core/sock.c -+++ b/net/core/sock.c -@@ -3088,6 +3088,8 @@ static __net_initdata struct pernet_oper - - static int __init proto_init(void) - { -+ if (IS_ENABLED(CONFIG_PROC_STRIPPED)) -+ return 0; - return register_pernet_subsys(&proto_net_ops); - } - ---- a/net/ipv4/fib_trie.c -+++ b/net/ipv4/fib_trie.c -@@ -2677,10 +2677,12 @@ static const struct file_operations fib_ - - int __net_init fib_proc_init(struct net *net) - { -- if (!proc_create("fib_trie", S_IRUGO, net->proc_net, &fib_trie_fops)) -+ if (!IS_ENABLED(CONFIG_PROC_STRIPPED) && -+ !proc_create("fib_trie", S_IRUGO, net->proc_net, &fib_trie_fops)) - goto out1; - -- if (!proc_create("fib_triestat", S_IRUGO, net->proc_net, -+ if (!IS_ENABLED(CONFIG_PROC_STRIPPED) && -+ !proc_create("fib_triestat", S_IRUGO, net->proc_net, - &fib_triestat_fops)) - goto out2; - -@@ -2690,17 +2692,21 @@ int __net_init fib_proc_init(struct net - return 0; - - out3: -- remove_proc_entry("fib_triestat", net->proc_net); -+ if (!IS_ENABLED(CONFIG_PROC_STRIPPED)) -+ remove_proc_entry("fib_triestat", net->proc_net); - out2: -- remove_proc_entry("fib_trie", net->proc_net); -+ if (!IS_ENABLED(CONFIG_PROC_STRIPPED)) -+ remove_proc_entry("fib_trie", net->proc_net); - out1: - return -ENOMEM; - } - - void __net_exit fib_proc_exit(struct net *net) - { -- remove_proc_entry("fib_trie", net->proc_net); -- remove_proc_entry("fib_triestat", net->proc_net); -+ if (!IS_ENABLED(CONFIG_PROC_STRIPPED)) { -+ remove_proc_entry("fib_trie", net->proc_net); -+ remove_proc_entry("fib_triestat", net->proc_net); -+ } - remove_proc_entry("route", net->proc_net); - } - ---- a/net/ipv4/proc.c -+++ b/net/ipv4/proc.c -@@ -565,6 +565,9 @@ static __net_initdata struct pernet_oper - - int __init ip_misc_proc_init(void) - { -+ if (IS_ENABLED(CONFIG_PROC_STRIPPED)) -+ return 0; -+ - return register_pernet_subsys(&ip_proc_ops); - } - ---- a/net/ipv4/route.c -+++ b/net/ipv4/route.c -@@ -423,6 +423,9 @@ static struct pernet_operations ip_rt_pr - - static int __init ip_rt_proc_init(void) - { -+ if (IS_ENABLED(CONFIG_PROC_STRIPPED)) -+ return 0; -+ - return register_pernet_subsys(&ip_rt_proc_ops); - } - diff --git a/target/linux/generic/hack-4.9/904-debloat_dma_buf.patch b/target/linux/generic/hack-4.9/904-debloat_dma_buf.patch deleted file mode 100644 index da69b7e784..0000000000 --- a/target/linux/generic/hack-4.9/904-debloat_dma_buf.patch +++ /dev/null @@ -1,64 +0,0 @@ -From e3692cb2fcd5ba1244512a0f43b8118f65f1c375 Mon Sep 17 00:00:00 2001 -From: Felix Fietkau -Date: Sat, 8 Jul 2017 08:20:43 +0200 -Subject: debloat: dmabuf - -Signed-off-by: Felix Fietkau ---- - drivers/base/Kconfig | 2 +- - drivers/dma-buf/Makefile | 10 +++++++--- - drivers/dma-buf/dma-buf.c | 4 +++- - kernel/sched/core.c | 1 + - 4 files changed, 12 insertions(+), 5 deletions(-) - ---- a/drivers/base/Kconfig -+++ b/drivers/base/Kconfig -@@ -244,7 +244,7 @@ config SOC_BUS - source "drivers/base/regmap/Kconfig" - - config DMA_SHARED_BUFFER -- bool -+ tristate - default n - select ANON_INODES - help ---- a/drivers/dma-buf/Makefile -+++ b/drivers/dma-buf/Makefile -@@ -1,3 +1,7 @@ --obj-y := dma-buf.o fence.o reservation.o seqno-fence.o fence-array.o --obj-$(CONFIG_SYNC_FILE) += sync_file.o --obj-$(CONFIG_SW_SYNC) += sw_sync.o sync_debug.o -+obj-$(CONFIG_DMA_SHARED_BUFFER) := dma-shared-buffer.o -+ -+dma-buf-objs-y := dma-buf.o fence.o reservation.o seqno-fence.o fence-array.o -+dma-buf-objs-$(CONFIG_SYNC_FILE) += sync_file.o -+dma-buf-objs-$(CONFIG_SW_SYNC) += sw_sync.o sync_debug.o -+ -+dma-shared-buffer-objs := $(dma-buf-objs-y) ---- a/drivers/dma-buf/dma-buf.c -+++ b/drivers/dma-buf/dma-buf.c -@@ -34,6 +34,7 @@ - #include - #include - #include -+#include - - #include - -@@ -977,4 +978,5 @@ static void __exit dma_buf_deinit(void) - { - dma_buf_uninit_debugfs(); - } --__exitcall(dma_buf_deinit); -+module_exit(dma_buf_deinit); -+MODULE_LICENSE("GPL"); ---- a/kernel/sched/core.c -+++ b/kernel/sched/core.c -@@ -2171,6 +2171,7 @@ int wake_up_state(struct task_struct *p, - { - return try_to_wake_up(p, state, 0); - } -+EXPORT_SYMBOL_GPL(wake_up_state); - - /* - * This function clears the sched_dl_entity static params. diff --git a/target/linux/generic/hack-4.9/910-kobject_uevent.patch b/target/linux/generic/hack-4.9/910-kobject_uevent.patch deleted file mode 100644 index 734401e1c6..0000000000 --- a/target/linux/generic/hack-4.9/910-kobject_uevent.patch +++ /dev/null @@ -1,32 +0,0 @@ -From 0d37e6edc09c99e683dd91ca0e83bbc0df8477b3 Mon Sep 17 00:00:00 2001 -From: Felix Fietkau -Date: Sun, 16 Jul 2017 16:56:10 +0200 -Subject: lib: add uevent_next_seqnum() - -Signed-off-by: Felix Fietkau ---- - include/linux/kobject.h | 5 +++++ - lib/kobject_uevent.c | 37 +++++++++++++++++++++++++++++++++++++ - 2 files changed, 42 insertions(+) - ---- a/lib/kobject_uevent.c -+++ b/lib/kobject_uevent.c -@@ -52,6 +52,18 @@ static const char *kobject_actions[] = { - [KOBJ_OFFLINE] = "offline", - }; - -+u64 uevent_next_seqnum(void) -+{ -+ u64 seq; -+ -+ mutex_lock(&uevent_sock_mutex); -+ seq = ++uevent_seqnum; -+ mutex_unlock(&uevent_sock_mutex); -+ -+ return seq; -+} -+EXPORT_SYMBOL_GPL(uevent_next_seqnum); -+ - /** - * kobject_action_type - translate action string to numeric type - * diff --git a/target/linux/generic/hack-4.9/911-kobject_add_broadcast_uevent.patch b/target/linux/generic/hack-4.9/911-kobject_add_broadcast_uevent.patch deleted file mode 100644 index d827ace9e0..0000000000 --- a/target/linux/generic/hack-4.9/911-kobject_add_broadcast_uevent.patch +++ /dev/null @@ -1,76 +0,0 @@ -From 0d37e6edc09c99e683dd91ca0e83bbc0df8477b3 Mon Sep 17 00:00:00 2001 -From: Felix Fietkau -Date: Sun, 16 Jul 2017 16:56:10 +0200 -Subject: lib: add uevent_next_seqnum() - -Signed-off-by: Felix Fietkau ---- - include/linux/kobject.h | 5 +++++ - lib/kobject_uevent.c | 37 +++++++++++++++++++++++++++++++++++++ - 2 files changed, 42 insertions(+) - ---- a/include/linux/kobject.h -+++ b/include/linux/kobject.h -@@ -32,6 +32,8 @@ - #define UEVENT_NUM_ENVP 32 /* number of env pointers */ - #define UEVENT_BUFFER_SIZE 2048 /* buffer for the variables */ - -+struct sk_buff; -+ - #ifdef CONFIG_UEVENT_HELPER - /* path to the userspace helper executed on an event */ - extern char uevent_helper[]; -@@ -239,4 +241,7 @@ int add_uevent_var(struct kobj_uevent_en - int kobject_action_type(const char *buf, size_t count, - enum kobject_action *type); - -+int broadcast_uevent(struct sk_buff *skb, __u32 pid, __u32 group, -+ gfp_t allocation); -+ - #endif /* _KOBJECT_H_ */ ---- a/lib/kobject_uevent.c -+++ b/lib/kobject_uevent.c -@@ -423,6 +423,43 @@ int add_uevent_var(struct kobj_uevent_en - EXPORT_SYMBOL_GPL(add_uevent_var); - - #if defined(CONFIG_NET) -+int broadcast_uevent(struct sk_buff *skb, __u32 pid, __u32 group, -+ gfp_t allocation) -+{ -+ struct uevent_sock *ue_sk; -+ int err = 0; -+ -+ /* send netlink message */ -+ mutex_lock(&uevent_sock_mutex); -+ list_for_each_entry(ue_sk, &uevent_sock_list, list) { -+ struct sock *uevent_sock = ue_sk->sk; -+ struct sk_buff *skb2; -+ -+ skb2 = skb_clone(skb, allocation); -+ if (!skb2) -+ break; -+ -+ err = netlink_broadcast(uevent_sock, skb2, pid, group, -+ allocation); -+ if (err) -+ break; -+ } -+ mutex_unlock(&uevent_sock_mutex); -+ -+ kfree_skb(skb); -+ return err; -+} -+#else -+int broadcast_uevent(struct sk_buff *skb, __u32 pid, __u32 group, -+ gfp_t allocation) -+{ -+ kfree_skb(skb); -+ return 0; -+} -+#endif -+EXPORT_SYMBOL_GPL(broadcast_uevent); -+ -+#if defined(CONFIG_NET) - static int uevent_net_init(struct net *net) - { - struct uevent_sock *ue_sk; diff --git a/target/linux/generic/hack-4.9/921-always-create-console-node-in-initramfs.patch b/target/linux/generic/hack-4.9/921-always-create-console-node-in-initramfs.patch deleted file mode 100644 index 38110f06be..0000000000 --- a/target/linux/generic/hack-4.9/921-always-create-console-node-in-initramfs.patch +++ /dev/null @@ -1,40 +0,0 @@ -From 5d301596fdc72f6cb672f72eb3c66e7cddefb103 Mon Sep 17 00:00:00 2001 -From: Felix Fietkau -Date: Sat, 8 Jul 2017 08:26:02 +0200 -Subject: initramfs: always create console node - -Signed-off-by: Felix Fietkau ---- - scripts/gen_initramfs_list.sh | 14 ++++++++++++++ - 1 file changed, 14 insertions(+) - ---- a/scripts/gen_initramfs_list.sh -+++ b/scripts/gen_initramfs_list.sh -@@ -59,6 +59,18 @@ default_initramfs() { - EOF - } - -+list_librecmc_initramfs() { -+ : -+} -+ -+librecmc_initramfs() { -+ # make sure that /dev/console exists -+ cat <<-EOF >> ${output} -+ dir /dev 0755 0 0 -+ nod /dev/console 0600 0 0 c 5 1 -+ EOF -+} -+ - filetype() { - local argv1="$1" - -@@ -180,6 +192,8 @@ dir_filelist() { - if [ "$(echo "${dirlist}" | wc -l)" -gt 1 ]; then - ${dep_list}print_mtime "$1" - -+ ${dep_list}librecmc_initramfs -+ - echo "${dirlist}" | \ - while read x; do - ${dep_list}parse ${x} diff --git a/target/linux/generic/hack-4.9/930-crashlog.patch b/target/linux/generic/hack-4.9/930-crashlog.patch deleted file mode 100644 index baa87b1b7f..0000000000 --- a/target/linux/generic/hack-4.9/930-crashlog.patch +++ /dev/null @@ -1,338 +0,0 @@ -From 6b1ab74a9917012d0c559edc4ed299d9228ac89f Mon Sep 17 00:00:00 2001 -From: Felix Fietkau -Date: Sat, 8 Jul 2017 08:26:47 +0200 -Subject: kernel: add the new 'crashlog' feature - -this tries to store kernel oops/panic logs in a fixed location in RAM to -recover them available to user space using debugfs - -Signed-off-by: Felix Fietkau ---- - include/linux/crashlog.h | 17 ++++ - init/Kconfig | 4 + - kernel/Makefile | 1 + - kernel/crashlog.c | 213 +++++++++++++++++++++++++++++++++++++++++++++++ - kernel/module.c | 3 + - mm/bootmem.c | 2 + - mm/memblock.c | 5 ++ - 7 files changed, 245 insertions(+) - create mode 100644 include/linux/crashlog.h - create mode 100644 kernel/crashlog.c - ---- /dev/null -+++ b/include/linux/crashlog.h -@@ -0,0 +1,17 @@ -+#ifndef __CRASHLOG_H -+#define __CRASHLOG_H -+ -+#ifdef CONFIG_CRASHLOG -+void crashlog_init_bootmem(struct bootmem_data *bdata); -+void crashlog_init_memblock(phys_addr_t addr, phys_addr_t size); -+#else -+static inline void crashlog_init_bootmem(struct bootmem_data *bdata) -+{ -+} -+ -+static inline void crashlog_init_memblock(phys_addr_t addr, phys_addr_t size) -+{ -+} -+#endif -+ -+#endif ---- a/init/Kconfig -+++ b/init/Kconfig -@@ -1298,6 +1298,10 @@ config RELAY - - If unsure, say N. - -+config CRASHLOG -+ bool "Crash logging" -+ depends on (!NO_BOOTMEM || HAVE_MEMBLOCK) -+ - config BLK_DEV_INITRD - bool "Initial RAM filesystem and RAM disk (initramfs/initrd) support" - depends on BROKEN || !FRV ---- a/kernel/Makefile -+++ b/kernel/Makefile -@@ -113,6 +113,7 @@ obj-$(CONFIG_TORTURE_TEST) += torture.o - obj-$(CONFIG_MEMBARRIER) += membarrier.o - - obj-$(CONFIG_HAS_IOMEM) += memremap.o -+obj-$(CONFIG_CRASHLOG) += crashlog.o - - $(obj)/configs.o: $(obj)/config_data.h - ---- /dev/null -+++ b/kernel/crashlog.c -@@ -0,0 +1,213 @@ -+/* -+ * Crash information logger -+ * Copyright (C) 2010 Felix Fietkau -+ * -+ * Based on ramoops.c -+ * Copyright (C) 2010 Marco Stornelli -+ * -+ * 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 -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+#define CRASHLOG_PAGES 4 -+#define CRASHLOG_SIZE (CRASHLOG_PAGES * PAGE_SIZE) -+#define CRASHLOG_MAGIC 0xa1eedead -+ -+/* -+ * Start the log at 1M before the end of RAM, as some boot loaders like -+ * to use the end of the RAM for stack usage and other things -+ * If this fails, fall back to using the last part. -+ */ -+#define CRASHLOG_OFFSET (1024 * 1024) -+ -+struct crashlog_data { -+ u32 magic; -+ u32 len; -+ u8 data[]; -+}; -+ -+static struct debugfs_blob_wrapper crashlog_blob; -+static unsigned long crashlog_addr = 0; -+static struct crashlog_data *crashlog_buf; -+static struct kmsg_dumper dump; -+static bool first = true; -+ -+extern struct list_head *crashlog_modules; -+ -+static bool crashlog_set_addr(phys_addr_t addr, phys_addr_t size) -+{ -+ /* Limit to lower 64 MB to avoid highmem */ -+ phys_addr_t limit = 64 * 1024 * 1024; -+ -+ if (crashlog_addr) -+ return false; -+ -+ if (addr > limit) -+ return false; -+ -+ if (addr + size > limit) -+ size = limit - addr; -+ -+ crashlog_addr = addr; -+ -+ if (addr + size > CRASHLOG_OFFSET) -+ crashlog_addr += size - CRASHLOG_OFFSET; -+ -+ return true; -+} -+ -+#ifndef CONFIG_NO_BOOTMEM -+void __init crashlog_init_bootmem(bootmem_data_t *bdata) -+{ -+ phys_addr_t start, end; -+ -+ start = PFN_PHYS(bdata->node_low_pfn); -+ end = PFN_PHYS(bdata->node_min_pfn); -+ if (!crashlog_set_addr(start, end - start)) -+ return; -+ -+ if (reserve_bootmem(crashlog_addr, CRASHLOG_SIZE, BOOTMEM_EXCLUSIVE) < 0) { -+ printk("Crashlog failed to allocate RAM at address 0x%lx\n", -+ crashlog_addr); -+ crashlog_addr = 0; -+ } -+} -+#endif -+ -+#ifdef CONFIG_HAVE_MEMBLOCK -+void __init_memblock crashlog_init_memblock(phys_addr_t addr, phys_addr_t size) -+{ -+ if (!crashlog_set_addr(addr, size)) -+ return; -+ -+ if (memblock_reserve(crashlog_addr, CRASHLOG_SIZE)) { -+ printk("Crashlog failed to allocate RAM at address 0x%lx\n", -+ crashlog_addr); -+ crashlog_addr = 0; -+ } -+} -+#endif -+ -+static void __init crashlog_copy(void) -+{ -+ if (crashlog_buf->magic != CRASHLOG_MAGIC) -+ return; -+ -+ if (!crashlog_buf->len || crashlog_buf->len > -+ CRASHLOG_SIZE - sizeof(*crashlog_buf)) -+ return; -+ -+ crashlog_blob.size = crashlog_buf->len; -+ crashlog_blob.data = kmemdup(crashlog_buf->data, -+ crashlog_buf->len, GFP_KERNEL); -+ -+ debugfs_create_blob("crashlog", 0700, NULL, &crashlog_blob); -+} -+ -+static int get_maxlen(void) -+{ -+ return CRASHLOG_SIZE - sizeof(*crashlog_buf) - crashlog_buf->len; -+} -+ -+static void crashlog_printf(const char *fmt, ...) -+{ -+ va_list args; -+ int len = get_maxlen(); -+ -+ if (!len) -+ return; -+ -+ va_start(args, fmt); -+ crashlog_buf->len += vscnprintf( -+ &crashlog_buf->data[crashlog_buf->len], -+ len, fmt, args); -+ va_end(args); -+} -+ -+static void crashlog_do_dump(struct kmsg_dumper *dumper, -+ enum kmsg_dump_reason reason) -+{ -+ struct timeval tv; -+ struct module *m; -+ char *buf; -+ size_t len; -+ -+ if (!first) -+ crashlog_printf("\n===================================\n"); -+ -+ do_gettimeofday(&tv); -+ crashlog_printf("Time: %lu.%lu\n", -+ (long)tv.tv_sec, (long)tv.tv_usec); -+ -+ if (first) { -+ crashlog_printf("Modules:"); -+ list_for_each_entry(m, crashlog_modules, list) { -+ crashlog_printf("\t%s@%p+%x", m->name, -+ m->core_layout.base, m->core_layout.size, -+ m->init_layout.base, m->init_layout.size); -+ } -+ crashlog_printf("\n"); -+ first = false; -+ } -+ -+ buf = (char *)&crashlog_buf->data[crashlog_buf->len]; -+ -+ kmsg_dump_get_buffer(dumper, true, buf, get_maxlen(), &len); -+ -+ crashlog_buf->len += len; -+} -+ -+ -+int __init crashlog_init_fs(void) -+{ -+ struct page *pages[CRASHLOG_PAGES]; -+ pgprot_t prot; -+ int i; -+ -+ if (!crashlog_addr) { -+ printk("No memory allocated for crashlog\n"); -+ return -ENOMEM; -+ } -+ -+ printk("Crashlog allocated RAM at address 0x%lx\n", (unsigned long) crashlog_addr); -+ for (i = 0; i < CRASHLOG_PAGES; i++) -+ pages[i] = pfn_to_page((crashlog_addr >> PAGE_SHIFT) + i); -+ -+ prot = pgprot_writecombine(PAGE_KERNEL); -+ crashlog_buf = vmap(pages, CRASHLOG_PAGES, VM_MAP, prot); -+ -+ crashlog_copy(); -+ -+ crashlog_buf->magic = CRASHLOG_MAGIC; -+ crashlog_buf->len = 0; -+ -+ dump.max_reason = KMSG_DUMP_OOPS; -+ dump.dump = crashlog_do_dump; -+ kmsg_dump_register(&dump); -+ -+ return 0; -+} -+module_init(crashlog_init_fs); ---- a/kernel/module.c -+++ b/kernel/module.c -@@ -253,6 +253,9 @@ static void mod_update_bounds(struct mod - #ifdef CONFIG_KGDB_KDB - struct list_head *kdb_modules = &modules; /* kdb needs the list of modules */ - #endif /* CONFIG_KGDB_KDB */ -+#ifdef CONFIG_CRASHLOG -+struct list_head *crashlog_modules = &modules; -+#endif - - static void module_assert_mutex(void) - { ---- a/mm/bootmem.c -+++ b/mm/bootmem.c -@@ -14,6 +14,7 @@ - #include - #include - #include -+#include - #include - #include - #include -@@ -174,6 +175,7 @@ static unsigned long __init free_all_boo - if (!bdata->node_bootmem_map) - return 0; - -+ crashlog_init_bootmem(bdata); - map = bdata->node_bootmem_map; - start = bdata->node_min_pfn; - end = bdata->node_low_pfn; ---- a/mm/memblock.c -+++ b/mm/memblock.c -@@ -19,6 +19,7 @@ - #include - #include - #include -+#include - - #include - #include -@@ -495,6 +496,8 @@ static void __init_memblock memblock_ins - memblock_set_region_node(rgn, nid); - type->cnt++; - type->total_size += size; -+ if (type == &memblock.memory) -+ crashlog_init_memblock(base, size); - } - - /** -@@ -534,6 +537,8 @@ int __init_memblock memblock_add_range(s - type->regions[0].flags = flags; - memblock_set_region_node(&type->regions[0], nid); - type->total_size = size; -+ if (type == &memblock.memory) -+ crashlog_init_memblock(base, size); - return 0; - } - repeat: diff --git a/target/linux/generic/pending-3.18/001-mtdsplit_backport.patch b/target/linux/generic/pending-3.18/001-mtdsplit_backport.patch deleted file mode 100644 index a558f6ff82..0000000000 --- a/target/linux/generic/pending-3.18/001-mtdsplit_backport.patch +++ /dev/null @@ -1,142 +0,0 @@ ---- a/drivers/mtd/mtdsplit/mtdsplit_brnimage.c -+++ b/drivers/mtd/mtdsplit/mtdsplit_brnimage.c -@@ -27,7 +27,7 @@ - #define BRNIMAGE_MAX_OVERHEAD (BRNIMAGE_ALIGN_BYTES + BRNIMAGE_FOOTER_SIZE) - - static int mtdsplit_parse_brnimage(struct mtd_info *master, -- const struct mtd_partition **pparts, -+ struct mtd_partition **pparts, - struct mtd_part_parser_data *data) - { - struct mtd_partition *parts; ---- a/drivers/mtd/mtdsplit/mtdsplit_eva.c -+++ b/drivers/mtd/mtdsplit/mtdsplit_eva.c -@@ -29,7 +29,7 @@ struct eva_image_header { - }; - - static int mtdsplit_parse_eva(struct mtd_info *master, -- const struct mtd_partition **pparts, -+ struct mtd_partition **pparts, - struct mtd_part_parser_data *data) - { - struct mtd_partition *parts; ---- a/drivers/mtd/mtdsplit/mtdsplit_fit.c -+++ b/drivers/mtd/mtdsplit/mtdsplit_fit.c -@@ -45,8 +45,7 @@ struct fdt_header { - }; - - static int --mtdsplit_fit_parse(struct mtd_info *mtd, -- const struct mtd_partition **pparts, -+mtdsplit_fit_parse(struct mtd_info *mtd, struct mtd_partition **pparts, - struct mtd_part_parser_data *data) - { - struct fdt_header hdr; ---- a/drivers/mtd/mtdsplit/mtdsplit_lzma.c -+++ b/drivers/mtd/mtdsplit/mtdsplit_lzma.c -@@ -28,7 +28,7 @@ struct lzma_header { - }; - - static int mtdsplit_parse_lzma(struct mtd_info *master, -- const struct mtd_partition **pparts, -+ struct mtd_partition **pparts, - struct mtd_part_parser_data *data) - { - struct lzma_header hdr; ---- a/drivers/mtd/mtdsplit/mtdsplit_seama.c -+++ b/drivers/mtd/mtdsplit/mtdsplit_seama.c -@@ -30,7 +30,7 @@ struct seama_header { - }; - - static int mtdsplit_parse_seama(struct mtd_info *master, -- const struct mtd_partition **pparts, -+ struct mtd_partition **pparts, - struct mtd_part_parser_data *data) - { - struct seama_header hdr; ---- a/drivers/mtd/mtdsplit/mtdsplit_squashfs.c -+++ b/drivers/mtd/mtdsplit/mtdsplit_squashfs.c -@@ -23,7 +23,7 @@ - - static int - mtdsplit_parse_squashfs(struct mtd_info *master, -- const struct mtd_partition **pparts, -+ struct mtd_partition **pparts, - struct mtd_part_parser_data *data) - { - struct mtd_partition *part; ---- a/drivers/mtd/mtdsplit/mtdsplit_tplink.c -+++ b/drivers/mtd/mtdsplit/mtdsplit_tplink.c -@@ -83,8 +83,8 @@ struct tplink_fw_header { - }; - - static int mtdsplit_parse_tplink(struct mtd_info *master, -- const struct mtd_partition **pparts, -- struct mtd_part_parser_data *data) -+ struct mtd_partition **pparts, -+ struct mtd_part_parser_data *data) - { - struct tplink_fw_header hdr; - size_t hdr_len, retlen, kernel_size; ---- a/drivers/mtd/mtdsplit/mtdsplit_trx.c -+++ b/drivers/mtd/mtdsplit/mtdsplit_trx.c -@@ -56,7 +56,7 @@ read_trx_header(struct mtd_info *mtd, si - - static int - mtdsplit_parse_trx(struct mtd_info *master, -- const struct mtd_partition **pparts, -+ struct mtd_partition **pparts, - struct mtd_part_parser_data *data) - { - struct mtd_partition *parts; ---- a/drivers/mtd/mtdsplit/mtdsplit_uimage.c -+++ b/drivers/mtd/mtdsplit/mtdsplit_uimage.c -@@ -82,7 +82,7 @@ read_uimage_header(struct mtd_info *mtd, - * of a valid uImage header if found - */ - static int __mtdsplit_parse_uimage(struct mtd_info *master, -- const struct mtd_partition **pparts, -+ struct mtd_partition **pparts, - struct mtd_part_parser_data *data, - ssize_t (*find_header)(u_char *buf, size_t len)) - { -@@ -233,7 +233,7 @@ static ssize_t uimage_verify_default(u_c - - static int - mtdsplit_uimage_parse_generic(struct mtd_info *master, -- const struct mtd_partition **pparts, -+ struct mtd_partition **pparts, - struct mtd_part_parser_data *data) - { - return __mtdsplit_parse_uimage(master, pparts, data, -@@ -300,7 +300,7 @@ static ssize_t uimage_verify_wndr3700(u_ - - static int - mtdsplit_uimage_parse_netgear(struct mtd_info *master, -- const struct mtd_partition **pparts, -+ struct mtd_partition **pparts, - struct mtd_part_parser_data *data) - { - return __mtdsplit_parse_uimage(master, pparts, data, -@@ -352,7 +352,7 @@ static ssize_t uimage_find_edimax(u_char - - static int - mtdsplit_uimage_parse_edimax(struct mtd_info *master, -- const struct mtd_partition **pparts, -+ struct mtd_partition **pparts, - struct mtd_part_parser_data *data) - { - return __mtdsplit_parse_uimage(master, pparts, data, ---- a/drivers/mtd/mtdsplit/mtdsplit_wrgg.c -+++ b/drivers/mtd/mtdsplit/mtdsplit_wrgg.c -@@ -51,8 +51,8 @@ struct wrg_header { - - - static int mtdsplit_parse_wrgg(struct mtd_info *master, -- const struct mtd_partition **pparts, -- struct mtd_part_parser_data *data) -+ struct mtd_partition **pparts, -+ struct mtd_part_parser_data *data) - { - struct wrgg03_header hdr; - size_t hdr_len, retlen, kernel_ent_size; diff --git a/target/linux/generic/pending-3.18/002-phy_drivers_backport.patch b/target/linux/generic/pending-3.18/002-phy_drivers_backport.patch deleted file mode 100644 index e2ca05384a..0000000000 --- a/target/linux/generic/pending-3.18/002-phy_drivers_backport.patch +++ /dev/null @@ -1,552 +0,0 @@ ---- a/drivers/net/phy/adm6996.c -+++ b/drivers/net/phy/adm6996.c -@@ -289,7 +289,7 @@ static u16 - adm6996_read_mii_reg(struct adm6996_priv *priv, enum admreg reg) - { - struct phy_device *phydev = priv->priv; -- struct mii_bus *bus = phydev->mdio.bus; -+ struct mii_bus *bus = phydev->bus; - - return bus->read(bus, PHYADDR(reg)); - } -@@ -298,7 +298,7 @@ static void - adm6996_write_mii_reg(struct adm6996_priv *priv, enum admreg reg, u16 val) - { - struct phy_device *phydev = priv->priv; -- struct mii_bus *bus = phydev->mdio.bus; -+ struct mii_bus *bus = phydev->bus; - - bus->write(bus, PHYADDR(reg), val); - } -@@ -1050,13 +1050,13 @@ static int adm6996_config_init(struct ph - pdev->supported = ADVERTISED_100baseT_Full; - pdev->advertising = ADVERTISED_100baseT_Full; - -- if (pdev->mdio.addr != 0) { -+ if (pdev->addr != 0) { - pr_info ("%s: PHY overlaps ADM6996, providing fixed PHY 0x%x.\n" -- , pdev->attached_dev->name, pdev->mdio.addr); -+ , pdev->attached_dev->name, pdev->addr); - return 0; - } - -- priv = devm_kzalloc(&pdev->mdio.dev, sizeof(struct adm6996_priv), GFP_KERNEL); -+ priv = devm_kzalloc(&pdev->dev, sizeof(struct adm6996_priv), GFP_KERNEL); - if (!priv) - return -ENOMEM; - -@@ -1076,7 +1076,7 @@ static int adm6996_config_init(struct ph - } - - /* -- * Warning: phydev->priv is NULL if phydev->mdio.addr != 0 -+ * Warning: phydev->priv is NULL if phydev->addr != 0 - */ - static int adm6996_read_status(struct phy_device *phydev) - { -@@ -1092,7 +1092,7 @@ static int adm6996_read_status(struct ph - } - - /* -- * Warning: phydev->priv is NULL if phydev->mdio.addr != 0 -+ * Warning: phydev->priv is NULL if phydev->addr != 0 - */ - static int adm6996_config_aneg(struct phy_device *phydev) - { -@@ -1101,11 +1101,11 @@ static int adm6996_config_aneg(struct ph - - static int adm6996_fixup(struct phy_device *dev) - { -- struct mii_bus *bus = dev->mdio.bus; -+ struct mii_bus *bus = dev->bus; - u16 reg; - - /* Our custom registers are at PHY addresses 0-10. Claim those. */ -- if (dev->mdio.addr > 10) -+ if (dev->addr > 10) - return 0; - - /* look for the switch on the bus */ -@@ -1152,6 +1152,7 @@ static struct phy_driver adm6996_phy_dri - .config_aneg = &adm6996_config_aneg, - .read_status = &adm6996_read_status, - .soft_reset = adm6996_soft_reset, -+ .driver = { .owner = THIS_MODULE,}, - }; - - static int adm6996_gpio_probe(struct platform_device *pdev) -@@ -1220,7 +1221,7 @@ static int __init adm6996_init(void) - int err; - - phy_register_fixup_for_id(PHY_ANY_ID, adm6996_fixup); -- err = phy_driver_register(&adm6996_phy_driver, THIS_MODULE); -+ err = phy_driver_register(&adm6996_phy_driver); - if (err) - return err; - ---- a/drivers/net/phy/ar8216.c -+++ b/drivers/net/phy/ar8216.c -@@ -177,7 +177,7 @@ ar8xxx_phy_check_aneg(struct phy_device - if (ret & BMCR_ANENABLE) - return 0; - -- dev_info(&phydev->mdio.dev, "ANEG disabled, re-enabling ...\n"); -+ dev_info(&phydev->dev, "ANEG disabled, re-enabling ...\n"); - ret |= BMCR_ANENABLE | BMCR_ANRESTART; - return phy_write(phydev, MII_BMCR, ret); - } -@@ -2021,7 +2021,7 @@ ar8xxx_phy_config_init(struct phy_device - - priv->phy = phydev; - -- if (phydev->mdio.addr != 0) { -+ if (phydev->addr != 0) { - if (chip_is_ar8316(priv)) { - /* switch device has been initialized, reinit */ - priv->dev.ports = (AR8216_NUM_PORTS - 1); -@@ -2069,7 +2069,7 @@ ar8xxx_check_link_states(struct ar8xxx_p - /* flush ARL entries for this port if it went down*/ - if (!link_new) - priv->chip->atu_flush_port(priv, i); -- dev_info(&priv->phy->mdio.dev, "Port %d is %s\n", -+ dev_info(&priv->phy->dev, "Port %d is %s\n", - i, link_new ? "up" : "down"); - } - -@@ -2088,10 +2088,10 @@ ar8xxx_phy_read_status(struct phy_device - if (phydev->state == PHY_CHANGELINK) - ar8xxx_check_link_states(priv); - -- if (phydev->mdio.addr != 0) -+ if (phydev->addr != 0) - return genphy_read_status(phydev); - -- ar8216_read_port_link(priv, phydev->mdio.addr, &link); -+ ar8216_read_port_link(priv, phydev->addr, &link); - phydev->link = !!link.link; - if (!phydev->link) - return 0; -@@ -2122,7 +2122,7 @@ ar8xxx_phy_read_status(struct phy_device - static int - ar8xxx_phy_config_aneg(struct phy_device *phydev) - { -- if (phydev->mdio.addr == 0) -+ if (phydev->addr == 0) - return 0; - - return genphy_config_aneg(phydev); -@@ -2177,15 +2177,15 @@ ar8xxx_phy_probe(struct phy_device *phyd - int ret; - - /* skip PHYs at unused adresses */ -- if (phydev->mdio.addr != 0 && phydev->mdio.addr != 3 && phydev->mdio.addr != 4) -+ if (phydev->addr != 0 && phydev->addr != 3 && phydev->addr != 4) - return -ENODEV; - -- if (!ar8xxx_is_possible(phydev->mdio.bus)) -+ if (!ar8xxx_is_possible(phydev->bus)) - return -ENODEV; - - mutex_lock(&ar8xxx_dev_list_lock); - list_for_each_entry(priv, &ar8xxx_dev_list, list) -- if (priv->mii_bus == phydev->mdio.bus) -+ if (priv->mii_bus == phydev->bus) - goto found; - - priv = ar8xxx_create(); -@@ -2194,7 +2194,7 @@ ar8xxx_phy_probe(struct phy_device *phyd - goto unlock; - } - -- priv->mii_bus = phydev->mdio.bus; -+ priv->mii_bus = phydev->bus; - - ret = ar8xxx_probe_switch(priv); - if (ret) -@@ -2215,7 +2215,7 @@ ar8xxx_phy_probe(struct phy_device *phyd - found: - priv->use_count++; - -- if (phydev->mdio.addr == 0) { -+ if (phydev->addr == 0) { - if (ar8xxx_has_gige(priv)) { - phydev->supported = SUPPORTED_1000baseT_Full; - phydev->advertising = ADVERTISED_1000baseT_Full; -@@ -2305,21 +2305,33 @@ ar8xxx_phy_soft_reset(struct phy_device - return 0; - } - --static struct phy_driver ar8xxx_phy_driver[] = { -- { -- .phy_id = 0x004d0000, -- .name = "Atheros AR8216/AR8236/AR8316", -- .phy_id_mask = 0xffff0000, -- .features = PHY_BASIC_FEATURES, -- .probe = ar8xxx_phy_probe, -- .remove = ar8xxx_phy_remove, -- .detach = ar8xxx_phy_detach, -- .config_init = ar8xxx_phy_config_init, -- .config_aneg = ar8xxx_phy_config_aneg, -- .read_status = ar8xxx_phy_read_status, -- .soft_reset = ar8xxx_phy_soft_reset, -- } -+static struct phy_driver ar8xxx_phy_driver = { -+ .phy_id = 0x004d0000, -+ .name = "Atheros AR8216/AR8236/AR8316", -+ .phy_id_mask = 0xffff0000, -+ .features = PHY_BASIC_FEATURES, -+ .probe = ar8xxx_phy_probe, -+ .remove = ar8xxx_phy_remove, -+ .detach = ar8xxx_phy_detach, -+ .config_init = ar8xxx_phy_config_init, -+ .config_aneg = ar8xxx_phy_config_aneg, -+ .read_status = ar8xxx_phy_read_status, -+ .soft_reset = ar8xxx_phy_soft_reset, -+ .driver = { .owner = THIS_MODULE }, - }; - --module_phy_driver(ar8xxx_phy_driver); -+int __init -+ar8xxx_init(void) -+{ -+ return phy_driver_register(&ar8xxx_phy_driver); -+} -+ -+void __exit -+ar8xxx_exit(void) -+{ -+ phy_driver_unregister(&ar8xxx_phy_driver); -+} -+ -+module_init(ar8xxx_init); -+module_exit(ar8xxx_exit); - MODULE_LICENSE("GPL"); ---- a/drivers/net/phy/ar8327.c -+++ b/drivers/net/phy/ar8327.c -@@ -662,11 +662,11 @@ ar8327_hw_init(struct ar8xxx_priv *priv) - if (!priv->chip_data) - return -ENOMEM; - -- if (priv->phy->mdio.dev.of_node) -- ret = ar8327_hw_config_of(priv, priv->phy->mdio.dev.of_node); -+ if (priv->phy->dev.of_node) -+ ret = ar8327_hw_config_of(priv, priv->phy->dev.of_node); - else - ret = ar8327_hw_config_pdata(priv, -- priv->phy->mdio.dev.platform_data); -+ priv->phy->dev.platform_data); - - if (ret) - return ret; ---- a/drivers/net/phy/ip17xx.c -+++ b/drivers/net/phy/ip17xx.c -@@ -1273,7 +1273,7 @@ static int ip17xx_probe(struct phy_devic - int err; - - /* We only attach to PHY 0, but use all available PHYs */ -- if (pdev->mdio.addr != 0) -+ if (pdev->addr != 0) - return -ENODEV; - - state = kzalloc(sizeof(*state), GFP_KERNEL); -@@ -1283,7 +1283,7 @@ static int ip17xx_probe(struct phy_devic - dev = &state->dev; - - pdev->priv = state; -- state->mii_bus = pdev->mdio.bus; -+ state->mii_bus = pdev->bus; - - err = get_model(state); - if (err < 0) -@@ -1295,7 +1295,7 @@ static int ip17xx_probe(struct phy_devic - dev->name = state->regs->NAME; - dev->ops = &ip17xx_ops; - -- pr_info("IP17xx: Found %s at %s\n", dev->name, dev_name(&pdev->mdio.dev)); -+ pr_info("IP17xx: Found %s at %s\n", dev->name, dev_name(&pdev->dev)); - return 0; - - error: -@@ -1353,25 +1353,58 @@ static int ip17xx_read_status(struct phy - return 0; - } - --static struct phy_driver ip17xx_driver[] = { -- { -- .name = "IC+ IP17xx", -- .phy_id = 0x02430c00, -- .phy_id_mask = 0x0ffffc00, -- .features = PHY_BASIC_FEATURES, -- .probe = ip17xx_probe, -- .remove = ip17xx_remove, -- .config_init = ip17xx_config_init, -- .config_aneg = ip17xx_config_aneg, -- .aneg_done = ip17xx_aneg_done, -- .update_link = ip17xx_update_link, -- .read_status = ip17xx_read_status, -- } -+static struct phy_driver ip17xx_driver = { -+ .name = "IC+ IP17xx", -+ .phy_id = 0x02430c00, -+ .phy_id_mask = 0x0ffffc00, -+ .features = PHY_BASIC_FEATURES, -+ .probe = ip17xx_probe, -+ .remove = ip17xx_remove, -+ .config_init = ip17xx_config_init, -+ .config_aneg = ip17xx_config_aneg, -+ .aneg_done = ip17xx_aneg_done, -+ .update_link = ip17xx_update_link, -+ .read_status = ip17xx_read_status, -+ .driver = { .owner = THIS_MODULE }, - }; - --module_phy_driver(ip17xx_driver); -+static struct phy_driver ip175a_driver = { -+ .name = "IC+ IP175A", -+ .phy_id = 0x02430c50, -+ .phy_id_mask = 0x0ffffff0, -+ .features = PHY_BASIC_FEATURES, -+ .probe = ip17xx_probe, -+ .remove = ip17xx_remove, -+ .config_init = ip17xx_config_init, -+ .config_aneg = ip17xx_config_aneg, -+ .aneg_done = ip17xx_aneg_done, -+ .update_link = ip17xx_update_link, -+ .read_status = ip17xx_read_status, -+ .driver = { .owner = THIS_MODULE }, -+}; -+ -+ -+int __init ip17xx_init(void) -+{ -+ int ret; -+ -+ ret = phy_driver_register(&ip175a_driver); -+ if (ret < 0) -+ return ret; -+ -+ return phy_driver_register(&ip17xx_driver); -+} -+ -+void __exit ip17xx_exit(void) -+{ -+ phy_driver_unregister(&ip17xx_driver); -+ phy_driver_unregister(&ip175a_driver); -+} - - MODULE_AUTHOR("Patrick Horn "); - MODULE_AUTHOR("Felix Fietkau "); - MODULE_AUTHOR("Martin Mares "); - MODULE_LICENSE("GPL"); -+ -+module_init(ip17xx_init); -+module_exit(ip17xx_exit); ---- a/drivers/net/phy/mvswitch.c -+++ b/drivers/net/phy/mvswitch.c -@@ -50,17 +50,13 @@ struct mvswitch_priv { - static inline u16 - r16(struct phy_device *phydev, int addr, int reg) - { -- struct mii_bus *bus = phydev->mdio.bus; -- -- return bus->read(bus, addr, reg); -+ return phydev->bus->read(phydev->bus, addr, reg); - } - - static inline void - w16(struct phy_device *phydev, int addr, int reg, u16 val) - { -- struct mii_bus *bus = phydev->mdio.bus; -- -- bus->write(bus, addr, reg, val); -+ phydev->bus->write(phydev->bus, addr, reg, val); - } - - -@@ -398,13 +394,12 @@ mvswitch_probe(struct phy_device *pdev) - static int - mvswitch_fixup(struct phy_device *dev) - { -- struct mii_bus *bus = dev->mdio.bus; - u16 reg; - -- if (dev->mdio.addr != 0x10) -+ if (dev->addr != 0x10) - return 0; - -- reg = bus->read(bus, MV_PORTREG(IDENT, 0)) & MV_IDENT_MASK; -+ reg = dev->bus->read(dev->bus, MV_PORTREG(IDENT, 0)) & MV_IDENT_MASK; - if (reg != MV_IDENT_VALUE) - return 0; - -@@ -425,13 +420,14 @@ static struct phy_driver mvswitch_driver - .config_aneg = &mvswitch_config_aneg, - .aneg_done = &mvswitch_aneg_done, - .read_status = &mvswitch_read_status, -+ .driver = { .owner = THIS_MODULE,}, - }; - - static int __init - mvswitch_init(void) - { - phy_register_fixup_for_id(PHY_ANY_ID, mvswitch_fixup); -- return phy_driver_register(&mvswitch_driver, THIS_MODULE); -+ return phy_driver_register(&mvswitch_driver); - } - - static void __exit ---- a/drivers/net/phy/psb6970.c -+++ b/drivers/net/phy/psb6970.c -@@ -70,16 +70,12 @@ struct psb6970_priv { - - static u16 psb6970_mii_read(struct phy_device *phydev, int reg) - { -- struct mii_bus *bus = phydev->mdio.bus; -- -- return bus->read(bus, PHYADDR(reg)); -+ return phydev->bus->read(phydev->bus, PHYADDR(reg)); - } - - static void psb6970_mii_write(struct phy_device *phydev, int reg, u16 val) - { -- struct mii_bus *bus = phydev->mdio.bus; -- -- bus->write(bus, PHYADDR(reg), val); -+ phydev->bus->write(phydev->bus, PHYADDR(reg), val); - } - - static int -@@ -316,11 +312,11 @@ static int psb6970_config_init(struct ph - - priv->phy = pdev; - -- if (pdev->mdio.addr == 0) -+ if (pdev->addr == 0) - printk(KERN_INFO "%s: psb6970 switch driver attached.\n", - pdev->attached_dev->name); - -- if (pdev->mdio.addr != 0) { -+ if (pdev->addr != 0) { - kfree(priv); - return 0; - } -@@ -388,14 +384,14 @@ static void psb6970_remove(struct phy_de - if (!priv) - return; - -- if (pdev->mdio.addr == 0) -+ if (pdev->addr == 0) - unregister_switch(&priv->dev); - kfree(priv); - } - - static int psb6970_fixup(struct phy_device *dev) - { -- struct mii_bus *bus = dev->mdio.bus; -+ struct mii_bus *bus = dev->bus; - u16 reg; - - /* look for the switch on the bus */ -@@ -419,12 +415,13 @@ static struct phy_driver psb6970_driver - .config_init = &psb6970_config_init, - .config_aneg = &psb6970_config_aneg, - .read_status = &psb6970_read_status, -+ .driver = {.owner = THIS_MODULE}, - }; - - int __init psb6970_init(void) - { - phy_register_fixup_for_id(PHY_ANY_ID, psb6970_fixup); -- return phy_driver_register(&psb6970_driver, THIS_MODULE); -+ return phy_driver_register(&psb6970_driver); - } - - module_init(psb6970_init); ---- a/drivers/net/phy/rtl8306.c -+++ b/drivers/net/phy/rtl8306.c -@@ -877,7 +877,7 @@ rtl8306_config_init(struct phy_device *p - int err; - - /* Only init the switch for the primary PHY */ -- if (pdev->mdio.addr != 0) -+ if (pdev->addr != 0) - return 0; - - val.value.i = 1; -@@ -887,7 +887,7 @@ rtl8306_config_init(struct phy_device *p - priv->dev.ops = &rtl8306_ops; - priv->do_cpu = 0; - priv->page = -1; -- priv->bus = pdev->mdio.bus; -+ priv->bus = pdev->bus; - - chipid = rtl_get(dev, RTL_REG_CHIPID); - chipver = rtl_get(dev, RTL_REG_CHIPVER); -@@ -933,13 +933,13 @@ rtl8306_fixup(struct phy_device *pdev) - u16 chipid; - - /* Attach to primary LAN port and WAN port */ -- if (pdev->mdio.addr != 0 && pdev->mdio.addr != 4) -+ if (pdev->addr != 0 && pdev->addr != 4) - return 0; - - memset(&priv, 0, sizeof(priv)); - priv.fixup = true; - priv.page = -1; -- priv.bus = pdev->mdio.bus; -+ priv.bus = pdev->bus; - chipid = rtl_get(&priv.dev, RTL_REG_CHIPID); - if (chipid == 0x5988) - pdev->phy_id = RTL8306_MAGIC; -@@ -957,14 +957,14 @@ rtl8306_probe(struct phy_device *pdev) - * share one rtl_priv instance between virtual phy - * devices on the same bus - */ -- if (priv->bus == pdev->mdio.bus) -+ if (priv->bus == pdev->bus) - goto found; - } - priv = kzalloc(sizeof(struct rtl_priv), GFP_KERNEL); - if (!priv) - return -ENOMEM; - -- priv->bus = pdev->mdio.bus; -+ priv->bus = pdev->bus; - - found: - pdev->priv = priv; -@@ -985,7 +985,7 @@ rtl8306_config_aneg(struct phy_device *p - struct rtl_priv *priv = pdev->priv; - - /* Only for WAN */ -- if (pdev->mdio.addr == 0) -+ if (pdev->addr == 0) - return 0; - - /* Restart autonegotiation */ -@@ -1001,7 +1001,7 @@ rtl8306_read_status(struct phy_device *p - struct rtl_priv *priv = pdev->priv; - struct switch_dev *dev = &priv->dev; - -- if (pdev->mdio.addr == 4) { -+ if (pdev->addr == 4) { - /* WAN */ - pdev->speed = rtl_get(dev, RTL_PORT_REG(4, SPEED)) ? SPEED_100 : SPEED_10; - pdev->duplex = rtl_get(dev, RTL_PORT_REG(4, DUPLEX)) ? DUPLEX_FULL : DUPLEX_HALF; -@@ -1044,6 +1044,7 @@ static struct phy_driver rtl8306_driver - .config_init = &rtl8306_config_init, - .config_aneg = &rtl8306_config_aneg, - .read_status = &rtl8306_read_status, -+ .driver = { .owner = THIS_MODULE,}, - }; - - -@@ -1051,7 +1052,7 @@ static int __init - rtl_init(void) - { - phy_register_fixup_for_id(PHY_ANY_ID, rtl8306_fixup); -- return phy_driver_register(&rtl8306_driver, THIS_MODULE); -+ return phy_driver_register(&rtl8306_driver); - } - - static void __exit diff --git a/target/linux/generic/pending-3.18/003-myloader_backport.patch b/target/linux/generic/pending-3.18/003-myloader_backport.patch deleted file mode 100644 index 846b25dc04..0000000000 --- a/target/linux/generic/pending-3.18/003-myloader_backport.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/drivers/mtd/myloader.c -+++ b/drivers/mtd/myloader.c -@@ -33,7 +33,7 @@ struct part_data { - }; - - static int myloader_parse_partitions(struct mtd_info *master, -- const struct mtd_partition **pparts, -+ struct mtd_partition **pparts, - struct mtd_part_parser_data *data) - { - struct part_data *buf; diff --git a/target/linux/generic/pending-3.18/020-ssb_update.patch b/target/linux/generic/pending-3.18/020-ssb_update.patch deleted file mode 100644 index f94d160fc6..0000000000 --- a/target/linux/generic/pending-3.18/020-ssb_update.patch +++ /dev/null @@ -1,134 +0,0 @@ ---- a/drivers/ssb/pcihost_wrapper.c -+++ b/drivers/ssb/pcihost_wrapper.c -@@ -11,15 +11,17 @@ - * Licensed under the GNU/GPL. See COPYING for details. - */ - -+#include - #include - #include - #include - #include - - --#ifdef CONFIG_PM --static int ssb_pcihost_suspend(struct pci_dev *dev, pm_message_t state) -+#ifdef CONFIG_PM_SLEEP -+static int ssb_pcihost_suspend(struct device *d) - { -+ struct pci_dev *dev = to_pci_dev(d); - struct ssb_bus *ssb = pci_get_drvdata(dev); - int err; - -@@ -28,17 +30,23 @@ static int ssb_pcihost_suspend(struct pc - return err; - pci_save_state(dev); - pci_disable_device(dev); -- pci_set_power_state(dev, pci_choose_state(dev, state)); -+ -+ /* if there is a wakeup enabled child device on ssb bus, -+ enable pci wakeup posibility. */ -+ device_set_wakeup_enable(d, d->power.wakeup_path); -+ -+ pci_prepare_to_sleep(dev); - - return 0; - } - --static int ssb_pcihost_resume(struct pci_dev *dev) -+static int ssb_pcihost_resume(struct device *d) - { -+ struct pci_dev *dev = to_pci_dev(d); - struct ssb_bus *ssb = pci_get_drvdata(dev); - int err; - -- pci_set_power_state(dev, PCI_D0); -+ pci_back_from_sleep(dev); - err = pci_enable_device(dev); - if (err) - return err; -@@ -49,10 +57,12 @@ static int ssb_pcihost_resume(struct pci - - return 0; - } --#else /* CONFIG_PM */ --# define ssb_pcihost_suspend NULL --# define ssb_pcihost_resume NULL --#endif /* CONFIG_PM */ -+ -+static const struct dev_pm_ops ssb_pcihost_pm_ops = { -+ SET_SYSTEM_SLEEP_PM_OPS(ssb_pcihost_suspend, ssb_pcihost_resume) -+}; -+ -+#endif /* CONFIG_PM_SLEEP */ - - static int ssb_pcihost_probe(struct pci_dev *dev, - const struct pci_device_id *id) -@@ -115,8 +125,9 @@ int ssb_pcihost_register(struct pci_driv - { - driver->probe = ssb_pcihost_probe; - driver->remove = ssb_pcihost_remove; -- driver->suspend = ssb_pcihost_suspend; -- driver->resume = ssb_pcihost_resume; -+#ifdef CONFIG_PM_SLEEP -+ driver->driver.pm = &ssb_pcihost_pm_ops; -+#endif - - return pci_register_driver(driver); - } ---- a/drivers/ssb/driver_pcicore.c -+++ b/drivers/ssb/driver_pcicore.c -@@ -357,6 +357,16 @@ static void ssb_pcicore_init_hostmode(st - pcicore_write32(pc, SSB_PCICORE_SBTOPCI2, - SSB_PCICORE_SBTOPCI_MEM | SSB_PCI_DMA); - -+ /* -+ * Accessing PCI config without a proper delay after devices reset (not -+ * GPIO reset) was causing reboots on WRT300N v1.0 (BCM4704). -+ * Tested delay 850 us lowered reboot chance to 50-80%, 1000 us fixed it -+ * completely. Flushing all writes was also tested but with no luck. -+ * The same problem was reported for WRT350N v1 (BCM4705), so we just -+ * sleep here unconditionally. -+ */ -+ usleep_range(1000, 2000); -+ - /* Enable PCI bridge BAR0 prefetch and burst */ - val = PCI_COMMAND_MASTER | PCI_COMMAND_MEMORY; - ssb_extpci_write_config(pc, 0, 0, 0, PCI_COMMAND, &val, 2); ---- a/drivers/ssb/main.c -+++ b/drivers/ssb/main.c -@@ -90,25 +90,6 @@ found: - } - #endif /* CONFIG_SSB_PCMCIAHOST */ - --#ifdef CONFIG_SSB_SDIOHOST --struct ssb_bus *ssb_sdio_func_to_bus(struct sdio_func *func) --{ -- struct ssb_bus *bus; -- -- ssb_buses_lock(); -- list_for_each_entry(bus, &buses, list) { -- if (bus->bustype == SSB_BUSTYPE_SDIO && -- bus->host_sdio == func) -- goto found; -- } -- bus = NULL; --found: -- ssb_buses_unlock(); -- -- return bus; --} --#endif /* CONFIG_SSB_SDIOHOST */ -- - int ssb_for_each_bus_call(unsigned long data, - int (*func)(struct ssb_bus *bus, unsigned long data)) - { -@@ -1154,6 +1135,8 @@ static u32 ssb_tmslow_reject_bitmask(str - case SSB_IDLOW_SSBREV_25: /* TODO - find the proper REJECT bit */ - case SSB_IDLOW_SSBREV_27: /* same here */ - return SSB_TMSLOW_REJECT; /* this is a guess */ -+ case SSB_IDLOW_SSBREV: -+ break; - default: - WARN(1, KERN_INFO "ssb: Backplane Revision 0x%.8X\n", rev); - } diff --git a/target/linux/generic/pending-3.18/021-ssb_sprom.patch b/target/linux/generic/pending-3.18/021-ssb_sprom.patch deleted file mode 100644 index 52d8080dfe..0000000000 --- a/target/linux/generic/pending-3.18/021-ssb_sprom.patch +++ /dev/null @@ -1,32 +0,0 @@ ---- a/include/linux/ssb/ssb.h -+++ b/include/linux/ssb/ssb.h -@@ -29,10 +29,13 @@ struct ssb_sprom { - u8 il0mac[6] __aligned(sizeof(u16)); /* MAC address for 802.11b/g */ - u8 et0mac[6] __aligned(sizeof(u16)); /* MAC address for Ethernet */ - u8 et1mac[6] __aligned(sizeof(u16)); /* MAC address for 802.11a */ -+ u8 et2mac[6] __aligned(sizeof(u16)); /* MAC address for extra Ethernet */ - u8 et0phyaddr; /* MII address for enet0 */ - u8 et1phyaddr; /* MII address for enet1 */ -+ u8 et2phyaddr; /* MII address for enet2 */ - u8 et0mdcport; /* MDIO for enet0 */ - u8 et1mdcport; /* MDIO for enet1 */ -+ u8 et2mdcport; /* MDIO for enet2 */ - u16 dev_id; /* Device ID overriding e.g. PCI ID */ - u16 board_rev; /* Board revision number from SPROM. */ - u16 board_num; /* Board number from SPROM. */ -@@ -88,11 +91,14 @@ struct ssb_sprom { - u32 ofdm5glpo; /* 5.2GHz OFDM power offset */ - u32 ofdm5gpo; /* 5.3GHz OFDM power offset */ - u32 ofdm5ghpo; /* 5.8GHz OFDM power offset */ -+ u32 boardflags; -+ u32 boardflags2; -+ u32 boardflags3; -+ /* TODO: Switch all drivers to new u32 fields and drop below ones */ - u16 boardflags_lo; /* Board flags (bits 0-15) */ - u16 boardflags_hi; /* Board flags (bits 16-31) */ - u16 boardflags2_lo; /* Board flags (bits 32-47) */ - u16 boardflags2_hi; /* Board flags (bits 48-63) */ -- /* TODO store board flags in a single u64 */ - - struct ssb_sprom_core_pwr_info core_pwr_info[4]; - diff --git a/target/linux/generic/pending-3.18/025-bcma_backport.patch b/target/linux/generic/pending-3.18/025-bcma_backport.patch deleted file mode 100644 index ec1cb004b7..0000000000 --- a/target/linux/generic/pending-3.18/025-bcma_backport.patch +++ /dev/null @@ -1,286 +0,0 @@ ---- a/drivers/bcma/bcma_private.h -+++ b/drivers/bcma/bcma_private.h -@@ -22,6 +22,7 @@ struct bcma_bus; - /* main.c */ - bool bcma_wait_value(struct bcma_device *core, u16 reg, u32 mask, u32 value, - int timeout); -+void bcma_prepare_core(struct bcma_bus *bus, struct bcma_device *core); - int bcma_bus_register(struct bcma_bus *bus); - void bcma_bus_unregister(struct bcma_bus *bus); - int __init bcma_bus_early_register(struct bcma_bus *bus, ---- a/drivers/bcma/driver_chipcommon.c -+++ b/drivers/bcma/driver_chipcommon.c -@@ -339,7 +339,7 @@ void bcma_chipco_serial_init(struct bcma - return; - } - -- irq = bcma_core_irq(cc->core); -+ irq = bcma_core_irq(cc->core, 0); - - /* Determine the registers of the UARTs */ - cc->nr_serial_ports = (cc->capabilities & BCMA_CC_CAP_NRUART); ---- a/drivers/bcma/driver_gpio.c -+++ b/drivers/bcma/driver_gpio.c -@@ -152,7 +152,7 @@ static int bcma_gpio_irq_domain_init(str - handle_simple_irq); - } - -- hwirq = bcma_core_irq(cc->core); -+ hwirq = bcma_core_irq(cc->core, 0); - err = request_irq(hwirq, bcma_gpio_irq_handler, IRQF_SHARED, "gpio", - cc); - if (err) -@@ -183,7 +183,7 @@ static void bcma_gpio_irq_domain_exit(st - return; - - bcma_cc_mask32(cc, BCMA_CC_IRQMASK, ~BCMA_CC_IRQ_GPIO); -- free_irq(bcma_core_irq(cc->core), cc); -+ free_irq(bcma_core_irq(cc->core, 0), cc); - for (gpio = 0; gpio < chip->ngpio; gpio++) { - int irq = irq_find_mapping(cc->irq_domain, gpio); - ---- a/drivers/bcma/driver_mips.c -+++ b/drivers/bcma/driver_mips.c -@@ -115,7 +115,7 @@ static u32 bcma_core_mips_irqflag(struct - * If disabled, 5 is returned. - * If not supported, 6 is returned. - */ --static unsigned int bcma_core_mips_irq(struct bcma_device *dev) -+unsigned int bcma_core_mips_irq(struct bcma_device *dev) - { - struct bcma_device *mdev = dev->bus->drv_mips.core; - u32 irqflag; -@@ -133,13 +133,6 @@ static unsigned int bcma_core_mips_irq(s - return 5; - } - --unsigned int bcma_core_irq(struct bcma_device *dev) --{ -- unsigned int mips_irq = bcma_core_mips_irq(dev); -- return mips_irq <= 4 ? mips_irq + 2 : 0; --} --EXPORT_SYMBOL(bcma_core_irq); -- - static void bcma_core_mips_set_irq(struct bcma_device *dev, unsigned int irq) - { - unsigned int oldirq = bcma_core_mips_irq(dev); -@@ -423,7 +416,7 @@ void bcma_core_mips_init(struct bcma_drv - break; - default: - list_for_each_entry(core, &bus->cores, list) { -- core->irq = bcma_core_irq(core); -+ core->irq = bcma_core_irq(core, 0); - } - bcma_err(bus, - "Unknown device (0x%x) found, can not configure IRQs\n", ---- a/drivers/bcma/driver_pci_host.c -+++ b/drivers/bcma/driver_pci_host.c -@@ -593,7 +593,7 @@ int bcma_core_pci_plat_dev_init(struct p - pr_info("PCI: Fixing up device %s\n", pci_name(dev)); - - /* Fix up interrupt lines */ -- dev->irq = bcma_core_irq(pc_host->pdev->core); -+ dev->irq = bcma_core_irq(pc_host->pdev->core, 0); - pci_write_config_byte(dev, PCI_INTERRUPT_LINE, dev->irq); - - readrq = pcie_get_readrq(dev); -@@ -617,6 +617,6 @@ int bcma_core_pci_pcibios_map_irq(const - - pc_host = container_of(dev->bus->ops, struct bcma_drv_pci_host, - pci_ops); -- return bcma_core_irq(pc_host->pdev->core); -+ return bcma_core_irq(pc_host->pdev->core, 0); - } - EXPORT_SYMBOL(bcma_core_pci_pcibios_map_irq); ---- a/drivers/bcma/main.c -+++ b/drivers/bcma/main.c -@@ -11,6 +11,7 @@ - #include - #include - #include -+#include - - MODULE_DESCRIPTION("Broadcom's specific AMBA driver"); - MODULE_LICENSE("GPL"); -@@ -153,6 +154,46 @@ static struct device_node *bcma_of_find_ - return NULL; - } - -+static int bcma_of_irq_parse(struct platform_device *parent, -+ struct bcma_device *core, -+ struct of_phandle_args *out_irq, int num) -+{ -+ __be32 laddr[1]; -+ int rc; -+ -+ if (core->dev.of_node) { -+ rc = of_irq_parse_one(core->dev.of_node, num, out_irq); -+ if (!rc) -+ return rc; -+ } -+ -+ out_irq->np = parent->dev.of_node; -+ out_irq->args_count = 1; -+ out_irq->args[0] = num; -+ -+ laddr[0] = cpu_to_be32(core->addr); -+ return of_irq_parse_raw(laddr, out_irq); -+} -+ -+static unsigned int bcma_of_get_irq(struct platform_device *parent, -+ struct bcma_device *core, int num) -+{ -+ struct of_phandle_args out_irq; -+ int ret; -+ -+ if (!parent || !parent->dev.of_node) -+ return 0; -+ -+ ret = bcma_of_irq_parse(parent, core, &out_irq, num); -+ if (ret) { -+ bcma_debug(core->bus, "bcma_of_get_irq() failed with rc=%d\n", -+ ret); -+ return 0; -+ } -+ -+ return irq_create_of_mapping(&out_irq); -+} -+ - static void bcma_of_fill_device(struct platform_device *parent, - struct bcma_device *core) - { -@@ -161,18 +202,47 @@ static void bcma_of_fill_device(struct p - node = bcma_of_find_child_device(parent, core); - if (node) - core->dev.of_node = node; -+ -+ core->irq = bcma_of_get_irq(parent, core, 0); - } - #else - static void bcma_of_fill_device(struct platform_device *parent, - struct bcma_device *core) - { - } -+static inline unsigned int bcma_of_get_irq(struct platform_device *parent, -+ struct bcma_device *core, int num) -+{ -+ return 0; -+} - #endif /* CONFIG_OF */ - --static void bcma_register_core(struct bcma_bus *bus, struct bcma_device *core) -+unsigned int bcma_core_irq(struct bcma_device *core, int num) - { -- int err; -+ struct bcma_bus *bus = core->bus; -+ unsigned int mips_irq; -+ -+ switch (bus->hosttype) { -+ case BCMA_HOSTTYPE_PCI: -+ return bus->host_pci->irq; -+ case BCMA_HOSTTYPE_SOC: -+ if (bus->drv_mips.core && num == 0) { -+ mips_irq = bcma_core_mips_irq(core); -+ return mips_irq <= 4 ? mips_irq + 2 : 0; -+ } -+ if (bus->host_pdev) -+ return bcma_of_get_irq(bus->host_pdev, core, num); -+ return 0; -+ case BCMA_HOSTTYPE_SDIO: -+ return 0; -+ } - -+ return 0; -+} -+EXPORT_SYMBOL(bcma_core_irq); -+ -+void bcma_prepare_core(struct bcma_bus *bus, struct bcma_device *core) -+{ - core->dev.release = bcma_release_core_dev; - core->dev.bus = &bcma_bus_type; - dev_set_name(&core->dev, "bcma%d:%d", bus->num, core->core_index); -@@ -196,6 +266,11 @@ static void bcma_register_core(struct bc - case BCMA_HOSTTYPE_SDIO: - break; - } -+} -+ -+static void bcma_register_core(struct bcma_bus *bus, struct bcma_device *core) -+{ -+ int err; - - err = device_register(&core->dev); - if (err) { ---- a/drivers/bcma/scan.c -+++ b/drivers/bcma/scan.c -@@ -505,6 +505,7 @@ int bcma_bus_scan(struct bcma_bus *bus) - bus->nr_cores++; - other_core = bcma_find_core_reverse(bus, core->id.id); - core->core_unit = (other_core == NULL) ? 0 : other_core->core_unit + 1; -+ bcma_prepare_core(bus, core); - - bcma_info(bus, "Core %d found: %s (manuf 0x%03X, id 0x%03X, rev 0x%02X, class 0x%X)\n", - core->core_index, bcma_device_name(&core->id), ---- a/include/linux/bcma/bcma.h -+++ b/include/linux/bcma/bcma.h -@@ -448,4 +448,6 @@ extern u32 bcma_chipco_pll_read(struct b - #define BCMA_DMA_TRANSLATION_DMA64_CMT 0x80000000 /* Client Mode Translation for 64-bit DMA */ - extern u32 bcma_core_dma_translation(struct bcma_device *core); - -+extern unsigned int bcma_core_irq(struct bcma_device *core, int num); -+ - #endif /* LINUX_BCMA_H_ */ ---- a/include/linux/bcma/bcma_driver_mips.h -+++ b/include/linux/bcma/bcma_driver_mips.h -@@ -43,12 +43,12 @@ struct bcma_drv_mips { - extern void bcma_core_mips_init(struct bcma_drv_mips *mcore); - extern void bcma_core_mips_early_init(struct bcma_drv_mips *mcore); - --extern unsigned int bcma_core_irq(struct bcma_device *core); -+extern unsigned int bcma_core_mips_irq(struct bcma_device *dev); - #else - static inline void bcma_core_mips_init(struct bcma_drv_mips *mcore) { } - static inline void bcma_core_mips_early_init(struct bcma_drv_mips *mcore) { } - --static inline unsigned int bcma_core_irq(struct bcma_device *core) -+static inline unsigned int bcma_core_mips_irq(struct bcma_device *dev) - { - return 0; - } ---- a/Documentation/devicetree/bindings/bus/bcma.txt -+++ b/Documentation/devicetree/bindings/bus/bcma.txt -@@ -8,6 +8,11 @@ Required properties: - - The cores on the AXI bus are automatically detected by bcma with the - memory ranges they are using and they get registered afterwards. -+Automatic detection of the IRQ number is not working on -+BCM47xx/BCM53xx ARM SoCs. To assign IRQ numbers to the cores, provide -+them manually through device tree. Use an interrupt-map to specify the -+IRQ used by the devices on the bus. The first address is just an index, -+because we do not have any special register. - - The top-level axi bus may contain children representing attached cores - (devices). This is needed since some hardware details can't be auto -@@ -22,6 +27,22 @@ Example: - ranges = <0x00000000 0x18000000 0x00100000>; - #address-cells = <1>; - #size-cells = <1>; -+ #interrupt-cells = <1>; -+ interrupt-map-mask = <0x000fffff 0xffff>; -+ interrupt-map = -+ /* Ethernet Controller 0 */ -+ <0x00024000 0 &gic GIC_SPI 147 IRQ_TYPE_LEVEL_HIGH>, -+ -+ /* Ethernet Controller 1 */ -+ <0x00025000 0 &gic GIC_SPI 148 IRQ_TYPE_LEVEL_HIGH>; -+ -+ /* PCIe Controller 0 */ -+ <0x00012000 0 &gic GIC_SPI 126 IRQ_TYPE_LEVEL_HIGH>, -+ <0x00012000 1 &gic GIC_SPI 127 IRQ_TYPE_LEVEL_HIGH>, -+ <0x00012000 2 &gic GIC_SPI 128 IRQ_TYPE_LEVEL_HIGH>, -+ <0x00012000 3 &gic GIC_SPI 129 IRQ_TYPE_LEVEL_HIGH>, -+ <0x00012000 4 &gic GIC_SPI 130 IRQ_TYPE_LEVEL_HIGH>, -+ <0x00012000 5 &gic GIC_SPI 131 IRQ_TYPE_LEVEL_HIGH>; - - chipcommon { - reg = <0x00000000 0x1000>; diff --git a/target/linux/generic/pending-3.18/026-bcma-from-3.20.patch b/target/linux/generic/pending-3.18/026-bcma-from-3.20.patch deleted file mode 100644 index 628b0bd389..0000000000 --- a/target/linux/generic/pending-3.18/026-bcma-from-3.20.patch +++ /dev/null @@ -1,527 +0,0 @@ ---- a/drivers/bcma/bcma_private.h -+++ b/drivers/bcma/bcma_private.h -@@ -23,22 +23,18 @@ struct bcma_bus; - bool bcma_wait_value(struct bcma_device *core, u16 reg, u32 mask, u32 value, - int timeout); - void bcma_prepare_core(struct bcma_bus *bus, struct bcma_device *core); -+void bcma_init_bus(struct bcma_bus *bus); - int bcma_bus_register(struct bcma_bus *bus); - void bcma_bus_unregister(struct bcma_bus *bus); --int __init bcma_bus_early_register(struct bcma_bus *bus, -- struct bcma_device *core_cc, -- struct bcma_device *core_mips); -+int __init bcma_bus_early_register(struct bcma_bus *bus); - #ifdef CONFIG_PM - int bcma_bus_suspend(struct bcma_bus *bus); - int bcma_bus_resume(struct bcma_bus *bus); - #endif - - /* scan.c */ -+void bcma_detect_chip(struct bcma_bus *bus); - int bcma_bus_scan(struct bcma_bus *bus); --int __init bcma_bus_scan_early(struct bcma_bus *bus, -- struct bcma_device_id *match, -- struct bcma_device *core); --void bcma_init_bus(struct bcma_bus *bus); - - /* sprom.c */ - int bcma_sprom_get(struct bcma_bus *bus); -@@ -109,6 +105,14 @@ extern int bcma_chipco_watchdog_register - #ifdef CONFIG_BCMA_DRIVER_PCI_HOSTMODE - bool bcma_core_pci_is_in_hostmode(struct bcma_drv_pci *pc); - void bcma_core_pci_hostmode_init(struct bcma_drv_pci *pc); -+#else -+static inline bool bcma_core_pci_is_in_hostmode(struct bcma_drv_pci *pc) -+{ -+ return false; -+} -+static inline void bcma_core_pci_hostmode_init(struct bcma_drv_pci *pc) -+{ -+} - #endif /* CONFIG_BCMA_DRIVER_PCI_HOSTMODE */ - - #ifdef CONFIG_BCMA_DRIVER_GPIO ---- a/drivers/bcma/driver_chipcommon.c -+++ b/drivers/bcma/driver_chipcommon.c -@@ -79,7 +79,9 @@ static int bcma_chipco_watchdog_ticks_pe - - if (cc->capabilities & BCMA_CC_CAP_PMU) { - if (bus->chipinfo.id == BCMA_CHIP_ID_BCM4706) -- /* 4706 CC and PMU watchdogs are clocked at 1/4 of ALP clock */ -+ /* 4706 CC and PMU watchdogs are clocked at 1/4 of ALP -+ * clock -+ */ - return bcma_chipco_get_alp_clock(cc) / 4000; - else - /* based on 32KHz ILP clock */ -@@ -97,7 +99,8 @@ int bcma_chipco_watchdog_register(struct - wdt.driver_data = cc; - wdt.timer_set = bcma_chipco_watchdog_timer_set_wdt; - wdt.timer_set_ms = bcma_chipco_watchdog_timer_set_ms_wdt; -- wdt.max_timer_ms = bcma_chipco_watchdog_get_max_timer(cc) / cc->ticks_per_ms; -+ wdt.max_timer_ms = -+ bcma_chipco_watchdog_get_max_timer(cc) / cc->ticks_per_ms; - - pdev = platform_device_register_data(NULL, "bcm47xx-wdt", - cc->core->bus->num, &wdt, -@@ -175,7 +178,6 @@ void bcma_core_chipcommon_init(struct bc - u32 bcma_chipco_watchdog_timer_set(struct bcma_drv_cc *cc, u32 ticks) - { - u32 maxt; -- enum bcma_clkmode clkmode; - - maxt = bcma_chipco_watchdog_get_max_timer(cc); - if (cc->capabilities & BCMA_CC_CAP_PMU) { -@@ -185,8 +187,13 @@ u32 bcma_chipco_watchdog_timer_set(struc - ticks = maxt; - bcma_cc_write32(cc, BCMA_CC_PMU_WATCHDOG, ticks); - } else { -- clkmode = ticks ? BCMA_CLKMODE_FAST : BCMA_CLKMODE_DYNAMIC; -- bcma_core_set_clockmode(cc->core, clkmode); -+ struct bcma_bus *bus = cc->core->bus; -+ -+ if (bus->chipinfo.id != BCMA_CHIP_ID_BCM4707 && -+ bus->chipinfo.id != BCMA_CHIP_ID_BCM53018) -+ bcma_core_set_clockmode(cc->core, -+ ticks ? BCMA_CLKMODE_FAST : BCMA_CLKMODE_DYNAMIC); -+ - if (ticks > maxt) - ticks = maxt; - /* instant NMI */ -@@ -335,7 +342,8 @@ void bcma_chipco_serial_init(struct bcma - | BCMA_CC_CORECTL_UARTCLKEN); - } - } else { -- bcma_err(cc->core->bus, "serial not supported on this device ccrev: 0x%x\n", ccrev); -+ bcma_err(cc->core->bus, "serial not supported on this device ccrev: 0x%x\n", -+ ccrev); - return; - } - ---- a/drivers/bcma/driver_pci.c -+++ b/drivers/bcma/driver_pci.c -@@ -145,6 +145,47 @@ static u16 bcma_pcie_mdio_writeread(stru - } - - /************************************************** -+ * Early init. -+ **************************************************/ -+ -+static void bcma_core_pci_fixcfg(struct bcma_drv_pci *pc) -+{ -+ struct bcma_device *core = pc->core; -+ u16 val16, core_index; -+ uint regoff; -+ -+ regoff = BCMA_CORE_PCI_SPROM(BCMA_CORE_PCI_SPROM_PI_OFFSET); -+ core_index = (u16)core->core_index; -+ -+ val16 = pcicore_read16(pc, regoff); -+ if (((val16 & BCMA_CORE_PCI_SPROM_PI_MASK) >> BCMA_CORE_PCI_SPROM_PI_SHIFT) -+ != core_index) { -+ val16 = (core_index << BCMA_CORE_PCI_SPROM_PI_SHIFT) | -+ (val16 & ~BCMA_CORE_PCI_SPROM_PI_MASK); -+ pcicore_write16(pc, regoff, val16); -+ } -+} -+ -+/* -+ * Apply some early fixes required before accessing SPROM. -+ * See also si_pci_fixcfg. -+ */ -+void bcma_core_pci_early_init(struct bcma_drv_pci *pc) -+{ -+ if (pc->early_setup_done) -+ return; -+ -+ pc->hostmode = bcma_core_pci_is_in_hostmode(pc); -+ if (pc->hostmode) -+ goto out; -+ -+ bcma_core_pci_fixcfg(pc); -+ -+out: -+ pc->early_setup_done = true; -+} -+ -+/************************************************** - * Workarounds. - **************************************************/ - -@@ -175,24 +216,6 @@ static void bcma_pcicore_serdes_workarou - tmp & ~BCMA_CORE_PCI_PLL_CTRL_FREQDET_EN); - } - --static void bcma_core_pci_fixcfg(struct bcma_drv_pci *pc) --{ -- struct bcma_device *core = pc->core; -- u16 val16, core_index; -- uint regoff; -- -- regoff = BCMA_CORE_PCI_SPROM(BCMA_CORE_PCI_SPROM_PI_OFFSET); -- core_index = (u16)core->core_index; -- -- val16 = pcicore_read16(pc, regoff); -- if (((val16 & BCMA_CORE_PCI_SPROM_PI_MASK) >> BCMA_CORE_PCI_SPROM_PI_SHIFT) -- != core_index) { -- val16 = (core_index << BCMA_CORE_PCI_SPROM_PI_SHIFT) | -- (val16 & ~BCMA_CORE_PCI_SPROM_PI_MASK); -- pcicore_write16(pc, regoff, val16); -- } --} -- - /* Fix MISC config to allow coming out of L2/L3-Ready state w/o PRST */ - /* Needs to happen when coming out of 'standby'/'hibernate' */ - static void bcma_core_pci_config_fixup(struct bcma_drv_pci *pc) -@@ -216,7 +239,6 @@ static void bcma_core_pci_config_fixup(s - - static void bcma_core_pci_clientmode_init(struct bcma_drv_pci *pc) - { -- bcma_core_pci_fixcfg(pc); - bcma_pcicore_serdes_workaround(pc); - bcma_core_pci_config_fixup(pc); - } -@@ -226,13 +248,11 @@ void bcma_core_pci_init(struct bcma_drv_ - if (pc->setup_done) - return; - --#ifdef CONFIG_BCMA_DRIVER_PCI_HOSTMODE -- pc->hostmode = bcma_core_pci_is_in_hostmode(pc); -+ bcma_core_pci_early_init(pc); -+ - if (pc->hostmode) - bcma_core_pci_hostmode_init(pc); --#endif /* CONFIG_BCMA_DRIVER_PCI_HOSTMODE */ -- -- if (!pc->hostmode) -+ else - bcma_core_pci_clientmode_init(pc); - } - ---- a/drivers/bcma/host_pci.c -+++ b/drivers/bcma/host_pci.c -@@ -13,10 +13,12 @@ - - static void bcma_host_pci_switch_core(struct bcma_device *core) - { -+ int win2 = core->bus->host_is_pcie2 ? -+ BCMA_PCIE2_BAR0_WIN2 : BCMA_PCI_BAR0_WIN2; -+ - pci_write_config_dword(core->bus->host_pci, BCMA_PCI_BAR0_WIN, - core->addr); -- pci_write_config_dword(core->bus->host_pci, BCMA_PCI_BAR0_WIN2, -- core->wrap); -+ pci_write_config_dword(core->bus->host_pci, win2, core->wrap); - core->bus->mapped_core = core; - bcma_debug(core->bus, "Switched to core: 0x%X\n", core->id.id); - } ---- a/drivers/bcma/host_soc.c -+++ b/drivers/bcma/host_soc.c -@@ -193,7 +193,7 @@ int __init bcma_host_soc_init(struct bcm - int err; - - /* Scan bus and initialize it */ -- err = bcma_bus_early_register(bus, &soc->core_cc, &soc->core_mips); -+ err = bcma_bus_early_register(bus); - if (err) - iounmap(bus->mmio); - ---- a/drivers/bcma/main.c -+++ b/drivers/bcma/main.c -@@ -268,6 +268,18 @@ void bcma_prepare_core(struct bcma_bus * - } - } - -+void bcma_init_bus(struct bcma_bus *bus) -+{ -+ mutex_lock(&bcma_buses_mutex); -+ bus->num = bcma_bus_next_num++; -+ mutex_unlock(&bcma_buses_mutex); -+ -+ INIT_LIST_HEAD(&bus->cores); -+ bus->nr_cores = 0; -+ -+ bcma_detect_chip(bus); -+} -+ - static void bcma_register_core(struct bcma_bus *bus, struct bcma_device *core) - { - int err; -@@ -356,12 +368,19 @@ static void bcma_unregister_cores(struct - struct bcma_device *core, *tmp; - - list_for_each_entry_safe(core, tmp, &bus->cores, list) { -+ if (!core->dev_registered) -+ continue; - list_del(&core->list); -- if (core->dev_registered) -- device_unregister(&core->dev); -+ device_unregister(&core->dev); - } - if (bus->hosttype == BCMA_HOSTTYPE_SOC) - platform_device_unregister(bus->drv_cc.watchdog); -+ -+ /* Now noone uses internally-handled cores, we can free them */ -+ list_for_each_entry_safe(core, tmp, &bus->cores, list) { -+ list_del(&core->list); -+ kfree(core); -+ } - } - - int bcma_bus_register(struct bcma_bus *bus) -@@ -369,10 +388,6 @@ int bcma_bus_register(struct bcma_bus *b - int err; - struct bcma_device *core; - -- mutex_lock(&bcma_buses_mutex); -- bus->num = bcma_bus_next_num++; -- mutex_unlock(&bcma_buses_mutex); -- - /* Scan for devices (cores) */ - err = bcma_bus_scan(bus); - if (err) { -@@ -387,6 +402,13 @@ int bcma_bus_register(struct bcma_bus *b - bcma_core_chipcommon_early_init(&bus->drv_cc); - } - -+ /* Early init PCIE core */ -+ core = bcma_find_core(bus, BCMA_CORE_PCIE); -+ if (core) { -+ bus->drv_pci[0].core = core; -+ bcma_core_pci_early_init(&bus->drv_pci[0]); -+ } -+ - /* Cores providing flash access go before SPROM init */ - list_for_each_entry(core, &bus->cores, list) { - if (bcma_is_core_needed_early(core->id.id)) -@@ -459,7 +481,6 @@ int bcma_bus_register(struct bcma_bus *b - - void bcma_bus_unregister(struct bcma_bus *bus) - { -- struct bcma_device *cores[3]; - int err; - - err = bcma_gpio_unregister(&bus->drv_cc); -@@ -470,46 +491,23 @@ void bcma_bus_unregister(struct bcma_bus - - bcma_core_chipcommon_b_free(&bus->drv_cc_b); - -- cores[0] = bcma_find_core(bus, BCMA_CORE_MIPS_74K); -- cores[1] = bcma_find_core(bus, BCMA_CORE_PCIE); -- cores[2] = bcma_find_core(bus, BCMA_CORE_4706_MAC_GBIT_COMMON); -- - bcma_unregister_cores(bus); -- -- kfree(cores[2]); -- kfree(cores[1]); -- kfree(cores[0]); - } - --int __init bcma_bus_early_register(struct bcma_bus *bus, -- struct bcma_device *core_cc, -- struct bcma_device *core_mips) -+/* -+ * This is a special version of bus registration function designed for SoCs. -+ * It scans bus and performs basic initialization of main cores only. -+ * Please note it requires memory allocation, however it won't try to sleep. -+ */ -+int __init bcma_bus_early_register(struct bcma_bus *bus) - { - int err; - struct bcma_device *core; -- struct bcma_device_id match; -- -- match.manuf = BCMA_MANUF_BCM; -- match.id = bcma_cc_core_id(bus); -- match.class = BCMA_CL_SIM; -- match.rev = BCMA_ANY_REV; - -- /* Scan for chip common core */ -- err = bcma_bus_scan_early(bus, &match, core_cc); -- if (err) { -- bcma_err(bus, "Failed to scan for common core: %d\n", err); -- return -1; -- } -- -- match.manuf = BCMA_MANUF_MIPS; -- match.id = BCMA_CORE_MIPS_74K; -- match.class = BCMA_CL_SIM; -- match.rev = BCMA_ANY_REV; -- -- /* Scan for mips core */ -- err = bcma_bus_scan_early(bus, &match, core_mips); -+ /* Scan for devices (cores) */ -+ err = bcma_bus_scan(bus); - if (err) { -- bcma_err(bus, "Failed to scan for mips core: %d\n", err); -+ bcma_err(bus, "Failed to scan bus: %d\n", err); - return -1; - } - ---- a/drivers/bcma/scan.c -+++ b/drivers/bcma/scan.c -@@ -435,15 +435,12 @@ static int bcma_get_next_core(struct bcm - return 0; - } - --void bcma_init_bus(struct bcma_bus *bus) -+void bcma_detect_chip(struct bcma_bus *bus) - { - s32 tmp; - struct bcma_chipinfo *chipinfo = &(bus->chipinfo); - char chip_id[8]; - -- INIT_LIST_HEAD(&bus->cores); -- bus->nr_cores = 0; -- - bcma_scan_switch_core(bus, BCMA_ADDR_BASE); - - tmp = bcma_scan_read32(bus, 0, BCMA_CC_ID); -@@ -464,6 +461,10 @@ int bcma_bus_scan(struct bcma_bus *bus) - - int err, core_num = 0; - -+ /* Skip if bus was already scanned (e.g. during early register) */ -+ if (bus->nr_cores) -+ return 0; -+ - erombase = bcma_scan_read32(bus, 0, BCMA_CC_EROM); - if (bus->hosttype == BCMA_HOSTTYPE_SOC) { - eromptr = ioremap_nocache(erombase, BCMA_CORE_SIZE); -@@ -519,64 +520,6 @@ int bcma_bus_scan(struct bcma_bus *bus) - out: - if (bus->hosttype == BCMA_HOSTTYPE_SOC) - iounmap(eromptr); -- -- return err; --} -- --int __init bcma_bus_scan_early(struct bcma_bus *bus, -- struct bcma_device_id *match, -- struct bcma_device *core) --{ -- u32 erombase; -- u32 __iomem *eromptr, *eromend; -- -- int err = -ENODEV; -- int core_num = 0; -- -- erombase = bcma_scan_read32(bus, 0, BCMA_CC_EROM); -- if (bus->hosttype == BCMA_HOSTTYPE_SOC) { -- eromptr = ioremap_nocache(erombase, BCMA_CORE_SIZE); -- if (!eromptr) -- return -ENOMEM; -- } else { -- eromptr = bus->mmio; -- } -- -- eromend = eromptr + BCMA_CORE_SIZE / sizeof(u32); -- -- bcma_scan_switch_core(bus, erombase); -- -- while (eromptr < eromend) { -- memset(core, 0, sizeof(*core)); -- INIT_LIST_HEAD(&core->list); -- core->bus = bus; -- -- err = bcma_get_next_core(bus, &eromptr, match, core_num, core); -- if (err == -ENODEV) { -- core_num++; -- continue; -- } else if (err == -ENXIO) -- continue; -- else if (err == -ESPIPE) -- break; -- else if (err < 0) -- goto out; -- -- core->core_index = core_num++; -- bus->nr_cores++; -- bcma_info(bus, "Core %d found: %s (manuf 0x%03X, id 0x%03X, rev 0x%02X, class 0x%X)\n", -- core->core_index, bcma_device_name(&core->id), -- core->id.manuf, core->id.id, core->id.rev, -- core->id.class); -- -- list_add_tail(&core->list, &bus->cores); -- err = 0; -- break; -- } -- --out: -- if (bus->hosttype == BCMA_HOSTTYPE_SOC) -- iounmap(eromptr); - - return err; - } ---- a/drivers/bcma/sprom.c -+++ b/drivers/bcma/sprom.c -@@ -579,7 +579,8 @@ int bcma_sprom_get(struct bcma_bus *bus) - u16 offset = BCMA_CC_SPROM; - u16 *sprom; - size_t sprom_sizes[] = { SSB_SPROMSIZE_WORDS_R4, -- SSB_SPROMSIZE_WORDS_R10, }; -+ SSB_SPROMSIZE_WORDS_R10, -+ SSB_SPROMSIZE_WORDS_R11, }; - int i, err = 0; - - if (!bus->drv_cc.core) ---- a/include/linux/bcma/bcma.h -+++ b/include/linux/bcma/bcma.h -@@ -319,6 +319,7 @@ struct bcma_bus { - const struct bcma_host_ops *ops; - - enum bcma_hosttype hosttype; -+ bool host_is_pcie2; /* Used for BCMA_HOSTTYPE_PCI only */ - union { - /* Pointer to the PCI bus (only for BCMA_HOSTTYPE_PCI) */ - struct pci_dev *host_pci; ---- a/include/linux/bcma/bcma_driver_pci.h -+++ b/include/linux/bcma/bcma_driver_pci.h -@@ -223,6 +223,7 @@ struct bcma_drv_pci_host { - - struct bcma_drv_pci { - struct bcma_device *core; -+ u8 early_setup_done:1; - u8 setup_done:1; - u8 hostmode:1; - -@@ -237,6 +238,7 @@ struct bcma_drv_pci { - #define pcicore_write16(pc, offset, val) bcma_write16((pc)->core, offset, val) - #define pcicore_write32(pc, offset, val) bcma_write32((pc)->core, offset, val) - -+extern void bcma_core_pci_early_init(struct bcma_drv_pci *pc); - extern void bcma_core_pci_init(struct bcma_drv_pci *pc); - extern int bcma_core_pci_irq_ctl(struct bcma_drv_pci *pc, - struct bcma_device *core, bool enable); ---- a/include/linux/bcma/bcma_regs.h -+++ b/include/linux/bcma/bcma_regs.h -@@ -64,6 +64,8 @@ - #define BCMA_PCI_GPIO_XTAL 0x40 /* PCI config space GPIO 14 for Xtal powerup */ - #define BCMA_PCI_GPIO_PLL 0x80 /* PCI config space GPIO 15 for PLL powerdown */ - -+#define BCMA_PCIE2_BAR0_WIN2 0x70 -+ - /* SiliconBackplane Address Map. - * All regions may not exist on all chips. - */ ---- a/include/linux/bcma/bcma_soc.h -+++ b/include/linux/bcma/bcma_soc.h -@@ -5,8 +5,6 @@ - - struct bcma_soc { - struct bcma_bus bus; -- struct bcma_device core_cc; -- struct bcma_device core_mips; - }; - - int __init bcma_host_soc_register(struct bcma_soc *soc); ---- a/include/linux/ssb/ssb_regs.h -+++ b/include/linux/ssb/ssb_regs.h -@@ -173,6 +173,7 @@ - #define SSB_SPROMSIZE_BYTES_R123 (SSB_SPROMSIZE_WORDS_R123 * sizeof(u16)) - #define SSB_SPROMSIZE_BYTES_R4 (SSB_SPROMSIZE_WORDS_R4 * sizeof(u16)) - #define SSB_SPROMSIZE_WORDS_R10 230 -+#define SSB_SPROMSIZE_WORDS_R11 234 - #define SSB_SPROM_BASE1 0x1000 - #define SSB_SPROM_BASE31 0x0800 - #define SSB_SPROM_REVISION 0x007E diff --git a/target/linux/generic/pending-3.18/027-bcma-from-4.1.patch b/target/linux/generic/pending-3.18/027-bcma-from-4.1.patch deleted file mode 100644 index c88a816fef..0000000000 --- a/target/linux/generic/pending-3.18/027-bcma-from-4.1.patch +++ /dev/null @@ -1,680 +0,0 @@ ---- a/drivers/bcma/bcma_private.h -+++ b/drivers/bcma/bcma_private.h -@@ -24,6 +24,7 @@ bool bcma_wait_value(struct bcma_device - int timeout); - void bcma_prepare_core(struct bcma_bus *bus, struct bcma_device *core); - void bcma_init_bus(struct bcma_bus *bus); -+void bcma_unregister_cores(struct bcma_bus *bus); - int bcma_bus_register(struct bcma_bus *bus); - void bcma_bus_unregister(struct bcma_bus *bus); - int __init bcma_bus_early_register(struct bcma_bus *bus); -@@ -40,6 +41,9 @@ int bcma_bus_scan(struct bcma_bus *bus); - int bcma_sprom_get(struct bcma_bus *bus); - - /* driver_chipcommon.c */ -+void bcma_core_chipcommon_early_init(struct bcma_drv_cc *cc); -+void bcma_core_chipcommon_init(struct bcma_drv_cc *cc); -+void bcma_chipco_bcm4331_ext_pa_lines_ctl(struct bcma_drv_cc *cc, bool enable); - #ifdef CONFIG_BCMA_DRIVER_MIPS - void bcma_chipco_serial_init(struct bcma_drv_cc *cc); - extern struct platform_device bcma_pflash_dev; -@@ -50,6 +54,8 @@ int bcma_core_chipcommon_b_init(struct b - void bcma_core_chipcommon_b_free(struct bcma_drv_cc_b *ccb); - - /* driver_chipcommon_pmu.c */ -+void bcma_pmu_early_init(struct bcma_drv_cc *cc); -+void bcma_pmu_init(struct bcma_drv_cc *cc); - u32 bcma_pmu_get_alp_clock(struct bcma_drv_cc *cc); - u32 bcma_pmu_get_cpu_clock(struct bcma_drv_cc *cc); - -@@ -98,7 +104,35 @@ static inline void __exit bcma_host_soc_ - #endif /* CONFIG_BCMA_HOST_SOC && CONFIG_OF */ - - /* driver_pci.c */ -+#ifdef CONFIG_BCMA_DRIVER_PCI - u32 bcma_pcie_read(struct bcma_drv_pci *pc, u32 address); -+void bcma_core_pci_early_init(struct bcma_drv_pci *pc); -+void bcma_core_pci_init(struct bcma_drv_pci *pc); -+void bcma_core_pci_up(struct bcma_drv_pci *pc); -+void bcma_core_pci_down(struct bcma_drv_pci *pc); -+#else -+static inline void bcma_core_pci_early_init(struct bcma_drv_pci *pc) -+{ -+ WARN_ON(pc->core->bus->hosttype == BCMA_HOSTTYPE_PCI); -+} -+static inline void bcma_core_pci_init(struct bcma_drv_pci *pc) -+{ -+ /* Initialization is required for PCI hosted bus */ -+ WARN_ON(pc->core->bus->hosttype == BCMA_HOSTTYPE_PCI); -+} -+#endif -+ -+/* driver_pcie2.c */ -+#ifdef CONFIG_BCMA_DRIVER_PCI -+void bcma_core_pcie2_init(struct bcma_drv_pcie2 *pcie2); -+void bcma_core_pcie2_up(struct bcma_drv_pcie2 *pcie2); -+#else -+static inline void bcma_core_pcie2_init(struct bcma_drv_pcie2 *pcie2) -+{ -+ /* Initialization is required for PCI hosted bus */ -+ WARN_ON(pcie2->core->bus->hosttype == BCMA_HOSTTYPE_PCI); -+} -+#endif - - extern int bcma_chipco_watchdog_register(struct bcma_drv_cc *cc); - -@@ -115,6 +149,39 @@ static inline void bcma_core_pci_hostmod - } - #endif /* CONFIG_BCMA_DRIVER_PCI_HOSTMODE */ - -+/************************************************** -+ * driver_mips.c -+ **************************************************/ -+ -+#ifdef CONFIG_BCMA_DRIVER_MIPS -+unsigned int bcma_core_mips_irq(struct bcma_device *dev); -+void bcma_core_mips_early_init(struct bcma_drv_mips *mcore); -+void bcma_core_mips_init(struct bcma_drv_mips *mcore); -+#else -+static inline unsigned int bcma_core_mips_irq(struct bcma_device *dev) -+{ -+ return 0; -+} -+static inline void bcma_core_mips_early_init(struct bcma_drv_mips *mcore) -+{ -+} -+static inline void bcma_core_mips_init(struct bcma_drv_mips *mcore) -+{ -+} -+#endif -+ -+/************************************************** -+ * driver_gmac_cmn.c -+ **************************************************/ -+ -+#ifdef CONFIG_BCMA_DRIVER_GMAC_CMN -+void bcma_core_gmac_cmn_init(struct bcma_drv_gmac_cmn *gc); -+#else -+static inline void bcma_core_gmac_cmn_init(struct bcma_drv_gmac_cmn *gc) -+{ -+} -+#endif -+ - #ifdef CONFIG_BCMA_DRIVER_GPIO - /* driver_gpio.c */ - int bcma_gpio_init(struct bcma_drv_cc *cc); ---- a/drivers/bcma/driver_gpio.c -+++ b/drivers/bcma/driver_gpio.c -@@ -17,6 +17,8 @@ - - #include "bcma_private.h" - -+#define BCMA_GPIO_MAX_PINS 32 -+ - static inline struct bcma_drv_cc *bcma_gpio_get_cc(struct gpio_chip *chip) - { - return container_of(chip, struct bcma_drv_cc, gpio); -@@ -76,7 +78,7 @@ static void bcma_gpio_free(struct gpio_c - bcma_chipco_gpio_pullup(cc, 1 << gpio, 0); - } - --#if IS_BUILTIN(CONFIG_BCM47XX) -+#if IS_BUILTIN(CONFIG_BCM47XX) || IS_BUILTIN(CONFIG_ARCH_BCM_5301X) - static int bcma_gpio_to_irq(struct gpio_chip *chip, unsigned gpio) - { - struct bcma_drv_cc *cc = bcma_gpio_get_cc(chip); -@@ -204,6 +206,7 @@ static void bcma_gpio_irq_domain_exit(st - - int bcma_gpio_init(struct bcma_drv_cc *cc) - { -+ struct bcma_bus *bus = cc->core->bus; - struct gpio_chip *chip = &cc->gpio; - int err; - -@@ -215,14 +218,14 @@ int bcma_gpio_init(struct bcma_drv_cc *c - chip->set = bcma_gpio_set_value; - chip->direction_input = bcma_gpio_direction_input; - chip->direction_output = bcma_gpio_direction_output; --#if IS_BUILTIN(CONFIG_BCM47XX) -+#if IS_BUILTIN(CONFIG_BCM47XX) || IS_BUILTIN(CONFIG_ARCH_BCM_5301X) - chip->to_irq = bcma_gpio_to_irq; - #endif - #if IS_BUILTIN(CONFIG_OF) - if (cc->core->bus->hosttype == BCMA_HOSTTYPE_SOC) - chip->of_node = cc->core->dev.of_node; - #endif -- switch (cc->core->bus->chipinfo.id) { -+ switch (bus->chipinfo.id) { - case BCMA_CHIP_ID_BCM5357: - case BCMA_CHIP_ID_BCM53572: - chip->ngpio = 32; -@@ -231,13 +234,17 @@ int bcma_gpio_init(struct bcma_drv_cc *c - chip->ngpio = 16; - } - -- /* There is just one SoC in one device and its GPIO addresses should be -- * deterministic to address them more easily. The other buses could get -- * a random base number. */ -- if (cc->core->bus->hosttype == BCMA_HOSTTYPE_SOC) -- chip->base = 0; -- else -- chip->base = -1; -+ /* -+ * On MIPS we register GPIO devices (LEDs, buttons) using absolute GPIO -+ * pin numbers. We don't have Device Tree there and we can't really use -+ * relative (per chip) numbers. -+ * So let's use predictable base for BCM47XX and "random" for all other. -+ */ -+#if IS_BUILTIN(CONFIG_BCM47XX) -+ chip->base = bus->num * BCMA_GPIO_MAX_PINS; -+#else -+ chip->base = -1; -+#endif - - err = bcma_gpio_irq_domain_init(cc); - if (err) ---- a/drivers/bcma/driver_pci.c -+++ b/drivers/bcma/driver_pci.c -@@ -282,39 +282,6 @@ void bcma_core_pci_power_save(struct bcm - } - EXPORT_SYMBOL_GPL(bcma_core_pci_power_save); - --int bcma_core_pci_irq_ctl(struct bcma_drv_pci *pc, struct bcma_device *core, -- bool enable) --{ -- struct pci_dev *pdev; -- u32 coremask, tmp; -- int err = 0; -- -- if (!pc || core->bus->hosttype != BCMA_HOSTTYPE_PCI) { -- /* This bcma device is not on a PCI host-bus. So the IRQs are -- * not routed through the PCI core. -- * So we must not enable routing through the PCI core. */ -- goto out; -- } -- -- pdev = pc->core->bus->host_pci; -- -- err = pci_read_config_dword(pdev, BCMA_PCI_IRQMASK, &tmp); -- if (err) -- goto out; -- -- coremask = BIT(core->core_index) << 8; -- if (enable) -- tmp |= coremask; -- else -- tmp &= ~coremask; -- -- err = pci_write_config_dword(pdev, BCMA_PCI_IRQMASK, tmp); -- --out: -- return err; --} --EXPORT_SYMBOL_GPL(bcma_core_pci_irq_ctl); -- - static void bcma_core_pci_extend_L1timer(struct bcma_drv_pci *pc, bool extend) - { - u32 w; -@@ -328,28 +295,12 @@ static void bcma_core_pci_extend_L1timer - bcma_pcie_read(pc, BCMA_CORE_PCI_DLLP_PMTHRESHREG); - } - --void bcma_core_pci_up(struct bcma_bus *bus) -+void bcma_core_pci_up(struct bcma_drv_pci *pc) - { -- struct bcma_drv_pci *pc; -- -- if (bus->hosttype != BCMA_HOSTTYPE_PCI) -- return; -- -- pc = &bus->drv_pci[0]; -- - bcma_core_pci_extend_L1timer(pc, true); - } --EXPORT_SYMBOL_GPL(bcma_core_pci_up); - --void bcma_core_pci_down(struct bcma_bus *bus) -+void bcma_core_pci_down(struct bcma_drv_pci *pc) - { -- struct bcma_drv_pci *pc; -- -- if (bus->hosttype != BCMA_HOSTTYPE_PCI) -- return; -- -- pc = &bus->drv_pci[0]; -- - bcma_core_pci_extend_L1timer(pc, false); - } --EXPORT_SYMBOL_GPL(bcma_core_pci_down); ---- a/drivers/bcma/driver_pci_host.c -+++ b/drivers/bcma/driver_pci_host.c -@@ -11,6 +11,7 @@ - - #include "bcma_private.h" - #include -+#include - #include - #include - #include ---- a/drivers/bcma/driver_pcie2.c -+++ b/drivers/bcma/driver_pcie2.c -@@ -10,6 +10,7 @@ - - #include "bcma_private.h" - #include -+#include - - /************************************************** - * R/W ops. -@@ -156,14 +157,23 @@ static void pciedev_reg_pm_clk_period(st - - void bcma_core_pcie2_init(struct bcma_drv_pcie2 *pcie2) - { -- struct bcma_chipinfo *ci = &pcie2->core->bus->chipinfo; -+ struct bcma_bus *bus = pcie2->core->bus; -+ struct bcma_chipinfo *ci = &bus->chipinfo; - u32 tmp; - - tmp = pcie2_read32(pcie2, BCMA_CORE_PCIE2_SPROM(54)); - if ((tmp & 0xe) >> 1 == 2) - bcma_core_pcie2_cfg_write(pcie2, 0x4e0, 0x17); - -- /* TODO: Do we need pcie_reqsize? */ -+ switch (bus->chipinfo.id) { -+ case BCMA_CHIP_ID_BCM4360: -+ case BCMA_CHIP_ID_BCM4352: -+ pcie2->reqsize = 1024; -+ break; -+ default: -+ pcie2->reqsize = 128; -+ break; -+ } - - if (ci->id == BCMA_CHIP_ID_BCM4360 && ci->rev > 3) - bcma_core_pcie2_war_delay_perst_enab(pcie2, true); -@@ -173,3 +183,18 @@ void bcma_core_pcie2_init(struct bcma_dr - pciedev_crwlpciegen2_180(pcie2); - pciedev_crwlpciegen2_182(pcie2); - } -+ -+/************************************************** -+ * Runtime ops. -+ **************************************************/ -+ -+void bcma_core_pcie2_up(struct bcma_drv_pcie2 *pcie2) -+{ -+ struct bcma_bus *bus = pcie2->core->bus; -+ struct pci_dev *dev = bus->host_pci; -+ int err; -+ -+ err = pcie_set_readrq(dev, pcie2->reqsize); -+ if (err) -+ bcma_err(bus, "Error setting PCI_EXP_DEVCTL_READRQ: %d\n", err); -+} ---- a/drivers/bcma/host_pci.c -+++ b/drivers/bcma/host_pci.c -@@ -213,16 +213,26 @@ static int bcma_host_pci_probe(struct pc - /* Initialize struct, detect chip */ - bcma_init_bus(bus); - -+ /* Scan bus to find out generation of PCIe core */ -+ err = bcma_bus_scan(bus); -+ if (err) -+ goto err_pci_unmap_mmio; -+ -+ if (bcma_find_core(bus, BCMA_CORE_PCIE2)) -+ bus->host_is_pcie2 = true; -+ - /* Register */ - err = bcma_bus_register(bus); - if (err) -- goto err_pci_unmap_mmio; -+ goto err_unregister_cores; - - pci_set_drvdata(dev, bus); - - out: - return err; - -+err_unregister_cores: -+ bcma_unregister_cores(bus); - err_pci_unmap_mmio: - pci_iounmap(dev, bus->mmio); - err_pci_release_regions: -@@ -283,9 +293,12 @@ static const struct pci_device_id bcma_p - { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x4357) }, - { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x4358) }, - { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x4359) }, -+ { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x4360) }, - { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x4365) }, -+ { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x43a0) }, - { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x43a9) }, - { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x43aa) }, -+ { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x43b1) }, - { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x4727) }, - { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 43227) }, /* 0xa8db, BCM43217 (sic!) */ - { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 43228) }, /* 0xa8dc */ -@@ -310,3 +323,65 @@ void __exit bcma_host_pci_exit(void) - { - pci_unregister_driver(&bcma_pci_bridge_driver); - } -+ -+/************************************************** -+ * Runtime ops for drivers. -+ **************************************************/ -+ -+/* See also pcicore_up */ -+void bcma_host_pci_up(struct bcma_bus *bus) -+{ -+ if (bus->hosttype != BCMA_HOSTTYPE_PCI) -+ return; -+ -+ if (bus->host_is_pcie2) -+ bcma_core_pcie2_up(&bus->drv_pcie2); -+ else -+ bcma_core_pci_up(&bus->drv_pci[0]); -+} -+EXPORT_SYMBOL_GPL(bcma_host_pci_up); -+ -+/* See also pcicore_down */ -+void bcma_host_pci_down(struct bcma_bus *bus) -+{ -+ if (bus->hosttype != BCMA_HOSTTYPE_PCI) -+ return; -+ -+ if (!bus->host_is_pcie2) -+ bcma_core_pci_down(&bus->drv_pci[0]); -+} -+EXPORT_SYMBOL_GPL(bcma_host_pci_down); -+ -+/* See also si_pci_setup */ -+int bcma_host_pci_irq_ctl(struct bcma_bus *bus, struct bcma_device *core, -+ bool enable) -+{ -+ struct pci_dev *pdev; -+ u32 coremask, tmp; -+ int err = 0; -+ -+ if (bus->hosttype != BCMA_HOSTTYPE_PCI) { -+ /* This bcma device is not on a PCI host-bus. So the IRQs are -+ * not routed through the PCI core. -+ * So we must not enable routing through the PCI core. */ -+ goto out; -+ } -+ -+ pdev = bus->host_pci; -+ -+ err = pci_read_config_dword(pdev, BCMA_PCI_IRQMASK, &tmp); -+ if (err) -+ goto out; -+ -+ coremask = BIT(core->core_index) << 8; -+ if (enable) -+ tmp |= coremask; -+ else -+ tmp &= ~coremask; -+ -+ err = pci_write_config_dword(pdev, BCMA_PCI_IRQMASK, tmp); -+ -+out: -+ return err; -+} -+EXPORT_SYMBOL_GPL(bcma_host_pci_irq_ctl); ---- a/drivers/bcma/main.c -+++ b/drivers/bcma/main.c -@@ -363,7 +363,7 @@ static int bcma_register_devices(struct - return 0; - } - --static void bcma_unregister_cores(struct bcma_bus *bus) -+void bcma_unregister_cores(struct bcma_bus *bus) - { - struct bcma_device *core, *tmp; - ---- a/drivers/net/wireless/b43/main.c -+++ b/drivers/net/wireless/b43/main.c -@@ -4770,7 +4770,7 @@ static void b43_wireless_core_exit(struc - switch (dev->dev->bus_type) { - #ifdef CONFIG_B43_BCMA - case B43_BUS_BCMA: -- bcma_core_pci_down(dev->dev->bdev->bus); -+ bcma_host_pci_down(dev->dev->bdev->bus); - break; - #endif - #ifdef CONFIG_B43_SSB -@@ -4817,9 +4817,9 @@ static int b43_wireless_core_init(struct - switch (dev->dev->bus_type) { - #ifdef CONFIG_B43_BCMA - case B43_BUS_BCMA: -- bcma_core_pci_irq_ctl(&dev->dev->bdev->bus->drv_pci[0], -+ bcma_host_pci_irq_ctl(dev->dev->bdev->bus, - dev->dev->bdev, true); -- bcma_core_pci_up(dev->dev->bdev->bus); -+ bcma_host_pci_up(dev->dev->bdev->bus); - break; - #endif - #ifdef CONFIG_B43_SSB ---- a/drivers/net/wireless/brcm80211/brcmsmac/main.c -+++ b/drivers/net/wireless/brcm80211/brcmsmac/main.c -@@ -4669,7 +4669,7 @@ static int brcms_b_attach(struct brcms_c - brcms_c_coredisable(wlc_hw); - - /* Match driver "down" state */ -- bcma_core_pci_down(wlc_hw->d11core->bus); -+ bcma_host_pci_down(wlc_hw->d11core->bus); - - /* turn off pll and xtal to match driver "down" state */ - brcms_b_xtal(wlc_hw, OFF); -@@ -4960,7 +4960,7 @@ static int brcms_b_up_prep(struct brcms_ - * Configure pci/pcmcia here instead of in brcms_c_attach() - * to allow mfg hotswap: down, hotswap (chip power cycle), up. - */ -- bcma_core_pci_irq_ctl(&wlc_hw->d11core->bus->drv_pci[0], wlc_hw->d11core, -+ bcma_host_pci_irq_ctl(wlc_hw->d11core->bus, wlc_hw->d11core, - true); - - /* -@@ -4970,12 +4970,12 @@ static int brcms_b_up_prep(struct brcms_ - */ - if (brcms_b_radio_read_hwdisabled(wlc_hw)) { - /* put SB PCI in down state again */ -- bcma_core_pci_down(wlc_hw->d11core->bus); -+ bcma_host_pci_down(wlc_hw->d11core->bus); - brcms_b_xtal(wlc_hw, OFF); - return -ENOMEDIUM; - } - -- bcma_core_pci_up(wlc_hw->d11core->bus); -+ bcma_host_pci_up(wlc_hw->d11core->bus); - - /* reset the d11 core */ - brcms_b_corereset(wlc_hw, BRCMS_USE_COREFLAGS); -@@ -5172,7 +5172,7 @@ static int brcms_b_down_finish(struct br - - /* turn off primary xtal and pll */ - if (!wlc_hw->noreset) { -- bcma_core_pci_down(wlc_hw->d11core->bus); -+ bcma_host_pci_down(wlc_hw->d11core->bus); - brcms_b_xtal(wlc_hw, OFF); - } - } ---- a/include/linux/bcma/bcma.h -+++ b/include/linux/bcma/bcma.h -@@ -435,6 +435,27 @@ static inline struct bcma_device *bcma_f - return bcma_find_core_unit(bus, coreid, 0); - } - -+#ifdef CONFIG_BCMA_HOST_PCI -+extern void bcma_host_pci_up(struct bcma_bus *bus); -+extern void bcma_host_pci_down(struct bcma_bus *bus); -+extern int bcma_host_pci_irq_ctl(struct bcma_bus *bus, -+ struct bcma_device *core, bool enable); -+#else -+static inline void bcma_host_pci_up(struct bcma_bus *bus) -+{ -+} -+static inline void bcma_host_pci_down(struct bcma_bus *bus) -+{ -+} -+static inline int bcma_host_pci_irq_ctl(struct bcma_bus *bus, -+ struct bcma_device *core, bool enable) -+{ -+ if (bus->hosttype == BCMA_HOSTTYPE_PCI) -+ return -ENOTSUPP; -+ return 0; -+} -+#endif -+ - extern bool bcma_core_is_enabled(struct bcma_device *core); - extern void bcma_core_disable(struct bcma_device *core, u32 flags); - extern int bcma_core_enable(struct bcma_device *core, u32 flags); ---- a/include/linux/bcma/bcma_driver_pci.h -+++ b/include/linux/bcma/bcma_driver_pci.h -@@ -238,13 +238,13 @@ struct bcma_drv_pci { - #define pcicore_write16(pc, offset, val) bcma_write16((pc)->core, offset, val) - #define pcicore_write32(pc, offset, val) bcma_write32((pc)->core, offset, val) - --extern void bcma_core_pci_early_init(struct bcma_drv_pci *pc); --extern void bcma_core_pci_init(struct bcma_drv_pci *pc); --extern int bcma_core_pci_irq_ctl(struct bcma_drv_pci *pc, -- struct bcma_device *core, bool enable); --extern void bcma_core_pci_up(struct bcma_bus *bus); --extern void bcma_core_pci_down(struct bcma_bus *bus); -+#ifdef CONFIG_BCMA_DRIVER_PCI - extern void bcma_core_pci_power_save(struct bcma_bus *bus, bool up); -+#else -+static inline void bcma_core_pci_power_save(struct bcma_bus *bus, bool up) -+{ -+} -+#endif - - extern int bcma_core_pci_pcibios_map_irq(const struct pci_dev *dev); - extern int bcma_core_pci_plat_dev_init(struct pci_dev *dev); ---- a/include/linux/bcma/bcma_driver_pcie2.h -+++ b/include/linux/bcma/bcma_driver_pcie2.h -@@ -143,6 +143,8 @@ - - struct bcma_drv_pcie2 { - struct bcma_device *core; -+ -+ u16 reqsize; - }; - - #define pcie2_read16(pcie2, offset) bcma_read16((pcie2)->core, offset) -@@ -153,6 +155,4 @@ struct bcma_drv_pcie2 { - #define pcie2_set32(pcie2, offset, set) bcma_set32((pcie2)->core, offset, set) - #define pcie2_mask32(pcie2, offset, mask) bcma_mask32((pcie2)->core, offset, mask) - --void bcma_core_pcie2_init(struct bcma_drv_pcie2 *pcie2); -- - #endif /* LINUX_BCMA_DRIVER_PCIE2_H_ */ ---- a/drivers/bcma/Kconfig -+++ b/drivers/bcma/Kconfig -@@ -26,6 +26,7 @@ config BCMA_HOST_PCI_POSSIBLE - config BCMA_HOST_PCI - bool "Support for BCMA on PCI-host bus" - depends on BCMA_HOST_PCI_POSSIBLE -+ select BCMA_DRIVER_PCI - default y - - config BCMA_DRIVER_PCI_HOSTMODE -@@ -44,6 +45,22 @@ config BCMA_HOST_SOC - - If unsure, say N - -+config BCMA_DRIVER_PCI -+ bool "BCMA Broadcom PCI core driver" -+ depends on BCMA && PCI -+ default y -+ help -+ BCMA bus may have many versions of PCIe core. This driver -+ supports: -+ 1) PCIe core working in clientmode -+ 2) PCIe Gen 2 clientmode core -+ -+ In general PCIe (Gen 2) clientmode core is required on PCIe -+ hosted buses. It's responsible for initialization and basic -+ hardware management. -+ This driver is also prerequisite for a hostmode PCIe core -+ support. -+ - config BCMA_DRIVER_MIPS - bool "BCMA Broadcom MIPS core driver" - depends on BCMA && MIPS ---- a/drivers/bcma/Makefile -+++ b/drivers/bcma/Makefile -@@ -3,8 +3,8 @@ bcma-y += driver_chipcommon.o driver - bcma-y += driver_chipcommon_b.o - bcma-$(CONFIG_BCMA_SFLASH) += driver_chipcommon_sflash.o - bcma-$(CONFIG_BCMA_NFLASH) += driver_chipcommon_nflash.o --bcma-y += driver_pci.o --bcma-y += driver_pcie2.o -+bcma-$(CONFIG_BCMA_DRIVER_PCI) += driver_pci.o -+bcma-$(CONFIG_BCMA_DRIVER_PCI) += driver_pcie2.o - bcma-$(CONFIG_BCMA_DRIVER_PCI_HOSTMODE) += driver_pci_host.o - bcma-$(CONFIG_BCMA_DRIVER_MIPS) += driver_mips.o - bcma-$(CONFIG_BCMA_DRIVER_GMAC_CMN) += driver_gmac_cmn.o ---- a/include/linux/bcma/bcma_driver_chipcommon.h -+++ b/include/linux/bcma/bcma_driver_chipcommon.h -@@ -663,14 +663,6 @@ struct bcma_drv_cc_b { - #define bcma_cc_maskset32(cc, offset, mask, set) \ - bcma_cc_write32(cc, offset, (bcma_cc_read32(cc, offset) & (mask)) | (set)) - --extern void bcma_core_chipcommon_init(struct bcma_drv_cc *cc); --extern void bcma_core_chipcommon_early_init(struct bcma_drv_cc *cc); -- --extern void bcma_chipco_suspend(struct bcma_drv_cc *cc); --extern void bcma_chipco_resume(struct bcma_drv_cc *cc); -- --void bcma_chipco_bcm4331_ext_pa_lines_ctl(struct bcma_drv_cc *cc, bool enable); -- - extern u32 bcma_chipco_watchdog_timer_set(struct bcma_drv_cc *cc, u32 ticks); - - extern u32 bcma_chipco_get_alp_clock(struct bcma_drv_cc *cc); -@@ -690,9 +682,6 @@ u32 bcma_chipco_gpio_pullup(struct bcma_ - u32 bcma_chipco_gpio_pulldown(struct bcma_drv_cc *cc, u32 mask, u32 value); - - /* PMU support */ --extern void bcma_pmu_init(struct bcma_drv_cc *cc); --extern void bcma_pmu_early_init(struct bcma_drv_cc *cc); -- - extern void bcma_chipco_pll_write(struct bcma_drv_cc *cc, u32 offset, - u32 value); - extern void bcma_chipco_pll_maskset(struct bcma_drv_cc *cc, u32 offset, ---- a/include/linux/bcma/bcma_driver_gmac_cmn.h -+++ b/include/linux/bcma/bcma_driver_gmac_cmn.h -@@ -91,10 +91,4 @@ struct bcma_drv_gmac_cmn { - #define gmac_cmn_write16(gc, offset, val) bcma_write16((gc)->core, offset, val) - #define gmac_cmn_write32(gc, offset, val) bcma_write32((gc)->core, offset, val) - --#ifdef CONFIG_BCMA_DRIVER_GMAC_CMN --extern void bcma_core_gmac_cmn_init(struct bcma_drv_gmac_cmn *gc); --#else --static inline void bcma_core_gmac_cmn_init(struct bcma_drv_gmac_cmn *gc) { } --#endif -- - #endif /* LINUX_BCMA_DRIVER_GMAC_CMN_H_ */ ---- a/include/linux/bcma/bcma_driver_mips.h -+++ b/include/linux/bcma/bcma_driver_mips.h -@@ -39,21 +39,6 @@ struct bcma_drv_mips { - u8 early_setup_done:1; - }; - --#ifdef CONFIG_BCMA_DRIVER_MIPS --extern void bcma_core_mips_init(struct bcma_drv_mips *mcore); --extern void bcma_core_mips_early_init(struct bcma_drv_mips *mcore); -- --extern unsigned int bcma_core_mips_irq(struct bcma_device *dev); --#else --static inline void bcma_core_mips_init(struct bcma_drv_mips *mcore) { } --static inline void bcma_core_mips_early_init(struct bcma_drv_mips *mcore) { } -- --static inline unsigned int bcma_core_mips_irq(struct bcma_device *dev) --{ -- return 0; --} --#endif -- - extern u32 bcma_cpu_clock(struct bcma_drv_mips *mcore); - - #endif /* LINUX_BCMA_DRIVER_MIPS_H_ */ diff --git a/target/linux/generic/pending-3.18/028-bcma-from-4.2.patch b/target/linux/generic/pending-3.18/028-bcma-from-4.2.patch deleted file mode 100644 index ba3df18bdd..0000000000 --- a/target/linux/generic/pending-3.18/028-bcma-from-4.2.patch +++ /dev/null @@ -1,86 +0,0 @@ ---- a/drivers/bcma/driver_gpio.c -+++ b/drivers/bcma/driver_gpio.c -@@ -226,6 +226,7 @@ int bcma_gpio_init(struct bcma_drv_cc *c - chip->of_node = cc->core->dev.of_node; - #endif - switch (bus->chipinfo.id) { -+ case BCMA_CHIP_ID_BCM4707: - case BCMA_CHIP_ID_BCM5357: - case BCMA_CHIP_ID_BCM53572: - chip->ngpio = 32; -@@ -235,16 +236,17 @@ int bcma_gpio_init(struct bcma_drv_cc *c - } - - /* -- * On MIPS we register GPIO devices (LEDs, buttons) using absolute GPIO -- * pin numbers. We don't have Device Tree there and we can't really use -- * relative (per chip) numbers. -- * So let's use predictable base for BCM47XX and "random" for all other. -+ * Register SoC GPIO devices with absolute GPIO pin base. -+ * On MIPS, we don't have Device Tree and we can't use relative (per chip) -+ * GPIO numbers. -+ * On some ARM devices, user space may want to access some system GPIO -+ * pins directly, which is easier to do with a predictable GPIO base. - */ --#if IS_BUILTIN(CONFIG_BCM47XX) -- chip->base = bus->num * BCMA_GPIO_MAX_PINS; --#else -- chip->base = -1; --#endif -+ if (IS_BUILTIN(CONFIG_BCM47XX) || -+ cc->core->bus->hosttype == BCMA_HOSTTYPE_SOC) -+ chip->base = bus->num * BCMA_GPIO_MAX_PINS; -+ else -+ chip->base = -1; - - err = bcma_gpio_irq_domain_init(cc); - if (err) ---- a/drivers/bcma/Kconfig -+++ b/drivers/bcma/Kconfig -@@ -29,12 +29,6 @@ config BCMA_HOST_PCI - select BCMA_DRIVER_PCI - default y - --config BCMA_DRIVER_PCI_HOSTMODE -- bool "Driver for PCI core working in hostmode" -- depends on BCMA && MIPS && BCMA_HOST_PCI -- help -- PCI core hostmode operation (external PCI bus). -- - config BCMA_HOST_SOC - bool "Support for BCMA in a SoC" - depends on BCMA -@@ -61,6 +55,12 @@ config BCMA_DRIVER_PCI - This driver is also prerequisite for a hostmode PCIe core - support. - -+config BCMA_DRIVER_PCI_HOSTMODE -+ bool "Driver for PCI core working in hostmode" -+ depends on BCMA && MIPS && BCMA_DRIVER_PCI -+ help -+ PCI core hostmode operation (external PCI bus). -+ - config BCMA_DRIVER_MIPS - bool "BCMA Broadcom MIPS core driver" - depends on BCMA && MIPS ---- a/include/linux/bcma/bcma_driver_pci.h -+++ b/include/linux/bcma/bcma_driver_pci.h -@@ -246,7 +246,18 @@ static inline void bcma_core_pci_power_s - } - #endif - -+#ifdef CONFIG_BCMA_DRIVER_PCI_HOSTMODE - extern int bcma_core_pci_pcibios_map_irq(const struct pci_dev *dev); - extern int bcma_core_pci_plat_dev_init(struct pci_dev *dev); -+#else -+static inline int bcma_core_pci_pcibios_map_irq(const struct pci_dev *dev) -+{ -+ return -ENOTSUPP; -+} -+static inline int bcma_core_pci_plat_dev_init(struct pci_dev *dev) -+{ -+ return -ENOTSUPP; -+} -+#endif - - #endif /* LINUX_BCMA_DRIVER_PCI_H_ */ diff --git a/target/linux/generic/pending-3.18/029-bcma-from-4.4.patch b/target/linux/generic/pending-3.18/029-bcma-from-4.4.patch deleted file mode 100644 index 5704081ee4..0000000000 --- a/target/linux/generic/pending-3.18/029-bcma-from-4.4.patch +++ /dev/null @@ -1,26 +0,0 @@ -commit 55acca90da52b85299c033354e51ddaa7b73e019 -Author: Hante Meuleman -Date: Fri Sep 18 22:08:17 2015 +0200 - - brcmfmac: Add support for the BCM4365 and BCM4366 PCIE devices. - - This patch adds support for the BCM4365 and BCM4366 11ac Wave2 - PCIE devices. - - Reviewed-by: Arend Van Spriel - Reviewed-by: Pieter-Paul Giesberts - Signed-off-by: Hante Meuleman - Signed-off-by: Arend van Spriel - Signed-off-by: Kalle Valo - ---- a/include/linux/bcma/bcma.h -+++ b/include/linux/bcma/bcma.h -@@ -151,6 +151,8 @@ struct bcma_host_ops { - #define BCMA_CORE_PCIE2 0x83C /* PCI Express Gen2 */ - #define BCMA_CORE_USB30_DEV 0x83D - #define BCMA_CORE_ARM_CR4 0x83E -+#define BCMA_CORE_ARM_CA7 0x847 -+#define BCMA_CORE_SYS_MEM 0x849 - #define BCMA_CORE_DEFAULT 0xFFF - - #define BCMA_MAX_NR_CORES 16 diff --git a/target/linux/generic/pending-3.18/030-backport_bcm47xx_nvram.patch b/target/linux/generic/pending-3.18/030-backport_bcm47xx_nvram.patch deleted file mode 100644 index 7ae8b1db6c..0000000000 --- a/target/linux/generic/pending-3.18/030-backport_bcm47xx_nvram.patch +++ /dev/null @@ -1,52 +0,0 @@ ---- /dev/null -+++ b/include/linux/bcm47xx_nvram.h -@@ -0,0 +1,49 @@ -+/* -+ * 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 __BCM47XX_NVRAM_H -+#define __BCM47XX_NVRAM_H -+ -+#include -+#include -+#include -+ -+#ifdef CONFIG_BCM47XX_NVRAM -+int bcm47xx_nvram_init_from_mem(u32 base, u32 lim); -+int bcm47xx_nvram_getenv(const char *name, char *val, size_t val_len); -+int bcm47xx_nvram_gpio_pin(const char *name); -+char *bcm47xx_nvram_get_contents(size_t *val_len); -+static inline void bcm47xx_nvram_release_contents(char *nvram) -+{ -+ vfree(nvram); -+}; -+#else -+static inline int bcm47xx_nvram_init_from_mem(u32 base, u32 lim) -+{ -+ return -ENOTSUPP; -+}; -+static inline int bcm47xx_nvram_getenv(const char *name, char *val, -+ size_t val_len) -+{ -+ return -ENOTSUPP; -+}; -+static inline int bcm47xx_nvram_gpio_pin(const char *name) -+{ -+ return -ENOTSUPP; -+}; -+ -+static inline char *bcm47xx_nvram_get_contents(size_t *val_len) -+{ -+ return NULL; -+}; -+ -+static inline void bcm47xx_nvram_release_contents(char *nvram) -+{ -+}; -+#endif -+ -+#endif /* __BCM47XX_NVRAM_H */ diff --git a/target/linux/generic/pending-3.18/030-nl80211-Allow-set-network-namespace-by-fd.patch b/target/linux/generic/pending-3.18/030-nl80211-Allow-set-network-namespace-by-fd.patch deleted file mode 100644 index 80f9708306..0000000000 --- a/target/linux/generic/pending-3.18/030-nl80211-Allow-set-network-namespace-by-fd.patch +++ /dev/null @@ -1,21 +0,0 @@ -From: Vadim Kochan -Date: Mon, 12 Jan 2015 16:34:05 +0200 -Subject: [PATCH] nl80211: Allow set network namespace by fd - -Added new NL80211_ATTR_NETNS_FD which allows to -set namespace via nl80211 by fd. - -Signed-off-by: Vadim Kochan -Signed-off-by: Johannes Berg ---- - ---- a/net/core/net_namespace.c -+++ b/net/core/net_namespace.c -@@ -380,6 +380,7 @@ struct net *get_net_ns_by_fd(int fd) - return ERR_PTR(-EINVAL); - } - #endif -+EXPORT_SYMBOL_GPL(get_net_ns_by_fd); - - struct net *get_net_ns_by_pid(pid_t pid) - { diff --git a/target/linux/generic/pending-3.18/031-bcma-from-4.5.patch b/target/linux/generic/pending-3.18/031-bcma-from-4.5.patch deleted file mode 100644 index 171395dcec..0000000000 --- a/target/linux/generic/pending-3.18/031-bcma-from-4.5.patch +++ /dev/null @@ -1,49 +0,0 @@ ---- a/drivers/bcma/main.c -+++ b/drivers/bcma/main.c -@@ -637,11 +637,36 @@ static int bcma_device_uevent(struct dev - core->id.rev, core->id.class); - } - --static int __init bcma_modinit(void) -+static unsigned int bcma_bus_registered; -+ -+/* -+ * If built-in, bus has to be registered early, before any driver calls -+ * bcma_driver_register. -+ * Otherwise registering driver would trigger BUG in driver_register. -+ */ -+static int __init bcma_init_bus_register(void) - { - int err; - -+ if (bcma_bus_registered) -+ return 0; -+ - err = bus_register(&bcma_bus_type); -+ if (!err) -+ bcma_bus_registered = 1; -+ -+ return err; -+} -+#ifndef MODULE -+fs_initcall(bcma_init_bus_register); -+#endif -+ -+/* Main initialization has to be done with SPI/mtd/NAND/SPROM available */ -+static int __init bcma_modinit(void) -+{ -+ int err; -+ -+ err = bcma_init_bus_register(); - if (err) - return err; - -@@ -660,7 +685,7 @@ static int __init bcma_modinit(void) - - return err; - } --fs_initcall(bcma_modinit); -+module_init(bcma_modinit); - - static void __exit bcma_modexit(void) - { diff --git a/target/linux/generic/pending-3.18/032-bcma-from-4.6.patch b/target/linux/generic/pending-3.18/032-bcma-from-4.6.patch deleted file mode 100644 index 85eeaad4d3..0000000000 --- a/target/linux/generic/pending-3.18/032-bcma-from-4.6.patch +++ /dev/null @@ -1,716 +0,0 @@ ---- a/drivers/bcma/driver_chipcommon.c -+++ b/drivers/bcma/driver_chipcommon.c -@@ -15,6 +15,8 @@ - #include - #include - -+static void bcma_chipco_serial_init(struct bcma_drv_cc *cc); -+ - static inline u32 bcma_cc_write32_masked(struct bcma_drv_cc *cc, u16 offset, - u32 mask, u32 value) - { -@@ -113,8 +115,37 @@ int bcma_chipco_watchdog_register(struct - return 0; - } - -+static void bcma_core_chipcommon_flash_detect(struct bcma_drv_cc *cc) -+{ -+ struct bcma_bus *bus = cc->core->bus; -+ -+ switch (cc->capabilities & BCMA_CC_CAP_FLASHT) { -+ case BCMA_CC_FLASHT_STSER: -+ case BCMA_CC_FLASHT_ATSER: -+ bcma_debug(bus, "Found serial flash\n"); -+ bcma_sflash_init(cc); -+ break; -+ case BCMA_CC_FLASHT_PARA: -+ bcma_debug(bus, "Found parallel flash\n"); -+ bcma_pflash_init(cc); -+ break; -+ default: -+ bcma_err(bus, "Flash type not supported\n"); -+ } -+ -+ if (cc->core->id.rev == 38 || -+ bus->chipinfo.id == BCMA_CHIP_ID_BCM4706) { -+ if (cc->capabilities & BCMA_CC_CAP_NFLASH) { -+ bcma_debug(bus, "Found NAND flash\n"); -+ bcma_nflash_init(cc); -+ } -+ } -+} -+ - void bcma_core_chipcommon_early_init(struct bcma_drv_cc *cc) - { -+ struct bcma_bus *bus = cc->core->bus; -+ - if (cc->early_setup_done) - return; - -@@ -129,6 +160,12 @@ void bcma_core_chipcommon_early_init(str - if (cc->capabilities & BCMA_CC_CAP_PMU) - bcma_pmu_early_init(cc); - -+ if (IS_BUILTIN(CONFIG_BCM47XX) && bus->hosttype == BCMA_HOSTTYPE_SOC) -+ bcma_chipco_serial_init(cc); -+ -+ if (bus->hosttype == BCMA_HOSTTYPE_SOC) -+ bcma_core_chipcommon_flash_detect(cc); -+ - cc->early_setup_done = true; - } - -@@ -185,11 +222,12 @@ u32 bcma_chipco_watchdog_timer_set(struc - ticks = 2; - else if (ticks > maxt) - ticks = maxt; -- bcma_cc_write32(cc, BCMA_CC_PMU_WATCHDOG, ticks); -+ bcma_pmu_write32(cc, BCMA_CC_PMU_WATCHDOG, ticks); - } else { - struct bcma_bus *bus = cc->core->bus; - - if (bus->chipinfo.id != BCMA_CHIP_ID_BCM4707 && -+ bus->chipinfo.id != BCMA_CHIP_ID_BCM47094 && - bus->chipinfo.id != BCMA_CHIP_ID_BCM53018) - bcma_core_set_clockmode(cc->core, - ticks ? BCMA_CLKMODE_FAST : BCMA_CLKMODE_DYNAMIC); -@@ -314,9 +352,9 @@ u32 bcma_chipco_gpio_pulldown(struct bcm - return res; - } - --#ifdef CONFIG_BCMA_DRIVER_MIPS --void bcma_chipco_serial_init(struct bcma_drv_cc *cc) -+static void bcma_chipco_serial_init(struct bcma_drv_cc *cc) - { -+#if IS_BUILTIN(CONFIG_BCM47XX) - unsigned int irq; - u32 baud_base; - u32 i; -@@ -358,5 +396,5 @@ void bcma_chipco_serial_init(struct bcma - ports[i].baud_base = baud_base; - ports[i].reg_shift = 0; - } -+#endif /* CONFIG_BCM47XX */ - } --#endif /* CONFIG_BCMA_DRIVER_MIPS */ ---- a/drivers/bcma/driver_chipcommon_pmu.c -+++ b/drivers/bcma/driver_chipcommon_pmu.c -@@ -15,44 +15,44 @@ - - u32 bcma_chipco_pll_read(struct bcma_drv_cc *cc, u32 offset) - { -- bcma_cc_write32(cc, BCMA_CC_PLLCTL_ADDR, offset); -- bcma_cc_read32(cc, BCMA_CC_PLLCTL_ADDR); -- return bcma_cc_read32(cc, BCMA_CC_PLLCTL_DATA); -+ bcma_pmu_write32(cc, BCMA_CC_PMU_PLLCTL_ADDR, offset); -+ bcma_pmu_read32(cc, BCMA_CC_PMU_PLLCTL_ADDR); -+ return bcma_pmu_read32(cc, BCMA_CC_PMU_PLLCTL_DATA); - } - EXPORT_SYMBOL_GPL(bcma_chipco_pll_read); - - void bcma_chipco_pll_write(struct bcma_drv_cc *cc, u32 offset, u32 value) - { -- bcma_cc_write32(cc, BCMA_CC_PLLCTL_ADDR, offset); -- bcma_cc_read32(cc, BCMA_CC_PLLCTL_ADDR); -- bcma_cc_write32(cc, BCMA_CC_PLLCTL_DATA, value); -+ bcma_pmu_write32(cc, BCMA_CC_PMU_PLLCTL_ADDR, offset); -+ bcma_pmu_read32(cc, BCMA_CC_PMU_PLLCTL_ADDR); -+ bcma_pmu_write32(cc, BCMA_CC_PMU_PLLCTL_DATA, value); - } - EXPORT_SYMBOL_GPL(bcma_chipco_pll_write); - - void bcma_chipco_pll_maskset(struct bcma_drv_cc *cc, u32 offset, u32 mask, - u32 set) - { -- bcma_cc_write32(cc, BCMA_CC_PLLCTL_ADDR, offset); -- bcma_cc_read32(cc, BCMA_CC_PLLCTL_ADDR); -- bcma_cc_maskset32(cc, BCMA_CC_PLLCTL_DATA, mask, set); -+ bcma_pmu_write32(cc, BCMA_CC_PMU_PLLCTL_ADDR, offset); -+ bcma_pmu_read32(cc, BCMA_CC_PMU_PLLCTL_ADDR); -+ bcma_pmu_maskset32(cc, BCMA_CC_PMU_PLLCTL_DATA, mask, set); - } - EXPORT_SYMBOL_GPL(bcma_chipco_pll_maskset); - - void bcma_chipco_chipctl_maskset(struct bcma_drv_cc *cc, - u32 offset, u32 mask, u32 set) - { -- bcma_cc_write32(cc, BCMA_CC_CHIPCTL_ADDR, offset); -- bcma_cc_read32(cc, BCMA_CC_CHIPCTL_ADDR); -- bcma_cc_maskset32(cc, BCMA_CC_CHIPCTL_DATA, mask, set); -+ bcma_pmu_write32(cc, BCMA_CC_PMU_CHIPCTL_ADDR, offset); -+ bcma_pmu_read32(cc, BCMA_CC_PMU_CHIPCTL_ADDR); -+ bcma_pmu_maskset32(cc, BCMA_CC_PMU_CHIPCTL_DATA, mask, set); - } - EXPORT_SYMBOL_GPL(bcma_chipco_chipctl_maskset); - - void bcma_chipco_regctl_maskset(struct bcma_drv_cc *cc, u32 offset, u32 mask, - u32 set) - { -- bcma_cc_write32(cc, BCMA_CC_REGCTL_ADDR, offset); -- bcma_cc_read32(cc, BCMA_CC_REGCTL_ADDR); -- bcma_cc_maskset32(cc, BCMA_CC_REGCTL_DATA, mask, set); -+ bcma_pmu_write32(cc, BCMA_CC_PMU_REGCTL_ADDR, offset); -+ bcma_pmu_read32(cc, BCMA_CC_PMU_REGCTL_ADDR); -+ bcma_pmu_maskset32(cc, BCMA_CC_PMU_REGCTL_DATA, mask, set); - } - EXPORT_SYMBOL_GPL(bcma_chipco_regctl_maskset); - -@@ -60,18 +60,18 @@ static u32 bcma_pmu_xtalfreq(struct bcma - { - u32 ilp_ctl, alp_hz; - -- if (!(bcma_cc_read32(cc, BCMA_CC_PMU_STAT) & -+ if (!(bcma_pmu_read32(cc, BCMA_CC_PMU_STAT) & - BCMA_CC_PMU_STAT_EXT_LPO_AVAIL)) - return 0; - -- bcma_cc_write32(cc, BCMA_CC_PMU_XTAL_FREQ, -- BIT(BCMA_CC_PMU_XTAL_FREQ_MEASURE_SHIFT)); -+ bcma_pmu_write32(cc, BCMA_CC_PMU_XTAL_FREQ, -+ BIT(BCMA_CC_PMU_XTAL_FREQ_MEASURE_SHIFT)); - usleep_range(1000, 2000); - -- ilp_ctl = bcma_cc_read32(cc, BCMA_CC_PMU_XTAL_FREQ); -+ ilp_ctl = bcma_pmu_read32(cc, BCMA_CC_PMU_XTAL_FREQ); - ilp_ctl &= BCMA_CC_PMU_XTAL_FREQ_ILPCTL_MASK; - -- bcma_cc_write32(cc, BCMA_CC_PMU_XTAL_FREQ, 0); -+ bcma_pmu_write32(cc, BCMA_CC_PMU_XTAL_FREQ, 0); - - alp_hz = ilp_ctl * 32768 / 4; - return (alp_hz + 50000) / 100000 * 100; -@@ -127,8 +127,8 @@ static void bcma_pmu2_pll_init0(struct b - mask = (u32)~(BCMA_RES_4314_HT_AVAIL | - BCMA_RES_4314_MACPHY_CLK_AVAIL); - -- bcma_cc_mask32(cc, BCMA_CC_PMU_MINRES_MSK, mask); -- bcma_cc_mask32(cc, BCMA_CC_PMU_MAXRES_MSK, mask); -+ bcma_pmu_mask32(cc, BCMA_CC_PMU_MINRES_MSK, mask); -+ bcma_pmu_mask32(cc, BCMA_CC_PMU_MAXRES_MSK, mask); - bcma_wait_value(cc->core, BCMA_CLKCTLST, - BCMA_CLKCTLST_HAVEHT, 0, 20000); - break; -@@ -140,7 +140,7 @@ static void bcma_pmu2_pll_init0(struct b - - /* Flush */ - if (cc->pmu.rev >= 2) -- bcma_cc_set32(cc, BCMA_CC_PMU_CTL, BCMA_CC_PMU_CTL_PLL_UPD); -+ bcma_pmu_set32(cc, BCMA_CC_PMU_CTL, BCMA_CC_PMU_CTL_PLL_UPD); - - /* TODO: Do we need to update OTP? */ - } -@@ -195,9 +195,9 @@ static void bcma_pmu_resources_init(stru - - /* Set the resource masks. */ - if (min_msk) -- bcma_cc_write32(cc, BCMA_CC_PMU_MINRES_MSK, min_msk); -+ bcma_pmu_write32(cc, BCMA_CC_PMU_MINRES_MSK, min_msk); - if (max_msk) -- bcma_cc_write32(cc, BCMA_CC_PMU_MAXRES_MSK, max_msk); -+ bcma_pmu_write32(cc, BCMA_CC_PMU_MAXRES_MSK, max_msk); - - /* - * Add some delay; allow resources to come up and settle. -@@ -269,23 +269,33 @@ static void bcma_pmu_workarounds(struct - - void bcma_pmu_early_init(struct bcma_drv_cc *cc) - { -+ struct bcma_bus *bus = cc->core->bus; - u32 pmucap; - -- pmucap = bcma_cc_read32(cc, BCMA_CC_PMU_CAP); -+ if (cc->core->id.rev >= 35 && -+ cc->capabilities_ext & BCMA_CC_CAP_EXT_AOB_PRESENT) { -+ cc->pmu.core = bcma_find_core(bus, BCMA_CORE_PMU); -+ if (!cc->pmu.core) -+ bcma_warn(bus, "Couldn't find expected PMU core"); -+ } -+ if (!cc->pmu.core) -+ cc->pmu.core = cc->core; -+ -+ pmucap = bcma_pmu_read32(cc, BCMA_CC_PMU_CAP); - cc->pmu.rev = (pmucap & BCMA_CC_PMU_CAP_REVISION); - -- bcma_debug(cc->core->bus, "Found rev %u PMU (capabilities 0x%08X)\n", -- cc->pmu.rev, pmucap); -+ bcma_debug(bus, "Found rev %u PMU (capabilities 0x%08X)\n", cc->pmu.rev, -+ pmucap); - } - - void bcma_pmu_init(struct bcma_drv_cc *cc) - { - if (cc->pmu.rev == 1) -- bcma_cc_mask32(cc, BCMA_CC_PMU_CTL, -- ~BCMA_CC_PMU_CTL_NOILPONW); -+ bcma_pmu_mask32(cc, BCMA_CC_PMU_CTL, -+ ~BCMA_CC_PMU_CTL_NOILPONW); - else -- bcma_cc_set32(cc, BCMA_CC_PMU_CTL, -- BCMA_CC_PMU_CTL_NOILPONW); -+ bcma_pmu_set32(cc, BCMA_CC_PMU_CTL, -+ BCMA_CC_PMU_CTL_NOILPONW); - - bcma_pmu_pll_init(cc); - bcma_pmu_resources_init(cc); -@@ -472,8 +482,8 @@ u32 bcma_pmu_get_cpu_clock(struct bcma_d - static void bcma_pmu_spuravoid_pll_write(struct bcma_drv_cc *cc, u32 offset, - u32 value) - { -- bcma_cc_write32(cc, BCMA_CC_PLLCTL_ADDR, offset); -- bcma_cc_write32(cc, BCMA_CC_PLLCTL_DATA, value); -+ bcma_pmu_write32(cc, BCMA_CC_PMU_PLLCTL_ADDR, offset); -+ bcma_pmu_write32(cc, BCMA_CC_PMU_PLLCTL_DATA, value); - } - - void bcma_pmu_spuravoid_pllupdate(struct bcma_drv_cc *cc, int spuravoid) -@@ -497,20 +507,20 @@ void bcma_pmu_spuravoid_pllupdate(struct - bus->chipinfo.id == BCMA_CHIP_ID_BCM53572) ? 6 : 0; - - /* RMW only the P1 divider */ -- bcma_cc_write32(cc, BCMA_CC_PLLCTL_ADDR, -+ bcma_pmu_write32(cc, BCMA_CC_PMU_PLLCTL_ADDR, - BCMA_CC_PMU_PLL_CTL0 + phypll_offset); -- tmp = bcma_cc_read32(cc, BCMA_CC_PLLCTL_DATA); -+ tmp = bcma_pmu_read32(cc, BCMA_CC_PMU_PLLCTL_DATA); - tmp &= (~(BCMA_CC_PMU1_PLL0_PC0_P1DIV_MASK)); - tmp |= (bcm5357_bcm43236_p1div[spuravoid] << BCMA_CC_PMU1_PLL0_PC0_P1DIV_SHIFT); -- bcma_cc_write32(cc, BCMA_CC_PLLCTL_DATA, tmp); -+ bcma_pmu_write32(cc, BCMA_CC_PMU_PLLCTL_DATA, tmp); - - /* RMW only the int feedback divider */ -- bcma_cc_write32(cc, BCMA_CC_PLLCTL_ADDR, -+ bcma_pmu_write32(cc, BCMA_CC_PMU_PLLCTL_ADDR, - BCMA_CC_PMU_PLL_CTL2 + phypll_offset); -- tmp = bcma_cc_read32(cc, BCMA_CC_PLLCTL_DATA); -+ tmp = bcma_pmu_read32(cc, BCMA_CC_PMU_PLLCTL_DATA); - tmp &= ~(BCMA_CC_PMU1_PLL0_PC2_NDIV_INT_MASK); - tmp |= (bcm5357_bcm43236_ndiv[spuravoid]) << BCMA_CC_PMU1_PLL0_PC2_NDIV_INT_SHIFT; -- bcma_cc_write32(cc, BCMA_CC_PLLCTL_DATA, tmp); -+ bcma_pmu_write32(cc, BCMA_CC_PMU_PLLCTL_DATA, tmp); - - tmp = BCMA_CC_PMU_CTL_PLL_UPD; - break; -@@ -646,7 +656,7 @@ void bcma_pmu_spuravoid_pllupdate(struct - break; - } - -- tmp |= bcma_cc_read32(cc, BCMA_CC_PMU_CTL); -- bcma_cc_write32(cc, BCMA_CC_PMU_CTL, tmp); -+ tmp |= bcma_pmu_read32(cc, BCMA_CC_PMU_CTL); -+ bcma_pmu_write32(cc, BCMA_CC_PMU_CTL, tmp); - } - EXPORT_SYMBOL_GPL(bcma_pmu_spuravoid_pllupdate); ---- a/drivers/bcma/driver_chipcommon_sflash.c -+++ b/drivers/bcma/driver_chipcommon_sflash.c -@@ -38,6 +38,7 @@ static const struct bcma_sflash_tbl_e bc - { "M25P32", 0x15, 0x10000, 64, }, - { "M25P64", 0x16, 0x10000, 128, }, - { "M25FL128", 0x17, 0x10000, 256, }, -+ { "MX25L25635F", 0x18, 0x10000, 512, }, - { NULL }, - }; - ---- a/drivers/bcma/scan.c -+++ b/drivers/bcma/scan.c -@@ -98,6 +98,9 @@ static const struct bcma_device_id_name - { BCMA_CORE_SHIM, "SHIM" }, - { BCMA_CORE_PCIE2, "PCIe Gen2" }, - { BCMA_CORE_ARM_CR4, "ARM CR4" }, -+ { BCMA_CORE_GCI, "GCI" }, -+ { BCMA_CORE_CMEM, "CNDS DDR2/3 memory controller" }, -+ { BCMA_CORE_ARM_CA7, "ARM CA7" }, - { BCMA_CORE_DEFAULT, "Default" }, - }; - -@@ -315,6 +318,8 @@ static int bcma_get_next_core(struct bcm - switch (core->id.id) { - case BCMA_CORE_4706_MAC_GBIT_COMMON: - case BCMA_CORE_NS_CHIPCOMMON_B: -+ case BCMA_CORE_PMU: -+ case BCMA_CORE_GCI: - /* Not used yet: case BCMA_CORE_OOB_ROUTER: */ - break; - default: ---- a/drivers/net/wireless/b43/main.c -+++ b/drivers/net/wireless/b43/main.c -@@ -1215,10 +1215,10 @@ void b43_wireless_core_phy_pll_reset(str - case B43_BUS_BCMA: - bcma_cc = &dev->dev->bdev->bus->drv_cc; - -- bcma_cc_write32(bcma_cc, BCMA_CC_CHIPCTL_ADDR, 0); -- bcma_cc_mask32(bcma_cc, BCMA_CC_CHIPCTL_DATA, ~0x4); -- bcma_cc_set32(bcma_cc, BCMA_CC_CHIPCTL_DATA, 0x4); -- bcma_cc_mask32(bcma_cc, BCMA_CC_CHIPCTL_DATA, ~0x4); -+ bcma_cc_write32(bcma_cc, BCMA_CC_PMU_CHIPCTL_ADDR, 0); -+ bcma_cc_mask32(bcma_cc, BCMA_CC_PMU_CHIPCTL_DATA, ~0x4); -+ bcma_cc_set32(bcma_cc, BCMA_CC_PMU_CHIPCTL_DATA, 0x4); -+ bcma_cc_mask32(bcma_cc, BCMA_CC_PMU_CHIPCTL_DATA, ~0x4); - break; - #endif - #ifdef CONFIG_B43_SSB ---- a/include/linux/bcma/bcma.h -+++ b/include/linux/bcma/bcma.h -@@ -151,6 +151,8 @@ struct bcma_host_ops { - #define BCMA_CORE_PCIE2 0x83C /* PCI Express Gen2 */ - #define BCMA_CORE_USB30_DEV 0x83D - #define BCMA_CORE_ARM_CR4 0x83E -+#define BCMA_CORE_GCI 0x840 -+#define BCMA_CORE_CMEM 0x846 /* CNDS DDR2/3 memory controller */ - #define BCMA_CORE_ARM_CA7 0x847 - #define BCMA_CORE_SYS_MEM 0x849 - #define BCMA_CORE_DEFAULT 0xFFF -@@ -200,6 +202,7 @@ struct bcma_host_ops { - #define BCMA_PKG_ID_BCM4707 1 - #define BCMA_PKG_ID_BCM4708 2 - #define BCMA_PKG_ID_BCM4709 0 -+#define BCMA_CHIP_ID_BCM47094 53030 - #define BCMA_CHIP_ID_BCM53018 53018 - - /* Board types (on PCI usually equals to the subsystem dev id) */ ---- a/include/linux/bcma/bcma_driver_chipcommon.h -+++ b/include/linux/bcma/bcma_driver_chipcommon.h -@@ -217,6 +217,11 @@ - #define BCMA_CC_CLKDIV_JTAG_SHIFT 8 - #define BCMA_CC_CLKDIV_UART 0x000000FF - #define BCMA_CC_CAP_EXT 0x00AC /* Capabilities */ -+#define BCMA_CC_CAP_EXT_SECI_PRESENT 0x00000001 -+#define BCMA_CC_CAP_EXT_GSIO_PRESENT 0x00000002 -+#define BCMA_CC_CAP_EXT_GCI_PRESENT 0x00000004 -+#define BCMA_CC_CAP_EXT_SECI_PUART_PRESENT 0x00000008 /* UART present */ -+#define BCMA_CC_CAP_EXT_AOB_PRESENT 0x00000040 - #define BCMA_CC_PLLONDELAY 0x00B0 /* Rev >= 4 only */ - #define BCMA_CC_FREFSELDELAY 0x00B4 /* Rev >= 4 only */ - #define BCMA_CC_SLOWCLKCTL 0x00B8 /* 6 <= Rev <= 9 only */ -@@ -351,12 +356,12 @@ - #define BCMA_CC_PMU_RES_REQTS 0x0640 /* PMU res req timer sel */ - #define BCMA_CC_PMU_RES_REQT 0x0644 /* PMU res req timer */ - #define BCMA_CC_PMU_RES_REQM 0x0648 /* PMU res req mask */ --#define BCMA_CC_CHIPCTL_ADDR 0x0650 --#define BCMA_CC_CHIPCTL_DATA 0x0654 --#define BCMA_CC_REGCTL_ADDR 0x0658 --#define BCMA_CC_REGCTL_DATA 0x065C --#define BCMA_CC_PLLCTL_ADDR 0x0660 --#define BCMA_CC_PLLCTL_DATA 0x0664 -+#define BCMA_CC_PMU_CHIPCTL_ADDR 0x0650 -+#define BCMA_CC_PMU_CHIPCTL_DATA 0x0654 -+#define BCMA_CC_PMU_REGCTL_ADDR 0x0658 -+#define BCMA_CC_PMU_REGCTL_DATA 0x065C -+#define BCMA_CC_PMU_PLLCTL_ADDR 0x0660 -+#define BCMA_CC_PMU_PLLCTL_DATA 0x0664 - #define BCMA_CC_PMU_STRAPOPT 0x0668 /* (corerev >= 28) */ - #define BCMA_CC_PMU_XTAL_FREQ 0x066C /* (pmurev >= 10) */ - #define BCMA_CC_PMU_XTAL_FREQ_ILPCTL_MASK 0x00001FFF -@@ -566,17 +571,16 @@ - * Check availability with ((struct bcma_chipcommon)->capabilities & BCMA_CC_CAP_PMU) - */ - struct bcma_chipcommon_pmu { -+ struct bcma_device *core; /* Can be separated core or just ChipCommon one */ - u8 rev; /* PMU revision */ - u32 crystalfreq; /* The active crystal frequency (in kHz) */ - }; - --#ifdef CONFIG_BCMA_DRIVER_MIPS -+#ifdef CONFIG_BCMA_PFLASH - struct bcma_pflash { - bool present; -- u8 buswidth; -- u32 window; -- u32 window_size; - }; -+#endif - - #ifdef CONFIG_BCMA_SFLASH - struct bcma_sflash { -@@ -602,6 +606,7 @@ struct bcma_nflash { - }; - #endif - -+#ifdef CONFIG_BCMA_DRIVER_MIPS - struct bcma_serial_port { - void *regs; - unsigned long clockspeed; -@@ -621,8 +626,9 @@ struct bcma_drv_cc { - /* Fast Powerup Delay constant */ - u16 fast_pwrup_delay; - struct bcma_chipcommon_pmu pmu; --#ifdef CONFIG_BCMA_DRIVER_MIPS -+#ifdef CONFIG_BCMA_PFLASH - struct bcma_pflash pflash; -+#endif - #ifdef CONFIG_BCMA_SFLASH - struct bcma_sflash sflash; - #endif -@@ -630,6 +636,7 @@ struct bcma_drv_cc { - struct bcma_nflash nflash; - #endif - -+#ifdef CONFIG_BCMA_DRIVER_MIPS - int nr_serial_ports; - struct bcma_serial_port serial_ports[4]; - #endif /* CONFIG_BCMA_DRIVER_MIPS */ -@@ -663,6 +670,19 @@ struct bcma_drv_cc_b { - #define bcma_cc_maskset32(cc, offset, mask, set) \ - bcma_cc_write32(cc, offset, (bcma_cc_read32(cc, offset) & (mask)) | (set)) - -+/* PMU registers access */ -+#define bcma_pmu_read32(cc, offset) \ -+ bcma_read32((cc)->pmu.core, offset) -+#define bcma_pmu_write32(cc, offset, val) \ -+ bcma_write32((cc)->pmu.core, offset, val) -+ -+#define bcma_pmu_mask32(cc, offset, mask) \ -+ bcma_pmu_write32(cc, offset, bcma_pmu_read32(cc, offset) & (mask)) -+#define bcma_pmu_set32(cc, offset, set) \ -+ bcma_pmu_write32(cc, offset, bcma_pmu_read32(cc, offset) | (set)) -+#define bcma_pmu_maskset32(cc, offset, mask, set) \ -+ bcma_pmu_write32(cc, offset, (bcma_pmu_read32(cc, offset) & (mask)) | (set)) -+ - extern u32 bcma_chipco_watchdog_timer_set(struct bcma_drv_cc *cc, u32 ticks); - - extern u32 bcma_chipco_get_alp_clock(struct bcma_drv_cc *cc); ---- a/drivers/bcma/bcma_private.h -+++ b/drivers/bcma/bcma_private.h -@@ -44,10 +44,6 @@ int bcma_sprom_get(struct bcma_bus *bus) - void bcma_core_chipcommon_early_init(struct bcma_drv_cc *cc); - void bcma_core_chipcommon_init(struct bcma_drv_cc *cc); - void bcma_chipco_bcm4331_ext_pa_lines_ctl(struct bcma_drv_cc *cc, bool enable); --#ifdef CONFIG_BCMA_DRIVER_MIPS --void bcma_chipco_serial_init(struct bcma_drv_cc *cc); --extern struct platform_device bcma_pflash_dev; --#endif /* CONFIG_BCMA_DRIVER_MIPS */ - - /* driver_chipcommon_b.c */ - int bcma_core_chipcommon_b_init(struct bcma_drv_cc_b *ccb); -@@ -59,6 +55,21 @@ void bcma_pmu_init(struct bcma_drv_cc *c - u32 bcma_pmu_get_alp_clock(struct bcma_drv_cc *cc); - u32 bcma_pmu_get_cpu_clock(struct bcma_drv_cc *cc); - -+/************************************************** -+ * driver_chipcommon_sflash.c -+ **************************************************/ -+ -+#ifdef CONFIG_BCMA_PFLASH -+extern struct platform_device bcma_pflash_dev; -+int bcma_pflash_init(struct bcma_drv_cc *cc); -+#else -+static inline int bcma_pflash_init(struct bcma_drv_cc *cc) -+{ -+ bcma_err(cc->core->bus, "Parallel flash not supported\n"); -+ return 0; -+} -+#endif /* CONFIG_BCMA_PFLASH */ -+ - #ifdef CONFIG_BCMA_SFLASH - /* driver_chipcommon_sflash.c */ - int bcma_sflash_init(struct bcma_drv_cc *cc); ---- a/drivers/bcma/driver_gpio.c -+++ b/drivers/bcma/driver_gpio.c -@@ -229,6 +229,7 @@ int bcma_gpio_init(struct bcma_drv_cc *c - case BCMA_CHIP_ID_BCM4707: - case BCMA_CHIP_ID_BCM5357: - case BCMA_CHIP_ID_BCM53572: -+ case BCMA_CHIP_ID_BCM47094: - chip->ngpio = 32; - break; - default: ---- a/drivers/bcma/driver_mips.c -+++ b/drivers/bcma/driver_mips.c -@@ -14,8 +14,6 @@ - - #include - --#include --#include - #include - #include - #include -@@ -29,26 +27,6 @@ enum bcma_boot_dev { - BCMA_BOOT_DEV_NAND, - }; - --static const char * const part_probes[] = { "bcm47xxpart", NULL }; -- --static struct physmap_flash_data bcma_pflash_data = { -- .part_probe_types = part_probes, --}; -- --static struct resource bcma_pflash_resource = { -- .name = "bcma_pflash", -- .flags = IORESOURCE_MEM, --}; -- --struct platform_device bcma_pflash_dev = { -- .name = "physmap-flash", -- .dev = { -- .platform_data = &bcma_pflash_data, -- }, -- .resource = &bcma_pflash_resource, -- .num_resources = 1, --}; -- - /* The 47162a0 hangs when reading MIPS DMP registers registers */ - static inline bool bcma_core_mips_bcm47162a0_quirk(struct bcma_device *dev) - { -@@ -269,48 +247,11 @@ static enum bcma_boot_dev bcma_boot_dev( - return BCMA_BOOT_DEV_SERIAL; - } - --static void bcma_core_mips_flash_detect(struct bcma_drv_mips *mcore) -+static void bcma_core_mips_nvram_init(struct bcma_drv_mips *mcore) - { - struct bcma_bus *bus = mcore->core->bus; -- struct bcma_drv_cc *cc = &bus->drv_cc; -- struct bcma_pflash *pflash = &cc->pflash; - enum bcma_boot_dev boot_dev; - -- switch (cc->capabilities & BCMA_CC_CAP_FLASHT) { -- case BCMA_CC_FLASHT_STSER: -- case BCMA_CC_FLASHT_ATSER: -- bcma_debug(bus, "Found serial flash\n"); -- bcma_sflash_init(cc); -- break; -- case BCMA_CC_FLASHT_PARA: -- bcma_debug(bus, "Found parallel flash\n"); -- pflash->present = true; -- pflash->window = BCMA_SOC_FLASH2; -- pflash->window_size = BCMA_SOC_FLASH2_SZ; -- -- if ((bcma_read32(cc->core, BCMA_CC_FLASH_CFG) & -- BCMA_CC_FLASH_CFG_DS) == 0) -- pflash->buswidth = 1; -- else -- pflash->buswidth = 2; -- -- bcma_pflash_data.width = pflash->buswidth; -- bcma_pflash_resource.start = pflash->window; -- bcma_pflash_resource.end = pflash->window + pflash->window_size; -- -- break; -- default: -- bcma_err(bus, "Flash type not supported\n"); -- } -- -- if (cc->core->id.rev == 38 || -- bus->chipinfo.id == BCMA_CHIP_ID_BCM4706) { -- if (cc->capabilities & BCMA_CC_CAP_NFLASH) { -- bcma_debug(bus, "Found NAND flash\n"); -- bcma_nflash_init(cc); -- } -- } -- - /* Determine flash type this SoC boots from */ - boot_dev = bcma_boot_dev(bus); - switch (boot_dev) { -@@ -328,13 +269,10 @@ static void bcma_core_mips_flash_detect( - - void bcma_core_mips_early_init(struct bcma_drv_mips *mcore) - { -- struct bcma_bus *bus = mcore->core->bus; -- - if (mcore->early_setup_done) - return; - -- bcma_chipco_serial_init(&bus->drv_cc); -- bcma_core_mips_flash_detect(mcore); -+ bcma_core_mips_nvram_init(mcore); - - mcore->early_setup_done = true; - } ---- a/drivers/bcma/host_pci.c -+++ b/drivers/bcma/host_pci.c -@@ -294,7 +294,7 @@ static const struct pci_device_id bcma_p - { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x4358) }, - { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x4359) }, - { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x4360) }, -- { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x4365) }, -+ { PCI_DEVICE_SUB(PCI_VENDOR_ID_BROADCOM, 0x4365, PCI_VENDOR_ID_DELL, 0x0016) }, - { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x43a0) }, - { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x43a9) }, - { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x43aa) }, ---- a/drivers/bcma/Kconfig -+++ b/drivers/bcma/Kconfig -@@ -70,6 +70,11 @@ config BCMA_DRIVER_MIPS - - If unsure, say N - -+config BCMA_PFLASH -+ bool -+ depends on BCMA_DRIVER_MIPS -+ default y -+ - config BCMA_SFLASH - bool - depends on BCMA_DRIVER_MIPS ---- a/drivers/bcma/Makefile -+++ b/drivers/bcma/Makefile -@@ -1,6 +1,7 @@ - bcma-y += main.o scan.o core.o sprom.o - bcma-y += driver_chipcommon.o driver_chipcommon_pmu.o - bcma-y += driver_chipcommon_b.o -+bcma-$(CONFIG_BCMA_PFLASH) += driver_chipcommon_pflash.o - bcma-$(CONFIG_BCMA_SFLASH) += driver_chipcommon_sflash.o - bcma-$(CONFIG_BCMA_NFLASH) += driver_chipcommon_nflash.o - bcma-$(CONFIG_BCMA_DRIVER_PCI) += driver_pci.o ---- /dev/null -+++ b/drivers/bcma/driver_chipcommon_pflash.c -@@ -0,0 +1,49 @@ -+/* -+ * Broadcom specific AMBA -+ * ChipCommon parallel flash -+ * -+ * Licensed under the GNU/GPL. See COPYING for details. -+ */ -+ -+#include "bcma_private.h" -+ -+#include -+#include -+#include -+ -+static const char * const part_probes[] = { "bcm47xxpart", NULL }; -+ -+static struct physmap_flash_data bcma_pflash_data = { -+ .part_probe_types = part_probes, -+}; -+ -+static struct resource bcma_pflash_resource = { -+ .name = "bcma_pflash", -+ .flags = IORESOURCE_MEM, -+}; -+ -+struct platform_device bcma_pflash_dev = { -+ .name = "physmap-flash", -+ .dev = { -+ .platform_data = &bcma_pflash_data, -+ }, -+ .resource = &bcma_pflash_resource, -+ .num_resources = 1, -+}; -+ -+int bcma_pflash_init(struct bcma_drv_cc *cc) -+{ -+ struct bcma_pflash *pflash = &cc->pflash; -+ -+ pflash->present = true; -+ -+ if (!(bcma_read32(cc->core, BCMA_CC_FLASH_CFG) & BCMA_CC_FLASH_CFG_DS)) -+ bcma_pflash_data.width = 1; -+ else -+ bcma_pflash_data.width = 2; -+ -+ bcma_pflash_resource.start = BCMA_SOC_FLASH2; -+ bcma_pflash_resource.end = BCMA_SOC_FLASH2 + BCMA_SOC_FLASH2_SZ; -+ -+ return 0; -+} ---- a/drivers/bcma/main.c -+++ b/drivers/bcma/main.c -@@ -325,7 +325,7 @@ static int bcma_register_devices(struct - bcma_register_core(bus, core); - } - --#ifdef CONFIG_BCMA_DRIVER_MIPS -+#ifdef CONFIG_BCMA_PFLASH - if (bus->drv_cc.pflash.present) { - err = platform_device_register(&bcma_pflash_dev); - if (err) diff --git a/target/linux/generic/pending-3.18/040-mtd-bcm47xxpart-backports-from-3.19.patch b/target/linux/generic/pending-3.18/040-mtd-bcm47xxpart-backports-from-3.19.patch deleted file mode 100644 index b2d53f9f8a..0000000000 --- a/target/linux/generic/pending-3.18/040-mtd-bcm47xxpart-backports-from-3.19.patch +++ /dev/null @@ -1,50 +0,0 @@ ---- a/drivers/mtd/bcm47xxpart.c -+++ b/drivers/mtd/bcm47xxpart.c -@@ -15,8 +15,12 @@ - #include - #include - --/* 10 parts were found on sflash on Netgear WNDR4500 */ --#define BCM47XXPART_MAX_PARTS 12 -+/* -+ * NAND flash on Netgear R6250 was verified to contain 15 partitions. -+ * This will result in allocating too big array for some old devices, but the -+ * memory will be freed soon anyway (see mtd_device_parse_register). -+ */ -+#define BCM47XXPART_MAX_PARTS 20 - - /* - * Amount of bytes we read when analyzing each block of flash memory. -@@ -168,18 +172,26 @@ static int bcm47xxpart_parse(struct mtd_ - i++; - } - -- bcm47xxpart_add_part(&parts[curr_part++], "linux", -- offset + trx->offset[i], 0); -- i++; -+ if (trx->offset[i]) { -+ bcm47xxpart_add_part(&parts[curr_part++], -+ "linux", -+ offset + trx->offset[i], -+ 0); -+ i++; -+ } - - /* - * Pure rootfs size is known and can be calculated as: - * trx->length - trx->offset[i]. We don't fill it as - * we want to have jffs2 (overlay) in the same mtd. - */ -- bcm47xxpart_add_part(&parts[curr_part++], "rootfs", -- offset + trx->offset[i], 0); -- i++; -+ if (trx->offset[i]) { -+ bcm47xxpart_add_part(&parts[curr_part++], -+ "rootfs", -+ offset + trx->offset[i], -+ 0); -+ i++; -+ } - - last_trx_part = curr_part - 1; - diff --git a/target/linux/generic/pending-3.18/041-mtd-bcm47xxpart-backports-from-3.20.patch b/target/linux/generic/pending-3.18/041-mtd-bcm47xxpart-backports-from-3.20.patch deleted file mode 100644 index f3dfa901f1..0000000000 --- a/target/linux/generic/pending-3.18/041-mtd-bcm47xxpart-backports-from-3.20.patch +++ /dev/null @@ -1,95 +0,0 @@ ---- a/drivers/mtd/bcm47xxpart.c -+++ b/drivers/mtd/bcm47xxpart.c -@@ -15,6 +15,8 @@ - #include - #include - -+#include -+ - /* - * NAND flash on Netgear R6250 was verified to contain 15 partitions. - * This will result in allocating too big array for some old devices, but the -@@ -39,7 +41,8 @@ - #define ML_MAGIC1 0x39685a42 - #define ML_MAGIC2 0x26594131 - #define TRX_MAGIC 0x30524448 --#define SQSH_MAGIC 0x71736873 /* shsq */ -+#define SHSQ_MAGIC 0x71736873 /* shsq (weird ZTE H218N endianness) */ -+#define UBI_EC_MAGIC 0x23494255 /* UBI# */ - - struct trx_header { - uint32_t magic; -@@ -50,7 +53,7 @@ struct trx_header { - uint32_t offset[3]; - } __packed; - --static void bcm47xxpart_add_part(struct mtd_partition *part, char *name, -+static void bcm47xxpart_add_part(struct mtd_partition *part, const char *name, - u64 offset, uint32_t mask_flags) - { - part->name = name; -@@ -58,6 +61,26 @@ static void bcm47xxpart_add_part(struct - part->mask_flags = mask_flags; - } - -+static const char *bcm47xxpart_trx_data_part_name(struct mtd_info *master, -+ size_t offset) -+{ -+ uint32_t buf; -+ size_t bytes_read; -+ -+ if (mtd_read(master, offset, sizeof(buf), &bytes_read, -+ (uint8_t *)&buf) < 0) { -+ pr_err("mtd_read error while parsing (offset: 0x%X)!\n", -+ offset); -+ goto out_default; -+ } -+ -+ if (buf == UBI_EC_MAGIC) -+ return "ubi"; -+ -+out_default: -+ return "rootfs"; -+} -+ - static int bcm47xxpart_parse(struct mtd_info *master, - struct mtd_partition **pparts, - struct mtd_part_parser_data *data) -@@ -73,8 +96,12 @@ static int bcm47xxpart_parse(struct mtd_ - int last_trx_part = -1; - int possible_nvram_sizes[] = { 0x8000, 0xF000, 0x10000, }; - -- if (blocksize <= 0x10000) -- blocksize = 0x10000; -+ /* -+ * Some really old flashes (like AT45DB*) had smaller erasesize-s, but -+ * partitions were aligned to at least 0x1000 anyway. -+ */ -+ if (blocksize < 0x1000) -+ blocksize = 0x1000; - - /* Alloc */ - parts = kzalloc(sizeof(struct mtd_partition) * BCM47XXPART_MAX_PARTS, -@@ -186,8 +213,11 @@ static int bcm47xxpart_parse(struct mtd_ - * we want to have jffs2 (overlay) in the same mtd. - */ - if (trx->offset[i]) { -+ const char *name; -+ -+ name = bcm47xxpart_trx_data_part_name(master, offset + trx->offset[i]); - bcm47xxpart_add_part(&parts[curr_part++], -- "rootfs", -+ name, - offset + trx->offset[i], - 0); - i++; -@@ -203,7 +233,8 @@ static int bcm47xxpart_parse(struct mtd_ - } - - /* Squashfs on devices not using TRX */ -- if (buf[0x000 / 4] == SQSH_MAGIC) { -+ if (le32_to_cpu(buf[0x000 / 4]) == SQUASHFS_MAGIC || -+ buf[0x000 / 4] == SHSQ_MAGIC) { - bcm47xxpart_add_part(&parts[curr_part++], "rootfs", - offset, 0); - continue; diff --git a/target/linux/generic/pending-3.18/043-mtd_GD25Q128B_support_backport_from_3.19.patch b/target/linux/generic/pending-3.18/043-mtd_GD25Q128B_support_backport_from_3.19.patch deleted file mode 100644 index b7bae34aa7..0000000000 --- a/target/linux/generic/pending-3.18/043-mtd_GD25Q128B_support_backport_from_3.19.patch +++ /dev/null @@ -1,15 +0,0 @@ -mtd: spi-nor: support for (GigaDevice) GD25Q128B - -Signed-off-by: Rafał Miłecki -Signed-off-by: Brian Norris - ---- a/drivers/mtd/spi-nor/spi-nor.c -+++ b/drivers/mtd/spi-nor/spi-nor.c -@@ -510,6 +510,7 @@ static const struct spi_device_id spi_no - /* GigaDevice */ - { "gd25q32", INFO(0xc84016, 0, 64 * 1024, 64, SECT_4K) }, - { "gd25q64", INFO(0xc84017, 0, 64 * 1024, 128, SECT_4K) }, -+ { "gd25q128", INFO(0xc84018, 0, 64 * 1024, 256, SECT_4K) }, - - /* Intel/Numonyx -- xxxs33b */ - { "160s33b", INFO(0x898911, 0, 64 * 1024, 32, 0) }, diff --git a/target/linux/generic/pending-3.18/044-backport-m25p80-jedec-probe.patch b/target/linux/generic/pending-3.18/044-backport-m25p80-jedec-probe.patch deleted file mode 100644 index 24c264ba97..0000000000 --- a/target/linux/generic/pending-3.18/044-backport-m25p80-jedec-probe.patch +++ /dev/null @@ -1,39 +0,0 @@ ---- a/drivers/mtd/devices/m25p80.c -+++ b/drivers/mtd/devices/m25p80.c -@@ -310,11 +310,21 @@ static const struct spi_device_id m25p_i - }; - MODULE_DEVICE_TABLE(spi, m25p_ids); - -+static const struct of_device_id m25p_of_table[] = { -+ /* -+ * Generic compatibility for SPI NOR that can be identified by the -+ * JEDEC READ ID opcode (0x9F). Use this, if possible. -+ */ -+ { .compatible = "jedec,spi-nor" }, -+ {} -+}; -+MODULE_DEVICE_TABLE(of, m25p_of_table); - - static struct spi_driver m25p80_driver = { - .driver = { - .name = "m25p80", - .owner = THIS_MODULE, -+ .of_match_table = m25p_of_table, - }, - .id_table = m25p_ids, - .probe = m25p_probe, ---- a/drivers/mtd/spi-nor/spi-nor.c -+++ b/drivers/mtd/spi-nor/spi-nor.c -@@ -934,8 +934,11 @@ int spi_nor_scan(struct spi_nor *nor, co - if (ret) - return ret; - -- id = spi_nor_match_id(name); -+ if (name) -+ id = spi_nor_match_id(name); - if (!id) -+ id = nor->read_id(nor); -+ if (IS_ERR_OR_NULL(id)) - return -ENOENT; - - info = (void *)id->driver_data; diff --git a/target/linux/generic/pending-3.18/050-backport_netfilter_rtcache.patch b/target/linux/generic/pending-3.18/050-backport_netfilter_rtcache.patch deleted file mode 100644 index 9f23db6a79..0000000000 --- a/target/linux/generic/pending-3.18/050-backport_netfilter_rtcache.patch +++ /dev/null @@ -1,509 +0,0 @@ -Subject: netfilter: conntrack: cache route for forwarded connections - -... to avoid per-packet FIB lookup if possible. - -The cached dst is re-used provided the input interface -is the same as that of the previous packet in the same direction. - -If not, the cached dst is invalidated. - -For ipv6 we also need to store sernum, else dst_check doesn't work, -pointed out by Eric Dumazet. - -This should speed up forwarding when conntrack is already in use -anyway, especially when using reverse path filtering -- active RPF -enforces two FIB lookups for each packet. - -Before the routing cache removal this didn't matter since RPF was performed -only when route cache didn't yield a result; but without route cache it -comes at higher price. - -Julian Anastasov suggested to add NETDEV_UNREGISTER handler to -avoid holding on to dsts of 'frozen' conntracks. - -Signed-off-by: Florian Westphal - ---- a/include/net/netfilter/nf_conntrack_extend.h -+++ b/include/net/netfilter/nf_conntrack_extend.h -@@ -30,6 +30,9 @@ enum nf_ct_ext_id { - #if IS_ENABLED(CONFIG_NETFILTER_SYNPROXY) - NF_CT_EXT_SYNPROXY, - #endif -+#if IS_ENABLED(CONFIG_NF_CONNTRACK_RTCACHE) -+ NF_CT_EXT_RTCACHE, -+#endif - NF_CT_EXT_NUM, - }; - -@@ -43,6 +46,7 @@ enum nf_ct_ext_id { - #define NF_CT_EXT_TIMEOUT_TYPE struct nf_conn_timeout - #define NF_CT_EXT_LABELS_TYPE struct nf_conn_labels - #define NF_CT_EXT_SYNPROXY_TYPE struct nf_conn_synproxy -+#define NF_CT_EXT_RTCACHE_TYPE struct nf_conn_rtcache - - /* Extensions: optional stuff which isn't permanently in struct. */ - struct nf_ct_ext { ---- /dev/null -+++ b/include/net/netfilter/nf_conntrack_rtcache.h -@@ -0,0 +1,34 @@ -+#include -+#include -+#include -+ -+struct dst_entry; -+ -+struct nf_conn_dst_cache { -+ struct dst_entry *dst; -+ int iif; -+#if IS_ENABLED(CONFIG_NF_CONNTRACK_IPV6) -+ u32 cookie; -+#endif -+ -+}; -+ -+struct nf_conn_rtcache { -+ struct nf_conn_dst_cache cached_dst[IP_CT_DIR_MAX]; -+}; -+ -+static inline -+struct nf_conn_rtcache *nf_ct_rtcache_find(const struct nf_conn *ct) -+{ -+#if IS_ENABLED(CONFIG_NF_CONNTRACK_RTCACHE) -+ return nf_ct_ext_find(ct, NF_CT_EXT_RTCACHE); -+#else -+ return NULL; -+#endif -+} -+ -+static inline int nf_conn_rtcache_iif_get(const struct nf_conn_rtcache *rtc, -+ enum ip_conntrack_dir dir) -+{ -+ return rtc->cached_dst[dir].iif; -+} ---- a/net/netfilter/Kconfig -+++ b/net/netfilter/Kconfig -@@ -106,6 +106,18 @@ config NF_CONNTRACK_EVENTS - - If unsure, say `N'. - -+config NF_CONNTRACK_RTCACHE -+ tristate "Cache route entries in conntrack objects" -+ depends on NETFILTER_ADVANCED -+ depends on NF_CONNTRACK -+ help -+ If this option is enabled, the connection tracking code will -+ cache routing information for each connection that is being -+ forwarded, at a cost of 32 bytes per conntrack object. -+ -+ To compile it as a module, choose M here. If unsure, say N. -+ The module will be called nf_conntrack_rtcache. -+ - config NF_CONNTRACK_TIMEOUT - bool 'Connection tracking timeout' - depends on NETFILTER_ADVANCED ---- a/net/netfilter/Makefile -+++ b/net/netfilter/Makefile -@@ -18,6 +18,9 @@ obj-$(CONFIG_NETFILTER_NETLINK_LOG) += n - # connection tracking - obj-$(CONFIG_NF_CONNTRACK) += nf_conntrack.o - -+# optional conntrack route cache extension -+obj-$(CONFIG_NF_CONNTRACK_RTCACHE) += nf_conntrack_rtcache.o -+ - # SCTP protocol connection tracking - obj-$(CONFIG_NF_CT_PROTO_DCCP) += nf_conntrack_proto_dccp.o - obj-$(CONFIG_NF_CT_PROTO_GRE) += nf_conntrack_proto_gre.o ---- /dev/null -+++ b/net/netfilter/nf_conntrack_rtcache.c -@@ -0,0 +1,391 @@ -+/* route cache for netfilter. -+ * -+ * (C) 2014 Red Hat GmbH -+ * -+ * 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 -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+#include -+ -+#include -+#include -+#include -+#include -+ -+#if IS_ENABLED(CONFIG_NF_CONNTRACK_IPV6) -+#include -+#endif -+ -+static void __nf_conn_rtcache_destroy(struct nf_conn_rtcache *rtc, -+ enum ip_conntrack_dir dir) -+{ -+ struct dst_entry *dst = rtc->cached_dst[dir].dst; -+ -+ dst_release(dst); -+} -+ -+static void nf_conn_rtcache_destroy(struct nf_conn *ct) -+{ -+ struct nf_conn_rtcache *rtc = nf_ct_rtcache_find(ct); -+ -+ if (!rtc) -+ return; -+ -+ __nf_conn_rtcache_destroy(rtc, IP_CT_DIR_ORIGINAL); -+ __nf_conn_rtcache_destroy(rtc, IP_CT_DIR_REPLY); -+} -+ -+static void nf_ct_rtcache_ext_add(struct nf_conn *ct) -+{ -+ struct nf_conn_rtcache *rtc; -+ -+ rtc = nf_ct_ext_add(ct, NF_CT_EXT_RTCACHE, GFP_ATOMIC); -+ if (rtc) { -+ rtc->cached_dst[IP_CT_DIR_ORIGINAL].iif = -1; -+ rtc->cached_dst[IP_CT_DIR_ORIGINAL].dst = NULL; -+ rtc->cached_dst[IP_CT_DIR_REPLY].iif = -1; -+ rtc->cached_dst[IP_CT_DIR_REPLY].dst = NULL; -+ } -+} -+ -+static struct nf_conn_rtcache *nf_ct_rtcache_find_usable(struct nf_conn *ct) -+{ -+ if (nf_ct_is_untracked(ct)) -+ return NULL; -+ return nf_ct_rtcache_find(ct); -+} -+ -+static struct dst_entry * -+nf_conn_rtcache_dst_get(const struct nf_conn_rtcache *rtc, -+ enum ip_conntrack_dir dir) -+{ -+ return rtc->cached_dst[dir].dst; -+} -+ -+static u32 nf_rtcache_get_cookie(int pf, const struct dst_entry *dst) -+{ -+#if IS_ENABLED(CONFIG_NF_CONNTRACK_IPV6) -+ if (pf == NFPROTO_IPV6) { -+ const struct rt6_info *rt = (const struct rt6_info *)dst; -+ -+ if (rt->rt6i_node) -+ return (u32)rt->rt6i_node->fn_sernum; -+ } -+#endif -+ return 0; -+} -+ -+static void nf_conn_rtcache_dst_set(int pf, -+ struct nf_conn_rtcache *rtc, -+ struct dst_entry *dst, -+ enum ip_conntrack_dir dir, int iif) -+{ -+ if (rtc->cached_dst[dir].iif != iif) -+ rtc->cached_dst[dir].iif = iif; -+ -+ if (rtc->cached_dst[dir].dst != dst) { -+ struct dst_entry *old; -+ -+ dst_hold(dst); -+ -+ old = xchg(&rtc->cached_dst[dir].dst, dst); -+ dst_release(old); -+ -+#if IS_ENABLED(CONFIG_NF_CONNTRACK_IPV6) -+ if (pf == NFPROTO_IPV6) -+ rtc->cached_dst[dir].cookie = -+ nf_rtcache_get_cookie(pf, dst); -+#endif -+ } -+} -+ -+static void nf_conn_rtcache_dst_obsolete(struct nf_conn_rtcache *rtc, -+ enum ip_conntrack_dir dir) -+{ -+ struct dst_entry *old; -+ -+ pr_debug("Invalidate iif %d for dir %d on cache %p\n", -+ rtc->cached_dst[dir].iif, dir, rtc); -+ -+ old = xchg(&rtc->cached_dst[dir].dst, NULL); -+ dst_release(old); -+ rtc->cached_dst[dir].iif = -1; -+} -+ -+static unsigned int nf_rtcache_in(const struct nf_hook_ops *ops, -+ struct sk_buff *skb, -+ const struct net_device *in, -+ const struct net_device *out, -+ int (*okfn)(struct sk_buff *)) -+{ -+ struct nf_conn_rtcache *rtc; -+ enum ip_conntrack_info ctinfo; -+ enum ip_conntrack_dir dir; -+ struct dst_entry *dst; -+ struct nf_conn *ct; -+ int iif; -+ u32 cookie; -+ -+ if (skb_dst(skb) || skb->sk) -+ return NF_ACCEPT; -+ -+ ct = nf_ct_get(skb, &ctinfo); -+ if (!ct) -+ return NF_ACCEPT; -+ -+ rtc = nf_ct_rtcache_find_usable(ct); -+ if (!rtc) -+ return NF_ACCEPT; -+ -+ /* if iif changes, don't use cache and let ip stack -+ * do route lookup. -+ * -+ * If rp_filter is enabled it might toss skb, so -+ * we don't want to avoid these checks. -+ */ -+ dir = CTINFO2DIR(ctinfo); -+ iif = nf_conn_rtcache_iif_get(rtc, dir); -+ if (in->ifindex != iif) { -+ pr_debug("ct %p, iif %d, cached iif %d, skip cached entry\n", -+ ct, iif, in->ifindex); -+ return NF_ACCEPT; -+ } -+ dst = nf_conn_rtcache_dst_get(rtc, dir); -+ if (dst == NULL) -+ return NF_ACCEPT; -+ -+ cookie = nf_rtcache_get_cookie(ops->pf, dst); -+ -+ dst = dst_check(dst, cookie); -+ pr_debug("obtained dst %p for skb %p, cookie %d\n", dst, skb, cookie); -+ if (likely(dst)) -+ skb_dst_set_noref_force(skb, dst); -+ else -+ nf_conn_rtcache_dst_obsolete(rtc, dir); -+ -+ return NF_ACCEPT; -+} -+ -+static unsigned int nf_rtcache_forward(const struct nf_hook_ops *ops, -+ struct sk_buff *skb, -+ const struct net_device *in, -+ const struct net_device *out, -+ int (*okfn)(struct sk_buff *)) -+{ -+ struct nf_conn_rtcache *rtc; -+ enum ip_conntrack_info ctinfo; -+ enum ip_conntrack_dir dir; -+ struct nf_conn *ct; -+ struct dst_entry *dst = skb_dst(skb); -+ int iif; -+ -+ ct = nf_ct_get(skb, &ctinfo); -+ if (!ct) -+ return NF_ACCEPT; -+ -+ if (dst && dst_xfrm(dst)) -+ return NF_ACCEPT; -+ -+ if (!nf_ct_is_confirmed(ct)) { -+ if (WARN_ON(nf_ct_rtcache_find(ct))) -+ return NF_ACCEPT; -+ nf_ct_rtcache_ext_add(ct); -+ return NF_ACCEPT; -+ } -+ -+ rtc = nf_ct_rtcache_find_usable(ct); -+ if (!rtc) -+ return NF_ACCEPT; -+ -+ dir = CTINFO2DIR(ctinfo); -+ iif = nf_conn_rtcache_iif_get(rtc, dir); -+ pr_debug("ct %p, skb %p, dir %d, iif %d, cached iif %d\n", -+ ct, skb, dir, iif, in->ifindex); -+ if (likely(in->ifindex == iif)) -+ return NF_ACCEPT; -+ -+ nf_conn_rtcache_dst_set(ops->pf, rtc, skb_dst(skb), dir, in->ifindex); -+ return NF_ACCEPT; -+} -+ -+static int nf_rtcache_dst_remove(struct nf_conn *ct, void *data) -+{ -+ struct nf_conn_rtcache *rtc = nf_ct_rtcache_find(ct); -+ struct net_device *dev = data; -+ -+ if (!rtc) -+ return 0; -+ -+ if (dev->ifindex == rtc->cached_dst[IP_CT_DIR_ORIGINAL].iif || -+ dev->ifindex == rtc->cached_dst[IP_CT_DIR_REPLY].iif) { -+ nf_conn_rtcache_dst_obsolete(rtc, IP_CT_DIR_ORIGINAL); -+ nf_conn_rtcache_dst_obsolete(rtc, IP_CT_DIR_REPLY); -+ } -+ -+ return 0; -+} -+ -+static int nf_rtcache_netdev_event(struct notifier_block *this, -+ unsigned long event, void *ptr) -+{ -+ struct net_device *dev = netdev_notifier_info_to_dev(ptr); -+ struct net *net = dev_net(dev); -+ -+ if (event == NETDEV_DOWN) -+ nf_ct_iterate_cleanup(net, nf_rtcache_dst_remove, dev, 0, 0); -+ -+ return NOTIFY_DONE; -+} -+ -+static struct notifier_block nf_rtcache_notifier = { -+ .notifier_call = nf_rtcache_netdev_event, -+}; -+ -+static struct nf_hook_ops rtcache_ops[] = { -+ { -+ .hook = nf_rtcache_in, -+ .owner = THIS_MODULE, -+ .pf = NFPROTO_IPV4, -+ .hooknum = NF_INET_PRE_ROUTING, -+ .priority = NF_IP_PRI_LAST, -+ }, -+ { -+ .hook = nf_rtcache_forward, -+ .owner = THIS_MODULE, -+ .pf = NFPROTO_IPV4, -+ .hooknum = NF_INET_FORWARD, -+ .priority = NF_IP_PRI_LAST, -+ }, -+#if IS_ENABLED(CONFIG_NF_CONNTRACK_IPV6) -+ { -+ .hook = nf_rtcache_in, -+ .owner = THIS_MODULE, -+ .pf = NFPROTO_IPV6, -+ .hooknum = NF_INET_PRE_ROUTING, -+ .priority = NF_IP_PRI_LAST, -+ }, -+ { -+ .hook = nf_rtcache_forward, -+ .owner = THIS_MODULE, -+ .pf = NFPROTO_IPV6, -+ .hooknum = NF_INET_FORWARD, -+ .priority = NF_IP_PRI_LAST, -+ }, -+#endif -+}; -+ -+static struct nf_ct_ext_type rtcache_extend __read_mostly = { -+ .len = sizeof(struct nf_conn_rtcache), -+ .align = __alignof__(struct nf_conn_rtcache), -+ .id = NF_CT_EXT_RTCACHE, -+ .destroy = nf_conn_rtcache_destroy, -+}; -+ -+static int __init nf_conntrack_rtcache_init(void) -+{ -+ int ret = nf_ct_extend_register(&rtcache_extend); -+ -+ if (ret < 0) { -+ pr_err("nf_conntrack_rtcache: Unable to register extension\n"); -+ return ret; -+ } -+ -+ ret = nf_register_hooks(rtcache_ops, ARRAY_SIZE(rtcache_ops)); -+ if (ret < 0) { -+ nf_ct_extend_unregister(&rtcache_extend); -+ return ret; -+ } -+ -+ ret = register_netdevice_notifier(&nf_rtcache_notifier); -+ if (ret) { -+ nf_unregister_hooks(rtcache_ops, ARRAY_SIZE(rtcache_ops)); -+ nf_ct_extend_unregister(&rtcache_extend); -+ } -+ -+ return ret; -+} -+ -+static int nf_rtcache_ext_remove(struct nf_conn *ct, void *data) -+{ -+ struct nf_conn_rtcache *rtc = nf_ct_rtcache_find(ct); -+ -+ return rtc != NULL; -+} -+ -+static bool __exit nf_conntrack_rtcache_wait_for_dying(struct net *net) -+{ -+ bool wait = false; -+ int cpu; -+ -+ for_each_possible_cpu(cpu) { -+ struct nf_conntrack_tuple_hash *h; -+ struct hlist_nulls_node *n; -+ struct nf_conn *ct; -+ struct ct_pcpu *pcpu = per_cpu_ptr(net->ct.pcpu_lists, cpu); -+ -+ rcu_read_lock(); -+ spin_lock_bh(&pcpu->lock); -+ -+ hlist_nulls_for_each_entry(h, n, &pcpu->dying, hnnode) { -+ ct = nf_ct_tuplehash_to_ctrack(h); -+ if (nf_ct_rtcache_find(ct) != NULL) { -+ wait = true; -+ break; -+ } -+ } -+ spin_unlock_bh(&pcpu->lock); -+ rcu_read_unlock(); -+ } -+ -+ return wait; -+} -+ -+static void __exit nf_conntrack_rtcache_fini(void) -+{ -+ struct net *net; -+ int count = 0; -+ -+ /* remove hooks so no new connections get rtcache extension */ -+ nf_unregister_hooks(rtcache_ops, ARRAY_SIZE(rtcache_ops)); -+ -+ synchronize_net(); -+ -+ unregister_netdevice_notifier(&nf_rtcache_notifier); -+ -+ rtnl_lock(); -+ -+ /* zap all conntracks with rtcache extension */ -+ for_each_net(net) -+ nf_ct_iterate_cleanup(net, nf_rtcache_ext_remove, NULL, 0, 0); -+ -+ for_each_net(net) { -+ /* .. and make sure they're gone from dying list, too */ -+ while (nf_conntrack_rtcache_wait_for_dying(net)) { -+ msleep(200); -+ WARN_ONCE(++count > 25, "Waiting for all rtcache conntracks to go away\n"); -+ } -+ } -+ -+ rtnl_unlock(); -+ synchronize_net(); -+ nf_ct_extend_unregister(&rtcache_extend); -+} -+module_init(nf_conntrack_rtcache_init); -+module_exit(nf_conntrack_rtcache_fini); -+ -+MODULE_LICENSE("GPL"); -+MODULE_AUTHOR("Florian Westphal "); -+MODULE_DESCRIPTION("Conntrack route cache extension"); diff --git a/target/linux/generic/pending-3.18/051-02-bridge-allow-setting-hash_max-multicast_router-if-in.patch b/target/linux/generic/pending-3.18/051-02-bridge-allow-setting-hash_max-multicast_router-if-in.patch deleted file mode 100644 index f7f88f8134..0000000000 --- a/target/linux/generic/pending-3.18/051-02-bridge-allow-setting-hash_max-multicast_router-if-in.patch +++ /dev/null @@ -1,99 +0,0 @@ -From 6ae4ae8e512bd229f806c22f8a2cd751e4f987c2 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Linus=20L=C3=BCssing?= -Date: Sat, 23 May 2015 03:12:34 +0200 -Subject: [PATCH] bridge: allow setting hash_max + multicast_router if - interface is down -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Network managers like netifd (used in OpenWRT for instance) try to -configure interface options after creation but before setting the -interface up. - -Unfortunately the sysfs / bridge currently only allows to configure the -hash_max and multicast_router options when the bridge interface is up. -But since br_multicast_init() doesn't start any timers and only sets -default values and initializes timers it should be save to reconfigure -the default values after that, before things actually get active after -the bridge is set up. - -Signed-off-by: Linus Lüssing -Signed-off-by: David S. Miller ---- - net/bridge/br_multicast.c | 24 +++--------------------- - 1 file changed, 3 insertions(+), 21 deletions(-) - ---- a/net/bridge/br_multicast.c -+++ b/net/bridge/br_multicast.c -@@ -1948,11 +1948,9 @@ out: - - int br_multicast_set_router(struct net_bridge *br, unsigned long val) - { -- int err = -ENOENT; -+ int err = -EINVAL; - - spin_lock_bh(&br->multicast_lock); -- if (!netif_running(br->dev)) -- goto unlock; - - switch (val) { - case 0: -@@ -1963,13 +1961,8 @@ int br_multicast_set_router(struct net_b - br->multicast_router = val; - err = 0; - break; -- -- default: -- err = -EINVAL; -- break; - } - --unlock: - spin_unlock_bh(&br->multicast_lock); - - return err; -@@ -1978,11 +1971,9 @@ unlock: - int br_multicast_set_port_router(struct net_bridge_port *p, unsigned long val) - { - struct net_bridge *br = p->br; -- int err = -ENOENT; -+ int err = -EINVAL; - - spin_lock(&br->multicast_lock); -- if (!netif_running(br->dev) || p->state == BR_STATE_DISABLED) -- goto unlock; - - switch (val) { - case 0: -@@ -2004,13 +1995,8 @@ int br_multicast_set_port_router(struct - - br_multicast_add_router(br, p); - break; -- -- default: -- err = -EINVAL; -- break; - } - --unlock: - spin_unlock(&br->multicast_lock); - - return err; -@@ -2115,15 +2101,11 @@ unlock: - - int br_multicast_set_hash_max(struct net_bridge *br, unsigned long val) - { -- int err = -ENOENT; -+ int err = -EINVAL; - u32 old; - struct net_bridge_mdb_htable *mdb; - - spin_lock_bh(&br->multicast_lock); -- if (!netif_running(br->dev)) -- goto unlock; -- -- err = -EINVAL; - if (!is_power_of_2(val)) - goto unlock; - diff --git a/target/linux/generic/pending-3.18/060-mips_decompressor_memmove.patch b/target/linux/generic/pending-3.18/060-mips_decompressor_memmove.patch deleted file mode 100644 index d215b80ab2..0000000000 --- a/target/linux/generic/pending-3.18/060-mips_decompressor_memmove.patch +++ /dev/null @@ -1,22 +0,0 @@ ---- a/arch/mips/boot/compressed/string.c -+++ b/arch/mips/boot/compressed/string.c -@@ -26,3 +26,19 @@ void *memset(void *s, int c, size_t n) - ss[i] = c; - return s; - } -+ -+void *memmove(void *__dest, __const void *__src, size_t count) -+{ -+ unsigned char *d = __dest; -+ const unsigned char *s = __src; -+ -+ if (__dest == __src) -+ return __dest; -+ -+ if (__dest < __src) -+ return memcpy(__dest, __src, count); -+ -+ while (count--) -+ d[count] = s[count]; -+ return __dest; -+} diff --git a/target/linux/generic/pending-3.18/070-bgmac-register-napi-before-the-device.patch b/target/linux/generic/pending-3.18/070-bgmac-register-napi-before-the-device.patch deleted file mode 100644 index 0e7e4f8b12..0000000000 --- a/target/linux/generic/pending-3.18/070-bgmac-register-napi-before-the-device.patch +++ /dev/null @@ -1,44 +0,0 @@ -From 6216642f200258708e47170ff14ba8ecb486f4f0 Mon Sep 17 00:00:00 2001 -From: Hauke Mehrtens -Date: Sun, 18 Jan 2015 19:49:58 +0100 -Subject: [PATCH] bgmac: register napi before the device - -napi should get registered before the netdev and not after. - -Signed-off-by: Hauke Mehrtens -Signed-off-by: David S. Miller ---- - drivers/net/ethernet/broadcom/bgmac.c | 6 +++--- - 1 file changed, 3 insertions(+), 3 deletions(-) - ---- a/drivers/net/ethernet/broadcom/bgmac.c -+++ b/drivers/net/ethernet/broadcom/bgmac.c -@@ -1521,6 +1521,8 @@ static int bgmac_probe(struct bcma_devic - if (core->bus->sprom.boardflags_lo & BGMAC_BFL_ENETADM) - bgmac_warn(bgmac, "Support for ADMtek ethernet switch not implemented\n"); - -+ netif_napi_add(net_dev, &bgmac->napi, bgmac_poll, BGMAC_WEIGHT); -+ - err = bgmac_mii_register(bgmac); - if (err) { - bgmac_err(bgmac, "Cannot register MDIO\n"); -@@ -1535,8 +1537,6 @@ static int bgmac_probe(struct bcma_devic - - netif_carrier_off(net_dev); - -- netif_napi_add(net_dev, &bgmac->napi, bgmac_poll, BGMAC_WEIGHT); -- - return 0; - - err_mii_unregister: -@@ -1555,9 +1555,9 @@ static void bgmac_remove(struct bcma_dev - { - struct bgmac *bgmac = bcma_get_drvdata(core); - -- netif_napi_del(&bgmac->napi); - unregister_netdev(bgmac->net_dev); - bgmac_mii_unregister(bgmac); -+ netif_napi_del(&bgmac->napi); - bgmac_dma_free(bgmac); - bcma_set_drvdata(core, NULL); - free_netdev(bgmac->net_dev); diff --git a/target/linux/generic/pending-3.18/071-bgmac-activate-irqs-only-if-there-is-nothing-to-poll.patch b/target/linux/generic/pending-3.18/071-bgmac-activate-irqs-only-if-there-is-nothing-to-poll.patch deleted file mode 100644 index cc43d367cc..0000000000 --- a/target/linux/generic/pending-3.18/071-bgmac-activate-irqs-only-if-there-is-nothing-to-poll.patch +++ /dev/null @@ -1,30 +0,0 @@ -From 43f159c60a99318b1ef7d1d7c16c4dfdd06bfd90 Mon Sep 17 00:00:00 2001 -From: Hauke Mehrtens -Date: Sun, 18 Jan 2015 19:49:59 +0100 -Subject: [PATCH] bgmac: activate irqs only if there is nothing to poll - -IRQs should only get activated when there is nothing to poll in the -queue any more and to after every poll. - -Signed-off-by: Hauke Mehrtens -Signed-off-by: David S. Miller ---- - drivers/net/ethernet/broadcom/bgmac.c | 6 +++--- - 1 file changed, 3 insertions(+), 3 deletions(-) - ---- a/drivers/net/ethernet/broadcom/bgmac.c -+++ b/drivers/net/ethernet/broadcom/bgmac.c -@@ -1167,10 +1167,10 @@ static int bgmac_poll(struct napi_struct - bgmac->int_status = 0; - } - -- if (handled < weight) -+ if (handled < weight) { - napi_complete(napi); -- -- bgmac_chip_intrs_on(bgmac); -+ bgmac_chip_intrs_on(bgmac); -+ } - - return handled; - } diff --git a/target/linux/generic/pending-3.18/073-bgmac-Clean-warning-messages.patch b/target/linux/generic/pending-3.18/073-bgmac-Clean-warning-messages.patch deleted file mode 100644 index 17fe5dff5e..0000000000 --- a/target/linux/generic/pending-3.18/073-bgmac-Clean-warning-messages.patch +++ /dev/null @@ -1,50 +0,0 @@ -From 8edfe3b6fad28da191c8fa15e4e0d8f7335a0091 Mon Sep 17 00:00:00 2001 -From: Peter Senna Tschudin -Date: Sat, 7 Mar 2015 12:10:26 +0100 -Subject: [PATCH] bgmac: Clean warning messages -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -On my test environment the throughput of a file transfer drops -from 4.4MBps to 116KBps due the number of repeated warning -messages. This patch removes the warning messages as DMA works -correctly with addresses using 0xC0000000 bits. - -Signed-off-by: Peter Senna Tschudin -Acked-by: Rafał Miłecki -Signed-off-by: David S. Miller ---- - drivers/net/ethernet/broadcom/bgmac.c | 7 ------- - 1 file changed, 7 deletions(-) - ---- a/drivers/net/ethernet/broadcom/bgmac.c -+++ b/drivers/net/ethernet/broadcom/bgmac.c -@@ -302,9 +302,6 @@ static int bgmac_dma_rx_skb_for_slot(str - slot->skb = skb; - slot->dma_addr = dma_addr; - -- if (slot->dma_addr & 0xC0000000) -- bgmac_warn(bgmac, "DMA address using 0xC0000000 bit(s), it may need translation trick\n"); -- - return 0; - } - -@@ -505,8 +502,6 @@ static int bgmac_dma_alloc(struct bgmac - ring->mmio_base); - goto err_dma_free; - } -- if (ring->dma_base & 0xC0000000) -- bgmac_warn(bgmac, "DMA address using 0xC0000000 bit(s), it may need translation trick\n"); - - ring->unaligned = bgmac_dma_unaligned(bgmac, ring, - BGMAC_DMA_RING_TX); -@@ -536,8 +531,6 @@ static int bgmac_dma_alloc(struct bgmac - err = -ENOMEM; - goto err_dma_free; - } -- if (ring->dma_base & 0xC0000000) -- bgmac_warn(bgmac, "DMA address using 0xC0000000 bit(s), it may need translation trick\n"); - - ring->unaligned = bgmac_dma_unaligned(bgmac, ring, - BGMAC_DMA_RING_RX); diff --git a/target/linux/generic/pending-3.18/074-bgmac-register-fixed-PHY-for-ARM-BCM470X-BCM5301X-ch.patch b/target/linux/generic/pending-3.18/074-bgmac-register-fixed-PHY-for-ARM-BCM470X-BCM5301X-ch.patch deleted file mode 100644 index 9f0baff0ee..0000000000 --- a/target/linux/generic/pending-3.18/074-bgmac-register-fixed-PHY-for-ARM-BCM470X-BCM5301X-ch.patch +++ /dev/null @@ -1,76 +0,0 @@ -From c25b23b8a387e7d31f7a74af8e37b61e9e6ebb21 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= -Date: Fri, 20 Mar 2015 23:14:31 +0100 -Subject: [PATCH] bgmac: register fixed PHY for ARM BCM470X / BCM5301X chipsets -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -On ARM SoCs with bgmac Ethernet hardware we don't have any normal PHY. -There is always a switch attached but it's not even controlled over MDIO -like in case of MIPS devices. -We need a fixed PHY to be able to send/receive packets from the switch. - -Signed-off-by: Rafał Miłecki -Signed-off-by: David S. Miller ---- - drivers/net/ethernet/broadcom/bgmac.c | 34 ++++++++++++++++++++++++++++++++++ - 1 file changed, 34 insertions(+) - ---- a/drivers/net/ethernet/broadcom/bgmac.c -+++ b/drivers/net/ethernet/broadcom/bgmac.c -@@ -14,6 +14,7 @@ - #include - #include - #include -+#include - #include - #include - #include -@@ -1330,13 +1331,46 @@ static void bgmac_adjust_link(struct net - } - } - -+static int bgmac_fixed_phy_register(struct bgmac *bgmac) -+{ -+ struct fixed_phy_status fphy_status = { -+ .link = 1, -+ .speed = SPEED_1000, -+ .duplex = DUPLEX_FULL, -+ }; -+ struct phy_device *phy_dev; -+ int err; -+ -+ phy_dev = fixed_phy_register(PHY_POLL, &fphy_status, NULL); -+ if (!phy_dev || IS_ERR(phy_dev)) { -+ bgmac_err(bgmac, "Failed to register fixed PHY device\n"); -+ return -ENODEV; -+ } -+ -+ err = phy_connect_direct(bgmac->net_dev, phy_dev, bgmac_adjust_link, -+ PHY_INTERFACE_MODE_MII); -+ if (err) { -+ bgmac_err(bgmac, "Connecting PHY failed\n"); -+ return err; -+ } -+ -+ bgmac->phy_dev = phy_dev; -+ -+ return err; -+} -+ - static int bgmac_mii_register(struct bgmac *bgmac) - { -+ struct bcma_chipinfo *ci = &bgmac->core->bus->chipinfo; - struct mii_bus *mii_bus; - struct phy_device *phy_dev; - char bus_id[MII_BUS_ID_SIZE + 3]; - int i, err = 0; - -+ if (ci->id == BCMA_CHIP_ID_BCM4707 || -+ ci->id == BCMA_CHIP_ID_BCM53018) -+ return bgmac_fixed_phy_register(bgmac); -+ - mii_bus = mdiobus_alloc(); - if (!mii_bus) - return -ENOMEM; diff --git a/target/linux/generic/pending-3.18/075-bgmac-allow-enabling-on-ARCH_BCM_5301X.patch b/target/linux/generic/pending-3.18/075-bgmac-allow-enabling-on-ARCH_BCM_5301X.patch deleted file mode 100644 index 4513667e3a..0000000000 --- a/target/linux/generic/pending-3.18/075-bgmac-allow-enabling-on-ARCH_BCM_5301X.patch +++ /dev/null @@ -1,28 +0,0 @@ -From fc300dc3733fdc328e6e10c7b8379b60c26cd648 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= -Date: Fri, 20 Mar 2015 23:14:32 +0100 -Subject: [PATCH] bgmac: allow enabling on ARCH_BCM_5301X -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Home routers based on ARM SoCs like BCM4708 also have bcma bus with core -supported by bgmac. - -Signed-off-by: Rafał Miłecki -Signed-off-by: David S. Miller ---- - drivers/net/ethernet/broadcom/Kconfig | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - ---- a/drivers/net/ethernet/broadcom/Kconfig -+++ b/drivers/net/ethernet/broadcom/Kconfig -@@ -143,7 +143,7 @@ config BNX2X_SRIOV - - config BGMAC - tristate "BCMA bus GBit core support" -- depends on BCMA_HOST_SOC && HAS_DMA && BCM47XX -+ depends on BCMA_HOST_SOC && HAS_DMA && (BCM47XX || ARCH_BCM_5301X) - select PHYLIB - ---help--- - This driver supports GBit MAC and BCM4706 GBit MAC cores on BCMA bus. diff --git a/target/linux/generic/pending-3.18/076-net-phy-export-fixed_phy_register.patch b/target/linux/generic/pending-3.18/076-net-phy-export-fixed_phy_register.patch deleted file mode 100644 index 939016c2e8..0000000000 --- a/target/linux/generic/pending-3.18/076-net-phy-export-fixed_phy_register.patch +++ /dev/null @@ -1,30 +0,0 @@ -From 37e9a6904520b525b542ecd67201164d06fdb95a Mon Sep 17 00:00:00 2001 -From: Mark Salter -Date: Thu, 11 Dec 2014 23:03:26 -0500 -Subject: [PATCH] net: phy: export fixed_phy_register() - -When building the bcmgenet driver as module, I get: - -ERROR: "fixed_phy_register" [drivers/net/ethernet/broadcom/genet/genet.ko] undefined! - -commit b0ba512e225d72 ("net: bcmgenet: enable driver to work without device -tree") which added a call to fixed_phy_register. But fixed_phy_register -needs to be exported if used from a module. - -Signed-off-by: Mark Salter -Acked-by: Florian Fainelli -Signed-off-by: David S. Miller ---- - drivers/net/phy/fixed.c | 1 + - 1 file changed, 1 insertion(+) - ---- a/drivers/net/phy/fixed.c -+++ b/drivers/net/phy/fixed.c -@@ -274,6 +274,7 @@ struct phy_device *fixed_phy_register(un - - return phy; - } -+EXPORT_SYMBOL_GPL(fixed_phy_register); - - static int __init fixed_mdio_bus_init(void) - { diff --git a/target/linux/generic/pending-3.18/077-01-bgmac-fix-descriptor-frame-start-end-definitions.patch b/target/linux/generic/pending-3.18/077-01-bgmac-fix-descriptor-frame-start-end-definitions.patch deleted file mode 100644 index fe8a602160..0000000000 --- a/target/linux/generic/pending-3.18/077-01-bgmac-fix-descriptor-frame-start-end-definitions.patch +++ /dev/null @@ -1,24 +0,0 @@ -From: Felix Fietkau -Date: Mon, 23 Mar 2015 02:40:06 +0100 -Subject: [PATCH] bgmac: fix descriptor frame start/end definitions - -The start-of-frame and end-of-frame bits were accidentally swapped. -In the current code it does not make any difference, since they are -always used together. - -Signed-off-by: Felix Fietkau ---- - ---- a/drivers/net/ethernet/broadcom/bgmac.h -+++ b/drivers/net/ethernet/broadcom/bgmac.h -@@ -345,8 +345,8 @@ - - #define BGMAC_DESC_CTL0_EOT 0x10000000 /* End of ring */ - #define BGMAC_DESC_CTL0_IOC 0x20000000 /* IRQ on complete */ --#define BGMAC_DESC_CTL0_SOF 0x40000000 /* Start of frame */ --#define BGMAC_DESC_CTL0_EOF 0x80000000 /* End of frame */ -+#define BGMAC_DESC_CTL0_EOF 0x40000000 /* End of frame */ -+#define BGMAC_DESC_CTL0_SOF 0x80000000 /* Start of frame */ - #define BGMAC_DESC_CTL1_LEN 0x00001FFF - - #define BGMAC_PHY_NOREGS 0x1E diff --git a/target/linux/generic/pending-3.18/077-02-bgmac-implement-GRO-and-use-build_skb.patch b/target/linux/generic/pending-3.18/077-02-bgmac-implement-GRO-and-use-build_skb.patch deleted file mode 100644 index 8dc5242b5a..0000000000 --- a/target/linux/generic/pending-3.18/077-02-bgmac-implement-GRO-and-use-build_skb.patch +++ /dev/null @@ -1,189 +0,0 @@ -From: Felix Fietkau -Date: Mon, 23 Mar 2015 02:41:25 +0100 -Subject: [PATCH] bgmac: implement GRO and use build_skb - -This improves performance for routing and local rx - -Signed-off-by: Felix Fietkau ---- - ---- a/drivers/net/ethernet/broadcom/bgmac.c -+++ b/drivers/net/ethernet/broadcom/bgmac.c -@@ -276,31 +276,31 @@ static int bgmac_dma_rx_skb_for_slot(str - struct bgmac_slot_info *slot) - { - struct device *dma_dev = bgmac->core->dma_dev; -- struct sk_buff *skb; - dma_addr_t dma_addr; - struct bgmac_rx_header *rx; -+ void *buf; - - /* Alloc skb */ -- skb = netdev_alloc_skb(bgmac->net_dev, BGMAC_RX_BUF_SIZE); -- if (!skb) -+ buf = netdev_alloc_frag(BGMAC_RX_ALLOC_SIZE); -+ if (!buf) - return -ENOMEM; - - /* Poison - if everything goes fine, hardware will overwrite it */ -- rx = (struct bgmac_rx_header *)skb->data; -+ rx = buf; - rx->len = cpu_to_le16(0xdead); - rx->flags = cpu_to_le16(0xbeef); - - /* Map skb for the DMA */ -- dma_addr = dma_map_single(dma_dev, skb->data, -- BGMAC_RX_BUF_SIZE, DMA_FROM_DEVICE); -+ dma_addr = dma_map_single(dma_dev, buf, BGMAC_RX_BUF_SIZE, -+ DMA_FROM_DEVICE); - if (dma_mapping_error(dma_dev, dma_addr)) { - bgmac_err(bgmac, "DMA mapping error\n"); -- dev_kfree_skb(skb); -+ put_page(virt_to_head_page(buf)); - return -ENOMEM; - } - - /* Update the slot */ -- slot->skb = skb; -+ slot->buf = buf; - slot->dma_addr = dma_addr; - - return 0; -@@ -343,8 +343,9 @@ static int bgmac_dma_rx_read(struct bgma - while (ring->start != ring->end) { - struct device *dma_dev = bgmac->core->dma_dev; - struct bgmac_slot_info *slot = &ring->slots[ring->start]; -- struct sk_buff *skb = slot->skb; -- struct bgmac_rx_header *rx; -+ struct bgmac_rx_header *rx = slot->buf; -+ struct sk_buff *skb; -+ void *buf = slot->buf; - u16 len, flags; - - /* Unmap buffer to make it accessible to the CPU */ -@@ -352,7 +353,6 @@ static int bgmac_dma_rx_read(struct bgma - BGMAC_RX_BUF_SIZE, DMA_FROM_DEVICE); - - /* Get info from the header */ -- rx = (struct bgmac_rx_header *)skb->data; - len = le16_to_cpu(rx->len); - flags = le16_to_cpu(rx->flags); - -@@ -393,12 +393,13 @@ static int bgmac_dma_rx_read(struct bgma - dma_unmap_single(dma_dev, old_dma_addr, - BGMAC_RX_BUF_SIZE, DMA_FROM_DEVICE); - -+ skb = build_skb(buf, BGMAC_RX_ALLOC_SIZE); - skb_put(skb, BGMAC_RX_FRAME_OFFSET + len); - skb_pull(skb, BGMAC_RX_FRAME_OFFSET); - - skb_checksum_none_assert(skb); - skb->protocol = eth_type_trans(skb, bgmac->net_dev); -- netif_receive_skb(skb); -+ napi_gro_receive(&bgmac->napi, skb); - handled++; - } while (0); - -@@ -434,12 +435,11 @@ static bool bgmac_dma_unaligned(struct b - return false; - } - --static void bgmac_dma_ring_free(struct bgmac *bgmac, -- struct bgmac_dma_ring *ring) -+static void bgmac_dma_tx_ring_free(struct bgmac *bgmac, -+ struct bgmac_dma_ring *ring) - { - struct device *dma_dev = bgmac->core->dma_dev; - struct bgmac_slot_info *slot; -- int size; - int i; - - for (i = 0; i < ring->num_slots; i++) { -@@ -451,23 +451,55 @@ static void bgmac_dma_ring_free(struct b - dev_kfree_skb(slot->skb); - } - } -+} -+ -+static void bgmac_dma_rx_ring_free(struct bgmac *bgmac, -+ struct bgmac_dma_ring *ring) -+{ -+ struct device *dma_dev = bgmac->core->dma_dev; -+ struct bgmac_slot_info *slot; -+ int i; -+ -+ for (i = 0; i < ring->num_slots; i++) { -+ slot = &ring->slots[i]; -+ if (!slot->buf) -+ continue; - -- if (ring->cpu_base) { -- /* Free ring of descriptors */ -- size = ring->num_slots * sizeof(struct bgmac_dma_desc); -- dma_free_coherent(dma_dev, size, ring->cpu_base, -- ring->dma_base); -+ if (slot->dma_addr) -+ dma_unmap_single(dma_dev, slot->dma_addr, -+ BGMAC_RX_BUF_SIZE, -+ DMA_FROM_DEVICE); -+ put_page(virt_to_head_page(slot->buf)); - } - } - -+static void bgmac_dma_ring_desc_free(struct bgmac *bgmac, -+ struct bgmac_dma_ring *ring) -+{ -+ struct device *dma_dev = bgmac->core->dma_dev; -+ int size; -+ -+ if (!ring->cpu_base) -+ return; -+ -+ /* Free ring of descriptors */ -+ size = ring->num_slots * sizeof(struct bgmac_dma_desc); -+ dma_free_coherent(dma_dev, size, ring->cpu_base, -+ ring->dma_base); -+} -+ - static void bgmac_dma_free(struct bgmac *bgmac) - { - int i; - -- for (i = 0; i < BGMAC_MAX_TX_RINGS; i++) -- bgmac_dma_ring_free(bgmac, &bgmac->tx_ring[i]); -- for (i = 0; i < BGMAC_MAX_RX_RINGS; i++) -- bgmac_dma_ring_free(bgmac, &bgmac->rx_ring[i]); -+ for (i = 0; i < BGMAC_MAX_TX_RINGS; i++) { -+ bgmac_dma_tx_ring_free(bgmac, &bgmac->tx_ring[i]); -+ bgmac_dma_ring_desc_free(bgmac, &bgmac->tx_ring[i]); -+ } -+ for (i = 0; i < BGMAC_MAX_RX_RINGS; i++) { -+ bgmac_dma_rx_ring_free(bgmac, &bgmac->rx_ring[i]); -+ bgmac_dma_ring_desc_free(bgmac, &bgmac->rx_ring[i]); -+ } - } - - static int bgmac_dma_alloc(struct bgmac *bgmac) ---- a/drivers/net/ethernet/broadcom/bgmac.h -+++ b/drivers/net/ethernet/broadcom/bgmac.h -@@ -362,6 +362,8 @@ - #define BGMAC_RX_FRAME_OFFSET 30 /* There are 2 unused bytes between header and real data */ - #define BGMAC_RX_MAX_FRAME_SIZE 1536 /* Copied from b44/tg3 */ - #define BGMAC_RX_BUF_SIZE (BGMAC_RX_FRAME_OFFSET + BGMAC_RX_MAX_FRAME_SIZE) -+#define BGMAC_RX_ALLOC_SIZE (SKB_DATA_ALIGN(BGMAC_RX_BUF_SIZE) + \ -+ SKB_DATA_ALIGN(sizeof(struct skb_shared_info))) - - #define BGMAC_BFL_ENETROBO 0x0010 /* has ephy roboswitch spi */ - #define BGMAC_BFL_ENETADM 0x0080 /* has ADMtek switch */ -@@ -383,7 +385,10 @@ - #define ETHER_MAX_LEN 1518 - - struct bgmac_slot_info { -- struct sk_buff *skb; -+ union { -+ struct sk_buff *skb; -+ void *buf; -+ }; - dma_addr_t dma_addr; - }; - diff --git a/target/linux/generic/pending-3.18/077-03-bgmac-implement-scatter-gather-support.patch b/target/linux/generic/pending-3.18/077-03-bgmac-implement-scatter-gather-support.patch deleted file mode 100644 index 642dd2ad73..0000000000 --- a/target/linux/generic/pending-3.18/077-03-bgmac-implement-scatter-gather-support.patch +++ /dev/null @@ -1,267 +0,0 @@ -From: Felix Fietkau -Date: Mon, 23 Mar 2015 02:42:26 +0100 -Subject: [PATCH] bgmac: implement scatter/gather support - -Always use software checksumming, since the hardware does not have any -checksum offload support. -This significantly improves local TCP tx performance. - -Signed-off-by: Felix Fietkau ---- - ---- a/drivers/net/ethernet/broadcom/bgmac.c -+++ b/drivers/net/ethernet/broadcom/bgmac.c -@@ -115,53 +115,91 @@ static void bgmac_dma_tx_enable(struct b - bgmac_write(bgmac, ring->mmio_base + BGMAC_DMA_TX_CTL, ctl); - } - -+static void -+bgmac_dma_tx_add_buf(struct bgmac *bgmac, struct bgmac_dma_ring *ring, -+ int i, int len, u32 ctl0) -+{ -+ struct bgmac_slot_info *slot; -+ struct bgmac_dma_desc *dma_desc; -+ u32 ctl1; -+ -+ if (i == ring->num_slots - 1) -+ ctl0 |= BGMAC_DESC_CTL0_EOT; -+ -+ ctl1 = len & BGMAC_DESC_CTL1_LEN; -+ -+ slot = &ring->slots[i]; -+ dma_desc = &ring->cpu_base[i]; -+ dma_desc->addr_low = cpu_to_le32(lower_32_bits(slot->dma_addr)); -+ dma_desc->addr_high = cpu_to_le32(upper_32_bits(slot->dma_addr)); -+ dma_desc->ctl0 = cpu_to_le32(ctl0); -+ dma_desc->ctl1 = cpu_to_le32(ctl1); -+} -+ - static netdev_tx_t bgmac_dma_tx_add(struct bgmac *bgmac, - struct bgmac_dma_ring *ring, - struct sk_buff *skb) - { - struct device *dma_dev = bgmac->core->dma_dev; - struct net_device *net_dev = bgmac->net_dev; -- struct bgmac_dma_desc *dma_desc; -- struct bgmac_slot_info *slot; -- u32 ctl0, ctl1; -+ struct bgmac_slot_info *slot = &ring->slots[ring->end]; - int free_slots; -+ int nr_frags; -+ u32 flags; -+ int index = ring->end; -+ int i; - - if (skb->len > BGMAC_DESC_CTL1_LEN) { - bgmac_err(bgmac, "Too long skb (%d)\n", skb->len); -- goto err_stop_drop; -+ goto err_drop; - } - -+ if (skb->ip_summed == CHECKSUM_PARTIAL) -+ skb_checksum_help(skb); -+ -+ nr_frags = skb_shinfo(skb)->nr_frags; -+ - if (ring->start <= ring->end) - free_slots = ring->start - ring->end + BGMAC_TX_RING_SLOTS; - else - free_slots = ring->start - ring->end; -- if (free_slots == 1) { -+ -+ if (free_slots <= nr_frags + 1) { - bgmac_err(bgmac, "TX ring is full, queue should be stopped!\n"); - netif_stop_queue(net_dev); - return NETDEV_TX_BUSY; - } - -- slot = &ring->slots[ring->end]; -- slot->skb = skb; -- slot->dma_addr = dma_map_single(dma_dev, skb->data, skb->len, -+ slot->dma_addr = dma_map_single(dma_dev, skb->data, skb_headlen(skb), - DMA_TO_DEVICE); -- if (dma_mapping_error(dma_dev, slot->dma_addr)) { -- bgmac_err(bgmac, "Mapping error of skb on ring 0x%X\n", -- ring->mmio_base); -- goto err_stop_drop; -- } -+ if (unlikely(dma_mapping_error(dma_dev, slot->dma_addr))) -+ goto err_dma_head; - -- ctl0 = BGMAC_DESC_CTL0_IOC | BGMAC_DESC_CTL0_SOF | BGMAC_DESC_CTL0_EOF; -- if (ring->end == ring->num_slots - 1) -- ctl0 |= BGMAC_DESC_CTL0_EOT; -- ctl1 = skb->len & BGMAC_DESC_CTL1_LEN; -+ flags = BGMAC_DESC_CTL0_SOF; -+ if (!nr_frags) -+ flags |= BGMAC_DESC_CTL0_EOF | BGMAC_DESC_CTL0_IOC; -+ -+ bgmac_dma_tx_add_buf(bgmac, ring, index, skb_headlen(skb), flags); -+ flags = 0; -+ -+ for (i = 0; i < nr_frags; i++) { -+ struct skb_frag_struct *frag = &skb_shinfo(skb)->frags[i]; -+ int len = skb_frag_size(frag); -+ -+ index = (index + 1) % BGMAC_TX_RING_SLOTS; -+ slot = &ring->slots[index]; -+ slot->dma_addr = skb_frag_dma_map(dma_dev, frag, 0, -+ len, DMA_TO_DEVICE); -+ if (unlikely(dma_mapping_error(dma_dev, slot->dma_addr))) -+ goto err_dma; - -- dma_desc = ring->cpu_base; -- dma_desc += ring->end; -- dma_desc->addr_low = cpu_to_le32(lower_32_bits(slot->dma_addr)); -- dma_desc->addr_high = cpu_to_le32(upper_32_bits(slot->dma_addr)); -- dma_desc->ctl0 = cpu_to_le32(ctl0); -- dma_desc->ctl1 = cpu_to_le32(ctl1); -+ if (i == nr_frags - 1) -+ flags |= BGMAC_DESC_CTL0_EOF | BGMAC_DESC_CTL0_IOC; -+ -+ bgmac_dma_tx_add_buf(bgmac, ring, index, len, flags); -+ } -+ -+ slot->skb = skb; - - netdev_sent_queue(net_dev, skb->len); - -@@ -170,20 +208,35 @@ static netdev_tx_t bgmac_dma_tx_add(stru - /* Increase ring->end to point empty slot. We tell hardware the first - * slot it should *not* read. - */ -- if (++ring->end >= BGMAC_TX_RING_SLOTS) -- ring->end = 0; -+ ring->end = (index + 1) % BGMAC_TX_RING_SLOTS; - bgmac_write(bgmac, ring->mmio_base + BGMAC_DMA_TX_INDEX, - ring->index_base + - ring->end * sizeof(struct bgmac_dma_desc)); - -- /* Always keep one slot free to allow detecting bugged calls. */ -- if (--free_slots == 1) -+ free_slots -= nr_frags + 1; -+ if (free_slots < 8) - netif_stop_queue(net_dev); - - return NETDEV_TX_OK; - --err_stop_drop: -- netif_stop_queue(net_dev); -+err_dma: -+ dma_unmap_single(dma_dev, slot->dma_addr, skb_headlen(skb), -+ DMA_TO_DEVICE); -+ -+ while (i > 0) { -+ int index = (ring->end + i) % BGMAC_TX_RING_SLOTS; -+ struct bgmac_slot_info *slot = &ring->slots[index]; -+ u32 ctl1 = le32_to_cpu(ring->cpu_base[index].ctl1); -+ int len = ctl1 & BGMAC_DESC_CTL1_LEN; -+ -+ dma_unmap_page(dma_dev, slot->dma_addr, len, DMA_TO_DEVICE); -+ } -+ -+err_dma_head: -+ bgmac_err(bgmac, "Mapping error of skb on ring 0x%X\n", -+ ring->mmio_base); -+ -+err_drop: - dev_kfree_skb(skb); - return NETDEV_TX_OK; - } -@@ -205,32 +258,45 @@ static void bgmac_dma_tx_free(struct bgm - - while (ring->start != empty_slot) { - struct bgmac_slot_info *slot = &ring->slots[ring->start]; -+ u32 ctl1 = le32_to_cpu(ring->cpu_base[ring->start].ctl1); -+ int len = ctl1 & BGMAC_DESC_CTL1_LEN; - -- if (slot->skb) { -+ if (!slot->dma_addr) { -+ bgmac_err(bgmac, "Hardware reported transmission for empty TX ring slot %d! End of ring: %d\n", -+ ring->start, ring->end); -+ goto next; -+ } -+ -+ if (ctl1 & BGMAC_DESC_CTL0_SOF) - /* Unmap no longer used buffer */ -- dma_unmap_single(dma_dev, slot->dma_addr, -- slot->skb->len, DMA_TO_DEVICE); -- slot->dma_addr = 0; -+ dma_unmap_single(dma_dev, slot->dma_addr, len, -+ DMA_TO_DEVICE); -+ else -+ dma_unmap_page(dma_dev, slot->dma_addr, len, -+ DMA_TO_DEVICE); - -+ if (slot->skb) { - bytes_compl += slot->skb->len; - pkts_compl++; - - /* Free memory! :) */ - dev_kfree_skb(slot->skb); - slot->skb = NULL; -- } else { -- bgmac_err(bgmac, "Hardware reported transmission for empty TX ring slot %d! End of ring: %d\n", -- ring->start, ring->end); - } - -+next: -+ slot->dma_addr = 0; - if (++ring->start >= BGMAC_TX_RING_SLOTS) - ring->start = 0; - freed = true; - } - -+ if (!pkts_compl) -+ return; -+ - netdev_completed_queue(bgmac->net_dev, pkts_compl, bytes_compl); - -- if (freed && netif_queue_stopped(bgmac->net_dev)) -+ if (netif_queue_stopped(bgmac->net_dev)) - netif_wake_queue(bgmac->net_dev); - } - -@@ -439,17 +505,25 @@ static void bgmac_dma_tx_ring_free(struc - struct bgmac_dma_ring *ring) - { - struct device *dma_dev = bgmac->core->dma_dev; -+ struct bgmac_dma_desc *dma_desc = ring->cpu_base; - struct bgmac_slot_info *slot; - int i; - - for (i = 0; i < ring->num_slots; i++) { -+ int len = dma_desc[i].ctl1 & BGMAC_DESC_CTL1_LEN; -+ - slot = &ring->slots[i]; -- if (slot->skb) { -- if (slot->dma_addr) -- dma_unmap_single(dma_dev, slot->dma_addr, -- slot->skb->len, DMA_TO_DEVICE); -- dev_kfree_skb(slot->skb); -- } -+ dev_kfree_skb(slot->skb); -+ -+ if (!slot->dma_addr) -+ continue; -+ -+ if (slot->skb) -+ dma_unmap_single(dma_dev, slot->dma_addr, -+ len, DMA_TO_DEVICE); -+ else -+ dma_unmap_page(dma_dev, slot->dma_addr, -+ len, DMA_TO_DEVICE); - } - } - -@@ -1588,6 +1662,10 @@ static int bgmac_probe(struct bcma_devic - goto err_dma_free; - } - -+ net_dev->features = NETIF_F_SG | NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM; -+ net_dev->hw_features = net_dev->features; -+ net_dev->vlan_features = net_dev->features; -+ - err = register_netdev(bgmac->net_dev); - if (err) { - bgmac_err(bgmac, "Cannot register net device\n"); diff --git a/target/linux/generic/pending-3.18/077-04-bgmac-simplify-tx-ring-index-handling.patch b/target/linux/generic/pending-3.18/077-04-bgmac-simplify-tx-ring-index-handling.patch deleted file mode 100644 index bf4a22dbea..0000000000 --- a/target/linux/generic/pending-3.18/077-04-bgmac-simplify-tx-ring-index-handling.patch +++ /dev/null @@ -1,125 +0,0 @@ -From: Felix Fietkau -Date: Sun, 12 Apr 2015 09:58:56 +0200 -Subject: [PATCH] bgmac: simplify tx ring index handling - -Keep incrementing ring->start and ring->end instead of pointing it to -the actual ring slot entry. This simplifies the calculation of the -number of free slots. - -Signed-off-by: Felix Fietkau ---- - ---- a/drivers/net/ethernet/broadcom/bgmac.c -+++ b/drivers/net/ethernet/broadcom/bgmac.c -@@ -142,11 +142,10 @@ static netdev_tx_t bgmac_dma_tx_add(stru - { - struct device *dma_dev = bgmac->core->dma_dev; - struct net_device *net_dev = bgmac->net_dev; -- struct bgmac_slot_info *slot = &ring->slots[ring->end]; -- int free_slots; -+ int index = ring->end % BGMAC_TX_RING_SLOTS; -+ struct bgmac_slot_info *slot = &ring->slots[index]; - int nr_frags; - u32 flags; -- int index = ring->end; - int i; - - if (skb->len > BGMAC_DESC_CTL1_LEN) { -@@ -159,12 +158,10 @@ static netdev_tx_t bgmac_dma_tx_add(stru - - nr_frags = skb_shinfo(skb)->nr_frags; - -- if (ring->start <= ring->end) -- free_slots = ring->start - ring->end + BGMAC_TX_RING_SLOTS; -- else -- free_slots = ring->start - ring->end; -- -- if (free_slots <= nr_frags + 1) { -+ /* ring->end - ring->start will return the number of valid slots, -+ * even when ring->end overflows -+ */ -+ if (ring->end - ring->start + nr_frags + 1 >= BGMAC_TX_RING_SLOTS) { - bgmac_err(bgmac, "TX ring is full, queue should be stopped!\n"); - netif_stop_queue(net_dev); - return NETDEV_TX_BUSY; -@@ -200,7 +197,7 @@ static netdev_tx_t bgmac_dma_tx_add(stru - } - - slot->skb = skb; -- -+ ring->end += nr_frags + 1; - netdev_sent_queue(net_dev, skb->len); - - wmb(); -@@ -208,13 +205,12 @@ static netdev_tx_t bgmac_dma_tx_add(stru - /* Increase ring->end to point empty slot. We tell hardware the first - * slot it should *not* read. - */ -- ring->end = (index + 1) % BGMAC_TX_RING_SLOTS; - bgmac_write(bgmac, ring->mmio_base + BGMAC_DMA_TX_INDEX, - ring->index_base + -- ring->end * sizeof(struct bgmac_dma_desc)); -+ (ring->end % BGMAC_TX_RING_SLOTS) * -+ sizeof(struct bgmac_dma_desc)); - -- free_slots -= nr_frags + 1; -- if (free_slots < 8) -+ if (ring->end - ring->start >= BGMAC_TX_RING_SLOTS - 8) - netif_stop_queue(net_dev); - - return NETDEV_TX_OK; -@@ -256,17 +252,17 @@ static void bgmac_dma_tx_free(struct bgm - empty_slot &= BGMAC_DMA_TX_STATDPTR; - empty_slot /= sizeof(struct bgmac_dma_desc); - -- while (ring->start != empty_slot) { -- struct bgmac_slot_info *slot = &ring->slots[ring->start]; -- u32 ctl1 = le32_to_cpu(ring->cpu_base[ring->start].ctl1); -- int len = ctl1 & BGMAC_DESC_CTL1_LEN; -+ while (ring->start != ring->end) { -+ int slot_idx = ring->start % BGMAC_TX_RING_SLOTS; -+ struct bgmac_slot_info *slot = &ring->slots[slot_idx]; -+ u32 ctl1; -+ int len; - -- if (!slot->dma_addr) { -- bgmac_err(bgmac, "Hardware reported transmission for empty TX ring slot %d! End of ring: %d\n", -- ring->start, ring->end); -- goto next; -- } -+ if (slot_idx == empty_slot) -+ break; - -+ ctl1 = le32_to_cpu(ring->cpu_base[slot_idx].ctl1); -+ len = ctl1 & BGMAC_DESC_CTL1_LEN; - if (ctl1 & BGMAC_DESC_CTL0_SOF) - /* Unmap no longer used buffer */ - dma_unmap_single(dma_dev, slot->dma_addr, len, -@@ -284,10 +280,8 @@ static void bgmac_dma_tx_free(struct bgm - slot->skb = NULL; - } - --next: - slot->dma_addr = 0; -- if (++ring->start >= BGMAC_TX_RING_SLOTS) -- ring->start = 0; -+ ring->start++; - freed = true; - } - ---- a/drivers/net/ethernet/broadcom/bgmac.h -+++ b/drivers/net/ethernet/broadcom/bgmac.h -@@ -414,10 +414,10 @@ enum bgmac_dma_ring_type { - * empty. - */ - struct bgmac_dma_ring { -- u16 num_slots; -- u16 start; -- u16 end; -+ u32 start; -+ u32 end; - -+ u16 num_slots; - u16 mmio_base; - struct bgmac_dma_desc *cpu_base; - dma_addr_t dma_base; diff --git a/target/linux/generic/pending-3.18/077-05-bgmac-leave-interrupts-disabled-as-long-as-there-is-.patch b/target/linux/generic/pending-3.18/077-05-bgmac-leave-interrupts-disabled-as-long-as-there-is-.patch deleted file mode 100644 index 4e5e2e720a..0000000000 --- a/target/linux/generic/pending-3.18/077-05-bgmac-leave-interrupts-disabled-as-long-as-there-is-.patch +++ /dev/null @@ -1,87 +0,0 @@ -From: Felix Fietkau -Date: Sun, 12 Apr 2015 10:08:04 +0200 -Subject: [PATCH] bgmac: leave interrupts disabled as long as there is work - to do - -Always poll rx and tx during NAPI poll instead of relying on the status -of the first interrupt. This prevents bgmac_poll from leaving unfinished -work around until the next IRQ. -In my tests this makes bridging/routing throughput under heavy load more -stable and ensures that no new IRQs arrive as long as bgmac_poll uses up -the entire budget. - -Signed-off-by: Felix Fietkau ---- - ---- a/drivers/net/ethernet/broadcom/bgmac.c -+++ b/drivers/net/ethernet/broadcom/bgmac.c -@@ -1109,8 +1109,6 @@ static void bgmac_chip_reset(struct bgma - bgmac_phy_init(bgmac); - - netdev_reset_queue(bgmac->net_dev); -- -- bgmac->int_status = 0; - } - - static void bgmac_chip_intrs_on(struct bgmac *bgmac) -@@ -1225,14 +1223,13 @@ static irqreturn_t bgmac_interrupt(int i - if (!int_status) - return IRQ_NONE; - -- /* Ack */ -- bgmac_write(bgmac, BGMAC_INT_STATUS, int_status); -+ int_status &= ~(BGMAC_IS_TX0 | BGMAC_IS_RX); -+ if (int_status) -+ bgmac_err(bgmac, "Unknown IRQs: 0x%08X\n", int_status); - - /* Disable new interrupts until handling existing ones */ - bgmac_chip_intrs_off(bgmac); - -- bgmac->int_status = int_status; -- - napi_schedule(&bgmac->napi); - - return IRQ_HANDLED; -@@ -1241,25 +1238,17 @@ static irqreturn_t bgmac_interrupt(int i - static int bgmac_poll(struct napi_struct *napi, int weight) - { - struct bgmac *bgmac = container_of(napi, struct bgmac, napi); -- struct bgmac_dma_ring *ring; - int handled = 0; - -- if (bgmac->int_status & BGMAC_IS_TX0) { -- ring = &bgmac->tx_ring[0]; -- bgmac_dma_tx_free(bgmac, ring); -- bgmac->int_status &= ~BGMAC_IS_TX0; -- } -+ /* Ack */ -+ bgmac_write(bgmac, BGMAC_INT_STATUS, ~0); - -- if (bgmac->int_status & BGMAC_IS_RX) { -- ring = &bgmac->rx_ring[0]; -- handled += bgmac_dma_rx_read(bgmac, ring, weight); -- bgmac->int_status &= ~BGMAC_IS_RX; -- } -+ bgmac_dma_tx_free(bgmac, &bgmac->tx_ring[0]); -+ handled += bgmac_dma_rx_read(bgmac, &bgmac->rx_ring[0], weight); - -- if (bgmac->int_status) { -- bgmac_err(bgmac, "Unknown IRQs: 0x%08X\n", bgmac->int_status); -- bgmac->int_status = 0; -- } -+ /* Poll again if more events arrived in the meantime */ -+ if (bgmac_read(bgmac, BGMAC_INT_STATUS) & (BGMAC_IS_TX0 | BGMAC_IS_RX)) -+ return handled; - - if (handled < weight) { - napi_complete(napi); ---- a/drivers/net/ethernet/broadcom/bgmac.h -+++ b/drivers/net/ethernet/broadcom/bgmac.h -@@ -452,7 +452,6 @@ struct bgmac { - - /* Int */ - u32 int_mask; -- u32 int_status; - - /* Current MAC state */ - int mac_speed; diff --git a/target/linux/generic/pending-3.18/077-06-bgmac-set-received-skb-headroom-to-NET_SKB_PAD.patch b/target/linux/generic/pending-3.18/077-06-bgmac-set-received-skb-headroom-to-NET_SKB_PAD.patch deleted file mode 100644 index 1b0742cd3a..0000000000 --- a/target/linux/generic/pending-3.18/077-06-bgmac-set-received-skb-headroom-to-NET_SKB_PAD.patch +++ /dev/null @@ -1,66 +0,0 @@ -From: Felix Fietkau -Date: Sun, 12 Apr 2015 10:13:28 +0200 -Subject: [PATCH] bgmac: set received skb headroom to NET_SKB_PAD - -A packet buffer offset of 30 bytes is inefficient, because the first 2 -bytes end up in a different cacheline. - -Signed-off-by: Felix Fietkau ---- - ---- a/drivers/net/ethernet/broadcom/bgmac.c -+++ b/drivers/net/ethernet/broadcom/bgmac.c -@@ -346,13 +346,13 @@ static int bgmac_dma_rx_skb_for_slot(str - return -ENOMEM; - - /* Poison - if everything goes fine, hardware will overwrite it */ -- rx = buf; -+ rx = buf + BGMAC_RX_BUF_OFFSET; - rx->len = cpu_to_le16(0xdead); - rx->flags = cpu_to_le16(0xbeef); - - /* Map skb for the DMA */ -- dma_addr = dma_map_single(dma_dev, buf, BGMAC_RX_BUF_SIZE, -- DMA_FROM_DEVICE); -+ dma_addr = dma_map_single(dma_dev, buf + BGMAC_RX_BUF_OFFSET, -+ BGMAC_RX_BUF_SIZE, DMA_FROM_DEVICE); - if (dma_mapping_error(dma_dev, dma_addr)) { - bgmac_err(bgmac, "DMA mapping error\n"); - put_page(virt_to_head_page(buf)); -@@ -403,7 +403,7 @@ static int bgmac_dma_rx_read(struct bgma - while (ring->start != ring->end) { - struct device *dma_dev = bgmac->core->dma_dev; - struct bgmac_slot_info *slot = &ring->slots[ring->start]; -- struct bgmac_rx_header *rx = slot->buf; -+ struct bgmac_rx_header *rx = slot->buf + BGMAC_RX_BUF_OFFSET; - struct sk_buff *skb; - void *buf = slot->buf; - u16 len, flags; -@@ -454,8 +454,10 @@ static int bgmac_dma_rx_read(struct bgma - BGMAC_RX_BUF_SIZE, DMA_FROM_DEVICE); - - skb = build_skb(buf, BGMAC_RX_ALLOC_SIZE); -- skb_put(skb, BGMAC_RX_FRAME_OFFSET + len); -- skb_pull(skb, BGMAC_RX_FRAME_OFFSET); -+ skb_put(skb, BGMAC_RX_FRAME_OFFSET + -+ BGMAC_RX_BUF_OFFSET + len); -+ skb_pull(skb, BGMAC_RX_FRAME_OFFSET + -+ BGMAC_RX_BUF_OFFSET); - - skb_checksum_none_assert(skb); - skb->protocol = eth_type_trans(skb, bgmac->net_dev); ---- a/drivers/net/ethernet/broadcom/bgmac.h -+++ b/drivers/net/ethernet/broadcom/bgmac.h -@@ -360,9 +360,11 @@ - - #define BGMAC_RX_HEADER_LEN 28 /* Last 24 bytes are unused. Well... */ - #define BGMAC_RX_FRAME_OFFSET 30 /* There are 2 unused bytes between header and real data */ -+#define BGMAC_RX_BUF_OFFSET (NET_SKB_PAD + NET_IP_ALIGN - \ -+ BGMAC_RX_FRAME_OFFSET) - #define BGMAC_RX_MAX_FRAME_SIZE 1536 /* Copied from b44/tg3 */ - #define BGMAC_RX_BUF_SIZE (BGMAC_RX_FRAME_OFFSET + BGMAC_RX_MAX_FRAME_SIZE) --#define BGMAC_RX_ALLOC_SIZE (SKB_DATA_ALIGN(BGMAC_RX_BUF_SIZE) + \ -+#define BGMAC_RX_ALLOC_SIZE (SKB_DATA_ALIGN(BGMAC_RX_BUF_SIZE + BGMAC_RX_BUF_OFFSET) + \ - SKB_DATA_ALIGN(sizeof(struct skb_shared_info))) - - #define BGMAC_BFL_ENETROBO 0x0010 /* has ephy roboswitch spi */ diff --git a/target/linux/generic/pending-3.18/077-07-bgmac-simplify-rx-DMA-error-handling.patch b/target/linux/generic/pending-3.18/077-07-bgmac-simplify-rx-DMA-error-handling.patch deleted file mode 100644 index 2be65b4544..0000000000 --- a/target/linux/generic/pending-3.18/077-07-bgmac-simplify-rx-DMA-error-handling.patch +++ /dev/null @@ -1,130 +0,0 @@ -From: Felix Fietkau -Date: Sun, 12 Apr 2015 22:23:07 +0200 -Subject: [PATCH] bgmac: simplify/optimize rx DMA error handling - -Allocate a new buffer before processing the completed one. If allocation -fails, reuse the old buffer. - -Signed-off-by: Felix Fietkau ---- - ---- a/drivers/net/ethernet/broadcom/bgmac.c -+++ b/drivers/net/ethernet/broadcom/bgmac.c -@@ -386,6 +386,19 @@ static void bgmac_dma_rx_setup_desc(stru - dma_desc->ctl1 = cpu_to_le32(ctl1); - } - -+static void bgmac_dma_rx_poison_buf(struct device *dma_dev, -+ struct bgmac_slot_info *slot) -+{ -+ struct bgmac_rx_header *rx = slot->buf + BGMAC_RX_BUF_OFFSET; -+ -+ dma_sync_single_for_cpu(dma_dev, slot->dma_addr, BGMAC_RX_BUF_SIZE, -+ DMA_FROM_DEVICE); -+ rx->len = cpu_to_le16(0xdead); -+ rx->flags = cpu_to_le16(0xbeef); -+ dma_sync_single_for_device(dma_dev, slot->dma_addr, BGMAC_RX_BUF_SIZE, -+ DMA_FROM_DEVICE); -+} -+ - static int bgmac_dma_rx_read(struct bgmac *bgmac, struct bgmac_dma_ring *ring, - int weight) - { -@@ -406,53 +419,35 @@ static int bgmac_dma_rx_read(struct bgma - struct bgmac_rx_header *rx = slot->buf + BGMAC_RX_BUF_OFFSET; - struct sk_buff *skb; - void *buf = slot->buf; -+ dma_addr_t dma_addr = slot->dma_addr; - u16 len, flags; - -- /* Unmap buffer to make it accessible to the CPU */ -- dma_sync_single_for_cpu(dma_dev, slot->dma_addr, -- BGMAC_RX_BUF_SIZE, DMA_FROM_DEVICE); -- -- /* Get info from the header */ -- len = le16_to_cpu(rx->len); -- flags = le16_to_cpu(rx->flags); -- - do { -- dma_addr_t old_dma_addr = slot->dma_addr; -- int err; -+ /* Prepare new skb as replacement */ -+ if (bgmac_dma_rx_skb_for_slot(bgmac, slot)) { -+ bgmac_dma_rx_poison_buf(dma_dev, slot); -+ break; -+ } -+ -+ /* Unmap buffer to make it accessible to the CPU */ -+ dma_unmap_single(dma_dev, dma_addr, -+ BGMAC_RX_BUF_SIZE, DMA_FROM_DEVICE); -+ -+ /* Get info from the header */ -+ len = le16_to_cpu(rx->len); -+ flags = le16_to_cpu(rx->flags); - - /* Check for poison and drop or pass the packet */ - if (len == 0xdead && flags == 0xbeef) { - bgmac_err(bgmac, "Found poisoned packet at slot %d, DMA issue!\n", - ring->start); -- dma_sync_single_for_device(dma_dev, -- slot->dma_addr, -- BGMAC_RX_BUF_SIZE, -- DMA_FROM_DEVICE); -+ put_page(virt_to_head_page(buf)); - break; - } - - /* Omit CRC. */ - len -= ETH_FCS_LEN; - -- /* Prepare new skb as replacement */ -- err = bgmac_dma_rx_skb_for_slot(bgmac, slot); -- if (err) { -- /* Poison the old skb */ -- rx->len = cpu_to_le16(0xdead); -- rx->flags = cpu_to_le16(0xbeef); -- -- dma_sync_single_for_device(dma_dev, -- slot->dma_addr, -- BGMAC_RX_BUF_SIZE, -- DMA_FROM_DEVICE); -- break; -- } -- bgmac_dma_rx_setup_desc(bgmac, ring, ring->start); -- -- /* Unmap old skb, we'll pass it to the netfif */ -- dma_unmap_single(dma_dev, old_dma_addr, -- BGMAC_RX_BUF_SIZE, DMA_FROM_DEVICE); -- - skb = build_skb(buf, BGMAC_RX_ALLOC_SIZE); - skb_put(skb, BGMAC_RX_FRAME_OFFSET + - BGMAC_RX_BUF_OFFSET + len); -@@ -465,6 +460,8 @@ static int bgmac_dma_rx_read(struct bgma - handled++; - } while (0); - -+ bgmac_dma_rx_setup_desc(bgmac, ring, ring->start); -+ - if (++ring->start >= BGMAC_RX_RING_SLOTS) - ring->start = 0; - -@@ -532,14 +529,14 @@ static void bgmac_dma_rx_ring_free(struc - - for (i = 0; i < ring->num_slots; i++) { - slot = &ring->slots[i]; -- if (!slot->buf) -+ if (!slot->dma_addr) - continue; - -- if (slot->dma_addr) -- dma_unmap_single(dma_dev, slot->dma_addr, -- BGMAC_RX_BUF_SIZE, -- DMA_FROM_DEVICE); -+ dma_unmap_single(dma_dev, slot->dma_addr, -+ BGMAC_RX_BUF_SIZE, -+ DMA_FROM_DEVICE); - put_page(virt_to_head_page(slot->buf)); -+ slot->dma_addr = 0; - } - } - diff --git a/target/linux/generic/pending-3.18/077-08-bgmac-add-check-for-oversized-packets.patch b/target/linux/generic/pending-3.18/077-08-bgmac-add-check-for-oversized-packets.patch deleted file mode 100644 index 6bb4747686..0000000000 --- a/target/linux/generic/pending-3.18/077-08-bgmac-add-check-for-oversized-packets.patch +++ /dev/null @@ -1,27 +0,0 @@ -From: Felix Fietkau -Date: Sun, 12 Apr 2015 22:28:20 +0200 -Subject: [PATCH] bgmac: add check for oversized packets - -In very rare cases, the MAC can catch an internal buffer that is bigger -than it's supposed to be. Instead of crashing the kernel, simply pass -the buffer back to the hardware - -Signed-off-by: Felix Fietkau ---- - ---- a/drivers/net/ethernet/broadcom/bgmac.c -+++ b/drivers/net/ethernet/broadcom/bgmac.c -@@ -445,6 +445,13 @@ static int bgmac_dma_rx_read(struct bgma - break; - } - -+ if (len > BGMAC_RX_ALLOC_SIZE) { -+ bgmac_err(bgmac, "Found oversized packet at slot %d, DMA issue!\n", -+ ring->start); -+ put_page(virt_to_head_page(buf)); -+ break; -+ } -+ - /* Omit CRC. */ - len -= ETH_FCS_LEN; - diff --git a/target/linux/generic/pending-3.18/077-09-bgmac-increase-rx-ring-size-from-511-to-512.patch b/target/linux/generic/pending-3.18/077-09-bgmac-increase-rx-ring-size-from-511-to-512.patch deleted file mode 100644 index 1fc4ed03f1..0000000000 --- a/target/linux/generic/pending-3.18/077-09-bgmac-increase-rx-ring-size-from-511-to-512.patch +++ /dev/null @@ -1,23 +0,0 @@ -From: Felix Fietkau -Date: Sun, 12 Apr 2015 22:36:16 +0200 -Subject: [PATCH] bgmac: increase rx ring size from 511 to 512 - -Limiting it to 511 looks like a failed attempt at leaving one descriptor -empty to allow the hardware to stop processing a buffer that has not -been prepared yet. However, this doesn't work because this affects the -total ring size as well - -Signed-off-by: Felix Fietkau ---- - ---- a/drivers/net/ethernet/broadcom/bgmac.h -+++ b/drivers/net/ethernet/broadcom/bgmac.h -@@ -356,7 +356,7 @@ - #define BGMAC_MAX_RX_RINGS 1 - - #define BGMAC_TX_RING_SLOTS 128 --#define BGMAC_RX_RING_SLOTS 512 - 1 /* Why -1? Well, Broadcom does that... */ -+#define BGMAC_RX_RING_SLOTS 512 - - #define BGMAC_RX_HEADER_LEN 28 /* Last 24 bytes are unused. Well... */ - #define BGMAC_RX_FRAME_OFFSET 30 /* There are 2 unused bytes between header and real data */ diff --git a/target/linux/generic/pending-3.18/077-10-bgmac-simplify-dma-init-cleanup.patch b/target/linux/generic/pending-3.18/077-10-bgmac-simplify-dma-init-cleanup.patch deleted file mode 100644 index a49bd5f5e7..0000000000 --- a/target/linux/generic/pending-3.18/077-10-bgmac-simplify-dma-init-cleanup.patch +++ /dev/null @@ -1,184 +0,0 @@ -From: Felix Fietkau -Date: Sun, 12 Apr 2015 23:19:32 +0200 -Subject: [PATCH] bgmac: simplify dma init/cleanup - -Instead of allocating buffers at device init time and initializing -descriptors at device open, do both at the same time (during open). -Free all buffers when closing the device. - -Signed-off-by: Felix Fietkau ---- - ---- a/drivers/net/ethernet/broadcom/bgmac.c -+++ b/drivers/net/ethernet/broadcom/bgmac.c -@@ -562,18 +562,26 @@ static void bgmac_dma_ring_desc_free(str - ring->dma_base); - } - --static void bgmac_dma_free(struct bgmac *bgmac) -+static void bgmac_dma_cleanup(struct bgmac *bgmac) - { - int i; - -- for (i = 0; i < BGMAC_MAX_TX_RINGS; i++) { -+ for (i = 0; i < BGMAC_MAX_TX_RINGS; i++) - bgmac_dma_tx_ring_free(bgmac, &bgmac->tx_ring[i]); -- bgmac_dma_ring_desc_free(bgmac, &bgmac->tx_ring[i]); -- } -- for (i = 0; i < BGMAC_MAX_RX_RINGS; i++) { -+ -+ for (i = 0; i < BGMAC_MAX_RX_RINGS; i++) - bgmac_dma_rx_ring_free(bgmac, &bgmac->rx_ring[i]); -+} -+ -+static void bgmac_dma_free(struct bgmac *bgmac) -+{ -+ int i; -+ -+ for (i = 0; i < BGMAC_MAX_TX_RINGS; i++) -+ bgmac_dma_ring_desc_free(bgmac, &bgmac->tx_ring[i]); -+ -+ for (i = 0; i < BGMAC_MAX_RX_RINGS; i++) - bgmac_dma_ring_desc_free(bgmac, &bgmac->rx_ring[i]); -- } - } - - static int bgmac_dma_alloc(struct bgmac *bgmac) -@@ -621,8 +629,6 @@ static int bgmac_dma_alloc(struct bgmac - } - - for (i = 0; i < BGMAC_MAX_RX_RINGS; i++) { -- int j; -- - ring = &bgmac->rx_ring[i]; - ring->num_slots = BGMAC_RX_RING_SLOTS; - ring->mmio_base = ring_base[i]; -@@ -645,15 +651,6 @@ static int bgmac_dma_alloc(struct bgmac - ring->index_base = lower_32_bits(ring->dma_base); - else - ring->index_base = 0; -- -- /* Alloc RX slots */ -- for (j = 0; j < ring->num_slots; j++) { -- err = bgmac_dma_rx_skb_for_slot(bgmac, &ring->slots[j]); -- if (err) { -- bgmac_err(bgmac, "Can't allocate skb for slot in RX ring\n"); -- goto err_dma_free; -- } -- } - } - - return 0; -@@ -663,10 +660,10 @@ err_dma_free: - return -ENOMEM; - } - --static void bgmac_dma_init(struct bgmac *bgmac) -+static int bgmac_dma_init(struct bgmac *bgmac) - { - struct bgmac_dma_ring *ring; -- int i; -+ int i, err; - - for (i = 0; i < BGMAC_MAX_TX_RINGS; i++) { - ring = &bgmac->tx_ring[i]; -@@ -698,8 +695,13 @@ static void bgmac_dma_init(struct bgmac - if (ring->unaligned) - bgmac_dma_rx_enable(bgmac, ring); - -- for (j = 0; j < ring->num_slots; j++) -+ for (j = 0; j < ring->num_slots; j++) { -+ err = bgmac_dma_rx_skb_for_slot(bgmac, &ring->slots[j]); -+ if (err) -+ goto error; -+ - bgmac_dma_rx_setup_desc(bgmac, ring, j); -+ } - - bgmac_write(bgmac, ring->mmio_base + BGMAC_DMA_RX_INDEX, - ring->index_base + -@@ -708,6 +710,12 @@ static void bgmac_dma_init(struct bgmac - ring->start = 0; - ring->end = 0; - } -+ -+ return 0; -+ -+error: -+ bgmac_dma_cleanup(bgmac); -+ return err; - } - - /************************************************** -@@ -1183,11 +1191,8 @@ static void bgmac_enable(struct bgmac *b - } - - /* http://bcm-v4.sipsolutions.net/mac-gbit/gmac/chipinit */ --static void bgmac_chip_init(struct bgmac *bgmac, bool full_init) -+static void bgmac_chip_init(struct bgmac *bgmac) - { -- struct bgmac_dma_ring *ring; -- int i; -- - /* 1 interrupt per received frame */ - bgmac_write(bgmac, BGMAC_INT_RECV_LAZY, 1 << BGMAC_IRL_FC_SHIFT); - -@@ -1205,16 +1210,7 @@ static void bgmac_chip_init(struct bgmac - - bgmac_write(bgmac, BGMAC_RXMAX_LENGTH, 32 + ETHER_MAX_LEN); - -- if (full_init) { -- bgmac_dma_init(bgmac); -- if (1) /* FIXME: is there any case we don't want IRQs? */ -- bgmac_chip_intrs_on(bgmac); -- } else { -- for (i = 0; i < BGMAC_MAX_RX_RINGS; i++) { -- ring = &bgmac->rx_ring[i]; -- bgmac_dma_rx_enable(bgmac, ring); -- } -- } -+ bgmac_chip_intrs_on(bgmac); - - bgmac_enable(bgmac); - } -@@ -1274,23 +1270,27 @@ static int bgmac_open(struct net_device - int err = 0; - - bgmac_chip_reset(bgmac); -+ -+ err = bgmac_dma_init(bgmac); -+ if (err) -+ return err; -+ - /* Specs say about reclaiming rings here, but we do that in DMA init */ -- bgmac_chip_init(bgmac, true); -+ bgmac_chip_init(bgmac); - - err = request_irq(bgmac->core->irq, bgmac_interrupt, IRQF_SHARED, - KBUILD_MODNAME, net_dev); - if (err < 0) { - bgmac_err(bgmac, "IRQ request error: %d!\n", err); -- goto err_out; -+ bgmac_dma_cleanup(bgmac); -+ return err; - } - napi_enable(&bgmac->napi); - - phy_start(bgmac->phy_dev); - - netif_carrier_on(net_dev); -- --err_out: -- return err; -+ return 0; - } - - static int bgmac_stop(struct net_device *net_dev) -@@ -1306,6 +1306,7 @@ static int bgmac_stop(struct net_device - free_irq(bgmac->core->irq, net_dev); - - bgmac_chip_reset(bgmac); -+ bgmac_dma_cleanup(bgmac); - - return 0; - } diff --git a/target/linux/generic/pending-3.18/077-11-bgmac-fix-DMA-rx-corruption.patch b/target/linux/generic/pending-3.18/077-11-bgmac-fix-DMA-rx-corruption.patch deleted file mode 100644 index e7a7987f43..0000000000 --- a/target/linux/generic/pending-3.18/077-11-bgmac-fix-DMA-rx-corruption.patch +++ /dev/null @@ -1,88 +0,0 @@ -From: Felix Fietkau -Date: Sun, 12 Apr 2015 11:59:47 +0200 -Subject: [PATCH] bgmac: fix DMA rx corruption - -The driver needs to inform the hardware about the first invalid (not yet -filled) rx slot, by writing its DMA descriptor pointer offset to the -BGMAC_DMA_RX_INDEX register. - -This register was set to a value exceeding the rx ring size, effectively -allowing the hardware constant access to the full ring, regardless of -which slots are initialized. - -To fix this issue, always mark the last filled rx slot as invalid. - -Signed-off-by: Felix Fietkau ---- - ---- a/drivers/net/ethernet/broadcom/bgmac.c -+++ b/drivers/net/ethernet/broadcom/bgmac.c -@@ -366,6 +366,16 @@ static int bgmac_dma_rx_skb_for_slot(str - return 0; - } - -+static void bgmac_dma_rx_update_index(struct bgmac *bgmac, -+ struct bgmac_dma_ring *ring) -+{ -+ wmb(); -+ -+ bgmac_write(bgmac, ring->mmio_base + BGMAC_DMA_RX_INDEX, -+ ring->index_base + -+ ring->end * sizeof(struct bgmac_dma_desc)); -+} -+ - static void bgmac_dma_rx_setup_desc(struct bgmac *bgmac, - struct bgmac_dma_ring *ring, int desc_idx) - { -@@ -384,6 +394,8 @@ static void bgmac_dma_rx_setup_desc(stru - dma_desc->addr_high = cpu_to_le32(upper_32_bits(ring->slots[desc_idx].dma_addr)); - dma_desc->ctl0 = cpu_to_le32(ctl0); - dma_desc->ctl1 = cpu_to_le32(ctl1); -+ -+ ring->end = desc_idx; - } - - static void bgmac_dma_rx_poison_buf(struct device *dma_dev, -@@ -411,9 +423,7 @@ static int bgmac_dma_rx_read(struct bgma - end_slot &= BGMAC_DMA_RX_STATDPTR; - end_slot /= sizeof(struct bgmac_dma_desc); - -- ring->end = end_slot; -- -- while (ring->start != ring->end) { -+ while (ring->start != end_slot) { - struct device *dma_dev = bgmac->core->dma_dev; - struct bgmac_slot_info *slot = &ring->slots[ring->start]; - struct bgmac_rx_header *rx = slot->buf + BGMAC_RX_BUF_OFFSET; -@@ -476,6 +486,8 @@ static int bgmac_dma_rx_read(struct bgma - break; - } - -+ bgmac_dma_rx_update_index(bgmac, ring); -+ - return handled; - } - -@@ -695,6 +707,8 @@ static int bgmac_dma_init(struct bgmac * - if (ring->unaligned) - bgmac_dma_rx_enable(bgmac, ring); - -+ ring->start = 0; -+ ring->end = 0; - for (j = 0; j < ring->num_slots; j++) { - err = bgmac_dma_rx_skb_for_slot(bgmac, &ring->slots[j]); - if (err) -@@ -703,12 +717,7 @@ static int bgmac_dma_init(struct bgmac * - bgmac_dma_rx_setup_desc(bgmac, ring, j); - } - -- bgmac_write(bgmac, ring->mmio_base + BGMAC_DMA_RX_INDEX, -- ring->index_base + -- ring->num_slots * sizeof(struct bgmac_dma_desc)); -- -- ring->start = 0; -- ring->end = 0; -+ bgmac_dma_rx_update_index(bgmac, ring); - } - - return 0; diff --git a/target/linux/generic/pending-3.18/077-12-bgmac-drop-ring-num_slots.patch b/target/linux/generic/pending-3.18/077-12-bgmac-drop-ring-num_slots.patch deleted file mode 100644 index 4dbb6f48de..0000000000 --- a/target/linux/generic/pending-3.18/077-12-bgmac-drop-ring-num_slots.patch +++ /dev/null @@ -1,132 +0,0 @@ -From: Felix Fietkau -Date: Sun, 12 Apr 2015 23:28:38 +0200 -Subject: [PATCH] bgmac: drop ring->num_slots - -The ring size is always known at compile time, so make the code a bit -more efficient - -Signed-off-by: Felix Fietkau ---- - ---- a/drivers/net/ethernet/broadcom/bgmac.c -+++ b/drivers/net/ethernet/broadcom/bgmac.c -@@ -123,7 +123,7 @@ bgmac_dma_tx_add_buf(struct bgmac *bgmac - struct bgmac_dma_desc *dma_desc; - u32 ctl1; - -- if (i == ring->num_slots - 1) -+ if (i == BGMAC_TX_RING_SLOTS - 1) - ctl0 |= BGMAC_DESC_CTL0_EOT; - - ctl1 = len & BGMAC_DESC_CTL1_LEN; -@@ -382,7 +382,7 @@ static void bgmac_dma_rx_setup_desc(stru - struct bgmac_dma_desc *dma_desc = ring->cpu_base + desc_idx; - u32 ctl0 = 0, ctl1 = 0; - -- if (desc_idx == ring->num_slots - 1) -+ if (desc_idx == BGMAC_RX_RING_SLOTS - 1) - ctl0 |= BGMAC_DESC_CTL0_EOT; - ctl1 |= BGMAC_RX_BUF_SIZE & BGMAC_DESC_CTL1_LEN; - /* Is there any BGMAC device that requires extension? */ -@@ -521,7 +521,7 @@ static void bgmac_dma_tx_ring_free(struc - struct bgmac_slot_info *slot; - int i; - -- for (i = 0; i < ring->num_slots; i++) { -+ for (i = 0; i < BGMAC_TX_RING_SLOTS; i++) { - int len = dma_desc[i].ctl1 & BGMAC_DESC_CTL1_LEN; - - slot = &ring->slots[i]; -@@ -546,7 +546,7 @@ static void bgmac_dma_rx_ring_free(struc - struct bgmac_slot_info *slot; - int i; - -- for (i = 0; i < ring->num_slots; i++) { -+ for (i = 0; i < BGMAC_RX_RING_SLOTS; i++) { - slot = &ring->slots[i]; - if (!slot->dma_addr) - continue; -@@ -560,7 +560,8 @@ static void bgmac_dma_rx_ring_free(struc - } - - static void bgmac_dma_ring_desc_free(struct bgmac *bgmac, -- struct bgmac_dma_ring *ring) -+ struct bgmac_dma_ring *ring, -+ int num_slots) - { - struct device *dma_dev = bgmac->core->dma_dev; - int size; -@@ -569,7 +570,7 @@ static void bgmac_dma_ring_desc_free(str - return; - - /* Free ring of descriptors */ -- size = ring->num_slots * sizeof(struct bgmac_dma_desc); -+ size = num_slots * sizeof(struct bgmac_dma_desc); - dma_free_coherent(dma_dev, size, ring->cpu_base, - ring->dma_base); - } -@@ -590,10 +591,12 @@ static void bgmac_dma_free(struct bgmac - int i; - - for (i = 0; i < BGMAC_MAX_TX_RINGS; i++) -- bgmac_dma_ring_desc_free(bgmac, &bgmac->tx_ring[i]); -+ bgmac_dma_ring_desc_free(bgmac, &bgmac->tx_ring[i], -+ BGMAC_TX_RING_SLOTS); - - for (i = 0; i < BGMAC_MAX_RX_RINGS; i++) -- bgmac_dma_ring_desc_free(bgmac, &bgmac->rx_ring[i]); -+ bgmac_dma_ring_desc_free(bgmac, &bgmac->rx_ring[i], -+ BGMAC_RX_RING_SLOTS); - } - - static int bgmac_dma_alloc(struct bgmac *bgmac) -@@ -616,11 +619,10 @@ static int bgmac_dma_alloc(struct bgmac - - for (i = 0; i < BGMAC_MAX_TX_RINGS; i++) { - ring = &bgmac->tx_ring[i]; -- ring->num_slots = BGMAC_TX_RING_SLOTS; - ring->mmio_base = ring_base[i]; - - /* Alloc ring of descriptors */ -- size = ring->num_slots * sizeof(struct bgmac_dma_desc); -+ size = BGMAC_TX_RING_SLOTS * sizeof(struct bgmac_dma_desc); - ring->cpu_base = dma_zalloc_coherent(dma_dev, size, - &ring->dma_base, - GFP_KERNEL); -@@ -642,11 +644,10 @@ static int bgmac_dma_alloc(struct bgmac - - for (i = 0; i < BGMAC_MAX_RX_RINGS; i++) { - ring = &bgmac->rx_ring[i]; -- ring->num_slots = BGMAC_RX_RING_SLOTS; - ring->mmio_base = ring_base[i]; - - /* Alloc ring of descriptors */ -- size = ring->num_slots * sizeof(struct bgmac_dma_desc); -+ size = BGMAC_RX_RING_SLOTS * sizeof(struct bgmac_dma_desc); - ring->cpu_base = dma_zalloc_coherent(dma_dev, size, - &ring->dma_base, - GFP_KERNEL); -@@ -709,7 +710,7 @@ static int bgmac_dma_init(struct bgmac * - - ring->start = 0; - ring->end = 0; -- for (j = 0; j < ring->num_slots; j++) { -+ for (j = 0; j < BGMAC_RX_RING_SLOTS; j++) { - err = bgmac_dma_rx_skb_for_slot(bgmac, &ring->slots[j]); - if (err) - goto error; ---- a/drivers/net/ethernet/broadcom/bgmac.h -+++ b/drivers/net/ethernet/broadcom/bgmac.h -@@ -419,11 +419,10 @@ struct bgmac_dma_ring { - u32 start; - u32 end; - -- u16 num_slots; -- u16 mmio_base; - struct bgmac_dma_desc *cpu_base; - dma_addr_t dma_base; - u32 index_base; /* Used for unaligned rings only, otherwise 0 */ -+ u16 mmio_base; - bool unaligned; - - struct bgmac_slot_info slots[BGMAC_RX_RING_SLOTS]; diff --git a/target/linux/generic/pending-3.18/078-bgmac-reset-enable-Ethernet-core-before-using-it.patch b/target/linux/generic/pending-3.18/078-bgmac-reset-enable-Ethernet-core-before-using-it.patch deleted file mode 100644 index a4c7876d7f..0000000000 --- a/target/linux/generic/pending-3.18/078-bgmac-reset-enable-Ethernet-core-before-using-it.patch +++ /dev/null @@ -1,31 +0,0 @@ -From b4dfd8e92956b396d3438212bc9a0be6267b8b34 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= -Date: Tue, 12 Apr 2016 13:30:45 +0200 -Subject: [PATCH] bgmac: reset & enable Ethernet core before using it -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -This fixes Ethernet on D-Link DIR-885L with BCM47094 SoC. Felix reported -similar fix was needed for his BCM4709 device (Buffalo WXR-1900DHP?). -I tested this for regressions on BCM4706, BCM4708A0 and BCM47081A0. - -Cc: Felix Fietkau -Signed-off-by: Rafał Miłecki -Signed-off-by: David S. Miller ---- - ---- a/drivers/net/ethernet/broadcom/bgmac.c -+++ b/drivers/net/ethernet/broadcom/bgmac.c -@@ -1569,6 +1569,11 @@ static int bgmac_probe(struct bcma_devic - */ - bcma_core_enable(core, 0); - -+ /* This (reset &) enable is not preset in specs or reference driver but -+ * Broadcom does it in arch PCI code when enabling fake PCI device. -+ */ -+ bcma_core_enable(core, 0); -+ - /* Allocation and references */ - net_dev = alloc_etherdev(sizeof(*bgmac)); - if (!net_dev) diff --git a/target/linux/generic/pending-3.18/079-bgmac-fix-MAC-soft-reset-bit-for-corerev-4.patch b/target/linux/generic/pending-3.18/079-bgmac-fix-MAC-soft-reset-bit-for-corerev-4.patch deleted file mode 100644 index f8d0a58769..0000000000 --- a/target/linux/generic/pending-3.18/079-bgmac-fix-MAC-soft-reset-bit-for-corerev-4.patch +++ /dev/null @@ -1,34 +0,0 @@ -From c02bc350f9dbce7d637c394a6e1c4d29dc5b28b2 Mon Sep 17 00:00:00 2001 -From: Felix Fietkau -Date: Tue, 12 Apr 2016 18:27:29 +0200 -Subject: [PATCH] bgmac: fix MAC soft-reset bit for corerev > 4 -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Only core revisions older than 4 use BGMAC_CMDCFG_SR_REV0. This mainly -fixes support for BCM4708A0KF SoCs with Ethernet core rev 5 (it means -only some devices as most of BCM4708A0KF-s got core rev 4). -This was tested for regressions on BCM47094 which doesn't seem to care -which bit gets used. - -Signed-off-by: Felix Fietkau -Signed-off-by: Rafał Miłecki -Signed-off-by: David S. Miller ---- - ---- a/drivers/net/ethernet/broadcom/bgmac.h -+++ b/drivers/net/ethernet/broadcom/bgmac.h -@@ -198,9 +198,9 @@ - #define BGMAC_CMDCFG_TAI 0x00000200 - #define BGMAC_CMDCFG_HD 0x00000400 /* Set if in half duplex mode */ - #define BGMAC_CMDCFG_HD_SHIFT 10 --#define BGMAC_CMDCFG_SR_REV0 0x00000800 /* Set to reset mode, for other revs */ --#define BGMAC_CMDCFG_SR_REV4 0x00002000 /* Set to reset mode, only for core rev 4 */ --#define BGMAC_CMDCFG_SR(rev) ((rev == 4) ? BGMAC_CMDCFG_SR_REV4 : BGMAC_CMDCFG_SR_REV0) -+#define BGMAC_CMDCFG_SR_REV0 0x00000800 /* Set to reset mode, for core rev 0-3 */ -+#define BGMAC_CMDCFG_SR_REV4 0x00002000 /* Set to reset mode, for core rev >= 4 */ -+#define BGMAC_CMDCFG_SR(rev) ((rev >= 4) ? BGMAC_CMDCFG_SR_REV4 : BGMAC_CMDCFG_SR_REV0) - #define BGMAC_CMDCFG_ML 0x00008000 /* Set to activate mac loopback mode */ - #define BGMAC_CMDCFG_AE 0x00400000 - #define BGMAC_CMDCFG_CFE 0x00800000 diff --git a/target/linux/generic/pending-3.18/080-00-fib_trie-Fix-proc-net-fib_trie-when-CONFIG_IP_MULTIP.patch b/target/linux/generic/pending-3.18/080-00-fib_trie-Fix-proc-net-fib_trie-when-CONFIG_IP_MULTIP.patch deleted file mode 100644 index 5d99367ad4..0000000000 --- a/target/linux/generic/pending-3.18/080-00-fib_trie-Fix-proc-net-fib_trie-when-CONFIG_IP_MULTIP.patch +++ /dev/null @@ -1,46 +0,0 @@ -From: Alexander Duyck -Date: Tue, 2 Dec 2014 10:58:21 -0800 -Subject: [PATCH] fib_trie: Fix /proc/net/fib_trie when - CONFIG_IP_MULTIPLE_TABLES is not defined - -In recent testing I had disabled CONFIG_IP_MULTIPLE_TABLES and as a result -when I ran "cat /proc/net/fib_trie" the main trie was displayed multiple -times. I found that the problem line of code was in the function -fib_trie_seq_next. Specifically the line below caused the indexes to go in -the opposite direction of our traversal: - - h = tb->tb_id & (FIB_TABLE_HASHSZ - 1); - -This issue was that the RT tables are defined such that RT_TABLE_LOCAL is ID -255, while it is located at TABLE_LOCAL_INDEX of 0, and RT_TABLE_MAIN is 254 -with a TABLE_MAIN_INDEX of 1. This means that the above line will return 1 -for the local table and 0 for main. The result is that fib_trie_seq_next -will return NULL at the end of the local table, fib_trie_seq_start will -return the start of the main table, and then fib_trie_seq_next will loop on -main forever as h will always return 0. - -The fix for this is to reverse the ordering of the two tables. It has the -advantage of making it so that the tables now print in the same order -regardless of if multiple tables are enabled or not. In order to make the -definition consistent with the multiple tables case I simply masked the to -RT_TABLE_XXX values by (FIB_TABLE_HASHSZ - 1). This way the two table -layouts should always stay consistent. - -Fixes: 93456b6 ("[IPV4]: Unify access to the routing tables") -Signed-off-by: Alexander Duyck -Signed-off-by: David S. Miller ---- - ---- a/include/net/ip_fib.h -+++ b/include/net/ip_fib.h -@@ -201,8 +201,8 @@ void fib_free_table(struct fib_table *tb - - #ifndef CONFIG_IP_MULTIPLE_TABLES - --#define TABLE_LOCAL_INDEX 0 --#define TABLE_MAIN_INDEX 1 -+#define TABLE_LOCAL_INDEX (RT_TABLE_LOCAL & (FIB_TABLE_HASHSZ - 1)) -+#define TABLE_MAIN_INDEX (RT_TABLE_MAIN & (FIB_TABLE_HASHSZ - 1)) - - static inline struct fib_table *fib_get_table(struct net *net, u32 id) - { diff --git a/target/linux/generic/pending-3.18/080-01-fib_trie-Fix-trie-balancing-issue-if-new-node-pushes.patch b/target/linux/generic/pending-3.18/080-01-fib_trie-Fix-trie-balancing-issue-if-new-node-pushes.patch deleted file mode 100644 index 4e09f8a189..0000000000 --- a/target/linux/generic/pending-3.18/080-01-fib_trie-Fix-trie-balancing-issue-if-new-node-pushes.patch +++ /dev/null @@ -1,72 +0,0 @@ -From: Alexander Duyck -Date: Wed, 10 Dec 2014 21:49:22 -0800 -Subject: [PATCH] fib_trie: Fix trie balancing issue if new node pushes down - existing node - -This patch addresses an issue with the level compression of the fib_trie. -Specifically in the case of adding a new leaf that triggers a new node to -be added that takes the place of the old node. The result is a trie where -the 1 child tnode is on one side and one leaf is on the other which gives -you a very deep trie. Below is the script I used to generate a trie on -dummy0 with a 10.X.X.X family of addresses. - - ip link add type dummy - ipval=184549374 - bit=2 - for i in `seq 1 23` - do - ifconfig dummy0:$bit $ipval/8 - ipval=`expr $ipval - $bit` - bit=`expr $bit \* 2` - done - cat /proc/net/fib_triestat - -Running the script before the patch: - - Local: - Aver depth: 10.82 - Max depth: 23 - Leaves: 29 - Prefixes: 30 - Internal nodes: 27 - 1: 26 2: 1 - Pointers: 56 - Null ptrs: 1 - Total size: 5 kB - -After applying the patch and repeating: - - Local: - Aver depth: 4.72 - Max depth: 9 - Leaves: 29 - Prefixes: 30 - Internal nodes: 12 - 1: 3 2: 2 3: 7 - Pointers: 70 - Null ptrs: 30 - Total size: 4 kB - -What this fix does is start the rebalance at the newly created tnode -instead of at the parent tnode. This way if there is a gap between the -parent and the new node it doesn't prevent the new tnode from being -coalesced with any pre-existing nodes that may have been pushed into one -of the new nodes child branches. - -Signed-off-by: Alexander Duyck -Signed-off-by: David S. Miller ---- - ---- a/net/ipv4/fib_trie.c -+++ b/net/ipv4/fib_trie.c -@@ -1143,8 +1143,9 @@ static struct list_head *fib_insert_node - put_child(tp, cindex, (struct rt_trie_node *)tn); - } else { - rcu_assign_pointer(t->trie, (struct rt_trie_node *)tn); -- tp = tn; - } -+ -+ tp = tn; - } - - if (tp && tp->pos + tp->bits > 32) diff --git a/target/linux/generic/pending-3.18/080-02-fib_trie-Update-usage-stats-to-be-percpu-instead-of-.patch b/target/linux/generic/pending-3.18/080-02-fib_trie-Update-usage-stats-to-be-percpu-instead-of-.patch deleted file mode 100644 index 2e6deb5bbc..0000000000 --- a/target/linux/generic/pending-3.18/080-02-fib_trie-Update-usage-stats-to-be-percpu-instead-of-.patch +++ /dev/null @@ -1,200 +0,0 @@ -From: Alexander Duyck -Date: Wed, 31 Dec 2014 10:55:29 -0800 -Subject: [PATCH] fib_trie: Update usage stats to be percpu instead of - global variables - -The trie usage stats were currently being shared by all threads that were -calling fib_table_lookup. As a result when multiple threads were -performing lookups simultaneously the trie would begin to cache bounce -between those threads. - -In order to prevent this I have updated the usage stats to use a set of -percpu variables. By doing this we should be able to avoid the cache -bouncing and still make use of these stats. - -Signed-off-by: Alexander Duyck -Signed-off-by: David S. Miller ---- - ---- a/net/ipv4/fib_frontend.c -+++ b/net/ipv4/fib_frontend.c -@@ -67,7 +67,7 @@ static int __net_init fib4_rules_init(st - return 0; - - fail: -- kfree(local_table); -+ fib_free_table(local_table); - return -ENOMEM; - } - #else ---- a/net/ipv4/fib_trie.c -+++ b/net/ipv4/fib_trie.c -@@ -153,7 +153,7 @@ struct trie_stat { - struct trie { - struct rt_trie_node __rcu *trie; - #ifdef CONFIG_IP_FIB_TRIE_STATS -- struct trie_use_stats stats; -+ struct trie_use_stats __percpu *stats; - #endif - }; - -@@ -631,7 +631,7 @@ static struct rt_trie_node *resize(struc - if (IS_ERR(tn)) { - tn = old_tn; - #ifdef CONFIG_IP_FIB_TRIE_STATS -- t->stats.resize_node_skipped++; -+ this_cpu_inc(t->stats->resize_node_skipped); - #endif - break; - } -@@ -658,7 +658,7 @@ static struct rt_trie_node *resize(struc - if (IS_ERR(tn)) { - tn = old_tn; - #ifdef CONFIG_IP_FIB_TRIE_STATS -- t->stats.resize_node_skipped++; -+ this_cpu_inc(t->stats->resize_node_skipped); - #endif - break; - } -@@ -1357,7 +1357,7 @@ static int check_leaf(struct fib_table * - err = fib_props[fa->fa_type].error; - if (err) { - #ifdef CONFIG_IP_FIB_TRIE_STATS -- t->stats.semantic_match_passed++; -+ this_cpu_inc(t->stats->semantic_match_passed); - #endif - return err; - } -@@ -1372,7 +1372,7 @@ static int check_leaf(struct fib_table * - continue; - - #ifdef CONFIG_IP_FIB_TRIE_STATS -- t->stats.semantic_match_passed++; -+ this_cpu_inc(t->stats->semantic_match_passed); - #endif - res->prefixlen = li->plen; - res->nh_sel = nhsel; -@@ -1388,7 +1388,7 @@ static int check_leaf(struct fib_table * - } - - #ifdef CONFIG_IP_FIB_TRIE_STATS -- t->stats.semantic_match_miss++; -+ this_cpu_inc(t->stats->semantic_match_miss); - #endif - } - -@@ -1399,6 +1399,9 @@ int fib_table_lookup(struct fib_table *t - struct fib_result *res, int fib_flags) - { - struct trie *t = (struct trie *) tb->tb_data; -+#ifdef CONFIG_IP_FIB_TRIE_STATS -+ struct trie_use_stats __percpu *stats = t->stats; -+#endif - int ret; - struct rt_trie_node *n; - struct tnode *pn; -@@ -1417,7 +1420,7 @@ int fib_table_lookup(struct fib_table *t - goto failed; - - #ifdef CONFIG_IP_FIB_TRIE_STATS -- t->stats.gets++; -+ this_cpu_inc(stats->gets); - #endif - - /* Just a leaf? */ -@@ -1441,7 +1444,7 @@ int fib_table_lookup(struct fib_table *t - - if (n == NULL) { - #ifdef CONFIG_IP_FIB_TRIE_STATS -- t->stats.null_node_hit++; -+ this_cpu_inc(stats->null_node_hit); - #endif - goto backtrace; - } -@@ -1576,7 +1579,7 @@ backtrace: - chopped_off = 0; - - #ifdef CONFIG_IP_FIB_TRIE_STATS -- t->stats.backtrack++; -+ this_cpu_inc(stats->backtrack); - #endif - goto backtrace; - } -@@ -1830,6 +1833,11 @@ int fib_table_flush(struct fib_table *tb - - void fib_free_table(struct fib_table *tb) - { -+#ifdef CONFIG_IP_FIB_TRIE_STATS -+ struct trie *t = (struct trie *)tb->tb_data; -+ -+ free_percpu(t->stats); -+#endif /* CONFIG_IP_FIB_TRIE_STATS */ - kfree(tb); - } - -@@ -1973,7 +1981,14 @@ struct fib_table *fib_trie_table(u32 id) - tb->tb_num_default = 0; - - t = (struct trie *) tb->tb_data; -- memset(t, 0, sizeof(*t)); -+ RCU_INIT_POINTER(t->trie, NULL); -+#ifdef CONFIG_IP_FIB_TRIE_STATS -+ t->stats = alloc_percpu(struct trie_use_stats); -+ if (!t->stats) { -+ kfree(tb); -+ tb = NULL; -+ } -+#endif - - return tb; - } -@@ -2139,18 +2154,31 @@ static void trie_show_stats(struct seq_f - - #ifdef CONFIG_IP_FIB_TRIE_STATS - static void trie_show_usage(struct seq_file *seq, -- const struct trie_use_stats *stats) -+ const struct trie_use_stats __percpu *stats) - { -+ struct trie_use_stats s = { 0 }; -+ int cpu; -+ -+ /* loop through all of the CPUs and gather up the stats */ -+ for_each_possible_cpu(cpu) { -+ const struct trie_use_stats *pcpu = per_cpu_ptr(stats, cpu); -+ -+ s.gets += pcpu->gets; -+ s.backtrack += pcpu->backtrack; -+ s.semantic_match_passed += pcpu->semantic_match_passed; -+ s.semantic_match_miss += pcpu->semantic_match_miss; -+ s.null_node_hit += pcpu->null_node_hit; -+ s.resize_node_skipped += pcpu->resize_node_skipped; -+ } -+ - seq_printf(seq, "\nCounters:\n---------\n"); -- seq_printf(seq, "gets = %u\n", stats->gets); -- seq_printf(seq, "backtracks = %u\n", stats->backtrack); -+ seq_printf(seq, "gets = %u\n", s.gets); -+ seq_printf(seq, "backtracks = %u\n", s.backtrack); - seq_printf(seq, "semantic match passed = %u\n", -- stats->semantic_match_passed); -- seq_printf(seq, "semantic match miss = %u\n", -- stats->semantic_match_miss); -- seq_printf(seq, "null node hit= %u\n", stats->null_node_hit); -- seq_printf(seq, "skipped node resize = %u\n\n", -- stats->resize_node_skipped); -+ s.semantic_match_passed); -+ seq_printf(seq, "semantic match miss = %u\n", s.semantic_match_miss); -+ seq_printf(seq, "null node hit= %u\n", s.null_node_hit); -+ seq_printf(seq, "skipped node resize = %u\n\n", s.resize_node_skipped); - } - #endif /* CONFIG_IP_FIB_TRIE_STATS */ - -@@ -2191,7 +2219,7 @@ static int fib_triestat_seq_show(struct - trie_collect_stats(t, &stat); - trie_show_stats(seq, &stat); - #ifdef CONFIG_IP_FIB_TRIE_STATS -- trie_show_usage(seq, &t->stats); -+ trie_show_usage(seq, t->stats); - #endif - } - } diff --git a/target/linux/generic/pending-3.18/080-03-fib_trie-Make-leaf-and-tnode-more-uniform.patch b/target/linux/generic/pending-3.18/080-03-fib_trie-Make-leaf-and-tnode-more-uniform.patch deleted file mode 100644 index 4c727cdfce..0000000000 --- a/target/linux/generic/pending-3.18/080-03-fib_trie-Make-leaf-and-tnode-more-uniform.patch +++ /dev/null @@ -1,421 +0,0 @@ -From: Alexander Duyck -Date: Wed, 31 Dec 2014 10:55:35 -0800 -Subject: [PATCH] fib_trie: Make leaf and tnode more uniform - -This change makes some fundamental changes to the way leaves and tnodes are -constructed. The big differences are: -1. Leaves now populate pos and bits indicating their full key size. -2. Trie nodes now mask out their lower bits to be consistent with the leaf -3. Both structures have been reordered so that rt_trie_node now consisists - of a much larger region including the pos, bits, and rcu portions of - the tnode structure. - -On 32b systems this will result in the leaf being 4B larger as the pos and -bits values were added to a hole created by the key as it was only 4B in -length. - -Signed-off-by: Alexander Duyck -Signed-off-by: David S. Miller ---- - ---- a/net/ipv4/fib_trie.c -+++ b/net/ipv4/fib_trie.c -@@ -87,24 +87,38 @@ - - typedef unsigned int t_key; - --#define T_TNODE 0 --#define T_LEAF 1 --#define NODE_TYPE_MASK 0x1UL --#define NODE_TYPE(node) ((node)->parent & NODE_TYPE_MASK) -+#define IS_TNODE(n) ((n)->bits) -+#define IS_LEAF(n) (!(n)->bits) - --#define IS_TNODE(n) (!(n->parent & T_LEAF)) --#define IS_LEAF(n) (n->parent & T_LEAF) -+struct tnode { -+ t_key key; -+ unsigned char bits; /* 2log(KEYLENGTH) bits needed */ -+ unsigned char pos; /* 2log(KEYLENGTH) bits needed */ -+ struct tnode __rcu *parent; -+ union { -+ struct rcu_head rcu; -+ struct tnode *tnode_free; -+ }; -+ unsigned int full_children; /* KEYLENGTH bits needed */ -+ unsigned int empty_children; /* KEYLENGTH bits needed */ -+ struct rt_trie_node __rcu *child[0]; -+}; - - struct rt_trie_node { -- unsigned long parent; - t_key key; -+ unsigned char bits; -+ unsigned char pos; -+ struct tnode __rcu *parent; -+ struct rcu_head rcu; - }; - - struct leaf { -- unsigned long parent; - t_key key; -- struct hlist_head list; -+ unsigned char bits; -+ unsigned char pos; -+ struct tnode __rcu *parent; - struct rcu_head rcu; -+ struct hlist_head list; - }; - - struct leaf_info { -@@ -115,20 +129,6 @@ struct leaf_info { - struct rcu_head rcu; - }; - --struct tnode { -- unsigned long parent; -- t_key key; -- unsigned char pos; /* 2log(KEYLENGTH) bits needed */ -- unsigned char bits; /* 2log(KEYLENGTH) bits needed */ -- unsigned int full_children; /* KEYLENGTH bits needed */ -- unsigned int empty_children; /* KEYLENGTH bits needed */ -- union { -- struct rcu_head rcu; -- struct tnode *tnode_free; -- }; -- struct rt_trie_node __rcu *child[0]; --}; -- - #ifdef CONFIG_IP_FIB_TRIE_STATS - struct trie_use_stats { - unsigned int gets; -@@ -176,38 +176,27 @@ static const int sync_pages = 128; - static struct kmem_cache *fn_alias_kmem __read_mostly; - static struct kmem_cache *trie_leaf_kmem __read_mostly; - --/* -- * caller must hold RTNL -- */ --static inline struct tnode *node_parent(const struct rt_trie_node *node) --{ -- unsigned long parent; -+/* caller must hold RTNL */ -+#define node_parent(n) rtnl_dereference((n)->parent) - -- parent = rcu_dereference_index_check(node->parent, lockdep_rtnl_is_held()); -+/* caller must hold RCU read lock or RTNL */ -+#define node_parent_rcu(n) rcu_dereference_rtnl((n)->parent) - -- return (struct tnode *)(parent & ~NODE_TYPE_MASK); --} -- --/* -- * caller must hold RCU read lock or RTNL -- */ --static inline struct tnode *node_parent_rcu(const struct rt_trie_node *node) -+/* wrapper for rcu_assign_pointer */ -+static inline void node_set_parent(struct rt_trie_node *node, struct tnode *ptr) - { -- unsigned long parent; -- -- parent = rcu_dereference_index_check(node->parent, rcu_read_lock_held() || -- lockdep_rtnl_is_held()); -- -- return (struct tnode *)(parent & ~NODE_TYPE_MASK); -+ if (node) -+ rcu_assign_pointer(node->parent, ptr); - } - --/* Same as rcu_assign_pointer -- * but that macro() assumes that value is a pointer. -+#define NODE_INIT_PARENT(n, p) RCU_INIT_POINTER((n)->parent, p) -+ -+/* This provides us with the number of children in this node, in the case of a -+ * leaf this will return 0 meaning none of the children are accessible. - */ --static inline void node_set_parent(struct rt_trie_node *node, struct tnode *ptr) -+static inline int tnode_child_length(const struct tnode *tn) - { -- smp_wmb(); -- node->parent = (unsigned long)ptr | NODE_TYPE(node); -+ return (1ul << tn->bits) & ~(1ul); - } - - /* -@@ -215,7 +204,7 @@ static inline void node_set_parent(struc - */ - static inline struct rt_trie_node *tnode_get_child(const struct tnode *tn, unsigned int i) - { -- BUG_ON(i >= 1U << tn->bits); -+ BUG_ON(i >= tnode_child_length(tn)); - - return rtnl_dereference(tn->child[i]); - } -@@ -225,16 +214,11 @@ static inline struct rt_trie_node *tnode - */ - static inline struct rt_trie_node *tnode_get_child_rcu(const struct tnode *tn, unsigned int i) - { -- BUG_ON(i >= 1U << tn->bits); -+ BUG_ON(i >= tnode_child_length(tn)); - - return rcu_dereference_rtnl(tn->child[i]); - } - --static inline int tnode_child_length(const struct tnode *tn) --{ -- return 1 << tn->bits; --} -- - static inline t_key mask_pfx(t_key k, unsigned int l) - { - return (l == 0) ? 0 : k >> (KEYLENGTH-l) << (KEYLENGTH-l); -@@ -336,11 +320,6 @@ static inline int tkey_mismatch(t_key a, - - */ - --static inline void check_tnode(const struct tnode *tn) --{ -- WARN_ON(tn && tn->pos+tn->bits > 32); --} -- - static const int halve_threshold = 25; - static const int inflate_threshold = 50; - static const int halve_threshold_root = 15; -@@ -426,11 +405,20 @@ static void tnode_free_flush(void) - } - } - --static struct leaf *leaf_new(void) -+static struct leaf *leaf_new(t_key key) - { - struct leaf *l = kmem_cache_alloc(trie_leaf_kmem, GFP_KERNEL); - if (l) { -- l->parent = T_LEAF; -+ l->parent = NULL; -+ /* set key and pos to reflect full key value -+ * any trailing zeros in the key should be ignored -+ * as the nodes are searched -+ */ -+ l->key = key; -+ l->pos = KEYLENGTH; -+ /* set bits to 0 indicating we are not a tnode */ -+ l->bits = 0; -+ - INIT_HLIST_HEAD(&l->list); - } - return l; -@@ -451,12 +439,16 @@ static struct tnode *tnode_new(t_key key - { - size_t sz = sizeof(struct tnode) + (sizeof(struct rt_trie_node *) << bits); - struct tnode *tn = tnode_alloc(sz); -+ unsigned int shift = pos + bits; -+ -+ /* verify bits and pos their msb bits clear and values are valid */ -+ BUG_ON(!bits || (shift > KEYLENGTH)); - - if (tn) { -- tn->parent = T_TNODE; -+ tn->parent = NULL; - tn->pos = pos; - tn->bits = bits; -- tn->key = key; -+ tn->key = mask_pfx(key, pos); - tn->full_children = 0; - tn->empty_children = 1<pos == tn->pos + tn->bits; -+ return n && IS_TNODE(n) && (n->pos == (tn->pos + tn->bits)); - } - - static inline void put_child(struct tnode *tn, int i, -@@ -514,8 +503,7 @@ static void tnode_put_child_reorg(struct - else if (!wasfull && isfull) - tn->full_children++; - -- if (n) -- node_set_parent(n, tn); -+ node_set_parent(n, tn); - - rcu_assign_pointer(tn->child[i], n); - } -@@ -523,7 +511,7 @@ static void tnode_put_child_reorg(struct - #define MAX_WORK 10 - static struct rt_trie_node *resize(struct trie *t, struct tnode *tn) - { -- int i; -+ struct rt_trie_node *n = NULL; - struct tnode *old_tn; - int inflate_threshold_use; - int halve_threshold_use; -@@ -536,12 +524,11 @@ static struct rt_trie_node *resize(struc - tn, inflate_threshold, halve_threshold); - - /* No children */ -- if (tn->empty_children == tnode_child_length(tn)) { -- tnode_free_safe(tn); -- return NULL; -- } -+ if (tn->empty_children > (tnode_child_length(tn) - 1)) -+ goto no_children; -+ - /* One child */ -- if (tn->empty_children == tnode_child_length(tn) - 1) -+ if (tn->empty_children == (tnode_child_length(tn) - 1)) - goto one_child; - /* - * Double as long as the resulting node has a number of -@@ -607,11 +594,9 @@ static struct rt_trie_node *resize(struc - * - */ - -- check_tnode(tn); -- - /* Keep root node larger */ - -- if (!node_parent((struct rt_trie_node *)tn)) { -+ if (!node_parent(tn)) { - inflate_threshold_use = inflate_threshold_root; - halve_threshold_use = halve_threshold_root; - } else { -@@ -637,8 +622,6 @@ static struct rt_trie_node *resize(struc - } - } - -- check_tnode(tn); -- - /* Return if at least one inflate is run */ - if (max_work != MAX_WORK) - return (struct rt_trie_node *) tn; -@@ -666,21 +649,16 @@ static struct rt_trie_node *resize(struc - - - /* Only one child remains */ -- if (tn->empty_children == tnode_child_length(tn) - 1) { -+ if (tn->empty_children == (tnode_child_length(tn) - 1)) { -+ unsigned long i; - one_child: -- for (i = 0; i < tnode_child_length(tn); i++) { -- struct rt_trie_node *n; -- -- n = rtnl_dereference(tn->child[i]); -- if (!n) -- continue; -- -- /* compress one level */ -- -- node_set_parent(n, NULL); -- tnode_free_safe(tn); -- return n; -- } -+ for (i = tnode_child_length(tn); !n && i;) -+ n = tnode_get_child(tn, --i); -+no_children: -+ /* compress one level */ -+ node_set_parent(n, NULL); -+ tnode_free_safe(tn); -+ return n; - } - return (struct rt_trie_node *) tn; - } -@@ -760,8 +738,7 @@ static struct tnode *inflate(struct trie - - /* A leaf or an internal node with skipped bits */ - -- if (IS_LEAF(node) || ((struct tnode *) node)->pos > -- tn->pos + tn->bits - 1) { -+ if (IS_LEAF(node) || (node->pos > (tn->pos + tn->bits - 1))) { - put_child(tn, - tkey_extract_bits(node->key, oldtnode->pos, oldtnode->bits + 1), - node); -@@ -958,11 +935,9 @@ fib_find_node(struct trie *t, u32 key) - pos = 0; - n = rcu_dereference_rtnl(t->trie); - -- while (n != NULL && NODE_TYPE(n) == T_TNODE) { -+ while (n && IS_TNODE(n)) { - tn = (struct tnode *) n; - -- check_tnode(tn); -- - if (tkey_sub_equals(tn->key, pos, tn->pos-pos, key)) { - pos = tn->pos + tn->bits; - n = tnode_get_child_rcu(tn, -@@ -988,7 +963,7 @@ static void trie_rebalance(struct trie * - - key = tn->key; - -- while (tn != NULL && (tp = node_parent((struct rt_trie_node *)tn)) != NULL) { -+ while (tn != NULL && (tp = node_parent(tn)) != NULL) { - cindex = tkey_extract_bits(key, tp->pos, tp->bits); - wasfull = tnode_full(tp, tnode_get_child(tp, cindex)); - tn = (struct tnode *)resize(t, tn); -@@ -996,7 +971,7 @@ static void trie_rebalance(struct trie * - tnode_put_child_reorg(tp, cindex, - (struct rt_trie_node *)tn, wasfull); - -- tp = node_parent((struct rt_trie_node *) tn); -+ tp = node_parent(tn); - if (!tp) - rcu_assign_pointer(t->trie, (struct rt_trie_node *)tn); - -@@ -1048,11 +1023,9 @@ static struct list_head *fib_insert_node - * If it doesn't, we need to replace it with a T_TNODE. - */ - -- while (n != NULL && NODE_TYPE(n) == T_TNODE) { -+ while (n && IS_TNODE(n)) { - tn = (struct tnode *) n; - -- check_tnode(tn); -- - if (tkey_sub_equals(tn->key, pos, tn->pos-pos, key)) { - tp = tn; - pos = tn->pos + tn->bits; -@@ -1087,12 +1060,11 @@ static struct list_head *fib_insert_node - insert_leaf_info(&l->list, li); - goto done; - } -- l = leaf_new(); -+ l = leaf_new(key); - - if (!l) - return NULL; - -- l->key = key; - li = leaf_info_new(plen); - - if (!li) { -@@ -1569,7 +1541,7 @@ backtrace: - if (chopped_off <= pn->bits) { - cindex &= ~(1 << (chopped_off-1)); - } else { -- struct tnode *parent = node_parent_rcu((struct rt_trie_node *) pn); -+ struct tnode *parent = node_parent_rcu(pn); - if (!parent) - goto failed; - -@@ -1597,7 +1569,7 @@ EXPORT_SYMBOL_GPL(fib_table_lookup); - */ - static void trie_leaf_remove(struct trie *t, struct leaf *l) - { -- struct tnode *tp = node_parent((struct rt_trie_node *) l); -+ struct tnode *tp = node_parent(l); - - pr_debug("entering trie_leaf_remove(%p)\n", l); - -@@ -2374,7 +2346,7 @@ static int fib_trie_seq_show(struct seq_ - - if (IS_TNODE(n)) { - struct tnode *tn = (struct tnode *) n; -- __be32 prf = htonl(mask_pfx(tn->key, tn->pos)); -+ __be32 prf = htonl(tn->key); - - seq_indent(seq, iter->depth-1); - seq_printf(seq, " +-- %pI4/%d %d %d %d\n", diff --git a/target/linux/generic/pending-3.18/080-04-fib_trie-Merge-tnode_free-and-leaf_free-into-node_fr.patch b/target/linux/generic/pending-3.18/080-04-fib_trie-Merge-tnode_free-and-leaf_free-into-node_fr.patch deleted file mode 100644 index 3f8d03067d..0000000000 --- a/target/linux/generic/pending-3.18/080-04-fib_trie-Merge-tnode_free-and-leaf_free-into-node_fr.patch +++ /dev/null @@ -1,209 +0,0 @@ -From: Alexander Duyck -Date: Wed, 31 Dec 2014 10:55:41 -0800 -Subject: [PATCH] fib_trie: Merge tnode_free and leaf_free into node_free - -Both the leaf and the tnode had an rcu_head in them, but they had them in -slightly different places. Since we now have them in the same spot and -know that any node with bits == 0 is a leaf and the rest are either vmalloc -or kmalloc tnodes depending on the value of bits it makes it easy to combine -the functions and reduce overhead. - -In addition I have taken advantage of the rcu_head pointer to go ahead and -put together a simple linked list instead of using the tnode pointer as -this way we can merge either type of structure for freeing. - -Signed-off-by: Alexander Duyck -Signed-off-by: David S. Miller ---- - ---- a/net/ipv4/fib_trie.c -+++ b/net/ipv4/fib_trie.c -@@ -95,15 +95,17 @@ struct tnode { - unsigned char bits; /* 2log(KEYLENGTH) bits needed */ - unsigned char pos; /* 2log(KEYLENGTH) bits needed */ - struct tnode __rcu *parent; -- union { -- struct rcu_head rcu; -- struct tnode *tnode_free; -- }; -+ struct rcu_head rcu; -+ /* everything above this comment must be the same as rt_trie_node */ - unsigned int full_children; /* KEYLENGTH bits needed */ - unsigned int empty_children; /* KEYLENGTH bits needed */ - struct rt_trie_node __rcu *child[0]; - }; - -+/* This struct represents the shared bits between tnode and leaf. If any -+ * ordering is changed here is must also be updated in tnode and leaf as -+ * well. -+ */ - struct rt_trie_node { - t_key key; - unsigned char bits; -@@ -118,6 +120,7 @@ struct leaf { - unsigned char pos; - struct tnode __rcu *parent; - struct rcu_head rcu; -+ /* everything above this comment must be the same as rt_trie_node */ - struct hlist_head list; - }; - -@@ -163,7 +166,7 @@ static struct rt_trie_node *resize(struc - static struct tnode *inflate(struct trie *t, struct tnode *tn); - static struct tnode *halve(struct trie *t, struct tnode *tn); - /* tnodes to free after resize(); protected by RTNL */ --static struct tnode *tnode_free_head; -+static struct callback_head *tnode_free_head; - static size_t tnode_free_size; - - /* -@@ -336,17 +339,23 @@ static inline void alias_free_mem_rcu(st - call_rcu(&fa->rcu, __alias_free_mem); - } - --static void __leaf_free_rcu(struct rcu_head *head) --{ -- struct leaf *l = container_of(head, struct leaf, rcu); -- kmem_cache_free(trie_leaf_kmem, l); --} -+#define TNODE_KMALLOC_MAX \ -+ ilog2((PAGE_SIZE - sizeof(struct tnode)) / sizeof(struct rt_trie_node *)) - --static inline void free_leaf(struct leaf *l) -+static void __node_free_rcu(struct rcu_head *head) - { -- call_rcu(&l->rcu, __leaf_free_rcu); -+ struct rt_trie_node *n = container_of(head, struct rt_trie_node, rcu); -+ -+ if (IS_LEAF(n)) -+ kmem_cache_free(trie_leaf_kmem, n); -+ else if (n->bits <= TNODE_KMALLOC_MAX) -+ kfree(n); -+ else -+ vfree(n); - } - -+#define node_free(n) call_rcu(&n->rcu, __node_free_rcu) -+ - static inline void free_leaf_info(struct leaf_info *leaf) - { - kfree_rcu(leaf, rcu); -@@ -360,43 +369,24 @@ static struct tnode *tnode_alloc(size_t - return vzalloc(size); - } - --static void __tnode_free_rcu(struct rcu_head *head) --{ -- struct tnode *tn = container_of(head, struct tnode, rcu); -- size_t size = sizeof(struct tnode) + -- (sizeof(struct rt_trie_node *) << tn->bits); -- -- if (size <= PAGE_SIZE) -- kfree(tn); -- else -- vfree(tn); --} -- --static inline void tnode_free(struct tnode *tn) --{ -- if (IS_LEAF(tn)) -- free_leaf((struct leaf *) tn); -- else -- call_rcu(&tn->rcu, __tnode_free_rcu); --} -- - static void tnode_free_safe(struct tnode *tn) - { - BUG_ON(IS_LEAF(tn)); -- tn->tnode_free = tnode_free_head; -- tnode_free_head = tn; -- tnode_free_size += sizeof(struct tnode) + -- (sizeof(struct rt_trie_node *) << tn->bits); -+ tn->rcu.next = tnode_free_head; -+ tnode_free_head = &tn->rcu; - } - - static void tnode_free_flush(void) - { -- struct tnode *tn; -+ struct callback_head *head; -+ -+ while ((head = tnode_free_head)) { -+ struct tnode *tn = container_of(head, struct tnode, rcu); -+ -+ tnode_free_head = head->next; -+ tnode_free_size += offsetof(struct tnode, child[1 << tn->bits]); - -- while ((tn = tnode_free_head)) { -- tnode_free_head = tn->tnode_free; -- tn->tnode_free = NULL; -- tnode_free(tn); -+ node_free(tn); - } - - if (tnode_free_size >= PAGE_SIZE * sync_pages) { -@@ -437,7 +427,7 @@ static struct leaf_info *leaf_info_new(i - - static struct tnode *tnode_new(t_key key, int pos, int bits) - { -- size_t sz = sizeof(struct tnode) + (sizeof(struct rt_trie_node *) << bits); -+ size_t sz = offsetof(struct tnode, child[1 << bits]); - struct tnode *tn = tnode_alloc(sz); - unsigned int shift = pos + bits; - -@@ -666,15 +656,15 @@ no_children: - - static void tnode_clean_free(struct tnode *tn) - { -+ struct rt_trie_node *tofree; - int i; -- struct tnode *tofree; - - for (i = 0; i < tnode_child_length(tn); i++) { -- tofree = (struct tnode *)rtnl_dereference(tn->child[i]); -+ tofree = rtnl_dereference(tn->child[i]); - if (tofree) -- tnode_free(tofree); -+ node_free(tofree); - } -- tnode_free(tn); -+ node_free(tn); - } - - static struct tnode *inflate(struct trie *t, struct tnode *tn) -@@ -717,7 +707,7 @@ static struct tnode *inflate(struct trie - inode->bits - 1); - - if (!right) { -- tnode_free(left); -+ node_free(left); - goto nomem; - } - -@@ -1068,7 +1058,7 @@ static struct list_head *fib_insert_node - li = leaf_info_new(plen); - - if (!li) { -- free_leaf(l); -+ node_free(l); - return NULL; - } - -@@ -1100,7 +1090,7 @@ static struct list_head *fib_insert_node - - if (!tn) { - free_leaf_info(li); -- free_leaf(l); -+ node_free(l); - return NULL; - } - -@@ -1580,7 +1570,7 @@ static void trie_leaf_remove(struct trie - } else - RCU_INIT_POINTER(t->trie, NULL); - -- free_leaf(l); -+ node_free(l); - } - - /* diff --git a/target/linux/generic/pending-3.18/080-05-fib_trie-Merge-leaf-into-tnode.patch b/target/linux/generic/pending-3.18/080-05-fib_trie-Merge-leaf-into-tnode.patch deleted file mode 100644 index a3393bf93f..0000000000 --- a/target/linux/generic/pending-3.18/080-05-fib_trie-Merge-leaf-into-tnode.patch +++ /dev/null @@ -1,928 +0,0 @@ -From: Alexander Duyck -Date: Wed, 31 Dec 2014 10:55:47 -0800 -Subject: [PATCH] fib_trie: Merge leaf into tnode - -This change makes it so that leaf and tnode are the same struct. As a -result there is no need for rt_trie_node anymore since everyting can be -merged into tnode. - -On 32b systems this results in the leaf being 4 bytes larger, however I -don't know if that is really an issue as this and an eariler patch that -added bits & pos have increased the size from 20 to 28. If I am not -mistaken slub/slab allocate on power of 2 sizes so 20 was likely being -rounded up to 32 anyway. - -Signed-off-by: Alexander Duyck -Signed-off-by: David S. Miller ---- - ---- a/net/ipv4/fib_trie.c -+++ b/net/ipv4/fib_trie.c -@@ -96,32 +96,16 @@ struct tnode { - unsigned char pos; /* 2log(KEYLENGTH) bits needed */ - struct tnode __rcu *parent; - struct rcu_head rcu; -- /* everything above this comment must be the same as rt_trie_node */ -- unsigned int full_children; /* KEYLENGTH bits needed */ -- unsigned int empty_children; /* KEYLENGTH bits needed */ -- struct rt_trie_node __rcu *child[0]; --}; -- --/* This struct represents the shared bits between tnode and leaf. If any -- * ordering is changed here is must also be updated in tnode and leaf as -- * well. -- */ --struct rt_trie_node { -- t_key key; -- unsigned char bits; -- unsigned char pos; -- struct tnode __rcu *parent; -- struct rcu_head rcu; --}; -- --struct leaf { -- t_key key; -- unsigned char bits; -- unsigned char pos; -- struct tnode __rcu *parent; -- struct rcu_head rcu; -- /* everything above this comment must be the same as rt_trie_node */ -- struct hlist_head list; -+ union { -+ /* The fields in this struct are valid if bits > 0 (TNODE) */ -+ struct { -+ unsigned int full_children; /* KEYLENGTH bits needed */ -+ unsigned int empty_children; /* KEYLENGTH bits needed */ -+ struct tnode __rcu *child[0]; -+ }; -+ /* This list pointer if valid if bits == 0 (LEAF) */ -+ struct hlist_head list; -+ }; - }; - - struct leaf_info { -@@ -154,15 +138,15 @@ struct trie_stat { - }; - - struct trie { -- struct rt_trie_node __rcu *trie; -+ struct tnode __rcu *trie; - #ifdef CONFIG_IP_FIB_TRIE_STATS - struct trie_use_stats __percpu *stats; - #endif - }; - --static void tnode_put_child_reorg(struct tnode *tn, int i, struct rt_trie_node *n, -+static void tnode_put_child_reorg(struct tnode *tn, int i, struct tnode *n, - int wasfull); --static struct rt_trie_node *resize(struct trie *t, struct tnode *tn); -+static struct tnode *resize(struct trie *t, struct tnode *tn); - static struct tnode *inflate(struct trie *t, struct tnode *tn); - static struct tnode *halve(struct trie *t, struct tnode *tn); - /* tnodes to free after resize(); protected by RTNL */ -@@ -186,10 +170,10 @@ static struct kmem_cache *trie_leaf_kmem - #define node_parent_rcu(n) rcu_dereference_rtnl((n)->parent) - - /* wrapper for rcu_assign_pointer */ --static inline void node_set_parent(struct rt_trie_node *node, struct tnode *ptr) -+static inline void node_set_parent(struct tnode *n, struct tnode *tp) - { -- if (node) -- rcu_assign_pointer(node->parent, ptr); -+ if (n) -+ rcu_assign_pointer(n->parent, tp); - } - - #define NODE_INIT_PARENT(n, p) RCU_INIT_POINTER((n)->parent, p) -@@ -205,7 +189,7 @@ static inline int tnode_child_length(con - /* - * caller must hold RTNL - */ --static inline struct rt_trie_node *tnode_get_child(const struct tnode *tn, unsigned int i) -+static inline struct tnode *tnode_get_child(const struct tnode *tn, unsigned int i) - { - BUG_ON(i >= tnode_child_length(tn)); - -@@ -215,7 +199,7 @@ static inline struct rt_trie_node *tnode - /* - * caller must hold RCU read lock or RTNL - */ --static inline struct rt_trie_node *tnode_get_child_rcu(const struct tnode *tn, unsigned int i) -+static inline struct tnode *tnode_get_child_rcu(const struct tnode *tn, unsigned int i) - { - BUG_ON(i >= tnode_child_length(tn)); - -@@ -340,11 +324,11 @@ static inline void alias_free_mem_rcu(st - } - - #define TNODE_KMALLOC_MAX \ -- ilog2((PAGE_SIZE - sizeof(struct tnode)) / sizeof(struct rt_trie_node *)) -+ ilog2((PAGE_SIZE - sizeof(struct tnode)) / sizeof(struct tnode *)) - - static void __node_free_rcu(struct rcu_head *head) - { -- struct rt_trie_node *n = container_of(head, struct rt_trie_node, rcu); -+ struct tnode *n = container_of(head, struct tnode, rcu); - - if (IS_LEAF(n)) - kmem_cache_free(trie_leaf_kmem, n); -@@ -395,9 +379,9 @@ static void tnode_free_flush(void) - } - } - --static struct leaf *leaf_new(t_key key) -+static struct tnode *leaf_new(t_key key) - { -- struct leaf *l = kmem_cache_alloc(trie_leaf_kmem, GFP_KERNEL); -+ struct tnode *l = kmem_cache_alloc(trie_leaf_kmem, GFP_KERNEL); - if (l) { - l->parent = NULL; - /* set key and pos to reflect full key value -@@ -444,7 +428,7 @@ static struct tnode *tnode_new(t_key key - } - - pr_debug("AT %p s=%zu %zu\n", tn, sizeof(struct tnode), -- sizeof(struct rt_trie_node *) << bits); -+ sizeof(struct tnode *) << bits); - return tn; - } - -@@ -453,13 +437,13 @@ static struct tnode *tnode_new(t_key key - * and no bits are skipped. See discussion in dyntree paper p. 6 - */ - --static inline int tnode_full(const struct tnode *tn, const struct rt_trie_node *n) -+static inline int tnode_full(const struct tnode *tn, const struct tnode *n) - { - return n && IS_TNODE(n) && (n->pos == (tn->pos + tn->bits)); - } - - static inline void put_child(struct tnode *tn, int i, -- struct rt_trie_node *n) -+ struct tnode *n) - { - tnode_put_child_reorg(tn, i, n, -1); - } -@@ -469,10 +453,10 @@ static inline void put_child(struct tnod - * Update the value of full_children and empty_children. - */ - --static void tnode_put_child_reorg(struct tnode *tn, int i, struct rt_trie_node *n, -+static void tnode_put_child_reorg(struct tnode *tn, int i, struct tnode *n, - int wasfull) - { -- struct rt_trie_node *chi = rtnl_dereference(tn->child[i]); -+ struct tnode *chi = rtnl_dereference(tn->child[i]); - int isfull; - - BUG_ON(i >= 1<bits); -@@ -499,10 +483,9 @@ static void tnode_put_child_reorg(struct - } - - #define MAX_WORK 10 --static struct rt_trie_node *resize(struct trie *t, struct tnode *tn) -+static struct tnode *resize(struct trie *t, struct tnode *tn) - { -- struct rt_trie_node *n = NULL; -- struct tnode *old_tn; -+ struct tnode *old_tn, *n = NULL; - int inflate_threshold_use; - int halve_threshold_use; - int max_work; -@@ -614,7 +597,7 @@ static struct rt_trie_node *resize(struc - - /* Return if at least one inflate is run */ - if (max_work != MAX_WORK) -- return (struct rt_trie_node *) tn; -+ return tn; - - /* - * Halve as long as the number of empty children in this -@@ -650,13 +633,13 @@ no_children: - tnode_free_safe(tn); - return n; - } -- return (struct rt_trie_node *) tn; -+ return tn; - } - - - static void tnode_clean_free(struct tnode *tn) - { -- struct rt_trie_node *tofree; -+ struct tnode *tofree; - int i; - - for (i = 0; i < tnode_child_length(tn); i++) { -@@ -667,10 +650,10 @@ static void tnode_clean_free(struct tnod - node_free(tn); - } - --static struct tnode *inflate(struct trie *t, struct tnode *tn) -+static struct tnode *inflate(struct trie *t, struct tnode *oldtnode) - { -- struct tnode *oldtnode = tn; -- int olen = tnode_child_length(tn); -+ int olen = tnode_child_length(oldtnode); -+ struct tnode *tn; - int i; - - pr_debug("In inflate\n"); -@@ -690,11 +673,8 @@ static struct tnode *inflate(struct trie - for (i = 0; i < olen; i++) { - struct tnode *inode; - -- inode = (struct tnode *) tnode_get_child(oldtnode, i); -- if (inode && -- IS_TNODE(inode) && -- inode->pos == oldtnode->pos + oldtnode->bits && -- inode->bits > 1) { -+ inode = tnode_get_child(oldtnode, i); -+ if (tnode_full(oldtnode, inode) && inode->bits > 1) { - struct tnode *left, *right; - t_key m = ~0U << (KEYLENGTH - 1) >> inode->pos; - -@@ -711,33 +691,29 @@ static struct tnode *inflate(struct trie - goto nomem; - } - -- put_child(tn, 2*i, (struct rt_trie_node *) left); -- put_child(tn, 2*i+1, (struct rt_trie_node *) right); -+ put_child(tn, 2*i, left); -+ put_child(tn, 2*i+1, right); - } - } - - for (i = 0; i < olen; i++) { -- struct tnode *inode; -- struct rt_trie_node *node = tnode_get_child(oldtnode, i); -+ struct tnode *inode = tnode_get_child(oldtnode, i); - struct tnode *left, *right; - int size, j; - - /* An empty child */ -- if (node == NULL) -+ if (inode == NULL) - continue; - - /* A leaf or an internal node with skipped bits */ -- -- if (IS_LEAF(node) || (node->pos > (tn->pos + tn->bits - 1))) { -+ if (!tnode_full(oldtnode, inode)) { - put_child(tn, -- tkey_extract_bits(node->key, oldtnode->pos, oldtnode->bits + 1), -- node); -+ tkey_extract_bits(inode->key, tn->pos, tn->bits), -+ inode); - continue; - } - - /* An internal node with two children */ -- inode = (struct tnode *) node; -- - if (inode->bits == 1) { - put_child(tn, 2*i, rtnl_dereference(inode->child[0])); - put_child(tn, 2*i+1, rtnl_dereference(inode->child[1])); -@@ -769,12 +745,12 @@ static struct tnode *inflate(struct trie - * bit to zero. - */ - -- left = (struct tnode *) tnode_get_child(tn, 2*i); -+ left = tnode_get_child(tn, 2*i); - put_child(tn, 2*i, NULL); - - BUG_ON(!left); - -- right = (struct tnode *) tnode_get_child(tn, 2*i+1); -+ right = tnode_get_child(tn, 2*i+1); - put_child(tn, 2*i+1, NULL); - - BUG_ON(!right); -@@ -796,12 +772,11 @@ nomem: - return ERR_PTR(-ENOMEM); - } - --static struct tnode *halve(struct trie *t, struct tnode *tn) -+static struct tnode *halve(struct trie *t, struct tnode *oldtnode) - { -- struct tnode *oldtnode = tn; -- struct rt_trie_node *left, *right; -+ int olen = tnode_child_length(oldtnode); -+ struct tnode *tn, *left, *right; - int i; -- int olen = tnode_child_length(tn); - - pr_debug("In halve\n"); - -@@ -830,7 +805,7 @@ static struct tnode *halve(struct trie * - if (!newn) - goto nomem; - -- put_child(tn, i/2, (struct rt_trie_node *)newn); -+ put_child(tn, i/2, newn); - } - - } -@@ -855,7 +830,7 @@ static struct tnode *halve(struct trie * - } - - /* Two nonempty children */ -- newBinNode = (struct tnode *) tnode_get_child(tn, i/2); -+ newBinNode = tnode_get_child(tn, i/2); - put_child(tn, i/2, NULL); - put_child(newBinNode, 0, left); - put_child(newBinNode, 1, right); -@@ -871,7 +846,7 @@ nomem: - /* readside must use rcu_read_lock currently dump routines - via get_fa_head and dump */ - --static struct leaf_info *find_leaf_info(struct leaf *l, int plen) -+static struct leaf_info *find_leaf_info(struct tnode *l, int plen) - { - struct hlist_head *head = &l->list; - struct leaf_info *li; -@@ -883,7 +858,7 @@ static struct leaf_info *find_leaf_info( - return NULL; - } - --static inline struct list_head *get_fa_head(struct leaf *l, int plen) -+static inline struct list_head *get_fa_head(struct tnode *l, int plen) - { - struct leaf_info *li = find_leaf_info(l, plen); - -@@ -915,32 +890,25 @@ static void insert_leaf_info(struct hlis - - /* rcu_read_lock needs to be hold by caller from readside */ - --static struct leaf * --fib_find_node(struct trie *t, u32 key) -+static struct tnode *fib_find_node(struct trie *t, u32 key) - { -- int pos; -- struct tnode *tn; -- struct rt_trie_node *n; -- -- pos = 0; -- n = rcu_dereference_rtnl(t->trie); -+ struct tnode *n = rcu_dereference_rtnl(t->trie); -+ int pos = 0; - - while (n && IS_TNODE(n)) { -- tn = (struct tnode *) n; -- -- if (tkey_sub_equals(tn->key, pos, tn->pos-pos, key)) { -- pos = tn->pos + tn->bits; -- n = tnode_get_child_rcu(tn, -+ if (tkey_sub_equals(n->key, pos, n->pos-pos, key)) { -+ pos = n->pos + n->bits; -+ n = tnode_get_child_rcu(n, - tkey_extract_bits(key, -- tn->pos, -- tn->bits)); -+ n->pos, -+ n->bits)); - } else - break; - } - /* Case we have found a leaf. Compare prefixes */ - - if (n != NULL && IS_LEAF(n) && tkey_equals(key, n->key)) -- return (struct leaf *)n; -+ return n; - - return NULL; - } -@@ -956,14 +924,13 @@ static void trie_rebalance(struct trie * - while (tn != NULL && (tp = node_parent(tn)) != NULL) { - cindex = tkey_extract_bits(key, tp->pos, tp->bits); - wasfull = tnode_full(tp, tnode_get_child(tp, cindex)); -- tn = (struct tnode *)resize(t, tn); -+ tn = resize(t, tn); - -- tnode_put_child_reorg(tp, cindex, -- (struct rt_trie_node *)tn, wasfull); -+ tnode_put_child_reorg(tp, cindex, tn, wasfull); - - tp = node_parent(tn); - if (!tp) -- rcu_assign_pointer(t->trie, (struct rt_trie_node *)tn); -+ rcu_assign_pointer(t->trie, tn); - - tnode_free_flush(); - if (!tp) -@@ -973,9 +940,9 @@ static void trie_rebalance(struct trie * - - /* Handle last (top) tnode */ - if (IS_TNODE(tn)) -- tn = (struct tnode *)resize(t, tn); -+ tn = resize(t, tn); - -- rcu_assign_pointer(t->trie, (struct rt_trie_node *)tn); -+ rcu_assign_pointer(t->trie, tn); - tnode_free_flush(); - } - -@@ -985,8 +952,8 @@ static struct list_head *fib_insert_node - { - int pos, newpos; - struct tnode *tp = NULL, *tn = NULL; -- struct rt_trie_node *n; -- struct leaf *l; -+ struct tnode *n; -+ struct tnode *l; - int missbit; - struct list_head *fa_head = NULL; - struct leaf_info *li; -@@ -1014,17 +981,15 @@ static struct list_head *fib_insert_node - */ - - while (n && IS_TNODE(n)) { -- tn = (struct tnode *) n; -- -- if (tkey_sub_equals(tn->key, pos, tn->pos-pos, key)) { -- tp = tn; -- pos = tn->pos + tn->bits; -- n = tnode_get_child(tn, -+ if (tkey_sub_equals(n->key, pos, n->pos-pos, key)) { -+ tp = n; -+ pos = n->pos + n->bits; -+ n = tnode_get_child(n, - tkey_extract_bits(key, -- tn->pos, -- tn->bits)); -+ n->pos, -+ n->bits)); - -- BUG_ON(n && node_parent(n) != tn); -+ BUG_ON(n && node_parent(n) != tp); - } else - break; - } -@@ -1040,14 +1005,13 @@ static struct list_head *fib_insert_node - /* Case 1: n is a leaf. Compare prefixes */ - - if (n != NULL && IS_LEAF(n) && tkey_equals(key, n->key)) { -- l = (struct leaf *) n; - li = leaf_info_new(plen); - - if (!li) - return NULL; - - fa_head = &li->falh; -- insert_leaf_info(&l->list, li); -+ insert_leaf_info(&n->list, li); - goto done; - } - l = leaf_new(key); -@@ -1068,10 +1032,10 @@ static struct list_head *fib_insert_node - if (t->trie && n == NULL) { - /* Case 2: n is NULL, and will just insert a new leaf */ - -- node_set_parent((struct rt_trie_node *)l, tp); -+ node_set_parent(l, tp); - - cindex = tkey_extract_bits(key, tp->pos, tp->bits); -- put_child(tp, cindex, (struct rt_trie_node *)l); -+ put_child(tp, cindex, l); - } else { - /* Case 3: n is a LEAF or a TNODE and the key doesn't match. */ - /* -@@ -1094,17 +1058,17 @@ static struct list_head *fib_insert_node - return NULL; - } - -- node_set_parent((struct rt_trie_node *)tn, tp); -+ node_set_parent(tn, tp); - - missbit = tkey_extract_bits(key, newpos, 1); -- put_child(tn, missbit, (struct rt_trie_node *)l); -+ put_child(tn, missbit, l); - put_child(tn, 1-missbit, n); - - if (tp) { - cindex = tkey_extract_bits(key, tp->pos, tp->bits); -- put_child(tp, cindex, (struct rt_trie_node *)tn); -+ put_child(tp, cindex, tn); - } else { -- rcu_assign_pointer(t->trie, (struct rt_trie_node *)tn); -+ rcu_assign_pointer(t->trie, tn); - } - - tp = tn; -@@ -1134,7 +1098,7 @@ int fib_table_insert(struct fib_table *t - u8 tos = cfg->fc_tos; - u32 key, mask; - int err; -- struct leaf *l; -+ struct tnode *l; - - if (plen > 32) - return -EINVAL; -@@ -1292,7 +1256,7 @@ err: - } - - /* should be called with rcu_read_lock */ --static int check_leaf(struct fib_table *tb, struct trie *t, struct leaf *l, -+static int check_leaf(struct fib_table *tb, struct trie *t, struct tnode *l, - t_key key, const struct flowi4 *flp, - struct fib_result *res, int fib_flags) - { -@@ -1365,7 +1329,7 @@ int fib_table_lookup(struct fib_table *t - struct trie_use_stats __percpu *stats = t->stats; - #endif - int ret; -- struct rt_trie_node *n; -+ struct tnode *n; - struct tnode *pn; - unsigned int pos, bits; - t_key key = ntohl(flp->daddr); -@@ -1387,11 +1351,11 @@ int fib_table_lookup(struct fib_table *t - - /* Just a leaf? */ - if (IS_LEAF(n)) { -- ret = check_leaf(tb, t, (struct leaf *)n, key, flp, res, fib_flags); -+ ret = check_leaf(tb, t, n, key, flp, res, fib_flags); - goto found; - } - -- pn = (struct tnode *) n; -+ pn = n; - chopped_off = 0; - - while (pn) { -@@ -1412,13 +1376,13 @@ int fib_table_lookup(struct fib_table *t - } - - if (IS_LEAF(n)) { -- ret = check_leaf(tb, t, (struct leaf *)n, key, flp, res, fib_flags); -+ ret = check_leaf(tb, t, n, key, flp, res, fib_flags); - if (ret > 0) - goto backtrace; - goto found; - } - -- cn = (struct tnode *)n; -+ cn = n; - - /* - * It's a tnode, and we can do some extra checks here if we -@@ -1506,7 +1470,7 @@ int fib_table_lookup(struct fib_table *t - current_prefix_length = mp; - } - -- pn = (struct tnode *)n; /* Descend */ -+ pn = n; /* Descend */ - chopped_off = 0; - continue; - -@@ -1557,7 +1521,7 @@ EXPORT_SYMBOL_GPL(fib_table_lookup); - /* - * Remove the leaf and return parent. - */ --static void trie_leaf_remove(struct trie *t, struct leaf *l) -+static void trie_leaf_remove(struct trie *t, struct tnode *l) - { - struct tnode *tp = node_parent(l); - -@@ -1584,7 +1548,7 @@ int fib_table_delete(struct fib_table *t - u8 tos = cfg->fc_tos; - struct fib_alias *fa, *fa_to_delete; - struct list_head *fa_head; -- struct leaf *l; -+ struct tnode *l; - struct leaf_info *li; - - if (plen > 32) -@@ -1682,7 +1646,7 @@ static int trie_flush_list(struct list_h - return found; - } - --static int trie_flush_leaf(struct leaf *l) -+static int trie_flush_leaf(struct tnode *l) - { - int found = 0; - struct hlist_head *lih = &l->list; -@@ -1704,7 +1668,7 @@ static int trie_flush_leaf(struct leaf * - * Scan for the next right leaf starting at node p->child[idx] - * Since we have back pointer, no recursion necessary. - */ --static struct leaf *leaf_walk_rcu(struct tnode *p, struct rt_trie_node *c) -+static struct tnode *leaf_walk_rcu(struct tnode *p, struct tnode *c) - { - do { - t_key idx; -@@ -1720,47 +1684,46 @@ static struct leaf *leaf_walk_rcu(struct - continue; - - if (IS_LEAF(c)) -- return (struct leaf *) c; -+ return c; - - /* Rescan start scanning in new node */ -- p = (struct tnode *) c; -+ p = c; - idx = 0; - } - - /* Node empty, walk back up to parent */ -- c = (struct rt_trie_node *) p; -+ c = p; - } while ((p = node_parent_rcu(c)) != NULL); - - return NULL; /* Root of trie */ - } - --static struct leaf *trie_firstleaf(struct trie *t) -+static struct tnode *trie_firstleaf(struct trie *t) - { -- struct tnode *n = (struct tnode *)rcu_dereference_rtnl(t->trie); -+ struct tnode *n = rcu_dereference_rtnl(t->trie); - - if (!n) - return NULL; - - if (IS_LEAF(n)) /* trie is just a leaf */ -- return (struct leaf *) n; -+ return n; - - return leaf_walk_rcu(n, NULL); - } - --static struct leaf *trie_nextleaf(struct leaf *l) -+static struct tnode *trie_nextleaf(struct tnode *l) - { -- struct rt_trie_node *c = (struct rt_trie_node *) l; -- struct tnode *p = node_parent_rcu(c); -+ struct tnode *p = node_parent_rcu(l); - - if (!p) - return NULL; /* trie with just one leaf */ - -- return leaf_walk_rcu(p, c); -+ return leaf_walk_rcu(p, l); - } - --static struct leaf *trie_leafindex(struct trie *t, int index) -+static struct tnode *trie_leafindex(struct trie *t, int index) - { -- struct leaf *l = trie_firstleaf(t); -+ struct tnode *l = trie_firstleaf(t); - - while (l && index-- > 0) - l = trie_nextleaf(l); -@@ -1775,7 +1738,7 @@ static struct leaf *trie_leafindex(struc - int fib_table_flush(struct fib_table *tb) - { - struct trie *t = (struct trie *) tb->tb_data; -- struct leaf *l, *ll = NULL; -+ struct tnode *l, *ll = NULL; - int found = 0; - - for (l = trie_firstleaf(t); l; l = trie_nextleaf(l)) { -@@ -1840,7 +1803,7 @@ static int fn_trie_dump_fa(t_key key, in - return skb->len; - } - --static int fn_trie_dump_leaf(struct leaf *l, struct fib_table *tb, -+static int fn_trie_dump_leaf(struct tnode *l, struct fib_table *tb, - struct sk_buff *skb, struct netlink_callback *cb) - { - struct leaf_info *li; -@@ -1876,7 +1839,7 @@ static int fn_trie_dump_leaf(struct leaf - int fib_table_dump(struct fib_table *tb, struct sk_buff *skb, - struct netlink_callback *cb) - { -- struct leaf *l; -+ struct tnode *l; - struct trie *t = (struct trie *) tb->tb_data; - t_key key = cb->args[2]; - int count = cb->args[3]; -@@ -1922,7 +1885,7 @@ void __init fib_trie_init(void) - 0, SLAB_PANIC, NULL); - - trie_leaf_kmem = kmem_cache_create("ip_fib_trie", -- max(sizeof(struct leaf), -+ max(sizeof(struct tnode), - sizeof(struct leaf_info)), - 0, SLAB_PANIC, NULL); - } -@@ -1965,7 +1928,7 @@ struct fib_trie_iter { - unsigned int depth; - }; - --static struct rt_trie_node *fib_trie_get_next(struct fib_trie_iter *iter) -+static struct tnode *fib_trie_get_next(struct fib_trie_iter *iter) - { - struct tnode *tn = iter->tnode; - unsigned int cindex = iter->index; -@@ -1979,7 +1942,7 @@ static struct rt_trie_node *fib_trie_get - iter->tnode, iter->index, iter->depth); - rescan: - while (cindex < (1<bits)) { -- struct rt_trie_node *n = tnode_get_child_rcu(tn, cindex); -+ struct tnode *n = tnode_get_child_rcu(tn, cindex); - - if (n) { - if (IS_LEAF(n)) { -@@ -1987,7 +1950,7 @@ rescan: - iter->index = cindex + 1; - } else { - /* push down one level */ -- iter->tnode = (struct tnode *) n; -+ iter->tnode = n; - iter->index = 0; - ++iter->depth; - } -@@ -1998,7 +1961,7 @@ rescan: - } - - /* Current node exhausted, pop back up */ -- p = node_parent_rcu((struct rt_trie_node *)tn); -+ p = node_parent_rcu(tn); - if (p) { - cindex = tkey_extract_bits(tn->key, p->pos, p->bits)+1; - tn = p; -@@ -2010,10 +1973,10 @@ rescan: - return NULL; - } - --static struct rt_trie_node *fib_trie_get_first(struct fib_trie_iter *iter, -+static struct tnode *fib_trie_get_first(struct fib_trie_iter *iter, - struct trie *t) - { -- struct rt_trie_node *n; -+ struct tnode *n; - - if (!t) - return NULL; -@@ -2023,7 +1986,7 @@ static struct rt_trie_node *fib_trie_get - return NULL; - - if (IS_TNODE(n)) { -- iter->tnode = (struct tnode *) n; -+ iter->tnode = n; - iter->index = 0; - iter->depth = 1; - } else { -@@ -2037,7 +2000,7 @@ static struct rt_trie_node *fib_trie_get - - static void trie_collect_stats(struct trie *t, struct trie_stat *s) - { -- struct rt_trie_node *n; -+ struct tnode *n; - struct fib_trie_iter iter; - - memset(s, 0, sizeof(*s)); -@@ -2045,7 +2008,6 @@ static void trie_collect_stats(struct tr - rcu_read_lock(); - for (n = fib_trie_get_first(&iter, t); n; n = fib_trie_get_next(&iter)) { - if (IS_LEAF(n)) { -- struct leaf *l = (struct leaf *)n; - struct leaf_info *li; - - s->leaves++; -@@ -2053,18 +2015,17 @@ static void trie_collect_stats(struct tr - if (iter.depth > s->maxdepth) - s->maxdepth = iter.depth; - -- hlist_for_each_entry_rcu(li, &l->list, hlist) -+ hlist_for_each_entry_rcu(li, &n->list, hlist) - ++s->prefixes; - } else { -- const struct tnode *tn = (const struct tnode *) n; - int i; - - s->tnodes++; -- if (tn->bits < MAX_STAT_DEPTH) -- s->nodesizes[tn->bits]++; -+ if (n->bits < MAX_STAT_DEPTH) -+ s->nodesizes[n->bits]++; - -- for (i = 0; i < (1<bits); i++) -- if (!tn->child[i]) -+ for (i = 0; i < tnode_child_length(n); i++) -+ if (!rcu_access_pointer(n->child[i])) - s->nullpointers++; - } - } -@@ -2088,7 +2049,7 @@ static void trie_show_stats(struct seq_f - seq_printf(seq, "\tMax depth: %u\n", stat->maxdepth); - - seq_printf(seq, "\tLeaves: %u\n", stat->leaves); -- bytes = sizeof(struct leaf) * stat->leaves; -+ bytes = sizeof(struct tnode) * stat->leaves; - - seq_printf(seq, "\tPrefixes: %u\n", stat->prefixes); - bytes += sizeof(struct leaf_info) * stat->prefixes; -@@ -2109,7 +2070,7 @@ static void trie_show_stats(struct seq_f - seq_putc(seq, '\n'); - seq_printf(seq, "\tPointers: %u\n", pointers); - -- bytes += sizeof(struct rt_trie_node *) * pointers; -+ bytes += sizeof(struct tnode *) * pointers; - seq_printf(seq, "Null ptrs: %u\n", stat->nullpointers); - seq_printf(seq, "Total size: %u kB\n", (bytes + 1023) / 1024); - } -@@ -2163,7 +2124,7 @@ static int fib_triestat_seq_show(struct - seq_printf(seq, - "Basic info: size of leaf:" - " %Zd bytes, size of tnode: %Zd bytes.\n", -- sizeof(struct leaf), sizeof(struct tnode)); -+ sizeof(struct tnode), sizeof(struct tnode)); - - for (h = 0; h < FIB_TABLE_HASHSZ; h++) { - struct hlist_head *head = &net->ipv4.fib_table_hash[h]; -@@ -2202,7 +2163,7 @@ static const struct file_operations fib_ - .release = single_release_net, - }; - --static struct rt_trie_node *fib_trie_get_idx(struct seq_file *seq, loff_t pos) -+static struct tnode *fib_trie_get_idx(struct seq_file *seq, loff_t pos) - { - struct fib_trie_iter *iter = seq->private; - struct net *net = seq_file_net(seq); -@@ -2214,7 +2175,7 @@ static struct rt_trie_node *fib_trie_get - struct fib_table *tb; - - hlist_for_each_entry_rcu(tb, head, tb_hlist) { -- struct rt_trie_node *n; -+ struct tnode *n; - - for (n = fib_trie_get_first(iter, - (struct trie *) tb->tb_data); -@@ -2243,7 +2204,7 @@ static void *fib_trie_seq_next(struct se - struct fib_table *tb = iter->tb; - struct hlist_node *tb_node; - unsigned int h; -- struct rt_trie_node *n; -+ struct tnode *n; - - ++*pos; - /* next node in same table */ -@@ -2329,29 +2290,26 @@ static inline const char *rtn_type(char - static int fib_trie_seq_show(struct seq_file *seq, void *v) - { - const struct fib_trie_iter *iter = seq->private; -- struct rt_trie_node *n = v; -+ struct tnode *n = v; - - if (!node_parent_rcu(n)) - fib_table_print(seq, iter->tb); - - if (IS_TNODE(n)) { -- struct tnode *tn = (struct tnode *) n; -- __be32 prf = htonl(tn->key); -+ __be32 prf = htonl(n->key); - -- seq_indent(seq, iter->depth-1); -+ seq_indent(seq, iter->depth - 1); - seq_printf(seq, " +-- %pI4/%d %d %d %d\n", -- &prf, tn->pos, tn->bits, tn->full_children, -- tn->empty_children); -- -+ &prf, n->pos, n->bits, n->full_children, -+ n->empty_children); - } else { -- struct leaf *l = (struct leaf *) n; - struct leaf_info *li; -- __be32 val = htonl(l->key); -+ __be32 val = htonl(n->key); - - seq_indent(seq, iter->depth); - seq_printf(seq, " |-- %pI4\n", &val); - -- hlist_for_each_entry_rcu(li, &l->list, hlist) { -+ hlist_for_each_entry_rcu(li, &n->list, hlist) { - struct fib_alias *fa; - - list_for_each_entry_rcu(fa, &li->falh, fa_list) { -@@ -2401,9 +2359,9 @@ struct fib_route_iter { - t_key key; - }; - --static struct leaf *fib_route_get_idx(struct fib_route_iter *iter, loff_t pos) -+static struct tnode *fib_route_get_idx(struct fib_route_iter *iter, loff_t pos) - { -- struct leaf *l = NULL; -+ struct tnode *l = NULL; - struct trie *t = iter->main_trie; - - /* use cache location of last found key */ -@@ -2448,7 +2406,7 @@ static void *fib_route_seq_start(struct - static void *fib_route_seq_next(struct seq_file *seq, void *v, loff_t *pos) - { - struct fib_route_iter *iter = seq->private; -- struct leaf *l = v; -+ struct tnode *l = v; - - ++*pos; - if (v == SEQ_START_TOKEN) { -@@ -2494,7 +2452,7 @@ static unsigned int fib_flag_trans(int t - */ - static int fib_route_seq_show(struct seq_file *seq, void *v) - { -- struct leaf *l = v; -+ struct tnode *l = v; - struct leaf_info *li; - - if (v == SEQ_START_TOKEN) { diff --git a/target/linux/generic/pending-3.18/080-06-fib_trie-Optimize-fib_table_lookup-to-avoid-wasting-.patch b/target/linux/generic/pending-3.18/080-06-fib_trie-Optimize-fib_table_lookup-to-avoid-wasting-.patch deleted file mode 100644 index e84412687d..0000000000 --- a/target/linux/generic/pending-3.18/080-06-fib_trie-Optimize-fib_table_lookup-to-avoid-wasting-.patch +++ /dev/null @@ -1,343 +0,0 @@ -From: Alexander Duyck -Date: Wed, 31 Dec 2014 10:55:54 -0800 -Subject: [PATCH] fib_trie: Optimize fib_table_lookup to avoid wasting - time on loops/variables - -This patch is meant to reduce the complexity of fib_table_lookup by reducing -the number of variables to the bare minimum while still keeping the same if -not improved functionality versus the original. - -Most of this change was started off by the desire to rid the function of -chopped_off and current_prefix_length as they actually added very little to -the function since they only applied when computing the cindex. I was able -to replace them mostly with just a check for the prefix match. As long as -the prefix between the key and the node being tested was the same we know -we can search the tnode fully versus just testing cindex 0. - -The second portion of the change ended up being a massive reordering. -Originally the calls to check_leaf were up near the start of the loop, and -the backtracing and descending into lower levels of tnodes was later. This -didn't make much sense as the structure of the tree means the leaves are -always the last thing to be tested. As such I reordered things so that we -instead have a loop that will delve into the tree and only exit when we -have either found a leaf or we have exhausted the tree. The advantage of -rearranging things like this is that we can fully inline check_leaf since -there is now only one reference to it in the function. - -Signed-off-by: Alexander Duyck -Signed-off-by: David S. Miller ---- - ---- a/net/ipv4/fib_trie.c -+++ b/net/ipv4/fib_trie.c -@@ -90,6 +90,9 @@ typedef unsigned int t_key; - #define IS_TNODE(n) ((n)->bits) - #define IS_LEAF(n) (!(n)->bits) - -+#define get_shift(_kv) (KEYLENGTH - (_kv)->pos - (_kv)->bits) -+#define get_index(_key, _kv) (((_key) ^ (_kv)->key) >> get_shift(_kv)) -+ - struct tnode { - t_key key; - unsigned char bits; /* 2log(KEYLENGTH) bits needed */ -@@ -1281,7 +1284,7 @@ static int check_leaf(struct fib_table * - continue; - fib_alias_accessed(fa); - err = fib_props[fa->fa_type].error; -- if (err) { -+ if (unlikely(err < 0)) { - #ifdef CONFIG_IP_FIB_TRIE_STATS - this_cpu_inc(t->stats->semantic_match_passed); - #endif -@@ -1303,7 +1306,7 @@ static int check_leaf(struct fib_table * - res->prefixlen = li->plen; - res->nh_sel = nhsel; - res->type = fa->fa_type; -- res->scope = fa->fa_info->fib_scope; -+ res->scope = fi->fib_scope; - res->fi = fi; - res->table = tb; - res->fa_head = &li->falh; -@@ -1321,23 +1324,24 @@ static int check_leaf(struct fib_table * - return 1; - } - -+static inline t_key prefix_mismatch(t_key key, struct tnode *n) -+{ -+ t_key prefix = n->key; -+ -+ return (key ^ prefix) & (prefix | -prefix); -+} -+ - int fib_table_lookup(struct fib_table *tb, const struct flowi4 *flp, - struct fib_result *res, int fib_flags) - { -- struct trie *t = (struct trie *) tb->tb_data; -+ struct trie *t = (struct trie *)tb->tb_data; - #ifdef CONFIG_IP_FIB_TRIE_STATS - struct trie_use_stats __percpu *stats = t->stats; - #endif -- int ret; -- struct tnode *n; -- struct tnode *pn; -- unsigned int pos, bits; -- t_key key = ntohl(flp->daddr); -- unsigned int chopped_off; -- t_key cindex = 0; -- unsigned int current_prefix_length = KEYLENGTH; -- struct tnode *cn; -- t_key pref_mismatch; -+ const t_key key = ntohl(flp->daddr); -+ struct tnode *n, *pn; -+ t_key cindex; -+ int ret = 1; - - rcu_read_lock(); - -@@ -1349,170 +1353,102 @@ int fib_table_lookup(struct fib_table *t - this_cpu_inc(stats->gets); - #endif - -- /* Just a leaf? */ -- if (IS_LEAF(n)) { -- ret = check_leaf(tb, t, n, key, flp, res, fib_flags); -- goto found; -- } -- - pn = n; -- chopped_off = 0; -- -- while (pn) { -- pos = pn->pos; -- bits = pn->bits; -+ cindex = 0; - -- if (!chopped_off) -- cindex = tkey_extract_bits(mask_pfx(key, current_prefix_length), -- pos, bits); -- -- n = tnode_get_child_rcu(pn, cindex); -- -- if (n == NULL) { --#ifdef CONFIG_IP_FIB_TRIE_STATS -- this_cpu_inc(stats->null_node_hit); --#endif -- goto backtrace; -- } -+ /* Step 1: Travel to the longest prefix match in the trie */ -+ for (;;) { -+ unsigned long index = get_index(key, n); -+ -+ /* This bit of code is a bit tricky but it combines multiple -+ * checks into a single check. The prefix consists of the -+ * prefix plus zeros for the "bits" in the prefix. The index -+ * is the difference between the key and this value. From -+ * this we can actually derive several pieces of data. -+ * if !(index >> bits) -+ * we know the value is child index -+ * else -+ * we have a mismatch in skip bits and failed -+ */ -+ if (index >> n->bits) -+ break; - -- if (IS_LEAF(n)) { -- ret = check_leaf(tb, t, n, key, flp, res, fib_flags); -- if (ret > 0) -- goto backtrace; -+ /* we have found a leaf. Prefixes have already been compared */ -+ if (IS_LEAF(n)) - goto found; -- } -- -- cn = n; - -- /* -- * It's a tnode, and we can do some extra checks here if we -- * like, to avoid descending into a dead-end branch. -- * This tnode is in the parent's child array at index -- * key[p_pos..p_pos+p_bits] but potentially with some bits -- * chopped off, so in reality the index may be just a -- * subprefix, padded with zero at the end. -- * We can also take a look at any skipped bits in this -- * tnode - everything up to p_pos is supposed to be ok, -- * and the non-chopped bits of the index (se previous -- * paragraph) are also guaranteed ok, but the rest is -- * considered unknown. -- * -- * The skipped bits are key[pos+bits..cn->pos]. -- */ -- -- /* If current_prefix_length < pos+bits, we are already doing -- * actual prefix matching, which means everything from -- * pos+(bits-chopped_off) onward must be zero along some -- * branch of this subtree - otherwise there is *no* valid -- * prefix present. Here we can only check the skipped -- * bits. Remember, since we have already indexed into the -- * parent's child array, we know that the bits we chopped of -- * *are* zero. -+ /* only record pn and cindex if we are going to be chopping -+ * bits later. Otherwise we are just wasting cycles. - */ -- -- /* NOTA BENE: Checking only skipped bits -- for the new node here */ -- -- if (current_prefix_length < pos+bits) { -- if (tkey_extract_bits(cn->key, current_prefix_length, -- cn->pos - current_prefix_length) -- || !(cn->child[0])) -- goto backtrace; -+ if (index) { -+ pn = n; -+ cindex = index; - } - -- /* -- * If chopped_off=0, the index is fully validated and we -- * only need to look at the skipped bits for this, the new, -- * tnode. What we actually want to do is to find out if -- * these skipped bits match our key perfectly, or if we will -- * have to count on finding a matching prefix further down, -- * because if we do, we would like to have some way of -- * verifying the existence of such a prefix at this point. -- */ -- -- /* The only thing we can do at this point is to verify that -- * any such matching prefix can indeed be a prefix to our -- * key, and if the bits in the node we are inspecting that -- * do not match our key are not ZERO, this cannot be true. -- * Thus, find out where there is a mismatch (before cn->pos) -- * and verify that all the mismatching bits are zero in the -- * new tnode's key. -- */ -+ n = rcu_dereference(n->child[index]); -+ if (unlikely(!n)) -+ goto backtrace; -+ } - -- /* -- * Note: We aren't very concerned about the piece of -- * the key that precede pn->pos+pn->bits, since these -- * have already been checked. The bits after cn->pos -- * aren't checked since these are by definition -- * "unknown" at this point. Thus, what we want to see -- * is if we are about to enter the "prefix matching" -- * state, and in that case verify that the skipped -- * bits that will prevail throughout this subtree are -- * zero, as they have to be if we are to find a -- * matching prefix. -+ /* Step 2: Sort out leaves and begin backtracing for longest prefix */ -+ for (;;) { -+ /* record the pointer where our next node pointer is stored */ -+ struct tnode __rcu **cptr = n->child; -+ -+ /* This test verifies that none of the bits that differ -+ * between the key and the prefix exist in the region of -+ * the lsb and higher in the prefix. - */ -+ if (unlikely(prefix_mismatch(key, n))) -+ goto backtrace; - -- pref_mismatch = mask_pfx(cn->key ^ key, cn->pos); -+ /* exit out and process leaf */ -+ if (unlikely(IS_LEAF(n))) -+ break; - -- /* -- * In short: If skipped bits in this node do not match -- * the search key, enter the "prefix matching" -- * state.directly. -+ /* Don't bother recording parent info. Since we are in -+ * prefix match mode we will have to come back to wherever -+ * we started this traversal anyway - */ -- if (pref_mismatch) { -- /* fls(x) = __fls(x) + 1 */ -- int mp = KEYLENGTH - __fls(pref_mismatch) - 1; -- -- if (tkey_extract_bits(cn->key, mp, cn->pos - mp) != 0) -- goto backtrace; -- -- if (current_prefix_length >= cn->pos) -- current_prefix_length = mp; -- } -- -- pn = n; /* Descend */ -- chopped_off = 0; -- continue; - -+ while ((n = rcu_dereference(*cptr)) == NULL) { - backtrace: -- chopped_off++; -- -- /* As zero don't change the child key (cindex) */ -- while ((chopped_off <= pn->bits) -- && !(cindex & (1<<(chopped_off-1)))) -- chopped_off++; -- -- /* Decrease current_... with bits chopped off */ -- if (current_prefix_length > pn->pos + pn->bits - chopped_off) -- current_prefix_length = pn->pos + pn->bits -- - chopped_off; -- -- /* -- * Either we do the actual chop off according or if we have -- * chopped off all bits in this tnode walk up to our parent. -- */ -- -- if (chopped_off <= pn->bits) { -- cindex &= ~(1 << (chopped_off-1)); -- } else { -- struct tnode *parent = node_parent_rcu(pn); -- if (!parent) -- goto failed; -- -- /* Get Child's index */ -- cindex = tkey_extract_bits(pn->key, parent->pos, parent->bits); -- pn = parent; -- chopped_off = 0; -- - #ifdef CONFIG_IP_FIB_TRIE_STATS -- this_cpu_inc(stats->backtrack); -+ if (!n) -+ this_cpu_inc(stats->null_node_hit); - #endif -- goto backtrace; -+ /* If we are at cindex 0 there are no more bits for -+ * us to strip at this level so we must ascend back -+ * up one level to see if there are any more bits to -+ * be stripped there. -+ */ -+ while (!cindex) { -+ t_key pkey = pn->key; -+ -+ pn = node_parent_rcu(pn); -+ if (unlikely(!pn)) -+ goto failed; -+#ifdef CONFIG_IP_FIB_TRIE_STATS -+ this_cpu_inc(stats->backtrack); -+#endif -+ /* Get Child's index */ -+ cindex = get_index(pkey, pn); -+ } -+ -+ /* strip the least significant bit from the cindex */ -+ cindex &= cindex - 1; -+ -+ /* grab pointer for next child node */ -+ cptr = &pn->child[cindex]; - } - } --failed: -- ret = 1; -+ - found: -+ /* Step 3: Process the leaf, if that fails fall back to backtracing */ -+ ret = check_leaf(tb, t, n, key, flp, res, fib_flags); -+ if (unlikely(ret > 0)) -+ goto backtrace; -+failed: - rcu_read_unlock(); - return ret; - } diff --git a/target/linux/generic/pending-3.18/080-07-fib_trie-Optimize-fib_find_node.patch b/target/linux/generic/pending-3.18/080-07-fib_trie-Optimize-fib_find_node.patch deleted file mode 100644 index 0193f758f6..0000000000 --- a/target/linux/generic/pending-3.18/080-07-fib_trie-Optimize-fib_find_node.patch +++ /dev/null @@ -1,64 +0,0 @@ -From: Alexander Duyck -Date: Wed, 31 Dec 2014 10:56:00 -0800 -Subject: [PATCH] fib_trie: Optimize fib_find_node - -This patch makes use of the same features I made use of for -fib_table_lookup to streamline fib_find_node. The resultant code should be -smaller and run faster than the original. - -Signed-off-by: Alexander Duyck -Signed-off-by: David S. Miller ---- - ---- a/net/ipv4/fib_trie.c -+++ b/net/ipv4/fib_trie.c -@@ -892,28 +892,34 @@ static void insert_leaf_info(struct hlis - } - - /* rcu_read_lock needs to be hold by caller from readside */ -- - static struct tnode *fib_find_node(struct trie *t, u32 key) - { - struct tnode *n = rcu_dereference_rtnl(t->trie); -- int pos = 0; - -- while (n && IS_TNODE(n)) { -- if (tkey_sub_equals(n->key, pos, n->pos-pos, key)) { -- pos = n->pos + n->bits; -- n = tnode_get_child_rcu(n, -- tkey_extract_bits(key, -- n->pos, -- n->bits)); -- } else -+ while (n) { -+ unsigned long index = get_index(key, n); -+ -+ /* This bit of code is a bit tricky but it combines multiple -+ * checks into a single check. The prefix consists of the -+ * prefix plus zeros for the bits in the cindex. The index -+ * is the difference between the key and this value. From -+ * this we can actually derive several pieces of data. -+ * if !(index >> bits) -+ * we know the value is cindex -+ * else -+ * we have a mismatch in skip bits and failed -+ */ -+ if (index >> n->bits) -+ return NULL; -+ -+ /* we have found a leaf. Prefixes have already been compared */ -+ if (IS_LEAF(n)) - break; -- } -- /* Case we have found a leaf. Compare prefixes */ - -- if (n != NULL && IS_LEAF(n) && tkey_equals(key, n->key)) -- return n; -+ n = rcu_dereference_rtnl(n->child[index]); -+ } - -- return NULL; -+ return n; - } - - static void trie_rebalance(struct trie *t, struct tnode *tn) diff --git a/target/linux/generic/pending-3.18/080-08-fib_trie-Optimize-fib_table_insert.patch b/target/linux/generic/pending-3.18/080-08-fib_trie-Optimize-fib_table_insert.patch deleted file mode 100644 index b328d2c5d2..0000000000 --- a/target/linux/generic/pending-3.18/080-08-fib_trie-Optimize-fib_table_insert.patch +++ /dev/null @@ -1,276 +0,0 @@ -From: Alexander Duyck -Date: Wed, 31 Dec 2014 10:56:06 -0800 -Subject: [PATCH] fib_trie: Optimize fib_table_insert - -This patch updates the fib_table_insert function to take advantage of the -changes made to improve the performance of fib_table_lookup. As a result -the code should be smaller and run faster then the original. - -Signed-off-by: Alexander Duyck -Signed-off-by: David S. Miller ---- - ---- a/net/ipv4/fib_trie.c -+++ b/net/ipv4/fib_trie.c -@@ -222,31 +222,6 @@ static inline t_key tkey_extract_bits(t_ - return 0; - } - --static inline int tkey_equals(t_key a, t_key b) --{ -- return a == b; --} -- --static inline int tkey_sub_equals(t_key a, int offset, int bits, t_key b) --{ -- if (bits == 0 || offset >= KEYLENGTH) -- return 1; -- bits = bits > KEYLENGTH ? KEYLENGTH : bits; -- return ((a ^ b) << offset) >> (KEYLENGTH - bits) == 0; --} -- --static inline int tkey_mismatch(t_key a, int offset, t_key b) --{ -- t_key diff = a ^ b; -- int i = offset; -- -- if (!diff) -- return 0; -- while ((diff << i) >> (KEYLENGTH-1) == 0) -- i++; -- return i; --} -- - /* - To understand this stuff, an understanding of keys and all their bits is - necessary. Every node in the trie has a key associated with it, but not -@@ -485,6 +460,15 @@ static void tnode_put_child_reorg(struct - rcu_assign_pointer(tn->child[i], n); - } - -+static void put_child_root(struct tnode *tp, struct trie *t, -+ t_key key, struct tnode *n) -+{ -+ if (tp) -+ put_child(tp, get_index(key, tp), n); -+ else -+ rcu_assign_pointer(t->trie, n); -+} -+ - #define MAX_WORK 10 - static struct tnode *resize(struct trie *t, struct tnode *tn) - { -@@ -959,138 +943,100 @@ static void trie_rebalance(struct trie * - - static struct list_head *fib_insert_node(struct trie *t, u32 key, int plen) - { -- int pos, newpos; -- struct tnode *tp = NULL, *tn = NULL; -- struct tnode *n; -- struct tnode *l; -- int missbit; - struct list_head *fa_head = NULL; -+ struct tnode *l, *n, *tp = NULL; - struct leaf_info *li; -- t_key cindex; - -- pos = 0; -+ li = leaf_info_new(plen); -+ if (!li) -+ return NULL; -+ fa_head = &li->falh; -+ - n = rtnl_dereference(t->trie); - - /* If we point to NULL, stop. Either the tree is empty and we should - * just put a new leaf in if, or we have reached an empty child slot, - * and we should just put our new leaf in that. -- * If we point to a T_TNODE, check if it matches our key. Note that -- * a T_TNODE might be skipping any number of bits - its 'pos' need -- * not be the parent's 'pos'+'bits'! -- * -- * If it does match the current key, get pos/bits from it, extract -- * the index from our key, push the T_TNODE and walk the tree. -- * -- * If it doesn't, we have to replace it with a new T_TNODE. - * -- * If we point to a T_LEAF, it might or might not have the same key -- * as we do. If it does, just change the value, update the T_LEAF's -- * value, and return it. -- * If it doesn't, we need to replace it with a T_TNODE. -+ * If we hit a node with a key that does't match then we should stop -+ * and create a new tnode to replace that node and insert ourselves -+ * and the other node into the new tnode. - */ -+ while (n) { -+ unsigned long index = get_index(key, n); - -- while (n && IS_TNODE(n)) { -- if (tkey_sub_equals(n->key, pos, n->pos-pos, key)) { -- tp = n; -- pos = n->pos + n->bits; -- n = tnode_get_child(n, -- tkey_extract_bits(key, -- n->pos, -- n->bits)); -- -- BUG_ON(n && node_parent(n) != tp); -- } else -+ /* This bit of code is a bit tricky but it combines multiple -+ * checks into a single check. The prefix consists of the -+ * prefix plus zeros for the "bits" in the prefix. The index -+ * is the difference between the key and this value. From -+ * this we can actually derive several pieces of data. -+ * if !(index >> bits) -+ * we know the value is child index -+ * else -+ * we have a mismatch in skip bits and failed -+ */ -+ if (index >> n->bits) - break; -- } -- -- /* -- * n ----> NULL, LEAF or TNODE -- * -- * tp is n's (parent) ----> NULL or TNODE -- */ - -- BUG_ON(tp && IS_LEAF(tp)); -- -- /* Case 1: n is a leaf. Compare prefixes */ -- -- if (n != NULL && IS_LEAF(n) && tkey_equals(key, n->key)) { -- li = leaf_info_new(plen); -- -- if (!li) -- return NULL; -+ /* we have found a leaf. Prefixes have already been compared */ -+ if (IS_LEAF(n)) { -+ /* Case 1: n is a leaf, and prefixes match*/ -+ insert_leaf_info(&n->list, li); -+ return fa_head; -+ } - -- fa_head = &li->falh; -- insert_leaf_info(&n->list, li); -- goto done; -+ tp = n; -+ n = rcu_dereference_rtnl(n->child[index]); - } -- l = leaf_new(key); -- -- if (!l) -- return NULL; - -- li = leaf_info_new(plen); -- -- if (!li) { -- node_free(l); -+ l = leaf_new(key); -+ if (!l) { -+ free_leaf_info(li); - return NULL; - } - -- fa_head = &li->falh; - insert_leaf_info(&l->list, li); - -- if (t->trie && n == NULL) { -- /* Case 2: n is NULL, and will just insert a new leaf */ -- -- node_set_parent(l, tp); -- -- cindex = tkey_extract_bits(key, tp->pos, tp->bits); -- put_child(tp, cindex, l); -- } else { -- /* Case 3: n is a LEAF or a TNODE and the key doesn't match. */ -- /* -- * Add a new tnode here -- * first tnode need some special handling -- */ -+ /* Case 2: n is a LEAF or a TNODE and the key doesn't match. -+ * -+ * Add a new tnode here -+ * first tnode need some special handling -+ * leaves us in position for handling as case 3 -+ */ -+ if (n) { -+ struct tnode *tn; -+ int newpos; - -- if (n) { -- pos = tp ? tp->pos+tp->bits : 0; -- newpos = tkey_mismatch(key, pos, n->key); -- tn = tnode_new(n->key, newpos, 1); -- } else { -- newpos = 0; -- tn = tnode_new(key, newpos, 1); /* First tnode */ -- } -+ newpos = KEYLENGTH - __fls(n->key ^ key) - 1; - -+ tn = tnode_new(key, newpos, 1); - if (!tn) { - free_leaf_info(li); - node_free(l); - return NULL; - } - -- node_set_parent(tn, tp); -- -- missbit = tkey_extract_bits(key, newpos, 1); -- put_child(tn, missbit, l); -- put_child(tn, 1-missbit, n); -- -- if (tp) { -- cindex = tkey_extract_bits(key, tp->pos, tp->bits); -- put_child(tp, cindex, tn); -- } else { -- rcu_assign_pointer(t->trie, tn); -- } -+ /* initialize routes out of node */ -+ NODE_INIT_PARENT(tn, tp); -+ put_child(tn, get_index(key, tn) ^ 1, n); -+ -+ /* start adding routes into the node */ -+ put_child_root(tp, t, key, tn); -+ node_set_parent(n, tn); - -+ /* parent now has a NULL spot where the leaf can go */ - tp = tn; - } - -- if (tp && tp->pos + tp->bits > 32) -- pr_warn("fib_trie tp=%p pos=%d, bits=%d, key=%0x plen=%d\n", -- tp, tp->pos, tp->bits, key, plen); -- -- /* Rebalance the trie */ -+ /* Case 3: n is NULL, and will just insert a new leaf */ -+ if (tp) { -+ NODE_INIT_PARENT(l, tp); -+ put_child(tp, get_index(key, tp), l); -+ trie_rebalance(t, tp); -+ } else { -+ rcu_assign_pointer(t->trie, l); -+ } - -- trie_rebalance(t, tp); --done: - return fa_head; - } - -@@ -1470,11 +1416,11 @@ static void trie_leaf_remove(struct trie - pr_debug("entering trie_leaf_remove(%p)\n", l); - - if (tp) { -- t_key cindex = tkey_extract_bits(l->key, tp->pos, tp->bits); -- put_child(tp, cindex, NULL); -+ put_child(tp, get_index(l->key, tp), NULL); - trie_rebalance(t, tp); -- } else -+ } else { - RCU_INIT_POINTER(t->trie, NULL); -+ } - - node_free(l); - } diff --git a/target/linux/generic/pending-3.18/080-09-fib_trie-Update-meaning-of-pos-to-represent-unchecke.patch b/target/linux/generic/pending-3.18/080-09-fib_trie-Update-meaning-of-pos-to-represent-unchecke.patch deleted file mode 100644 index a0d34762b8..0000000000 --- a/target/linux/generic/pending-3.18/080-09-fib_trie-Update-meaning-of-pos-to-represent-unchecke.patch +++ /dev/null @@ -1,346 +0,0 @@ -From: Alexander Duyck -Date: Wed, 31 Dec 2014 10:56:12 -0800 -Subject: [PATCH] fib_trie: Update meaning of pos to represent unchecked - bits - -This change moves the pos value to the other side of the "bits" field. By -doing this it actually simplifies a significant amount of code in the trie. - -For example when halving a tree we know that the bit lost exists at -oldnode->pos, and if we inflate the tree the new bit being add is at -tn->pos. Previously to find those bits you would have to subtract pos and -bits from the keylength or start with a value of (1 << 31) and then shift -that. - -There are a number of spots throughout the code that benefit from this. In -the case of the hot-path searches the main advantage is that we can drop 2 -or more operations from the search path as we no longer need to compute the -value for the index to be shifted by and can instead just use the raw pos -value. - -In addition the tkey_extract_bits is now defunct and can be replaced by -get_index since the two operations were doing the same thing, but now -get_index does it much more quickly as it is only an xor and shift versus a -pair of shifts and a subtraction. - -Signed-off-by: Alexander Duyck -Signed-off-by: David S. Miller ---- - ---- a/net/ipv4/fib_trie.c -+++ b/net/ipv4/fib_trie.c -@@ -90,8 +90,7 @@ typedef unsigned int t_key; - #define IS_TNODE(n) ((n)->bits) - #define IS_LEAF(n) (!(n)->bits) - --#define get_shift(_kv) (KEYLENGTH - (_kv)->pos - (_kv)->bits) --#define get_index(_key, _kv) (((_key) ^ (_kv)->key) >> get_shift(_kv)) -+#define get_index(_key, _kv) (((_key) ^ (_kv)->key) >> (_kv)->pos) - - struct tnode { - t_key key; -@@ -209,81 +208,64 @@ static inline struct tnode *tnode_get_ch - return rcu_dereference_rtnl(tn->child[i]); - } - --static inline t_key mask_pfx(t_key k, unsigned int l) --{ -- return (l == 0) ? 0 : k >> (KEYLENGTH-l) << (KEYLENGTH-l); --} -- --static inline t_key tkey_extract_bits(t_key a, unsigned int offset, unsigned int bits) --{ -- if (offset < KEYLENGTH) -- return ((t_key)(a << offset)) >> (KEYLENGTH - bits); -- else -- return 0; --} -- --/* -- To understand this stuff, an understanding of keys and all their bits is -- necessary. Every node in the trie has a key associated with it, but not -- all of the bits in that key are significant. -- -- Consider a node 'n' and its parent 'tp'. -- -- If n is a leaf, every bit in its key is significant. Its presence is -- necessitated by path compression, since during a tree traversal (when -- searching for a leaf - unless we are doing an insertion) we will completely -- ignore all skipped bits we encounter. Thus we need to verify, at the end of -- a potentially successful search, that we have indeed been walking the -- correct key path. -- -- Note that we can never "miss" the correct key in the tree if present by -- following the wrong path. Path compression ensures that segments of the key -- that are the same for all keys with a given prefix are skipped, but the -- skipped part *is* identical for each node in the subtrie below the skipped -- bit! trie_insert() in this implementation takes care of that - note the -- call to tkey_sub_equals() in trie_insert(). -- -- if n is an internal node - a 'tnode' here, the various parts of its key -- have many different meanings. -- -- Example: -- _________________________________________________________________ -- | i | i | i | i | i | i | i | N | N | N | S | S | S | S | S | C | -- ----------------------------------------------------------------- -- 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 -- -- _________________________________________________________________ -- | C | C | C | u | u | u | u | u | u | u | u | u | u | u | u | u | -- ----------------------------------------------------------------- -- 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 -- -- tp->pos = 7 -- tp->bits = 3 -- n->pos = 15 -- n->bits = 4 -- -- First, let's just ignore the bits that come before the parent tp, that is -- the bits from 0 to (tp->pos-1). They are *known* but at this point we do -- not use them for anything. -- -- The bits from (tp->pos) to (tp->pos + tp->bits - 1) - "N", above - are the -- index into the parent's child array. That is, they will be used to find -- 'n' among tp's children. -- -- The bits from (tp->pos + tp->bits) to (n->pos - 1) - "S" - are skipped bits -- for the node n. -- -- All the bits we have seen so far are significant to the node n. The rest -- of the bits are really not needed or indeed known in n->key. -- -- The bits from (n->pos) to (n->pos + n->bits - 1) - "C" - are the index into -- n's child array, and will of course be different for each child. -- -- -- The rest of the bits, from (n->pos + n->bits) onward, are completely unknown -- at this point. -- --*/ -+/* To understand this stuff, an understanding of keys and all their bits is -+ * necessary. Every node in the trie has a key associated with it, but not -+ * all of the bits in that key are significant. -+ * -+ * Consider a node 'n' and its parent 'tp'. -+ * -+ * If n is a leaf, every bit in its key is significant. Its presence is -+ * necessitated by path compression, since during a tree traversal (when -+ * searching for a leaf - unless we are doing an insertion) we will completely -+ * ignore all skipped bits we encounter. Thus we need to verify, at the end of -+ * a potentially successful search, that we have indeed been walking the -+ * correct key path. -+ * -+ * Note that we can never "miss" the correct key in the tree if present by -+ * following the wrong path. Path compression ensures that segments of the key -+ * that are the same for all keys with a given prefix are skipped, but the -+ * skipped part *is* identical for each node in the subtrie below the skipped -+ * bit! trie_insert() in this implementation takes care of that. -+ * -+ * if n is an internal node - a 'tnode' here, the various parts of its key -+ * have many different meanings. -+ * -+ * Example: -+ * _________________________________________________________________ -+ * | i | i | i | i | i | i | i | N | N | N | S | S | S | S | S | C | -+ * ----------------------------------------------------------------- -+ * 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 -+ * -+ * _________________________________________________________________ -+ * | C | C | C | u | u | u | u | u | u | u | u | u | u | u | u | u | -+ * ----------------------------------------------------------------- -+ * 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 -+ * -+ * tp->pos = 22 -+ * tp->bits = 3 -+ * n->pos = 13 -+ * n->bits = 4 -+ * -+ * First, let's just ignore the bits that come before the parent tp, that is -+ * the bits from (tp->pos + tp->bits) to 31. They are *known* but at this -+ * point we do not use them for anything. -+ * -+ * The bits from (tp->pos) to (tp->pos + tp->bits - 1) - "N", above - are the -+ * index into the parent's child array. That is, they will be used to find -+ * 'n' among tp's children. -+ * -+ * The bits from (n->pos + n->bits) to (tn->pos - 1) - "S" - are skipped bits -+ * for the node n. -+ * -+ * All the bits we have seen so far are significant to the node n. The rest -+ * of the bits are really not needed or indeed known in n->key. -+ * -+ * The bits from (n->pos) to (n->pos + n->bits - 1) - "C" - are the index into -+ * n's child array, and will of course be different for each child. -+ * -+ * The rest of the bits, from 0 to (n->pos + n->bits), are completely unknown -+ * at this point. -+ */ - - static const int halve_threshold = 25; - static const int inflate_threshold = 50; -@@ -367,7 +349,7 @@ static struct tnode *leaf_new(t_key key) - * as the nodes are searched - */ - l->key = key; -- l->pos = KEYLENGTH; -+ l->pos = 0; - /* set bits to 0 indicating we are not a tnode */ - l->bits = 0; - -@@ -400,7 +382,7 @@ static struct tnode *tnode_new(t_key key - tn->parent = NULL; - tn->pos = pos; - tn->bits = bits; -- tn->key = mask_pfx(key, pos); -+ tn->key = (shift < KEYLENGTH) ? (key >> shift) << shift : 0; - tn->full_children = 0; - tn->empty_children = 1<pos == (tn->pos + tn->bits)); -+ return n && ((n->pos + n->bits) == tn->pos) && IS_TNODE(n); - } - - static inline void put_child(struct tnode *tn, int i, -@@ -641,11 +621,12 @@ static struct tnode *inflate(struct trie - { - int olen = tnode_child_length(oldtnode); - struct tnode *tn; -+ t_key m; - int i; - - pr_debug("In inflate\n"); - -- tn = tnode_new(oldtnode->key, oldtnode->pos, oldtnode->bits + 1); -+ tn = tnode_new(oldtnode->key, oldtnode->pos - 1, oldtnode->bits + 1); - - if (!tn) - return ERR_PTR(-ENOMEM); -@@ -656,21 +637,18 @@ static struct tnode *inflate(struct trie - * fails. In case of failure we return the oldnode and inflate - * of tnode is ignored. - */ -+ for (i = 0, m = 1u << tn->pos; i < olen; i++) { -+ struct tnode *inode = tnode_get_child(oldtnode, i); - -- for (i = 0; i < olen; i++) { -- struct tnode *inode; -- -- inode = tnode_get_child(oldtnode, i); -- if (tnode_full(oldtnode, inode) && inode->bits > 1) { -+ if (tnode_full(oldtnode, inode) && (inode->bits > 1)) { - struct tnode *left, *right; -- t_key m = ~0U << (KEYLENGTH - 1) >> inode->pos; - -- left = tnode_new(inode->key&(~m), inode->pos + 1, -+ left = tnode_new(inode->key & ~m, inode->pos, - inode->bits - 1); - if (!left) - goto nomem; - -- right = tnode_new(inode->key|m, inode->pos + 1, -+ right = tnode_new(inode->key | m, inode->pos, - inode->bits - 1); - - if (!right) { -@@ -694,9 +672,7 @@ static struct tnode *inflate(struct trie - - /* A leaf or an internal node with skipped bits */ - if (!tnode_full(oldtnode, inode)) { -- put_child(tn, -- tkey_extract_bits(inode->key, tn->pos, tn->bits), -- inode); -+ put_child(tn, get_index(inode->key, tn), inode); - continue; - } - -@@ -767,7 +743,7 @@ static struct tnode *halve(struct trie * - - pr_debug("In halve\n"); - -- tn = tnode_new(oldtnode->key, oldtnode->pos, oldtnode->bits - 1); -+ tn = tnode_new(oldtnode->key, oldtnode->pos + 1, oldtnode->bits - 1); - - if (!tn) - return ERR_PTR(-ENOMEM); -@@ -787,7 +763,7 @@ static struct tnode *halve(struct trie * - if (left && right) { - struct tnode *newn; - -- newn = tnode_new(left->key, tn->pos + tn->bits, 1); -+ newn = tnode_new(left->key, oldtnode->pos, 1); - - if (!newn) - goto nomem; -@@ -915,7 +891,7 @@ static void trie_rebalance(struct trie * - key = tn->key; - - while (tn != NULL && (tp = node_parent(tn)) != NULL) { -- cindex = tkey_extract_bits(key, tp->pos, tp->bits); -+ cindex = get_index(key, tp); - wasfull = tnode_full(tp, tnode_get_child(tp, cindex)); - tn = resize(t, tn); - -@@ -1005,11 +981,8 @@ static struct list_head *fib_insert_node - */ - if (n) { - struct tnode *tn; -- int newpos; -- -- newpos = KEYLENGTH - __fls(n->key ^ key) - 1; - -- tn = tnode_new(key, newpos, 1); -+ tn = tnode_new(key, __fls(key ^ n->key), 1); - if (!tn) { - free_leaf_info(li); - node_free(l); -@@ -1559,12 +1532,7 @@ static int trie_flush_leaf(struct tnode - static struct tnode *leaf_walk_rcu(struct tnode *p, struct tnode *c) - { - do { -- t_key idx; -- -- if (c) -- idx = tkey_extract_bits(c->key, p->pos, p->bits) + 1; -- else -- idx = 0; -+ t_key idx = c ? idx = get_index(c->key, p) + 1 : 0; - - while (idx < 1u << p->bits) { - c = tnode_get_child_rcu(p, idx++); -@@ -1851,7 +1819,7 @@ rescan: - /* Current node exhausted, pop back up */ - p = node_parent_rcu(tn); - if (p) { -- cindex = tkey_extract_bits(tn->key, p->pos, p->bits)+1; -+ cindex = get_index(tn->key, p) + 1; - tn = p; - --iter->depth; - goto rescan; -@@ -2186,10 +2154,10 @@ static int fib_trie_seq_show(struct seq_ - if (IS_TNODE(n)) { - __be32 prf = htonl(n->key); - -- seq_indent(seq, iter->depth - 1); -- seq_printf(seq, " +-- %pI4/%d %d %d %d\n", -- &prf, n->pos, n->bits, n->full_children, -- n->empty_children); -+ seq_indent(seq, iter->depth-1); -+ seq_printf(seq, " +-- %pI4/%zu %u %u %u\n", -+ &prf, KEYLENGTH - n->pos - n->bits, n->bits, -+ n->full_children, n->empty_children); - } else { - struct leaf_info *li; - __be32 val = htonl(n->key); diff --git a/target/linux/generic/pending-3.18/080-10-fib_trie-Use-unsigned-long-for-anything-dealing-with.patch b/target/linux/generic/pending-3.18/080-10-fib_trie-Use-unsigned-long-for-anything-dealing-with.patch deleted file mode 100644 index 487a25f0d9..0000000000 --- a/target/linux/generic/pending-3.18/080-10-fib_trie-Use-unsigned-long-for-anything-dealing-with.patch +++ /dev/null @@ -1,186 +0,0 @@ -From: Alexander Duyck -Date: Wed, 31 Dec 2014 10:56:18 -0800 -Subject: [PATCH] fib_trie: Use unsigned long for anything dealing with a - shift by bits - -This change makes it so that anything that can be shifted by, or compared -to a value shifted by bits is updated to be an unsigned long. This is -mostly a precaution against an insanely huge address space that somehow -starts coming close to the 2^32 root node size which would require -something like 1.5 billion addresses. - -I chose unsigned long instead of unsigned long long since I do not believe -it is possible to allocate a 32 bit tnode on a 32 bit system as the memory -consumed would be 16GB + 28B which exceeds the addressible space for any -one process. - -Signed-off-by: Alexander Duyck -Signed-off-by: David S. Miller ---- - ---- a/net/ipv4/fib_trie.c -+++ b/net/ipv4/fib_trie.c -@@ -146,8 +146,8 @@ struct trie { - #endif - }; - --static void tnode_put_child_reorg(struct tnode *tn, int i, struct tnode *n, -- int wasfull); -+static void tnode_put_child_reorg(struct tnode *tn, unsigned long i, -+ struct tnode *n, int wasfull); - static struct tnode *resize(struct trie *t, struct tnode *tn); - static struct tnode *inflate(struct trie *t, struct tnode *tn); - static struct tnode *halve(struct trie *t, struct tnode *tn); -@@ -183,25 +183,23 @@ static inline void node_set_parent(struc - /* This provides us with the number of children in this node, in the case of a - * leaf this will return 0 meaning none of the children are accessible. - */ --static inline int tnode_child_length(const struct tnode *tn) -+static inline unsigned long tnode_child_length(const struct tnode *tn) - { - return (1ul << tn->bits) & ~(1ul); - } - --/* -- * caller must hold RTNL -- */ --static inline struct tnode *tnode_get_child(const struct tnode *tn, unsigned int i) -+/* caller must hold RTNL */ -+static inline struct tnode *tnode_get_child(const struct tnode *tn, -+ unsigned long i) - { - BUG_ON(i >= tnode_child_length(tn)); - - return rtnl_dereference(tn->child[i]); - } - --/* -- * caller must hold RCU read lock or RTNL -- */ --static inline struct tnode *tnode_get_child_rcu(const struct tnode *tn, unsigned int i) -+/* caller must hold RCU read lock or RTNL */ -+static inline struct tnode *tnode_get_child_rcu(const struct tnode *tn, -+ unsigned long i) - { - BUG_ON(i >= tnode_child_length(tn)); - -@@ -400,7 +398,7 @@ static inline int tnode_full(const struc - return n && ((n->pos + n->bits) == tn->pos) && IS_TNODE(n); - } - --static inline void put_child(struct tnode *tn, int i, -+static inline void put_child(struct tnode *tn, unsigned long i, - struct tnode *n) - { - tnode_put_child_reorg(tn, i, n, -1); -@@ -411,13 +409,13 @@ static inline void put_child(struct tnod - * Update the value of full_children and empty_children. - */ - --static void tnode_put_child_reorg(struct tnode *tn, int i, struct tnode *n, -- int wasfull) -+static void tnode_put_child_reorg(struct tnode *tn, unsigned long i, -+ struct tnode *n, int wasfull) - { - struct tnode *chi = rtnl_dereference(tn->child[i]); - int isfull; - -- BUG_ON(i >= 1<bits); -+ BUG_ON(i >= tnode_child_length(tn)); - - /* update emptyChildren */ - if (n == NULL && chi != NULL) -@@ -607,10 +605,10 @@ no_children: - static void tnode_clean_free(struct tnode *tn) - { - struct tnode *tofree; -- int i; -+ unsigned long i; - - for (i = 0; i < tnode_child_length(tn); i++) { -- tofree = rtnl_dereference(tn->child[i]); -+ tofree = tnode_get_child(tn, i); - if (tofree) - node_free(tofree); - } -@@ -619,10 +617,10 @@ static void tnode_clean_free(struct tnod - - static struct tnode *inflate(struct trie *t, struct tnode *oldtnode) - { -- int olen = tnode_child_length(oldtnode); -+ unsigned long olen = tnode_child_length(oldtnode); - struct tnode *tn; -+ unsigned long i; - t_key m; -- int i; - - pr_debug("In inflate\n"); - -@@ -664,7 +662,7 @@ static struct tnode *inflate(struct trie - for (i = 0; i < olen; i++) { - struct tnode *inode = tnode_get_child(oldtnode, i); - struct tnode *left, *right; -- int size, j; -+ unsigned long size, j; - - /* An empty child */ - if (inode == NULL) -@@ -737,7 +735,7 @@ nomem: - - static struct tnode *halve(struct trie *t, struct tnode *oldtnode) - { -- int olen = tnode_child_length(oldtnode); -+ unsigned long olen = tnode_child_length(oldtnode); - struct tnode *tn, *left, *right; - int i; - -@@ -1532,9 +1530,9 @@ static int trie_flush_leaf(struct tnode - static struct tnode *leaf_walk_rcu(struct tnode *p, struct tnode *c) - { - do { -- t_key idx = c ? idx = get_index(c->key, p) + 1 : 0; -+ unsigned long idx = c ? idx = get_index(c->key, p) + 1 : 0; - -- while (idx < 1u << p->bits) { -+ while (idx < tnode_child_length(p)) { - c = tnode_get_child_rcu(p, idx++); - if (!c) - continue; -@@ -1786,8 +1784,8 @@ struct fib_trie_iter { - - static struct tnode *fib_trie_get_next(struct fib_trie_iter *iter) - { -+ unsigned long cindex = iter->index; - struct tnode *tn = iter->tnode; -- unsigned int cindex = iter->index; - struct tnode *p; - - /* A single entry routing table */ -@@ -1797,7 +1795,7 @@ static struct tnode *fib_trie_get_next(s - pr_debug("get_next iter={node=%p index=%d depth=%d}\n", - iter->tnode, iter->index, iter->depth); - rescan: -- while (cindex < (1<bits)) { -+ while (cindex < tnode_child_length(tn)) { - struct tnode *n = tnode_get_child_rcu(tn, cindex); - - if (n) { -@@ -1874,15 +1872,16 @@ static void trie_collect_stats(struct tr - hlist_for_each_entry_rcu(li, &n->list, hlist) - ++s->prefixes; - } else { -- int i; -+ unsigned long i; - - s->tnodes++; - if (n->bits < MAX_STAT_DEPTH) - s->nodesizes[n->bits]++; - -- for (i = 0; i < tnode_child_length(n); i++) -+ for (i = 0; i < tnode_child_length(n); i++) { - if (!rcu_access_pointer(n->child[i])) - s->nullpointers++; -+ } - } - } - rcu_read_unlock(); diff --git a/target/linux/generic/pending-3.18/080-11-fib_trie-Push-rcu_read_lock-unlock-to-callers.patch b/target/linux/generic/pending-3.18/080-11-fib_trie-Push-rcu_read_lock-unlock-to-callers.patch deleted file mode 100644 index 29bec8387d..0000000000 --- a/target/linux/generic/pending-3.18/080-11-fib_trie-Push-rcu_read_lock-unlock-to-callers.patch +++ /dev/null @@ -1,403 +0,0 @@ -From: Alexander Duyck -Date: Wed, 31 Dec 2014 10:56:24 -0800 -Subject: [PATCH] fib_trie: Push rcu_read_lock/unlock to callers - -This change is to start cleaning up some of the rcu_read_lock/unlock -handling. I realized while reviewing the code there are several spots that -I don't believe are being handled correctly or are masking warnings by -locally calling rcu_read_lock/unlock instead of calling them at the correct -level. - -A common example is a call to fib_get_table followed by fib_table_lookup. -The rcu_read_lock/unlock ought to wrap both but there are several spots where -they were not wrapped. - -Signed-off-by: Alexander Duyck -Signed-off-by: David S. Miller ---- - ---- a/include/net/ip_fib.h -+++ b/include/net/ip_fib.h -@@ -222,16 +222,19 @@ static inline struct fib_table *fib_new_ - static inline int fib_lookup(struct net *net, const struct flowi4 *flp, - struct fib_result *res) - { -- struct fib_table *table; -+ int err = -ENETUNREACH; - -- table = fib_get_table(net, RT_TABLE_LOCAL); -- if (!fib_table_lookup(table, flp, res, FIB_LOOKUP_NOREF)) -- return 0; -- -- table = fib_get_table(net, RT_TABLE_MAIN); -- if (!fib_table_lookup(table, flp, res, FIB_LOOKUP_NOREF)) -- return 0; -- return -ENETUNREACH; -+ rcu_read_lock(); -+ -+ if (!fib_table_lookup(fib_get_table(net, RT_TABLE_LOCAL), flp, res, -+ FIB_LOOKUP_NOREF) || -+ !fib_table_lookup(fib_get_table(net, RT_TABLE_MAIN), flp, res, -+ FIB_LOOKUP_NOREF)) -+ err = 0; -+ -+ rcu_read_unlock(); -+ -+ return err; - } - - #else /* CONFIG_IP_MULTIPLE_TABLES */ -@@ -247,20 +250,25 @@ static inline int fib_lookup(struct net - struct fib_result *res) - { - if (!net->ipv4.fib_has_custom_rules) { -+ int err = -ENETUNREACH; -+ -+ rcu_read_lock(); -+ - res->tclassid = 0; -- if (net->ipv4.fib_local && -- !fib_table_lookup(net->ipv4.fib_local, flp, res, -- FIB_LOOKUP_NOREF)) -- return 0; -- if (net->ipv4.fib_main && -- !fib_table_lookup(net->ipv4.fib_main, flp, res, -- FIB_LOOKUP_NOREF)) -- return 0; -- if (net->ipv4.fib_default && -- !fib_table_lookup(net->ipv4.fib_default, flp, res, -- FIB_LOOKUP_NOREF)) -- return 0; -- return -ENETUNREACH; -+ if ((net->ipv4.fib_local && -+ !fib_table_lookup(net->ipv4.fib_local, flp, res, -+ FIB_LOOKUP_NOREF)) || -+ (net->ipv4.fib_main && -+ !fib_table_lookup(net->ipv4.fib_main, flp, res, -+ FIB_LOOKUP_NOREF)) || -+ (net->ipv4.fib_default && -+ !fib_table_lookup(net->ipv4.fib_default, flp, res, -+ FIB_LOOKUP_NOREF))) -+ err = 0; -+ -+ rcu_read_unlock(); -+ -+ return err; - } - return __fib_lookup(net, flp, res); - } ---- a/net/ipv4/fib_frontend.c -+++ b/net/ipv4/fib_frontend.c -@@ -109,6 +109,7 @@ struct fib_table *fib_new_table(struct n - return tb; - } - -+/* caller must hold either rtnl or rcu read lock */ - struct fib_table *fib_get_table(struct net *net, u32 id) - { - struct fib_table *tb; -@@ -119,15 +120,11 @@ struct fib_table *fib_get_table(struct n - id = RT_TABLE_MAIN; - h = id & (FIB_TABLE_HASHSZ - 1); - -- rcu_read_lock(); - head = &net->ipv4.fib_table_hash[h]; - hlist_for_each_entry_rcu(tb, head, tb_hlist) { -- if (tb->tb_id == id) { -- rcu_read_unlock(); -+ if (tb->tb_id == id) - return tb; -- } - } -- rcu_read_unlock(); - return NULL; - } - #endif /* CONFIG_IP_MULTIPLE_TABLES */ -@@ -167,16 +164,18 @@ static inline unsigned int __inet_dev_ad - if (ipv4_is_multicast(addr)) - return RTN_MULTICAST; - -+ rcu_read_lock(); -+ - local_table = fib_get_table(net, RT_TABLE_LOCAL); - if (local_table) { - ret = RTN_UNICAST; -- rcu_read_lock(); - if (!fib_table_lookup(local_table, &fl4, &res, FIB_LOOKUP_NOREF)) { - if (!dev || dev == res.fi->fib_dev) - ret = res.type; - } -- rcu_read_unlock(); - } -+ -+ rcu_read_unlock(); - return ret; - } - -@@ -923,7 +922,7 @@ no_promotions: - #undef BRD1_OK - } - --static void nl_fib_lookup(struct fib_result_nl *frn, struct fib_table *tb) -+static void nl_fib_lookup(struct net *net, struct fib_result_nl *frn) - { - - struct fib_result res; -@@ -933,6 +932,11 @@ static void nl_fib_lookup(struct fib_res - .flowi4_tos = frn->fl_tos, - .flowi4_scope = frn->fl_scope, - }; -+ struct fib_table *tb; -+ -+ rcu_read_lock(); -+ -+ tb = fib_get_table(net, frn->tb_id_in); - - frn->err = -ENOENT; - if (tb) { -@@ -949,6 +953,8 @@ static void nl_fib_lookup(struct fib_res - } - local_bh_enable(); - } -+ -+ rcu_read_unlock(); - } - - static void nl_fib_input(struct sk_buff *skb) -@@ -956,7 +962,6 @@ static void nl_fib_input(struct sk_buff - struct net *net; - struct fib_result_nl *frn; - struct nlmsghdr *nlh; -- struct fib_table *tb; - u32 portid; - - net = sock_net(skb->sk); -@@ -972,9 +977,7 @@ static void nl_fib_input(struct sk_buff - nlh = nlmsg_hdr(skb); - - frn = (struct fib_result_nl *) nlmsg_data(nlh); -- tb = fib_get_table(net, frn->tb_id_in); -- -- nl_fib_lookup(frn, tb); -+ nl_fib_lookup(net, frn); - - portid = NETLINK_CB(skb).portid; /* netlink portid */ - NETLINK_CB(skb).portid = 0; /* from kernel */ ---- a/net/ipv4/fib_rules.c -+++ b/net/ipv4/fib_rules.c -@@ -81,27 +81,25 @@ static int fib4_rule_action(struct fib_r - break; - - case FR_ACT_UNREACHABLE: -- err = -ENETUNREACH; -- goto errout; -+ return -ENETUNREACH; - - case FR_ACT_PROHIBIT: -- err = -EACCES; -- goto errout; -+ return -EACCES; - - case FR_ACT_BLACKHOLE: - default: -- err = -EINVAL; -- goto errout; -+ return -EINVAL; - } - -+ rcu_read_lock(); -+ - tbl = fib_get_table(rule->fr_net, rule->table); -- if (!tbl) -- goto errout; -+ if (tbl) -+ err = fib_table_lookup(tbl, &flp->u.ip4, -+ (struct fib_result *)arg->result, -+ arg->flags); - -- err = fib_table_lookup(tbl, &flp->u.ip4, (struct fib_result *) arg->result, arg->flags); -- if (err > 0) -- err = -EAGAIN; --errout: -+ rcu_read_unlock(); - return err; - } - ---- a/net/ipv4/fib_trie.c -+++ b/net/ipv4/fib_trie.c -@@ -1181,72 +1181,6 @@ err: - return err; - } - --/* should be called with rcu_read_lock */ --static int check_leaf(struct fib_table *tb, struct trie *t, struct tnode *l, -- t_key key, const struct flowi4 *flp, -- struct fib_result *res, int fib_flags) --{ -- struct leaf_info *li; -- struct hlist_head *hhead = &l->list; -- -- hlist_for_each_entry_rcu(li, hhead, hlist) { -- struct fib_alias *fa; -- -- if (l->key != (key & li->mask_plen)) -- continue; -- -- list_for_each_entry_rcu(fa, &li->falh, fa_list) { -- struct fib_info *fi = fa->fa_info; -- int nhsel, err; -- -- if (fa->fa_tos && fa->fa_tos != flp->flowi4_tos) -- continue; -- if (fi->fib_dead) -- continue; -- if (fa->fa_info->fib_scope < flp->flowi4_scope) -- continue; -- fib_alias_accessed(fa); -- err = fib_props[fa->fa_type].error; -- if (unlikely(err < 0)) { --#ifdef CONFIG_IP_FIB_TRIE_STATS -- this_cpu_inc(t->stats->semantic_match_passed); --#endif -- return err; -- } -- if (fi->fib_flags & RTNH_F_DEAD) -- continue; -- for (nhsel = 0; nhsel < fi->fib_nhs; nhsel++) { -- const struct fib_nh *nh = &fi->fib_nh[nhsel]; -- -- if (nh->nh_flags & RTNH_F_DEAD) -- continue; -- if (flp->flowi4_oif && flp->flowi4_oif != nh->nh_oif) -- continue; -- --#ifdef CONFIG_IP_FIB_TRIE_STATS -- this_cpu_inc(t->stats->semantic_match_passed); --#endif -- res->prefixlen = li->plen; -- res->nh_sel = nhsel; -- res->type = fa->fa_type; -- res->scope = fi->fib_scope; -- res->fi = fi; -- res->table = tb; -- res->fa_head = &li->falh; -- if (!(fib_flags & FIB_LOOKUP_NOREF)) -- atomic_inc(&fi->fib_clntref); -- return 0; -- } -- } -- --#ifdef CONFIG_IP_FIB_TRIE_STATS -- this_cpu_inc(t->stats->semantic_match_miss); --#endif -- } -- -- return 1; --} -- - static inline t_key prefix_mismatch(t_key key, struct tnode *n) - { - t_key prefix = n->key; -@@ -1254,6 +1188,7 @@ static inline t_key prefix_mismatch(t_ke - return (key ^ prefix) & (prefix | -prefix); - } - -+/* should be called with rcu_read_lock */ - int fib_table_lookup(struct fib_table *tb, const struct flowi4 *flp, - struct fib_result *res, int fib_flags) - { -@@ -1263,14 +1198,12 @@ int fib_table_lookup(struct fib_table *t - #endif - const t_key key = ntohl(flp->daddr); - struct tnode *n, *pn; -+ struct leaf_info *li; - t_key cindex; -- int ret = 1; -- -- rcu_read_lock(); - - n = rcu_dereference(t->trie); - if (!n) -- goto failed; -+ return -EAGAIN; - - #ifdef CONFIG_IP_FIB_TRIE_STATS - this_cpu_inc(stats->gets); -@@ -1350,7 +1283,7 @@ backtrace: - - pn = node_parent_rcu(pn); - if (unlikely(!pn)) -- goto failed; -+ return -EAGAIN; - #ifdef CONFIG_IP_FIB_TRIE_STATS - this_cpu_inc(stats->backtrack); - #endif -@@ -1368,12 +1301,62 @@ backtrace: - - found: - /* Step 3: Process the leaf, if that fails fall back to backtracing */ -- ret = check_leaf(tb, t, n, key, flp, res, fib_flags); -- if (unlikely(ret > 0)) -- goto backtrace; --failed: -- rcu_read_unlock(); -- return ret; -+ hlist_for_each_entry_rcu(li, &n->list, hlist) { -+ struct fib_alias *fa; -+ -+ if ((key ^ n->key) & li->mask_plen) -+ continue; -+ -+ list_for_each_entry_rcu(fa, &li->falh, fa_list) { -+ struct fib_info *fi = fa->fa_info; -+ int nhsel, err; -+ -+ if (fa->fa_tos && fa->fa_tos != flp->flowi4_tos) -+ continue; -+ if (fi->fib_dead) -+ continue; -+ if (fa->fa_info->fib_scope < flp->flowi4_scope) -+ continue; -+ fib_alias_accessed(fa); -+ err = fib_props[fa->fa_type].error; -+ if (unlikely(err < 0)) { -+#ifdef CONFIG_IP_FIB_TRIE_STATS -+ this_cpu_inc(stats->semantic_match_passed); -+#endif -+ return err; -+ } -+ if (fi->fib_flags & RTNH_F_DEAD) -+ continue; -+ for (nhsel = 0; nhsel < fi->fib_nhs; nhsel++) { -+ const struct fib_nh *nh = &fi->fib_nh[nhsel]; -+ -+ if (nh->nh_flags & RTNH_F_DEAD) -+ continue; -+ if (flp->flowi4_oif && flp->flowi4_oif != nh->nh_oif) -+ continue; -+ -+ if (!(fib_flags & FIB_LOOKUP_NOREF)) -+ atomic_inc(&fi->fib_clntref); -+ -+ res->prefixlen = li->plen; -+ res->nh_sel = nhsel; -+ res->type = fa->fa_type; -+ res->scope = fi->fib_scope; -+ res->fi = fi; -+ res->table = tb; -+ res->fa_head = &li->falh; -+#ifdef CONFIG_IP_FIB_TRIE_STATS -+ this_cpu_inc(stats->semantic_match_passed); -+#endif -+ return err; -+ } -+ } -+ -+#ifdef CONFIG_IP_FIB_TRIE_STATS -+ this_cpu_inc(stats->semantic_match_miss); -+#endif -+ } -+ goto backtrace; - } - EXPORT_SYMBOL_GPL(fib_table_lookup); - diff --git a/target/linux/generic/pending-3.18/080-12-fib_trie-Move-resize-to-after-inflate-halve.patch b/target/linux/generic/pending-3.18/080-12-fib_trie-Move-resize-to-after-inflate-halve.patch deleted file mode 100644 index a373add1d2..0000000000 --- a/target/linux/generic/pending-3.18/080-12-fib_trie-Move-resize-to-after-inflate-halve.patch +++ /dev/null @@ -1,345 +0,0 @@ -From: Alexander Duyck -Date: Wed, 31 Dec 2014 10:56:31 -0800 -Subject: [PATCH] fib_trie: Move resize to after inflate/halve - -This change consists of a cut/paste of resize to behind inflate and halve -so that I could remove the two function prototypes. - -Signed-off-by: Alexander Duyck -Signed-off-by: David S. Miller ---- - ---- a/net/ipv4/fib_trie.c -+++ b/net/ipv4/fib_trie.c -@@ -149,8 +149,6 @@ struct trie { - static void tnode_put_child_reorg(struct tnode *tn, unsigned long i, - struct tnode *n, int wasfull); - static struct tnode *resize(struct trie *t, struct tnode *tn); --static struct tnode *inflate(struct trie *t, struct tnode *tn); --static struct tnode *halve(struct trie *t, struct tnode *tn); - /* tnodes to free after resize(); protected by RTNL */ - static struct callback_head *tnode_free_head; - static size_t tnode_free_size; -@@ -447,161 +445,6 @@ static void put_child_root(struct tnode - rcu_assign_pointer(t->trie, n); - } - --#define MAX_WORK 10 --static struct tnode *resize(struct trie *t, struct tnode *tn) --{ -- struct tnode *old_tn, *n = NULL; -- int inflate_threshold_use; -- int halve_threshold_use; -- int max_work; -- -- if (!tn) -- return NULL; -- -- pr_debug("In tnode_resize %p inflate_threshold=%d threshold=%d\n", -- tn, inflate_threshold, halve_threshold); -- -- /* No children */ -- if (tn->empty_children > (tnode_child_length(tn) - 1)) -- goto no_children; -- -- /* One child */ -- if (tn->empty_children == (tnode_child_length(tn) - 1)) -- goto one_child; -- /* -- * Double as long as the resulting node has a number of -- * nonempty nodes that are above the threshold. -- */ -- -- /* -- * From "Implementing a dynamic compressed trie" by Stefan Nilsson of -- * the Helsinki University of Technology and Matti Tikkanen of Nokia -- * Telecommunications, page 6: -- * "A node is doubled if the ratio of non-empty children to all -- * children in the *doubled* node is at least 'high'." -- * -- * 'high' in this instance is the variable 'inflate_threshold'. It -- * is expressed as a percentage, so we multiply it with -- * tnode_child_length() and instead of multiplying by 2 (since the -- * child array will be doubled by inflate()) and multiplying -- * the left-hand side by 100 (to handle the percentage thing) we -- * multiply the left-hand side by 50. -- * -- * The left-hand side may look a bit weird: tnode_child_length(tn) -- * - tn->empty_children is of course the number of non-null children -- * in the current node. tn->full_children is the number of "full" -- * children, that is non-null tnodes with a skip value of 0. -- * All of those will be doubled in the resulting inflated tnode, so -- * we just count them one extra time here. -- * -- * A clearer way to write this would be: -- * -- * to_be_doubled = tn->full_children; -- * not_to_be_doubled = tnode_child_length(tn) - tn->empty_children - -- * tn->full_children; -- * -- * new_child_length = tnode_child_length(tn) * 2; -- * -- * new_fill_factor = 100 * (not_to_be_doubled + 2*to_be_doubled) / -- * new_child_length; -- * if (new_fill_factor >= inflate_threshold) -- * -- * ...and so on, tho it would mess up the while () loop. -- * -- * anyway, -- * 100 * (not_to_be_doubled + 2*to_be_doubled) / new_child_length >= -- * inflate_threshold -- * -- * avoid a division: -- * 100 * (not_to_be_doubled + 2*to_be_doubled) >= -- * inflate_threshold * new_child_length -- * -- * expand not_to_be_doubled and to_be_doubled, and shorten: -- * 100 * (tnode_child_length(tn) - tn->empty_children + -- * tn->full_children) >= inflate_threshold * new_child_length -- * -- * expand new_child_length: -- * 100 * (tnode_child_length(tn) - tn->empty_children + -- * tn->full_children) >= -- * inflate_threshold * tnode_child_length(tn) * 2 -- * -- * shorten again: -- * 50 * (tn->full_children + tnode_child_length(tn) - -- * tn->empty_children) >= inflate_threshold * -- * tnode_child_length(tn) -- * -- */ -- -- /* Keep root node larger */ -- -- if (!node_parent(tn)) { -- inflate_threshold_use = inflate_threshold_root; -- halve_threshold_use = halve_threshold_root; -- } else { -- inflate_threshold_use = inflate_threshold; -- halve_threshold_use = halve_threshold; -- } -- -- max_work = MAX_WORK; -- while ((tn->full_children > 0 && max_work-- && -- 50 * (tn->full_children + tnode_child_length(tn) -- - tn->empty_children) -- >= inflate_threshold_use * tnode_child_length(tn))) { -- -- old_tn = tn; -- tn = inflate(t, tn); -- -- if (IS_ERR(tn)) { -- tn = old_tn; --#ifdef CONFIG_IP_FIB_TRIE_STATS -- this_cpu_inc(t->stats->resize_node_skipped); --#endif -- break; -- } -- } -- -- /* Return if at least one inflate is run */ -- if (max_work != MAX_WORK) -- return tn; -- -- /* -- * Halve as long as the number of empty children in this -- * node is above threshold. -- */ -- -- max_work = MAX_WORK; -- while (tn->bits > 1 && max_work-- && -- 100 * (tnode_child_length(tn) - tn->empty_children) < -- halve_threshold_use * tnode_child_length(tn)) { -- -- old_tn = tn; -- tn = halve(t, tn); -- if (IS_ERR(tn)) { -- tn = old_tn; --#ifdef CONFIG_IP_FIB_TRIE_STATS -- this_cpu_inc(t->stats->resize_node_skipped); --#endif -- break; -- } -- } -- -- -- /* Only one child remains */ -- if (tn->empty_children == (tnode_child_length(tn) - 1)) { -- unsigned long i; --one_child: -- for (i = tnode_child_length(tn); !n && i;) -- n = tnode_get_child(tn, --i); --no_children: -- /* compress one level */ -- node_set_parent(n, NULL); -- tnode_free_safe(tn); -- return n; -- } -- return tn; --} -- -- - static void tnode_clean_free(struct tnode *tn) - { - struct tnode *tofree; -@@ -804,6 +647,160 @@ nomem: - return ERR_PTR(-ENOMEM); - } - -+#define MAX_WORK 10 -+static struct tnode *resize(struct trie *t, struct tnode *tn) -+{ -+ struct tnode *old_tn, *n = NULL; -+ int inflate_threshold_use; -+ int halve_threshold_use; -+ int max_work; -+ -+ if (!tn) -+ return NULL; -+ -+ pr_debug("In tnode_resize %p inflate_threshold=%d threshold=%d\n", -+ tn, inflate_threshold, halve_threshold); -+ -+ /* No children */ -+ if (tn->empty_children > (tnode_child_length(tn) - 1)) -+ goto no_children; -+ -+ /* One child */ -+ if (tn->empty_children == (tnode_child_length(tn) - 1)) -+ goto one_child; -+ /* -+ * Double as long as the resulting node has a number of -+ * nonempty nodes that are above the threshold. -+ */ -+ -+ /* -+ * From "Implementing a dynamic compressed trie" by Stefan Nilsson of -+ * the Helsinki University of Technology and Matti Tikkanen of Nokia -+ * Telecommunications, page 6: -+ * "A node is doubled if the ratio of non-empty children to all -+ * children in the *doubled* node is at least 'high'." -+ * -+ * 'high' in this instance is the variable 'inflate_threshold'. It -+ * is expressed as a percentage, so we multiply it with -+ * tnode_child_length() and instead of multiplying by 2 (since the -+ * child array will be doubled by inflate()) and multiplying -+ * the left-hand side by 100 (to handle the percentage thing) we -+ * multiply the left-hand side by 50. -+ * -+ * The left-hand side may look a bit weird: tnode_child_length(tn) -+ * - tn->empty_children is of course the number of non-null children -+ * in the current node. tn->full_children is the number of "full" -+ * children, that is non-null tnodes with a skip value of 0. -+ * All of those will be doubled in the resulting inflated tnode, so -+ * we just count them one extra time here. -+ * -+ * A clearer way to write this would be: -+ * -+ * to_be_doubled = tn->full_children; -+ * not_to_be_doubled = tnode_child_length(tn) - tn->empty_children - -+ * tn->full_children; -+ * -+ * new_child_length = tnode_child_length(tn) * 2; -+ * -+ * new_fill_factor = 100 * (not_to_be_doubled + 2*to_be_doubled) / -+ * new_child_length; -+ * if (new_fill_factor >= inflate_threshold) -+ * -+ * ...and so on, tho it would mess up the while () loop. -+ * -+ * anyway, -+ * 100 * (not_to_be_doubled + 2*to_be_doubled) / new_child_length >= -+ * inflate_threshold -+ * -+ * avoid a division: -+ * 100 * (not_to_be_doubled + 2*to_be_doubled) >= -+ * inflate_threshold * new_child_length -+ * -+ * expand not_to_be_doubled and to_be_doubled, and shorten: -+ * 100 * (tnode_child_length(tn) - tn->empty_children + -+ * tn->full_children) >= inflate_threshold * new_child_length -+ * -+ * expand new_child_length: -+ * 100 * (tnode_child_length(tn) - tn->empty_children + -+ * tn->full_children) >= -+ * inflate_threshold * tnode_child_length(tn) * 2 -+ * -+ * shorten again: -+ * 50 * (tn->full_children + tnode_child_length(tn) - -+ * tn->empty_children) >= inflate_threshold * -+ * tnode_child_length(tn) -+ * -+ */ -+ -+ /* Keep root node larger */ -+ -+ if (!node_parent(tn)) { -+ inflate_threshold_use = inflate_threshold_root; -+ halve_threshold_use = halve_threshold_root; -+ } else { -+ inflate_threshold_use = inflate_threshold; -+ halve_threshold_use = halve_threshold; -+ } -+ -+ max_work = MAX_WORK; -+ while ((tn->full_children > 0 && max_work-- && -+ 50 * (tn->full_children + tnode_child_length(tn) -+ - tn->empty_children) -+ >= inflate_threshold_use * tnode_child_length(tn))) { -+ -+ old_tn = tn; -+ tn = inflate(t, tn); -+ -+ if (IS_ERR(tn)) { -+ tn = old_tn; -+#ifdef CONFIG_IP_FIB_TRIE_STATS -+ this_cpu_inc(t->stats->resize_node_skipped); -+#endif -+ break; -+ } -+ } -+ -+ /* Return if at least one inflate is run */ -+ if (max_work != MAX_WORK) -+ return tn; -+ -+ /* -+ * Halve as long as the number of empty children in this -+ * node is above threshold. -+ */ -+ -+ max_work = MAX_WORK; -+ while (tn->bits > 1 && max_work-- && -+ 100 * (tnode_child_length(tn) - tn->empty_children) < -+ halve_threshold_use * tnode_child_length(tn)) { -+ -+ old_tn = tn; -+ tn = halve(t, tn); -+ if (IS_ERR(tn)) { -+ tn = old_tn; -+#ifdef CONFIG_IP_FIB_TRIE_STATS -+ this_cpu_inc(t->stats->resize_node_skipped); -+#endif -+ break; -+ } -+ } -+ -+ -+ /* Only one child remains */ -+ if (tn->empty_children == (tnode_child_length(tn) - 1)) { -+ unsigned long i; -+one_child: -+ for (i = tnode_child_length(tn); !n && i;) -+ n = tnode_get_child(tn, --i); -+no_children: -+ /* compress one level */ -+ node_set_parent(n, NULL); -+ tnode_free_safe(tn); -+ return n; -+ } -+ return tn; -+} -+ - /* readside must use rcu_read_lock currently dump routines - via get_fa_head and dump */ - diff --git a/target/linux/generic/pending-3.18/080-13-fib_trie-Add-functions-should_inflate-and-should_hal.patch b/target/linux/generic/pending-3.18/080-13-fib_trie-Add-functions-should_inflate-and-should_hal.patch deleted file mode 100644 index c01d57af0f..0000000000 --- a/target/linux/generic/pending-3.18/080-13-fib_trie-Add-functions-should_inflate-and-should_hal.patch +++ /dev/null @@ -1,250 +0,0 @@ -From: Alexander Duyck -Date: Wed, 31 Dec 2014 10:56:37 -0800 -Subject: [PATCH] fib_trie: Add functions should_inflate and should_halve - -This change pulls the logic for if we should inflate/halve the nodes out -into separate functions. It also addresses what I believe is a bug where 1 -full node is all that is needed to keep a node from ever being halved. - -Simple script to reproduce the issue: - modprobe dummy; ifconfig dummy0 up - for i in `seq 0 255`; do ifconfig dummy0:$i 10.0.${i}.1/24 up; done - ifconfig dummy0:256 10.0.255.33/16 up - for i in `seq 0 254`; do ifconfig dummy0:$i down; done - -Results from /proc/net/fib_triestat -Before: - Local: - Aver depth: 3.00 - Max depth: 4 - Leaves: 17 - Prefixes: 18 - Internal nodes: 11 - 1: 8 2: 2 10: 1 - Pointers: 1048 - Null ptrs: 1021 - Total size: 11 kB -After: - Local: - Aver depth: 3.41 - Max depth: 5 - Leaves: 17 - Prefixes: 18 - Internal nodes: 12 - 1: 8 2: 3 3: 1 - Pointers: 36 - Null ptrs: 8 - Total size: 3 kB - -Signed-off-by: Alexander Duyck -Signed-off-by: David S. Miller ---- - ---- a/net/ipv4/fib_trie.c -+++ b/net/ipv4/fib_trie.c -@@ -647,12 +647,94 @@ nomem: - return ERR_PTR(-ENOMEM); - } - -+/* From "Implementing a dynamic compressed trie" by Stefan Nilsson of -+ * the Helsinki University of Technology and Matti Tikkanen of Nokia -+ * Telecommunications, page 6: -+ * "A node is doubled if the ratio of non-empty children to all -+ * children in the *doubled* node is at least 'high'." -+ * -+ * 'high' in this instance is the variable 'inflate_threshold'. It -+ * is expressed as a percentage, so we multiply it with -+ * tnode_child_length() and instead of multiplying by 2 (since the -+ * child array will be doubled by inflate()) and multiplying -+ * the left-hand side by 100 (to handle the percentage thing) we -+ * multiply the left-hand side by 50. -+ * -+ * The left-hand side may look a bit weird: tnode_child_length(tn) -+ * - tn->empty_children is of course the number of non-null children -+ * in the current node. tn->full_children is the number of "full" -+ * children, that is non-null tnodes with a skip value of 0. -+ * All of those will be doubled in the resulting inflated tnode, so -+ * we just count them one extra time here. -+ * -+ * A clearer way to write this would be: -+ * -+ * to_be_doubled = tn->full_children; -+ * not_to_be_doubled = tnode_child_length(tn) - tn->empty_children - -+ * tn->full_children; -+ * -+ * new_child_length = tnode_child_length(tn) * 2; -+ * -+ * new_fill_factor = 100 * (not_to_be_doubled + 2*to_be_doubled) / -+ * new_child_length; -+ * if (new_fill_factor >= inflate_threshold) -+ * -+ * ...and so on, tho it would mess up the while () loop. -+ * -+ * anyway, -+ * 100 * (not_to_be_doubled + 2*to_be_doubled) / new_child_length >= -+ * inflate_threshold -+ * -+ * avoid a division: -+ * 100 * (not_to_be_doubled + 2*to_be_doubled) >= -+ * inflate_threshold * new_child_length -+ * -+ * expand not_to_be_doubled and to_be_doubled, and shorten: -+ * 100 * (tnode_child_length(tn) - tn->empty_children + -+ * tn->full_children) >= inflate_threshold * new_child_length -+ * -+ * expand new_child_length: -+ * 100 * (tnode_child_length(tn) - tn->empty_children + -+ * tn->full_children) >= -+ * inflate_threshold * tnode_child_length(tn) * 2 -+ * -+ * shorten again: -+ * 50 * (tn->full_children + tnode_child_length(tn) - -+ * tn->empty_children) >= inflate_threshold * -+ * tnode_child_length(tn) -+ * -+ */ -+static bool should_inflate(const struct tnode *tn) -+{ -+ unsigned long used = tnode_child_length(tn); -+ unsigned long threshold = used; -+ -+ /* Keep root node larger */ -+ threshold *= node_parent(tn) ? inflate_threshold : -+ inflate_threshold_root; -+ used += tn->full_children; -+ used -= tn->empty_children; -+ -+ return tn->pos && ((50 * used) >= threshold); -+} -+ -+static bool should_halve(const struct tnode *tn) -+{ -+ unsigned long used = tnode_child_length(tn); -+ unsigned long threshold = used; -+ -+ /* Keep root node larger */ -+ threshold *= node_parent(tn) ? halve_threshold : -+ halve_threshold_root; -+ used -= tn->empty_children; -+ -+ return (tn->bits > 1) && ((100 * used) < threshold); -+} -+ - #define MAX_WORK 10 - static struct tnode *resize(struct trie *t, struct tnode *tn) - { - struct tnode *old_tn, *n = NULL; -- int inflate_threshold_use; -- int halve_threshold_use; - int max_work; - - if (!tn) -@@ -668,86 +750,12 @@ static struct tnode *resize(struct trie - /* One child */ - if (tn->empty_children == (tnode_child_length(tn) - 1)) - goto one_child; -- /* -- * Double as long as the resulting node has a number of -- * nonempty nodes that are above the threshold. -- */ - -- /* -- * From "Implementing a dynamic compressed trie" by Stefan Nilsson of -- * the Helsinki University of Technology and Matti Tikkanen of Nokia -- * Telecommunications, page 6: -- * "A node is doubled if the ratio of non-empty children to all -- * children in the *doubled* node is at least 'high'." -- * -- * 'high' in this instance is the variable 'inflate_threshold'. It -- * is expressed as a percentage, so we multiply it with -- * tnode_child_length() and instead of multiplying by 2 (since the -- * child array will be doubled by inflate()) and multiplying -- * the left-hand side by 100 (to handle the percentage thing) we -- * multiply the left-hand side by 50. -- * -- * The left-hand side may look a bit weird: tnode_child_length(tn) -- * - tn->empty_children is of course the number of non-null children -- * in the current node. tn->full_children is the number of "full" -- * children, that is non-null tnodes with a skip value of 0. -- * All of those will be doubled in the resulting inflated tnode, so -- * we just count them one extra time here. -- * -- * A clearer way to write this would be: -- * -- * to_be_doubled = tn->full_children; -- * not_to_be_doubled = tnode_child_length(tn) - tn->empty_children - -- * tn->full_children; -- * -- * new_child_length = tnode_child_length(tn) * 2; -- * -- * new_fill_factor = 100 * (not_to_be_doubled + 2*to_be_doubled) / -- * new_child_length; -- * if (new_fill_factor >= inflate_threshold) -- * -- * ...and so on, tho it would mess up the while () loop. -- * -- * anyway, -- * 100 * (not_to_be_doubled + 2*to_be_doubled) / new_child_length >= -- * inflate_threshold -- * -- * avoid a division: -- * 100 * (not_to_be_doubled + 2*to_be_doubled) >= -- * inflate_threshold * new_child_length -- * -- * expand not_to_be_doubled and to_be_doubled, and shorten: -- * 100 * (tnode_child_length(tn) - tn->empty_children + -- * tn->full_children) >= inflate_threshold * new_child_length -- * -- * expand new_child_length: -- * 100 * (tnode_child_length(tn) - tn->empty_children + -- * tn->full_children) >= -- * inflate_threshold * tnode_child_length(tn) * 2 -- * -- * shorten again: -- * 50 * (tn->full_children + tnode_child_length(tn) - -- * tn->empty_children) >= inflate_threshold * -- * tnode_child_length(tn) -- * -+ /* Double as long as the resulting node has a number of -+ * nonempty nodes that are above the threshold. - */ -- -- /* Keep root node larger */ -- -- if (!node_parent(tn)) { -- inflate_threshold_use = inflate_threshold_root; -- halve_threshold_use = halve_threshold_root; -- } else { -- inflate_threshold_use = inflate_threshold; -- halve_threshold_use = halve_threshold; -- } -- - max_work = MAX_WORK; -- while ((tn->full_children > 0 && max_work-- && -- 50 * (tn->full_children + tnode_child_length(tn) -- - tn->empty_children) -- >= inflate_threshold_use * tnode_child_length(tn))) { -- -+ while (should_inflate(tn) && max_work--) { - old_tn = tn; - tn = inflate(t, tn); - -@@ -764,16 +772,11 @@ static struct tnode *resize(struct trie - if (max_work != MAX_WORK) - return tn; - -- /* -- * Halve as long as the number of empty children in this -+ /* Halve as long as the number of empty children in this - * node is above threshold. - */ -- - max_work = MAX_WORK; -- while (tn->bits > 1 && max_work-- && -- 100 * (tnode_child_length(tn) - tn->empty_children) < -- halve_threshold_use * tnode_child_length(tn)) { -- -+ while (should_halve(tn) && max_work--) { - old_tn = tn; - tn = halve(t, tn); - if (IS_ERR(tn)) { diff --git a/target/linux/generic/pending-3.18/080-14-fib_trie-Push-assignment-of-child-to-parent-down-int.patch b/target/linux/generic/pending-3.18/080-14-fib_trie-Push-assignment-of-child-to-parent-down-int.patch deleted file mode 100644 index 8f26e32d3d..0000000000 --- a/target/linux/generic/pending-3.18/080-14-fib_trie-Push-assignment-of-child-to-parent-down-int.patch +++ /dev/null @@ -1,336 +0,0 @@ -From: Alexander Duyck -Date: Wed, 31 Dec 2014 10:56:43 -0800 -Subject: [PATCH] fib_trie: Push assignment of child to parent down into - inflate/halve - -This change makes it so that the assignment of the tnode to the parent is -handled directly within whatever function is currently handling the node be -it inflate, halve, or resize. By doing this we can avoid some of the need -to set NULL pointers in the tree while we are resizing the subnodes. - -Signed-off-by: Alexander Duyck -Signed-off-by: David S. Miller ---- - ---- a/net/ipv4/fib_trie.c -+++ b/net/ipv4/fib_trie.c -@@ -146,9 +146,7 @@ struct trie { - #endif - }; - --static void tnode_put_child_reorg(struct tnode *tn, unsigned long i, -- struct tnode *n, int wasfull); --static struct tnode *resize(struct trie *t, struct tnode *tn); -+static void resize(struct trie *t, struct tnode *tn); - /* tnodes to free after resize(); protected by RTNL */ - static struct callback_head *tnode_free_head; - static size_t tnode_free_size; -@@ -396,22 +394,13 @@ static inline int tnode_full(const struc - return n && ((n->pos + n->bits) == tn->pos) && IS_TNODE(n); - } - --static inline void put_child(struct tnode *tn, unsigned long i, -- struct tnode *n) --{ -- tnode_put_child_reorg(tn, i, n, -1); --} -- -- /* -- * Add a child at position i overwriting the old value. -- * Update the value of full_children and empty_children. -- */ -- --static void tnode_put_child_reorg(struct tnode *tn, unsigned long i, -- struct tnode *n, int wasfull) -+/* Add a child at position i overwriting the old value. -+ * Update the value of full_children and empty_children. -+ */ -+static void put_child(struct tnode *tn, unsigned long i, struct tnode *n) - { - struct tnode *chi = rtnl_dereference(tn->child[i]); -- int isfull; -+ int isfull, wasfull; - - BUG_ON(i >= tnode_child_length(tn)); - -@@ -422,10 +411,9 @@ static void tnode_put_child_reorg(struct - tn->empty_children--; - - /* update fullChildren */ -- if (wasfull == -1) -- wasfull = tnode_full(tn, chi); -- -+ wasfull = tnode_full(tn, chi); - isfull = tnode_full(tn, n); -+ - if (wasfull && !isfull) - tn->full_children--; - else if (!wasfull && isfull) -@@ -458,9 +446,10 @@ static void tnode_clean_free(struct tnod - node_free(tn); - } - --static struct tnode *inflate(struct trie *t, struct tnode *oldtnode) -+static int inflate(struct trie *t, struct tnode *oldtnode) - { - unsigned long olen = tnode_child_length(oldtnode); -+ struct tnode *tp = node_parent(oldtnode); - struct tnode *tn; - unsigned long i; - t_key m; -@@ -468,9 +457,8 @@ static struct tnode *inflate(struct trie - pr_debug("In inflate\n"); - - tn = tnode_new(oldtnode->key, oldtnode->pos - 1, oldtnode->bits + 1); -- - if (!tn) -- return ERR_PTR(-ENOMEM); -+ return -ENOMEM; - - /* - * Preallocate and store tnodes before the actual work so we -@@ -564,30 +552,36 @@ static struct tnode *inflate(struct trie - put_child(left, j, rtnl_dereference(inode->child[j])); - put_child(right, j, rtnl_dereference(inode->child[j + size])); - } -- put_child(tn, 2*i, resize(t, left)); -- put_child(tn, 2*i+1, resize(t, right)); -+ -+ put_child(tn, 2 * i, left); -+ put_child(tn, 2 * i + 1, right); - - tnode_free_safe(inode); -+ -+ resize(t, left); -+ resize(t, right); - } -+ -+ put_child_root(tp, t, tn->key, tn); - tnode_free_safe(oldtnode); -- return tn; -+ return 0; - nomem: - tnode_clean_free(tn); -- return ERR_PTR(-ENOMEM); -+ return -ENOMEM; - } - --static struct tnode *halve(struct trie *t, struct tnode *oldtnode) -+static int halve(struct trie *t, struct tnode *oldtnode) - { - unsigned long olen = tnode_child_length(oldtnode); -+ struct tnode *tp = node_parent(oldtnode); - struct tnode *tn, *left, *right; - int i; - - pr_debug("In halve\n"); - - tn = tnode_new(oldtnode->key, oldtnode->pos + 1, oldtnode->bits - 1); -- - if (!tn) -- return ERR_PTR(-ENOMEM); -+ return -ENOMEM; - - /* - * Preallocate and store tnodes before the actual work so we -@@ -606,8 +600,10 @@ static struct tnode *halve(struct trie * - - newn = tnode_new(left->key, oldtnode->pos, 1); - -- if (!newn) -- goto nomem; -+ if (!newn) { -+ tnode_clean_free(tn); -+ return -ENOMEM; -+ } - - put_child(tn, i/2, newn); - } -@@ -635,16 +631,18 @@ static struct tnode *halve(struct trie * - - /* Two nonempty children */ - newBinNode = tnode_get_child(tn, i/2); -- put_child(tn, i/2, NULL); - put_child(newBinNode, 0, left); - put_child(newBinNode, 1, right); -- put_child(tn, i/2, resize(t, newBinNode)); -+ -+ put_child(tn, i / 2, newBinNode); -+ -+ resize(t, newBinNode); - } -+ -+ put_child_root(tp, t, tn->key, tn); - tnode_free_safe(oldtnode); -- return tn; --nomem: -- tnode_clean_free(tn); -- return ERR_PTR(-ENOMEM); -+ -+ return 0; - } - - /* From "Implementing a dynamic compressed trie" by Stefan Nilsson of -@@ -704,45 +702,48 @@ nomem: - * tnode_child_length(tn) - * - */ --static bool should_inflate(const struct tnode *tn) -+static bool should_inflate(const struct tnode *tp, const struct tnode *tn) - { - unsigned long used = tnode_child_length(tn); - unsigned long threshold = used; - - /* Keep root node larger */ -- threshold *= node_parent(tn) ? inflate_threshold : -- inflate_threshold_root; -+ threshold *= tp ? inflate_threshold : inflate_threshold_root; - used += tn->full_children; - used -= tn->empty_children; - - return tn->pos && ((50 * used) >= threshold); - } - --static bool should_halve(const struct tnode *tn) -+static bool should_halve(const struct tnode *tp, const struct tnode *tn) - { - unsigned long used = tnode_child_length(tn); - unsigned long threshold = used; - - /* Keep root node larger */ -- threshold *= node_parent(tn) ? halve_threshold : -- halve_threshold_root; -+ threshold *= tp ? halve_threshold : halve_threshold_root; - used -= tn->empty_children; - - return (tn->bits > 1) && ((100 * used) < threshold); - } - - #define MAX_WORK 10 --static struct tnode *resize(struct trie *t, struct tnode *tn) -+static void resize(struct trie *t, struct tnode *tn) - { -- struct tnode *old_tn, *n = NULL; -+ struct tnode *tp = node_parent(tn), *n = NULL; -+ struct tnode __rcu **cptr; - int max_work; - -- if (!tn) -- return NULL; -- - pr_debug("In tnode_resize %p inflate_threshold=%d threshold=%d\n", - tn, inflate_threshold, halve_threshold); - -+ /* track the tnode via the pointer from the parent instead of -+ * doing it ourselves. This way we can let RCU fully do its -+ * thing without us interfering -+ */ -+ cptr = tp ? &tp->child[get_index(tn->key, tp)] : &t->trie; -+ BUG_ON(tn != rtnl_dereference(*cptr)); -+ - /* No children */ - if (tn->empty_children > (tnode_child_length(tn) - 1)) - goto no_children; -@@ -755,39 +756,35 @@ static struct tnode *resize(struct trie - * nonempty nodes that are above the threshold. - */ - max_work = MAX_WORK; -- while (should_inflate(tn) && max_work--) { -- old_tn = tn; -- tn = inflate(t, tn); -- -- if (IS_ERR(tn)) { -- tn = old_tn; -+ while (should_inflate(tp, tn) && max_work--) { -+ if (inflate(t, tn)) { - #ifdef CONFIG_IP_FIB_TRIE_STATS - this_cpu_inc(t->stats->resize_node_skipped); - #endif - break; - } -+ -+ tn = rtnl_dereference(*cptr); - } - - /* Return if at least one inflate is run */ - if (max_work != MAX_WORK) -- return tn; -+ return; - - /* Halve as long as the number of empty children in this - * node is above threshold. - */ - max_work = MAX_WORK; -- while (should_halve(tn) && max_work--) { -- old_tn = tn; -- tn = halve(t, tn); -- if (IS_ERR(tn)) { -- tn = old_tn; -+ while (should_halve(tp, tn) && max_work--) { -+ if (halve(t, tn)) { - #ifdef CONFIG_IP_FIB_TRIE_STATS - this_cpu_inc(t->stats->resize_node_skipped); - #endif - break; - } -- } - -+ tn = rtnl_dereference(*cptr); -+ } - - /* Only one child remains */ - if (tn->empty_children == (tnode_child_length(tn) - 1)) { -@@ -797,11 +794,12 @@ one_child: - n = tnode_get_child(tn, --i); - no_children: - /* compress one level */ -- node_set_parent(n, NULL); -+ put_child_root(tp, t, tn->key, n); -+ node_set_parent(n, tp); -+ -+ /* drop dead node */ - tnode_free_safe(tn); -- return n; - } -- return tn; - } - - /* readside must use rcu_read_lock currently dump routines -@@ -882,34 +880,19 @@ static struct tnode *fib_find_node(struc - - static void trie_rebalance(struct trie *t, struct tnode *tn) - { -- int wasfull; -- t_key cindex, key; - struct tnode *tp; - -- key = tn->key; -- -- while (tn != NULL && (tp = node_parent(tn)) != NULL) { -- cindex = get_index(key, tp); -- wasfull = tnode_full(tp, tnode_get_child(tp, cindex)); -- tn = resize(t, tn); -- -- tnode_put_child_reorg(tp, cindex, tn, wasfull); -- -- tp = node_parent(tn); -- if (!tp) -- rcu_assign_pointer(t->trie, tn); -+ while ((tp = node_parent(tn)) != NULL) { -+ resize(t, tn); - - tnode_free_flush(); -- if (!tp) -- break; - tn = tp; - } - - /* Handle last (top) tnode */ - if (IS_TNODE(tn)) -- tn = resize(t, tn); -+ resize(t, tn); - -- rcu_assign_pointer(t->trie, tn); - tnode_free_flush(); - } - diff --git a/target/linux/generic/pending-3.18/080-15-fib_trie-Push-tnode-flushing-down-to-inflate-halve.patch b/target/linux/generic/pending-3.18/080-15-fib_trie-Push-tnode-flushing-down-to-inflate-halve.patch deleted file mode 100644 index 51178a0f14..0000000000 --- a/target/linux/generic/pending-3.18/080-15-fib_trie-Push-tnode-flushing-down-to-inflate-halve.patch +++ /dev/null @@ -1,237 +0,0 @@ -From: Alexander Duyck -Date: Wed, 31 Dec 2014 10:56:49 -0800 -Subject: [PATCH] fib_trie: Push tnode flushing down to inflate/halve - -This change pushes the tnode freeing down into the inflate and halve -functions. It makes more sense here as we have a better grasp of what is -going on and when a given cluster of nodes is ready to be freed. - -I believe this may address a bug in the freeing logic as well. For some -reason if the freelist got to a certain size we would call -synchronize_rcu(). I'm assuming that what they meant to do is call -synchronize_rcu() after they had handed off that much memory via -call_rcu(). As such that is what I have updated the behavior to be. - -Signed-off-by: Alexander Duyck -Signed-off-by: David S. Miller ---- - ---- a/net/ipv4/fib_trie.c -+++ b/net/ipv4/fib_trie.c -@@ -147,8 +147,6 @@ struct trie { - }; - - static void resize(struct trie *t, struct tnode *tn); --/* tnodes to free after resize(); protected by RTNL */ --static struct callback_head *tnode_free_head; - static size_t tnode_free_size; - - /* -@@ -307,32 +305,6 @@ static struct tnode *tnode_alloc(size_t - return vzalloc(size); - } - --static void tnode_free_safe(struct tnode *tn) --{ -- BUG_ON(IS_LEAF(tn)); -- tn->rcu.next = tnode_free_head; -- tnode_free_head = &tn->rcu; --} -- --static void tnode_free_flush(void) --{ -- struct callback_head *head; -- -- while ((head = tnode_free_head)) { -- struct tnode *tn = container_of(head, struct tnode, rcu); -- -- tnode_free_head = head->next; -- tnode_free_size += offsetof(struct tnode, child[1 << tn->bits]); -- -- node_free(tn); -- } -- -- if (tnode_free_size >= PAGE_SIZE * sync_pages) { -- tnode_free_size = 0; -- synchronize_rcu(); -- } --} -- - static struct tnode *leaf_new(t_key key) - { - struct tnode *l = kmem_cache_alloc(trie_leaf_kmem, GFP_KERNEL); -@@ -433,17 +405,33 @@ static void put_child_root(struct tnode - rcu_assign_pointer(t->trie, n); - } - --static void tnode_clean_free(struct tnode *tn) -+static inline void tnode_free_init(struct tnode *tn) - { -- struct tnode *tofree; -- unsigned long i; -+ tn->rcu.next = NULL; -+} -+ -+static inline void tnode_free_append(struct tnode *tn, struct tnode *n) -+{ -+ n->rcu.next = tn->rcu.next; -+ tn->rcu.next = &n->rcu; -+} - -- for (i = 0; i < tnode_child_length(tn); i++) { -- tofree = tnode_get_child(tn, i); -- if (tofree) -- node_free(tofree); -+static void tnode_free(struct tnode *tn) -+{ -+ struct callback_head *head = &tn->rcu; -+ -+ while (head) { -+ head = head->next; -+ tnode_free_size += offsetof(struct tnode, child[1 << tn->bits]); -+ node_free(tn); -+ -+ tn = container_of(head, struct tnode, rcu); -+ } -+ -+ if (tnode_free_size >= PAGE_SIZE * sync_pages) { -+ tnode_free_size = 0; -+ synchronize_rcu(); - } -- node_free(tn); - } - - static int inflate(struct trie *t, struct tnode *oldtnode) -@@ -476,20 +464,23 @@ static int inflate(struct trie *t, struc - inode->bits - 1); - if (!left) - goto nomem; -+ tnode_free_append(tn, left); - - right = tnode_new(inode->key | m, inode->pos, - inode->bits - 1); - -- if (!right) { -- node_free(left); -+ if (!right) - goto nomem; -- } -+ tnode_free_append(tn, right); - - put_child(tn, 2*i, left); - put_child(tn, 2*i+1, right); - } - } - -+ /* prepare oldtnode to be freed */ -+ tnode_free_init(oldtnode); -+ - for (i = 0; i < olen; i++) { - struct tnode *inode = tnode_get_child(oldtnode, i); - struct tnode *left, *right; -@@ -505,12 +496,13 @@ static int inflate(struct trie *t, struc - continue; - } - -+ /* drop the node in the old tnode free list */ -+ tnode_free_append(oldtnode, inode); -+ - /* An internal node with two children */ - if (inode->bits == 1) { - put_child(tn, 2*i, rtnl_dereference(inode->child[0])); - put_child(tn, 2*i+1, rtnl_dereference(inode->child[1])); -- -- tnode_free_safe(inode); - continue; - } - -@@ -556,17 +548,19 @@ static int inflate(struct trie *t, struc - put_child(tn, 2 * i, left); - put_child(tn, 2 * i + 1, right); - -- tnode_free_safe(inode); -- -+ /* resize child nodes */ - resize(t, left); - resize(t, right); - } - - put_child_root(tp, t, tn->key, tn); -- tnode_free_safe(oldtnode); -+ -+ /* we completed without error, prepare to free old node */ -+ tnode_free(oldtnode); - return 0; - nomem: -- tnode_clean_free(tn); -+ /* all pointers should be clean so we are done */ -+ tnode_free(tn); - return -ENOMEM; - } - -@@ -599,17 +593,20 @@ static int halve(struct trie *t, struct - struct tnode *newn; - - newn = tnode_new(left->key, oldtnode->pos, 1); -- - if (!newn) { -- tnode_clean_free(tn); -+ tnode_free(tn); - return -ENOMEM; - } -+ tnode_free_append(tn, newn); - - put_child(tn, i/2, newn); - } - - } - -+ /* prepare oldtnode to be freed */ -+ tnode_free_init(oldtnode); -+ - for (i = 0; i < olen; i += 2) { - struct tnode *newBinNode; - -@@ -636,11 +633,14 @@ static int halve(struct trie *t, struct - - put_child(tn, i / 2, newBinNode); - -+ /* resize child node */ - resize(t, newBinNode); - } - - put_child_root(tp, t, tn->key, tn); -- tnode_free_safe(oldtnode); -+ -+ /* all pointers should be clean so we are done */ -+ tnode_free(oldtnode); - - return 0; - } -@@ -798,7 +798,8 @@ no_children: - node_set_parent(n, tp); - - /* drop dead node */ -- tnode_free_safe(tn); -+ tnode_free_init(tn); -+ tnode_free(tn); - } - } - -@@ -884,16 +885,12 @@ static void trie_rebalance(struct trie * - - while ((tp = node_parent(tn)) != NULL) { - resize(t, tn); -- -- tnode_free_flush(); - tn = tp; - } - - /* Handle last (top) tnode */ - if (IS_TNODE(tn)) - resize(t, tn); -- -- tnode_free_flush(); - } - - /* only used from updater-side */ diff --git a/target/linux/generic/pending-3.18/080-16-fib_trie-inflate-halve-nodes-in-a-more-RCU-friendly-.patch b/target/linux/generic/pending-3.18/080-16-fib_trie-inflate-halve-nodes-in-a-more-RCU-friendly-.patch deleted file mode 100644 index d6b600c5dd..0000000000 --- a/target/linux/generic/pending-3.18/080-16-fib_trie-inflate-halve-nodes-in-a-more-RCU-friendly-.patch +++ /dev/null @@ -1,345 +0,0 @@ -From: Alexander Duyck -Date: Wed, 31 Dec 2014 10:56:55 -0800 -Subject: [PATCH] fib_trie: inflate/halve nodes in a more RCU friendly - way - -This change pulls the node_set_parent functionality out of put_child_reorg -and instead leaves that to the function to take care of as well. By doing -this we can fully construct the new cluster of tnodes and all of the -pointers out of it before we start routing pointers into it. - -I am suspecting this will likely fix some concurency issues though I don't -have a good test to show as such. - -Signed-off-by: Alexander Duyck -Signed-off-by: David S. Miller ---- - ---- a/net/ipv4/fib_trie.c -+++ b/net/ipv4/fib_trie.c -@@ -391,8 +391,6 @@ static void put_child(struct tnode *tn, - else if (!wasfull && isfull) - tn->full_children++; - -- node_set_parent(n, tn); -- - rcu_assign_pointer(tn->child[i], n); - } - -@@ -436,10 +434,8 @@ static void tnode_free(struct tnode *tn) - - static int inflate(struct trie *t, struct tnode *oldtnode) - { -- unsigned long olen = tnode_child_length(oldtnode); -- struct tnode *tp = node_parent(oldtnode); -- struct tnode *tn; -- unsigned long i; -+ struct tnode *inode, *node0, *node1, *tn, *tp; -+ unsigned long i, j, k; - t_key m; - - pr_debug("In inflate\n"); -@@ -448,43 +444,13 @@ static int inflate(struct trie *t, struc - if (!tn) - return -ENOMEM; - -- /* -- * Preallocate and store tnodes before the actual work so we -- * don't get into an inconsistent state if memory allocation -- * fails. In case of failure we return the oldnode and inflate -- * of tnode is ignored. -+ /* Assemble all of the pointers in our cluster, in this case that -+ * represents all of the pointers out of our allocated nodes that -+ * point to existing tnodes and the links between our allocated -+ * nodes. - */ -- for (i = 0, m = 1u << tn->pos; i < olen; i++) { -- struct tnode *inode = tnode_get_child(oldtnode, i); -- -- if (tnode_full(oldtnode, inode) && (inode->bits > 1)) { -- struct tnode *left, *right; -- -- left = tnode_new(inode->key & ~m, inode->pos, -- inode->bits - 1); -- if (!left) -- goto nomem; -- tnode_free_append(tn, left); -- -- right = tnode_new(inode->key | m, inode->pos, -- inode->bits - 1); -- -- if (!right) -- goto nomem; -- tnode_free_append(tn, right); -- -- put_child(tn, 2*i, left); -- put_child(tn, 2*i+1, right); -- } -- } -- -- /* prepare oldtnode to be freed */ -- tnode_free_init(oldtnode); -- -- for (i = 0; i < olen; i++) { -- struct tnode *inode = tnode_get_child(oldtnode, i); -- struct tnode *left, *right; -- unsigned long size, j; -+ for (i = tnode_child_length(oldtnode), m = 1u << tn->pos; i;) { -+ inode = tnode_get_child(oldtnode, --i); - - /* An empty child */ - if (inode == NULL) -@@ -496,65 +462,99 @@ static int inflate(struct trie *t, struc - continue; - } - -- /* drop the node in the old tnode free list */ -- tnode_free_append(oldtnode, inode); -- - /* An internal node with two children */ - if (inode->bits == 1) { -- put_child(tn, 2*i, rtnl_dereference(inode->child[0])); -- put_child(tn, 2*i+1, rtnl_dereference(inode->child[1])); -+ put_child(tn, 2 * i + 1, tnode_get_child(inode, 1)); -+ put_child(tn, 2 * i, tnode_get_child(inode, 0)); - continue; - } - -- /* An internal node with more than two children */ -- - /* We will replace this node 'inode' with two new -- * ones, 'left' and 'right', each with half of the -+ * ones, 'node0' and 'node1', each with half of the - * original children. The two new nodes will have - * a position one bit further down the key and this - * means that the "significant" part of their keys - * (see the discussion near the top of this file) - * will differ by one bit, which will be "0" in -- * left's key and "1" in right's key. Since we are -+ * node0's key and "1" in node1's key. Since we are - * moving the key position by one step, the bit that - * we are moving away from - the bit at position -- * (inode->pos) - is the one that will differ between -- * left and right. So... we synthesize that bit in the -- * two new keys. -- * The mask 'm' below will be a single "one" bit at -- * the position (inode->pos) -+ * (tn->pos) - is the one that will differ between -+ * node0 and node1. So... we synthesize that bit in the -+ * two new keys. - */ -+ node1 = tnode_new(inode->key | m, inode->pos, inode->bits - 1); -+ if (!node1) -+ goto nomem; -+ tnode_free_append(tn, node1); -+ -+ node0 = tnode_new(inode->key & ~m, inode->pos, inode->bits - 1); -+ if (!node0) -+ goto nomem; -+ tnode_free_append(tn, node0); -+ -+ /* populate child pointers in new nodes */ -+ for (k = tnode_child_length(inode), j = k / 2; j;) { -+ put_child(node1, --j, tnode_get_child(inode, --k)); -+ put_child(node0, j, tnode_get_child(inode, j)); -+ put_child(node1, --j, tnode_get_child(inode, --k)); -+ put_child(node0, j, tnode_get_child(inode, j)); -+ } -+ -+ /* link new nodes to parent */ -+ NODE_INIT_PARENT(node1, tn); -+ NODE_INIT_PARENT(node0, tn); -+ -+ /* link parent to nodes */ -+ put_child(tn, 2 * i + 1, node1); -+ put_child(tn, 2 * i, node0); -+ } -+ -+ /* setup the parent pointer into and out of this node */ -+ tp = node_parent(oldtnode); -+ NODE_INIT_PARENT(tn, tp); -+ put_child_root(tp, t, tn->key, tn); - -- /* Use the old key, but set the new significant -- * bit to zero. -- */ -+ /* prepare oldtnode to be freed */ -+ tnode_free_init(oldtnode); - -- left = tnode_get_child(tn, 2*i); -- put_child(tn, 2*i, NULL); -+ /* update all child nodes parent pointers to route to us */ -+ for (i = tnode_child_length(oldtnode); i;) { -+ inode = tnode_get_child(oldtnode, --i); - -- BUG_ON(!left); -+ /* A leaf or an internal node with skipped bits */ -+ if (!tnode_full(oldtnode, inode)) { -+ node_set_parent(inode, tn); -+ continue; -+ } - -- right = tnode_get_child(tn, 2*i+1); -- put_child(tn, 2*i+1, NULL); -+ /* drop the node in the old tnode free list */ -+ tnode_free_append(oldtnode, inode); - -- BUG_ON(!right); -+ /* fetch new nodes */ -+ node1 = tnode_get_child(tn, 2 * i + 1); -+ node0 = tnode_get_child(tn, 2 * i); - -- size = tnode_child_length(left); -- for (j = 0; j < size; j++) { -- put_child(left, j, rtnl_dereference(inode->child[j])); -- put_child(right, j, rtnl_dereference(inode->child[j + size])); -+ /* bits == 1 then node0 and node1 represent inode's children */ -+ if (inode->bits == 1) { -+ node_set_parent(node1, tn); -+ node_set_parent(node0, tn); -+ continue; - } - -- put_child(tn, 2 * i, left); -- put_child(tn, 2 * i + 1, right); -+ /* update parent pointers in child node's children */ -+ for (k = tnode_child_length(inode), j = k / 2; j;) { -+ node_set_parent(tnode_get_child(inode, --k), node1); -+ node_set_parent(tnode_get_child(inode, --j), node0); -+ node_set_parent(tnode_get_child(inode, --k), node1); -+ node_set_parent(tnode_get_child(inode, --j), node0); -+ } - - /* resize child nodes */ -- resize(t, left); -- resize(t, right); -+ resize(t, node1); -+ resize(t, node0); - } - -- put_child_root(tp, t, tn->key, tn); -- - /* we completed without error, prepare to free old node */ - tnode_free(oldtnode); - return 0; -@@ -566,10 +566,8 @@ nomem: - - static int halve(struct trie *t, struct tnode *oldtnode) - { -- unsigned long olen = tnode_child_length(oldtnode); -- struct tnode *tp = node_parent(oldtnode); -- struct tnode *tn, *left, *right; -- int i; -+ struct tnode *tn, *tp, *inode, *node0, *node1; -+ unsigned long i; - - pr_debug("In halve\n"); - -@@ -577,68 +575,64 @@ static int halve(struct trie *t, struct - if (!tn) - return -ENOMEM; - -- /* -- * Preallocate and store tnodes before the actual work so we -- * don't get into an inconsistent state if memory allocation -- * fails. In case of failure we return the oldnode and halve -- * of tnode is ignored. -+ /* Assemble all of the pointers in our cluster, in this case that -+ * represents all of the pointers out of our allocated nodes that -+ * point to existing tnodes and the links between our allocated -+ * nodes. - */ -+ for (i = tnode_child_length(oldtnode); i;) { -+ node1 = tnode_get_child(oldtnode, --i); -+ node0 = tnode_get_child(oldtnode, --i); - -- for (i = 0; i < olen; i += 2) { -- left = tnode_get_child(oldtnode, i); -- right = tnode_get_child(oldtnode, i+1); -+ /* At least one of the children is empty */ -+ if (!node1 || !node0) { -+ put_child(tn, i / 2, node1 ? : node0); -+ continue; -+ } - - /* Two nonempty children */ -- if (left && right) { -- struct tnode *newn; -- -- newn = tnode_new(left->key, oldtnode->pos, 1); -- if (!newn) { -- tnode_free(tn); -- return -ENOMEM; -- } -- tnode_free_append(tn, newn); -- -- put_child(tn, i/2, newn); -+ inode = tnode_new(node0->key, oldtnode->pos, 1); -+ if (!inode) { -+ tnode_free(tn); -+ return -ENOMEM; - } -+ tnode_free_append(tn, inode); - -+ /* initialize pointers out of node */ -+ put_child(inode, 1, node1); -+ put_child(inode, 0, node0); -+ NODE_INIT_PARENT(inode, tn); -+ -+ /* link parent to node */ -+ put_child(tn, i / 2, inode); - } - -+ /* setup the parent pointer out of and back into this node */ -+ tp = node_parent(oldtnode); -+ NODE_INIT_PARENT(tn, tp); -+ put_child_root(tp, t, tn->key, tn); -+ - /* prepare oldtnode to be freed */ - tnode_free_init(oldtnode); - -- for (i = 0; i < olen; i += 2) { -- struct tnode *newBinNode; -- -- left = tnode_get_child(oldtnode, i); -- right = tnode_get_child(oldtnode, i+1); -- -- /* At least one of the children is empty */ -- if (left == NULL) { -- if (right == NULL) /* Both are empty */ -- continue; -- put_child(tn, i/2, right); -- continue; -- } -- -- if (right == NULL) { -- put_child(tn, i/2, left); -+ /* update all of the child parent pointers */ -+ for (i = tnode_child_length(tn); i;) { -+ inode = tnode_get_child(tn, --i); -+ -+ /* only new tnodes will be considered "full" nodes */ -+ if (!tnode_full(tn, inode)) { -+ node_set_parent(inode, tn); - continue; - } - - /* Two nonempty children */ -- newBinNode = tnode_get_child(tn, i/2); -- put_child(newBinNode, 0, left); -- put_child(newBinNode, 1, right); -- -- put_child(tn, i / 2, newBinNode); -+ node_set_parent(tnode_get_child(inode, 1), inode); -+ node_set_parent(tnode_get_child(inode, 0), inode); - - /* resize child node */ -- resize(t, newBinNode); -+ resize(t, inode); - } - -- put_child_root(tp, t, tn->key, tn); -- - /* all pointers should be clean so we are done */ - tnode_free(oldtnode); - diff --git a/target/linux/generic/pending-3.18/080-17-fib_trie-Remove-checks-for-index-tnode_child_length-.patch b/target/linux/generic/pending-3.18/080-17-fib_trie-Remove-checks-for-index-tnode_child_length-.patch deleted file mode 100644 index 8f7c671ac6..0000000000 --- a/target/linux/generic/pending-3.18/080-17-fib_trie-Remove-checks-for-index-tnode_child_length-.patch +++ /dev/null @@ -1,95 +0,0 @@ -From: Alexander Duyck -Date: Wed, 31 Dec 2014 10:57:02 -0800 -Subject: [PATCH] fib_trie: Remove checks for index >= tnode_child_length - from tnode_get_child - -For some reason the compiler doesn't seem to understand that when we are in -a loop that runs from tnode_child_length - 1 to 0 we don't expect the value -of tn->bits to change. As such every call to tnode_get_child was rerunning -tnode_chile_length which ended up consuming quite a bit of space in the -resultant assembly code. - -I have gone though and verified that in all cases where tnode_get_child -is used we are either winding though a fixed loop from tnode_child_length - -1 to 0, or are in a fastpath case where we are verifying the value by -either checking for any remaining bits after shifting index by bits and -testing for leaf, or by using tnode_child_length. - -size net/ipv4/fib_trie.o -Before: - text data bss dec hex filename - 15506 376 8 15890 3e12 net/ipv4/fib_trie.o - -After: - text data bss dec hex filename - 14827 376 8 15211 3b6b net/ipv4/fib_trie.o - -Signed-off-by: Alexander Duyck -Signed-off-by: David S. Miller ---- - ---- a/net/ipv4/fib_trie.c -+++ b/net/ipv4/fib_trie.c -@@ -186,8 +186,6 @@ static inline unsigned long tnode_child_ - static inline struct tnode *tnode_get_child(const struct tnode *tn, - unsigned long i) - { -- BUG_ON(i >= tnode_child_length(tn)); -- - return rtnl_dereference(tn->child[i]); - } - -@@ -195,8 +193,6 @@ static inline struct tnode *tnode_get_ch - static inline struct tnode *tnode_get_child_rcu(const struct tnode *tn, - unsigned long i) - { -- BUG_ON(i >= tnode_child_length(tn)); -- - return rcu_dereference_rtnl(tn->child[i]); - } - -@@ -371,7 +367,7 @@ static inline int tnode_full(const struc - */ - static void put_child(struct tnode *tn, unsigned long i, struct tnode *n) - { -- struct tnode *chi = rtnl_dereference(tn->child[i]); -+ struct tnode *chi = tnode_get_child(tn, i); - int isfull, wasfull; - - BUG_ON(i >= tnode_child_length(tn)); -@@ -867,7 +863,7 @@ static struct tnode *fib_find_node(struc - if (IS_LEAF(n)) - break; - -- n = rcu_dereference_rtnl(n->child[index]); -+ n = tnode_get_child_rcu(n, index); - } - - return n; -@@ -934,7 +930,7 @@ static struct list_head *fib_insert_node - } - - tp = n; -- n = rcu_dereference_rtnl(n->child[index]); -+ n = tnode_get_child_rcu(n, index); - } - - l = leaf_new(key); -@@ -1215,7 +1211,7 @@ int fib_table_lookup(struct fib_table *t - cindex = index; - } - -- n = rcu_dereference(n->child[index]); -+ n = tnode_get_child_rcu(n, index); - if (unlikely(!n)) - goto backtrace; - } -@@ -1835,7 +1831,7 @@ static void trie_collect_stats(struct tr - if (n->bits < MAX_STAT_DEPTH) - s->nodesizes[n->bits]++; - -- for (i = 0; i < tnode_child_length(n); i++) { -+ for (i = tnode_child_length(n); i--;) { - if (!rcu_access_pointer(n->child[i])) - s->nullpointers++; - } diff --git a/target/linux/generic/pending-3.18/080-18-fib_trie-Add-tracking-value-for-suffix-length.patch b/target/linux/generic/pending-3.18/080-18-fib_trie-Add-tracking-value-for-suffix-length.patch deleted file mode 100644 index 6a4a45e952..0000000000 --- a/target/linux/generic/pending-3.18/080-18-fib_trie-Add-tracking-value-for-suffix-length.patch +++ /dev/null @@ -1,234 +0,0 @@ -From: Alexander Duyck -Date: Wed, 31 Dec 2014 10:57:08 -0800 -Subject: [PATCH] fib_trie: Add tracking value for suffix length - -This change adds a tracking value for the maximum suffix length of all -prefixes stored in any given tnode. With this value we can determine if we -need to backtrace or not based on if the suffix is greater than the pos -value. - -By doing this we can reduce the CPU overhead for lookups in the local table -as many of the prefixes there are 32b long and have a suffix length of 0 -meaning we can immediately backtrace to the root node without needing to -test any of the nodes between it and where we ended up. - -Signed-off-by: Alexander Duyck -Signed-off-by: David S. Miller ---- - ---- a/net/ipv4/fib_trie.c -+++ b/net/ipv4/fib_trie.c -@@ -96,6 +96,7 @@ struct tnode { - t_key key; - unsigned char bits; /* 2log(KEYLENGTH) bits needed */ - unsigned char pos; /* 2log(KEYLENGTH) bits needed */ -+ unsigned char slen; - struct tnode __rcu *parent; - struct rcu_head rcu; - union { -@@ -311,6 +312,7 @@ static struct tnode *leaf_new(t_key key) - * as the nodes are searched - */ - l->key = key; -+ l->slen = 0; - l->pos = 0; - /* set bits to 0 indicating we are not a tnode */ - l->bits = 0; -@@ -342,6 +344,7 @@ static struct tnode *tnode_new(t_key key - - if (tn) { - tn->parent = NULL; -+ tn->slen = pos; - tn->pos = pos; - tn->bits = bits; - tn->key = (shift < KEYLENGTH) ? (key >> shift) << shift : 0; -@@ -387,6 +390,9 @@ static void put_child(struct tnode *tn, - else if (!wasfull && isfull) - tn->full_children++; - -+ if (n && (tn->slen < n->slen)) -+ tn->slen = n->slen; -+ - rcu_assign_pointer(tn->child[i], n); - } - -@@ -635,6 +641,41 @@ static int halve(struct trie *t, struct - return 0; - } - -+static unsigned char update_suffix(struct tnode *tn) -+{ -+ unsigned char slen = tn->pos; -+ unsigned long stride, i; -+ -+ /* search though the list of children looking for nodes that might -+ * have a suffix greater than the one we currently have. This is -+ * why we start with a stride of 2 since a stride of 1 would -+ * represent the nodes with suffix length equal to tn->pos -+ */ -+ for (i = 0, stride = 0x2ul ; i < tnode_child_length(tn); i += stride) { -+ struct tnode *n = tnode_get_child(tn, i); -+ -+ if (!n || (n->slen <= slen)) -+ continue; -+ -+ /* update stride and slen based on new value */ -+ stride <<= (n->slen - slen); -+ slen = n->slen; -+ i &= ~(stride - 1); -+ -+ /* if slen covers all but the last bit we can stop here -+ * there will be nothing longer than that since only node -+ * 0 and 1 << (bits - 1) could have that as their suffix -+ * length. -+ */ -+ if ((slen + 1) >= (tn->pos + tn->bits)) -+ break; -+ } -+ -+ tn->slen = slen; -+ -+ return slen; -+} -+ - /* From "Implementing a dynamic compressed trie" by Stefan Nilsson of - * the Helsinki University of Technology and Matti Tikkanen of Nokia - * Telecommunications, page 6: -@@ -790,6 +831,19 @@ no_children: - /* drop dead node */ - tnode_free_init(tn); - tnode_free(tn); -+ return; -+ } -+ -+ /* Return if at least one deflate was run */ -+ if (max_work != MAX_WORK) -+ return; -+ -+ /* push the suffix length to the parent node */ -+ if (tn->slen > tn->pos) { -+ unsigned char slen = update_suffix(tn); -+ -+ if (tp && (slen > tp->slen)) -+ tp->slen = slen; - } - } - -@@ -818,8 +872,58 @@ static inline struct list_head *get_fa_h - return &li->falh; - } - --static void insert_leaf_info(struct hlist_head *head, struct leaf_info *new) -+static void leaf_pull_suffix(struct tnode *l) -+{ -+ struct tnode *tp = node_parent(l); -+ -+ while (tp && (tp->slen > tp->pos) && (tp->slen > l->slen)) { -+ if (update_suffix(tp) > l->slen) -+ break; -+ tp = node_parent(tp); -+ } -+} -+ -+static void leaf_push_suffix(struct tnode *l) -+{ -+ struct tnode *tn = node_parent(l); -+ -+ /* if this is a new leaf then tn will be NULL and we can sort -+ * out parent suffix lengths as a part of trie_rebalance -+ */ -+ while (tn && (tn->slen < l->slen)) { -+ tn->slen = l->slen; -+ tn = node_parent(tn); -+ } -+} -+ -+static void remove_leaf_info(struct tnode *l, struct leaf_info *old) -+{ -+ struct hlist_node *prev; -+ -+ /* record the location of the pointer to this object */ -+ prev = rtnl_dereference(hlist_pprev_rcu(&old->hlist)); -+ -+ /* remove the leaf info from the list */ -+ hlist_del_rcu(&old->hlist); -+ -+ /* if we emptied the list this leaf will be freed and we can sort -+ * out parent suffix lengths as a part of trie_rebalance -+ */ -+ if (hlist_empty(&l->list)) -+ return; -+ -+ /* if we removed the tail then we need to update slen */ -+ if (!rcu_access_pointer(hlist_next_rcu(prev))) { -+ struct leaf_info *li = hlist_entry(prev, typeof(*li), hlist); -+ -+ l->slen = KEYLENGTH - li->plen; -+ leaf_pull_suffix(l); -+ } -+} -+ -+static void insert_leaf_info(struct tnode *l, struct leaf_info *new) - { -+ struct hlist_head *head = &l->list; - struct leaf_info *li = NULL, *last = NULL; - - if (hlist_empty(head)) { -@@ -836,6 +940,12 @@ static void insert_leaf_info(struct hlis - else - hlist_add_before_rcu(&new->hlist, &li->hlist); - } -+ -+ /* if we added to the tail node then we need to update slen */ -+ if (!rcu_access_pointer(hlist_next_rcu(&new->hlist))) { -+ l->slen = KEYLENGTH - new->plen; -+ leaf_push_suffix(l); -+ } - } - - /* rcu_read_lock needs to be hold by caller from readside */ -@@ -925,7 +1035,7 @@ static struct list_head *fib_insert_node - /* we have found a leaf. Prefixes have already been compared */ - if (IS_LEAF(n)) { - /* Case 1: n is a leaf, and prefixes match*/ -- insert_leaf_info(&n->list, li); -+ insert_leaf_info(n, li); - return fa_head; - } - -@@ -939,7 +1049,7 @@ static struct list_head *fib_insert_node - return NULL; - } - -- insert_leaf_info(&l->list, li); -+ insert_leaf_info(l, li); - - /* Case 2: n is a LEAF or a TNODE and the key doesn't match. - * -@@ -1206,7 +1316,7 @@ int fib_table_lookup(struct fib_table *t - /* only record pn and cindex if we are going to be chopping - * bits later. Otherwise we are just wasting cycles. - */ -- if (index) { -+ if (n->slen > n->pos) { - pn = n; - cindex = index; - } -@@ -1225,7 +1335,7 @@ int fib_table_lookup(struct fib_table *t - * between the key and the prefix exist in the region of - * the lsb and higher in the prefix. - */ -- if (unlikely(prefix_mismatch(key, n))) -+ if (unlikely(prefix_mismatch(key, n)) || (n->slen == n->pos)) - goto backtrace; - - /* exit out and process leaf */ -@@ -1425,7 +1535,7 @@ int fib_table_delete(struct fib_table *t - tb->tb_num_default--; - - if (list_empty(fa_head)) { -- hlist_del_rcu(&li->hlist); -+ remove_leaf_info(l, li); - free_leaf_info(li); - } - diff --git a/target/linux/generic/pending-3.18/080-19-fib_trie-Use-index-0ul-n-bits-instead-of-index-n-bit.patch b/target/linux/generic/pending-3.18/080-19-fib_trie-Use-index-0ul-n-bits-instead-of-index-n-bit.patch deleted file mode 100644 index d5fc112563..0000000000 --- a/target/linux/generic/pending-3.18/080-19-fib_trie-Use-index-0ul-n-bits-instead-of-index-n-bit.patch +++ /dev/null @@ -1,52 +0,0 @@ -From: Alexander Duyck -Date: Thu, 22 Jan 2015 15:51:08 -0800 -Subject: [PATCH] fib_trie: Use index & (~0ul << n->bits) instead of index >> - n->bits - -In doing performance testing and analysis of the changes I recently found -that by shifting the index I had created an unnecessary dependency. - -I have updated the code so that we instead shift a mask by bits and then -just test against that as that should save us about 2 CPU cycles since we -can generate the mask while the key and pos are being processed. - -Signed-off-by: Alexander Duyck -Signed-off-by: David S. Miller ---- - ---- a/net/ipv4/fib_trie.c -+++ b/net/ipv4/fib_trie.c -@@ -961,12 +961,12 @@ static struct tnode *fib_find_node(struc - * prefix plus zeros for the bits in the cindex. The index - * is the difference between the key and this value. From - * this we can actually derive several pieces of data. -- * if !(index >> bits) -- * we know the value is cindex -- * else -+ * if (index & (~0ul << bits)) - * we have a mismatch in skip bits and failed -+ * else -+ * we know the value is cindex - */ -- if (index >> n->bits) -+ if (index & (~0ul << n->bits)) - return NULL; - - /* we have found a leaf. Prefixes have already been compared */ -@@ -1301,12 +1301,12 @@ int fib_table_lookup(struct fib_table *t - * prefix plus zeros for the "bits" in the prefix. The index - * is the difference between the key and this value. From - * this we can actually derive several pieces of data. -- * if !(index >> bits) -- * we know the value is child index -- * else -+ * if (index & (~0ul << bits)) - * we have a mismatch in skip bits and failed -+ * else -+ * we know the value is cindex - */ -- if (index >> n->bits) -+ if (index & (~0ul << n->bits)) - break; - - /* we have found a leaf. Prefixes have already been compared */ diff --git a/target/linux/generic/pending-3.18/080-20-fib_trie-Fix-RCU-bug-and-merge-similar-bits-of-infla.patch b/target/linux/generic/pending-3.18/080-20-fib_trie-Fix-RCU-bug-and-merge-similar-bits-of-infla.patch deleted file mode 100644 index 7e26127084..0000000000 --- a/target/linux/generic/pending-3.18/080-20-fib_trie-Fix-RCU-bug-and-merge-similar-bits-of-infla.patch +++ /dev/null @@ -1,267 +0,0 @@ -From: Alexander Duyck -Date: Thu, 22 Jan 2015 15:51:14 -0800 -Subject: [PATCH] fib_trie: Fix RCU bug and merge similar bits of inflate/halve - -This patch addresses two issues. - -The first issue is the fact that I believe I had the RCU freeing sequence -slightly out of order. As a result we could get into an issue if a caller -went into a child of a child of the new node, then backtraced into the to be -freed parent, and then attempted to access a child of a child that may have -been consumed in a resize of one of the new nodes children. To resolve this I -have moved the resize after we have freed the oldtnode. The only side effect -of this is that we will now be calling resize on more nodes in the case of -inflate due to the fact that we don't have a good way to test to see if a -full_tnode on the new node was there before or after the allocation. This -should have minimal impact however since the node should already be -correctly size so it is just the cost of calling should_inflate that we -will be taking on the node which is only a couple of cycles. - -The second issue is the fact that inflate and halve were essentially doing -the same thing after the new node was added to the trie replacing the old -one. As such it wasn't really necessary to keep the code in both functions -so I have split it out into two other functions, called replace and -update_children. - -Signed-off-by: Alexander Duyck -Signed-off-by: David S. Miller ---- - ---- a/net/ipv4/fib_trie.c -+++ b/net/ipv4/fib_trie.c -@@ -396,8 +396,30 @@ static void put_child(struct tnode *tn, - rcu_assign_pointer(tn->child[i], n); - } - --static void put_child_root(struct tnode *tp, struct trie *t, -- t_key key, struct tnode *n) -+static void update_children(struct tnode *tn) -+{ -+ unsigned long i; -+ -+ /* update all of the child parent pointers */ -+ for (i = tnode_child_length(tn); i;) { -+ struct tnode *inode = tnode_get_child(tn, --i); -+ -+ if (!inode) -+ continue; -+ -+ /* Either update the children of a tnode that -+ * already belongs to us or update the child -+ * to point to ourselves. -+ */ -+ if (node_parent(inode) == tn) -+ update_children(inode); -+ else -+ node_set_parent(inode, tn); -+ } -+} -+ -+static inline void put_child_root(struct tnode *tp, struct trie *t, -+ t_key key, struct tnode *n) - { - if (tp) - put_child(tp, get_index(key, tp), n); -@@ -434,10 +456,35 @@ static void tnode_free(struct tnode *tn) - } - } - -+static void replace(struct trie *t, struct tnode *oldtnode, struct tnode *tn) -+{ -+ struct tnode *tp = node_parent(oldtnode); -+ unsigned long i; -+ -+ /* setup the parent pointer out of and back into this node */ -+ NODE_INIT_PARENT(tn, tp); -+ put_child_root(tp, t, tn->key, tn); -+ -+ /* update all of the child parent pointers */ -+ update_children(tn); -+ -+ /* all pointers should be clean so we are done */ -+ tnode_free(oldtnode); -+ -+ /* resize children now that oldtnode is freed */ -+ for (i = tnode_child_length(tn); i;) { -+ struct tnode *inode = tnode_get_child(tn, --i); -+ -+ /* resize child node */ -+ if (tnode_full(tn, inode)) -+ resize(t, inode); -+ } -+} -+ - static int inflate(struct trie *t, struct tnode *oldtnode) - { -- struct tnode *inode, *node0, *node1, *tn, *tp; -- unsigned long i, j, k; -+ struct tnode *tn; -+ unsigned long i; - t_key m; - - pr_debug("In inflate\n"); -@@ -446,13 +493,18 @@ static int inflate(struct trie *t, struc - if (!tn) - return -ENOMEM; - -+ /* prepare oldtnode to be freed */ -+ tnode_free_init(oldtnode); -+ - /* Assemble all of the pointers in our cluster, in this case that - * represents all of the pointers out of our allocated nodes that - * point to existing tnodes and the links between our allocated - * nodes. - */ - for (i = tnode_child_length(oldtnode), m = 1u << tn->pos; i;) { -- inode = tnode_get_child(oldtnode, --i); -+ struct tnode *inode = tnode_get_child(oldtnode, --i); -+ struct tnode *node0, *node1; -+ unsigned long j, k; - - /* An empty child */ - if (inode == NULL) -@@ -464,6 +516,9 @@ static int inflate(struct trie *t, struc - continue; - } - -+ /* drop the node in the old tnode free list */ -+ tnode_free_append(oldtnode, inode); -+ - /* An internal node with two children */ - if (inode->bits == 1) { - put_child(tn, 2 * i + 1, tnode_get_child(inode, 1)); -@@ -488,9 +543,9 @@ static int inflate(struct trie *t, struc - node1 = tnode_new(inode->key | m, inode->pos, inode->bits - 1); - if (!node1) - goto nomem; -- tnode_free_append(tn, node1); -+ node0 = tnode_new(inode->key, inode->pos, inode->bits - 1); - -- node0 = tnode_new(inode->key & ~m, inode->pos, inode->bits - 1); -+ tnode_free_append(tn, node1); - if (!node0) - goto nomem; - tnode_free_append(tn, node0); -@@ -512,53 +567,9 @@ static int inflate(struct trie *t, struc - put_child(tn, 2 * i, node0); - } - -- /* setup the parent pointer into and out of this node */ -- tp = node_parent(oldtnode); -- NODE_INIT_PARENT(tn, tp); -- put_child_root(tp, t, tn->key, tn); -+ /* setup the parent pointers into and out of this node */ -+ replace(t, oldtnode, tn); - -- /* prepare oldtnode to be freed */ -- tnode_free_init(oldtnode); -- -- /* update all child nodes parent pointers to route to us */ -- for (i = tnode_child_length(oldtnode); i;) { -- inode = tnode_get_child(oldtnode, --i); -- -- /* A leaf or an internal node with skipped bits */ -- if (!tnode_full(oldtnode, inode)) { -- node_set_parent(inode, tn); -- continue; -- } -- -- /* drop the node in the old tnode free list */ -- tnode_free_append(oldtnode, inode); -- -- /* fetch new nodes */ -- node1 = tnode_get_child(tn, 2 * i + 1); -- node0 = tnode_get_child(tn, 2 * i); -- -- /* bits == 1 then node0 and node1 represent inode's children */ -- if (inode->bits == 1) { -- node_set_parent(node1, tn); -- node_set_parent(node0, tn); -- continue; -- } -- -- /* update parent pointers in child node's children */ -- for (k = tnode_child_length(inode), j = k / 2; j;) { -- node_set_parent(tnode_get_child(inode, --k), node1); -- node_set_parent(tnode_get_child(inode, --j), node0); -- node_set_parent(tnode_get_child(inode, --k), node1); -- node_set_parent(tnode_get_child(inode, --j), node0); -- } -- -- /* resize child nodes */ -- resize(t, node1); -- resize(t, node0); -- } -- -- /* we completed without error, prepare to free old node */ -- tnode_free(oldtnode); - return 0; - nomem: - /* all pointers should be clean so we are done */ -@@ -568,7 +579,7 @@ nomem: - - static int halve(struct trie *t, struct tnode *oldtnode) - { -- struct tnode *tn, *tp, *inode, *node0, *node1; -+ struct tnode *tn; - unsigned long i; - - pr_debug("In halve\n"); -@@ -577,14 +588,18 @@ static int halve(struct trie *t, struct - if (!tn) - return -ENOMEM; - -+ /* prepare oldtnode to be freed */ -+ tnode_free_init(oldtnode); -+ - /* Assemble all of the pointers in our cluster, in this case that - * represents all of the pointers out of our allocated nodes that - * point to existing tnodes and the links between our allocated - * nodes. - */ - for (i = tnode_child_length(oldtnode); i;) { -- node1 = tnode_get_child(oldtnode, --i); -- node0 = tnode_get_child(oldtnode, --i); -+ struct tnode *node1 = tnode_get_child(oldtnode, --i); -+ struct tnode *node0 = tnode_get_child(oldtnode, --i); -+ struct tnode *inode; - - /* At least one of the children is empty */ - if (!node1 || !node0) { -@@ -609,34 +624,8 @@ static int halve(struct trie *t, struct - put_child(tn, i / 2, inode); - } - -- /* setup the parent pointer out of and back into this node */ -- tp = node_parent(oldtnode); -- NODE_INIT_PARENT(tn, tp); -- put_child_root(tp, t, tn->key, tn); -- -- /* prepare oldtnode to be freed */ -- tnode_free_init(oldtnode); -- -- /* update all of the child parent pointers */ -- for (i = tnode_child_length(tn); i;) { -- inode = tnode_get_child(tn, --i); -- -- /* only new tnodes will be considered "full" nodes */ -- if (!tnode_full(tn, inode)) { -- node_set_parent(inode, tn); -- continue; -- } -- -- /* Two nonempty children */ -- node_set_parent(tnode_get_child(inode, 1), inode); -- node_set_parent(tnode_get_child(inode, 0), inode); -- -- /* resize child node */ -- resize(t, inode); -- } -- -- /* all pointers should be clean so we are done */ -- tnode_free(oldtnode); -+ /* setup the parent pointers into and out of this node */ -+ replace(t, oldtnode, tn); - - return 0; - } diff --git a/target/linux/generic/pending-3.18/080-21-fib_trie-Fall-back-to-slen-update-on-inflate-halve-f.patch b/target/linux/generic/pending-3.18/080-21-fib_trie-Fall-back-to-slen-update-on-inflate-halve-f.patch deleted file mode 100644 index 058b33bf9d..0000000000 --- a/target/linux/generic/pending-3.18/080-21-fib_trie-Fall-back-to-slen-update-on-inflate-halve-f.patch +++ /dev/null @@ -1,61 +0,0 @@ -From: Alexander Duyck -Date: Thu, 22 Jan 2015 15:51:20 -0800 -Subject: [PATCH] fib_trie: Fall back to slen update on inflate/halve failure - -This change corrects an issue where if inflate or halve fails we were -exiting the resize function without at least updating the slen for the -node. To correct this I have moved the update of max_size into the while -loop so that it is only decremented on a successful call to either inflate -or halve. - -Signed-off-by: Alexander Duyck -Signed-off-by: David S. Miller ---- - ---- a/net/ipv4/fib_trie.c -+++ b/net/ipv4/fib_trie.c -@@ -752,7 +752,7 @@ static void resize(struct trie *t, struc - { - struct tnode *tp = node_parent(tn), *n = NULL; - struct tnode __rcu **cptr; -- int max_work; -+ int max_work = MAX_WORK; - - pr_debug("In tnode_resize %p inflate_threshold=%d threshold=%d\n", - tn, inflate_threshold, halve_threshold); -@@ -775,8 +775,7 @@ static void resize(struct trie *t, struc - /* Double as long as the resulting node has a number of - * nonempty nodes that are above the threshold. - */ -- max_work = MAX_WORK; -- while (should_inflate(tp, tn) && max_work--) { -+ while (should_inflate(tp, tn) && max_work) { - if (inflate(t, tn)) { - #ifdef CONFIG_IP_FIB_TRIE_STATS - this_cpu_inc(t->stats->resize_node_skipped); -@@ -784,6 +783,7 @@ static void resize(struct trie *t, struc - break; - } - -+ max_work--; - tn = rtnl_dereference(*cptr); - } - -@@ -794,8 +794,7 @@ static void resize(struct trie *t, struc - /* Halve as long as the number of empty children in this - * node is above threshold. - */ -- max_work = MAX_WORK; -- while (should_halve(tp, tn) && max_work--) { -+ while (should_halve(tp, tn) && max_work) { - if (halve(t, tn)) { - #ifdef CONFIG_IP_FIB_TRIE_STATS - this_cpu_inc(t->stats->resize_node_skipped); -@@ -803,6 +802,7 @@ static void resize(struct trie *t, struc - break; - } - -+ max_work--; - tn = rtnl_dereference(*cptr); - } - diff --git a/target/linux/generic/pending-3.18/080-22-fib_trie-Add-collapse-and-should_collapse-to-resize.patch b/target/linux/generic/pending-3.18/080-22-fib_trie-Add-collapse-and-should_collapse-to-resize.patch deleted file mode 100644 index 19b7db7f94..0000000000 --- a/target/linux/generic/pending-3.18/080-22-fib_trie-Add-collapse-and-should_collapse-to-resize.patch +++ /dev/null @@ -1,206 +0,0 @@ -From: Alexander Duyck -Date: Thu, 22 Jan 2015 15:51:26 -0800 -Subject: [PATCH] fib_trie: Add collapse() and should_collapse() to resize - -This patch really does two things. - -First it pulls the logic for determining if we should collapse one node out -of the tree and the actual code doing the collapse into a separate pair of -functions. This helps to make the changes to these areas more readable. - -Second it encodes the upper 32b of the empty_children value onto the -full_children value in the case of bits == KEYLENGTH. By doing this we are -able to handle the case of a 32b node where empty_children would appear to -be 0 when it was actually 1ul << 32. - -Signed-off-by: Alexander Duyck -Signed-off-by: David S. Miller ---- - ---- a/net/ipv4/fib_trie.c -+++ b/net/ipv4/fib_trie.c -@@ -83,7 +83,8 @@ - - #define MAX_STAT_DEPTH 32 - --#define KEYLENGTH (8*sizeof(t_key)) -+#define KEYLENGTH (8*sizeof(t_key)) -+#define KEY_MAX ((t_key)~0) - - typedef unsigned int t_key; - -@@ -102,8 +103,8 @@ struct tnode { - union { - /* The fields in this struct are valid if bits > 0 (TNODE) */ - struct { -- unsigned int full_children; /* KEYLENGTH bits needed */ -- unsigned int empty_children; /* KEYLENGTH bits needed */ -+ t_key empty_children; /* KEYLENGTH bits needed */ -+ t_key full_children; /* KEYLENGTH bits needed */ - struct tnode __rcu *child[0]; - }; - /* This list pointer if valid if bits == 0 (LEAF) */ -@@ -302,6 +303,16 @@ static struct tnode *tnode_alloc(size_t - return vzalloc(size); - } - -+static inline void empty_child_inc(struct tnode *n) -+{ -+ ++n->empty_children ? : ++n->full_children; -+} -+ -+static inline void empty_child_dec(struct tnode *n) -+{ -+ n->empty_children-- ? : n->full_children--; -+} -+ - static struct tnode *leaf_new(t_key key) - { - struct tnode *l = kmem_cache_alloc(trie_leaf_kmem, GFP_KERNEL); -@@ -335,7 +346,7 @@ static struct leaf_info *leaf_info_new(i - - static struct tnode *tnode_new(t_key key, int pos, int bits) - { -- size_t sz = offsetof(struct tnode, child[1 << bits]); -+ size_t sz = offsetof(struct tnode, child[1ul << bits]); - struct tnode *tn = tnode_alloc(sz); - unsigned int shift = pos + bits; - -@@ -348,8 +359,10 @@ static struct tnode *tnode_new(t_key key - tn->pos = pos; - tn->bits = bits; - tn->key = (shift < KEYLENGTH) ? (key >> shift) << shift : 0; -- tn->full_children = 0; -- tn->empty_children = 1<full_children = 1; -+ else -+ tn->empty_children = 1ul << bits; - } - - pr_debug("AT %p s=%zu %zu\n", tn, sizeof(struct tnode), -@@ -375,11 +388,11 @@ static void put_child(struct tnode *tn, - - BUG_ON(i >= tnode_child_length(tn)); - -- /* update emptyChildren */ -+ /* update emptyChildren, overflow into fullChildren */ - if (n == NULL && chi != NULL) -- tn->empty_children++; -- else if (n != NULL && chi == NULL) -- tn->empty_children--; -+ empty_child_inc(tn); -+ if (n != NULL && chi == NULL) -+ empty_child_dec(tn); - - /* update fullChildren */ - wasfull = tnode_full(tn, chi); -@@ -630,6 +643,24 @@ static int halve(struct trie *t, struct - return 0; - } - -+static void collapse(struct trie *t, struct tnode *oldtnode) -+{ -+ struct tnode *n, *tp; -+ unsigned long i; -+ -+ /* scan the tnode looking for that one child that might still exist */ -+ for (n = NULL, i = tnode_child_length(oldtnode); !n && i;) -+ n = tnode_get_child(oldtnode, --i); -+ -+ /* compress one level */ -+ tp = node_parent(oldtnode); -+ put_child_root(tp, t, oldtnode->key, n); -+ node_set_parent(n, tp); -+ -+ /* drop dead node */ -+ node_free(oldtnode); -+} -+ - static unsigned char update_suffix(struct tnode *tn) - { - unsigned char slen = tn->pos; -@@ -729,10 +760,12 @@ static bool should_inflate(const struct - - /* Keep root node larger */ - threshold *= tp ? inflate_threshold : inflate_threshold_root; -- used += tn->full_children; - used -= tn->empty_children; -+ used += tn->full_children; - -- return tn->pos && ((50 * used) >= threshold); -+ /* if bits == KEYLENGTH then pos = 0, and will fail below */ -+ -+ return (used > 1) && tn->pos && ((50 * used) >= threshold); - } - - static bool should_halve(const struct tnode *tp, const struct tnode *tn) -@@ -744,13 +777,29 @@ static bool should_halve(const struct tn - threshold *= tp ? halve_threshold : halve_threshold_root; - used -= tn->empty_children; - -- return (tn->bits > 1) && ((100 * used) < threshold); -+ /* if bits == KEYLENGTH then used = 100% on wrap, and will fail below */ -+ -+ return (used > 1) && (tn->bits > 1) && ((100 * used) < threshold); -+} -+ -+static bool should_collapse(const struct tnode *tn) -+{ -+ unsigned long used = tnode_child_length(tn); -+ -+ used -= tn->empty_children; -+ -+ /* account for bits == KEYLENGTH case */ -+ if ((tn->bits == KEYLENGTH) && tn->full_children) -+ used -= KEY_MAX; -+ -+ /* One child or none, time to drop us from the trie */ -+ return used < 2; - } - - #define MAX_WORK 10 - static void resize(struct trie *t, struct tnode *tn) - { -- struct tnode *tp = node_parent(tn), *n = NULL; -+ struct tnode *tp = node_parent(tn); - struct tnode __rcu **cptr; - int max_work = MAX_WORK; - -@@ -764,14 +813,6 @@ static void resize(struct trie *t, struc - cptr = tp ? &tp->child[get_index(tn->key, tp)] : &t->trie; - BUG_ON(tn != rtnl_dereference(*cptr)); - -- /* No children */ -- if (tn->empty_children > (tnode_child_length(tn) - 1)) -- goto no_children; -- -- /* One child */ -- if (tn->empty_children == (tnode_child_length(tn) - 1)) -- goto one_child; -- - /* Double as long as the resulting node has a number of - * nonempty nodes that are above the threshold. - */ -@@ -807,19 +848,8 @@ static void resize(struct trie *t, struc - } - - /* Only one child remains */ -- if (tn->empty_children == (tnode_child_length(tn) - 1)) { -- unsigned long i; --one_child: -- for (i = tnode_child_length(tn); !n && i;) -- n = tnode_get_child(tn, --i); --no_children: -- /* compress one level */ -- put_child_root(tp, t, tn->key, n); -- node_set_parent(n, tp); -- -- /* drop dead node */ -- tnode_free_init(tn); -- tnode_free(tn); -+ if (should_collapse(tn)) { -+ collapse(t, tn); - return; - } - diff --git a/target/linux/generic/pending-3.18/080-23-fib_trie-Use-empty_children-instead-of-counting-empt.patch b/target/linux/generic/pending-3.18/080-23-fib_trie-Use-empty_children-instead-of-counting-empt.patch deleted file mode 100644 index 160fbe1f3e..0000000000 --- a/target/linux/generic/pending-3.18/080-23-fib_trie-Use-empty_children-instead-of-counting-empt.patch +++ /dev/null @@ -1,34 +0,0 @@ -From: Alexander Duyck -Date: Thu, 22 Jan 2015 15:51:33 -0800 -Subject: [PATCH] fib_trie: Use empty_children instead of counting empty nodes - in stats collection - -It doesn't make much sense to count the pointers ourselves when -empty_children already has a count for the number of NULL pointers stored -in the tnode. As such save ourselves the cycles and just use -empty_children. - -Signed-off-by: Alexander Duyck -Signed-off-by: David S. Miller ---- - ---- a/net/ipv4/fib_trie.c -+++ b/net/ipv4/fib_trie.c -@@ -1954,16 +1954,10 @@ static void trie_collect_stats(struct tr - hlist_for_each_entry_rcu(li, &n->list, hlist) - ++s->prefixes; - } else { -- unsigned long i; -- - s->tnodes++; - if (n->bits < MAX_STAT_DEPTH) - s->nodesizes[n->bits]++; -- -- for (i = tnode_child_length(n); i--;) { -- if (!rcu_access_pointer(n->child[i])) -- s->nullpointers++; -- } -+ s->nullpointers += n->empty_children; - } - } - rcu_read_unlock(); diff --git a/target/linux/generic/pending-3.18/080-24-fib_trie-Move-fib_find_alias-to-file-where-it-is-use.patch b/target/linux/generic/pending-3.18/080-24-fib_trie-Move-fib_find_alias-to-file-where-it-is-use.patch deleted file mode 100644 index 5eba700caa..0000000000 --- a/target/linux/generic/pending-3.18/080-24-fib_trie-Move-fib_find_alias-to-file-where-it-is-use.patch +++ /dev/null @@ -1,79 +0,0 @@ -From: Alexander Duyck -Date: Thu, 22 Jan 2015 15:51:39 -0800 -Subject: [PATCH] fib_trie: Move fib_find_alias to file where it is used - -The function fib_find_alias is only accessed by functions in fib_trie.c as -such it makes sense to relocate it and cast it as static so that the -compiler can take advantage of optimizations it can do to it as a local -function. - -Signed-off-by: Alexander Duyck -Signed-off-by: David S. Miller ---- - ---- a/net/ipv4/fib_lookup.h -+++ b/net/ipv4/fib_lookup.h -@@ -32,7 +32,6 @@ int fib_dump_info(struct sk_buff *skb, u - unsigned int); - void rtmsg_fib(int event, __be32 key, struct fib_alias *fa, int dst_len, - u32 tb_id, const struct nl_info *info, unsigned int nlm_flags); --struct fib_alias *fib_find_alias(struct list_head *fah, u8 tos, u32 prio); - - static inline void fib_result_assign(struct fib_result *res, - struct fib_info *fi) ---- a/net/ipv4/fib_semantics.c -+++ b/net/ipv4/fib_semantics.c -@@ -410,24 +410,6 @@ errout: - rtnl_set_sk_err(info->nl_net, RTNLGRP_IPV4_ROUTE, err); - } - --/* Return the first fib alias matching TOS with -- * priority less than or equal to PRIO. -- */ --struct fib_alias *fib_find_alias(struct list_head *fah, u8 tos, u32 prio) --{ -- if (fah) { -- struct fib_alias *fa; -- list_for_each_entry(fa, fah, fa_list) { -- if (fa->fa_tos > tos) -- continue; -- if (fa->fa_info->fib_priority >= prio || -- fa->fa_tos < tos) -- return fa; -- } -- } -- return NULL; --} -- - static int fib_detect_death(struct fib_info *fi, int order, - struct fib_info **last_resort, int *last_idx, - int dflt) ---- a/net/ipv4/fib_trie.c -+++ b/net/ipv4/fib_trie.c -@@ -998,6 +998,26 @@ static struct tnode *fib_find_node(struc - return n; - } - -+/* Return the first fib alias matching TOS with -+ * priority less than or equal to PRIO. -+ */ -+static struct fib_alias *fib_find_alias(struct list_head *fah, u8 tos, u32 prio) -+{ -+ struct fib_alias *fa; -+ -+ if (!fah) -+ return NULL; -+ -+ list_for_each_entry(fa, fah, fa_list) { -+ if (fa->fa_tos > tos) -+ continue; -+ if (fa->fa_info->fib_priority >= prio || fa->fa_tos < tos) -+ return fa; -+ } -+ -+ return NULL; -+} -+ - static void trie_rebalance(struct trie *t, struct tnode *tn) - { - struct tnode *tp; diff --git a/target/linux/generic/pending-3.18/080-25-fib_trie-Various-clean-ups-for-handling-slen.patch b/target/linux/generic/pending-3.18/080-25-fib_trie-Various-clean-ups-for-handling-slen.patch deleted file mode 100644 index c7739d0323..0000000000 --- a/target/linux/generic/pending-3.18/080-25-fib_trie-Various-clean-ups-for-handling-slen.patch +++ /dev/null @@ -1,116 +0,0 @@ -From: Alexander Duyck -Date: Thu, 22 Jan 2015 15:51:45 -0800 -Subject: [PATCH] fib_trie: Various clean-ups for handling slen - -While doing further work on the fib_trie I noted a few items. - -First I was using calls that were far more complicated than they needed to -be for determining when to push/pull the suffix length. I have updated the -code to reflect the simplier logic. - -The second issue is that I realised we weren't necessarily handling the -case of a leaf_info struct surviving a flush. I have updated the logic so -that now we will call pull_suffix in the event of having a leaf info value -left in the leaf after flushing it. - -Signed-off-by: Alexander Duyck -Signed-off-by: David S. Miller ---- - ---- a/net/ipv4/fib_trie.c -+++ b/net/ipv4/fib_trie.c -@@ -917,27 +917,20 @@ static void leaf_push_suffix(struct tnod - - static void remove_leaf_info(struct tnode *l, struct leaf_info *old) - { -- struct hlist_node *prev; -- -- /* record the location of the pointer to this object */ -- prev = rtnl_dereference(hlist_pprev_rcu(&old->hlist)); -+ /* record the location of the previous list_info entry */ -+ struct hlist_node **pprev = old->hlist.pprev; -+ struct leaf_info *li = hlist_entry(pprev, typeof(*li), hlist.next); - - /* remove the leaf info from the list */ - hlist_del_rcu(&old->hlist); - -- /* if we emptied the list this leaf will be freed and we can sort -- * out parent suffix lengths as a part of trie_rebalance -- */ -- if (hlist_empty(&l->list)) -+ /* only access li if it is pointing at the last valid hlist_node */ -+ if (hlist_empty(&l->list) || (*pprev)) - return; - -- /* if we removed the tail then we need to update slen */ -- if (!rcu_access_pointer(hlist_next_rcu(prev))) { -- struct leaf_info *li = hlist_entry(prev, typeof(*li), hlist); -- -- l->slen = KEYLENGTH - li->plen; -- leaf_pull_suffix(l); -- } -+ /* update the trie with the latest suffix length */ -+ l->slen = KEYLENGTH - li->plen; -+ leaf_pull_suffix(l); - } - - static void insert_leaf_info(struct tnode *l, struct leaf_info *new) -@@ -961,7 +954,7 @@ static void insert_leaf_info(struct tnod - } - - /* if we added to the tail node then we need to update slen */ -- if (!rcu_access_pointer(hlist_next_rcu(&new->hlist))) { -+ if (l->slen < (KEYLENGTH - new->plen)) { - l->slen = KEYLENGTH - new->plen; - leaf_push_suffix(l); - } -@@ -1613,6 +1606,7 @@ static int trie_flush_leaf(struct tnode - struct hlist_head *lih = &l->list; - struct hlist_node *tmp; - struct leaf_info *li = NULL; -+ unsigned char plen = KEYLENGTH; - - hlist_for_each_entry_safe(li, tmp, lih, hlist) { - found += trie_flush_list(&li->falh); -@@ -1620,8 +1614,14 @@ static int trie_flush_leaf(struct tnode - if (list_empty(&li->falh)) { - hlist_del_rcu(&li->hlist); - free_leaf_info(li); -+ continue; - } -+ -+ plen = li->plen; - } -+ -+ l->slen = KEYLENGTH - plen; -+ - return found; - } - -@@ -1700,13 +1700,22 @@ int fib_table_flush(struct fib_table *tb - for (l = trie_firstleaf(t); l; l = trie_nextleaf(l)) { - found += trie_flush_leaf(l); - -- if (ll && hlist_empty(&ll->list)) -- trie_leaf_remove(t, ll); -+ if (ll) { -+ if (hlist_empty(&ll->list)) -+ trie_leaf_remove(t, ll); -+ else -+ leaf_pull_suffix(ll); -+ } -+ - ll = l; - } - -- if (ll && hlist_empty(&ll->list)) -- trie_leaf_remove(t, ll); -+ if (ll) { -+ if (hlist_empty(&ll->list)) -+ trie_leaf_remove(t, ll); -+ else -+ leaf_pull_suffix(ll); -+ } - - pr_debug("trie_flush found=%d\n", found); - return found; diff --git a/target/linux/generic/pending-3.18/081-01-pppoe-Use-workqueue-to-die-properly-when-a-PADT-is-r.patch b/target/linux/generic/pending-3.18/081-01-pppoe-Use-workqueue-to-die-properly-when-a-PADT-is-r.patch deleted file mode 100644 index fb44df97e9..0000000000 --- a/target/linux/generic/pending-3.18/081-01-pppoe-Use-workqueue-to-die-properly-when-a-PADT-is-r.patch +++ /dev/null @@ -1,89 +0,0 @@ -From: Simon Farnsworth -Date: Sun, 1 Mar 2015 10:54:39 +0000 -Subject: [PATCH] pppoe: Use workqueue to die properly when a PADT is received - -When a PADT frame is received, the socket may not be in a good state to -close down the PPP interface. The current implementation handles this by -simply blocking all further PPP traffic, and hoping that the lack of traffic -will trigger the user to investigate. - -Use schedule_work to get to a process context from which we clear down the -PPP interface, in a fashion analogous to hangup on a TTY-based PPP -interface. This causes pppd to disconnect immediately, and allows tools to -take immediate corrective action. - -Note that pppd's rp_pppoe.so plugin has code in it to disable the session -when it disconnects; however, as a consequence of this patch, the session is -already disabled before rp_pppoe.so is asked to disable the session. The -result is a harmless error message: - -Failed to disconnect PPPoE socket: 114 Operation already in progress - -This message is safe to ignore, as long as the error is 114 Operation -already in progress; in that specific case, it means that the PPPoE session -has already been disabled before pppd tried to disable it. - -Signed-off-by: Simon Farnsworth -Tested-by: Dan Williams -Tested-by: Christoph Schulz -Signed-off-by: David S. Miller ---- - ---- a/drivers/net/ppp/pppoe.c -+++ b/drivers/net/ppp/pppoe.c -@@ -454,6 +454,18 @@ out: - return NET_RX_DROP; - } - -+static void pppoe_unbind_sock_work(struct work_struct *work) -+{ -+ struct pppox_sock *po = container_of(work, struct pppox_sock, -+ proto.pppoe.padt_work); -+ struct sock *sk = sk_pppox(po); -+ -+ lock_sock(sk); -+ pppox_unbind_sock(sk); -+ release_sock(sk); -+ sock_put(sk); -+} -+ - /************************************************************************ - * - * Receive a PPPoE Discovery frame. -@@ -499,7 +511,8 @@ static int pppoe_disc_rcv(struct sk_buff - } - - bh_unlock_sock(sk); -- sock_put(sk); -+ if (!schedule_work(&po->proto.pppoe.padt_work)) -+ sock_put(sk); - } - - abort: -@@ -612,6 +625,8 @@ static int pppoe_connect(struct socket * - - lock_sock(sk); - -+ INIT_WORK(&po->proto.pppoe.padt_work, pppoe_unbind_sock_work); -+ - error = -EINVAL; - - if (sockaddr_len != sizeof(struct sockaddr_pppox)) ---- a/include/linux/if_pppox.h -+++ b/include/linux/if_pppox.h -@@ -19,6 +19,7 @@ - #include - #include - #include -+#include - #include - - static inline struct pppoe_hdr *pppoe_hdr(const struct sk_buff *skb) -@@ -32,6 +33,7 @@ struct pppoe_opt { - struct pppoe_addr pa; /* what this socket is bound to*/ - struct sockaddr_pppox relay; /* what socket data will be - relayed to (PPPoE relaying) */ -+ struct work_struct padt_work;/* Work item for handling PADT */ - }; - - struct pptp_opt { diff --git a/target/linux/generic/pending-3.18/081-02-pppoe-Lacks-DST-MAC-address-check.patch b/target/linux/generic/pending-3.18/081-02-pppoe-Lacks-DST-MAC-address-check.patch deleted file mode 100644 index f592929b3e..0000000000 --- a/target/linux/generic/pending-3.18/081-02-pppoe-Lacks-DST-MAC-address-check.patch +++ /dev/null @@ -1,25 +0,0 @@ -From: Joakim Tjernlund -Date: Mon, 20 Apr 2015 21:07:48 +0200 -Subject: [PATCH] pppoe: Lacks DST MAC address check - -A pppoe session is identified by its session ID and MAC address. -Currently pppoe does not check if the received pkg has the correct -MAC address. This is a problem when the eth I/F is in promisc mode -as then any DST MAC address is accepted. - -Signed-off-by: Joakim Tjernlund -Signed-off-by: David S. Miller ---- - ---- a/drivers/net/ppp/pppoe.c -+++ b/drivers/net/ppp/pppoe.c -@@ -379,6 +379,9 @@ static int pppoe_rcv_core(struct sock *s - * can't change. - */ - -+ if (skb->pkt_type == PACKET_OTHERHOST) -+ goto abort_kfree; -+ - if (sk->sk_state & PPPOX_BOUND) { - ppp_input(&po->chan, skb); - } else if (sk->sk_state & PPPOX_RELAY) { diff --git a/target/linux/generic/pending-3.18/081-03-pppoe-drop-pppoe-device-in-pppoe_unbind_sock_work.patch b/target/linux/generic/pending-3.18/081-03-pppoe-drop-pppoe-device-in-pppoe_unbind_sock_work.patch deleted file mode 100644 index 07d64359ce..0000000000 --- a/target/linux/generic/pending-3.18/081-03-pppoe-drop-pppoe-device-in-pppoe_unbind_sock_work.patch +++ /dev/null @@ -1,28 +0,0 @@ -From: Felix Fietkau -Date: Sat, 9 May 2015 23:08:38 +0200 -Subject: [PATCH] pppoe: drop pppoe device in pppoe_unbind_sock_work - -After receiving a PADT and the socket is closed, user space will no -longer drop the reference to the pppoe device. -This leads to errors like this: - -[ 488.570000] unregister_netdevice: waiting for eth0.2 to become free. Usage count = 2 - -Fixes: 287f3a943fe ("pppoe: Use workqueue to die properly when a PADT is received") -Signed-off-by: Felix Fietkau -Signed-off-by: David S. Miller ---- - ---- a/drivers/net/ppp/pppoe.c -+++ b/drivers/net/ppp/pppoe.c -@@ -464,6 +464,10 @@ static void pppoe_unbind_sock_work(struc - struct sock *sk = sk_pppox(po); - - lock_sock(sk); -+ if (po->pppoe_dev) { -+ dev_put(po->pppoe_dev); -+ po->pppoe_dev = NULL; -+ } - pppox_unbind_sock(sk); - release_sock(sk); - sock_put(sk); diff --git a/target/linux/generic/pending-3.18/081-06-ppp-don-t-set-sk_state-to-PPPOX_ZOMBIE-in-pppoe_disc.patch b/target/linux/generic/pending-3.18/081-06-ppp-don-t-set-sk_state-to-PPPOX_ZOMBIE-in-pppoe_disc.patch deleted file mode 100644 index 8d155eba1d..0000000000 --- a/target/linux/generic/pending-3.18/081-06-ppp-don-t-set-sk_state-to-PPPOX_ZOMBIE-in-pppoe_disc.patch +++ /dev/null @@ -1,45 +0,0 @@ -From: Guillaume Nault -Date: Thu, 19 Nov 2015 12:52:56 +0100 -Subject: [PATCH] ppp: don't set sk_state to PPPOX_ZOMBIE in pppoe_disc_rcv() - -Since 287f3a943fef ("pppoe: Use workqueue to die properly when a PADT -is received"), pppoe_disc_rcv() disconnects the socket by scheduling -pppoe_unbind_sock_work(). This is enough to stop socket transmission -and makes the PPPOX_ZOMBIE state uncessary. - -Signed-off-by: Guillaume Nault -Signed-off-by: David S. Miller ---- - ---- a/drivers/net/ppp/pppoe.c -+++ b/drivers/net/ppp/pppoe.c -@@ -500,27 +500,9 @@ static int pppoe_disc_rcv(struct sk_buff - - pn = pppoe_pernet(dev_net(dev)); - po = get_item(pn, ph->sid, eth_hdr(skb)->h_source, dev->ifindex); -- if (po) { -- struct sock *sk = sk_pppox(po); -- -- bh_lock_sock(sk); -- -- /* If the user has locked the socket, just ignore -- * the packet. With the way two rcv protocols hook into -- * one socket family type, we cannot (easily) distinguish -- * what kind of SKB it is during backlog rcv. -- */ -- if (sock_owned_by_user(sk) == 0) { -- /* We're no longer connect at the PPPOE layer, -- * and must wait for ppp channel to disconnect us. -- */ -- sk->sk_state = PPPOX_ZOMBIE; -- } -- -- bh_unlock_sock(sk); -+ if (po) - if (!schedule_work(&po->proto.pppoe.padt_work)) -- sock_put(sk); -- } -+ sock_put(sk_pppox(po)); - - abort: - kfree_skb(skb); diff --git a/target/linux/generic/pending-3.18/081-07-ppp-remove-PPPOX_ZOMBIE-socket-state.patch b/target/linux/generic/pending-3.18/081-07-ppp-remove-PPPOX_ZOMBIE-socket-state.patch deleted file mode 100644 index 28ec03b410..0000000000 --- a/target/linux/generic/pending-3.18/081-07-ppp-remove-PPPOX_ZOMBIE-socket-state.patch +++ /dev/null @@ -1,51 +0,0 @@ -From: Guillaume Nault -Date: Thu, 19 Nov 2015 12:53:21 +0100 -Subject: [PATCH] ppp: remove PPPOX_ZOMBIE socket state - -PPPOX_ZOMBIE is never set anymore. - -Signed-off-by: Guillaume Nault -Signed-off-by: David S. Miller ---- - ---- a/drivers/net/ppp/pppoe.c -+++ b/drivers/net/ppp/pppoe.c -@@ -311,7 +311,7 @@ static void pppoe_flush_dev(struct net_d - lock_sock(sk); - - if (po->pppoe_dev == dev && -- sk->sk_state & (PPPOX_CONNECTED | PPPOX_BOUND | PPPOX_ZOMBIE)) { -+ sk->sk_state & (PPPOX_CONNECTED | PPPOX_BOUND)) { - pppox_unbind_sock(sk); - sk->sk_state_change(sk); - po->pppoe_dev = NULL; -@@ -779,7 +779,7 @@ static int pppoe_ioctl(struct socket *so - struct pppox_sock *relay_po; - - err = -EBUSY; -- if (sk->sk_state & (PPPOX_BOUND | PPPOX_ZOMBIE | PPPOX_DEAD)) -+ if (sk->sk_state & (PPPOX_BOUND | PPPOX_DEAD)) - break; - - err = -ENOTCONN; ---- a/drivers/net/ppp/pppox.c -+++ b/drivers/net/ppp/pppox.c -@@ -58,7 +58,7 @@ void pppox_unbind_sock(struct sock *sk) - { - /* Clear connection to ppp device, if attached. */ - -- if (sk->sk_state & (PPPOX_BOUND | PPPOX_CONNECTED | PPPOX_ZOMBIE)) { -+ if (sk->sk_state & (PPPOX_BOUND | PPPOX_CONNECTED)) { - ppp_unregister_channel(&pppox_sk(sk)->chan); - sk->sk_state = PPPOX_DEAD; - } ---- a/include/linux/if_pppox.h -+++ b/include/linux/if_pppox.h -@@ -91,7 +91,6 @@ enum { - PPPOX_CONNECTED = 1, /* connection established ==TCP_ESTABLISHED */ - PPPOX_BOUND = 2, /* bound to ppp device */ - PPPOX_RELAY = 4, /* forwarding is enabled */ -- PPPOX_ZOMBIE = 8, /* dead, but still bound to ppp device */ - PPPOX_DEAD = 16 /* dead, useless, please clean me up!*/ - }; - diff --git a/target/linux/generic/pending-3.18/081-08-pppoe-fix-memory-corruption-in-padt-work-structure.patch b/target/linux/generic/pending-3.18/081-08-pppoe-fix-memory-corruption-in-padt-work-structure.patch deleted file mode 100644 index 8637746b5b..0000000000 --- a/target/linux/generic/pending-3.18/081-08-pppoe-fix-memory-corruption-in-padt-work-structure.patch +++ /dev/null @@ -1,82 +0,0 @@ -From: Guillaume Nault -Date: Thu, 3 Dec 2015 16:49:32 +0100 -Subject: [PATCH] pppoe: fix memory corruption in padt work structure - -pppoe_connect() mustn't touch the padt_work field of pppoe sockets -because that work could be already pending. - -[ 21.473147] BUG: unable to handle kernel NULL pointer dereference at 00000004 -[ 21.474523] IP: [] process_one_work+0x29/0x31c -[ 21.475164] *pde = 00000000 -[ 21.475513] Oops: 0000 [#1] SMP -[ 21.475910] Modules linked in: pppoe pppox ppp_generic slhc crc32c_intel aesni_intel virtio_net xts aes_i586 lrw gf128mul ablk_helper cryptd evdev acpi_cpufreq processor serio_raw button ext4 crc16 mbcache jbd2 virtio_blk virtio_pci virtio_ring virtio -[ 21.476168] CPU: 2 PID: 164 Comm: kworker/2:2 Not tainted 4.4.0-rc1 #1 -[ 21.476168] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS Debian-1.8.2-1 04/01/2014 -[ 21.476168] task: f5f83c00 ti: f5e28000 task.ti: f5e28000 -[ 21.476168] EIP: 0060:[] EFLAGS: 00010046 CPU: 2 -[ 21.476168] EIP is at process_one_work+0x29/0x31c -[ 21.484082] EAX: 00000000 EBX: f678b2a0 ECX: 00000004 EDX: 00000000 -[ 21.484082] ESI: f6c69940 EDI: f5e29ef0 EBP: f5e29f0c ESP: f5e29edc -[ 21.484082] DS: 007b ES: 007b FS: 00d8 GS: 0000 SS: 0068 -[ 21.484082] CR0: 80050033 CR2: 000000a4 CR3: 317ad000 CR4: 00040690 -[ 21.484082] Stack: -[ 21.484082] 00000000 f6c69950 00000000 f6c69940 c0042338 f5e29f0c c1327945 00000000 -[ 21.484082] 00000008 f678b2a0 f6c69940 f678b2b8 f5e29f30 c1043984 f5f83c00 f6c69970 -[ 21.484082] f678b2a0 c10437d3 f6775e80 f678b2a0 c10437d3 f5e29fac c1047059 f5e29f74 -[ 21.484082] Call Trace: -[ 21.484082] [] ? _raw_spin_lock_irq+0x28/0x30 -[ 21.484082] [] worker_thread+0x1b1/0x244 -[ 21.484082] [] ? rescuer_thread+0x229/0x229 -[ 21.484082] [] ? rescuer_thread+0x229/0x229 -[ 21.484082] [] kthread+0x8f/0x94 -[ 21.484082] [] ? _raw_spin_unlock_irq+0x22/0x26 -[ 21.484082] [] ret_from_kernel_thread+0x21/0x38 -[ 21.484082] [] ? kthread_parkme+0x19/0x19 -[ 21.496082] Code: 5d c3 55 89 e5 57 56 53 89 c3 83 ec 24 89 d0 89 55 e0 8d 7d e4 e8 6c d8 ff ff b9 04 00 00 00 89 45 d8 8b 43 24 89 45 dc 8b 45 d8 <8b> 40 04 8b 80 e0 00 00 00 c1 e8 05 24 01 88 45 d7 8b 45 e0 8d -[ 21.496082] EIP: [] process_one_work+0x29/0x31c SS:ESP 0068:f5e29edc -[ 21.496082] CR2: 0000000000000004 -[ 21.496082] ---[ end trace e362cc9cf10dae89 ]--- - -Reported-by: Andrew -Fixes: 287f3a943fef ("pppoe: Use workqueue to die properly when a PADT is received") -Signed-off-by: Guillaume Nault -Signed-off-by: David S. Miller ---- - ---- a/drivers/net/ppp/pppoe.c -+++ b/drivers/net/ppp/pppoe.c -@@ -550,6 +550,9 @@ static int pppoe_create(struct net *net, - sk->sk_family = PF_PPPOX; - sk->sk_protocol = PX_PROTO_OE; - -+ INIT_WORK(&pppox_sk(sk)->proto.pppoe.padt_work, -+ pppoe_unbind_sock_work); -+ - return 0; - } - -@@ -614,8 +617,6 @@ static int pppoe_connect(struct socket * - - lock_sock(sk); - -- INIT_WORK(&po->proto.pppoe.padt_work, pppoe_unbind_sock_work); -- - error = -EINVAL; - - if (sockaddr_len != sizeof(struct sockaddr_pppox)) -@@ -649,8 +650,13 @@ static int pppoe_connect(struct socket * - po->pppoe_dev = NULL; - } - -- memset(sk_pppox(po) + 1, 0, -- sizeof(struct pppox_sock) - sizeof(struct sock)); -+ po->pppoe_ifindex = 0; -+ memset(&po->pppoe_pa, 0, sizeof(po->pppoe_pa)); -+ memset(&po->pppoe_relay, 0, sizeof(po->pppoe_relay)); -+ memset(&po->chan, 0, sizeof(po->chan)); -+ po->next = NULL; -+ po->num = 0; -+ - sk->sk_state = PPPOX_NONE; - } - diff --git a/target/linux/generic/pending-3.18/082-ipv6-ip6_fragment-fix-headroom-tests-and-skb-leak.patch b/target/linux/generic/pending-3.18/082-ipv6-ip6_fragment-fix-headroom-tests-and-skb-leak.patch deleted file mode 100644 index 8990061303..0000000000 --- a/target/linux/generic/pending-3.18/082-ipv6-ip6_fragment-fix-headroom-tests-and-skb-leak.patch +++ /dev/null @@ -1,101 +0,0 @@ -From: Florian Westphal -Date: Thu, 17 Sep 2015 11:24:48 +0100 -Subject: [PATCH] ipv6: ip6_fragment: fix headroom tests and skb leak - -David Woodhouse reports skb_under_panic when we try to push ethernet -header to fragmented ipv6 skbs: - - skbuff: skb_under_panic: text:c1277f1e len:1294 put:14 head:dec98000 - data:dec97ffc tail:0xdec9850a end:0xdec98f40 dev:br-lan -[..] -ip6_finish_output2+0x196/0x4da - -David further debugged this: - [..] offending fragments were arriving here with skb_headroom(skb)==10. - Which is reasonable, being the Solos ADSL card's header of 8 bytes - followed by 2 bytes of PPP frame type. - -The problem is that if netfilter ipv6 defragmentation is used, skb_cow() -in ip6_forward will only see reassembled skb. - -Therefore, headroom is overestimated by 8 bytes (we pulled fragment -header) and we don't check the skbs in the frag_list either. - -We can't do these checks in netfilter defrag since outdev isn't known yet. - -Furthermore, existing tests in ip6_fragment did not consider the fragment -or ipv6 header size when checking headroom of the fraglist skbs. - -While at it, also fix a skb leak on memory allocation -- ip6_fragment -must consume the skb. - -I tested this e1000 driver hacked to not allocate additional headroom -(we end up in slowpath, since LL_RESERVED_SPACE is 16). - -If 2 bytes of headroom are allocated, fastpath is taken (14 byte -ethernet header was pulled, so 16 byte headroom available in all -fragments). - -Reported-by: David Woodhouse -Diagnosed-by: David Woodhouse -Signed-off-by: Florian Westphal -Closes 20532 ---- - ---- a/net/ipv6/ip6_output.c -+++ b/net/ipv6/ip6_output.c -@@ -603,20 +603,22 @@ int ip6_fragment(struct sk_buff *skb, in - } - mtu -= hlen + sizeof(struct frag_hdr); - -+ hroom = LL_RESERVED_SPACE(rt->dst.dev); - if (skb_has_frag_list(skb)) { - int first_len = skb_pagelen(skb); - struct sk_buff *frag2; - - if (first_len - hlen > mtu || - ((first_len - hlen) & 7) || -- skb_cloned(skb)) -+ skb_cloned(skb) || -+ skb_headroom(skb) < (hroom + sizeof(struct frag_hdr))) - goto slow_path; - - skb_walk_frags(skb, frag) { - /* Correct geometry. */ - if (frag->len > mtu || - ((frag->len & 7) && frag->next) || -- skb_headroom(frag) < hlen) -+ skb_headroom(frag) < (hlen + hroom + sizeof(struct frag_hdr))) - goto slow_path_clean; - - /* Partially cloned skb? */ -@@ -633,8 +635,6 @@ int ip6_fragment(struct sk_buff *skb, in - - err = 0; - offset = 0; -- frag = skb_shinfo(skb)->frag_list; -- skb_frag_list_init(skb); - /* BUILD HEADER */ - - *prevhdr = NEXTHDR_FRAGMENT; -@@ -642,8 +642,11 @@ int ip6_fragment(struct sk_buff *skb, in - if (!tmp_hdr) { - IP6_INC_STATS(net, ip6_dst_idev(skb_dst(skb)), - IPSTATS_MIB_FRAGFAILS); -- return -ENOMEM; -+ err = -ENOMEM; -+ goto fail; - } -+ frag = skb_shinfo(skb)->frag_list; -+ skb_frag_list_init(skb); - - __skb_pull(skb, hlen); - fh = (struct frag_hdr *)__skb_push(skb, sizeof(struct frag_hdr)); -@@ -741,7 +744,6 @@ slow_path: - */ - - *prevhdr = NEXTHDR_FRAGMENT; -- hroom = LL_RESERVED_SPACE(rt->dst.dev); - troom = rt->dst.dev->needed_tailroom; - - /* diff --git a/target/linux/generic/pending-3.18/083-solos-pci-Increase-headroom-on-received-packets.patch b/target/linux/generic/pending-3.18/083-solos-pci-Increase-headroom-on-received-packets.patch deleted file mode 100644 index 7f9f9266c6..0000000000 --- a/target/linux/generic/pending-3.18/083-solos-pci-Increase-headroom-on-received-packets.patch +++ /dev/null @@ -1,54 +0,0 @@ -From: David Woodhouse -Date: Thu, 17 Sep 2015 11:19:53 +0100 -Subject: [PATCH] solos-pci: Increase headroom on received packets -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -A comment in include/linux/skbuff.h says that: - - * Various parts of the networking layer expect at least 32 bytes of - * headroom, you should not reduce this. - -This was demonstrated by a panic when handling fragmented IPv6 packets: -http://marc.info/?l=linux-netdev&m=144236093519172&w=2 - -It's not entirely clear if that comment is still valid — and if it is, -perhaps netif_rx() ought to be enforcing it with a warning. - -But either way, it is rather stupid from a performance point of view -for us to be receiving packets into a buffer which doesn't have enough -room to prepend an Ethernet header — it means that *every* incoming -packet is going to be need to be reallocated. So let's fix that. - -Signed-off-by: David Woodhouse ---- - ---- a/drivers/atm/solos-pci.c -+++ b/drivers/atm/solos-pci.c -@@ -805,7 +805,12 @@ static void solos_bh(unsigned long card_ - continue; - } - -- skb = alloc_skb(size + 1, GFP_ATOMIC); -+ /* Use netdev_alloc_skb() because it adds NET_SKB_PAD of -+ * headroom, and ensures we can route packets back out an -+ * Ethernet interface (for example) without having to -+ * reallocate. Adding NET_IP_ALIGN also ensures that both -+ * PPPoATM and PPPoEoBR2684 packets end up aligned. */ -+ skb = netdev_alloc_skb_ip_align(NULL, size + 1); - if (!skb) { - if (net_ratelimit()) - dev_warn(&card->dev->dev, "Failed to allocate sk_buff for RX\n"); -@@ -869,7 +874,10 @@ static void solos_bh(unsigned long card_ - /* Allocate RX skbs for any ports which need them */ - if (card->using_dma && card->atmdev[port] && - !card->rx_skb[port]) { -- struct sk_buff *skb = alloc_skb(RX_DMA_SIZE, GFP_ATOMIC); -+ /* Unlike the MMIO case (qv) we can't add NET_IP_ALIGN -+ * here; the FPGA can only DMA to addresses which are -+ * aligned to 4 bytes. */ -+ struct sk_buff *skb = dev_alloc_skb(RX_DMA_SIZE); - if (skb) { - SKB_CB(skb)->dma_addr = - pci_map_single(card->dev, skb->data, diff --git a/target/linux/generic/pending-3.18/087-regmap-make-LZO-cache-optional.patch b/target/linux/generic/pending-3.18/087-regmap-make-LZO-cache-optional.patch deleted file mode 100644 index 94b61fdab4..0000000000 --- a/target/linux/generic/pending-3.18/087-regmap-make-LZO-cache-optional.patch +++ /dev/null @@ -1,67 +0,0 @@ -From de88e9b0354c2e3ff8eae3f97afe43a34f5ed239 Mon Sep 17 00:00:00 2001 -From: Jonas Gorski -Date: Sat, 13 May 2017 13:03:21 +0200 -Subject: [PATCH] regmap: make LZO cache optional - -Commit 2cbbb579bcbe3 ("regmap: Add the LZO cache support") added support -for LZO compression in regcache, but there were never any users added -afterwards. Since LZO support itself has its own size, it currently is -rather a deoptimization. - -So make it optional by introducing a symbol that can be selected by -drivers wanting to make use of it. - -Saves e.g. ~46 kB on MIPS (size of LZO support + regcache LZO code). - -Signed-off-by: Jonas Gorski ---- -I tried using google to find any users (even out-of-tree ones), but at -best I found a single driver submission that was switched to RBTREE in -subsequent resubmissions (MFD_SMSC). - -One could maybe also just drop the code because of no users for 5 years, -but that would be up to the maintainer(s) to decide. - - drivers/base/regmap/Kconfig | 5 ++++- - drivers/base/regmap/Makefile | 3 ++- - drivers/base/regmap/regcache.c | 2 ++ - 3 files changed, 8 insertions(+), 2 deletions(-) - ---- a/drivers/base/regmap/Kconfig -+++ b/drivers/base/regmap/Kconfig -@@ -4,9 +4,12 @@ - - config REGMAP - default y if (REGMAP_I2C || REGMAP_SPI || REGMAP_SPMI || REGMAP_MMIO || REGMAP_IRQ) -+ select IRQ_DOMAIN if REGMAP_IRQ -+ bool -+ -+config REGCACHE_COMPRESSED - select LZO_COMPRESS - select LZO_DECOMPRESS -- select IRQ_DOMAIN if REGMAP_IRQ - bool - - config REGMAP_I2C ---- a/drivers/base/regmap/Makefile -+++ b/drivers/base/regmap/Makefile -@@ -1,5 +1,6 @@ - obj-$(CONFIG_REGMAP) += regmap.o regcache.o --obj-$(CONFIG_REGMAP) += regcache-rbtree.o regcache-lzo.o regcache-flat.o -+obj-$(CONFIG_REGMAP) += regcache-rbtree.o regcache-flat.o -+obj-$(CONFIG_REGCACHE_COMPRESSED) += regcache-lzo.o - obj-$(CONFIG_DEBUG_FS) += regmap-debugfs.o - obj-$(CONFIG_REGMAP_I2C) += regmap-i2c.o - obj-$(CONFIG_REGMAP_SPI) += regmap-spi.o ---- a/drivers/base/regmap/regcache.c -+++ b/drivers/base/regmap/regcache.c -@@ -21,7 +21,9 @@ - - static const struct regcache_ops *cache_types[] = { - ®cache_rbtree_ops, -+#if IS_ENABLED(CONFIG_REGCACHE_COMPRESSED) - ®cache_lzo_ops, -+#endif - ®cache_flat_ops, - }; - diff --git a/target/linux/generic/pending-3.18/090-overlayfs-fallback-to-readonly-when-full.patch b/target/linux/generic/pending-3.18/090-overlayfs-fallback-to-readonly-when-full.patch deleted file mode 100644 index 6c26a47c5f..0000000000 --- a/target/linux/generic/pending-3.18/090-overlayfs-fallback-to-readonly-when-full.patch +++ /dev/null @@ -1,109 +0,0 @@ -[linux-unionfs added to Cc] - -On Tue, May 19, 2015 at 09:51:20AM +0200, Bastian Bittorf wrote: -> Hi Miklos, -> -> sorry for writing directly to you, feel free to forward -> this to the appropriate mailinglist. -> -> we have a problem with mainline overlay filesystem on kernel 3.18: -> https://dev.openwrt.org/ticket/19564 -> -> 2 things are odd: -> when the working filesystem is full, overlays fails with: -> -> overlayfs: failed to create directory /overlay/work/work -> -> what is strange, that we call it with: -> -> mount(overlay, "/mnt", "overlay", MS_NOATIME, lowerdir) -> -> see here: -> http://nbd.name/gitweb.cgi?p=fstools.git;a=blob;f=libfstools/mount.c;h=81176ce399b4cd8e2d347c0008c13dec92407f55;hb=e6004000ff15d7bd32cf5663e8690fc94d7ec747#l125 -> -> do you have an idea whats wrong? -> 1) is it really needed, that we need space for creating dir "/overlay/work"? -> 2) why does overlay need "/overlay/work/work"? - -The work directory is needed for atomic copy-up and similar. It is not actually -necessary to mount a read-only overlay. Post 4.0 it is possible to mount the -overlay without workdir (but even then it won't happen automatically in case the -upper fs is full, so this should be fixed in the latest kernel too). - -Could you please try the following patch? If the workdir can't be created it -will fall back to mounting the overlay read-only. - -Thanks, -Miklos - ---- - fs/overlayfs/copy_up.c | 3 +++ - fs/overlayfs/dir.c | 9 +++++++++ - fs/overlayfs/super.c | 12 +++++++++--- - 3 files changed, 21 insertions(+), 3 deletions(-) - ---- a/fs/overlayfs/copy_up.c -+++ b/fs/overlayfs/copy_up.c -@@ -315,6 +315,9 @@ int ovl_copy_up_one(struct dentry *paren - struct cred *override_cred; - char *link = NULL; - -+ if (WARN_ON(!workdir)) -+ return -EROFS; -+ - ovl_path_upper(parent, &parentpath); - upperdir = parentpath.dentry; - ---- a/fs/overlayfs/dir.c -+++ b/fs/overlayfs/dir.c -@@ -222,6 +222,9 @@ static struct dentry *ovl_clear_empty(st - struct kstat stat; - int err; - -+ if (WARN_ON(!workdir)) -+ return ERR_PTR(-EROFS); -+ - err = ovl_lock_rename_workdir(workdir, upperdir); - if (err) - goto out; -@@ -322,6 +325,9 @@ static int ovl_create_over_whiteout(stru - struct dentry *newdentry; - int err; - -+ if (WARN_ON(!workdir)) -+ return -EROFS; -+ - err = ovl_lock_rename_workdir(workdir, upperdir); - if (err) - goto out; -@@ -507,6 +513,9 @@ static int ovl_remove_and_whiteout(struc - int err; - int flags = 0; - -+ if (WARN_ON(!workdir)) -+ return -EROFS; -+ - if (is_dir) { - opaquedir = ovl_check_empty_and_clear(dentry); - err = PTR_ERR(opaquedir); ---- a/fs/overlayfs/super.c -+++ b/fs/overlayfs/super.c -@@ -760,9 +760,15 @@ static int ovl_fill_super(struct super_b - ufs->workdir = ovl_workdir_create(ufs->upper_mnt, workpath.dentry); - err = PTR_ERR(ufs->workdir); - if (IS_ERR(ufs->workdir)) { -- pr_err("overlayfs: failed to create directory %s/%s\n", -- ufs->config.workdir, OVL_WORKDIR_NAME); -- goto out_put_lower_mnt; -+ if (err == -ENOSPC || err == -EROFS) { -+ pr_warning("overlayfs: failed to create work directory (%s), mounting read-only\n", err == ENOSPC ? "ENOSPC" : "EROFS"); -+ sb->s_flags |= MS_RDONLY; -+ ufs->workdir = NULL; -+ } else { -+ pr_err("overlayfs: failed to create directory %s/%s\n", -+ ufs->config.workdir, OVL_WORKDIR_NAME); -+ goto out_put_lower_mnt; -+ } - } - - /* diff --git a/target/linux/generic/pending-3.18/091-mtd-spi-nor-add-support-Spansion_S25FL164K.patch b/target/linux/generic/pending-3.18/091-mtd-spi-nor-add-support-Spansion_S25FL164K.patch deleted file mode 100644 index 24aa0752d8..0000000000 --- a/target/linux/generic/pending-3.18/091-mtd-spi-nor-add-support-Spansion_S25FL164K.patch +++ /dev/null @@ -1,10 +0,0 @@ ---- a/drivers/mtd/spi-nor/spi-nor.c -+++ b/drivers/mtd/spi-nor/spi-nor.c -@@ -567,6 +567,7 @@ static const struct spi_device_id spi_no - { "s25fl008k", INFO(0xef4014, 0, 64 * 1024, 16, SECT_4K) }, - { "s25fl016k", INFO(0xef4015, 0, 64 * 1024, 32, SECT_4K) }, - { "s25fl064k", INFO(0xef4017, 0, 64 * 1024, 128, SECT_4K) }, -+ { "s25fl164k", INFO(0x014017, 0, 64 * 1024, 128, SECT_4K) }, - - /* SST -- large erase sizes are "overlays", "sectors" are 4K */ - { "sst25vf040b", INFO(0xbf258d, 0, 64 * 1024, 8, SECT_4K | SST_WRITE) }, diff --git a/target/linux/generic/pending-3.18/092-01-spi-Check-to-see-if-the-device-is-processing-a-messa.patch b/target/linux/generic/pending-3.18/092-01-spi-Check-to-see-if-the-device-is-processing-a-messa.patch deleted file mode 100644 index fa3ab6a638..0000000000 --- a/target/linux/generic/pending-3.18/092-01-spi-Check-to-see-if-the-device-is-processing-a-messa.patch +++ /dev/null @@ -1,47 +0,0 @@ -From: Mark Brown -Date: Tue, 9 Dec 2014 19:46:56 +0000 -Subject: [PATCH] spi: Check to see if the device is processing a message - before we idle - -cur_msg is updated under the queue lock and holds the message we are -currently processing. Since currently we only ever do removals in the -pump kthread it doesn't matter in what order we do things but we want -to be able to push things out from the submitting thread so pull the -check to see if we're currently handling a message before we check to -see if the queue is idle. - -Signed-off-by: Mark Brown ---- - ---- a/drivers/spi/spi.c -+++ b/drivers/spi/spi.c -@@ -891,8 +891,16 @@ static void spi_pump_messages(struct kth - bool was_busy = false; - int ret; - -- /* Lock queue and check for queue work */ -+ /* Lock queue */ - spin_lock_irqsave(&master->queue_lock, flags); -+ -+ /* Make sure we are not already running a message */ -+ if (master->cur_msg) { -+ spin_unlock_irqrestore(&master->queue_lock, flags); -+ return; -+ } -+ -+ /* Check if the queue is idle */ - if (list_empty(&master->queue) || !master->running) { - if (!master->busy) { - spin_unlock_irqrestore(&master->queue_lock, flags); -@@ -916,11 +924,6 @@ static void spi_pump_messages(struct kth - return; - } - -- /* Make sure we are not already running a message */ -- if (master->cur_msg) { -- spin_unlock_irqrestore(&master->queue_lock, flags); -- return; -- } - /* Extract head of queue */ - master->cur_msg = - list_first_entry(&master->queue, struct spi_message, queue); diff --git a/target/linux/generic/pending-3.18/092-02-spi-Pump-transfers-inside-calling-context-for-spi_sy.patch b/target/linux/generic/pending-3.18/092-02-spi-Pump-transfers-inside-calling-context-for-spi_sy.patch deleted file mode 100644 index b74b4cb93b..0000000000 --- a/target/linux/generic/pending-3.18/092-02-spi-Pump-transfers-inside-calling-context-for-spi_sy.patch +++ /dev/null @@ -1,184 +0,0 @@ -From: Mark Brown -Date: Tue, 9 Dec 2014 21:38:05 +0000 -Subject: [PATCH] spi: Pump transfers inside calling context for spi_sync() - -If we are using the standard SPI message pump (which all drivers should be -transitioning over to) then special case the message enqueue and instead of -starting the worker thread to push messages to the hardware do so in the -context of the caller if the controller is idle. This avoids a context -switch in the common case where the controller has a single user in a -single thread, for short PIO transfers there may be no need to context -switch away from the calling context to complete the transfer. - -The code is a bit more complex than is desirable in part due to the need -to handle drivers not using the standard queue and in part due to handling -the various combinations of bus locking and asynchronous submission in -interrupt context. - -It is still suboptimal since it will still wake the message pump for each -transfer in order to schedule idling of the hardware and if multiple -contexts are using the controller simultaneously a caller may end up -pumping a message for some random other thread rather than for itself, -and if the thread ends up deferring due to another context idling the -hardware then it will just busy wait. It can, however, have the benefit -of aggregating power up and down of the hardware when a caller performs -a series of transfers back to back without any need for the use of -spi_async(). - -Signed-off-by: Mark Brown ---- - ---- a/drivers/spi/spi.c -+++ b/drivers/spi/spi.c -@@ -882,6 +882,9 @@ EXPORT_SYMBOL_GPL(spi_finalize_current_t - * needs processing and if so call out to the driver to initialize hardware - * and transfer each message. - * -+ * Note that it is called both from the kthread itself and also from -+ * inside spi_sync(); the queue extraction handling at the top of the -+ * function should deal with this safely. - */ - static void spi_pump_messages(struct kthread_work *work) - { -@@ -900,6 +903,13 @@ static void spi_pump_messages(struct kth - return; - } - -+ /* If another context is idling the device then defer */ -+ if (master->idling) { -+ queue_kthread_work(&master->kworker, &master->pump_messages); -+ spin_unlock_irqrestore(&master->queue_lock, flags); -+ return; -+ } -+ - /* Check if the queue is idle */ - if (list_empty(&master->queue) || !master->running) { - if (!master->busy) { -@@ -907,7 +917,9 @@ static void spi_pump_messages(struct kth - return; - } - master->busy = false; -+ master->idling = true; - spin_unlock_irqrestore(&master->queue_lock, flags); -+ - kfree(master->dummy_rx); - master->dummy_rx = NULL; - kfree(master->dummy_tx); -@@ -921,6 +933,10 @@ static void spi_pump_messages(struct kth - pm_runtime_put_autosuspend(master->dev.parent); - } - trace_spi_master_idle(master); -+ -+ spin_lock_irqsave(&master->queue_lock, flags); -+ master->idling = false; -+ spin_unlock_irqrestore(&master->queue_lock, flags); - return; - } - -@@ -1166,12 +1182,9 @@ static int spi_destroy_queue(struct spi_ - return 0; - } - --/** -- * spi_queued_transfer - transfer function for queued transfers -- * @spi: spi device which is requesting transfer -- * @msg: spi message which is to handled is queued to driver queue -- */ --static int spi_queued_transfer(struct spi_device *spi, struct spi_message *msg) -+static int __spi_queued_transfer(struct spi_device *spi, -+ struct spi_message *msg, -+ bool need_pump) - { - struct spi_master *master = spi->master; - unsigned long flags; -@@ -1186,13 +1199,23 @@ static int spi_queued_transfer(struct sp - msg->status = -EINPROGRESS; - - list_add_tail(&msg->queue, &master->queue); -- if (!master->busy) -+ if (!master->busy && need_pump) - queue_kthread_work(&master->kworker, &master->pump_messages); - - spin_unlock_irqrestore(&master->queue_lock, flags); - return 0; - } - -+/** -+ * spi_queued_transfer - transfer function for queued transfers -+ * @spi: spi device which is requesting transfer -+ * @msg: spi message which is to handled is queued to driver queue -+ */ -+static int spi_queued_transfer(struct spi_device *spi, struct spi_message *msg) -+{ -+ return __spi_queued_transfer(spi, msg, true); -+} -+ - static int spi_master_initialize_queue(struct spi_master *master) - { - int ret; -@@ -2104,19 +2127,46 @@ static int __spi_sync(struct spi_device - DECLARE_COMPLETION_ONSTACK(done); - int status; - struct spi_master *master = spi->master; -+ unsigned long flags; -+ -+ status = __spi_validate(spi, message); -+ if (status != 0) -+ return status; - - message->complete = spi_complete; - message->context = &done; -+ message->spi = spi; - - if (!bus_locked) - mutex_lock(&master->bus_lock_mutex); - -- status = spi_async_locked(spi, message); -+ /* If we're not using the legacy transfer method then we will -+ * try to transfer in the calling context so special case. -+ * This code would be less tricky if we could remove the -+ * support for driver implemented message queues. -+ */ -+ if (master->transfer == spi_queued_transfer) { -+ spin_lock_irqsave(&master->bus_lock_spinlock, flags); -+ -+ trace_spi_message_submit(message); -+ -+ status = __spi_queued_transfer(spi, message, false); -+ -+ spin_unlock_irqrestore(&master->bus_lock_spinlock, flags); -+ } else { -+ status = spi_async_locked(spi, message); -+ } - - if (!bus_locked) - mutex_unlock(&master->bus_lock_mutex); - - if (status == 0) { -+ /* Push out the messages in the calling context if we -+ * can. -+ */ -+ if (master->transfer == spi_queued_transfer) -+ spi_pump_messages(&master->pump_messages); -+ - wait_for_completion(&done); - status = message->status; - } ---- a/include/linux/spi/spi.h -+++ b/include/linux/spi/spi.h -@@ -260,6 +260,7 @@ static inline void spi_unregister_driver - * @pump_messages: work struct for scheduling work to the message pump - * @queue_lock: spinlock to syncronise access to message queue - * @queue: message queue -+ * @idling: the device is entering idle state - * @cur_msg: the currently in-flight message - * @cur_msg_prepared: spi_prepare_message was called for the currently - * in-flight message -@@ -425,6 +426,7 @@ struct spi_master { - spinlock_t queue_lock; - struct list_head queue; - struct spi_message *cur_msg; -+ bool idling; - bool busy; - bool running; - bool rt; diff --git a/target/linux/generic/pending-3.18/092-03-spi-Only-idle-the-message-pump-in-the-worker-kthread.patch b/target/linux/generic/pending-3.18/092-03-spi-Only-idle-the-message-pump-in-the-worker-kthread.patch deleted file mode 100644 index a5d85be2b4..0000000000 --- a/target/linux/generic/pending-3.18/092-03-spi-Only-idle-the-message-pump-in-the-worker-kthread.patch +++ /dev/null @@ -1,83 +0,0 @@ -From: Mark Brown -Date: Wed, 10 Dec 2014 13:46:33 +0000 -Subject: [PATCH] spi: Only idle the message pump in the worker kthread - -In order to avoid the situation where the kthread is waiting for another -context to make the hardware idle let the message pump know if it's being -called from the worker thread context and if it isn't then defer to the -worker thread instead of idling the hardware immediately. This will ensure -that if this situation happens we block rather than busy waiting. - -Signed-off-by: Mark Brown ---- - ---- a/drivers/spi/spi.c -+++ b/drivers/spi/spi.c -@@ -875,8 +875,9 @@ void spi_finalize_current_transfer(struc - EXPORT_SYMBOL_GPL(spi_finalize_current_transfer); - - /** -- * spi_pump_messages - kthread work function which processes spi message queue -- * @work: pointer to kthread work struct contained in the master struct -+ * __spi_pump_messages - function which processes spi message queue -+ * @master: master to process queue for -+ * @in_kthread: true if we are in the context of the message pump thread - * - * This function checks if there is any spi message in the queue that - * needs processing and if so call out to the driver to initialize hardware -@@ -886,10 +887,8 @@ EXPORT_SYMBOL_GPL(spi_finalize_current_t - * inside spi_sync(); the queue extraction handling at the top of the - * function should deal with this safely. - */ --static void spi_pump_messages(struct kthread_work *work) -+static void __spi_pump_messages(struct spi_master *master, bool in_kthread) - { -- struct spi_master *master = -- container_of(work, struct spi_master, pump_messages); - unsigned long flags; - bool was_busy = false; - int ret; -@@ -916,6 +915,15 @@ static void spi_pump_messages(struct kth - spin_unlock_irqrestore(&master->queue_lock, flags); - return; - } -+ -+ /* Only do teardown in the thread */ -+ if (!in_kthread) { -+ queue_kthread_work(&master->kworker, -+ &master->pump_messages); -+ spin_unlock_irqrestore(&master->queue_lock, flags); -+ return; -+ } -+ - master->busy = false; - master->idling = true; - spin_unlock_irqrestore(&master->queue_lock, flags); -@@ -1004,6 +1012,18 @@ static void spi_pump_messages(struct kth - } - } - -+/** -+ * spi_pump_messages - kthread work function which processes spi message queue -+ * @work: pointer to kthread work struct contained in the master struct -+ */ -+static void spi_pump_messages(struct kthread_work *work) -+{ -+ struct spi_master *master = -+ container_of(work, struct spi_master, pump_messages); -+ -+ __spi_pump_messages(master, true); -+} -+ - static int spi_init_queue(struct spi_master *master) - { - struct sched_param param = { .sched_priority = MAX_RT_PRIO - 1 }; -@@ -2165,7 +2185,7 @@ static int __spi_sync(struct spi_device - * can. - */ - if (master->transfer == spi_queued_transfer) -- spi_pump_messages(&master->pump_messages); -+ __spi_pump_messages(master, false); - - wait_for_completion(&done); - status = message->status; diff --git a/target/linux/generic/pending-3.18/095-api-fix-compatibility-of-linux-in.h-with-netinet-in..patch b/target/linux/generic/pending-3.18/095-api-fix-compatibility-of-linux-in.h-with-netinet-in..patch deleted file mode 100644 index 4c5cd596f7..0000000000 --- a/target/linux/generic/pending-3.18/095-api-fix-compatibility-of-linux-in.h-with-netinet-in..patch +++ /dev/null @@ -1,146 +0,0 @@ -From 279c6c7fa64f5763e6b9f05e7ab3840092e702e7 Mon Sep 17 00:00:00 2001 -From: Stephen Hemminger -Date: Mon, 29 Jun 2015 14:57:48 -1000 -Subject: [PATCH] api: fix compatibility of linux/in.h with netinet/in.h - -u -This fixes breakage to iproute2 build with recent kernel headers -caused by: - commit a263653ed798216c0069922d7b5237ca49436007 - Author: Pablo Neira Ayuso - Date: Wed Jun 17 10:28:27 2015 -0500 - - netfilter: don't pull include/linux/netfilter.h from netns headers - -The issue is that definitions in linux/in.h overlap with those -in netinet/in.h. This patch solves this by introducing the same -mechanism as was used to solve the same problem with linux/in6.h - -Signed-off-by: Stephen Hemminger -Signed-off-by: David S. Miller ---- - include/uapi/linux/in.h | 16 +++++++++++++--- - include/uapi/linux/libc-compat.h | 22 ++++++++++++++++++++++ - 2 files changed, 35 insertions(+), 3 deletions(-) - ---- a/include/uapi/linux/in.h -+++ b/include/uapi/linux/in.h -@@ -19,8 +19,10 @@ - #define _UAPI_LINUX_IN_H - - #include -+#include - #include - -+#if __UAPI_DEF_IN_IPPROTO - /* Standard well-defined IP protocols. */ - enum { - IPPROTO_IP = 0, /* Dummy protocol for TCP */ -@@ -73,12 +75,14 @@ enum { - #define IPPROTO_RAW IPPROTO_RAW - IPPROTO_MAX - }; -+#endif - -- -+#if __UAPI_DEF_IN_ADDR - /* Internet address. */ - struct in_addr { - __be32 s_addr; - }; -+#endif - - #define IP_TOS 1 - #define IP_TTL 2 -@@ -154,6 +158,7 @@ struct in_addr { - - /* Request struct for multicast socket ops */ - -+#if __UAPI_DEF_IP_MREQ - struct ip_mreq { - struct in_addr imr_multiaddr; /* IP multicast address of group */ - struct in_addr imr_interface; /* local IP address of interface */ -@@ -205,14 +210,18 @@ struct group_filter { - #define GROUP_FILTER_SIZE(numsrc) \ - (sizeof(struct group_filter) - sizeof(struct __kernel_sockaddr_storage) \ - + (numsrc) * sizeof(struct __kernel_sockaddr_storage)) -+#endif - -+#if __UAPI_DEF_IN_PKTINFO - struct in_pktinfo { - int ipi_ifindex; - struct in_addr ipi_spec_dst; - struct in_addr ipi_addr; - }; -+#endif - - /* Structure describing an Internet (IP) socket address. */ -+#if __UAPI_DEF_SOCKADDR_IN - #define __SOCK_SIZE__ 16 /* sizeof(struct sockaddr) */ - struct sockaddr_in { - __kernel_sa_family_t sin_family; /* Address family */ -@@ -224,8 +233,9 @@ struct sockaddr_in { - sizeof(unsigned short int) - sizeof(struct in_addr)]; - }; - #define sin_zero __pad /* for BSD UNIX comp. -FvK */ -+#endif - -- -+#if __UAPI_DEF_IN_CLASS - /* - * Definitions of the bits in an Internet address integer. - * On subnets, host and network parts are found according -@@ -276,7 +286,7 @@ struct sockaddr_in { - #define INADDR_ALLHOSTS_GROUP 0xe0000001U /* 224.0.0.1 */ - #define INADDR_ALLRTRS_GROUP 0xe0000002U /* 224.0.0.2 */ - #define INADDR_MAX_LOCAL_GROUP 0xe00000ffU /* 224.0.0.255 */ -- -+#endif - - /* contains the htonl type stuff.. */ - #include ---- a/include/uapi/linux/libc-compat.h -+++ b/include/uapi/linux/libc-compat.h -@@ -56,6 +56,13 @@ - - /* GLIBC headers included first so don't define anything - * that would already be defined. */ -+#define __UAPI_DEF_IN_ADDR 0 -+#define __UAPI_DEF_IN_IPPROTO 0 -+#define __UAPI_DEF_IN_PKTINFO 0 -+#define __UAPI_DEF_IP_MREQ 0 -+#define __UAPI_DEF_SOCKADDR_IN 0 -+#define __UAPI_DEF_IN_CLASS 0 -+ - #define __UAPI_DEF_IN6_ADDR 0 - /* The exception is the in6_addr macros which must be defined - * if the glibc code didn't define them. This guard matches -@@ -76,6 +83,13 @@ - /* Linux headers included first, and we must define everything - * we need. The expectation is that glibc will check the - * __UAPI_DEF_* defines and adjust appropriately. */ -+#define __UAPI_DEF_IN_ADDR 1 -+#define __UAPI_DEF_IN_IPPROTO 1 -+#define __UAPI_DEF_IN_PKTINFO 1 -+#define __UAPI_DEF_IP_MREQ 1 -+#define __UAPI_DEF_SOCKADDR_IN 1 -+#define __UAPI_DEF_IN_CLASS 1 -+ - #define __UAPI_DEF_IN6_ADDR 1 - /* We unconditionally define the in6_addr macros and glibc must - * coordinate. */ -@@ -99,6 +113,14 @@ - * that we need. */ - #else /* !defined(__GLIBC__) */ - -+/* Definitions for in.h */ -+#define __UAPI_DEF_IN_ADDR 1 -+#define __UAPI_DEF_IN_IPPROTO 1 -+#define __UAPI_DEF_IN_PKTINFO 1 -+#define __UAPI_DEF_IP_MREQ 1 -+#define __UAPI_DEF_SOCKADDR_IN 1 -+#define __UAPI_DEF_IN_CLASS 1 -+ - /* Definitions for in6.h */ - #define __UAPI_DEF_IN6_ADDR 1 - #define __UAPI_DEF_IN6_ADDR_ALT 1 diff --git a/target/linux/generic/pending-3.18/099-module_arch_freeing_init-new-hook-for-archs-before-m.patch b/target/linux/generic/pending-3.18/099-module_arch_freeing_init-new-hook-for-archs-before-m.patch deleted file mode 100644 index 352bf6de15..0000000000 --- a/target/linux/generic/pending-3.18/099-module_arch_freeing_init-new-hook-for-archs-before-m.patch +++ /dev/null @@ -1,182 +0,0 @@ -From: Rusty Russell -Date: Tue, 20 Jan 2015 09:07:04 +1030 -Subject: [PATCH] module_arch_freeing_init(): new hook for archs before module->module_init freed. - -Archs have been abusing module_free() to clean up their arch-specific -allocations. Since module_free() is also (ab)used by BPF and trace code, -let's keep it to simple allocations, and provide a hook called before -that. - -This means that avr32, ia64, parisc and s390 no longer need to implement -their own module_free() at all. avr32 doesn't need module_finalize() -either. - -Signed-off-by: Rusty Russell -Cc: Chris Metcalf -Cc: Haavard Skinnemoen -Cc: Hans-Christian Egtvedt -Cc: Tony Luck -Cc: Fenghua Yu -Cc: "James E.J. Bottomley" -Cc: Helge Deller -Cc: Martin Schwidefsky -Cc: Heiko Carstens -Cc: linux-kernel@vger.kernel.org -Cc: linux-ia64@vger.kernel.org -Cc: linux-parisc@vger.kernel.org -Cc: linux-s390@vger.kernel.org - -Origin: backport, https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=d453cded05ee219b77815ea194dc36efa5398bca ---- - arch/avr32/kernel/module.c | 13 +------------ - arch/ia64/kernel/module.c | 6 ++---- - arch/parisc/kernel/module.c | 6 +----- - arch/s390/kernel/module.c | 10 +++------- - arch/tile/kernel/module.c | 2 +- - include/linux/moduleloader.h | 2 ++ - kernel/module.c | 7 +++++++ - 7 files changed, 17 insertions(+), 29 deletions(-) - ---- a/arch/avr32/kernel/module.c -+++ b/arch/avr32/kernel/module.c -@@ -19,12 +19,10 @@ - #include - #include - --void module_free(struct module *mod, void *module_region) -+void module_arch_freeing_init(struct module *mod) - { - vfree(mod->arch.syminfo); - mod->arch.syminfo = NULL; -- -- vfree(module_region); - } - - static inline int check_rela(Elf32_Rela *rela, struct module *module, -@@ -291,12 +289,3 @@ int apply_relocate_add(Elf32_Shdr *sechd - - return ret; - } -- --int module_finalize(const Elf_Ehdr *hdr, const Elf_Shdr *sechdrs, -- struct module *module) --{ -- vfree(module->arch.syminfo); -- module->arch.syminfo = NULL; -- -- return 0; --} ---- a/arch/ia64/kernel/module.c -+++ b/arch/ia64/kernel/module.c -@@ -305,14 +305,12 @@ plt_target (struct plt_entry *plt) - #endif /* !USE_BRL */ - - void --module_free (struct module *mod, void *module_region) -+module_arch_freeing_init (struct module *mod) - { -- if (mod && mod->arch.init_unw_table && -- module_region == mod->module_init) { -+ if (mod->arch.init_unw_table) { - unw_remove_unwind_table(mod->arch.init_unw_table); - mod->arch.init_unw_table = NULL; - } -- vfree(module_region); - } - - /* Have we already seen one of these relocations? */ ---- a/arch/parisc/kernel/module.c -+++ b/arch/parisc/kernel/module.c -@@ -298,14 +298,10 @@ static inline unsigned long count_stubs( - } - #endif - -- --/* Free memory returned from module_alloc */ --void module_free(struct module *mod, void *module_region) -+void module_arch_freeing_init(struct module *mod) - { - kfree(mod->arch.section); - mod->arch.section = NULL; -- -- vfree(module_region); - } - - /* Additional bytes needed in front of individual sections */ ---- a/arch/s390/kernel/module.c -+++ b/arch/s390/kernel/module.c -@@ -55,14 +55,10 @@ void *module_alloc(unsigned long size) - } - #endif - --/* Free memory returned from module_alloc */ --void module_free(struct module *mod, void *module_region) -+void module_arch_freeing_init(struct module *mod) - { -- if (mod) { -- vfree(mod->arch.syminfo); -- mod->arch.syminfo = NULL; -- } -- vfree(module_region); -+ vfree(mod->arch.syminfo); -+ mod->arch.syminfo = NULL; - } - - static void check_rela(Elf_Rela *rela, struct module *me) ---- a/arch/tile/kernel/module.c -+++ b/arch/tile/kernel/module.c -@@ -83,7 +83,7 @@ void module_free(struct module *mod, voi - 0, 0, 0, NULL, NULL, 0); - - /* -- * FIXME: If module_region == mod->module_init, trim exception -+ * FIXME: Add module_arch_freeing_init to trim exception - * table entries. - */ - } ---- a/include/linux/moduleloader.h -+++ b/include/linux/moduleloader.h -@@ -82,4 +82,6 @@ int module_finalize(const Elf_Ehdr *hdr, - /* Any cleanup needed when module leaves. */ - void module_arch_cleanup(struct module *mod); - -+/* Any cleanup before freeing mod->module_init */ -+void module_arch_freeing_init(struct module *mod); - #endif ---- a/kernel/module.c -+++ b/kernel/module.c -@@ -1840,6 +1840,10 @@ void __weak module_arch_cleanup(struct m - { - } - -+void __weak module_arch_freeing_init(struct module *mod) -+{ -+} -+ - /* Free a module, remove from lists, etc. */ - static void free_module(struct module *mod) - { -@@ -1872,6 +1876,7 @@ static void free_module(struct module *m - - /* This may be NULL, but that's OK */ - unset_module_init_ro_nx(mod); -+ module_arch_freeing_init(mod); - module_free(mod, mod->module_init); - kfree(mod->args); - percpu_modfree(mod); -@@ -2983,6 +2988,7 @@ static struct module *layout_and_allocat - static void module_deallocate(struct module *mod, struct load_info *info) - { - percpu_modfree(mod); -+ module_arch_freeing_init(mod); - module_free(mod, mod->module_init); - module_free(mod, mod->module_core); - } -@@ -3105,6 +3111,7 @@ static int do_init_module(struct module - rcu_assign_pointer(mod->kallsyms, &mod->core_kallsyms); - #endif - unset_module_init_ro_nx(mod); -+ module_arch_freeing_init(mod); - module_free(mod, mod->module_init); - mod->module_init = NULL; - mod->init_size = 0; diff --git a/target/linux/generic/pending-3.18/102-ehci_hcd_ignore_oc.patch b/target/linux/generic/pending-3.18/102-ehci_hcd_ignore_oc.patch deleted file mode 100644 index a5645596f9..0000000000 --- a/target/linux/generic/pending-3.18/102-ehci_hcd_ignore_oc.patch +++ /dev/null @@ -1,82 +0,0 @@ -From 1e311820ec3055e3f08e687de6564692a7cec675 Mon Sep 17 00:00:00 2001 -From: Florian Fainelli -Date: Mon, 28 Jan 2013 20:06:29 +0100 -Subject: [PATCH 11/12] USB: EHCI: add ignore_oc flag to disable overcurrent - checking - -This patch adds an ignore_oc flag which can be set by EHCI controller -not supporting or wanting to disable overcurrent checking. The EHCI -platform data in include/linux/usb/ehci_pdriver.h is also augmented to -take advantage of this new flag. - -Signed-off-by: Florian Fainelli ---- - drivers/usb/host/ehci-hcd.c | 2 +- - drivers/usb/host/ehci-hub.c | 4 ++-- - drivers/usb/host/ehci-platform.c | 1 + - drivers/usb/host/ehci.h | 1 + - include/linux/usb/ehci_pdriver.h | 1 + - 5 files changed, 6 insertions(+), 3 deletions(-) - ---- a/drivers/usb/host/ehci-hcd.c -+++ b/drivers/usb/host/ehci-hcd.c -@@ -633,7 +633,7 @@ static int ehci_run (struct usb_hcd *hcd - "USB %x.%x started, EHCI %x.%02x%s\n", - ((ehci->sbrn & 0xf0)>>4), (ehci->sbrn & 0x0f), - temp >> 8, temp & 0xff, -- ignore_oc ? ", overcurrent ignored" : ""); -+ (ignore_oc || ehci->ignore_oc) ? ", overcurrent ignored" : ""); - - ehci_writel(ehci, INTR_MASK, - &ehci->regs->intr_enable); /* Turn On Interrupts */ ---- a/drivers/usb/host/ehci-hub.c -+++ b/drivers/usb/host/ehci-hub.c -@@ -635,7 +635,7 @@ ehci_hub_status_data (struct usb_hcd *hc - * always set, seem to clear PORT_OCC and PORT_CSC when writing to - * PORT_POWER; that's surprising, but maybe within-spec. - */ -- if (!ignore_oc) -+ if (!ignore_oc && !ehci->ignore_oc) - mask = PORT_CSC | PORT_PEC | PORT_OCC; - else - mask = PORT_CSC | PORT_PEC; -@@ -995,7 +995,7 @@ int ehci_hub_control( - if (temp & PORT_PEC) - status |= USB_PORT_STAT_C_ENABLE << 16; - -- if ((temp & PORT_OCC) && !ignore_oc){ -+ if ((temp & PORT_OCC) && (!ignore_oc && !ehci->ignore_oc)){ - status |= USB_PORT_STAT_C_OVERCURRENT << 16; - - /* ---- a/drivers/usb/host/ehci-platform.c -+++ b/drivers/usb/host/ehci-platform.c -@@ -226,6 +226,8 @@ static int ehci_platform_probe(struct pl - ehci->big_endian_desc = 1; - if (pdata->big_endian_mmio) - ehci->big_endian_mmio = 1; -+ if (pdata->ignore_oc) -+ ehci->ignore_oc = 1; - - #ifndef CONFIG_USB_EHCI_BIG_ENDIAN_MMIO - if (ehci->big_endian_mmio) { ---- a/drivers/usb/host/ehci.h -+++ b/drivers/usb/host/ehci.h -@@ -226,6 +226,7 @@ struct ehci_hcd { /* one per controlle - unsigned frame_index_bug:1; /* MosChip (AKA NetMos) */ - unsigned need_oc_pp_cycle:1; /* MPC834X port power */ - unsigned imx28_write_fix:1; /* For Freescale i.MX28 */ -+ unsigned ignore_oc:1; - - /* required for usb32 quirk */ - #define OHCI_CTRL_HCFS (3 << 6) ---- a/include/linux/usb/ehci_pdriver.h -+++ b/include/linux/usb/ehci_pdriver.h -@@ -45,6 +45,7 @@ struct usb_ehci_pdata { - unsigned big_endian_desc:1; - unsigned big_endian_mmio:1; - unsigned no_io_watchdog:1; -+ unsigned ignore_oc:1; - - /* Turn on all power and clocks */ - int (*power_on)(struct platform_device *pdev); diff --git a/target/linux/generic/pending-3.18/110-jffs2-use-.rename2-and-add-RENAME_WHITEOUT-support.patch b/target/linux/generic/pending-3.18/110-jffs2-use-.rename2-and-add-RENAME_WHITEOUT-support.patch deleted file mode 100644 index 6bbeb93cfa..0000000000 --- a/target/linux/generic/pending-3.18/110-jffs2-use-.rename2-and-add-RENAME_WHITEOUT-support.patch +++ /dev/null @@ -1,86 +0,0 @@ -From: Felix Fietkau -Date: Fri, 10 Apr 2015 13:35:29 +0200 -Subject: [PATCH] jffs2: use .rename2 and add RENAME_WHITEOUT support - -It is required for renames on overlayfs - -Signed-off-by: Felix Fietkau ---- - ---- a/fs/jffs2/dir.c -+++ b/fs/jffs2/dir.c -@@ -35,7 +35,7 @@ static int jffs2_mkdir (struct inode *,s - static int jffs2_rmdir (struct inode *,struct dentry *); - static int jffs2_mknod (struct inode *,struct dentry *,umode_t,dev_t); - static int jffs2_rename (struct inode *, struct dentry *, -- struct inode *, struct dentry *); -+ struct inode *, struct dentry *, unsigned int); - - const struct file_operations jffs2_dir_operations = - { -@@ -57,7 +57,7 @@ const struct inode_operations jffs2_dir_ - .mkdir = jffs2_mkdir, - .rmdir = jffs2_rmdir, - .mknod = jffs2_mknod, -- .rename = jffs2_rename, -+ .rename2 = jffs2_rename, - .get_acl = jffs2_get_acl, - .set_acl = jffs2_set_acl, - .setattr = jffs2_setattr, -@@ -752,8 +752,27 @@ static int jffs2_mknod (struct inode *di - return ret; - } - -+static int jffs2_whiteout(struct inode *old_dir, struct dentry *old_dentry) -+{ -+ struct dentry *wh; -+ int err; -+ -+ wh = d_alloc(old_dentry->d_parent, &old_dentry->d_name); -+ if (!wh) -+ return -ENOMEM; -+ -+ err = jffs2_mknod(old_dir, wh, S_IFCHR | WHITEOUT_MODE, -+ WHITEOUT_DEV); -+ if (err) -+ return err; -+ -+ d_rehash(wh); -+ return 0; -+} -+ - static int jffs2_rename (struct inode *old_dir_i, struct dentry *old_dentry, -- struct inode *new_dir_i, struct dentry *new_dentry) -+ struct inode *new_dir_i, struct dentry *new_dentry, -+ unsigned int flags) - { - int ret; - struct jffs2_sb_info *c = JFFS2_SB_INFO(old_dir_i->i_sb); -@@ -761,6 +780,9 @@ static int jffs2_rename (struct inode *o - uint8_t type; - uint32_t now; - -+ if (flags & ~RENAME_WHITEOUT) -+ return -EINVAL; -+ - /* The VFS will check for us and prevent trying to rename a - * file over a directory and vice versa, but if it's a directory, - * the VFS can't check whether the victim is empty. The filesystem -@@ -824,9 +846,14 @@ static int jffs2_rename (struct inode *o - if (S_ISDIR(old_dentry->d_inode->i_mode) && !victim_f) - inc_nlink(new_dir_i); - -- /* Unlink the original */ -- ret = jffs2_do_unlink(c, JFFS2_INODE_INFO(old_dir_i), -- old_dentry->d_name.name, old_dentry->d_name.len, NULL, now); -+ if (flags & RENAME_WHITEOUT) -+ /* Replace with whiteout */ -+ ret = jffs2_whiteout(old_dir_i, old_dentry); -+ else -+ /* Unlink the original */ -+ ret = jffs2_do_unlink(c, JFFS2_INODE_INFO(old_dir_i), -+ old_dentry->d_name.name, -+ old_dentry->d_name.len, NULL, now); - - /* We don't touch inode->i_nlink */ - diff --git a/target/linux/generic/pending-3.18/111-jffs2-add-RENAME_EXCHANGE-support.patch b/target/linux/generic/pending-3.18/111-jffs2-add-RENAME_EXCHANGE-support.patch deleted file mode 100644 index e0ed3312a2..0000000000 --- a/target/linux/generic/pending-3.18/111-jffs2-add-RENAME_EXCHANGE-support.patch +++ /dev/null @@ -1,58 +0,0 @@ -From: Felix Fietkau -Date: Sat, 25 Apr 2015 12:41:32 +0200 -Subject: [PATCH] jffs2: add RENAME_EXCHANGE support - -Signed-off-by: Felix Fietkau ---- - ---- a/fs/jffs2/dir.c -+++ b/fs/jffs2/dir.c -@@ -780,7 +780,7 @@ static int jffs2_rename (struct inode *o - uint8_t type; - uint32_t now; - -- if (flags & ~RENAME_WHITEOUT) -+ if (flags & ~(RENAME_WHITEOUT | RENAME_EXCHANGE)) - return -EINVAL; - - /* The VFS will check for us and prevent trying to rename a -@@ -788,7 +788,7 @@ static int jffs2_rename (struct inode *o - * the VFS can't check whether the victim is empty. The filesystem - * needs to do that for itself. - */ -- if (new_dentry->d_inode) { -+ if (new_dentry->d_inode && !(flags & RENAME_EXCHANGE)) { - victim_f = JFFS2_INODE_INFO(new_dentry->d_inode); - if (S_ISDIR(new_dentry->d_inode->i_mode)) { - struct jffs2_full_dirent *fd; -@@ -823,7 +823,7 @@ static int jffs2_rename (struct inode *o - if (ret) - return ret; - -- if (victim_f) { -+ if (victim_f && !(flags & RENAME_EXCHANGE)) { - /* There was a victim. Kill it off nicely */ - if (S_ISDIR(new_dentry->d_inode->i_mode)) - clear_nlink(new_dentry->d_inode); -@@ -849,6 +849,12 @@ static int jffs2_rename (struct inode *o - if (flags & RENAME_WHITEOUT) - /* Replace with whiteout */ - ret = jffs2_whiteout(old_dir_i, old_dentry); -+ else if (flags & RENAME_EXCHANGE) -+ /* Replace the original */ -+ ret = jffs2_do_link(c, JFFS2_INODE_INFO(old_dir_i), -+ new_dentry->d_inode->i_ino, type, -+ old_dentry->d_name.name, old_dentry->d_name.len, -+ now); - else - /* Unlink the original */ - ret = jffs2_do_unlink(c, JFFS2_INODE_INFO(old_dir_i), -@@ -875,7 +881,7 @@ static int jffs2_rename (struct inode *o - return ret; - } - -- if (S_ISDIR(old_dentry->d_inode->i_mode)) -+ if (S_ISDIR(old_dentry->d_inode->i_mode) && !(flags & RENAME_EXCHANGE)) - drop_nlink(old_dir_i); - - new_dir_i->i_mtime = new_dir_i->i_ctime = old_dir_i->i_mtime = old_dir_i->i_ctime = ITIME(now); diff --git a/target/linux/generic/pending-3.18/120-bridge_allow_receiption_on_disabled_port.patch b/target/linux/generic/pending-3.18/120-bridge_allow_receiption_on_disabled_port.patch deleted file mode 100644 index 909611403c..0000000000 --- a/target/linux/generic/pending-3.18/120-bridge_allow_receiption_on_disabled_port.patch +++ /dev/null @@ -1,54 +0,0 @@ -From: Stephen Hemminger -Subject: bridge: allow receiption on disabled port - -When an ethernet device is enslaved to a bridge, and the bridge STP -detects loss of carrier (or operational state down), then normally -packet receiption is blocked. - -This breaks control applications like WPA which maybe expecting to -receive packets to negotiate to bring link up. The bridge needs to -block forwarding packets from these disabled ports, but there is no -hard requirement to not allow local packet delivery. - -Signed-off-by: Stephen Hemminger -Signed-off-by: Felix Fietkau - ---- a/net/bridge/br_input.c -+++ b/net/bridge/br_input.c -@@ -146,11 +146,13 @@ EXPORT_SYMBOL_GPL(br_handle_frame_finish - static int br_handle_local_finish(struct sk_buff *skb) - { - struct net_bridge_port *p = br_port_get_rcu(skb->dev); -- u16 vid = 0; -+ if (p->state != BR_STATE_DISABLED) { -+ u16 vid = 0; - -- /* check if vlan is allowed, to avoid spoofing */ -- if (p->flags & BR_LEARNING && br_should_learn(p, skb, &vid)) -- br_fdb_update(p->br, p, eth_hdr(skb)->h_source, vid, false); -+ /* check if vlan is allowed, to avoid spoofing */ -+ if (p->flags & BR_LEARNING && br_should_learn(p, skb, &vid)) -+ br_fdb_update(p->br, p, eth_hdr(skb)->h_source, vid, false); -+ } - return 0; /* process further */ - } - -@@ -224,6 +226,18 @@ rx_handler_result_t br_handle_frame(stru - - forward: - switch (p->state) { -+ case BR_STATE_DISABLED: -+ if (ether_addr_equal(p->br->dev->dev_addr, dest)) -+ skb->pkt_type = PACKET_HOST; -+ -+ if (NF_HOOK(NFPROTO_BRIDGE, NF_BR_PRE_ROUTING, skb, skb->dev, NULL, -+ br_handle_local_finish)) -+ break; -+ -+ BR_INPUT_SKB_CB(skb)->brdev = p->br->dev; -+ br_pass_frame_up(skb); -+ break; -+ - case BR_STATE_FORWARDING: - rhook = rcu_dereference(br_should_route_hook); - if (rhook) { diff --git a/target/linux/generic/pending-3.18/132-mips_inline_dma_ops.patch b/target/linux/generic/pending-3.18/132-mips_inline_dma_ops.patch deleted file mode 100644 index 7a64ae7994..0000000000 --- a/target/linux/generic/pending-3.18/132-mips_inline_dma_ops.patch +++ /dev/null @@ -1,688 +0,0 @@ -From 2c58080407554e1bac8fd50d23cb02420524caed Mon Sep 17 00:00:00 2001 -From: Felix Fietkau -Date: Mon, 12 Aug 2013 12:50:22 +0200 -Subject: [PATCH] MIPS: partially inline dma ops - -Several DMA ops are no-op on many platforms, and the indirection through -the mips_dma_map_ops function table is causing the compiler to emit -unnecessary code. - -Inlining visibly improves network performance in my tests (on a 24Kc -based system), and also slightly reduces code size of a few drivers. - -Signed-off-by: Felix Fietkau ---- - arch/mips/Kconfig | 4 + - arch/mips/include/asm/dma-mapping.h | 360 +++++++++++++++++++++++++++++++++++- - arch/mips/mm/dma-default.c | 163 ++-------------- - 3 files changed, 373 insertions(+), 154 deletions(-) - ---- a/arch/mips/Kconfig -+++ b/arch/mips/Kconfig -@@ -1453,6 +1453,7 @@ config CPU_CAVIUM_OCTEON - select CPU_SUPPORTS_HUGEPAGES - select USB_EHCI_BIG_ENDIAN_MMIO - select MIPS_L1_CACHE_SHIFT_7 -+ select SYS_HAS_DMA_OPS - help - The Cavium Octeon processor is a highly integrated chip containing - many ethernet hardware widgets for networking tasks. The processor -@@ -1708,6 +1709,9 @@ config MIPS_MALTA_PM - bool - default y - -+config SYS_HAS_DMA_OPS -+ bool -+ - # - # CPU may reorder R->R, R->W, W->R, W->W - # Reordering beyond LL and SC is handled in WEAK_REORDERING_BEYOND_LLSC ---- a/arch/mips/include/asm/dma-mapping.h -+++ b/arch/mips/include/asm/dma-mapping.h -@@ -1,9 +1,16 @@ - #ifndef _ASM_DMA_MAPPING_H - #define _ASM_DMA_MAPPING_H - -+#include -+#include -+#include -+#include -+#include -+ - #include - #include - #include -+#include - #include - - #ifndef CONFIG_SGI_IP27 /* Kludge to fix 2.6.39 build for IP27 */ -@@ -12,12 +19,48 @@ - - extern struct dma_map_ops *mips_dma_map_ops; - -+void __dma_sync(struct page *page, unsigned long offset, size_t size, -+ enum dma_data_direction direction); -+void *mips_dma_alloc_coherent(struct device *dev, size_t size, -+ dma_addr_t *dma_handle, gfp_t gfp, -+ struct dma_attrs *attrs); -+void mips_dma_free_coherent(struct device *dev, size_t size, void *vaddr, -+ dma_addr_t dma_handle, struct dma_attrs *attrs); -+ - static inline struct dma_map_ops *get_dma_ops(struct device *dev) - { -+#ifdef CONFIG_SYS_HAS_DMA_OPS - if (dev && dev->archdata.dma_ops) - return dev->archdata.dma_ops; - else - return mips_dma_map_ops; -+#else -+ return NULL; -+#endif -+} -+ -+/* -+ * Warning on the terminology - Linux calls an uncached area coherent; -+ * MIPS terminology calls memory areas with hardware maintained coherency -+ * coherent. -+ */ -+ -+static inline int cpu_needs_post_dma_flush(struct device *dev) -+{ -+#ifndef CONFIG_SYS_HAS_CPU_R10000 -+ return 0; -+#endif -+ return !plat_device_is_coherent(dev) && -+ (boot_cpu_type() == CPU_R10000 || -+ boot_cpu_type() == CPU_R12000 || -+ boot_cpu_type() == CPU_BMIPS5000); -+} -+ -+static inline struct page *dma_addr_to_page(struct device *dev, -+ dma_addr_t dma_addr) -+{ -+ return pfn_to_page( -+ plat_dma_addr_to_phys(dev, dma_addr) >> PAGE_SHIFT); - } - - static inline bool dma_capable(struct device *dev, dma_addr_t addr, size_t size) -@@ -30,12 +73,304 @@ static inline bool dma_capable(struct de - - static inline void dma_mark_clean(void *addr, size_t size) {} - --#include -+static inline dma_addr_t dma_map_single_attrs(struct device *dev, void *ptr, -+ size_t size, -+ enum dma_data_direction dir, -+ struct dma_attrs *attrs) -+{ -+ struct dma_map_ops *ops = get_dma_ops(dev); -+ unsigned long offset = (unsigned long)ptr & ~PAGE_MASK; -+ struct page *page = virt_to_page(ptr); -+ dma_addr_t addr; -+ -+ kmemcheck_mark_initialized(ptr, size); -+ BUG_ON(!valid_dma_direction(dir)); -+ if (ops) { -+ addr = ops->map_page(dev, page, offset, size, dir, attrs); -+ } else { -+ if (!plat_device_is_coherent(dev)) -+ __dma_sync(page, offset, size, dir); -+ -+ addr = plat_map_dma_mem_page(dev, page) + offset; -+ } -+ debug_dma_map_page(dev, page, offset, size, dir, addr, true); -+ return addr; -+} -+ -+static inline void dma_unmap_single_attrs(struct device *dev, dma_addr_t addr, -+ size_t size, -+ enum dma_data_direction dir, -+ struct dma_attrs *attrs) -+{ -+ struct dma_map_ops *ops = get_dma_ops(dev); -+ -+ BUG_ON(!valid_dma_direction(dir)); -+ if (ops) { -+ ops->unmap_page(dev, addr, size, dir, attrs); -+ } else { -+ if (cpu_needs_post_dma_flush(dev)) -+ __dma_sync(dma_addr_to_page(dev, addr), -+ addr & ~PAGE_MASK, size, dir); -+ -+ plat_unmap_dma_mem(dev, addr, size, dir); -+ } -+ debug_dma_unmap_page(dev, addr, size, dir, true); -+} -+ -+static inline int dma_map_sg_attrs(struct device *dev, struct scatterlist *sg, -+ int nents, enum dma_data_direction dir, -+ struct dma_attrs *attrs) -+{ -+ struct dma_map_ops *ops = get_dma_ops(dev); -+ int i, ents; -+ struct scatterlist *s; -+ -+ for_each_sg(sg, s, nents, i) -+ kmemcheck_mark_initialized(sg_virt(s), s->length); -+ BUG_ON(!valid_dma_direction(dir)); -+ if (ops) { -+ ents = ops->map_sg(dev, sg, nents, dir, attrs); -+ } else { -+ for_each_sg(sg, s, nents, i) { -+ struct page *page = sg_page(s); -+ -+ if (!plat_device_is_coherent(dev)) -+ __dma_sync(page, s->offset, s->length, dir); -+#ifdef CONFIG_NEED_SG_DMA_LENGTH -+ s->dma_length = s->length; -+#endif -+ s->dma_address = -+ plat_map_dma_mem_page(dev, page) + s->offset; -+ } -+ ents = nents; -+ } -+ debug_dma_map_sg(dev, sg, nents, ents, dir); -+ -+ return ents; -+} -+ -+static inline void dma_unmap_sg_attrs(struct device *dev, struct scatterlist *sg, -+ int nents, enum dma_data_direction dir, -+ struct dma_attrs *attrs) -+{ -+ struct dma_map_ops *ops = get_dma_ops(dev); -+ struct scatterlist *s; -+ int i; -+ -+ BUG_ON(!valid_dma_direction(dir)); -+ debug_dma_unmap_sg(dev, sg, nents, dir); -+ if (ops) { -+ ops->unmap_sg(dev, sg, nents, dir, attrs); -+ return; -+ } -+ -+ for_each_sg(sg, s, nents, i) { -+ if (!plat_device_is_coherent(dev) && dir != DMA_TO_DEVICE) -+ __dma_sync(sg_page(s), s->offset, s->length, dir); -+ plat_unmap_dma_mem(dev, s->dma_address, s->length, dir); -+ } -+} -+ -+static inline dma_addr_t dma_map_page(struct device *dev, struct page *page, -+ size_t offset, size_t size, -+ enum dma_data_direction dir) -+{ -+ struct dma_map_ops *ops = get_dma_ops(dev); -+ dma_addr_t addr; -+ -+ kmemcheck_mark_initialized(page_address(page) + offset, size); -+ BUG_ON(!valid_dma_direction(dir)); -+ if (ops) { -+ addr = ops->map_page(dev, page, offset, size, dir, NULL); -+ } else { -+ if (!plat_device_is_coherent(dev)) -+ __dma_sync(page, offset, size, dir); -+ -+ addr = plat_map_dma_mem_page(dev, page) + offset; -+ } -+ debug_dma_map_page(dev, page, offset, size, dir, addr, false); -+ -+ return addr; -+} -+ -+static inline void dma_unmap_page(struct device *dev, dma_addr_t addr, -+ size_t size, enum dma_data_direction dir) -+{ -+ struct dma_map_ops *ops = get_dma_ops(dev); -+ -+ BUG_ON(!valid_dma_direction(dir)); -+ if (ops) { -+ ops->unmap_page(dev, addr, size, dir, NULL); -+ } else { -+ if (cpu_needs_post_dma_flush(dev)) -+ __dma_sync(dma_addr_to_page(dev, addr), -+ addr & ~PAGE_MASK, size, dir); -+ -+ plat_unmap_dma_mem(dev, addr, size, dir); -+ } -+ debug_dma_unmap_page(dev, addr, size, dir, false); -+} -+ -+static inline void dma_sync_single_for_cpu(struct device *dev, dma_addr_t addr, -+ size_t size, -+ enum dma_data_direction dir) -+{ -+ struct dma_map_ops *ops = get_dma_ops(dev); -+ -+ BUG_ON(!valid_dma_direction(dir)); -+ if (ops) -+ ops->sync_single_for_cpu(dev, addr, size, dir); -+ else if (cpu_needs_post_dma_flush(dev)) -+ __dma_sync(dma_addr_to_page(dev, addr), -+ addr & ~PAGE_MASK, size, dir); -+ debug_dma_sync_single_for_cpu(dev, addr, size, dir); -+} -+ -+static inline void dma_sync_single_for_device(struct device *dev, -+ dma_addr_t addr, size_t size, -+ enum dma_data_direction dir) -+{ -+ struct dma_map_ops *ops = get_dma_ops(dev); -+ -+ BUG_ON(!valid_dma_direction(dir)); -+ if (ops) -+ ops->sync_single_for_device(dev, addr, size, dir); -+ else if (!plat_device_is_coherent(dev)) -+ __dma_sync(dma_addr_to_page(dev, addr), -+ addr & ~PAGE_MASK, size, dir); -+ debug_dma_sync_single_for_device(dev, addr, size, dir); -+} -+ -+static inline void dma_sync_single_range_for_cpu(struct device *dev, -+ dma_addr_t addr, -+ unsigned long offset, -+ size_t size, -+ enum dma_data_direction dir) -+{ -+ const struct dma_map_ops *ops = get_dma_ops(dev); -+ -+ BUG_ON(!valid_dma_direction(dir)); -+ if (ops) -+ ops->sync_single_for_cpu(dev, addr + offset, size, dir); -+ else if (cpu_needs_post_dma_flush(dev)) -+ __dma_sync(dma_addr_to_page(dev, addr + offset), -+ (addr + offset) & ~PAGE_MASK, size, dir); -+ debug_dma_sync_single_range_for_cpu(dev, addr, offset, size, dir); -+} -+ -+static inline void dma_sync_single_range_for_device(struct device *dev, -+ dma_addr_t addr, -+ unsigned long offset, -+ size_t size, -+ enum dma_data_direction dir) -+{ -+ const struct dma_map_ops *ops = get_dma_ops(dev); -+ -+ BUG_ON(!valid_dma_direction(dir)); -+ if (ops) -+ ops->sync_single_for_device(dev, addr + offset, size, dir); -+ else if (!plat_device_is_coherent(dev)) -+ __dma_sync(dma_addr_to_page(dev, addr + offset), -+ (addr + offset) & ~PAGE_MASK, size, dir); -+ debug_dma_sync_single_range_for_device(dev, addr, offset, size, dir); -+} -+ -+static inline void -+dma_sync_sg_for_cpu(struct device *dev, struct scatterlist *sg, -+ int nelems, enum dma_data_direction dir) -+{ -+ struct dma_map_ops *ops = get_dma_ops(dev); -+ struct scatterlist *s; -+ int i; -+ -+ BUG_ON(!valid_dma_direction(dir)); -+ if (ops) -+ ops->sync_sg_for_cpu(dev, sg, nelems, dir); -+ else if (cpu_needs_post_dma_flush(dev)) { -+ for_each_sg(sg, s, nelems, i) -+ __dma_sync(sg_page(s), s->offset, s->length, dir); -+ } -+ debug_dma_sync_sg_for_cpu(dev, sg, nelems, dir); -+} -+ -+static inline void -+dma_sync_sg_for_device(struct device *dev, struct scatterlist *sg, -+ int nelems, enum dma_data_direction dir) -+{ -+ struct dma_map_ops *ops = get_dma_ops(dev); -+ struct scatterlist *s; -+ int i; -+ -+ BUG_ON(!valid_dma_direction(dir)); -+ if (ops) -+ ops->sync_sg_for_device(dev, sg, nelems, dir); -+ else if (!plat_device_is_coherent(dev)) { -+ for_each_sg(sg, s, nelems, i) -+ __dma_sync(sg_page(s), s->offset, s->length, dir); -+ } -+ debug_dma_sync_sg_for_device(dev, sg, nelems, dir); -+ -+} -+ -+#define dma_map_single(d, a, s, r) dma_map_single_attrs(d, a, s, r, NULL) -+#define dma_unmap_single(d, a, s, r) dma_unmap_single_attrs(d, a, s, r, NULL) -+#define dma_map_sg(d, s, n, r) dma_map_sg_attrs(d, s, n, r, NULL) -+#define dma_unmap_sg(d, s, n, r) dma_unmap_sg_attrs(d, s, n, r, NULL) -+ -+extern int dma_common_mmap(struct device *dev, struct vm_area_struct *vma, -+ void *cpu_addr, dma_addr_t dma_addr, size_t size); -+ -+/** -+ * dma_mmap_attrs - map a coherent DMA allocation into user space -+ * @dev: valid struct device pointer, or NULL for ISA and EISA-like devices -+ * @vma: vm_area_struct describing requested user mapping -+ * @cpu_addr: kernel CPU-view address returned from dma_alloc_attrs -+ * @handle: device-view address returned from dma_alloc_attrs -+ * @size: size of memory originally requested in dma_alloc_attrs -+ * @attrs: attributes of mapping properties requested in dma_alloc_attrs -+ * -+ * Map a coherent DMA buffer previously allocated by dma_alloc_attrs -+ * into user space. The coherent DMA buffer must not be freed by the -+ * driver until the user space mapping has been released. -+ */ -+static inline int -+dma_mmap_attrs(struct device *dev, struct vm_area_struct *vma, void *cpu_addr, -+ dma_addr_t dma_addr, size_t size, struct dma_attrs *attrs) -+{ -+ struct dma_map_ops *ops = get_dma_ops(dev); -+ BUG_ON(!ops); -+ if (ops && ops->mmap) -+ return ops->mmap(dev, vma, cpu_addr, dma_addr, size, attrs); -+ return dma_common_mmap(dev, vma, cpu_addr, dma_addr, size); -+} -+ -+#define dma_mmap_coherent(d, v, c, h, s) dma_mmap_attrs(d, v, c, h, s, NULL) -+ -+int -+dma_common_get_sgtable(struct device *dev, struct sg_table *sgt, -+ void *cpu_addr, dma_addr_t dma_addr, size_t size); -+ -+static inline int -+dma_get_sgtable_attrs(struct device *dev, struct sg_table *sgt, void *cpu_addr, -+ dma_addr_t dma_addr, size_t size, struct dma_attrs *attrs) -+{ -+ struct dma_map_ops *ops = get_dma_ops(dev); -+ BUG_ON(!ops); -+ if (ops && ops->get_sgtable) -+ return ops->get_sgtable(dev, sgt, cpu_addr, dma_addr, size, -+ attrs); -+ return dma_common_get_sgtable(dev, sgt, cpu_addr, dma_addr, size); -+} -+ -+#define dma_get_sgtable(d, t, v, h, s) dma_get_sgtable_attrs(d, t, v, h, s, NULL) -+ - - static inline int dma_supported(struct device *dev, u64 mask) - { - struct dma_map_ops *ops = get_dma_ops(dev); -- return ops->dma_supported(dev, mask); -+ if (ops) -+ return ops->dma_supported(dev, mask); -+ return plat_dma_supported(dev, mask); - } - - static inline int dma_mapping_error(struct device *dev, u64 mask) -@@ -43,7 +378,9 @@ static inline int dma_mapping_error(stru - struct dma_map_ops *ops = get_dma_ops(dev); - - debug_dma_mapping_error(dev, mask); -- return ops->mapping_error(dev, mask); -+ if (ops) -+ return ops->mapping_error(dev, mask); -+ return 0; - } - - static inline int -@@ -54,7 +391,7 @@ dma_set_mask(struct device *dev, u64 mas - if(!dev->dma_mask || !dma_supported(dev, mask)) - return -EIO; - -- if (ops->set_dma_mask) -+ if (ops && ops->set_dma_mask) - return ops->set_dma_mask(dev, mask); - - *dev->dma_mask = mask; -@@ -74,7 +411,11 @@ static inline void *dma_alloc_attrs(stru - void *ret; - struct dma_map_ops *ops = get_dma_ops(dev); - -- ret = ops->alloc(dev, size, dma_handle, gfp, attrs); -+ if (ops) -+ ret = ops->alloc(dev, size, dma_handle, gfp, attrs); -+ else -+ ret = mips_dma_alloc_coherent(dev, size, dma_handle, gfp, -+ attrs); - - debug_dma_alloc_coherent(dev, size, *dma_handle, ret); - -@@ -89,7 +430,10 @@ static inline void dma_free_attrs(struct - { - struct dma_map_ops *ops = get_dma_ops(dev); - -- ops->free(dev, size, vaddr, dma_handle, attrs); -+ if (ops) -+ ops->free(dev, size, vaddr, dma_handle, attrs); -+ else -+ mips_dma_free_coherent(dev, size, vaddr, dma_handle, attrs); - - debug_dma_free_coherent(dev, size, vaddr, dma_handle); - } ---- a/arch/mips/mm/dma-default.c -+++ b/arch/mips/mm/dma-default.c -@@ -26,7 +26,7 @@ - - #ifdef CONFIG_DMA_MAYBE_COHERENT - int coherentio = 0; /* User defined DMA coherency from command line. */ --EXPORT_SYMBOL_GPL(coherentio); -+EXPORT_SYMBOL(coherentio); - int hw_coherentio = 0; /* Actual hardware supported DMA coherency setting. */ - - static int __init setcoherentio(char *str) -@@ -46,30 +46,6 @@ static int __init setnocoherentio(char * - early_param("nocoherentio", setnocoherentio); - #endif - --static inline struct page *dma_addr_to_page(struct device *dev, -- dma_addr_t dma_addr) --{ -- return pfn_to_page( -- plat_dma_addr_to_phys(dev, dma_addr) >> PAGE_SHIFT); --} -- --/* -- * The affected CPUs below in 'cpu_needs_post_dma_flush()' can -- * speculatively fill random cachelines with stale data at any time, -- * requiring an extra flush post-DMA. -- * -- * Warning on the terminology - Linux calls an uncached area coherent; -- * MIPS terminology calls memory areas with hardware maintained coherency -- * coherent. -- */ --static inline int cpu_needs_post_dma_flush(struct device *dev) --{ -- return !plat_device_is_coherent(dev) && -- (boot_cpu_type() == CPU_R10000 || -- boot_cpu_type() == CPU_R12000 || -- boot_cpu_type() == CPU_BMIPS5000); --} -- - static gfp_t massage_gfp_flags(const struct device *dev, gfp_t gfp) - { - gfp_t dma_flag; -@@ -125,8 +101,9 @@ void *dma_alloc_noncoherent(struct devic - } - EXPORT_SYMBOL(dma_alloc_noncoherent); - --static void *mips_dma_alloc_coherent(struct device *dev, size_t size, -- dma_addr_t * dma_handle, gfp_t gfp, struct dma_attrs *attrs) -+void *mips_dma_alloc_coherent(struct device *dev, size_t size, -+ dma_addr_t *dma_handle, gfp_t gfp, -+ struct dma_attrs *attrs) - { - void *ret; - struct page *page = NULL; -@@ -157,6 +134,7 @@ static void *mips_dma_alloc_coherent(str - - return ret; - } -+EXPORT_SYMBOL(mips_dma_alloc_coherent); - - - void dma_free_noncoherent(struct device *dev, size_t size, void *vaddr, -@@ -167,8 +145,8 @@ void dma_free_noncoherent(struct device - } - EXPORT_SYMBOL(dma_free_noncoherent); - --static void mips_dma_free_coherent(struct device *dev, size_t size, void *vaddr, -- dma_addr_t dma_handle, struct dma_attrs *attrs) -+void mips_dma_free_coherent(struct device *dev, size_t size, void *vaddr, -+ dma_addr_t dma_handle, struct dma_attrs *attrs) - { - unsigned long addr = (unsigned long) vaddr; - int order = get_order(size); -@@ -188,6 +166,7 @@ static void mips_dma_free_coherent(struc - if (!dma_release_from_contiguous(dev, page, count)) - __free_pages(page, get_order(size)); - } -+EXPORT_SYMBOL(mips_dma_free_coherent); - - static inline void __dma_sync_virtual(void *addr, size_t size, - enum dma_data_direction direction) -@@ -216,8 +195,8 @@ static inline void __dma_sync_virtual(vo - * If highmem is not configured then the bulk of this loop gets - * optimized out. - */ --static inline void __dma_sync(struct page *page, -- unsigned long offset, size_t size, enum dma_data_direction direction) -+void __dma_sync(struct page *page, unsigned long offset, size_t size, -+ enum dma_data_direction direction) - { - size_t left = size; - -@@ -246,108 +225,7 @@ static inline void __dma_sync(struct pag - left -= len; - } while (left); - } -- --static void mips_dma_unmap_page(struct device *dev, dma_addr_t dma_addr, -- size_t size, enum dma_data_direction direction, struct dma_attrs *attrs) --{ -- if (cpu_needs_post_dma_flush(dev)) -- __dma_sync(dma_addr_to_page(dev, dma_addr), -- dma_addr & ~PAGE_MASK, size, direction); -- -- plat_unmap_dma_mem(dev, dma_addr, size, direction); --} -- --static int mips_dma_map_sg(struct device *dev, struct scatterlist *sg, -- int nents, enum dma_data_direction direction, struct dma_attrs *attrs) --{ -- int i; -- -- for (i = 0; i < nents; i++, sg++) { -- if (!plat_device_is_coherent(dev)) -- __dma_sync(sg_page(sg), sg->offset, sg->length, -- direction); --#ifdef CONFIG_NEED_SG_DMA_LENGTH -- sg->dma_length = sg->length; --#endif -- sg->dma_address = plat_map_dma_mem_page(dev, sg_page(sg)) + -- sg->offset; -- } -- -- return nents; --} -- --static dma_addr_t mips_dma_map_page(struct device *dev, struct page *page, -- unsigned long offset, size_t size, enum dma_data_direction direction, -- struct dma_attrs *attrs) --{ -- if (!plat_device_is_coherent(dev)) -- __dma_sync(page, offset, size, direction); -- -- return plat_map_dma_mem_page(dev, page) + offset; --} -- --static void mips_dma_unmap_sg(struct device *dev, struct scatterlist *sg, -- int nhwentries, enum dma_data_direction direction, -- struct dma_attrs *attrs) --{ -- int i; -- -- for (i = 0; i < nhwentries; i++, sg++) { -- if (!plat_device_is_coherent(dev) && -- direction != DMA_TO_DEVICE) -- __dma_sync(sg_page(sg), sg->offset, sg->length, -- direction); -- plat_unmap_dma_mem(dev, sg->dma_address, sg->length, direction); -- } --} -- --static void mips_dma_sync_single_for_cpu(struct device *dev, -- dma_addr_t dma_handle, size_t size, enum dma_data_direction direction) --{ -- if (cpu_needs_post_dma_flush(dev)) -- __dma_sync(dma_addr_to_page(dev, dma_handle), -- dma_handle & ~PAGE_MASK, size, direction); --} -- --static void mips_dma_sync_single_for_device(struct device *dev, -- dma_addr_t dma_handle, size_t size, enum dma_data_direction direction) --{ -- if (!plat_device_is_coherent(dev)) -- __dma_sync(dma_addr_to_page(dev, dma_handle), -- dma_handle & ~PAGE_MASK, size, direction); --} -- --static void mips_dma_sync_sg_for_cpu(struct device *dev, -- struct scatterlist *sg, int nelems, enum dma_data_direction direction) --{ -- int i; -- -- if (cpu_needs_post_dma_flush(dev)) -- for (i = 0; i < nelems; i++, sg++) -- __dma_sync(sg_page(sg), sg->offset, sg->length, -- direction); --} -- --static void mips_dma_sync_sg_for_device(struct device *dev, -- struct scatterlist *sg, int nelems, enum dma_data_direction direction) --{ -- int i; -- -- if (!plat_device_is_coherent(dev)) -- for (i = 0; i < nelems; i++, sg++) -- __dma_sync(sg_page(sg), sg->offset, sg->length, -- direction); --} -- --int mips_dma_mapping_error(struct device *dev, dma_addr_t dma_addr) --{ -- return 0; --} -- --int mips_dma_supported(struct device *dev, u64 mask) --{ -- return plat_dma_supported(dev, mask); --} -+EXPORT_SYMBOL(__dma_sync); - - void dma_cache_sync(struct device *dev, void *vaddr, size_t size, - enum dma_data_direction direction) -@@ -360,23 +238,10 @@ void dma_cache_sync(struct device *dev, - - EXPORT_SYMBOL(dma_cache_sync); - --static struct dma_map_ops mips_default_dma_map_ops = { -- .alloc = mips_dma_alloc_coherent, -- .free = mips_dma_free_coherent, -- .map_page = mips_dma_map_page, -- .unmap_page = mips_dma_unmap_page, -- .map_sg = mips_dma_map_sg, -- .unmap_sg = mips_dma_unmap_sg, -- .sync_single_for_cpu = mips_dma_sync_single_for_cpu, -- .sync_single_for_device = mips_dma_sync_single_for_device, -- .sync_sg_for_cpu = mips_dma_sync_sg_for_cpu, -- .sync_sg_for_device = mips_dma_sync_sg_for_device, -- .mapping_error = mips_dma_mapping_error, -- .dma_supported = mips_dma_supported --}; -- --struct dma_map_ops *mips_dma_map_ops = &mips_default_dma_map_ops; -+#ifdef CONFIG_SYS_HAS_DMA_OPS -+struct dma_map_ops *mips_dma_map_ops = NULL; - EXPORT_SYMBOL(mips_dma_map_ops); -+#endif - - #define PREALLOC_DMA_DEBUG_ENTRIES (1 << 16) - diff --git a/target/linux/generic/pending-3.18/140-mtd-part-add-generic-parsing-of-linux-part-probe.patch b/target/linux/generic/pending-3.18/140-mtd-part-add-generic-parsing-of-linux-part-probe.patch deleted file mode 100644 index bd34f9698a..0000000000 --- a/target/linux/generic/pending-3.18/140-mtd-part-add-generic-parsing-of-linux-part-probe.patch +++ /dev/null @@ -1,175 +0,0 @@ -From 173b0add0cff6558f950c0cb1eacfb729d482711 Mon Sep 17 00:00:00 2001 -From: Hauke Mehrtens -Date: Sun, 17 May 2015 18:48:38 +0200 -Subject: [PATCH 4/8] mtd: part: add generic parsing of linux,part-probe - -This moves the linux,part-probe device tree parsing code from -physmap_of.c to mtdpart.c. Now all drivers can use this feature by just -providing a reference to their device tree node in struct -mtd_part_parser_data. - -Signed-off-by: Hauke Mehrtens ---- - Documentation/devicetree/bindings/mtd/nand.txt | 16 ++++++++++ - drivers/mtd/maps/physmap_of.c | 40 +----------------------- - drivers/mtd/mtdpart.c | 43 ++++++++++++++++++++++++++ - 3 files changed, 60 insertions(+), 39 deletions(-) - ---- a/Documentation/devicetree/bindings/mtd/nand.txt -+++ b/Documentation/devicetree/bindings/mtd/nand.txt -@@ -12,6 +12,22 @@ - - nand-ecc-step-size: integer representing the number of data bytes - that are covered by a single ECC step. - -+- linux,part-probe: list of name as strings of the partition parser -+ which should be used to parse the partition table. -+ They will be tried in the specified ordering and -+ the next one will be used if the previous one -+ failed. -+ -+ Example: linux,part-probe = "cmdlinepart", "ofpart"; -+ -+ This is also the default value, which will be used -+ if this attribute is not specified. It could be -+ that the flash driver in use overwrote the default -+ value and uses some other default. -+ -+ Possible values are: bcm47xxpart, afs, ar7part, -+ ofoldpart, ofpart, bcm63xxpart, RedBoot, cmdlinepart -+ - The ECC strength and ECC step size properties define the correction capability - of a controller. Together, they say a controller can correct "{strength} bit - errors per {size} bytes". ---- a/drivers/mtd/maps/physmap_of.c -+++ b/drivers/mtd/maps/physmap_of.c -@@ -114,45 +114,9 @@ static struct mtd_info *obsolete_probe(s - static const char * const part_probe_types_def[] = { - "cmdlinepart", "RedBoot", "ofpart", "ofoldpart", NULL }; - --static const char * const *of_get_probes(struct device_node *dp) --{ -- const char *cp; -- int cplen; -- unsigned int l; -- unsigned int count; -- const char **res; -- -- cp = of_get_property(dp, "linux,part-probe", &cplen); -- if (cp == NULL) -- return part_probe_types_def; -- -- count = 0; -- for (l = 0; l != cplen; l++) -- if (cp[l] == 0) -- count++; -- -- res = kzalloc((count + 1)*sizeof(*res), GFP_KERNEL); -- count = 0; -- while (cplen > 0) { -- res[count] = cp; -- l = strlen(cp) + 1; -- cp += l; -- cplen -= l; -- count++; -- } -- return res; --} -- --static void of_free_probes(const char * const *probes) --{ -- if (probes != part_probe_types_def) -- kfree(probes); --} -- - static struct of_device_id of_flash_match[]; - static int of_flash_probe(struct platform_device *dev) - { -- const char * const *part_probe_types; - const struct of_device_id *match; - struct device_node *dp = dev->dev.of_node; - struct resource res; -@@ -302,10 +266,8 @@ static int of_flash_probe(struct platfor - goto err_out; - - ppdata.of_node = dp; -- part_probe_types = of_get_probes(dp); -- mtd_device_parse_register(info->cmtd, part_probe_types, &ppdata, -+ mtd_device_parse_register(info->cmtd, part_probe_types_def, &ppdata, - NULL, 0); -- of_free_probes(part_probe_types); - - kfree(mtd_list); - ---- a/drivers/mtd/mtdpart.c -+++ b/drivers/mtd/mtdpart.c -@@ -29,6 +29,7 @@ - #include - #include - #include -+#include - #include - - #include "mtdcore.h" -@@ -702,6 +703,40 @@ void deregister_mtd_parser(struct mtd_pa - EXPORT_SYMBOL_GPL(deregister_mtd_parser); - - /* -+ * Parses the linux,part-probe device tree property. -+ * When a non null value is returned it has to be freed with kfree() by -+ * the caller. -+ */ -+static const char * const *of_get_probes(struct device_node *dp) -+{ -+ const char *cp; -+ int cplen; -+ unsigned int l; -+ unsigned int count; -+ const char **res; -+ -+ cp = of_get_property(dp, "linux,part-probe", &cplen); -+ if (cp == NULL) -+ return NULL; -+ -+ count = 0; -+ for (l = 0; l != cplen; l++) -+ if (cp[l] == 0) -+ count++; -+ -+ res = kzalloc((count + 1) * sizeof(*res), GFP_KERNEL); -+ count = 0; -+ while (cplen > 0) { -+ res[count] = cp; -+ l = strlen(cp) + 1; -+ cp += l; -+ cplen -= l; -+ count++; -+ } -+ return res; -+} -+ -+/* - * Do not forget to update 'parse_mtd_partitions()' kerneldoc comment if you - * are changing this array! - */ -@@ -737,6 +772,13 @@ int parse_mtd_partitions(struct mtd_info - { - struct mtd_part_parser *parser; - int ret = 0; -+ const char *const *types_of = NULL; -+ -+ if (data && data->of_node) { -+ types_of = of_get_probes(data->of_node); -+ if (types_of != NULL) -+ types = types_of; -+ } - - if (!types) - types = default_mtd_part_types; -@@ -755,6 +797,7 @@ int parse_mtd_partitions(struct mtd_info - break; - } - } -+ kfree(types_of); - return ret; - } - diff --git a/target/linux/generic/pending-3.18/142-mtd-bcm47xxpart-don-t-fail-because-of-bit-flips.patch b/target/linux/generic/pending-3.18/142-mtd-bcm47xxpart-don-t-fail-because-of-bit-flips.patch deleted file mode 100644 index 926de5fef7..0000000000 --- a/target/linux/generic/pending-3.18/142-mtd-bcm47xxpart-don-t-fail-because-of-bit-flips.patch +++ /dev/null @@ -1,92 +0,0 @@ -From dfe4b4c732365fc1d83c2d2fd9cc18054ae850b7 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= -Date: Sun, 6 Dec 2015 11:24:05 +0100 -Subject: [PATCH] mtd: bcm47xxpart: don't fail because of bit-flips -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Bit-flip errors may occur on NAND flashes and are harmless. Handle them -gracefully as read content is still reliable and can be parsed. - -Signed-off-by: Rafał Miłecki ---- - drivers/mtd/bcm47xxpart.c | 38 ++++++++++++++++++++++---------------- - 1 file changed, 22 insertions(+), 16 deletions(-) - ---- a/drivers/mtd/bcm47xxpart.c -+++ b/drivers/mtd/bcm47xxpart.c -@@ -66,11 +66,13 @@ static const char *bcm47xxpart_trx_data_ - { - uint32_t buf; - size_t bytes_read; -+ int err; - -- if (mtd_read(master, offset, sizeof(buf), &bytes_read, -- (uint8_t *)&buf) < 0) { -- pr_err("mtd_read error while parsing (offset: 0x%X)!\n", -- offset); -+ err = mtd_read(master, offset, sizeof(buf), &bytes_read, -+ (uint8_t *)&buf); -+ if (err && !mtd_is_bitflip(err)) { -+ pr_err("mtd_read error while parsing (offset: 0x%X): %d\n", -+ offset, err); - goto out_default; - } - -@@ -95,6 +97,7 @@ static int bcm47xxpart_parse(struct mtd_ - int trx_part = -1; - int last_trx_part = -1; - int possible_nvram_sizes[] = { 0x8000, 0xF000, 0x10000, }; -+ int err; - - /* - * Some really old flashes (like AT45DB*) had smaller erasesize-s, but -@@ -128,10 +131,11 @@ static int bcm47xxpart_parse(struct mtd_ - } - - /* Read beginning of the block */ -- if (mtd_read(master, offset, BCM47XXPART_BYTES_TO_READ, -- &bytes_read, (uint8_t *)buf) < 0) { -- pr_err("mtd_read error while parsing (offset: 0x%X)!\n", -- offset); -+ err = mtd_read(master, offset, BCM47XXPART_BYTES_TO_READ, -+ &bytes_read, (uint8_t *)buf); -+ if (err && !mtd_is_bitflip(err)) { -+ pr_err("mtd_read error while parsing (offset: 0x%X): %d\n", -+ offset, err); - continue; - } - -@@ -252,10 +256,11 @@ static int bcm47xxpart_parse(struct mtd_ - } - - /* Read middle of the block */ -- if (mtd_read(master, offset + 0x8000, 0x4, -- &bytes_read, (uint8_t *)buf) < 0) { -- pr_err("mtd_read error while parsing (offset: 0x%X)!\n", -- offset); -+ err = mtd_read(master, offset + 0x8000, 0x4, &bytes_read, -+ (uint8_t *)buf); -+ if (err && !mtd_is_bitflip(err)) { -+ pr_err("mtd_read error while parsing (offset: 0x%X): %d\n", -+ offset, err); - continue; - } - -@@ -275,10 +280,11 @@ static int bcm47xxpart_parse(struct mtd_ - } - - offset = master->size - possible_nvram_sizes[i]; -- if (mtd_read(master, offset, 0x4, &bytes_read, -- (uint8_t *)buf) < 0) { -- pr_err("mtd_read error while reading at offset 0x%X!\n", -- offset); -+ err = mtd_read(master, offset, 0x4, &bytes_read, -+ (uint8_t *)buf); -+ if (err && !mtd_is_bitflip(err)) { -+ pr_err("mtd_read error while reading (offset 0x%X): %d\n", -+ offset, err); - continue; - } - diff --git a/target/linux/generic/pending-3.18/180-usb-xhci-make-USB_XHCI_PLATFORM-selectable.patch b/target/linux/generic/pending-3.18/180-usb-xhci-make-USB_XHCI_PLATFORM-selectable.patch deleted file mode 100644 index a17e39800c..0000000000 --- a/target/linux/generic/pending-3.18/180-usb-xhci-make-USB_XHCI_PLATFORM-selectable.patch +++ /dev/null @@ -1,41 +0,0 @@ -From 9612e686b235dc9e33c8dfb5e6d2ff2b2140fb9d Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= -Date: Tue, 16 Jun 2015 21:01:30 +0200 -Subject: [PATCH V2] usb: xhci: make USB_XHCI_PLATFORM selectable -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Right now xhci-plat-hcd can be built when using one of platform specific -drivers only (mvebu/rcar). There shouldn't be such limitation as some -platforms may not require any quirks and may want to just use a generic -driver ("generic-xhci" / "xhci-hcd"). - -Signed-off-by: Rafał Miłecki ---- -Greg/Mathias: I'm not sure if it's more like USB subsystem stuff or xHCI -Could you decide which one of you could pick that, please? - -V2: Drop useless "default n", thanks Sergei :) ---- - drivers/usb/host/Kconfig | 9 ++++++++- - 1 file changed, 8 insertions(+), 1 deletion(-) - ---- a/drivers/usb/host/Kconfig -+++ b/drivers/usb/host/Kconfig -@@ -32,7 +32,14 @@ config USB_XHCI_PCI - default y - - config USB_XHCI_PLATFORM -- tristate -+ tristate "Generic xHCI driver for a platform device" -+ ---help--- -+ Adds an xHCI host driver for a generic platform device, which -+ provides a memory space and an irq. -+ It is also a prerequisite for platform specific drivers that -+ implement some extra quirks. -+ -+ If unsure, say N. - - config USB_XHCI_MVEBU - tristate "xHCI support for Marvell Armada 375/38x" diff --git a/target/linux/generic/pending-3.18/190-cdc_ncm_add_support_for_moving_ndp_to_end_of_ncm_frame.patch b/target/linux/generic/pending-3.18/190-cdc_ncm_add_support_for_moving_ndp_to_end_of_ncm_frame.patch deleted file mode 100644 index 632384d56f..0000000000 --- a/target/linux/generic/pending-3.18/190-cdc_ncm_add_support_for_moving_ndp_to_end_of_ncm_frame.patch +++ /dev/null @@ -1,228 +0,0 @@ -From 4a0e3e989d66bb7204b163d9cfaa7fa96d0f2023 Mon Sep 17 00:00:00 2001 -From: Enrico Mioso -Date: Wed, 8 Jul 2015 13:05:57 +0200 -Subject: [PATCH] cdc_ncm: Add support for moving NDP to end of NCM frame - -NCM specs are not actually mandating a specific position in the frame for -the NDP (Network Datagram Pointer). However, some Huawei devices will -ignore our aggregates if it is not placed after the datagrams it points -to. Add support for doing just this, in a per-device configurable way. -While at it, update NCM subdrivers, disabling this functionality in all of -them, except in huawei_cdc_ncm where it is enabled instead. -We aren't making any distinction between different Huawei NCM devices, -based on what the vendor driver does. Standard NCM devices are left -unaffected: if they are compliant, they should be always usable, still -stay on the safe side. - -This change has been tested and working with a Huawei E3131 device (which -works regardless of NDP position), a Huawei E3531 (also working both -ways) and an E3372 (which mandates NDP to be after indexed datagrams). - -V1->V2: -- corrected wrong NDP acronym definition -- fixed possible NULL pointer dereference -- patch cleanup -V2->V3: -- Properly account for the NDP size when writing new packets to SKB - -Signed-off-by: Enrico Mioso -Signed-off-by: David S. Miller ---- - drivers/net/usb/cdc_mbim.c | 2 +- - drivers/net/usb/cdc_ncm.c | 61 ++++++++++++++++++++++++++++++++++++---- - drivers/net/usb/huawei_cdc_ncm.c | 7 +++-- - include/linux/usb/cdc_ncm.h | 7 ++++- - 4 files changed, 67 insertions(+), 10 deletions(-) - ---- a/drivers/net/usb/cdc_mbim.c -+++ b/drivers/net/usb/cdc_mbim.c -@@ -158,7 +158,7 @@ static int cdc_mbim_bind(struct usbnet * - if (!cdc_ncm_comm_intf_is_mbim(intf->cur_altsetting)) - goto err; - -- ret = cdc_ncm_bind_common(dev, intf, data_altsetting); -+ ret = cdc_ncm_bind_common(dev, intf, data_altsetting, 0); - if (ret) - goto err; - ---- a/drivers/net/usb/cdc_ncm.c -+++ b/drivers/net/usb/cdc_ncm.c -@@ -684,10 +684,12 @@ static void cdc_ncm_free(struct cdc_ncm_ - ctx->tx_curr_skb = NULL; - } - -+ kfree(ctx->delayed_ndp16); -+ - kfree(ctx); - } - --int cdc_ncm_bind_common(struct usbnet *dev, struct usb_interface *intf, u8 data_altsetting) -+int cdc_ncm_bind_common(struct usbnet *dev, struct usb_interface *intf, u8 data_altsetting, int drvflags) - { - const struct usb_cdc_union_desc *union_desc = NULL; - struct cdc_ncm_ctx *ctx; -@@ -859,6 +861,17 @@ advance: - /* finish setting up the device specific data */ - cdc_ncm_setup(dev); - -+ /* Device-specific flags */ -+ ctx->drvflags = drvflags; -+ -+ /* Allocate the delayed NDP if needed. */ -+ if (ctx->drvflags & CDC_NCM_FLAG_NDP_TO_END) { -+ ctx->delayed_ndp16 = kzalloc(ctx->max_ndp_size, GFP_KERNEL); -+ if (!ctx->delayed_ndp16) -+ goto error2; -+ dev_info(&intf->dev, "NDP will be placed at end of frame for this device."); -+ } -+ - /* override ethtool_ops */ - dev->net->ethtool_ops = &cdc_ncm_ethtool_ops; - -@@ -956,8 +969,11 @@ static int cdc_ncm_bind(struct usbnet *d - if (cdc_ncm_select_altsetting(intf) != CDC_NCM_COMM_ALTSETTING_NCM) - return -ENODEV; - -- /* The NCM data altsetting is fixed */ -- return cdc_ncm_bind_common(dev, intf, CDC_NCM_DATA_ALTSETTING_NCM); -+ /* The NCM data altsetting is fixed, so we hard-coded it. -+ * Additionally, generic NCM devices are assumed to accept arbitrarily -+ * placed NDP. -+ */ -+ return cdc_ncm_bind_common(dev, intf, CDC_NCM_DATA_ALTSETTING_NCM, 0); - } - - static void cdc_ncm_align_tail(struct sk_buff *skb, size_t modulus, size_t remainder, size_t max) -@@ -979,6 +995,14 @@ static struct usb_cdc_ncm_ndp16 *cdc_ncm - struct usb_cdc_ncm_nth16 *nth16 = (void *)skb->data; - size_t ndpoffset = le16_to_cpu(nth16->wNdpIndex); - -+ /* If NDP should be moved to the end of the NCM package, we can't follow the -+ * NTH16 header as we would normally do. NDP isn't written to the SKB yet, and -+ * the wNdpIndex field in the header is actually not consistent with reality. It will be later. -+ */ -+ if (ctx->drvflags & CDC_NCM_FLAG_NDP_TO_END) -+ if (ctx->delayed_ndp16->dwSignature == sign) -+ return ctx->delayed_ndp16; -+ - /* follow the chain of NDPs, looking for a match */ - while (ndpoffset) { - ndp16 = (struct usb_cdc_ncm_ndp16 *)(skb->data + ndpoffset); -@@ -988,7 +1012,8 @@ static struct usb_cdc_ncm_ndp16 *cdc_ncm - } - - /* align new NDP */ -- cdc_ncm_align_tail(skb, ctx->tx_ndp_modulus, 0, ctx->tx_max); -+ if (!(ctx->drvflags & CDC_NCM_FLAG_NDP_TO_END)) -+ cdc_ncm_align_tail(skb, ctx->tx_ndp_modulus, 0, ctx->tx_max); - - /* verify that there is room for the NDP and the datagram (reserve) */ - if ((ctx->tx_max - skb->len - reserve) < ctx->max_ndp_size) -@@ -1001,7 +1026,11 @@ static struct usb_cdc_ncm_ndp16 *cdc_ncm - nth16->wNdpIndex = cpu_to_le16(skb->len); - - /* push a new empty NDP */ -- ndp16 = (struct usb_cdc_ncm_ndp16 *)memset(skb_put(skb, ctx->max_ndp_size), 0, ctx->max_ndp_size); -+ if (!(ctx->drvflags & CDC_NCM_FLAG_NDP_TO_END)) -+ ndp16 = (struct usb_cdc_ncm_ndp16 *)memset(skb_put(skb, ctx->max_ndp_size), 0, ctx->max_ndp_size); -+ else -+ ndp16 = ctx->delayed_ndp16; -+ - ndp16->dwSignature = sign; - ndp16->wLength = cpu_to_le16(sizeof(struct usb_cdc_ncm_ndp16) + sizeof(struct usb_cdc_ncm_dpe16)); - return ndp16; -@@ -1016,6 +1045,15 @@ cdc_ncm_fill_tx_frame(struct usbnet *dev - struct sk_buff *skb_out; - u16 n = 0, index, ndplen; - u8 ready2send = 0; -+ u32 delayed_ndp_size; -+ -+ /* When our NDP gets written in cdc_ncm_ndp(), then skb_out->len gets updated -+ * accordingly. Otherwise, we should check here. -+ */ -+ if (ctx->drvflags & CDC_NCM_FLAG_NDP_TO_END) -+ delayed_ndp_size = ctx->max_ndp_size; -+ else -+ delayed_ndp_size = 0; - - /* if there is a remaining skb, it gets priority */ - if (skb != NULL) { -@@ -1070,7 +1108,7 @@ cdc_ncm_fill_tx_frame(struct usbnet *dev - cdc_ncm_align_tail(skb_out, ctx->tx_modulus, ctx->tx_remainder, ctx->tx_max); - - /* check if we had enough room left for both NDP and frame */ -- if (!ndp16 || skb_out->len + skb->len > ctx->tx_max) { -+ if (!ndp16 || skb_out->len + skb->len + delayed_ndp_size > ctx->tx_max) { - if (n == 0) { - /* won't fit, MTU problem? */ - dev_kfree_skb_any(skb); -@@ -1143,6 +1181,17 @@ cdc_ncm_fill_tx_frame(struct usbnet *dev - /* variables will be reset at next call */ - } - -+ /* If requested, put NDP at end of frame. */ -+ if (ctx->drvflags & CDC_NCM_FLAG_NDP_TO_END) { -+ nth16 = (struct usb_cdc_ncm_nth16 *)skb_out->data; -+ cdc_ncm_align_tail(skb_out, ctx->tx_ndp_modulus, 0, ctx->tx_max); -+ nth16->wNdpIndex = cpu_to_le16(skb_out->len); -+ memcpy(skb_put(skb_out, ctx->max_ndp_size), ctx->delayed_ndp16, ctx->max_ndp_size); -+ -+ /* Zero out delayed NDP - signature checking will naturally fail. */ -+ ndp16 = memset(ctx->delayed_ndp16, 0, ctx->max_ndp_size); -+ } -+ - /* If collected data size is less or equal ctx->min_tx_pkt - * bytes, we send buffers as it is. If we get more data, it - * would be more efficient for USB HS mobile device with DMA ---- a/drivers/net/usb/huawei_cdc_ncm.c -+++ b/drivers/net/usb/huawei_cdc_ncm.c -@@ -73,11 +73,14 @@ static int huawei_cdc_ncm_bind(struct us - struct usb_driver *subdriver = ERR_PTR(-ENODEV); - int ret = -ENODEV; - struct huawei_cdc_ncm_state *drvstate = (void *)&usbnet_dev->data; -+ int drvflags = 0; - - /* altsetting should always be 1 for NCM devices - so we hard-coded -- * it here -+ * it here. Some huawei devices will need the NDP part of the NCM package to -+ * be at the end of the frame. - */ -- ret = cdc_ncm_bind_common(usbnet_dev, intf, 1); -+ drvflags |= CDC_NCM_FLAG_NDP_TO_END; -+ ret = cdc_ncm_bind_common(usbnet_dev, intf, 1, drvflags); - if (ret) - goto err; - ---- a/include/linux/usb/cdc_ncm.h -+++ b/include/linux/usb/cdc_ncm.h -@@ -80,6 +80,9 @@ - #define CDC_NCM_TIMER_INTERVAL_MIN 5UL - #define CDC_NCM_TIMER_INTERVAL_MAX (U32_MAX / NSEC_PER_USEC) - -+/* Driver flags */ -+#define CDC_NCM_FLAG_NDP_TO_END 0x02 /* NDP is placed at end of frame */ -+ - #define cdc_ncm_comm_intf_is_mbim(x) ((x)->desc.bInterfaceSubClass == USB_CDC_SUBCLASS_MBIM && \ - (x)->desc.bInterfaceProtocol == USB_CDC_PROTO_NONE) - #define cdc_ncm_data_intf_is_mbim(x) ((x)->desc.bInterfaceProtocol == USB_CDC_MBIM_PROTO_NTB) -@@ -103,9 +106,11 @@ struct cdc_ncm_ctx { - - spinlock_t mtx; - atomic_t stop; -+ int drvflags; - - u32 timer_interval; - u32 max_ndp_size; -+ struct usb_cdc_ncm_ndp16 *delayed_ndp16; - - u32 tx_timer_pending; - u32 tx_curr_frame_num; -@@ -133,7 +138,7 @@ struct cdc_ncm_ctx { - }; - - u8 cdc_ncm_select_altsetting(struct usb_interface *intf); --int cdc_ncm_bind_common(struct usbnet *dev, struct usb_interface *intf, u8 data_altsetting); -+int cdc_ncm_bind_common(struct usbnet *dev, struct usb_interface *intf, u8 data_altsetting, int drvflags); - void cdc_ncm_unbind(struct usbnet *dev, struct usb_interface *intf); - struct sk_buff *cdc_ncm_fill_tx_frame(struct usbnet *dev, struct sk_buff *skb, __le32 sign); - int cdc_ncm_rx_verify_nth16(struct cdc_ncm_ctx *ctx, struct sk_buff *skb_in); diff --git a/target/linux/generic/pending-3.18/192-USB-qcserial-Add-support-for-Quectel-EC20-Mini-PCIe-.patch b/target/linux/generic/pending-3.18/192-USB-qcserial-Add-support-for-Quectel-EC20-Mini-PCIe-.patch deleted file mode 100644 index 02133e4b5e..0000000000 --- a/target/linux/generic/pending-3.18/192-USB-qcserial-Add-support-for-Quectel-EC20-Mini-PCIe-.patch +++ /dev/null @@ -1,114 +0,0 @@ -From 128524b9db3e4f4245226852bee771bd03db75be Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Petr=20=C5=A0tetiar?= -Date: Tue, 3 Nov 2015 11:01:42 +0100 -Subject: [PATCH 1/2] USB: qcserial: Add support for Quectel EC20 Mini PCIe - module -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -It seems like this device has same vendor and product IDs as G2K -devices, but it has different number of interfaces(4 vs 5) and also -different interface layout which makes it currently unusable: - - usbcore: registered new interface driver qcserial - usbserial: USB Serial support registered for Qualcomm USB modem - usb 2-1.2: unknown number of interfaces: 5 - -lsusb output: - - Bus 002 Device 003: ID 05c6:9215 Qualcomm, Inc. Acer Gobi 2000 Wireless - Device Descriptor: - bLength 18 - bDescriptorType 1 - bcdUSB 2.00 - bDeviceClass 0 (Defined at Interface level) - bDeviceSubClass 0 - bDeviceProtocol 0 - bMaxPacketSize0 64 - idVendor 0x05c6 Qualcomm, Inc. - idProduct 0x9215 Acer Gobi 2000 Wireless Modem - bcdDevice 2.32 - iManufacturer 1 Quectel - iProduct 2 Quectel LTE Module - iSerial 0 - bNumConfigurations 1 - Configuration Descriptor: - bLength 9 - bDescriptorType 2 - wTotalLength 209 - bNumInterfaces 5 - bConfigurationValue 1 - iConfiguration 0 - bmAttributes 0xa0 - (Bus Powered) - Remote Wakeup - MaxPower 500mA - -Signed-off-by: Petr Å tetiar ---- - drivers/usb/serial/qcserial.c | 39 +++++++++++++++++++++++++++++++++++++++ - 1 file changed, 39 insertions(+) - ---- a/drivers/usb/serial/qcserial.c -+++ b/drivers/usb/serial/qcserial.c -@@ -22,6 +22,8 @@ - #define DRIVER_AUTHOR "Qualcomm Inc" - #define DRIVER_DESC "Qualcomm USB Serial driver" - -+#define QUECTEL_EC20_IDPRODUCT 0x9215 -+ - /* standard device layouts supported by this driver */ - enum qcserial_layouts { - QCSERIAL_G2K = 0, /* Gobi 2000 */ -@@ -181,6 +183,38 @@ static const struct usb_device_id id_tab - }; - MODULE_DEVICE_TABLE(usb, id_table); - -+static int handle_quectel_ec20(struct device *dev, int ifnum) -+{ -+ int altsetting = 0; -+ -+ /* -+ * Quectel EC20 Mini PCIe LTE module layout: -+ * 0: DM/DIAG (use libqcdm from ModemManager for communication) -+ * 1: NMEA -+ * 2: AT-capable modem port -+ * 3: Modem interface -+ * 4: NDIS -+ */ -+ switch (ifnum) { -+ case 0: -+ dev_dbg(dev, "Quectel EC20 DM/DIAG interface found\n"); -+ break; -+ case 1: -+ dev_dbg(dev, "Quectel EC20 NMEA GPS interface found\n"); -+ break; -+ case 2: -+ case 3: -+ dev_dbg(dev, "Quectel EC20 Modem port found\n"); -+ break; -+ case 4: -+ /* Don't claim the QMI/net interface */ -+ altsetting = -1; -+ break; -+ } -+ -+ return altsetting; -+} -+ - static int qcprobe(struct usb_serial *serial, const struct usb_device_id *id) - { - struct usb_host_interface *intf = serial->interface->cur_altsetting; -@@ -253,6 +287,11 @@ static int qcprobe(struct usb_serial *se - altsetting = -1; - break; - case QCSERIAL_G2K: -+ if (nintf == 5 && id->idProduct == QUECTEL_EC20_IDPRODUCT) { -+ altsetting = handle_quectel_ec20(dev, ifnum); -+ goto done; -+ } -+ - /* - * Gobi 2K+ USB layout: - * 0: QMI/net diff --git a/target/linux/generic/pending-3.18/193-USB-qmi_wwan-Add-quirk-for-Quectel-EC20-Mini-PCIe-mo.patch b/target/linux/generic/pending-3.18/193-USB-qmi_wwan-Add-quirk-for-Quectel-EC20-Mini-PCIe-mo.patch deleted file mode 100644 index ae3533db19..0000000000 --- a/target/linux/generic/pending-3.18/193-USB-qmi_wwan-Add-quirk-for-Quectel-EC20-Mini-PCIe-mo.patch +++ /dev/null @@ -1,91 +0,0 @@ -From fe29727caa7fe434fcb3166df2a62672bc516b54 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Petr=20=C5=A0tetiar?= -Date: Wed, 4 Nov 2015 16:23:37 +0100 -Subject: [PATCH 2/2] USB: qmi_wwan: Add quirk for Quectel EC20 Mini PCIe - module -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -This device has same vendor and product IDs as G2K devices, but it has -different number of interfaces(4 vs 5) and also different interface -layout where EC20 has QMI on interface 4 instead of 0. - -lsusb output: - - Bus 002 Device 003: ID 05c6:9215 Qualcomm, Inc. Acer Gobi 2000 - Device Descriptor: - bLength 18 - bDescriptorType 1 - bcdUSB 2.00 - bDeviceClass 0 (Defined at Interface level) - bDeviceSubClass 0 - bDeviceProtocol 0 - bMaxPacketSize0 64 - idVendor 0x05c6 Qualcomm, Inc. - idProduct 0x9215 Acer Gobi 2000 Wireless Modem - bcdDevice 2.32 - iManufacturer 1 Quectel - iProduct 2 Quectel LTE Module - iSerial 0 - bNumConfigurations 1 - Configuration Descriptor: - bLength 9 - bDescriptorType 2 - wTotalLength 209 - bNumInterfaces 5 - bConfigurationValue 1 - iConfiguration 0 - bmAttributes 0xa0 - (Bus Powered) - Remote Wakeup - MaxPower 500mA - -Signed-off-by: Petr Å tetiar ---- - drivers/net/usb/qmi_wwan.c | 21 +++++++++++++++++++++ - 1 file changed, 21 insertions(+) - ---- a/drivers/net/usb/qmi_wwan.c -+++ b/drivers/net/usb/qmi_wwan.c -@@ -836,6 +836,7 @@ static const struct usb_device_id produc - {QMI_GOBI_DEVICE(0x05c6, 0x9245)}, /* Samsung Gobi 2000 Modem device (VL176) */ - {QMI_GOBI_DEVICE(0x03f0, 0x251d)}, /* HP Gobi 2000 Modem device (VP412) */ - {QMI_GOBI_DEVICE(0x05c6, 0x9215)}, /* Acer Gobi 2000 Modem device (VP413) */ -+ {QMI_FIXED_INTF(0x05c6, 0x9215, 4)}, /* Quectel EC20 Mini PCIe */ - {QMI_GOBI_DEVICE(0x05c6, 0x9265)}, /* Asus Gobi 2000 Modem device (VR305) */ - {QMI_GOBI_DEVICE(0x05c6, 0x9235)}, /* Top Global Gobi 2000 Modem device (VR306) */ - {QMI_GOBI_DEVICE(0x05c6, 0x9275)}, /* iRex Technologies Gobi 2000 Modem device (VR307) */ -@@ -867,6 +868,19 @@ static const struct usb_device_id produc - }; - MODULE_DEVICE_TABLE(usb, products); - -+static bool quectel_ec20_detected(struct usb_interface *intf) -+{ -+ struct usb_device *dev = interface_to_usbdev(intf); -+ -+ if (dev->actconfig && -+ le16_to_cpu(dev->descriptor.idVendor) == 0x05c6 && -+ le16_to_cpu(dev->descriptor.idProduct) == 0x9215 && -+ dev->actconfig->desc.bNumInterfaces == 5) -+ return true; -+ -+ return false; -+} -+ - static int qmi_wwan_probe(struct usb_interface *intf, - const struct usb_device_id *prod) - { -@@ -895,6 +909,12 @@ static int qmi_wwan_probe(struct usb_int - return -ENODEV; - } - -+ /* Quectel EC20 quirk where we've QMI on interface 4 instead of 0 */ -+ if (quectel_ec20_detected(intf) && desc->bInterfaceNumber == 0) { -+ dev_dbg(&intf->dev, "Quectel EC20 quirk, skipping interface 0\n"); -+ return -ENODEV; -+ } -+ - return usbnet_probe(intf, id); - } - diff --git a/target/linux/generic/pending-3.18/200-fix_localversion.patch b/target/linux/generic/pending-3.18/200-fix_localversion.patch deleted file mode 100644 index 70228bb5f4..0000000000 --- a/target/linux/generic/pending-3.18/200-fix_localversion.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/scripts/setlocalversion -+++ b/scripts/setlocalversion -@@ -165,7 +165,7 @@ else - # annotated or signed tagged state (as git describe only - # looks at signed or annotated tags - git tag -a/-s) and - # LOCALVERSION= is not specified -- if test "${LOCALVERSION+set}" != "set"; then -+ if test "${CONFIG_LOCALVERSION+set}" != "set"; then - scm=$(scm_version --short) - res="$res${scm:++}" - fi diff --git a/target/linux/generic/pending-3.18/201-extra_optimization.patch b/target/linux/generic/pending-3.18/201-extra_optimization.patch deleted file mode 100644 index 5a2396cfa3..0000000000 --- a/target/linux/generic/pending-3.18/201-extra_optimization.patch +++ /dev/null @@ -1,14 +0,0 @@ ---- a/Makefile -+++ b/Makefile -@@ -618,9 +618,9 @@ KBUILD_CFLAGS += $(call cc-option,-fno-P - KBUILD_AFLAGS += $(call cc-option,-fno-PIE) - - ifdef CONFIG_CC_OPTIMIZE_FOR_SIZE --KBUILD_CFLAGS += -Os $(call cc-disable-warning,maybe-uninitialized,) -+KBUILD_CFLAGS += -Os $(EXTRA_OPTIMIZATION) $(call cc-disable-warning,maybe-uninitialized,) - else --KBUILD_CFLAGS += -O2 -+KBUILD_CFLAGS += -O2 -fno-reorder-blocks -fno-tree-ch $(EXTRA_OPTIMIZATION) - endif - - # Tell gcc to never replace conditional load with a non-conditional one diff --git a/target/linux/generic/pending-3.18/202-reduce_module_size.patch b/target/linux/generic/pending-3.18/202-reduce_module_size.patch deleted file mode 100644 index 60ea5c2085..0000000000 --- a/target/linux/generic/pending-3.18/202-reduce_module_size.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/Makefile -+++ b/Makefile -@@ -408,7 +408,7 @@ KBUILD_CFLAGS_KERNEL := - KBUILD_AFLAGS := -D__ASSEMBLY__ - KBUILD_AFLAGS_MODULE := -DMODULE - KBUILD_CFLAGS_MODULE := -DMODULE --KBUILD_LDFLAGS_MODULE := -T $(srctree)/scripts/module-common.lds -+KBUILD_LDFLAGS_MODULE = -T $(srctree)/scripts/module-common.lds $(if $(CONFIG_PROFILING),,-s) - - # Read KERNELRELEASE from include/config/kernel.release (if it exists) - KERNELRELEASE = $(shell cat include/config/kernel.release 2> /dev/null) diff --git a/target/linux/generic/pending-3.18/203-kallsyms_uncompressed.patch b/target/linux/generic/pending-3.18/203-kallsyms_uncompressed.patch deleted file mode 100644 index b9d82207a0..0000000000 --- a/target/linux/generic/pending-3.18/203-kallsyms_uncompressed.patch +++ /dev/null @@ -1,108 +0,0 @@ ---- a/scripts/kallsyms.c -+++ b/scripts/kallsyms.c -@@ -58,6 +58,7 @@ static struct addr_range percpu_range = - static struct sym_entry *table; - static unsigned int table_size, table_cnt; - static int all_symbols = 0; -+static int uncompressed = 0; - static int absolute_percpu = 0; - static char symbol_prefix_char = '\0'; - static unsigned long long kernel_start_addr = 0; -@@ -392,6 +393,9 @@ static void write_src(void) - - free(markers); - -+ if (uncompressed) -+ return; -+ - output_label("kallsyms_token_table"); - off = 0; - for (i = 0; i < 256; i++) { -@@ -450,6 +454,9 @@ static void *find_token(unsigned char *s - { - int i; - -+ if (uncompressed) -+ return NULL; -+ - for (i = 0; i < len - 1; i++) { - if (str[i] == token[0] && str[i+1] == token[1]) - return &str[i]; -@@ -522,6 +529,9 @@ static void optimize_result(void) - { - int i, best; - -+ if (uncompressed) -+ return; -+ - /* using the '\0' symbol last allows compress_symbols to use standard - * fast string functions */ - for (i = 255; i >= 0; i--) { -@@ -692,7 +702,9 @@ int main(int argc, char **argv) - } else if (strncmp(argv[i], "--page-offset=", 14) == 0) { - const char *p = &argv[i][14]; - kernel_start_addr = strtoull(p, NULL, 16); -- } else -+ } else if (strcmp(argv[i], "--uncompressed") == 0) -+ uncompressed = 1; -+ else - usage(); - } - } else if (argc != 1) ---- a/init/Kconfig -+++ b/init/Kconfig -@@ -1338,6 +1338,17 @@ config SYSCTL_ARCH_UNALIGN_ALLOW - the unaligned access emulation. - see arch/parisc/kernel/unaligned.c for reference - -+config KALLSYMS_UNCOMPRESSED -+ bool "Keep kallsyms uncompressed" -+ depends on KALLSYMS -+ help -+ Normally kallsyms contains compressed symbols (using a token table), -+ reducing the uncompressed kernel image size. Keeping the symbol table -+ uncompressed significantly improves the size of this part in compressed -+ kernel images. -+ -+ Say N unless you need compressed kernel images to be small. -+ - config HAVE_PCSPKR_PLATFORM - bool - ---- a/scripts/link-vmlinux.sh -+++ b/scripts/link-vmlinux.sh -@@ -90,6 +90,10 @@ kallsyms() - kallsymopt="${kallsymopt} --absolute-percpu" - fi - -+ if [ -n "${CONFIG_KALLSYMS_UNCOMPRESSED}" ]; then -+ kallsymopt="${kallsymopt} --uncompressed" -+ fi -+ - local aflags="${KBUILD_AFLAGS} ${KBUILD_AFLAGS_KERNEL} \ - ${NOSTDINC_FLAGS} ${LINUXINCLUDE} ${KBUILD_CPPFLAGS}" - ---- a/kernel/kallsyms.c -+++ b/kernel/kallsyms.c -@@ -109,6 +109,11 @@ static unsigned int kallsyms_expand_symb - * For every byte on the compressed symbol data, copy the table - * entry for that byte. - */ -+#ifdef CONFIG_KALLSYMS_UNCOMPRESSED -+ memcpy(result, data + 1, len - 1); -+ result += len - 1; -+ len = 0; -+#endif - while (len) { - tptr = &kallsyms_token_table[kallsyms_token_index[*data]]; - data++; -@@ -141,6 +146,9 @@ tail: - */ - static char kallsyms_get_symbol_type(unsigned int off) - { -+#ifdef CONFIG_KALLSYMS_UNCOMPRESSED -+ return kallsyms_names[off + 1]; -+#endif - /* - * Get just the first code, look it up in the token table, - * and return the first char from this token. diff --git a/target/linux/generic/pending-3.18/204-module_strip.patch b/target/linux/generic/pending-3.18/204-module_strip.patch deleted file mode 100644 index dcad148792..0000000000 --- a/target/linux/generic/pending-3.18/204-module_strip.patch +++ /dev/null @@ -1,190 +0,0 @@ -From: Felix Fietkau -Subject: [PATCH] build: add a hack for removing non-essential module info - -Signed-off-by: Felix Fietkau ---- ---- a/include/linux/module.h -+++ b/include/linux/module.h -@@ -84,6 +84,7 @@ void trim_init_extable(struct module *m) - - /* Generic info of form tag = "info" */ - #define MODULE_INFO(tag, info) __MODULE_INFO(tag, tag, info) -+#define MODULE_INFO_STRIP(tag, info) __MODULE_INFO_STRIP(tag, tag, info) - - /* For userspace: you can also call me... */ - #define MODULE_ALIAS(_alias) MODULE_INFO(alias, _alias) -@@ -127,12 +128,12 @@ void trim_init_extable(struct module *m) - * Author(s), use "Name " or just "Name", for multiple - * authors use multiple MODULE_AUTHOR() statements/lines. - */ --#define MODULE_AUTHOR(_author) MODULE_INFO(author, _author) -+#define MODULE_AUTHOR(_author) MODULE_INFO_STRIP(author, _author) - - /* What your module does. */ --#define MODULE_DESCRIPTION(_description) MODULE_INFO(description, _description) -+#define MODULE_DESCRIPTION(_description) MODULE_INFO_STRIP(description, _description) - --#ifdef MODULE -+#if defined(MODULE) && !defined(CONFIG_MODULE_STRIPPED) - /* Creates an alias so file2alias.c can find device table. */ - #define MODULE_DEVICE_TABLE(type, name) \ - extern const typeof(name) __mod_##type##__##name##_device_table \ -@@ -159,7 +160,9 @@ extern const typeof(name) __mod_##type## - */ - - #if defined(MODULE) || !defined(CONFIG_SYSFS) --#define MODULE_VERSION(_version) MODULE_INFO(version, _version) -+#define MODULE_VERSION(_version) MODULE_INFO_STRIP(version, _version) -+#elif defined(CONFIG_MODULE_STRIPPED) -+#define MODULE_VERSION(_version) __MODULE_INFO_DISABLED(version) - #else - #define MODULE_VERSION(_version) \ - static struct module_version_attribute ___modver_attr = { \ -@@ -181,7 +184,7 @@ extern const typeof(name) __mod_##type## - /* Optional firmware file (or files) needed by the module - * format is simply firmware file name. Multiple firmware - * files require multiple MODULE_FIRMWARE() specifiers */ --#define MODULE_FIRMWARE(_firmware) MODULE_INFO(firmware, _firmware) -+#define MODULE_FIRMWARE(_firmware) MODULE_INFO_STRIP(firmware, _firmware) - - /* Given an address, look for it in the exception tables */ - const struct exception_table_entry *search_exception_tables(unsigned long add); ---- a/include/linux/moduleparam.h -+++ b/include/linux/moduleparam.h -@@ -16,6 +16,16 @@ - /* Chosen so that structs with an unsigned long line up. */ - #define MAX_PARAM_PREFIX_LEN (64 - sizeof(unsigned long)) - -+/* This struct is here for syntactic coherency, it is not used */ -+#define __MODULE_INFO_DISABLED(name) \ -+ struct __UNIQUE_ID(name) {} -+ -+#ifdef CONFIG_MODULE_STRIPPED -+#define __MODULE_INFO_STRIP(tag, name, info) __MODULE_INFO_DISABLED(name) -+#else -+#define __MODULE_INFO_STRIP(tag, name, info) __MODULE_INFO(tag, name, info) -+#endif -+ - #ifdef MODULE - #define __MODULE_INFO(tag, name, info) \ - static const char __UNIQUE_ID(name)[] \ -@@ -23,8 +33,7 @@ static const char __UNIQUE_ID(name)[] - = __stringify(tag) "=" info - #else /* !MODULE */ - /* This struct is here for syntactic coherency, it is not used */ --#define __MODULE_INFO(tag, name, info) \ -- struct __UNIQUE_ID(name) {} -+#define __MODULE_INFO(tag, name, info) __MODULE_INFO_DISABLED(name) - #endif - #define __MODULE_PARM_TYPE(name, _type) \ - __MODULE_INFO(parmtype, name##type, #name ":" _type) -@@ -32,7 +41,7 @@ static const char __UNIQUE_ID(name)[] - /* One for each parameter, describing how to use it. Some files do - multiple of these per line, so can't just use MODULE_INFO. */ - #define MODULE_PARM_DESC(_parm, desc) \ -- __MODULE_INFO(parm, _parm, #_parm ":" desc) -+ __MODULE_INFO_STRIP(parm, _parm, #_parm ":" desc) - - struct kernel_param; - ---- a/init/Kconfig -+++ b/init/Kconfig -@@ -1987,6 +1987,13 @@ config MODULE_COMPRESS_XZ - - endchoice - -+config MODULE_STRIPPED -+ bool "Reduce module size" -+ depends on MODULES -+ help -+ Remove module parameter descriptions, author info, version, aliases, -+ device tables, etc. -+ - endif # MODULES - - config INIT_ALL_POSSIBLE ---- a/kernel/module.c -+++ b/kernel/module.c -@@ -2699,6 +2699,7 @@ static struct module *setup_load_info(st - - static int check_modinfo(struct module *mod, struct load_info *info, int flags) - { -+#ifndef CONFIG_MODULE_STRIPPED - const char *modmagic = get_modinfo(info, "vermagic"); - int err; - -@@ -2724,6 +2725,7 @@ static int check_modinfo(struct module * - pr_warn("%s: module is from the staging directory, the quality " - "is unknown, you have been warned.\n", mod->name); - } -+#endif - - /* Set up license info based on the info section */ - set_license(mod, get_modinfo(info, "license")); ---- a/scripts/mod/modpost.c -+++ b/scripts/mod/modpost.c -@@ -1760,7 +1760,9 @@ static void read_symbols(char *modname) - symname = remove_dot(info.strtab + sym->st_name); - - handle_modversions(mod, &info, sym, symname); -+#ifndef CONFIG_MODULE_STRIPPED - handle_moddevtable(mod, &info, sym, symname); -+#endif - } - if (!is_vmlinux(modname) || - (is_vmlinux(modname) && vmlinux_section_warnings)) -@@ -1904,7 +1906,9 @@ static void add_header(struct buffer *b, - buf_printf(b, "#include \n"); - buf_printf(b, "#include \n"); - buf_printf(b, "\n"); -+#ifndef CONFIG_MODULE_STRIPPED - buf_printf(b, "MODULE_INFO(vermagic, VERMAGIC_STRING);\n"); -+#endif - buf_printf(b, "\n"); - buf_printf(b, "__visible struct module __this_module\n"); - buf_printf(b, "__attribute__((section(\".gnu.linkonce.this_module\"))) = {\n"); -@@ -1921,16 +1925,20 @@ static void add_header(struct buffer *b, - - static void add_intree_flag(struct buffer *b, int is_intree) - { -+#ifndef CONFIG_MODULE_STRIPPED - if (is_intree) - buf_printf(b, "\nMODULE_INFO(intree, \"Y\");\n"); -+#endif - } - - static void add_staging_flag(struct buffer *b, const char *name) - { -+#ifndef CONFIG_MODULE_STRIPPED - static const char *staging_dir = "drivers/staging"; - - if (strncmp(staging_dir, name, strlen(staging_dir)) == 0) - buf_printf(b, "\nMODULE_INFO(staging, \"Y\");\n"); -+#endif - } - - /** -@@ -2023,11 +2031,13 @@ static void add_depends(struct buffer *b - - static void add_srcversion(struct buffer *b, struct module *mod) - { -+#ifndef CONFIG_MODULE_STRIPPED - if (mod->srcversion[0]) { - buf_printf(b, "\n"); - buf_printf(b, "MODULE_INFO(srcversion, \"%s\");\n", - mod->srcversion); - } -+#endif - } - - static void write_if_changed(struct buffer *b, const char *fname) -@@ -2258,7 +2268,9 @@ int main(int argc, char **argv) - add_staging_flag(&buf, mod->name); - err |= add_versions(&buf, mod); - add_depends(&buf, mod, modules); -+#ifndef CONFIG_MODULE_STRIPPED - add_moddevtable(&buf, mod); -+#endif - add_srcversion(&buf, mod); - - sprintf(fname, "%s.mod.c", mod->name); diff --git a/target/linux/generic/pending-3.18/205-backtrace_module_info.patch b/target/linux/generic/pending-3.18/205-backtrace_module_info.patch deleted file mode 100644 index f83b21ebc8..0000000000 --- a/target/linux/generic/pending-3.18/205-backtrace_module_info.patch +++ /dev/null @@ -1,36 +0,0 @@ ---- a/lib/vsprintf.c -+++ b/lib/vsprintf.c -@@ -614,8 +614,10 @@ char *symbol_string(char *buf, char *end - struct printf_spec spec, const char *fmt) - { - unsigned long value; --#ifdef CONFIG_KALLSYMS - char sym[KSYM_SYMBOL_LEN]; -+#ifndef CONFIG_KALLSYMS -+ struct module *mod; -+ int len; - #endif - - if (fmt[1] == 'R') -@@ -629,15 +631,15 @@ char *symbol_string(char *buf, char *end - sprint_symbol(sym, value); - else - sprint_symbol_no_offset(sym, value); -- -- return string(buf, end, sym, spec); - #else -- spec.field_width = 2 * sizeof(void *); -- spec.flags |= SPECIAL | SMALL | ZEROPAD; -- spec.base = 16; -+ len = snprintf(sym, sizeof(sym), "0x%lx", value); - -- return number(buf, end, value, spec); -+ mod = __module_address(value); -+ if (mod) -+ snprintf(sym + len, sizeof(sym) - len, " [%s@%p+0x%x]", -+ mod->name, mod->module_core, mod->core_size); - #endif -+ return string(buf, end, sym, spec); - } - - static noinline_for_stack diff --git a/target/linux/generic/pending-3.18/210-darwin_scripts_include.patch b/target/linux/generic/pending-3.18/210-darwin_scripts_include.patch deleted file mode 100644 index dc554de247..0000000000 --- a/target/linux/generic/pending-3.18/210-darwin_scripts_include.patch +++ /dev/null @@ -1,3088 +0,0 @@ ---- a/scripts/kallsyms.c -+++ b/scripts/kallsyms.c -@@ -22,6 +22,35 @@ - #include - #include - #include -+#ifdef __APPLE__ -+/* Darwin has no memmem implementation, this one is ripped of the uClibc-0.9.28 source */ -+void *memmem (const void *haystack, size_t haystack_len, -+ const void *needle, size_t needle_len) -+{ -+ const char *begin; -+ const char *const last_possible -+ = (const char *) haystack + haystack_len - needle_len; -+ -+ if (needle_len == 0) -+ /* The first occurrence of the empty string is deemed to occur at -+ the beginning of the string. */ -+ return (void *) haystack; -+ -+ /* Sanity check, otherwise the loop might search through the whole -+ memory. */ -+ if (__builtin_expect (haystack_len < needle_len, 0)) -+ return NULL; -+ -+ for (begin = (const char *) haystack; begin <= last_possible; ++begin) -+ if (begin[0] == ((const char *) needle)[0] && -+ !memcmp ((const void *) &begin[1], -+ (const void *) ((const char *) needle + 1), -+ needle_len - 1)) -+ return (void *) begin; -+ -+ return NULL; -+} -+#endif - - #ifndef ARRAY_SIZE - #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof(arr[0])) ---- a/scripts/kconfig/Makefile -+++ b/scripts/kconfig/Makefile -@@ -151,6 +151,9 @@ check-lxdialog := $(srctree)/$(src)/lxd - # we really need to do so. (Do not call gcc as part of make mrproper) - HOST_EXTRACFLAGS += $(shell $(CONFIG_SHELL) $(check-lxdialog) -ccflags) \ - -DLOCALE -+ifeq ($(shell uname -s),Darwin) -+HOST_LOADLIBES += -lncurses -+endif - - # =========================================================================== - # Shared Makefile for the various kconfig executables: ---- a/scripts/mod/mk_elfconfig.c -+++ b/scripts/mod/mk_elfconfig.c -@@ -1,7 +1,11 @@ - #include - #include - #include -+#ifndef __APPLE__ - #include -+#else -+#include "elf.h" -+#endif - - int - main(int argc, char **argv) ---- a/scripts/mod/modpost.h -+++ b/scripts/mod/modpost.h -@@ -7,7 +7,11 @@ - #include - #include - #include -+#if !(defined(__APPLE__) || defined(__CYGWIN__)) - #include -+#else -+#include "elf.h" -+#endif - - #include "elfconfig.h" - ---- /dev/null -+++ b/scripts/mod/elf.h -@@ -0,0 +1,3007 @@ -+/* This file defines standard ELF types, structures, and macros. -+ Copyright (C) 1995-2012 Free Software Foundation, Inc. -+ This file is part of the GNU C Library. -+ -+ The GNU C Library 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. -+ -+ The GNU C Library is distributed in the hope that 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 the GNU C Library; if not, see -+ . */ -+ -+#ifndef _ELF_H -+#define _ELF_H 1 -+ -+/* Standard ELF types. */ -+ -+#include -+ -+/* Type for a 16-bit quantity. */ -+typedef uint16_t Elf32_Half; -+typedef uint16_t Elf64_Half; -+ -+/* Types for signed and unsigned 32-bit quantities. */ -+typedef uint32_t Elf32_Word; -+typedef int32_t Elf32_Sword; -+typedef uint32_t Elf64_Word; -+typedef int32_t Elf64_Sword; -+ -+/* Types for signed and unsigned 64-bit quantities. */ -+typedef uint64_t Elf32_Xword; -+typedef int64_t Elf32_Sxword; -+typedef uint64_t Elf64_Xword; -+typedef int64_t Elf64_Sxword; -+ -+/* Type of addresses. */ -+typedef uint32_t Elf32_Addr; -+typedef uint64_t Elf64_Addr; -+ -+/* Type of file offsets. */ -+typedef uint32_t Elf32_Off; -+typedef uint64_t Elf64_Off; -+ -+/* Type for section indices, which are 16-bit quantities. */ -+typedef uint16_t Elf32_Section; -+typedef uint16_t Elf64_Section; -+ -+/* Type for version symbol information. */ -+typedef Elf32_Half Elf32_Versym; -+typedef Elf64_Half Elf64_Versym; -+ -+ -+/* The ELF file header. This appears at the start of every ELF file. */ -+ -+#define EI_NIDENT (16) -+ -+typedef struct -+{ -+ unsigned char e_ident[EI_NIDENT]; /* Magic number and other info */ -+ Elf32_Half e_type; /* Object file type */ -+ Elf32_Half e_machine; /* Architecture */ -+ Elf32_Word e_version; /* Object file version */ -+ Elf32_Addr e_entry; /* Entry point virtual address */ -+ Elf32_Off e_phoff; /* Program header table file offset */ -+ Elf32_Off e_shoff; /* Section header table file offset */ -+ Elf32_Word e_flags; /* Processor-specific flags */ -+ Elf32_Half e_ehsize; /* ELF header size in bytes */ -+ Elf32_Half e_phentsize; /* Program header table entry size */ -+ Elf32_Half e_phnum; /* Program header table entry count */ -+ Elf32_Half e_shentsize; /* Section header table entry size */ -+ Elf32_Half e_shnum; /* Section header table entry count */ -+ Elf32_Half e_shstrndx; /* Section header string table index */ -+} Elf32_Ehdr; -+ -+typedef struct -+{ -+ unsigned char e_ident[EI_NIDENT]; /* Magic number and other info */ -+ Elf64_Half e_type; /* Object file type */ -+ Elf64_Half e_machine; /* Architecture */ -+ Elf64_Word e_version; /* Object file version */ -+ Elf64_Addr e_entry; /* Entry point virtual address */ -+ Elf64_Off e_phoff; /* Program header table file offset */ -+ Elf64_Off e_shoff; /* Section header table file offset */ -+ Elf64_Word e_flags; /* Processor-specific flags */ -+ Elf64_Half e_ehsize; /* ELF header size in bytes */ -+ Elf64_Half e_phentsize; /* Program header table entry size */ -+ Elf64_Half e_phnum; /* Program header table entry count */ -+ Elf64_Half e_shentsize; /* Section header table entry size */ -+ Elf64_Half e_shnum; /* Section header table entry count */ -+ Elf64_Half e_shstrndx; /* Section header string table index */ -+} Elf64_Ehdr; -+ -+/* Fields in the e_ident array. The EI_* macros are indices into the -+ array. The macros under each EI_* macro are the values the byte -+ may have. */ -+ -+#define EI_MAG0 0 /* File identification byte 0 index */ -+#define ELFMAG0 0x7f /* Magic number byte 0 */ -+ -+#define EI_MAG1 1 /* File identification byte 1 index */ -+#define ELFMAG1 'E' /* Magic number byte 1 */ -+ -+#define EI_MAG2 2 /* File identification byte 2 index */ -+#define ELFMAG2 'L' /* Magic number byte 2 */ -+ -+#define EI_MAG3 3 /* File identification byte 3 index */ -+#define ELFMAG3 'F' /* Magic number byte 3 */ -+ -+/* Conglomeration of the identification bytes, for easy testing as a word. */ -+#define ELFMAG "\177ELF" -+#define SELFMAG 4 -+ -+#define EI_CLASS 4 /* File class byte index */ -+#define ELFCLASSNONE 0 /* Invalid class */ -+#define ELFCLASS32 1 /* 32-bit objects */ -+#define ELFCLASS64 2 /* 64-bit objects */ -+#define ELFCLASSNUM 3 -+ -+#define EI_DATA 5 /* Data encoding byte index */ -+#define ELFDATANONE 0 /* Invalid data encoding */ -+#define ELFDATA2LSB 1 /* 2's complement, little endian */ -+#define ELFDATA2MSB 2 /* 2's complement, big endian */ -+#define ELFDATANUM 3 -+ -+#define EI_VERSION 6 /* File version byte index */ -+ /* Value must be EV_CURRENT */ -+ -+#define EI_OSABI 7 /* OS ABI identification */ -+#define ELFOSABI_NONE 0 /* UNIX System V ABI */ -+#define ELFOSABI_SYSV 0 /* Alias. */ -+#define ELFOSABI_HPUX 1 /* HP-UX */ -+#define ELFOSABI_NETBSD 2 /* NetBSD. */ -+#define ELFOSABI_GNU 3 /* Object uses GNU ELF extensions. */ -+#define ELFOSABI_LINUX ELFOSABI_GNU /* Compatibility alias. */ -+#define ELFOSABI_SOLARIS 6 /* Sun Solaris. */ -+#define ELFOSABI_AIX 7 /* IBM AIX. */ -+#define ELFOSABI_IRIX 8 /* SGI Irix. */ -+#define ELFOSABI_FREEBSD 9 /* FreeBSD. */ -+#define ELFOSABI_TRU64 10 /* Compaq TRU64 UNIX. */ -+#define ELFOSABI_MODESTO 11 /* Novell Modesto. */ -+#define ELFOSABI_OPENBSD 12 /* OpenBSD. */ -+#define ELFOSABI_ARM_AEABI 64 /* ARM EABI */ -+#define ELFOSABI_ARM 97 /* ARM */ -+#define ELFOSABI_STANDALONE 255 /* Standalone (embedded) application */ -+ -+#define EI_ABIVERSION 8 /* ABI version */ -+ -+#define EI_PAD 9 /* Byte index of padding bytes */ -+ -+/* Legal values for e_type (object file type). */ -+ -+#define ET_NONE 0 /* No file type */ -+#define ET_REL 1 /* Relocatable file */ -+#define ET_EXEC 2 /* Executable file */ -+#define ET_DYN 3 /* Shared object file */ -+#define ET_CORE 4 /* Core file */ -+#define ET_NUM 5 /* Number of defined types */ -+#define ET_LOOS 0xfe00 /* OS-specific range start */ -+#define ET_HIOS 0xfeff /* OS-specific range end */ -+#define ET_LOPROC 0xff00 /* Processor-specific range start */ -+#define ET_HIPROC 0xffff /* Processor-specific range end */ -+ -+/* Legal values for e_machine (architecture). */ -+ -+#define EM_NONE 0 /* No machine */ -+#define EM_M32 1 /* AT&T WE 32100 */ -+#define EM_SPARC 2 /* SUN SPARC */ -+#define EM_386 3 /* Intel 80386 */ -+#define EM_68K 4 /* Motorola m68k family */ -+#define EM_88K 5 /* Motorola m88k family */ -+#define EM_860 7 /* Intel 80860 */ -+#define EM_MIPS 8 /* MIPS R3000 big-endian */ -+#define EM_S370 9 /* IBM System/370 */ -+#define EM_MIPS_RS3_LE 10 /* MIPS R3000 little-endian */ -+ -+#define EM_PARISC 15 /* HPPA */ -+#define EM_VPP500 17 /* Fujitsu VPP500 */ -+#define EM_SPARC32PLUS 18 /* Sun's "v8plus" */ -+#define EM_960 19 /* Intel 80960 */ -+#define EM_PPC 20 /* PowerPC */ -+#define EM_PPC64 21 /* PowerPC 64-bit */ -+#define EM_S390 22 /* IBM S390 */ -+ -+#define EM_V800 36 /* NEC V800 series */ -+#define EM_FR20 37 /* Fujitsu FR20 */ -+#define EM_RH32 38 /* TRW RH-32 */ -+#define EM_RCE 39 /* Motorola RCE */ -+#define EM_ARM 40 /* ARM */ -+#define EM_FAKE_ALPHA 41 /* Digital Alpha */ -+#define EM_SH 42 /* Hitachi SH */ -+#define EM_SPARCV9 43 /* SPARC v9 64-bit */ -+#define EM_TRICORE 44 /* Siemens Tricore */ -+#define EM_ARC 45 /* Argonaut RISC Core */ -+#define EM_H8_300 46 /* Hitachi H8/300 */ -+#define EM_H8_300H 47 /* Hitachi H8/300H */ -+#define EM_H8S 48 /* Hitachi H8S */ -+#define EM_H8_500 49 /* Hitachi H8/500 */ -+#define EM_IA_64 50 /* Intel Merced */ -+#define EM_MIPS_X 51 /* Stanford MIPS-X */ -+#define EM_COLDFIRE 52 /* Motorola Coldfire */ -+#define EM_68HC12 53 /* Motorola M68HC12 */ -+#define EM_MMA 54 /* Fujitsu MMA Multimedia Accelerator*/ -+#define EM_PCP 55 /* Siemens PCP */ -+#define EM_NCPU 56 /* Sony nCPU embeeded RISC */ -+#define EM_NDR1 57 /* Denso NDR1 microprocessor */ -+#define EM_STARCORE 58 /* Motorola Start*Core processor */ -+#define EM_ME16 59 /* Toyota ME16 processor */ -+#define EM_ST100 60 /* STMicroelectronic ST100 processor */ -+#define EM_TINYJ 61 /* Advanced Logic Corp. Tinyj emb.fam*/ -+#define EM_X86_64 62 /* AMD x86-64 architecture */ -+#define EM_PDSP 63 /* Sony DSP Processor */ -+ -+#define EM_FX66 66 /* Siemens FX66 microcontroller */ -+#define EM_ST9PLUS 67 /* STMicroelectronics ST9+ 8/16 mc */ -+#define EM_ST7 68 /* STmicroelectronics ST7 8 bit mc */ -+#define EM_68HC16 69 /* Motorola MC68HC16 microcontroller */ -+#define EM_68HC11 70 /* Motorola MC68HC11 microcontroller */ -+#define EM_68HC08 71 /* Motorola MC68HC08 microcontroller */ -+#define EM_68HC05 72 /* Motorola MC68HC05 microcontroller */ -+#define EM_SVX 73 /* Silicon Graphics SVx */ -+#define EM_ST19 74 /* STMicroelectronics ST19 8 bit mc */ -+#define EM_VAX 75 /* Digital VAX */ -+#define EM_CRIS 76 /* Axis Communications 32-bit embedded processor */ -+#define EM_JAVELIN 77 /* Infineon Technologies 32-bit embedded processor */ -+#define EM_FIREPATH 78 /* Element 14 64-bit DSP Processor */ -+#define EM_ZSP 79 /* LSI Logic 16-bit DSP Processor */ -+#define EM_MMIX 80 /* Donald Knuth's educational 64-bit processor */ -+#define EM_HUANY 81 /* Harvard University machine-independent object files */ -+#define EM_PRISM 82 /* SiTera Prism */ -+#define EM_AVR 83 /* Atmel AVR 8-bit microcontroller */ -+#define EM_FR30 84 /* Fujitsu FR30 */ -+#define EM_D10V 85 /* Mitsubishi D10V */ -+#define EM_D30V 86 /* Mitsubishi D30V */ -+#define EM_V850 87 /* NEC v850 */ -+#define EM_M32R 88 /* Mitsubishi M32R */ -+#define EM_MN10300 89 /* Matsushita MN10300 */ -+#define EM_MN10200 90 /* Matsushita MN10200 */ -+#define EM_PJ 91 /* picoJava */ -+#define EM_OPENRISC 92 /* OpenRISC 32-bit embedded processor */ -+#define EM_ARC_A5 93 /* ARC Cores Tangent-A5 */ -+#define EM_XTENSA 94 /* Tensilica Xtensa Architecture */ -+#define EM_TILEPRO 188 /* Tilera TILEPro */ -+#define EM_TILEGX 191 /* Tilera TILE-Gx */ -+#define EM_NUM 192 -+ -+/* If it is necessary to assign new unofficial EM_* values, please -+ pick large random numbers (0x8523, 0xa7f2, etc.) to minimize the -+ chances of collision with official or non-GNU unofficial values. */ -+ -+#define EM_ALPHA 0x9026 -+ -+/* Legal values for e_version (version). */ -+ -+#define EV_NONE 0 /* Invalid ELF version */ -+#define EV_CURRENT 1 /* Current version */ -+#define EV_NUM 2 -+ -+/* Section header. */ -+ -+typedef struct -+{ -+ Elf32_Word sh_name; /* Section name (string tbl index) */ -+ Elf32_Word sh_type; /* Section type */ -+ Elf32_Word sh_flags; /* Section flags */ -+ Elf32_Addr sh_addr; /* Section virtual addr at execution */ -+ Elf32_Off sh_offset; /* Section file offset */ -+ Elf32_Word sh_size; /* Section size in bytes */ -+ Elf32_Word sh_link; /* Link to another section */ -+ Elf32_Word sh_info; /* Additional section information */ -+ Elf32_Word sh_addralign; /* Section alignment */ -+ Elf32_Word sh_entsize; /* Entry size if section holds table */ -+} Elf32_Shdr; -+ -+typedef struct -+{ -+ Elf64_Word sh_name; /* Section name (string tbl index) */ -+ Elf64_Word sh_type; /* Section type */ -+ Elf64_Xword sh_flags; /* Section flags */ -+ Elf64_Addr sh_addr; /* Section virtual addr at execution */ -+ Elf64_Off sh_offset; /* Section file offset */ -+ Elf64_Xword sh_size; /* Section size in bytes */ -+ Elf64_Word sh_link; /* Link to another section */ -+ Elf64_Word sh_info; /* Additional section information */ -+ Elf64_Xword sh_addralign; /* Section alignment */ -+ Elf64_Xword sh_entsize; /* Entry size if section holds table */ -+} Elf64_Shdr; -+ -+/* Special section indices. */ -+ -+#define SHN_UNDEF 0 /* Undefined section */ -+#define SHN_LORESERVE 0xff00 /* Start of reserved indices */ -+#define SHN_LOPROC 0xff00 /* Start of processor-specific */ -+#define SHN_BEFORE 0xff00 /* Order section before all others -+ (Solaris). */ -+#define SHN_AFTER 0xff01 /* Order section after all others -+ (Solaris). */ -+#define SHN_HIPROC 0xff1f /* End of processor-specific */ -+#define SHN_LOOS 0xff20 /* Start of OS-specific */ -+#define SHN_HIOS 0xff3f /* End of OS-specific */ -+#define SHN_ABS 0xfff1 /* Associated symbol is absolute */ -+#define SHN_COMMON 0xfff2 /* Associated symbol is common */ -+#define SHN_XINDEX 0xffff /* Index is in extra table. */ -+#define SHN_HIRESERVE 0xffff /* End of reserved indices */ -+ -+/* Legal values for sh_type (section type). */ -+ -+#define SHT_NULL 0 /* Section header table entry unused */ -+#define SHT_PROGBITS 1 /* Program data */ -+#define SHT_SYMTAB 2 /* Symbol table */ -+#define SHT_STRTAB 3 /* String table */ -+#define SHT_RELA 4 /* Relocation entries with addends */ -+#define SHT_HASH 5 /* Symbol hash table */ -+#define SHT_DYNAMIC 6 /* Dynamic linking information */ -+#define SHT_NOTE 7 /* Notes */ -+#define SHT_NOBITS 8 /* Program space with no data (bss) */ -+#define SHT_REL 9 /* Relocation entries, no addends */ -+#define SHT_SHLIB 10 /* Reserved */ -+#define SHT_DYNSYM 11 /* Dynamic linker symbol table */ -+#define SHT_INIT_ARRAY 14 /* Array of constructors */ -+#define SHT_FINI_ARRAY 15 /* Array of destructors */ -+#define SHT_PREINIT_ARRAY 16 /* Array of pre-constructors */ -+#define SHT_GROUP 17 /* Section group */ -+#define SHT_SYMTAB_SHNDX 18 /* Extended section indeces */ -+#define SHT_NUM 19 /* Number of defined types. */ -+#define SHT_LOOS 0x60000000 /* Start OS-specific. */ -+#define SHT_GNU_ATTRIBUTES 0x6ffffff5 /* Object attributes. */ -+#define SHT_GNU_HASH 0x6ffffff6 /* GNU-style hash table. */ -+#define SHT_GNU_LIBLIST 0x6ffffff7 /* Prelink library list */ -+#define SHT_CHECKSUM 0x6ffffff8 /* Checksum for DSO content. */ -+#define SHT_LOSUNW 0x6ffffffa /* Sun-specific low bound. */ -+#define SHT_SUNW_move 0x6ffffffa -+#define SHT_SUNW_COMDAT 0x6ffffffb -+#define SHT_SUNW_syminfo 0x6ffffffc -+#define SHT_GNU_verdef 0x6ffffffd /* Version definition section. */ -+#define SHT_GNU_verneed 0x6ffffffe /* Version needs section. */ -+#define SHT_GNU_versym 0x6fffffff /* Version symbol table. */ -+#define SHT_HISUNW 0x6fffffff /* Sun-specific high bound. */ -+#define SHT_HIOS 0x6fffffff /* End OS-specific type */ -+#define SHT_LOPROC 0x70000000 /* Start of processor-specific */ -+#define SHT_HIPROC 0x7fffffff /* End of processor-specific */ -+#define SHT_LOUSER 0x80000000 /* Start of application-specific */ -+#define SHT_HIUSER 0x8fffffff /* End of application-specific */ -+ -+/* Legal values for sh_flags (section flags). */ -+ -+#define SHF_WRITE (1 << 0) /* Writable */ -+#define SHF_ALLOC (1 << 1) /* Occupies memory during execution */ -+#define SHF_EXECINSTR (1 << 2) /* Executable */ -+#define SHF_MERGE (1 << 4) /* Might be merged */ -+#define SHF_STRINGS (1 << 5) /* Contains nul-terminated strings */ -+#define SHF_INFO_LINK (1 << 6) /* `sh_info' contains SHT index */ -+#define SHF_LINK_ORDER (1 << 7) /* Preserve order after combining */ -+#define SHF_OS_NONCONFORMING (1 << 8) /* Non-standard OS specific handling -+ required */ -+#define SHF_GROUP (1 << 9) /* Section is member of a group. */ -+#define SHF_TLS (1 << 10) /* Section hold thread-local data. */ -+#define SHF_MASKOS 0x0ff00000 /* OS-specific. */ -+#define SHF_MASKPROC 0xf0000000 /* Processor-specific */ -+#define SHF_ORDERED (1 << 30) /* Special ordering requirement -+ (Solaris). */ -+#define SHF_EXCLUDE (1 << 31) /* Section is excluded unless -+ referenced or allocated (Solaris).*/ -+ -+/* Section group handling. */ -+#define GRP_COMDAT 0x1 /* Mark group as COMDAT. */ -+ -+/* Symbol table entry. */ -+ -+typedef struct -+{ -+ Elf32_Word st_name; /* Symbol name (string tbl index) */ -+ Elf32_Addr st_value; /* Symbol value */ -+ Elf32_Word st_size; /* Symbol size */ -+ unsigned char st_info; /* Symbol type and binding */ -+ unsigned char st_other; /* Symbol visibility */ -+ Elf32_Section st_shndx; /* Section index */ -+} Elf32_Sym; -+ -+typedef struct -+{ -+ Elf64_Word st_name; /* Symbol name (string tbl index) */ -+ unsigned char st_info; /* Symbol type and binding */ -+ unsigned char st_other; /* Symbol visibility */ -+ Elf64_Section st_shndx; /* Section index */ -+ Elf64_Addr st_value; /* Symbol value */ -+ Elf64_Xword st_size; /* Symbol size */ -+} Elf64_Sym; -+ -+/* The syminfo section if available contains additional information about -+ every dynamic symbol. */ -+ -+typedef struct -+{ -+ Elf32_Half si_boundto; /* Direct bindings, symbol bound to */ -+ Elf32_Half si_flags; /* Per symbol flags */ -+} Elf32_Syminfo; -+ -+typedef struct -+{ -+ Elf64_Half si_boundto; /* Direct bindings, symbol bound to */ -+ Elf64_Half si_flags; /* Per symbol flags */ -+} Elf64_Syminfo; -+ -+/* Possible values for si_boundto. */ -+#define SYMINFO_BT_SELF 0xffff /* Symbol bound to self */ -+#define SYMINFO_BT_PARENT 0xfffe /* Symbol bound to parent */ -+#define SYMINFO_BT_LOWRESERVE 0xff00 /* Beginning of reserved entries */ -+ -+/* Possible bitmasks for si_flags. */ -+#define SYMINFO_FLG_DIRECT 0x0001 /* Direct bound symbol */ -+#define SYMINFO_FLG_PASSTHRU 0x0002 /* Pass-thru symbol for translator */ -+#define SYMINFO_FLG_COPY 0x0004 /* Symbol is a copy-reloc */ -+#define SYMINFO_FLG_LAZYLOAD 0x0008 /* Symbol bound to object to be lazy -+ loaded */ -+/* Syminfo version values. */ -+#define SYMINFO_NONE 0 -+#define SYMINFO_CURRENT 1 -+#define SYMINFO_NUM 2 -+ -+ -+/* How to extract and insert information held in the st_info field. */ -+ -+#define ELF32_ST_BIND(val) (((unsigned char) (val)) >> 4) -+#define ELF32_ST_TYPE(val) ((val) & 0xf) -+#define ELF32_ST_INFO(bind, type) (((bind) << 4) + ((type) & 0xf)) -+ -+/* Both Elf32_Sym and Elf64_Sym use the same one-byte st_info field. */ -+#define ELF64_ST_BIND(val) ELF32_ST_BIND (val) -+#define ELF64_ST_TYPE(val) ELF32_ST_TYPE (val) -+#define ELF64_ST_INFO(bind, type) ELF32_ST_INFO ((bind), (type)) -+ -+/* Legal values for ST_BIND subfield of st_info (symbol binding). */ -+ -+#define STB_LOCAL 0 /* Local symbol */ -+#define STB_GLOBAL 1 /* Global symbol */ -+#define STB_WEAK 2 /* Weak symbol */ -+#define STB_NUM 3 /* Number of defined types. */ -+#define STB_LOOS 10 /* Start of OS-specific */ -+#define STB_GNU_UNIQUE 10 /* Unique symbol. */ -+#define STB_HIOS 12 /* End of OS-specific */ -+#define STB_LOPROC 13 /* Start of processor-specific */ -+#define STB_HIPROC 15 /* End of processor-specific */ -+ -+/* Legal values for ST_TYPE subfield of st_info (symbol type). */ -+ -+#define STT_NOTYPE 0 /* Symbol type is unspecified */ -+#define STT_OBJECT 1 /* Symbol is a data object */ -+#define STT_FUNC 2 /* Symbol is a code object */ -+#define STT_SECTION 3 /* Symbol associated with a section */ -+#define STT_FILE 4 /* Symbol's name is file name */ -+#define STT_COMMON 5 /* Symbol is a common data object */ -+#define STT_TLS 6 /* Symbol is thread-local data object*/ -+#define STT_NUM 7 /* Number of defined types. */ -+#define STT_LOOS 10 /* Start of OS-specific */ -+#define STT_GNU_IFUNC 10 /* Symbol is indirect code object */ -+#define STT_HIOS 12 /* End of OS-specific */ -+#define STT_LOPROC 13 /* Start of processor-specific */ -+#define STT_HIPROC 15 /* End of processor-specific */ -+ -+ -+/* Symbol table indices are found in the hash buckets and chain table -+ of a symbol hash table section. This special index value indicates -+ the end of a chain, meaning no further symbols are found in that bucket. */ -+ -+#define STN_UNDEF 0 /* End of a chain. */ -+ -+ -+/* How to extract and insert information held in the st_other field. */ -+ -+#define ELF32_ST_VISIBILITY(o) ((o) & 0x03) -+ -+/* For ELF64 the definitions are the same. */ -+#define ELF64_ST_VISIBILITY(o) ELF32_ST_VISIBILITY (o) -+ -+/* Symbol visibility specification encoded in the st_other field. */ -+#define STV_DEFAULT 0 /* Default symbol visibility rules */ -+#define STV_INTERNAL 1 /* Processor specific hidden class */ -+#define STV_HIDDEN 2 /* Sym unavailable in other modules */ -+#define STV_PROTECTED 3 /* Not preemptible, not exported */ -+ -+ -+/* Relocation table entry without addend (in section of type SHT_REL). */ -+ -+typedef struct -+{ -+ Elf32_Addr r_offset; /* Address */ -+ Elf32_Word r_info; /* Relocation type and symbol index */ -+} Elf32_Rel; -+ -+/* I have seen two different definitions of the Elf64_Rel and -+ Elf64_Rela structures, so we'll leave them out until Novell (or -+ whoever) gets their act together. */ -+/* The following, at least, is used on Sparc v9, MIPS, and Alpha. */ -+ -+typedef struct -+{ -+ Elf64_Addr r_offset; /* Address */ -+ Elf64_Xword r_info; /* Relocation type and symbol index */ -+} Elf64_Rel; -+ -+/* Relocation table entry with addend (in section of type SHT_RELA). */ -+ -+typedef struct -+{ -+ Elf32_Addr r_offset; /* Address */ -+ Elf32_Word r_info; /* Relocation type and symbol index */ -+ Elf32_Sword r_addend; /* Addend */ -+} Elf32_Rela; -+ -+typedef struct -+{ -+ Elf64_Addr r_offset; /* Address */ -+ Elf64_Xword r_info; /* Relocation type and symbol index */ -+ Elf64_Sxword r_addend; /* Addend */ -+} Elf64_Rela; -+ -+/* How to extract and insert information held in the r_info field. */ -+ -+#define ELF32_R_SYM(val) ((val) >> 8) -+#define ELF32_R_TYPE(val) ((val) & 0xff) -+#define ELF32_R_INFO(sym, type) (((sym) << 8) + ((type) & 0xff)) -+ -+#define ELF64_R_SYM(i) ((i) >> 32) -+#define ELF64_R_TYPE(i) ((i) & 0xffffffff) -+#define ELF64_R_INFO(sym,type) ((((Elf64_Xword) (sym)) << 32) + (type)) -+ -+/* Program segment header. */ -+ -+typedef struct -+{ -+ Elf32_Word p_type; /* Segment type */ -+ Elf32_Off p_offset; /* Segment file offset */ -+ Elf32_Addr p_vaddr; /* Segment virtual address */ -+ Elf32_Addr p_paddr; /* Segment physical address */ -+ Elf32_Word p_filesz; /* Segment size in file */ -+ Elf32_Word p_memsz; /* Segment size in memory */ -+ Elf32_Word p_flags; /* Segment flags */ -+ Elf32_Word p_align; /* Segment alignment */ -+} Elf32_Phdr; -+ -+typedef struct -+{ -+ Elf64_Word p_type; /* Segment type */ -+ Elf64_Word p_flags; /* Segment flags */ -+ Elf64_Off p_offset; /* Segment file offset */ -+ Elf64_Addr p_vaddr; /* Segment virtual address */ -+ Elf64_Addr p_paddr; /* Segment physical address */ -+ Elf64_Xword p_filesz; /* Segment size in file */ -+ Elf64_Xword p_memsz; /* Segment size in memory */ -+ Elf64_Xword p_align; /* Segment alignment */ -+} Elf64_Phdr; -+ -+/* Special value for e_phnum. This indicates that the real number of -+ program headers is too large to fit into e_phnum. Instead the real -+ value is in the field sh_info of section 0. */ -+ -+#define PN_XNUM 0xffff -+ -+/* Legal values for p_type (segment type). */ -+ -+#define PT_NULL 0 /* Program header table entry unused */ -+#define PT_LOAD 1 /* Loadable program segment */ -+#define PT_DYNAMIC 2 /* Dynamic linking information */ -+#define PT_INTERP 3 /* Program interpreter */ -+#define PT_NOTE 4 /* Auxiliary information */ -+#define PT_SHLIB 5 /* Reserved */ -+#define PT_PHDR 6 /* Entry for header table itself */ -+#define PT_TLS 7 /* Thread-local storage segment */ -+#define PT_NUM 8 /* Number of defined types */ -+#define PT_LOOS 0x60000000 /* Start of OS-specific */ -+#define PT_GNU_EH_FRAME 0x6474e550 /* GCC .eh_frame_hdr segment */ -+#define PT_GNU_STACK 0x6474e551 /* Indicates stack executability */ -+#define PT_GNU_RELRO 0x6474e552 /* Read-only after relocation */ -+#define PT_LOSUNW 0x6ffffffa -+#define PT_SUNWBSS 0x6ffffffa /* Sun Specific segment */ -+#define PT_SUNWSTACK 0x6ffffffb /* Stack segment */ -+#define PT_HISUNW 0x6fffffff -+#define PT_HIOS 0x6fffffff /* End of OS-specific */ -+#define PT_LOPROC 0x70000000 /* Start of processor-specific */ -+#define PT_HIPROC 0x7fffffff /* End of processor-specific */ -+ -+/* Legal values for p_flags (segment flags). */ -+ -+#define PF_X (1 << 0) /* Segment is executable */ -+#define PF_W (1 << 1) /* Segment is writable */ -+#define PF_R (1 << 2) /* Segment is readable */ -+#define PF_MASKOS 0x0ff00000 /* OS-specific */ -+#define PF_MASKPROC 0xf0000000 /* Processor-specific */ -+ -+/* Legal values for note segment descriptor types for core files. */ -+ -+#define NT_PRSTATUS 1 /* Contains copy of prstatus struct */ -+#define NT_FPREGSET 2 /* Contains copy of fpregset struct */ -+#define NT_PRPSINFO 3 /* Contains copy of prpsinfo struct */ -+#define NT_PRXREG 4 /* Contains copy of prxregset struct */ -+#define NT_TASKSTRUCT 4 /* Contains copy of task structure */ -+#define NT_PLATFORM 5 /* String from sysinfo(SI_PLATFORM) */ -+#define NT_AUXV 6 /* Contains copy of auxv array */ -+#define NT_GWINDOWS 7 /* Contains copy of gwindows struct */ -+#define NT_ASRS 8 /* Contains copy of asrset struct */ -+#define NT_PSTATUS 10 /* Contains copy of pstatus struct */ -+#define NT_PSINFO 13 /* Contains copy of psinfo struct */ -+#define NT_PRCRED 14 /* Contains copy of prcred struct */ -+#define NT_UTSNAME 15 /* Contains copy of utsname struct */ -+#define NT_LWPSTATUS 16 /* Contains copy of lwpstatus struct */ -+#define NT_LWPSINFO 17 /* Contains copy of lwpinfo struct */ -+#define NT_PRFPXREG 20 /* Contains copy of fprxregset struct */ -+#define NT_PRXFPREG 0x46e62b7f /* Contains copy of user_fxsr_struct */ -+#define NT_PPC_VMX 0x100 /* PowerPC Altivec/VMX registers */ -+#define NT_PPC_SPE 0x101 /* PowerPC SPE/EVR registers */ -+#define NT_PPC_VSX 0x102 /* PowerPC VSX registers */ -+#define NT_386_TLS 0x200 /* i386 TLS slots (struct user_desc) */ -+#define NT_386_IOPERM 0x201 /* x86 io permission bitmap (1=deny) */ -+#define NT_X86_XSTATE 0x202 /* x86 extended state using xsave */ -+ -+/* Legal values for the note segment descriptor types for object files. */ -+ -+#define NT_VERSION 1 /* Contains a version string. */ -+ -+ -+/* Dynamic section entry. */ -+ -+typedef struct -+{ -+ Elf32_Sword d_tag; /* Dynamic entry type */ -+ union -+ { -+ Elf32_Word d_val; /* Integer value */ -+ Elf32_Addr d_ptr; /* Address value */ -+ } d_un; -+} Elf32_Dyn; -+ -+typedef struct -+{ -+ Elf64_Sxword d_tag; /* Dynamic entry type */ -+ union -+ { -+ Elf64_Xword d_val; /* Integer value */ -+ Elf64_Addr d_ptr; /* Address value */ -+ } d_un; -+} Elf64_Dyn; -+ -+/* Legal values for d_tag (dynamic entry type). */ -+ -+#define DT_NULL 0 /* Marks end of dynamic section */ -+#define DT_NEEDED 1 /* Name of needed library */ -+#define DT_PLTRELSZ 2 /* Size in bytes of PLT relocs */ -+#define DT_PLTGOT 3 /* Processor defined value */ -+#define DT_HASH 4 /* Address of symbol hash table */ -+#define DT_STRTAB 5 /* Address of string table */ -+#define DT_SYMTAB 6 /* Address of symbol table */ -+#define DT_RELA 7 /* Address of Rela relocs */ -+#define DT_RELASZ 8 /* Total size of Rela relocs */ -+#define DT_RELAENT 9 /* Size of one Rela reloc */ -+#define DT_STRSZ 10 /* Size of string table */ -+#define DT_SYMENT 11 /* Size of one symbol table entry */ -+#define DT_INIT 12 /* Address of init function */ -+#define DT_FINI 13 /* Address of termination function */ -+#define DT_SONAME 14 /* Name of shared object */ -+#define DT_RPATH 15 /* Library search path (deprecated) */ -+#define DT_SYMBOLIC 16 /* Start symbol search here */ -+#define DT_REL 17 /* Address of Rel relocs */ -+#define DT_RELSZ 18 /* Total size of Rel relocs */ -+#define DT_RELENT 19 /* Size of one Rel reloc */ -+#define DT_PLTREL 20 /* Type of reloc in PLT */ -+#define DT_DEBUG 21 /* For debugging; unspecified */ -+#define DT_TEXTREL 22 /* Reloc might modify .text */ -+#define DT_JMPREL 23 /* Address of PLT relocs */ -+#define DT_BIND_NOW 24 /* Process relocations of object */ -+#define DT_INIT_ARRAY 25 /* Array with addresses of init fct */ -+#define DT_FINI_ARRAY 26 /* Array with addresses of fini fct */ -+#define DT_INIT_ARRAYSZ 27 /* Size in bytes of DT_INIT_ARRAY */ -+#define DT_FINI_ARRAYSZ 28 /* Size in bytes of DT_FINI_ARRAY */ -+#define DT_RUNPATH 29 /* Library search path */ -+#define DT_FLAGS 30 /* Flags for the object being loaded */ -+#define DT_ENCODING 32 /* Start of encoded range */ -+#define DT_PREINIT_ARRAY 32 /* Array with addresses of preinit fct*/ -+#define DT_PREINIT_ARRAYSZ 33 /* size in bytes of DT_PREINIT_ARRAY */ -+#define DT_NUM 34 /* Number used */ -+#define DT_LOOS 0x6000000d /* Start of OS-specific */ -+#define DT_HIOS 0x6ffff000 /* End of OS-specific */ -+#define DT_LOPROC 0x70000000 /* Start of processor-specific */ -+#define DT_HIPROC 0x7fffffff /* End of processor-specific */ -+#define DT_PROCNUM DT_MIPS_NUM /* Most used by any processor */ -+ -+/* DT_* entries which fall between DT_VALRNGHI & DT_VALRNGLO use the -+ Dyn.d_un.d_val field of the Elf*_Dyn structure. This follows Sun's -+ approach. */ -+#define DT_VALRNGLO 0x6ffffd00 -+#define DT_GNU_PRELINKED 0x6ffffdf5 /* Prelinking timestamp */ -+#define DT_GNU_CONFLICTSZ 0x6ffffdf6 /* Size of conflict section */ -+#define DT_GNU_LIBLISTSZ 0x6ffffdf7 /* Size of library list */ -+#define DT_CHECKSUM 0x6ffffdf8 -+#define DT_PLTPADSZ 0x6ffffdf9 -+#define DT_MOVEENT 0x6ffffdfa -+#define DT_MOVESZ 0x6ffffdfb -+#define DT_FEATURE_1 0x6ffffdfc /* Feature selection (DTF_*). */ -+#define DT_POSFLAG_1 0x6ffffdfd /* Flags for DT_* entries, effecting -+ the following DT_* entry. */ -+#define DT_SYMINSZ 0x6ffffdfe /* Size of syminfo table (in bytes) */ -+#define DT_SYMINENT 0x6ffffdff /* Entry size of syminfo */ -+#define DT_VALRNGHI 0x6ffffdff -+#define DT_VALTAGIDX(tag) (DT_VALRNGHI - (tag)) /* Reverse order! */ -+#define DT_VALNUM 12 -+ -+/* DT_* entries which fall between DT_ADDRRNGHI & DT_ADDRRNGLO use the -+ Dyn.d_un.d_ptr field of the Elf*_Dyn structure. -+ -+ If any adjustment is made to the ELF object after it has been -+ built these entries will need to be adjusted. */ -+#define DT_ADDRRNGLO 0x6ffffe00 -+#define DT_GNU_HASH 0x6ffffef5 /* GNU-style hash table. */ -+#define DT_TLSDESC_PLT 0x6ffffef6 -+#define DT_TLSDESC_GOT 0x6ffffef7 -+#define DT_GNU_CONFLICT 0x6ffffef8 /* Start of conflict section */ -+#define DT_GNU_LIBLIST 0x6ffffef9 /* Library list */ -+#define DT_CONFIG 0x6ffffefa /* Configuration information. */ -+#define DT_DEPAUDIT 0x6ffffefb /* Dependency auditing. */ -+#define DT_AUDIT 0x6ffffefc /* Object auditing. */ -+#define DT_PLTPAD 0x6ffffefd /* PLT padding. */ -+#define DT_MOVETAB 0x6ffffefe /* Move table. */ -+#define DT_SYMINFO 0x6ffffeff /* Syminfo table. */ -+#define DT_ADDRRNGHI 0x6ffffeff -+#define DT_ADDRTAGIDX(tag) (DT_ADDRRNGHI - (tag)) /* Reverse order! */ -+#define DT_ADDRNUM 11 -+ -+/* The versioning entry types. The next are defined as part of the -+ GNU extension. */ -+#define DT_VERSYM 0x6ffffff0 -+ -+#define DT_RELACOUNT 0x6ffffff9 -+#define DT_RELCOUNT 0x6ffffffa -+ -+/* These were chosen by Sun. */ -+#define DT_FLAGS_1 0x6ffffffb /* State flags, see DF_1_* below. */ -+#define DT_VERDEF 0x6ffffffc /* Address of version definition -+ table */ -+#define DT_VERDEFNUM 0x6ffffffd /* Number of version definitions */ -+#define DT_VERNEED 0x6ffffffe /* Address of table with needed -+ versions */ -+#define DT_VERNEEDNUM 0x6fffffff /* Number of needed versions */ -+#define DT_VERSIONTAGIDX(tag) (DT_VERNEEDNUM - (tag)) /* Reverse order! */ -+#define DT_VERSIONTAGNUM 16 -+ -+/* Sun added these machine-independent extensions in the "processor-specific" -+ range. Be compatible. */ -+#define DT_AUXILIARY 0x7ffffffd /* Shared object to load before self */ -+#define DT_FILTER 0x7fffffff /* Shared object to get values from */ -+#define DT_EXTRATAGIDX(tag) ((Elf32_Word)-((Elf32_Sword) (tag) <<1>>1)-1) -+#define DT_EXTRANUM 3 -+ -+/* Values of `d_un.d_val' in the DT_FLAGS entry. */ -+#define DF_ORIGIN 0x00000001 /* Object may use DF_ORIGIN */ -+#define DF_SYMBOLIC 0x00000002 /* Symbol resolutions starts here */ -+#define DF_TEXTREL 0x00000004 /* Object contains text relocations */ -+#define DF_BIND_NOW 0x00000008 /* No lazy binding for this object */ -+#define DF_STATIC_TLS 0x00000010 /* Module uses the static TLS model */ -+ -+/* State flags selectable in the `d_un.d_val' element of the DT_FLAGS_1 -+ entry in the dynamic section. */ -+#define DF_1_NOW 0x00000001 /* Set RTLD_NOW for this object. */ -+#define DF_1_GLOBAL 0x00000002 /* Set RTLD_GLOBAL for this object. */ -+#define DF_1_GROUP 0x00000004 /* Set RTLD_GROUP for this object. */ -+#define DF_1_NODELETE 0x00000008 /* Set RTLD_NODELETE for this object.*/ -+#define DF_1_LOADFLTR 0x00000010 /* Trigger filtee loading at runtime.*/ -+#define DF_1_INITFIRST 0x00000020 /* Set RTLD_INITFIRST for this object*/ -+#define DF_1_NOOPEN 0x00000040 /* Set RTLD_NOOPEN for this object. */ -+#define DF_1_ORIGIN 0x00000080 /* $ORIGIN must be handled. */ -+#define DF_1_DIRECT 0x00000100 /* Direct binding enabled. */ -+#define DF_1_TRANS 0x00000200 -+#define DF_1_INTERPOSE 0x00000400 /* Object is used to interpose. */ -+#define DF_1_NODEFLIB 0x00000800 /* Ignore default lib search path. */ -+#define DF_1_NODUMP 0x00001000 /* Object can't be dldump'ed. */ -+#define DF_1_CONFALT 0x00002000 /* Configuration alternative created.*/ -+#define DF_1_ENDFILTEE 0x00004000 /* Filtee terminates filters search. */ -+#define DF_1_DISPRELDNE 0x00008000 /* Disp reloc applied at build time. */ -+#define DF_1_DISPRELPND 0x00010000 /* Disp reloc applied at run-time. */ -+ -+/* Flags for the feature selection in DT_FEATURE_1. */ -+#define DTF_1_PARINIT 0x00000001 -+#define DTF_1_CONFEXP 0x00000002 -+ -+/* Flags in the DT_POSFLAG_1 entry effecting only the next DT_* entry. */ -+#define DF_P1_LAZYLOAD 0x00000001 /* Lazyload following object. */ -+#define DF_P1_GROUPPERM 0x00000002 /* Symbols from next object are not -+ generally available. */ -+ -+/* Version definition sections. */ -+ -+typedef struct -+{ -+ Elf32_Half vd_version; /* Version revision */ -+ Elf32_Half vd_flags; /* Version information */ -+ Elf32_Half vd_ndx; /* Version Index */ -+ Elf32_Half vd_cnt; /* Number of associated aux entries */ -+ Elf32_Word vd_hash; /* Version name hash value */ -+ Elf32_Word vd_aux; /* Offset in bytes to verdaux array */ -+ Elf32_Word vd_next; /* Offset in bytes to next verdef -+ entry */ -+} Elf32_Verdef; -+ -+typedef struct -+{ -+ Elf64_Half vd_version; /* Version revision */ -+ Elf64_Half vd_flags; /* Version information */ -+ Elf64_Half vd_ndx; /* Version Index */ -+ Elf64_Half vd_cnt; /* Number of associated aux entries */ -+ Elf64_Word vd_hash; /* Version name hash value */ -+ Elf64_Word vd_aux; /* Offset in bytes to verdaux array */ -+ Elf64_Word vd_next; /* Offset in bytes to next verdef -+ entry */ -+} Elf64_Verdef; -+ -+ -+/* Legal values for vd_version (version revision). */ -+#define VER_DEF_NONE 0 /* No version */ -+#define VER_DEF_CURRENT 1 /* Current version */ -+#define VER_DEF_NUM 2 /* Given version number */ -+ -+/* Legal values for vd_flags (version information flags). */ -+#define VER_FLG_BASE 0x1 /* Version definition of file itself */ -+#define VER_FLG_WEAK 0x2 /* Weak version identifier */ -+ -+/* Versym symbol index values. */ -+#define VER_NDX_LOCAL 0 /* Symbol is local. */ -+#define VER_NDX_GLOBAL 1 /* Symbol is global. */ -+#define VER_NDX_LORESERVE 0xff00 /* Beginning of reserved entries. */ -+#define VER_NDX_ELIMINATE 0xff01 /* Symbol is to be eliminated. */ -+ -+/* Auxialiary version information. */ -+ -+typedef struct -+{ -+ Elf32_Word vda_name; /* Version or dependency names */ -+ Elf32_Word vda_next; /* Offset in bytes to next verdaux -+ entry */ -+} Elf32_Verdaux; -+ -+typedef struct -+{ -+ Elf64_Word vda_name; /* Version or dependency names */ -+ Elf64_Word vda_next; /* Offset in bytes to next verdaux -+ entry */ -+} Elf64_Verdaux; -+ -+ -+/* Version dependency section. */ -+ -+typedef struct -+{ -+ Elf32_Half vn_version; /* Version of structure */ -+ Elf32_Half vn_cnt; /* Number of associated aux entries */ -+ Elf32_Word vn_file; /* Offset of filename for this -+ dependency */ -+ Elf32_Word vn_aux; /* Offset in bytes to vernaux array */ -+ Elf32_Word vn_next; /* Offset in bytes to next verneed -+ entry */ -+} Elf32_Verneed; -+ -+typedef struct -+{ -+ Elf64_Half vn_version; /* Version of structure */ -+ Elf64_Half vn_cnt; /* Number of associated aux entries */ -+ Elf64_Word vn_file; /* Offset of filename for this -+ dependency */ -+ Elf64_Word vn_aux; /* Offset in bytes to vernaux array */ -+ Elf64_Word vn_next; /* Offset in bytes to next verneed -+ entry */ -+} Elf64_Verneed; -+ -+ -+/* Legal values for vn_version (version revision). */ -+#define VER_NEED_NONE 0 /* No version */ -+#define VER_NEED_CURRENT 1 /* Current version */ -+#define VER_NEED_NUM 2 /* Given version number */ -+ -+/* Auxiliary needed version information. */ -+ -+typedef struct -+{ -+ Elf32_Word vna_hash; /* Hash value of dependency name */ -+ Elf32_Half vna_flags; /* Dependency specific information */ -+ Elf32_Half vna_other; /* Unused */ -+ Elf32_Word vna_name; /* Dependency name string offset */ -+ Elf32_Word vna_next; /* Offset in bytes to next vernaux -+ entry */ -+} Elf32_Vernaux; -+ -+typedef struct -+{ -+ Elf64_Word vna_hash; /* Hash value of dependency name */ -+ Elf64_Half vna_flags; /* Dependency specific information */ -+ Elf64_Half vna_other; /* Unused */ -+ Elf64_Word vna_name; /* Dependency name string offset */ -+ Elf64_Word vna_next; /* Offset in bytes to next vernaux -+ entry */ -+} Elf64_Vernaux; -+ -+ -+/* Legal values for vna_flags. */ -+#define VER_FLG_WEAK 0x2 /* Weak version identifier */ -+ -+ -+/* Auxiliary vector. */ -+ -+/* This vector is normally only used by the program interpreter. The -+ usual definition in an ABI supplement uses the name auxv_t. The -+ vector is not usually defined in a standard file, but it -+ can't hurt. We rename it to avoid conflicts. The sizes of these -+ types are an arrangement between the exec server and the program -+ interpreter, so we don't fully specify them here. */ -+ -+typedef struct -+{ -+ uint32_t a_type; /* Entry type */ -+ union -+ { -+ uint32_t a_val; /* Integer value */ -+ /* We use to have pointer elements added here. We cannot do that, -+ though, since it does not work when using 32-bit definitions -+ on 64-bit platforms and vice versa. */ -+ } a_un; -+} Elf32_auxv_t; -+ -+typedef struct -+{ -+ uint64_t a_type; /* Entry type */ -+ union -+ { -+ uint64_t a_val; /* Integer value */ -+ /* We use to have pointer elements added here. We cannot do that, -+ though, since it does not work when using 32-bit definitions -+ on 64-bit platforms and vice versa. */ -+ } a_un; -+} Elf64_auxv_t; -+ -+/* Legal values for a_type (entry type). */ -+ -+#define AT_NULL 0 /* End of vector */ -+#define AT_IGNORE 1 /* Entry should be ignored */ -+#define AT_EXECFD 2 /* File descriptor of program */ -+#define AT_PHDR 3 /* Program headers for program */ -+#define AT_PHENT 4 /* Size of program header entry */ -+#define AT_PHNUM 5 /* Number of program headers */ -+#define AT_PAGESZ 6 /* System page size */ -+#define AT_BASE 7 /* Base address of interpreter */ -+#define AT_FLAGS 8 /* Flags */ -+#define AT_ENTRY 9 /* Entry point of program */ -+#define AT_NOTELF 10 /* Program is not ELF */ -+#define AT_UID 11 /* Real uid */ -+#define AT_EUID 12 /* Effective uid */ -+#define AT_GID 13 /* Real gid */ -+#define AT_EGID 14 /* Effective gid */ -+#define AT_CLKTCK 17 /* Frequency of times() */ -+ -+/* Some more special a_type values describing the hardware. */ -+#define AT_PLATFORM 15 /* String identifying platform. */ -+#define AT_HWCAP 16 /* Machine dependent hints about -+ processor capabilities. */ -+ -+/* This entry gives some information about the FPU initialization -+ performed by the kernel. */ -+#define AT_FPUCW 18 /* Used FPU control word. */ -+ -+/* Cache block sizes. */ -+#define AT_DCACHEBSIZE 19 /* Data cache block size. */ -+#define AT_ICACHEBSIZE 20 /* Instruction cache block size. */ -+#define AT_UCACHEBSIZE 21 /* Unified cache block size. */ -+ -+/* A special ignored value for PPC, used by the kernel to control the -+ interpretation of the AUXV. Must be > 16. */ -+#define AT_IGNOREPPC 22 /* Entry should be ignored. */ -+ -+#define AT_SECURE 23 /* Boolean, was exec setuid-like? */ -+ -+#define AT_BASE_PLATFORM 24 /* String identifying real platforms.*/ -+ -+#define AT_RANDOM 25 /* Address of 16 random bytes. */ -+ -+#define AT_EXECFN 31 /* Filename of executable. */ -+ -+/* Pointer to the global system page used for system calls and other -+ nice things. */ -+#define AT_SYSINFO 32 -+#define AT_SYSINFO_EHDR 33 -+ -+/* Shapes of the caches. Bits 0-3 contains associativity; bits 4-7 contains -+ log2 of line size; mask those to get cache size. */ -+#define AT_L1I_CACHESHAPE 34 -+#define AT_L1D_CACHESHAPE 35 -+#define AT_L2_CACHESHAPE 36 -+#define AT_L3_CACHESHAPE 37 -+ -+/* Note section contents. Each entry in the note section begins with -+ a header of a fixed form. */ -+ -+typedef struct -+{ -+ Elf32_Word n_namesz; /* Length of the note's name. */ -+ Elf32_Word n_descsz; /* Length of the note's descriptor. */ -+ Elf32_Word n_type; /* Type of the note. */ -+} Elf32_Nhdr; -+ -+typedef struct -+{ -+ Elf64_Word n_namesz; /* Length of the note's name. */ -+ Elf64_Word n_descsz; /* Length of the note's descriptor. */ -+ Elf64_Word n_type; /* Type of the note. */ -+} Elf64_Nhdr; -+ -+/* Known names of notes. */ -+ -+/* Solaris entries in the note section have this name. */ -+#define ELF_NOTE_SOLARIS "SUNW Solaris" -+ -+/* Note entries for GNU systems have this name. */ -+#define ELF_NOTE_GNU "GNU" -+ -+ -+/* Defined types of notes for Solaris. */ -+ -+/* Value of descriptor (one word) is desired pagesize for the binary. */ -+#define ELF_NOTE_PAGESIZE_HINT 1 -+ -+ -+/* Defined note types for GNU systems. */ -+ -+/* ABI information. The descriptor consists of words: -+ word 0: OS descriptor -+ word 1: major version of the ABI -+ word 2: minor version of the ABI -+ word 3: subminor version of the ABI -+*/ -+#define NT_GNU_ABI_TAG 1 -+#define ELF_NOTE_ABI NT_GNU_ABI_TAG /* Old name. */ -+ -+/* Known OSes. These values can appear in word 0 of an -+ NT_GNU_ABI_TAG note section entry. */ -+#define ELF_NOTE_OS_LINUX 0 -+#define ELF_NOTE_OS_GNU 1 -+#define ELF_NOTE_OS_SOLARIS2 2 -+#define ELF_NOTE_OS_FREEBSD 3 -+ -+/* Synthetic hwcap information. The descriptor begins with two words: -+ word 0: number of entries -+ word 1: bitmask of enabled entries -+ Then follow variable-length entries, one byte followed by a -+ '\0'-terminated hwcap name string. The byte gives the bit -+ number to test if enabled, (1U << bit) & bitmask. */ -+#define NT_GNU_HWCAP 2 -+ -+/* Build ID bits as generated by ld --build-id. -+ The descriptor consists of any nonzero number of bytes. */ -+#define NT_GNU_BUILD_ID 3 -+ -+/* Version note generated by GNU gold containing a version string. */ -+#define NT_GNU_GOLD_VERSION 4 -+ -+ -+/* Move records. */ -+typedef struct -+{ -+ Elf32_Xword m_value; /* Symbol value. */ -+ Elf32_Word m_info; /* Size and index. */ -+ Elf32_Word m_poffset; /* Symbol offset. */ -+ Elf32_Half m_repeat; /* Repeat count. */ -+ Elf32_Half m_stride; /* Stride info. */ -+} Elf32_Move; -+ -+typedef struct -+{ -+ Elf64_Xword m_value; /* Symbol value. */ -+ Elf64_Xword m_info; /* Size and index. */ -+ Elf64_Xword m_poffset; /* Symbol offset. */ -+ Elf64_Half m_repeat; /* Repeat count. */ -+ Elf64_Half m_stride; /* Stride info. */ -+} Elf64_Move; -+ -+/* Macro to construct move records. */ -+#define ELF32_M_SYM(info) ((info) >> 8) -+#define ELF32_M_SIZE(info) ((unsigned char) (info)) -+#define ELF32_M_INFO(sym, size) (((sym) << 8) + (unsigned char) (size)) -+ -+#define ELF64_M_SYM(info) ELF32_M_SYM (info) -+#define ELF64_M_SIZE(info) ELF32_M_SIZE (info) -+#define ELF64_M_INFO(sym, size) ELF32_M_INFO (sym, size) -+ -+ -+/* Motorola 68k specific definitions. */ -+ -+/* Values for Elf32_Ehdr.e_flags. */ -+#define EF_CPU32 0x00810000 -+ -+/* m68k relocs. */ -+ -+#define R_68K_NONE 0 /* No reloc */ -+#define R_68K_32 1 /* Direct 32 bit */ -+#define R_68K_16 2 /* Direct 16 bit */ -+#define R_68K_8 3 /* Direct 8 bit */ -+#define R_68K_PC32 4 /* PC relative 32 bit */ -+#define R_68K_PC16 5 /* PC relative 16 bit */ -+#define R_68K_PC8 6 /* PC relative 8 bit */ -+#define R_68K_GOT32 7 /* 32 bit PC relative GOT entry */ -+#define R_68K_GOT16 8 /* 16 bit PC relative GOT entry */ -+#define R_68K_GOT8 9 /* 8 bit PC relative GOT entry */ -+#define R_68K_GOT32O 10 /* 32 bit GOT offset */ -+#define R_68K_GOT16O 11 /* 16 bit GOT offset */ -+#define R_68K_GOT8O 12 /* 8 bit GOT offset */ -+#define R_68K_PLT32 13 /* 32 bit PC relative PLT address */ -+#define R_68K_PLT16 14 /* 16 bit PC relative PLT address */ -+#define R_68K_PLT8 15 /* 8 bit PC relative PLT address */ -+#define R_68K_PLT32O 16 /* 32 bit PLT offset */ -+#define R_68K_PLT16O 17 /* 16 bit PLT offset */ -+#define R_68K_PLT8O 18 /* 8 bit PLT offset */ -+#define R_68K_COPY 19 /* Copy symbol at runtime */ -+#define R_68K_GLOB_DAT 20 /* Create GOT entry */ -+#define R_68K_JMP_SLOT 21 /* Create PLT entry */ -+#define R_68K_RELATIVE 22 /* Adjust by program base */ -+#define R_68K_TLS_GD32 25 /* 32 bit GOT offset for GD */ -+#define R_68K_TLS_GD16 26 /* 16 bit GOT offset for GD */ -+#define R_68K_TLS_GD8 27 /* 8 bit GOT offset for GD */ -+#define R_68K_TLS_LDM32 28 /* 32 bit GOT offset for LDM */ -+#define R_68K_TLS_LDM16 29 /* 16 bit GOT offset for LDM */ -+#define R_68K_TLS_LDM8 30 /* 8 bit GOT offset for LDM */ -+#define R_68K_TLS_LDO32 31 /* 32 bit module-relative offset */ -+#define R_68K_TLS_LDO16 32 /* 16 bit module-relative offset */ -+#define R_68K_TLS_LDO8 33 /* 8 bit module-relative offset */ -+#define R_68K_TLS_IE32 34 /* 32 bit GOT offset for IE */ -+#define R_68K_TLS_IE16 35 /* 16 bit GOT offset for IE */ -+#define R_68K_TLS_IE8 36 /* 8 bit GOT offset for IE */ -+#define R_68K_TLS_LE32 37 /* 32 bit offset relative to -+ static TLS block */ -+#define R_68K_TLS_LE16 38 /* 16 bit offset relative to -+ static TLS block */ -+#define R_68K_TLS_LE8 39 /* 8 bit offset relative to -+ static TLS block */ -+#define R_68K_TLS_DTPMOD32 40 /* 32 bit module number */ -+#define R_68K_TLS_DTPREL32 41 /* 32 bit module-relative offset */ -+#define R_68K_TLS_TPREL32 42 /* 32 bit TP-relative offset */ -+/* Keep this the last entry. */ -+#define R_68K_NUM 43 -+ -+/* Intel 80386 specific definitions. */ -+ -+/* i386 relocs. */ -+ -+#define R_386_NONE 0 /* No reloc */ -+#define R_386_32 1 /* Direct 32 bit */ -+#define R_386_PC32 2 /* PC relative 32 bit */ -+#define R_386_GOT32 3 /* 32 bit GOT entry */ -+#define R_386_PLT32 4 /* 32 bit PLT address */ -+#define R_386_COPY 5 /* Copy symbol at runtime */ -+#define R_386_GLOB_DAT 6 /* Create GOT entry */ -+#define R_386_JMP_SLOT 7 /* Create PLT entry */ -+#define R_386_RELATIVE 8 /* Adjust by program base */ -+#define R_386_GOTOFF 9 /* 32 bit offset to GOT */ -+#define R_386_GOTPC 10 /* 32 bit PC relative offset to GOT */ -+#define R_386_32PLT 11 -+#define R_386_TLS_TPOFF 14 /* Offset in static TLS block */ -+#define R_386_TLS_IE 15 /* Address of GOT entry for static TLS -+ block offset */ -+#define R_386_TLS_GOTIE 16 /* GOT entry for static TLS block -+ offset */ -+#define R_386_TLS_LE 17 /* Offset relative to static TLS -+ block */ -+#define R_386_TLS_GD 18 /* Direct 32 bit for GNU version of -+ general dynamic thread local data */ -+#define R_386_TLS_LDM 19 /* Direct 32 bit for GNU version of -+ local dynamic thread local data -+ in LE code */ -+#define R_386_16 20 -+#define R_386_PC16 21 -+#define R_386_8 22 -+#define R_386_PC8 23 -+#define R_386_TLS_GD_32 24 /* Direct 32 bit for general dynamic -+ thread local data */ -+#define R_386_TLS_GD_PUSH 25 /* Tag for pushl in GD TLS code */ -+#define R_386_TLS_GD_CALL 26 /* Relocation for call to -+ __tls_get_addr() */ -+#define R_386_TLS_GD_POP 27 /* Tag for popl in GD TLS code */ -+#define R_386_TLS_LDM_32 28 /* Direct 32 bit for local dynamic -+ thread local data in LE code */ -+#define R_386_TLS_LDM_PUSH 29 /* Tag for pushl in LDM TLS code */ -+#define R_386_TLS_LDM_CALL 30 /* Relocation for call to -+ __tls_get_addr() in LDM code */ -+#define R_386_TLS_LDM_POP 31 /* Tag for popl in LDM TLS code */ -+#define R_386_TLS_LDO_32 32 /* Offset relative to TLS block */ -+#define R_386_TLS_IE_32 33 /* GOT entry for negated static TLS -+ block offset */ -+#define R_386_TLS_LE_32 34 /* Negated offset relative to static -+ TLS block */ -+#define R_386_TLS_DTPMOD32 35 /* ID of module containing symbol */ -+#define R_386_TLS_DTPOFF32 36 /* Offset in TLS block */ -+#define R_386_TLS_TPOFF32 37 /* Negated offset in static TLS block */ -+/* 38? */ -+#define R_386_TLS_GOTDESC 39 /* GOT offset for TLS descriptor. */ -+#define R_386_TLS_DESC_CALL 40 /* Marker of call through TLS -+ descriptor for -+ relaxation. */ -+#define R_386_TLS_DESC 41 /* TLS descriptor containing -+ pointer to code and to -+ argument, returning the TLS -+ offset for the symbol. */ -+#define R_386_IRELATIVE 42 /* Adjust indirectly by program base */ -+/* Keep this the last entry. */ -+#define R_386_NUM 43 -+ -+/* SUN SPARC specific definitions. */ -+ -+/* Legal values for ST_TYPE subfield of st_info (symbol type). */ -+ -+#define STT_SPARC_REGISTER 13 /* Global register reserved to app. */ -+ -+/* Values for Elf64_Ehdr.e_flags. */ -+ -+#define EF_SPARCV9_MM 3 -+#define EF_SPARCV9_TSO 0 -+#define EF_SPARCV9_PSO 1 -+#define EF_SPARCV9_RMO 2 -+#define EF_SPARC_LEDATA 0x800000 /* little endian data */ -+#define EF_SPARC_EXT_MASK 0xFFFF00 -+#define EF_SPARC_32PLUS 0x000100 /* generic V8+ features */ -+#define EF_SPARC_SUN_US1 0x000200 /* Sun UltraSPARC1 extensions */ -+#define EF_SPARC_HAL_R1 0x000400 /* HAL R1 extensions */ -+#define EF_SPARC_SUN_US3 0x000800 /* Sun UltraSPARCIII extensions */ -+ -+/* SPARC relocs. */ -+ -+#define R_SPARC_NONE 0 /* No reloc */ -+#define R_SPARC_8 1 /* Direct 8 bit */ -+#define R_SPARC_16 2 /* Direct 16 bit */ -+#define R_SPARC_32 3 /* Direct 32 bit */ -+#define R_SPARC_DISP8 4 /* PC relative 8 bit */ -+#define R_SPARC_DISP16 5 /* PC relative 16 bit */ -+#define R_SPARC_DISP32 6 /* PC relative 32 bit */ -+#define R_SPARC_WDISP30 7 /* PC relative 30 bit shifted */ -+#define R_SPARC_WDISP22 8 /* PC relative 22 bit shifted */ -+#define R_SPARC_HI22 9 /* High 22 bit */ -+#define R_SPARC_22 10 /* Direct 22 bit */ -+#define R_SPARC_13 11 /* Direct 13 bit */ -+#define R_SPARC_LO10 12 /* Truncated 10 bit */ -+#define R_SPARC_GOT10 13 /* Truncated 10 bit GOT entry */ -+#define R_SPARC_GOT13 14 /* 13 bit GOT entry */ -+#define R_SPARC_GOT22 15 /* 22 bit GOT entry shifted */ -+#define R_SPARC_PC10 16 /* PC relative 10 bit truncated */ -+#define R_SPARC_PC22 17 /* PC relative 22 bit shifted */ -+#define R_SPARC_WPLT30 18 /* 30 bit PC relative PLT address */ -+#define R_SPARC_COPY 19 /* Copy symbol at runtime */ -+#define R_SPARC_GLOB_DAT 20 /* Create GOT entry */ -+#define R_SPARC_JMP_SLOT 21 /* Create PLT entry */ -+#define R_SPARC_RELATIVE 22 /* Adjust by program base */ -+#define R_SPARC_UA32 23 /* Direct 32 bit unaligned */ -+ -+/* Additional Sparc64 relocs. */ -+ -+#define R_SPARC_PLT32 24 /* Direct 32 bit ref to PLT entry */ -+#define R_SPARC_HIPLT22 25 /* High 22 bit PLT entry */ -+#define R_SPARC_LOPLT10 26 /* Truncated 10 bit PLT entry */ -+#define R_SPARC_PCPLT32 27 /* PC rel 32 bit ref to PLT entry */ -+#define R_SPARC_PCPLT22 28 /* PC rel high 22 bit PLT entry */ -+#define R_SPARC_PCPLT10 29 /* PC rel trunc 10 bit PLT entry */ -+#define R_SPARC_10 30 /* Direct 10 bit */ -+#define R_SPARC_11 31 /* Direct 11 bit */ -+#define R_SPARC_64 32 /* Direct 64 bit */ -+#define R_SPARC_OLO10 33 /* 10bit with secondary 13bit addend */ -+#define R_SPARC_HH22 34 /* Top 22 bits of direct 64 bit */ -+#define R_SPARC_HM10 35 /* High middle 10 bits of ... */ -+#define R_SPARC_LM22 36 /* Low middle 22 bits of ... */ -+#define R_SPARC_PC_HH22 37 /* Top 22 bits of pc rel 64 bit */ -+#define R_SPARC_PC_HM10 38 /* High middle 10 bit of ... */ -+#define R_SPARC_PC_LM22 39 /* Low miggle 22 bits of ... */ -+#define R_SPARC_WDISP16 40 /* PC relative 16 bit shifted */ -+#define R_SPARC_WDISP19 41 /* PC relative 19 bit shifted */ -+#define R_SPARC_GLOB_JMP 42 /* was part of v9 ABI but was removed */ -+#define R_SPARC_7 43 /* Direct 7 bit */ -+#define R_SPARC_5 44 /* Direct 5 bit */ -+#define R_SPARC_6 45 /* Direct 6 bit */ -+#define R_SPARC_DISP64 46 /* PC relative 64 bit */ -+#define R_SPARC_PLT64 47 /* Direct 64 bit ref to PLT entry */ -+#define R_SPARC_HIX22 48 /* High 22 bit complemented */ -+#define R_SPARC_LOX10 49 /* Truncated 11 bit complemented */ -+#define R_SPARC_H44 50 /* Direct high 12 of 44 bit */ -+#define R_SPARC_M44 51 /* Direct mid 22 of 44 bit */ -+#define R_SPARC_L44 52 /* Direct low 10 of 44 bit */ -+#define R_SPARC_REGISTER 53 /* Global register usage */ -+#define R_SPARC_UA64 54 /* Direct 64 bit unaligned */ -+#define R_SPARC_UA16 55 /* Direct 16 bit unaligned */ -+#define R_SPARC_TLS_GD_HI22 56 -+#define R_SPARC_TLS_GD_LO10 57 -+#define R_SPARC_TLS_GD_ADD 58 -+#define R_SPARC_TLS_GD_CALL 59 -+#define R_SPARC_TLS_LDM_HI22 60 -+#define R_SPARC_TLS_LDM_LO10 61 -+#define R_SPARC_TLS_LDM_ADD 62 -+#define R_SPARC_TLS_LDM_CALL 63 -+#define R_SPARC_TLS_LDO_HIX22 64 -+#define R_SPARC_TLS_LDO_LOX10 65 -+#define R_SPARC_TLS_LDO_ADD 66 -+#define R_SPARC_TLS_IE_HI22 67 -+#define R_SPARC_TLS_IE_LO10 68 -+#define R_SPARC_TLS_IE_LD 69 -+#define R_SPARC_TLS_IE_LDX 70 -+#define R_SPARC_TLS_IE_ADD 71 -+#define R_SPARC_TLS_LE_HIX22 72 -+#define R_SPARC_TLS_LE_LOX10 73 -+#define R_SPARC_TLS_DTPMOD32 74 -+#define R_SPARC_TLS_DTPMOD64 75 -+#define R_SPARC_TLS_DTPOFF32 76 -+#define R_SPARC_TLS_DTPOFF64 77 -+#define R_SPARC_TLS_TPOFF32 78 -+#define R_SPARC_TLS_TPOFF64 79 -+#define R_SPARC_GOTDATA_HIX22 80 -+#define R_SPARC_GOTDATA_LOX10 81 -+#define R_SPARC_GOTDATA_OP_HIX22 82 -+#define R_SPARC_GOTDATA_OP_LOX10 83 -+#define R_SPARC_GOTDATA_OP 84 -+#define R_SPARC_H34 85 -+#define R_SPARC_SIZE32 86 -+#define R_SPARC_SIZE64 87 -+#define R_SPARC_WDISP10 88 -+#define R_SPARC_JMP_IREL 248 -+#define R_SPARC_IRELATIVE 249 -+#define R_SPARC_GNU_VTINHERIT 250 -+#define R_SPARC_GNU_VTENTRY 251 -+#define R_SPARC_REV32 252 -+/* Keep this the last entry. */ -+#define R_SPARC_NUM 253 -+ -+/* For Sparc64, legal values for d_tag of Elf64_Dyn. */ -+ -+#define DT_SPARC_REGISTER 0x70000001 -+#define DT_SPARC_NUM 2 -+ -+/* MIPS R3000 specific definitions. */ -+ -+/* Legal values for e_flags field of Elf32_Ehdr. */ -+ -+#define EF_MIPS_NOREORDER 1 /* A .noreorder directive was used */ -+#define EF_MIPS_PIC 2 /* Contains PIC code */ -+#define EF_MIPS_CPIC 4 /* Uses PIC calling sequence */ -+#define EF_MIPS_XGOT 8 -+#define EF_MIPS_64BIT_WHIRL 16 -+#define EF_MIPS_ABI2 32 -+#define EF_MIPS_ABI_ON32 64 -+#define EF_MIPS_ARCH 0xf0000000 /* MIPS architecture level */ -+ -+/* Legal values for MIPS architecture level. */ -+ -+#define EF_MIPS_ARCH_1 0x00000000 /* -mips1 code. */ -+#define EF_MIPS_ARCH_2 0x10000000 /* -mips2 code. */ -+#define EF_MIPS_ARCH_3 0x20000000 /* -mips3 code. */ -+#define EF_MIPS_ARCH_4 0x30000000 /* -mips4 code. */ -+#define EF_MIPS_ARCH_5 0x40000000 /* -mips5 code. */ -+#define EF_MIPS_ARCH_32 0x60000000 /* MIPS32 code. */ -+#define EF_MIPS_ARCH_64 0x70000000 /* MIPS64 code. */ -+ -+/* The following are non-official names and should not be used. */ -+ -+#define E_MIPS_ARCH_1 0x00000000 /* -mips1 code. */ -+#define E_MIPS_ARCH_2 0x10000000 /* -mips2 code. */ -+#define E_MIPS_ARCH_3 0x20000000 /* -mips3 code. */ -+#define E_MIPS_ARCH_4 0x30000000 /* -mips4 code. */ -+#define E_MIPS_ARCH_5 0x40000000 /* -mips5 code. */ -+#define E_MIPS_ARCH_32 0x60000000 /* MIPS32 code. */ -+#define E_MIPS_ARCH_64 0x70000000 /* MIPS64 code. */ -+ -+/* Special section indices. */ -+ -+#define SHN_MIPS_ACOMMON 0xff00 /* Allocated common symbols */ -+#define SHN_MIPS_TEXT 0xff01 /* Allocated test symbols. */ -+#define SHN_MIPS_DATA 0xff02 /* Allocated data symbols. */ -+#define SHN_MIPS_SCOMMON 0xff03 /* Small common symbols */ -+#define SHN_MIPS_SUNDEFINED 0xff04 /* Small undefined symbols */ -+ -+/* Legal values for sh_type field of Elf32_Shdr. */ -+ -+#define SHT_MIPS_LIBLIST 0x70000000 /* Shared objects used in link */ -+#define SHT_MIPS_MSYM 0x70000001 -+#define SHT_MIPS_CONFLICT 0x70000002 /* Conflicting symbols */ -+#define SHT_MIPS_GPTAB 0x70000003 /* Global data area sizes */ -+#define SHT_MIPS_UCODE 0x70000004 /* Reserved for SGI/MIPS compilers */ -+#define SHT_MIPS_DEBUG 0x70000005 /* MIPS ECOFF debugging information*/ -+#define SHT_MIPS_REGINFO 0x70000006 /* Register usage information */ -+#define SHT_MIPS_PACKAGE 0x70000007 -+#define SHT_MIPS_PACKSYM 0x70000008 -+#define SHT_MIPS_RELD 0x70000009 -+#define SHT_MIPS_IFACE 0x7000000b -+#define SHT_MIPS_CONTENT 0x7000000c -+#define SHT_MIPS_OPTIONS 0x7000000d /* Miscellaneous options. */ -+#define SHT_MIPS_SHDR 0x70000010 -+#define SHT_MIPS_FDESC 0x70000011 -+#define SHT_MIPS_EXTSYM 0x70000012 -+#define SHT_MIPS_DENSE 0x70000013 -+#define SHT_MIPS_PDESC 0x70000014 -+#define SHT_MIPS_LOCSYM 0x70000015 -+#define SHT_MIPS_AUXSYM 0x70000016 -+#define SHT_MIPS_OPTSYM 0x70000017 -+#define SHT_MIPS_LOCSTR 0x70000018 -+#define SHT_MIPS_LINE 0x70000019 -+#define SHT_MIPS_RFDESC 0x7000001a -+#define SHT_MIPS_DELTASYM 0x7000001b -+#define SHT_MIPS_DELTAINST 0x7000001c -+#define SHT_MIPS_DELTACLASS 0x7000001d -+#define SHT_MIPS_DWARF 0x7000001e /* DWARF debugging information. */ -+#define SHT_MIPS_DELTADECL 0x7000001f -+#define SHT_MIPS_SYMBOL_LIB 0x70000020 -+#define SHT_MIPS_EVENTS 0x70000021 /* Event section. */ -+#define SHT_MIPS_TRANSLATE 0x70000022 -+#define SHT_MIPS_PIXIE 0x70000023 -+#define SHT_MIPS_XLATE 0x70000024 -+#define SHT_MIPS_XLATE_DEBUG 0x70000025 -+#define SHT_MIPS_WHIRL 0x70000026 -+#define SHT_MIPS_EH_REGION 0x70000027 -+#define SHT_MIPS_XLATE_OLD 0x70000028 -+#define SHT_MIPS_PDR_EXCEPTION 0x70000029 -+ -+/* Legal values for sh_flags field of Elf32_Shdr. */ -+ -+#define SHF_MIPS_GPREL 0x10000000 /* Must be part of global data area */ -+#define SHF_MIPS_MERGE 0x20000000 -+#define SHF_MIPS_ADDR 0x40000000 -+#define SHF_MIPS_STRINGS 0x80000000 -+#define SHF_MIPS_NOSTRIP 0x08000000 -+#define SHF_MIPS_LOCAL 0x04000000 -+#define SHF_MIPS_NAMES 0x02000000 -+#define SHF_MIPS_NODUPE 0x01000000 -+ -+ -+/* Symbol tables. */ -+ -+/* MIPS specific values for `st_other'. */ -+#define STO_MIPS_DEFAULT 0x0 -+#define STO_MIPS_INTERNAL 0x1 -+#define STO_MIPS_HIDDEN 0x2 -+#define STO_MIPS_PROTECTED 0x3 -+#define STO_MIPS_PLT 0x8 -+#define STO_MIPS_SC_ALIGN_UNUSED 0xff -+ -+/* MIPS specific values for `st_info'. */ -+#define STB_MIPS_SPLIT_COMMON 13 -+ -+/* Entries found in sections of type SHT_MIPS_GPTAB. */ -+ -+typedef union -+{ -+ struct -+ { -+ Elf32_Word gt_current_g_value; /* -G value used for compilation */ -+ Elf32_Word gt_unused; /* Not used */ -+ } gt_header; /* First entry in section */ -+ struct -+ { -+ Elf32_Word gt_g_value; /* If this value were used for -G */ -+ Elf32_Word gt_bytes; /* This many bytes would be used */ -+ } gt_entry; /* Subsequent entries in section */ -+} Elf32_gptab; -+ -+/* Entry found in sections of type SHT_MIPS_REGINFO. */ -+ -+typedef struct -+{ -+ Elf32_Word ri_gprmask; /* General registers used */ -+ Elf32_Word ri_cprmask[4]; /* Coprocessor registers used */ -+ Elf32_Sword ri_gp_value; /* $gp register value */ -+} Elf32_RegInfo; -+ -+/* Entries found in sections of type SHT_MIPS_OPTIONS. */ -+ -+typedef struct -+{ -+ unsigned char kind; /* Determines interpretation of the -+ variable part of descriptor. */ -+ unsigned char size; /* Size of descriptor, including header. */ -+ Elf32_Section section; /* Section header index of section affected, -+ 0 for global options. */ -+ Elf32_Word info; /* Kind-specific information. */ -+} Elf_Options; -+ -+/* Values for `kind' field in Elf_Options. */ -+ -+#define ODK_NULL 0 /* Undefined. */ -+#define ODK_REGINFO 1 /* Register usage information. */ -+#define ODK_EXCEPTIONS 2 /* Exception processing options. */ -+#define ODK_PAD 3 /* Section padding options. */ -+#define ODK_HWPATCH 4 /* Hardware workarounds performed */ -+#define ODK_FILL 5 /* record the fill value used by the linker. */ -+#define ODK_TAGS 6 /* reserve space for desktop tools to write. */ -+#define ODK_HWAND 7 /* HW workarounds. 'AND' bits when merging. */ -+#define ODK_HWOR 8 /* HW workarounds. 'OR' bits when merging. */ -+ -+/* Values for `info' in Elf_Options for ODK_EXCEPTIONS entries. */ -+ -+#define OEX_FPU_MIN 0x1f /* FPE's which MUST be enabled. */ -+#define OEX_FPU_MAX 0x1f00 /* FPE's which MAY be enabled. */ -+#define OEX_PAGE0 0x10000 /* page zero must be mapped. */ -+#define OEX_SMM 0x20000 /* Force sequential memory mode? */ -+#define OEX_FPDBUG 0x40000 /* Force floating point debug mode? */ -+#define OEX_PRECISEFP OEX_FPDBUG -+#define OEX_DISMISS 0x80000 /* Dismiss invalid address faults? */ -+ -+#define OEX_FPU_INVAL 0x10 -+#define OEX_FPU_DIV0 0x08 -+#define OEX_FPU_OFLO 0x04 -+#define OEX_FPU_UFLO 0x02 -+#define OEX_FPU_INEX 0x01 -+ -+/* Masks for `info' in Elf_Options for an ODK_HWPATCH entry. */ -+ -+#define OHW_R4KEOP 0x1 /* R4000 end-of-page patch. */ -+#define OHW_R8KPFETCH 0x2 /* may need R8000 prefetch patch. */ -+#define OHW_R5KEOP 0x4 /* R5000 end-of-page patch. */ -+#define OHW_R5KCVTL 0x8 /* R5000 cvt.[ds].l bug. clean=1. */ -+ -+#define OPAD_PREFIX 0x1 -+#define OPAD_POSTFIX 0x2 -+#define OPAD_SYMBOL 0x4 -+ -+/* Entry found in `.options' section. */ -+ -+typedef struct -+{ -+ Elf32_Word hwp_flags1; /* Extra flags. */ -+ Elf32_Word hwp_flags2; /* Extra flags. */ -+} Elf_Options_Hw; -+ -+/* Masks for `info' in ElfOptions for ODK_HWAND and ODK_HWOR entries. */ -+ -+#define OHWA0_R4KEOP_CHECKED 0x00000001 -+#define OHWA1_R4KEOP_CLEAN 0x00000002 -+ -+/* MIPS relocs. */ -+ -+#define R_MIPS_NONE 0 /* No reloc */ -+#define R_MIPS_16 1 /* Direct 16 bit */ -+#define R_MIPS_32 2 /* Direct 32 bit */ -+#define R_MIPS_REL32 3 /* PC relative 32 bit */ -+#define R_MIPS_26 4 /* Direct 26 bit shifted */ -+#define R_MIPS_HI16 5 /* High 16 bit */ -+#define R_MIPS_LO16 6 /* Low 16 bit */ -+#define R_MIPS_GPREL16 7 /* GP relative 16 bit */ -+#define R_MIPS_LITERAL 8 /* 16 bit literal entry */ -+#define R_MIPS_GOT16 9 /* 16 bit GOT entry */ -+#define R_MIPS_PC16 10 /* PC relative 16 bit */ -+#define R_MIPS_CALL16 11 /* 16 bit GOT entry for function */ -+#define R_MIPS_GPREL32 12 /* GP relative 32 bit */ -+ -+#define R_MIPS_SHIFT5 16 -+#define R_MIPS_SHIFT6 17 -+#define R_MIPS_64 18 -+#define R_MIPS_GOT_DISP 19 -+#define R_MIPS_GOT_PAGE 20 -+#define R_MIPS_GOT_OFST 21 -+#define R_MIPS_GOT_HI16 22 -+#define R_MIPS_GOT_LO16 23 -+#define R_MIPS_SUB 24 -+#define R_MIPS_INSERT_A 25 -+#define R_MIPS_INSERT_B 26 -+#define R_MIPS_DELETE 27 -+#define R_MIPS_HIGHER 28 -+#define R_MIPS_HIGHEST 29 -+#define R_MIPS_CALL_HI16 30 -+#define R_MIPS_CALL_LO16 31 -+#define R_MIPS_SCN_DISP 32 -+#define R_MIPS_REL16 33 -+#define R_MIPS_ADD_IMMEDIATE 34 -+#define R_MIPS_PJUMP 35 -+#define R_MIPS_RELGOT 36 -+#define R_MIPS_JALR 37 -+#define R_MIPS_TLS_DTPMOD32 38 /* Module number 32 bit */ -+#define R_MIPS_TLS_DTPREL32 39 /* Module-relative offset 32 bit */ -+#define R_MIPS_TLS_DTPMOD64 40 /* Module number 64 bit */ -+#define R_MIPS_TLS_DTPREL64 41 /* Module-relative offset 64 bit */ -+#define R_MIPS_TLS_GD 42 /* 16 bit GOT offset for GD */ -+#define R_MIPS_TLS_LDM 43 /* 16 bit GOT offset for LDM */ -+#define R_MIPS_TLS_DTPREL_HI16 44 /* Module-relative offset, high 16 bits */ -+#define R_MIPS_TLS_DTPREL_LO16 45 /* Module-relative offset, low 16 bits */ -+#define R_MIPS_TLS_GOTTPREL 46 /* 16 bit GOT offset for IE */ -+#define R_MIPS_TLS_TPREL32 47 /* TP-relative offset, 32 bit */ -+#define R_MIPS_TLS_TPREL64 48 /* TP-relative offset, 64 bit */ -+#define R_MIPS_TLS_TPREL_HI16 49 /* TP-relative offset, high 16 bits */ -+#define R_MIPS_TLS_TPREL_LO16 50 /* TP-relative offset, low 16 bits */ -+#define R_MIPS_GLOB_DAT 51 -+#define R_MIPS_COPY 126 -+#define R_MIPS_JUMP_SLOT 127 -+/* Keep this the last entry. */ -+#define R_MIPS_NUM 128 -+ -+/* Legal values for p_type field of Elf32_Phdr. */ -+ -+#define PT_MIPS_REGINFO 0x70000000 /* Register usage information */ -+#define PT_MIPS_RTPROC 0x70000001 /* Runtime procedure table. */ -+#define PT_MIPS_OPTIONS 0x70000002 -+ -+/* Special program header types. */ -+ -+#define PF_MIPS_LOCAL 0x10000000 -+ -+/* Legal values for d_tag field of Elf32_Dyn. */ -+ -+#define DT_MIPS_RLD_VERSION 0x70000001 /* Runtime linker interface version */ -+#define DT_MIPS_TIME_STAMP 0x70000002 /* Timestamp */ -+#define DT_MIPS_ICHECKSUM 0x70000003 /* Checksum */ -+#define DT_MIPS_IVERSION 0x70000004 /* Version string (string tbl index) */ -+#define DT_MIPS_FLAGS 0x70000005 /* Flags */ -+#define DT_MIPS_BASE_ADDRESS 0x70000006 /* Base address */ -+#define DT_MIPS_MSYM 0x70000007 -+#define DT_MIPS_CONFLICT 0x70000008 /* Address of CONFLICT section */ -+#define DT_MIPS_LIBLIST 0x70000009 /* Address of LIBLIST section */ -+#define DT_MIPS_LOCAL_GOTNO 0x7000000a /* Number of local GOT entries */ -+#define DT_MIPS_CONFLICTNO 0x7000000b /* Number of CONFLICT entries */ -+#define DT_MIPS_LIBLISTNO 0x70000010 /* Number of LIBLIST entries */ -+#define DT_MIPS_SYMTABNO 0x70000011 /* Number of DYNSYM entries */ -+#define DT_MIPS_UNREFEXTNO 0x70000012 /* First external DYNSYM */ -+#define DT_MIPS_GOTSYM 0x70000013 /* First GOT entry in DYNSYM */ -+#define DT_MIPS_HIPAGENO 0x70000014 /* Number of GOT page table entries */ -+#define DT_MIPS_RLD_MAP 0x70000016 /* Address of run time loader map. */ -+#define DT_MIPS_DELTA_CLASS 0x70000017 /* Delta C++ class definition. */ -+#define DT_MIPS_DELTA_CLASS_NO 0x70000018 /* Number of entries in -+ DT_MIPS_DELTA_CLASS. */ -+#define DT_MIPS_DELTA_INSTANCE 0x70000019 /* Delta C++ class instances. */ -+#define DT_MIPS_DELTA_INSTANCE_NO 0x7000001a /* Number of entries in -+ DT_MIPS_DELTA_INSTANCE. */ -+#define DT_MIPS_DELTA_RELOC 0x7000001b /* Delta relocations. */ -+#define DT_MIPS_DELTA_RELOC_NO 0x7000001c /* Number of entries in -+ DT_MIPS_DELTA_RELOC. */ -+#define DT_MIPS_DELTA_SYM 0x7000001d /* Delta symbols that Delta -+ relocations refer to. */ -+#define DT_MIPS_DELTA_SYM_NO 0x7000001e /* Number of entries in -+ DT_MIPS_DELTA_SYM. */ -+#define DT_MIPS_DELTA_CLASSSYM 0x70000020 /* Delta symbols that hold the -+ class declaration. */ -+#define DT_MIPS_DELTA_CLASSSYM_NO 0x70000021 /* Number of entries in -+ DT_MIPS_DELTA_CLASSSYM. */ -+#define DT_MIPS_CXX_FLAGS 0x70000022 /* Flags indicating for C++ flavor. */ -+#define DT_MIPS_PIXIE_INIT 0x70000023 -+#define DT_MIPS_SYMBOL_LIB 0x70000024 -+#define DT_MIPS_LOCALPAGE_GOTIDX 0x70000025 -+#define DT_MIPS_LOCAL_GOTIDX 0x70000026 -+#define DT_MIPS_HIDDEN_GOTIDX 0x70000027 -+#define DT_MIPS_PROTECTED_GOTIDX 0x70000028 -+#define DT_MIPS_OPTIONS 0x70000029 /* Address of .options. */ -+#define DT_MIPS_INTERFACE 0x7000002a /* Address of .interface. */ -+#define DT_MIPS_DYNSTR_ALIGN 0x7000002b -+#define DT_MIPS_INTERFACE_SIZE 0x7000002c /* Size of the .interface section. */ -+#define DT_MIPS_RLD_TEXT_RESOLVE_ADDR 0x7000002d /* Address of rld_text_rsolve -+ function stored in GOT. */ -+#define DT_MIPS_PERF_SUFFIX 0x7000002e /* Default suffix of dso to be added -+ by rld on dlopen() calls. */ -+#define DT_MIPS_COMPACT_SIZE 0x7000002f /* (O32)Size of compact rel section. */ -+#define DT_MIPS_GP_VALUE 0x70000030 /* GP value for aux GOTs. */ -+#define DT_MIPS_AUX_DYNAMIC 0x70000031 /* Address of aux .dynamic. */ -+/* The address of .got.plt in an executable using the new non-PIC ABI. */ -+#define DT_MIPS_PLTGOT 0x70000032 -+/* The base of the PLT in an executable using the new non-PIC ABI if that -+ PLT is writable. For a non-writable PLT, this is omitted or has a zero -+ value. */ -+#define DT_MIPS_RWPLT 0x70000034 -+#define DT_MIPS_NUM 0x35 -+ -+/* Legal values for DT_MIPS_FLAGS Elf32_Dyn entry. */ -+ -+#define RHF_NONE 0 /* No flags */ -+#define RHF_QUICKSTART (1 << 0) /* Use quickstart */ -+#define RHF_NOTPOT (1 << 1) /* Hash size not power of 2 */ -+#define RHF_NO_LIBRARY_REPLACEMENT (1 << 2) /* Ignore LD_LIBRARY_PATH */ -+#define RHF_NO_MOVE (1 << 3) -+#define RHF_SGI_ONLY (1 << 4) -+#define RHF_GUARANTEE_INIT (1 << 5) -+#define RHF_DELTA_C_PLUS_PLUS (1 << 6) -+#define RHF_GUARANTEE_START_INIT (1 << 7) -+#define RHF_PIXIE (1 << 8) -+#define RHF_DEFAULT_DELAY_LOAD (1 << 9) -+#define RHF_REQUICKSTART (1 << 10) -+#define RHF_REQUICKSTARTED (1 << 11) -+#define RHF_CORD (1 << 12) -+#define RHF_NO_UNRES_UNDEF (1 << 13) -+#define RHF_RLD_ORDER_SAFE (1 << 14) -+ -+/* Entries found in sections of type SHT_MIPS_LIBLIST. */ -+ -+typedef struct -+{ -+ Elf32_Word l_name; /* Name (string table index) */ -+ Elf32_Word l_time_stamp; /* Timestamp */ -+ Elf32_Word l_checksum; /* Checksum */ -+ Elf32_Word l_version; /* Interface version */ -+ Elf32_Word l_flags; /* Flags */ -+} Elf32_Lib; -+ -+typedef struct -+{ -+ Elf64_Word l_name; /* Name (string table index) */ -+ Elf64_Word l_time_stamp; /* Timestamp */ -+ Elf64_Word l_checksum; /* Checksum */ -+ Elf64_Word l_version; /* Interface version */ -+ Elf64_Word l_flags; /* Flags */ -+} Elf64_Lib; -+ -+ -+/* Legal values for l_flags. */ -+ -+#define LL_NONE 0 -+#define LL_EXACT_MATCH (1 << 0) /* Require exact match */ -+#define LL_IGNORE_INT_VER (1 << 1) /* Ignore interface version */ -+#define LL_REQUIRE_MINOR (1 << 2) -+#define LL_EXPORTS (1 << 3) -+#define LL_DELAY_LOAD (1 << 4) -+#define LL_DELTA (1 << 5) -+ -+/* Entries found in sections of type SHT_MIPS_CONFLICT. */ -+ -+typedef Elf32_Addr Elf32_Conflict; -+ -+ -+/* HPPA specific definitions. */ -+ -+/* Legal values for e_flags field of Elf32_Ehdr. */ -+ -+#define EF_PARISC_TRAPNIL 0x00010000 /* Trap nil pointer dereference. */ -+#define EF_PARISC_EXT 0x00020000 /* Program uses arch. extensions. */ -+#define EF_PARISC_LSB 0x00040000 /* Program expects little endian. */ -+#define EF_PARISC_WIDE 0x00080000 /* Program expects wide mode. */ -+#define EF_PARISC_NO_KABP 0x00100000 /* No kernel assisted branch -+ prediction. */ -+#define EF_PARISC_LAZYSWAP 0x00400000 /* Allow lazy swapping. */ -+#define EF_PARISC_ARCH 0x0000ffff /* Architecture version. */ -+ -+/* Defined values for `e_flags & EF_PARISC_ARCH' are: */ -+ -+#define EFA_PARISC_1_0 0x020b /* PA-RISC 1.0 big-endian. */ -+#define EFA_PARISC_1_1 0x0210 /* PA-RISC 1.1 big-endian. */ -+#define EFA_PARISC_2_0 0x0214 /* PA-RISC 2.0 big-endian. */ -+ -+/* Additional section indeces. */ -+ -+#define SHN_PARISC_ANSI_COMMON 0xff00 /* Section for tenatively declared -+ symbols in ANSI C. */ -+#define SHN_PARISC_HUGE_COMMON 0xff01 /* Common blocks in huge model. */ -+ -+/* Legal values for sh_type field of Elf32_Shdr. */ -+ -+#define SHT_PARISC_EXT 0x70000000 /* Contains product specific ext. */ -+#define SHT_PARISC_UNWIND 0x70000001 /* Unwind information. */ -+#define SHT_PARISC_DOC 0x70000002 /* Debug info for optimized code. */ -+ -+/* Legal values for sh_flags field of Elf32_Shdr. */ -+ -+#define SHF_PARISC_SHORT 0x20000000 /* Section with short addressing. */ -+#define SHF_PARISC_HUGE 0x40000000 /* Section far from gp. */ -+#define SHF_PARISC_SBP 0x80000000 /* Static branch prediction code. */ -+ -+/* Legal values for ST_TYPE subfield of st_info (symbol type). */ -+ -+#define STT_PARISC_MILLICODE 13 /* Millicode function entry point. */ -+ -+#define STT_HP_OPAQUE (STT_LOOS + 0x1) -+#define STT_HP_STUB (STT_LOOS + 0x2) -+ -+/* HPPA relocs. */ -+ -+#define R_PARISC_NONE 0 /* No reloc. */ -+#define R_PARISC_DIR32 1 /* Direct 32-bit reference. */ -+#define R_PARISC_DIR21L 2 /* Left 21 bits of eff. address. */ -+#define R_PARISC_DIR17R 3 /* Right 17 bits of eff. address. */ -+#define R_PARISC_DIR17F 4 /* 17 bits of eff. address. */ -+#define R_PARISC_DIR14R 6 /* Right 14 bits of eff. address. */ -+#define R_PARISC_PCREL32 9 /* 32-bit rel. address. */ -+#define R_PARISC_PCREL21L 10 /* Left 21 bits of rel. address. */ -+#define R_PARISC_PCREL17R 11 /* Right 17 bits of rel. address. */ -+#define R_PARISC_PCREL17F 12 /* 17 bits of rel. address. */ -+#define R_PARISC_PCREL14R 14 /* Right 14 bits of rel. address. */ -+#define R_PARISC_DPREL21L 18 /* Left 21 bits of rel. address. */ -+#define R_PARISC_DPREL14R 22 /* Right 14 bits of rel. address. */ -+#define R_PARISC_GPREL21L 26 /* GP-relative, left 21 bits. */ -+#define R_PARISC_GPREL14R 30 /* GP-relative, right 14 bits. */ -+#define R_PARISC_LTOFF21L 34 /* LT-relative, left 21 bits. */ -+#define R_PARISC_LTOFF14R 38 /* LT-relative, right 14 bits. */ -+#define R_PARISC_SECREL32 41 /* 32 bits section rel. address. */ -+#define R_PARISC_SEGBASE 48 /* No relocation, set segment base. */ -+#define R_PARISC_SEGREL32 49 /* 32 bits segment rel. address. */ -+#define R_PARISC_PLTOFF21L 50 /* PLT rel. address, left 21 bits. */ -+#define R_PARISC_PLTOFF14R 54 /* PLT rel. address, right 14 bits. */ -+#define R_PARISC_LTOFF_FPTR32 57 /* 32 bits LT-rel. function pointer. */ -+#define R_PARISC_LTOFF_FPTR21L 58 /* LT-rel. fct ptr, left 21 bits. */ -+#define R_PARISC_LTOFF_FPTR14R 62 /* LT-rel. fct ptr, right 14 bits. */ -+#define R_PARISC_FPTR64 64 /* 64 bits function address. */ -+#define R_PARISC_PLABEL32 65 /* 32 bits function address. */ -+#define R_PARISC_PLABEL21L 66 /* Left 21 bits of fdesc address. */ -+#define R_PARISC_PLABEL14R 70 /* Right 14 bits of fdesc address. */ -+#define R_PARISC_PCREL64 72 /* 64 bits PC-rel. address. */ -+#define R_PARISC_PCREL22F 74 /* 22 bits PC-rel. address. */ -+#define R_PARISC_PCREL14WR 75 /* PC-rel. address, right 14 bits. */ -+#define R_PARISC_PCREL14DR 76 /* PC rel. address, right 14 bits. */ -+#define R_PARISC_PCREL16F 77 /* 16 bits PC-rel. address. */ -+#define R_PARISC_PCREL16WF 78 /* 16 bits PC-rel. address. */ -+#define R_PARISC_PCREL16DF 79 /* 16 bits PC-rel. address. */ -+#define R_PARISC_DIR64 80 /* 64 bits of eff. address. */ -+#define R_PARISC_DIR14WR 83 /* 14 bits of eff. address. */ -+#define R_PARISC_DIR14DR 84 /* 14 bits of eff. address. */ -+#define R_PARISC_DIR16F 85 /* 16 bits of eff. address. */ -+#define R_PARISC_DIR16WF 86 /* 16 bits of eff. address. */ -+#define R_PARISC_DIR16DF 87 /* 16 bits of eff. address. */ -+#define R_PARISC_GPREL64 88 /* 64 bits of GP-rel. address. */ -+#define R_PARISC_GPREL14WR 91 /* GP-rel. address, right 14 bits. */ -+#define R_PARISC_GPREL14DR 92 /* GP-rel. address, right 14 bits. */ -+#define R_PARISC_GPREL16F 93 /* 16 bits GP-rel. address. */ -+#define R_PARISC_GPREL16WF 94 /* 16 bits GP-rel. address. */ -+#define R_PARISC_GPREL16DF 95 /* 16 bits GP-rel. address. */ -+#define R_PARISC_LTOFF64 96 /* 64 bits LT-rel. address. */ -+#define R_PARISC_LTOFF14WR 99 /* LT-rel. address, right 14 bits. */ -+#define R_PARISC_LTOFF14DR 100 /* LT-rel. address, right 14 bits. */ -+#define R_PARISC_LTOFF16F 101 /* 16 bits LT-rel. address. */ -+#define R_PARISC_LTOFF16WF 102 /* 16 bits LT-rel. address. */ -+#define R_PARISC_LTOFF16DF 103 /* 16 bits LT-rel. address. */ -+#define R_PARISC_SECREL64 104 /* 64 bits section rel. address. */ -+#define R_PARISC_SEGREL64 112 /* 64 bits segment rel. address. */ -+#define R_PARISC_PLTOFF14WR 115 /* PLT-rel. address, right 14 bits. */ -+#define R_PARISC_PLTOFF14DR 116 /* PLT-rel. address, right 14 bits. */ -+#define R_PARISC_PLTOFF16F 117 /* 16 bits LT-rel. address. */ -+#define R_PARISC_PLTOFF16WF 118 /* 16 bits PLT-rel. address. */ -+#define R_PARISC_PLTOFF16DF 119 /* 16 bits PLT-rel. address. */ -+#define R_PARISC_LTOFF_FPTR64 120 /* 64 bits LT-rel. function ptr. */ -+#define R_PARISC_LTOFF_FPTR14WR 123 /* LT-rel. fct. ptr., right 14 bits. */ -+#define R_PARISC_LTOFF_FPTR14DR 124 /* LT-rel. fct. ptr., right 14 bits. */ -+#define R_PARISC_LTOFF_FPTR16F 125 /* 16 bits LT-rel. function ptr. */ -+#define R_PARISC_LTOFF_FPTR16WF 126 /* 16 bits LT-rel. function ptr. */ -+#define R_PARISC_LTOFF_FPTR16DF 127 /* 16 bits LT-rel. function ptr. */ -+#define R_PARISC_LORESERVE 128 -+#define R_PARISC_COPY 128 /* Copy relocation. */ -+#define R_PARISC_IPLT 129 /* Dynamic reloc, imported PLT */ -+#define R_PARISC_EPLT 130 /* Dynamic reloc, exported PLT */ -+#define R_PARISC_TPREL32 153 /* 32 bits TP-rel. address. */ -+#define R_PARISC_TPREL21L 154 /* TP-rel. address, left 21 bits. */ -+#define R_PARISC_TPREL14R 158 /* TP-rel. address, right 14 bits. */ -+#define R_PARISC_LTOFF_TP21L 162 /* LT-TP-rel. address, left 21 bits. */ -+#define R_PARISC_LTOFF_TP14R 166 /* LT-TP-rel. address, right 14 bits.*/ -+#define R_PARISC_LTOFF_TP14F 167 /* 14 bits LT-TP-rel. address. */ -+#define R_PARISC_TPREL64 216 /* 64 bits TP-rel. address. */ -+#define R_PARISC_TPREL14WR 219 /* TP-rel. address, right 14 bits. */ -+#define R_PARISC_TPREL14DR 220 /* TP-rel. address, right 14 bits. */ -+#define R_PARISC_TPREL16F 221 /* 16 bits TP-rel. address. */ -+#define R_PARISC_TPREL16WF 222 /* 16 bits TP-rel. address. */ -+#define R_PARISC_TPREL16DF 223 /* 16 bits TP-rel. address. */ -+#define R_PARISC_LTOFF_TP64 224 /* 64 bits LT-TP-rel. address. */ -+#define R_PARISC_LTOFF_TP14WR 227 /* LT-TP-rel. address, right 14 bits.*/ -+#define R_PARISC_LTOFF_TP14DR 228 /* LT-TP-rel. address, right 14 bits.*/ -+#define R_PARISC_LTOFF_TP16F 229 /* 16 bits LT-TP-rel. address. */ -+#define R_PARISC_LTOFF_TP16WF 230 /* 16 bits LT-TP-rel. address. */ -+#define R_PARISC_LTOFF_TP16DF 231 /* 16 bits LT-TP-rel. address. */ -+#define R_PARISC_GNU_VTENTRY 232 -+#define R_PARISC_GNU_VTINHERIT 233 -+#define R_PARISC_TLS_GD21L 234 /* GD 21-bit left. */ -+#define R_PARISC_TLS_GD14R 235 /* GD 14-bit right. */ -+#define R_PARISC_TLS_GDCALL 236 /* GD call to __t_g_a. */ -+#define R_PARISC_TLS_LDM21L 237 /* LD module 21-bit left. */ -+#define R_PARISC_TLS_LDM14R 238 /* LD module 14-bit right. */ -+#define R_PARISC_TLS_LDMCALL 239 /* LD module call to __t_g_a. */ -+#define R_PARISC_TLS_LDO21L 240 /* LD offset 21-bit left. */ -+#define R_PARISC_TLS_LDO14R 241 /* LD offset 14-bit right. */ -+#define R_PARISC_TLS_DTPMOD32 242 /* DTP module 32-bit. */ -+#define R_PARISC_TLS_DTPMOD64 243 /* DTP module 64-bit. */ -+#define R_PARISC_TLS_DTPOFF32 244 /* DTP offset 32-bit. */ -+#define R_PARISC_TLS_DTPOFF64 245 /* DTP offset 32-bit. */ -+#define R_PARISC_TLS_LE21L R_PARISC_TPREL21L -+#define R_PARISC_TLS_LE14R R_PARISC_TPREL14R -+#define R_PARISC_TLS_IE21L R_PARISC_LTOFF_TP21L -+#define R_PARISC_TLS_IE14R R_PARISC_LTOFF_TP14R -+#define R_PARISC_TLS_TPREL32 R_PARISC_TPREL32 -+#define R_PARISC_TLS_TPREL64 R_PARISC_TPREL64 -+#define R_PARISC_HIRESERVE 255 -+ -+/* Legal values for p_type field of Elf32_Phdr/Elf64_Phdr. */ -+ -+#define PT_HP_TLS (PT_LOOS + 0x0) -+#define PT_HP_CORE_NONE (PT_LOOS + 0x1) -+#define PT_HP_CORE_VERSION (PT_LOOS + 0x2) -+#define PT_HP_CORE_KERNEL (PT_LOOS + 0x3) -+#define PT_HP_CORE_COMM (PT_LOOS + 0x4) -+#define PT_HP_CORE_PROC (PT_LOOS + 0x5) -+#define PT_HP_CORE_LOADABLE (PT_LOOS + 0x6) -+#define PT_HP_CORE_STACK (PT_LOOS + 0x7) -+#define PT_HP_CORE_SHM (PT_LOOS + 0x8) -+#define PT_HP_CORE_MMF (PT_LOOS + 0x9) -+#define PT_HP_PARALLEL (PT_LOOS + 0x10) -+#define PT_HP_FASTBIND (PT_LOOS + 0x11) -+#define PT_HP_OPT_ANNOT (PT_LOOS + 0x12) -+#define PT_HP_HSL_ANNOT (PT_LOOS + 0x13) -+#define PT_HP_STACK (PT_LOOS + 0x14) -+ -+#define PT_PARISC_ARCHEXT 0x70000000 -+#define PT_PARISC_UNWIND 0x70000001 -+ -+/* Legal values for p_flags field of Elf32_Phdr/Elf64_Phdr. */ -+ -+#define PF_PARISC_SBP 0x08000000 -+ -+#define PF_HP_PAGE_SIZE 0x00100000 -+#define PF_HP_FAR_SHARED 0x00200000 -+#define PF_HP_NEAR_SHARED 0x00400000 -+#define PF_HP_CODE 0x01000000 -+#define PF_HP_MODIFY 0x02000000 -+#define PF_HP_LAZYSWAP 0x04000000 -+#define PF_HP_SBP 0x08000000 -+ -+ -+/* Alpha specific definitions. */ -+ -+/* Legal values for e_flags field of Elf64_Ehdr. */ -+ -+#define EF_ALPHA_32BIT 1 /* All addresses must be < 2GB. */ -+#define EF_ALPHA_CANRELAX 2 /* Relocations for relaxing exist. */ -+ -+/* Legal values for sh_type field of Elf64_Shdr. */ -+ -+/* These two are primerily concerned with ECOFF debugging info. */ -+#define SHT_ALPHA_DEBUG 0x70000001 -+#define SHT_ALPHA_REGINFO 0x70000002 -+ -+/* Legal values for sh_flags field of Elf64_Shdr. */ -+ -+#define SHF_ALPHA_GPREL 0x10000000 -+ -+/* Legal values for st_other field of Elf64_Sym. */ -+#define STO_ALPHA_NOPV 0x80 /* No PV required. */ -+#define STO_ALPHA_STD_GPLOAD 0x88 /* PV only used for initial ldgp. */ -+ -+/* Alpha relocs. */ -+ -+#define R_ALPHA_NONE 0 /* No reloc */ -+#define R_ALPHA_REFLONG 1 /* Direct 32 bit */ -+#define R_ALPHA_REFQUAD 2 /* Direct 64 bit */ -+#define R_ALPHA_GPREL32 3 /* GP relative 32 bit */ -+#define R_ALPHA_LITERAL 4 /* GP relative 16 bit w/optimization */ -+#define R_ALPHA_LITUSE 5 /* Optimization hint for LITERAL */ -+#define R_ALPHA_GPDISP 6 /* Add displacement to GP */ -+#define R_ALPHA_BRADDR 7 /* PC+4 relative 23 bit shifted */ -+#define R_ALPHA_HINT 8 /* PC+4 relative 16 bit shifted */ -+#define R_ALPHA_SREL16 9 /* PC relative 16 bit */ -+#define R_ALPHA_SREL32 10 /* PC relative 32 bit */ -+#define R_ALPHA_SREL64 11 /* PC relative 64 bit */ -+#define R_ALPHA_GPRELHIGH 17 /* GP relative 32 bit, high 16 bits */ -+#define R_ALPHA_GPRELLOW 18 /* GP relative 32 bit, low 16 bits */ -+#define R_ALPHA_GPREL16 19 /* GP relative 16 bit */ -+#define R_ALPHA_COPY 24 /* Copy symbol at runtime */ -+#define R_ALPHA_GLOB_DAT 25 /* Create GOT entry */ -+#define R_ALPHA_JMP_SLOT 26 /* Create PLT entry */ -+#define R_ALPHA_RELATIVE 27 /* Adjust by program base */ -+#define R_ALPHA_TLS_GD_HI 28 -+#define R_ALPHA_TLSGD 29 -+#define R_ALPHA_TLS_LDM 30 -+#define R_ALPHA_DTPMOD64 31 -+#define R_ALPHA_GOTDTPREL 32 -+#define R_ALPHA_DTPREL64 33 -+#define R_ALPHA_DTPRELHI 34 -+#define R_ALPHA_DTPRELLO 35 -+#define R_ALPHA_DTPREL16 36 -+#define R_ALPHA_GOTTPREL 37 -+#define R_ALPHA_TPREL64 38 -+#define R_ALPHA_TPRELHI 39 -+#define R_ALPHA_TPRELLO 40 -+#define R_ALPHA_TPREL16 41 -+/* Keep this the last entry. */ -+#define R_ALPHA_NUM 46 -+ -+/* Magic values of the LITUSE relocation addend. */ -+#define LITUSE_ALPHA_ADDR 0 -+#define LITUSE_ALPHA_BASE 1 -+#define LITUSE_ALPHA_BYTOFF 2 -+#define LITUSE_ALPHA_JSR 3 -+#define LITUSE_ALPHA_TLS_GD 4 -+#define LITUSE_ALPHA_TLS_LDM 5 -+ -+/* Legal values for d_tag of Elf64_Dyn. */ -+#define DT_ALPHA_PLTRO (DT_LOPROC + 0) -+#define DT_ALPHA_NUM 1 -+ -+/* PowerPC specific declarations */ -+ -+/* Values for Elf32/64_Ehdr.e_flags. */ -+#define EF_PPC_EMB 0x80000000 /* PowerPC embedded flag */ -+ -+/* Cygnus local bits below */ -+#define EF_PPC_RELOCATABLE 0x00010000 /* PowerPC -mrelocatable flag*/ -+#define EF_PPC_RELOCATABLE_LIB 0x00008000 /* PowerPC -mrelocatable-lib -+ flag */ -+ -+/* PowerPC relocations defined by the ABIs */ -+#define R_PPC_NONE 0 -+#define R_PPC_ADDR32 1 /* 32bit absolute address */ -+#define R_PPC_ADDR24 2 /* 26bit address, 2 bits ignored. */ -+#define R_PPC_ADDR16 3 /* 16bit absolute address */ -+#define R_PPC_ADDR16_LO 4 /* lower 16bit of absolute address */ -+#define R_PPC_ADDR16_HI 5 /* high 16bit of absolute address */ -+#define R_PPC_ADDR16_HA 6 /* adjusted high 16bit */ -+#define R_PPC_ADDR14 7 /* 16bit address, 2 bits ignored */ -+#define R_PPC_ADDR14_BRTAKEN 8 -+#define R_PPC_ADDR14_BRNTAKEN 9 -+#define R_PPC_REL24 10 /* PC relative 26 bit */ -+#define R_PPC_REL14 11 /* PC relative 16 bit */ -+#define R_PPC_REL14_BRTAKEN 12 -+#define R_PPC_REL14_BRNTAKEN 13 -+#define R_PPC_GOT16 14 -+#define R_PPC_GOT16_LO 15 -+#define R_PPC_GOT16_HI 16 -+#define R_PPC_GOT16_HA 17 -+#define R_PPC_PLTREL24 18 -+#define R_PPC_COPY 19 -+#define R_PPC_GLOB_DAT 20 -+#define R_PPC_JMP_SLOT 21 -+#define R_PPC_RELATIVE 22 -+#define R_PPC_LOCAL24PC 23 -+#define R_PPC_UADDR32 24 -+#define R_PPC_UADDR16 25 -+#define R_PPC_REL32 26 -+#define R_PPC_PLT32 27 -+#define R_PPC_PLTREL32 28 -+#define R_PPC_PLT16_LO 29 -+#define R_PPC_PLT16_HI 30 -+#define R_PPC_PLT16_HA 31 -+#define R_PPC_SDAREL16 32 -+#define R_PPC_SECTOFF 33 -+#define R_PPC_SECTOFF_LO 34 -+#define R_PPC_SECTOFF_HI 35 -+#define R_PPC_SECTOFF_HA 36 -+ -+/* PowerPC relocations defined for the TLS access ABI. */ -+#define R_PPC_TLS 67 /* none (sym+add)@tls */ -+#define R_PPC_DTPMOD32 68 /* word32 (sym+add)@dtpmod */ -+#define R_PPC_TPREL16 69 /* half16* (sym+add)@tprel */ -+#define R_PPC_TPREL16_LO 70 /* half16 (sym+add)@tprel@l */ -+#define R_PPC_TPREL16_HI 71 /* half16 (sym+add)@tprel@h */ -+#define R_PPC_TPREL16_HA 72 /* half16 (sym+add)@tprel@ha */ -+#define R_PPC_TPREL32 73 /* word32 (sym+add)@tprel */ -+#define R_PPC_DTPREL16 74 /* half16* (sym+add)@dtprel */ -+#define R_PPC_DTPREL16_LO 75 /* half16 (sym+add)@dtprel@l */ -+#define R_PPC_DTPREL16_HI 76 /* half16 (sym+add)@dtprel@h */ -+#define R_PPC_DTPREL16_HA 77 /* half16 (sym+add)@dtprel@ha */ -+#define R_PPC_DTPREL32 78 /* word32 (sym+add)@dtprel */ -+#define R_PPC_GOT_TLSGD16 79 /* half16* (sym+add)@got@tlsgd */ -+#define R_PPC_GOT_TLSGD16_LO 80 /* half16 (sym+add)@got@tlsgd@l */ -+#define R_PPC_GOT_TLSGD16_HI 81 /* half16 (sym+add)@got@tlsgd@h */ -+#define R_PPC_GOT_TLSGD16_HA 82 /* half16 (sym+add)@got@tlsgd@ha */ -+#define R_PPC_GOT_TLSLD16 83 /* half16* (sym+add)@got@tlsld */ -+#define R_PPC_GOT_TLSLD16_LO 84 /* half16 (sym+add)@got@tlsld@l */ -+#define R_PPC_GOT_TLSLD16_HI 85 /* half16 (sym+add)@got@tlsld@h */ -+#define R_PPC_GOT_TLSLD16_HA 86 /* half16 (sym+add)@got@tlsld@ha */ -+#define R_PPC_GOT_TPREL16 87 /* half16* (sym+add)@got@tprel */ -+#define R_PPC_GOT_TPREL16_LO 88 /* half16 (sym+add)@got@tprel@l */ -+#define R_PPC_GOT_TPREL16_HI 89 /* half16 (sym+add)@got@tprel@h */ -+#define R_PPC_GOT_TPREL16_HA 90 /* half16 (sym+add)@got@tprel@ha */ -+#define R_PPC_GOT_DTPREL16 91 /* half16* (sym+add)@got@dtprel */ -+#define R_PPC_GOT_DTPREL16_LO 92 /* half16* (sym+add)@got@dtprel@l */ -+#define R_PPC_GOT_DTPREL16_HI 93 /* half16* (sym+add)@got@dtprel@h */ -+#define R_PPC_GOT_DTPREL16_HA 94 /* half16* (sym+add)@got@dtprel@ha */ -+ -+/* The remaining relocs are from the Embedded ELF ABI, and are not -+ in the SVR4 ELF ABI. */ -+#define R_PPC_EMB_NADDR32 101 -+#define R_PPC_EMB_NADDR16 102 -+#define R_PPC_EMB_NADDR16_LO 103 -+#define R_PPC_EMB_NADDR16_HI 104 -+#define R_PPC_EMB_NADDR16_HA 105 -+#define R_PPC_EMB_SDAI16 106 -+#define R_PPC_EMB_SDA2I16 107 -+#define R_PPC_EMB_SDA2REL 108 -+#define R_PPC_EMB_SDA21 109 /* 16 bit offset in SDA */ -+#define R_PPC_EMB_MRKREF 110 -+#define R_PPC_EMB_RELSEC16 111 -+#define R_PPC_EMB_RELST_LO 112 -+#define R_PPC_EMB_RELST_HI 113 -+#define R_PPC_EMB_RELST_HA 114 -+#define R_PPC_EMB_BIT_FLD 115 -+#define R_PPC_EMB_RELSDA 116 /* 16 bit relative offset in SDA */ -+ -+/* Diab tool relocations. */ -+#define R_PPC_DIAB_SDA21_LO 180 /* like EMB_SDA21, but lower 16 bit */ -+#define R_PPC_DIAB_SDA21_HI 181 /* like EMB_SDA21, but high 16 bit */ -+#define R_PPC_DIAB_SDA21_HA 182 /* like EMB_SDA21, adjusted high 16 */ -+#define R_PPC_DIAB_RELSDA_LO 183 /* like EMB_RELSDA, but lower 16 bit */ -+#define R_PPC_DIAB_RELSDA_HI 184 /* like EMB_RELSDA, but high 16 bit */ -+#define R_PPC_DIAB_RELSDA_HA 185 /* like EMB_RELSDA, adjusted high 16 */ -+ -+/* GNU extension to support local ifunc. */ -+#define R_PPC_IRELATIVE 248 -+ -+/* GNU relocs used in PIC code sequences. */ -+#define R_PPC_REL16 249 /* half16 (sym+add-.) */ -+#define R_PPC_REL16_LO 250 /* half16 (sym+add-.)@l */ -+#define R_PPC_REL16_HI 251 /* half16 (sym+add-.)@h */ -+#define R_PPC_REL16_HA 252 /* half16 (sym+add-.)@ha */ -+ -+/* This is a phony reloc to handle any old fashioned TOC16 references -+ that may still be in object files. */ -+#define R_PPC_TOC16 255 -+ -+/* PowerPC specific values for the Dyn d_tag field. */ -+#define DT_PPC_GOT (DT_LOPROC + 0) -+#define DT_PPC_NUM 1 -+ -+/* PowerPC64 relocations defined by the ABIs */ -+#define R_PPC64_NONE R_PPC_NONE -+#define R_PPC64_ADDR32 R_PPC_ADDR32 /* 32bit absolute address */ -+#define R_PPC64_ADDR24 R_PPC_ADDR24 /* 26bit address, word aligned */ -+#define R_PPC64_ADDR16 R_PPC_ADDR16 /* 16bit absolute address */ -+#define R_PPC64_ADDR16_LO R_PPC_ADDR16_LO /* lower 16bits of address */ -+#define R_PPC64_ADDR16_HI R_PPC_ADDR16_HI /* high 16bits of address. */ -+#define R_PPC64_ADDR16_HA R_PPC_ADDR16_HA /* adjusted high 16bits. */ -+#define R_PPC64_ADDR14 R_PPC_ADDR14 /* 16bit address, word aligned */ -+#define R_PPC64_ADDR14_BRTAKEN R_PPC_ADDR14_BRTAKEN -+#define R_PPC64_ADDR14_BRNTAKEN R_PPC_ADDR14_BRNTAKEN -+#define R_PPC64_REL24 R_PPC_REL24 /* PC-rel. 26 bit, word aligned */ -+#define R_PPC64_REL14 R_PPC_REL14 /* PC relative 16 bit */ -+#define R_PPC64_REL14_BRTAKEN R_PPC_REL14_BRTAKEN -+#define R_PPC64_REL14_BRNTAKEN R_PPC_REL14_BRNTAKEN -+#define R_PPC64_GOT16 R_PPC_GOT16 -+#define R_PPC64_GOT16_LO R_PPC_GOT16_LO -+#define R_PPC64_GOT16_HI R_PPC_GOT16_HI -+#define R_PPC64_GOT16_HA R_PPC_GOT16_HA -+ -+#define R_PPC64_COPY R_PPC_COPY -+#define R_PPC64_GLOB_DAT R_PPC_GLOB_DAT -+#define R_PPC64_JMP_SLOT R_PPC_JMP_SLOT -+#define R_PPC64_RELATIVE R_PPC_RELATIVE -+ -+#define R_PPC64_UADDR32 R_PPC_UADDR32 -+#define R_PPC64_UADDR16 R_PPC_UADDR16 -+#define R_PPC64_REL32 R_PPC_REL32 -+#define R_PPC64_PLT32 R_PPC_PLT32 -+#define R_PPC64_PLTREL32 R_PPC_PLTREL32 -+#define R_PPC64_PLT16_LO R_PPC_PLT16_LO -+#define R_PPC64_PLT16_HI R_PPC_PLT16_HI -+#define R_PPC64_PLT16_HA R_PPC_PLT16_HA -+ -+#define R_PPC64_SECTOFF R_PPC_SECTOFF -+#define R_PPC64_SECTOFF_LO R_PPC_SECTOFF_LO -+#define R_PPC64_SECTOFF_HI R_PPC_SECTOFF_HI -+#define R_PPC64_SECTOFF_HA R_PPC_SECTOFF_HA -+#define R_PPC64_ADDR30 37 /* word30 (S + A - P) >> 2 */ -+#define R_PPC64_ADDR64 38 /* doubleword64 S + A */ -+#define R_PPC64_ADDR16_HIGHER 39 /* half16 #higher(S + A) */ -+#define R_PPC64_ADDR16_HIGHERA 40 /* half16 #highera(S + A) */ -+#define R_PPC64_ADDR16_HIGHEST 41 /* half16 #highest(S + A) */ -+#define R_PPC64_ADDR16_HIGHESTA 42 /* half16 #highesta(S + A) */ -+#define R_PPC64_UADDR64 43 /* doubleword64 S + A */ -+#define R_PPC64_REL64 44 /* doubleword64 S + A - P */ -+#define R_PPC64_PLT64 45 /* doubleword64 L + A */ -+#define R_PPC64_PLTREL64 46 /* doubleword64 L + A - P */ -+#define R_PPC64_TOC16 47 /* half16* S + A - .TOC */ -+#define R_PPC64_TOC16_LO 48 /* half16 #lo(S + A - .TOC.) */ -+#define R_PPC64_TOC16_HI 49 /* half16 #hi(S + A - .TOC.) */ -+#define R_PPC64_TOC16_HA 50 /* half16 #ha(S + A - .TOC.) */ -+#define R_PPC64_TOC 51 /* doubleword64 .TOC */ -+#define R_PPC64_PLTGOT16 52 /* half16* M + A */ -+#define R_PPC64_PLTGOT16_LO 53 /* half16 #lo(M + A) */ -+#define R_PPC64_PLTGOT16_HI 54 /* half16 #hi(M + A) */ -+#define R_PPC64_PLTGOT16_HA 55 /* half16 #ha(M + A) */ -+ -+#define R_PPC64_ADDR16_DS 56 /* half16ds* (S + A) >> 2 */ -+#define R_PPC64_ADDR16_LO_DS 57 /* half16ds #lo(S + A) >> 2 */ -+#define R_PPC64_GOT16_DS 58 /* half16ds* (G + A) >> 2 */ -+#define R_PPC64_GOT16_LO_DS 59 /* half16ds #lo(G + A) >> 2 */ -+#define R_PPC64_PLT16_LO_DS 60 /* half16ds #lo(L + A) >> 2 */ -+#define R_PPC64_SECTOFF_DS 61 /* half16ds* (R + A) >> 2 */ -+#define R_PPC64_SECTOFF_LO_DS 62 /* half16ds #lo(R + A) >> 2 */ -+#define R_PPC64_TOC16_DS 63 /* half16ds* (S + A - .TOC.) >> 2 */ -+#define R_PPC64_TOC16_LO_DS 64 /* half16ds #lo(S + A - .TOC.) >> 2 */ -+#define R_PPC64_PLTGOT16_DS 65 /* half16ds* (M + A) >> 2 */ -+#define R_PPC64_PLTGOT16_LO_DS 66 /* half16ds #lo(M + A) >> 2 */ -+ -+/* PowerPC64 relocations defined for the TLS access ABI. */ -+#define R_PPC64_TLS 67 /* none (sym+add)@tls */ -+#define R_PPC64_DTPMOD64 68 /* doubleword64 (sym+add)@dtpmod */ -+#define R_PPC64_TPREL16 69 /* half16* (sym+add)@tprel */ -+#define R_PPC64_TPREL16_LO 70 /* half16 (sym+add)@tprel@l */ -+#define R_PPC64_TPREL16_HI 71 /* half16 (sym+add)@tprel@h */ -+#define R_PPC64_TPREL16_HA 72 /* half16 (sym+add)@tprel@ha */ -+#define R_PPC64_TPREL64 73 /* doubleword64 (sym+add)@tprel */ -+#define R_PPC64_DTPREL16 74 /* half16* (sym+add)@dtprel */ -+#define R_PPC64_DTPREL16_LO 75 /* half16 (sym+add)@dtprel@l */ -+#define R_PPC64_DTPREL16_HI 76 /* half16 (sym+add)@dtprel@h */ -+#define R_PPC64_DTPREL16_HA 77 /* half16 (sym+add)@dtprel@ha */ -+#define R_PPC64_DTPREL64 78 /* doubleword64 (sym+add)@dtprel */ -+#define R_PPC64_GOT_TLSGD16 79 /* half16* (sym+add)@got@tlsgd */ -+#define R_PPC64_GOT_TLSGD16_LO 80 /* half16 (sym+add)@got@tlsgd@l */ -+#define R_PPC64_GOT_TLSGD16_HI 81 /* half16 (sym+add)@got@tlsgd@h */ -+#define R_PPC64_GOT_TLSGD16_HA 82 /* half16 (sym+add)@got@tlsgd@ha */ -+#define R_PPC64_GOT_TLSLD16 83 /* half16* (sym+add)@got@tlsld */ -+#define R_PPC64_GOT_TLSLD16_LO 84 /* half16 (sym+add)@got@tlsld@l */ -+#define R_PPC64_GOT_TLSLD16_HI 85 /* half16 (sym+add)@got@tlsld@h */ -+#define R_PPC64_GOT_TLSLD16_HA 86 /* half16 (sym+add)@got@tlsld@ha */ -+#define R_PPC64_GOT_TPREL16_DS 87 /* half16ds* (sym+add)@got@tprel */ -+#define R_PPC64_GOT_TPREL16_LO_DS 88 /* half16ds (sym+add)@got@tprel@l */ -+#define R_PPC64_GOT_TPREL16_HI 89 /* half16 (sym+add)@got@tprel@h */ -+#define R_PPC64_GOT_TPREL16_HA 90 /* half16 (sym+add)@got@tprel@ha */ -+#define R_PPC64_GOT_DTPREL16_DS 91 /* half16ds* (sym+add)@got@dtprel */ -+#define R_PPC64_GOT_DTPREL16_LO_DS 92 /* half16ds (sym+add)@got@dtprel@l */ -+#define R_PPC64_GOT_DTPREL16_HI 93 /* half16 (sym+add)@got@dtprel@h */ -+#define R_PPC64_GOT_DTPREL16_HA 94 /* half16 (sym+add)@got@dtprel@ha */ -+#define R_PPC64_TPREL16_DS 95 /* half16ds* (sym+add)@tprel */ -+#define R_PPC64_TPREL16_LO_DS 96 /* half16ds (sym+add)@tprel@l */ -+#define R_PPC64_TPREL16_HIGHER 97 /* half16 (sym+add)@tprel@higher */ -+#define R_PPC64_TPREL16_HIGHERA 98 /* half16 (sym+add)@tprel@highera */ -+#define R_PPC64_TPREL16_HIGHEST 99 /* half16 (sym+add)@tprel@highest */ -+#define R_PPC64_TPREL16_HIGHESTA 100 /* half16 (sym+add)@tprel@highesta */ -+#define R_PPC64_DTPREL16_DS 101 /* half16ds* (sym+add)@dtprel */ -+#define R_PPC64_DTPREL16_LO_DS 102 /* half16ds (sym+add)@dtprel@l */ -+#define R_PPC64_DTPREL16_HIGHER 103 /* half16 (sym+add)@dtprel@higher */ -+#define R_PPC64_DTPREL16_HIGHERA 104 /* half16 (sym+add)@dtprel@highera */ -+#define R_PPC64_DTPREL16_HIGHEST 105 /* half16 (sym+add)@dtprel@highest */ -+#define R_PPC64_DTPREL16_HIGHESTA 106 /* half16 (sym+add)@dtprel@highesta */ -+ -+/* GNU extension to support local ifunc. */ -+#define R_PPC64_JMP_IREL 247 -+#define R_PPC64_IRELATIVE 248 -+#define R_PPC64_REL16 249 /* half16 (sym+add-.) */ -+#define R_PPC64_REL16_LO 250 /* half16 (sym+add-.)@l */ -+#define R_PPC64_REL16_HI 251 /* half16 (sym+add-.)@h */ -+#define R_PPC64_REL16_HA 252 /* half16 (sym+add-.)@ha */ -+ -+/* PowerPC64 specific values for the Dyn d_tag field. */ -+#define DT_PPC64_GLINK (DT_LOPROC + 0) -+#define DT_PPC64_OPD (DT_LOPROC + 1) -+#define DT_PPC64_OPDSZ (DT_LOPROC + 2) -+#define DT_PPC64_NUM 3 -+ -+ -+/* ARM specific declarations */ -+ -+/* Processor specific flags for the ELF header e_flags field. */ -+#define EF_ARM_RELEXEC 0x01 -+#define EF_ARM_HASENTRY 0x02 -+#define EF_ARM_INTERWORK 0x04 -+#define EF_ARM_APCS_26 0x08 -+#define EF_ARM_APCS_FLOAT 0x10 -+#define EF_ARM_PIC 0x20 -+#define EF_ARM_ALIGN8 0x40 /* 8-bit structure alignment is in use */ -+#define EF_ARM_NEW_ABI 0x80 -+#define EF_ARM_OLD_ABI 0x100 -+#define EF_ARM_SOFT_FLOAT 0x200 -+#define EF_ARM_VFP_FLOAT 0x400 -+#define EF_ARM_MAVERICK_FLOAT 0x800 -+ -+ -+/* Other constants defined in the ARM ELF spec. version B-01. */ -+/* NB. These conflict with values defined above. */ -+#define EF_ARM_SYMSARESORTED 0x04 -+#define EF_ARM_DYNSYMSUSESEGIDX 0x08 -+#define EF_ARM_MAPSYMSFIRST 0x10 -+#define EF_ARM_EABIMASK 0XFF000000 -+ -+/* Constants defined in AAELF. */ -+#define EF_ARM_BE8 0x00800000 -+#define EF_ARM_LE8 0x00400000 -+ -+#define EF_ARM_EABI_VERSION(flags) ((flags) & EF_ARM_EABIMASK) -+#define EF_ARM_EABI_UNKNOWN 0x00000000 -+#define EF_ARM_EABI_VER1 0x01000000 -+#define EF_ARM_EABI_VER2 0x02000000 -+#define EF_ARM_EABI_VER3 0x03000000 -+#define EF_ARM_EABI_VER4 0x04000000 -+#define EF_ARM_EABI_VER5 0x05000000 -+ -+/* Additional symbol types for Thumb. */ -+#define STT_ARM_TFUNC STT_LOPROC /* A Thumb function. */ -+#define STT_ARM_16BIT STT_HIPROC /* A Thumb label. */ -+ -+/* ARM-specific values for sh_flags */ -+#define SHF_ARM_ENTRYSECT 0x10000000 /* Section contains an entry point */ -+#define SHF_ARM_COMDEF 0x80000000 /* Section may be multiply defined -+ in the input to a link step. */ -+ -+/* ARM-specific program header flags */ -+#define PF_ARM_SB 0x10000000 /* Segment contains the location -+ addressed by the static base. */ -+#define PF_ARM_PI 0x20000000 /* Position-independent segment. */ -+#define PF_ARM_ABS 0x40000000 /* Absolute segment. */ -+ -+/* Processor specific values for the Phdr p_type field. */ -+#define PT_ARM_EXIDX (PT_LOPROC + 1) /* ARM unwind segment. */ -+ -+/* Processor specific values for the Shdr sh_type field. */ -+#define SHT_ARM_EXIDX (SHT_LOPROC + 1) /* ARM unwind section. */ -+#define SHT_ARM_PREEMPTMAP (SHT_LOPROC + 2) /* Preemption details. */ -+#define SHT_ARM_ATTRIBUTES (SHT_LOPROC + 3) /* ARM attributes section. */ -+ -+ -+/* ARM relocs. */ -+ -+#define R_ARM_NONE 0 /* No reloc */ -+#define R_ARM_PC24 1 /* PC relative 26 bit branch */ -+#define R_ARM_ABS32 2 /* Direct 32 bit */ -+#define R_ARM_REL32 3 /* PC relative 32 bit */ -+#define R_ARM_PC13 4 -+#define R_ARM_ABS16 5 /* Direct 16 bit */ -+#define R_ARM_ABS12 6 /* Direct 12 bit */ -+#define R_ARM_THM_ABS5 7 -+#define R_ARM_ABS8 8 /* Direct 8 bit */ -+#define R_ARM_SBREL32 9 -+#define R_ARM_THM_PC22 10 -+#define R_ARM_THM_PC8 11 -+#define R_ARM_AMP_VCALL9 12 -+#define R_ARM_SWI24 13 /* Obsolete static relocation. */ -+#define R_ARM_TLS_DESC 13 /* Dynamic relocation. */ -+#define R_ARM_THM_SWI8 14 -+#define R_ARM_XPC25 15 -+#define R_ARM_THM_XPC22 16 -+#define R_ARM_TLS_DTPMOD32 17 /* ID of module containing symbol */ -+#define R_ARM_TLS_DTPOFF32 18 /* Offset in TLS block */ -+#define R_ARM_TLS_TPOFF32 19 /* Offset in static TLS block */ -+#define R_ARM_COPY 20 /* Copy symbol at runtime */ -+#define R_ARM_GLOB_DAT 21 /* Create GOT entry */ -+#define R_ARM_JUMP_SLOT 22 /* Create PLT entry */ -+#define R_ARM_RELATIVE 23 /* Adjust by program base */ -+#define R_ARM_GOTOFF 24 /* 32 bit offset to GOT */ -+#define R_ARM_GOTPC 25 /* 32 bit PC relative offset to GOT */ -+#define R_ARM_GOT32 26 /* 32 bit GOT entry */ -+#define R_ARM_PLT32 27 /* 32 bit PLT address */ -+#define R_ARM_ALU_PCREL_7_0 32 -+#define R_ARM_ALU_PCREL_15_8 33 -+#define R_ARM_ALU_PCREL_23_15 34 -+#define R_ARM_LDR_SBREL_11_0 35 -+#define R_ARM_ALU_SBREL_19_12 36 -+#define R_ARM_ALU_SBREL_27_20 37 -+#define R_ARM_TLS_GOTDESC 90 -+#define R_ARM_TLS_CALL 91 -+#define R_ARM_TLS_DESCSEQ 92 -+#define R_ARM_THM_TLS_CALL 93 -+#define R_ARM_GNU_VTENTRY 100 -+#define R_ARM_GNU_VTINHERIT 101 -+#define R_ARM_THM_PC11 102 /* thumb unconditional branch */ -+#define R_ARM_THM_PC9 103 /* thumb conditional branch */ -+#define R_ARM_TLS_GD32 104 /* PC-rel 32 bit for global dynamic -+ thread local data */ -+#define R_ARM_TLS_LDM32 105 /* PC-rel 32 bit for local dynamic -+ thread local data */ -+#define R_ARM_TLS_LDO32 106 /* 32 bit offset relative to TLS -+ block */ -+#define R_ARM_TLS_IE32 107 /* PC-rel 32 bit for GOT entry of -+ static TLS block offset */ -+#define R_ARM_TLS_LE32 108 /* 32 bit offset relative to static -+ TLS block */ -+#define R_ARM_THM_TLS_DESCSEQ 129 -+#define R_ARM_IRELATIVE 160 -+#define R_ARM_RXPC25 249 -+#define R_ARM_RSBREL32 250 -+#define R_ARM_THM_RPC22 251 -+#define R_ARM_RREL32 252 -+#define R_ARM_RABS22 253 -+#define R_ARM_RPC24 254 -+#define R_ARM_RBASE 255 -+/* Keep this the last entry. */ -+#define R_ARM_NUM 256 -+ -+/* IA-64 specific declarations. */ -+ -+/* Processor specific flags for the Ehdr e_flags field. */ -+#define EF_IA_64_MASKOS 0x0000000f /* os-specific flags */ -+#define EF_IA_64_ABI64 0x00000010 /* 64-bit ABI */ -+#define EF_IA_64_ARCH 0xff000000 /* arch. version mask */ -+ -+/* Processor specific values for the Phdr p_type field. */ -+#define PT_IA_64_ARCHEXT (PT_LOPROC + 0) /* arch extension bits */ -+#define PT_IA_64_UNWIND (PT_LOPROC + 1) /* ia64 unwind bits */ -+#define PT_IA_64_HP_OPT_ANOT (PT_LOOS + 0x12) -+#define PT_IA_64_HP_HSL_ANOT (PT_LOOS + 0x13) -+#define PT_IA_64_HP_STACK (PT_LOOS + 0x14) -+ -+/* Processor specific flags for the Phdr p_flags field. */ -+#define PF_IA_64_NORECOV 0x80000000 /* spec insns w/o recovery */ -+ -+/* Processor specific values for the Shdr sh_type field. */ -+#define SHT_IA_64_EXT (SHT_LOPROC + 0) /* extension bits */ -+#define SHT_IA_64_UNWIND (SHT_LOPROC + 1) /* unwind bits */ -+ -+/* Processor specific flags for the Shdr sh_flags field. */ -+#define SHF_IA_64_SHORT 0x10000000 /* section near gp */ -+#define SHF_IA_64_NORECOV 0x20000000 /* spec insns w/o recovery */ -+ -+/* Processor specific values for the Dyn d_tag field. */ -+#define DT_IA_64_PLT_RESERVE (DT_LOPROC + 0) -+#define DT_IA_64_NUM 1 -+ -+/* IA-64 relocations. */ -+#define R_IA64_NONE 0x00 /* none */ -+#define R_IA64_IMM14 0x21 /* symbol + addend, add imm14 */ -+#define R_IA64_IMM22 0x22 /* symbol + addend, add imm22 */ -+#define R_IA64_IMM64 0x23 /* symbol + addend, mov imm64 */ -+#define R_IA64_DIR32MSB 0x24 /* symbol + addend, data4 MSB */ -+#define R_IA64_DIR32LSB 0x25 /* symbol + addend, data4 LSB */ -+#define R_IA64_DIR64MSB 0x26 /* symbol + addend, data8 MSB */ -+#define R_IA64_DIR64LSB 0x27 /* symbol + addend, data8 LSB */ -+#define R_IA64_GPREL22 0x2a /* @gprel(sym + add), add imm22 */ -+#define R_IA64_GPREL64I 0x2b /* @gprel(sym + add), mov imm64 */ -+#define R_IA64_GPREL32MSB 0x2c /* @gprel(sym + add), data4 MSB */ -+#define R_IA64_GPREL32LSB 0x2d /* @gprel(sym + add), data4 LSB */ -+#define R_IA64_GPREL64MSB 0x2e /* @gprel(sym + add), data8 MSB */ -+#define R_IA64_GPREL64LSB 0x2f /* @gprel(sym + add), data8 LSB */ -+#define R_IA64_LTOFF22 0x32 /* @ltoff(sym + add), add imm22 */ -+#define R_IA64_LTOFF64I 0x33 /* @ltoff(sym + add), mov imm64 */ -+#define R_IA64_PLTOFF22 0x3a /* @pltoff(sym + add), add imm22 */ -+#define R_IA64_PLTOFF64I 0x3b /* @pltoff(sym + add), mov imm64 */ -+#define R_IA64_PLTOFF64MSB 0x3e /* @pltoff(sym + add), data8 MSB */ -+#define R_IA64_PLTOFF64LSB 0x3f /* @pltoff(sym + add), data8 LSB */ -+#define R_IA64_FPTR64I 0x43 /* @fptr(sym + add), mov imm64 */ -+#define R_IA64_FPTR32MSB 0x44 /* @fptr(sym + add), data4 MSB */ -+#define R_IA64_FPTR32LSB 0x45 /* @fptr(sym + add), data4 LSB */ -+#define R_IA64_FPTR64MSB 0x46 /* @fptr(sym + add), data8 MSB */ -+#define R_IA64_FPTR64LSB 0x47 /* @fptr(sym + add), data8 LSB */ -+#define R_IA64_PCREL60B 0x48 /* @pcrel(sym + add), brl */ -+#define R_IA64_PCREL21B 0x49 /* @pcrel(sym + add), ptb, call */ -+#define R_IA64_PCREL21M 0x4a /* @pcrel(sym + add), chk.s */ -+#define R_IA64_PCREL21F 0x4b /* @pcrel(sym + add), fchkf */ -+#define R_IA64_PCREL32MSB 0x4c /* @pcrel(sym + add), data4 MSB */ -+#define R_IA64_PCREL32LSB 0x4d /* @pcrel(sym + add), data4 LSB */ -+#define R_IA64_PCREL64MSB 0x4e /* @pcrel(sym + add), data8 MSB */ -+#define R_IA64_PCREL64LSB 0x4f /* @pcrel(sym + add), data8 LSB */ -+#define R_IA64_LTOFF_FPTR22 0x52 /* @ltoff(@fptr(s+a)), imm22 */ -+#define R_IA64_LTOFF_FPTR64I 0x53 /* @ltoff(@fptr(s+a)), imm64 */ -+#define R_IA64_LTOFF_FPTR32MSB 0x54 /* @ltoff(@fptr(s+a)), data4 MSB */ -+#define R_IA64_LTOFF_FPTR32LSB 0x55 /* @ltoff(@fptr(s+a)), data4 LSB */ -+#define R_IA64_LTOFF_FPTR64MSB 0x56 /* @ltoff(@fptr(s+a)), data8 MSB */ -+#define R_IA64_LTOFF_FPTR64LSB 0x57 /* @ltoff(@fptr(s+a)), data8 LSB */ -+#define R_IA64_SEGREL32MSB 0x5c /* @segrel(sym + add), data4 MSB */ -+#define R_IA64_SEGREL32LSB 0x5d /* @segrel(sym + add), data4 LSB */ -+#define R_IA64_SEGREL64MSB 0x5e /* @segrel(sym + add), data8 MSB */ -+#define R_IA64_SEGREL64LSB 0x5f /* @segrel(sym + add), data8 LSB */ -+#define R_IA64_SECREL32MSB 0x64 /* @secrel(sym + add), data4 MSB */ -+#define R_IA64_SECREL32LSB 0x65 /* @secrel(sym + add), data4 LSB */ -+#define R_IA64_SECREL64MSB 0x66 /* @secrel(sym + add), data8 MSB */ -+#define R_IA64_SECREL64LSB 0x67 /* @secrel(sym + add), data8 LSB */ -+#define R_IA64_REL32MSB 0x6c /* data 4 + REL */ -+#define R_IA64_REL32LSB 0x6d /* data 4 + REL */ -+#define R_IA64_REL64MSB 0x6e /* data 8 + REL */ -+#define R_IA64_REL64LSB 0x6f /* data 8 + REL */ -+#define R_IA64_LTV32MSB 0x74 /* symbol + addend, data4 MSB */ -+#define R_IA64_LTV32LSB 0x75 /* symbol + addend, data4 LSB */ -+#define R_IA64_LTV64MSB 0x76 /* symbol + addend, data8 MSB */ -+#define R_IA64_LTV64LSB 0x77 /* symbol + addend, data8 LSB */ -+#define R_IA64_PCREL21BI 0x79 /* @pcrel(sym + add), 21bit inst */ -+#define R_IA64_PCREL22 0x7a /* @pcrel(sym + add), 22bit inst */ -+#define R_IA64_PCREL64I 0x7b /* @pcrel(sym + add), 64bit inst */ -+#define R_IA64_IPLTMSB 0x80 /* dynamic reloc, imported PLT, MSB */ -+#define R_IA64_IPLTLSB 0x81 /* dynamic reloc, imported PLT, LSB */ -+#define R_IA64_COPY 0x84 /* copy relocation */ -+#define R_IA64_SUB 0x85 /* Addend and symbol difference */ -+#define R_IA64_LTOFF22X 0x86 /* LTOFF22, relaxable. */ -+#define R_IA64_LDXMOV 0x87 /* Use of LTOFF22X. */ -+#define R_IA64_TPREL14 0x91 /* @tprel(sym + add), imm14 */ -+#define R_IA64_TPREL22 0x92 /* @tprel(sym + add), imm22 */ -+#define R_IA64_TPREL64I 0x93 /* @tprel(sym + add), imm64 */ -+#define R_IA64_TPREL64MSB 0x96 /* @tprel(sym + add), data8 MSB */ -+#define R_IA64_TPREL64LSB 0x97 /* @tprel(sym + add), data8 LSB */ -+#define R_IA64_LTOFF_TPREL22 0x9a /* @ltoff(@tprel(s+a)), imm2 */ -+#define R_IA64_DTPMOD64MSB 0xa6 /* @dtpmod(sym + add), data8 MSB */ -+#define R_IA64_DTPMOD64LSB 0xa7 /* @dtpmod(sym + add), data8 LSB */ -+#define R_IA64_LTOFF_DTPMOD22 0xaa /* @ltoff(@dtpmod(sym + add)), imm22 */ -+#define R_IA64_DTPREL14 0xb1 /* @dtprel(sym + add), imm14 */ -+#define R_IA64_DTPREL22 0xb2 /* @dtprel(sym + add), imm22 */ -+#define R_IA64_DTPREL64I 0xb3 /* @dtprel(sym + add), imm64 */ -+#define R_IA64_DTPREL32MSB 0xb4 /* @dtprel(sym + add), data4 MSB */ -+#define R_IA64_DTPREL32LSB 0xb5 /* @dtprel(sym + add), data4 LSB */ -+#define R_IA64_DTPREL64MSB 0xb6 /* @dtprel(sym + add), data8 MSB */ -+#define R_IA64_DTPREL64LSB 0xb7 /* @dtprel(sym + add), data8 LSB */ -+#define R_IA64_LTOFF_DTPREL22 0xba /* @ltoff(@dtprel(s+a)), imm22 */ -+ -+/* SH specific declarations */ -+ -+/* Processor specific flags for the ELF header e_flags field. */ -+#define EF_SH_MACH_MASK 0x1f -+#define EF_SH_UNKNOWN 0x0 -+#define EF_SH1 0x1 -+#define EF_SH2 0x2 -+#define EF_SH3 0x3 -+#define EF_SH_DSP 0x4 -+#define EF_SH3_DSP 0x5 -+#define EF_SH4AL_DSP 0x6 -+#define EF_SH3E 0x8 -+#define EF_SH4 0x9 -+#define EF_SH2E 0xb -+#define EF_SH4A 0xc -+#define EF_SH2A 0xd -+#define EF_SH4_NOFPU 0x10 -+#define EF_SH4A_NOFPU 0x11 -+#define EF_SH4_NOMMU_NOFPU 0x12 -+#define EF_SH2A_NOFPU 0x13 -+#define EF_SH3_NOMMU 0x14 -+#define EF_SH2A_SH4_NOFPU 0x15 -+#define EF_SH2A_SH3_NOFPU 0x16 -+#define EF_SH2A_SH4 0x17 -+#define EF_SH2A_SH3E 0x18 -+ -+/* SH relocs. */ -+#define R_SH_NONE 0 -+#define R_SH_DIR32 1 -+#define R_SH_REL32 2 -+#define R_SH_DIR8WPN 3 -+#define R_SH_IND12W 4 -+#define R_SH_DIR8WPL 5 -+#define R_SH_DIR8WPZ 6 -+#define R_SH_DIR8BP 7 -+#define R_SH_DIR8W 8 -+#define R_SH_DIR8L 9 -+#define R_SH_SWITCH16 25 -+#define R_SH_SWITCH32 26 -+#define R_SH_USES 27 -+#define R_SH_COUNT 28 -+#define R_SH_ALIGN 29 -+#define R_SH_CODE 30 -+#define R_SH_DATA 31 -+#define R_SH_LABEL 32 -+#define R_SH_SWITCH8 33 -+#define R_SH_GNU_VTINHERIT 34 -+#define R_SH_GNU_VTENTRY 35 -+#define R_SH_TLS_GD_32 144 -+#define R_SH_TLS_LD_32 145 -+#define R_SH_TLS_LDO_32 146 -+#define R_SH_TLS_IE_32 147 -+#define R_SH_TLS_LE_32 148 -+#define R_SH_TLS_DTPMOD32 149 -+#define R_SH_TLS_DTPOFF32 150 -+#define R_SH_TLS_TPOFF32 151 -+#define R_SH_GOT32 160 -+#define R_SH_PLT32 161 -+#define R_SH_COPY 162 -+#define R_SH_GLOB_DAT 163 -+#define R_SH_JMP_SLOT 164 -+#define R_SH_RELATIVE 165 -+#define R_SH_GOTOFF 166 -+#define R_SH_GOTPC 167 -+/* Keep this the last entry. */ -+#define R_SH_NUM 256 -+ -+/* S/390 specific definitions. */ -+ -+/* Valid values for the e_flags field. */ -+ -+#define EF_S390_HIGH_GPRS 0x00000001 /* High GPRs kernel facility needed. */ -+ -+/* Additional s390 relocs */ -+ -+#define R_390_NONE 0 /* No reloc. */ -+#define R_390_8 1 /* Direct 8 bit. */ -+#define R_390_12 2 /* Direct 12 bit. */ -+#define R_390_16 3 /* Direct 16 bit. */ -+#define R_390_32 4 /* Direct 32 bit. */ -+#define R_390_PC32 5 /* PC relative 32 bit. */ -+#define R_390_GOT12 6 /* 12 bit GOT offset. */ -+#define R_390_GOT32 7 /* 32 bit GOT offset. */ -+#define R_390_PLT32 8 /* 32 bit PC relative PLT address. */ -+#define R_390_COPY 9 /* Copy symbol at runtime. */ -+#define R_390_GLOB_DAT 10 /* Create GOT entry. */ -+#define R_390_JMP_SLOT 11 /* Create PLT entry. */ -+#define R_390_RELATIVE 12 /* Adjust by program base. */ -+#define R_390_GOTOFF32 13 /* 32 bit offset to GOT. */ -+#define R_390_GOTPC 14 /* 32 bit PC relative offset to GOT. */ -+#define R_390_GOT16 15 /* 16 bit GOT offset. */ -+#define R_390_PC16 16 /* PC relative 16 bit. */ -+#define R_390_PC16DBL 17 /* PC relative 16 bit shifted by 1. */ -+#define R_390_PLT16DBL 18 /* 16 bit PC rel. PLT shifted by 1. */ -+#define R_390_PC32DBL 19 /* PC relative 32 bit shifted by 1. */ -+#define R_390_PLT32DBL 20 /* 32 bit PC rel. PLT shifted by 1. */ -+#define R_390_GOTPCDBL 21 /* 32 bit PC rel. GOT shifted by 1. */ -+#define R_390_64 22 /* Direct 64 bit. */ -+#define R_390_PC64 23 /* PC relative 64 bit. */ -+#define R_390_GOT64 24 /* 64 bit GOT offset. */ -+#define R_390_PLT64 25 /* 64 bit PC relative PLT address. */ -+#define R_390_GOTENT 26 /* 32 bit PC rel. to GOT entry >> 1. */ -+#define R_390_GOTOFF16 27 /* 16 bit offset to GOT. */ -+#define R_390_GOTOFF64 28 /* 64 bit offset to GOT. */ -+#define R_390_GOTPLT12 29 /* 12 bit offset to jump slot. */ -+#define R_390_GOTPLT16 30 /* 16 bit offset to jump slot. */ -+#define R_390_GOTPLT32 31 /* 32 bit offset to jump slot. */ -+#define R_390_GOTPLT64 32 /* 64 bit offset to jump slot. */ -+#define R_390_GOTPLTENT 33 /* 32 bit rel. offset to jump slot. */ -+#define R_390_PLTOFF16 34 /* 16 bit offset from GOT to PLT. */ -+#define R_390_PLTOFF32 35 /* 32 bit offset from GOT to PLT. */ -+#define R_390_PLTOFF64 36 /* 16 bit offset from GOT to PLT. */ -+#define R_390_TLS_LOAD 37 /* Tag for load insn in TLS code. */ -+#define R_390_TLS_GDCALL 38 /* Tag for function call in general -+ dynamic TLS code. */ -+#define R_390_TLS_LDCALL 39 /* Tag for function call in local -+ dynamic TLS code. */ -+#define R_390_TLS_GD32 40 /* Direct 32 bit for general dynamic -+ thread local data. */ -+#define R_390_TLS_GD64 41 /* Direct 64 bit for general dynamic -+ thread local data. */ -+#define R_390_TLS_GOTIE12 42 /* 12 bit GOT offset for static TLS -+ block offset. */ -+#define R_390_TLS_GOTIE32 43 /* 32 bit GOT offset for static TLS -+ block offset. */ -+#define R_390_TLS_GOTIE64 44 /* 64 bit GOT offset for static TLS -+ block offset. */ -+#define R_390_TLS_LDM32 45 /* Direct 32 bit for local dynamic -+ thread local data in LE code. */ -+#define R_390_TLS_LDM64 46 /* Direct 64 bit for local dynamic -+ thread local data in LE code. */ -+#define R_390_TLS_IE32 47 /* 32 bit address of GOT entry for -+ negated static TLS block offset. */ -+#define R_390_TLS_IE64 48 /* 64 bit address of GOT entry for -+ negated static TLS block offset. */ -+#define R_390_TLS_IEENT 49 /* 32 bit rel. offset to GOT entry for -+ negated static TLS block offset. */ -+#define R_390_TLS_LE32 50 /* 32 bit negated offset relative to -+ static TLS block. */ -+#define R_390_TLS_LE64 51 /* 64 bit negated offset relative to -+ static TLS block. */ -+#define R_390_TLS_LDO32 52 /* 32 bit offset relative to TLS -+ block. */ -+#define R_390_TLS_LDO64 53 /* 64 bit offset relative to TLS -+ block. */ -+#define R_390_TLS_DTPMOD 54 /* ID of module containing symbol. */ -+#define R_390_TLS_DTPOFF 55 /* Offset in TLS block. */ -+#define R_390_TLS_TPOFF 56 /* Negated offset in static TLS -+ block. */ -+#define R_390_20 57 /* Direct 20 bit. */ -+#define R_390_GOT20 58 /* 20 bit GOT offset. */ -+#define R_390_GOTPLT20 59 /* 20 bit offset to jump slot. */ -+#define R_390_TLS_GOTIE20 60 /* 20 bit GOT offset for static TLS -+ block offset. */ -+#define R_390_IRELATIVE 61 /* STT_GNU_IFUNC relocation. */ -+/* Keep this the last entry. */ -+#define R_390_NUM 62 -+ -+ -+/* CRIS relocations. */ -+#define R_CRIS_NONE 0 -+#define R_CRIS_8 1 -+#define R_CRIS_16 2 -+#define R_CRIS_32 3 -+#define R_CRIS_8_PCREL 4 -+#define R_CRIS_16_PCREL 5 -+#define R_CRIS_32_PCREL 6 -+#define R_CRIS_GNU_VTINHERIT 7 -+#define R_CRIS_GNU_VTENTRY 8 -+#define R_CRIS_COPY 9 -+#define R_CRIS_GLOB_DAT 10 -+#define R_CRIS_JUMP_SLOT 11 -+#define R_CRIS_RELATIVE 12 -+#define R_CRIS_16_GOT 13 -+#define R_CRIS_32_GOT 14 -+#define R_CRIS_16_GOTPLT 15 -+#define R_CRIS_32_GOTPLT 16 -+#define R_CRIS_32_GOTREL 17 -+#define R_CRIS_32_PLT_GOTREL 18 -+#define R_CRIS_32_PLT_PCREL 19 -+ -+#define R_CRIS_NUM 20 -+ -+ -+/* AMD x86-64 relocations. */ -+#define R_X86_64_NONE 0 /* No reloc */ -+#define R_X86_64_64 1 /* Direct 64 bit */ -+#define R_X86_64_PC32 2 /* PC relative 32 bit signed */ -+#define R_X86_64_GOT32 3 /* 32 bit GOT entry */ -+#define R_X86_64_PLT32 4 /* 32 bit PLT address */ -+#define R_X86_64_COPY 5 /* Copy symbol at runtime */ -+#define R_X86_64_GLOB_DAT 6 /* Create GOT entry */ -+#define R_X86_64_JUMP_SLOT 7 /* Create PLT entry */ -+#define R_X86_64_RELATIVE 8 /* Adjust by program base */ -+#define R_X86_64_GOTPCREL 9 /* 32 bit signed PC relative -+ offset to GOT */ -+#define R_X86_64_32 10 /* Direct 32 bit zero extended */ -+#define R_X86_64_32S 11 /* Direct 32 bit sign extended */ -+#define R_X86_64_16 12 /* Direct 16 bit zero extended */ -+#define R_X86_64_PC16 13 /* 16 bit sign extended pc relative */ -+#define R_X86_64_8 14 /* Direct 8 bit sign extended */ -+#define R_X86_64_PC8 15 /* 8 bit sign extended pc relative */ -+#define R_X86_64_DTPMOD64 16 /* ID of module containing symbol */ -+#define R_X86_64_DTPOFF64 17 /* Offset in module's TLS block */ -+#define R_X86_64_TPOFF64 18 /* Offset in initial TLS block */ -+#define R_X86_64_TLSGD 19 /* 32 bit signed PC relative offset -+ to two GOT entries for GD symbol */ -+#define R_X86_64_TLSLD 20 /* 32 bit signed PC relative offset -+ to two GOT entries for LD symbol */ -+#define R_X86_64_DTPOFF32 21 /* Offset in TLS block */ -+#define R_X86_64_GOTTPOFF 22 /* 32 bit signed PC relative offset -+ to GOT entry for IE symbol */ -+#define R_X86_64_TPOFF32 23 /* Offset in initial TLS block */ -+#define R_X86_64_PC64 24 /* PC relative 64 bit */ -+#define R_X86_64_GOTOFF64 25 /* 64 bit offset to GOT */ -+#define R_X86_64_GOTPC32 26 /* 32 bit signed pc relative -+ offset to GOT */ -+#define R_X86_64_GOT64 27 /* 64-bit GOT entry offset */ -+#define R_X86_64_GOTPCREL64 28 /* 64-bit PC relative offset -+ to GOT entry */ -+#define R_X86_64_GOTPC64 29 /* 64-bit PC relative offset to GOT */ -+#define R_X86_64_GOTPLT64 30 /* like GOT64, says PLT entry needed */ -+#define R_X86_64_PLTOFF64 31 /* 64-bit GOT relative offset -+ to PLT entry */ -+#define R_X86_64_SIZE32 32 /* Size of symbol plus 32-bit addend */ -+#define R_X86_64_SIZE64 33 /* Size of symbol plus 64-bit addend */ -+#define R_X86_64_GOTPC32_TLSDESC 34 /* GOT offset for TLS descriptor. */ -+#define R_X86_64_TLSDESC_CALL 35 /* Marker for call through TLS -+ descriptor. */ -+#define R_X86_64_TLSDESC 36 /* TLS descriptor. */ -+#define R_X86_64_IRELATIVE 37 /* Adjust indirectly by program base */ -+#define R_X86_64_RELATIVE64 38 /* 64-bit adjust by program base */ -+ -+#define R_X86_64_NUM 39 -+ -+ -+/* AM33 relocations. */ -+#define R_MN10300_NONE 0 /* No reloc. */ -+#define R_MN10300_32 1 /* Direct 32 bit. */ -+#define R_MN10300_16 2 /* Direct 16 bit. */ -+#define R_MN10300_8 3 /* Direct 8 bit. */ -+#define R_MN10300_PCREL32 4 /* PC-relative 32-bit. */ -+#define R_MN10300_PCREL16 5 /* PC-relative 16-bit signed. */ -+#define R_MN10300_PCREL8 6 /* PC-relative 8-bit signed. */ -+#define R_MN10300_GNU_VTINHERIT 7 /* Ancient C++ vtable garbage... */ -+#define R_MN10300_GNU_VTENTRY 8 /* ... collection annotation. */ -+#define R_MN10300_24 9 /* Direct 24 bit. */ -+#define R_MN10300_GOTPC32 10 /* 32-bit PCrel offset to GOT. */ -+#define R_MN10300_GOTPC16 11 /* 16-bit PCrel offset to GOT. */ -+#define R_MN10300_GOTOFF32 12 /* 32-bit offset from GOT. */ -+#define R_MN10300_GOTOFF24 13 /* 24-bit offset from GOT. */ -+#define R_MN10300_GOTOFF16 14 /* 16-bit offset from GOT. */ -+#define R_MN10300_PLT32 15 /* 32-bit PCrel to PLT entry. */ -+#define R_MN10300_PLT16 16 /* 16-bit PCrel to PLT entry. */ -+#define R_MN10300_GOT32 17 /* 32-bit offset to GOT entry. */ -+#define R_MN10300_GOT24 18 /* 24-bit offset to GOT entry. */ -+#define R_MN10300_GOT16 19 /* 16-bit offset to GOT entry. */ -+#define R_MN10300_COPY 20 /* Copy symbol at runtime. */ -+#define R_MN10300_GLOB_DAT 21 /* Create GOT entry. */ -+#define R_MN10300_JMP_SLOT 22 /* Create PLT entry. */ -+#define R_MN10300_RELATIVE 23 /* Adjust by program base. */ -+ -+#define R_MN10300_NUM 24 -+ -+ -+/* M32R relocs. */ -+#define R_M32R_NONE 0 /* No reloc. */ -+#define R_M32R_16 1 /* Direct 16 bit. */ -+#define R_M32R_32 2 /* Direct 32 bit. */ -+#define R_M32R_24 3 /* Direct 24 bit. */ -+#define R_M32R_10_PCREL 4 /* PC relative 10 bit shifted. */ -+#define R_M32R_18_PCREL 5 /* PC relative 18 bit shifted. */ -+#define R_M32R_26_PCREL 6 /* PC relative 26 bit shifted. */ -+#define R_M32R_HI16_ULO 7 /* High 16 bit with unsigned low. */ -+#define R_M32R_HI16_SLO 8 /* High 16 bit with signed low. */ -+#define R_M32R_LO16 9 /* Low 16 bit. */ -+#define R_M32R_SDA16 10 /* 16 bit offset in SDA. */ -+#define R_M32R_GNU_VTINHERIT 11 -+#define R_M32R_GNU_VTENTRY 12 -+/* M32R relocs use SHT_RELA. */ -+#define R_M32R_16_RELA 33 /* Direct 16 bit. */ -+#define R_M32R_32_RELA 34 /* Direct 32 bit. */ -+#define R_M32R_24_RELA 35 /* Direct 24 bit. */ -+#define R_M32R_10_PCREL_RELA 36 /* PC relative 10 bit shifted. */ -+#define R_M32R_18_PCREL_RELA 37 /* PC relative 18 bit shifted. */ -+#define R_M32R_26_PCREL_RELA 38 /* PC relative 26 bit shifted. */ -+#define R_M32R_HI16_ULO_RELA 39 /* High 16 bit with unsigned low */ -+#define R_M32R_HI16_SLO_RELA 40 /* High 16 bit with signed low */ -+#define R_M32R_LO16_RELA 41 /* Low 16 bit */ -+#define R_M32R_SDA16_RELA 42 /* 16 bit offset in SDA */ -+#define R_M32R_RELA_GNU_VTINHERIT 43 -+#define R_M32R_RELA_GNU_VTENTRY 44 -+#define R_M32R_REL32 45 /* PC relative 32 bit. */ -+ -+#define R_M32R_GOT24 48 /* 24 bit GOT entry */ -+#define R_M32R_26_PLTREL 49 /* 26 bit PC relative to PLT shifted */ -+#define R_M32R_COPY 50 /* Copy symbol at runtime */ -+#define R_M32R_GLOB_DAT 51 /* Create GOT entry */ -+#define R_M32R_JMP_SLOT 52 /* Create PLT entry */ -+#define R_M32R_RELATIVE 53 /* Adjust by program base */ -+#define R_M32R_GOTOFF 54 /* 24 bit offset to GOT */ -+#define R_M32R_GOTPC24 55 /* 24 bit PC relative offset to GOT */ -+#define R_M32R_GOT16_HI_ULO 56 /* High 16 bit GOT entry with unsigned -+ low */ -+#define R_M32R_GOT16_HI_SLO 57 /* High 16 bit GOT entry with signed -+ low */ -+#define R_M32R_GOT16_LO 58 /* Low 16 bit GOT entry */ -+#define R_M32R_GOTPC_HI_ULO 59 /* High 16 bit PC relative offset to -+ GOT with unsigned low */ -+#define R_M32R_GOTPC_HI_SLO 60 /* High 16 bit PC relative offset to -+ GOT with signed low */ -+#define R_M32R_GOTPC_LO 61 /* Low 16 bit PC relative offset to -+ GOT */ -+#define R_M32R_GOTOFF_HI_ULO 62 /* High 16 bit offset to GOT -+ with unsigned low */ -+#define R_M32R_GOTOFF_HI_SLO 63 /* High 16 bit offset to GOT -+ with signed low */ -+#define R_M32R_GOTOFF_LO 64 /* Low 16 bit offset to GOT */ -+#define R_M32R_NUM 256 /* Keep this the last entry. */ -+ -+ -+/* TILEPro relocations. */ -+#define R_TILEPRO_NONE 0 /* No reloc */ -+#define R_TILEPRO_32 1 /* Direct 32 bit */ -+#define R_TILEPRO_16 2 /* Direct 16 bit */ -+#define R_TILEPRO_8 3 /* Direct 8 bit */ -+#define R_TILEPRO_32_PCREL 4 /* PC relative 32 bit */ -+#define R_TILEPRO_16_PCREL 5 /* PC relative 16 bit */ -+#define R_TILEPRO_8_PCREL 6 /* PC relative 8 bit */ -+#define R_TILEPRO_LO16 7 /* Low 16 bit */ -+#define R_TILEPRO_HI16 8 /* High 16 bit */ -+#define R_TILEPRO_HA16 9 /* High 16 bit, adjusted */ -+#define R_TILEPRO_COPY 10 /* Copy relocation */ -+#define R_TILEPRO_GLOB_DAT 11 /* Create GOT entry */ -+#define R_TILEPRO_JMP_SLOT 12 /* Create PLT entry */ -+#define R_TILEPRO_RELATIVE 13 /* Adjust by program base */ -+#define R_TILEPRO_BROFF_X1 14 /* X1 pipe branch offset */ -+#define R_TILEPRO_JOFFLONG_X1 15 /* X1 pipe jump offset */ -+#define R_TILEPRO_JOFFLONG_X1_PLT 16 /* X1 pipe jump offset to PLT */ -+#define R_TILEPRO_IMM8_X0 17 /* X0 pipe 8-bit */ -+#define R_TILEPRO_IMM8_Y0 18 /* Y0 pipe 8-bit */ -+#define R_TILEPRO_IMM8_X1 19 /* X1 pipe 8-bit */ -+#define R_TILEPRO_IMM8_Y1 20 /* Y1 pipe 8-bit */ -+#define R_TILEPRO_MT_IMM15_X1 21 /* X1 pipe mtspr */ -+#define R_TILEPRO_MF_IMM15_X1 22 /* X1 pipe mfspr */ -+#define R_TILEPRO_IMM16_X0 23 /* X0 pipe 16-bit */ -+#define R_TILEPRO_IMM16_X1 24 /* X1 pipe 16-bit */ -+#define R_TILEPRO_IMM16_X0_LO 25 /* X0 pipe low 16-bit */ -+#define R_TILEPRO_IMM16_X1_LO 26 /* X1 pipe low 16-bit */ -+#define R_TILEPRO_IMM16_X0_HI 27 /* X0 pipe high 16-bit */ -+#define R_TILEPRO_IMM16_X1_HI 28 /* X1 pipe high 16-bit */ -+#define R_TILEPRO_IMM16_X0_HA 29 /* X0 pipe high 16-bit, adjusted */ -+#define R_TILEPRO_IMM16_X1_HA 30 /* X1 pipe high 16-bit, adjusted */ -+#define R_TILEPRO_IMM16_X0_PCREL 31 /* X0 pipe PC relative 16 bit */ -+#define R_TILEPRO_IMM16_X1_PCREL 32 /* X1 pipe PC relative 16 bit */ -+#define R_TILEPRO_IMM16_X0_LO_PCREL 33 /* X0 pipe PC relative low 16 bit */ -+#define R_TILEPRO_IMM16_X1_LO_PCREL 34 /* X1 pipe PC relative low 16 bit */ -+#define R_TILEPRO_IMM16_X0_HI_PCREL 35 /* X0 pipe PC relative high 16 bit */ -+#define R_TILEPRO_IMM16_X1_HI_PCREL 36 /* X1 pipe PC relative high 16 bit */ -+#define R_TILEPRO_IMM16_X0_HA_PCREL 37 /* X0 pipe PC relative ha() 16 bit */ -+#define R_TILEPRO_IMM16_X1_HA_PCREL 38 /* X1 pipe PC relative ha() 16 bit */ -+#define R_TILEPRO_IMM16_X0_GOT 39 /* X0 pipe 16-bit GOT offset */ -+#define R_TILEPRO_IMM16_X1_GOT 40 /* X1 pipe 16-bit GOT offset */ -+#define R_TILEPRO_IMM16_X0_GOT_LO 41 /* X0 pipe low 16-bit GOT offset */ -+#define R_TILEPRO_IMM16_X1_GOT_LO 42 /* X1 pipe low 16-bit GOT offset */ -+#define R_TILEPRO_IMM16_X0_GOT_HI 43 /* X0 pipe high 16-bit GOT offset */ -+#define R_TILEPRO_IMM16_X1_GOT_HI 44 /* X1 pipe high 16-bit GOT offset */ -+#define R_TILEPRO_IMM16_X0_GOT_HA 45 /* X0 pipe ha() 16-bit GOT offset */ -+#define R_TILEPRO_IMM16_X1_GOT_HA 46 /* X1 pipe ha() 16-bit GOT offset */ -+#define R_TILEPRO_MMSTART_X0 47 /* X0 pipe mm "start" */ -+#define R_TILEPRO_MMEND_X0 48 /* X0 pipe mm "end" */ -+#define R_TILEPRO_MMSTART_X1 49 /* X1 pipe mm "start" */ -+#define R_TILEPRO_MMEND_X1 50 /* X1 pipe mm "end" */ -+#define R_TILEPRO_SHAMT_X0 51 /* X0 pipe shift amount */ -+#define R_TILEPRO_SHAMT_X1 52 /* X1 pipe shift amount */ -+#define R_TILEPRO_SHAMT_Y0 53 /* Y0 pipe shift amount */ -+#define R_TILEPRO_SHAMT_Y1 54 /* Y1 pipe shift amount */ -+#define R_TILEPRO_DEST_IMM8_X1 55 /* X1 pipe destination 8-bit */ -+/* Relocs 56-59 are currently not defined. */ -+#define R_TILEPRO_TLS_GD_CALL 60 /* "jal" for TLS GD */ -+#define R_TILEPRO_IMM8_X0_TLS_GD_ADD 61 /* X0 pipe "addi" for TLS GD */ -+#define R_TILEPRO_IMM8_X1_TLS_GD_ADD 62 /* X1 pipe "addi" for TLS GD */ -+#define R_TILEPRO_IMM8_Y0_TLS_GD_ADD 63 /* Y0 pipe "addi" for TLS GD */ -+#define R_TILEPRO_IMM8_Y1_TLS_GD_ADD 64 /* Y1 pipe "addi" for TLS GD */ -+#define R_TILEPRO_TLS_IE_LOAD 65 /* "lw_tls" for TLS IE */ -+#define R_TILEPRO_IMM16_X0_TLS_GD 66 /* X0 pipe 16-bit TLS GD offset */ -+#define R_TILEPRO_IMM16_X1_TLS_GD 67 /* X1 pipe 16-bit TLS GD offset */ -+#define R_TILEPRO_IMM16_X0_TLS_GD_LO 68 /* X0 pipe low 16-bit TLS GD offset */ -+#define R_TILEPRO_IMM16_X1_TLS_GD_LO 69 /* X1 pipe low 16-bit TLS GD offset */ -+#define R_TILEPRO_IMM16_X0_TLS_GD_HI 70 /* X0 pipe high 16-bit TLS GD offset */ -+#define R_TILEPRO_IMM16_X1_TLS_GD_HI 71 /* X1 pipe high 16-bit TLS GD offset */ -+#define R_TILEPRO_IMM16_X0_TLS_GD_HA 72 /* X0 pipe ha() 16-bit TLS GD offset */ -+#define R_TILEPRO_IMM16_X1_TLS_GD_HA 73 /* X1 pipe ha() 16-bit TLS GD offset */ -+#define R_TILEPRO_IMM16_X0_TLS_IE 74 /* X0 pipe 16-bit TLS IE offset */ -+#define R_TILEPRO_IMM16_X1_TLS_IE 75 /* X1 pipe 16-bit TLS IE offset */ -+#define R_TILEPRO_IMM16_X0_TLS_IE_LO 76 /* X0 pipe low 16-bit TLS IE offset */ -+#define R_TILEPRO_IMM16_X1_TLS_IE_LO 77 /* X1 pipe low 16-bit TLS IE offset */ -+#define R_TILEPRO_IMM16_X0_TLS_IE_HI 78 /* X0 pipe high 16-bit TLS IE offset */ -+#define R_TILEPRO_IMM16_X1_TLS_IE_HI 79 /* X1 pipe high 16-bit TLS IE offset */ -+#define R_TILEPRO_IMM16_X0_TLS_IE_HA 80 /* X0 pipe ha() 16-bit TLS IE offset */ -+#define R_TILEPRO_IMM16_X1_TLS_IE_HA 81 /* X1 pipe ha() 16-bit TLS IE offset */ -+#define R_TILEPRO_TLS_DTPMOD32 82 /* ID of module containing symbol */ -+#define R_TILEPRO_TLS_DTPOFF32 83 /* Offset in TLS block */ -+#define R_TILEPRO_TLS_TPOFF32 84 /* Offset in static TLS block */ -+#define R_TILEPRO_IMM16_X0_TLS_LE 85 /* X0 pipe 16-bit TLS LE offset */ -+#define R_TILEPRO_IMM16_X1_TLS_LE 86 /* X1 pipe 16-bit TLS LE offset */ -+#define R_TILEPRO_IMM16_X0_TLS_LE_LO 87 /* X0 pipe low 16-bit TLS LE offset */ -+#define R_TILEPRO_IMM16_X1_TLS_LE_LO 88 /* X1 pipe low 16-bit TLS LE offset */ -+#define R_TILEPRO_IMM16_X0_TLS_LE_HI 89 /* X0 pipe high 16-bit TLS LE offset */ -+#define R_TILEPRO_IMM16_X1_TLS_LE_HI 90 /* X1 pipe high 16-bit TLS LE offset */ -+#define R_TILEPRO_IMM16_X0_TLS_LE_HA 91 /* X0 pipe ha() 16-bit TLS LE offset */ -+#define R_TILEPRO_IMM16_X1_TLS_LE_HA 92 /* X1 pipe ha() 16-bit TLS LE offset */ -+ -+#define R_TILEPRO_GNU_VTINHERIT 128 /* GNU C++ vtable hierarchy */ -+#define R_TILEPRO_GNU_VTENTRY 129 /* GNU C++ vtable member usage */ -+ -+#define R_TILEPRO_NUM 130 -+ -+ -+/* TILE-Gx relocations. */ -+#define R_TILEGX_NONE 0 /* No reloc */ -+#define R_TILEGX_64 1 /* Direct 64 bit */ -+#define R_TILEGX_32 2 /* Direct 32 bit */ -+#define R_TILEGX_16 3 /* Direct 16 bit */ -+#define R_TILEGX_8 4 /* Direct 8 bit */ -+#define R_TILEGX_64_PCREL 5 /* PC relative 64 bit */ -+#define R_TILEGX_32_PCREL 6 /* PC relative 32 bit */ -+#define R_TILEGX_16_PCREL 7 /* PC relative 16 bit */ -+#define R_TILEGX_8_PCREL 8 /* PC relative 8 bit */ -+#define R_TILEGX_HW0 9 /* hword 0 16-bit */ -+#define R_TILEGX_HW1 10 /* hword 1 16-bit */ -+#define R_TILEGX_HW2 11 /* hword 2 16-bit */ -+#define R_TILEGX_HW3 12 /* hword 3 16-bit */ -+#define R_TILEGX_HW0_LAST 13 /* last hword 0 16-bit */ -+#define R_TILEGX_HW1_LAST 14 /* last hword 1 16-bit */ -+#define R_TILEGX_HW2_LAST 15 /* last hword 2 16-bit */ -+#define R_TILEGX_COPY 16 /* Copy relocation */ -+#define R_TILEGX_GLOB_DAT 17 /* Create GOT entry */ -+#define R_TILEGX_JMP_SLOT 18 /* Create PLT entry */ -+#define R_TILEGX_RELATIVE 19 /* Adjust by program base */ -+#define R_TILEGX_BROFF_X1 20 /* X1 pipe branch offset */ -+#define R_TILEGX_JUMPOFF_X1 21 /* X1 pipe jump offset */ -+#define R_TILEGX_JUMPOFF_X1_PLT 22 /* X1 pipe jump offset to PLT */ -+#define R_TILEGX_IMM8_X0 23 /* X0 pipe 8-bit */ -+#define R_TILEGX_IMM8_Y0 24 /* Y0 pipe 8-bit */ -+#define R_TILEGX_IMM8_X1 25 /* X1 pipe 8-bit */ -+#define R_TILEGX_IMM8_Y1 26 /* Y1 pipe 8-bit */ -+#define R_TILEGX_DEST_IMM8_X1 27 /* X1 pipe destination 8-bit */ -+#define R_TILEGX_MT_IMM14_X1 28 /* X1 pipe mtspr */ -+#define R_TILEGX_MF_IMM14_X1 29 /* X1 pipe mfspr */ -+#define R_TILEGX_MMSTART_X0 30 /* X0 pipe mm "start" */ -+#define R_TILEGX_MMEND_X0 31 /* X0 pipe mm "end" */ -+#define R_TILEGX_SHAMT_X0 32 /* X0 pipe shift amount */ -+#define R_TILEGX_SHAMT_X1 33 /* X1 pipe shift amount */ -+#define R_TILEGX_SHAMT_Y0 34 /* Y0 pipe shift amount */ -+#define R_TILEGX_SHAMT_Y1 35 /* Y1 pipe shift amount */ -+#define R_TILEGX_IMM16_X0_HW0 36 /* X0 pipe hword 0 */ -+#define R_TILEGX_IMM16_X1_HW0 37 /* X1 pipe hword 0 */ -+#define R_TILEGX_IMM16_X0_HW1 38 /* X0 pipe hword 1 */ -+#define R_TILEGX_IMM16_X1_HW1 39 /* X1 pipe hword 1 */ -+#define R_TILEGX_IMM16_X0_HW2 40 /* X0 pipe hword 2 */ -+#define R_TILEGX_IMM16_X1_HW2 41 /* X1 pipe hword 2 */ -+#define R_TILEGX_IMM16_X0_HW3 42 /* X0 pipe hword 3 */ -+#define R_TILEGX_IMM16_X1_HW3 43 /* X1 pipe hword 3 */ -+#define R_TILEGX_IMM16_X0_HW0_LAST 44 /* X0 pipe last hword 0 */ -+#define R_TILEGX_IMM16_X1_HW0_LAST 45 /* X1 pipe last hword 0 */ -+#define R_TILEGX_IMM16_X0_HW1_LAST 46 /* X0 pipe last hword 1 */ -+#define R_TILEGX_IMM16_X1_HW1_LAST 47 /* X1 pipe last hword 1 */ -+#define R_TILEGX_IMM16_X0_HW2_LAST 48 /* X0 pipe last hword 2 */ -+#define R_TILEGX_IMM16_X1_HW2_LAST 49 /* X1 pipe last hword 2 */ -+#define R_TILEGX_IMM16_X0_HW0_PCREL 50 /* X0 pipe PC relative hword 0 */ -+#define R_TILEGX_IMM16_X1_HW0_PCREL 51 /* X1 pipe PC relative hword 0 */ -+#define R_TILEGX_IMM16_X0_HW1_PCREL 52 /* X0 pipe PC relative hword 1 */ -+#define R_TILEGX_IMM16_X1_HW1_PCREL 53 /* X1 pipe PC relative hword 1 */ -+#define R_TILEGX_IMM16_X0_HW2_PCREL 54 /* X0 pipe PC relative hword 2 */ -+#define R_TILEGX_IMM16_X1_HW2_PCREL 55 /* X1 pipe PC relative hword 2 */ -+#define R_TILEGX_IMM16_X0_HW3_PCREL 56 /* X0 pipe PC relative hword 3 */ -+#define R_TILEGX_IMM16_X1_HW3_PCREL 57 /* X1 pipe PC relative hword 3 */ -+#define R_TILEGX_IMM16_X0_HW0_LAST_PCREL 58 /* X0 pipe PC-rel last hword 0 */ -+#define R_TILEGX_IMM16_X1_HW0_LAST_PCREL 59 /* X1 pipe PC-rel last hword 0 */ -+#define R_TILEGX_IMM16_X0_HW1_LAST_PCREL 60 /* X0 pipe PC-rel last hword 1 */ -+#define R_TILEGX_IMM16_X1_HW1_LAST_PCREL 61 /* X1 pipe PC-rel last hword 1 */ -+#define R_TILEGX_IMM16_X0_HW2_LAST_PCREL 62 /* X0 pipe PC-rel last hword 2 */ -+#define R_TILEGX_IMM16_X1_HW2_LAST_PCREL 63 /* X1 pipe PC-rel last hword 2 */ -+#define R_TILEGX_IMM16_X0_HW0_GOT 64 /* X0 pipe hword 0 GOT offset */ -+#define R_TILEGX_IMM16_X1_HW0_GOT 65 /* X1 pipe hword 0 GOT offset */ -+/* Relocs 66-71 are currently not defined. */ -+#define R_TILEGX_IMM16_X0_HW0_LAST_GOT 72 /* X0 pipe last hword 0 GOT offset */ -+#define R_TILEGX_IMM16_X1_HW0_LAST_GOT 73 /* X1 pipe last hword 0 GOT offset */ -+#define R_TILEGX_IMM16_X0_HW1_LAST_GOT 74 /* X0 pipe last hword 1 GOT offset */ -+#define R_TILEGX_IMM16_X1_HW1_LAST_GOT 75 /* X1 pipe last hword 1 GOT offset */ -+/* Relocs 76-77 are currently not defined. */ -+#define R_TILEGX_IMM16_X0_HW0_TLS_GD 78 /* X0 pipe hword 0 TLS GD offset */ -+#define R_TILEGX_IMM16_X1_HW0_TLS_GD 79 /* X1 pipe hword 0 TLS GD offset */ -+#define R_TILEGX_IMM16_X0_HW0_TLS_LE 80 /* X0 pipe hword 0 TLS LE offset */ -+#define R_TILEGX_IMM16_X1_HW0_TLS_LE 81 /* X1 pipe hword 0 TLS LE offset */ -+#define R_TILEGX_IMM16_X0_HW0_LAST_TLS_LE 82 /* X0 pipe last hword 0 LE off */ -+#define R_TILEGX_IMM16_X1_HW0_LAST_TLS_LE 83 /* X1 pipe last hword 0 LE off */ -+#define R_TILEGX_IMM16_X0_HW1_LAST_TLS_LE 84 /* X0 pipe last hword 1 LE off */ -+#define R_TILEGX_IMM16_X1_HW1_LAST_TLS_LE 85 /* X1 pipe last hword 1 LE off */ -+#define R_TILEGX_IMM16_X0_HW0_LAST_TLS_GD 86 /* X0 pipe last hword 0 GD off */ -+#define R_TILEGX_IMM16_X1_HW0_LAST_TLS_GD 87 /* X1 pipe last hword 0 GD off */ -+#define R_TILEGX_IMM16_X0_HW1_LAST_TLS_GD 88 /* X0 pipe last hword 1 GD off */ -+#define R_TILEGX_IMM16_X1_HW1_LAST_TLS_GD 89 /* X1 pipe last hword 1 GD off */ -+/* Relocs 90-91 are currently not defined. */ -+#define R_TILEGX_IMM16_X0_HW0_TLS_IE 92 /* X0 pipe hword 0 TLS IE offset */ -+#define R_TILEGX_IMM16_X1_HW0_TLS_IE 93 /* X1 pipe hword 0 TLS IE offset */ -+/* Relocs 94-99 are currently not defined. */ -+#define R_TILEGX_IMM16_X0_HW0_LAST_TLS_IE 100 /* X0 pipe last hword 0 IE off */ -+#define R_TILEGX_IMM16_X1_HW0_LAST_TLS_IE 101 /* X1 pipe last hword 0 IE off */ -+#define R_TILEGX_IMM16_X0_HW1_LAST_TLS_IE 102 /* X0 pipe last hword 1 IE off */ -+#define R_TILEGX_IMM16_X1_HW1_LAST_TLS_IE 103 /* X1 pipe last hword 1 IE off */ -+/* Relocs 104-105 are currently not defined. */ -+#define R_TILEGX_TLS_DTPMOD64 106 /* 64-bit ID of symbol's module */ -+#define R_TILEGX_TLS_DTPOFF64 107 /* 64-bit offset in TLS block */ -+#define R_TILEGX_TLS_TPOFF64 108 /* 64-bit offset in static TLS block */ -+#define R_TILEGX_TLS_DTPMOD32 109 /* 32-bit ID of symbol's module */ -+#define R_TILEGX_TLS_DTPOFF32 110 /* 32-bit offset in TLS block */ -+#define R_TILEGX_TLS_TPOFF32 111 /* 32-bit offset in static TLS block */ -+#define R_TILEGX_TLS_GD_CALL 112 /* "jal" for TLS GD */ -+#define R_TILEGX_IMM8_X0_TLS_GD_ADD 113 /* X0 pipe "addi" for TLS GD */ -+#define R_TILEGX_IMM8_X1_TLS_GD_ADD 114 /* X1 pipe "addi" for TLS GD */ -+#define R_TILEGX_IMM8_Y0_TLS_GD_ADD 115 /* Y0 pipe "addi" for TLS GD */ -+#define R_TILEGX_IMM8_Y1_TLS_GD_ADD 116 /* Y1 pipe "addi" for TLS GD */ -+#define R_TILEGX_TLS_IE_LOAD 117 /* "ld_tls" for TLS IE */ -+#define R_TILEGX_IMM8_X0_TLS_ADD 118 /* X0 pipe "addi" for TLS GD/IE */ -+#define R_TILEGX_IMM8_X1_TLS_ADD 119 /* X1 pipe "addi" for TLS GD/IE */ -+#define R_TILEGX_IMM8_Y0_TLS_ADD 120 /* Y0 pipe "addi" for TLS GD/IE */ -+#define R_TILEGX_IMM8_Y1_TLS_ADD 121 /* Y1 pipe "addi" for TLS GD/IE */ -+ -+#define R_TILEGX_GNU_VTINHERIT 128 /* GNU C++ vtable hierarchy */ -+#define R_TILEGX_GNU_VTENTRY 129 /* GNU C++ vtable member usage */ -+ -+#define R_TILEGX_NUM 130 -+ -+#endif /* elf.h */ diff --git a/target/linux/generic/pending-3.18/212-byteshift_portability.patch b/target/linux/generic/pending-3.18/212-byteshift_portability.patch deleted file mode 100644 index 0f23ba9be9..0000000000 --- a/target/linux/generic/pending-3.18/212-byteshift_portability.patch +++ /dev/null @@ -1,51 +0,0 @@ ---- a/tools/include/tools/be_byteshift.h -+++ b/tools/include/tools/be_byteshift.h -@@ -1,6 +1,10 @@ - #ifndef _TOOLS_BE_BYTESHIFT_H - #define _TOOLS_BE_BYTESHIFT_H - -+#ifndef __linux__ -+#include "linux_types.h" -+#endif -+ - #include - - static inline uint16_t __get_unaligned_be16(const uint8_t *p) ---- a/tools/include/tools/le_byteshift.h -+++ b/tools/include/tools/le_byteshift.h -@@ -1,6 +1,10 @@ - #ifndef _TOOLS_LE_BYTESHIFT_H - #define _TOOLS_LE_BYTESHIFT_H - -+#ifndef __linux__ -+#include "linux_types.h" -+#endif -+ - #include - - static inline uint16_t __get_unaligned_le16(const uint8_t *p) ---- /dev/null -+++ b/tools/include/tools/linux_types.h -@@ -0,0 +1,22 @@ -+#ifndef __LINUX_TYPES_H -+#define __LINUX_TYPES_H -+ -+#include -+ -+typedef uint8_t __u8; -+typedef uint8_t __be8; -+typedef uint8_t __le8; -+ -+typedef uint16_t __u16; -+typedef uint16_t __be16; -+typedef uint16_t __le16; -+ -+typedef uint32_t __u32; -+typedef uint32_t __be32; -+typedef uint32_t __le32; -+ -+typedef uint64_t __u64; -+typedef uint64_t __be64; -+typedef uint64_t __le64; -+ -+#endif diff --git a/target/linux/generic/pending-3.18/213-x86_vdso_portability.patch b/target/linux/generic/pending-3.18/213-x86_vdso_portability.patch deleted file mode 100644 index 937ab9054d..0000000000 --- a/target/linux/generic/pending-3.18/213-x86_vdso_portability.patch +++ /dev/null @@ -1,13 +0,0 @@ ---- a/arch/x86/vdso/vdso2c.c -+++ b/arch/x86/vdso/vdso2c.c -@@ -63,8 +63,8 @@ - - #include - --#include --#include -+#include -+#include - - const char *outfilename; - diff --git a/target/linux/generic/pending-3.18/214-spidev_h_portability.patch b/target/linux/generic/pending-3.18/214-spidev_h_portability.patch deleted file mode 100644 index 39fa32ffa2..0000000000 --- a/target/linux/generic/pending-3.18/214-spidev_h_portability.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/include/uapi/linux/spi/spidev.h -+++ b/include/uapi/linux/spi/spidev.h -@@ -112,7 +112,7 @@ struct spi_ioc_transfer { - - /* not all platforms use or _IOC_TYPECHECK() ... */ - #define SPI_MSGSIZE(N) \ -- ((((N)*(sizeof (struct spi_ioc_transfer))) < (1 << _IOC_SIZEBITS)) \ -+ ((((N)*(sizeof (struct spi_ioc_transfer))) < (1 << 13)) \ - ? ((N)*(sizeof (struct spi_ioc_transfer))) : 0) - #define SPI_IOC_MESSAGE(N) _IOW(SPI_IOC_MAGIC, 0, char[SPI_MSGSIZE(N)]) - diff --git a/target/linux/generic/pending-3.18/220-gc_sections.patch b/target/linux/generic/pending-3.18/220-gc_sections.patch deleted file mode 100644 index d872949f8d..0000000000 --- a/target/linux/generic/pending-3.18/220-gc_sections.patch +++ /dev/null @@ -1,531 +0,0 @@ -From: Felix Fietkau - -use -ffunction-sections, -fdata-sections and --gc-sections - -In combination with kernel symbol export stripping this significantly reduces -the kernel image size. Used on both ARM and MIPS architectures. - -Signed-off-by: Felix Fietkau -Signed-off-by: Jonas Gorski -Signed-off-by: Gabor Juhos ---- - ---- a/arch/mips/Makefile -+++ b/arch/mips/Makefile -@@ -89,10 +89,14 @@ all-$(CONFIG_SYS_SUPPORTS_ZBOOT)+= vmlin - # - cflags-y += -G 0 -mno-abicalls -fno-pic -pipe - cflags-y += -msoft-float --LDFLAGS_vmlinux += -G 0 -static -n -nostdlib -+LDFLAGS_vmlinux += -G 0 -static -n -nostdlib --gc-sections - KBUILD_AFLAGS_MODULE += -mlong-calls - KBUILD_CFLAGS_MODULE += -mlong-calls - -+ifndef CONFIG_FUNCTION_TRACER -+KBUILD_CFLAGS_KERNEL += -ffunction-sections -fdata-sections -+endif -+ - # - # pass -msoft-float to GAS if it supports it. However on newer binutils - # (specifically newer than 2.24.51.20140728) we then also need to explicitly ---- a/arch/mips/kernel/vmlinux.lds.S -+++ b/arch/mips/kernel/vmlinux.lds.S -@@ -67,7 +67,7 @@ SECTIONS - /* Exception table for data bus errors */ - __dbe_table : { - __start___dbe_table = .; -- *(__dbe_table) -+ KEEP(*(__dbe_table)) - __stop___dbe_table = .; - } - -@@ -112,7 +112,7 @@ SECTIONS - . = ALIGN(4); - .mips.machines.init : AT(ADDR(.mips.machines.init) - LOAD_OFFSET) { - __mips_machines_start = .; -- *(.mips.machines.init) -+ KEEP(*(.mips.machines.init)) - __mips_machines_end = .; - } - ---- a/include/asm-generic/vmlinux.lds.h -+++ b/include/asm-generic/vmlinux.lds.h -@@ -89,7 +89,7 @@ - #ifdef CONFIG_FTRACE_MCOUNT_RECORD - #define MCOUNT_REC() . = ALIGN(8); \ - VMLINUX_SYMBOL(__start_mcount_loc) = .; \ -- *(__mcount_loc) \ -+ KEEP(*(__mcount_loc)) \ - VMLINUX_SYMBOL(__stop_mcount_loc) = .; - #else - #define MCOUNT_REC() -@@ -97,7 +97,7 @@ - - #ifdef CONFIG_TRACE_BRANCH_PROFILING - #define LIKELY_PROFILE() VMLINUX_SYMBOL(__start_annotated_branch_profile) = .; \ -- *(_ftrace_annotated_branch) \ -+ KEEP(*(_ftrace_annotated_branch)) \ - VMLINUX_SYMBOL(__stop_annotated_branch_profile) = .; - #else - #define LIKELY_PROFILE() -@@ -105,7 +105,7 @@ - - #ifdef CONFIG_PROFILE_ALL_BRANCHES - #define BRANCH_PROFILE() VMLINUX_SYMBOL(__start_branch_profile) = .; \ -- *(_ftrace_branch) \ -+ KEEP(*(_ftrace_branch)) \ - VMLINUX_SYMBOL(__stop_branch_profile) = .; - #else - #define BRANCH_PROFILE() -@@ -114,7 +114,7 @@ - #ifdef CONFIG_KPROBES - #define KPROBE_BLACKLIST() . = ALIGN(8); \ - VMLINUX_SYMBOL(__start_kprobe_blacklist) = .; \ -- *(_kprobe_blacklist) \ -+ KEEP(*(_kprobe_blacklist)) \ - VMLINUX_SYMBOL(__stop_kprobe_blacklist) = .; - #else - #define KPROBE_BLACKLIST() -@@ -123,7 +123,7 @@ - #ifdef CONFIG_EVENT_TRACING - #define FTRACE_EVENTS() . = ALIGN(8); \ - VMLINUX_SYMBOL(__start_ftrace_events) = .; \ -- *(_ftrace_events) \ -+ KEEP(*(_ftrace_events)) \ - VMLINUX_SYMBOL(__stop_ftrace_events) = .; - #else - #define FTRACE_EVENTS() -@@ -131,7 +131,7 @@ - - #ifdef CONFIG_TRACING - #define TRACE_PRINTKS() VMLINUX_SYMBOL(__start___trace_bprintk_fmt) = .; \ -- *(__trace_printk_fmt) /* Trace_printk fmt' pointer */ \ -+ KEEP(*(__trace_printk_fmt)) /* Trace_printk fmt' pointer */ \ - VMLINUX_SYMBOL(__stop___trace_bprintk_fmt) = .; - #define TRACEPOINT_STR() VMLINUX_SYMBOL(__start___tracepoint_str) = .; \ - *(__tracepoint_str) /* Trace_printk fmt' pointer */ \ -@@ -144,7 +144,7 @@ - #ifdef CONFIG_FTRACE_SYSCALLS - #define TRACE_SYSCALLS() . = ALIGN(8); \ - VMLINUX_SYMBOL(__start_syscalls_metadata) = .; \ -- *(__syscalls_metadata) \ -+ KEEP(*(__syscalls_metadata)) \ - VMLINUX_SYMBOL(__stop_syscalls_metadata) = .; - #else - #define TRACE_SYSCALLS() -@@ -158,8 +158,8 @@ - #define _OF_TABLE_1(name) \ - . = ALIGN(8); \ - VMLINUX_SYMBOL(__##name##_of_table) = .; \ -- *(__##name##_of_table) \ -- *(__##name##_of_table_end) -+ KEEP(*(__##name##_of_table)) \ -+ KEEP(*(__##name##_of_table_end)) - - #define CLKSRC_OF_TABLES() OF_TABLE(CONFIG_CLKSRC_OF, clksrc) - #define IRQCHIP_OF_MATCH_TABLE() OF_TABLE(CONFIG_IRQCHIP, irqchip) -@@ -171,7 +171,7 @@ - #define KERNEL_DTB() \ - STRUCT_ALIGN(); \ - VMLINUX_SYMBOL(__dtb_start) = .; \ -- *(.dtb.init.rodata) \ -+ KEEP(*(.dtb.init.rodata)) \ - VMLINUX_SYMBOL(__dtb_end) = .; - - /* .data section */ -@@ -187,16 +187,17 @@ - /* implement dynamic printk debug */ \ - . = ALIGN(8); \ - VMLINUX_SYMBOL(__start___jump_table) = .; \ -- *(__jump_table) \ -+ KEEP(*(__jump_table)) \ - VMLINUX_SYMBOL(__stop___jump_table) = .; \ - . = ALIGN(8); \ - VMLINUX_SYMBOL(__start___verbose) = .; \ -- *(__verbose) \ -+ KEEP(*(__verbose)) \ - VMLINUX_SYMBOL(__stop___verbose) = .; \ - LIKELY_PROFILE() \ - BRANCH_PROFILE() \ - TRACE_PRINTKS() \ -- TRACEPOINT_STR() -+ TRACEPOINT_STR() \ -+ *(.data.[a-zA-Z_]*) - - /* - * Data section helpers -@@ -250,35 +251,35 @@ - /* PCI quirks */ \ - .pci_fixup : AT(ADDR(.pci_fixup) - LOAD_OFFSET) { \ - VMLINUX_SYMBOL(__start_pci_fixups_early) = .; \ -- *(.pci_fixup_early) \ -+ KEEP(*(.pci_fixup_early)) \ - VMLINUX_SYMBOL(__end_pci_fixups_early) = .; \ - VMLINUX_SYMBOL(__start_pci_fixups_header) = .; \ -- *(.pci_fixup_header) \ -+ KEEP(*(.pci_fixup_header)) \ - VMLINUX_SYMBOL(__end_pci_fixups_header) = .; \ - VMLINUX_SYMBOL(__start_pci_fixups_final) = .; \ -- *(.pci_fixup_final) \ -+ KEEP(*(.pci_fixup_final)) \ - VMLINUX_SYMBOL(__end_pci_fixups_final) = .; \ - VMLINUX_SYMBOL(__start_pci_fixups_enable) = .; \ -- *(.pci_fixup_enable) \ -+ KEEP(*(.pci_fixup_enable)) \ - VMLINUX_SYMBOL(__end_pci_fixups_enable) = .; \ - VMLINUX_SYMBOL(__start_pci_fixups_resume) = .; \ -- *(.pci_fixup_resume) \ -+ KEEP(*(.pci_fixup_resume)) \ - VMLINUX_SYMBOL(__end_pci_fixups_resume) = .; \ - VMLINUX_SYMBOL(__start_pci_fixups_resume_early) = .; \ -- *(.pci_fixup_resume_early) \ -+ KEEP(*(.pci_fixup_resume_early)) \ - VMLINUX_SYMBOL(__end_pci_fixups_resume_early) = .; \ - VMLINUX_SYMBOL(__start_pci_fixups_suspend) = .; \ -- *(.pci_fixup_suspend) \ -+ KEEP(*(.pci_fixup_suspend)) \ - VMLINUX_SYMBOL(__end_pci_fixups_suspend) = .; \ - VMLINUX_SYMBOL(__start_pci_fixups_suspend_late) = .; \ -- *(.pci_fixup_suspend_late) \ -+ KEEP(*(.pci_fixup_suspend_late)) \ - VMLINUX_SYMBOL(__end_pci_fixups_suspend_late) = .; \ - } \ - \ - /* Built-in firmware blobs */ \ - .builtin_fw : AT(ADDR(.builtin_fw) - LOAD_OFFSET) { \ - VMLINUX_SYMBOL(__start_builtin_fw) = .; \ -- *(.builtin_fw) \ -+ KEEP(*(.builtin_fw)) \ - VMLINUX_SYMBOL(__end_builtin_fw) = .; \ - } \ - \ -@@ -287,49 +288,49 @@ - /* Kernel symbol table: Normal symbols */ \ - __ksymtab : AT(ADDR(__ksymtab) - LOAD_OFFSET) { \ - VMLINUX_SYMBOL(__start___ksymtab) = .; \ -- *(SORT(___ksymtab+*)) \ -+ KEEP(*(SORT(___ksymtab+*))) \ - VMLINUX_SYMBOL(__stop___ksymtab) = .; \ - } \ - \ - /* Kernel symbol table: GPL-only symbols */ \ - __ksymtab_gpl : AT(ADDR(__ksymtab_gpl) - LOAD_OFFSET) { \ - VMLINUX_SYMBOL(__start___ksymtab_gpl) = .; \ -- *(SORT(___ksymtab_gpl+*)) \ -+ KEEP(*(SORT(___ksymtab_gpl+*))) \ - VMLINUX_SYMBOL(__stop___ksymtab_gpl) = .; \ - } \ - \ - /* Kernel symbol table: Normal unused symbols */ \ - __ksymtab_unused : AT(ADDR(__ksymtab_unused) - LOAD_OFFSET) { \ - VMLINUX_SYMBOL(__start___ksymtab_unused) = .; \ -- *(SORT(___ksymtab_unused+*)) \ -+ KEEP(*(SORT(___ksymtab_unused+*))) \ - VMLINUX_SYMBOL(__stop___ksymtab_unused) = .; \ - } \ - \ - /* Kernel symbol table: GPL-only unused symbols */ \ - __ksymtab_unused_gpl : AT(ADDR(__ksymtab_unused_gpl) - LOAD_OFFSET) { \ - VMLINUX_SYMBOL(__start___ksymtab_unused_gpl) = .; \ -- *(SORT(___ksymtab_unused_gpl+*)) \ -+ KEEP(*(SORT(___ksymtab_unused_gpl+*))) \ - VMLINUX_SYMBOL(__stop___ksymtab_unused_gpl) = .; \ - } \ - \ - /* Kernel symbol table: GPL-future-only symbols */ \ - __ksymtab_gpl_future : AT(ADDR(__ksymtab_gpl_future) - LOAD_OFFSET) { \ - VMLINUX_SYMBOL(__start___ksymtab_gpl_future) = .; \ -- *(SORT(___ksymtab_gpl_future+*)) \ -+ KEEP(*(SORT(___ksymtab_gpl_future+*))) \ - VMLINUX_SYMBOL(__stop___ksymtab_gpl_future) = .; \ - } \ - \ - /* Kernel symbol table: Normal symbols */ \ - __kcrctab : AT(ADDR(__kcrctab) - LOAD_OFFSET) { \ - VMLINUX_SYMBOL(__start___kcrctab) = .; \ -- *(SORT(___kcrctab+*)) \ -+ KEEP(*(SORT(___kcrctab+*))) \ - VMLINUX_SYMBOL(__stop___kcrctab) = .; \ - } \ - \ - /* Kernel symbol table: GPL-only symbols */ \ - __kcrctab_gpl : AT(ADDR(__kcrctab_gpl) - LOAD_OFFSET) { \ - VMLINUX_SYMBOL(__start___kcrctab_gpl) = .; \ -- *(SORT(___kcrctab_gpl+*)) \ -+ KEEP(*(SORT(___kcrctab_gpl+*))) \ - VMLINUX_SYMBOL(__stop___kcrctab_gpl) = .; \ - } \ - \ -@@ -343,14 +344,14 @@ - /* Kernel symbol table: GPL-only unused symbols */ \ - __kcrctab_unused_gpl : AT(ADDR(__kcrctab_unused_gpl) - LOAD_OFFSET) { \ - VMLINUX_SYMBOL(__start___kcrctab_unused_gpl) = .; \ -- *(SORT(___kcrctab_unused_gpl+*)) \ -+ KEEP(*(SORT(___kcrctab_unused_gpl+*))) \ - VMLINUX_SYMBOL(__stop___kcrctab_unused_gpl) = .; \ - } \ - \ - /* Kernel symbol table: GPL-future-only symbols */ \ - __kcrctab_gpl_future : AT(ADDR(__kcrctab_gpl_future) - LOAD_OFFSET) { \ - VMLINUX_SYMBOL(__start___kcrctab_gpl_future) = .; \ -- *(SORT(___kcrctab_gpl_future+*)) \ -+ KEEP(*(SORT(___kcrctab_gpl_future+*))) \ - VMLINUX_SYMBOL(__stop___kcrctab_gpl_future) = .; \ - } \ - \ -@@ -369,14 +370,14 @@ - /* Built-in module parameters. */ \ - __param : AT(ADDR(__param) - LOAD_OFFSET) { \ - VMLINUX_SYMBOL(__start___param) = .; \ -- *(__param) \ -+ KEEP(*(__param)) \ - VMLINUX_SYMBOL(__stop___param) = .; \ - } \ - \ - /* Built-in module versions. */ \ - __modver : AT(ADDR(__modver) - LOAD_OFFSET) { \ - VMLINUX_SYMBOL(__start___modver) = .; \ -- *(__modver) \ -+ KEEP(*(__modver)) \ - VMLINUX_SYMBOL(__stop___modver) = .; \ - . = ALIGN((align)); \ - VMLINUX_SYMBOL(__end_rodata) = .; \ -@@ -432,7 +433,7 @@ - #define ENTRY_TEXT \ - ALIGN_FUNCTION(); \ - VMLINUX_SYMBOL(__entry_text_start) = .; \ -- *(.entry.text) \ -+ KEEP(*(.entry.text)) \ - VMLINUX_SYMBOL(__entry_text_end) = .; - - #ifdef CONFIG_FUNCTION_GRAPH_TRACER -@@ -460,7 +461,7 @@ - . = ALIGN(align); \ - __ex_table : AT(ADDR(__ex_table) - LOAD_OFFSET) { \ - VMLINUX_SYMBOL(__start___ex_table) = .; \ -- *(__ex_table) \ -+ KEEP(*(__ex_table)) \ - VMLINUX_SYMBOL(__stop___ex_table) = .; \ - } - -@@ -476,8 +477,8 @@ - #ifdef CONFIG_CONSTRUCTORS - #define KERNEL_CTORS() . = ALIGN(8); \ - VMLINUX_SYMBOL(__ctors_start) = .; \ -- *(.ctors) \ -- *(.init_array) \ -+ KEEP(*(.ctors)) \ -+ KEEP(*(.init_array)) \ - VMLINUX_SYMBOL(__ctors_end) = .; - #else - #define KERNEL_CTORS() -@@ -525,7 +526,7 @@ - #define SBSS(sbss_align) \ - . = ALIGN(sbss_align); \ - .sbss : AT(ADDR(.sbss) - LOAD_OFFSET) { \ -- *(.sbss) \ -+ *(.sbss .sbss.*) \ - *(.scommon) \ - } - -@@ -543,7 +544,7 @@ - BSS_FIRST_SECTIONS \ - *(.bss..page_aligned) \ - *(.dynbss) \ -- *(.bss) \ -+ *(.bss .bss.*) \ - *(COMMON) \ - } - -@@ -592,7 +593,7 @@ - . = ALIGN(8); \ - __bug_table : AT(ADDR(__bug_table) - LOAD_OFFSET) { \ - VMLINUX_SYMBOL(__start___bug_table) = .; \ -- *(__bug_table) \ -+ KEEP(*(__bug_table)) \ - VMLINUX_SYMBOL(__stop___bug_table) = .; \ - } - #else -@@ -604,7 +605,7 @@ - . = ALIGN(4); \ - .tracedata : AT(ADDR(.tracedata) - LOAD_OFFSET) { \ - VMLINUX_SYMBOL(__tracedata_start) = .; \ -- *(.tracedata) \ -+ KEEP(*(.tracedata)) \ - VMLINUX_SYMBOL(__tracedata_end) = .; \ - } - #else -@@ -621,17 +622,17 @@ - #define INIT_SETUP(initsetup_align) \ - . = ALIGN(initsetup_align); \ - VMLINUX_SYMBOL(__setup_start) = .; \ -- *(.init.setup) \ -+ KEEP(*(.init.setup)) \ - VMLINUX_SYMBOL(__setup_end) = .; - - #define INIT_CALLS_LEVEL(level) \ - VMLINUX_SYMBOL(__initcall##level##_start) = .; \ -- *(.initcall##level##.init) \ -- *(.initcall##level##s.init) \ -+ KEEP(*(.initcall##level##.init)) \ -+ KEEP(*(.initcall##level##s.init)) \ - - #define INIT_CALLS \ - VMLINUX_SYMBOL(__initcall_start) = .; \ -- *(.initcallearly.init) \ -+ KEEP(*(.initcallearly.init)) \ - INIT_CALLS_LEVEL(0) \ - INIT_CALLS_LEVEL(1) \ - INIT_CALLS_LEVEL(2) \ -@@ -645,21 +646,21 @@ - - #define CON_INITCALL \ - VMLINUX_SYMBOL(__con_initcall_start) = .; \ -- *(.con_initcall.init) \ -+ KEEP(*(.con_initcall.init)) \ - VMLINUX_SYMBOL(__con_initcall_end) = .; - - #define SECURITY_INITCALL \ - VMLINUX_SYMBOL(__security_initcall_start) = .; \ -- *(.security_initcall.init) \ -+ KEEP(*(.security_initcall.init)) \ - VMLINUX_SYMBOL(__security_initcall_end) = .; - - #ifdef CONFIG_BLK_DEV_INITRD - #define INIT_RAM_FS \ - . = ALIGN(4); \ - VMLINUX_SYMBOL(__initramfs_start) = .; \ -- *(.init.ramfs) \ -+ KEEP(*(.init.ramfs)) \ - . = ALIGN(8); \ -- *(.init.ramfs.info) -+ KEEP(*(.init.ramfs.info)) - #else - #define INIT_RAM_FS - #endif ---- a/arch/arm/Makefile -+++ b/arch/arm/Makefile -@@ -18,11 +18,16 @@ ifeq ($(CONFIG_CPU_ENDIAN_BE8),y) - LDFLAGS_vmlinux += --be8 - LDFLAGS_MODULE += --be8 - endif -+LDFLAGS_vmlinux += --gc-sections - - OBJCOPYFLAGS :=-O binary -R .comment -S - GZFLAGS :=-9 - #KBUILD_CFLAGS +=-pipe - -+ifndef CONFIG_FUNCTION_TRACER -+KBUILD_CFLAGS_KERNEL += -ffunction-sections -fdata-sections -+endif -+ - # Never generate .eh_frame - KBUILD_CFLAGS += $(call cc-option,-fno-dwarf2-cfi-asm) - ---- a/arch/arm/kernel/vmlinux.lds.S -+++ b/arch/arm/kernel/vmlinux.lds.S -@@ -12,13 +12,13 @@ - #define PROC_INFO \ - . = ALIGN(4); \ - VMLINUX_SYMBOL(__proc_info_begin) = .; \ -- *(.proc.info.init) \ -+ KEEP(*(.proc.info.init)) \ - VMLINUX_SYMBOL(__proc_info_end) = .; - - #define IDMAP_TEXT \ - ALIGN_FUNCTION(); \ - VMLINUX_SYMBOL(__idmap_text_start) = .; \ -- *(.idmap.text) \ -+ KEEP(*(.idmap.text)) \ - VMLINUX_SYMBOL(__idmap_text_end) = .; \ - . = ALIGN(32); \ - VMLINUX_SYMBOL(__hyp_idmap_text_start) = .; \ -@@ -93,7 +93,7 @@ SECTIONS - .text : { /* Real text segment */ - _stext = .; /* Text and read-only data */ - __exception_text_start = .; -- *(.exception.text) -+ KEEP(*(.exception.text)) - __exception_text_end = .; - IRQENTRY_TEXT - TEXT_TEXT -@@ -118,7 +118,7 @@ SECTIONS - __ex_table : AT(ADDR(__ex_table) - LOAD_OFFSET) { - __start___ex_table = .; - #ifdef CONFIG_MMU -- *(__ex_table) -+ KEEP(*(__ex_table)) - #endif - __stop___ex_table = .; - } -@@ -130,12 +130,12 @@ SECTIONS - . = ALIGN(8); - .ARM.unwind_idx : { - __start_unwind_idx = .; -- *(.ARM.exidx*) -+ KEEP(*(.ARM.exidx*)) - __stop_unwind_idx = .; - } - .ARM.unwind_tab : { - __start_unwind_tab = .; -- *(.ARM.extab*) -+ KEEP(*(.ARM.extab*)) - __stop_unwind_tab = .; - } - #endif -@@ -154,14 +154,14 @@ SECTIONS - */ - __vectors_start = .; - .vectors 0 : AT(__vectors_start) { -- *(.vectors) -+ KEEP(*(.vectors)) - } - . = __vectors_start + SIZEOF(.vectors); - __vectors_end = .; - - __stubs_start = .; - .stubs 0x1000 : AT(__stubs_start) { -- *(.stubs) -+ KEEP(*(.stubs)) - } - . = __stubs_start + SIZEOF(.stubs); - __stubs_end = .; -@@ -175,24 +175,24 @@ SECTIONS - } - .init.arch.info : { - __arch_info_begin = .; -- *(.arch.info.init) -+ KEEP(*(.arch.info.init)) - __arch_info_end = .; - } - .init.tagtable : { - __tagtable_begin = .; -- *(.taglist.init) -+ KEEP(*(.taglist.init)) - __tagtable_end = .; - } - #ifdef CONFIG_SMP_ON_UP - .init.smpalt : { - __smpalt_begin = .; -- *(.alt.smp.init) -+ KEEP(*(.alt.smp.init)) - __smpalt_end = .; - } - #endif - .init.pv_table : { - __pv_table_begin = .; -- *(.pv_table) -+ KEEP(*(.pv_table)) - __pv_table_end = .; - } - .init.data : { ---- a/arch/arm/boot/compressed/Makefile -+++ b/arch/arm/boot/compressed/Makefile -@@ -122,6 +122,7 @@ ifeq ($(CONFIG_FUNCTION_TRACER),y) - ORIG_CFLAGS := $(KBUILD_CFLAGS) - KBUILD_CFLAGS = $(subst -pg, , $(ORIG_CFLAGS)) - endif -+KBUILD_CFLAGS_KERNEL := $(patsubst -f%-sections,,$(KBUILD_CFLAGS_KERNEL)) - - ccflags-y := -fpic -mno-single-pic-base -fno-builtin -I$(obj) - asflags-y := -DZIMAGE diff --git a/target/linux/generic/pending-3.18/221-module_exports.patch b/target/linux/generic/pending-3.18/221-module_exports.patch deleted file mode 100644 index f2cad7a028..0000000000 --- a/target/linux/generic/pending-3.18/221-module_exports.patch +++ /dev/null @@ -1,88 +0,0 @@ ---- a/include/asm-generic/vmlinux.lds.h -+++ b/include/asm-generic/vmlinux.lds.h -@@ -54,6 +54,16 @@ - #define LOAD_OFFSET 0 - #endif - -+#ifndef SYMTAB_KEEP -+#define SYMTAB_KEEP KEEP(*(SORT(___ksymtab+*))) -+#define SYMTAB_KEEP_GPL KEEP(*(SORT(___ksymtab_gpl+*))) -+#endif -+ -+#ifndef SYMTAB_DISCARD -+#define SYMTAB_DISCARD -+#define SYMTAB_DISCARD_GPL -+#endif -+ - #include - - /* Align . to a 8 byte boundary equals to maximum function alignment. */ -@@ -288,14 +298,14 @@ - /* Kernel symbol table: Normal symbols */ \ - __ksymtab : AT(ADDR(__ksymtab) - LOAD_OFFSET) { \ - VMLINUX_SYMBOL(__start___ksymtab) = .; \ -- KEEP(*(SORT(___ksymtab+*))) \ -+ SYMTAB_KEEP \ - VMLINUX_SYMBOL(__stop___ksymtab) = .; \ - } \ - \ - /* Kernel symbol table: GPL-only symbols */ \ - __ksymtab_gpl : AT(ADDR(__ksymtab_gpl) - LOAD_OFFSET) { \ - VMLINUX_SYMBOL(__start___ksymtab_gpl) = .; \ -- KEEP(*(SORT(___ksymtab_gpl+*))) \ -+ SYMTAB_KEEP_GPL \ - VMLINUX_SYMBOL(__stop___ksymtab_gpl) = .; \ - } \ - \ -@@ -357,7 +367,7 @@ - \ - /* Kernel symbol table: strings */ \ - __ksymtab_strings : AT(ADDR(__ksymtab_strings) - LOAD_OFFSET) { \ -- *(__ksymtab_strings) \ -+ *(__ksymtab_strings+*) \ - } \ - \ - /* __*init sections */ \ -@@ -679,6 +689,8 @@ - EXIT_TEXT \ - EXIT_DATA \ - EXIT_CALL \ -+ SYMTAB_DISCARD \ -+ SYMTAB_DISCARD_GPL \ - *(.discard) \ - *(.discard.*) \ - } ---- a/scripts/Makefile.build -+++ b/scripts/Makefile.build -@@ -298,7 +298,7 @@ targets += $(extra-y) $(MAKECMDGOALS) $( - # Linker scripts preprocessor (.lds.S -> .lds) - # --------------------------------------------------------------------------- - quiet_cmd_cpp_lds_S = LDS $@ -- cmd_cpp_lds_S = $(CPP) $(cpp_flags) -P -C -U$(ARCH) \ -+ cmd_cpp_lds_S = $(CPP) $(EXTRA_LDSFLAGS) $(cpp_flags) -P -C -U$(ARCH) \ - -D__ASSEMBLY__ -DLINKER_SCRIPT -o $@ $< - - $(obj)/%.lds: $(src)/%.lds.S FORCE ---- a/include/linux/export.h -+++ b/include/linux/export.h -@@ -52,12 +52,19 @@ extern struct module __this_module; - #define __CRC_SYMBOL(sym, sec) - #endif - -+#ifdef MODULE -+#define __EXPORT_SUFFIX(sym) -+#else -+#define __EXPORT_SUFFIX(sym) "+" #sym -+#endif -+ - /* For every exported symbol, place a struct in the __ksymtab section */ - #define __EXPORT_SYMBOL(sym, sec) \ - extern typeof(sym) sym; \ - __CRC_SYMBOL(sym, sec) \ - static const char __kstrtab_##sym[] \ -- __attribute__((section("__ksymtab_strings"), aligned(1))) \ -+ __attribute__((section("__ksymtab_strings" \ -+ __EXPORT_SUFFIX(sym)), aligned(1))) \ - = VMLINUX_SYMBOL_STR(sym); \ - extern const struct kernel_symbol __ksymtab_##sym; \ - __visible const struct kernel_symbol __ksymtab_##sym \ diff --git a/target/linux/generic/pending-3.18/230-openwrt_lzma_options.patch b/target/linux/generic/pending-3.18/230-openwrt_lzma_options.patch deleted file mode 100644 index 73978f745b..0000000000 --- a/target/linux/generic/pending-3.18/230-openwrt_lzma_options.patch +++ /dev/null @@ -1,58 +0,0 @@ ---- a/scripts/Makefile.lib -+++ b/scripts/Makefile.lib -@@ -325,7 +325,7 @@ cmd_bzip2 = (cat $(filter-out FORCE,$^) - - quiet_cmd_lzma = LZMA $@ - cmd_lzma = (cat $(filter-out FORCE,$^) | \ -- lzma -9 && $(call size_append, $(filter-out FORCE,$^))) > $@ || \ -+ lzma e -d20 -lc1 -lp2 -pb2 -eos -si -so && $(call size_append, $(filter-out FORCE,$^))) > $@ || \ - (rm -f $@ ; false) - - quiet_cmd_lzo = LZO $@ ---- a/scripts/gen_initramfs_list.sh -+++ b/scripts/gen_initramfs_list.sh -@@ -226,7 +226,7 @@ cpio_list= - output="/dev/stdout" - output_file="" - is_cpio_compressed= --compr="gzip -n -9 -f" -+compr="gzip -n -9 -f -" - - arg="$1" - case "$arg" in -@@ -242,13 +242,13 @@ case "$arg" in - output=${cpio_list} - echo "$output_file" | grep -q "\.gz$" \ - && [ -x "`which gzip 2> /dev/null`" ] \ -- && compr="gzip -n -9 -f" -+ && compr="gzip -n -9 -f -" - echo "$output_file" | grep -q "\.bz2$" \ - && [ -x "`which bzip2 2> /dev/null`" ] \ -- && compr="bzip2 -9 -f" -+ && compr="bzip2 -9 -f -" - echo "$output_file" | grep -q "\.lzma$" \ - && [ -x "`which lzma 2> /dev/null`" ] \ -- && compr="lzma -9 -f" -+ && compr="lzma e -d20 -lc1 -lp2 -pb2 -eos -si -so" - echo "$output_file" | grep -q "\.xz$" \ - && [ -x "`which xz 2> /dev/null`" ] \ - && compr="xz --check=crc32 --lzma2=dict=1MiB" -@@ -315,7 +315,7 @@ if [ ! -z ${output_file} ]; then - if [ "${is_cpio_compressed}" = "compressed" ]; then - cat ${cpio_tfile} > ${output_file} - else -- (cat ${cpio_tfile} | ${compr} - > ${output_file}) \ -+ (cat ${cpio_tfile} | ${compr} > ${output_file}) \ - || (rm -f ${output_file} ; false) - fi - [ -z ${cpio_file} ] && rm ${cpio_tfile} ---- a/lib/decompress.c -+++ b/lib/decompress.c -@@ -48,6 +48,7 @@ static const struct compress_format comp - { {037, 0236}, "gzip", gunzip }, - { {0x42, 0x5a}, "bzip2", bunzip2 }, - { {0x5d, 0x00}, "lzma", unlzma }, -+ { {0x6d, 0x00}, "lzma-librecmc", unlzma }, - { {0xfd, 0x37}, "xz", unxz }, - { {0x89, 0x4c}, "lzo", unlzo }, - { {0x02, 0x21}, "lz4", unlz4 }, diff --git a/target/linux/generic/pending-3.18/250-netfilter_depends.patch b/target/linux/generic/pending-3.18/250-netfilter_depends.patch deleted file mode 100644 index 47be4a0197..0000000000 --- a/target/linux/generic/pending-3.18/250-netfilter_depends.patch +++ /dev/null @@ -1,18 +0,0 @@ ---- a/net/netfilter/Kconfig -+++ b/net/netfilter/Kconfig -@@ -210,7 +210,6 @@ config NF_CONNTRACK_FTP - - config NF_CONNTRACK_H323 - tristate "H.323 protocol support" -- depends on (IPV6 || IPV6=n) - depends on NETFILTER_ADVANCED - help - H.323 is a VoIP signalling protocol from ITU-T. As one of the most -@@ -907,7 +906,6 @@ config NETFILTER_XT_TARGET_SECMARK - - config NETFILTER_XT_TARGET_TCPMSS - tristate '"TCPMSS" target support' -- depends on (IPV6 || IPV6=n) - default m if NETFILTER_ADVANCED=n - ---help--- - This option adds a `TCPMSS' target, which allows you to alter the diff --git a/target/linux/generic/pending-3.18/251-sound_kconfig.patch b/target/linux/generic/pending-3.18/251-sound_kconfig.patch deleted file mode 100644 index c2ebacecd1..0000000000 --- a/target/linux/generic/pending-3.18/251-sound_kconfig.patch +++ /dev/null @@ -1,18 +0,0 @@ ---- a/sound/core/Kconfig -+++ b/sound/core/Kconfig -@@ -10,13 +10,13 @@ config SND_DMAENGINE_PCM - tristate - - config SND_HWDEP -- tristate -+ tristate "Sound hardware support" - - config SND_RAWMIDI - tristate - - config SND_COMPRESS_OFFLOAD -- tristate -+ tristate "Compression offloading support" - - # To be effective this also requires INPUT - users should say: - # select SND_JACK if INPUT=y || INPUT=SND diff --git a/target/linux/generic/pending-3.18/252-mv_cesa_depends.patch b/target/linux/generic/pending-3.18/252-mv_cesa_depends.patch deleted file mode 100644 index fee28db120..0000000000 --- a/target/linux/generic/pending-3.18/252-mv_cesa_depends.patch +++ /dev/null @@ -1,10 +0,0 @@ ---- a/drivers/crypto/Kconfig -+++ b/drivers/crypto/Kconfig -@@ -164,6 +164,7 @@ config CRYPTO_DEV_MV_CESA - depends on PLAT_ORION - select CRYPTO_ALGAPI - select CRYPTO_AES -+ select CRYPTO_HASH2 - select CRYPTO_BLKCIPHER2 - select CRYPTO_HASH - help diff --git a/target/linux/generic/pending-3.18/253-ssb_b43_default_on.patch b/target/linux/generic/pending-3.18/253-ssb_b43_default_on.patch deleted file mode 100644 index 29d2a41a3b..0000000000 --- a/target/linux/generic/pending-3.18/253-ssb_b43_default_on.patch +++ /dev/null @@ -1,29 +0,0 @@ ---- a/drivers/ssb/Kconfig -+++ b/drivers/ssb/Kconfig -@@ -29,6 +29,7 @@ config SSB_SPROM - config SSB_BLOCKIO - bool - depends on SSB -+ default y - - config SSB_PCIHOST_POSSIBLE - bool -@@ -49,7 +50,7 @@ config SSB_PCIHOST - config SSB_B43_PCI_BRIDGE - bool - depends on SSB_PCIHOST -- default n -+ default y - - config SSB_PCMCIAHOST_POSSIBLE - bool ---- a/drivers/bcma/Kconfig -+++ b/drivers/bcma/Kconfig -@@ -17,6 +17,7 @@ config BCMA - config BCMA_BLOCKIO - bool - depends on BCMA -+ default y - - config BCMA_HOST_PCI_POSSIBLE - bool diff --git a/target/linux/generic/pending-3.18/254-textsearch_kconfig_hacks.patch b/target/linux/generic/pending-3.18/254-textsearch_kconfig_hacks.patch deleted file mode 100644 index 3c3b1e1b53..0000000000 --- a/target/linux/generic/pending-3.18/254-textsearch_kconfig_hacks.patch +++ /dev/null @@ -1,23 +0,0 @@ ---- a/lib/Kconfig -+++ b/lib/Kconfig -@@ -320,16 +320,16 @@ config BCH_CONST_T - # Textsearch support is select'ed if needed - # - config TEXTSEARCH -- boolean -+ boolean "Textsearch support" - - config TEXTSEARCH_KMP -- tristate -+ tristate "Textsearch KMP" - - config TEXTSEARCH_BM -- tristate -+ tristate "Textsearch BM" - - config TEXTSEARCH_FSM -- tristate -+ tristate "Textsearch FSM" - - config BTREE - boolean diff --git a/target/linux/generic/pending-3.18/255-lib80211_kconfig_hacks.patch b/target/linux/generic/pending-3.18/255-lib80211_kconfig_hacks.patch deleted file mode 100644 index d8752359c7..0000000000 --- a/target/linux/generic/pending-3.18/255-lib80211_kconfig_hacks.patch +++ /dev/null @@ -1,31 +0,0 @@ ---- a/net/wireless/Kconfig -+++ b/net/wireless/Kconfig -@@ -183,7 +183,7 @@ config CFG80211_WEXT - extensions with cfg80211-based drivers. - - config LIB80211 -- tristate -+ tristate "LIB80211" - default n - help - This options enables a library of common routines used -@@ -192,13 +192,16 @@ config LIB80211 - Drivers should select this themselves if needed. - - config LIB80211_CRYPT_WEP -- tristate -+ tristate "LIB80211_CRYPT_WEP" -+ select LIB80211 - - config LIB80211_CRYPT_CCMP -- tristate -+ tristate "LIB80211_CRYPT_CCMP" -+ select LIB80211 - - config LIB80211_CRYPT_TKIP -- tristate -+ tristate "LIB80211_CRYPT_TKIP" -+ select LIB80211 - - config LIB80211_DEBUG - bool "lib80211 debugging messages" diff --git a/target/linux/generic/pending-3.18/256-crypto_add_kconfig_prompts.patch b/target/linux/generic/pending-3.18/256-crypto_add_kconfig_prompts.patch deleted file mode 100644 index f9f6c0ea7b..0000000000 --- a/target/linux/generic/pending-3.18/256-crypto_add_kconfig_prompts.patch +++ /dev/null @@ -1,47 +0,0 @@ ---- a/crypto/Kconfig -+++ b/crypto/Kconfig -@@ -32,7 +32,7 @@ config CRYPTO_FIPS - this is. - - config CRYPTO_ALGAPI -- tristate -+ tristate "ALGAPI" - select CRYPTO_ALGAPI2 - help - This option provides the API for cryptographic algorithms. -@@ -41,7 +41,7 @@ config CRYPTO_ALGAPI2 - tristate - - config CRYPTO_AEAD -- tristate -+ tristate "AEAD" - select CRYPTO_AEAD2 - select CRYPTO_ALGAPI - -@@ -50,7 +50,7 @@ config CRYPTO_AEAD2 - select CRYPTO_ALGAPI2 - - config CRYPTO_BLKCIPHER -- tristate -+ tristate "BLKCIPHER" - select CRYPTO_BLKCIPHER2 - select CRYPTO_ALGAPI - -@@ -61,7 +61,7 @@ config CRYPTO_BLKCIPHER2 - select CRYPTO_WORKQUEUE - - config CRYPTO_HASH -- tristate -+ tristate "HASH" - select CRYPTO_HASH2 - select CRYPTO_ALGAPI - -@@ -70,7 +70,7 @@ config CRYPTO_HASH2 - select CRYPTO_ALGAPI2 - - config CRYPTO_RNG -- tristate -+ tristate "RNG" - select CRYPTO_RNG2 - select CRYPTO_ALGAPI - diff --git a/target/linux/generic/pending-3.18/257-wireless_ext_kconfig_hack.patch b/target/linux/generic/pending-3.18/257-wireless_ext_kconfig_hack.patch deleted file mode 100644 index daac5898ae..0000000000 --- a/target/linux/generic/pending-3.18/257-wireless_ext_kconfig_hack.patch +++ /dev/null @@ -1,22 +0,0 @@ ---- a/net/wireless/Kconfig -+++ b/net/wireless/Kconfig -@@ -1,5 +1,5 @@ - config WIRELESS_EXT -- bool -+ bool "Wireless extensions" - - config WEXT_CORE - def_bool y -@@ -11,10 +11,10 @@ config WEXT_PROC - depends on WEXT_CORE - - config WEXT_SPY -- bool -+ bool "WEXT_SPY" - - config WEXT_PRIV -- bool -+ bool "WEXT_PRIV" - - config CFG80211 - tristate "cfg80211 - wireless configuration API" diff --git a/target/linux/generic/pending-3.18/258-netfilter_netlink_kconfig_hack.patch b/target/linux/generic/pending-3.18/258-netfilter_netlink_kconfig_hack.patch deleted file mode 100644 index 9d827c253b..0000000000 --- a/target/linux/generic/pending-3.18/258-netfilter_netlink_kconfig_hack.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/net/netfilter/Kconfig -+++ b/net/netfilter/Kconfig -@@ -2,7 +2,7 @@ menu "Core Netfilter Configuration" - depends on NET && INET && NETFILTER - - config NETFILTER_NETLINK -- tristate -+ tristate "Netfilter NFNETLINK interface" - - config NETFILTER_NETLINK_ACCT - tristate "Netfilter NFACCT over NFNETLINK interface" diff --git a/target/linux/generic/pending-3.18/259-regmap_dynamic.patch b/target/linux/generic/pending-3.18/259-regmap_dynamic.patch deleted file mode 100644 index 0748919e66..0000000000 --- a/target/linux/generic/pending-3.18/259-regmap_dynamic.patch +++ /dev/null @@ -1,83 +0,0 @@ ---- a/drivers/base/regmap/Kconfig -+++ b/drivers/base/regmap/Kconfig -@@ -3,9 +3,8 @@ - # subsystems should select the appropriate symbols. - - config REGMAP -- default y if (REGMAP_I2C || REGMAP_SPI || REGMAP_SPMI || REGMAP_MMIO || REGMAP_IRQ) - select IRQ_DOMAIN if REGMAP_IRQ -- bool -+ tristate - - config REGCACHE_COMPRESSED - select LZO_COMPRESS -@@ -14,18 +13,24 @@ config REGCACHE_COMPRESSED - - config REGMAP_I2C - tristate -+ select REGMAP - depends on I2C - - config REGMAP_SPI - tristate -+ select REGMAP -+ depends on SPI_MASTER - depends on SPI - - config REGMAP_SPMI -+ select REGMAP - tristate - depends on SPMI - - config REGMAP_MMIO - tristate -+ select REGMAP - - config REGMAP_IRQ -+ select REGMAP - bool ---- a/include/linux/regmap.h -+++ b/include/linux/regmap.h -@@ -49,7 +49,7 @@ struct reg_default { - unsigned int def; - }; - --#ifdef CONFIG_REGMAP -+#if IS_ENABLED(CONFIG_REGMAP) - - enum regmap_endian { - /* Unspecified -> 0 -> Backwards compatible default */ ---- a/drivers/base/regmap/Makefile -+++ b/drivers/base/regmap/Makefile -@@ -1,7 +1,11 @@ --obj-$(CONFIG_REGMAP) += regmap.o regcache.o --obj-$(CONFIG_REGMAP) += regcache-rbtree.o regcache-flat.o --obj-$(CONFIG_REGCACHE_COMPRESSED) += regcache-lzo.o --obj-$(CONFIG_DEBUG_FS) += regmap-debugfs.o -+regmap-core-objs = regmap.o regcache.o regcache-rbtree.o regcache-flat.o -+ifdef CONFIG_DEBUG_FS -+regmap-core-objs += regmap-debugfs.o -+endif -+ifdef CONFIG_REGCACHE_COMPRESSED -+regmap-core-objs += regcache-lzo.o -+endif -+obj-$(CONFIG_REGMAP) += regmap-core.o - obj-$(CONFIG_REGMAP_I2C) += regmap-i2c.o - obj-$(CONFIG_REGMAP_SPI) += regmap-spi.o - obj-$(CONFIG_REGMAP_SPMI) += regmap-spmi.o ---- a/drivers/base/regmap/regmap.c -+++ b/drivers/base/regmap/regmap.c -@@ -13,6 +13,7 @@ - #include - #include - #include -+#include - #include - #include - #include -@@ -2630,3 +2631,5 @@ static int __init regmap_initcall(void) - return 0; - } - postcore_initcall(regmap_initcall); -+ -+MODULE_LICENSE("GPL"); diff --git a/target/linux/generic/pending-3.18/260-crypto_test_dependencies.patch b/target/linux/generic/pending-3.18/260-crypto_test_dependencies.patch deleted file mode 100644 index 8a96fd9da7..0000000000 --- a/target/linux/generic/pending-3.18/260-crypto_test_dependencies.patch +++ /dev/null @@ -1,37 +0,0 @@ ---- a/crypto/Kconfig -+++ b/crypto/Kconfig -@@ -96,10 +96,10 @@ config CRYPTO_MANAGER - - config CRYPTO_MANAGER2 - def_tristate CRYPTO_MANAGER || (CRYPTO_MANAGER!=n && CRYPTO_ALGAPI=y) -- select CRYPTO_AEAD2 -- select CRYPTO_HASH2 -- select CRYPTO_BLKCIPHER2 -- select CRYPTO_PCOMP2 -+ select CRYPTO_AEAD2 if !CRYPTO_MANAGER_DISABLE_TESTS -+ select CRYPTO_HASH2 if !CRYPTO_MANAGER_DISABLE_TESTS -+ select CRYPTO_BLKCIPHER2 if !CRYPTO_MANAGER_DISABLE_TESTS -+ select CRYPTO_PCOMP2 if !CRYPTO_MANAGER_DISABLE_TESTS - - config CRYPTO_USER - tristate "Userspace cryptographic algorithm configuration" ---- a/crypto/algboss.c -+++ b/crypto/algboss.c -@@ -248,6 +248,9 @@ static int cryptomgr_schedule_test(struc - type = alg->cra_flags; - - /* This piece of crap needs to disappear into per-type test hooks. */ -+#ifdef CONFIG_CRYPTO_MANAGER_DISABLE_TESTS -+ type |= CRYPTO_ALG_TESTED; -+#else - if ((!((type ^ CRYPTO_ALG_TYPE_BLKCIPHER) & - CRYPTO_ALG_TYPE_BLKCIPHER_MASK) && !(type & CRYPTO_ALG_GENIV) && - ((alg->cra_flags & CRYPTO_ALG_TYPE_MASK) == -@@ -256,6 +259,7 @@ static int cryptomgr_schedule_test(struc - (!((type ^ CRYPTO_ALG_TYPE_AEAD) & CRYPTO_ALG_TYPE_MASK) && - alg->cra_type == &crypto_nivaead_type && alg->cra_aead.ivsize)) - type |= CRYPTO_ALG_TESTED; -+#endif - - param->type = type; - diff --git a/target/linux/generic/pending-3.18/270-uapi-libc-compat-add-fallback-for-unsupported-libcs.patch b/target/linux/generic/pending-3.18/270-uapi-libc-compat-add-fallback-for-unsupported-libcs.patch deleted file mode 100644 index 67895995b2..0000000000 --- a/target/linux/generic/pending-3.18/270-uapi-libc-compat-add-fallback-for-unsupported-libcs.patch +++ /dev/null @@ -1,102 +0,0 @@ -From c6bdd0d302119819de72439972d0462c26ef9eda Mon Sep 17 00:00:00 2001 -From: Felix Janda -Date: Sun, 12 Nov 2017 13:30:17 -0500 -Subject: uapi libc compat: add fallback for unsupported libcs - -libc-compat.h aims to prevent symbol collisions between uapi and libc -headers for each supported libc. This requires continuous coordination -between them. - -The goal of this commit is to improve the situation for libcs (such as -musl) which are not yet supported and/or do not wish to be explicitly -supported, while not affecting supported libcs. More precisely, with -this commit, unsupported libcs can request the suppression of any -specific uapi definition by defining the correspondings _UAPI_DEF_* -macro as 0. This can fix symbol collisions for them, as long as the -libc headers are included before the uapi headers. Inclusion in the -other order is outside the scope of this commit. - -All infrastructure in order to enable this fallback for unsupported -libcs is already in place, except that libc-compat.h unconditionally -defines all _UAPI_DEF_* macros to 1 for all unsupported libcs so that -any previous definitions are ignored. In order to fix this, this commit -merely makes these definitions conditional. - -This commit together with the musl libc commit - -http://git.musl-libc.org/cgit/musl/commit/?id=04983f2272382af92eb8f8838964ff944fbb8258 - -fixes for example the following compiler errors when is -included after musl's : - -./linux/in6.h:32:8: error: redefinition of 'struct in6_addr' -./linux/in6.h:49:8: error: redefinition of 'struct sockaddr_in6' -./linux/in6.h:59:8: error: redefinition of 'struct ipv6_mreq' - -The comments referencing glibc are still correct, but this file is not -only used for glibc any more. - -Signed-off-by: Felix Janda -Reviewed-by: Hauke Mehrtens ---- - include/uapi/linux/libc-compat.h | 55 +++++++++++++++++++++++++++++++++++++++- - 1 file changed, 54 insertions(+), 1 deletion(-) - ---- a/include/uapi/linux/libc-compat.h -+++ b/include/uapi/linux/libc-compat.h -@@ -110,27 +110,54 @@ - - /* If we did not see any headers from any supported C libraries, - * or we are being included in the kernel, then define everything -- * that we need. */ -+ * that we need. Check for previous __UAPI_* definitions to give -+ * unsupported C libraries a way to opt out of any kernel definition. */ - #else /* !defined(__GLIBC__) */ - - /* Definitions for in.h */ -+#ifndef __UAPI_DEF_IN_ADDR - #define __UAPI_DEF_IN_ADDR 1 -+#endif -+#ifndef __UAPI_DEF_IN_IPPROTO - #define __UAPI_DEF_IN_IPPROTO 1 -+#endif -+#ifndef __UAPI_DEF_IN_PKTINFO - #define __UAPI_DEF_IN_PKTINFO 1 -+#endif -+#ifndef __UAPI_DEF_IP_MREQ - #define __UAPI_DEF_IP_MREQ 1 -+#endif -+#ifndef __UAPI_DEF_SOCKADDR_IN - #define __UAPI_DEF_SOCKADDR_IN 1 -+#endif -+#ifndef __UAPI_DEF_IN_CLASS - #define __UAPI_DEF_IN_CLASS 1 -+#endif - - /* Definitions for in6.h */ -+#ifndef __UAPI_DEF_IN6_ADDR - #define __UAPI_DEF_IN6_ADDR 1 -+#endif -+#ifndef __UAPI_DEF_IN6_ADDR_ALT - #define __UAPI_DEF_IN6_ADDR_ALT 1 -+#endif -+#ifndef __UAPI_DEF_SOCKADDR_IN6 - #define __UAPI_DEF_SOCKADDR_IN6 1 -+#endif -+#ifndef __UAPI_DEF_IPV6_MREQ - #define __UAPI_DEF_IPV6_MREQ 1 -+#endif -+#ifndef __UAPI_DEF_IPPROTO_V6 - #define __UAPI_DEF_IPPROTO_V6 1 -+#endif -+#ifndef __UAPI_DEF_IPV6_OPTIONS - #define __UAPI_DEF_IPV6_OPTIONS 1 -+#endif - - /* Definitions for xattr.h */ -+#ifndef __UAPI_DEF_XATTR - #define __UAPI_DEF_XATTR 1 -+#endif - - #endif /* __GLIBC__ */ - diff --git a/target/linux/generic/pending-3.18/272-uapi-if_ether.h-prevent-redefinition-of-struct-ethhd.patch b/target/linux/generic/pending-3.18/272-uapi-if_ether.h-prevent-redefinition-of-struct-ethhd.patch deleted file mode 100644 index 6f7ba681c1..0000000000 --- a/target/linux/generic/pending-3.18/272-uapi-if_ether.h-prevent-redefinition-of-struct-ethhd.patch +++ /dev/null @@ -1,55 +0,0 @@ -From 649affd04813c43e0a72886517fcfccd63230981 Mon Sep 17 00:00:00 2001 -From: Hauke Mehrtens -Date: Mon, 29 Jun 2015 16:53:03 +0200 -Subject: uapi/if_ether.h: prevent redefinition of struct ethhdr - -Musl provides its own ethhdr struct definition. Add a guard to prevent -its definition of the appropriate musl header has already been included. - -glibc does not implement this header, but when glibc will implement this -they can just define __UAPI_DEF_ETHHDR 0 to make it work with the -kernel. - -Signed-off-by: Hauke Mehrtens ---- - include/uapi/linux/if_ether.h | 3 +++ - include/uapi/linux/libc-compat.h | 6 ++++++ - 2 files changed, 9 insertions(+) - ---- a/include/uapi/linux/if_ether.h -+++ b/include/uapi/linux/if_ether.h -@@ -22,6 +22,7 @@ - #define _UAPI_LINUX_IF_ETHER_H - - #include -+#include - - /* - * IEEE 802.3 Ethernet magic constants. The frame sizes omit the preamble -@@ -135,11 +136,13 @@ - * This is an Ethernet frame header. - */ - -+#if __UAPI_DEF_ETHHDR - struct ethhdr { - unsigned char h_dest[ETH_ALEN]; /* destination eth addr */ - unsigned char h_source[ETH_ALEN]; /* source ether addr */ - __be16 h_proto; /* packet type ID field */ - } __attribute__((packed)); -+#endif - - - #endif /* _UAPI_LINUX_IF_ETHER_H */ ---- a/include/uapi/linux/libc-compat.h -+++ b/include/uapi/linux/libc-compat.h -@@ -161,4 +161,10 @@ - - #endif /* __GLIBC__ */ - -+/* Definitions for if_ether.h */ -+/* allow libcs like musl to deactivate this, glibc does not implement this. */ -+#ifndef __UAPI_DEF_ETHHDR -+#define __UAPI_DEF_ETHHDR 1 -+#endif -+ - #endif /* _UAPI_LIBC_COMPAT_H */ diff --git a/target/linux/generic/pending-3.18/300-mips_expose_boot_raw.patch b/target/linux/generic/pending-3.18/300-mips_expose_boot_raw.patch deleted file mode 100644 index ab7c46f087..0000000000 --- a/target/linux/generic/pending-3.18/300-mips_expose_boot_raw.patch +++ /dev/null @@ -1,39 +0,0 @@ -From: Mark Miller - -This exposes the CONFIG_BOOT_RAW symbol in Kconfig. This is needed on -certain Broadcom chipsets running CFE in order to load the kernel. - -Signed-off-by: Mark Miller -Acked-by: Rob Landley ---- ---- a/arch/mips/Kconfig -+++ b/arch/mips/Kconfig -@@ -895,9 +895,6 @@ config FW_ARC - config ARCH_MAY_HAVE_PC_FDC - bool - --config BOOT_RAW -- bool -- - config CEVT_BCM1480 - bool - -@@ -2506,6 +2503,18 @@ config USE_OF - config BUILTIN_DTB - bool - -+config BOOT_RAW -+ bool "Enable the kernel to be executed from the load address" -+ default n -+ help -+ Allow the kernel to be executed from the load address for -+ bootloaders which cannot read the ELF format. This places -+ a jump to start_kernel at the load address. -+ -+ If unsure, say N. -+ -+ -+ - endmenu - - config LOCKDEP_SUPPORT diff --git a/target/linux/generic/pending-3.18/301-mips_image_cmdline_hack.patch b/target/linux/generic/pending-3.18/301-mips_image_cmdline_hack.patch deleted file mode 100644 index 68d28ff112..0000000000 --- a/target/linux/generic/pending-3.18/301-mips_image_cmdline_hack.patch +++ /dev/null @@ -1,28 +0,0 @@ ---- a/arch/mips/Kconfig -+++ b/arch/mips/Kconfig -@@ -991,6 +991,10 @@ config SYNC_R4K - config MIPS_MACHINE - def_bool n - -+config IMAGE_CMDLINE_HACK -+ bool "libreCMC specific image command line hack" -+ default n -+ - config NO_IOPORT_MAP - def_bool n - ---- a/arch/mips/kernel/head.S -+++ b/arch/mips/kernel/head.S -@@ -80,6 +80,12 @@ FEXPORT(__kernel_entry) - j kernel_entry - #endif - -+#ifdef CONFIG_IMAGE_CMDLINE_HACK -+ .ascii "CMDLINE:" -+EXPORT(__image_cmdline) -+ .fill 0x400 -+#endif /* CONFIG_IMAGE_CMDLINE_HACK */ -+ - __REF - - NESTED(kernel_entry, 16, sp) # kernel entry point diff --git a/target/linux/generic/pending-3.18/302-mips_no_branch_likely.patch b/target/linux/generic/pending-3.18/302-mips_no_branch_likely.patch deleted file mode 100644 index 44c6b04fcf..0000000000 --- a/target/linux/generic/pending-3.18/302-mips_no_branch_likely.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/arch/mips/Makefile -+++ b/arch/mips/Makefile -@@ -87,7 +87,7 @@ all-$(CONFIG_SYS_SUPPORTS_ZBOOT)+= vmlin - # machines may also. Since BFD is incredibly buggy with respect to - # crossformat linking we rely on the elf2ecoff tool for format conversion. - # --cflags-y += -G 0 -mno-abicalls -fno-pic -pipe -+cflags-y += -G 0 -mno-abicalls -fno-pic -pipe -mno-branch-likely - cflags-y += -msoft-float - LDFLAGS_vmlinux += -G 0 -static -n -nostdlib --gc-sections - KBUILD_AFLAGS_MODULE += -mlong-calls diff --git a/target/linux/generic/pending-3.18/304-mips_disable_fpu.patch b/target/linux/generic/pending-3.18/304-mips_disable_fpu.patch deleted file mode 100644 index a28ca3ebe2..0000000000 --- a/target/linux/generic/pending-3.18/304-mips_disable_fpu.patch +++ /dev/null @@ -1,105 +0,0 @@ -From: Manuel Lauss -Subject: [RFC PATCH v4 2/2] MIPS: make FPU emulator optional -Date: Mon, 7 Apr 2014 12:57:04 +0200 -Message-Id: <1396868224-252888-2-git-send-email-manuel.lauss@gmail.com> - -This small patch makes the MIPS FPU emulator optional. The kernel -kills float-users on systems without a hardware FPU by sending a SIGILL. - -Disabling the emulator shrinks vmlinux by about 54kBytes (32bit, -optimizing for size). - -Signed-off-by: Manuel Lauss ---- -v4: rediffed because of patch 1/2, should now work with micromips as well -v3: updated patch description with size savings. -v2: incorporated changes suggested by Jonas Gorski - force the fpu emulator on for micromips: relocating the parts - of the mmips code in the emulator to other areas would be a - much larger change; I went the cheap route instead with this. - - arch/mips/Kbuild | 2 +- - arch/mips/Kconfig | 14 ++++++++++++++ - arch/mips/include/asm/fpu.h | 5 +++-- - arch/mips/include/asm/fpu_emulator.h | 15 +++++++++++++++ - 4 files changed, 33 insertions(+), 3 deletions(-) - ---- a/arch/mips/Kconfig -+++ b/arch/mips/Kconfig -@@ -2498,6 +2498,20 @@ config MIPS_O32_FP64_SUPPORT - - If unsure, say N. - -+config MIPS_FPU_EMULATOR -+ bool "MIPS FPU Emulator" -+ default y -+ help -+ This option lets you disable the built-in MIPS FPU (Coprocessor 1) -+ emulator, which handles floating-point instructions on processors -+ without a hardware FPU. It is generally a good idea to keep the -+ emulator built-in, unless you are perfectly sure you have a -+ complete soft-float environment. With the emulator disabled, all -+ users of float operations will be killed with an illegal instr- -+ uction exception. -+ -+ Say Y, please. -+ - config USE_OF - bool - select OF ---- a/arch/mips/Makefile -+++ b/arch/mips/Makefile -@@ -275,7 +275,7 @@ OBJCOPYFLAGS += --remove-section=.regin - head-y := arch/mips/kernel/head.o - - libs-y += arch/mips/lib/ --libs-y += arch/mips/math-emu/ -+libs-$(CONFIG_MIPS_FPU_EMULATOR) += arch/mips/math-emu/ - - # See arch/mips/Kbuild for content of core part of the kernel - core-y += arch/mips/ ---- a/arch/mips/include/asm/fpu.h -+++ b/arch/mips/include/asm/fpu.h -@@ -169,8 +169,10 @@ static inline int init_fpu(void) - ret = __own_fpu(); - if (!ret) - _init_fpu(); -- } else -+ } else if (IS_ENABLED(CONFIG_MIPS_FPU_EMULATOR)) - fpu_emulator_init_fpu(); -+ else -+ ret = SIGILL; - - return ret; - } ---- a/arch/mips/include/asm/fpu_emulator.h -+++ b/arch/mips/include/asm/fpu_emulator.h -@@ -30,6 +30,7 @@ - #include - #include - -+#ifdef CONFIG_MIPS_FPU_EMULATOR - #ifdef CONFIG_DEBUG_FS - - struct mips_fpu_emulator_stats { -@@ -65,6 +66,20 @@ extern int do_dsemulret(struct pt_regs * - extern int fpu_emulator_cop1Handler(struct pt_regs *xcp, - struct mips_fpu_struct *ctx, int has_fpu, - void *__user *fault_addr); -+#else /* no CONFIG_MIPS_FPU_EMULATOR */ -+static inline int do_dsemulret(struct pt_regs *xcp) -+{ -+ return 0; /* 0 means error, should never get here anyway */ -+} -+ -+static inline int fpu_emulator_cop1Handler(struct pt_regs *xcp, -+ struct mips_fpu_struct *ctx, int has_fpu, -+ void *__user *fault_addr) -+{ -+ return SIGILL; /* we don't speak MIPS FPU */ -+} -+#endif /* CONFIG_MIPS_FPU_EMULATOR */ -+ - int process_fpemu_return(int sig, void __user *fault_addr); - int mm_isBranchInstr(struct pt_regs *regs, struct mm_decoded_insn dec_insn, - unsigned long *contpc); diff --git a/target/linux/generic/pending-3.18/305-mips_module_reloc.patch b/target/linux/generic/pending-3.18/305-mips_module_reloc.patch deleted file mode 100644 index fae7e70f0e..0000000000 --- a/target/linux/generic/pending-3.18/305-mips_module_reloc.patch +++ /dev/null @@ -1,356 +0,0 @@ ---- a/arch/mips/Makefile -+++ b/arch/mips/Makefile -@@ -90,8 +90,13 @@ all-$(CONFIG_SYS_SUPPORTS_ZBOOT)+= vmlin - cflags-y += -G 0 -mno-abicalls -fno-pic -pipe -mno-branch-likely - cflags-y += -msoft-float - LDFLAGS_vmlinux += -G 0 -static -n -nostdlib --gc-sections -+ifdef CONFIG_64BIT - KBUILD_AFLAGS_MODULE += -mlong-calls - KBUILD_CFLAGS_MODULE += -mlong-calls -+else -+KBUILD_AFLAGS_MODULE += -mno-long-calls -+KBUILD_CFLAGS_MODULE += -mno-long-calls -+endif - - ifndef CONFIG_FUNCTION_TRACER - KBUILD_CFLAGS_KERNEL += -ffunction-sections -fdata-sections ---- a/arch/mips/include/asm/module.h -+++ b/arch/mips/include/asm/module.h -@@ -11,6 +11,11 @@ struct mod_arch_specific { - const struct exception_table_entry *dbe_start; - const struct exception_table_entry *dbe_end; - struct mips_hi16 *r_mips_hi16_list; -+ -+ void *phys_plt_tbl; -+ void *virt_plt_tbl; -+ unsigned int phys_plt_offset; -+ unsigned int virt_plt_offset; - }; - - typedef uint8_t Elf64_Byte; /* Type for a 8-bit quantity. */ ---- a/arch/mips/kernel/module.c -+++ b/arch/mips/kernel/module.c -@@ -43,14 +43,222 @@ struct mips_hi16 { - static LIST_HEAD(dbe_list); - static DEFINE_SPINLOCK(dbe_lock); - --#ifdef MODULE_START -+/* -+ * Get the potential max trampolines size required of the init and -+ * non-init sections. Only used if we cannot find enough contiguous -+ * physically mapped memory to put the module into. -+ */ -+static unsigned int -+get_plt_size(const Elf_Ehdr *hdr, const Elf_Shdr *sechdrs, -+ const char *secstrings, unsigned int symindex, bool is_init) -+{ -+ unsigned long ret = 0; -+ unsigned int i, j; -+ Elf_Sym *syms; -+ -+ /* Everything marked ALLOC (this includes the exported symbols) */ -+ for (i = 1; i < hdr->e_shnum; ++i) { -+ unsigned int info = sechdrs[i].sh_info; -+ -+ if (sechdrs[i].sh_type != SHT_REL -+ && sechdrs[i].sh_type != SHT_RELA) -+ continue; -+ -+ /* Not a valid relocation section? */ -+ if (info >= hdr->e_shnum) -+ continue; -+ -+ /* Don't bother with non-allocated sections */ -+ if (!(sechdrs[info].sh_flags & SHF_ALLOC)) -+ continue; -+ -+ /* If it's called *.init*, and we're not init, we're -+ not interested */ -+ if ((strstr(secstrings + sechdrs[i].sh_name, ".init") != 0) -+ != is_init) -+ continue; -+ -+ syms = (Elf_Sym *) sechdrs[symindex].sh_addr; -+ if (sechdrs[i].sh_type == SHT_REL) { -+ Elf_Mips_Rel *rel = (void *) sechdrs[i].sh_addr; -+ unsigned int size = sechdrs[i].sh_size / sizeof(*rel); -+ -+ for (j = 0; j < size; ++j) { -+ Elf_Sym *sym; -+ -+ if (ELF_MIPS_R_TYPE(rel[j]) != R_MIPS_26) -+ continue; -+ -+ sym = syms + ELF_MIPS_R_SYM(rel[j]); -+ if (!is_init && sym->st_shndx != SHN_UNDEF) -+ continue; -+ -+ ret += 4 * sizeof(int); -+ } -+ } else { -+ Elf_Mips_Rela *rela = (void *) sechdrs[i].sh_addr; -+ unsigned int size = sechdrs[i].sh_size / sizeof(*rela); -+ -+ for (j = 0; j < size; ++j) { -+ Elf_Sym *sym; -+ -+ if (ELF_MIPS_R_TYPE(rela[j]) != R_MIPS_26) -+ continue; -+ -+ sym = syms + ELF_MIPS_R_SYM(rela[j]); -+ if (!is_init && sym->st_shndx != SHN_UNDEF) -+ continue; -+ -+ ret += 4 * sizeof(int); -+ } -+ } -+ } -+ -+ return ret; -+} -+ -+#ifndef MODULE_START -+static void *alloc_phys(unsigned long size) -+{ -+ unsigned order; -+ struct page *page; -+ struct page *p; -+ -+ size = PAGE_ALIGN(size); -+ order = get_order(size); -+ -+ page = alloc_pages(GFP_KERNEL | __GFP_NORETRY | __GFP_NOWARN | -+ __GFP_THISNODE, order); -+ if (!page) -+ return NULL; -+ -+ split_page(page, order); -+ -+ for (p = page + (size >> PAGE_SHIFT); p < page + (1 << order); ++p) -+ __free_page(p); -+ -+ return page_address(page); -+} -+#endif -+ -+static void free_phys(void *ptr, unsigned long size) -+{ -+ struct page *page; -+ struct page *end; -+ -+ page = virt_to_page(ptr); -+ end = page + (PAGE_ALIGN(size) >> PAGE_SHIFT); -+ -+ for (; page < end; ++page) -+ __free_page(page); -+} -+ -+ - void *module_alloc(unsigned long size) - { -+#ifdef MODULE_START - return __vmalloc_node_range(size, 1, MODULE_START, MODULE_END, - GFP_KERNEL, PAGE_KERNEL, NUMA_NO_NODE, - __builtin_return_address(0)); -+#else -+ void *ptr; -+ -+ if (size == 0) -+ return NULL; -+ -+ ptr = alloc_phys(size); -+ -+ /* If we failed to allocate physically contiguous memory, -+ * fall back to regular vmalloc. The module loader code will -+ * create jump tables to handle long jumps */ -+ if (!ptr) -+ return vmalloc(size); -+ -+ return ptr; -+#endif - } -+ -+static inline bool is_phys_addr(void *ptr) -+{ -+#ifdef CONFIG_64BIT -+ return (KSEGX((unsigned long)ptr) == CKSEG0); -+#else -+ return (KSEGX(ptr) == KSEG0); - #endif -+} -+ -+/* Free memory returned from module_alloc */ -+void module_free(struct module *mod, void *module_region) -+{ -+ if (is_phys_addr(module_region)) { -+ if (mod->module_init == module_region) -+ free_phys(module_region, mod->init_size); -+ else if (mod->module_core == module_region) -+ free_phys(module_region, mod->core_size); -+ else -+ BUG(); -+ } else { -+ vfree(module_region); -+ } -+} -+ -+static void *__module_alloc(int size, bool phys) -+{ -+ void *ptr; -+ -+ if (phys) -+ ptr = kmalloc(size, GFP_KERNEL); -+ else -+ ptr = vmalloc(size); -+ return ptr; -+} -+ -+static void __module_free(void *ptr) -+{ -+ if (is_phys_addr(ptr)) -+ kfree(ptr); -+ else -+ vfree(ptr); -+} -+ -+int module_frob_arch_sections(Elf_Ehdr *hdr, Elf_Shdr *sechdrs, -+ char *secstrings, struct module *mod) -+{ -+ unsigned int symindex = 0; -+ unsigned int core_size, init_size; -+ int i; -+ -+ mod->arch.phys_plt_offset = 0; -+ mod->arch.virt_plt_offset = 0; -+ mod->arch.phys_plt_tbl = NULL; -+ mod->arch.virt_plt_tbl = NULL; -+ -+ if (IS_ENABLED(CONFIG_64BIT)) -+ return 0; -+ -+ for (i = 1; i < hdr->e_shnum; i++) -+ if (sechdrs[i].sh_type == SHT_SYMTAB) -+ symindex = i; -+ -+ core_size = get_plt_size(hdr, sechdrs, secstrings, symindex, false); -+ init_size = get_plt_size(hdr, sechdrs, secstrings, symindex, true); -+ -+ if ((core_size + init_size) == 0) -+ return 0; -+ -+ mod->arch.phys_plt_tbl = __module_alloc(core_size + init_size, 1); -+ if (!mod->arch.phys_plt_tbl) -+ return -ENOMEM; -+ -+ mod->arch.virt_plt_tbl = __module_alloc(core_size + init_size, 0); -+ if (!mod->arch.virt_plt_tbl) { -+ __module_free(mod->arch.phys_plt_tbl); -+ mod->arch.phys_plt_tbl = NULL; -+ return -ENOMEM; -+ } -+ -+ return 0; -+} - - int apply_r_mips_none(struct module *me, u32 *location, Elf_Addr v) - { -@@ -64,8 +272,39 @@ static int apply_r_mips_32_rel(struct mo - return 0; - } - -+static Elf_Addr add_plt_entry_to(unsigned *plt_offset, -+ void *start, Elf_Addr v) -+{ -+ unsigned *tramp = start + *plt_offset; -+ *plt_offset += 4 * sizeof(int); -+ -+ /* adjust carry for addiu */ -+ if (v & 0x00008000) -+ v += 0x10000; -+ -+ tramp[0] = 0x3c190000 | (v >> 16); /* lui t9, hi16 */ -+ tramp[1] = 0x27390000 | (v & 0xffff); /* addiu t9, t9, lo16 */ -+ tramp[2] = 0x03200008; /* jr t9 */ -+ tramp[3] = 0x00000000; /* nop */ -+ -+ return (Elf_Addr) tramp; -+} -+ -+static Elf_Addr add_plt_entry(struct module *me, void *location, Elf_Addr v) -+{ -+ if (is_phys_addr(location)) -+ return add_plt_entry_to(&me->arch.phys_plt_offset, -+ me->arch.phys_plt_tbl, v); -+ else -+ return add_plt_entry_to(&me->arch.virt_plt_offset, -+ me->arch.virt_plt_tbl, v); -+ -+} -+ - static int apply_r_mips_26_rel(struct module *me, u32 *location, Elf_Addr v) - { -+ u32 ofs = *location & 0x03ffffff; -+ - if (v % 4) { - pr_err("module %s: dangerous R_MIPS_26 REL relocation\n", - me->name); -@@ -73,14 +312,17 @@ static int apply_r_mips_26_rel(struct mo - } - - if ((v & 0xf0000000) != (((unsigned long)location + 4) & 0xf0000000)) { -- printk(KERN_ERR -- "module %s: relocation overflow\n", -- me->name); -- return -ENOEXEC; -+ v = add_plt_entry(me, location, v + (ofs << 2)); -+ if (!v) { -+ printk(KERN_ERR -+ "module %s: relocation overflow\n", me->name); -+ return -ENOEXEC; -+ } -+ ofs = 0; - } - - *location = (*location & ~0x03ffffff) | -- ((*location + (v >> 2)) & 0x03ffffff); -+ ((ofs + (v >> 2)) & 0x03ffffff); - - return 0; - } -@@ -287,9 +529,36 @@ int module_finalize(const Elf_Ehdr *hdr, - list_add(&me->arch.dbe_list, &dbe_list); - spin_unlock_irq(&dbe_lock); - } -+ -+ /* Get rid of the fixup trampoline if we're running the module -+ * from physically mapped address space */ -+ if (me->arch.phys_plt_offset == 0) { -+ __module_free(me->arch.phys_plt_tbl); -+ me->arch.phys_plt_tbl = NULL; -+ } -+ if (me->arch.virt_plt_offset == 0) { -+ __module_free(me->arch.virt_plt_tbl); -+ me->arch.virt_plt_tbl = NULL; -+ } -+ - return 0; - } - -+void module_arch_freeing_init(struct module *mod) -+{ -+ if (mod->state == MODULE_STATE_LIVE) -+ return; -+ -+ if (mod->arch.phys_plt_tbl) { -+ __module_free(mod->arch.phys_plt_tbl); -+ mod->arch.phys_plt_tbl = NULL; -+ } -+ if (mod->arch.virt_plt_tbl) { -+ __module_free(mod->arch.virt_plt_tbl); -+ mod->arch.virt_plt_tbl = NULL; -+ } -+} -+ - void module_arch_cleanup(struct module *mod) - { - spin_lock_irq(&dbe_lock); diff --git a/target/linux/generic/pending-3.18/306-mips_mem_functions_performance.patch b/target/linux/generic/pending-3.18/306-mips_mem_functions_performance.patch deleted file mode 100644 index 9818677425..0000000000 --- a/target/linux/generic/pending-3.18/306-mips_mem_functions_performance.patch +++ /dev/null @@ -1,83 +0,0 @@ ---- a/arch/mips/include/asm/string.h -+++ b/arch/mips/include/asm/string.h -@@ -133,11 +133,44 @@ strncmp(__const__ char *__cs, __const__ - - #define __HAVE_ARCH_MEMSET - extern void *memset(void *__s, int __c, size_t __count); -+#define memset(__s, __c, len) \ -+({ \ -+ size_t __len = (len); \ -+ void *__ret; \ -+ if (__builtin_constant_p(len) && __len >= 64) \ -+ __ret = memset((__s), (__c), __len); \ -+ else \ -+ __ret = __builtin_memset((__s), (__c), __len); \ -+ __ret; \ -+}) - - #define __HAVE_ARCH_MEMCPY - extern void *memcpy(void *__to, __const__ void *__from, size_t __n); -+#define memcpy(dst, src, len) \ -+({ \ -+ size_t __len = (len); \ -+ void *__ret; \ -+ if (__builtin_constant_p(len) && __len >= 64) \ -+ __ret = memcpy((dst), (src), __len); \ -+ else \ -+ __ret = __builtin_memcpy((dst), (src), __len); \ -+ __ret; \ -+}) - - #define __HAVE_ARCH_MEMMOVE - extern void *memmove(void *__dest, __const__ void *__src, size_t __n); -+#define memmove(dst, src, len) \ -+({ \ -+ size_t __len = (len); \ -+ void *__ret; \ -+ if (__builtin_constant_p(len) && __len >= 64) \ -+ __ret = memmove((dst), (src), __len); \ -+ else \ -+ __ret = __builtin_memmove((dst), (src), __len); \ -+ __ret; \ -+}) -+ -+#define __HAVE_ARCH_MEMCMP -+#define memcmp(src1, src2, len) __builtin_memcmp((src1), (src2), (len)) - - #endif /* _ASM_STRING_H */ ---- a/arch/mips/lib/Makefile -+++ b/arch/mips/lib/Makefile -@@ -4,7 +4,7 @@ - - lib-y += bitops.o csum_partial.o delay.o memcpy.o memset.o \ - mips-atomic.o strlen_user.o strncpy_user.o \ -- strnlen_user.o uncached.o -+ strnlen_user.o uncached.o memcmp.o - - obj-y += iomap.o - obj-$(CONFIG_PCI) += iomap-pci.o ---- /dev/null -+++ b/arch/mips/lib/memcmp.c -@@ -0,0 +1,22 @@ -+/* -+ * copied from linux/lib/string.c -+ * -+ * Copyright (C) 1991, 1992 Linus Torvalds -+ */ -+ -+#include -+#include -+ -+#undef memcmp -+int memcmp(const void *cs, const void *ct, size_t count) -+{ -+ const unsigned char *su1, *su2; -+ int res = 0; -+ -+ for (su1 = cs, su2 = ct; 0 < count; ++su1, ++su2, count--) -+ if ((res = *su1 - *su2) != 0) -+ break; -+ return res; -+} -+EXPORT_SYMBOL(memcmp); -+ diff --git a/target/linux/generic/pending-3.18/307-mips_highmem_offset.patch b/target/linux/generic/pending-3.18/307-mips_highmem_offset.patch deleted file mode 100644 index 5a7dc9cee9..0000000000 --- a/target/linux/generic/pending-3.18/307-mips_highmem_offset.patch +++ /dev/null @@ -1,17 +0,0 @@ -Adjust highmem offset to 0x10000000 to ensure that all kmalloc allocations -stay within the same 256M boundary. This ensures that -mlong-calls is not -needed on systems with more than 256M RAM. - -Signed-off-by: Felix Fietkau ---- ---- a/arch/mips/include/asm/mach-generic/spaces.h -+++ b/arch/mips/include/asm/mach-generic/spaces.h -@@ -44,7 +44,7 @@ - * Memory above this physical address will be considered highmem. - */ - #ifndef HIGHMEM_START --#define HIGHMEM_START _AC(0x20000000, UL) -+#define HIGHMEM_START _AC(0x10000000, UL) - #endif - - #endif /* CONFIG_32BIT */ diff --git a/target/linux/generic/pending-3.18/310-arm_module_unresolved_weak_sym.patch b/target/linux/generic/pending-3.18/310-arm_module_unresolved_weak_sym.patch deleted file mode 100644 index 9210c1d2d3..0000000000 --- a/target/linux/generic/pending-3.18/310-arm_module_unresolved_weak_sym.patch +++ /dev/null @@ -1,13 +0,0 @@ ---- a/arch/arm/kernel/module.c -+++ b/arch/arm/kernel/module.c -@@ -83,6 +83,10 @@ apply_relocate(Elf32_Shdr *sechdrs, cons - return -ENOEXEC; - } - -+ if ((IS_ERR_VALUE(sym->st_value) || !sym->st_value) && -+ ELF_ST_BIND(sym->st_info) == STB_WEAK) -+ continue; -+ - loc = dstsec->sh_addr + rel->r_offset; - - switch (ELF32_R_TYPE(rel->r_info)) { diff --git a/target/linux/generic/pending-3.18/320-ppc4xx_optimization.patch b/target/linux/generic/pending-3.18/320-ppc4xx_optimization.patch deleted file mode 100644 index 8673de4df2..0000000000 --- a/target/linux/generic/pending-3.18/320-ppc4xx_optimization.patch +++ /dev/null @@ -1,31 +0,0 @@ -Upstream doesn't optimize the kernel and bootwrappers for ppc44x because -they still want to support gcc 3.3 -- well, we don't. - ---- a/arch/powerpc/Makefile -+++ b/arch/powerpc/Makefile -@@ -203,7 +203,8 @@ ifeq ($(CONFIG_FUNCTION_TRACER),y) - KBUILD_CFLAGS += -mno-sched-epilog - endif - --cpu-as-$(CONFIG_4xx) += -Wa,-m405 -+cpu-as-$(CONFIG_40x) += -Wa,-m405 -+cpu-as-$(CONFIG_44x) += -Wa,-m440 - cpu-as-$(CONFIG_ALTIVEC) += -Wa,-maltivec - cpu-as-$(CONFIG_E200) += -Wa,-me200 - ---- a/arch/powerpc/boot/Makefile -+++ b/arch/powerpc/boot/Makefile -@@ -45,10 +45,10 @@ BOOTCFLAGS += -I$(obj) -I$(srctree)/$(ob - DTC_FLAGS ?= -p 1024 - - $(obj)/4xx.o: BOOTCFLAGS += -mcpu=405 --$(obj)/ebony.o: BOOTCFLAGS += -mcpu=405 -+$(obj)/ebony.o: BOOTCFLAGS += -mcpu=440 - $(obj)/cuboot-hotfoot.o: BOOTCFLAGS += -mcpu=405 --$(obj)/cuboot-taishan.o: BOOTCFLAGS += -mcpu=405 --$(obj)/cuboot-katmai.o: BOOTCFLAGS += -mcpu=405 -+$(obj)/cuboot-taishan.o: BOOTCFLAGS += -mcpu=440 -+$(obj)/cuboot-katmai.o: BOOTCFLAGS += -mcpu=440 - $(obj)/cuboot-acadia.o: BOOTCFLAGS += -mcpu=405 - $(obj)/treeboot-walnut.o: BOOTCFLAGS += -mcpu=405 - $(obj)/treeboot-iss4xx.o: BOOTCFLAGS += -mcpu=405 diff --git a/target/linux/generic/pending-3.18/321-powerpc_crtsavres_prereq.patch b/target/linux/generic/pending-3.18/321-powerpc_crtsavres_prereq.patch deleted file mode 100644 index ab6ea7beb2..0000000000 --- a/target/linux/generic/pending-3.18/321-powerpc_crtsavres_prereq.patch +++ /dev/null @@ -1,10 +0,0 @@ ---- a/arch/powerpc/Makefile -+++ b/arch/powerpc/Makefile -@@ -165,7 +165,6 @@ CPP = $(CC) -E $(KBUILD_CFLAGS) - - CHECKFLAGS += -m$(CONFIG_WORD_SIZE) -D__powerpc__ -D__powerpc$(CONFIG_WORD_SIZE)__ - --KBUILD_LDFLAGS_MODULE += arch/powerpc/lib/crtsavres.o - - ifeq ($(CONFIG_476FPE_ERR46),y) - KBUILD_LDFLAGS_MODULE += --ppc476-workaround \ diff --git a/target/linux/generic/pending-3.18/330-MIPS-kexec-Accept-command-line-parameters-from-users.patch b/target/linux/generic/pending-3.18/330-MIPS-kexec-Accept-command-line-parameters-from-users.patch deleted file mode 100644 index 3a09572bde..0000000000 --- a/target/linux/generic/pending-3.18/330-MIPS-kexec-Accept-command-line-parameters-from-users.patch +++ /dev/null @@ -1,298 +0,0 @@ -From d8582dcf1ed66eee88a11e4760f42c0d6c8822be Mon Sep 17 00:00:00 2001 -From: Yousong Zhou -Date: Sat, 31 Jan 2015 22:26:03 +0800 -Subject: [PATCH 331/331] MIPS: kexec: Accept command line parameters from - userspace. - -Signed-off-by: Yousong Zhou ---- - arch/mips/kernel/machine_kexec.c | 153 +++++++++++++++++++++++++++++++----- - arch/mips/kernel/machine_kexec.h | 20 +++++ - arch/mips/kernel/relocate_kernel.S | 21 +++-- - 3 files changed, 167 insertions(+), 27 deletions(-) - create mode 100644 arch/mips/kernel/machine_kexec.h - ---- a/arch/mips/kernel/machine_kexec.c -+++ b/arch/mips/kernel/machine_kexec.c -@@ -10,45 +10,145 @@ - #include - #include - -+#include - #include - #include -- --extern const unsigned char relocate_new_kernel[]; --extern const size_t relocate_new_kernel_size; -- --extern unsigned long kexec_start_address; --extern unsigned long kexec_indirection_page; -+#include -+#include "machine_kexec.h" - - int (*_machine_kexec_prepare)(struct kimage *) = NULL; - void (*_machine_kexec_shutdown)(void) = NULL; - void (*_machine_crash_shutdown)(struct pt_regs *regs) = NULL; -+ - #ifdef CONFIG_SMP - void (*relocated_kexec_smp_wait) (void *); - atomic_t kexec_ready_to_reboot = ATOMIC_INIT(0); - #endif - --int --machine_kexec_prepare(struct kimage *kimage) -+static void machine_kexec_print_args(void) - { -+ unsigned long argc = (int)kexec_args[0]; -+ int i; -+ -+ pr_info("kexec_args[0] (argc): %lu\n", argc); -+ pr_info("kexec_args[1] (argv): %p\n", (void *)kexec_args[1]); -+ pr_info("kexec_args[2] (env ): %p\n", (void *)kexec_args[2]); -+ pr_info("kexec_args[3] (desc): %p\n", (void *)kexec_args[3]); -+ -+ for (i = 0; i < argc; i++) { -+ pr_info("kexec_argv[%d] = %p, %s\n", -+ i, kexec_argv[i], kexec_argv[i]); -+ } -+} -+ -+static void machine_kexec_init_argv(struct kimage *image) -+{ -+ void __user *buf = NULL; -+ size_t bufsz; -+ size_t size; -+ int i; -+ -+ bufsz = 0; -+ for (i = 0; i < image->nr_segments; i++) { -+ struct kexec_segment *seg; -+ -+ seg = &image->segment[i]; -+ if (seg->bufsz < 6) -+ continue; -+ -+ if (strncmp((char *) seg->buf, "kexec ", 6)) -+ continue; -+ -+ buf = seg->buf; -+ bufsz = seg->bufsz; -+ break; -+ } -+ -+ if (!buf) -+ return; -+ -+ size = KEXEC_COMMAND_LINE_SIZE; -+ size = min(size, bufsz); -+ if (size < bufsz) -+ pr_warn("kexec command line truncated to %zd bytes\n", size); -+ -+ /* Copy to kernel space */ -+ copy_from_user(kexec_argv_buf, buf, size); -+ kexec_argv_buf[size - 1] = 0; -+} -+ -+static void machine_kexec_parse_argv(struct kimage *image) -+{ -+ char *reboot_code_buffer; -+ int reloc_delta; -+ char *ptr; -+ int argc; -+ int i; -+ -+ ptr = kexec_argv_buf; -+ argc = 0; -+ -+ /* -+ * convert command line string to array of parameters -+ * (as bootloader does). -+ */ -+ while (ptr && *ptr && (KEXEC_MAX_ARGC > argc)) { -+ if (*ptr == ' ') { -+ *ptr++ = '\0'; -+ continue; -+ } -+ -+ kexec_argv[argc++] = ptr; -+ ptr = strchr(ptr, ' '); -+ } -+ -+ if (!argc) -+ return; -+ -+ kexec_args[0] = argc; -+ kexec_args[1] = (unsigned long)kexec_argv; -+ kexec_args[2] = 0; -+ kexec_args[3] = 0; -+ -+ reboot_code_buffer = page_address(image->control_code_page); -+ reloc_delta = reboot_code_buffer - (char *)kexec_relocate_new_kernel; -+ -+ kexec_args[1] += reloc_delta; -+ for (i = 0; i < argc; i++) -+ kexec_argv[i] += reloc_delta; -+} -+ -+int machine_kexec_prepare(struct kimage *kimage) -+{ -+ /* -+ * Whenever arguments passed from kexec-tools, Init the arguments as -+ * the original ones to try avoiding booting failure. -+ */ -+ -+ kexec_args[0] = fw_arg0; -+ kexec_args[1] = fw_arg1; -+ kexec_args[2] = fw_arg2; -+ kexec_args[3] = fw_arg3; -+ -+ machine_kexec_init_argv(kimage); -+ machine_kexec_parse_argv(kimage); -+ - if (_machine_kexec_prepare) - return _machine_kexec_prepare(kimage); - return 0; - } - --void --machine_kexec_cleanup(struct kimage *kimage) -+void machine_kexec_cleanup(struct kimage *kimage) - { - } - --void --machine_shutdown(void) -+void machine_shutdown(void) - { - if (_machine_kexec_shutdown) - _machine_kexec_shutdown(); - } - --void --machine_crash_shutdown(struct pt_regs *regs) -+void machine_crash_shutdown(struct pt_regs *regs) - { - if (_machine_crash_shutdown) - _machine_crash_shutdown(regs); -@@ -66,10 +166,12 @@ machine_kexec(struct kimage *image) - unsigned long *ptr; - - reboot_code_buffer = -- (unsigned long)page_address(image->control_code_page); -+ (unsigned long)page_address(image->control_code_page); -+ pr_info("reboot_code_buffer = %p\n", (void *)reboot_code_buffer); - - kexec_start_address = - (unsigned long) phys_to_virt(image->start); -+ pr_info("kexec_start_address = %p\n", (void *)kexec_start_address); - - if (image->type == KEXEC_TYPE_DEFAULT) { - kexec_indirection_page = -@@ -77,9 +179,19 @@ machine_kexec(struct kimage *image) - } else { - kexec_indirection_page = (unsigned long)&image->head; - } -+ pr_info("kexec_indirection_page = %p\n", (void *)kexec_indirection_page); - -- memcpy((void*)reboot_code_buffer, relocate_new_kernel, -- relocate_new_kernel_size); -+ pr_info("Where is memcpy: %p\n", memcpy); -+ pr_info("kexec_relocate_new_kernel = %p, kexec_relocate_new_kernel_end = %p\n", -+ (void *)kexec_relocate_new_kernel, &kexec_relocate_new_kernel_end); -+ pr_info("Copy %lu bytes from %p to %p\n", KEXEC_RELOCATE_NEW_KERNEL_SIZE, -+ (void *)kexec_relocate_new_kernel, (void *)reboot_code_buffer); -+ memcpy((void*)reboot_code_buffer, kexec_relocate_new_kernel, -+ KEXEC_RELOCATE_NEW_KERNEL_SIZE); -+ -+ pr_info("Before _print_args().\n"); -+ machine_kexec_print_args(); -+ pr_info("Before eval loop.\n"); - - /* - * The generic kexec code builds a page list with physical -@@ -101,15 +213,16 @@ machine_kexec(struct kimage *image) - /* - * we do not want to be bothered. - */ -+ pr_info("Before irq_disable.\n"); - local_irq_disable(); - -- printk("Will call new kernel at %08lx\n", image->start); -- printk("Bye ...\n"); -+ pr_info("Will call new kernel at %08lx\n", image->start); -+ pr_info("Bye ...\n"); - __flush_cache_all(); - #ifdef CONFIG_SMP - /* All secondary cpus now may jump to kexec_wait cycle */ - relocated_kexec_smp_wait = reboot_code_buffer + -- (void *)(kexec_smp_wait - relocate_new_kernel); -+ (void *)(kexec_smp_wait - kexec_relocate_new_kernel); - smp_wmb(); - atomic_set(&kexec_ready_to_reboot, 1); - #endif ---- /dev/null -+++ b/arch/mips/kernel/machine_kexec.h -@@ -0,0 +1,20 @@ -+#ifndef _MACHINE_KEXEC_H -+#define _MACHINE_KEXEC_H -+ -+#ifndef __ASSEMBLY__ -+extern const unsigned char kexec_relocate_new_kernel[]; -+extern unsigned long kexec_relocate_new_kernel_end; -+extern unsigned long kexec_start_address; -+extern unsigned long kexec_indirection_page; -+ -+extern char kexec_argv_buf[]; -+extern char *kexec_argv[]; -+ -+#define KEXEC_RELOCATE_NEW_KERNEL_SIZE ((unsigned long)&kexec_relocate_new_kernel_end - (unsigned long)kexec_relocate_new_kernel) -+#endif /* !__ASSEMBLY__ */ -+ -+#define KEXEC_COMMAND_LINE_SIZE 256 -+#define KEXEC_ARGV_SIZE (KEXEC_COMMAND_LINE_SIZE / 16) -+#define KEXEC_MAX_ARGC (KEXEC_ARGV_SIZE / sizeof(long)) -+ -+#endif ---- a/arch/mips/kernel/relocate_kernel.S -+++ b/arch/mips/kernel/relocate_kernel.S -@@ -12,8 +12,9 @@ - #include - #include - #include -+#include "machine_kexec.h" - --LEAF(relocate_new_kernel) -+LEAF(kexec_relocate_new_kernel) - PTR_L a0, arg0 - PTR_L a1, arg1 - PTR_L a2, arg2 -@@ -98,7 +99,7 @@ done: - #endif - /* jump to kexec_start_address */ - j s1 -- END(relocate_new_kernel) -+ END(kexec_relocate_new_kernel) - - #ifdef CONFIG_SMP - /* -@@ -184,9 +185,15 @@ kexec_indirection_page: - PTR 0 - .size kexec_indirection_page, PTRSIZE - --relocate_new_kernel_end: -+kexec_argv_buf: -+ EXPORT(kexec_argv_buf) -+ .skip KEXEC_COMMAND_LINE_SIZE -+ .size kexec_argv_buf, KEXEC_COMMAND_LINE_SIZE -+ -+kexec_argv: -+ EXPORT(kexec_argv) -+ .skip KEXEC_ARGV_SIZE -+ .size kexec_argv, KEXEC_ARGV_SIZE - --relocate_new_kernel_size: -- EXPORT(relocate_new_kernel_size) -- PTR relocate_new_kernel_end - relocate_new_kernel -- .size relocate_new_kernel_size, PTRSIZE -+kexec_relocate_new_kernel_end: -+ EXPORT(kexec_relocate_new_kernel_end) diff --git a/target/linux/generic/pending-3.18/400-mtd-add-rootfs-split-support.patch b/target/linux/generic/pending-3.18/400-mtd-add-rootfs-split-support.patch deleted file mode 100644 index a36ea70b03..0000000000 --- a/target/linux/generic/pending-3.18/400-mtd-add-rootfs-split-support.patch +++ /dev/null @@ -1,171 +0,0 @@ ---- a/drivers/mtd/Kconfig -+++ b/drivers/mtd/Kconfig -@@ -12,6 +12,23 @@ menuconfig MTD - - if MTD - -+menu "libreCMC specific MTD options" -+ -+config MTD_ROOTFS_ROOT_DEV -+ bool "Automatically set 'rootfs' partition to be root filesystem" -+ default y -+ -+config MTD_SPLIT_FIRMWARE -+ bool "Automatically split firmware partition for kernel+rootfs" -+ default y -+ -+config MTD_SPLIT_FIRMWARE_NAME -+ string "Firmware partition name" -+ depends on MTD_SPLIT_FIRMWARE -+ default "firmware" -+ -+endmenu -+ - config MTD_TESTS - tristate "MTD tests support (DANGEROUS)" - depends on m ---- a/drivers/mtd/mtdpart.c -+++ b/drivers/mtd/mtdpart.c -@@ -30,9 +30,11 @@ - #include - #include - #include -+#include - #include - - #include "mtdcore.h" -+#include "mtdsplit/mtdsplit.h" - - /* Our partition linked list */ - static LIST_HEAD(mtd_partitions); -@@ -46,13 +48,14 @@ struct mtd_part { - struct list_head list; - }; - -+static void mtd_partition_split(struct mtd_info *master, struct mtd_part *part); -+ - /* - * Given a pointer to the MTD object in the mtd_part structure, we can retrieve - * the pointer to that structure with this macro. - */ - #define PART(x) ((struct mtd_part *)(x)) - -- - /* - * MTD methods which simply translate the effective address and pass through - * to the _real_ device. -@@ -548,8 +551,10 @@ out_register: - return slave; - } - --int mtd_add_partition(struct mtd_info *master, const char *name, -- long long offset, long long length) -+ -+static int -+__mtd_add_partition(struct mtd_info *master, const char *name, -+ long long offset, long long length, bool dup_check) - { - struct mtd_partition part; - struct mtd_part *p, *new; -@@ -581,21 +586,24 @@ int mtd_add_partition(struct mtd_info *m - end = offset + length; - - mutex_lock(&mtd_partitions_mutex); -- list_for_each_entry(p, &mtd_partitions, list) -- if (p->master == master) { -- if ((start >= p->offset) && -- (start < (p->offset + p->mtd.size))) -- goto err_inv; -- -- if ((end >= p->offset) && -- (end < (p->offset + p->mtd.size))) -- goto err_inv; -- } -+ if (dup_check) { -+ list_for_each_entry(p, &mtd_partitions, list) -+ if (p->master == master) { -+ if ((start >= p->offset) && -+ (start < (p->offset + p->mtd.size))) -+ goto err_inv; -+ -+ if ((end >= p->offset) && -+ (end < (p->offset + p->mtd.size))) -+ goto err_inv; -+ } -+ } - - list_add(&new->list, &mtd_partitions); - mutex_unlock(&mtd_partitions_mutex); - - add_mtd_device(&new->mtd); -+ mtd_partition_split(master, new); - - return ret; - err_inv: -@@ -605,6 +613,12 @@ err_inv: - } - EXPORT_SYMBOL_GPL(mtd_add_partition); - -+int mtd_add_partition(struct mtd_info *master, const char *name, -+ long long offset, long long length) -+{ -+ return __mtd_add_partition(master, name, offset, length, true); -+} -+ - int mtd_del_partition(struct mtd_info *master, int partno) - { - struct mtd_part *slave, *next; -@@ -628,6 +642,35 @@ int mtd_del_partition(struct mtd_info *m - } - EXPORT_SYMBOL_GPL(mtd_del_partition); - -+#ifdef CONFIG_MTD_SPLIT_FIRMWARE_NAME -+#define SPLIT_FIRMWARE_NAME CONFIG_MTD_SPLIT_FIRMWARE_NAME -+#else -+#define SPLIT_FIRMWARE_NAME "unused" -+#endif -+ -+static void split_firmware(struct mtd_info *master, struct mtd_part *part) -+{ -+} -+ -+void __weak arch_split_mtd_part(struct mtd_info *master, const char *name, -+ int offset, int size) -+{ -+} -+ -+static void mtd_partition_split(struct mtd_info *master, struct mtd_part *part) -+{ -+ static int rootfs_found = 0; -+ -+ if (rootfs_found) -+ return; -+ -+ if (!strcmp(part->mtd.name, SPLIT_FIRMWARE_NAME) && -+ config_enabled(CONFIG_MTD_SPLIT_FIRMWARE)) -+ split_firmware(master, part); -+ -+ arch_split_mtd_part(master, part->mtd.name, part->offset, -+ part->mtd.size); -+} - /* - * This function, given a master MTD object and a partition table, creates - * and registers slave MTD objects which are bound to the master according to -@@ -657,6 +700,7 @@ int add_mtd_partitions(struct mtd_info * - mutex_unlock(&mtd_partitions_mutex); - - add_mtd_device(&slave->mtd); -+ mtd_partition_split(master, slave); - - cur_offset = slave->offset + slave->mtd.size; - } ---- a/include/linux/mtd/partitions.h -+++ b/include/linux/mtd/partitions.h -@@ -84,5 +84,7 @@ int mtd_add_partition(struct mtd_info *m - long long offset, long long length); - int mtd_del_partition(struct mtd_info *master, int partno); - uint64_t mtd_get_device_size(const struct mtd_info *mtd); -+extern void __weak arch_split_mtd_part(struct mtd_info *master, -+ const char *name, int offset, int size); - - #endif diff --git a/target/linux/generic/pending-3.18/401-mtd-add-support-for-different-partition-parser-types.patch b/target/linux/generic/pending-3.18/401-mtd-add-support-for-different-partition-parser-types.patch deleted file mode 100644 index 684234161a..0000000000 --- a/target/linux/generic/pending-3.18/401-mtd-add-support-for-different-partition-parser-types.patch +++ /dev/null @@ -1,113 +0,0 @@ -From 02cff0ccaa6d364f5c1eeea83f47ac80ccc967d4 Mon Sep 17 00:00:00 2001 -From: Gabor Juhos -Date: Tue, 3 Sep 2013 18:11:50 +0200 -Subject: [PATCH] mtd: add support for different partition parser types - -Signed-off-by: Gabor Juhos ---- - drivers/mtd/mtdpart.c | 56 ++++++++++++++++++++++++++++++++++++++++ - include/linux/mtd/partitions.h | 11 ++++++++ - 2 files changed, 67 insertions(+) - ---- a/drivers/mtd/mtdpart.c -+++ b/drivers/mtd/mtdpart.c -@@ -730,6 +730,30 @@ static struct mtd_part_parser *get_parti - - #define put_partition_parser(p) do { module_put((p)->owner); } while (0) - -+static struct mtd_part_parser * -+get_partition_parser_by_type(enum mtd_parser_type type, -+ struct mtd_part_parser *start) -+{ -+ struct mtd_part_parser *p, *ret = NULL; -+ -+ spin_lock(&part_parser_lock); -+ -+ p = list_prepare_entry(start, &part_parsers, list); -+ if (start) -+ put_partition_parser(start); -+ -+ list_for_each_entry_continue(p, &part_parsers, list) { -+ if (p->type == type && try_module_get(p->owner)) { -+ ret = p; -+ break; -+ } -+ } -+ -+ spin_unlock(&part_parser_lock); -+ -+ return ret; -+} -+ - void register_mtd_parser(struct mtd_part_parser *p) - { - spin_lock(&part_parser_lock); -@@ -845,6 +869,38 @@ int parse_mtd_partitions(struct mtd_info - return ret; - } - -+int parse_mtd_partitions_by_type(struct mtd_info *master, -+ enum mtd_parser_type type, -+ struct mtd_partition **pparts, -+ struct mtd_part_parser_data *data) -+{ -+ struct mtd_part_parser *prev = NULL; -+ int ret = 0; -+ -+ while (1) { -+ struct mtd_part_parser *parser; -+ -+ parser = get_partition_parser_by_type(type, prev); -+ if (!parser) -+ break; -+ -+ ret = (*parser->parse_fn)(master, pparts, data); -+ -+ if (ret > 0) { -+ put_partition_parser(parser); -+ printk(KERN_NOTICE -+ "%d %s partitions found on MTD device %s\n", -+ ret, parser->name, master->name); -+ break; -+ } -+ -+ prev = parser; -+ } -+ -+ return ret; -+} -+EXPORT_SYMBOL_GPL(parse_mtd_partitions_by_type); -+ - int mtd_is_partition(const struct mtd_info *mtd) - { - struct mtd_part *part; ---- a/include/linux/mtd/partitions.h -+++ b/include/linux/mtd/partitions.h -@@ -68,12 +68,17 @@ struct mtd_part_parser_data { - * Functions dealing with the various ways of partitioning the space - */ - -+enum mtd_parser_type { -+ MTD_PARSER_TYPE_DEVICE = 0, -+}; -+ - struct mtd_part_parser { - struct list_head list; - struct module *owner; - const char *name; - int (*parse_fn)(struct mtd_info *, struct mtd_partition **, - struct mtd_part_parser_data *); -+ enum mtd_parser_type type; - }; - - extern void register_mtd_parser(struct mtd_part_parser *parser); -@@ -87,4 +92,9 @@ uint64_t mtd_get_device_size(const struc - extern void __weak arch_split_mtd_part(struct mtd_info *master, - const char *name, int offset, int size); - -+int parse_mtd_partitions_by_type(struct mtd_info *master, -+ enum mtd_parser_type type, -+ struct mtd_partition **pparts, -+ struct mtd_part_parser_data *data); -+ - #endif diff --git a/target/linux/generic/pending-3.18/402-mtd-use-typed-mtd-parsers-for-rootfs-and-firmware-split.patch b/target/linux/generic/pending-3.18/402-mtd-use-typed-mtd-parsers-for-rootfs-and-firmware-split.patch deleted file mode 100644 index dead0fbf5f..0000000000 --- a/target/linux/generic/pending-3.18/402-mtd-use-typed-mtd-parsers-for-rootfs-and-firmware-split.patch +++ /dev/null @@ -1,72 +0,0 @@ ---- a/drivers/mtd/mtdpart.c -+++ b/drivers/mtd/mtdpart.c -@@ -642,6 +642,37 @@ int mtd_del_partition(struct mtd_info *m - } - EXPORT_SYMBOL_GPL(mtd_del_partition); - -+static int -+run_parsers_by_type(struct mtd_part *slave, enum mtd_parser_type type) -+{ -+ struct mtd_partition *parts; -+ int nr_parts; -+ int i; -+ -+ nr_parts = parse_mtd_partitions_by_type(&slave->mtd, type, &parts, -+ NULL); -+ if (nr_parts <= 0) -+ return nr_parts; -+ -+ if (WARN_ON(!parts)) -+ return 0; -+ -+ for (i = 0; i < nr_parts; i++) { -+ /* adjust partition offsets */ -+ parts[i].offset += slave->offset; -+ -+ __mtd_add_partition(slave->master, -+ parts[i].name, -+ parts[i].offset, -+ parts[i].size, -+ false); -+ } -+ -+ kfree(parts); -+ -+ return nr_parts; -+} -+ - #ifdef CONFIG_MTD_SPLIT_FIRMWARE_NAME - #define SPLIT_FIRMWARE_NAME CONFIG_MTD_SPLIT_FIRMWARE_NAME - #else -@@ -650,6 +681,7 @@ EXPORT_SYMBOL_GPL(mtd_del_partition); - - static void split_firmware(struct mtd_info *master, struct mtd_part *part) - { -+ run_parsers_by_type(part, MTD_PARSER_TYPE_FIRMWARE); - } - - void __weak arch_split_mtd_part(struct mtd_info *master, const char *name, -@@ -664,6 +696,12 @@ static void mtd_partition_split(struct m - if (rootfs_found) - return; - -+ if (!strcmp(part->mtd.name, "rootfs")) { -+ run_parsers_by_type(part, MTD_PARSER_TYPE_ROOTFS); -+ -+ rootfs_found = 1; -+ } -+ - if (!strcmp(part->mtd.name, SPLIT_FIRMWARE_NAME) && - config_enabled(CONFIG_MTD_SPLIT_FIRMWARE)) - split_firmware(master, part); ---- a/include/linux/mtd/partitions.h -+++ b/include/linux/mtd/partitions.h -@@ -70,6 +70,8 @@ struct mtd_part_parser_data { - - enum mtd_parser_type { - MTD_PARSER_TYPE_DEVICE = 0, -+ MTD_PARSER_TYPE_ROOTFS, -+ MTD_PARSER_TYPE_FIRMWARE, - }; - - struct mtd_part_parser { diff --git a/target/linux/generic/pending-3.18/403-mtd-hook-mtdsplit-to-Kbuild.patch b/target/linux/generic/pending-3.18/403-mtd-hook-mtdsplit-to-Kbuild.patch deleted file mode 100644 index 0cf1c38555..0000000000 --- a/target/linux/generic/pending-3.18/403-mtd-hook-mtdsplit-to-Kbuild.patch +++ /dev/null @@ -1,22 +0,0 @@ ---- a/drivers/mtd/Kconfig -+++ b/drivers/mtd/Kconfig -@@ -27,6 +27,8 @@ config MTD_SPLIT_FIRMWARE_NAME - depends on MTD_SPLIT_FIRMWARE - default "firmware" - -+source "drivers/mtd/mtdsplit/Kconfig" -+ - endmenu - - config MTD_TESTS ---- a/drivers/mtd/Makefile -+++ b/drivers/mtd/Makefile -@@ -6,6 +6,8 @@ - obj-$(CONFIG_MTD) += mtd.o - mtd-y := mtdcore.o mtdsuper.o mtdconcat.o mtdpart.o mtdchar.o - -+obj-$(CONFIG_MTD_SPLIT) += mtdsplit/ -+ - obj-$(CONFIG_MTD_OF_PARTS) += ofpart.o - obj-$(CONFIG_MTD_REDBOOT_PARTS) += redboot.o - obj-$(CONFIG_MTD_CMDLINE_PARTS) += cmdlinepart.o diff --git a/target/linux/generic/pending-3.18/404-mtd-add-more-helper-functions.patch b/target/linux/generic/pending-3.18/404-mtd-add-more-helper-functions.patch deleted file mode 100644 index b2f62c115d..0000000000 --- a/target/linux/generic/pending-3.18/404-mtd-add-more-helper-functions.patch +++ /dev/null @@ -1,101 +0,0 @@ ---- a/drivers/mtd/mtdpart.c -+++ b/drivers/mtd/mtdpart.c -@@ -446,14 +446,12 @@ static struct mtd_part *allocate_partiti - if (slave->offset == MTDPART_OFS_APPEND) - slave->offset = cur_offset; - if (slave->offset == MTDPART_OFS_NXTBLK) { -- slave->offset = cur_offset; -- if (mtd_mod_by_eb(cur_offset, master) != 0) { -- /* Round up to next erasesize */ -- slave->offset = (mtd_div_by_eb(cur_offset, master) + 1) * master->erasesize; -+ /* Round up to next erasesize */ -+ slave->offset = mtd_roundup_to_eb(cur_offset, master); -+ if (slave->offset != cur_offset) - printk(KERN_NOTICE "Moving partition %d: " - "0x%012llx -> 0x%012llx\n", partno, - (unsigned long long)cur_offset, (unsigned long long)slave->offset); -- } - } - if (slave->offset == MTDPART_OFS_RETAIN) { - slave->offset = cur_offset; -@@ -673,6 +671,17 @@ run_parsers_by_type(struct mtd_part *sla - return nr_parts; - } - -+static inline unsigned long -+mtd_pad_erasesize(struct mtd_info *mtd, int offset, int len) -+{ -+ unsigned long mask = mtd->erasesize - 1; -+ -+ len += offset & mask; -+ len = (len + mask) & ~mask; -+ len -= offset & mask; -+ return len; -+} -+ - #ifdef CONFIG_MTD_SPLIT_FIRMWARE_NAME - #define SPLIT_FIRMWARE_NAME CONFIG_MTD_SPLIT_FIRMWARE_NAME - #else -@@ -956,6 +965,24 @@ int mtd_is_partition(const struct mtd_in - } - EXPORT_SYMBOL_GPL(mtd_is_partition); - -+struct mtd_info *mtdpart_get_master(const struct mtd_info *mtd) -+{ -+ if (!mtd_is_partition(mtd)) -+ return (struct mtd_info *)mtd; -+ -+ return PART(mtd)->master; -+} -+EXPORT_SYMBOL_GPL(mtdpart_get_master); -+ -+uint64_t mtdpart_get_offset(const struct mtd_info *mtd) -+{ -+ if (!mtd_is_partition(mtd)) -+ return 0; -+ -+ return PART(mtd)->offset; -+} -+EXPORT_SYMBOL_GPL(mtdpart_get_offset); -+ - /* Returns the size of the entire flash chip */ - uint64_t mtd_get_device_size(const struct mtd_info *mtd) - { ---- a/include/linux/mtd/partitions.h -+++ b/include/linux/mtd/partitions.h -@@ -90,6 +90,8 @@ int mtd_is_partition(const struct mtd_in - int mtd_add_partition(struct mtd_info *master, const char *name, - long long offset, long long length); - int mtd_del_partition(struct mtd_info *master, int partno); -+struct mtd_info *mtdpart_get_master(const struct mtd_info *mtd); -+uint64_t mtdpart_get_offset(const struct mtd_info *mtd); - uint64_t mtd_get_device_size(const struct mtd_info *mtd); - extern void __weak arch_split_mtd_part(struct mtd_info *master, - const char *name, int offset, int size); ---- a/include/linux/mtd/mtd.h -+++ b/include/linux/mtd/mtd.h -@@ -333,6 +333,24 @@ static inline uint32_t mtd_mod_by_eb(uin - return do_div(sz, mtd->erasesize); - } - -+static inline uint64_t mtd_roundup_to_eb(uint64_t sz, struct mtd_info *mtd) -+{ -+ if (mtd_mod_by_eb(sz, mtd) == 0) -+ return sz; -+ -+ /* Round up to next erase block */ -+ return (mtd_div_by_eb(sz, mtd) + 1) * mtd->erasesize; -+} -+ -+static inline uint64_t mtd_rounddown_to_eb(uint64_t sz, struct mtd_info *mtd) -+{ -+ if (mtd_mod_by_eb(sz, mtd) == 0) -+ return sz; -+ -+ /* Round down to the start of the current erase block */ -+ return (mtd_div_by_eb(sz, mtd)) * mtd->erasesize; -+} -+ - static inline uint32_t mtd_div_by_ws(uint64_t sz, struct mtd_info *mtd) - { - if (mtd->writesize_shift) diff --git a/target/linux/generic/pending-3.18/405-mtd-old-firmware-uimage-splitter.patch b/target/linux/generic/pending-3.18/405-mtd-old-firmware-uimage-splitter.patch deleted file mode 100644 index 7e74c4e538..0000000000 --- a/target/linux/generic/pending-3.18/405-mtd-old-firmware-uimage-splitter.patch +++ /dev/null @@ -1,70 +0,0 @@ ---- a/drivers/mtd/Kconfig -+++ b/drivers/mtd/Kconfig -@@ -27,6 +27,11 @@ config MTD_SPLIT_FIRMWARE_NAME - depends on MTD_SPLIT_FIRMWARE - default "firmware" - -+config MTD_UIMAGE_SPLIT -+ bool "Enable split support for firmware partitions containing a uImage" -+ depends on MTD_SPLIT_FIRMWARE -+ default y -+ - source "drivers/mtd/mtdsplit/Kconfig" - - endmenu ---- a/drivers/mtd/mtdpart.c -+++ b/drivers/mtd/mtdpart.c -@@ -682,6 +682,37 @@ mtd_pad_erasesize(struct mtd_info *mtd, - return len; - } - -+#define UBOOT_MAGIC 0x27051956 -+ -+static void split_uimage(struct mtd_info *master, struct mtd_part *part) -+{ -+ struct { -+ __be32 magic; -+ __be32 pad[2]; -+ __be32 size; -+ } hdr; -+ size_t len; -+ -+ if (mtd_read(master, part->offset, sizeof(hdr), &len, (void *) &hdr)) -+ return; -+ -+ if (len != sizeof(hdr) || hdr.magic != cpu_to_be32(UBOOT_MAGIC)) -+ return; -+ -+ len = be32_to_cpu(hdr.size) + 0x40; -+ len = mtd_pad_erasesize(master, part->offset, len); -+ if (len + master->erasesize > part->mtd.size) -+ return; -+ -+ if (config_enabled(CONFIG_MTD_SPLIT_UIMAGE_FW)) -+ pr_err("Dedicated partitioner didn't split firmware partition, please fill a bug report!\n"); -+ else -+ pr_warn("Support for built-in firmware splitter will be removed, please use CONFIG_MTD_SPLIT_UIMAGE_FW\n"); -+ -+ __mtd_add_partition(master, "rootfs", part->offset + len, -+ part->mtd.size - len, false); -+} -+ - #ifdef CONFIG_MTD_SPLIT_FIRMWARE_NAME - #define SPLIT_FIRMWARE_NAME CONFIG_MTD_SPLIT_FIRMWARE_NAME - #else -@@ -690,7 +721,14 @@ mtd_pad_erasesize(struct mtd_info *mtd, - - static void split_firmware(struct mtd_info *master, struct mtd_part *part) - { -- run_parsers_by_type(part, MTD_PARSER_TYPE_FIRMWARE); -+ int ret; -+ -+ ret = run_parsers_by_type(part, MTD_PARSER_TYPE_FIRMWARE); -+ if (ret > 0) -+ return; -+ -+ if (config_enabled(CONFIG_MTD_UIMAGE_SPLIT)) -+ split_uimage(master, part); - } - - void __weak arch_split_mtd_part(struct mtd_info *master, const char *name, diff --git a/target/linux/generic/pending-3.18/406-mtd-old-rootfs-squashfs-splitter.patch b/target/linux/generic/pending-3.18/406-mtd-old-rootfs-squashfs-splitter.patch deleted file mode 100644 index cc548efb60..0000000000 --- a/target/linux/generic/pending-3.18/406-mtd-old-rootfs-squashfs-splitter.patch +++ /dev/null @@ -1,76 +0,0 @@ ---- a/drivers/mtd/Kconfig -+++ b/drivers/mtd/Kconfig -@@ -18,6 +18,11 @@ config MTD_ROOTFS_ROOT_DEV - bool "Automatically set 'rootfs' partition to be root filesystem" - default y - -+config MTD_ROOTFS_SPLIT -+ bool "Automatically split 'rootfs' partition for squashfs" -+ select MTD_SPLIT -+ default y -+ - config MTD_SPLIT_FIRMWARE - bool "Automatically split firmware partition for kernel+rootfs" - default y ---- a/drivers/mtd/mtdpart.c -+++ b/drivers/mtd/mtdpart.c -@@ -682,6 +682,47 @@ mtd_pad_erasesize(struct mtd_info *mtd, - return len; - } - -+static int split_squashfs(struct mtd_info *master, int offset, int *split_offset) -+{ -+ size_t squashfs_len; -+ int len, ret; -+ -+ ret = mtd_get_squashfs_len(master, offset, &squashfs_len); -+ if (ret) -+ return ret; -+ -+ len = mtd_pad_erasesize(master, offset, squashfs_len); -+ *split_offset = offset + len; -+ -+ return 0; -+} -+ -+static void split_rootfs_data(struct mtd_info *master, struct mtd_part *part) -+{ -+ unsigned int split_offset = 0; -+ unsigned int split_size; -+ int ret; -+ -+ ret = split_squashfs(master, part->offset, &split_offset); -+ if (ret) -+ return; -+ -+ if (split_offset <= 0) -+ return; -+ -+ if (config_enabled(CONFIG_MTD_SPLIT_SQUASHFS_ROOT)) -+ pr_err("Dedicated partitioner didn't create \"rootfs_data\" partition, please fill a bug report!\n"); -+ else -+ pr_warn("Support for built-in \"rootfs_data\" splitter will be removed, please use CONFIG_MTD_SPLIT_SQUASHFS_ROOT\n"); -+ -+ split_size = part->mtd.size - (split_offset - part->offset); -+ printk(KERN_INFO "mtd: partition \"%s\" created automatically, ofs=0x%x, len=0x%x\n", -+ ROOTFS_SPLIT_NAME, split_offset, split_size); -+ -+ __mtd_add_partition(master, ROOTFS_SPLIT_NAME, split_offset, -+ split_size, false); -+} -+ - #define UBOOT_MAGIC 0x27051956 - - static void split_uimage(struct mtd_info *master, struct mtd_part *part) -@@ -744,7 +785,10 @@ static void mtd_partition_split(struct m - return; - - if (!strcmp(part->mtd.name, "rootfs")) { -- run_parsers_by_type(part, MTD_PARSER_TYPE_ROOTFS); -+ int num = run_parsers_by_type(part, MTD_PARSER_TYPE_ROOTFS); -+ -+ if (num <= 0 && config_enabled(CONFIG_MTD_ROOTFS_SPLIT)) -+ split_rootfs_data(master, part); - - rootfs_found = 1; - } diff --git a/target/linux/generic/pending-3.18/410-mtd-move-forward-declaration-of-struct-mtd_info.patch b/target/linux/generic/pending-3.18/410-mtd-move-forward-declaration-of-struct-mtd_info.patch deleted file mode 100644 index 78ebbf88ca..0000000000 --- a/target/linux/generic/pending-3.18/410-mtd-move-forward-declaration-of-struct-mtd_info.patch +++ /dev/null @@ -1,18 +0,0 @@ ---- a/include/linux/mtd/partitions.h -+++ b/include/linux/mtd/partitions.h -@@ -35,6 +35,7 @@ - * Note: writeable partitions require their size and offset be - * erasesize aligned (e.g. use MTDPART_OFS_NEXTBLK). - */ -+struct mtd_info; - - struct mtd_partition { - const char *name; /* identifier string */ -@@ -50,7 +51,6 @@ struct mtd_partition { - #define MTDPART_SIZ_FULL (0) - - --struct mtd_info; - struct device_node; - - /** diff --git a/target/linux/generic/pending-3.18/411-mtd-partial_eraseblock_write.patch b/target/linux/generic/pending-3.18/411-mtd-partial_eraseblock_write.patch deleted file mode 100644 index 5d5c6ed5d3..0000000000 --- a/target/linux/generic/pending-3.18/411-mtd-partial_eraseblock_write.patch +++ /dev/null @@ -1,142 +0,0 @@ ---- a/drivers/mtd/mtdpart.c -+++ b/drivers/mtd/mtdpart.c -@@ -36,6 +36,8 @@ - #include "mtdcore.h" - #include "mtdsplit/mtdsplit.h" - -+#define MTD_ERASE_PARTIAL 0x8000 /* partition only covers parts of an erase block */ -+ - /* Our partition linked list */ - static LIST_HEAD(mtd_partitions); - static DEFINE_MUTEX(mtd_partitions_mutex); -@@ -234,13 +236,61 @@ static int part_erase(struct mtd_info *m - struct mtd_part *part = PART(mtd); - int ret; - -+ -+ instr->partial_start = false; -+ if (mtd->flags & MTD_ERASE_PARTIAL) { -+ size_t readlen = 0; -+ u64 mtd_ofs; -+ -+ instr->erase_buf = kmalloc(part->master->erasesize, GFP_ATOMIC); -+ if (!instr->erase_buf) -+ return -ENOMEM; -+ -+ mtd_ofs = part->offset + instr->addr; -+ instr->erase_buf_ofs = do_div(mtd_ofs, part->master->erasesize); -+ -+ if (instr->erase_buf_ofs > 0) { -+ instr->addr -= instr->erase_buf_ofs; -+ ret = mtd_read(part->master, -+ instr->addr + part->offset, -+ part->master->erasesize, -+ &readlen, instr->erase_buf); -+ -+ instr->len += instr->erase_buf_ofs; -+ instr->partial_start = true; -+ } else { -+ mtd_ofs = part->offset + part->mtd.size; -+ instr->erase_buf_ofs = part->master->erasesize - -+ do_div(mtd_ofs, part->master->erasesize); -+ -+ if (instr->erase_buf_ofs > 0) { -+ instr->len += instr->erase_buf_ofs; -+ ret = mtd_read(part->master, -+ part->offset + instr->addr + -+ instr->len - part->master->erasesize, -+ part->master->erasesize, &readlen, -+ instr->erase_buf); -+ } else { -+ ret = 0; -+ } -+ } -+ if (ret < 0) { -+ kfree(instr->erase_buf); -+ return ret; -+ } -+ -+ } -+ - instr->addr += part->offset; - ret = part->master->_erase(part->master, instr); - if (ret) { - if (instr->fail_addr != MTD_FAIL_ADDR_UNKNOWN) - instr->fail_addr -= part->offset; - instr->addr -= part->offset; -+ if (mtd->flags & MTD_ERASE_PARTIAL) -+ kfree(instr->erase_buf); - } -+ - return ret; - } - -@@ -248,7 +298,25 @@ void mtd_erase_callback(struct erase_inf - { - if (instr->mtd->_erase == part_erase) { - struct mtd_part *part = PART(instr->mtd); -+ size_t wrlen = 0; - -+ if (instr->mtd->flags & MTD_ERASE_PARTIAL) { -+ if (instr->partial_start) { -+ part->master->_write(part->master, -+ instr->addr, instr->erase_buf_ofs, -+ &wrlen, instr->erase_buf); -+ instr->addr += instr->erase_buf_ofs; -+ } else { -+ instr->len -= instr->erase_buf_ofs; -+ part->master->_write(part->master, -+ instr->addr + instr->len, -+ instr->erase_buf_ofs, &wrlen, -+ instr->erase_buf + -+ part->master->erasesize - -+ instr->erase_buf_ofs); -+ } -+ kfree(instr->erase_buf); -+ } - if (instr->fail_addr != MTD_FAIL_ADDR_UNKNOWN) - instr->fail_addr -= part->offset; - instr->addr -= part->offset; -@@ -515,17 +583,20 @@ static struct mtd_part *allocate_partiti - if ((slave->mtd.flags & MTD_WRITEABLE) && - mtd_mod_by_eb(slave->offset, &slave->mtd)) { - /* Doesn't start on a boundary of major erase size */ -- /* FIXME: Let it be writable if it is on a boundary of -- * _minor_ erase size though */ -- slave->mtd.flags &= ~MTD_WRITEABLE; -- printk(KERN_WARNING"mtd: partition \"%s\" doesn't start on an erase block boundary -- force read-only\n", -- part->name); -+ slave->mtd.flags |= MTD_ERASE_PARTIAL; -+ if (((u32) slave->mtd.size) > master->erasesize) -+ slave->mtd.flags &= ~MTD_WRITEABLE; -+ else -+ slave->mtd.erasesize = slave->mtd.size; - } - if ((slave->mtd.flags & MTD_WRITEABLE) && -- mtd_mod_by_eb(slave->mtd.size, &slave->mtd)) { -- slave->mtd.flags &= ~MTD_WRITEABLE; -- printk(KERN_WARNING"mtd: partition \"%s\" doesn't end on an erase block -- force read-only\n", -- part->name); -+ mtd_mod_by_eb(slave->offset + slave->mtd.size, &slave->mtd)) { -+ slave->mtd.flags |= MTD_ERASE_PARTIAL; -+ -+ if ((u32) slave->mtd.size > master->erasesize) -+ slave->mtd.flags &= ~MTD_WRITEABLE; -+ else -+ slave->mtd.erasesize = slave->mtd.size; - } - - slave->mtd.ecclayout = master->ecclayout; ---- a/include/linux/mtd/mtd.h -+++ b/include/linux/mtd/mtd.h -@@ -55,6 +55,10 @@ struct erase_info { - u_long priv; - u_char state; - struct erase_info *next; -+ -+ u8 *erase_buf; -+ u32 erase_buf_ofs; -+ bool partial_start; - }; - - struct mtd_erase_region_info { diff --git a/target/linux/generic/pending-3.18/412-mtd-partial_eraseblock_unlock.patch b/target/linux/generic/pending-3.18/412-mtd-partial_eraseblock_unlock.patch deleted file mode 100644 index 62f9d5bad0..0000000000 --- a/target/linux/generic/pending-3.18/412-mtd-partial_eraseblock_unlock.patch +++ /dev/null @@ -1,18 +0,0 @@ ---- a/drivers/mtd/mtdpart.c -+++ b/drivers/mtd/mtdpart.c -@@ -335,7 +335,14 @@ static int part_lock(struct mtd_info *mt - static int part_unlock(struct mtd_info *mtd, loff_t ofs, uint64_t len) - { - struct mtd_part *part = PART(mtd); -- return part->master->_unlock(part->master, ofs + part->offset, len); -+ -+ ofs += part->offset; -+ if (mtd->flags & MTD_ERASE_PARTIAL) { -+ /* round up len to next erasesize and round down offset to prev block */ -+ len = (mtd_div_by_eb(len, part->master) + 1) * part->master->erasesize; -+ ofs &= ~(part->master->erasesize - 1); -+ } -+ return part->master->_unlock(part->master, ofs, len); - } - - static int part_is_locked(struct mtd_info *mtd, loff_t ofs, uint64_t len) diff --git a/target/linux/generic/pending-3.18/420-mtd-redboot_space.patch b/target/linux/generic/pending-3.18/420-mtd-redboot_space.patch deleted file mode 100644 index f74affcef7..0000000000 --- a/target/linux/generic/pending-3.18/420-mtd-redboot_space.patch +++ /dev/null @@ -1,30 +0,0 @@ ---- a/drivers/mtd/redboot.c -+++ b/drivers/mtd/redboot.c -@@ -265,14 +265,21 @@ static int parse_redboot_partitions(stru - #endif - names += strlen(names)+1; - --#ifdef CONFIG_MTD_REDBOOT_PARTS_UNALLOCATED - if(fl->next && fl->img->flash_base + fl->img->size + master->erasesize <= fl->next->img->flash_base) { -- i++; -- parts[i].offset = parts[i-1].size + parts[i-1].offset; -- parts[i].size = fl->next->img->flash_base - parts[i].offset; -- parts[i].name = nullname; -- } -+ if (!strcmp(parts[i].name, "rootfs")) { -+ parts[i].size = fl->next->img->flash_base; -+ parts[i].size &= ~(master->erasesize - 1); -+ parts[i].size -= parts[i].offset; -+#ifdef CONFIG_MTD_REDBOOT_PARTS_UNALLOCATED -+ nrparts--; -+ } else { -+ i++; -+ parts[i].offset = parts[i-1].size + parts[i-1].offset; -+ parts[i].size = fl->next->img->flash_base - parts[i].offset; -+ parts[i].name = nullname; - #endif -+ } -+ } - tmp_fl = fl; - fl = fl->next; - kfree(tmp_fl); diff --git a/target/linux/generic/pending-3.18/430-mtd-add-myloader-partition-parser.patch b/target/linux/generic/pending-3.18/430-mtd-add-myloader-partition-parser.patch deleted file mode 100644 index 25e0ecd048..0000000000 --- a/target/linux/generic/pending-3.18/430-mtd-add-myloader-partition-parser.patch +++ /dev/null @@ -1,35 +0,0 @@ ---- a/drivers/mtd/Kconfig -+++ b/drivers/mtd/Kconfig -@@ -184,6 +184,22 @@ config MTD_BCM47XX_PARTS - This provides partitions parser for devices based on BCM47xx - boards. - -+config MTD_MYLOADER_PARTS -+ tristate "MyLoader partition parsing" -+ depends on ADM5120 || ATH25 || ATH79 -+ ---help--- -+ MyLoader is a bootloader which allows the user to define partitions -+ in flash devices, by putting a table in the second erase block -+ on the device, similar to a partition table. This table gives the -+ offsets and lengths of the user defined partitions. -+ -+ If you need code which can detect and parse these tables, and -+ register MTD 'partitions' corresponding to each image detected, -+ enable this option. -+ -+ You will still need the parsing functions to be called by the driver -+ for your particular device. It won't happen automatically. -+ - comment "User Modules And Translation Layers" - - # ---- a/drivers/mtd/Makefile -+++ b/drivers/mtd/Makefile -@@ -15,6 +15,7 @@ obj-$(CONFIG_MTD_AFS_PARTS) += afs.o - obj-$(CONFIG_MTD_AR7_PARTS) += ar7part.o - obj-$(CONFIG_MTD_BCM63XX_PARTS) += bcm63xxpart.o - obj-$(CONFIG_MTD_BCM47XX_PARTS) += bcm47xxpart.o -+obj-$(CONFIG_MTD_MYLOADER_PARTS) += myloader.o - - # 'Users' - code which presents functionality to userspace. - obj-$(CONFIG_MTD_BLKDEVS) += mtd_blkdevs.o diff --git a/target/linux/generic/pending-3.18/431-mtd-bcm47xxpart-check-for-bad-blocks-when-calculatin.patch b/target/linux/generic/pending-3.18/431-mtd-bcm47xxpart-check-for-bad-blocks-when-calculatin.patch deleted file mode 100644 index 5ad82f1f51..0000000000 --- a/target/linux/generic/pending-3.18/431-mtd-bcm47xxpart-check-for-bad-blocks-when-calculatin.patch +++ /dev/null @@ -1,100 +0,0 @@ -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= -Date: Sat, 2 Jan 2016 01:04:52 +0100 -Subject: [PATCH] mtd: bcm47xxpart: check for bad blocks when calculating - offsets -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Signed-off-by: Rafał Miłecki ---- - drivers/mtd/bcm47xxpart.c | 50 +++++++++++++++++++++++++++++++++++++---------- - 1 file changed, 40 insertions(+), 10 deletions(-) - ---- a/drivers/mtd/bcm47xxpart.c -+++ b/drivers/mtd/bcm47xxpart.c -@@ -61,6 +61,34 @@ static void bcm47xxpart_add_part(struct - part->mask_flags = mask_flags; - } - -+/* -+ * Calculate real end offset (address) for a given amount of data. It checks -+ * all blocks skipping bad ones. -+ */ -+static size_t bcm47xxpart_real_offset(struct mtd_info *master, size_t offset, -+ size_t bytes) -+{ -+ size_t real_offset = offset; -+ -+ if (mtd_block_isbad(master, real_offset)) -+ pr_warn("Base offset shouldn't be at bad block"); -+ -+ while (bytes >= master->erasesize) { -+ bytes -= master->erasesize; -+ real_offset += master->erasesize; -+ while (mtd_block_isbad(master, real_offset)) { -+ real_offset += master->erasesize; -+ -+ if (real_offset >= master->size) -+ return real_offset - master->erasesize; -+ } -+ } -+ -+ real_offset += bytes; -+ -+ return real_offset; -+} -+ - static const char *bcm47xxpart_trx_data_part_name(struct mtd_info *master, - size_t offset) - { -@@ -182,6 +210,8 @@ static int bcm47xxpart_parse(struct mtd_ - - /* TRX */ - if (buf[0x000 / 4] == TRX_MAGIC) { -+ uint32_t tmp; -+ - if (BCM47XXPART_MAX_PARTS - curr_part < 4) { - pr_warn("Not enough partitions left to register trx, scanning stopped!\n"); - break; -@@ -196,18 +226,18 @@ static int bcm47xxpart_parse(struct mtd_ - i = 0; - /* We have LZMA loader if offset[2] points to sth */ - if (trx->offset[2]) { -+ tmp = bcm47xxpart_real_offset(master, offset, -+ trx->offset[i]); - bcm47xxpart_add_part(&parts[curr_part++], -- "loader", -- offset + trx->offset[i], -- 0); -+ "loader", tmp, 0); - i++; - } - - if (trx->offset[i]) { -+ tmp = bcm47xxpart_real_offset(master, offset, -+ trx->offset[i]); - bcm47xxpart_add_part(&parts[curr_part++], -- "linux", -- offset + trx->offset[i], -- 0); -+ "linux", tmp, 0); - i++; - } - -@@ -219,11 +249,11 @@ static int bcm47xxpart_parse(struct mtd_ - if (trx->offset[i]) { - const char *name; - -- name = bcm47xxpart_trx_data_part_name(master, offset + trx->offset[i]); -+ tmp = bcm47xxpart_real_offset(master, offset, -+ trx->offset[i]); -+ name = bcm47xxpart_trx_data_part_name(master, tmp); - bcm47xxpart_add_part(&parts[curr_part++], -- name, -- offset + trx->offset[i], -- 0); -+ name, tmp, 0); - i++; - } - diff --git a/target/linux/generic/pending-3.18/432-mtd-bcm47xxpart-detect-T_Meter-partition.patch b/target/linux/generic/pending-3.18/432-mtd-bcm47xxpart-detect-T_Meter-partition.patch deleted file mode 100644 index 9e5ca91e55..0000000000 --- a/target/linux/generic/pending-3.18/432-mtd-bcm47xxpart-detect-T_Meter-partition.patch +++ /dev/null @@ -1,42 +0,0 @@ -From fd54aa583296f9adfb1f519affbc10ba521eb809 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= -Date: Wed, 28 Jan 2015 22:14:41 +0100 -Subject: [PATCH] mtd: bcm47xxpart: detect T_Meter partition -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -It can be found on many Netgear devices. It consists of many 0x30 blocks -starting with 4D 54. - -Signed-off-by: Rafał Miłecki ---- - drivers/mtd/bcm47xxpart.c | 10 ++++++++++ - 1 file changed, 10 insertions(+) - ---- a/drivers/mtd/bcm47xxpart.c -+++ b/drivers/mtd/bcm47xxpart.c -@@ -38,6 +38,7 @@ - #define NVRAM_HEADER 0x48534C46 /* FLSH */ - #define POT_MAGIC1 0x54544f50 /* POTT */ - #define POT_MAGIC2 0x504f /* OP */ -+#define T_METER_MAGIC 0x4D540000 /* MT */ - #define ML_MAGIC1 0x39685a42 - #define ML_MAGIC2 0x26594131 - #define TRX_MAGIC 0x30524448 -@@ -207,6 +208,15 @@ static int bcm47xxpart_parse(struct mtd_ - MTD_WRITEABLE); - continue; - } -+ -+ /* T_Meter */ -+ if ((le32_to_cpu(buf[0x000 / 4]) & 0xFFFF0000) == T_METER_MAGIC && -+ (le32_to_cpu(buf[0x030 / 4]) & 0xFFFF0000) == T_METER_MAGIC && -+ (le32_to_cpu(buf[0x060 / 4]) & 0xFFFF0000) == T_METER_MAGIC) { -+ bcm47xxpart_add_part(&parts[curr_part++], "T_Meter", offset, -+ MTD_WRITEABLE); -+ continue; -+ } - - /* TRX */ - if (buf[0x000 / 4] == TRX_MAGIC) { diff --git a/target/linux/generic/pending-3.18/440-block2mtd_init.patch b/target/linux/generic/pending-3.18/440-block2mtd_init.patch deleted file mode 100644 index 5ab60265a3..0000000000 --- a/target/linux/generic/pending-3.18/440-block2mtd_init.patch +++ /dev/null @@ -1,107 +0,0 @@ ---- a/drivers/mtd/devices/block2mtd.c -+++ b/drivers/mtd/devices/block2mtd.c -@@ -17,6 +17,7 @@ - #include - #include - #include -+#include - #include - #include - #include -@@ -209,11 +210,12 @@ static void block2mtd_free_device(struct - } - - --static struct block2mtd_dev *add_device(char *devname, int erase_size) -+static struct block2mtd_dev *add_device(char *devname, int erase_size, const char *mtdname) - { - const fmode_t mode = FMODE_READ | FMODE_WRITE | FMODE_EXCL; - struct block_device *bdev; - struct block2mtd_dev *dev; -+ struct mtd_partition *part; - char *name; - - if (!devname) -@@ -257,13 +259,16 @@ static struct block2mtd_dev *add_device( - - /* Setup the MTD structure */ - /* make the name contain the block device in */ -- name = kasprintf(GFP_KERNEL, "block2mtd: %s", devname); -+ if (!mtdname) -+ mtdname = devname; -+ name = kmalloc(strlen(mtdname) + 1, GFP_KERNEL); - if (!name) - goto err_destroy_mutex; - -+ strcpy(name, mtdname); - dev->mtd.name = name; - -- dev->mtd.size = dev->blkdev->bd_inode->i_size & PAGE_MASK; -+ dev->mtd.size = dev->blkdev->bd_inode->i_size & PAGE_MASK & ~(erase_size - 1); - dev->mtd.erasesize = erase_size; - dev->mtd.writesize = 1; - dev->mtd.writebufsize = PAGE_SIZE; -@@ -276,15 +281,18 @@ static struct block2mtd_dev *add_device( - dev->mtd.priv = dev; - dev->mtd.owner = THIS_MODULE; - -- if (mtd_device_register(&dev->mtd, NULL, 0)) { -+ part = kzalloc(sizeof(struct mtd_partition), GFP_KERNEL); -+ part->name = name; -+ part->offset = 0; -+ part->size = dev->mtd.size; -+ if (mtd_device_register(&dev->mtd, part, 1)) { - /* Device didn't get added, so free the entry */ - goto err_destroy_mutex; - } - list_add(&dev->list, &blkmtd_device_list); - pr_info("mtd%d: [%s] erase_size = %dKiB [%d]\n", - dev->mtd.index, -- dev->mtd.name + strlen("block2mtd: "), -- dev->mtd.erasesize >> 10, dev->mtd.erasesize); -+ mtdname, dev->mtd.erasesize >> 10, dev->mtd.erasesize); - return dev; - - err_destroy_mutex: -@@ -353,9 +361,9 @@ static char block2mtd_paramline[80 + 12] - - static int block2mtd_setup2(const char *val) - { -- char buf[80 + 12]; /* 80 for device, 12 for erase size */ -+ char buf[80 + 12 + 80]; /* 80 for device, 12 for erase size, 80 for name */ - char *str = buf; -- char *token[2]; -+ char *token[3]; - char *name; - size_t erase_size = PAGE_SIZE; - int i, ret; -@@ -368,7 +376,7 @@ static int block2mtd_setup2(const char * - strcpy(str, val); - kill_final_newline(str); - -- for (i = 0; i < 2; i++) -+ for (i = 0; i < 3; i++) - token[i] = strsep(&str, ","); - - if (str) { -@@ -394,8 +402,10 @@ static int block2mtd_setup2(const char * - return 0; - } - } -+ if (token[2] && (strlen(token[2]) + 1 > 80)) -+ pr_err("mtd device name too long\n"); - -- add_device(name, erase_size); -+ add_device(name, erase_size, token[2]); - - return 0; - } -@@ -429,7 +439,7 @@ static int block2mtd_setup(const char *v - - - module_param_call(block2mtd, block2mtd_setup, NULL, NULL, 0200); --MODULE_PARM_DESC(block2mtd, "Device to use. \"block2mtd=[,]\""); -+MODULE_PARM_DESC(block2mtd, "Device to use. \"block2mtd=[,[,]]\""); - - static int __init block2mtd_init(void) - { diff --git a/target/linux/generic/pending-3.18/441-block2mtd_probe.patch b/target/linux/generic/pending-3.18/441-block2mtd_probe.patch deleted file mode 100644 index 6836a48e39..0000000000 --- a/target/linux/generic/pending-3.18/441-block2mtd_probe.patch +++ /dev/null @@ -1,110 +0,0 @@ ---- a/drivers/mtd/devices/block2mtd.c -+++ b/drivers/mtd/devices/block2mtd.c -@@ -10,6 +10,7 @@ - #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt - - #include -+#include - #include - #include - #include -@@ -210,13 +211,16 @@ static void block2mtd_free_device(struct - } - - --static struct block2mtd_dev *add_device(char *devname, int erase_size, const char *mtdname) -+static struct block2mtd_dev *add_device(char *devname, int erase_size, const char *mtdname, int timeout) - { - const fmode_t mode = FMODE_READ | FMODE_WRITE | FMODE_EXCL; -- struct block_device *bdev; -+ struct block_device *bdev = ERR_PTR(-ENODEV); - struct block2mtd_dev *dev; - struct mtd_partition *part; - char *name; -+#ifndef MODULE -+ int i; -+#endif - - if (!devname) - return NULL; -@@ -227,15 +231,20 @@ static struct block2mtd_dev *add_device( - - /* Get a handle on the device */ - bdev = blkdev_get_by_path(devname, mode, dev); -+ - #ifndef MODULE -- if (IS_ERR(bdev)) { -+ for (i = 0; IS_ERR(bdev) && i <= timeout; i++) { -+ dev_t devt; - -- /* We might not have rootfs mounted at this point. Try -- to resolve the device name by other means. */ -+ if (i) -+ msleep(1000); -+ wait_for_device_probe(); -+ -+ devt = name_to_dev_t(devname); -+ if (!devt) -+ continue; - -- dev_t devt = name_to_dev_t(devname); -- if (devt) -- bdev = blkdev_get_by_dev(devt, mode, dev); -+ bdev = blkdev_get_by_dev(devt, mode, dev); - } - #endif - -@@ -361,11 +370,12 @@ static char block2mtd_paramline[80 + 12] - - static int block2mtd_setup2(const char *val) - { -- char buf[80 + 12 + 80]; /* 80 for device, 12 for erase size, 80 for name */ -+ char buf[80 + 12 + 80 + 8]; /* 80 for device, 12 for erase size, 80 for name, 8 for timeout */ - char *str = buf; -- char *token[3]; -+ char *token[4]; - char *name; - size_t erase_size = PAGE_SIZE; -+ unsigned long timeout = 0; - int i, ret; - - if (strnlen(val, sizeof(buf)) >= sizeof(buf)) { -@@ -376,7 +386,7 @@ static int block2mtd_setup2(const char * - strcpy(str, val); - kill_final_newline(str); - -- for (i = 0; i < 3; i++) -+ for (i = 0; i < 4; i++) - token[i] = strsep(&str, ","); - - if (str) { -@@ -405,7 +415,10 @@ static int block2mtd_setup2(const char * - if (token[2] && (strlen(token[2]) + 1 > 80)) - pr_err("mtd device name too long\n"); - -- add_device(name, erase_size, token[2]); -+ if (token[3] && kstrtoul(token[3], 0, &timeout)) -+ pr_err("invalid timeout\n"); -+ -+ add_device(name, erase_size, token[2], timeout); - - return 0; - } -@@ -439,7 +452,7 @@ static int block2mtd_setup(const char *v - - - module_param_call(block2mtd, block2mtd_setup, NULL, NULL, 0200); --MODULE_PARM_DESC(block2mtd, "Device to use. \"block2mtd=[,[,]]\""); -+MODULE_PARM_DESC(block2mtd, "Device to use. \"block2mtd=[,[,[,]]]\""); - - static int __init block2mtd_init(void) - { -@@ -474,7 +487,7 @@ static void block2mtd_exit(void) - } - - --module_init(block2mtd_init); -+late_initcall(block2mtd_init); - module_exit(block2mtd_exit); - - MODULE_LICENSE("GPL"); diff --git a/target/linux/generic/pending-3.18/450-mtd-nand-allow-to-use-platform-specific-chip-fixup.patch b/target/linux/generic/pending-3.18/450-mtd-nand-allow-to-use-platform-specific-chip-fixup.patch deleted file mode 100644 index 0f5abaa723..0000000000 --- a/target/linux/generic/pending-3.18/450-mtd-nand-allow-to-use-platform-specific-chip-fixup.patch +++ /dev/null @@ -1,37 +0,0 @@ ---- - drivers/mtd/nand/plat_nand.c | 13 ++++++++++++- - include/linux/mtd/nand.h | 1 + - 2 files changed, 13 insertions(+), 1 deletion(-) - ---- a/include/linux/mtd/nand.h -+++ b/include/linux/mtd/nand.h -@@ -851,6 +851,7 @@ struct platform_nand_chip { - unsigned int options; - unsigned int bbt_options; - const char **part_probe_types; -+ int (*chip_fixup)(struct mtd_info *mtd); - }; - - /* Keep gcc happy */ ---- a/drivers/mtd/nand/plat_nand.c -+++ b/drivers/mtd/nand/plat_nand.c -@@ -90,7 +90,18 @@ static int plat_nand_probe(struct platfo - } - - /* Scan to find existence of the device */ -- if (nand_scan(&data->mtd, pdata->chip.nr_chips)) { -+ if (nand_scan_ident(&data->mtd, pdata->chip.nr_chips, NULL)) { -+ err = -ENXIO; -+ goto out; -+ } -+ -+ if (pdata->chip.chip_fixup) { -+ err = pdata->chip.chip_fixup(&data->mtd); -+ if (err) -+ goto out; -+ } -+ -+ if (nand_scan_tail(&data->mtd)) { - err = -ENXIO; - goto out; - } diff --git a/target/linux/generic/pending-3.18/451-mtd-nand-fix-return-code-of-nand_correct_data-function.patch b/target/linux/generic/pending-3.18/451-mtd-nand-fix-return-code-of-nand_correct_data-function.patch deleted file mode 100644 index 6a2092ce20..0000000000 --- a/target/linux/generic/pending-3.18/451-mtd-nand-fix-return-code-of-nand_correct_data-function.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/drivers/mtd/nand/nand_ecc.c -+++ b/drivers/mtd/nand/nand_ecc.c -@@ -507,7 +507,7 @@ int __nand_correct_data(unsigned char *b - return 1; /* error in ECC data; no action needed */ - - pr_err("%s: uncorrectable ECC error\n", __func__); -- return -1; -+ return -EBADMSG; - } - EXPORT_SYMBOL(__nand_correct_data); - diff --git a/target/linux/generic/pending-3.18/460-mtd-cfi_cmdset_0002-no-erase_suspend.patch b/target/linux/generic/pending-3.18/460-mtd-cfi_cmdset_0002-no-erase_suspend.patch deleted file mode 100644 index 68fbd12466..0000000000 --- a/target/linux/generic/pending-3.18/460-mtd-cfi_cmdset_0002-no-erase_suspend.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/drivers/mtd/chips/cfi_cmdset_0002.c -+++ b/drivers/mtd/chips/cfi_cmdset_0002.c -@@ -809,7 +809,7 @@ static int get_chip(struct map_info *map - return 0; - - case FL_ERASING: -- if (!cfip || !(cfip->EraseSuspend & (0x1|0x2)) || -+ if (1 /* no suspend */ || !cfip || !(cfip->EraseSuspend & (0x1|0x2)) || - !(mode == FL_READY || mode == FL_POINT || - (mode == FL_WRITING && (cfip->EraseSuspend & 0x2)))) - goto sleep; diff --git a/target/linux/generic/pending-3.18/461-mtd-cfi_cmdset_0002-add-buffer-write-cmd-timeout.patch b/target/linux/generic/pending-3.18/461-mtd-cfi_cmdset_0002-add-buffer-write-cmd-timeout.patch deleted file mode 100644 index 382b44a939..0000000000 --- a/target/linux/generic/pending-3.18/461-mtd-cfi_cmdset_0002-add-buffer-write-cmd-timeout.patch +++ /dev/null @@ -1,18 +0,0 @@ -From: George Kashperko - -Issue map read after Write Buffer Load command to ensure chip is ready -to receive data. -Signed-off-by: George Kashperko ---- - drivers/mtd/chips/cfi_cmdset_0002.c | 1 + - 1 file changed, 1 insertion(+) ---- a/drivers/mtd/chips/cfi_cmdset_0002.c -+++ b/drivers/mtd/chips/cfi_cmdset_0002.c -@@ -1831,6 +1831,7 @@ static int __xipram do_write_buffer(stru - - /* Write Buffer Load */ - map_write(map, CMD(0x25), cmd_adr); -+ (void) map_read(map, cmd_adr); - - chip->state = FL_WRITING_TO_BUFFER; - diff --git a/target/linux/generic/pending-3.18/472-mtd-m25p80-add-support-for-Winbond-W25X05-flash.patch b/target/linux/generic/pending-3.18/472-mtd-m25p80-add-support-for-Winbond-W25X05-flash.patch deleted file mode 100644 index f059aa777e..0000000000 --- a/target/linux/generic/pending-3.18/472-mtd-m25p80-add-support-for-Winbond-W25X05-flash.patch +++ /dev/null @@ -1,20 +0,0 @@ -From eef9dfc4e821408af1af13aa0cc707fc496fb7c6 Mon Sep 17 00:00:00 2001 -From: Gabor Juhos -Date: Wed, 11 Dec 2013 19:05:59 +0100 -Subject: [PATCH] m25p80: add support for the Winbond W25X05 flash - -Signed-off-by: Gabor Juhos ---- - drivers/mtd/devices/m25p80.c | 1 + - 1 file changed, 1 insertion(+) - ---- a/drivers/mtd/spi-nor/spi-nor.c -+++ b/drivers/mtd/spi-nor/spi-nor.c -@@ -618,6 +618,7 @@ static const struct spi_device_id spi_no - { "m25px80", INFO(0x207114, 0, 64 * 1024, 16, 0) }, - - /* Winbond -- w25x "blocks" are 64K, "sectors" are 4KiB */ -+ { "w25x05", INFO(0xef3010, 0, 64 * 1024, 1, SECT_4K) }, - { "w25x10", INFO(0xef3011, 0, 64 * 1024, 2, SECT_4K) }, - { "w25x20", INFO(0xef3012, 0, 64 * 1024, 4, SECT_4K) }, - { "w25x40", INFO(0xef3013, 0, 64 * 1024, 8, SECT_4K) }, diff --git a/target/linux/generic/pending-3.18/473-mtd-spi-nor-add-support-for-the-Macronix-MX25L512E-S.patch b/target/linux/generic/pending-3.18/473-mtd-spi-nor-add-support-for-the-Macronix-MX25L512E-S.patch deleted file mode 100644 index 9ba7a4ab2f..0000000000 --- a/target/linux/generic/pending-3.18/473-mtd-spi-nor-add-support-for-the-Macronix-MX25L512E-S.patch +++ /dev/null @@ -1,21 +0,0 @@ -From 0d7388de0911c1a4fc4a8a3898ef9d0ab818ca08 Mon Sep 17 00:00:00 2001 -From: Gabor Juhos -Date: Tue, 7 Apr 2015 18:35:15 +0200 -Subject: [PATCH] mtd: spi-nor: add support for the Macronix MX25L512E SPI - flash chip - -Signed-off-by: Gabor Juhos ---- - drivers/mtd/spi-nor/spi-nor.c | 1 + - 1 file changed, 1 insertion(+) - ---- a/drivers/mtd/spi-nor/spi-nor.c -+++ b/drivers/mtd/spi-nor/spi-nor.c -@@ -518,6 +518,7 @@ static const struct spi_device_id spi_no - { "640s33b", INFO(0x898913, 0, 64 * 1024, 128, 0) }, - - /* Macronix */ -+ { "mx25l512e", INFO(0xc22010, 0, 64 * 1024, 1, SECT_4K) }, - { "mx25l2005a", INFO(0xc22012, 0, 64 * 1024, 4, SECT_4K) }, - { "mx25l4005a", INFO(0xc22013, 0, 64 * 1024, 8, SECT_4K) }, - { "mx25l8005", INFO(0xc22014, 0, 64 * 1024, 16, 0) }, diff --git a/target/linux/generic/pending-3.18/474-mtd-spi-nor-add-support-for-the-ISSI-SI25CD512-SPI-f.patch b/target/linux/generic/pending-3.18/474-mtd-spi-nor-add-support-for-the-ISSI-SI25CD512-SPI-f.patch deleted file mode 100644 index b06ac73fae..0000000000 --- a/target/linux/generic/pending-3.18/474-mtd-spi-nor-add-support-for-the-ISSI-SI25CD512-SPI-f.patch +++ /dev/null @@ -1,22 +0,0 @@ -From 34e2b403040a2f9d3ba071d95a7f42457e2950f9 Mon Sep 17 00:00:00 2001 -From: Gabor Juhos -Date: Tue, 7 Apr 2015 18:35:15 +0200 -Subject: [PATCH] mtd: spi-nor: add support for the ISSI SI25CD512 SPI flash - -Signed-off-by: Gabor Juhos ---- - drivers/mtd/spi-nor/spi-nor.c | 3 +++ - 1 file changed, 3 insertions(+) - ---- a/drivers/mtd/spi-nor/spi-nor.c -+++ b/drivers/mtd/spi-nor/spi-nor.c -@@ -517,6 +517,9 @@ static const struct spi_device_id spi_no - { "320s33b", INFO(0x898912, 0, 64 * 1024, 64, 0) }, - { "640s33b", INFO(0x898913, 0, 64 * 1024, 128, 0) }, - -+ /* ISSI */ -+ { "is25cd512", INFO(0x7f9d20, 0, 32 * 1024, 2, SECT_4K) }, -+ - /* Macronix */ - { "mx25l512e", INFO(0xc22010, 0, 64 * 1024, 1, SECT_4K) }, - { "mx25l2005a", INFO(0xc22012, 0, 64 * 1024, 4, SECT_4K) }, diff --git a/target/linux/generic/pending-3.18/475-mtd-spi-nor-add-macronix-mx25u25635f.patch b/target/linux/generic/pending-3.18/475-mtd-spi-nor-add-macronix-mx25u25635f.patch deleted file mode 100644 index 72c083232e..0000000000 --- a/target/linux/generic/pending-3.18/475-mtd-spi-nor-add-macronix-mx25u25635f.patch +++ /dev/null @@ -1,10 +0,0 @@ ---- a/drivers/mtd/spi-nor/spi-nor.c -+++ b/drivers/mtd/spi-nor/spi-nor.c -@@ -532,6 +532,7 @@ static const struct spi_device_id spi_no - { "mx25l12805d", INFO(0xc22018, 0, 64 * 1024, 256, 0) }, - { "mx25l12855e", INFO(0xc22618, 0, 64 * 1024, 256, 0) }, - { "mx25l25635e", INFO(0xc22019, 0, 64 * 1024, 512, 0) }, -+ { "mx25u25635f", INFO(0xc22539, 0, 64 * 1024, 512, 0) }, - { "mx25l25655e", INFO(0xc22619, 0, 64 * 1024, 512, 0) }, - { "mx66l51235l", INFO(0xc2201a, 0, 64 * 1024, 1024, SPI_NOR_QUAD_READ) }, - { "mx66l1g55g", INFO(0xc2261b, 0, 64 * 1024, 2048, SPI_NOR_QUAD_READ) }, diff --git a/target/linux/generic/pending-3.18/476-mtd-spi-nor-add-eon-en25qh32.patch b/target/linux/generic/pending-3.18/476-mtd-spi-nor-add-eon-en25qh32.patch deleted file mode 100644 index 950970dbc9..0000000000 --- a/target/linux/generic/pending-3.18/476-mtd-spi-nor-add-eon-en25qh32.patch +++ /dev/null @@ -1,10 +0,0 @@ ---- a/drivers/mtd/spi-nor/spi-nor.c -+++ b/drivers/mtd/spi-nor/spi-nor.c -@@ -497,6 +497,7 @@ static const struct spi_device_id spi_no - { "en25q32b", INFO(0x1c3016, 0, 64 * 1024, 64, 0) }, - { "en25p64", INFO(0x1c2017, 0, 64 * 1024, 128, 0) }, - { "en25q64", INFO(0x1c3017, 0, 64 * 1024, 128, SECT_4K) }, -+ { "en25qh32", INFO(0x1c7016, 0, 64 * 1024, 64, 0) }, - { "en25qh128", INFO(0x1c7018, 0, 64 * 1024, 256, 0) }, - { "en25qh256", INFO(0x1c7019, 0, 64 * 1024, 512, 0) }, - diff --git a/target/linux/generic/pending-3.18/480-mtd-set-rootfs-to-be-root-dev.patch b/target/linux/generic/pending-3.18/480-mtd-set-rootfs-to-be-root-dev.patch deleted file mode 100644 index 8fc3578a66..0000000000 --- a/target/linux/generic/pending-3.18/480-mtd-set-rootfs-to-be-root-dev.patch +++ /dev/null @@ -1,26 +0,0 @@ ---- a/drivers/mtd/mtdcore.c -+++ b/drivers/mtd/mtdcore.c -@@ -37,6 +37,7 @@ - #include - #include - #include -+#include - - #include - #include -@@ -456,6 +457,15 @@ int add_mtd_device(struct mtd_info *mtd) - of this try_ nonsense, and no bitching about it - either. :) */ - __module_get(THIS_MODULE); -+ -+ if (!strcmp(mtd->name, "rootfs") && -+ config_enabled(CONFIG_MTD_ROOTFS_ROOT_DEV) && -+ ROOT_DEV == 0) { -+ pr_notice("mtd: device %d (%s) set to be root filesystem\n", -+ mtd->index, mtd->name); -+ ROOT_DEV = MKDEV(MTD_BLOCK_MAJOR, mtd->index); -+ } -+ - return 0; - - fail_added: diff --git a/target/linux/generic/pending-3.18/490-ubi-auto-attach-mtd-device-named-ubi-or-data-on-boot.patch b/target/linux/generic/pending-3.18/490-ubi-auto-attach-mtd-device-named-ubi-or-data-on-boot.patch deleted file mode 100644 index b2b46ac6aa..0000000000 --- a/target/linux/generic/pending-3.18/490-ubi-auto-attach-mtd-device-named-ubi-or-data-on-boot.patch +++ /dev/null @@ -1,76 +0,0 @@ -From 8a52e4100d7c3a4a1dfddfa02b8864a9b0068c13 Mon Sep 17 00:00:00 2001 -From: Daniel Golle -Date: Sat, 17 May 2014 03:36:18 +0200 -Subject: [PATCH 1/5] ubi: auto-attach mtd device named "ubi" or "data" on boot -To: openwrt-devel@lists.openwrt.org - -Signed-off-by: Daniel Golle ---- - drivers/mtd/ubi/build.c | 36 ++++++++++++++++++++++++++++++++++++ - 1 file changed, 36 insertions(+) - ---- a/drivers/mtd/ubi/build.c -+++ b/drivers/mtd/ubi/build.c -@@ -1223,6 +1223,49 @@ static struct mtd_info * __init open_mtd - return mtd; - } - -+/* -+ * This function tries attaching mtd partitions named either "ubi" or "data" -+ * during boot. -+ */ -+static void __init ubi_auto_attach(void) -+{ -+ int err; -+ struct mtd_info *mtd; -+ -+ /* try attaching mtd device named "ubi" or "data" */ -+ mtd = open_mtd_device("ubi"); -+ if (IS_ERR(mtd)) -+ mtd = open_mtd_device("data"); -+ -+ if (!IS_ERR(mtd)) { -+ size_t len; -+ char magic[4]; -+ -+ /* check for a valid ubi magic */ -+ err = mtd_read(mtd, 0, 4, &len, (void *) magic); -+ if (!err && len == 4 && strncmp(magic, "UBI#", 4)) { -+ ubi_err("no valid UBI magic found inside mtd%d", mtd->index); -+ put_mtd_device(mtd); -+ return; -+ } -+ -+ /* auto-add only media types where UBI makes sense */ -+ if (mtd->type == MTD_NANDFLASH || -+ mtd->type == MTD_NORFLASH || -+ mtd->type == MTD_DATAFLASH || -+ mtd->type == MTD_MLCNANDFLASH) { -+ mutex_lock(&ubi_devices_mutex); -+ ubi_msg("auto-attach mtd%d", mtd->index); -+ err = ubi_attach_mtd_dev(mtd, UBI_DEV_NUM_AUTO, 0, 0); -+ mutex_unlock(&ubi_devices_mutex); -+ if (err < 0) { -+ ubi_err("cannot attach mtd%d", mtd->index); -+ put_mtd_device(mtd); -+ } -+ } -+ } -+} -+ - static int __init ubi_init(void) - { - int err, i, k; -@@ -1312,6 +1355,12 @@ static int __init ubi_init(void) - } - } - -+ /* auto-attach mtd devices only if built-in to the kernel and no ubi.mtd -+ * parameter was given */ -+ if (config_enabled(CONFIG_MTD_ROOTFS_ROOT_DEV) && -+ !ubi_is_module() && !mtd_devs) -+ ubi_auto_attach(); -+ - err = ubiblock_init(); - if (err) { - ubi_err("block: cannot initialize, error %d", err); diff --git a/target/linux/generic/pending-3.18/491-ubi-auto-create-ubiblock-device-for-rootfs.patch b/target/linux/generic/pending-3.18/491-ubi-auto-create-ubiblock-device-for-rootfs.patch deleted file mode 100644 index b152fba1b3..0000000000 --- a/target/linux/generic/pending-3.18/491-ubi-auto-create-ubiblock-device-for-rootfs.patch +++ /dev/null @@ -1,69 +0,0 @@ -From 0f3966579815f889bb2fcb4846152c35f65e79c4 Mon Sep 17 00:00:00 2001 -From: Daniel Golle -Date: Thu, 15 May 2014 21:06:33 +0200 -Subject: [PATCH 2/5] ubi: auto-create ubiblock device for rootfs -To: openwrt-devel@lists.openwrt.org - -Signed-off-by: Daniel Golle ---- - drivers/mtd/ubi/block.c | 42 ++++++++++++++++++++++++++++++++++++++++++ - 1 file changed, 42 insertions(+) - ---- a/drivers/mtd/ubi/block.c -+++ b/drivers/mtd/ubi/block.c -@@ -615,6 +615,44 @@ static int __init ubiblock_create_from_p - return ret; - } - -+#define UBIFS_NODE_MAGIC 0x06101831 -+static inline int ubi_vol_is_ubifs(struct ubi_volume_desc *desc) -+{ -+ int ret; -+ uint32_t magic_of, magic; -+ ret = ubi_read(desc, 0, (char *)&magic_of, 0, 4); -+ if (ret) -+ return 0; -+ magic = le32_to_cpu(magic_of); -+ return magic == UBIFS_NODE_MAGIC; -+} -+ -+static void __init ubiblock_create_auto_rootfs(void) -+{ -+ int ubi_num, ret, is_ubifs; -+ struct ubi_volume_desc *desc; -+ struct ubi_volume_info vi; -+ -+ for (ubi_num = 0; ubi_num < UBI_MAX_DEVICES; ubi_num++) { -+ desc = ubi_open_volume_nm(ubi_num, "rootfs", UBI_READONLY); -+ if (IS_ERR(desc)) -+ continue; -+ -+ ubi_get_volume_info(desc, &vi); -+ is_ubifs = ubi_vol_is_ubifs(desc); -+ ubi_close_volume(desc); -+ if (is_ubifs) -+ break; -+ -+ ret = ubiblock_create(&vi); -+ if (ret) -+ ubi_err("block: can't add '%s' volume, err=%d\n", -+ vi.name, ret); -+ /* always break if we get here */ -+ break; -+ } -+} -+ - static void ubiblock_remove_all(void) - { - struct ubiblock *next; -@@ -645,6 +683,10 @@ int __init ubiblock_init(void) - if (ret) - goto err_remove; - -+ /* auto-attach "rootfs" volume if existing and non-ubifs */ -+ if (config_enabled(CONFIG_MTD_ROOTFS_ROOT_DEV)) -+ ubiblock_create_auto_rootfs(); -+ - /* - * Block devices are only created upon user requests, so we ignore - * existing volumes. diff --git a/target/linux/generic/pending-3.18/492-try-auto-mounting-ubi0-rootfs-in-init-do_mounts.c.patch b/target/linux/generic/pending-3.18/492-try-auto-mounting-ubi0-rootfs-in-init-do_mounts.c.patch deleted file mode 100644 index 54a2f8259c..0000000000 --- a/target/linux/generic/pending-3.18/492-try-auto-mounting-ubi0-rootfs-in-init-do_mounts.c.patch +++ /dev/null @@ -1,54 +0,0 @@ -From eea9e1785e4c05c2a3444506aabafa0ae958538f Mon Sep 17 00:00:00 2001 -From: Daniel Golle -Date: Sat, 17 May 2014 03:35:02 +0200 -Subject: [PATCH 4/5] try auto-mounting ubi0:rootfs in init/do_mounts.c -To: openwrt-devel@lists.openwrt.org - -Signed-off-by: Daniel Golle ---- - init/do_mounts.c | 26 +++++++++++++++++++++++++- - 1 file changed, 25 insertions(+), 1 deletion(-) - ---- a/init/do_mounts.c -+++ b/init/do_mounts.c -@@ -433,7 +433,28 @@ retry: - out: - put_page(page); - } -- -+ -+static int __init mount_ubi_rootfs(void) -+{ -+ int flags = MS_SILENT; -+ int err, tried = 0; -+ -+ while (tried < 2) { -+ err = do_mount_root("ubi0:rootfs", "ubifs", flags, \ -+ root_mount_data); -+ switch (err) { -+ case -EACCES: -+ flags |= MS_RDONLY; -+ tried++; -+ break; -+ default: -+ return err; -+ } -+ } -+ -+ return -EINVAL; -+} -+ - #ifdef CONFIG_ROOT_NFS - - #define NFSROOT_TIMEOUT_MIN 5 -@@ -527,6 +548,10 @@ void __init mount_root(void) - change_floppy("root floppy"); - } - #endif -+#ifdef CONFIG_MTD_ROOTFS_ROOT_DEV -+ if (!mount_ubi_rootfs()) -+ return; -+#endif - #ifdef CONFIG_BLOCK - create_dev("/dev/root", ROOT_DEV); - mount_block_root("/dev/root", root_mountflags); diff --git a/target/linux/generic/pending-3.18/493-ubi-set-ROOT_DEV-to-ubiblock-rootfs-if-unset.patch b/target/linux/generic/pending-3.18/493-ubi-set-ROOT_DEV-to-ubiblock-rootfs-if-unset.patch deleted file mode 100644 index 46917d12d2..0000000000 --- a/target/linux/generic/pending-3.18/493-ubi-set-ROOT_DEV-to-ubiblock-rootfs-if-unset.patch +++ /dev/null @@ -1,37 +0,0 @@ -From cd68d1b12b5ea4c01a664c064179ada42bf55d3d Mon Sep 17 00:00:00 2001 -From: Daniel Golle -Date: Thu, 15 May 2014 20:55:42 +0200 -Subject: [PATCH 5/5] ubi: set ROOT_DEV to ubiblock "rootfs" if unset -To: openwrt-devel@lists.openwrt.org - -Signed-off-by: Daniel Golle ---- - drivers/mtd/ubi/block.c | 10 ++++++++++ - 1 file changed, 10 insertions(+) - ---- a/drivers/mtd/ubi/block.c -+++ b/drivers/mtd/ubi/block.c -@@ -48,6 +48,7 @@ - #include - #include - #include -+#include - - #include "ubi-media.h" - #include "ubi.h" -@@ -448,6 +449,15 @@ int ubiblock_create(struct ubi_volume_in - add_disk(dev->gd); - ubi_msg("%s created from ubi%d:%d(%s)", - dev->gd->disk_name, dev->ubi_num, dev->vol_id, vi->name); -+ -+ if (!strcmp(vi->name, "rootfs") && -+ config_enabled(CONFIG_MTD_ROOTFS_ROOT_DEV) && -+ ROOT_DEV == 0) { -+ pr_notice("ubiblock: device ubiblock%d_%d (%s) set to be root filesystem\n", -+ dev->ubi_num, dev->vol_id, vi->name); -+ ROOT_DEV = MKDEV(gd->major, gd->first_minor); -+ } -+ - return 0; - - out_free_queue: diff --git a/target/linux/generic/pending-3.18/494-mtd-ubi-add-EOF-marker-support.patch b/target/linux/generic/pending-3.18/494-mtd-ubi-add-EOF-marker-support.patch deleted file mode 100644 index 4b5eb4568d..0000000000 --- a/target/linux/generic/pending-3.18/494-mtd-ubi-add-EOF-marker-support.patch +++ /dev/null @@ -1,51 +0,0 @@ ---- a/drivers/mtd/ubi/attach.c -+++ b/drivers/mtd/ubi/attach.c -@@ -800,6 +800,13 @@ out_unlock: - return err; - } - -+static bool ec_hdr_has_eof(struct ubi_ec_hdr *ech) -+{ -+ return ech->padding1[0] == 'E' && -+ ech->padding1[1] == 'O' && -+ ech->padding1[2] == 'F'; -+} -+ - /** - * scan_peb - scan and process UBI headers of a PEB. - * @ubi: UBI device description object -@@ -830,9 +837,21 @@ static int scan_peb(struct ubi_device *u - return 0; - } - -- err = ubi_io_read_ec_hdr(ubi, pnum, ech, 0); -- if (err < 0) -- return err; -+ if (!ai->eof_found) { -+ err = ubi_io_read_ec_hdr(ubi, pnum, ech, 0); -+ if (err < 0) -+ return err; -+ -+ if (ec_hdr_has_eof(ech)) { -+ ubi_msg("EOF marker found, PEBs from %d will be erased", -+ pnum); -+ ai->eof_found = true; -+ } -+ } -+ -+ if (ai->eof_found) -+ err = UBI_IO_FF_BITFLIPS; -+ - switch (err) { - case 0: - break; ---- a/drivers/mtd/ubi/ubi.h -+++ b/drivers/mtd/ubi/ubi.h -@@ -705,6 +705,7 @@ struct ubi_attach_info { - int mean_ec; - uint64_t ec_sum; - int ec_count; -+ bool eof_found; - struct kmem_cache *aeb_slab_cache; - }; - diff --git a/target/linux/generic/pending-3.18/530-jffs2_make_lzma_available.patch b/target/linux/generic/pending-3.18/530-jffs2_make_lzma_available.patch deleted file mode 100644 index b68238c937..0000000000 --- a/target/linux/generic/pending-3.18/530-jffs2_make_lzma_available.patch +++ /dev/null @@ -1,5142 +0,0 @@ ---- a/fs/jffs2/Kconfig -+++ b/fs/jffs2/Kconfig -@@ -139,6 +139,15 @@ config JFFS2_LZO - This feature was added in July, 2007. Say 'N' if you need - compatibility with older bootloaders or kernels. - -+config JFFS2_LZMA -+ bool "JFFS2 LZMA compression support" if JFFS2_COMPRESSION_OPTIONS -+ select LZMA_COMPRESS -+ select LZMA_DECOMPRESS -+ depends on JFFS2_FS -+ default n -+ help -+ JFFS2 wrapper to the LZMA C SDK -+ - config JFFS2_RTIME - bool "JFFS2 RTIME compression support" if JFFS2_COMPRESSION_OPTIONS - depends on JFFS2_FS ---- a/fs/jffs2/Makefile -+++ b/fs/jffs2/Makefile -@@ -18,4 +18,7 @@ jffs2-$(CONFIG_JFFS2_RUBIN) += compr_rub - jffs2-$(CONFIG_JFFS2_RTIME) += compr_rtime.o - jffs2-$(CONFIG_JFFS2_ZLIB) += compr_zlib.o - jffs2-$(CONFIG_JFFS2_LZO) += compr_lzo.o -+jffs2-$(CONFIG_JFFS2_LZMA) += compr_lzma.o - jffs2-$(CONFIG_JFFS2_SUMMARY) += summary.o -+ -+CFLAGS_compr_lzma.o += -Iinclude/linux -Ilib/lzma ---- a/fs/jffs2/compr.c -+++ b/fs/jffs2/compr.c -@@ -378,6 +378,9 @@ int __init jffs2_compressors_init(void) - #ifdef CONFIG_JFFS2_LZO - jffs2_lzo_init(); - #endif -+#ifdef CONFIG_JFFS2_LZMA -+ jffs2_lzma_init(); -+#endif - /* Setting default compression mode */ - #ifdef CONFIG_JFFS2_CMODE_NONE - jffs2_compression_mode = JFFS2_COMPR_MODE_NONE; -@@ -401,6 +404,9 @@ int __init jffs2_compressors_init(void) - int jffs2_compressors_exit(void) - { - /* Unregistering compressors */ -+#ifdef CONFIG_JFFS2_LZMA -+ jffs2_lzma_exit(); -+#endif - #ifdef CONFIG_JFFS2_LZO - jffs2_lzo_exit(); - #endif ---- a/fs/jffs2/compr.h -+++ b/fs/jffs2/compr.h -@@ -29,9 +29,9 @@ - #define JFFS2_DYNRUBIN_PRIORITY 20 - #define JFFS2_LZARI_PRIORITY 30 - #define JFFS2_RTIME_PRIORITY 50 --#define JFFS2_ZLIB_PRIORITY 60 --#define JFFS2_LZO_PRIORITY 80 -- -+#define JFFS2_LZMA_PRIORITY 70 -+#define JFFS2_ZLIB_PRIORITY 80 -+#define JFFS2_LZO_PRIORITY 90 - - #define JFFS2_RUBINMIPS_DISABLED /* RUBINs will be used only */ - #define JFFS2_DYNRUBIN_DISABLED /* for decompression */ -@@ -101,5 +101,9 @@ void jffs2_zlib_exit(void); - int jffs2_lzo_init(void); - void jffs2_lzo_exit(void); - #endif -+#ifdef CONFIG_JFFS2_LZMA -+int jffs2_lzma_init(void); -+void jffs2_lzma_exit(void); -+#endif - - #endif /* __JFFS2_COMPR_H__ */ ---- /dev/null -+++ b/fs/jffs2/compr_lzma.c -@@ -0,0 +1,128 @@ -+/* -+ * JFFS2 -- Journalling Flash File System, Version 2. -+ * -+ * For licensing information, see the file 'LICENCE' in this directory. -+ * -+ * JFFS2 wrapper to the LZMA C SDK -+ * -+ */ -+ -+#include -+#include "compr.h" -+ -+#ifdef __KERNEL__ -+ static DEFINE_MUTEX(deflate_mutex); -+#endif -+ -+CLzmaEncHandle *p; -+Byte propsEncoded[LZMA_PROPS_SIZE]; -+SizeT propsSize = sizeof(propsEncoded); -+ -+STATIC void lzma_free_workspace(void) -+{ -+ LzmaEnc_Destroy(p, &lzma_alloc, &lzma_alloc); -+} -+ -+STATIC int INIT lzma_alloc_workspace(CLzmaEncProps *props) -+{ -+ if ((p = (CLzmaEncHandle *)LzmaEnc_Create(&lzma_alloc)) == NULL) -+ { -+ PRINT_ERROR("Failed to allocate lzma deflate workspace\n"); -+ return -ENOMEM; -+ } -+ -+ if (LzmaEnc_SetProps(p, props) != SZ_OK) -+ { -+ lzma_free_workspace(); -+ return -1; -+ } -+ -+ if (LzmaEnc_WriteProperties(p, propsEncoded, &propsSize) != SZ_OK) -+ { -+ lzma_free_workspace(); -+ return -1; -+ } -+ -+ return 0; -+} -+ -+STATIC int jffs2_lzma_compress(unsigned char *data_in, unsigned char *cpage_out, -+ uint32_t *sourcelen, uint32_t *dstlen) -+{ -+ SizeT compress_size = (SizeT)(*dstlen); -+ int ret; -+ -+ #ifdef __KERNEL__ -+ mutex_lock(&deflate_mutex); -+ #endif -+ -+ ret = LzmaEnc_MemEncode(p, cpage_out, &compress_size, data_in, *sourcelen, -+ 0, NULL, &lzma_alloc, &lzma_alloc); -+ -+ #ifdef __KERNEL__ -+ mutex_unlock(&deflate_mutex); -+ #endif -+ -+ if (ret != SZ_OK) -+ return -1; -+ -+ *dstlen = (uint32_t)compress_size; -+ -+ return 0; -+} -+ -+STATIC int jffs2_lzma_decompress(unsigned char *data_in, unsigned char *cpage_out, -+ uint32_t srclen, uint32_t destlen) -+{ -+ int ret; -+ SizeT dl = (SizeT)destlen; -+ SizeT sl = (SizeT)srclen; -+ ELzmaStatus status; -+ -+ ret = LzmaDecode(cpage_out, &dl, data_in, &sl, propsEncoded, -+ propsSize, LZMA_FINISH_ANY, &status, &lzma_alloc); -+ -+ if (ret != SZ_OK || status == LZMA_STATUS_NOT_FINISHED || dl != (SizeT)destlen) -+ return -1; -+ -+ return 0; -+} -+ -+static struct jffs2_compressor jffs2_lzma_comp = { -+ .priority = JFFS2_LZMA_PRIORITY, -+ .name = "lzma", -+ .compr = JFFS2_COMPR_LZMA, -+ .compress = &jffs2_lzma_compress, -+ .decompress = &jffs2_lzma_decompress, -+ .disabled = 0, -+}; -+ -+int INIT jffs2_lzma_init(void) -+{ -+ int ret; -+ CLzmaEncProps props; -+ LzmaEncProps_Init(&props); -+ -+ props.dictSize = LZMA_BEST_DICT(0x2000); -+ props.level = LZMA_BEST_LEVEL; -+ props.lc = LZMA_BEST_LC; -+ props.lp = LZMA_BEST_LP; -+ props.pb = LZMA_BEST_PB; -+ props.fb = LZMA_BEST_FB; -+ -+ ret = lzma_alloc_workspace(&props); -+ if (ret < 0) -+ return ret; -+ -+ ret = jffs2_register_compressor(&jffs2_lzma_comp); -+ if (ret) -+ lzma_free_workspace(); -+ -+ return ret; -+} -+ -+void jffs2_lzma_exit(void) -+{ -+ jffs2_unregister_compressor(&jffs2_lzma_comp); -+ lzma_free_workspace(); -+} ---- a/fs/jffs2/super.c -+++ b/fs/jffs2/super.c -@@ -374,14 +374,41 @@ static int __init init_jffs2_fs(void) - BUILD_BUG_ON(sizeof(struct jffs2_raw_inode) != 68); - BUILD_BUG_ON(sizeof(struct jffs2_raw_summary) != 32); - -- pr_info("version 2.2." -+ pr_info("version 2.2" - #ifdef CONFIG_JFFS2_FS_WRITEBUFFER - " (NAND)" - #endif - #ifdef CONFIG_JFFS2_SUMMARY -- " (SUMMARY) " -+ " (SUMMARY)" - #endif -- " © 2001-2006 Red Hat, Inc.\n"); -+#ifdef CONFIG_JFFS2_ZLIB -+ " (ZLIB)" -+#endif -+#ifdef CONFIG_JFFS2_LZO -+ " (LZO)" -+#endif -+#ifdef CONFIG_JFFS2_LZMA -+ " (LZMA)" -+#endif -+#ifdef CONFIG_JFFS2_RTIME -+ " (RTIME)" -+#endif -+#ifdef CONFIG_JFFS2_RUBIN -+ " (RUBIN)" -+#endif -+#ifdef CONFIG_JFFS2_CMODE_NONE -+ " (CMODE_NONE)" -+#endif -+#ifdef CONFIG_JFFS2_CMODE_PRIORITY -+ " (CMODE_PRIORITY)" -+#endif -+#ifdef CONFIG_JFFS2_CMODE_SIZE -+ " (CMODE_SIZE)" -+#endif -+#ifdef CONFIG_JFFS2_CMODE_FAVOURLZO -+ " (CMODE_FAVOURLZO)" -+#endif -+ " (c) 2001-2006 Red Hat, Inc.\n"); - - jffs2_inode_cachep = kmem_cache_create("jffs2_i", - sizeof(struct jffs2_inode_info), ---- a/include/uapi/linux/jffs2.h -+++ b/include/uapi/linux/jffs2.h -@@ -46,6 +46,7 @@ - #define JFFS2_COMPR_DYNRUBIN 0x05 - #define JFFS2_COMPR_ZLIB 0x06 - #define JFFS2_COMPR_LZO 0x07 -+#define JFFS2_COMPR_LZMA 0x08 - /* Compatibility flags. */ - #define JFFS2_COMPAT_MASK 0xc000 /* What do to if an unknown nodetype is found */ - #define JFFS2_NODE_ACCURATE 0x2000 ---- /dev/null -+++ b/include/linux/lzma.h -@@ -0,0 +1,62 @@ -+#ifndef __LZMA_H__ -+#define __LZMA_H__ -+ -+#ifdef __KERNEL__ -+ #include -+ #include -+ #include -+ #include -+ #include -+ #define LZMA_MALLOC vmalloc -+ #define LZMA_FREE vfree -+ #define PRINT_ERROR(msg) printk(KERN_WARNING #msg) -+ #define INIT __init -+ #define STATIC static -+#else -+ #include -+ #include -+ #include -+ #include -+ #include -+ #include -+ #include -+ #include -+ #ifndef PAGE_SIZE -+ extern int page_size; -+ #define PAGE_SIZE page_size -+ #endif -+ #define LZMA_MALLOC malloc -+ #define LZMA_FREE free -+ #define PRINT_ERROR(msg) fprintf(stderr, msg) -+ #define INIT -+ #define STATIC -+#endif -+ -+#include "lzma/LzmaDec.h" -+#include "lzma/LzmaEnc.h" -+ -+#define LZMA_BEST_LEVEL (9) -+#define LZMA_BEST_LC (0) -+#define LZMA_BEST_LP (0) -+#define LZMA_BEST_PB (0) -+#define LZMA_BEST_FB (273) -+ -+#define LZMA_BEST_DICT(n) (((int)((n) / 2)) * 2) -+ -+static void *p_lzma_malloc(void *p, size_t size) -+{ -+ if (size == 0) -+ return NULL; -+ -+ return LZMA_MALLOC(size); -+} -+ -+static void p_lzma_free(void *p, void *address) -+{ -+ if (address != NULL) -+ LZMA_FREE(address); -+} -+ -+static ISzAlloc lzma_alloc = {p_lzma_malloc, p_lzma_free}; -+ -+#endif ---- /dev/null -+++ b/include/linux/lzma/LzFind.h -@@ -0,0 +1,115 @@ -+/* LzFind.h -- Match finder for LZ algorithms -+2009-04-22 : Igor Pavlov : Public domain */ -+ -+#ifndef __LZ_FIND_H -+#define __LZ_FIND_H -+ -+#include "Types.h" -+ -+#ifdef __cplusplus -+extern "C" { -+#endif -+ -+typedef UInt32 CLzRef; -+ -+typedef struct _CMatchFinder -+{ -+ Byte *buffer; -+ UInt32 pos; -+ UInt32 posLimit; -+ UInt32 streamPos; -+ UInt32 lenLimit; -+ -+ UInt32 cyclicBufferPos; -+ UInt32 cyclicBufferSize; /* it must be = (historySize + 1) */ -+ -+ UInt32 matchMaxLen; -+ CLzRef *hash; -+ CLzRef *son; -+ UInt32 hashMask; -+ UInt32 cutValue; -+ -+ Byte *bufferBase; -+ ISeqInStream *stream; -+ int streamEndWasReached; -+ -+ UInt32 blockSize; -+ UInt32 keepSizeBefore; -+ UInt32 keepSizeAfter; -+ -+ UInt32 numHashBytes; -+ int directInput; -+ size_t directInputRem; -+ int btMode; -+ int bigHash; -+ UInt32 historySize; -+ UInt32 fixedHashSize; -+ UInt32 hashSizeSum; -+ UInt32 numSons; -+ SRes result; -+ UInt32 crc[256]; -+} CMatchFinder; -+ -+#define Inline_MatchFinder_GetPointerToCurrentPos(p) ((p)->buffer) -+#define Inline_MatchFinder_GetIndexByte(p, index) ((p)->buffer[(Int32)(index)]) -+ -+#define Inline_MatchFinder_GetNumAvailableBytes(p) ((p)->streamPos - (p)->pos) -+ -+int MatchFinder_NeedMove(CMatchFinder *p); -+Byte *MatchFinder_GetPointerToCurrentPos(CMatchFinder *p); -+void MatchFinder_MoveBlock(CMatchFinder *p); -+void MatchFinder_ReadIfRequired(CMatchFinder *p); -+ -+void MatchFinder_Construct(CMatchFinder *p); -+ -+/* Conditions: -+ historySize <= 3 GB -+ keepAddBufferBefore + matchMaxLen + keepAddBufferAfter < 511MB -+*/ -+int MatchFinder_Create(CMatchFinder *p, UInt32 historySize, -+ UInt32 keepAddBufferBefore, UInt32 matchMaxLen, UInt32 keepAddBufferAfter, -+ ISzAlloc *alloc); -+void MatchFinder_Free(CMatchFinder *p, ISzAlloc *alloc); -+void MatchFinder_Normalize3(UInt32 subValue, CLzRef *items, UInt32 numItems); -+void MatchFinder_ReduceOffsets(CMatchFinder *p, UInt32 subValue); -+ -+UInt32 * GetMatchesSpec1(UInt32 lenLimit, UInt32 curMatch, UInt32 pos, const Byte *buffer, CLzRef *son, -+ UInt32 _cyclicBufferPos, UInt32 _cyclicBufferSize, UInt32 _cutValue, -+ UInt32 *distances, UInt32 maxLen); -+ -+/* -+Conditions: -+ Mf_GetNumAvailableBytes_Func must be called before each Mf_GetMatchLen_Func. -+ Mf_GetPointerToCurrentPos_Func's result must be used only before any other function -+*/ -+ -+typedef void (*Mf_Init_Func)(void *object); -+typedef Byte (*Mf_GetIndexByte_Func)(void *object, Int32 index); -+typedef UInt32 (*Mf_GetNumAvailableBytes_Func)(void *object); -+typedef const Byte * (*Mf_GetPointerToCurrentPos_Func)(void *object); -+typedef UInt32 (*Mf_GetMatches_Func)(void *object, UInt32 *distances); -+typedef void (*Mf_Skip_Func)(void *object, UInt32); -+ -+typedef struct _IMatchFinder -+{ -+ Mf_Init_Func Init; -+ Mf_GetIndexByte_Func GetIndexByte; -+ Mf_GetNumAvailableBytes_Func GetNumAvailableBytes; -+ Mf_GetPointerToCurrentPos_Func GetPointerToCurrentPos; -+ Mf_GetMatches_Func GetMatches; -+ Mf_Skip_Func Skip; -+} IMatchFinder; -+ -+void MatchFinder_CreateVTable(CMatchFinder *p, IMatchFinder *vTable); -+ -+void MatchFinder_Init(CMatchFinder *p); -+UInt32 Bt3Zip_MatchFinder_GetMatches(CMatchFinder *p, UInt32 *distances); -+UInt32 Hc3Zip_MatchFinder_GetMatches(CMatchFinder *p, UInt32 *distances); -+void Bt3Zip_MatchFinder_Skip(CMatchFinder *p, UInt32 num); -+void Hc3Zip_MatchFinder_Skip(CMatchFinder *p, UInt32 num); -+ -+#ifdef __cplusplus -+} -+#endif -+ -+#endif ---- /dev/null -+++ b/include/linux/lzma/LzHash.h -@@ -0,0 +1,54 @@ -+/* LzHash.h -- HASH functions for LZ algorithms -+2009-02-07 : Igor Pavlov : Public domain */ -+ -+#ifndef __LZ_HASH_H -+#define __LZ_HASH_H -+ -+#define kHash2Size (1 << 10) -+#define kHash3Size (1 << 16) -+#define kHash4Size (1 << 20) -+ -+#define kFix3HashSize (kHash2Size) -+#define kFix4HashSize (kHash2Size + kHash3Size) -+#define kFix5HashSize (kHash2Size + kHash3Size + kHash4Size) -+ -+#define HASH2_CALC hashValue = cur[0] | ((UInt32)cur[1] << 8); -+ -+#define HASH3_CALC { \ -+ UInt32 temp = p->crc[cur[0]] ^ cur[1]; \ -+ hash2Value = temp & (kHash2Size - 1); \ -+ hashValue = (temp ^ ((UInt32)cur[2] << 8)) & p->hashMask; } -+ -+#define HASH4_CALC { \ -+ UInt32 temp = p->crc[cur[0]] ^ cur[1]; \ -+ hash2Value = temp & (kHash2Size - 1); \ -+ hash3Value = (temp ^ ((UInt32)cur[2] << 8)) & (kHash3Size - 1); \ -+ hashValue = (temp ^ ((UInt32)cur[2] << 8) ^ (p->crc[cur[3]] << 5)) & p->hashMask; } -+ -+#define HASH5_CALC { \ -+ UInt32 temp = p->crc[cur[0]] ^ cur[1]; \ -+ hash2Value = temp & (kHash2Size - 1); \ -+ hash3Value = (temp ^ ((UInt32)cur[2] << 8)) & (kHash3Size - 1); \ -+ hash4Value = (temp ^ ((UInt32)cur[2] << 8) ^ (p->crc[cur[3]] << 5)); \ -+ hashValue = (hash4Value ^ (p->crc[cur[4]] << 3)) & p->hashMask; \ -+ hash4Value &= (kHash4Size - 1); } -+ -+/* #define HASH_ZIP_CALC hashValue = ((cur[0] | ((UInt32)cur[1] << 8)) ^ p->crc[cur[2]]) & 0xFFFF; */ -+#define HASH_ZIP_CALC hashValue = ((cur[2] | ((UInt32)cur[0] << 8)) ^ p->crc[cur[1]]) & 0xFFFF; -+ -+ -+#define MT_HASH2_CALC \ -+ hash2Value = (p->crc[cur[0]] ^ cur[1]) & (kHash2Size - 1); -+ -+#define MT_HASH3_CALC { \ -+ UInt32 temp = p->crc[cur[0]] ^ cur[1]; \ -+ hash2Value = temp & (kHash2Size - 1); \ -+ hash3Value = (temp ^ ((UInt32)cur[2] << 8)) & (kHash3Size - 1); } -+ -+#define MT_HASH4_CALC { \ -+ UInt32 temp = p->crc[cur[0]] ^ cur[1]; \ -+ hash2Value = temp & (kHash2Size - 1); \ -+ hash3Value = (temp ^ ((UInt32)cur[2] << 8)) & (kHash3Size - 1); \ -+ hash4Value = (temp ^ ((UInt32)cur[2] << 8) ^ (p->crc[cur[3]] << 5)) & (kHash4Size - 1); } -+ -+#endif ---- /dev/null -+++ b/include/linux/lzma/LzmaDec.h -@@ -0,0 +1,231 @@ -+/* LzmaDec.h -- LZMA Decoder -+2009-02-07 : Igor Pavlov : Public domain */ -+ -+#ifndef __LZMA_DEC_H -+#define __LZMA_DEC_H -+ -+#include "Types.h" -+ -+#ifdef __cplusplus -+extern "C" { -+#endif -+ -+/* #define _LZMA_PROB32 */ -+/* _LZMA_PROB32 can increase the speed on some CPUs, -+ but memory usage for CLzmaDec::probs will be doubled in that case */ -+ -+#ifdef _LZMA_PROB32 -+#define CLzmaProb UInt32 -+#else -+#define CLzmaProb UInt16 -+#endif -+ -+ -+/* ---------- LZMA Properties ---------- */ -+ -+#define LZMA_PROPS_SIZE 5 -+ -+typedef struct _CLzmaProps -+{ -+ unsigned lc, lp, pb; -+ UInt32 dicSize; -+} CLzmaProps; -+ -+/* LzmaProps_Decode - decodes properties -+Returns: -+ SZ_OK -+ SZ_ERROR_UNSUPPORTED - Unsupported properties -+*/ -+ -+SRes LzmaProps_Decode(CLzmaProps *p, const Byte *data, unsigned size); -+ -+ -+/* ---------- LZMA Decoder state ---------- */ -+ -+/* LZMA_REQUIRED_INPUT_MAX = number of required input bytes for worst case. -+ Num bits = log2((2^11 / 31) ^ 22) + 26 < 134 + 26 = 160; */ -+ -+#define LZMA_REQUIRED_INPUT_MAX 20 -+ -+typedef struct -+{ -+ CLzmaProps prop; -+ CLzmaProb *probs; -+ Byte *dic; -+ const Byte *buf; -+ UInt32 range, code; -+ SizeT dicPos; -+ SizeT dicBufSize; -+ UInt32 processedPos; -+ UInt32 checkDicSize; -+ unsigned state; -+ UInt32 reps[4]; -+ unsigned remainLen; -+ int needFlush; -+ int needInitState; -+ UInt32 numProbs; -+ unsigned tempBufSize; -+ Byte tempBuf[LZMA_REQUIRED_INPUT_MAX]; -+} CLzmaDec; -+ -+#define LzmaDec_Construct(p) { (p)->dic = 0; (p)->probs = 0; } -+ -+void LzmaDec_Init(CLzmaDec *p); -+ -+/* There are two types of LZMA streams: -+ 0) Stream with end mark. That end mark adds about 6 bytes to compressed size. -+ 1) Stream without end mark. You must know exact uncompressed size to decompress such stream. */ -+ -+typedef enum -+{ -+ LZMA_FINISH_ANY, /* finish at any point */ -+ LZMA_FINISH_END /* block must be finished at the end */ -+} ELzmaFinishMode; -+ -+/* ELzmaFinishMode has meaning only if the decoding reaches output limit !!! -+ -+ You must use LZMA_FINISH_END, when you know that current output buffer -+ covers last bytes of block. In other cases you must use LZMA_FINISH_ANY. -+ -+ If LZMA decoder sees end marker before reaching output limit, it returns SZ_OK, -+ and output value of destLen will be less than output buffer size limit. -+ You can check status result also. -+ -+ You can use multiple checks to test data integrity after full decompression: -+ 1) Check Result and "status" variable. -+ 2) Check that output(destLen) = uncompressedSize, if you know real uncompressedSize. -+ 3) Check that output(srcLen) = compressedSize, if you know real compressedSize. -+ You must use correct finish mode in that case. */ -+ -+typedef enum -+{ -+ LZMA_STATUS_NOT_SPECIFIED, /* use main error code instead */ -+ LZMA_STATUS_FINISHED_WITH_MARK, /* stream was finished with end mark. */ -+ LZMA_STATUS_NOT_FINISHED, /* stream was not finished */ -+ LZMA_STATUS_NEEDS_MORE_INPUT, /* you must provide more input bytes */ -+ LZMA_STATUS_MAYBE_FINISHED_WITHOUT_MARK /* there is probability that stream was finished without end mark */ -+} ELzmaStatus; -+ -+/* ELzmaStatus is used only as output value for function call */ -+ -+ -+/* ---------- Interfaces ---------- */ -+ -+/* There are 3 levels of interfaces: -+ 1) Dictionary Interface -+ 2) Buffer Interface -+ 3) One Call Interface -+ You can select any of these interfaces, but don't mix functions from different -+ groups for same object. */ -+ -+ -+/* There are two variants to allocate state for Dictionary Interface: -+ 1) LzmaDec_Allocate / LzmaDec_Free -+ 2) LzmaDec_AllocateProbs / LzmaDec_FreeProbs -+ You can use variant 2, if you set dictionary buffer manually. -+ For Buffer Interface you must always use variant 1. -+ -+LzmaDec_Allocate* can return: -+ SZ_OK -+ SZ_ERROR_MEM - Memory allocation error -+ SZ_ERROR_UNSUPPORTED - Unsupported properties -+*/ -+ -+SRes LzmaDec_AllocateProbs(CLzmaDec *p, const Byte *props, unsigned propsSize, ISzAlloc *alloc); -+void LzmaDec_FreeProbs(CLzmaDec *p, ISzAlloc *alloc); -+ -+SRes LzmaDec_Allocate(CLzmaDec *state, const Byte *prop, unsigned propsSize, ISzAlloc *alloc); -+void LzmaDec_Free(CLzmaDec *state, ISzAlloc *alloc); -+ -+/* ---------- Dictionary Interface ---------- */ -+ -+/* You can use it, if you want to eliminate the overhead for data copying from -+ dictionary to some other external buffer. -+ You must work with CLzmaDec variables directly in this interface. -+ -+ STEPS: -+ LzmaDec_Constr() -+ LzmaDec_Allocate() -+ for (each new stream) -+ { -+ LzmaDec_Init() -+ while (it needs more decompression) -+ { -+ LzmaDec_DecodeToDic() -+ use data from CLzmaDec::dic and update CLzmaDec::dicPos -+ } -+ } -+ LzmaDec_Free() -+*/ -+ -+/* LzmaDec_DecodeToDic -+ -+ The decoding to internal dictionary buffer (CLzmaDec::dic). -+ You must manually update CLzmaDec::dicPos, if it reaches CLzmaDec::dicBufSize !!! -+ -+finishMode: -+ It has meaning only if the decoding reaches output limit (dicLimit). -+ LZMA_FINISH_ANY - Decode just dicLimit bytes. -+ LZMA_FINISH_END - Stream must be finished after dicLimit. -+ -+Returns: -+ SZ_OK -+ status: -+ LZMA_STATUS_FINISHED_WITH_MARK -+ LZMA_STATUS_NOT_FINISHED -+ LZMA_STATUS_NEEDS_MORE_INPUT -+ LZMA_STATUS_MAYBE_FINISHED_WITHOUT_MARK -+ SZ_ERROR_DATA - Data error -+*/ -+ -+SRes LzmaDec_DecodeToDic(CLzmaDec *p, SizeT dicLimit, -+ const Byte *src, SizeT *srcLen, ELzmaFinishMode finishMode, ELzmaStatus *status); -+ -+ -+/* ---------- Buffer Interface ---------- */ -+ -+/* It's zlib-like interface. -+ See LzmaDec_DecodeToDic description for information about STEPS and return results, -+ but you must use LzmaDec_DecodeToBuf instead of LzmaDec_DecodeToDic and you don't need -+ to work with CLzmaDec variables manually. -+ -+finishMode: -+ It has meaning only if the decoding reaches output limit (*destLen). -+ LZMA_FINISH_ANY - Decode just destLen bytes. -+ LZMA_FINISH_END - Stream must be finished after (*destLen). -+*/ -+ -+SRes LzmaDec_DecodeToBuf(CLzmaDec *p, Byte *dest, SizeT *destLen, -+ const Byte *src, SizeT *srcLen, ELzmaFinishMode finishMode, ELzmaStatus *status); -+ -+ -+/* ---------- One Call Interface ---------- */ -+ -+/* LzmaDecode -+ -+finishMode: -+ It has meaning only if the decoding reaches output limit (*destLen). -+ LZMA_FINISH_ANY - Decode just destLen bytes. -+ LZMA_FINISH_END - Stream must be finished after (*destLen). -+ -+Returns: -+ SZ_OK -+ status: -+ LZMA_STATUS_FINISHED_WITH_MARK -+ LZMA_STATUS_NOT_FINISHED -+ LZMA_STATUS_MAYBE_FINISHED_WITHOUT_MARK -+ SZ_ERROR_DATA - Data error -+ SZ_ERROR_MEM - Memory allocation error -+ SZ_ERROR_UNSUPPORTED - Unsupported properties -+ SZ_ERROR_INPUT_EOF - It needs more bytes in input buffer (src). -+*/ -+ -+SRes LzmaDecode(Byte *dest, SizeT *destLen, const Byte *src, SizeT *srcLen, -+ const Byte *propData, unsigned propSize, ELzmaFinishMode finishMode, -+ ELzmaStatus *status, ISzAlloc *alloc); -+ -+#ifdef __cplusplus -+} -+#endif -+ -+#endif ---- /dev/null -+++ b/include/linux/lzma/LzmaEnc.h -@@ -0,0 +1,80 @@ -+/* LzmaEnc.h -- LZMA Encoder -+2009-02-07 : Igor Pavlov : Public domain */ -+ -+#ifndef __LZMA_ENC_H -+#define __LZMA_ENC_H -+ -+#include "Types.h" -+ -+#ifdef __cplusplus -+extern "C" { -+#endif -+ -+#define LZMA_PROPS_SIZE 5 -+ -+typedef struct _CLzmaEncProps -+{ -+ int level; /* 0 <= level <= 9 */ -+ UInt32 dictSize; /* (1 << 12) <= dictSize <= (1 << 27) for 32-bit version -+ (1 << 12) <= dictSize <= (1 << 30) for 64-bit version -+ default = (1 << 24) */ -+ int lc; /* 0 <= lc <= 8, default = 3 */ -+ int lp; /* 0 <= lp <= 4, default = 0 */ -+ int pb; /* 0 <= pb <= 4, default = 2 */ -+ int algo; /* 0 - fast, 1 - normal, default = 1 */ -+ int fb; /* 5 <= fb <= 273, default = 32 */ -+ int btMode; /* 0 - hashChain Mode, 1 - binTree mode - normal, default = 1 */ -+ int numHashBytes; /* 2, 3 or 4, default = 4 */ -+ UInt32 mc; /* 1 <= mc <= (1 << 30), default = 32 */ -+ unsigned writeEndMark; /* 0 - do not write EOPM, 1 - write EOPM, default = 0 */ -+ int numThreads; /* 1 or 2, default = 2 */ -+} CLzmaEncProps; -+ -+void LzmaEncProps_Init(CLzmaEncProps *p); -+void LzmaEncProps_Normalize(CLzmaEncProps *p); -+UInt32 LzmaEncProps_GetDictSize(const CLzmaEncProps *props2); -+ -+ -+/* ---------- CLzmaEncHandle Interface ---------- */ -+ -+/* LzmaEnc_* functions can return the following exit codes: -+Returns: -+ SZ_OK - OK -+ SZ_ERROR_MEM - Memory allocation error -+ SZ_ERROR_PARAM - Incorrect paramater in props -+ SZ_ERROR_WRITE - Write callback error. -+ SZ_ERROR_PROGRESS - some break from progress callback -+ SZ_ERROR_THREAD - errors in multithreading functions (only for Mt version) -+*/ -+ -+typedef void * CLzmaEncHandle; -+ -+CLzmaEncHandle LzmaEnc_Create(ISzAlloc *alloc); -+void LzmaEnc_Destroy(CLzmaEncHandle p, ISzAlloc *alloc, ISzAlloc *allocBig); -+SRes LzmaEnc_SetProps(CLzmaEncHandle p, const CLzmaEncProps *props); -+SRes LzmaEnc_WriteProperties(CLzmaEncHandle p, Byte *properties, SizeT *size); -+SRes LzmaEnc_Encode(CLzmaEncHandle p, ISeqOutStream *outStream, ISeqInStream *inStream, -+ ICompressProgress *progress, ISzAlloc *alloc, ISzAlloc *allocBig); -+SRes LzmaEnc_MemEncode(CLzmaEncHandle p, Byte *dest, SizeT *destLen, const Byte *src, SizeT srcLen, -+ int writeEndMark, ICompressProgress *progress, ISzAlloc *alloc, ISzAlloc *allocBig); -+ -+/* ---------- One Call Interface ---------- */ -+ -+/* LzmaEncode -+Return code: -+ SZ_OK - OK -+ SZ_ERROR_MEM - Memory allocation error -+ SZ_ERROR_PARAM - Incorrect paramater -+ SZ_ERROR_OUTPUT_EOF - output buffer overflow -+ SZ_ERROR_THREAD - errors in multithreading functions (only for Mt version) -+*/ -+ -+SRes LzmaEncode(Byte *dest, SizeT *destLen, const Byte *src, SizeT srcLen, -+ const CLzmaEncProps *props, Byte *propsEncoded, SizeT *propsSize, int writeEndMark, -+ ICompressProgress *progress, ISzAlloc *alloc, ISzAlloc *allocBig); -+ -+#ifdef __cplusplus -+} -+#endif -+ -+#endif ---- /dev/null -+++ b/include/linux/lzma/Types.h -@@ -0,0 +1,226 @@ -+/* Types.h -- Basic types -+2009-11-23 : Igor Pavlov : Public domain */ -+ -+#ifndef __7Z_TYPES_H -+#define __7Z_TYPES_H -+ -+#include -+ -+#ifdef _WIN32 -+#include -+#endif -+ -+#ifndef EXTERN_C_BEGIN -+#ifdef __cplusplus -+#define EXTERN_C_BEGIN extern "C" { -+#define EXTERN_C_END } -+#else -+#define EXTERN_C_BEGIN -+#define EXTERN_C_END -+#endif -+#endif -+ -+EXTERN_C_BEGIN -+ -+#define SZ_OK 0 -+ -+#define SZ_ERROR_DATA 1 -+#define SZ_ERROR_MEM 2 -+#define SZ_ERROR_CRC 3 -+#define SZ_ERROR_UNSUPPORTED 4 -+#define SZ_ERROR_PARAM 5 -+#define SZ_ERROR_INPUT_EOF 6 -+#define SZ_ERROR_OUTPUT_EOF 7 -+#define SZ_ERROR_READ 8 -+#define SZ_ERROR_WRITE 9 -+#define SZ_ERROR_PROGRESS 10 -+#define SZ_ERROR_FAIL 11 -+#define SZ_ERROR_THREAD 12 -+ -+#define SZ_ERROR_ARCHIVE 16 -+#define SZ_ERROR_NO_ARCHIVE 17 -+ -+typedef int SRes; -+ -+#ifdef _WIN32 -+typedef DWORD WRes; -+#else -+typedef int WRes; -+#endif -+ -+#ifndef RINOK -+#define RINOK(x) { int __result__ = (x); if (__result__ != 0) return __result__; } -+#endif -+ -+typedef unsigned char Byte; -+typedef short Int16; -+typedef unsigned short UInt16; -+ -+#ifdef _LZMA_UINT32_IS_ULONG -+typedef long Int32; -+typedef unsigned long UInt32; -+#else -+typedef int Int32; -+typedef unsigned int UInt32; -+#endif -+ -+#ifdef _SZ_NO_INT_64 -+ -+/* define _SZ_NO_INT_64, if your compiler doesn't support 64-bit integers. -+ NOTES: Some code will work incorrectly in that case! */ -+ -+typedef long Int64; -+typedef unsigned long UInt64; -+ -+#else -+ -+#if defined(_MSC_VER) || defined(__BORLANDC__) -+typedef __int64 Int64; -+typedef unsigned __int64 UInt64; -+#else -+typedef long long int Int64; -+typedef unsigned long long int UInt64; -+#endif -+ -+#endif -+ -+#ifdef _LZMA_NO_SYSTEM_SIZE_T -+typedef UInt32 SizeT; -+#else -+typedef size_t SizeT; -+#endif -+ -+typedef int Bool; -+#define True 1 -+#define False 0 -+ -+ -+#ifdef _WIN32 -+#define MY_STD_CALL __stdcall -+#else -+#define MY_STD_CALL -+#endif -+ -+#ifdef _MSC_VER -+ -+#if _MSC_VER >= 1300 -+#define MY_NO_INLINE __declspec(noinline) -+#else -+#define MY_NO_INLINE -+#endif -+ -+#define MY_CDECL __cdecl -+#define MY_FAST_CALL __fastcall -+ -+#else -+ -+#define MY_CDECL -+#define MY_FAST_CALL -+ -+#endif -+ -+ -+/* The following interfaces use first parameter as pointer to structure */ -+ -+typedef struct -+{ -+ SRes (*Read)(void *p, void *buf, size_t *size); -+ /* if (input(*size) != 0 && output(*size) == 0) means end_of_stream. -+ (output(*size) < input(*size)) is allowed */ -+} ISeqInStream; -+ -+/* it can return SZ_ERROR_INPUT_EOF */ -+SRes SeqInStream_Read(ISeqInStream *stream, void *buf, size_t size); -+SRes SeqInStream_Read2(ISeqInStream *stream, void *buf, size_t size, SRes errorType); -+SRes SeqInStream_ReadByte(ISeqInStream *stream, Byte *buf); -+ -+typedef struct -+{ -+ size_t (*Write)(void *p, const void *buf, size_t size); -+ /* Returns: result - the number of actually written bytes. -+ (result < size) means error */ -+} ISeqOutStream; -+ -+typedef enum -+{ -+ SZ_SEEK_SET = 0, -+ SZ_SEEK_CUR = 1, -+ SZ_SEEK_END = 2 -+} ESzSeek; -+ -+typedef struct -+{ -+ SRes (*Read)(void *p, void *buf, size_t *size); /* same as ISeqInStream::Read */ -+ SRes (*Seek)(void *p, Int64 *pos, ESzSeek origin); -+} ISeekInStream; -+ -+typedef struct -+{ -+ SRes (*Look)(void *p, void **buf, size_t *size); -+ /* if (input(*size) != 0 && output(*size) == 0) means end_of_stream. -+ (output(*size) > input(*size)) is not allowed -+ (output(*size) < input(*size)) is allowed */ -+ SRes (*Skip)(void *p, size_t offset); -+ /* offset must be <= output(*size) of Look */ -+ -+ SRes (*Read)(void *p, void *buf, size_t *size); -+ /* reads directly (without buffer). It's same as ISeqInStream::Read */ -+ SRes (*Seek)(void *p, Int64 *pos, ESzSeek origin); -+} ILookInStream; -+ -+SRes LookInStream_LookRead(ILookInStream *stream, void *buf, size_t *size); -+SRes LookInStream_SeekTo(ILookInStream *stream, UInt64 offset); -+ -+/* reads via ILookInStream::Read */ -+SRes LookInStream_Read2(ILookInStream *stream, void *buf, size_t size, SRes errorType); -+SRes LookInStream_Read(ILookInStream *stream, void *buf, size_t size); -+ -+#define LookToRead_BUF_SIZE (1 << 14) -+ -+typedef struct -+{ -+ ILookInStream s; -+ ISeekInStream *realStream; -+ size_t pos; -+ size_t size; -+ Byte buf[LookToRead_BUF_SIZE]; -+} CLookToRead; -+ -+void LookToRead_CreateVTable(CLookToRead *p, int lookahead); -+void LookToRead_Init(CLookToRead *p); -+ -+typedef struct -+{ -+ ISeqInStream s; -+ ILookInStream *realStream; -+} CSecToLook; -+ -+void SecToLook_CreateVTable(CSecToLook *p); -+ -+typedef struct -+{ -+ ISeqInStream s; -+ ILookInStream *realStream; -+} CSecToRead; -+ -+void SecToRead_CreateVTable(CSecToRead *p); -+ -+typedef struct -+{ -+ SRes (*Progress)(void *p, UInt64 inSize, UInt64 outSize); -+ /* Returns: result. (result != SZ_OK) means break. -+ Value (UInt64)(Int64)-1 for size means unknown value. */ -+} ICompressProgress; -+ -+typedef struct -+{ -+ void *(*Alloc)(void *p, size_t size); -+ void (*Free)(void *p, void *address); /* address can be 0 */ -+} ISzAlloc; -+ -+#define IAlloc_Alloc(p, size) (p)->Alloc((p), size) -+#define IAlloc_Free(p, a) (p)->Free((p), a) -+ -+EXTERN_C_END -+ -+#endif ---- a/lib/Kconfig -+++ b/lib/Kconfig -@@ -227,6 +227,12 @@ config LZ4_DECOMPRESS - - source "lib/xz/Kconfig" - -+config LZMA_COMPRESS -+ tristate -+ -+config LZMA_DECOMPRESS -+ tristate -+ - # - # These all provide a common interface (hence the apparent duplication with - # ZLIB_INFLATE; DECOMPRESS_GZIP is just a wrapper.) ---- a/lib/Makefile -+++ b/lib/Makefile -@@ -2,6 +2,16 @@ - # Makefile for some libs needed in the kernel. - # - -+ifdef CONFIG_JFFS2_ZLIB -+ CONFIG_ZLIB_INFLATE:=y -+ CONFIG_ZLIB_DEFLATE:=y -+endif -+ -+ifdef CONFIG_JFFS2_LZMA -+ CONFIG_LZMA_DECOMPRESS:=y -+ CONFIG_LZMA_COMPRESS:=y -+endif -+ - ifdef CONFIG_FUNCTION_TRACER - ORIG_CFLAGS := $(KBUILD_CFLAGS) - KBUILD_CFLAGS = $(subst -pg,,$(ORIG_CFLAGS)) -@@ -85,6 +95,8 @@ obj-$(CONFIG_LZ4HC_COMPRESS) += lz4/ - obj-$(CONFIG_LZ4_DECOMPRESS) += lz4/ - obj-$(CONFIG_XZ_DEC) += xz/ - obj-$(CONFIG_RAID6_PQ) += raid6/ -+obj-$(CONFIG_LZMA_COMPRESS) += lzma/ -+obj-$(CONFIG_LZMA_DECOMPRESS) += lzma/ - - lib-$(CONFIG_DECOMPRESS_GZIP) += decompress_inflate.o - lib-$(CONFIG_DECOMPRESS_BZIP2) += decompress_bunzip2.o ---- /dev/null -+++ b/lib/lzma/LzFind.c -@@ -0,0 +1,761 @@ -+/* LzFind.c -- Match finder for LZ algorithms -+2009-04-22 : Igor Pavlov : Public domain */ -+ -+#include -+ -+#include "LzFind.h" -+#include "LzHash.h" -+ -+#define kEmptyHashValue 0 -+#define kMaxValForNormalize ((UInt32)0xFFFFFFFF) -+#define kNormalizeStepMin (1 << 10) /* it must be power of 2 */ -+#define kNormalizeMask (~(kNormalizeStepMin - 1)) -+#define kMaxHistorySize ((UInt32)3 << 30) -+ -+#define kStartMaxLen 3 -+ -+static void LzInWindow_Free(CMatchFinder *p, ISzAlloc *alloc) -+{ -+ if (!p->directInput) -+ { -+ alloc->Free(alloc, p->bufferBase); -+ p->bufferBase = 0; -+ } -+} -+ -+/* keepSizeBefore + keepSizeAfter + keepSizeReserv must be < 4G) */ -+ -+static int LzInWindow_Create(CMatchFinder *p, UInt32 keepSizeReserv, ISzAlloc *alloc) -+{ -+ UInt32 blockSize = p->keepSizeBefore + p->keepSizeAfter + keepSizeReserv; -+ if (p->directInput) -+ { -+ p->blockSize = blockSize; -+ return 1; -+ } -+ if (p->bufferBase == 0 || p->blockSize != blockSize) -+ { -+ LzInWindow_Free(p, alloc); -+ p->blockSize = blockSize; -+ p->bufferBase = (Byte *)alloc->Alloc(alloc, (size_t)blockSize); -+ } -+ return (p->bufferBase != 0); -+} -+ -+Byte *MatchFinder_GetPointerToCurrentPos(CMatchFinder *p) { return p->buffer; } -+Byte MatchFinder_GetIndexByte(CMatchFinder *p, Int32 index) { return p->buffer[index]; } -+ -+UInt32 MatchFinder_GetNumAvailableBytes(CMatchFinder *p) { return p->streamPos - p->pos; } -+ -+void MatchFinder_ReduceOffsets(CMatchFinder *p, UInt32 subValue) -+{ -+ p->posLimit -= subValue; -+ p->pos -= subValue; -+ p->streamPos -= subValue; -+} -+ -+static void MatchFinder_ReadBlock(CMatchFinder *p) -+{ -+ if (p->streamEndWasReached || p->result != SZ_OK) -+ return; -+ if (p->directInput) -+ { -+ UInt32 curSize = 0xFFFFFFFF - p->streamPos; -+ if (curSize > p->directInputRem) -+ curSize = (UInt32)p->directInputRem; -+ p->directInputRem -= curSize; -+ p->streamPos += curSize; -+ if (p->directInputRem == 0) -+ p->streamEndWasReached = 1; -+ return; -+ } -+ for (;;) -+ { -+ Byte *dest = p->buffer + (p->streamPos - p->pos); -+ size_t size = (p->bufferBase + p->blockSize - dest); -+ if (size == 0) -+ return; -+ p->result = p->stream->Read(p->stream, dest, &size); -+ if (p->result != SZ_OK) -+ return; -+ if (size == 0) -+ { -+ p->streamEndWasReached = 1; -+ return; -+ } -+ p->streamPos += (UInt32)size; -+ if (p->streamPos - p->pos > p->keepSizeAfter) -+ return; -+ } -+} -+ -+void MatchFinder_MoveBlock(CMatchFinder *p) -+{ -+ memmove(p->bufferBase, -+ p->buffer - p->keepSizeBefore, -+ (size_t)(p->streamPos - p->pos + p->keepSizeBefore)); -+ p->buffer = p->bufferBase + p->keepSizeBefore; -+} -+ -+int MatchFinder_NeedMove(CMatchFinder *p) -+{ -+ if (p->directInput) -+ return 0; -+ /* if (p->streamEndWasReached) return 0; */ -+ return ((size_t)(p->bufferBase + p->blockSize - p->buffer) <= p->keepSizeAfter); -+} -+ -+void MatchFinder_ReadIfRequired(CMatchFinder *p) -+{ -+ if (p->streamEndWasReached) -+ return; -+ if (p->keepSizeAfter >= p->streamPos - p->pos) -+ MatchFinder_ReadBlock(p); -+} -+ -+static void MatchFinder_CheckAndMoveAndRead(CMatchFinder *p) -+{ -+ if (MatchFinder_NeedMove(p)) -+ MatchFinder_MoveBlock(p); -+ MatchFinder_ReadBlock(p); -+} -+ -+static void MatchFinder_SetDefaultSettings(CMatchFinder *p) -+{ -+ p->cutValue = 32; -+ p->btMode = 1; -+ p->numHashBytes = 4; -+ p->bigHash = 0; -+} -+ -+#define kCrcPoly 0xEDB88320 -+ -+void MatchFinder_Construct(CMatchFinder *p) -+{ -+ UInt32 i; -+ p->bufferBase = 0; -+ p->directInput = 0; -+ p->hash = 0; -+ MatchFinder_SetDefaultSettings(p); -+ -+ for (i = 0; i < 256; i++) -+ { -+ UInt32 r = i; -+ int j; -+ for (j = 0; j < 8; j++) -+ r = (r >> 1) ^ (kCrcPoly & ~((r & 1) - 1)); -+ p->crc[i] = r; -+ } -+} -+ -+static void MatchFinder_FreeThisClassMemory(CMatchFinder *p, ISzAlloc *alloc) -+{ -+ alloc->Free(alloc, p->hash); -+ p->hash = 0; -+} -+ -+void MatchFinder_Free(CMatchFinder *p, ISzAlloc *alloc) -+{ -+ MatchFinder_FreeThisClassMemory(p, alloc); -+ LzInWindow_Free(p, alloc); -+} -+ -+static CLzRef* AllocRefs(UInt32 num, ISzAlloc *alloc) -+{ -+ size_t sizeInBytes = (size_t)num * sizeof(CLzRef); -+ if (sizeInBytes / sizeof(CLzRef) != num) -+ return 0; -+ return (CLzRef *)alloc->Alloc(alloc, sizeInBytes); -+} -+ -+int MatchFinder_Create(CMatchFinder *p, UInt32 historySize, -+ UInt32 keepAddBufferBefore, UInt32 matchMaxLen, UInt32 keepAddBufferAfter, -+ ISzAlloc *alloc) -+{ -+ UInt32 sizeReserv; -+ if (historySize > kMaxHistorySize) -+ { -+ MatchFinder_Free(p, alloc); -+ return 0; -+ } -+ sizeReserv = historySize >> 1; -+ if (historySize > ((UInt32)2 << 30)) -+ sizeReserv = historySize >> 2; -+ sizeReserv += (keepAddBufferBefore + matchMaxLen + keepAddBufferAfter) / 2 + (1 << 19); -+ -+ p->keepSizeBefore = historySize + keepAddBufferBefore + 1; -+ p->keepSizeAfter = matchMaxLen + keepAddBufferAfter; -+ /* we need one additional byte, since we use MoveBlock after pos++ and before dictionary using */ -+ if (LzInWindow_Create(p, sizeReserv, alloc)) -+ { -+ UInt32 newCyclicBufferSize = historySize + 1; -+ UInt32 hs; -+ p->matchMaxLen = matchMaxLen; -+ { -+ p->fixedHashSize = 0; -+ if (p->numHashBytes == 2) -+ hs = (1 << 16) - 1; -+ else -+ { -+ hs = historySize - 1; -+ hs |= (hs >> 1); -+ hs |= (hs >> 2); -+ hs |= (hs >> 4); -+ hs |= (hs >> 8); -+ hs >>= 1; -+ hs |= 0xFFFF; /* don't change it! It's required for Deflate */ -+ if (hs > (1 << 24)) -+ { -+ if (p->numHashBytes == 3) -+ hs = (1 << 24) - 1; -+ else -+ hs >>= 1; -+ } -+ } -+ p->hashMask = hs; -+ hs++; -+ if (p->numHashBytes > 2) p->fixedHashSize += kHash2Size; -+ if (p->numHashBytes > 3) p->fixedHashSize += kHash3Size; -+ if (p->numHashBytes > 4) p->fixedHashSize += kHash4Size; -+ hs += p->fixedHashSize; -+ } -+ -+ { -+ UInt32 prevSize = p->hashSizeSum + p->numSons; -+ UInt32 newSize; -+ p->historySize = historySize; -+ p->hashSizeSum = hs; -+ p->cyclicBufferSize = newCyclicBufferSize; -+ p->numSons = (p->btMode ? newCyclicBufferSize * 2 : newCyclicBufferSize); -+ newSize = p->hashSizeSum + p->numSons; -+ if (p->hash != 0 && prevSize == newSize) -+ return 1; -+ MatchFinder_FreeThisClassMemory(p, alloc); -+ p->hash = AllocRefs(newSize, alloc); -+ if (p->hash != 0) -+ { -+ p->son = p->hash + p->hashSizeSum; -+ return 1; -+ } -+ } -+ } -+ MatchFinder_Free(p, alloc); -+ return 0; -+} -+ -+static void MatchFinder_SetLimits(CMatchFinder *p) -+{ -+ UInt32 limit = kMaxValForNormalize - p->pos; -+ UInt32 limit2 = p->cyclicBufferSize - p->cyclicBufferPos; -+ if (limit2 < limit) -+ limit = limit2; -+ limit2 = p->streamPos - p->pos; -+ if (limit2 <= p->keepSizeAfter) -+ { -+ if (limit2 > 0) -+ limit2 = 1; -+ } -+ else -+ limit2 -= p->keepSizeAfter; -+ if (limit2 < limit) -+ limit = limit2; -+ { -+ UInt32 lenLimit = p->streamPos - p->pos; -+ if (lenLimit > p->matchMaxLen) -+ lenLimit = p->matchMaxLen; -+ p->lenLimit = lenLimit; -+ } -+ p->posLimit = p->pos + limit; -+} -+ -+void MatchFinder_Init(CMatchFinder *p) -+{ -+ UInt32 i; -+ for (i = 0; i < p->hashSizeSum; i++) -+ p->hash[i] = kEmptyHashValue; -+ p->cyclicBufferPos = 0; -+ p->buffer = p->bufferBase; -+ p->pos = p->streamPos = p->cyclicBufferSize; -+ p->result = SZ_OK; -+ p->streamEndWasReached = 0; -+ MatchFinder_ReadBlock(p); -+ MatchFinder_SetLimits(p); -+} -+ -+static UInt32 MatchFinder_GetSubValue(CMatchFinder *p) -+{ -+ return (p->pos - p->historySize - 1) & kNormalizeMask; -+} -+ -+void MatchFinder_Normalize3(UInt32 subValue, CLzRef *items, UInt32 numItems) -+{ -+ UInt32 i; -+ for (i = 0; i < numItems; i++) -+ { -+ UInt32 value = items[i]; -+ if (value <= subValue) -+ value = kEmptyHashValue; -+ else -+ value -= subValue; -+ items[i] = value; -+ } -+} -+ -+static void MatchFinder_Normalize(CMatchFinder *p) -+{ -+ UInt32 subValue = MatchFinder_GetSubValue(p); -+ MatchFinder_Normalize3(subValue, p->hash, p->hashSizeSum + p->numSons); -+ MatchFinder_ReduceOffsets(p, subValue); -+} -+ -+static void MatchFinder_CheckLimits(CMatchFinder *p) -+{ -+ if (p->pos == kMaxValForNormalize) -+ MatchFinder_Normalize(p); -+ if (!p->streamEndWasReached && p->keepSizeAfter == p->streamPos - p->pos) -+ MatchFinder_CheckAndMoveAndRead(p); -+ if (p->cyclicBufferPos == p->cyclicBufferSize) -+ p->cyclicBufferPos = 0; -+ MatchFinder_SetLimits(p); -+} -+ -+static UInt32 * Hc_GetMatchesSpec(UInt32 lenLimit, UInt32 curMatch, UInt32 pos, const Byte *cur, CLzRef *son, -+ UInt32 _cyclicBufferPos, UInt32 _cyclicBufferSize, UInt32 cutValue, -+ UInt32 *distances, UInt32 maxLen) -+{ -+ son[_cyclicBufferPos] = curMatch; -+ for (;;) -+ { -+ UInt32 delta = pos - curMatch; -+ if (cutValue-- == 0 || delta >= _cyclicBufferSize) -+ return distances; -+ { -+ const Byte *pb = cur - delta; -+ curMatch = son[_cyclicBufferPos - delta + ((delta > _cyclicBufferPos) ? _cyclicBufferSize : 0)]; -+ if (pb[maxLen] == cur[maxLen] && *pb == *cur) -+ { -+ UInt32 len = 0; -+ while (++len != lenLimit) -+ if (pb[len] != cur[len]) -+ break; -+ if (maxLen < len) -+ { -+ *distances++ = maxLen = len; -+ *distances++ = delta - 1; -+ if (len == lenLimit) -+ return distances; -+ } -+ } -+ } -+ } -+} -+ -+UInt32 * GetMatchesSpec1(UInt32 lenLimit, UInt32 curMatch, UInt32 pos, const Byte *cur, CLzRef *son, -+ UInt32 _cyclicBufferPos, UInt32 _cyclicBufferSize, UInt32 cutValue, -+ UInt32 *distances, UInt32 maxLen) -+{ -+ CLzRef *ptr0 = son + (_cyclicBufferPos << 1) + 1; -+ CLzRef *ptr1 = son + (_cyclicBufferPos << 1); -+ UInt32 len0 = 0, len1 = 0; -+ for (;;) -+ { -+ UInt32 delta = pos - curMatch; -+ if (cutValue-- == 0 || delta >= _cyclicBufferSize) -+ { -+ *ptr0 = *ptr1 = kEmptyHashValue; -+ return distances; -+ } -+ { -+ CLzRef *pair = son + ((_cyclicBufferPos - delta + ((delta > _cyclicBufferPos) ? _cyclicBufferSize : 0)) << 1); -+ const Byte *pb = cur - delta; -+ UInt32 len = (len0 < len1 ? len0 : len1); -+ if (pb[len] == cur[len]) -+ { -+ if (++len != lenLimit && pb[len] == cur[len]) -+ while (++len != lenLimit) -+ if (pb[len] != cur[len]) -+ break; -+ if (maxLen < len) -+ { -+ *distances++ = maxLen = len; -+ *distances++ = delta - 1; -+ if (len == lenLimit) -+ { -+ *ptr1 = pair[0]; -+ *ptr0 = pair[1]; -+ return distances; -+ } -+ } -+ } -+ if (pb[len] < cur[len]) -+ { -+ *ptr1 = curMatch; -+ ptr1 = pair + 1; -+ curMatch = *ptr1; -+ len1 = len; -+ } -+ else -+ { -+ *ptr0 = curMatch; -+ ptr0 = pair; -+ curMatch = *ptr0; -+ len0 = len; -+ } -+ } -+ } -+} -+ -+static void SkipMatchesSpec(UInt32 lenLimit, UInt32 curMatch, UInt32 pos, const Byte *cur, CLzRef *son, -+ UInt32 _cyclicBufferPos, UInt32 _cyclicBufferSize, UInt32 cutValue) -+{ -+ CLzRef *ptr0 = son + (_cyclicBufferPos << 1) + 1; -+ CLzRef *ptr1 = son + (_cyclicBufferPos << 1); -+ UInt32 len0 = 0, len1 = 0; -+ for (;;) -+ { -+ UInt32 delta = pos - curMatch; -+ if (cutValue-- == 0 || delta >= _cyclicBufferSize) -+ { -+ *ptr0 = *ptr1 = kEmptyHashValue; -+ return; -+ } -+ { -+ CLzRef *pair = son + ((_cyclicBufferPos - delta + ((delta > _cyclicBufferPos) ? _cyclicBufferSize : 0)) << 1); -+ const Byte *pb = cur - delta; -+ UInt32 len = (len0 < len1 ? len0 : len1); -+ if (pb[len] == cur[len]) -+ { -+ while (++len != lenLimit) -+ if (pb[len] != cur[len]) -+ break; -+ { -+ if (len == lenLimit) -+ { -+ *ptr1 = pair[0]; -+ *ptr0 = pair[1]; -+ return; -+ } -+ } -+ } -+ if (pb[len] < cur[len]) -+ { -+ *ptr1 = curMatch; -+ ptr1 = pair + 1; -+ curMatch = *ptr1; -+ len1 = len; -+ } -+ else -+ { -+ *ptr0 = curMatch; -+ ptr0 = pair; -+ curMatch = *ptr0; -+ len0 = len; -+ } -+ } -+ } -+} -+ -+#define MOVE_POS \ -+ ++p->cyclicBufferPos; \ -+ p->buffer++; \ -+ if (++p->pos == p->posLimit) MatchFinder_CheckLimits(p); -+ -+#define MOVE_POS_RET MOVE_POS return offset; -+ -+static void MatchFinder_MovePos(CMatchFinder *p) { MOVE_POS; } -+ -+#define GET_MATCHES_HEADER2(minLen, ret_op) \ -+ UInt32 lenLimit; UInt32 hashValue; const Byte *cur; UInt32 curMatch; \ -+ lenLimit = p->lenLimit; { if (lenLimit < minLen) { MatchFinder_MovePos(p); ret_op; }} \ -+ cur = p->buffer; -+ -+#define GET_MATCHES_HEADER(minLen) GET_MATCHES_HEADER2(minLen, return 0) -+#define SKIP_HEADER(minLen) GET_MATCHES_HEADER2(minLen, continue) -+ -+#define MF_PARAMS(p) p->pos, p->buffer, p->son, p->cyclicBufferPos, p->cyclicBufferSize, p->cutValue -+ -+#define GET_MATCHES_FOOTER(offset, maxLen) \ -+ offset = (UInt32)(GetMatchesSpec1(lenLimit, curMatch, MF_PARAMS(p), \ -+ distances + offset, maxLen) - distances); MOVE_POS_RET; -+ -+#define SKIP_FOOTER \ -+ SkipMatchesSpec(lenLimit, curMatch, MF_PARAMS(p)); MOVE_POS; -+ -+static UInt32 Bt2_MatchFinder_GetMatches(CMatchFinder *p, UInt32 *distances) -+{ -+ UInt32 offset; -+ GET_MATCHES_HEADER(2) -+ HASH2_CALC; -+ curMatch = p->hash[hashValue]; -+ p->hash[hashValue] = p->pos; -+ offset = 0; -+ GET_MATCHES_FOOTER(offset, 1) -+} -+ -+UInt32 Bt3Zip_MatchFinder_GetMatches(CMatchFinder *p, UInt32 *distances) -+{ -+ UInt32 offset; -+ GET_MATCHES_HEADER(3) -+ HASH_ZIP_CALC; -+ curMatch = p->hash[hashValue]; -+ p->hash[hashValue] = p->pos; -+ offset = 0; -+ GET_MATCHES_FOOTER(offset, 2) -+} -+ -+static UInt32 Bt3_MatchFinder_GetMatches(CMatchFinder *p, UInt32 *distances) -+{ -+ UInt32 hash2Value, delta2, maxLen, offset; -+ GET_MATCHES_HEADER(3) -+ -+ HASH3_CALC; -+ -+ delta2 = p->pos - p->hash[hash2Value]; -+ curMatch = p->hash[kFix3HashSize + hashValue]; -+ -+ p->hash[hash2Value] = -+ p->hash[kFix3HashSize + hashValue] = p->pos; -+ -+ -+ maxLen = 2; -+ offset = 0; -+ if (delta2 < p->cyclicBufferSize && *(cur - delta2) == *cur) -+ { -+ for (; maxLen != lenLimit; maxLen++) -+ if (cur[(ptrdiff_t)maxLen - delta2] != cur[maxLen]) -+ break; -+ distances[0] = maxLen; -+ distances[1] = delta2 - 1; -+ offset = 2; -+ if (maxLen == lenLimit) -+ { -+ SkipMatchesSpec(lenLimit, curMatch, MF_PARAMS(p)); -+ MOVE_POS_RET; -+ } -+ } -+ GET_MATCHES_FOOTER(offset, maxLen) -+} -+ -+static UInt32 Bt4_MatchFinder_GetMatches(CMatchFinder *p, UInt32 *distances) -+{ -+ UInt32 hash2Value, hash3Value, delta2, delta3, maxLen, offset; -+ GET_MATCHES_HEADER(4) -+ -+ HASH4_CALC; -+ -+ delta2 = p->pos - p->hash[ hash2Value]; -+ delta3 = p->pos - p->hash[kFix3HashSize + hash3Value]; -+ curMatch = p->hash[kFix4HashSize + hashValue]; -+ -+ p->hash[ hash2Value] = -+ p->hash[kFix3HashSize + hash3Value] = -+ p->hash[kFix4HashSize + hashValue] = p->pos; -+ -+ maxLen = 1; -+ offset = 0; -+ if (delta2 < p->cyclicBufferSize && *(cur - delta2) == *cur) -+ { -+ distances[0] = maxLen = 2; -+ distances[1] = delta2 - 1; -+ offset = 2; -+ } -+ if (delta2 != delta3 && delta3 < p->cyclicBufferSize && *(cur - delta3) == *cur) -+ { -+ maxLen = 3; -+ distances[offset + 1] = delta3 - 1; -+ offset += 2; -+ delta2 = delta3; -+ } -+ if (offset != 0) -+ { -+ for (; maxLen != lenLimit; maxLen++) -+ if (cur[(ptrdiff_t)maxLen - delta2] != cur[maxLen]) -+ break; -+ distances[offset - 2] = maxLen; -+ if (maxLen == lenLimit) -+ { -+ SkipMatchesSpec(lenLimit, curMatch, MF_PARAMS(p)); -+ MOVE_POS_RET; -+ } -+ } -+ if (maxLen < 3) -+ maxLen = 3; -+ GET_MATCHES_FOOTER(offset, maxLen) -+} -+ -+static UInt32 Hc4_MatchFinder_GetMatches(CMatchFinder *p, UInt32 *distances) -+{ -+ UInt32 hash2Value, hash3Value, delta2, delta3, maxLen, offset; -+ GET_MATCHES_HEADER(4) -+ -+ HASH4_CALC; -+ -+ delta2 = p->pos - p->hash[ hash2Value]; -+ delta3 = p->pos - p->hash[kFix3HashSize + hash3Value]; -+ curMatch = p->hash[kFix4HashSize + hashValue]; -+ -+ p->hash[ hash2Value] = -+ p->hash[kFix3HashSize + hash3Value] = -+ p->hash[kFix4HashSize + hashValue] = p->pos; -+ -+ maxLen = 1; -+ offset = 0; -+ if (delta2 < p->cyclicBufferSize && *(cur - delta2) == *cur) -+ { -+ distances[0] = maxLen = 2; -+ distances[1] = delta2 - 1; -+ offset = 2; -+ } -+ if (delta2 != delta3 && delta3 < p->cyclicBufferSize && *(cur - delta3) == *cur) -+ { -+ maxLen = 3; -+ distances[offset + 1] = delta3 - 1; -+ offset += 2; -+ delta2 = delta3; -+ } -+ if (offset != 0) -+ { -+ for (; maxLen != lenLimit; maxLen++) -+ if (cur[(ptrdiff_t)maxLen - delta2] != cur[maxLen]) -+ break; -+ distances[offset - 2] = maxLen; -+ if (maxLen == lenLimit) -+ { -+ p->son[p->cyclicBufferPos] = curMatch; -+ MOVE_POS_RET; -+ } -+ } -+ if (maxLen < 3) -+ maxLen = 3; -+ offset = (UInt32)(Hc_GetMatchesSpec(lenLimit, curMatch, MF_PARAMS(p), -+ distances + offset, maxLen) - (distances)); -+ MOVE_POS_RET -+} -+ -+UInt32 Hc3Zip_MatchFinder_GetMatches(CMatchFinder *p, UInt32 *distances) -+{ -+ UInt32 offset; -+ GET_MATCHES_HEADER(3) -+ HASH_ZIP_CALC; -+ curMatch = p->hash[hashValue]; -+ p->hash[hashValue] = p->pos; -+ offset = (UInt32)(Hc_GetMatchesSpec(lenLimit, curMatch, MF_PARAMS(p), -+ distances, 2) - (distances)); -+ MOVE_POS_RET -+} -+ -+static void Bt2_MatchFinder_Skip(CMatchFinder *p, UInt32 num) -+{ -+ do -+ { -+ SKIP_HEADER(2) -+ HASH2_CALC; -+ curMatch = p->hash[hashValue]; -+ p->hash[hashValue] = p->pos; -+ SKIP_FOOTER -+ } -+ while (--num != 0); -+} -+ -+void Bt3Zip_MatchFinder_Skip(CMatchFinder *p, UInt32 num) -+{ -+ do -+ { -+ SKIP_HEADER(3) -+ HASH_ZIP_CALC; -+ curMatch = p->hash[hashValue]; -+ p->hash[hashValue] = p->pos; -+ SKIP_FOOTER -+ } -+ while (--num != 0); -+} -+ -+static void Bt3_MatchFinder_Skip(CMatchFinder *p, UInt32 num) -+{ -+ do -+ { -+ UInt32 hash2Value; -+ SKIP_HEADER(3) -+ HASH3_CALC; -+ curMatch = p->hash[kFix3HashSize + hashValue]; -+ p->hash[hash2Value] = -+ p->hash[kFix3HashSize + hashValue] = p->pos; -+ SKIP_FOOTER -+ } -+ while (--num != 0); -+} -+ -+static void Bt4_MatchFinder_Skip(CMatchFinder *p, UInt32 num) -+{ -+ do -+ { -+ UInt32 hash2Value, hash3Value; -+ SKIP_HEADER(4) -+ HASH4_CALC; -+ curMatch = p->hash[kFix4HashSize + hashValue]; -+ p->hash[ hash2Value] = -+ p->hash[kFix3HashSize + hash3Value] = p->pos; -+ p->hash[kFix4HashSize + hashValue] = p->pos; -+ SKIP_FOOTER -+ } -+ while (--num != 0); -+} -+ -+static void Hc4_MatchFinder_Skip(CMatchFinder *p, UInt32 num) -+{ -+ do -+ { -+ UInt32 hash2Value, hash3Value; -+ SKIP_HEADER(4) -+ HASH4_CALC; -+ curMatch = p->hash[kFix4HashSize + hashValue]; -+ p->hash[ hash2Value] = -+ p->hash[kFix3HashSize + hash3Value] = -+ p->hash[kFix4HashSize + hashValue] = p->pos; -+ p->son[p->cyclicBufferPos] = curMatch; -+ MOVE_POS -+ } -+ while (--num != 0); -+} -+ -+void Hc3Zip_MatchFinder_Skip(CMatchFinder *p, UInt32 num) -+{ -+ do -+ { -+ SKIP_HEADER(3) -+ HASH_ZIP_CALC; -+ curMatch = p->hash[hashValue]; -+ p->hash[hashValue] = p->pos; -+ p->son[p->cyclicBufferPos] = curMatch; -+ MOVE_POS -+ } -+ while (--num != 0); -+} -+ -+void MatchFinder_CreateVTable(CMatchFinder *p, IMatchFinder *vTable) -+{ -+ vTable->Init = (Mf_Init_Func)MatchFinder_Init; -+ vTable->GetIndexByte = (Mf_GetIndexByte_Func)MatchFinder_GetIndexByte; -+ vTable->GetNumAvailableBytes = (Mf_GetNumAvailableBytes_Func)MatchFinder_GetNumAvailableBytes; -+ vTable->GetPointerToCurrentPos = (Mf_GetPointerToCurrentPos_Func)MatchFinder_GetPointerToCurrentPos; -+ if (!p->btMode) -+ { -+ vTable->GetMatches = (Mf_GetMatches_Func)Hc4_MatchFinder_GetMatches; -+ vTable->Skip = (Mf_Skip_Func)Hc4_MatchFinder_Skip; -+ } -+ else if (p->numHashBytes == 2) -+ { -+ vTable->GetMatches = (Mf_GetMatches_Func)Bt2_MatchFinder_GetMatches; -+ vTable->Skip = (Mf_Skip_Func)Bt2_MatchFinder_Skip; -+ } -+ else if (p->numHashBytes == 3) -+ { -+ vTable->GetMatches = (Mf_GetMatches_Func)Bt3_MatchFinder_GetMatches; -+ vTable->Skip = (Mf_Skip_Func)Bt3_MatchFinder_Skip; -+ } -+ else -+ { -+ vTable->GetMatches = (Mf_GetMatches_Func)Bt4_MatchFinder_GetMatches; -+ vTable->Skip = (Mf_Skip_Func)Bt4_MatchFinder_Skip; -+ } -+} ---- /dev/null -+++ b/lib/lzma/LzmaDec.c -@@ -0,0 +1,999 @@ -+/* LzmaDec.c -- LZMA Decoder -+2009-09-20 : Igor Pavlov : Public domain */ -+ -+#include "LzmaDec.h" -+ -+#include -+ -+#define kNumTopBits 24 -+#define kTopValue ((UInt32)1 << kNumTopBits) -+ -+#define kNumBitModelTotalBits 11 -+#define kBitModelTotal (1 << kNumBitModelTotalBits) -+#define kNumMoveBits 5 -+ -+#define RC_INIT_SIZE 5 -+ -+#define NORMALIZE if (range < kTopValue) { range <<= 8; code = (code << 8) | (*buf++); } -+ -+#define IF_BIT_0(p) ttt = *(p); NORMALIZE; bound = (range >> kNumBitModelTotalBits) * ttt; if (code < bound) -+#define UPDATE_0(p) range = bound; *(p) = (CLzmaProb)(ttt + ((kBitModelTotal - ttt) >> kNumMoveBits)); -+#define UPDATE_1(p) range -= bound; code -= bound; *(p) = (CLzmaProb)(ttt - (ttt >> kNumMoveBits)); -+#define GET_BIT2(p, i, A0, A1) IF_BIT_0(p) \ -+ { UPDATE_0(p); i = (i + i); A0; } else \ -+ { UPDATE_1(p); i = (i + i) + 1; A1; } -+#define GET_BIT(p, i) GET_BIT2(p, i, ; , ;) -+ -+#define TREE_GET_BIT(probs, i) { GET_BIT((probs + i), i); } -+#define TREE_DECODE(probs, limit, i) \ -+ { i = 1; do { TREE_GET_BIT(probs, i); } while (i < limit); i -= limit; } -+ -+/* #define _LZMA_SIZE_OPT */ -+ -+#ifdef _LZMA_SIZE_OPT -+#define TREE_6_DECODE(probs, i) TREE_DECODE(probs, (1 << 6), i) -+#else -+#define TREE_6_DECODE(probs, i) \ -+ { i = 1; \ -+ TREE_GET_BIT(probs, i); \ -+ TREE_GET_BIT(probs, i); \ -+ TREE_GET_BIT(probs, i); \ -+ TREE_GET_BIT(probs, i); \ -+ TREE_GET_BIT(probs, i); \ -+ TREE_GET_BIT(probs, i); \ -+ i -= 0x40; } -+#endif -+ -+#define NORMALIZE_CHECK if (range < kTopValue) { if (buf >= bufLimit) return DUMMY_ERROR; range <<= 8; code = (code << 8) | (*buf++); } -+ -+#define IF_BIT_0_CHECK(p) ttt = *(p); NORMALIZE_CHECK; bound = (range >> kNumBitModelTotalBits) * ttt; if (code < bound) -+#define UPDATE_0_CHECK range = bound; -+#define UPDATE_1_CHECK range -= bound; code -= bound; -+#define GET_BIT2_CHECK(p, i, A0, A1) IF_BIT_0_CHECK(p) \ -+ { UPDATE_0_CHECK; i = (i + i); A0; } else \ -+ { UPDATE_1_CHECK; i = (i + i) + 1; A1; } -+#define GET_BIT_CHECK(p, i) GET_BIT2_CHECK(p, i, ; , ;) -+#define TREE_DECODE_CHECK(probs, limit, i) \ -+ { i = 1; do { GET_BIT_CHECK(probs + i, i) } while (i < limit); i -= limit; } -+ -+ -+#define kNumPosBitsMax 4 -+#define kNumPosStatesMax (1 << kNumPosBitsMax) -+ -+#define kLenNumLowBits 3 -+#define kLenNumLowSymbols (1 << kLenNumLowBits) -+#define kLenNumMidBits 3 -+#define kLenNumMidSymbols (1 << kLenNumMidBits) -+#define kLenNumHighBits 8 -+#define kLenNumHighSymbols (1 << kLenNumHighBits) -+ -+#define LenChoice 0 -+#define LenChoice2 (LenChoice + 1) -+#define LenLow (LenChoice2 + 1) -+#define LenMid (LenLow + (kNumPosStatesMax << kLenNumLowBits)) -+#define LenHigh (LenMid + (kNumPosStatesMax << kLenNumMidBits)) -+#define kNumLenProbs (LenHigh + kLenNumHighSymbols) -+ -+ -+#define kNumStates 12 -+#define kNumLitStates 7 -+ -+#define kStartPosModelIndex 4 -+#define kEndPosModelIndex 14 -+#define kNumFullDistances (1 << (kEndPosModelIndex >> 1)) -+ -+#define kNumPosSlotBits 6 -+#define kNumLenToPosStates 4 -+ -+#define kNumAlignBits 4 -+#define kAlignTableSize (1 << kNumAlignBits) -+ -+#define kMatchMinLen 2 -+#define kMatchSpecLenStart (kMatchMinLen + kLenNumLowSymbols + kLenNumMidSymbols + kLenNumHighSymbols) -+ -+#define IsMatch 0 -+#define IsRep (IsMatch + (kNumStates << kNumPosBitsMax)) -+#define IsRepG0 (IsRep + kNumStates) -+#define IsRepG1 (IsRepG0 + kNumStates) -+#define IsRepG2 (IsRepG1 + kNumStates) -+#define IsRep0Long (IsRepG2 + kNumStates) -+#define PosSlot (IsRep0Long + (kNumStates << kNumPosBitsMax)) -+#define SpecPos (PosSlot + (kNumLenToPosStates << kNumPosSlotBits)) -+#define Align (SpecPos + kNumFullDistances - kEndPosModelIndex) -+#define LenCoder (Align + kAlignTableSize) -+#define RepLenCoder (LenCoder + kNumLenProbs) -+#define Literal (RepLenCoder + kNumLenProbs) -+ -+#define LZMA_BASE_SIZE 1846 -+#define LZMA_LIT_SIZE 768 -+ -+#define LzmaProps_GetNumProbs(p) ((UInt32)LZMA_BASE_SIZE + (LZMA_LIT_SIZE << ((p)->lc + (p)->lp))) -+ -+#if Literal != LZMA_BASE_SIZE -+StopCompilingDueBUG -+#endif -+ -+#define LZMA_DIC_MIN (1 << 12) -+ -+/* First LZMA-symbol is always decoded. -+And it decodes new LZMA-symbols while (buf < bufLimit), but "buf" is without last normalization -+Out: -+ Result: -+ SZ_OK - OK -+ SZ_ERROR_DATA - Error -+ p->remainLen: -+ < kMatchSpecLenStart : normal remain -+ = kMatchSpecLenStart : finished -+ = kMatchSpecLenStart + 1 : Flush marker -+ = kMatchSpecLenStart + 2 : State Init Marker -+*/ -+ -+static int MY_FAST_CALL LzmaDec_DecodeReal(CLzmaDec *p, SizeT limit, const Byte *bufLimit) -+{ -+ CLzmaProb *probs = p->probs; -+ -+ unsigned state = p->state; -+ UInt32 rep0 = p->reps[0], rep1 = p->reps[1], rep2 = p->reps[2], rep3 = p->reps[3]; -+ unsigned pbMask = ((unsigned)1 << (p->prop.pb)) - 1; -+ unsigned lpMask = ((unsigned)1 << (p->prop.lp)) - 1; -+ unsigned lc = p->prop.lc; -+ -+ Byte *dic = p->dic; -+ SizeT dicBufSize = p->dicBufSize; -+ SizeT dicPos = p->dicPos; -+ -+ UInt32 processedPos = p->processedPos; -+ UInt32 checkDicSize = p->checkDicSize; -+ unsigned len = 0; -+ -+ const Byte *buf = p->buf; -+ UInt32 range = p->range; -+ UInt32 code = p->code; -+ -+ do -+ { -+ CLzmaProb *prob; -+ UInt32 bound; -+ unsigned ttt; -+ unsigned posState = processedPos & pbMask; -+ -+ prob = probs + IsMatch + (state << kNumPosBitsMax) + posState; -+ IF_BIT_0(prob) -+ { -+ unsigned symbol; -+ UPDATE_0(prob); -+ prob = probs + Literal; -+ if (checkDicSize != 0 || processedPos != 0) -+ prob += (LZMA_LIT_SIZE * (((processedPos & lpMask) << lc) + -+ (dic[(dicPos == 0 ? dicBufSize : dicPos) - 1] >> (8 - lc)))); -+ -+ if (state < kNumLitStates) -+ { -+ state -= (state < 4) ? state : 3; -+ symbol = 1; -+ do { GET_BIT(prob + symbol, symbol) } while (symbol < 0x100); -+ } -+ else -+ { -+ unsigned matchByte = p->dic[(dicPos - rep0) + ((dicPos < rep0) ? dicBufSize : 0)]; -+ unsigned offs = 0x100; -+ state -= (state < 10) ? 3 : 6; -+ symbol = 1; -+ do -+ { -+ unsigned bit; -+ CLzmaProb *probLit; -+ matchByte <<= 1; -+ bit = (matchByte & offs); -+ probLit = prob + offs + bit + symbol; -+ GET_BIT2(probLit, symbol, offs &= ~bit, offs &= bit) -+ } -+ while (symbol < 0x100); -+ } -+ dic[dicPos++] = (Byte)symbol; -+ processedPos++; -+ continue; -+ } -+ else -+ { -+ UPDATE_1(prob); -+ prob = probs + IsRep + state; -+ IF_BIT_0(prob) -+ { -+ UPDATE_0(prob); -+ state += kNumStates; -+ prob = probs + LenCoder; -+ } -+ else -+ { -+ UPDATE_1(prob); -+ if (checkDicSize == 0 && processedPos == 0) -+ return SZ_ERROR_DATA; -+ prob = probs + IsRepG0 + state; -+ IF_BIT_0(prob) -+ { -+ UPDATE_0(prob); -+ prob = probs + IsRep0Long + (state << kNumPosBitsMax) + posState; -+ IF_BIT_0(prob) -+ { -+ UPDATE_0(prob); -+ dic[dicPos] = dic[(dicPos - rep0) + ((dicPos < rep0) ? dicBufSize : 0)]; -+ dicPos++; -+ processedPos++; -+ state = state < kNumLitStates ? 9 : 11; -+ continue; -+ } -+ UPDATE_1(prob); -+ } -+ else -+ { -+ UInt32 distance; -+ UPDATE_1(prob); -+ prob = probs + IsRepG1 + state; -+ IF_BIT_0(prob) -+ { -+ UPDATE_0(prob); -+ distance = rep1; -+ } -+ else -+ { -+ UPDATE_1(prob); -+ prob = probs + IsRepG2 + state; -+ IF_BIT_0(prob) -+ { -+ UPDATE_0(prob); -+ distance = rep2; -+ } -+ else -+ { -+ UPDATE_1(prob); -+ distance = rep3; -+ rep3 = rep2; -+ } -+ rep2 = rep1; -+ } -+ rep1 = rep0; -+ rep0 = distance; -+ } -+ state = state < kNumLitStates ? 8 : 11; -+ prob = probs + RepLenCoder; -+ } -+ { -+ unsigned limit, offset; -+ CLzmaProb *probLen = prob + LenChoice; -+ IF_BIT_0(probLen) -+ { -+ UPDATE_0(probLen); -+ probLen = prob + LenLow + (posState << kLenNumLowBits); -+ offset = 0; -+ limit = (1 << kLenNumLowBits); -+ } -+ else -+ { -+ UPDATE_1(probLen); -+ probLen = prob + LenChoice2; -+ IF_BIT_0(probLen) -+ { -+ UPDATE_0(probLen); -+ probLen = prob + LenMid + (posState << kLenNumMidBits); -+ offset = kLenNumLowSymbols; -+ limit = (1 << kLenNumMidBits); -+ } -+ else -+ { -+ UPDATE_1(probLen); -+ probLen = prob + LenHigh; -+ offset = kLenNumLowSymbols + kLenNumMidSymbols; -+ limit = (1 << kLenNumHighBits); -+ } -+ } -+ TREE_DECODE(probLen, limit, len); -+ len += offset; -+ } -+ -+ if (state >= kNumStates) -+ { -+ UInt32 distance; -+ prob = probs + PosSlot + -+ ((len < kNumLenToPosStates ? len : kNumLenToPosStates - 1) << kNumPosSlotBits); -+ TREE_6_DECODE(prob, distance); -+ if (distance >= kStartPosModelIndex) -+ { -+ unsigned posSlot = (unsigned)distance; -+ int numDirectBits = (int)(((distance >> 1) - 1)); -+ distance = (2 | (distance & 1)); -+ if (posSlot < kEndPosModelIndex) -+ { -+ distance <<= numDirectBits; -+ prob = probs + SpecPos + distance - posSlot - 1; -+ { -+ UInt32 mask = 1; -+ unsigned i = 1; -+ do -+ { -+ GET_BIT2(prob + i, i, ; , distance |= mask); -+ mask <<= 1; -+ } -+ while (--numDirectBits != 0); -+ } -+ } -+ else -+ { -+ numDirectBits -= kNumAlignBits; -+ do -+ { -+ NORMALIZE -+ range >>= 1; -+ -+ { -+ UInt32 t; -+ code -= range; -+ t = (0 - ((UInt32)code >> 31)); /* (UInt32)((Int32)code >> 31) */ -+ distance = (distance << 1) + (t + 1); -+ code += range & t; -+ } -+ /* -+ distance <<= 1; -+ if (code >= range) -+ { -+ code -= range; -+ distance |= 1; -+ } -+ */ -+ } -+ while (--numDirectBits != 0); -+ prob = probs + Align; -+ distance <<= kNumAlignBits; -+ { -+ unsigned i = 1; -+ GET_BIT2(prob + i, i, ; , distance |= 1); -+ GET_BIT2(prob + i, i, ; , distance |= 2); -+ GET_BIT2(prob + i, i, ; , distance |= 4); -+ GET_BIT2(prob + i, i, ; , distance |= 8); -+ } -+ if (distance == (UInt32)0xFFFFFFFF) -+ { -+ len += kMatchSpecLenStart; -+ state -= kNumStates; -+ break; -+ } -+ } -+ } -+ rep3 = rep2; -+ rep2 = rep1; -+ rep1 = rep0; -+ rep0 = distance + 1; -+ if (checkDicSize == 0) -+ { -+ if (distance >= processedPos) -+ return SZ_ERROR_DATA; -+ } -+ else if (distance >= checkDicSize) -+ return SZ_ERROR_DATA; -+ state = (state < kNumStates + kNumLitStates) ? kNumLitStates : kNumLitStates + 3; -+ } -+ -+ len += kMatchMinLen; -+ -+ if (limit == dicPos) -+ return SZ_ERROR_DATA; -+ { -+ SizeT rem = limit - dicPos; -+ unsigned curLen = ((rem < len) ? (unsigned)rem : len); -+ SizeT pos = (dicPos - rep0) + ((dicPos < rep0) ? dicBufSize : 0); -+ -+ processedPos += curLen; -+ -+ len -= curLen; -+ if (pos + curLen <= dicBufSize) -+ { -+ Byte *dest = dic + dicPos; -+ ptrdiff_t src = (ptrdiff_t)pos - (ptrdiff_t)dicPos; -+ const Byte *lim = dest + curLen; -+ dicPos += curLen; -+ do -+ *(dest) = (Byte)*(dest + src); -+ while (++dest != lim); -+ } -+ else -+ { -+ do -+ { -+ dic[dicPos++] = dic[pos]; -+ if (++pos == dicBufSize) -+ pos = 0; -+ } -+ while (--curLen != 0); -+ } -+ } -+ } -+ } -+ while (dicPos < limit && buf < bufLimit); -+ NORMALIZE; -+ p->buf = buf; -+ p->range = range; -+ p->code = code; -+ p->remainLen = len; -+ p->dicPos = dicPos; -+ p->processedPos = processedPos; -+ p->reps[0] = rep0; -+ p->reps[1] = rep1; -+ p->reps[2] = rep2; -+ p->reps[3] = rep3; -+ p->state = state; -+ -+ return SZ_OK; -+} -+ -+static void MY_FAST_CALL LzmaDec_WriteRem(CLzmaDec *p, SizeT limit) -+{ -+ if (p->remainLen != 0 && p->remainLen < kMatchSpecLenStart) -+ { -+ Byte *dic = p->dic; -+ SizeT dicPos = p->dicPos; -+ SizeT dicBufSize = p->dicBufSize; -+ unsigned len = p->remainLen; -+ UInt32 rep0 = p->reps[0]; -+ if (limit - dicPos < len) -+ len = (unsigned)(limit - dicPos); -+ -+ if (p->checkDicSize == 0 && p->prop.dicSize - p->processedPos <= len) -+ p->checkDicSize = p->prop.dicSize; -+ -+ p->processedPos += len; -+ p->remainLen -= len; -+ while (len-- != 0) -+ { -+ dic[dicPos] = dic[(dicPos - rep0) + ((dicPos < rep0) ? dicBufSize : 0)]; -+ dicPos++; -+ } -+ p->dicPos = dicPos; -+ } -+} -+ -+static int MY_FAST_CALL LzmaDec_DecodeReal2(CLzmaDec *p, SizeT limit, const Byte *bufLimit) -+{ -+ do -+ { -+ SizeT limit2 = limit; -+ if (p->checkDicSize == 0) -+ { -+ UInt32 rem = p->prop.dicSize - p->processedPos; -+ if (limit - p->dicPos > rem) -+ limit2 = p->dicPos + rem; -+ } -+ RINOK(LzmaDec_DecodeReal(p, limit2, bufLimit)); -+ if (p->processedPos >= p->prop.dicSize) -+ p->checkDicSize = p->prop.dicSize; -+ LzmaDec_WriteRem(p, limit); -+ } -+ while (p->dicPos < limit && p->buf < bufLimit && p->remainLen < kMatchSpecLenStart); -+ -+ if (p->remainLen > kMatchSpecLenStart) -+ { -+ p->remainLen = kMatchSpecLenStart; -+ } -+ return 0; -+} -+ -+typedef enum -+{ -+ DUMMY_ERROR, /* unexpected end of input stream */ -+ DUMMY_LIT, -+ DUMMY_MATCH, -+ DUMMY_REP -+} ELzmaDummy; -+ -+static ELzmaDummy LzmaDec_TryDummy(const CLzmaDec *p, const Byte *buf, SizeT inSize) -+{ -+ UInt32 range = p->range; -+ UInt32 code = p->code; -+ const Byte *bufLimit = buf + inSize; -+ CLzmaProb *probs = p->probs; -+ unsigned state = p->state; -+ ELzmaDummy res; -+ -+ { -+ CLzmaProb *prob; -+ UInt32 bound; -+ unsigned ttt; -+ unsigned posState = (p->processedPos) & ((1 << p->prop.pb) - 1); -+ -+ prob = probs + IsMatch + (state << kNumPosBitsMax) + posState; -+ IF_BIT_0_CHECK(prob) -+ { -+ UPDATE_0_CHECK -+ -+ /* if (bufLimit - buf >= 7) return DUMMY_LIT; */ -+ -+ prob = probs + Literal; -+ if (p->checkDicSize != 0 || p->processedPos != 0) -+ prob += (LZMA_LIT_SIZE * -+ ((((p->processedPos) & ((1 << (p->prop.lp)) - 1)) << p->prop.lc) + -+ (p->dic[(p->dicPos == 0 ? p->dicBufSize : p->dicPos) - 1] >> (8 - p->prop.lc)))); -+ -+ if (state < kNumLitStates) -+ { -+ unsigned symbol = 1; -+ do { GET_BIT_CHECK(prob + symbol, symbol) } while (symbol < 0x100); -+ } -+ else -+ { -+ unsigned matchByte = p->dic[p->dicPos - p->reps[0] + -+ ((p->dicPos < p->reps[0]) ? p->dicBufSize : 0)]; -+ unsigned offs = 0x100; -+ unsigned symbol = 1; -+ do -+ { -+ unsigned bit; -+ CLzmaProb *probLit; -+ matchByte <<= 1; -+ bit = (matchByte & offs); -+ probLit = prob + offs + bit + symbol; -+ GET_BIT2_CHECK(probLit, symbol, offs &= ~bit, offs &= bit) -+ } -+ while (symbol < 0x100); -+ } -+ res = DUMMY_LIT; -+ } -+ else -+ { -+ unsigned len; -+ UPDATE_1_CHECK; -+ -+ prob = probs + IsRep + state; -+ IF_BIT_0_CHECK(prob) -+ { -+ UPDATE_0_CHECK; -+ state = 0; -+ prob = probs + LenCoder; -+ res = DUMMY_MATCH; -+ } -+ else -+ { -+ UPDATE_1_CHECK; -+ res = DUMMY_REP; -+ prob = probs + IsRepG0 + state; -+ IF_BIT_0_CHECK(prob) -+ { -+ UPDATE_0_CHECK; -+ prob = probs + IsRep0Long + (state << kNumPosBitsMax) + posState; -+ IF_BIT_0_CHECK(prob) -+ { -+ UPDATE_0_CHECK; -+ NORMALIZE_CHECK; -+ return DUMMY_REP; -+ } -+ else -+ { -+ UPDATE_1_CHECK; -+ } -+ } -+ else -+ { -+ UPDATE_1_CHECK; -+ prob = probs + IsRepG1 + state; -+ IF_BIT_0_CHECK(prob) -+ { -+ UPDATE_0_CHECK; -+ } -+ else -+ { -+ UPDATE_1_CHECK; -+ prob = probs + IsRepG2 + state; -+ IF_BIT_0_CHECK(prob) -+ { -+ UPDATE_0_CHECK; -+ } -+ else -+ { -+ UPDATE_1_CHECK; -+ } -+ } -+ } -+ state = kNumStates; -+ prob = probs + RepLenCoder; -+ } -+ { -+ unsigned limit, offset; -+ CLzmaProb *probLen = prob + LenChoice; -+ IF_BIT_0_CHECK(probLen) -+ { -+ UPDATE_0_CHECK; -+ probLen = prob + LenLow + (posState << kLenNumLowBits); -+ offset = 0; -+ limit = 1 << kLenNumLowBits; -+ } -+ else -+ { -+ UPDATE_1_CHECK; -+ probLen = prob + LenChoice2; -+ IF_BIT_0_CHECK(probLen) -+ { -+ UPDATE_0_CHECK; -+ probLen = prob + LenMid + (posState << kLenNumMidBits); -+ offset = kLenNumLowSymbols; -+ limit = 1 << kLenNumMidBits; -+ } -+ else -+ { -+ UPDATE_1_CHECK; -+ probLen = prob + LenHigh; -+ offset = kLenNumLowSymbols + kLenNumMidSymbols; -+ limit = 1 << kLenNumHighBits; -+ } -+ } -+ TREE_DECODE_CHECK(probLen, limit, len); -+ len += offset; -+ } -+ -+ if (state < 4) -+ { -+ unsigned posSlot; -+ prob = probs + PosSlot + -+ ((len < kNumLenToPosStates ? len : kNumLenToPosStates - 1) << -+ kNumPosSlotBits); -+ TREE_DECODE_CHECK(prob, 1 << kNumPosSlotBits, posSlot); -+ if (posSlot >= kStartPosModelIndex) -+ { -+ int numDirectBits = ((posSlot >> 1) - 1); -+ -+ /* if (bufLimit - buf >= 8) return DUMMY_MATCH; */ -+ -+ if (posSlot < kEndPosModelIndex) -+ { -+ prob = probs + SpecPos + ((2 | (posSlot & 1)) << numDirectBits) - posSlot - 1; -+ } -+ else -+ { -+ numDirectBits -= kNumAlignBits; -+ do -+ { -+ NORMALIZE_CHECK -+ range >>= 1; -+ code -= range & (((code - range) >> 31) - 1); -+ /* if (code >= range) code -= range; */ -+ } -+ while (--numDirectBits != 0); -+ prob = probs + Align; -+ numDirectBits = kNumAlignBits; -+ } -+ { -+ unsigned i = 1; -+ do -+ { -+ GET_BIT_CHECK(prob + i, i); -+ } -+ while (--numDirectBits != 0); -+ } -+ } -+ } -+ } -+ } -+ NORMALIZE_CHECK; -+ return res; -+} -+ -+ -+static void LzmaDec_InitRc(CLzmaDec *p, const Byte *data) -+{ -+ p->code = ((UInt32)data[1] << 24) | ((UInt32)data[2] << 16) | ((UInt32)data[3] << 8) | ((UInt32)data[4]); -+ p->range = 0xFFFFFFFF; -+ p->needFlush = 0; -+} -+ -+void LzmaDec_InitDicAndState(CLzmaDec *p, Bool initDic, Bool initState) -+{ -+ p->needFlush = 1; -+ p->remainLen = 0; -+ p->tempBufSize = 0; -+ -+ if (initDic) -+ { -+ p->processedPos = 0; -+ p->checkDicSize = 0; -+ p->needInitState = 1; -+ } -+ if (initState) -+ p->needInitState = 1; -+} -+ -+void LzmaDec_Init(CLzmaDec *p) -+{ -+ p->dicPos = 0; -+ LzmaDec_InitDicAndState(p, True, True); -+} -+ -+static void LzmaDec_InitStateReal(CLzmaDec *p) -+{ -+ UInt32 numProbs = Literal + ((UInt32)LZMA_LIT_SIZE << (p->prop.lc + p->prop.lp)); -+ UInt32 i; -+ CLzmaProb *probs = p->probs; -+ for (i = 0; i < numProbs; i++) -+ probs[i] = kBitModelTotal >> 1; -+ p->reps[0] = p->reps[1] = p->reps[2] = p->reps[3] = 1; -+ p->state = 0; -+ p->needInitState = 0; -+} -+ -+SRes LzmaDec_DecodeToDic(CLzmaDec *p, SizeT dicLimit, const Byte *src, SizeT *srcLen, -+ ELzmaFinishMode finishMode, ELzmaStatus *status) -+{ -+ SizeT inSize = *srcLen; -+ (*srcLen) = 0; -+ LzmaDec_WriteRem(p, dicLimit); -+ -+ *status = LZMA_STATUS_NOT_SPECIFIED; -+ -+ while (p->remainLen != kMatchSpecLenStart) -+ { -+ int checkEndMarkNow; -+ -+ if (p->needFlush != 0) -+ { -+ for (; inSize > 0 && p->tempBufSize < RC_INIT_SIZE; (*srcLen)++, inSize--) -+ p->tempBuf[p->tempBufSize++] = *src++; -+ if (p->tempBufSize < RC_INIT_SIZE) -+ { -+ *status = LZMA_STATUS_NEEDS_MORE_INPUT; -+ return SZ_OK; -+ } -+ if (p->tempBuf[0] != 0) -+ return SZ_ERROR_DATA; -+ -+ LzmaDec_InitRc(p, p->tempBuf); -+ p->tempBufSize = 0; -+ } -+ -+ checkEndMarkNow = 0; -+ if (p->dicPos >= dicLimit) -+ { -+ if (p->remainLen == 0 && p->code == 0) -+ { -+ *status = LZMA_STATUS_MAYBE_FINISHED_WITHOUT_MARK; -+ return SZ_OK; -+ } -+ if (finishMode == LZMA_FINISH_ANY) -+ { -+ *status = LZMA_STATUS_NOT_FINISHED; -+ return SZ_OK; -+ } -+ if (p->remainLen != 0) -+ { -+ *status = LZMA_STATUS_NOT_FINISHED; -+ return SZ_ERROR_DATA; -+ } -+ checkEndMarkNow = 1; -+ } -+ -+ if (p->needInitState) -+ LzmaDec_InitStateReal(p); -+ -+ if (p->tempBufSize == 0) -+ { -+ SizeT processed; -+ const Byte *bufLimit; -+ if (inSize < LZMA_REQUIRED_INPUT_MAX || checkEndMarkNow) -+ { -+ int dummyRes = LzmaDec_TryDummy(p, src, inSize); -+ if (dummyRes == DUMMY_ERROR) -+ { -+ memcpy(p->tempBuf, src, inSize); -+ p->tempBufSize = (unsigned)inSize; -+ (*srcLen) += inSize; -+ *status = LZMA_STATUS_NEEDS_MORE_INPUT; -+ return SZ_OK; -+ } -+ if (checkEndMarkNow && dummyRes != DUMMY_MATCH) -+ { -+ *status = LZMA_STATUS_NOT_FINISHED; -+ return SZ_ERROR_DATA; -+ } -+ bufLimit = src; -+ } -+ else -+ bufLimit = src + inSize - LZMA_REQUIRED_INPUT_MAX; -+ p->buf = src; -+ if (LzmaDec_DecodeReal2(p, dicLimit, bufLimit) != 0) -+ return SZ_ERROR_DATA; -+ processed = (SizeT)(p->buf - src); -+ (*srcLen) += processed; -+ src += processed; -+ inSize -= processed; -+ } -+ else -+ { -+ unsigned rem = p->tempBufSize, lookAhead = 0; -+ while (rem < LZMA_REQUIRED_INPUT_MAX && lookAhead < inSize) -+ p->tempBuf[rem++] = src[lookAhead++]; -+ p->tempBufSize = rem; -+ if (rem < LZMA_REQUIRED_INPUT_MAX || checkEndMarkNow) -+ { -+ int dummyRes = LzmaDec_TryDummy(p, p->tempBuf, rem); -+ if (dummyRes == DUMMY_ERROR) -+ { -+ (*srcLen) += lookAhead; -+ *status = LZMA_STATUS_NEEDS_MORE_INPUT; -+ return SZ_OK; -+ } -+ if (checkEndMarkNow && dummyRes != DUMMY_MATCH) -+ { -+ *status = LZMA_STATUS_NOT_FINISHED; -+ return SZ_ERROR_DATA; -+ } -+ } -+ p->buf = p->tempBuf; -+ if (LzmaDec_DecodeReal2(p, dicLimit, p->buf) != 0) -+ return SZ_ERROR_DATA; -+ lookAhead -= (rem - (unsigned)(p->buf - p->tempBuf)); -+ (*srcLen) += lookAhead; -+ src += lookAhead; -+ inSize -= lookAhead; -+ p->tempBufSize = 0; -+ } -+ } -+ if (p->code == 0) -+ *status = LZMA_STATUS_FINISHED_WITH_MARK; -+ return (p->code == 0) ? SZ_OK : SZ_ERROR_DATA; -+} -+ -+SRes LzmaDec_DecodeToBuf(CLzmaDec *p, Byte *dest, SizeT *destLen, const Byte *src, SizeT *srcLen, ELzmaFinishMode finishMode, ELzmaStatus *status) -+{ -+ SizeT outSize = *destLen; -+ SizeT inSize = *srcLen; -+ *srcLen = *destLen = 0; -+ for (;;) -+ { -+ SizeT inSizeCur = inSize, outSizeCur, dicPos; -+ ELzmaFinishMode curFinishMode; -+ SRes res; -+ if (p->dicPos == p->dicBufSize) -+ p->dicPos = 0; -+ dicPos = p->dicPos; -+ if (outSize > p->dicBufSize - dicPos) -+ { -+ outSizeCur = p->dicBufSize; -+ curFinishMode = LZMA_FINISH_ANY; -+ } -+ else -+ { -+ outSizeCur = dicPos + outSize; -+ curFinishMode = finishMode; -+ } -+ -+ res = LzmaDec_DecodeToDic(p, outSizeCur, src, &inSizeCur, curFinishMode, status); -+ src += inSizeCur; -+ inSize -= inSizeCur; -+ *srcLen += inSizeCur; -+ outSizeCur = p->dicPos - dicPos; -+ memcpy(dest, p->dic + dicPos, outSizeCur); -+ dest += outSizeCur; -+ outSize -= outSizeCur; -+ *destLen += outSizeCur; -+ if (res != 0) -+ return res; -+ if (outSizeCur == 0 || outSize == 0) -+ return SZ_OK; -+ } -+} -+ -+void LzmaDec_FreeProbs(CLzmaDec *p, ISzAlloc *alloc) -+{ -+ alloc->Free(alloc, p->probs); -+ p->probs = 0; -+} -+ -+static void LzmaDec_FreeDict(CLzmaDec *p, ISzAlloc *alloc) -+{ -+ alloc->Free(alloc, p->dic); -+ p->dic = 0; -+} -+ -+void LzmaDec_Free(CLzmaDec *p, ISzAlloc *alloc) -+{ -+ LzmaDec_FreeProbs(p, alloc); -+ LzmaDec_FreeDict(p, alloc); -+} -+ -+SRes LzmaProps_Decode(CLzmaProps *p, const Byte *data, unsigned size) -+{ -+ UInt32 dicSize; -+ Byte d; -+ -+ if (size < LZMA_PROPS_SIZE) -+ return SZ_ERROR_UNSUPPORTED; -+ else -+ dicSize = data[1] | ((UInt32)data[2] << 8) | ((UInt32)data[3] << 16) | ((UInt32)data[4] << 24); -+ -+ if (dicSize < LZMA_DIC_MIN) -+ dicSize = LZMA_DIC_MIN; -+ p->dicSize = dicSize; -+ -+ d = data[0]; -+ if (d >= (9 * 5 * 5)) -+ return SZ_ERROR_UNSUPPORTED; -+ -+ p->lc = d % 9; -+ d /= 9; -+ p->pb = d / 5; -+ p->lp = d % 5; -+ -+ return SZ_OK; -+} -+ -+static SRes LzmaDec_AllocateProbs2(CLzmaDec *p, const CLzmaProps *propNew, ISzAlloc *alloc) -+{ -+ UInt32 numProbs = LzmaProps_GetNumProbs(propNew); -+ if (p->probs == 0 || numProbs != p->numProbs) -+ { -+ LzmaDec_FreeProbs(p, alloc); -+ p->probs = (CLzmaProb *)alloc->Alloc(alloc, numProbs * sizeof(CLzmaProb)); -+ p->numProbs = numProbs; -+ if (p->probs == 0) -+ return SZ_ERROR_MEM; -+ } -+ return SZ_OK; -+} -+ -+SRes LzmaDec_AllocateProbs(CLzmaDec *p, const Byte *props, unsigned propsSize, ISzAlloc *alloc) -+{ -+ CLzmaProps propNew; -+ RINOK(LzmaProps_Decode(&propNew, props, propsSize)); -+ RINOK(LzmaDec_AllocateProbs2(p, &propNew, alloc)); -+ p->prop = propNew; -+ return SZ_OK; -+} -+ -+SRes LzmaDec_Allocate(CLzmaDec *p, const Byte *props, unsigned propsSize, ISzAlloc *alloc) -+{ -+ CLzmaProps propNew; -+ SizeT dicBufSize; -+ RINOK(LzmaProps_Decode(&propNew, props, propsSize)); -+ RINOK(LzmaDec_AllocateProbs2(p, &propNew, alloc)); -+ dicBufSize = propNew.dicSize; -+ if (p->dic == 0 || dicBufSize != p->dicBufSize) -+ { -+ LzmaDec_FreeDict(p, alloc); -+ p->dic = (Byte *)alloc->Alloc(alloc, dicBufSize); -+ if (p->dic == 0) -+ { -+ LzmaDec_FreeProbs(p, alloc); -+ return SZ_ERROR_MEM; -+ } -+ } -+ p->dicBufSize = dicBufSize; -+ p->prop = propNew; -+ return SZ_OK; -+} -+ -+SRes LzmaDecode(Byte *dest, SizeT *destLen, const Byte *src, SizeT *srcLen, -+ const Byte *propData, unsigned propSize, ELzmaFinishMode finishMode, -+ ELzmaStatus *status, ISzAlloc *alloc) -+{ -+ CLzmaDec p; -+ SRes res; -+ SizeT inSize = *srcLen; -+ SizeT outSize = *destLen; -+ *srcLen = *destLen = 0; -+ if (inSize < RC_INIT_SIZE) -+ return SZ_ERROR_INPUT_EOF; -+ -+ LzmaDec_Construct(&p); -+ res = LzmaDec_AllocateProbs(&p, propData, propSize, alloc); -+ if (res != 0) -+ return res; -+ p.dic = dest; -+ p.dicBufSize = outSize; -+ -+ LzmaDec_Init(&p); -+ -+ *srcLen = inSize; -+ res = LzmaDec_DecodeToDic(&p, outSize, src, srcLen, finishMode, status); -+ -+ if (res == SZ_OK && *status == LZMA_STATUS_NEEDS_MORE_INPUT) -+ res = SZ_ERROR_INPUT_EOF; -+ -+ (*destLen) = p.dicPos; -+ LzmaDec_FreeProbs(&p, alloc); -+ return res; -+} ---- /dev/null -+++ b/lib/lzma/LzmaEnc.c -@@ -0,0 +1,2271 @@ -+/* LzmaEnc.c -- LZMA Encoder -+2009-11-24 : Igor Pavlov : Public domain */ -+ -+#include -+ -+/* #define SHOW_STAT */ -+/* #define SHOW_STAT2 */ -+ -+#if defined(SHOW_STAT) || defined(SHOW_STAT2) -+#include -+#endif -+ -+#include "LzmaEnc.h" -+ -+/* disable MT */ -+#define _7ZIP_ST -+ -+#include "LzFind.h" -+#ifndef _7ZIP_ST -+#include "LzFindMt.h" -+#endif -+ -+#ifdef SHOW_STAT -+static int ttt = 0; -+#endif -+ -+#define kBlockSizeMax ((1 << LZMA_NUM_BLOCK_SIZE_BITS) - 1) -+ -+#define kBlockSize (9 << 10) -+#define kUnpackBlockSize (1 << 18) -+#define kMatchArraySize (1 << 21) -+#define kMatchRecordMaxSize ((LZMA_MATCH_LEN_MAX * 2 + 3) * LZMA_MATCH_LEN_MAX) -+ -+#define kNumMaxDirectBits (31) -+ -+#define kNumTopBits 24 -+#define kTopValue ((UInt32)1 << kNumTopBits) -+ -+#define kNumBitModelTotalBits 11 -+#define kBitModelTotal (1 << kNumBitModelTotalBits) -+#define kNumMoveBits 5 -+#define kProbInitValue (kBitModelTotal >> 1) -+ -+#define kNumMoveReducingBits 4 -+#define kNumBitPriceShiftBits 4 -+#define kBitPrice (1 << kNumBitPriceShiftBits) -+ -+void LzmaEncProps_Init(CLzmaEncProps *p) -+{ -+ p->level = 5; -+ p->dictSize = p->mc = 0; -+ p->lc = p->lp = p->pb = p->algo = p->fb = p->btMode = p->numHashBytes = p->numThreads = -1; -+ p->writeEndMark = 0; -+} -+ -+void LzmaEncProps_Normalize(CLzmaEncProps *p) -+{ -+ int level = p->level; -+ if (level < 0) level = 5; -+ p->level = level; -+ if (p->dictSize == 0) p->dictSize = (level <= 5 ? (1 << (level * 2 + 14)) : (level == 6 ? (1 << 25) : (1 << 26))); -+ if (p->lc < 0) p->lc = 3; -+ if (p->lp < 0) p->lp = 0; -+ if (p->pb < 0) p->pb = 2; -+ if (p->algo < 0) p->algo = (level < 5 ? 0 : 1); -+ if (p->fb < 0) p->fb = (level < 7 ? 32 : 64); -+ if (p->btMode < 0) p->btMode = (p->algo == 0 ? 0 : 1); -+ if (p->numHashBytes < 0) p->numHashBytes = 4; -+ if (p->mc == 0) p->mc = (16 + (p->fb >> 1)) >> (p->btMode ? 0 : 1); -+ if (p->numThreads < 0) -+ p->numThreads = -+ #ifndef _7ZIP_ST -+ ((p->btMode && p->algo) ? 2 : 1); -+ #else -+ 1; -+ #endif -+} -+ -+UInt32 LzmaEncProps_GetDictSize(const CLzmaEncProps *props2) -+{ -+ CLzmaEncProps props = *props2; -+ LzmaEncProps_Normalize(&props); -+ return props.dictSize; -+} -+ -+/* #define LZMA_LOG_BSR */ -+/* Define it for Intel's CPU */ -+ -+ -+#ifdef LZMA_LOG_BSR -+ -+#define kDicLogSizeMaxCompress 30 -+ -+#define BSR2_RET(pos, res) { unsigned long i; _BitScanReverse(&i, (pos)); res = (i + i) + ((pos >> (i - 1)) & 1); } -+ -+UInt32 GetPosSlot1(UInt32 pos) -+{ -+ UInt32 res; -+ BSR2_RET(pos, res); -+ return res; -+} -+#define GetPosSlot2(pos, res) { BSR2_RET(pos, res); } -+#define GetPosSlot(pos, res) { if (pos < 2) res = pos; else BSR2_RET(pos, res); } -+ -+#else -+ -+#define kNumLogBits (9 + (int)sizeof(size_t) / 2) -+#define kDicLogSizeMaxCompress ((kNumLogBits - 1) * 2 + 7) -+ -+void LzmaEnc_FastPosInit(Byte *g_FastPos) -+{ -+ int c = 2, slotFast; -+ g_FastPos[0] = 0; -+ g_FastPos[1] = 1; -+ -+ for (slotFast = 2; slotFast < kNumLogBits * 2; slotFast++) -+ { -+ UInt32 k = (1 << ((slotFast >> 1) - 1)); -+ UInt32 j; -+ for (j = 0; j < k; j++, c++) -+ g_FastPos[c] = (Byte)slotFast; -+ } -+} -+ -+#define BSR2_RET(pos, res) { UInt32 i = 6 + ((kNumLogBits - 1) & \ -+ (0 - (((((UInt32)1 << (kNumLogBits + 6)) - 1) - pos) >> 31))); \ -+ res = p->g_FastPos[pos >> i] + (i * 2); } -+/* -+#define BSR2_RET(pos, res) { res = (pos < (1 << (kNumLogBits + 6))) ? \ -+ p->g_FastPos[pos >> 6] + 12 : \ -+ p->g_FastPos[pos >> (6 + kNumLogBits - 1)] + (6 + (kNumLogBits - 1)) * 2; } -+*/ -+ -+#define GetPosSlot1(pos) p->g_FastPos[pos] -+#define GetPosSlot2(pos, res) { BSR2_RET(pos, res); } -+#define GetPosSlot(pos, res) { if (pos < kNumFullDistances) res = p->g_FastPos[pos]; else BSR2_RET(pos, res); } -+ -+#endif -+ -+ -+#define LZMA_NUM_REPS 4 -+ -+typedef unsigned CState; -+ -+typedef struct -+{ -+ UInt32 price; -+ -+ CState state; -+ int prev1IsChar; -+ int prev2; -+ -+ UInt32 posPrev2; -+ UInt32 backPrev2; -+ -+ UInt32 posPrev; -+ UInt32 backPrev; -+ UInt32 backs[LZMA_NUM_REPS]; -+} COptimal; -+ -+#define kNumOpts (1 << 12) -+ -+#define kNumLenToPosStates 4 -+#define kNumPosSlotBits 6 -+#define kDicLogSizeMin 0 -+#define kDicLogSizeMax 32 -+#define kDistTableSizeMax (kDicLogSizeMax * 2) -+ -+ -+#define kNumAlignBits 4 -+#define kAlignTableSize (1 << kNumAlignBits) -+#define kAlignMask (kAlignTableSize - 1) -+ -+#define kStartPosModelIndex 4 -+#define kEndPosModelIndex 14 -+#define kNumPosModels (kEndPosModelIndex - kStartPosModelIndex) -+ -+#define kNumFullDistances (1 << (kEndPosModelIndex >> 1)) -+ -+#ifdef _LZMA_PROB32 -+#define CLzmaProb UInt32 -+#else -+#define CLzmaProb UInt16 -+#endif -+ -+#define LZMA_PB_MAX 4 -+#define LZMA_LC_MAX 8 -+#define LZMA_LP_MAX 4 -+ -+#define LZMA_NUM_PB_STATES_MAX (1 << LZMA_PB_MAX) -+ -+ -+#define kLenNumLowBits 3 -+#define kLenNumLowSymbols (1 << kLenNumLowBits) -+#define kLenNumMidBits 3 -+#define kLenNumMidSymbols (1 << kLenNumMidBits) -+#define kLenNumHighBits 8 -+#define kLenNumHighSymbols (1 << kLenNumHighBits) -+ -+#define kLenNumSymbolsTotal (kLenNumLowSymbols + kLenNumMidSymbols + kLenNumHighSymbols) -+ -+#define LZMA_MATCH_LEN_MIN 2 -+#define LZMA_MATCH_LEN_MAX (LZMA_MATCH_LEN_MIN + kLenNumSymbolsTotal - 1) -+ -+#define kNumStates 12 -+ -+typedef struct -+{ -+ CLzmaProb choice; -+ CLzmaProb choice2; -+ CLzmaProb low[LZMA_NUM_PB_STATES_MAX << kLenNumLowBits]; -+ CLzmaProb mid[LZMA_NUM_PB_STATES_MAX << kLenNumMidBits]; -+ CLzmaProb high[kLenNumHighSymbols]; -+} CLenEnc; -+ -+typedef struct -+{ -+ CLenEnc p; -+ UInt32 prices[LZMA_NUM_PB_STATES_MAX][kLenNumSymbolsTotal]; -+ UInt32 tableSize; -+ UInt32 counters[LZMA_NUM_PB_STATES_MAX]; -+} CLenPriceEnc; -+ -+typedef struct -+{ -+ UInt32 range; -+ Byte cache; -+ UInt64 low; -+ UInt64 cacheSize; -+ Byte *buf; -+ Byte *bufLim; -+ Byte *bufBase; -+ ISeqOutStream *outStream; -+ UInt64 processed; -+ SRes res; -+} CRangeEnc; -+ -+typedef struct -+{ -+ CLzmaProb *litProbs; -+ -+ CLzmaProb isMatch[kNumStates][LZMA_NUM_PB_STATES_MAX]; -+ CLzmaProb isRep[kNumStates]; -+ CLzmaProb isRepG0[kNumStates]; -+ CLzmaProb isRepG1[kNumStates]; -+ CLzmaProb isRepG2[kNumStates]; -+ CLzmaProb isRep0Long[kNumStates][LZMA_NUM_PB_STATES_MAX]; -+ -+ CLzmaProb posSlotEncoder[kNumLenToPosStates][1 << kNumPosSlotBits]; -+ CLzmaProb posEncoders[kNumFullDistances - kEndPosModelIndex]; -+ CLzmaProb posAlignEncoder[1 << kNumAlignBits]; -+ -+ CLenPriceEnc lenEnc; -+ CLenPriceEnc repLenEnc; -+ -+ UInt32 reps[LZMA_NUM_REPS]; -+ UInt32 state; -+} CSaveState; -+ -+typedef struct -+{ -+ IMatchFinder matchFinder; -+ void *matchFinderObj; -+ -+ #ifndef _7ZIP_ST -+ Bool mtMode; -+ CMatchFinderMt matchFinderMt; -+ #endif -+ -+ CMatchFinder matchFinderBase; -+ -+ #ifndef _7ZIP_ST -+ Byte pad[128]; -+ #endif -+ -+ UInt32 optimumEndIndex; -+ UInt32 optimumCurrentIndex; -+ -+ UInt32 longestMatchLength; -+ UInt32 numPairs; -+ UInt32 numAvail; -+ COptimal opt[kNumOpts]; -+ -+ #ifndef LZMA_LOG_BSR -+ Byte g_FastPos[1 << kNumLogBits]; -+ #endif -+ -+ UInt32 ProbPrices[kBitModelTotal >> kNumMoveReducingBits]; -+ UInt32 matches[LZMA_MATCH_LEN_MAX * 2 + 2 + 1]; -+ UInt32 numFastBytes; -+ UInt32 additionalOffset; -+ UInt32 reps[LZMA_NUM_REPS]; -+ UInt32 state; -+ -+ UInt32 posSlotPrices[kNumLenToPosStates][kDistTableSizeMax]; -+ UInt32 distancesPrices[kNumLenToPosStates][kNumFullDistances]; -+ UInt32 alignPrices[kAlignTableSize]; -+ UInt32 alignPriceCount; -+ -+ UInt32 distTableSize; -+ -+ unsigned lc, lp, pb; -+ unsigned lpMask, pbMask; -+ -+ CLzmaProb *litProbs; -+ -+ CLzmaProb isMatch[kNumStates][LZMA_NUM_PB_STATES_MAX]; -+ CLzmaProb isRep[kNumStates]; -+ CLzmaProb isRepG0[kNumStates]; -+ CLzmaProb isRepG1[kNumStates]; -+ CLzmaProb isRepG2[kNumStates]; -+ CLzmaProb isRep0Long[kNumStates][LZMA_NUM_PB_STATES_MAX]; -+ -+ CLzmaProb posSlotEncoder[kNumLenToPosStates][1 << kNumPosSlotBits]; -+ CLzmaProb posEncoders[kNumFullDistances - kEndPosModelIndex]; -+ CLzmaProb posAlignEncoder[1 << kNumAlignBits]; -+ -+ CLenPriceEnc lenEnc; -+ CLenPriceEnc repLenEnc; -+ -+ unsigned lclp; -+ -+ Bool fastMode; -+ -+ CRangeEnc rc; -+ -+ Bool writeEndMark; -+ UInt64 nowPos64; -+ UInt32 matchPriceCount; -+ Bool finished; -+ Bool multiThread; -+ -+ SRes result; -+ UInt32 dictSize; -+ UInt32 matchFinderCycles; -+ -+ int needInit; -+ -+ CSaveState saveState; -+} CLzmaEnc; -+ -+void LzmaEnc_SaveState(CLzmaEncHandle pp) -+{ -+ CLzmaEnc *p = (CLzmaEnc *)pp; -+ CSaveState *dest = &p->saveState; -+ int i; -+ dest->lenEnc = p->lenEnc; -+ dest->repLenEnc = p->repLenEnc; -+ dest->state = p->state; -+ -+ for (i = 0; i < kNumStates; i++) -+ { -+ memcpy(dest->isMatch[i], p->isMatch[i], sizeof(p->isMatch[i])); -+ memcpy(dest->isRep0Long[i], p->isRep0Long[i], sizeof(p->isRep0Long[i])); -+ } -+ for (i = 0; i < kNumLenToPosStates; i++) -+ memcpy(dest->posSlotEncoder[i], p->posSlotEncoder[i], sizeof(p->posSlotEncoder[i])); -+ memcpy(dest->isRep, p->isRep, sizeof(p->isRep)); -+ memcpy(dest->isRepG0, p->isRepG0, sizeof(p->isRepG0)); -+ memcpy(dest->isRepG1, p->isRepG1, sizeof(p->isRepG1)); -+ memcpy(dest->isRepG2, p->isRepG2, sizeof(p->isRepG2)); -+ memcpy(dest->posEncoders, p->posEncoders, sizeof(p->posEncoders)); -+ memcpy(dest->posAlignEncoder, p->posAlignEncoder, sizeof(p->posAlignEncoder)); -+ memcpy(dest->reps, p->reps, sizeof(p->reps)); -+ memcpy(dest->litProbs, p->litProbs, (0x300 << p->lclp) * sizeof(CLzmaProb)); -+} -+ -+void LzmaEnc_RestoreState(CLzmaEncHandle pp) -+{ -+ CLzmaEnc *dest = (CLzmaEnc *)pp; -+ const CSaveState *p = &dest->saveState; -+ int i; -+ dest->lenEnc = p->lenEnc; -+ dest->repLenEnc = p->repLenEnc; -+ dest->state = p->state; -+ -+ for (i = 0; i < kNumStates; i++) -+ { -+ memcpy(dest->isMatch[i], p->isMatch[i], sizeof(p->isMatch[i])); -+ memcpy(dest->isRep0Long[i], p->isRep0Long[i], sizeof(p->isRep0Long[i])); -+ } -+ for (i = 0; i < kNumLenToPosStates; i++) -+ memcpy(dest->posSlotEncoder[i], p->posSlotEncoder[i], sizeof(p->posSlotEncoder[i])); -+ memcpy(dest->isRep, p->isRep, sizeof(p->isRep)); -+ memcpy(dest->isRepG0, p->isRepG0, sizeof(p->isRepG0)); -+ memcpy(dest->isRepG1, p->isRepG1, sizeof(p->isRepG1)); -+ memcpy(dest->isRepG2, p->isRepG2, sizeof(p->isRepG2)); -+ memcpy(dest->posEncoders, p->posEncoders, sizeof(p->posEncoders)); -+ memcpy(dest->posAlignEncoder, p->posAlignEncoder, sizeof(p->posAlignEncoder)); -+ memcpy(dest->reps, p->reps, sizeof(p->reps)); -+ memcpy(dest->litProbs, p->litProbs, (0x300 << dest->lclp) * sizeof(CLzmaProb)); -+} -+ -+SRes LzmaEnc_SetProps(CLzmaEncHandle pp, const CLzmaEncProps *props2) -+{ -+ CLzmaEnc *p = (CLzmaEnc *)pp; -+ CLzmaEncProps props = *props2; -+ LzmaEncProps_Normalize(&props); -+ -+ if (props.lc > LZMA_LC_MAX || props.lp > LZMA_LP_MAX || props.pb > LZMA_PB_MAX || -+ props.dictSize > (1 << kDicLogSizeMaxCompress) || props.dictSize > (1 << 30)) -+ return SZ_ERROR_PARAM; -+ p->dictSize = props.dictSize; -+ p->matchFinderCycles = props.mc; -+ { -+ unsigned fb = props.fb; -+ if (fb < 5) -+ fb = 5; -+ if (fb > LZMA_MATCH_LEN_MAX) -+ fb = LZMA_MATCH_LEN_MAX; -+ p->numFastBytes = fb; -+ } -+ p->lc = props.lc; -+ p->lp = props.lp; -+ p->pb = props.pb; -+ p->fastMode = (props.algo == 0); -+ p->matchFinderBase.btMode = props.btMode; -+ { -+ UInt32 numHashBytes = 4; -+ if (props.btMode) -+ { -+ if (props.numHashBytes < 2) -+ numHashBytes = 2; -+ else if (props.numHashBytes < 4) -+ numHashBytes = props.numHashBytes; -+ } -+ p->matchFinderBase.numHashBytes = numHashBytes; -+ } -+ -+ p->matchFinderBase.cutValue = props.mc; -+ -+ p->writeEndMark = props.writeEndMark; -+ -+ #ifndef _7ZIP_ST -+ /* -+ if (newMultiThread != _multiThread) -+ { -+ ReleaseMatchFinder(); -+ _multiThread = newMultiThread; -+ } -+ */ -+ p->multiThread = (props.numThreads > 1); -+ #endif -+ -+ return SZ_OK; -+} -+ -+static const int kLiteralNextStates[kNumStates] = {0, 0, 0, 0, 1, 2, 3, 4, 5, 6, 4, 5}; -+static const int kMatchNextStates[kNumStates] = {7, 7, 7, 7, 7, 7, 7, 10, 10, 10, 10, 10}; -+static const int kRepNextStates[kNumStates] = {8, 8, 8, 8, 8, 8, 8, 11, 11, 11, 11, 11}; -+static const int kShortRepNextStates[kNumStates]= {9, 9, 9, 9, 9, 9, 9, 11, 11, 11, 11, 11}; -+ -+#define IsCharState(s) ((s) < 7) -+ -+#define GetLenToPosState(len) (((len) < kNumLenToPosStates + 1) ? (len) - 2 : kNumLenToPosStates - 1) -+ -+#define kInfinityPrice (1 << 30) -+ -+static void RangeEnc_Construct(CRangeEnc *p) -+{ -+ p->outStream = 0; -+ p->bufBase = 0; -+} -+ -+#define RangeEnc_GetProcessed(p) ((p)->processed + ((p)->buf - (p)->bufBase) + (p)->cacheSize) -+ -+#define RC_BUF_SIZE (1 << 16) -+static int RangeEnc_Alloc(CRangeEnc *p, ISzAlloc *alloc) -+{ -+ if (p->bufBase == 0) -+ { -+ p->bufBase = (Byte *)alloc->Alloc(alloc, RC_BUF_SIZE); -+ if (p->bufBase == 0) -+ return 0; -+ p->bufLim = p->bufBase + RC_BUF_SIZE; -+ } -+ return 1; -+} -+ -+static void RangeEnc_Free(CRangeEnc *p, ISzAlloc *alloc) -+{ -+ alloc->Free(alloc, p->bufBase); -+ p->bufBase = 0; -+} -+ -+static void RangeEnc_Init(CRangeEnc *p) -+{ -+ /* Stream.Init(); */ -+ p->low = 0; -+ p->range = 0xFFFFFFFF; -+ p->cacheSize = 1; -+ p->cache = 0; -+ -+ p->buf = p->bufBase; -+ -+ p->processed = 0; -+ p->res = SZ_OK; -+} -+ -+static void RangeEnc_FlushStream(CRangeEnc *p) -+{ -+ size_t num; -+ if (p->res != SZ_OK) -+ return; -+ num = p->buf - p->bufBase; -+ if (num != p->outStream->Write(p->outStream, p->bufBase, num)) -+ p->res = SZ_ERROR_WRITE; -+ p->processed += num; -+ p->buf = p->bufBase; -+} -+ -+static void MY_FAST_CALL RangeEnc_ShiftLow(CRangeEnc *p) -+{ -+ if ((UInt32)p->low < (UInt32)0xFF000000 || (int)(p->low >> 32) != 0) -+ { -+ Byte temp = p->cache; -+ do -+ { -+ Byte *buf = p->buf; -+ *buf++ = (Byte)(temp + (Byte)(p->low >> 32)); -+ p->buf = buf; -+ if (buf == p->bufLim) -+ RangeEnc_FlushStream(p); -+ temp = 0xFF; -+ } -+ while (--p->cacheSize != 0); -+ p->cache = (Byte)((UInt32)p->low >> 24); -+ } -+ p->cacheSize++; -+ p->low = (UInt32)p->low << 8; -+} -+ -+static void RangeEnc_FlushData(CRangeEnc *p) -+{ -+ int i; -+ for (i = 0; i < 5; i++) -+ RangeEnc_ShiftLow(p); -+} -+ -+static void RangeEnc_EncodeDirectBits(CRangeEnc *p, UInt32 value, int numBits) -+{ -+ do -+ { -+ p->range >>= 1; -+ p->low += p->range & (0 - ((value >> --numBits) & 1)); -+ if (p->range < kTopValue) -+ { -+ p->range <<= 8; -+ RangeEnc_ShiftLow(p); -+ } -+ } -+ while (numBits != 0); -+} -+ -+static void RangeEnc_EncodeBit(CRangeEnc *p, CLzmaProb *prob, UInt32 symbol) -+{ -+ UInt32 ttt = *prob; -+ UInt32 newBound = (p->range >> kNumBitModelTotalBits) * ttt; -+ if (symbol == 0) -+ { -+ p->range = newBound; -+ ttt += (kBitModelTotal - ttt) >> kNumMoveBits; -+ } -+ else -+ { -+ p->low += newBound; -+ p->range -= newBound; -+ ttt -= ttt >> kNumMoveBits; -+ } -+ *prob = (CLzmaProb)ttt; -+ if (p->range < kTopValue) -+ { -+ p->range <<= 8; -+ RangeEnc_ShiftLow(p); -+ } -+} -+ -+static void LitEnc_Encode(CRangeEnc *p, CLzmaProb *probs, UInt32 symbol) -+{ -+ symbol |= 0x100; -+ do -+ { -+ RangeEnc_EncodeBit(p, probs + (symbol >> 8), (symbol >> 7) & 1); -+ symbol <<= 1; -+ } -+ while (symbol < 0x10000); -+} -+ -+static void LitEnc_EncodeMatched(CRangeEnc *p, CLzmaProb *probs, UInt32 symbol, UInt32 matchByte) -+{ -+ UInt32 offs = 0x100; -+ symbol |= 0x100; -+ do -+ { -+ matchByte <<= 1; -+ RangeEnc_EncodeBit(p, probs + (offs + (matchByte & offs) + (symbol >> 8)), (symbol >> 7) & 1); -+ symbol <<= 1; -+ offs &= ~(matchByte ^ symbol); -+ } -+ while (symbol < 0x10000); -+} -+ -+void LzmaEnc_InitPriceTables(UInt32 *ProbPrices) -+{ -+ UInt32 i; -+ for (i = (1 << kNumMoveReducingBits) / 2; i < kBitModelTotal; i += (1 << kNumMoveReducingBits)) -+ { -+ const int kCyclesBits = kNumBitPriceShiftBits; -+ UInt32 w = i; -+ UInt32 bitCount = 0; -+ int j; -+ for (j = 0; j < kCyclesBits; j++) -+ { -+ w = w * w; -+ bitCount <<= 1; -+ while (w >= ((UInt32)1 << 16)) -+ { -+ w >>= 1; -+ bitCount++; -+ } -+ } -+ ProbPrices[i >> kNumMoveReducingBits] = ((kNumBitModelTotalBits << kCyclesBits) - 15 - bitCount); -+ } -+} -+ -+ -+#define GET_PRICE(prob, symbol) \ -+ p->ProbPrices[((prob) ^ (((-(int)(symbol))) & (kBitModelTotal - 1))) >> kNumMoveReducingBits]; -+ -+#define GET_PRICEa(prob, symbol) \ -+ ProbPrices[((prob) ^ ((-((int)(symbol))) & (kBitModelTotal - 1))) >> kNumMoveReducingBits]; -+ -+#define GET_PRICE_0(prob) p->ProbPrices[(prob) >> kNumMoveReducingBits] -+#define GET_PRICE_1(prob) p->ProbPrices[((prob) ^ (kBitModelTotal - 1)) >> kNumMoveReducingBits] -+ -+#define GET_PRICE_0a(prob) ProbPrices[(prob) >> kNumMoveReducingBits] -+#define GET_PRICE_1a(prob) ProbPrices[((prob) ^ (kBitModelTotal - 1)) >> kNumMoveReducingBits] -+ -+static UInt32 LitEnc_GetPrice(const CLzmaProb *probs, UInt32 symbol, UInt32 *ProbPrices) -+{ -+ UInt32 price = 0; -+ symbol |= 0x100; -+ do -+ { -+ price += GET_PRICEa(probs[symbol >> 8], (symbol >> 7) & 1); -+ symbol <<= 1; -+ } -+ while (symbol < 0x10000); -+ return price; -+} -+ -+static UInt32 LitEnc_GetPriceMatched(const CLzmaProb *probs, UInt32 symbol, UInt32 matchByte, UInt32 *ProbPrices) -+{ -+ UInt32 price = 0; -+ UInt32 offs = 0x100; -+ symbol |= 0x100; -+ do -+ { -+ matchByte <<= 1; -+ price += GET_PRICEa(probs[offs + (matchByte & offs) + (symbol >> 8)], (symbol >> 7) & 1); -+ symbol <<= 1; -+ offs &= ~(matchByte ^ symbol); -+ } -+ while (symbol < 0x10000); -+ return price; -+} -+ -+ -+static void RcTree_Encode(CRangeEnc *rc, CLzmaProb *probs, int numBitLevels, UInt32 symbol) -+{ -+ UInt32 m = 1; -+ int i; -+ for (i = numBitLevels; i != 0;) -+ { -+ UInt32 bit; -+ i--; -+ bit = (symbol >> i) & 1; -+ RangeEnc_EncodeBit(rc, probs + m, bit); -+ m = (m << 1) | bit; -+ } -+} -+ -+static void RcTree_ReverseEncode(CRangeEnc *rc, CLzmaProb *probs, int numBitLevels, UInt32 symbol) -+{ -+ UInt32 m = 1; -+ int i; -+ for (i = 0; i < numBitLevels; i++) -+ { -+ UInt32 bit = symbol & 1; -+ RangeEnc_EncodeBit(rc, probs + m, bit); -+ m = (m << 1) | bit; -+ symbol >>= 1; -+ } -+} -+ -+static UInt32 RcTree_GetPrice(const CLzmaProb *probs, int numBitLevels, UInt32 symbol, UInt32 *ProbPrices) -+{ -+ UInt32 price = 0; -+ symbol |= (1 << numBitLevels); -+ while (symbol != 1) -+ { -+ price += GET_PRICEa(probs[symbol >> 1], symbol & 1); -+ symbol >>= 1; -+ } -+ return price; -+} -+ -+static UInt32 RcTree_ReverseGetPrice(const CLzmaProb *probs, int numBitLevels, UInt32 symbol, UInt32 *ProbPrices) -+{ -+ UInt32 price = 0; -+ UInt32 m = 1; -+ int i; -+ for (i = numBitLevels; i != 0; i--) -+ { -+ UInt32 bit = symbol & 1; -+ symbol >>= 1; -+ price += GET_PRICEa(probs[m], bit); -+ m = (m << 1) | bit; -+ } -+ return price; -+} -+ -+ -+static void LenEnc_Init(CLenEnc *p) -+{ -+ unsigned i; -+ p->choice = p->choice2 = kProbInitValue; -+ for (i = 0; i < (LZMA_NUM_PB_STATES_MAX << kLenNumLowBits); i++) -+ p->low[i] = kProbInitValue; -+ for (i = 0; i < (LZMA_NUM_PB_STATES_MAX << kLenNumMidBits); i++) -+ p->mid[i] = kProbInitValue; -+ for (i = 0; i < kLenNumHighSymbols; i++) -+ p->high[i] = kProbInitValue; -+} -+ -+static void LenEnc_Encode(CLenEnc *p, CRangeEnc *rc, UInt32 symbol, UInt32 posState) -+{ -+ if (symbol < kLenNumLowSymbols) -+ { -+ RangeEnc_EncodeBit(rc, &p->choice, 0); -+ RcTree_Encode(rc, p->low + (posState << kLenNumLowBits), kLenNumLowBits, symbol); -+ } -+ else -+ { -+ RangeEnc_EncodeBit(rc, &p->choice, 1); -+ if (symbol < kLenNumLowSymbols + kLenNumMidSymbols) -+ { -+ RangeEnc_EncodeBit(rc, &p->choice2, 0); -+ RcTree_Encode(rc, p->mid + (posState << kLenNumMidBits), kLenNumMidBits, symbol - kLenNumLowSymbols); -+ } -+ else -+ { -+ RangeEnc_EncodeBit(rc, &p->choice2, 1); -+ RcTree_Encode(rc, p->high, kLenNumHighBits, symbol - kLenNumLowSymbols - kLenNumMidSymbols); -+ } -+ } -+} -+ -+static void LenEnc_SetPrices(CLenEnc *p, UInt32 posState, UInt32 numSymbols, UInt32 *prices, UInt32 *ProbPrices) -+{ -+ UInt32 a0 = GET_PRICE_0a(p->choice); -+ UInt32 a1 = GET_PRICE_1a(p->choice); -+ UInt32 b0 = a1 + GET_PRICE_0a(p->choice2); -+ UInt32 b1 = a1 + GET_PRICE_1a(p->choice2); -+ UInt32 i = 0; -+ for (i = 0; i < kLenNumLowSymbols; i++) -+ { -+ if (i >= numSymbols) -+ return; -+ prices[i] = a0 + RcTree_GetPrice(p->low + (posState << kLenNumLowBits), kLenNumLowBits, i, ProbPrices); -+ } -+ for (; i < kLenNumLowSymbols + kLenNumMidSymbols; i++) -+ { -+ if (i >= numSymbols) -+ return; -+ prices[i] = b0 + RcTree_GetPrice(p->mid + (posState << kLenNumMidBits), kLenNumMidBits, i - kLenNumLowSymbols, ProbPrices); -+ } -+ for (; i < numSymbols; i++) -+ prices[i] = b1 + RcTree_GetPrice(p->high, kLenNumHighBits, i - kLenNumLowSymbols - kLenNumMidSymbols, ProbPrices); -+} -+ -+static void MY_FAST_CALL LenPriceEnc_UpdateTable(CLenPriceEnc *p, UInt32 posState, UInt32 *ProbPrices) -+{ -+ LenEnc_SetPrices(&p->p, posState, p->tableSize, p->prices[posState], ProbPrices); -+ p->counters[posState] = p->tableSize; -+} -+ -+static void LenPriceEnc_UpdateTables(CLenPriceEnc *p, UInt32 numPosStates, UInt32 *ProbPrices) -+{ -+ UInt32 posState; -+ for (posState = 0; posState < numPosStates; posState++) -+ LenPriceEnc_UpdateTable(p, posState, ProbPrices); -+} -+ -+static void LenEnc_Encode2(CLenPriceEnc *p, CRangeEnc *rc, UInt32 symbol, UInt32 posState, Bool updatePrice, UInt32 *ProbPrices) -+{ -+ LenEnc_Encode(&p->p, rc, symbol, posState); -+ if (updatePrice) -+ if (--p->counters[posState] == 0) -+ LenPriceEnc_UpdateTable(p, posState, ProbPrices); -+} -+ -+ -+ -+ -+static void MovePos(CLzmaEnc *p, UInt32 num) -+{ -+ #ifdef SHOW_STAT -+ ttt += num; -+ printf("\n MovePos %d", num); -+ #endif -+ if (num != 0) -+ { -+ p->additionalOffset += num; -+ p->matchFinder.Skip(p->matchFinderObj, num); -+ } -+} -+ -+static UInt32 ReadMatchDistances(CLzmaEnc *p, UInt32 *numDistancePairsRes) -+{ -+ UInt32 lenRes = 0, numPairs; -+ p->numAvail = p->matchFinder.GetNumAvailableBytes(p->matchFinderObj); -+ numPairs = p->matchFinder.GetMatches(p->matchFinderObj, p->matches); -+ #ifdef SHOW_STAT -+ printf("\n i = %d numPairs = %d ", ttt, numPairs / 2); -+ ttt++; -+ { -+ UInt32 i; -+ for (i = 0; i < numPairs; i += 2) -+ printf("%2d %6d | ", p->matches[i], p->matches[i + 1]); -+ } -+ #endif -+ if (numPairs > 0) -+ { -+ lenRes = p->matches[numPairs - 2]; -+ if (lenRes == p->numFastBytes) -+ { -+ const Byte *pby = p->matchFinder.GetPointerToCurrentPos(p->matchFinderObj) - 1; -+ UInt32 distance = p->matches[numPairs - 1] + 1; -+ UInt32 numAvail = p->numAvail; -+ if (numAvail > LZMA_MATCH_LEN_MAX) -+ numAvail = LZMA_MATCH_LEN_MAX; -+ { -+ const Byte *pby2 = pby - distance; -+ for (; lenRes < numAvail && pby[lenRes] == pby2[lenRes]; lenRes++); -+ } -+ } -+ } -+ p->additionalOffset++; -+ *numDistancePairsRes = numPairs; -+ return lenRes; -+} -+ -+ -+#define MakeAsChar(p) (p)->backPrev = (UInt32)(-1); (p)->prev1IsChar = False; -+#define MakeAsShortRep(p) (p)->backPrev = 0; (p)->prev1IsChar = False; -+#define IsShortRep(p) ((p)->backPrev == 0) -+ -+static UInt32 GetRepLen1Price(CLzmaEnc *p, UInt32 state, UInt32 posState) -+{ -+ return -+ GET_PRICE_0(p->isRepG0[state]) + -+ GET_PRICE_0(p->isRep0Long[state][posState]); -+} -+ -+static UInt32 GetPureRepPrice(CLzmaEnc *p, UInt32 repIndex, UInt32 state, UInt32 posState) -+{ -+ UInt32 price; -+ if (repIndex == 0) -+ { -+ price = GET_PRICE_0(p->isRepG0[state]); -+ price += GET_PRICE_1(p->isRep0Long[state][posState]); -+ } -+ else -+ { -+ price = GET_PRICE_1(p->isRepG0[state]); -+ if (repIndex == 1) -+ price += GET_PRICE_0(p->isRepG1[state]); -+ else -+ { -+ price += GET_PRICE_1(p->isRepG1[state]); -+ price += GET_PRICE(p->isRepG2[state], repIndex - 2); -+ } -+ } -+ return price; -+} -+ -+static UInt32 GetRepPrice(CLzmaEnc *p, UInt32 repIndex, UInt32 len, UInt32 state, UInt32 posState) -+{ -+ return p->repLenEnc.prices[posState][len - LZMA_MATCH_LEN_MIN] + -+ GetPureRepPrice(p, repIndex, state, posState); -+} -+ -+static UInt32 Backward(CLzmaEnc *p, UInt32 *backRes, UInt32 cur) -+{ -+ UInt32 posMem = p->opt[cur].posPrev; -+ UInt32 backMem = p->opt[cur].backPrev; -+ p->optimumEndIndex = cur; -+ do -+ { -+ if (p->opt[cur].prev1IsChar) -+ { -+ MakeAsChar(&p->opt[posMem]) -+ p->opt[posMem].posPrev = posMem - 1; -+ if (p->opt[cur].prev2) -+ { -+ p->opt[posMem - 1].prev1IsChar = False; -+ p->opt[posMem - 1].posPrev = p->opt[cur].posPrev2; -+ p->opt[posMem - 1].backPrev = p->opt[cur].backPrev2; -+ } -+ } -+ { -+ UInt32 posPrev = posMem; -+ UInt32 backCur = backMem; -+ -+ backMem = p->opt[posPrev].backPrev; -+ posMem = p->opt[posPrev].posPrev; -+ -+ p->opt[posPrev].backPrev = backCur; -+ p->opt[posPrev].posPrev = cur; -+ cur = posPrev; -+ } -+ } -+ while (cur != 0); -+ *backRes = p->opt[0].backPrev; -+ p->optimumCurrentIndex = p->opt[0].posPrev; -+ return p->optimumCurrentIndex; -+} -+ -+#define LIT_PROBS(pos, prevByte) (p->litProbs + ((((pos) & p->lpMask) << p->lc) + ((prevByte) >> (8 - p->lc))) * 0x300) -+ -+static UInt32 GetOptimum(CLzmaEnc *p, UInt32 position, UInt32 *backRes) -+{ -+ UInt32 numAvail, mainLen, numPairs, repMaxIndex, i, posState, lenEnd, len, cur; -+ UInt32 matchPrice, repMatchPrice, normalMatchPrice; -+ UInt32 reps[LZMA_NUM_REPS], repLens[LZMA_NUM_REPS]; -+ UInt32 *matches; -+ const Byte *data; -+ Byte curByte, matchByte; -+ if (p->optimumEndIndex != p->optimumCurrentIndex) -+ { -+ const COptimal *opt = &p->opt[p->optimumCurrentIndex]; -+ UInt32 lenRes = opt->posPrev - p->optimumCurrentIndex; -+ *backRes = opt->backPrev; -+ p->optimumCurrentIndex = opt->posPrev; -+ return lenRes; -+ } -+ p->optimumCurrentIndex = p->optimumEndIndex = 0; -+ -+ if (p->additionalOffset == 0) -+ mainLen = ReadMatchDistances(p, &numPairs); -+ else -+ { -+ mainLen = p->longestMatchLength; -+ numPairs = p->numPairs; -+ } -+ -+ numAvail = p->numAvail; -+ if (numAvail < 2) -+ { -+ *backRes = (UInt32)(-1); -+ return 1; -+ } -+ if (numAvail > LZMA_MATCH_LEN_MAX) -+ numAvail = LZMA_MATCH_LEN_MAX; -+ -+ data = p->matchFinder.GetPointerToCurrentPos(p->matchFinderObj) - 1; -+ repMaxIndex = 0; -+ for (i = 0; i < LZMA_NUM_REPS; i++) -+ { -+ UInt32 lenTest; -+ const Byte *data2; -+ reps[i] = p->reps[i]; -+ data2 = data - (reps[i] + 1); -+ if (data[0] != data2[0] || data[1] != data2[1]) -+ { -+ repLens[i] = 0; -+ continue; -+ } -+ for (lenTest = 2; lenTest < numAvail && data[lenTest] == data2[lenTest]; lenTest++); -+ repLens[i] = lenTest; -+ if (lenTest > repLens[repMaxIndex]) -+ repMaxIndex = i; -+ } -+ if (repLens[repMaxIndex] >= p->numFastBytes) -+ { -+ UInt32 lenRes; -+ *backRes = repMaxIndex; -+ lenRes = repLens[repMaxIndex]; -+ MovePos(p, lenRes - 1); -+ return lenRes; -+ } -+ -+ matches = p->matches; -+ if (mainLen >= p->numFastBytes) -+ { -+ *backRes = matches[numPairs - 1] + LZMA_NUM_REPS; -+ MovePos(p, mainLen - 1); -+ return mainLen; -+ } -+ curByte = *data; -+ matchByte = *(data - (reps[0] + 1)); -+ -+ if (mainLen < 2 && curByte != matchByte && repLens[repMaxIndex] < 2) -+ { -+ *backRes = (UInt32)-1; -+ return 1; -+ } -+ -+ p->opt[0].state = (CState)p->state; -+ -+ posState = (position & p->pbMask); -+ -+ { -+ const CLzmaProb *probs = LIT_PROBS(position, *(data - 1)); -+ p->opt[1].price = GET_PRICE_0(p->isMatch[p->state][posState]) + -+ (!IsCharState(p->state) ? -+ LitEnc_GetPriceMatched(probs, curByte, matchByte, p->ProbPrices) : -+ LitEnc_GetPrice(probs, curByte, p->ProbPrices)); -+ } -+ -+ MakeAsChar(&p->opt[1]); -+ -+ matchPrice = GET_PRICE_1(p->isMatch[p->state][posState]); -+ repMatchPrice = matchPrice + GET_PRICE_1(p->isRep[p->state]); -+ -+ if (matchByte == curByte) -+ { -+ UInt32 shortRepPrice = repMatchPrice + GetRepLen1Price(p, p->state, posState); -+ if (shortRepPrice < p->opt[1].price) -+ { -+ p->opt[1].price = shortRepPrice; -+ MakeAsShortRep(&p->opt[1]); -+ } -+ } -+ lenEnd = ((mainLen >= repLens[repMaxIndex]) ? mainLen : repLens[repMaxIndex]); -+ -+ if (lenEnd < 2) -+ { -+ *backRes = p->opt[1].backPrev; -+ return 1; -+ } -+ -+ p->opt[1].posPrev = 0; -+ for (i = 0; i < LZMA_NUM_REPS; i++) -+ p->opt[0].backs[i] = reps[i]; -+ -+ len = lenEnd; -+ do -+ p->opt[len--].price = kInfinityPrice; -+ while (len >= 2); -+ -+ for (i = 0; i < LZMA_NUM_REPS; i++) -+ { -+ UInt32 repLen = repLens[i]; -+ UInt32 price; -+ if (repLen < 2) -+ continue; -+ price = repMatchPrice + GetPureRepPrice(p, i, p->state, posState); -+ do -+ { -+ UInt32 curAndLenPrice = price + p->repLenEnc.prices[posState][repLen - 2]; -+ COptimal *opt = &p->opt[repLen]; -+ if (curAndLenPrice < opt->price) -+ { -+ opt->price = curAndLenPrice; -+ opt->posPrev = 0; -+ opt->backPrev = i; -+ opt->prev1IsChar = False; -+ } -+ } -+ while (--repLen >= 2); -+ } -+ -+ normalMatchPrice = matchPrice + GET_PRICE_0(p->isRep[p->state]); -+ -+ len = ((repLens[0] >= 2) ? repLens[0] + 1 : 2); -+ if (len <= mainLen) -+ { -+ UInt32 offs = 0; -+ while (len > matches[offs]) -+ offs += 2; -+ for (; ; len++) -+ { -+ COptimal *opt; -+ UInt32 distance = matches[offs + 1]; -+ -+ UInt32 curAndLenPrice = normalMatchPrice + p->lenEnc.prices[posState][len - LZMA_MATCH_LEN_MIN]; -+ UInt32 lenToPosState = GetLenToPosState(len); -+ if (distance < kNumFullDistances) -+ curAndLenPrice += p->distancesPrices[lenToPosState][distance]; -+ else -+ { -+ UInt32 slot; -+ GetPosSlot2(distance, slot); -+ curAndLenPrice += p->alignPrices[distance & kAlignMask] + p->posSlotPrices[lenToPosState][slot]; -+ } -+ opt = &p->opt[len]; -+ if (curAndLenPrice < opt->price) -+ { -+ opt->price = curAndLenPrice; -+ opt->posPrev = 0; -+ opt->backPrev = distance + LZMA_NUM_REPS; -+ opt->prev1IsChar = False; -+ } -+ if (len == matches[offs]) -+ { -+ offs += 2; -+ if (offs == numPairs) -+ break; -+ } -+ } -+ } -+ -+ cur = 0; -+ -+ #ifdef SHOW_STAT2 -+ if (position >= 0) -+ { -+ unsigned i; -+ printf("\n pos = %4X", position); -+ for (i = cur; i <= lenEnd; i++) -+ printf("\nprice[%4X] = %d", position - cur + i, p->opt[i].price); -+ } -+ #endif -+ -+ for (;;) -+ { -+ UInt32 numAvailFull, newLen, numPairs, posPrev, state, posState, startLen; -+ UInt32 curPrice, curAnd1Price, matchPrice, repMatchPrice; -+ Bool nextIsChar; -+ Byte curByte, matchByte; -+ const Byte *data; -+ COptimal *curOpt; -+ COptimal *nextOpt; -+ -+ cur++; -+ if (cur == lenEnd) -+ return Backward(p, backRes, cur); -+ -+ newLen = ReadMatchDistances(p, &numPairs); -+ if (newLen >= p->numFastBytes) -+ { -+ p->numPairs = numPairs; -+ p->longestMatchLength = newLen; -+ return Backward(p, backRes, cur); -+ } -+ position++; -+ curOpt = &p->opt[cur]; -+ posPrev = curOpt->posPrev; -+ if (curOpt->prev1IsChar) -+ { -+ posPrev--; -+ if (curOpt->prev2) -+ { -+ state = p->opt[curOpt->posPrev2].state; -+ if (curOpt->backPrev2 < LZMA_NUM_REPS) -+ state = kRepNextStates[state]; -+ else -+ state = kMatchNextStates[state]; -+ } -+ else -+ state = p->opt[posPrev].state; -+ state = kLiteralNextStates[state]; -+ } -+ else -+ state = p->opt[posPrev].state; -+ if (posPrev == cur - 1) -+ { -+ if (IsShortRep(curOpt)) -+ state = kShortRepNextStates[state]; -+ else -+ state = kLiteralNextStates[state]; -+ } -+ else -+ { -+ UInt32 pos; -+ const COptimal *prevOpt; -+ if (curOpt->prev1IsChar && curOpt->prev2) -+ { -+ posPrev = curOpt->posPrev2; -+ pos = curOpt->backPrev2; -+ state = kRepNextStates[state]; -+ } -+ else -+ { -+ pos = curOpt->backPrev; -+ if (pos < LZMA_NUM_REPS) -+ state = kRepNextStates[state]; -+ else -+ state = kMatchNextStates[state]; -+ } -+ prevOpt = &p->opt[posPrev]; -+ if (pos < LZMA_NUM_REPS) -+ { -+ UInt32 i; -+ reps[0] = prevOpt->backs[pos]; -+ for (i = 1; i <= pos; i++) -+ reps[i] = prevOpt->backs[i - 1]; -+ for (; i < LZMA_NUM_REPS; i++) -+ reps[i] = prevOpt->backs[i]; -+ } -+ else -+ { -+ UInt32 i; -+ reps[0] = (pos - LZMA_NUM_REPS); -+ for (i = 1; i < LZMA_NUM_REPS; i++) -+ reps[i] = prevOpt->backs[i - 1]; -+ } -+ } -+ curOpt->state = (CState)state; -+ -+ curOpt->backs[0] = reps[0]; -+ curOpt->backs[1] = reps[1]; -+ curOpt->backs[2] = reps[2]; -+ curOpt->backs[3] = reps[3]; -+ -+ curPrice = curOpt->price; -+ nextIsChar = False; -+ data = p->matchFinder.GetPointerToCurrentPos(p->matchFinderObj) - 1; -+ curByte = *data; -+ matchByte = *(data - (reps[0] + 1)); -+ -+ posState = (position & p->pbMask); -+ -+ curAnd1Price = curPrice + GET_PRICE_0(p->isMatch[state][posState]); -+ { -+ const CLzmaProb *probs = LIT_PROBS(position, *(data - 1)); -+ curAnd1Price += -+ (!IsCharState(state) ? -+ LitEnc_GetPriceMatched(probs, curByte, matchByte, p->ProbPrices) : -+ LitEnc_GetPrice(probs, curByte, p->ProbPrices)); -+ } -+ -+ nextOpt = &p->opt[cur + 1]; -+ -+ if (curAnd1Price < nextOpt->price) -+ { -+ nextOpt->price = curAnd1Price; -+ nextOpt->posPrev = cur; -+ MakeAsChar(nextOpt); -+ nextIsChar = True; -+ } -+ -+ matchPrice = curPrice + GET_PRICE_1(p->isMatch[state][posState]); -+ repMatchPrice = matchPrice + GET_PRICE_1(p->isRep[state]); -+ -+ if (matchByte == curByte && !(nextOpt->posPrev < cur && nextOpt->backPrev == 0)) -+ { -+ UInt32 shortRepPrice = repMatchPrice + GetRepLen1Price(p, state, posState); -+ if (shortRepPrice <= nextOpt->price) -+ { -+ nextOpt->price = shortRepPrice; -+ nextOpt->posPrev = cur; -+ MakeAsShortRep(nextOpt); -+ nextIsChar = True; -+ } -+ } -+ numAvailFull = p->numAvail; -+ { -+ UInt32 temp = kNumOpts - 1 - cur; -+ if (temp < numAvailFull) -+ numAvailFull = temp; -+ } -+ -+ if (numAvailFull < 2) -+ continue; -+ numAvail = (numAvailFull <= p->numFastBytes ? numAvailFull : p->numFastBytes); -+ -+ if (!nextIsChar && matchByte != curByte) /* speed optimization */ -+ { -+ /* try Literal + rep0 */ -+ UInt32 temp; -+ UInt32 lenTest2; -+ const Byte *data2 = data - (reps[0] + 1); -+ UInt32 limit = p->numFastBytes + 1; -+ if (limit > numAvailFull) -+ limit = numAvailFull; -+ -+ for (temp = 1; temp < limit && data[temp] == data2[temp]; temp++); -+ lenTest2 = temp - 1; -+ if (lenTest2 >= 2) -+ { -+ UInt32 state2 = kLiteralNextStates[state]; -+ UInt32 posStateNext = (position + 1) & p->pbMask; -+ UInt32 nextRepMatchPrice = curAnd1Price + -+ GET_PRICE_1(p->isMatch[state2][posStateNext]) + -+ GET_PRICE_1(p->isRep[state2]); -+ /* for (; lenTest2 >= 2; lenTest2--) */ -+ { -+ UInt32 curAndLenPrice; -+ COptimal *opt; -+ UInt32 offset = cur + 1 + lenTest2; -+ while (lenEnd < offset) -+ p->opt[++lenEnd].price = kInfinityPrice; -+ curAndLenPrice = nextRepMatchPrice + GetRepPrice(p, 0, lenTest2, state2, posStateNext); -+ opt = &p->opt[offset]; -+ if (curAndLenPrice < opt->price) -+ { -+ opt->price = curAndLenPrice; -+ opt->posPrev = cur + 1; -+ opt->backPrev = 0; -+ opt->prev1IsChar = True; -+ opt->prev2 = False; -+ } -+ } -+ } -+ } -+ -+ startLen = 2; /* speed optimization */ -+ { -+ UInt32 repIndex; -+ for (repIndex = 0; repIndex < LZMA_NUM_REPS; repIndex++) -+ { -+ UInt32 lenTest; -+ UInt32 lenTestTemp; -+ UInt32 price; -+ const Byte *data2 = data - (reps[repIndex] + 1); -+ if (data[0] != data2[0] || data[1] != data2[1]) -+ continue; -+ for (lenTest = 2; lenTest < numAvail && data[lenTest] == data2[lenTest]; lenTest++); -+ while (lenEnd < cur + lenTest) -+ p->opt[++lenEnd].price = kInfinityPrice; -+ lenTestTemp = lenTest; -+ price = repMatchPrice + GetPureRepPrice(p, repIndex, state, posState); -+ do -+ { -+ UInt32 curAndLenPrice = price + p->repLenEnc.prices[posState][lenTest - 2]; -+ COptimal *opt = &p->opt[cur + lenTest]; -+ if (curAndLenPrice < opt->price) -+ { -+ opt->price = curAndLenPrice; -+ opt->posPrev = cur; -+ opt->backPrev = repIndex; -+ opt->prev1IsChar = False; -+ } -+ } -+ while (--lenTest >= 2); -+ lenTest = lenTestTemp; -+ -+ if (repIndex == 0) -+ startLen = lenTest + 1; -+ -+ /* if (_maxMode) */ -+ { -+ UInt32 lenTest2 = lenTest + 1; -+ UInt32 limit = lenTest2 + p->numFastBytes; -+ UInt32 nextRepMatchPrice; -+ if (limit > numAvailFull) -+ limit = numAvailFull; -+ for (; lenTest2 < limit && data[lenTest2] == data2[lenTest2]; lenTest2++); -+ lenTest2 -= lenTest + 1; -+ if (lenTest2 >= 2) -+ { -+ UInt32 state2 = kRepNextStates[state]; -+ UInt32 posStateNext = (position + lenTest) & p->pbMask; -+ UInt32 curAndLenCharPrice = -+ price + p->repLenEnc.prices[posState][lenTest - 2] + -+ GET_PRICE_0(p->isMatch[state2][posStateNext]) + -+ LitEnc_GetPriceMatched(LIT_PROBS(position + lenTest, data[lenTest - 1]), -+ data[lenTest], data2[lenTest], p->ProbPrices); -+ state2 = kLiteralNextStates[state2]; -+ posStateNext = (position + lenTest + 1) & p->pbMask; -+ nextRepMatchPrice = curAndLenCharPrice + -+ GET_PRICE_1(p->isMatch[state2][posStateNext]) + -+ GET_PRICE_1(p->isRep[state2]); -+ -+ /* for (; lenTest2 >= 2; lenTest2--) */ -+ { -+ UInt32 curAndLenPrice; -+ COptimal *opt; -+ UInt32 offset = cur + lenTest + 1 + lenTest2; -+ while (lenEnd < offset) -+ p->opt[++lenEnd].price = kInfinityPrice; -+ curAndLenPrice = nextRepMatchPrice + GetRepPrice(p, 0, lenTest2, state2, posStateNext); -+ opt = &p->opt[offset]; -+ if (curAndLenPrice < opt->price) -+ { -+ opt->price = curAndLenPrice; -+ opt->posPrev = cur + lenTest + 1; -+ opt->backPrev = 0; -+ opt->prev1IsChar = True; -+ opt->prev2 = True; -+ opt->posPrev2 = cur; -+ opt->backPrev2 = repIndex; -+ } -+ } -+ } -+ } -+ } -+ } -+ /* for (UInt32 lenTest = 2; lenTest <= newLen; lenTest++) */ -+ if (newLen > numAvail) -+ { -+ newLen = numAvail; -+ for (numPairs = 0; newLen > matches[numPairs]; numPairs += 2); -+ matches[numPairs] = newLen; -+ numPairs += 2; -+ } -+ if (newLen >= startLen) -+ { -+ UInt32 normalMatchPrice = matchPrice + GET_PRICE_0(p->isRep[state]); -+ UInt32 offs, curBack, posSlot; -+ UInt32 lenTest; -+ while (lenEnd < cur + newLen) -+ p->opt[++lenEnd].price = kInfinityPrice; -+ -+ offs = 0; -+ while (startLen > matches[offs]) -+ offs += 2; -+ curBack = matches[offs + 1]; -+ GetPosSlot2(curBack, posSlot); -+ for (lenTest = /*2*/ startLen; ; lenTest++) -+ { -+ UInt32 curAndLenPrice = normalMatchPrice + p->lenEnc.prices[posState][lenTest - LZMA_MATCH_LEN_MIN]; -+ UInt32 lenToPosState = GetLenToPosState(lenTest); -+ COptimal *opt; -+ if (curBack < kNumFullDistances) -+ curAndLenPrice += p->distancesPrices[lenToPosState][curBack]; -+ else -+ curAndLenPrice += p->posSlotPrices[lenToPosState][posSlot] + p->alignPrices[curBack & kAlignMask]; -+ -+ opt = &p->opt[cur + lenTest]; -+ if (curAndLenPrice < opt->price) -+ { -+ opt->price = curAndLenPrice; -+ opt->posPrev = cur; -+ opt->backPrev = curBack + LZMA_NUM_REPS; -+ opt->prev1IsChar = False; -+ } -+ -+ if (/*_maxMode && */lenTest == matches[offs]) -+ { -+ /* Try Match + Literal + Rep0 */ -+ const Byte *data2 = data - (curBack + 1); -+ UInt32 lenTest2 = lenTest + 1; -+ UInt32 limit = lenTest2 + p->numFastBytes; -+ UInt32 nextRepMatchPrice; -+ if (limit > numAvailFull) -+ limit = numAvailFull; -+ for (; lenTest2 < limit && data[lenTest2] == data2[lenTest2]; lenTest2++); -+ lenTest2 -= lenTest + 1; -+ if (lenTest2 >= 2) -+ { -+ UInt32 state2 = kMatchNextStates[state]; -+ UInt32 posStateNext = (position + lenTest) & p->pbMask; -+ UInt32 curAndLenCharPrice = curAndLenPrice + -+ GET_PRICE_0(p->isMatch[state2][posStateNext]) + -+ LitEnc_GetPriceMatched(LIT_PROBS(position + lenTest, data[lenTest - 1]), -+ data[lenTest], data2[lenTest], p->ProbPrices); -+ state2 = kLiteralNextStates[state2]; -+ posStateNext = (posStateNext + 1) & p->pbMask; -+ nextRepMatchPrice = curAndLenCharPrice + -+ GET_PRICE_1(p->isMatch[state2][posStateNext]) + -+ GET_PRICE_1(p->isRep[state2]); -+ -+ /* for (; lenTest2 >= 2; lenTest2--) */ -+ { -+ UInt32 offset = cur + lenTest + 1 + lenTest2; -+ UInt32 curAndLenPrice; -+ COptimal *opt; -+ while (lenEnd < offset) -+ p->opt[++lenEnd].price = kInfinityPrice; -+ curAndLenPrice = nextRepMatchPrice + GetRepPrice(p, 0, lenTest2, state2, posStateNext); -+ opt = &p->opt[offset]; -+ if (curAndLenPrice < opt->price) -+ { -+ opt->price = curAndLenPrice; -+ opt->posPrev = cur + lenTest + 1; -+ opt->backPrev = 0; -+ opt->prev1IsChar = True; -+ opt->prev2 = True; -+ opt->posPrev2 = cur; -+ opt->backPrev2 = curBack + LZMA_NUM_REPS; -+ } -+ } -+ } -+ offs += 2; -+ if (offs == numPairs) -+ break; -+ curBack = matches[offs + 1]; -+ if (curBack >= kNumFullDistances) -+ GetPosSlot2(curBack, posSlot); -+ } -+ } -+ } -+ } -+} -+ -+#define ChangePair(smallDist, bigDist) (((bigDist) >> 7) > (smallDist)) -+ -+static UInt32 GetOptimumFast(CLzmaEnc *p, UInt32 *backRes) -+{ -+ UInt32 numAvail, mainLen, mainDist, numPairs, repIndex, repLen, i; -+ const Byte *data; -+ const UInt32 *matches; -+ -+ if (p->additionalOffset == 0) -+ mainLen = ReadMatchDistances(p, &numPairs); -+ else -+ { -+ mainLen = p->longestMatchLength; -+ numPairs = p->numPairs; -+ } -+ -+ numAvail = p->numAvail; -+ *backRes = (UInt32)-1; -+ if (numAvail < 2) -+ return 1; -+ if (numAvail > LZMA_MATCH_LEN_MAX) -+ numAvail = LZMA_MATCH_LEN_MAX; -+ data = p->matchFinder.GetPointerToCurrentPos(p->matchFinderObj) - 1; -+ -+ repLen = repIndex = 0; -+ for (i = 0; i < LZMA_NUM_REPS; i++) -+ { -+ UInt32 len; -+ const Byte *data2 = data - (p->reps[i] + 1); -+ if (data[0] != data2[0] || data[1] != data2[1]) -+ continue; -+ for (len = 2; len < numAvail && data[len] == data2[len]; len++); -+ if (len >= p->numFastBytes) -+ { -+ *backRes = i; -+ MovePos(p, len - 1); -+ return len; -+ } -+ if (len > repLen) -+ { -+ repIndex = i; -+ repLen = len; -+ } -+ } -+ -+ matches = p->matches; -+ if (mainLen >= p->numFastBytes) -+ { -+ *backRes = matches[numPairs - 1] + LZMA_NUM_REPS; -+ MovePos(p, mainLen - 1); -+ return mainLen; -+ } -+ -+ mainDist = 0; /* for GCC */ -+ if (mainLen >= 2) -+ { -+ mainDist = matches[numPairs - 1]; -+ while (numPairs > 2 && mainLen == matches[numPairs - 4] + 1) -+ { -+ if (!ChangePair(matches[numPairs - 3], mainDist)) -+ break; -+ numPairs -= 2; -+ mainLen = matches[numPairs - 2]; -+ mainDist = matches[numPairs - 1]; -+ } -+ if (mainLen == 2 && mainDist >= 0x80) -+ mainLen = 1; -+ } -+ -+ if (repLen >= 2 && ( -+ (repLen + 1 >= mainLen) || -+ (repLen + 2 >= mainLen && mainDist >= (1 << 9)) || -+ (repLen + 3 >= mainLen && mainDist >= (1 << 15)))) -+ { -+ *backRes = repIndex; -+ MovePos(p, repLen - 1); -+ return repLen; -+ } -+ -+ if (mainLen < 2 || numAvail <= 2) -+ return 1; -+ -+ p->longestMatchLength = ReadMatchDistances(p, &p->numPairs); -+ if (p->longestMatchLength >= 2) -+ { -+ UInt32 newDistance = matches[p->numPairs - 1]; -+ if ((p->longestMatchLength >= mainLen && newDistance < mainDist) || -+ (p->longestMatchLength == mainLen + 1 && !ChangePair(mainDist, newDistance)) || -+ (p->longestMatchLength > mainLen + 1) || -+ (p->longestMatchLength + 1 >= mainLen && mainLen >= 3 && ChangePair(newDistance, mainDist))) -+ return 1; -+ } -+ -+ data = p->matchFinder.GetPointerToCurrentPos(p->matchFinderObj) - 1; -+ for (i = 0; i < LZMA_NUM_REPS; i++) -+ { -+ UInt32 len, limit; -+ const Byte *data2 = data - (p->reps[i] + 1); -+ if (data[0] != data2[0] || data[1] != data2[1]) -+ continue; -+ limit = mainLen - 1; -+ for (len = 2; len < limit && data[len] == data2[len]; len++); -+ if (len >= limit) -+ return 1; -+ } -+ *backRes = mainDist + LZMA_NUM_REPS; -+ MovePos(p, mainLen - 2); -+ return mainLen; -+} -+ -+static void WriteEndMarker(CLzmaEnc *p, UInt32 posState) -+{ -+ UInt32 len; -+ RangeEnc_EncodeBit(&p->rc, &p->isMatch[p->state][posState], 1); -+ RangeEnc_EncodeBit(&p->rc, &p->isRep[p->state], 0); -+ p->state = kMatchNextStates[p->state]; -+ len = LZMA_MATCH_LEN_MIN; -+ LenEnc_Encode2(&p->lenEnc, &p->rc, len - LZMA_MATCH_LEN_MIN, posState, !p->fastMode, p->ProbPrices); -+ RcTree_Encode(&p->rc, p->posSlotEncoder[GetLenToPosState(len)], kNumPosSlotBits, (1 << kNumPosSlotBits) - 1); -+ RangeEnc_EncodeDirectBits(&p->rc, (((UInt32)1 << 30) - 1) >> kNumAlignBits, 30 - kNumAlignBits); -+ RcTree_ReverseEncode(&p->rc, p->posAlignEncoder, kNumAlignBits, kAlignMask); -+} -+ -+static SRes CheckErrors(CLzmaEnc *p) -+{ -+ if (p->result != SZ_OK) -+ return p->result; -+ if (p->rc.res != SZ_OK) -+ p->result = SZ_ERROR_WRITE; -+ if (p->matchFinderBase.result != SZ_OK) -+ p->result = SZ_ERROR_READ; -+ if (p->result != SZ_OK) -+ p->finished = True; -+ return p->result; -+} -+ -+static SRes Flush(CLzmaEnc *p, UInt32 nowPos) -+{ -+ /* ReleaseMFStream(); */ -+ p->finished = True; -+ if (p->writeEndMark) -+ WriteEndMarker(p, nowPos & p->pbMask); -+ RangeEnc_FlushData(&p->rc); -+ RangeEnc_FlushStream(&p->rc); -+ return CheckErrors(p); -+} -+ -+static void FillAlignPrices(CLzmaEnc *p) -+{ -+ UInt32 i; -+ for (i = 0; i < kAlignTableSize; i++) -+ p->alignPrices[i] = RcTree_ReverseGetPrice(p->posAlignEncoder, kNumAlignBits, i, p->ProbPrices); -+ p->alignPriceCount = 0; -+} -+ -+static void FillDistancesPrices(CLzmaEnc *p) -+{ -+ UInt32 tempPrices[kNumFullDistances]; -+ UInt32 i, lenToPosState; -+ for (i = kStartPosModelIndex; i < kNumFullDistances; i++) -+ { -+ UInt32 posSlot = GetPosSlot1(i); -+ UInt32 footerBits = ((posSlot >> 1) - 1); -+ UInt32 base = ((2 | (posSlot & 1)) << footerBits); -+ tempPrices[i] = RcTree_ReverseGetPrice(p->posEncoders + base - posSlot - 1, footerBits, i - base, p->ProbPrices); -+ } -+ -+ for (lenToPosState = 0; lenToPosState < kNumLenToPosStates; lenToPosState++) -+ { -+ UInt32 posSlot; -+ const CLzmaProb *encoder = p->posSlotEncoder[lenToPosState]; -+ UInt32 *posSlotPrices = p->posSlotPrices[lenToPosState]; -+ for (posSlot = 0; posSlot < p->distTableSize; posSlot++) -+ posSlotPrices[posSlot] = RcTree_GetPrice(encoder, kNumPosSlotBits, posSlot, p->ProbPrices); -+ for (posSlot = kEndPosModelIndex; posSlot < p->distTableSize; posSlot++) -+ posSlotPrices[posSlot] += ((((posSlot >> 1) - 1) - kNumAlignBits) << kNumBitPriceShiftBits); -+ -+ { -+ UInt32 *distancesPrices = p->distancesPrices[lenToPosState]; -+ UInt32 i; -+ for (i = 0; i < kStartPosModelIndex; i++) -+ distancesPrices[i] = posSlotPrices[i]; -+ for (; i < kNumFullDistances; i++) -+ distancesPrices[i] = posSlotPrices[GetPosSlot1(i)] + tempPrices[i]; -+ } -+ } -+ p->matchPriceCount = 0; -+} -+ -+void LzmaEnc_Construct(CLzmaEnc *p) -+{ -+ RangeEnc_Construct(&p->rc); -+ MatchFinder_Construct(&p->matchFinderBase); -+ #ifndef _7ZIP_ST -+ MatchFinderMt_Construct(&p->matchFinderMt); -+ p->matchFinderMt.MatchFinder = &p->matchFinderBase; -+ #endif -+ -+ { -+ CLzmaEncProps props; -+ LzmaEncProps_Init(&props); -+ LzmaEnc_SetProps(p, &props); -+ } -+ -+ #ifndef LZMA_LOG_BSR -+ LzmaEnc_FastPosInit(p->g_FastPos); -+ #endif -+ -+ LzmaEnc_InitPriceTables(p->ProbPrices); -+ p->litProbs = 0; -+ p->saveState.litProbs = 0; -+} -+ -+CLzmaEncHandle LzmaEnc_Create(ISzAlloc *alloc) -+{ -+ void *p; -+ p = alloc->Alloc(alloc, sizeof(CLzmaEnc)); -+ if (p != 0) -+ LzmaEnc_Construct((CLzmaEnc *)p); -+ return p; -+} -+ -+void LzmaEnc_FreeLits(CLzmaEnc *p, ISzAlloc *alloc) -+{ -+ alloc->Free(alloc, p->litProbs); -+ alloc->Free(alloc, p->saveState.litProbs); -+ p->litProbs = 0; -+ p->saveState.litProbs = 0; -+} -+ -+void LzmaEnc_Destruct(CLzmaEnc *p, ISzAlloc *alloc, ISzAlloc *allocBig) -+{ -+ #ifndef _7ZIP_ST -+ MatchFinderMt_Destruct(&p->matchFinderMt, allocBig); -+ #endif -+ MatchFinder_Free(&p->matchFinderBase, allocBig); -+ LzmaEnc_FreeLits(p, alloc); -+ RangeEnc_Free(&p->rc, alloc); -+} -+ -+void LzmaEnc_Destroy(CLzmaEncHandle p, ISzAlloc *alloc, ISzAlloc *allocBig) -+{ -+ LzmaEnc_Destruct((CLzmaEnc *)p, alloc, allocBig); -+ alloc->Free(alloc, p); -+} -+ -+static SRes LzmaEnc_CodeOneBlock(CLzmaEnc *p, Bool useLimits, UInt32 maxPackSize, UInt32 maxUnpackSize) -+{ -+ UInt32 nowPos32, startPos32; -+ if (p->needInit) -+ { -+ p->matchFinder.Init(p->matchFinderObj); -+ p->needInit = 0; -+ } -+ -+ if (p->finished) -+ return p->result; -+ RINOK(CheckErrors(p)); -+ -+ nowPos32 = (UInt32)p->nowPos64; -+ startPos32 = nowPos32; -+ -+ if (p->nowPos64 == 0) -+ { -+ UInt32 numPairs; -+ Byte curByte; -+ if (p->matchFinder.GetNumAvailableBytes(p->matchFinderObj) == 0) -+ return Flush(p, nowPos32); -+ ReadMatchDistances(p, &numPairs); -+ RangeEnc_EncodeBit(&p->rc, &p->isMatch[p->state][0], 0); -+ p->state = kLiteralNextStates[p->state]; -+ curByte = p->matchFinder.GetIndexByte(p->matchFinderObj, 0 - p->additionalOffset); -+ LitEnc_Encode(&p->rc, p->litProbs, curByte); -+ p->additionalOffset--; -+ nowPos32++; -+ } -+ -+ if (p->matchFinder.GetNumAvailableBytes(p->matchFinderObj) != 0) -+ for (;;) -+ { -+ UInt32 pos, len, posState; -+ -+ if (p->fastMode) -+ len = GetOptimumFast(p, &pos); -+ else -+ len = GetOptimum(p, nowPos32, &pos); -+ -+ #ifdef SHOW_STAT2 -+ printf("\n pos = %4X, len = %d pos = %d", nowPos32, len, pos); -+ #endif -+ -+ posState = nowPos32 & p->pbMask; -+ if (len == 1 && pos == (UInt32)-1) -+ { -+ Byte curByte; -+ CLzmaProb *probs; -+ const Byte *data; -+ -+ RangeEnc_EncodeBit(&p->rc, &p->isMatch[p->state][posState], 0); -+ data = p->matchFinder.GetPointerToCurrentPos(p->matchFinderObj) - p->additionalOffset; -+ curByte = *data; -+ probs = LIT_PROBS(nowPos32, *(data - 1)); -+ if (IsCharState(p->state)) -+ LitEnc_Encode(&p->rc, probs, curByte); -+ else -+ LitEnc_EncodeMatched(&p->rc, probs, curByte, *(data - p->reps[0] - 1)); -+ p->state = kLiteralNextStates[p->state]; -+ } -+ else -+ { -+ RangeEnc_EncodeBit(&p->rc, &p->isMatch[p->state][posState], 1); -+ if (pos < LZMA_NUM_REPS) -+ { -+ RangeEnc_EncodeBit(&p->rc, &p->isRep[p->state], 1); -+ if (pos == 0) -+ { -+ RangeEnc_EncodeBit(&p->rc, &p->isRepG0[p->state], 0); -+ RangeEnc_EncodeBit(&p->rc, &p->isRep0Long[p->state][posState], ((len == 1) ? 0 : 1)); -+ } -+ else -+ { -+ UInt32 distance = p->reps[pos]; -+ RangeEnc_EncodeBit(&p->rc, &p->isRepG0[p->state], 1); -+ if (pos == 1) -+ RangeEnc_EncodeBit(&p->rc, &p->isRepG1[p->state], 0); -+ else -+ { -+ RangeEnc_EncodeBit(&p->rc, &p->isRepG1[p->state], 1); -+ RangeEnc_EncodeBit(&p->rc, &p->isRepG2[p->state], pos - 2); -+ if (pos == 3) -+ p->reps[3] = p->reps[2]; -+ p->reps[2] = p->reps[1]; -+ } -+ p->reps[1] = p->reps[0]; -+ p->reps[0] = distance; -+ } -+ if (len == 1) -+ p->state = kShortRepNextStates[p->state]; -+ else -+ { -+ LenEnc_Encode2(&p->repLenEnc, &p->rc, len - LZMA_MATCH_LEN_MIN, posState, !p->fastMode, p->ProbPrices); -+ p->state = kRepNextStates[p->state]; -+ } -+ } -+ else -+ { -+ UInt32 posSlot; -+ RangeEnc_EncodeBit(&p->rc, &p->isRep[p->state], 0); -+ p->state = kMatchNextStates[p->state]; -+ LenEnc_Encode2(&p->lenEnc, &p->rc, len - LZMA_MATCH_LEN_MIN, posState, !p->fastMode, p->ProbPrices); -+ pos -= LZMA_NUM_REPS; -+ GetPosSlot(pos, posSlot); -+ RcTree_Encode(&p->rc, p->posSlotEncoder[GetLenToPosState(len)], kNumPosSlotBits, posSlot); -+ -+ if (posSlot >= kStartPosModelIndex) -+ { -+ UInt32 footerBits = ((posSlot >> 1) - 1); -+ UInt32 base = ((2 | (posSlot & 1)) << footerBits); -+ UInt32 posReduced = pos - base; -+ -+ if (posSlot < kEndPosModelIndex) -+ RcTree_ReverseEncode(&p->rc, p->posEncoders + base - posSlot - 1, footerBits, posReduced); -+ else -+ { -+ RangeEnc_EncodeDirectBits(&p->rc, posReduced >> kNumAlignBits, footerBits - kNumAlignBits); -+ RcTree_ReverseEncode(&p->rc, p->posAlignEncoder, kNumAlignBits, posReduced & kAlignMask); -+ p->alignPriceCount++; -+ } -+ } -+ p->reps[3] = p->reps[2]; -+ p->reps[2] = p->reps[1]; -+ p->reps[1] = p->reps[0]; -+ p->reps[0] = pos; -+ p->matchPriceCount++; -+ } -+ } -+ p->additionalOffset -= len; -+ nowPos32 += len; -+ if (p->additionalOffset == 0) -+ { -+ UInt32 processed; -+ if (!p->fastMode) -+ { -+ if (p->matchPriceCount >= (1 << 7)) -+ FillDistancesPrices(p); -+ if (p->alignPriceCount >= kAlignTableSize) -+ FillAlignPrices(p); -+ } -+ if (p->matchFinder.GetNumAvailableBytes(p->matchFinderObj) == 0) -+ break; -+ processed = nowPos32 - startPos32; -+ if (useLimits) -+ { -+ if (processed + kNumOpts + 300 >= maxUnpackSize || -+ RangeEnc_GetProcessed(&p->rc) + kNumOpts * 2 >= maxPackSize) -+ break; -+ } -+ else if (processed >= (1 << 15)) -+ { -+ p->nowPos64 += nowPos32 - startPos32; -+ return CheckErrors(p); -+ } -+ } -+ } -+ p->nowPos64 += nowPos32 - startPos32; -+ return Flush(p, nowPos32); -+} -+ -+#define kBigHashDicLimit ((UInt32)1 << 24) -+ -+static SRes LzmaEnc_Alloc(CLzmaEnc *p, UInt32 keepWindowSize, ISzAlloc *alloc, ISzAlloc *allocBig) -+{ -+ UInt32 beforeSize = kNumOpts; -+ Bool btMode; -+ if (!RangeEnc_Alloc(&p->rc, alloc)) -+ return SZ_ERROR_MEM; -+ btMode = (p->matchFinderBase.btMode != 0); -+ #ifndef _7ZIP_ST -+ p->mtMode = (p->multiThread && !p->fastMode && btMode); -+ #endif -+ -+ { -+ unsigned lclp = p->lc + p->lp; -+ if (p->litProbs == 0 || p->saveState.litProbs == 0 || p->lclp != lclp) -+ { -+ LzmaEnc_FreeLits(p, alloc); -+ p->litProbs = (CLzmaProb *)alloc->Alloc(alloc, (0x300 << lclp) * sizeof(CLzmaProb)); -+ p->saveState.litProbs = (CLzmaProb *)alloc->Alloc(alloc, (0x300 << lclp) * sizeof(CLzmaProb)); -+ if (p->litProbs == 0 || p->saveState.litProbs == 0) -+ { -+ LzmaEnc_FreeLits(p, alloc); -+ return SZ_ERROR_MEM; -+ } -+ p->lclp = lclp; -+ } -+ } -+ -+ p->matchFinderBase.bigHash = (p->dictSize > kBigHashDicLimit); -+ -+ if (beforeSize + p->dictSize < keepWindowSize) -+ beforeSize = keepWindowSize - p->dictSize; -+ -+ #ifndef _7ZIP_ST -+ if (p->mtMode) -+ { -+ RINOK(MatchFinderMt_Create(&p->matchFinderMt, p->dictSize, beforeSize, p->numFastBytes, LZMA_MATCH_LEN_MAX, allocBig)); -+ p->matchFinderObj = &p->matchFinderMt; -+ MatchFinderMt_CreateVTable(&p->matchFinderMt, &p->matchFinder); -+ } -+ else -+ #endif -+ { -+ if (!MatchFinder_Create(&p->matchFinderBase, p->dictSize, beforeSize, p->numFastBytes, LZMA_MATCH_LEN_MAX, allocBig)) -+ return SZ_ERROR_MEM; -+ p->matchFinderObj = &p->matchFinderBase; -+ MatchFinder_CreateVTable(&p->matchFinderBase, &p->matchFinder); -+ } -+ return SZ_OK; -+} -+ -+void LzmaEnc_Init(CLzmaEnc *p) -+{ -+ UInt32 i; -+ p->state = 0; -+ for (i = 0 ; i < LZMA_NUM_REPS; i++) -+ p->reps[i] = 0; -+ -+ RangeEnc_Init(&p->rc); -+ -+ -+ for (i = 0; i < kNumStates; i++) -+ { -+ UInt32 j; -+ for (j = 0; j < LZMA_NUM_PB_STATES_MAX; j++) -+ { -+ p->isMatch[i][j] = kProbInitValue; -+ p->isRep0Long[i][j] = kProbInitValue; -+ } -+ p->isRep[i] = kProbInitValue; -+ p->isRepG0[i] = kProbInitValue; -+ p->isRepG1[i] = kProbInitValue; -+ p->isRepG2[i] = kProbInitValue; -+ } -+ -+ { -+ UInt32 num = 0x300 << (p->lp + p->lc); -+ for (i = 0; i < num; i++) -+ p->litProbs[i] = kProbInitValue; -+ } -+ -+ { -+ for (i = 0; i < kNumLenToPosStates; i++) -+ { -+ CLzmaProb *probs = p->posSlotEncoder[i]; -+ UInt32 j; -+ for (j = 0; j < (1 << kNumPosSlotBits); j++) -+ probs[j] = kProbInitValue; -+ } -+ } -+ { -+ for (i = 0; i < kNumFullDistances - kEndPosModelIndex; i++) -+ p->posEncoders[i] = kProbInitValue; -+ } -+ -+ LenEnc_Init(&p->lenEnc.p); -+ LenEnc_Init(&p->repLenEnc.p); -+ -+ for (i = 0; i < (1 << kNumAlignBits); i++) -+ p->posAlignEncoder[i] = kProbInitValue; -+ -+ p->optimumEndIndex = 0; -+ p->optimumCurrentIndex = 0; -+ p->additionalOffset = 0; -+ -+ p->pbMask = (1 << p->pb) - 1; -+ p->lpMask = (1 << p->lp) - 1; -+} -+ -+void LzmaEnc_InitPrices(CLzmaEnc *p) -+{ -+ if (!p->fastMode) -+ { -+ FillDistancesPrices(p); -+ FillAlignPrices(p); -+ } -+ -+ p->lenEnc.tableSize = -+ p->repLenEnc.tableSize = -+ p->numFastBytes + 1 - LZMA_MATCH_LEN_MIN; -+ LenPriceEnc_UpdateTables(&p->lenEnc, 1 << p->pb, p->ProbPrices); -+ LenPriceEnc_UpdateTables(&p->repLenEnc, 1 << p->pb, p->ProbPrices); -+} -+ -+static SRes LzmaEnc_AllocAndInit(CLzmaEnc *p, UInt32 keepWindowSize, ISzAlloc *alloc, ISzAlloc *allocBig) -+{ -+ UInt32 i; -+ for (i = 0; i < (UInt32)kDicLogSizeMaxCompress; i++) -+ if (p->dictSize <= ((UInt32)1 << i)) -+ break; -+ p->distTableSize = i * 2; -+ -+ p->finished = False; -+ p->result = SZ_OK; -+ RINOK(LzmaEnc_Alloc(p, keepWindowSize, alloc, allocBig)); -+ LzmaEnc_Init(p); -+ LzmaEnc_InitPrices(p); -+ p->nowPos64 = 0; -+ return SZ_OK; -+} -+ -+static SRes LzmaEnc_Prepare(CLzmaEncHandle pp, ISeqOutStream *outStream, ISeqInStream *inStream, -+ ISzAlloc *alloc, ISzAlloc *allocBig) -+{ -+ CLzmaEnc *p = (CLzmaEnc *)pp; -+ p->matchFinderBase.stream = inStream; -+ p->needInit = 1; -+ p->rc.outStream = outStream; -+ return LzmaEnc_AllocAndInit(p, 0, alloc, allocBig); -+} -+ -+SRes LzmaEnc_PrepareForLzma2(CLzmaEncHandle pp, -+ ISeqInStream *inStream, UInt32 keepWindowSize, -+ ISzAlloc *alloc, ISzAlloc *allocBig) -+{ -+ CLzmaEnc *p = (CLzmaEnc *)pp; -+ p->matchFinderBase.stream = inStream; -+ p->needInit = 1; -+ return LzmaEnc_AllocAndInit(p, keepWindowSize, alloc, allocBig); -+} -+ -+static void LzmaEnc_SetInputBuf(CLzmaEnc *p, const Byte *src, SizeT srcLen) -+{ -+ p->matchFinderBase.directInput = 1; -+ p->matchFinderBase.bufferBase = (Byte *)src; -+ p->matchFinderBase.directInputRem = srcLen; -+} -+ -+SRes LzmaEnc_MemPrepare(CLzmaEncHandle pp, const Byte *src, SizeT srcLen, -+ UInt32 keepWindowSize, ISzAlloc *alloc, ISzAlloc *allocBig) -+{ -+ CLzmaEnc *p = (CLzmaEnc *)pp; -+ LzmaEnc_SetInputBuf(p, src, srcLen); -+ p->needInit = 1; -+ -+ return LzmaEnc_AllocAndInit(p, keepWindowSize, alloc, allocBig); -+} -+ -+void LzmaEnc_Finish(CLzmaEncHandle pp) -+{ -+ #ifndef _7ZIP_ST -+ CLzmaEnc *p = (CLzmaEnc *)pp; -+ if (p->mtMode) -+ MatchFinderMt_ReleaseStream(&p->matchFinderMt); -+ #else -+ pp = pp; -+ #endif -+} -+ -+typedef struct -+{ -+ ISeqOutStream funcTable; -+ Byte *data; -+ SizeT rem; -+ Bool overflow; -+} CSeqOutStreamBuf; -+ -+static size_t MyWrite(void *pp, const void *data, size_t size) -+{ -+ CSeqOutStreamBuf *p = (CSeqOutStreamBuf *)pp; -+ if (p->rem < size) -+ { -+ size = p->rem; -+ p->overflow = True; -+ } -+ memcpy(p->data, data, size); -+ p->rem -= size; -+ p->data += size; -+ return size; -+} -+ -+ -+UInt32 LzmaEnc_GetNumAvailableBytes(CLzmaEncHandle pp) -+{ -+ const CLzmaEnc *p = (CLzmaEnc *)pp; -+ return p->matchFinder.GetNumAvailableBytes(p->matchFinderObj); -+} -+ -+const Byte *LzmaEnc_GetCurBuf(CLzmaEncHandle pp) -+{ -+ const CLzmaEnc *p = (CLzmaEnc *)pp; -+ return p->matchFinder.GetPointerToCurrentPos(p->matchFinderObj) - p->additionalOffset; -+} -+ -+SRes LzmaEnc_CodeOneMemBlock(CLzmaEncHandle pp, Bool reInit, -+ Byte *dest, size_t *destLen, UInt32 desiredPackSize, UInt32 *unpackSize) -+{ -+ CLzmaEnc *p = (CLzmaEnc *)pp; -+ UInt64 nowPos64; -+ SRes res; -+ CSeqOutStreamBuf outStream; -+ -+ outStream.funcTable.Write = MyWrite; -+ outStream.data = dest; -+ outStream.rem = *destLen; -+ outStream.overflow = False; -+ -+ p->writeEndMark = False; -+ p->finished = False; -+ p->result = SZ_OK; -+ -+ if (reInit) -+ LzmaEnc_Init(p); -+ LzmaEnc_InitPrices(p); -+ nowPos64 = p->nowPos64; -+ RangeEnc_Init(&p->rc); -+ p->rc.outStream = &outStream.funcTable; -+ -+ res = LzmaEnc_CodeOneBlock(p, True, desiredPackSize, *unpackSize); -+ -+ *unpackSize = (UInt32)(p->nowPos64 - nowPos64); -+ *destLen -= outStream.rem; -+ if (outStream.overflow) -+ return SZ_ERROR_OUTPUT_EOF; -+ -+ return res; -+} -+ -+static SRes LzmaEnc_Encode2(CLzmaEnc *p, ICompressProgress *progress) -+{ -+ SRes res = SZ_OK; -+ -+ #ifndef _7ZIP_ST -+ Byte allocaDummy[0x300]; -+ int i = 0; -+ for (i = 0; i < 16; i++) -+ allocaDummy[i] = (Byte)i; -+ #endif -+ -+ for (;;) -+ { -+ res = LzmaEnc_CodeOneBlock(p, False, 0, 0); -+ if (res != SZ_OK || p->finished != 0) -+ break; -+ if (progress != 0) -+ { -+ res = progress->Progress(progress, p->nowPos64, RangeEnc_GetProcessed(&p->rc)); -+ if (res != SZ_OK) -+ { -+ res = SZ_ERROR_PROGRESS; -+ break; -+ } -+ } -+ } -+ LzmaEnc_Finish(p); -+ return res; -+} -+ -+SRes LzmaEnc_Encode(CLzmaEncHandle pp, ISeqOutStream *outStream, ISeqInStream *inStream, ICompressProgress *progress, -+ ISzAlloc *alloc, ISzAlloc *allocBig) -+{ -+ RINOK(LzmaEnc_Prepare(pp, outStream, inStream, alloc, allocBig)); -+ return LzmaEnc_Encode2((CLzmaEnc *)pp, progress); -+} -+ -+SRes LzmaEnc_WriteProperties(CLzmaEncHandle pp, Byte *props, SizeT *size) -+{ -+ CLzmaEnc *p = (CLzmaEnc *)pp; -+ int i; -+ UInt32 dictSize = p->dictSize; -+ if (*size < LZMA_PROPS_SIZE) -+ return SZ_ERROR_PARAM; -+ *size = LZMA_PROPS_SIZE; -+ props[0] = (Byte)((p->pb * 5 + p->lp) * 9 + p->lc); -+ -+ for (i = 11; i <= 30; i++) -+ { -+ if (dictSize <= ((UInt32)2 << i)) -+ { -+ dictSize = (2 << i); -+ break; -+ } -+ if (dictSize <= ((UInt32)3 << i)) -+ { -+ dictSize = (3 << i); -+ break; -+ } -+ } -+ -+ for (i = 0; i < 4; i++) -+ props[1 + i] = (Byte)(dictSize >> (8 * i)); -+ return SZ_OK; -+} -+ -+SRes LzmaEnc_MemEncode(CLzmaEncHandle pp, Byte *dest, SizeT *destLen, const Byte *src, SizeT srcLen, -+ int writeEndMark, ICompressProgress *progress, ISzAlloc *alloc, ISzAlloc *allocBig) -+{ -+ SRes res; -+ CLzmaEnc *p = (CLzmaEnc *)pp; -+ -+ CSeqOutStreamBuf outStream; -+ -+ LzmaEnc_SetInputBuf(p, src, srcLen); -+ -+ outStream.funcTable.Write = MyWrite; -+ outStream.data = dest; -+ outStream.rem = *destLen; -+ outStream.overflow = False; -+ -+ p->writeEndMark = writeEndMark; -+ -+ p->rc.outStream = &outStream.funcTable; -+ res = LzmaEnc_MemPrepare(pp, src, srcLen, 0, alloc, allocBig); -+ if (res == SZ_OK) -+ res = LzmaEnc_Encode2(p, progress); -+ -+ *destLen -= outStream.rem; -+ if (outStream.overflow) -+ return SZ_ERROR_OUTPUT_EOF; -+ return res; -+} -+ -+SRes LzmaEncode(Byte *dest, SizeT *destLen, const Byte *src, SizeT srcLen, -+ const CLzmaEncProps *props, Byte *propsEncoded, SizeT *propsSize, int writeEndMark, -+ ICompressProgress *progress, ISzAlloc *alloc, ISzAlloc *allocBig) -+{ -+ CLzmaEnc *p = (CLzmaEnc *)LzmaEnc_Create(alloc); -+ SRes res; -+ if (p == 0) -+ return SZ_ERROR_MEM; -+ -+ res = LzmaEnc_SetProps(p, props); -+ if (res == SZ_OK) -+ { -+ res = LzmaEnc_WriteProperties(p, propsEncoded, propsSize); -+ if (res == SZ_OK) -+ res = LzmaEnc_MemEncode(p, dest, destLen, src, srcLen, -+ writeEndMark, progress, alloc, allocBig); -+ } -+ -+ LzmaEnc_Destroy(p, alloc, allocBig); -+ return res; -+} ---- /dev/null -+++ b/lib/lzma/Makefile -@@ -0,0 +1,7 @@ -+lzma_compress-objs := LzFind.o LzmaEnc.o -+lzma_decompress-objs := LzmaDec.o -+ -+obj-$(CONFIG_LZMA_COMPRESS) += lzma_compress.o -+obj-$(CONFIG_LZMA_DECOMPRESS) += lzma_decompress.o -+ -+EXTRA_CFLAGS += -Iinclude/linux -Iinclude/linux/lzma -include types.h diff --git a/target/linux/generic/pending-3.18/531-debloat_lzma.patch b/target/linux/generic/pending-3.18/531-debloat_lzma.patch deleted file mode 100644 index aa3c498016..0000000000 --- a/target/linux/generic/pending-3.18/531-debloat_lzma.patch +++ /dev/null @@ -1,1024 +0,0 @@ ---- a/include/linux/lzma/LzmaDec.h -+++ b/include/linux/lzma/LzmaDec.h -@@ -31,14 +31,6 @@ typedef struct _CLzmaProps - UInt32 dicSize; - } CLzmaProps; - --/* LzmaProps_Decode - decodes properties --Returns: -- SZ_OK -- SZ_ERROR_UNSUPPORTED - Unsupported properties --*/ -- --SRes LzmaProps_Decode(CLzmaProps *p, const Byte *data, unsigned size); -- - - /* ---------- LZMA Decoder state ---------- */ - -@@ -70,8 +62,6 @@ typedef struct - - #define LzmaDec_Construct(p) { (p)->dic = 0; (p)->probs = 0; } - --void LzmaDec_Init(CLzmaDec *p); -- - /* There are two types of LZMA streams: - 0) Stream with end mark. That end mark adds about 6 bytes to compressed size. - 1) Stream without end mark. You must know exact uncompressed size to decompress such stream. */ -@@ -108,97 +98,6 @@ typedef enum - - /* ELzmaStatus is used only as output value for function call */ - -- --/* ---------- Interfaces ---------- */ -- --/* There are 3 levels of interfaces: -- 1) Dictionary Interface -- 2) Buffer Interface -- 3) One Call Interface -- You can select any of these interfaces, but don't mix functions from different -- groups for same object. */ -- -- --/* There are two variants to allocate state for Dictionary Interface: -- 1) LzmaDec_Allocate / LzmaDec_Free -- 2) LzmaDec_AllocateProbs / LzmaDec_FreeProbs -- You can use variant 2, if you set dictionary buffer manually. -- For Buffer Interface you must always use variant 1. -- --LzmaDec_Allocate* can return: -- SZ_OK -- SZ_ERROR_MEM - Memory allocation error -- SZ_ERROR_UNSUPPORTED - Unsupported properties --*/ -- --SRes LzmaDec_AllocateProbs(CLzmaDec *p, const Byte *props, unsigned propsSize, ISzAlloc *alloc); --void LzmaDec_FreeProbs(CLzmaDec *p, ISzAlloc *alloc); -- --SRes LzmaDec_Allocate(CLzmaDec *state, const Byte *prop, unsigned propsSize, ISzAlloc *alloc); --void LzmaDec_Free(CLzmaDec *state, ISzAlloc *alloc); -- --/* ---------- Dictionary Interface ---------- */ -- --/* You can use it, if you want to eliminate the overhead for data copying from -- dictionary to some other external buffer. -- You must work with CLzmaDec variables directly in this interface. -- -- STEPS: -- LzmaDec_Constr() -- LzmaDec_Allocate() -- for (each new stream) -- { -- LzmaDec_Init() -- while (it needs more decompression) -- { -- LzmaDec_DecodeToDic() -- use data from CLzmaDec::dic and update CLzmaDec::dicPos -- } -- } -- LzmaDec_Free() --*/ -- --/* LzmaDec_DecodeToDic -- -- The decoding to internal dictionary buffer (CLzmaDec::dic). -- You must manually update CLzmaDec::dicPos, if it reaches CLzmaDec::dicBufSize !!! -- --finishMode: -- It has meaning only if the decoding reaches output limit (dicLimit). -- LZMA_FINISH_ANY - Decode just dicLimit bytes. -- LZMA_FINISH_END - Stream must be finished after dicLimit. -- --Returns: -- SZ_OK -- status: -- LZMA_STATUS_FINISHED_WITH_MARK -- LZMA_STATUS_NOT_FINISHED -- LZMA_STATUS_NEEDS_MORE_INPUT -- LZMA_STATUS_MAYBE_FINISHED_WITHOUT_MARK -- SZ_ERROR_DATA - Data error --*/ -- --SRes LzmaDec_DecodeToDic(CLzmaDec *p, SizeT dicLimit, -- const Byte *src, SizeT *srcLen, ELzmaFinishMode finishMode, ELzmaStatus *status); -- -- --/* ---------- Buffer Interface ---------- */ -- --/* It's zlib-like interface. -- See LzmaDec_DecodeToDic description for information about STEPS and return results, -- but you must use LzmaDec_DecodeToBuf instead of LzmaDec_DecodeToDic and you don't need -- to work with CLzmaDec variables manually. -- --finishMode: -- It has meaning only if the decoding reaches output limit (*destLen). -- LZMA_FINISH_ANY - Decode just destLen bytes. -- LZMA_FINISH_END - Stream must be finished after (*destLen). --*/ -- --SRes LzmaDec_DecodeToBuf(CLzmaDec *p, Byte *dest, SizeT *destLen, -- const Byte *src, SizeT *srcLen, ELzmaFinishMode finishMode, ELzmaStatus *status); -- -- - /* ---------- One Call Interface ---------- */ - - /* LzmaDecode ---- a/lib/lzma/LzmaDec.c -+++ b/lib/lzma/LzmaDec.c -@@ -682,7 +682,7 @@ static void LzmaDec_InitRc(CLzmaDec *p, - p->needFlush = 0; - } - --void LzmaDec_InitDicAndState(CLzmaDec *p, Bool initDic, Bool initState) -+static void LzmaDec_InitDicAndState(CLzmaDec *p, Bool initDic, Bool initState) - { - p->needFlush = 1; - p->remainLen = 0; -@@ -698,7 +698,7 @@ void LzmaDec_InitDicAndState(CLzmaDec *p - p->needInitState = 1; - } - --void LzmaDec_Init(CLzmaDec *p) -+static void LzmaDec_Init(CLzmaDec *p) - { - p->dicPos = 0; - LzmaDec_InitDicAndState(p, True, True); -@@ -716,7 +716,7 @@ static void LzmaDec_InitStateReal(CLzmaD - p->needInitState = 0; - } - --SRes LzmaDec_DecodeToDic(CLzmaDec *p, SizeT dicLimit, const Byte *src, SizeT *srcLen, -+static SRes LzmaDec_DecodeToDic(CLzmaDec *p, SizeT dicLimit, const Byte *src, SizeT *srcLen, - ELzmaFinishMode finishMode, ELzmaStatus *status) - { - SizeT inSize = *srcLen; -@@ -837,65 +837,13 @@ SRes LzmaDec_DecodeToDic(CLzmaDec *p, Si - return (p->code == 0) ? SZ_OK : SZ_ERROR_DATA; - } - --SRes LzmaDec_DecodeToBuf(CLzmaDec *p, Byte *dest, SizeT *destLen, const Byte *src, SizeT *srcLen, ELzmaFinishMode finishMode, ELzmaStatus *status) --{ -- SizeT outSize = *destLen; -- SizeT inSize = *srcLen; -- *srcLen = *destLen = 0; -- for (;;) -- { -- SizeT inSizeCur = inSize, outSizeCur, dicPos; -- ELzmaFinishMode curFinishMode; -- SRes res; -- if (p->dicPos == p->dicBufSize) -- p->dicPos = 0; -- dicPos = p->dicPos; -- if (outSize > p->dicBufSize - dicPos) -- { -- outSizeCur = p->dicBufSize; -- curFinishMode = LZMA_FINISH_ANY; -- } -- else -- { -- outSizeCur = dicPos + outSize; -- curFinishMode = finishMode; -- } -- -- res = LzmaDec_DecodeToDic(p, outSizeCur, src, &inSizeCur, curFinishMode, status); -- src += inSizeCur; -- inSize -= inSizeCur; -- *srcLen += inSizeCur; -- outSizeCur = p->dicPos - dicPos; -- memcpy(dest, p->dic + dicPos, outSizeCur); -- dest += outSizeCur; -- outSize -= outSizeCur; -- *destLen += outSizeCur; -- if (res != 0) -- return res; -- if (outSizeCur == 0 || outSize == 0) -- return SZ_OK; -- } --} -- --void LzmaDec_FreeProbs(CLzmaDec *p, ISzAlloc *alloc) -+static void LzmaDec_FreeProbs(CLzmaDec *p, ISzAlloc *alloc) - { - alloc->Free(alloc, p->probs); - p->probs = 0; - } - --static void LzmaDec_FreeDict(CLzmaDec *p, ISzAlloc *alloc) --{ -- alloc->Free(alloc, p->dic); -- p->dic = 0; --} -- --void LzmaDec_Free(CLzmaDec *p, ISzAlloc *alloc) --{ -- LzmaDec_FreeProbs(p, alloc); -- LzmaDec_FreeDict(p, alloc); --} -- --SRes LzmaProps_Decode(CLzmaProps *p, const Byte *data, unsigned size) -+static SRes LzmaProps_Decode(CLzmaProps *p, const Byte *data, unsigned size) - { - UInt32 dicSize; - Byte d; -@@ -935,7 +883,7 @@ static SRes LzmaDec_AllocateProbs2(CLzma - return SZ_OK; - } - --SRes LzmaDec_AllocateProbs(CLzmaDec *p, const Byte *props, unsigned propsSize, ISzAlloc *alloc) -+static SRes LzmaDec_AllocateProbs(CLzmaDec *p, const Byte *props, unsigned propsSize, ISzAlloc *alloc) - { - CLzmaProps propNew; - RINOK(LzmaProps_Decode(&propNew, props, propsSize)); -@@ -943,28 +891,6 @@ SRes LzmaDec_AllocateProbs(CLzmaDec *p, - p->prop = propNew; - return SZ_OK; - } -- --SRes LzmaDec_Allocate(CLzmaDec *p, const Byte *props, unsigned propsSize, ISzAlloc *alloc) --{ -- CLzmaProps propNew; -- SizeT dicBufSize; -- RINOK(LzmaProps_Decode(&propNew, props, propsSize)); -- RINOK(LzmaDec_AllocateProbs2(p, &propNew, alloc)); -- dicBufSize = propNew.dicSize; -- if (p->dic == 0 || dicBufSize != p->dicBufSize) -- { -- LzmaDec_FreeDict(p, alloc); -- p->dic = (Byte *)alloc->Alloc(alloc, dicBufSize); -- if (p->dic == 0) -- { -- LzmaDec_FreeProbs(p, alloc); -- return SZ_ERROR_MEM; -- } -- } -- p->dicBufSize = dicBufSize; -- p->prop = propNew; -- return SZ_OK; --} - - SRes LzmaDecode(Byte *dest, SizeT *destLen, const Byte *src, SizeT *srcLen, - const Byte *propData, unsigned propSize, ELzmaFinishMode finishMode, ---- a/include/linux/lzma/LzmaEnc.h -+++ b/include/linux/lzma/LzmaEnc.h -@@ -31,9 +31,6 @@ typedef struct _CLzmaEncProps - } CLzmaEncProps; - - void LzmaEncProps_Init(CLzmaEncProps *p); --void LzmaEncProps_Normalize(CLzmaEncProps *p); --UInt32 LzmaEncProps_GetDictSize(const CLzmaEncProps *props2); -- - - /* ---------- CLzmaEncHandle Interface ---------- */ - -@@ -53,26 +50,9 @@ CLzmaEncHandle LzmaEnc_Create(ISzAlloc * - void LzmaEnc_Destroy(CLzmaEncHandle p, ISzAlloc *alloc, ISzAlloc *allocBig); - SRes LzmaEnc_SetProps(CLzmaEncHandle p, const CLzmaEncProps *props); - SRes LzmaEnc_WriteProperties(CLzmaEncHandle p, Byte *properties, SizeT *size); --SRes LzmaEnc_Encode(CLzmaEncHandle p, ISeqOutStream *outStream, ISeqInStream *inStream, -- ICompressProgress *progress, ISzAlloc *alloc, ISzAlloc *allocBig); - SRes LzmaEnc_MemEncode(CLzmaEncHandle p, Byte *dest, SizeT *destLen, const Byte *src, SizeT srcLen, - int writeEndMark, ICompressProgress *progress, ISzAlloc *alloc, ISzAlloc *allocBig); - --/* ---------- One Call Interface ---------- */ -- --/* LzmaEncode --Return code: -- SZ_OK - OK -- SZ_ERROR_MEM - Memory allocation error -- SZ_ERROR_PARAM - Incorrect paramater -- SZ_ERROR_OUTPUT_EOF - output buffer overflow -- SZ_ERROR_THREAD - errors in multithreading functions (only for Mt version) --*/ -- --SRes LzmaEncode(Byte *dest, SizeT *destLen, const Byte *src, SizeT srcLen, -- const CLzmaEncProps *props, Byte *propsEncoded, SizeT *propsSize, int writeEndMark, -- ICompressProgress *progress, ISzAlloc *alloc, ISzAlloc *allocBig); -- - #ifdef __cplusplus - } - #endif ---- a/lib/lzma/LzmaEnc.c -+++ b/lib/lzma/LzmaEnc.c -@@ -53,7 +53,7 @@ void LzmaEncProps_Init(CLzmaEncProps *p) - p->writeEndMark = 0; - } - --void LzmaEncProps_Normalize(CLzmaEncProps *p) -+static void LzmaEncProps_Normalize(CLzmaEncProps *p) - { - int level = p->level; - if (level < 0) level = 5; -@@ -76,7 +76,7 @@ void LzmaEncProps_Normalize(CLzmaEncProp - #endif - } - --UInt32 LzmaEncProps_GetDictSize(const CLzmaEncProps *props2) -+static UInt32 __maybe_unused LzmaEncProps_GetDictSize(const CLzmaEncProps *props2) - { - CLzmaEncProps props = *props2; - LzmaEncProps_Normalize(&props); -@@ -93,7 +93,7 @@ UInt32 LzmaEncProps_GetDictSize(const CL - - #define BSR2_RET(pos, res) { unsigned long i; _BitScanReverse(&i, (pos)); res = (i + i) + ((pos >> (i - 1)) & 1); } - --UInt32 GetPosSlot1(UInt32 pos) -+static UInt32 GetPosSlot1(UInt32 pos) - { - UInt32 res; - BSR2_RET(pos, res); -@@ -107,7 +107,7 @@ UInt32 GetPosSlot1(UInt32 pos) - #define kNumLogBits (9 + (int)sizeof(size_t) / 2) - #define kDicLogSizeMaxCompress ((kNumLogBits - 1) * 2 + 7) - --void LzmaEnc_FastPosInit(Byte *g_FastPos) -+static void LzmaEnc_FastPosInit(Byte *g_FastPos) - { - int c = 2, slotFast; - g_FastPos[0] = 0; -@@ -339,58 +339,6 @@ typedef struct - CSaveState saveState; - } CLzmaEnc; - --void LzmaEnc_SaveState(CLzmaEncHandle pp) --{ -- CLzmaEnc *p = (CLzmaEnc *)pp; -- CSaveState *dest = &p->saveState; -- int i; -- dest->lenEnc = p->lenEnc; -- dest->repLenEnc = p->repLenEnc; -- dest->state = p->state; -- -- for (i = 0; i < kNumStates; i++) -- { -- memcpy(dest->isMatch[i], p->isMatch[i], sizeof(p->isMatch[i])); -- memcpy(dest->isRep0Long[i], p->isRep0Long[i], sizeof(p->isRep0Long[i])); -- } -- for (i = 0; i < kNumLenToPosStates; i++) -- memcpy(dest->posSlotEncoder[i], p->posSlotEncoder[i], sizeof(p->posSlotEncoder[i])); -- memcpy(dest->isRep, p->isRep, sizeof(p->isRep)); -- memcpy(dest->isRepG0, p->isRepG0, sizeof(p->isRepG0)); -- memcpy(dest->isRepG1, p->isRepG1, sizeof(p->isRepG1)); -- memcpy(dest->isRepG2, p->isRepG2, sizeof(p->isRepG2)); -- memcpy(dest->posEncoders, p->posEncoders, sizeof(p->posEncoders)); -- memcpy(dest->posAlignEncoder, p->posAlignEncoder, sizeof(p->posAlignEncoder)); -- memcpy(dest->reps, p->reps, sizeof(p->reps)); -- memcpy(dest->litProbs, p->litProbs, (0x300 << p->lclp) * sizeof(CLzmaProb)); --} -- --void LzmaEnc_RestoreState(CLzmaEncHandle pp) --{ -- CLzmaEnc *dest = (CLzmaEnc *)pp; -- const CSaveState *p = &dest->saveState; -- int i; -- dest->lenEnc = p->lenEnc; -- dest->repLenEnc = p->repLenEnc; -- dest->state = p->state; -- -- for (i = 0; i < kNumStates; i++) -- { -- memcpy(dest->isMatch[i], p->isMatch[i], sizeof(p->isMatch[i])); -- memcpy(dest->isRep0Long[i], p->isRep0Long[i], sizeof(p->isRep0Long[i])); -- } -- for (i = 0; i < kNumLenToPosStates; i++) -- memcpy(dest->posSlotEncoder[i], p->posSlotEncoder[i], sizeof(p->posSlotEncoder[i])); -- memcpy(dest->isRep, p->isRep, sizeof(p->isRep)); -- memcpy(dest->isRepG0, p->isRepG0, sizeof(p->isRepG0)); -- memcpy(dest->isRepG1, p->isRepG1, sizeof(p->isRepG1)); -- memcpy(dest->isRepG2, p->isRepG2, sizeof(p->isRepG2)); -- memcpy(dest->posEncoders, p->posEncoders, sizeof(p->posEncoders)); -- memcpy(dest->posAlignEncoder, p->posAlignEncoder, sizeof(p->posAlignEncoder)); -- memcpy(dest->reps, p->reps, sizeof(p->reps)); -- memcpy(dest->litProbs, p->litProbs, (0x300 << dest->lclp) * sizeof(CLzmaProb)); --} -- - SRes LzmaEnc_SetProps(CLzmaEncHandle pp, const CLzmaEncProps *props2) - { - CLzmaEnc *p = (CLzmaEnc *)pp; -@@ -600,7 +548,7 @@ static void LitEnc_EncodeMatched(CRangeE - while (symbol < 0x10000); - } - --void LzmaEnc_InitPriceTables(UInt32 *ProbPrices) -+static void LzmaEnc_InitPriceTables(UInt32 *ProbPrices) - { - UInt32 i; - for (i = (1 << kNumMoveReducingBits) / 2; i < kBitModelTotal; i += (1 << kNumMoveReducingBits)) -@@ -1676,7 +1624,7 @@ static void FillDistancesPrices(CLzmaEnc - p->matchPriceCount = 0; - } - --void LzmaEnc_Construct(CLzmaEnc *p) -+static void LzmaEnc_Construct(CLzmaEnc *p) - { - RangeEnc_Construct(&p->rc); - MatchFinder_Construct(&p->matchFinderBase); -@@ -1709,7 +1657,7 @@ CLzmaEncHandle LzmaEnc_Create(ISzAlloc * - return p; - } - --void LzmaEnc_FreeLits(CLzmaEnc *p, ISzAlloc *alloc) -+static void LzmaEnc_FreeLits(CLzmaEnc *p, ISzAlloc *alloc) - { - alloc->Free(alloc, p->litProbs); - alloc->Free(alloc, p->saveState.litProbs); -@@ -1717,7 +1665,7 @@ void LzmaEnc_FreeLits(CLzmaEnc *p, ISzAl - p->saveState.litProbs = 0; - } - --void LzmaEnc_Destruct(CLzmaEnc *p, ISzAlloc *alloc, ISzAlloc *allocBig) -+static void LzmaEnc_Destruct(CLzmaEnc *p, ISzAlloc *alloc, ISzAlloc *allocBig) - { - #ifndef _7ZIP_ST - MatchFinderMt_Destruct(&p->matchFinderMt, allocBig); -@@ -1947,7 +1895,7 @@ static SRes LzmaEnc_Alloc(CLzmaEnc *p, U - return SZ_OK; - } - --void LzmaEnc_Init(CLzmaEnc *p) -+static void LzmaEnc_Init(CLzmaEnc *p) - { - UInt32 i; - p->state = 0; -@@ -2005,7 +1953,7 @@ void LzmaEnc_Init(CLzmaEnc *p) - p->lpMask = (1 << p->lp) - 1; - } - --void LzmaEnc_InitPrices(CLzmaEnc *p) -+static void LzmaEnc_InitPrices(CLzmaEnc *p) - { - if (!p->fastMode) - { -@@ -2037,26 +1985,6 @@ static SRes LzmaEnc_AllocAndInit(CLzmaEn - return SZ_OK; - } - --static SRes LzmaEnc_Prepare(CLzmaEncHandle pp, ISeqOutStream *outStream, ISeqInStream *inStream, -- ISzAlloc *alloc, ISzAlloc *allocBig) --{ -- CLzmaEnc *p = (CLzmaEnc *)pp; -- p->matchFinderBase.stream = inStream; -- p->needInit = 1; -- p->rc.outStream = outStream; -- return LzmaEnc_AllocAndInit(p, 0, alloc, allocBig); --} -- --SRes LzmaEnc_PrepareForLzma2(CLzmaEncHandle pp, -- ISeqInStream *inStream, UInt32 keepWindowSize, -- ISzAlloc *alloc, ISzAlloc *allocBig) --{ -- CLzmaEnc *p = (CLzmaEnc *)pp; -- p->matchFinderBase.stream = inStream; -- p->needInit = 1; -- return LzmaEnc_AllocAndInit(p, keepWindowSize, alloc, allocBig); --} -- - static void LzmaEnc_SetInputBuf(CLzmaEnc *p, const Byte *src, SizeT srcLen) - { - p->matchFinderBase.directInput = 1; -@@ -2064,7 +1992,7 @@ static void LzmaEnc_SetInputBuf(CLzmaEnc - p->matchFinderBase.directInputRem = srcLen; - } - --SRes LzmaEnc_MemPrepare(CLzmaEncHandle pp, const Byte *src, SizeT srcLen, -+static SRes LzmaEnc_MemPrepare(CLzmaEncHandle pp, const Byte *src, SizeT srcLen, - UInt32 keepWindowSize, ISzAlloc *alloc, ISzAlloc *allocBig) - { - CLzmaEnc *p = (CLzmaEnc *)pp; -@@ -2074,7 +2002,7 @@ SRes LzmaEnc_MemPrepare(CLzmaEncHandle p - return LzmaEnc_AllocAndInit(p, keepWindowSize, alloc, allocBig); - } - --void LzmaEnc_Finish(CLzmaEncHandle pp) -+static void LzmaEnc_Finish(CLzmaEncHandle pp) - { - #ifndef _7ZIP_ST - CLzmaEnc *p = (CLzmaEnc *)pp; -@@ -2107,53 +2035,6 @@ static size_t MyWrite(void *pp, const vo - return size; - } - -- --UInt32 LzmaEnc_GetNumAvailableBytes(CLzmaEncHandle pp) --{ -- const CLzmaEnc *p = (CLzmaEnc *)pp; -- return p->matchFinder.GetNumAvailableBytes(p->matchFinderObj); --} -- --const Byte *LzmaEnc_GetCurBuf(CLzmaEncHandle pp) --{ -- const CLzmaEnc *p = (CLzmaEnc *)pp; -- return p->matchFinder.GetPointerToCurrentPos(p->matchFinderObj) - p->additionalOffset; --} -- --SRes LzmaEnc_CodeOneMemBlock(CLzmaEncHandle pp, Bool reInit, -- Byte *dest, size_t *destLen, UInt32 desiredPackSize, UInt32 *unpackSize) --{ -- CLzmaEnc *p = (CLzmaEnc *)pp; -- UInt64 nowPos64; -- SRes res; -- CSeqOutStreamBuf outStream; -- -- outStream.funcTable.Write = MyWrite; -- outStream.data = dest; -- outStream.rem = *destLen; -- outStream.overflow = False; -- -- p->writeEndMark = False; -- p->finished = False; -- p->result = SZ_OK; -- -- if (reInit) -- LzmaEnc_Init(p); -- LzmaEnc_InitPrices(p); -- nowPos64 = p->nowPos64; -- RangeEnc_Init(&p->rc); -- p->rc.outStream = &outStream.funcTable; -- -- res = LzmaEnc_CodeOneBlock(p, True, desiredPackSize, *unpackSize); -- -- *unpackSize = (UInt32)(p->nowPos64 - nowPos64); -- *destLen -= outStream.rem; -- if (outStream.overflow) -- return SZ_ERROR_OUTPUT_EOF; -- -- return res; --} -- - static SRes LzmaEnc_Encode2(CLzmaEnc *p, ICompressProgress *progress) - { - SRes res = SZ_OK; -@@ -2184,13 +2065,6 @@ static SRes LzmaEnc_Encode2(CLzmaEnc *p, - return res; - } - --SRes LzmaEnc_Encode(CLzmaEncHandle pp, ISeqOutStream *outStream, ISeqInStream *inStream, ICompressProgress *progress, -- ISzAlloc *alloc, ISzAlloc *allocBig) --{ -- RINOK(LzmaEnc_Prepare(pp, outStream, inStream, alloc, allocBig)); -- return LzmaEnc_Encode2((CLzmaEnc *)pp, progress); --} -- - SRes LzmaEnc_WriteProperties(CLzmaEncHandle pp, Byte *props, SizeT *size) - { - CLzmaEnc *p = (CLzmaEnc *)pp; -@@ -2247,25 +2121,3 @@ SRes LzmaEnc_MemEncode(CLzmaEncHandle pp - return SZ_ERROR_OUTPUT_EOF; - return res; - } -- --SRes LzmaEncode(Byte *dest, SizeT *destLen, const Byte *src, SizeT srcLen, -- const CLzmaEncProps *props, Byte *propsEncoded, SizeT *propsSize, int writeEndMark, -- ICompressProgress *progress, ISzAlloc *alloc, ISzAlloc *allocBig) --{ -- CLzmaEnc *p = (CLzmaEnc *)LzmaEnc_Create(alloc); -- SRes res; -- if (p == 0) -- return SZ_ERROR_MEM; -- -- res = LzmaEnc_SetProps(p, props); -- if (res == SZ_OK) -- { -- res = LzmaEnc_WriteProperties(p, propsEncoded, propsSize); -- if (res == SZ_OK) -- res = LzmaEnc_MemEncode(p, dest, destLen, src, srcLen, -- writeEndMark, progress, alloc, allocBig); -- } -- -- LzmaEnc_Destroy(p, alloc, allocBig); -- return res; --} ---- a/include/linux/lzma/LzFind.h -+++ b/include/linux/lzma/LzFind.h -@@ -55,11 +55,6 @@ typedef struct _CMatchFinder - - #define Inline_MatchFinder_GetNumAvailableBytes(p) ((p)->streamPos - (p)->pos) - --int MatchFinder_NeedMove(CMatchFinder *p); --Byte *MatchFinder_GetPointerToCurrentPos(CMatchFinder *p); --void MatchFinder_MoveBlock(CMatchFinder *p); --void MatchFinder_ReadIfRequired(CMatchFinder *p); -- - void MatchFinder_Construct(CMatchFinder *p); - - /* Conditions: -@@ -70,12 +65,6 @@ int MatchFinder_Create(CMatchFinder *p, - UInt32 keepAddBufferBefore, UInt32 matchMaxLen, UInt32 keepAddBufferAfter, - ISzAlloc *alloc); - void MatchFinder_Free(CMatchFinder *p, ISzAlloc *alloc); --void MatchFinder_Normalize3(UInt32 subValue, CLzRef *items, UInt32 numItems); --void MatchFinder_ReduceOffsets(CMatchFinder *p, UInt32 subValue); -- --UInt32 * GetMatchesSpec1(UInt32 lenLimit, UInt32 curMatch, UInt32 pos, const Byte *buffer, CLzRef *son, -- UInt32 _cyclicBufferPos, UInt32 _cyclicBufferSize, UInt32 _cutValue, -- UInt32 *distances, UInt32 maxLen); - - /* - Conditions: -@@ -102,12 +91,6 @@ typedef struct _IMatchFinder - - void MatchFinder_CreateVTable(CMatchFinder *p, IMatchFinder *vTable); - --void MatchFinder_Init(CMatchFinder *p); --UInt32 Bt3Zip_MatchFinder_GetMatches(CMatchFinder *p, UInt32 *distances); --UInt32 Hc3Zip_MatchFinder_GetMatches(CMatchFinder *p, UInt32 *distances); --void Bt3Zip_MatchFinder_Skip(CMatchFinder *p, UInt32 num); --void Hc3Zip_MatchFinder_Skip(CMatchFinder *p, UInt32 num); -- - #ifdef __cplusplus - } - #endif ---- a/lib/lzma/LzFind.c -+++ b/lib/lzma/LzFind.c -@@ -14,9 +14,15 @@ - - #define kStartMaxLen 3 - -+#if 0 -+#define DIRECT_INPUT p->directInput -+#else -+#define DIRECT_INPUT 1 -+#endif -+ - static void LzInWindow_Free(CMatchFinder *p, ISzAlloc *alloc) - { -- if (!p->directInput) -+ if (!DIRECT_INPUT) - { - alloc->Free(alloc, p->bufferBase); - p->bufferBase = 0; -@@ -28,7 +34,7 @@ static void LzInWindow_Free(CMatchFinder - static int LzInWindow_Create(CMatchFinder *p, UInt32 keepSizeReserv, ISzAlloc *alloc) - { - UInt32 blockSize = p->keepSizeBefore + p->keepSizeAfter + keepSizeReserv; -- if (p->directInput) -+ if (DIRECT_INPUT) - { - p->blockSize = blockSize; - return 1; -@@ -42,12 +48,12 @@ static int LzInWindow_Create(CMatchFinde - return (p->bufferBase != 0); - } - --Byte *MatchFinder_GetPointerToCurrentPos(CMatchFinder *p) { return p->buffer; } --Byte MatchFinder_GetIndexByte(CMatchFinder *p, Int32 index) { return p->buffer[index]; } -+static Byte *MatchFinder_GetPointerToCurrentPos(CMatchFinder *p) { return p->buffer; } -+static Byte MatchFinder_GetIndexByte(CMatchFinder *p, Int32 index) { return p->buffer[index]; } - --UInt32 MatchFinder_GetNumAvailableBytes(CMatchFinder *p) { return p->streamPos - p->pos; } -+static UInt32 MatchFinder_GetNumAvailableBytes(CMatchFinder *p) { return p->streamPos - p->pos; } - --void MatchFinder_ReduceOffsets(CMatchFinder *p, UInt32 subValue) -+static void MatchFinder_ReduceOffsets(CMatchFinder *p, UInt32 subValue) - { - p->posLimit -= subValue; - p->pos -= subValue; -@@ -58,7 +64,7 @@ static void MatchFinder_ReadBlock(CMatch - { - if (p->streamEndWasReached || p->result != SZ_OK) - return; -- if (p->directInput) -+ if (DIRECT_INPUT) - { - UInt32 curSize = 0xFFFFFFFF - p->streamPos; - if (curSize > p->directInputRem) -@@ -89,7 +95,7 @@ static void MatchFinder_ReadBlock(CMatch - } - } - --void MatchFinder_MoveBlock(CMatchFinder *p) -+static void MatchFinder_MoveBlock(CMatchFinder *p) - { - memmove(p->bufferBase, - p->buffer - p->keepSizeBefore, -@@ -97,22 +103,14 @@ void MatchFinder_MoveBlock(CMatchFinder - p->buffer = p->bufferBase + p->keepSizeBefore; - } - --int MatchFinder_NeedMove(CMatchFinder *p) -+static int MatchFinder_NeedMove(CMatchFinder *p) - { -- if (p->directInput) -+ if (DIRECT_INPUT) - return 0; - /* if (p->streamEndWasReached) return 0; */ - return ((size_t)(p->bufferBase + p->blockSize - p->buffer) <= p->keepSizeAfter); - } - --void MatchFinder_ReadIfRequired(CMatchFinder *p) --{ -- if (p->streamEndWasReached) -- return; -- if (p->keepSizeAfter >= p->streamPos - p->pos) -- MatchFinder_ReadBlock(p); --} -- - static void MatchFinder_CheckAndMoveAndRead(CMatchFinder *p) - { - if (MatchFinder_NeedMove(p)) -@@ -268,7 +266,7 @@ static void MatchFinder_SetLimits(CMatch - p->posLimit = p->pos + limit; - } - --void MatchFinder_Init(CMatchFinder *p) -+static void MatchFinder_Init(CMatchFinder *p) - { - UInt32 i; - for (i = 0; i < p->hashSizeSum; i++) -@@ -287,7 +285,7 @@ static UInt32 MatchFinder_GetSubValue(CM - return (p->pos - p->historySize - 1) & kNormalizeMask; - } - --void MatchFinder_Normalize3(UInt32 subValue, CLzRef *items, UInt32 numItems) -+static void MatchFinder_Normalize3(UInt32 subValue, CLzRef *items, UInt32 numItems) - { - UInt32 i; - for (i = 0; i < numItems; i++) -@@ -319,38 +317,7 @@ static void MatchFinder_CheckLimits(CMat - MatchFinder_SetLimits(p); - } - --static UInt32 * Hc_GetMatchesSpec(UInt32 lenLimit, UInt32 curMatch, UInt32 pos, const Byte *cur, CLzRef *son, -- UInt32 _cyclicBufferPos, UInt32 _cyclicBufferSize, UInt32 cutValue, -- UInt32 *distances, UInt32 maxLen) --{ -- son[_cyclicBufferPos] = curMatch; -- for (;;) -- { -- UInt32 delta = pos - curMatch; -- if (cutValue-- == 0 || delta >= _cyclicBufferSize) -- return distances; -- { -- const Byte *pb = cur - delta; -- curMatch = son[_cyclicBufferPos - delta + ((delta > _cyclicBufferPos) ? _cyclicBufferSize : 0)]; -- if (pb[maxLen] == cur[maxLen] && *pb == *cur) -- { -- UInt32 len = 0; -- while (++len != lenLimit) -- if (pb[len] != cur[len]) -- break; -- if (maxLen < len) -- { -- *distances++ = maxLen = len; -- *distances++ = delta - 1; -- if (len == lenLimit) -- return distances; -- } -- } -- } -- } --} -- --UInt32 * GetMatchesSpec1(UInt32 lenLimit, UInt32 curMatch, UInt32 pos, const Byte *cur, CLzRef *son, -+static UInt32 * GetMatchesSpec1(UInt32 lenLimit, UInt32 curMatch, UInt32 pos, const Byte *cur, CLzRef *son, - UInt32 _cyclicBufferPos, UInt32 _cyclicBufferSize, UInt32 cutValue, - UInt32 *distances, UInt32 maxLen) - { -@@ -460,10 +427,10 @@ static void SkipMatchesSpec(UInt32 lenLi - p->buffer++; \ - if (++p->pos == p->posLimit) MatchFinder_CheckLimits(p); - --#define MOVE_POS_RET MOVE_POS return offset; -- - static void MatchFinder_MovePos(CMatchFinder *p) { MOVE_POS; } - -+#define MOVE_POS_RET MatchFinder_MovePos(p); return offset; -+ - #define GET_MATCHES_HEADER2(minLen, ret_op) \ - UInt32 lenLimit; UInt32 hashValue; const Byte *cur; UInt32 curMatch; \ - lenLimit = p->lenLimit; { if (lenLimit < minLen) { MatchFinder_MovePos(p); ret_op; }} \ -@@ -479,62 +446,7 @@ static void MatchFinder_MovePos(CMatchFi - distances + offset, maxLen) - distances); MOVE_POS_RET; - - #define SKIP_FOOTER \ -- SkipMatchesSpec(lenLimit, curMatch, MF_PARAMS(p)); MOVE_POS; -- --static UInt32 Bt2_MatchFinder_GetMatches(CMatchFinder *p, UInt32 *distances) --{ -- UInt32 offset; -- GET_MATCHES_HEADER(2) -- HASH2_CALC; -- curMatch = p->hash[hashValue]; -- p->hash[hashValue] = p->pos; -- offset = 0; -- GET_MATCHES_FOOTER(offset, 1) --} -- --UInt32 Bt3Zip_MatchFinder_GetMatches(CMatchFinder *p, UInt32 *distances) --{ -- UInt32 offset; -- GET_MATCHES_HEADER(3) -- HASH_ZIP_CALC; -- curMatch = p->hash[hashValue]; -- p->hash[hashValue] = p->pos; -- offset = 0; -- GET_MATCHES_FOOTER(offset, 2) --} -- --static UInt32 Bt3_MatchFinder_GetMatches(CMatchFinder *p, UInt32 *distances) --{ -- UInt32 hash2Value, delta2, maxLen, offset; -- GET_MATCHES_HEADER(3) -- -- HASH3_CALC; -- -- delta2 = p->pos - p->hash[hash2Value]; -- curMatch = p->hash[kFix3HashSize + hashValue]; -- -- p->hash[hash2Value] = -- p->hash[kFix3HashSize + hashValue] = p->pos; -- -- -- maxLen = 2; -- offset = 0; -- if (delta2 < p->cyclicBufferSize && *(cur - delta2) == *cur) -- { -- for (; maxLen != lenLimit; maxLen++) -- if (cur[(ptrdiff_t)maxLen - delta2] != cur[maxLen]) -- break; -- distances[0] = maxLen; -- distances[1] = delta2 - 1; -- offset = 2; -- if (maxLen == lenLimit) -- { -- SkipMatchesSpec(lenLimit, curMatch, MF_PARAMS(p)); -- MOVE_POS_RET; -- } -- } -- GET_MATCHES_FOOTER(offset, maxLen) --} -+ SkipMatchesSpec(lenLimit, curMatch, MF_PARAMS(p)); MatchFinder_MovePos(p); - - static UInt32 Bt4_MatchFinder_GetMatches(CMatchFinder *p, UInt32 *distances) - { -@@ -583,108 +495,6 @@ static UInt32 Bt4_MatchFinder_GetMatches - GET_MATCHES_FOOTER(offset, maxLen) - } - --static UInt32 Hc4_MatchFinder_GetMatches(CMatchFinder *p, UInt32 *distances) --{ -- UInt32 hash2Value, hash3Value, delta2, delta3, maxLen, offset; -- GET_MATCHES_HEADER(4) -- -- HASH4_CALC; -- -- delta2 = p->pos - p->hash[ hash2Value]; -- delta3 = p->pos - p->hash[kFix3HashSize + hash3Value]; -- curMatch = p->hash[kFix4HashSize + hashValue]; -- -- p->hash[ hash2Value] = -- p->hash[kFix3HashSize + hash3Value] = -- p->hash[kFix4HashSize + hashValue] = p->pos; -- -- maxLen = 1; -- offset = 0; -- if (delta2 < p->cyclicBufferSize && *(cur - delta2) == *cur) -- { -- distances[0] = maxLen = 2; -- distances[1] = delta2 - 1; -- offset = 2; -- } -- if (delta2 != delta3 && delta3 < p->cyclicBufferSize && *(cur - delta3) == *cur) -- { -- maxLen = 3; -- distances[offset + 1] = delta3 - 1; -- offset += 2; -- delta2 = delta3; -- } -- if (offset != 0) -- { -- for (; maxLen != lenLimit; maxLen++) -- if (cur[(ptrdiff_t)maxLen - delta2] != cur[maxLen]) -- break; -- distances[offset - 2] = maxLen; -- if (maxLen == lenLimit) -- { -- p->son[p->cyclicBufferPos] = curMatch; -- MOVE_POS_RET; -- } -- } -- if (maxLen < 3) -- maxLen = 3; -- offset = (UInt32)(Hc_GetMatchesSpec(lenLimit, curMatch, MF_PARAMS(p), -- distances + offset, maxLen) - (distances)); -- MOVE_POS_RET --} -- --UInt32 Hc3Zip_MatchFinder_GetMatches(CMatchFinder *p, UInt32 *distances) --{ -- UInt32 offset; -- GET_MATCHES_HEADER(3) -- HASH_ZIP_CALC; -- curMatch = p->hash[hashValue]; -- p->hash[hashValue] = p->pos; -- offset = (UInt32)(Hc_GetMatchesSpec(lenLimit, curMatch, MF_PARAMS(p), -- distances, 2) - (distances)); -- MOVE_POS_RET --} -- --static void Bt2_MatchFinder_Skip(CMatchFinder *p, UInt32 num) --{ -- do -- { -- SKIP_HEADER(2) -- HASH2_CALC; -- curMatch = p->hash[hashValue]; -- p->hash[hashValue] = p->pos; -- SKIP_FOOTER -- } -- while (--num != 0); --} -- --void Bt3Zip_MatchFinder_Skip(CMatchFinder *p, UInt32 num) --{ -- do -- { -- SKIP_HEADER(3) -- HASH_ZIP_CALC; -- curMatch = p->hash[hashValue]; -- p->hash[hashValue] = p->pos; -- SKIP_FOOTER -- } -- while (--num != 0); --} -- --static void Bt3_MatchFinder_Skip(CMatchFinder *p, UInt32 num) --{ -- do -- { -- UInt32 hash2Value; -- SKIP_HEADER(3) -- HASH3_CALC; -- curMatch = p->hash[kFix3HashSize + hashValue]; -- p->hash[hash2Value] = -- p->hash[kFix3HashSize + hashValue] = p->pos; -- SKIP_FOOTER -- } -- while (--num != 0); --} -- - static void Bt4_MatchFinder_Skip(CMatchFinder *p, UInt32 num) - { - do -@@ -701,61 +511,12 @@ static void Bt4_MatchFinder_Skip(CMatchF - while (--num != 0); - } - --static void Hc4_MatchFinder_Skip(CMatchFinder *p, UInt32 num) --{ -- do -- { -- UInt32 hash2Value, hash3Value; -- SKIP_HEADER(4) -- HASH4_CALC; -- curMatch = p->hash[kFix4HashSize + hashValue]; -- p->hash[ hash2Value] = -- p->hash[kFix3HashSize + hash3Value] = -- p->hash[kFix4HashSize + hashValue] = p->pos; -- p->son[p->cyclicBufferPos] = curMatch; -- MOVE_POS -- } -- while (--num != 0); --} -- --void Hc3Zip_MatchFinder_Skip(CMatchFinder *p, UInt32 num) --{ -- do -- { -- SKIP_HEADER(3) -- HASH_ZIP_CALC; -- curMatch = p->hash[hashValue]; -- p->hash[hashValue] = p->pos; -- p->son[p->cyclicBufferPos] = curMatch; -- MOVE_POS -- } -- while (--num != 0); --} -- - void MatchFinder_CreateVTable(CMatchFinder *p, IMatchFinder *vTable) - { - vTable->Init = (Mf_Init_Func)MatchFinder_Init; - vTable->GetIndexByte = (Mf_GetIndexByte_Func)MatchFinder_GetIndexByte; - vTable->GetNumAvailableBytes = (Mf_GetNumAvailableBytes_Func)MatchFinder_GetNumAvailableBytes; - vTable->GetPointerToCurrentPos = (Mf_GetPointerToCurrentPos_Func)MatchFinder_GetPointerToCurrentPos; -- if (!p->btMode) -- { -- vTable->GetMatches = (Mf_GetMatches_Func)Hc4_MatchFinder_GetMatches; -- vTable->Skip = (Mf_Skip_Func)Hc4_MatchFinder_Skip; -- } -- else if (p->numHashBytes == 2) -- { -- vTable->GetMatches = (Mf_GetMatches_Func)Bt2_MatchFinder_GetMatches; -- vTable->Skip = (Mf_Skip_Func)Bt2_MatchFinder_Skip; -- } -- else if (p->numHashBytes == 3) -- { -- vTable->GetMatches = (Mf_GetMatches_Func)Bt3_MatchFinder_GetMatches; -- vTable->Skip = (Mf_Skip_Func)Bt3_MatchFinder_Skip; -- } -- else -- { -- vTable->GetMatches = (Mf_GetMatches_Func)Bt4_MatchFinder_GetMatches; -- vTable->Skip = (Mf_Skip_Func)Bt4_MatchFinder_Skip; -- } -+ vTable->GetMatches = (Mf_GetMatches_Func)Bt4_MatchFinder_GetMatches; -+ vTable->Skip = (Mf_Skip_Func)Bt4_MatchFinder_Skip; - } diff --git a/target/linux/generic/pending-3.18/532-jffs2_eofdetect.patch b/target/linux/generic/pending-3.18/532-jffs2_eofdetect.patch deleted file mode 100644 index 8ce53d8bed..0000000000 --- a/target/linux/generic/pending-3.18/532-jffs2_eofdetect.patch +++ /dev/null @@ -1,56 +0,0 @@ ---- a/fs/jffs2/build.c -+++ b/fs/jffs2/build.c -@@ -116,6 +116,16 @@ static int jffs2_build_filesystem(struct - dbg_fsbuild("scanned flash completely\n"); - jffs2_dbg_dump_block_lists_nolock(c); - -+ if (c->flags & (1 << 7)) { -+ printk("%s(): unlocking the mtd device... ", __func__); -+ mtd_unlock(c->mtd, 0, c->mtd->size); -+ printk("done.\n"); -+ -+ printk("%s(): erasing all blocks after the end marker... ", __func__); -+ jffs2_erase_pending_blocks(c, -1); -+ printk("done.\n"); -+ } -+ - dbg_fsbuild("pass 1 starting\n"); - c->flags |= JFFS2_SB_FLAG_BUILDING; - /* Now scan the directory tree, increasing nlink according to every dirent found. */ ---- a/fs/jffs2/scan.c -+++ b/fs/jffs2/scan.c -@@ -148,8 +148,14 @@ int jffs2_scan_medium(struct jffs2_sb_in - /* reset summary info for next eraseblock scan */ - jffs2_sum_reset_collected(s); - -- ret = jffs2_scan_eraseblock(c, jeb, buf_size?flashbuf:(flashbuf+jeb->offset), -- buf_size, s); -+ if (c->flags & (1 << 7)) { -+ if (mtd_block_isbad(c->mtd, jeb->offset)) -+ ret = BLK_STATE_BADBLOCK; -+ else -+ ret = BLK_STATE_ALLFF; -+ } else -+ ret = jffs2_scan_eraseblock(c, jeb, buf_size?flashbuf:(flashbuf+jeb->offset), -+ buf_size, s); - - if (ret < 0) - goto out; -@@ -561,6 +567,17 @@ full_scan: - return err; - } - -+ if ((buf[0] == 0xde) && -+ (buf[1] == 0xad) && -+ (buf[2] == 0xc0) && -+ (buf[3] == 0xde)) { -+ /* end of filesystem. erase everything after this point */ -+ printk("%s(): End of filesystem marker found at 0x%x\n", __func__, jeb->offset); -+ c->flags |= (1 << 7); -+ -+ return BLK_STATE_ALLFF; -+ } -+ - /* We temporarily use 'ofs' as a pointer into the buffer/jeb */ - ofs = 0; - max_ofs = EMPTY_SCAN_SIZE(c->sector_size); diff --git a/target/linux/generic/pending-3.18/550-ubifs-symlink-xattr-support.patch b/target/linux/generic/pending-3.18/550-ubifs-symlink-xattr-support.patch deleted file mode 100644 index 6e08ca302e..0000000000 --- a/target/linux/generic/pending-3.18/550-ubifs-symlink-xattr-support.patch +++ /dev/null @@ -1,55 +0,0 @@ ---- a/fs/ubifs/file.c -+++ b/fs/ubifs/file.c -@@ -1597,6 +1597,10 @@ const struct inode_operations ubifs_syml - .follow_link = ubifs_follow_link, - .setattr = ubifs_setattr, - .getattr = ubifs_getattr, -+ .setxattr = ubifs_setxattr, -+ .getxattr = ubifs_getxattr, -+ .listxattr = ubifs_listxattr, -+ .removexattr = ubifs_removexattr, - }; - - const struct file_operations ubifs_file_operations = { ---- a/fs/ubifs/journal.c -+++ b/fs/ubifs/journal.c -@@ -572,6 +572,13 @@ int ubifs_jnl_update(struct ubifs_info * - aligned_dlen = ALIGN(dlen, 8); - aligned_ilen = ALIGN(ilen, 8); - len = aligned_dlen + aligned_ilen + UBIFS_INO_NODE_SZ; -+ if (xent) { -+ /* -+ * Make sure to account for host_ui->data_len in -+ * length calculation in case there is extended attribute. -+ */ -+ len += host_ui->data_len; -+ } - dent = kmalloc(len, GFP_NOFS); - if (!dent) - return -ENOMEM; -@@ -648,7 +655,8 @@ int ubifs_jnl_update(struct ubifs_info * - - ino_key_init(c, &ino_key, dir->i_ino); - ino_offs += aligned_ilen; -- err = ubifs_tnc_add(c, &ino_key, lnum, ino_offs, UBIFS_INO_NODE_SZ); -+ err = ubifs_tnc_add(c, &ino_key, lnum, ino_offs, -+ UBIFS_INO_NODE_SZ + host_ui->data_len); - if (err) - goto out_ro; - ---- a/fs/ubifs/xattr.c -+++ b/fs/ubifs/xattr.c -@@ -210,12 +210,12 @@ static int change_xattr(struct ubifs_inf - goto out_free; - } - inode->i_size = ui->ui_size = size; -- ui->data_len = size; - - mutex_lock(&host_ui->ui_mutex); - host->i_ctime = ubifs_current_time(host); - host_ui->xattr_size -= CALC_XATTR_BYTES(ui->data_len); - host_ui->xattr_size += CALC_XATTR_BYTES(size); -+ ui->data_len = size; - - /* - * It is important to write the host inode after the xattr inode diff --git a/target/linux/generic/pending-3.18/551-ubifs-fix-default-compression-selection.patch b/target/linux/generic/pending-3.18/551-ubifs-fix-default-compression-selection.patch deleted file mode 100644 index 1b0f30718c..0000000000 --- a/target/linux/generic/pending-3.18/551-ubifs-fix-default-compression-selection.patch +++ /dev/null @@ -1,29 +0,0 @@ ---- a/fs/ubifs/sb.c -+++ b/fs/ubifs/sb.c -@@ -63,6 +63,17 @@ - /* Default time granularity in nanoseconds */ - #define DEFAULT_TIME_GRAN 1000000000 - -+static int get_default_compressor(void) -+{ -+ if (ubifs_compr_present(UBIFS_COMPR_LZO)) -+ return UBIFS_COMPR_LZO; -+ -+ if (ubifs_compr_present(UBIFS_COMPR_ZLIB)) -+ return UBIFS_COMPR_ZLIB; -+ -+ return UBIFS_COMPR_NONE; -+} -+ - /** - * create_default_filesystem - format empty UBI volume. - * @c: UBIFS file-system description object -@@ -183,7 +194,7 @@ static int create_default_filesystem(str - if (c->mount_opts.override_compr) - sup->default_compr = cpu_to_le16(c->mount_opts.compr_type); - else -- sup->default_compr = cpu_to_le16(UBIFS_COMPR_LZO); -+ sup->default_compr = cpu_to_le16(get_default_compressor()); - - generate_random_uuid(sup->uuid); - diff --git a/target/linux/generic/pending-3.18/600-netfilter_conntrack_flush.patch b/target/linux/generic/pending-3.18/600-netfilter_conntrack_flush.patch deleted file mode 100644 index bc6ed3e5d7..0000000000 --- a/target/linux/generic/pending-3.18/600-netfilter_conntrack_flush.patch +++ /dev/null @@ -1,86 +0,0 @@ ---- a/net/netfilter/nf_conntrack_standalone.c -+++ b/net/netfilter/nf_conntrack_standalone.c -@@ -17,6 +17,7 @@ - #include - #include - #include -+#include - #include - #ifdef CONFIG_SYSCTL - #include -@@ -262,10 +263,66 @@ static int ct_open(struct inode *inode, - sizeof(struct ct_iter_state)); - } - -+struct kill_request { -+ u16 family; -+ union nf_inet_addr addr; -+}; -+ -+static int kill_matching(struct nf_conn *i, void *data) -+{ -+ struct kill_request *kr = data; -+ struct nf_conntrack_tuple *t1 = &i->tuplehash[IP_CT_DIR_ORIGINAL].tuple; -+ struct nf_conntrack_tuple *t2 = &i->tuplehash[IP_CT_DIR_REPLY].tuple; -+ -+ if (!kr->family) -+ return 1; -+ -+ if (t1->src.l3num != kr->family) -+ return 0; -+ -+ return (nf_inet_addr_cmp(&kr->addr, &t1->src.u3) || -+ nf_inet_addr_cmp(&kr->addr, &t1->dst.u3) || -+ nf_inet_addr_cmp(&kr->addr, &t2->src.u3) || -+ nf_inet_addr_cmp(&kr->addr, &t2->dst.u3)); -+} -+ -+static ssize_t ct_file_write(struct file *file, const char __user *buf, -+ size_t count, loff_t *ppos) -+{ -+ struct seq_file *seq = file->private_data; -+ struct net *net = seq_file_net(seq); -+ struct kill_request kr = { }; -+ char req[INET6_ADDRSTRLEN] = { }; -+ -+ if (count == 0) -+ return 0; -+ -+ if (count >= INET6_ADDRSTRLEN) -+ count = INET6_ADDRSTRLEN - 1; -+ -+ if (copy_from_user(req, buf, count)) -+ return -EFAULT; -+ -+ if (strnchr(req, count, ':')) { -+ kr.family = AF_INET6; -+ if (!in6_pton(req, count, (void *)&kr.addr, '\n', NULL)) -+ return -EINVAL; -+ } else if (strnchr(req, count, '.')) { -+ kr.family = AF_INET; -+ if (!in4_pton(req, count, (void *)&kr.addr, '\n', NULL)) -+ return -EINVAL; -+ } -+ -+ nf_ct_iterate_cleanup(net, kill_matching, &kr, 0, 0); -+ -+ return count; -+} -+ - static const struct file_operations ct_file_ops = { - .owner = THIS_MODULE, - .open = ct_open, - .read = seq_read, -+ .write = ct_file_write, - .llseek = seq_lseek, - .release = seq_release_net, - }; -@@ -367,7 +424,7 @@ static int nf_conntrack_standalone_init_ - { - struct proc_dir_entry *pde; - -- pde = proc_create("nf_conntrack", 0440, net->proc_net, &ct_file_ops); -+ pde = proc_create("nf_conntrack", 0660, net->proc_net, &ct_file_ops); - if (!pde) - goto out_nf_conntrack; - diff --git a/target/linux/generic/pending-3.18/610-netfilter_match_bypass_default_checks.patch b/target/linux/generic/pending-3.18/610-netfilter_match_bypass_default_checks.patch deleted file mode 100644 index b96402fd3e..0000000000 --- a/target/linux/generic/pending-3.18/610-netfilter_match_bypass_default_checks.patch +++ /dev/null @@ -1,101 +0,0 @@ ---- a/include/uapi/linux/netfilter_ipv4/ip_tables.h -+++ b/include/uapi/linux/netfilter_ipv4/ip_tables.h -@@ -87,6 +87,7 @@ struct ipt_ip { - #define IPT_F_FRAG 0x01 /* Set if rule is a fragment rule */ - #define IPT_F_GOTO 0x02 /* Set if jump is a goto */ - #define IPT_F_MASK 0x03 /* All possible flag bits mask. */ -+#define IPT_F_NO_DEF_MATCH 0x80 /* Internal: no default match rules present */ - - /* Values for "inv" field in struct ipt_ip. */ - #define IPT_INV_VIA_IN 0x01 /* Invert the sense of IN IFACE. */ ---- a/net/ipv4/netfilter/ip_tables.c -+++ b/net/ipv4/netfilter/ip_tables.c -@@ -82,6 +82,9 @@ ip_packet_match(const struct iphdr *ip, - - #define FWINV(bool, invflg) ((bool) ^ !!(ipinfo->invflags & (invflg))) - -+ if (ipinfo->flags & IPT_F_NO_DEF_MATCH) -+ return true; -+ - if (FWINV((ip->saddr&ipinfo->smsk.s_addr) != ipinfo->src.s_addr, - IPT_INV_SRCIP) || - FWINV((ip->daddr&ipinfo->dmsk.s_addr) != ipinfo->dst.s_addr, -@@ -135,6 +138,29 @@ ip_packet_match(const struct iphdr *ip, - return true; - } - -+static void -+ip_checkdefault(struct ipt_ip *ip) -+{ -+ static const char iface_mask[IFNAMSIZ] = {}; -+ -+ if (ip->invflags || ip->flags & IPT_F_FRAG) -+ return; -+ -+ if (memcmp(ip->iniface_mask, iface_mask, IFNAMSIZ) != 0) -+ return; -+ -+ if (memcmp(ip->outiface_mask, iface_mask, IFNAMSIZ) != 0) -+ return; -+ -+ if (ip->smsk.s_addr || ip->dmsk.s_addr) -+ return; -+ -+ if (ip->proto) -+ return; -+ -+ ip->flags |= IPT_F_NO_DEF_MATCH; -+} -+ - static bool - ip_checkentry(const struct ipt_ip *ip) - { -@@ -650,6 +676,8 @@ find_check_entry(struct ipt_entry *e, st - struct xt_mtchk_param mtpar; - struct xt_entry_match *ematch; - -+ ip_checkdefault(&e->ip); -+ - j = 0; - memset(&mtpar, 0, sizeof(mtpar)); - mtpar.net = net; -@@ -943,6 +971,7 @@ copy_entries_to_user(unsigned int total_ - const struct xt_table_info *private = table->private; - int ret = 0; - const void *loc_cpu_entry; -+ u8 flags; - - counters = alloc_counters(table); - if (IS_ERR(counters)) -@@ -974,6 +1003,14 @@ copy_entries_to_user(unsigned int total_ - goto free_counters; - } - -+ flags = e->ip.flags & IPT_F_MASK; -+ if (copy_to_user(userptr + off -+ + offsetof(struct ipt_entry, ip.flags), -+ &flags, sizeof(flags)) != 0) { -+ ret = -EFAULT; -+ goto free_counters; -+ } -+ - for (i = sizeof(struct ipt_entry); - i < e->target_offset; - i += m->u.match_size) { -@@ -1380,12 +1417,15 @@ compat_copy_entry_to_user(struct ipt_ent - compat_uint_t origsize; - const struct xt_entry_match *ematch; - int ret = 0; -+ u8 flags = e->ip.flags & IPT_F_MASK; - - origsize = *size; - ce = (struct compat_ipt_entry __user *)*dstptr; - if (copy_to_user(ce, e, sizeof(struct ipt_entry)) != 0 || - copy_to_user(&ce->counters, &counters[i], -- sizeof(counters[i])) != 0) -+ sizeof(counters[i])) != 0 || -+ copy_to_user(&ce->ip.flags, &flags, -+ sizeof(flags)) != 0) - return -EFAULT; - - *dstptr += sizeof(struct compat_ipt_entry); diff --git a/target/linux/generic/pending-3.18/611-netfilter_match_bypass_default_table.patch b/target/linux/generic/pending-3.18/611-netfilter_match_bypass_default_table.patch deleted file mode 100644 index ef993c864b..0000000000 --- a/target/linux/generic/pending-3.18/611-netfilter_match_bypass_default_table.patch +++ /dev/null @@ -1,94 +0,0 @@ ---- a/net/ipv4/netfilter/ip_tables.c -+++ b/net/ipv4/netfilter/ip_tables.c -@@ -310,6 +310,33 @@ struct ipt_entry *ipt_next_entry(const s - return (void *)entry + entry->next_offset; - } - -+static bool -+ipt_handle_default_rule(struct ipt_entry *e, unsigned int *verdict) -+{ -+ struct xt_entry_target *t; -+ struct xt_standard_target *st; -+ -+ if (e->target_offset != sizeof(struct ipt_entry)) -+ return false; -+ -+ if (!(e->ip.flags & IPT_F_NO_DEF_MATCH)) -+ return false; -+ -+ t = ipt_get_target(e); -+ if (t->u.kernel.target->target) -+ return false; -+ -+ st = (struct xt_standard_target *) t; -+ if (st->verdict == XT_RETURN) -+ return false; -+ -+ if (st->verdict >= 0) -+ return false; -+ -+ *verdict = (unsigned)(-st->verdict) - 1; -+ return true; -+} -+ - /* Returns one of the generic firewall policies, like NF_ACCEPT. */ - unsigned int - ipt_do_table(struct sk_buff *skb, -@@ -331,9 +358,33 @@ ipt_do_table(struct sk_buff *skb, - unsigned int addend; - - /* Initialization */ -+ IP_NF_ASSERT(table->valid_hooks & (1 << hook)); -+ local_bh_disable(); -+ private = table->private; -+ cpu = smp_processor_id(); -+ /* -+ * Ensure we load private-> members after we've fetched the base -+ * pointer. -+ */ -+ smp_read_barrier_depends(); -+ table_base = private->entries[cpu]; -+ -+ e = get_entry(table_base, private->hook_entry[hook]); -+ if (ipt_handle_default_rule(e, &verdict)) { -+ ADD_COUNTER(e->counters, skb->len, 1); -+ local_bh_enable(); -+ return verdict; -+ } -+ - ip = ip_hdr(skb); - indev = in ? in->name : nulldevname; - outdev = out ? out->name : nulldevname; -+ -+ addend = xt_write_recseq_begin(); -+ jumpstack = (struct ipt_entry **)private->jumpstack[cpu]; -+ stackptr = per_cpu_ptr(private->stackptr, cpu); -+ origptr = *stackptr; -+ - /* We handle fragments by dealing with the first fragment as - * if it was a normal packet. All other fragments are treated - * normally, except that they will NEVER match rules that ask -@@ -348,23 +399,6 @@ ipt_do_table(struct sk_buff *skb, - acpar.family = NFPROTO_IPV4; - acpar.hooknum = hook; - -- IP_NF_ASSERT(table->valid_hooks & (1 << hook)); -- local_bh_disable(); -- addend = xt_write_recseq_begin(); -- private = table->private; -- cpu = smp_processor_id(); -- /* -- * Ensure we load private-> members after we've fetched the base -- * pointer. -- */ -- smp_read_barrier_depends(); -- table_base = private->entries[cpu]; -- jumpstack = (struct ipt_entry **)private->jumpstack[cpu]; -- stackptr = per_cpu_ptr(private->stackptr, cpu); -- origptr = *stackptr; -- -- e = get_entry(table_base, private->hook_entry[hook]); -- - pr_debug("Entering %s(hook %u); sp at %u (UF %p)\n", - table->name, hook, origptr, - get_entry(table_base, private->underflow[hook])); diff --git a/target/linux/generic/pending-3.18/612-netfilter_match_reduce_memory_access.patch b/target/linux/generic/pending-3.18/612-netfilter_match_reduce_memory_access.patch deleted file mode 100644 index 72172d8bb4..0000000000 --- a/target/linux/generic/pending-3.18/612-netfilter_match_reduce_memory_access.patch +++ /dev/null @@ -1,16 +0,0 @@ ---- a/net/ipv4/netfilter/ip_tables.c -+++ b/net/ipv4/netfilter/ip_tables.c -@@ -85,9 +85,11 @@ ip_packet_match(const struct iphdr *ip, - if (ipinfo->flags & IPT_F_NO_DEF_MATCH) - return true; - -- if (FWINV((ip->saddr&ipinfo->smsk.s_addr) != ipinfo->src.s_addr, -+ if (FWINV(ipinfo->smsk.s_addr && -+ (ip->saddr&ipinfo->smsk.s_addr) != ipinfo->src.s_addr, - IPT_INV_SRCIP) || -- FWINV((ip->daddr&ipinfo->dmsk.s_addr) != ipinfo->dst.s_addr, -+ FWINV(ipinfo->dmsk.s_addr && -+ (ip->daddr&ipinfo->dmsk.s_addr) != ipinfo->dst.s_addr, - IPT_INV_DSTIP)) { - dprintf("Source or dest mismatch.\n"); - diff --git a/target/linux/generic/pending-3.18/613-netfilter_optional_tcp_window_check.patch b/target/linux/generic/pending-3.18/613-netfilter_optional_tcp_window_check.patch deleted file mode 100644 index 1d3b37cc10..0000000000 --- a/target/linux/generic/pending-3.18/613-netfilter_optional_tcp_window_check.patch +++ /dev/null @@ -1,36 +0,0 @@ ---- a/net/netfilter/nf_conntrack_proto_tcp.c -+++ b/net/netfilter/nf_conntrack_proto_tcp.c -@@ -33,6 +33,9 @@ - #include - #include - -+/* Do not check the TCP window for incoming packets */ -+static int nf_ct_tcp_no_window_check __read_mostly = 1; -+ - /* "Be conservative in what you do, - be liberal in what you accept from others." - If it's non-zero, we mark only out of window RST segments as INVALID. */ -@@ -515,6 +518,9 @@ static bool tcp_in_window(const struct n - s32 receiver_offset; - bool res, in_recv_win; - -+ if (nf_ct_tcp_no_window_check) -+ return true; -+ - /* - * Get the required data from the packet. - */ -@@ -1452,6 +1458,13 @@ static struct ctl_table tcp_sysctl_table - .mode = 0644, - .proc_handler = proc_dointvec, - }, -+ { -+ .procname = "nf_conntrack_tcp_no_window_check", -+ .data = &nf_ct_tcp_no_window_check, -+ .maxlen = sizeof(unsigned int), -+ .mode = 0644, -+ .proc_handler = proc_dointvec, -+ }, - { } - }; - diff --git a/target/linux/generic/pending-3.18/616-net_optimize_xfrm_calls.patch b/target/linux/generic/pending-3.18/616-net_optimize_xfrm_calls.patch deleted file mode 100644 index 2a64d5420a..0000000000 --- a/target/linux/generic/pending-3.18/616-net_optimize_xfrm_calls.patch +++ /dev/null @@ -1,12 +0,0 @@ ---- a/net/netfilter/nf_nat_core.c -+++ b/net/netfilter/nf_nat_core.c -@@ -90,6 +90,9 @@ int nf_xfrm_me_harder(struct sk_buff *sk - struct dst_entry *dst; - int err; - -+ if (skb->dev && !dev_net(skb->dev)->xfrm.policy_count[XFRM_POLICY_OUT]) -+ return 0; -+ - err = xfrm_decode_session(skb, &fl, family); - if (err < 0) - return err; diff --git a/target/linux/generic/pending-3.18/621-sched_act_connmark.patch b/target/linux/generic/pending-3.18/621-sched_act_connmark.patch deleted file mode 100644 index 72d8e53433..0000000000 --- a/target/linux/generic/pending-3.18/621-sched_act_connmark.patch +++ /dev/null @@ -1,161 +0,0 @@ ---- /dev/null -+++ b/net/sched/act_connmark.c -@@ -0,0 +1,126 @@ -+/* -+ * Copyright (c) 2011 Felix Fietkau -+ * -+ * 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, write to the Free Software Foundation, Inc., 59 Temple -+ * Place - Suite 330, Boston, MA 02111-1307 USA. -+ */ -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+#include -+#include -+ -+#define TCA_ACT_CONNMARK 20 -+ -+#define CONNMARK_TAB_MASK 3 -+ -+static int tcf_connmark(struct sk_buff *skb, const struct tc_action *a, -+ struct tcf_result *res) -+{ -+ struct nf_conn *c; -+ enum ip_conntrack_info ctinfo; -+ int proto; -+ int r; -+ -+ if (skb->protocol == htons(ETH_P_IP)) { -+ if (skb->len < sizeof(struct iphdr)) -+ goto out; -+ proto = PF_INET; -+ } else if (skb->protocol == htons(ETH_P_IPV6)) { -+ if (skb->len < sizeof(struct ipv6hdr)) -+ goto out; -+ proto = PF_INET6; -+ } else -+ goto out; -+ -+ r = nf_conntrack_in(dev_net(skb->dev), proto, NF_INET_PRE_ROUTING, skb); -+ if (r != NF_ACCEPT) -+ goto out; -+ -+ c = nf_ct_get(skb, &ctinfo); -+ if (!c) -+ goto out; -+ -+ skb->mark = c->mark; -+ nf_conntrack_put(skb->nfct); -+ skb->nfct = NULL; -+ -+out: -+ return TC_ACT_PIPE; -+} -+ -+static int tcf_connmark_init(struct net *net, struct nlattr *nla, -+ struct nlattr *est, struct tc_action *a, -+ int ovr, int bind) -+{ -+ int ret = 0; -+ -+ if (!tcf_hash_check(0, a, bind)) { -+ ret = tcf_hash_create(0, est, a, sizeof(struct tcf_common), bind); -+ if (ret) -+ return ret; -+ -+ tcf_hash_insert(a); -+ ret = ACT_P_CREATED; -+ } else { -+ if (!ovr) { -+ tcf_hash_release(a, bind); -+ return -EEXIST; -+ } -+ } -+ -+ return ret; -+} -+ -+static inline int tcf_connmark_dump(struct sk_buff *skb, struct tc_action *a, -+ int bind, int ref) -+{ -+ return skb->len; -+} -+ -+static struct tc_action_ops act_connmark_ops = { -+ .kind = "connmark", -+ .type = TCA_ACT_CONNMARK, -+ .owner = THIS_MODULE, -+ .act = tcf_connmark, -+ .dump = tcf_connmark_dump, -+ .init = tcf_connmark_init, -+}; -+ -+MODULE_AUTHOR("Felix Fietkau "); -+MODULE_DESCRIPTION("Connection tracking mark restoring"); -+MODULE_LICENSE("GPL"); -+ -+static int __init connmark_init_module(void) -+{ -+ -+ return tcf_register_action(&act_connmark_ops, CONNMARK_TAB_MASK); -+} -+ -+static void __exit connmark_cleanup_module(void) -+{ -+ tcf_unregister_action(&act_connmark_ops); -+} -+ -+module_init(connmark_init_module); -+module_exit(connmark_cleanup_module); ---- a/net/sched/Kconfig -+++ b/net/sched/Kconfig -@@ -686,6 +686,19 @@ config NET_ACT_CSUM - To compile this code as a module, choose M here: the - module will be called act_csum. - -+config NET_ACT_CONNMARK -+ tristate "Connection Tracking Marking" -+ depends on NET_CLS_ACT -+ depends on NF_CONNTRACK -+ depends on NF_CONNTRACK_MARK -+ ---help--- -+ Say Y here to restore the connmark from a scheduler action -+ -+ If unsure, say N. -+ -+ To compile this code as a module, choose M here: the -+ module will be called act_connmark. -+ - config NET_CLS_IND - bool "Incoming device classification" - depends on NET_CLS_U32 || NET_CLS_FW ---- a/net/sched/Makefile -+++ b/net/sched/Makefile -@@ -16,6 +16,7 @@ obj-$(CONFIG_NET_ACT_PEDIT) += act_pedit - obj-$(CONFIG_NET_ACT_SIMP) += act_simple.o - obj-$(CONFIG_NET_ACT_SKBEDIT) += act_skbedit.o - obj-$(CONFIG_NET_ACT_CSUM) += act_csum.o -+obj-$(CONFIG_NET_ACT_CONNMARK) += act_connmark.o - obj-$(CONFIG_NET_SCH_FIFO) += sch_fifo.o - obj-$(CONFIG_NET_SCH_CBQ) += sch_cbq.o - obj-$(CONFIG_NET_SCH_HTB) += sch_htb.o diff --git a/target/linux/generic/pending-3.18/630-packet_socket_type.patch b/target/linux/generic/pending-3.18/630-packet_socket_type.patch deleted file mode 100644 index 21f3732167..0000000000 --- a/target/linux/generic/pending-3.18/630-packet_socket_type.patch +++ /dev/null @@ -1,134 +0,0 @@ -This patch allows the user to specify desired packet types (outgoing, -broadcast, unicast, etc.) on packet sockets via setsockopt. -This can reduce the load in situations where only a limited number -of packet types are necessary - -Signed-off-by: Felix Fietkau - ---- a/include/uapi/linux/if_packet.h -+++ b/include/uapi/linux/if_packet.h -@@ -31,6 +31,8 @@ struct sockaddr_ll { - #define PACKET_KERNEL 7 /* To kernel space */ - /* Unused, PACKET_FASTROUTE and PACKET_LOOPBACK are invisible to user space */ - #define PACKET_FASTROUTE 6 /* Fastrouted frame */ -+#define PACKET_MASK_ANY 0xffffffff /* mask for packet type bits */ -+ - - /* Packet socket options */ - -@@ -54,6 +56,7 @@ struct sockaddr_ll { - #define PACKET_FANOUT 18 - #define PACKET_TX_HAS_OFF 19 - #define PACKET_QDISC_BYPASS 20 -+#define PACKET_RECV_TYPE 21 - - #define PACKET_FANOUT_HASH 0 - #define PACKET_FANOUT_LB 1 ---- a/net/packet/af_packet.c -+++ b/net/packet/af_packet.c -@@ -1551,6 +1551,7 @@ static int packet_rcv_spkt(struct sk_buf - { - struct sock *sk; - struct sockaddr_pkt *spkt; -+ struct packet_sock *po; - - /* - * When we registered the protocol we saved the socket in the data -@@ -1558,6 +1559,7 @@ static int packet_rcv_spkt(struct sk_buf - */ - - sk = pt->af_packet_priv; -+ po = pkt_sk(sk); - - /* - * Yank back the headers [hope the device set this -@@ -1570,7 +1572,7 @@ static int packet_rcv_spkt(struct sk_buf - * so that this procedure is noop. - */ - -- if (skb->pkt_type == PACKET_LOOPBACK) -+ if (!(po->pkt_type & (1 << skb->pkt_type))) - goto out; - - if (!net_eq(dev_net(dev), sock_net(sk))) -@@ -1769,12 +1771,12 @@ static int packet_rcv(struct sk_buff *sk - int skb_len = skb->len; - unsigned int snaplen, res; - -- if (skb->pkt_type == PACKET_LOOPBACK) -- goto drop; -- - sk = pt->af_packet_priv; - po = pkt_sk(sk); - -+ if (!(po->pkt_type & (1 << skb->pkt_type))) -+ goto drop; -+ - if (!net_eq(dev_net(dev), sock_net(sk))) - goto drop; - -@@ -1894,12 +1896,12 @@ static int tpacket_rcv(struct sk_buff *s - BUILD_BUG_ON(TPACKET_ALIGN(sizeof(*h.h2)) != 32); - BUILD_BUG_ON(TPACKET_ALIGN(sizeof(*h.h3)) != 48); - -- if (skb->pkt_type == PACKET_LOOPBACK) -- goto drop; -- - sk = pt->af_packet_priv; - po = pkt_sk(sk); - -+ if (!(po->pkt_type & (1 << skb->pkt_type))) -+ goto drop; -+ - if (!net_eq(dev_net(dev), sock_net(sk))) - goto drop; - -@@ -2866,6 +2868,7 @@ static int packet_create(struct net *net - spin_lock_init(&po->bind_lock); - mutex_init(&po->pg_vec_lock); - po->prot_hook.func = packet_rcv; -+ po->pkt_type = PACKET_MASK_ANY & ~(1 << PACKET_LOOPBACK); - - if (sock->type == SOCK_PACKET) - po->prot_hook.func = packet_rcv_spkt; -@@ -3489,6 +3492,16 @@ packet_setsockopt(struct socket *sock, i - po->xmit = val ? packet_direct_xmit : dev_queue_xmit; - return 0; - } -+ case PACKET_RECV_TYPE: -+ { -+ unsigned int val; -+ if (optlen != sizeof(val)) -+ return -EINVAL; -+ if (copy_from_user(&val, optval, sizeof(val))) -+ return -EFAULT; -+ po->pkt_type = val & ~BIT(PACKET_LOOPBACK); -+ return 0; -+ } - default: - return -ENOPROTOOPT; - } -@@ -3540,6 +3553,13 @@ static int packet_getsockopt(struct sock - case PACKET_VNET_HDR: - val = po->has_vnet_hdr; - break; -+ case PACKET_RECV_TYPE: -+ if (len > sizeof(unsigned int)) -+ len = sizeof(unsigned int); -+ val = po->pkt_type; -+ -+ data = &val; -+ break; - case PACKET_VERSION: - val = po->tp_version; - break; ---- a/net/packet/internal.h -+++ b/net/packet/internal.h -@@ -117,6 +117,7 @@ struct packet_sock { - struct net_device __rcu *cached_dev; - int (*xmit)(struct sk_buff *skb); - struct packet_type prot_hook ____cacheline_aligned_in_smp; -+ unsigned int pkt_type; - }; - - static struct packet_sock *pkt_sk(struct sock *sk) diff --git a/target/linux/generic/pending-3.18/640-bridge_no_eap_forward.patch b/target/linux/generic/pending-3.18/640-bridge_no_eap_forward.patch deleted file mode 100644 index 35802d63dc..0000000000 --- a/target/linux/generic/pending-3.18/640-bridge_no_eap_forward.patch +++ /dev/null @@ -1,23 +0,0 @@ -From: Felix Fietkau -Subject: [PATCH] bridge: no EAP forward - -When bridging, do not forward EAP frames to other ports, only deliver -them locally. -Fixes WPA authentication issues with multiples APs that are connected to -each other via bridges. ---- ---- a/net/bridge/br_input.c -+++ b/net/bridge/br_input.c -@@ -97,7 +97,11 @@ int br_handle_frame_finish(struct sk_buf - - dst = NULL; - -- if (is_broadcast_ether_addr(dest)) { -+ if (skb->protocol == htons(ETH_P_PAE)) { -+ skb2 = skb; -+ /* Do not forward 802.1x/EAP frames */ -+ skb = NULL; -+ } else if (is_broadcast_ether_addr(dest)) { - skb2 = skb; - unicast = false; - } else if (is_multicast_ether_addr(dest)) { diff --git a/target/linux/generic/pending-3.18/641-bridge_always_accept_eap.patch b/target/linux/generic/pending-3.18/641-bridge_always_accept_eap.patch deleted file mode 100644 index a822fb0dc9..0000000000 --- a/target/linux/generic/pending-3.18/641-bridge_always_accept_eap.patch +++ /dev/null @@ -1,17 +0,0 @@ -From: Felix Fietkau -Subject: [PATCH] bridge: always accept EAP - -Allow EAP frames to pass through bridges even in learning state. Fixes -issues with WDS. ---- ---- a/net/bridge/br_input.c -+++ b/net/bridge/br_input.c -@@ -84,7 +84,7 @@ int br_handle_frame_finish(struct sk_buf - br_multicast_rcv(br, p, skb, vid)) - goto drop; - -- if (p->state == BR_STATE_LEARNING) -+ if ((p->state == BR_STATE_LEARNING) && skb->protocol != htons(ETH_P_PAE)) - goto drop; - - BR_INPUT_SKB_CB(skb)->brdev = br->dev; diff --git a/target/linux/generic/pending-3.18/642-bridge_port_isolate.patch b/target/linux/generic/pending-3.18/642-bridge_port_isolate.patch deleted file mode 100644 index 47f8eb160b..0000000000 --- a/target/linux/generic/pending-3.18/642-bridge_port_isolate.patch +++ /dev/null @@ -1,92 +0,0 @@ -From: Felix Fietkau -Subject: [PATCH] bridge: port isolate - -Isolating individual bridge ports ---- ---- a/net/bridge/br_private.h -+++ b/net/bridge/br_private.h -@@ -172,6 +172,7 @@ struct net_bridge_port - #define BR_FLOOD 0x00000040 - #define BR_AUTO_MASK (BR_FLOOD | BR_LEARNING) - #define BR_PROMISC 0x00000080 -+#define BR_ISOLATE_MODE 0x00000100 - - #ifdef CONFIG_BRIDGE_IGMP_SNOOPING - struct bridge_mcast_own_query ip4_own_query; ---- a/net/bridge/br_sysfs_if.c -+++ b/net/bridge/br_sysfs_if.c -@@ -170,6 +170,7 @@ BRPORT_ATTR_FLAG(bpdu_guard, BR_BPDU_GUA - BRPORT_ATTR_FLAG(root_block, BR_ROOT_BLOCK); - BRPORT_ATTR_FLAG(learning, BR_LEARNING); - BRPORT_ATTR_FLAG(unicast_flood, BR_FLOOD); -+BRPORT_ATTR_FLAG(isolated, BR_ISOLATE_MODE); - - #ifdef CONFIG_BRIDGE_IGMP_SNOOPING - static ssize_t show_multicast_router(struct net_bridge_port *p, char *buf) -@@ -213,6 +214,7 @@ static const struct brport_attribute *br - &brport_attr_multicast_router, - &brport_attr_multicast_fast_leave, - #endif -+ &brport_attr_isolated, - NULL - }; - ---- a/net/bridge/br_input.c -+++ b/net/bridge/br_input.c -@@ -120,8 +120,8 @@ int br_handle_frame_finish(struct sk_buf - - unicast = false; - br->dev->stats.multicast++; -- } else if ((dst = __br_fdb_get(br, dest, vid)) && -- dst->is_local) { -+ } else if ((p->flags & BR_ISOLATE_MODE) || -+ ((dst = __br_fdb_get(br, dest, vid)) && dst->is_local)) { - skb2 = skb; - /* Do not forward the packet since it's local. */ - skb = NULL; ---- a/net/bridge/br_forward.c -+++ b/net/bridge/br_forward.c -@@ -117,7 +117,7 @@ EXPORT_SYMBOL_GPL(br_deliver); - /* called with rcu_read_lock */ - void br_forward(const struct net_bridge_port *to, struct sk_buff *skb, struct sk_buff *skb0) - { -- if (should_deliver(to, skb)) { -+ if (should_deliver(to, skb) && !(to->flags & BR_ISOLATE_MODE)) { - if (skb0) - deliver_clone(to, skb, __br_forward); - else -@@ -173,7 +173,7 @@ static void br_flood(struct net_bridge * - struct sk_buff *skb0, - void (*__packet_hook)(const struct net_bridge_port *p, - struct sk_buff *skb), -- bool unicast) -+ bool unicast, bool forward) - { - struct net_bridge_port *p; - struct net_bridge_port *prev; -@@ -181,6 +181,8 @@ static void br_flood(struct net_bridge * - prev = NULL; - - list_for_each_entry_rcu(p, &br->port_list, list) { -+ if (forward && (p->flags & BR_ISOLATE_MODE)) -+ continue; - /* Do not flood unicast traffic to ports that turn it off */ - if (unicast && !(p->flags & BR_FLOOD)) - continue; -@@ -207,14 +209,14 @@ out: - /* called with rcu_read_lock */ - void br_flood_deliver(struct net_bridge *br, struct sk_buff *skb, bool unicast) - { -- br_flood(br, skb, NULL, __br_deliver, unicast); -+ br_flood(br, skb, NULL, __br_deliver, unicast, false); - } - - /* called under bridge lock */ - void br_flood_forward(struct net_bridge *br, struct sk_buff *skb, - struct sk_buff *skb2, bool unicast) - { -- br_flood(br, skb, skb2, __br_forward, unicast); -+ br_flood(br, skb, skb2, __br_forward, unicast, true); - } - - #ifdef CONFIG_BRIDGE_IGMP_SNOOPING diff --git a/target/linux/generic/pending-3.18/645-bridge_multicast_to_unicast.patch b/target/linux/generic/pending-3.18/645-bridge_multicast_to_unicast.patch deleted file mode 100644 index 642cf03d33..0000000000 --- a/target/linux/generic/pending-3.18/645-bridge_multicast_to_unicast.patch +++ /dev/null @@ -1,390 +0,0 @@ -From: Felix Fietkau -Subject: [PATCH] bridge: multicast to unicast - -Implement optinal multicast->unicast conversion for igmp snooping ---- ---- a/net/bridge/br_multicast.c -+++ b/net/bridge/br_multicast.c -@@ -635,7 +635,8 @@ struct net_bridge_port_group *br_multica - struct net_bridge_port *port, - struct br_ip *group, - struct net_bridge_port_group __rcu *next, -- unsigned char state) -+ unsigned char state, -+ const unsigned char *src) - { - struct net_bridge_port_group *p; - -@@ -650,12 +651,33 @@ struct net_bridge_port_group *br_multica - hlist_add_head(&p->mglist, &port->mglist); - setup_timer(&p->timer, br_multicast_port_group_expired, - (unsigned long)p); -+ if ((port->flags & BR_MULTICAST_TO_UCAST) && src) { -+ memcpy(p->eth_addr, src, ETH_ALEN); -+ p->unicast = true; -+ } - return p; - } - -+static bool br_port_group_equal(struct net_bridge_port_group *p, -+ struct net_bridge_port *port, -+ const unsigned char *src) -+{ -+ if (p->port != port) -+ return false; -+ -+ if (!p->unicast) -+ return true; -+ -+ if (!src) -+ return false; -+ -+ return ether_addr_equal(src, p->eth_addr); -+} -+ - static int br_multicast_add_group(struct net_bridge *br, - struct net_bridge_port *port, -- struct br_ip *group) -+ struct br_ip *group, -+ const unsigned char *src) - { - struct net_bridge_mdb_entry *mp; - struct net_bridge_port_group *p; -@@ -682,13 +704,13 @@ static int br_multicast_add_group(struct - for (pp = &mp->ports; - (p = mlock_dereference(*pp, br)) != NULL; - pp = &p->next) { -- if (p->port == port) -+ if (br_port_group_equal(p, port, src)) - goto found; - if ((unsigned long)p->port < (unsigned long)port) - break; - } - -- p = br_multicast_new_port_group(port, group, *pp, MDB_TEMPORARY); -+ p = br_multicast_new_port_group(port, group, *pp, MDB_TEMPORARY, src); - if (unlikely(!p)) - goto err; - rcu_assign_pointer(*pp, p); -@@ -707,7 +729,7 @@ err: - static int br_ip4_multicast_add_group(struct net_bridge *br, - struct net_bridge_port *port, - __be32 group, -- __u16 vid) -+ __u16 vid, const unsigned char *src) - { - struct br_ip br_group; - -@@ -718,14 +740,14 @@ static int br_ip4_multicast_add_group(st - br_group.proto = htons(ETH_P_IP); - br_group.vid = vid; - -- return br_multicast_add_group(br, port, &br_group); -+ return br_multicast_add_group(br, port, &br_group, src); - } - - #if IS_ENABLED(CONFIG_IPV6) - static int br_ip6_multicast_add_group(struct net_bridge *br, - struct net_bridge_port *port, - const struct in6_addr *group, -- __u16 vid) -+ __u16 vid, const unsigned char *src) - { - struct br_ip br_group; - -@@ -736,7 +758,7 @@ static int br_ip6_multicast_add_group(st - br_group.proto = htons(ETH_P_IPV6); - br_group.vid = vid; - -- return br_multicast_add_group(br, port, &br_group); -+ return br_multicast_add_group(br, port, &br_group, src); - } - #endif - -@@ -965,6 +987,7 @@ static int br_ip4_multicast_igmp3_report - struct sk_buff *skb, - u16 vid) - { -+ const unsigned char *src; - struct igmpv3_report *ih; - struct igmpv3_grec *grec; - int i; -@@ -1008,7 +1031,8 @@ static int br_ip4_multicast_igmp3_report - continue; - } - -- err = br_ip4_multicast_add_group(br, port, group, vid); -+ src = eth_hdr(skb)->h_source; -+ err = br_ip4_multicast_add_group(br, port, group, vid, src); - if (err) - break; - } -@@ -1022,6 +1046,7 @@ static int br_ip6_multicast_mld2_report( - struct sk_buff *skb, - u16 vid) - { -+ const unsigned char *src; - struct icmp6hdr *icmp6h; - struct mld2_grec *grec; - int i; -@@ -1069,8 +1094,9 @@ static int br_ip6_multicast_mld2_report( - continue; - } - -+ src = eth_hdr(skb)->h_source; - err = br_ip6_multicast_add_group(br, port, &grec->grec_mca, -- vid); -+ vid, src); - if (err) - break; - } -@@ -1406,7 +1432,8 @@ br_multicast_leave_group(struct net_brid - struct net_bridge_port *port, - struct br_ip *group, - struct bridge_mcast_other_query *other_query, -- struct bridge_mcast_own_query *own_query) -+ struct bridge_mcast_own_query *own_query, -+ const unsigned char *src) - { - struct net_bridge_mdb_htable *mdb; - struct net_bridge_mdb_entry *mp; -@@ -1456,7 +1483,7 @@ br_multicast_leave_group(struct net_brid - for (pp = &mp->ports; - (p = mlock_dereference(*pp, br)) != NULL; - pp = &p->next) { -- if (p->port != port) -+ if (!br_port_group_equal(p, port, src)) - continue; - - rcu_assign_pointer(*pp, p->next); -@@ -1490,7 +1517,7 @@ br_multicast_leave_group(struct net_brid - for (p = mlock_dereference(mp->ports, br); - p != NULL; - p = mlock_dereference(p->next, br)) { -- if (p->port != port) -+ if (!br_port_group_equal(p, port, src)) - continue; - - if (!hlist_unhashed(&p->mglist) && -@@ -1508,8 +1535,8 @@ out: - - static void br_ip4_multicast_leave_group(struct net_bridge *br, - struct net_bridge_port *port, -- __be32 group, -- __u16 vid) -+ __be32 group, __u16 vid, -+ const unsigned char *src) - { - struct br_ip br_group; - struct bridge_mcast_own_query *own_query; -@@ -1524,14 +1551,14 @@ static void br_ip4_multicast_leave_group - br_group.vid = vid; - - br_multicast_leave_group(br, port, &br_group, &br->ip4_other_query, -- own_query); -+ own_query, src); - } - - #if IS_ENABLED(CONFIG_IPV6) - static void br_ip6_multicast_leave_group(struct net_bridge *br, - struct net_bridge_port *port, - const struct in6_addr *group, -- __u16 vid) -+ __u16 vid, const unsigned char *src) - { - struct br_ip br_group; - struct bridge_mcast_own_query *own_query; -@@ -1546,7 +1573,7 @@ static void br_ip6_multicast_leave_group - br_group.vid = vid; - - br_multicast_leave_group(br, port, &br_group, &br->ip6_other_query, -- own_query); -+ own_query, src); - } - #endif - -@@ -1555,6 +1582,7 @@ static int br_multicast_ipv4_rcv(struct - struct sk_buff *skb, - u16 vid) - { -+ const unsigned char *src; - struct sk_buff *skb2 = skb; - const struct iphdr *iph; - struct igmphdr *ih; -@@ -1628,7 +1656,8 @@ static int br_multicast_ipv4_rcv(struct - case IGMP_HOST_MEMBERSHIP_REPORT: - case IGMPV2_HOST_MEMBERSHIP_REPORT: - BR_INPUT_SKB_CB(skb)->mrouters_only = 1; -- err = br_ip4_multicast_add_group(br, port, ih->group, vid); -+ src = eth_hdr(skb)->h_source; -+ err = br_ip4_multicast_add_group(br, port, ih->group, vid, src); - break; - case IGMPV3_HOST_MEMBERSHIP_REPORT: - err = br_ip4_multicast_igmp3_report(br, port, skb2, vid); -@@ -1637,7 +1666,8 @@ static int br_multicast_ipv4_rcv(struct - err = br_ip4_multicast_query(br, port, skb2, vid); - break; - case IGMP_HOST_LEAVE_MESSAGE: -- br_ip4_multicast_leave_group(br, port, ih->group, vid); -+ src = eth_hdr(skb)->h_source; -+ br_ip4_multicast_leave_group(br, port, ih->group, vid, src); - break; - } - -@@ -1655,6 +1685,7 @@ static int br_multicast_ipv6_rcv(struct - struct sk_buff *skb, - u16 vid) - { -+ const unsigned char *src; - struct sk_buff *skb2; - const struct ipv6hdr *ip6h; - u8 icmp6_type; -@@ -1764,7 +1795,9 @@ static int br_multicast_ipv6_rcv(struct - } - mld = (struct mld_msg *)skb_transport_header(skb2); - BR_INPUT_SKB_CB(skb)->mrouters_only = 1; -- err = br_ip6_multicast_add_group(br, port, &mld->mld_mca, vid); -+ src = eth_hdr(skb)->h_source; -+ err = br_ip6_multicast_add_group(br, port, &mld->mld_mca, vid, -+ src); - break; - } - case ICMPV6_MLD2_REPORT: -@@ -1781,7 +1814,8 @@ static int br_multicast_ipv6_rcv(struct - goto out; - } - mld = (struct mld_msg *)skb_transport_header(skb2); -- br_ip6_multicast_leave_group(br, port, &mld->mld_mca, vid); -+ src = eth_hdr(skb)->h_source; -+ br_ip6_multicast_leave_group(br, port, &mld->mld_mca, vid, src); - } - } - ---- a/net/bridge/br_private.h -+++ b/net/bridge/br_private.h -@@ -112,6 +112,9 @@ struct net_bridge_port_group { - struct timer_list timer; - struct br_ip addr; - unsigned char state; -+ -+ unsigned char eth_addr[ETH_ALEN]; -+ bool unicast; - }; - - struct net_bridge_mdb_entry -@@ -173,6 +176,7 @@ struct net_bridge_port - #define BR_AUTO_MASK (BR_FLOOD | BR_LEARNING) - #define BR_PROMISC 0x00000080 - #define BR_ISOLATE_MODE 0x00000100 -+#define BR_MULTICAST_TO_UCAST 0x00000200 - - #ifdef CONFIG_BRIDGE_IGMP_SNOOPING - struct bridge_mcast_own_query ip4_own_query; -@@ -485,7 +489,8 @@ void br_multicast_free_pg(struct rcu_hea - struct net_bridge_port_group * - br_multicast_new_port_group(struct net_bridge_port *port, struct br_ip *group, - struct net_bridge_port_group __rcu *next, -- unsigned char state); -+ unsigned char state, -+ const unsigned char *src); - void br_mdb_init(void); - void br_mdb_uninit(void); - void br_mdb_notify(struct net_device *dev, struct net_bridge_port *port, ---- a/net/bridge/br_mdb.c -+++ b/net/bridge/br_mdb.c -@@ -342,7 +342,7 @@ static int br_mdb_add_group(struct net_b - break; - } - -- p = br_multicast_new_port_group(port, group, *pp, state); -+ p = br_multicast_new_port_group(port, group, *pp, state, NULL); - if (unlikely(!p)) - return -ENOMEM; - rcu_assign_pointer(*pp, p); ---- a/net/bridge/br_forward.c -+++ b/net/bridge/br_forward.c -@@ -168,6 +168,34 @@ out: - return p; - } - -+static struct net_bridge_port *maybe_deliver_addr( -+ struct net_bridge_port *prev, struct net_bridge_port *p, -+ struct sk_buff *skb, const unsigned char *addr, -+ void (*__packet_hook)(const struct net_bridge_port *p, -+ struct sk_buff *skb)) -+{ -+ struct net_device *dev = BR_INPUT_SKB_CB(skb)->brdev; -+ const unsigned char *src = eth_hdr(skb)->h_source; -+ -+ if (!should_deliver(p, skb)) -+ return prev; -+ -+ /* Even with hairpin, no soliloquies - prevent breaking IPv6 DAD */ -+ if (skb->dev == p->dev && ether_addr_equal(src, addr)) -+ return prev; -+ -+ skb = skb_copy(skb, GFP_ATOMIC); -+ if (!skb) { -+ dev->stats.tx_dropped++; -+ return prev; -+ } -+ -+ memcpy(eth_hdr(skb)->h_dest, addr, ETH_ALEN); -+ __packet_hook(p, skb); -+ -+ return prev; -+} -+ - /* called under bridge lock */ - static void br_flood(struct net_bridge *br, struct sk_buff *skb, - struct sk_buff *skb0, -@@ -232,6 +260,7 @@ static void br_multicast_flood(struct ne - struct net_bridge_port *prev = NULL; - struct net_bridge_port_group *p; - struct hlist_node *rp; -+ const unsigned char *addr; - - rp = rcu_dereference(hlist_first_rcu(&br->router_list)); - p = mdst ? rcu_dereference(mdst->ports) : NULL; -@@ -242,10 +271,19 @@ static void br_multicast_flood(struct ne - rport = rp ? hlist_entry(rp, struct net_bridge_port, rlist) : - NULL; - -- port = (unsigned long)lport > (unsigned long)rport ? -- lport : rport; -- -- prev = maybe_deliver(prev, port, skb, __packet_hook); -+ if ((unsigned long)lport > (unsigned long)rport) { -+ port = lport; -+ addr = p->unicast ? p->eth_addr : NULL; -+ } else { -+ port = rport; -+ addr = NULL; -+ } -+ -+ if (addr) -+ prev = maybe_deliver_addr(prev, port, skb, addr, -+ __packet_hook); -+ else -+ prev = maybe_deliver(prev, port, skb, __packet_hook); - if (IS_ERR(prev)) - goto out; - ---- a/net/bridge/br_sysfs_if.c -+++ b/net/bridge/br_sysfs_if.c -@@ -187,6 +187,7 @@ static BRPORT_ATTR(multicast_router, S_I - store_multicast_router); - - BRPORT_ATTR_FLAG(multicast_fast_leave, BR_MULTICAST_FAST_LEAVE); -+BRPORT_ATTR_FLAG(multicast_to_unicast, BR_MULTICAST_TO_UCAST); - #endif - - static const struct brport_attribute *brport_attrs[] = { -@@ -213,6 +214,7 @@ static const struct brport_attribute *br - #ifdef CONFIG_BRIDGE_IGMP_SNOOPING - &brport_attr_multicast_router, - &brport_attr_multicast_fast_leave, -+ &brport_attr_multicast_to_unicast, - #endif - &brport_attr_isolated, - NULL diff --git a/target/linux/generic/pending-3.18/650-pppoe_header_pad.patch b/target/linux/generic/pending-3.18/650-pppoe_header_pad.patch deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/target/linux/generic/pending-3.18/651-wireless_mesh_header.patch b/target/linux/generic/pending-3.18/651-wireless_mesh_header.patch deleted file mode 100644 index 16da5cd66f..0000000000 --- a/target/linux/generic/pending-3.18/651-wireless_mesh_header.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/include/linux/netdevice.h -+++ b/include/linux/netdevice.h -@@ -130,7 +130,7 @@ static inline bool dev_xmit_complete(int - */ - - #if defined(CONFIG_WLAN) || IS_ENABLED(CONFIG_AX25) --# if defined(CONFIG_MAC80211_MESH) -+# if 1 || defined(CONFIG_MAC80211_MESH) - # define LL_MAX_HEADER 128 - # else - # define LL_MAX_HEADER 96 diff --git a/target/linux/generic/pending-3.18/653-disable_netlink_trim.patch b/target/linux/generic/pending-3.18/653-disable_netlink_trim.patch deleted file mode 100644 index ebe5da4ec0..0000000000 --- a/target/linux/generic/pending-3.18/653-disable_netlink_trim.patch +++ /dev/null @@ -1,26 +0,0 @@ ---- a/net/netlink/af_netlink.c -+++ b/net/netlink/af_netlink.c -@@ -1154,23 +1154,7 @@ void netlink_detachskb(struct sock *sk, - - static struct sk_buff *netlink_trim(struct sk_buff *skb, gfp_t allocation) - { -- int delta; -- - WARN_ON(skb->sk != NULL); -- delta = skb->end - skb->tail; -- if (is_vmalloc_addr(skb->head) || delta * 2 < skb->truesize) -- return skb; -- -- if (skb_shared(skb)) { -- struct sk_buff *nskb = skb_clone(skb, allocation); -- if (!nskb) -- return skb; -- consume_skb(skb); -- skb = nskb; -- } -- -- if (!pskb_expand_head(skb, 0, -delta, allocation)) -- skb->truesize -= delta; - - return skb; - } diff --git a/target/linux/generic/pending-3.18/655-increase_skb_pad.patch b/target/linux/generic/pending-3.18/655-increase_skb_pad.patch deleted file mode 100644 index 96f81e9aa7..0000000000 --- a/target/linux/generic/pending-3.18/655-increase_skb_pad.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/include/linux/skbuff.h -+++ b/include/linux/skbuff.h -@@ -2024,7 +2024,7 @@ static inline int pskb_network_may_pull( - * NET_IP_ALIGN(2) + ethernet_header(14) + IP_header(20/40) + ports(8) - */ - #ifndef NET_SKB_PAD --#define NET_SKB_PAD max(32, L1_CACHE_BYTES) -+#define NET_SKB_PAD max(64, L1_CACHE_BYTES) - #endif - - int ___pskb_trim(struct sk_buff *skb, unsigned int len); diff --git a/target/linux/generic/pending-3.18/656-skb_reduce_truesize-helper.patch b/target/linux/generic/pending-3.18/656-skb_reduce_truesize-helper.patch deleted file mode 100644 index 0fde9f6e62..0000000000 --- a/target/linux/generic/pending-3.18/656-skb_reduce_truesize-helper.patch +++ /dev/null @@ -1,41 +0,0 @@ -From 4593a806e31119c5bd3faa00c7210ad862d515af Mon Sep 17 00:00:00 2001 -From: Dave Taht -Date: Mon, 31 Dec 2012 10:02:21 -0800 -Subject: [PATCH 3/7] skb_reduce_truesize: helper function for shrinking skbs - whenever needed - -On embedded devices in particular, large queues of small packets from the rx -path with a large truesize can exist. Reducing their size can reduce -memory pressure. skb_reduce_truesize is a helper function for doing this, -when needed. ---- - include/linux/skbuff.h | 18 ++++++++++++++++++ - 1 file changed, 18 insertions(+) - ---- a/include/linux/skbuff.h -+++ b/include/linux/skbuff.h -@@ -2069,6 +2069,24 @@ static inline void pskb_trim_unique(stru - BUG_ON(err); - } - -+/* -+ * Caller wants to reduce memory needs before queueing skb -+ * The (expensive) copy should not be be done in fast path. -+ */ -+static inline struct sk_buff *skb_reduce_truesize(struct sk_buff *skb) -+{ -+ if (skb->truesize > 2 * SKB_TRUESIZE(skb->len)) { -+ struct sk_buff *nskb; -+ nskb = skb_copy_expand(skb, skb_headroom(skb), 0, -+ GFP_ATOMIC | __GFP_NOWARN); -+ if (nskb) { -+ __kfree_skb(skb); -+ skb = nskb; -+ } -+ } -+ return skb; -+} -+ - /** - * skb_orphan - orphan a buffer - * @skb: buffer to orphan diff --git a/target/linux/generic/pending-3.18/657-qdisc_reduce_truesize.patch b/target/linux/generic/pending-3.18/657-qdisc_reduce_truesize.patch deleted file mode 100644 index 410e0b763d..0000000000 --- a/target/linux/generic/pending-3.18/657-qdisc_reduce_truesize.patch +++ /dev/null @@ -1,63 +0,0 @@ -From bc9fec2f87d57bdbff30d296605e24504513f65c Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Dave=20T=C3=A4ht?= -Date: Mon, 17 Sep 2012 19:20:22 -0700 -Subject: [PATCH 4/7] net: add skb_reduce_truesize support to common qdiscs - -Reduce skb size under load when queues begin to fill on the -commont qdiscs. ---- - net/sched/sch_codel.c | 2 ++ - net/sched/sch_fifo.c | 12 ++++++++---- - net/sched/sch_fq_codel.c | 2 ++ - 3 files changed, 12 insertions(+), 4 deletions(-) - ---- a/net/sched/sch_codel.c -+++ b/net/sched/sch_codel.c -@@ -97,6 +97,8 @@ static int codel_qdisc_enqueue(struct sk - struct codel_sched_data *q; - - if (likely(qdisc_qlen(sch) < sch->limit)) { -+ if(qdisc_qlen(sch) > 128) -+ skb = skb_reduce_truesize(skb); - codel_set_enqueue_time(skb); - return qdisc_enqueue_tail(skb, sch); - } ---- a/net/sched/sch_fifo.c -+++ b/net/sched/sch_fifo.c -@@ -29,17 +29,21 @@ static int bfifo_enqueue(struct sk_buff - - static int pfifo_enqueue(struct sk_buff *skb, struct Qdisc *sch) - { -- if (likely(skb_queue_len(&sch->q) < sch->limit)) -+ if (likely(skb_queue_len(&sch->q) < sch->limit)) { -+ if (skb_queue_len(&sch->q) > 128) -+ skb = skb_reduce_truesize(skb); - return qdisc_enqueue_tail(skb, sch); -- -+ } - return qdisc_reshape_fail(skb, sch); - } - - static int pfifo_tail_enqueue(struct sk_buff *skb, struct Qdisc *sch) - { -- if (likely(skb_queue_len(&sch->q) < sch->limit)) -+ if (likely(skb_queue_len(&sch->q) < sch->limit)) { -+ if (skb_queue_len(&sch->q) > 128) -+ skb = skb_reduce_truesize(skb); - return qdisc_enqueue_tail(skb, sch); -- -+ } - /* queue full, remove one skb to fulfill the limit */ - __qdisc_queue_drop_head(sch, &sch->q); - qdisc_qstats_drop(sch); ---- a/net/sched/sch_fq_codel.c -+++ b/net/sched/sch_fq_codel.c -@@ -185,6 +185,8 @@ static int fq_codel_enqueue(struct sk_bu - return ret; - } - idx--; -+ if (sch->q.qlen > 128) -+ skb = skb_reduce_truesize(skb); - - codel_set_enqueue_time(skb); - flow = &q->flows[idx]; diff --git a/target/linux/generic/pending-3.18/660-fq_codel_defaults.patch b/target/linux/generic/pending-3.18/660-fq_codel_defaults.patch deleted file mode 100644 index 8a870cccc1..0000000000 --- a/target/linux/generic/pending-3.18/660-fq_codel_defaults.patch +++ /dev/null @@ -1,13 +0,0 @@ ---- a/net/sched/sch_fq_codel.c -+++ b/net/sched/sch_fq_codel.c -@@ -394,8 +394,8 @@ static int fq_codel_init(struct Qdisc *s - struct fq_codel_sched_data *q = qdisc_priv(sch); - int i; - -- sch->limit = 10*1024; -- q->flows_cnt = 1024; -+ sch->limit = 1024; -+ q->flows_cnt = 128; - q->quantum = psched_mtu(qdisc_dev(sch)); - q->perturbation = prandom_u32(); - INIT_LIST_HEAD(&q->new_flows); diff --git a/target/linux/generic/pending-3.18/661-fq_codel_keep_dropped_stats.patch b/target/linux/generic/pending-3.18/661-fq_codel_keep_dropped_stats.patch deleted file mode 100644 index 45a8d68367..0000000000 --- a/target/linux/generic/pending-3.18/661-fq_codel_keep_dropped_stats.patch +++ /dev/null @@ -1,10 +0,0 @@ ---- a/net/sched/sch_fq_codel.c -+++ b/net/sched/sch_fq_codel.c -@@ -198,7 +198,6 @@ static int fq_codel_enqueue(struct sk_bu - list_add_tail(&flow->flowchain, &q->new_flows); - q->new_flow_count++; - flow->deficit = q->quantum; -- flow->dropped = 0; - } - if (++sch->q.qlen <= sch->limit) - return NET_XMIT_SUCCESS; diff --git a/target/linux/generic/pending-3.18/662-use_fq_codel_by_default.patch b/target/linux/generic/pending-3.18/662-use_fq_codel_by_default.patch deleted file mode 100644 index 39abfaabea..0000000000 --- a/target/linux/generic/pending-3.18/662-use_fq_codel_by_default.patch +++ /dev/null @@ -1,95 +0,0 @@ ---- a/net/sched/Kconfig -+++ b/net/sched/Kconfig -@@ -3,8 +3,9 @@ - # - - menuconfig NET_SCHED -- bool "QoS and/or fair queueing" -+ def_bool y - select NET_SCH_FIFO -+ select NET_SCH_FQ_CODEL - ---help--- - When the kernel has several packets to send out over a network - device, it has to decide which ones to send first, which ones to ---- a/net/sched/sch_fq_codel.c -+++ b/net/sched/sch_fq_codel.c -@@ -599,7 +599,7 @@ static const struct Qdisc_class_ops fq_c - .walk = fq_codel_walk, - }; - --static struct Qdisc_ops fq_codel_qdisc_ops __read_mostly = { -+struct Qdisc_ops fq_codel_qdisc_ops __read_mostly = { - .cl_ops = &fq_codel_class_ops, - .id = "fq_codel", - .priv_size = sizeof(struct fq_codel_sched_data), -@@ -615,6 +615,7 @@ static struct Qdisc_ops fq_codel_qdisc_o - .dump_stats = fq_codel_dump_stats, - .owner = THIS_MODULE, - }; -+EXPORT_SYMBOL(fq_codel_qdisc_ops); - - static int __init fq_codel_module_init(void) - { ---- a/include/net/sch_generic.h -+++ b/include/net/sch_generic.h -@@ -341,6 +341,7 @@ extern struct Qdisc noop_qdisc; - extern struct Qdisc_ops noop_qdisc_ops; - extern struct Qdisc_ops pfifo_fast_ops; - extern struct Qdisc_ops mq_qdisc_ops; -+extern struct Qdisc_ops fq_codel_qdisc_ops; - extern const struct Qdisc_ops *default_qdisc_ops; - - struct Qdisc_class_common { ---- a/net/sched/sch_generic.c -+++ b/net/sched/sch_generic.c -@@ -31,7 +31,7 @@ - #include - - /* Qdisc to use by default */ --const struct Qdisc_ops *default_qdisc_ops = &pfifo_fast_ops; -+const struct Qdisc_ops *default_qdisc_ops = &fq_codel_qdisc_ops; - EXPORT_SYMBOL(default_qdisc_ops); - - /* Main transmission queue. */ -@@ -742,7 +742,7 @@ static void attach_one_default_qdisc(str - - if (dev->tx_queue_len) { - qdisc = qdisc_create_dflt(dev_queue, -- default_qdisc_ops, TC_H_ROOT); -+ &fq_codel_qdisc_ops, TC_H_ROOT); - if (!qdisc) { - netdev_info(dev, "activation failed\n"); - return; ---- a/net/sched/sch_mq.c -+++ b/net/sched/sch_mq.c -@@ -57,7 +57,7 @@ static int mq_init(struct Qdisc *sch, st - - for (ntx = 0; ntx < dev->num_tx_queues; ntx++) { - dev_queue = netdev_get_tx_queue(dev, ntx); -- qdisc = qdisc_create_dflt(dev_queue, default_qdisc_ops, -+ qdisc = qdisc_create_dflt(dev_queue, &fq_codel_qdisc_ops, - TC_H_MAKE(TC_H_MAJ(sch->handle), - TC_H_MIN(ntx + 1))); - if (qdisc == NULL) ---- a/net/sched/sch_mqprio.c -+++ b/net/sched/sch_mqprio.c -@@ -124,7 +124,7 @@ static int mqprio_init(struct Qdisc *sch - - for (i = 0; i < dev->num_tx_queues; i++) { - dev_queue = netdev_get_tx_queue(dev, i); -- qdisc = qdisc_create_dflt(dev_queue, default_qdisc_ops, -+ qdisc = qdisc_create_dflt(dev_queue, &fq_codel_qdisc_ops, - TC_H_MAKE(TC_H_MAJ(sch->handle), - TC_H_MIN(i + 1))); - if (qdisc == NULL) { ---- a/net/sched/sch_api.c -+++ b/net/sched/sch_api.c -@@ -1949,7 +1949,7 @@ static int __init pktsched_init(void) - return err; - } - -- register_qdisc(&pfifo_fast_ops); -+ register_qdisc(&fq_codel_qdisc_ops); - register_qdisc(&pfifo_qdisc_ops); - register_qdisc(&bfifo_qdisc_ops); - register_qdisc(&pfifo_head_drop_qdisc_ops); diff --git a/target/linux/generic/pending-3.18/663-remove_pfifo_fast.patch b/target/linux/generic/pending-3.18/663-remove_pfifo_fast.patch deleted file mode 100644 index 50b90b375f..0000000000 --- a/target/linux/generic/pending-3.18/663-remove_pfifo_fast.patch +++ /dev/null @@ -1,143 +0,0 @@ ---- a/net/sched/sch_generic.c -+++ b/net/sched/sch_generic.c -@@ -445,140 +445,6 @@ static struct Qdisc noqueue_qdisc = { - .busylock = __SPIN_LOCK_UNLOCKED(noqueue_qdisc.busylock), - }; - -- --static const u8 prio2band[TC_PRIO_MAX + 1] = { -- 1, 2, 2, 2, 1, 2, 0, 0 , 1, 1, 1, 1, 1, 1, 1, 1 --}; -- --/* 3-band FIFO queue: old style, but should be a bit faster than -- generic prio+fifo combination. -- */ -- --#define PFIFO_FAST_BANDS 3 -- --/* -- * Private data for a pfifo_fast scheduler containing: -- * - queues for the three band -- * - bitmap indicating which of the bands contain skbs -- */ --struct pfifo_fast_priv { -- u32 bitmap; -- struct sk_buff_head q[PFIFO_FAST_BANDS]; --}; -- --/* -- * Convert a bitmap to the first band number where an skb is queued, where: -- * bitmap=0 means there are no skbs on any band. -- * bitmap=1 means there is an skb on band 0. -- * bitmap=7 means there are skbs on all 3 bands, etc. -- */ --static const int bitmap2band[] = {-1, 0, 1, 0, 2, 0, 1, 0}; -- --static inline struct sk_buff_head *band2list(struct pfifo_fast_priv *priv, -- int band) --{ -- return priv->q + band; --} -- --static int pfifo_fast_enqueue(struct sk_buff *skb, struct Qdisc *qdisc) --{ -- if (skb_queue_len(&qdisc->q) < qdisc_dev(qdisc)->tx_queue_len) { -- int band = prio2band[skb->priority & TC_PRIO_MAX]; -- struct pfifo_fast_priv *priv = qdisc_priv(qdisc); -- struct sk_buff_head *list = band2list(priv, band); -- -- priv->bitmap |= (1 << band); -- qdisc->q.qlen++; -- return __qdisc_enqueue_tail(skb, qdisc, list); -- } -- -- return qdisc_drop(skb, qdisc); --} -- --static struct sk_buff *pfifo_fast_dequeue(struct Qdisc *qdisc) --{ -- struct pfifo_fast_priv *priv = qdisc_priv(qdisc); -- int band = bitmap2band[priv->bitmap]; -- -- if (likely(band >= 0)) { -- struct sk_buff_head *list = band2list(priv, band); -- struct sk_buff *skb = __qdisc_dequeue_head(qdisc, list); -- -- qdisc->q.qlen--; -- if (skb_queue_empty(list)) -- priv->bitmap &= ~(1 << band); -- -- return skb; -- } -- -- return NULL; --} -- --static struct sk_buff *pfifo_fast_peek(struct Qdisc *qdisc) --{ -- struct pfifo_fast_priv *priv = qdisc_priv(qdisc); -- int band = bitmap2band[priv->bitmap]; -- -- if (band >= 0) { -- struct sk_buff_head *list = band2list(priv, band); -- -- return skb_peek(list); -- } -- -- return NULL; --} -- --static void pfifo_fast_reset(struct Qdisc *qdisc) --{ -- int prio; -- struct pfifo_fast_priv *priv = qdisc_priv(qdisc); -- -- for (prio = 0; prio < PFIFO_FAST_BANDS; prio++) -- __qdisc_reset_queue(qdisc, band2list(priv, prio)); -- -- priv->bitmap = 0; -- qdisc->qstats.backlog = 0; -- qdisc->q.qlen = 0; --} -- --static int pfifo_fast_dump(struct Qdisc *qdisc, struct sk_buff *skb) --{ -- struct tc_prio_qopt opt = { .bands = PFIFO_FAST_BANDS }; -- -- memcpy(&opt.priomap, prio2band, TC_PRIO_MAX + 1); -- if (nla_put(skb, TCA_OPTIONS, sizeof(opt), &opt)) -- goto nla_put_failure; -- return skb->len; -- --nla_put_failure: -- return -1; --} -- --static int pfifo_fast_init(struct Qdisc *qdisc, struct nlattr *opt) --{ -- int prio; -- struct pfifo_fast_priv *priv = qdisc_priv(qdisc); -- -- for (prio = 0; prio < PFIFO_FAST_BANDS; prio++) -- __skb_queue_head_init(band2list(priv, prio)); -- -- /* Can by-pass the queue discipline */ -- qdisc->flags |= TCQ_F_CAN_BYPASS; -- return 0; --} -- --struct Qdisc_ops pfifo_fast_ops __read_mostly = { -- .id = "pfifo_fast", -- .priv_size = sizeof(struct pfifo_fast_priv), -- .enqueue = pfifo_fast_enqueue, -- .dequeue = pfifo_fast_dequeue, -- .peek = pfifo_fast_peek, -- .init = pfifo_fast_init, -- .reset = pfifo_fast_reset, -- .dump = pfifo_fast_dump, -- .owner = THIS_MODULE, --}; -- - static struct lock_class_key qdisc_tx_busylock; - - struct Qdisc *qdisc_alloc(struct netdev_queue *dev_queue, diff --git a/target/linux/generic/pending-3.18/666-Add-support-for-MAP-E-FMRs-mesh-mode.patch b/target/linux/generic/pending-3.18/666-Add-support-for-MAP-E-FMRs-mesh-mode.patch deleted file mode 100644 index 9a2808acd5..0000000000 --- a/target/linux/generic/pending-3.18/666-Add-support-for-MAP-E-FMRs-mesh-mode.patch +++ /dev/null @@ -1,481 +0,0 @@ -From 775d6fe74d1eaec2ba387535b068dde2dc89de9e Mon Sep 17 00:00:00 2001 -From: Steven Barth -Date: Thu, 22 May 2014 09:49:05 +0200 -Subject: [PATCH] Add support for MAP-E FMRs (mesh mode) - -MAP-E FMRs (draft-ietf-softwire-map-10) are rules for IPv4-communication -between MAP CEs (mesh mode) without the need to forward such data to a -border relay. This is similar to how 6rd works but for IPv4 over IPv6. - -Signed-off-by: Steven Barth ---- - include/net/ip6_tunnel.h | 13 ++ - include/uapi/linux/if_tunnel.h | 13 ++ - net/ipv6/ip6_tunnel.c | 276 +++++++++++++++++++++++++++++++++++++++-- - 3 files changed, 291 insertions(+), 11 deletions(-) - ---- a/include/net/ip6_tunnel.h -+++ b/include/net/ip6_tunnel.h -@@ -15,6 +15,18 @@ - /* determine capability on a per-packet basis */ - #define IP6_TNL_F_CAP_PER_PACKET 0x40000 - -+/* IPv6 tunnel FMR */ -+struct __ip6_tnl_fmr { -+ struct __ip6_tnl_fmr *next; /* next fmr in list */ -+ struct in6_addr ip6_prefix; -+ struct in_addr ip4_prefix; -+ -+ __u8 ip6_prefix_len; -+ __u8 ip4_prefix_len; -+ __u8 ea_len; -+ __u8 offset; -+}; -+ - struct __ip6_tnl_parm { - char name[IFNAMSIZ]; /* name of tunnel device */ - int link; /* ifindex of underlying L2 interface */ -@@ -25,6 +37,7 @@ struct __ip6_tnl_parm { - __u32 flags; /* tunnel flags */ - struct in6_addr laddr; /* local tunnel end-point address */ - struct in6_addr raddr; /* remote tunnel end-point address */ -+ struct __ip6_tnl_fmr *fmrs; /* FMRs */ - - __be16 i_flags; - __be16 o_flags; ---- a/include/uapi/linux/if_tunnel.h -+++ b/include/uapi/linux/if_tunnel.h -@@ -57,10 +57,23 @@ enum { - IFLA_IPTUN_ENCAP_FLAGS, - IFLA_IPTUN_ENCAP_SPORT, - IFLA_IPTUN_ENCAP_DPORT, -+ IFLA_IPTUN_FMRS, - __IFLA_IPTUN_MAX, - }; - #define IFLA_IPTUN_MAX (__IFLA_IPTUN_MAX - 1) - -+enum { -+ IFLA_IPTUN_FMR_UNSPEC, -+ IFLA_IPTUN_FMR_IP6_PREFIX, -+ IFLA_IPTUN_FMR_IP4_PREFIX, -+ IFLA_IPTUN_FMR_IP6_PREFIX_LEN, -+ IFLA_IPTUN_FMR_IP4_PREFIX_LEN, -+ IFLA_IPTUN_FMR_EA_LEN, -+ IFLA_IPTUN_FMR_OFFSET, -+ __IFLA_IPTUN_FMR_MAX, -+}; -+#define IFLA_IPTUN_FMR_MAX (__IFLA_IPTUN_FMR_MAX - 1) -+ - enum tunnel_encap_types { - TUNNEL_ENCAP_NONE, - TUNNEL_ENCAP_FOU, ---- a/net/ipv6/ip6_tunnel.c -+++ b/net/ipv6/ip6_tunnel.c -@@ -16,6 +16,8 @@ - * as published by the Free Software Foundation; either version - * 2 of the License, or (at your option) any later version. - * -+ * Changes: -+ * Steven Barth : MAP-E FMR support - */ - - #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt -@@ -77,11 +79,9 @@ static bool log_ecn_error = true; - module_param(log_ecn_error, bool, 0644); - MODULE_PARM_DESC(log_ecn_error, "Log packets received with corrupted ECN"); - --static u32 HASH(const struct in6_addr *addr1, const struct in6_addr *addr2) -+static u32 HASH(const struct in6_addr *addr) - { -- u32 hash = ipv6_addr_hash(addr1) ^ ipv6_addr_hash(addr2); -- -- return hash_32(hash, HASH_SIZE_SHIFT); -+ return hash_32(ipv6_addr_hash(addr), HASH_SIZE_SHIFT); - } - - static int ip6_tnl_dev_init(struct net_device *dev); -@@ -180,15 +180,24 @@ EXPORT_SYMBOL_GPL(ip6_tnl_dst_store); - static struct ip6_tnl * - ip6_tnl_lookup(struct net *net, const struct in6_addr *remote, const struct in6_addr *local) - { -- unsigned int hash = HASH(remote, local); -+ unsigned int hash = HASH(local); - struct ip6_tnl *t; - struct ip6_tnl_net *ip6n = net_generic(net, ip6_tnl_net_id); -+ struct __ip6_tnl_fmr *fmr; - - for_each_ip6_tunnel_rcu(ip6n->tnls_r_l[hash]) { -- if (ipv6_addr_equal(local, &t->parms.laddr) && -- ipv6_addr_equal(remote, &t->parms.raddr) && -- (t->dev->flags & IFF_UP)) -+ if (!ipv6_addr_equal(local, &t->parms.laddr) || -+ !(t->dev->flags & IFF_UP)) -+ continue; -+ -+ if (ipv6_addr_equal(remote, &t->parms.raddr)) - return t; -+ -+ for (fmr = t->parms.fmrs; fmr; fmr = fmr->next) { -+ if (ipv6_prefix_equal(remote, &fmr->ip6_prefix, -+ fmr->ip6_prefix_len)) -+ return t; -+ } - } - t = rcu_dereference(ip6n->tnls_wc[0]); - if (t && (t->dev->flags & IFF_UP)) -@@ -218,7 +227,7 @@ ip6_tnl_bucket(struct ip6_tnl_net *ip6n, - - if (!ipv6_addr_any(remote) || !ipv6_addr_any(local)) { - prio = 1; -- h = HASH(remote, local); -+ h = HASH(local); - } - return &ip6n->tnls[prio][h]; - } -@@ -391,6 +400,12 @@ ip6_tnl_dev_uninit(struct net_device *de - struct net *net = t->net; - struct ip6_tnl_net *ip6n = net_generic(net, ip6_tnl_net_id); - -+ while (t->parms.fmrs) { -+ struct __ip6_tnl_fmr *next = t->parms.fmrs->next; -+ kfree(t->parms.fmrs); -+ t->parms.fmrs = next; -+ } -+ - if (dev == ip6n->fb_tnl_dev) - RCU_INIT_POINTER(ip6n->tnls_wc[0], NULL); - else -@@ -784,6 +799,108 @@ int ip6_tnl_rcv_ctl(struct ip6_tnl *t, - } - EXPORT_SYMBOL_GPL(ip6_tnl_rcv_ctl); - -+ -+/** -+ * ip4ip6_fmr_calc - calculate target / source IPv6-address based on FMR -+ * @dest: destination IPv6 address buffer -+ * @skb: received socket buffer -+ * @fmr: MAP FMR -+ * @xmit: Calculate for xmit or rcv -+ **/ -+static void ip4ip6_fmr_calc(struct in6_addr *dest, -+ const struct iphdr *iph, const uint8_t *end, -+ const struct __ip6_tnl_fmr *fmr, bool xmit) -+{ -+ int psidlen = fmr->ea_len - (32 - fmr->ip4_prefix_len); -+ u8 *portp = NULL; -+ bool use_dest_addr; -+ const struct iphdr *dsth = iph; -+ -+ if ((u8*)dsth >= end) -+ return; -+ -+ /* find significant IP header */ -+ if (iph->protocol == IPPROTO_ICMP) { -+ struct icmphdr *ih = (struct icmphdr*)(((u8*)dsth) + dsth->ihl * 4); -+ if (ih && ((u8*)&ih[1]) <= end && ( -+ ih->type == ICMP_DEST_UNREACH || -+ ih->type == ICMP_SOURCE_QUENCH || -+ ih->type == ICMP_TIME_EXCEEDED || -+ ih->type == ICMP_PARAMETERPROB || -+ ih->type == ICMP_REDIRECT)) -+ dsth = (const struct iphdr*)&ih[1]; -+ } -+ -+ /* in xmit-path use dest port by default and source port only if -+ this is an ICMP reply to something else; vice versa in rcv-path */ -+ use_dest_addr = (xmit && dsth == iph) || (!xmit && dsth != iph); -+ -+ /* get dst port */ -+ if (((u8*)&dsth[1]) <= end && ( -+ dsth->protocol == IPPROTO_UDP || -+ dsth->protocol == IPPROTO_TCP || -+ dsth->protocol == IPPROTO_SCTP || -+ dsth->protocol == IPPROTO_DCCP)) { -+ /* for UDP, TCP, SCTP and DCCP source and dest port -+ follow IPv4 header directly */ -+ portp = ((u8*)dsth) + dsth->ihl * 4; -+ -+ if (use_dest_addr) -+ portp += sizeof(u16); -+ } else if (iph->protocol == IPPROTO_ICMP) { -+ struct icmphdr *ih = (struct icmphdr*)(((u8*)dsth) + dsth->ihl * 4); -+ -+ /* use icmp identifier as port */ -+ if (((u8*)&ih) <= end && ( -+ (use_dest_addr && ( -+ ih->type == ICMP_ECHOREPLY || -+ ih->type == ICMP_TIMESTAMPREPLY || -+ ih->type == ICMP_INFO_REPLY || -+ ih->type == ICMP_ADDRESSREPLY)) || -+ (!use_dest_addr && ( -+ ih->type == ICMP_ECHO || -+ ih->type == ICMP_TIMESTAMP || -+ ih->type == ICMP_INFO_REQUEST || -+ ih->type == ICMP_ADDRESS) -+ ))) -+ portp = (u8*)&ih->un.echo.id; -+ } -+ -+ if ((portp && &portp[2] <= end) || psidlen == 0) { -+ int frombyte = fmr->ip6_prefix_len / 8; -+ int fromrem = fmr->ip6_prefix_len % 8; -+ int bytes = sizeof(struct in6_addr) - frombyte; -+ const u32 *addr = (use_dest_addr) ? &iph->daddr : &iph->saddr; -+ u64 eabits = ((u64)ntohl(*addr)) << (32 + fmr->ip4_prefix_len); -+ u64 t = 0; -+ -+ /* extract PSID from port and add it to eabits */ -+ u16 psidbits = 0; -+ if (psidlen > 0) { -+ psidbits = ((u16)portp[0]) << 8 | ((u16)portp[1]); -+ psidbits >>= 16 - psidlen - fmr->offset; -+ psidbits = (u16)(psidbits << (16 - psidlen)); -+ eabits |= ((u64)psidbits) << (48 - (fmr->ea_len - psidlen)); -+ } -+ -+ /* rewrite destination address */ -+ *dest = fmr->ip6_prefix; -+ memcpy(&dest->s6_addr[10], addr, sizeof(*addr)); -+ dest->s6_addr16[7] = htons(psidbits >> (16 - psidlen)); -+ -+ if (bytes > sizeof(u64)) -+ bytes = sizeof(u64); -+ -+ /* insert eabits */ -+ memcpy(&t, &dest->s6_addr[frombyte], bytes); -+ t = be64_to_cpu(t) & ~(((((u64)1) << fmr->ea_len) - 1) -+ << (64 - fmr->ea_len - fromrem)); -+ t = cpu_to_be64(t | (eabits >> fromrem)); -+ memcpy(&dest->s6_addr[frombyte], &t, bytes); -+ } -+} -+ -+ - /** - * ip6_tnl_rcv - decapsulate IPv6 packet and retransmit it locally - * @skb: received socket buffer -@@ -828,6 +945,26 @@ static int ip6_tnl_rcv(struct sk_buff *s - skb_reset_network_header(skb); - skb->protocol = htons(protocol); - memset(skb->cb, 0, sizeof(struct inet6_skb_parm)); -+ if (protocol == ETH_P_IP && t->parms.fmrs && -+ !ipv6_addr_equal(&ipv6h->saddr, &t->parms.raddr)) { -+ /* Packet didn't come from BR, so lookup FMR */ -+ struct __ip6_tnl_fmr *fmr; -+ struct in6_addr expected = t->parms.raddr; -+ for (fmr = t->parms.fmrs; fmr; fmr = fmr->next) -+ if (ipv6_prefix_equal(&ipv6h->saddr, -+ &fmr->ip6_prefix, fmr->ip6_prefix_len)) -+ break; -+ -+ /* Check that IPv6 matches IPv4 source to prevent spoofing */ -+ if (fmr) -+ ip4ip6_fmr_calc(&expected, ip_hdr(skb), -+ skb_tail_pointer(skb), fmr, false); -+ -+ if (!ipv6_addr_equal(&ipv6h->saddr, &expected)) { -+ rcu_read_unlock(); -+ goto discard; -+ } -+ } - - __skb_tunnel_rx(skb, t->dev, t->net); - -@@ -1089,6 +1226,7 @@ ip4ip6_tnl_xmit(struct sk_buff *skb, str - __u8 dsfield; - __u32 mtu; - int err; -+ struct __ip6_tnl_fmr *fmr; - - /* ensure we can access the full inner ip header */ - if (!pskb_may_pull(skb, sizeof(struct iphdr))) -@@ -1114,6 +1252,18 @@ ip4ip6_tnl_xmit(struct sk_buff *skb, str - if (t->parms.flags & IP6_TNL_F_USE_ORIG_FWMARK) - fl6.flowi6_mark = skb->mark; - -+ /* try to find matching FMR */ -+ for (fmr = t->parms.fmrs; fmr; fmr = fmr->next) { -+ unsigned mshift = 32 - fmr->ip4_prefix_len; -+ if (ntohl(fmr->ip4_prefix.s_addr) >> mshift == -+ ntohl(iph->daddr) >> mshift) -+ break; -+ } -+ -+ /* change dstaddr according to FMR */ -+ if (fmr) -+ ip4ip6_fmr_calc(&fl6.daddr, iph, skb_tail_pointer(skb), fmr, true); -+ - err = ip6_tnl_xmit2(skb, dev, dsfield, &fl6, encap_limit, &mtu); - if (err != 0) { - /* XXX: send ICMP error even if DF is not set. */ -@@ -1286,6 +1436,14 @@ ip6_tnl_change(struct ip6_tnl *t, const - t->parms.flowinfo = p->flowinfo; - t->parms.link = p->link; - t->parms.proto = p->proto; -+ -+ while (t->parms.fmrs) { -+ struct __ip6_tnl_fmr *next = t->parms.fmrs->next; -+ kfree(t->parms.fmrs); -+ t->parms.fmrs = next; -+ } -+ t->parms.fmrs = p->fmrs; -+ - ip6_tnl_dst_reset(t); - ip6_tnl_link_config(t); - return 0; -@@ -1316,6 +1474,7 @@ ip6_tnl_parm_from_user(struct __ip6_tnl_ - p->flowinfo = u->flowinfo; - p->link = u->link; - p->proto = u->proto; -+ p->fmrs = NULL; - memcpy(p->name, u->name, sizeof(u->name)); - } - -@@ -1591,6 +1750,15 @@ static int ip6_tnl_validate(struct nlatt - return 0; - } - -+static const struct nla_policy ip6_tnl_fmr_policy[IFLA_IPTUN_FMR_MAX + 1] = { -+ [IFLA_IPTUN_FMR_IP6_PREFIX] = { .len = sizeof(struct in6_addr) }, -+ [IFLA_IPTUN_FMR_IP4_PREFIX] = { .len = sizeof(struct in_addr) }, -+ [IFLA_IPTUN_FMR_IP6_PREFIX_LEN] = { .type = NLA_U8 }, -+ [IFLA_IPTUN_FMR_IP4_PREFIX_LEN] = { .type = NLA_U8 }, -+ [IFLA_IPTUN_FMR_EA_LEN] = { .type = NLA_U8 }, -+ [IFLA_IPTUN_FMR_OFFSET] = { .type = NLA_U8 } -+}; -+ - static void ip6_tnl_netlink_parms(struct nlattr *data[], - struct __ip6_tnl_parm *parms) - { -@@ -1624,6 +1792,46 @@ static void ip6_tnl_netlink_parms(struct - - if (data[IFLA_IPTUN_PROTO]) - parms->proto = nla_get_u8(data[IFLA_IPTUN_PROTO]); -+ -+ if (data[IFLA_IPTUN_FMRS]) { -+ unsigned rem; -+ struct nlattr *fmr; -+ nla_for_each_nested(fmr, data[IFLA_IPTUN_FMRS], rem) { -+ struct nlattr *fmrd[IFLA_IPTUN_FMR_MAX + 1], *c; -+ struct __ip6_tnl_fmr *nfmr; -+ -+ nla_parse_nested(fmrd, IFLA_IPTUN_FMR_MAX, -+ fmr, ip6_tnl_fmr_policy); -+ -+ if (!(nfmr = kzalloc(sizeof(*nfmr), GFP_KERNEL))) -+ continue; -+ -+ nfmr->offset = 6; -+ -+ if ((c = fmrd[IFLA_IPTUN_FMR_IP6_PREFIX])) -+ nla_memcpy(&nfmr->ip6_prefix, fmrd[IFLA_IPTUN_FMR_IP6_PREFIX], -+ sizeof(nfmr->ip6_prefix)); -+ -+ if ((c = fmrd[IFLA_IPTUN_FMR_IP4_PREFIX])) -+ nla_memcpy(&nfmr->ip4_prefix, fmrd[IFLA_IPTUN_FMR_IP4_PREFIX], -+ sizeof(nfmr->ip4_prefix)); -+ -+ if ((c = fmrd[IFLA_IPTUN_FMR_IP6_PREFIX_LEN])) -+ nfmr->ip6_prefix_len = nla_get_u8(c); -+ -+ if ((c = fmrd[IFLA_IPTUN_FMR_IP4_PREFIX_LEN])) -+ nfmr->ip4_prefix_len = nla_get_u8(c); -+ -+ if ((c = fmrd[IFLA_IPTUN_FMR_EA_LEN])) -+ nfmr->ea_len = nla_get_u8(c); -+ -+ if ((c = fmrd[IFLA_IPTUN_FMR_OFFSET])) -+ nfmr->offset = nla_get_u8(c); -+ -+ nfmr->next = parms->fmrs; -+ parms->fmrs = nfmr; -+ } -+ } - } - - static int ip6_tnl_newlink(struct net *src_net, struct net_device *dev, -@@ -1676,6 +1884,12 @@ static void ip6_tnl_dellink(struct net_d - - static size_t ip6_tnl_get_size(const struct net_device *dev) - { -+ const struct ip6_tnl *t = netdev_priv(dev); -+ struct __ip6_tnl_fmr *c; -+ int fmrs = 0; -+ for (c = t->parms.fmrs; c; c = c->next) -+ ++fmrs; -+ - return - /* IFLA_IPTUN_LINK */ - nla_total_size(4) + -@@ -1693,6 +1907,24 @@ static size_t ip6_tnl_get_size(const str - nla_total_size(4) + - /* IFLA_IPTUN_PROTO */ - nla_total_size(1) + -+ /* IFLA_IPTUN_FMRS */ -+ nla_total_size(0) + -+ ( -+ /* nest */ -+ nla_total_size(0) + -+ /* IFLA_IPTUN_FMR_IP6_PREFIX */ -+ nla_total_size(sizeof(struct in6_addr)) + -+ /* IFLA_IPTUN_FMR_IP4_PREFIX */ -+ nla_total_size(sizeof(struct in_addr)) + -+ /* IFLA_IPTUN_FMR_EA_LEN */ -+ nla_total_size(1) + -+ /* IFLA_IPTUN_FMR_IP6_PREFIX_LEN */ -+ nla_total_size(1) + -+ /* IFLA_IPTUN_FMR_IP4_PREFIX_LEN */ -+ nla_total_size(1) + -+ /* IFLA_IPTUN_FMR_OFFSET */ -+ nla_total_size(1) -+ ) * fmrs + - 0; - } - -@@ -1700,6 +1932,9 @@ static int ip6_tnl_fill_info(struct sk_b - { - struct ip6_tnl *tunnel = netdev_priv(dev); - struct __ip6_tnl_parm *parm = &tunnel->parms; -+ struct __ip6_tnl_fmr *c; -+ int fmrcnt = 0; -+ struct nlattr *fmrs; - - if (nla_put_u32(skb, IFLA_IPTUN_LINK, parm->link) || - nla_put(skb, IFLA_IPTUN_LOCAL, sizeof(struct in6_addr), -@@ -1710,8 +1945,27 @@ static int ip6_tnl_fill_info(struct sk_b - nla_put_u8(skb, IFLA_IPTUN_ENCAP_LIMIT, parm->encap_limit) || - nla_put_be32(skb, IFLA_IPTUN_FLOWINFO, parm->flowinfo) || - nla_put_u32(skb, IFLA_IPTUN_FLAGS, parm->flags) || -- nla_put_u8(skb, IFLA_IPTUN_PROTO, parm->proto)) -+ nla_put_u8(skb, IFLA_IPTUN_PROTO, parm->proto) || -+ !(fmrs = nla_nest_start(skb, IFLA_IPTUN_FMRS))) - goto nla_put_failure; -+ -+ for (c = parm->fmrs; c; c = c->next) { -+ struct nlattr *fmr = nla_nest_start(skb, ++fmrcnt); -+ if (!fmr || -+ nla_put(skb, IFLA_IPTUN_FMR_IP6_PREFIX, -+ sizeof(c->ip6_prefix), &c->ip6_prefix) || -+ nla_put(skb, IFLA_IPTUN_FMR_IP4_PREFIX, -+ sizeof(c->ip4_prefix), &c->ip4_prefix) || -+ nla_put_u8(skb, IFLA_IPTUN_FMR_IP6_PREFIX_LEN, c->ip6_prefix_len) || -+ nla_put_u8(skb, IFLA_IPTUN_FMR_IP4_PREFIX_LEN, c->ip4_prefix_len) || -+ nla_put_u8(skb, IFLA_IPTUN_FMR_EA_LEN, c->ea_len) || -+ nla_put_u8(skb, IFLA_IPTUN_FMR_OFFSET, c->offset)) -+ goto nla_put_failure; -+ -+ nla_nest_end(skb, fmr); -+ } -+ nla_nest_end(skb, fmrs); -+ - return 0; - - nla_put_failure: -@@ -1727,6 +1981,7 @@ static const struct nla_policy ip6_tnl_p - [IFLA_IPTUN_FLOWINFO] = { .type = NLA_U32 }, - [IFLA_IPTUN_FLAGS] = { .type = NLA_U32 }, - [IFLA_IPTUN_PROTO] = { .type = NLA_U8 }, -+ [IFLA_IPTUN_FMRS] = { .type = NLA_NESTED }, - }; - - static struct rtnl_link_ops ip6_link_ops __read_mostly = { diff --git a/target/linux/generic/pending-3.18/667-ipv6-Fixed-source-specific-default-route-handling.patch b/target/linux/generic/pending-3.18/667-ipv6-Fixed-source-specific-default-route-handling.patch deleted file mode 100644 index 61612cecb8..0000000000 --- a/target/linux/generic/pending-3.18/667-ipv6-Fixed-source-specific-default-route-handling.patch +++ /dev/null @@ -1,96 +0,0 @@ -From e16e888b525503be05b3aea64190e8b3bdef44d0 Mon Sep 17 00:00:00 2001 -From: Markus Stenberg -Date: Tue, 5 May 2015 13:36:59 +0300 -Subject: [PATCH] ipv6: Fixed source specific default route handling. - -If there are only IPv6 source specific default routes present, the -host gets -ENETUNREACH on e.g. connect() because ip6_dst_lookup_tail -calls ip6_route_output first, and given source address any, it fails, -and ip6_route_get_saddr is never called. - -The change is to use the ip6_route_get_saddr, even if the initial -ip6_route_output fails, and then doing ip6_route_output _again_ after -we have appropriate source address available. - -Note that this is '99% fix' to the problem; a correct fix would be to -do route lookups only within addrconf.c when picking a source address, -and never call ip6_route_output before source address has been -populated. - -Signed-off-by: Markus Stenberg -Signed-off-by: David S. Miller ---- - net/ipv6/ip6_output.c | 39 +++++++++++++++++++++++++++++++-------- - net/ipv6/route.c | 5 +++-- - 2 files changed, 34 insertions(+), 10 deletions(-) - ---- a/net/ipv6/ip6_output.c -+++ b/net/ipv6/ip6_output.c -@@ -909,21 +909,45 @@ static int ip6_dst_lookup_tail(struct so - #endif - int err; - -- if (*dst == NULL) -- *dst = ip6_route_output(net, sk, fl6); -- -- if ((err = (*dst)->error)) -- goto out_err_release; -+ /* The correct way to handle this would be to do -+ * ip6_route_get_saddr, and then ip6_route_output; however, -+ * the route-specific preferred source forces the -+ * ip6_route_output call _before_ ip6_route_get_saddr. -+ * -+ * In source specific routing (no src=any default route), -+ * ip6_route_output will fail given src=any saddr, though, so -+ * that's why we try it again later. -+ */ -+ if (ipv6_addr_any(&fl6->saddr) && (!*dst || !(*dst)->error)) { -+ struct rt6_info *rt; -+ bool had_dst = *dst != NULL; - -- if (ipv6_addr_any(&fl6->saddr)) { -- struct rt6_info *rt = (struct rt6_info *) *dst; -+ if (!had_dst) -+ *dst = ip6_route_output(net, sk, fl6); -+ rt = (*dst)->error ? NULL : (struct rt6_info *)*dst; - err = ip6_route_get_saddr(net, rt, &fl6->daddr, - sk ? inet6_sk(sk)->srcprefs : 0, - &fl6->saddr); - if (err) - goto out_err_release; -+ -+ /* If we had an erroneous initial result, pretend it -+ * never existed and let the SA-enabled version take -+ * over. -+ */ -+ if (!had_dst && (*dst)->error) { -+ dst_release(*dst); -+ *dst = NULL; -+ } - } - -+ if (!*dst) -+ *dst = ip6_route_output(net, sk, fl6); -+ -+ err = (*dst)->error; -+ if (err) -+ goto out_err_release; -+ - #ifdef CONFIG_IPV6_OPTIMISTIC_DAD - /* - * Here if the dst entry we've looked up ---- a/net/ipv6/route.c -+++ b/net/ipv6/route.c -@@ -2185,9 +2185,10 @@ int ip6_route_get_saddr(struct net *net, - unsigned int prefs, - struct in6_addr *saddr) - { -- struct inet6_dev *idev = ip6_dst_idev((struct dst_entry *)rt); -+ struct inet6_dev *idev = -+ rt ? ip6_dst_idev((struct dst_entry *)rt) : NULL; - int err = 0; -- if (rt->rt6i_prefsrc.plen) -+ if (rt && rt->rt6i_prefsrc.plen) - *saddr = rt->rt6i_prefsrc.addr; - else - err = ipv6_dev_get_saddr(net, idev ? idev->dev : NULL, diff --git a/target/linux/generic/pending-3.18/670-ipv6-allow-rejecting-with-source-address-failed-policy.patch b/target/linux/generic/pending-3.18/670-ipv6-allow-rejecting-with-source-address-failed-policy.patch deleted file mode 100644 index ac4a0a6bf9..0000000000 --- a/target/linux/generic/pending-3.18/670-ipv6-allow-rejecting-with-source-address-failed-policy.patch +++ /dev/null @@ -1,249 +0,0 @@ -From 1b5aaa4b16f6e6471ab1c07b38068197a1b4c395 Mon Sep 17 00:00:00 2001 -From: Jonas Gorski -Date: Fri, 24 May 2013 14:40:54 +0200 -Subject: [PATCH 1/2] ipv6: allow rejecting with "source address failed policy" - -RFC6204 L-14 requires rejecting traffic from invalid addresses with -ICMPv6 Destination Unreachable, Code 5 (Source address failed ingress/ -egress policy) on the LAN side, so add an appropriate rule for that. - -Signed-off-by: Jonas Gorski ---- - include/net/netns/ipv6.h | 1 + - include/uapi/linux/fib_rules.h | 4 +++ - include/uapi/linux/rtnetlink.h | 1 + - net/ipv4/fib_semantics.c | 4 +++ - net/ipv4/fib_trie.c | 1 + - net/ipv4/ipmr.c | 1 + - net/ipv6/fib6_rules.c | 4 +++ - net/ipv6/ip6mr.c | 2 ++ - net/ipv6/route.c | 58 +++++++++++++++++++++++++++++++++++++++++- - 9 files changed, 75 insertions(+), 1 deletion(-) - ---- a/include/net/netns/ipv6.h -+++ b/include/net/netns/ipv6.h -@@ -59,6 +59,7 @@ struct netns_ipv6 { - unsigned long ip6_rt_last_gc; - #ifdef CONFIG_IPV6_MULTIPLE_TABLES - struct rt6_info *ip6_prohibit_entry; -+ struct rt6_info *ip6_policy_failed_entry; - struct rt6_info *ip6_blk_hole_entry; - struct fib6_table *fib6_local_tbl; - struct fib_rules_ops *fib6_rules_ops; ---- a/include/uapi/linux/fib_rules.h -+++ b/include/uapi/linux/fib_rules.h -@@ -64,6 +64,10 @@ enum { - FR_ACT_BLACKHOLE, /* Drop without notification */ - FR_ACT_UNREACHABLE, /* Drop with ENETUNREACH */ - FR_ACT_PROHIBIT, /* Drop with EACCES */ -+ FR_ACT_RES9, -+ FR_ACT_RES10, -+ FR_ACT_RES11, -+ FR_ACT_POLICY_FAILED, /* Drop with EACCES */ - __FR_ACT_MAX, - }; - ---- a/include/uapi/linux/rtnetlink.h -+++ b/include/uapi/linux/rtnetlink.h -@@ -203,6 +203,7 @@ enum { - RTN_THROW, /* Not in this table */ - RTN_NAT, /* Translate this address */ - RTN_XRESOLVE, /* Use external resolver */ -+ RTN_POLICY_FAILED, /* Failed ingress/egress policy */ - __RTN_MAX - }; - ---- a/net/ipv4/fib_semantics.c -+++ b/net/ipv4/fib_semantics.c -@@ -138,6 +138,10 @@ const struct fib_prop fib_props[RTN_MAX - .error = -EINVAL, - .scope = RT_SCOPE_NOWHERE, - }, -+ [RTN_POLICY_FAILED] = { -+ .error = -EACCES, -+ .scope = RT_SCOPE_UNIVERSE, -+ }, - }; - - static void rt_fibinfo_free(struct rtable __rcu **rtp) ---- a/net/ipv4/fib_trie.c -+++ b/net/ipv4/fib_trie.c -@@ -2236,6 +2236,7 @@ static const char *const rtn_type_names[ - [RTN_THROW] = "THROW", - [RTN_NAT] = "NAT", - [RTN_XRESOLVE] = "XRESOLVE", -+ [RTN_POLICY_FAILED] = "POLICY_FAILED", - }; - - static inline const char *rtn_type(char *buf, size_t len, unsigned int t) ---- a/net/ipv4/ipmr.c -+++ b/net/ipv4/ipmr.c -@@ -184,6 +184,7 @@ static int ipmr_rule_action(struct fib_r - case FR_ACT_UNREACHABLE: - return -ENETUNREACH; - case FR_ACT_PROHIBIT: -+ case FR_ACT_POLICY_FAILED: - return -EACCES; - case FR_ACT_BLACKHOLE: - default: ---- a/net/ipv6/fib6_rules.c -+++ b/net/ipv6/fib6_rules.c -@@ -73,6 +73,10 @@ static int fib6_rule_action(struct fib_r - err = -EACCES; - rt = net->ipv6.ip6_prohibit_entry; - goto discard_pkt; -+ case FR_ACT_POLICY_FAILED: -+ err = -EACCES; -+ rt = net->ipv6.ip6_policy_failed_entry; -+ goto discard_pkt; - } - - table = fib6_get_table(net, rule->table); ---- a/net/ipv6/ip6mr.c -+++ b/net/ipv6/ip6mr.c -@@ -169,6 +169,8 @@ static int ip6mr_rule_action(struct fib_ - return -ENETUNREACH; - case FR_ACT_PROHIBIT: - return -EACCES; -+ case FR_ACT_POLICY_FAILED: -+ return -EACCES; - case FR_ACT_BLACKHOLE: - default: - return -EINVAL; ---- a/net/ipv6/route.c -+++ b/net/ipv6/route.c -@@ -87,6 +87,8 @@ static int ip6_pkt_discard(struct sk_bu - static int ip6_pkt_discard_out(struct sock *sk, struct sk_buff *skb); - static int ip6_pkt_prohibit(struct sk_buff *skb); - static int ip6_pkt_prohibit_out(struct sock *sk, struct sk_buff *skb); -+static int ip6_pkt_policy_failed(struct sk_buff *skb); -+static int ip6_pkt_policy_failed_out(struct sock *sk, struct sk_buff *skb); - static void ip6_link_failure(struct sk_buff *skb); - static void ip6_rt_update_pmtu(struct dst_entry *dst, struct sock *sk, - struct sk_buff *skb, u32 mtu); -@@ -283,6 +285,21 @@ static const struct rt6_info ip6_prohibi - .rt6i_ref = ATOMIC_INIT(1), - }; - -+static const struct rt6_info ip6_policy_failed_entry_template = { -+ .dst = { -+ .__refcnt = ATOMIC_INIT(1), -+ .__use = 1, -+ .obsolete = DST_OBSOLETE_FORCE_CHK, -+ .error = -EACCES, -+ .input = ip6_pkt_policy_failed, -+ .output = ip6_pkt_policy_failed_out, -+ }, -+ .rt6i_flags = (RTF_REJECT | RTF_NONEXTHOP), -+ .rt6i_protocol = RTPROT_KERNEL, -+ .rt6i_metric = ~(u32) 0, -+ .rt6i_ref = ATOMIC_INIT(1), -+}; -+ - static const struct rt6_info ip6_blk_hole_entry_template = { - .dst = { - .__refcnt = ATOMIC_INIT(1), -@@ -1579,6 +1596,11 @@ int ip6_route_add(struct fib6_config *cf - rt->dst.output = ip6_pkt_prohibit_out; - rt->dst.input = ip6_pkt_prohibit; - break; -+ case RTN_POLICY_FAILED: -+ rt->dst.error = -EACCES; -+ rt->dst.output = ip6_pkt_policy_failed_out; -+ rt->dst.input = ip6_pkt_policy_failed; -+ break; - case RTN_THROW: - default: - rt->dst.error = (cfg->fc_type == RTN_THROW) ? -EAGAIN -@@ -2142,6 +2164,17 @@ static int ip6_pkt_prohibit_out(struct s - return ip6_pkt_drop(skb, ICMPV6_ADM_PROHIBITED, IPSTATS_MIB_OUTNOROUTES); - } - -+static int ip6_pkt_policy_failed(struct sk_buff *skb) -+{ -+ return ip6_pkt_drop(skb, ICMPV6_POLICY_FAIL, IPSTATS_MIB_INNOROUTES); -+} -+ -+static int ip6_pkt_policy_failed_out(struct sock *sk, struct sk_buff *skb) -+{ -+ skb->dev = skb_dst(skb)->dev; -+ return ip6_pkt_drop(skb, ICMPV6_POLICY_FAIL, IPSTATS_MIB_OUTNOROUTES); -+} -+ - /* - * Allocate a dst for local (unicast / anycast) address. - */ -@@ -2368,7 +2401,8 @@ static int rtm_to_fib6_config(struct sk_ - if (rtm->rtm_type == RTN_UNREACHABLE || - rtm->rtm_type == RTN_BLACKHOLE || - rtm->rtm_type == RTN_PROHIBIT || -- rtm->rtm_type == RTN_THROW) -+ rtm->rtm_type == RTN_THROW || -+ rtm->rtm_type == RTN_POLICY_FAILED) - cfg->fc_flags |= RTF_REJECT; - - if (rtm->rtm_type == RTN_LOCAL) -@@ -2570,6 +2604,9 @@ static int rt6_fill_node(struct net *net - case -EACCES: - rtm->rtm_type = RTN_PROHIBIT; - break; -+ case -EPERM: -+ rtm->rtm_type = RTN_POLICY_FAILED; -+ break; - case -EAGAIN: - rtm->rtm_type = RTN_THROW; - break; -@@ -2828,6 +2865,8 @@ static int ip6_route_dev_notify(struct n - #ifdef CONFIG_IPV6_MULTIPLE_TABLES - net->ipv6.ip6_prohibit_entry->dst.dev = dev; - net->ipv6.ip6_prohibit_entry->rt6i_idev = in6_dev_get(dev); -+ net->ipv6.ip6_policy_failed_entry->dst.dev = dev; -+ net->ipv6.ip6_policy_failed_entry->rt6i_idev = in6_dev_get(dev); - net->ipv6.ip6_blk_hole_entry->dst.dev = dev; - net->ipv6.ip6_blk_hole_entry->rt6i_idev = in6_dev_get(dev); - #endif -@@ -3054,6 +3093,17 @@ static int __net_init ip6_route_net_init - net->ipv6.ip6_blk_hole_entry->dst.ops = &net->ipv6.ip6_dst_ops; - dst_init_metrics(&net->ipv6.ip6_blk_hole_entry->dst, - ip6_template_metrics, true); -+ -+ net->ipv6.ip6_policy_failed_entry = -+ kmemdup(&ip6_policy_failed_entry_template, -+ sizeof(*net->ipv6.ip6_policy_failed_entry), GFP_KERNEL); -+ if (!net->ipv6.ip6_policy_failed_entry) -+ goto out_ip6_blk_hole_entry; -+ net->ipv6.ip6_policy_failed_entry->dst.path = -+ (struct dst_entry *)net->ipv6.ip6_policy_failed_entry; -+ net->ipv6.ip6_policy_failed_entry->dst.ops = &net->ipv6.ip6_dst_ops; -+ dst_init_metrics(&net->ipv6.ip6_policy_failed_entry->dst, -+ ip6_template_metrics, true); - #endif - - net->ipv6.sysctl.flush_delay = 0; -@@ -3072,6 +3122,8 @@ out: - return ret; - - #ifdef CONFIG_IPV6_MULTIPLE_TABLES -+out_ip6_blk_hole_entry: -+ kfree(net->ipv6.ip6_blk_hole_entry); - out_ip6_prohibit_entry: - kfree(net->ipv6.ip6_prohibit_entry); - out_ip6_null_entry: -@@ -3089,6 +3141,7 @@ static void __net_exit ip6_route_net_exi - #ifdef CONFIG_IPV6_MULTIPLE_TABLES - kfree(net->ipv6.ip6_prohibit_entry); - kfree(net->ipv6.ip6_blk_hole_entry); -+ kfree(net->ipv6.ip6_policy_failed_entry); - #endif - dst_entries_destroy(&net->ipv6.ip6_dst_ops); - } -@@ -3162,6 +3215,9 @@ void __init ip6_route_init_special_entri - init_net.ipv6.ip6_prohibit_entry->rt6i_idev = in6_dev_get(init_net.loopback_dev); - init_net.ipv6.ip6_blk_hole_entry->dst.dev = init_net.loopback_dev; - init_net.ipv6.ip6_blk_hole_entry->rt6i_idev = in6_dev_get(init_net.loopback_dev); -+ init_net.ipv6.ip6_policy_failed_entry->dst.dev = init_net.loopback_dev; -+ init_net.ipv6.ip6_policy_failed_entry->rt6i_idev = -+ in6_dev_get(init_net.loopback_dev); - #endif - } - diff --git a/target/linux/generic/pending-3.18/671-net-provide-defines-for-_POLICY_FAILED-until-all-cod.patch b/target/linux/generic/pending-3.18/671-net-provide-defines-for-_POLICY_FAILED-until-all-cod.patch deleted file mode 100644 index 25a8639397..0000000000 --- a/target/linux/generic/pending-3.18/671-net-provide-defines-for-_POLICY_FAILED-until-all-cod.patch +++ /dev/null @@ -1,53 +0,0 @@ -From 7749b481ce5d7e232b1f7da5e6b2c44816f51681 Mon Sep 17 00:00:00 2001 -From: Jonas Gorski -Date: Sun, 19 Jan 2014 20:45:51 +0100 -Subject: [PATCH 2/2] net: provide defines for _POLICY_FAILED until all code is - updated - -Upstream introduced ICMPV6_POLICY_FAIL for code 5 of destination -unreachable, conflicting with our name. - -Add appropriate defines to allow our code to build with the new -name until we have updated our local patches for older kernels -and userspace packages. - -Signed-off-by: Jonas Gorski ---- - include/uapi/linux/fib_rules.h | 2 ++ - include/uapi/linux/icmpv6.h | 2 ++ - include/uapi/linux/rtnetlink.h | 2 ++ - 3 files changed, 6 insertions(+) - ---- a/include/uapi/linux/fib_rules.h -+++ b/include/uapi/linux/fib_rules.h -@@ -71,6 +71,8 @@ enum { - __FR_ACT_MAX, - }; - -+#define FR_ACT_FAILED_POLICY FR_ACT_POLICY_FAILED -+ - #define FR_ACT_MAX (__FR_ACT_MAX - 1) - - #endif ---- a/include/uapi/linux/icmpv6.h -+++ b/include/uapi/linux/icmpv6.h -@@ -118,6 +118,8 @@ struct icmp6hdr { - #define ICMPV6_POLICY_FAIL 5 - #define ICMPV6_REJECT_ROUTE 6 - -+#define ICMPV6_FAILED_POLICY ICMPV6_POLICY_FAIL -+ - /* - * Codes for Time Exceeded - */ ---- a/include/uapi/linux/rtnetlink.h -+++ b/include/uapi/linux/rtnetlink.h -@@ -207,6 +207,8 @@ enum { - __RTN_MAX - }; - -+#define RTN_FAILED_POLICY RTN_POLICY_FAILED -+ - #define RTN_MAX (__RTN_MAX - 1) - - diff --git a/target/linux/generic/pending-3.18/680-NET-skip-GRO-for-foreign-MAC-addresses.patch b/target/linux/generic/pending-3.18/680-NET-skip-GRO-for-foreign-MAC-addresses.patch deleted file mode 100644 index 038c75b680..0000000000 --- a/target/linux/generic/pending-3.18/680-NET-skip-GRO-for-foreign-MAC-addresses.patch +++ /dev/null @@ -1,160 +0,0 @@ -Subject: NET: skip GRO for foreign MAC addresses - -For network drivers using napi_gro_receive, packets are run through GRO, -even when the destination MAC address does not match, and they're supposed -to be delivered to another host behind a different bridge port. - -This can be very expensive, because for drivers without TSO or scatter- -gather, this can only be undone by copying the skb and checksumming it -again. - -To be able to track foreign MAC addresses in an inexpensive way, create -a mask of changed bits in MAC addresses of upper devices. This allows -handling VLANs and bridge devices with different addresses (as long as -they are not too different). - -Signed-off-by: Felix Fietkau - ---- a/net/core/dev.c -+++ b/net/core/dev.c -@@ -4028,6 +4028,9 @@ static enum gro_result dev_gro_receive(s - enum gro_result ret; - int grow; - -+ if (skb->gro_skip) -+ goto normal; -+ - if (!(skb->dev->features & NETIF_F_GRO)) - goto normal; - -@@ -5103,6 +5106,48 @@ static void __netdev_adjacent_dev_unlink - &upper_dev->adj_list.lower); - } - -+static void __netdev_addr_mask(unsigned char *mask, const unsigned char *addr, -+ struct net_device *dev) -+{ -+ int i; -+ -+ for (i = 0; i < dev->addr_len; i++) -+ mask[i] |= addr[i] ^ dev->dev_addr[i]; -+} -+ -+static void __netdev_upper_mask(unsigned char *mask, struct net_device *dev, -+ struct net_device *lower) -+{ -+ struct net_device *cur; -+ struct list_head *iter; -+ -+ netdev_for_each_upper_dev_rcu(dev, cur, iter) { -+ __netdev_addr_mask(mask, cur->dev_addr, lower); -+ __netdev_upper_mask(mask, cur, lower); -+ } -+} -+ -+static void __netdev_update_addr_mask(struct net_device *dev) -+{ -+ unsigned char mask[MAX_ADDR_LEN]; -+ struct net_device *cur; -+ struct list_head *iter; -+ -+ memset(mask, 0, sizeof(mask)); -+ __netdev_upper_mask(mask, dev, dev); -+ memcpy(dev->local_addr_mask, mask, dev->addr_len); -+ -+ netdev_for_each_lower_dev(dev, cur, iter) -+ __netdev_update_addr_mask(cur); -+} -+ -+static void netdev_update_addr_mask(struct net_device *dev) -+{ -+ rcu_read_lock(); -+ __netdev_update_addr_mask(dev); -+ rcu_read_unlock(); -+} -+ - static int __netdev_upper_dev_link(struct net_device *dev, - struct net_device *upper_dev, bool master, - void *private) -@@ -5163,6 +5208,7 @@ static int __netdev_upper_dev_link(struc - goto rollback_lower_mesh; - } - -+ netdev_update_addr_mask(dev); - call_netdevice_notifiers(NETDEV_CHANGEUPPER, dev); - return 0; - -@@ -5280,6 +5326,7 @@ void netdev_upper_dev_unlink(struct net_ - list_for_each_entry(i, &upper_dev->all_adj_list.upper, list) - __netdev_adjacent_dev_unlink(dev, i->dev, i->ref_nr); - -+ netdev_update_addr_mask(dev); - call_netdevice_notifiers(NETDEV_CHANGEUPPER, dev); - } - EXPORT_SYMBOL(netdev_upper_dev_unlink); -@@ -5799,6 +5846,7 @@ int dev_set_mac_address(struct net_devic - if (err) - return err; - dev->addr_assign_type = NET_ADDR_SET; -+ netdev_update_addr_mask(dev); - call_netdevice_notifiers(NETDEV_CHANGEADDR, dev); - add_device_randomness(dev->dev_addr, dev->addr_len); - return 0; ---- a/include/linux/netdevice.h -+++ b/include/linux/netdevice.h -@@ -1556,6 +1556,8 @@ struct net_device { - struct netdev_hw_addr_list mc; - struct netdev_hw_addr_list dev_addrs; - -+ unsigned char local_addr_mask[MAX_ADDR_LEN]; -+ - #ifdef CONFIG_SYSFS - struct kset *queues_kset; - #endif ---- a/include/linux/skbuff.h -+++ b/include/linux/skbuff.h -@@ -598,7 +598,8 @@ struct sk_buff { - __u8 ipvs_property:1; - - __u8 inner_protocol_type:1; -- /* 4 or 6 bit hole */ -+ __u8 gro_skip:1; -+ /* 3 or 5 bit hole */ - - #ifdef CONFIG_NET_SCHED - __u16 tc_index; /* traffic control index */ ---- a/net/ethernet/eth.c -+++ b/net/ethernet/eth.c -@@ -172,6 +172,18 @@ u32 eth_get_headlen(void *data, unsigned - } - EXPORT_SYMBOL(eth_get_headlen); - -+static inline bool -+eth_check_local_mask(const void *addr1, const void *addr2, const void *mask) -+{ -+ const u16 *a1 = addr1; -+ const u16 *a2 = addr2; -+ const u16 *m = mask; -+ -+ return (((a1[0] ^ a2[0]) & ~m[0]) | -+ ((a1[1] ^ a2[1]) & ~m[1]) | -+ ((a1[2] ^ a2[2]) & ~m[2])); -+} -+ - /** - * eth_type_trans - determine the packet's protocol ID. - * @skb: received socket data -@@ -199,8 +211,12 @@ __be16 eth_type_trans(struct sk_buff *sk - skb->pkt_type = PACKET_MULTICAST; - } - else if (unlikely(!ether_addr_equal_64bits(eth->h_dest, -- dev->dev_addr))) -+ dev->dev_addr))) { - skb->pkt_type = PACKET_OTHERHOST; -+ if (eth_check_local_mask(eth->h_dest, dev->dev_addr, -+ dev->local_addr_mask)) -+ skb->gro_skip = 1; -+ } - - /* - * Some variants of DSA tagging don't have an ethertype field diff --git a/target/linux/generic/pending-3.18/681-NET-add-of_get_mac_address_mtd.patch b/target/linux/generic/pending-3.18/681-NET-add-of_get_mac_address_mtd.patch deleted file mode 100644 index a836eed867..0000000000 --- a/target/linux/generic/pending-3.18/681-NET-add-of_get_mac_address_mtd.patch +++ /dev/null @@ -1,88 +0,0 @@ -From: John Crispin -Date: Sun, 27 Jul 2014 09:40:01 +0100 -Subject: NET: add of_get_mac_address_mtd() - -Many embedded devices have information such as mac addresses stored inside mtd -devices. This patch allows us to add a property inside a node describing a -network interface. The new property points at a mtd partition with an offset -where the mac address can be found. - -Signed-off-by: John Crispin ---- - drivers/of/of_net.c | 37 +++++++++++++++++++++++++++++++++++++ - include/linux/of_net.h | 1 + - 2 files changed, 38 insertions(+) - ---- a/drivers/of/of_net.c -+++ b/drivers/of/of_net.c -@@ -10,6 +10,7 @@ - #include - #include - #include -+#include - - /** - * of_get_phy_mode - Get phy mode for given device_node -@@ -75,3 +76,45 @@ const void *of_get_mac_address(struct de - return NULL; - } - EXPORT_SYMBOL(of_get_mac_address); -+ -+#ifdef CONFIG_MTD -+int of_get_mac_address_mtd(struct device_node *np, unsigned char *mac) -+{ -+ struct device_node *mtd_np = NULL; -+ size_t retlen; -+ int size, ret; -+ struct mtd_info *mtd; -+ const char *part; -+ const __be32 *list; -+ phandle phandle; -+ u32 mac_inc = 0; -+ -+ list = of_get_property(np, "mtd-mac-address", &size); -+ if (!list || (size != (2 * sizeof(*list)))) -+ return -ENOENT; -+ -+ phandle = be32_to_cpup(list++); -+ if (phandle) -+ mtd_np = of_find_node_by_phandle(phandle); -+ -+ if (!mtd_np) -+ return -ENOENT; -+ -+ part = of_get_property(mtd_np, "label", NULL); -+ if (!part) -+ part = mtd_np->name; -+ -+ mtd = get_mtd_device_nm(part); -+ if (IS_ERR(mtd)) -+ return PTR_ERR(mtd); -+ -+ ret = mtd_read(mtd, be32_to_cpup(list), 6, &retlen, mac); -+ put_mtd_device(mtd); -+ -+ if (!of_property_read_u32(np, "mtd-mac-address-increment", &mac_inc)) -+ mac[5] += mac_inc; -+ -+ return ret; -+} -+EXPORT_SYMBOL_GPL(of_get_mac_address_mtd); -+#endif ---- a/include/linux/of_net.h -+++ b/include/linux/of_net.h -@@ -11,6 +11,14 @@ - #include - extern int of_get_phy_mode(struct device_node *np); - extern const void *of_get_mac_address(struct device_node *np); -+#ifdef CONFIG_MTD -+extern int of_get_mac_address_mtd(struct device_node *np, unsigned char *mac); -+#else -+static inline int of_get_mac_address_mtd(struct device_node *np, unsigned char *mac) -+{ -+ return -ENOENT; -+} -+#endif - #else - static inline int of_get_phy_mode(struct device_node *np) - { diff --git a/target/linux/generic/pending-3.18/700-swconfig.patch b/target/linux/generic/pending-3.18/700-swconfig.patch deleted file mode 100644 index 7cf525a509..0000000000 --- a/target/linux/generic/pending-3.18/700-swconfig.patch +++ /dev/null @@ -1,39 +0,0 @@ ---- a/drivers/net/phy/Kconfig -+++ b/drivers/net/phy/Kconfig -@@ -12,6 +12,16 @@ menuconfig PHYLIB - - if PHYLIB - -+config SWCONFIG -+ tristate "Switch configuration API" -+ ---help--- -+ Switch configuration API using netlink. This allows -+ you to configure the VLAN features of certain switches. -+ -+config SWCONFIG_LEDS -+ bool "Switch LED trigger support" -+ depends on (SWCONFIG && LEDS_TRIGGERS) -+ - comment "MII PHY device drivers" - - config AT803X_PHY ---- a/drivers/net/phy/Makefile -+++ b/drivers/net/phy/Makefile -@@ -3,6 +3,7 @@ - libphy-objs := phy.o phy_device.o mdio_bus.o - - obj-$(CONFIG_PHYLIB) += libphy.o -+obj-$(CONFIG_SWCONFIG) += swconfig.o - obj-$(CONFIG_MARVELL_PHY) += marvell.o - obj-$(CONFIG_DAVICOM_PHY) += davicom.o - obj-$(CONFIG_CICADA_PHY) += cicada.o ---- a/include/uapi/linux/Kbuild -+++ b/include/uapi/linux/Kbuild -@@ -374,6 +374,7 @@ header-y += stddef.h - header-y += string.h - header-y += suspend_ioctls.h - header-y += swab.h -+header-y += switch.h - header-y += synclink.h - header-y += sysctl.h - header-y += sysinfo.h diff --git a/target/linux/generic/pending-3.18/701-phy_extension.patch b/target/linux/generic/pending-3.18/701-phy_extension.patch deleted file mode 100644 index ffc310a134..0000000000 --- a/target/linux/generic/pending-3.18/701-phy_extension.patch +++ /dev/null @@ -1,63 +0,0 @@ ---- a/drivers/net/phy/phy.c -+++ b/drivers/net/phy/phy.c -@@ -363,6 +363,50 @@ int phy_ethtool_gset(struct phy_device * - } - EXPORT_SYMBOL(phy_ethtool_gset); - -+int phy_ethtool_ioctl(struct phy_device *phydev, void *useraddr) -+{ -+ u32 cmd; -+ int tmp; -+ struct ethtool_cmd ecmd = { ETHTOOL_GSET }; -+ struct ethtool_value edata = { ETHTOOL_GLINK }; -+ -+ if (get_user(cmd, (u32 *) useraddr)) -+ return -EFAULT; -+ -+ switch (cmd) { -+ case ETHTOOL_GSET: -+ phy_ethtool_gset(phydev, &ecmd); -+ if (copy_to_user(useraddr, &ecmd, sizeof(ecmd))) -+ return -EFAULT; -+ return 0; -+ -+ case ETHTOOL_SSET: -+ if (copy_from_user(&ecmd, useraddr, sizeof(ecmd))) -+ return -EFAULT; -+ return phy_ethtool_sset(phydev, &ecmd); -+ -+ case ETHTOOL_NWAY_RST: -+ /* if autoneg is off, it's an error */ -+ tmp = phy_read(phydev, MII_BMCR); -+ if (tmp & BMCR_ANENABLE) { -+ tmp |= (BMCR_ANRESTART); -+ phy_write(phydev, MII_BMCR, tmp); -+ return 0; -+ } -+ return -EINVAL; -+ -+ case ETHTOOL_GLINK: -+ edata.data = (phy_read(phydev, -+ MII_BMSR) & BMSR_LSTATUS) ? 1 : 0; -+ if (copy_to_user(useraddr, &edata, sizeof(edata))) -+ return -EFAULT; -+ return 0; -+ } -+ -+ return -EOPNOTSUPP; -+} -+EXPORT_SYMBOL(phy_ethtool_ioctl); -+ - /** - * phy_mii_ioctl - generic PHY MII ioctl interface - * @phydev: the phy_device struct ---- a/include/linux/phy.h -+++ b/include/linux/phy.h -@@ -759,6 +759,7 @@ void phy_start_machine(struct phy_device - void phy_stop_machine(struct phy_device *phydev); - int phy_ethtool_sset(struct phy_device *phydev, struct ethtool_cmd *cmd); - int phy_ethtool_gset(struct phy_device *phydev, struct ethtool_cmd *cmd); -+int phy_ethtool_ioctl(struct phy_device *phydev, void *useraddr); - int phy_mii_ioctl(struct phy_device *phydev, struct ifreq *ifr, int cmd); - int phy_start_interrupts(struct phy_device *phydev); - void phy_print_status(struct phy_device *phydev); diff --git a/target/linux/generic/pending-3.18/702-phy_add_aneg_done_function.patch b/target/linux/generic/pending-3.18/702-phy_add_aneg_done_function.patch deleted file mode 100644 index 49ffd27814..0000000000 --- a/target/linux/generic/pending-3.18/702-phy_add_aneg_done_function.patch +++ /dev/null @@ -1,27 +0,0 @@ ---- a/include/linux/phy.h -+++ b/include/linux/phy.h -@@ -480,6 +480,12 @@ struct phy_driver { - /* Determines the negotiated speed and duplex */ - int (*read_status)(struct phy_device *phydev); - -+ /* -+ * Update the value in phydev->link to reflect the -+ * current link value -+ */ -+ int (*update_link)(struct phy_device *phydev); -+ - /* Clears any pending interrupts */ - int (*ack_interrupt)(struct phy_device *phydev); - ---- a/drivers/net/phy/phy_device.c -+++ b/drivers/net/phy/phy_device.c -@@ -915,6 +915,9 @@ int genphy_update_link(struct phy_device - { - int status; - -+ if (phydev->drv && phydev->drv->update_link) -+ return phydev->drv->update_link(phydev); -+ - /* Do a fake read */ - status = phy_read(phydev, MII_BMSR); - if (status < 0) diff --git a/target/linux/generic/pending-3.18/703-phy-add-detach-callback-to-struct-phy_driver.patch b/target/linux/generic/pending-3.18/703-phy-add-detach-callback-to-struct-phy_driver.patch deleted file mode 100644 index ca8e455833..0000000000 --- a/target/linux/generic/pending-3.18/703-phy-add-detach-callback-to-struct-phy_driver.patch +++ /dev/null @@ -1,27 +0,0 @@ ---- a/drivers/net/phy/phy_device.c -+++ b/drivers/net/phy/phy_device.c -@@ -674,6 +674,9 @@ void phy_detach(struct phy_device *phyde - { - int i; - -+ if (phydev->drv && phydev->drv->detach) -+ phydev->drv->detach(phydev); -+ - if (phydev->bus->dev.driver) - module_put(phydev->bus->dev.driver->owner); - ---- a/include/linux/phy.h -+++ b/include/linux/phy.h -@@ -498,6 +498,12 @@ struct phy_driver { - */ - int (*did_interrupt)(struct phy_device *phydev); - -+ /* -+ * Called before an ethernet device is detached -+ * from the PHY. -+ */ -+ void (*detach)(struct phy_device *phydev); -+ - /* Clears up any memory if needed */ - void (*remove)(struct phy_device *phydev); - diff --git a/target/linux/generic/pending-3.18/710-phy-add-mdio_register_board_info.patch b/target/linux/generic/pending-3.18/710-phy-add-mdio_register_board_info.patch deleted file mode 100644 index 60026b474c..0000000000 --- a/target/linux/generic/pending-3.18/710-phy-add-mdio_register_board_info.patch +++ /dev/null @@ -1,192 +0,0 @@ ---- a/drivers/net/phy/mdio_bus.c -+++ b/drivers/net/phy/mdio_bus.c -@@ -38,6 +38,8 @@ - - #include - -+#include "mdio-boardinfo.h" -+ - /** - * mdiobus_alloc_size - allocate a mii_bus structure - * @size: extra amount of memory to allocate for private storage. -@@ -335,9 +337,21 @@ void mdiobus_free(struct mii_bus *bus) - } - EXPORT_SYMBOL(mdiobus_free); - -+static void mdiobus_setup_phydev_from_boardinfo(struct mii_bus *bus, -+ struct phy_device *phydev, -+ struct mdio_board_info *bi) -+{ -+ if (strcmp(bus->id, bi->bus_id) || -+ bi->phy_addr != phydev->addr) -+ return; -+ -+ phydev->dev.platform_data = (void *) bi->platform_data; -+} -+ - struct phy_device *mdiobus_scan(struct mii_bus *bus, int addr) - { - struct phy_device *phydev; -+ struct mdio_board_entry *be; - int err; - - phydev = get_phy_device(bus, addr, false); -@@ -350,6 +364,12 @@ struct phy_device *mdiobus_scan(struct m - */ - of_mdiobus_link_phydev(bus, phydev); - -+ mutex_lock(&__mdio_board_lock); -+ list_for_each_entry(be, &__mdio_board_list, list) -+ mdiobus_setup_phydev_from_boardinfo(bus, phydev, -+ &be->board_info); -+ mutex_unlock(&__mdio_board_lock); -+ - err = phy_device_register(phydev); - if (err) { - phy_device_free(phydev); ---- a/include/linux/phy.h -+++ b/include/linux/phy.h -@@ -796,4 +796,22 @@ int __init mdio_bus_init(void); - void mdio_bus_exit(void); - - extern struct bus_type mdio_bus_type; -+ -+struct mdio_board_info { -+ const char *bus_id; -+ int phy_addr; -+ -+ const void *platform_data; -+}; -+ -+#ifdef CONFIG_MDIO_BOARDINFO -+int mdiobus_register_board_info(const struct mdio_board_info *info, unsigned n); -+#else -+static inline int -+mdiobus_register_board_info(const struct mdio_board_info *info, unsigned n) -+{ -+ return 0; -+} -+#endif -+ - #endif /* __PHY_H */ ---- a/drivers/net/phy/Kconfig -+++ b/drivers/net/phy/Kconfig -@@ -12,6 +12,10 @@ menuconfig PHYLIB - - if PHYLIB - -+config MDIO_BOARDINFO -+ bool -+ default y -+ - config SWCONFIG - tristate "Switch configuration API" - ---help--- ---- a/drivers/net/phy/Makefile -+++ b/drivers/net/phy/Makefile -@@ -2,6 +2,8 @@ - - libphy-objs := phy.o phy_device.o mdio_bus.o - -+obj-$(CONFIG_MDIO_BOARDINFO) += mdio-boardinfo.o -+ - obj-$(CONFIG_PHYLIB) += libphy.o - obj-$(CONFIG_SWCONFIG) += swconfig.o - obj-$(CONFIG_MARVELL_PHY) += marvell.o ---- /dev/null -+++ b/drivers/net/phy/mdio-boardinfo.c -@@ -0,0 +1,58 @@ -+/* -+ * mdio-boardinfo.c - collect pre-declarations of PHY devices -+ * -+ * 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 -+#include -+#include -+#include -+#include -+#include -+ -+#include "mdio-boardinfo.h" -+ -+/* -+ * These symbols are exported ONLY FOR the mdio_bus component. -+ * No other users will be supported. -+ */ -+ -+LIST_HEAD(__mdio_board_list); -+EXPORT_SYMBOL_GPL(__mdio_board_list); -+ -+DEFINE_MUTEX(__mdio_board_lock); -+EXPORT_SYMBOL_GPL(__mdio_board_lock); -+ -+/** -+ * mdio_register_board_info - register PHY devices for a given board -+ * @info: array of chip descriptors -+ * @n: how many descriptors are provided -+ * Context: can sleep -+ * -+ * The board info passed can safely be __initdata ... but be careful of -+ * any embedded pointers (platform_data, etc), they're copied as-is. -+ */ -+int __init -+mdiobus_register_board_info(struct mdio_board_info const *info, unsigned n) -+{ -+ struct mdio_board_entry *be; -+ int i; -+ -+ be = kzalloc(n * sizeof(*be), GFP_KERNEL); -+ if (!be) -+ return -ENOMEM; -+ -+ for (i = 0; i < n; i++, be++, info++) { -+ memcpy(&be->board_info, info, sizeof(*info)); -+ mutex_lock(&__mdio_board_lock); -+ list_add_tail(&be->list, &__mdio_board_list); -+ mutex_unlock(&__mdio_board_lock); -+ } -+ -+ return 0; -+} ---- /dev/null -+++ b/drivers/net/phy/mdio-boardinfo.h -@@ -0,0 +1,22 @@ -+/* -+ * mdio-boardinfo.h - boardinfo interface internal to the mdio_bus component -+ * -+ * 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 -+ -+struct mdio_board_entry { -+ struct list_head list; -+ struct mdio_board_info board_info; -+}; -+ -+/* __mdio_board_lock protects __mdio_board_list -+ * only mdio_bus components are allowed to use these symbols. -+ */ -+extern struct mutex __mdio_board_lock; -+extern struct list_head __mdio_board_list; ---- a/drivers/net/Makefile -+++ b/drivers/net/Makefile -@@ -15,7 +15,7 @@ obj-$(CONFIG_MII) += mii.o - obj-$(CONFIG_MDIO) += mdio.o - obj-$(CONFIG_NET) += Space.o loopback.o - obj-$(CONFIG_NETCONSOLE) += netconsole.o --obj-$(CONFIG_PHYLIB) += phy/ -+obj-y += phy/ - obj-$(CONFIG_RIONET) += rionet.o - obj-$(CONFIG_NET_TEAM) += team/ - obj-$(CONFIG_TUN) += tun.o diff --git a/target/linux/generic/pending-3.18/720-phy_adm6996.patch b/target/linux/generic/pending-3.18/720-phy_adm6996.patch deleted file mode 100644 index b0b8db4e5d..0000000000 --- a/target/linux/generic/pending-3.18/720-phy_adm6996.patch +++ /dev/null @@ -1,26 +0,0 @@ ---- a/drivers/net/phy/Kconfig -+++ b/drivers/net/phy/Kconfig -@@ -132,6 +132,13 @@ config MICREL_PHY - ---help--- - Supports the KSZ9021, VSC8201, KS8001 PHYs. - -+config ADM6996_PHY -+ tristate "Driver for ADM6996 switches" -+ select SWCONFIG -+ ---help--- -+ Currently supports the ADM6996FC and ADM6996M switches. -+ Support for FC is very limited. -+ - config FIXED_PHY - bool "Driver for MDIO Bus/PHY emulation with fixed speed/link PHYs" - depends on PHYLIB=y ---- a/drivers/net/phy/Makefile -+++ b/drivers/net/phy/Makefile -@@ -18,6 +18,7 @@ obj-$(CONFIG_BCM63XX_PHY) += bcm63xx.o - obj-$(CONFIG_BCM7XXX_PHY) += bcm7xxx.o - obj-$(CONFIG_BCM87XX_PHY) += bcm87xx.o - obj-$(CONFIG_ICPLUS_PHY) += icplus.o -+obj-$(CONFIG_ADM6996_PHY) += adm6996.o - obj-$(CONFIG_REALTEK_PHY) += realtek.o - obj-$(CONFIG_LSI_ET1011C_PHY) += et1011c.o - obj-$(CONFIG_FIXED_PHY) += fixed.o diff --git a/target/linux/generic/pending-3.18/721-phy_packets.patch b/target/linux/generic/pending-3.18/721-phy_packets.patch deleted file mode 100644 index ed51bb1d2d..0000000000 --- a/target/linux/generic/pending-3.18/721-phy_packets.patch +++ /dev/null @@ -1,161 +0,0 @@ ---- a/include/linux/netdevice.h -+++ b/include/linux/netdevice.h -@@ -1228,6 +1228,7 @@ enum netdev_priv_flags { - IFF_LIVE_ADDR_CHANGE = 1<<20, - IFF_MACVLAN = 1<<21, - IFF_XMIT_DST_RELEASE_PERM = 1<<22, -+ IFF_NO_IP_ALIGN = 1<<23, - }; - - #define IFF_802_1Q_VLAN IFF_802_1Q_VLAN -@@ -1253,6 +1254,7 @@ enum netdev_priv_flags { - #define IFF_LIVE_ADDR_CHANGE IFF_LIVE_ADDR_CHANGE - #define IFF_MACVLAN IFF_MACVLAN - #define IFF_XMIT_DST_RELEASE_PERM IFF_XMIT_DST_RELEASE_PERM -+#define IFF_NO_IP_ALIGN IFF_NO_IP_ALIGN - - /** - * struct net_device - The DEVICE structure. -@@ -1523,6 +1525,11 @@ struct net_device { - const struct ethtool_ops *ethtool_ops; - const struct forwarding_accel_ops *fwd_ops; - -+#ifdef CONFIG_ETHERNET_PACKET_MANGLE -+ void (*eth_mangle_rx)(struct net_device *dev, struct sk_buff *skb); -+ struct sk_buff *(*eth_mangle_tx)(struct net_device *dev, struct sk_buff *skb); -+#endif -+ - const struct header_ops *header_ops; - - unsigned int flags; -@@ -1587,6 +1594,10 @@ struct net_device { - void *ax25_ptr; - struct wireless_dev *ieee80211_ptr; - -+#ifdef CONFIG_ETHERNET_PACKET_MANGLE -+ void *phy_ptr; /* PHY device specific data */ -+#endif -+ - /* - * Cache lines mostly used on receive path (including eth_type_trans()) - */ ---- a/include/linux/skbuff.h -+++ b/include/linux/skbuff.h -@@ -2055,6 +2055,10 @@ static inline int pskb_trim(struct sk_bu - return (len < skb->len) ? __pskb_trim(skb, len) : 0; - } - -+extern struct sk_buff *__netdev_alloc_skb_ip_align(struct net_device *dev, -+ unsigned int length, gfp_t gfp); -+ -+ - /** - * pskb_trim_unique - remove end from a paged unique (not cloned) buffer - * @skb: buffer to alter -@@ -2181,16 +2185,6 @@ static inline struct sk_buff *dev_alloc_ - } - - --static inline struct sk_buff *__netdev_alloc_skb_ip_align(struct net_device *dev, -- unsigned int length, gfp_t gfp) --{ -- struct sk_buff *skb = __netdev_alloc_skb(dev, length + NET_IP_ALIGN, gfp); -- -- if (NET_IP_ALIGN && skb) -- skb_reserve(skb, NET_IP_ALIGN); -- return skb; --} -- - static inline struct sk_buff *netdev_alloc_skb_ip_align(struct net_device *dev, - unsigned int length) - { ---- a/net/Kconfig -+++ b/net/Kconfig -@@ -25,6 +25,12 @@ menuconfig NET - - if NET - -+config ETHERNET_PACKET_MANGLE -+ bool -+ help -+ This option can be selected by phy drivers that need to mangle -+ packets going in or out of an ethernet device. -+ - config WANT_COMPAT_NETLINK_MESSAGES - bool - help ---- a/net/core/dev.c -+++ b/net/core/dev.c -@@ -2637,10 +2637,20 @@ static int xmit_one(struct sk_buff *skb, - if (!list_empty(&ptype_all)) - dev_queue_xmit_nit(skb, dev); - -- len = skb->len; -- trace_net_dev_start_xmit(skb, dev); -- rc = netdev_start_xmit(skb, dev, txq, more); -- trace_net_dev_xmit(skb, rc, dev, len); -+#ifdef CONFIG_ETHERNET_PACKET_MANGLE -+ if (!dev->eth_mangle_tx || -+ (skb = dev->eth_mangle_tx(dev, skb)) != NULL) -+#else -+ if (1) -+#endif -+ { -+ len = skb->len; -+ trace_net_dev_start_xmit(skb, dev); -+ rc = netdev_start_xmit(skb, dev, txq, more); -+ trace_net_dev_xmit(skb, rc, dev, len); -+ } else { -+ rc = NETDEV_TX_OK; -+ } - - return rc; - } ---- a/net/core/skbuff.c -+++ b/net/core/skbuff.c -@@ -63,6 +63,7 @@ - #include - #include - #include -+#include - - #include - #include -@@ -471,6 +472,22 @@ struct sk_buff *__netdev_alloc_skb(struc - } - EXPORT_SYMBOL(__netdev_alloc_skb); - -+struct sk_buff *__netdev_alloc_skb_ip_align(struct net_device *dev, -+ unsigned int length, gfp_t gfp) -+{ -+ struct sk_buff *skb = __netdev_alloc_skb(dev, length + NET_IP_ALIGN, gfp); -+ -+#ifdef CONFIG_ETHERNET_PACKET_MANGLE -+ if (dev && (dev->priv_flags & IFF_NO_IP_ALIGN)) -+ return skb; -+#endif -+ -+ if (NET_IP_ALIGN && skb) -+ skb_reserve(skb, NET_IP_ALIGN); -+ return skb; -+} -+EXPORT_SYMBOL(__netdev_alloc_skb_ip_align); -+ - void skb_add_rx_frag(struct sk_buff *skb, int i, struct page *page, int off, - int size, unsigned int truesize) - { ---- a/net/ethernet/eth.c -+++ b/net/ethernet/eth.c -@@ -200,6 +200,12 @@ __be16 eth_type_trans(struct sk_buff *sk - const struct ethhdr *eth; - - skb->dev = dev; -+ -+#ifdef CONFIG_ETHERNET_PACKET_MANGLE -+ if (dev->eth_mangle_rx) -+ dev->eth_mangle_rx(dev, skb); -+#endif -+ - skb_reset_mac_header(skb); - skb_pull_inline(skb, ETH_HLEN); - eth = eth_hdr(skb); diff --git a/target/linux/generic/pending-3.18/722-phy_mvswitch.patch b/target/linux/generic/pending-3.18/722-phy_mvswitch.patch deleted file mode 100644 index f577a9f684..0000000000 --- a/target/linux/generic/pending-3.18/722-phy_mvswitch.patch +++ /dev/null @@ -1,23 +0,0 @@ ---- a/drivers/net/phy/Kconfig -+++ b/drivers/net/phy/Kconfig -@@ -139,6 +139,10 @@ config ADM6996_PHY - Currently supports the ADM6996FC and ADM6996M switches. - Support for FC is very limited. - -+config MVSWITCH_PHY -+ tristate "Driver for Marvell 88E6060 switches" -+ select ETHERNET_PACKET_MANGLE -+ - config FIXED_PHY - bool "Driver for MDIO Bus/PHY emulation with fixed speed/link PHYs" - depends on PHYLIB=y ---- a/drivers/net/phy/Makefile -+++ b/drivers/net/phy/Makefile -@@ -19,6 +19,7 @@ obj-$(CONFIG_BCM7XXX_PHY) += bcm7xxx.o - obj-$(CONFIG_BCM87XX_PHY) += bcm87xx.o - obj-$(CONFIG_ICPLUS_PHY) += icplus.o - obj-$(CONFIG_ADM6996_PHY) += adm6996.o -+obj-$(CONFIG_MVSWITCH_PHY) += mvswitch.o - obj-$(CONFIG_REALTEK_PHY) += realtek.o - obj-$(CONFIG_LSI_ET1011C_PHY) += et1011c.o - obj-$(CONFIG_FIXED_PHY) += fixed.o diff --git a/target/linux/generic/pending-3.18/723-phy_ip175c.patch b/target/linux/generic/pending-3.18/723-phy_ip175c.patch deleted file mode 100644 index c7c4f99eec..0000000000 --- a/target/linux/generic/pending-3.18/723-phy_ip175c.patch +++ /dev/null @@ -1,23 +0,0 @@ ---- a/drivers/net/phy/Kconfig -+++ b/drivers/net/phy/Kconfig -@@ -143,6 +143,10 @@ config MVSWITCH_PHY - tristate "Driver for Marvell 88E6060 switches" - select ETHERNET_PACKET_MANGLE - -+config IP17XX_PHY -+ tristate "Driver for IC+ IP17xx switches" -+ select SWCONFIG -+ - config FIXED_PHY - bool "Driver for MDIO Bus/PHY emulation with fixed speed/link PHYs" - depends on PHYLIB=y ---- a/drivers/net/phy/Makefile -+++ b/drivers/net/phy/Makefile -@@ -20,6 +20,7 @@ obj-$(CONFIG_BCM87XX_PHY) += bcm87xx.o - obj-$(CONFIG_ICPLUS_PHY) += icplus.o - obj-$(CONFIG_ADM6996_PHY) += adm6996.o - obj-$(CONFIG_MVSWITCH_PHY) += mvswitch.o -+obj-$(CONFIG_IP17XX_PHY) += ip17xx.o - obj-$(CONFIG_REALTEK_PHY) += realtek.o - obj-$(CONFIG_LSI_ET1011C_PHY) += et1011c.o - obj-$(CONFIG_FIXED_PHY) += fixed.o diff --git a/target/linux/generic/pending-3.18/724-phy_ar8216.patch b/target/linux/generic/pending-3.18/724-phy_ar8216.patch deleted file mode 100644 index acb2df8f83..0000000000 --- a/target/linux/generic/pending-3.18/724-phy_ar8216.patch +++ /dev/null @@ -1,24 +0,0 @@ ---- a/drivers/net/phy/Kconfig -+++ b/drivers/net/phy/Kconfig -@@ -147,6 +147,11 @@ config IP17XX_PHY - tristate "Driver for IC+ IP17xx switches" - select SWCONFIG - -+config AR8216_PHY -+ tristate "Driver for Atheros AR8216 switches" -+ select ETHERNET_PACKET_MANGLE -+ select SWCONFIG -+ - config FIXED_PHY - bool "Driver for MDIO Bus/PHY emulation with fixed speed/link PHYs" - depends on PHYLIB=y ---- a/drivers/net/phy/Makefile -+++ b/drivers/net/phy/Makefile -@@ -22,6 +22,7 @@ obj-$(CONFIG_ADM6996_PHY) += adm6996.o - obj-$(CONFIG_MVSWITCH_PHY) += mvswitch.o - obj-$(CONFIG_IP17XX_PHY) += ip17xx.o - obj-$(CONFIG_REALTEK_PHY) += realtek.o -+obj-$(CONFIG_AR8216_PHY) += ar8216.o ar8327.o - obj-$(CONFIG_LSI_ET1011C_PHY) += et1011c.o - obj-$(CONFIG_FIXED_PHY) += fixed.o - obj-$(CONFIG_MDIO_BITBANG) += mdio-bitbang.o diff --git a/target/linux/generic/pending-3.18/725-phy_rtl8306.patch b/target/linux/generic/pending-3.18/725-phy_rtl8306.patch deleted file mode 100644 index 78ac6ce98a..0000000000 --- a/target/linux/generic/pending-3.18/725-phy_rtl8306.patch +++ /dev/null @@ -1,23 +0,0 @@ ---- a/drivers/net/phy/Kconfig -+++ b/drivers/net/phy/Kconfig -@@ -152,6 +152,10 @@ config AR8216_PHY - select ETHERNET_PACKET_MANGLE - select SWCONFIG - -+config RTL8306_PHY -+ tristate "Driver for Realtek RTL8306S switches" -+ select SWCONFIG -+ - config FIXED_PHY - bool "Driver for MDIO Bus/PHY emulation with fixed speed/link PHYs" - depends on PHYLIB=y ---- a/drivers/net/phy/Makefile -+++ b/drivers/net/phy/Makefile -@@ -23,6 +23,7 @@ obj-$(CONFIG_MVSWITCH_PHY) += mvswitch.o - obj-$(CONFIG_IP17XX_PHY) += ip17xx.o - obj-$(CONFIG_REALTEK_PHY) += realtek.o - obj-$(CONFIG_AR8216_PHY) += ar8216.o ar8327.o -+obj-$(CONFIG_RTL8306_PHY) += rtl8306.o - obj-$(CONFIG_LSI_ET1011C_PHY) += et1011c.o - obj-$(CONFIG_FIXED_PHY) += fixed.o - obj-$(CONFIG_MDIO_BITBANG) += mdio-bitbang.o diff --git a/target/linux/generic/pending-3.18/726-phy_rtl8366.patch b/target/linux/generic/pending-3.18/726-phy_rtl8366.patch deleted file mode 100644 index 4a4a4acee0..0000000000 --- a/target/linux/generic/pending-3.18/726-phy_rtl8366.patch +++ /dev/null @@ -1,45 +0,0 @@ ---- a/drivers/net/phy/Kconfig -+++ b/drivers/net/phy/Kconfig -@@ -250,6 +250,30 @@ config MDIO_BCM_UNIMAC - controllers as well as some Broadcom Ethernet switches such as the - Starfighter 2 switches. - -+config RTL8366_SMI -+ tristate "Driver for the RTL8366 SMI interface" -+ depends on GPIOLIB -+ ---help--- -+ This module implements the SMI interface protocol which is used -+ by some RTL8366 ethernet switch devices via the generic GPIO API. -+ -+if RTL8366_SMI -+ -+config RTL8366_SMI_DEBUG_FS -+ bool "RTL8366 SMI interface debugfs support" -+ depends on DEBUG_FS -+ default n -+ -+config RTL8366S_PHY -+ tristate "Driver for the Realtek RTL8366S switch" -+ select SWCONFIG -+ -+config RTL8366RB_PHY -+ tristate "Driver for the Realtek RTL8366RB switch" -+ select SWCONFIG -+ -+endif # RTL8366_SMI -+ - endif # PHYLIB - - config MICREL_KS8995MA ---- a/drivers/net/phy/Makefile -+++ b/drivers/net/phy/Makefile -@@ -24,6 +24,9 @@ obj-$(CONFIG_IP17XX_PHY) += ip17xx.o - obj-$(CONFIG_REALTEK_PHY) += realtek.o - obj-$(CONFIG_AR8216_PHY) += ar8216.o ar8327.o - obj-$(CONFIG_RTL8306_PHY) += rtl8306.o -+obj-$(CONFIG_RTL8366_SMI) += rtl8366_smi.o -+obj-$(CONFIG_RTL8366S_PHY) += rtl8366s.o -+obj-$(CONFIG_RTL8366RB_PHY) += rtl8366rb.o - obj-$(CONFIG_LSI_ET1011C_PHY) += et1011c.o - obj-$(CONFIG_FIXED_PHY) += fixed.o - obj-$(CONFIG_MDIO_BITBANG) += mdio-bitbang.o diff --git a/target/linux/generic/pending-3.18/727-phy-rtl8367.patch b/target/linux/generic/pending-3.18/727-phy-rtl8367.patch deleted file mode 100644 index 8481b589d9..0000000000 --- a/target/linux/generic/pending-3.18/727-phy-rtl8367.patch +++ /dev/null @@ -1,23 +0,0 @@ ---- a/drivers/net/phy/Kconfig -+++ b/drivers/net/phy/Kconfig -@@ -272,6 +272,10 @@ config RTL8366RB_PHY - tristate "Driver for the Realtek RTL8366RB switch" - select SWCONFIG - -+config RTL8367_PHY -+ tristate "Driver for the Realtek RTL8367R/M switches" -+ select SWCONFIG -+ - endif # RTL8366_SMI - - endif # PHYLIB ---- a/drivers/net/phy/Makefile -+++ b/drivers/net/phy/Makefile -@@ -27,6 +27,7 @@ obj-$(CONFIG_RTL8306_PHY) += rtl8306.o - obj-$(CONFIG_RTL8366_SMI) += rtl8366_smi.o - obj-$(CONFIG_RTL8366S_PHY) += rtl8366s.o - obj-$(CONFIG_RTL8366RB_PHY) += rtl8366rb.o -+obj-$(CONFIG_RTL8367_PHY) += rtl8367.o - obj-$(CONFIG_LSI_ET1011C_PHY) += et1011c.o - obj-$(CONFIG_FIXED_PHY) += fixed.o - obj-$(CONFIG_MDIO_BITBANG) += mdio-bitbang.o diff --git a/target/linux/generic/pending-3.18/728-phy-rtl8367b.patch b/target/linux/generic/pending-3.18/728-phy-rtl8367b.patch deleted file mode 100644 index 958ff58907..0000000000 --- a/target/linux/generic/pending-3.18/728-phy-rtl8367b.patch +++ /dev/null @@ -1,23 +0,0 @@ ---- a/drivers/net/phy/Kconfig -+++ b/drivers/net/phy/Kconfig -@@ -276,6 +276,10 @@ config RTL8367_PHY - tristate "Driver for the Realtek RTL8367R/M switches" - select SWCONFIG - -+config RTL8367B_PHY -+ tristate "Driver fot the Realtek RTL8367R-VB switch" -+ select SWCONFIG -+ - endif # RTL8366_SMI - - endif # PHYLIB ---- a/drivers/net/phy/Makefile -+++ b/drivers/net/phy/Makefile -@@ -28,6 +28,7 @@ obj-$(CONFIG_RTL8366_SMI) += rtl8366_smi - obj-$(CONFIG_RTL8366S_PHY) += rtl8366s.o - obj-$(CONFIG_RTL8366RB_PHY) += rtl8366rb.o - obj-$(CONFIG_RTL8367_PHY) += rtl8367.o -+obj-$(CONFIG_RTL8367B_PHY) += rtl8367b.o - obj-$(CONFIG_LSI_ET1011C_PHY) += et1011c.o - obj-$(CONFIG_FIXED_PHY) += fixed.o - obj-$(CONFIG_MDIO_BITBANG) += mdio-bitbang.o diff --git a/target/linux/generic/pending-3.18/729-phy-tantos.patch b/target/linux/generic/pending-3.18/729-phy-tantos.patch deleted file mode 100644 index 019f919492..0000000000 --- a/target/linux/generic/pending-3.18/729-phy-tantos.patch +++ /dev/null @@ -1,21 +0,0 @@ ---- a/drivers/net/phy/Kconfig -+++ b/drivers/net/phy/Kconfig -@@ -287,3 +287,8 @@ endif # PHYLIB - config MICREL_KS8995MA - tristate "Micrel KS8995MA 5-ports 10/100 managed Ethernet switch" - depends on SPI -+ -+config PSB6970_PHY -+ tristate "Lantiq XWAY Tantos (PSB6970) Ethernet switch" -+ select SWCONFIG -+ select ETHERNET_PACKET_MANGLE ---- a/drivers/net/phy/Makefile -+++ b/drivers/net/phy/Makefile -@@ -30,6 +30,7 @@ obj-$(CONFIG_RTL8366RB_PHY) += rtl8366rb - obj-$(CONFIG_RTL8367_PHY) += rtl8367.o - obj-$(CONFIG_RTL8367B_PHY) += rtl8367b.o - obj-$(CONFIG_LSI_ET1011C_PHY) += et1011c.o -+obj-$(CONFIG_PSB6970_PHY) += psb6970.o - obj-$(CONFIG_FIXED_PHY) += fixed.o - obj-$(CONFIG_MDIO_BITBANG) += mdio-bitbang.o - obj-$(CONFIG_MDIO_GPIO) += mdio-gpio.o diff --git a/target/linux/generic/pending-3.18/730-phy_b53.patch b/target/linux/generic/pending-3.18/730-phy_b53.patch deleted file mode 100644 index 8137693b3c..0000000000 --- a/target/linux/generic/pending-3.18/730-phy_b53.patch +++ /dev/null @@ -1,60 +0,0 @@ ---- a/drivers/net/phy/Kconfig -+++ b/drivers/net/phy/Kconfig -@@ -282,6 +282,8 @@ config RTL8367B_PHY - - endif # RTL8366_SMI - -+source "drivers/net/phy/b53/Kconfig" -+ - endif # PHYLIB - - config MICREL_KS8995MA ---- a/drivers/net/phy/Makefile -+++ b/drivers/net/phy/Makefile -@@ -31,6 +31,7 @@ obj-$(CONFIG_RTL8367_PHY) += rtl8367.o - obj-$(CONFIG_RTL8367B_PHY) += rtl8367b.o - obj-$(CONFIG_LSI_ET1011C_PHY) += et1011c.o - obj-$(CONFIG_PSB6970_PHY) += psb6970.o -+obj-$(CONFIG_SWCONFIG_B53) += b53/ - obj-$(CONFIG_FIXED_PHY) += fixed.o - obj-$(CONFIG_MDIO_BITBANG) += mdio-bitbang.o - obj-$(CONFIG_MDIO_GPIO) += mdio-gpio.o ---- /dev/null -+++ b/linux/platform_data/b53.h -@@ -0,0 +1,36 @@ -+/* -+ * B53 platform data -+ * -+ * Copyright (C) 2013 Jonas Gorski -+ * -+ * Permission to use, copy, modify, and/or distribute this software for any -+ * purpose with or without fee is hereby granted, provided that the above -+ * copyright notice and this permission notice appear in all copies. -+ * -+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -+ */ -+ -+#ifndef __B53_H -+#define __B53_H -+ -+#include -+ -+struct b53_platform_data { -+ u32 chip_id; -+ u16 enabled_ports; -+ -+ /* allow to specify an ethX alias */ -+ const char *alias; -+ -+ /* only used by MMAP'd driver */ -+ unsigned big_endian:1; -+ void __iomem *regs; -+}; -+ -+#endif diff --git a/target/linux/generic/pending-3.18/732-phy-ar8216-led-support.patch b/target/linux/generic/pending-3.18/732-phy-ar8216-led-support.patch deleted file mode 100644 index c753967572..0000000000 --- a/target/linux/generic/pending-3.18/732-phy-ar8216-led-support.patch +++ /dev/null @@ -1,13 +0,0 @@ ---- a/drivers/net/phy/Kconfig -+++ b/drivers/net/phy/Kconfig -@@ -152,6 +152,10 @@ config AR8216_PHY - select ETHERNET_PACKET_MANGLE - select SWCONFIG - -+config AR8216_PHY_LEDS -+ bool "Atheros AR8216 switch LED support" -+ depends on (AR8216_PHY && LEDS_CLASS) -+ - config RTL8306_PHY - tristate "Driver for Realtek RTL8306S switches" - select SWCONFIG diff --git a/target/linux/generic/pending-3.18/733-phy_mvsw61xx.patch b/target/linux/generic/pending-3.18/733-phy_mvsw61xx.patch deleted file mode 100644 index 041d168b65..0000000000 --- a/target/linux/generic/pending-3.18/733-phy_mvsw61xx.patch +++ /dev/null @@ -1,23 +0,0 @@ ---- a/drivers/net/phy/Kconfig -+++ b/drivers/net/phy/Kconfig -@@ -143,6 +143,10 @@ config MVSWITCH_PHY - tristate "Driver for Marvell 88E6060 switches" - select ETHERNET_PACKET_MANGLE - -+config MVSW61XX_PHY -+ tristate "Driver for Marvell 88E6171/6172 switches" -+ select SWCONFIG -+ - config IP17XX_PHY - tristate "Driver for IC+ IP17xx switches" - select SWCONFIG ---- a/drivers/net/phy/Makefile -+++ b/drivers/net/phy/Makefile -@@ -20,6 +20,7 @@ obj-$(CONFIG_BCM87XX_PHY) += bcm87xx.o - obj-$(CONFIG_ICPLUS_PHY) += icplus.o - obj-$(CONFIG_ADM6996_PHY) += adm6996.o - obj-$(CONFIG_MVSWITCH_PHY) += mvswitch.o -+obj-$(CONFIG_MVSW61XX_PHY) += mvsw61xx.o - obj-$(CONFIG_IP17XX_PHY) += ip17xx.o - obj-$(CONFIG_REALTEK_PHY) += realtek.o - obj-$(CONFIG_AR8216_PHY) += ar8216.o ar8327.o diff --git a/target/linux/generic/pending-3.18/734-net-phy-at803x-allow-to-configure-via-pdata.patch b/target/linux/generic/pending-3.18/734-net-phy-at803x-allow-to-configure-via-pdata.patch deleted file mode 100644 index 0d021ac7bd..0000000000 --- a/target/linux/generic/pending-3.18/734-net-phy-at803x-allow-to-configure-via-pdata.patch +++ /dev/null @@ -1,180 +0,0 @@ ---- a/drivers/net/phy/at803x.c -+++ b/drivers/net/phy/at803x.c -@@ -12,12 +12,14 @@ - */ - - #include -+#include - #include - #include - #include - #include - #include - #include -+#include - - #define AT803X_INTR_ENABLE 0x12 - #define AT803X_INTR_STATUS 0x13 -@@ -34,8 +36,16 @@ - #define AT803X_INER 0x0012 - #define AT803X_INER_INIT 0xec00 - #define AT803X_INSR 0x0013 -+ -+#define AT803X_PCS_SMART_EEE_CTRL3 0x805D -+#define AT803X_SMART_EEE_CTRL3_LPI_TX_DELAY_SEL_MASK 0x3 -+#define AT803X_SMART_EEE_CTRL3_LPI_TX_DELAY_SEL_SHIFT 12 -+#define AT803X_SMART_EEE_CTRL3_LPI_EN BIT(8) -+ - #define AT803X_DEBUG_ADDR 0x1D - #define AT803X_DEBUG_DATA 0x1E -+#define AT803X_DBG0_REG 0x00 -+#define AT803X_DEBUG_RGMII_RX_CLK_DLY BIT(8) - #define AT803X_DEBUG_SYSTEM_MODE_CTRL 0x05 - #define AT803X_DEBUG_RGMII_TX_CLK_DLY BIT(8) - -@@ -50,6 +60,7 @@ MODULE_LICENSE("GPL"); - struct at803x_priv { - bool phy_reset:1; - struct gpio_desc *gpiod_reset; -+ int prev_speed; - }; - - struct at803x_context { -@@ -61,6 +72,43 @@ struct at803x_context { - u16 led_control; - }; - -+static u16 -+at803x_dbg_reg_rmw(struct phy_device *phydev, u16 reg, u16 clear, u16 set) -+{ -+ struct mii_bus *bus = phydev->bus; -+ int val; -+ -+ mutex_lock(&bus->mdio_lock); -+ -+ bus->write(bus, phydev->addr, AT803X_DEBUG_ADDR, reg); -+ val = bus->read(bus, phydev->addr, AT803X_DEBUG_DATA); -+ if (val < 0) { -+ val = 0xffff; -+ goto out; -+ } -+ -+ val &= ~clear; -+ val |= set; -+ bus->write(bus, phydev->addr, AT803X_DEBUG_DATA, val); -+ -+out: -+ mutex_unlock(&bus->mdio_lock); -+ return val; -+} -+ -+static inline void -+at803x_dbg_reg_set(struct phy_device *phydev, u16 reg, u16 set) -+{ -+ at803x_dbg_reg_rmw(phydev, reg, 0, set); -+} -+ -+static inline void -+at803x_dbg_reg_clr(struct phy_device *phydev, u16 reg, u16 clear) -+{ -+ at803x_dbg_reg_rmw(phydev, reg, clear, 0); -+} -+ -+ - /* save relevant PHY registers to private copy */ - static void at803x_context_save(struct phy_device *phydev, - struct at803x_context *context) -@@ -208,8 +256,16 @@ static int at803x_probe(struct phy_devic - return 0; - } - -+static void at803x_disable_smarteee(struct phy_device *phydev) -+{ -+ phy_write_mmd(phydev, MDIO_MMD_PCS, AT803X_PCS_SMART_EEE_CTRL3, -+ 1 << AT803X_SMART_EEE_CTRL3_LPI_TX_DELAY_SEL_SHIFT); -+ phy_write_mmd(phydev, MDIO_MMD_AN, MDIO_AN_EEE_ADV, 0); -+} -+ - static int at803x_config_init(struct phy_device *phydev) - { -+ struct at803x_platform_data *pdata; - int ret; - - ret = genphy_config_init(phydev); -@@ -227,6 +283,26 @@ static int at803x_config_init(struct phy - return ret; - } - -+ pdata = dev_get_platdata(&phydev->dev); -+ if (pdata) { -+ if (pdata->disable_smarteee) -+ at803x_disable_smarteee(phydev); -+ -+ if (pdata->enable_rgmii_rx_delay) -+ at803x_dbg_reg_set(phydev, AT803X_DBG0_REG, -+ AT803X_DEBUG_RGMII_RX_CLK_DLY); -+ else -+ at803x_dbg_reg_clr(phydev, AT803X_DBG0_REG, -+ AT803X_DEBUG_RGMII_RX_CLK_DLY); -+ -+ if (pdata->enable_rgmii_tx_delay) -+ at803x_dbg_reg_set(phydev, AT803X_DEBUG_SYSTEM_MODE_CTRL, -+ AT803X_DEBUG_RGMII_TX_CLK_DLY); -+ else -+ at803x_dbg_reg_clr(phydev, AT803X_DEBUG_SYSTEM_MODE_CTRL, -+ AT803X_DEBUG_RGMII_TX_CLK_DLY); -+ } -+ - return 0; - } - -@@ -258,6 +334,8 @@ static int at803x_config_intr(struct phy - static void at803x_link_change_notify(struct phy_device *phydev) - { - struct at803x_priv *priv = phydev->priv; -+ struct at803x_platform_data *pdata; -+ pdata = dev_get_platdata(&phydev->dev); - - /* - * Conduct a hardware reset for AT8030 every time a link loss is -@@ -288,6 +366,26 @@ static void at803x_link_change_notify(st - priv->phy_reset = false; - } - } -+ if (pdata && pdata->fixup_rgmii_tx_delay && -+ phydev->speed != priv->prev_speed) { -+ switch (phydev->speed) { -+ case SPEED_10: -+ case SPEED_100: -+ at803x_dbg_reg_set(phydev, -+ AT803X_DEBUG_SYSTEM_MODE_CTRL, -+ AT803X_DEBUG_RGMII_TX_CLK_DLY); -+ break; -+ case SPEED_1000: -+ at803x_dbg_reg_clr(phydev, -+ AT803X_DEBUG_SYSTEM_MODE_CTRL, -+ AT803X_DEBUG_RGMII_TX_CLK_DLY); -+ break; -+ default: -+ break; -+ } -+ -+ priv->prev_speed = phydev->speed; -+ } - } - - static struct phy_driver at803x_driver[] = { ---- /dev/null -+++ b/include/linux/platform_data/phy-at803x.h -@@ -0,0 +1,11 @@ -+#ifndef _PHY_AT803X_PDATA_H -+#define _PHY_AT803X_PDATA_H -+ -+struct at803x_platform_data { -+ int disable_smarteee:1; -+ int enable_rgmii_tx_delay:1; -+ int enable_rgmii_rx_delay:1; -+ int fixup_rgmii_tx_delay:1; -+}; -+ -+#endif /* _PHY_AT803X_PDATA_H */ diff --git a/target/linux/generic/pending-3.18/735-net-phy-at803x-fix-at8033-sgmii-mode.patch b/target/linux/generic/pending-3.18/735-net-phy-at803x-fix-at8033-sgmii-mode.patch deleted file mode 100644 index 4a8f532aa3..0000000000 --- a/target/linux/generic/pending-3.18/735-net-phy-at803x-fix-at8033-sgmii-mode.patch +++ /dev/null @@ -1,96 +0,0 @@ ---- a/drivers/net/phy/at803x.c -+++ b/drivers/net/phy/at803x.c -@@ -36,6 +36,9 @@ - #define AT803X_INER 0x0012 - #define AT803X_INER_INIT 0xec00 - #define AT803X_INSR 0x0013 -+#define AT803X_REG_CHIP_CONFIG 0x1f -+#define AT803X_BT_BX_REG_SEL 0x8000 -+#define AT803X_SGMII_ANEG_EN 0x1000 - - #define AT803X_PCS_SMART_EEE_CTRL3 0x805D - #define AT803X_SMART_EEE_CTRL3_LPI_TX_DELAY_SEL_MASK 0x3 -@@ -49,9 +52,10 @@ - #define AT803X_DEBUG_SYSTEM_MODE_CTRL 0x05 - #define AT803X_DEBUG_RGMII_TX_CLK_DLY BIT(8) - --#define ATH8030_PHY_ID 0x004dd076 --#define ATH8031_PHY_ID 0x004dd074 --#define ATH8035_PHY_ID 0x004dd072 -+#define AT803X_PHY_ID_MASK 0xffffffef -+#define ATH8030_PHY_ID 0x004dd076 -+#define ATH8031_PHY_ID 0x004dd074 -+#define ATH8035_PHY_ID 0x004dd072 - - MODULE_DESCRIPTION("Atheros 803x PHY driver"); - MODULE_AUTHOR("Matus Ujhelyi"); -@@ -267,6 +271,27 @@ static int at803x_config_init(struct phy - { - struct at803x_platform_data *pdata; - int ret; -+ u32 v; -+ -+ if (phydev->drv->phy_id == ATH8031_PHY_ID && -+ phydev->interface == PHY_INTERFACE_MODE_SGMII) -+ { -+ v = phy_read(phydev, AT803X_REG_CHIP_CONFIG); -+ /* select SGMII/fiber page */ -+ ret = phy_write(phydev, AT803X_REG_CHIP_CONFIG, -+ v & ~AT803X_BT_BX_REG_SEL); -+ if (ret) -+ return ret; -+ /* enable SGMII autonegotiation */ -+ ret = phy_write(phydev, MII_BMCR, AT803X_SGMII_ANEG_EN); -+ if (ret) -+ return ret; -+ /* select copper page */ -+ ret = phy_write(phydev, AT803X_REG_CHIP_CONFIG, -+ v | AT803X_BT_BX_REG_SEL); -+ if (ret) -+ return ret; -+ } - - ret = genphy_config_init(phydev); - if (ret < 0) -@@ -393,7 +418,7 @@ static struct phy_driver at803x_driver[] - /* ATHEROS 8035 */ - .phy_id = ATH8035_PHY_ID, - .name = "Atheros 8035 ethernet", -- .phy_id_mask = 0xffffffef, -+ .phy_id_mask = AT803X_PHY_ID_MASK, - .probe = at803x_probe, - .config_init = at803x_config_init, - .link_change_notify = at803x_link_change_notify, -@@ -412,7 +437,7 @@ static struct phy_driver at803x_driver[] - /* ATHEROS 8030 */ - .phy_id = ATH8030_PHY_ID, - .name = "Atheros 8030 ethernet", -- .phy_id_mask = 0xffffffef, -+ .phy_id_mask = AT803X_PHY_ID_MASK, - .probe = at803x_probe, - .config_init = at803x_config_init, - .link_change_notify = at803x_link_change_notify, -@@ -430,8 +455,8 @@ static struct phy_driver at803x_driver[] - }, { - /* ATHEROS 8031 */ - .phy_id = ATH8031_PHY_ID, -- .name = "Atheros 8031 ethernet", -- .phy_id_mask = 0xffffffef, -+ .name = "Atheros 8031/8033 ethernet", -+ .phy_id_mask = AT803X_PHY_ID_MASK, - .probe = at803x_probe, - .config_init = at803x_config_init, - .link_change_notify = at803x_link_change_notify, -@@ -465,9 +490,9 @@ module_init(atheros_init); - module_exit(atheros_exit); - - static struct mdio_device_id __maybe_unused atheros_tbl[] = { -- { ATH8030_PHY_ID, 0xffffffef }, -- { ATH8031_PHY_ID, 0xffffffef }, -- { ATH8035_PHY_ID, 0xffffffef }, -+ { ATH8030_PHY_ID, AT803X_PHY_ID_MASK }, -+ { ATH8031_PHY_ID, AT803X_PHY_ID_MASK }, -+ { ATH8035_PHY_ID, AT803X_PHY_ID_MASK }, - { } - }; - diff --git a/target/linux/generic/pending-3.18/760-8139cp-fixes-from-4.3.patch b/target/linux/generic/pending-3.18/760-8139cp-fixes-from-4.3.patch deleted file mode 100644 index 79bbcc74e4..0000000000 --- a/target/linux/generic/pending-3.18/760-8139cp-fixes-from-4.3.patch +++ /dev/null @@ -1,365 +0,0 @@ -commit 41b976414c88016e2c9d9b2f6667ee67a998d388 -Author: David Woodhouse -Date: Wed Sep 23 09:45:31 2015 +0100 - - 8139cp: Dump contents of descriptor ring on TX timeout - - We are seeing unexplained TX timeouts under heavy load. Let's try to get - a better idea of what's going on. - - Signed-off-by: David Woodhouse - Signed-off-by: David S. Miller - -commit 7f4c685633e2df9ba10d49a31dda13715745db37 -Author: David Woodhouse -Date: Wed Sep 23 09:45:16 2015 +0100 - - 8139cp: Fix DMA unmapping of transmitted buffers - - The low 16 bits of the 'opts1' field in the TX descriptor are supposed - to still contain the buffer length when the descriptor is handed back to - us. In practice, at least on my hardware, they don't. So stash the - original value of the opts1 field and get the length to unmap from - there. - - There are other ways we could have worked out the length, but I actually - want a stash of the opts1 field anyway so that I can dump it alongside - the contents of the descriptor ring when we suffer a TX timeout. - - Signed-off-by: David Woodhouse - Signed-off-by: David S. Miller - -commit 0a5aeee0b79fa99d8e04c98dd4e87d4f52aa497b -Author: David Woodhouse -Date: Wed Sep 23 09:44:57 2015 +0100 - - 8139cp: Reduce duplicate csum/tso code in cp_start_xmit() - - We calculate the value of the opts1 descriptor field in three different - places. With two different behaviours when given an invalid packet to - be checksummed — none of them correct. Sort that out. - - Signed-off-by: David Woodhouse - Signed-off-by: David S. Miller - -commit a3b804043f490aeec57d8ca5baccdd35e6250857 -Author: David Woodhouse -Date: Wed Sep 23 09:44:38 2015 +0100 - - 8139cp: Fix TSO/scatter-gather descriptor setup - - When sending a TSO frame in multiple buffers, we were neglecting to set - the first descriptor up in TSO mode. - - Signed-off-by: David Woodhouse - Signed-off-by: David S. Miller - -commit 26b0bad6ac3a0167792dc4ffb276c29bc597d239 -Author: David Woodhouse -Date: Wed Sep 23 09:44:06 2015 +0100 - - 8139cp: Fix tx_queued debug message to print correct slot numbers - - After a certain amount of staring at the debug output of this driver, I - realised it was lying to me. - - Signed-off-by: David Woodhouse - Signed-off-by: David S. Miller - -commit aaa0062ecf4877a26dea66bee1039c6eaf906c94 -Author: David Woodhouse -Date: Wed Sep 23 09:43:41 2015 +0100 - - 8139cp: Do not re-enable RX interrupts in cp_tx_timeout() - - If an RX interrupt was already received but NAPI has not yet run when - the RX timeout happens, we end up in cp_tx_timeout() with RX interrupts - already disabled. Blindly re-enabling them will cause an IRQ storm. - - (This is made particularly horrid by the fact that cp_interrupt() always - returns that it's handled the interrupt, even when it hasn't actually - done anything. If it didn't do that, the core IRQ code would have - detected the storm and handled it, I'd have had a clear smoking gun - backtrace instead of just a spontaneously resetting router, and I'd have - at *least* two days of my life back. Changing the return value of - cp_interrupt() will be argued about under separate cover.) - - Unconditionally leave RX interrupts disabled after the reset, and - schedule NAPI to check the receive ring and re-enable them. - - Signed-off-by: David Woodhouse - Signed-off-by: David S. Miller - -commit 7a8a8e75d505147358b225173e890ada43a267e2 -Author: David Woodhouse -Date: Fri Sep 18 00:21:54 2015 +0100 - - 8139cp: Call __cp_set_rx_mode() from cp_tx_timeout() - - Unless we reset the RX config, on real hardware I don't seem to receive - any packets after a TX timeout. - - Signed-off-by: David Woodhouse - Signed-off-by: David S. Miller - -commit fc27bd115b334e3ebdc682a42a47c3aea2566dcc -Author: David Woodhouse -Date: Fri Sep 18 00:19:08 2015 +0100 - - 8139cp: Use dev_kfree_skb_any() instead of dev_kfree_skb() in cp_clean_rings() - - This can be called from cp_tx_timeout() with interrupts disabled. - Spotted by Francois Romieu - - Signed-off-by: David Woodhouse - Signed-off-by: David S. Miller ---- a/drivers/net/ethernet/realtek/8139cp.c -+++ b/drivers/net/ethernet/realtek/8139cp.c -@@ -157,6 +157,7 @@ enum { - NWayAdvert = 0x66, /* MII ADVERTISE */ - NWayLPAR = 0x68, /* MII LPA */ - NWayExpansion = 0x6A, /* MII Expansion */ -+ TxDmaOkLowDesc = 0x82, /* Low 16 bit address of a Tx descriptor. */ - Config5 = 0xD8, /* Config5 */ - TxPoll = 0xD9, /* Tell chip to check Tx descriptors for work */ - RxMaxSize = 0xDA, /* Max size of an Rx packet (8169 only) */ -@@ -341,6 +342,7 @@ struct cp_private { - unsigned tx_tail; - struct cp_desc *tx_ring; - struct sk_buff *tx_skb[CP_TX_RING_SIZE]; -+ u32 tx_opts[CP_TX_RING_SIZE]; - - unsigned rx_buf_sz; - unsigned wol_enabled : 1; /* Is Wake-on-LAN enabled? */ -@@ -670,7 +672,7 @@ static void cp_tx (struct cp_private *cp - BUG_ON(!skb); - - dma_unmap_single(&cp->pdev->dev, le64_to_cpu(txd->addr), -- le32_to_cpu(txd->opts1) & 0xffff, -+ cp->tx_opts[tx_tail] & 0xffff, - PCI_DMA_TODEVICE); - - if (status & LastFrag) { -@@ -738,7 +740,7 @@ static netdev_tx_t cp_start_xmit (struct - { - struct cp_private *cp = netdev_priv(dev); - unsigned entry; -- u32 eor, flags; -+ u32 eor, opts1; - unsigned long intr_flags; - __le32 opts2; - int mss = 0; -@@ -758,6 +760,21 @@ static netdev_tx_t cp_start_xmit (struct - mss = skb_shinfo(skb)->gso_size; - - opts2 = cpu_to_le32(cp_tx_vlan_tag(skb)); -+ opts1 = DescOwn; -+ if (mss) -+ opts1 |= LargeSend | ((mss & MSSMask) << MSSShift); -+ else if (skb->ip_summed == CHECKSUM_PARTIAL) { -+ const struct iphdr *ip = ip_hdr(skb); -+ if (ip->protocol == IPPROTO_TCP) -+ opts1 |= IPCS | TCPCS; -+ else if (ip->protocol == IPPROTO_UDP) -+ opts1 |= IPCS | UDPCS; -+ else { -+ WARN_ONCE(1, -+ "Net bug: asked to checksum invalid Legacy IP packet\n"); -+ goto out_dma_error; -+ } -+ } - - if (skb_shinfo(skb)->nr_frags == 0) { - struct cp_desc *txd = &cp->tx_ring[entry]; -@@ -773,31 +790,20 @@ static netdev_tx_t cp_start_xmit (struct - txd->addr = cpu_to_le64(mapping); - wmb(); - -- flags = eor | len | DescOwn | FirstFrag | LastFrag; -- -- if (mss) -- flags |= LargeSend | ((mss & MSSMask) << MSSShift); -- else if (skb->ip_summed == CHECKSUM_PARTIAL) { -- const struct iphdr *ip = ip_hdr(skb); -- if (ip->protocol == IPPROTO_TCP) -- flags |= IPCS | TCPCS; -- else if (ip->protocol == IPPROTO_UDP) -- flags |= IPCS | UDPCS; -- else -- WARN_ON(1); /* we need a WARN() */ -- } -+ opts1 |= eor | len | FirstFrag | LastFrag; - -- txd->opts1 = cpu_to_le32(flags); -+ txd->opts1 = cpu_to_le32(opts1); - wmb(); - - cp->tx_skb[entry] = skb; -- entry = NEXT_TX(entry); -+ cp->tx_opts[entry] = opts1; -+ netif_dbg(cp, tx_queued, cp->dev, "tx queued, slot %d, skblen %d\n", -+ entry, skb->len); - } else { - struct cp_desc *txd; -- u32 first_len, first_eor; -+ u32 first_len, first_eor, ctrl; - dma_addr_t first_mapping; - int frag, first_entry = entry; -- const struct iphdr *ip = ip_hdr(skb); - - /* We must give this initial chunk to the device last. - * Otherwise we could race with the device. -@@ -810,14 +816,14 @@ static netdev_tx_t cp_start_xmit (struct - goto out_dma_error; - - cp->tx_skb[entry] = skb; -- entry = NEXT_TX(entry); - - for (frag = 0; frag < skb_shinfo(skb)->nr_frags; frag++) { - const skb_frag_t *this_frag = &skb_shinfo(skb)->frags[frag]; - u32 len; -- u32 ctrl; - dma_addr_t mapping; - -+ entry = NEXT_TX(entry); -+ - len = skb_frag_size(this_frag); - mapping = dma_map_single(&cp->pdev->dev, - skb_frag_address(this_frag), -@@ -829,19 +835,7 @@ static netdev_tx_t cp_start_xmit (struct - - eor = (entry == (CP_TX_RING_SIZE - 1)) ? RingEnd : 0; - -- ctrl = eor | len | DescOwn; -- -- if (mss) -- ctrl |= LargeSend | -- ((mss & MSSMask) << MSSShift); -- else if (skb->ip_summed == CHECKSUM_PARTIAL) { -- if (ip->protocol == IPPROTO_TCP) -- ctrl |= IPCS | TCPCS; -- else if (ip->protocol == IPPROTO_UDP) -- ctrl |= IPCS | UDPCS; -- else -- BUG(); -- } -+ ctrl = opts1 | eor | len; - - if (frag == skb_shinfo(skb)->nr_frags - 1) - ctrl |= LastFrag; -@@ -854,8 +848,8 @@ static netdev_tx_t cp_start_xmit (struct - txd->opts1 = cpu_to_le32(ctrl); - wmb(); - -+ cp->tx_opts[entry] = ctrl; - cp->tx_skb[entry] = skb; -- entry = NEXT_TX(entry); - } - - txd = &cp->tx_ring[first_entry]; -@@ -863,27 +857,17 @@ static netdev_tx_t cp_start_xmit (struct - txd->addr = cpu_to_le64(first_mapping); - wmb(); - -- if (skb->ip_summed == CHECKSUM_PARTIAL) { -- if (ip->protocol == IPPROTO_TCP) -- txd->opts1 = cpu_to_le32(first_eor | first_len | -- FirstFrag | DescOwn | -- IPCS | TCPCS); -- else if (ip->protocol == IPPROTO_UDP) -- txd->opts1 = cpu_to_le32(first_eor | first_len | -- FirstFrag | DescOwn | -- IPCS | UDPCS); -- else -- BUG(); -- } else -- txd->opts1 = cpu_to_le32(first_eor | first_len | -- FirstFrag | DescOwn); -+ ctrl = opts1 | first_eor | first_len | FirstFrag; -+ txd->opts1 = cpu_to_le32(ctrl); - wmb(); -+ -+ cp->tx_opts[first_entry] = ctrl; -+ netif_dbg(cp, tx_queued, cp->dev, "tx queued, slots %d-%d, skblen %d\n", -+ first_entry, entry, skb->len); - } -- cp->tx_head = entry; -+ cp->tx_head = NEXT_TX(entry); - - netdev_sent_queue(dev, skb->len); -- netif_dbg(cp, tx_queued, cp->dev, "tx queued, slot %d, skblen %d\n", -- entry, skb->len); - if (TX_BUFFS_AVAIL(cp) <= (MAX_SKB_FRAGS + 1)) - netif_stop_queue(dev); - -@@ -1120,6 +1104,7 @@ static int cp_init_rings (struct cp_priv - { - memset(cp->tx_ring, 0, sizeof(struct cp_desc) * CP_TX_RING_SIZE); - cp->tx_ring[CP_TX_RING_SIZE - 1].opts1 = cpu_to_le32(RingEnd); -+ memset(cp->tx_opts, 0, sizeof(cp->tx_opts)); - - cp_init_rings_index(cp); - -@@ -1156,7 +1141,7 @@ static void cp_clean_rings (struct cp_pr - desc = cp->rx_ring + i; - dma_unmap_single(&cp->pdev->dev,le64_to_cpu(desc->addr), - cp->rx_buf_sz, PCI_DMA_FROMDEVICE); -- dev_kfree_skb(cp->rx_skb[i]); -+ dev_kfree_skb_any(cp->rx_skb[i]); - } - } - -@@ -1169,7 +1154,7 @@ static void cp_clean_rings (struct cp_pr - le32_to_cpu(desc->opts1) & 0xffff, - PCI_DMA_TODEVICE); - if (le32_to_cpu(desc->opts1) & LastFrag) -- dev_kfree_skb(skb); -+ dev_kfree_skb_any(skb); - cp->dev->stats.tx_dropped++; - } - } -@@ -1177,6 +1162,7 @@ static void cp_clean_rings (struct cp_pr - - memset(cp->rx_ring, 0, sizeof(struct cp_desc) * CP_RX_RING_SIZE); - memset(cp->tx_ring, 0, sizeof(struct cp_desc) * CP_TX_RING_SIZE); -+ memset(cp->tx_opts, 0, sizeof(cp->tx_opts)); - - memset(cp->rx_skb, 0, sizeof(struct sk_buff *) * CP_RX_RING_SIZE); - memset(cp->tx_skb, 0, sizeof(struct sk_buff *) * CP_TX_RING_SIZE); -@@ -1254,7 +1240,7 @@ static void cp_tx_timeout(struct net_dev - { - struct cp_private *cp = netdev_priv(dev); - unsigned long flags; -- int rc; -+ int rc, i; - - netdev_warn(dev, "Transmit timeout, status %2x %4x %4x %4x\n", - cpr8(Cmd), cpr16(CpCmd), -@@ -1262,13 +1248,26 @@ static void cp_tx_timeout(struct net_dev - - spin_lock_irqsave(&cp->lock, flags); - -+ netif_dbg(cp, tx_err, cp->dev, "TX ring head %d tail %d desc %x\n", -+ cp->tx_head, cp->tx_tail, cpr16(TxDmaOkLowDesc)); -+ for (i = 0; i < CP_TX_RING_SIZE; i++) { -+ netif_dbg(cp, tx_err, cp->dev, -+ "TX slot %d @%p: %08x (%08x) %08x %llx %p\n", -+ i, &cp->tx_ring[i], le32_to_cpu(cp->tx_ring[i].opts1), -+ cp->tx_opts[i], le32_to_cpu(cp->tx_ring[i].opts2), -+ le64_to_cpu(cp->tx_ring[i].addr), -+ cp->tx_skb[i]); -+ } -+ - cp_stop_hw(cp); - cp_clean_rings(cp); - rc = cp_init_rings(cp); - cp_start_hw(cp); -- cp_enable_irq(cp); -+ __cp_set_rx_mode(dev); -+ cpw16_f(IntrMask, cp_norx_intr_mask); - - netif_wake_queue(dev); -+ napi_schedule(&cp->napi); - - spin_unlock_irqrestore(&cp->lock, flags); - } diff --git a/target/linux/generic/pending-3.18/773-bgmac-add-srab-switch.patch b/target/linux/generic/pending-3.18/773-bgmac-add-srab-switch.patch deleted file mode 100644 index a93877b69e..0000000000 --- a/target/linux/generic/pending-3.18/773-bgmac-add-srab-switch.patch +++ /dev/null @@ -1,72 +0,0 @@ -Register switch connected to srab - -Signed-off-by: Hauke Mehrtens - ---- a/drivers/net/ethernet/broadcom/bgmac.c -+++ b/drivers/net/ethernet/broadcom/bgmac.c -@@ -17,6 +17,7 @@ - #include - #include - #include -+#include - #include - - static const struct bcma_device_id bgmac_bcma_tbl[] = { -@@ -1538,6 +1539,17 @@ static void bgmac_mii_unregister(struct - mdiobus_free(mii_bus); - } - -+static struct b53_platform_data bgmac_b53_pdata = { -+}; -+ -+static struct platform_device bgmac_b53_dev = { -+ .name = "b53-srab-switch", -+ .id = -1, -+ .dev = { -+ .platform_data = &bgmac_b53_pdata, -+ }, -+}; -+ - /************************************************** - * BCMA bus ops - **************************************************/ -@@ -1671,6 +1683,16 @@ static int bgmac_probe(struct bcma_devic - net_dev->hw_features = net_dev->features; - net_dev->vlan_features = net_dev->features; - -+ if ((ci->id == BCMA_CHIP_ID_BCM4707 || -+ ci->id == BCMA_CHIP_ID_BCM53018) && -+ !bgmac_b53_pdata.regs) { -+ bgmac_b53_pdata.regs = ioremap_nocache(0x18007000, 0x1000); -+ -+ err = platform_device_register(&bgmac_b53_dev); -+ if (!err) -+ bgmac->b53_device = &bgmac_b53_dev; -+ } -+ - err = register_netdev(bgmac->net_dev); - if (err) { - bgmac_err(bgmac, "Cannot register net device\n"); -@@ -1697,6 +1719,10 @@ static void bgmac_remove(struct bcma_dev - { - struct bgmac *bgmac = bcma_get_drvdata(core); - -+ if (bgmac->b53_device) -+ platform_device_unregister(&bgmac_b53_dev); -+ bgmac->b53_device = NULL; -+ - unregister_netdev(bgmac->net_dev); - bgmac_mii_unregister(bgmac); - netif_napi_del(&bgmac->napi); ---- a/drivers/net/ethernet/broadcom/bgmac.h -+++ b/drivers/net/ethernet/broadcom/bgmac.h -@@ -462,6 +462,9 @@ struct bgmac { - bool has_robosw; - - bool loopback; -+ -+ /* platform device for associated switch */ -+ struct platform_device *b53_device; - }; - - static inline u32 bgmac_read(struct bgmac *bgmac, u16 offset) diff --git a/target/linux/generic/pending-3.18/785-hso-support-0af0-9300.patch b/target/linux/generic/pending-3.18/785-hso-support-0af0-9300.patch deleted file mode 100644 index 50bccc4df5..0000000000 --- a/target/linux/generic/pending-3.18/785-hso-support-0af0-9300.patch +++ /dev/null @@ -1,25 +0,0 @@ ---- a/drivers/net/usb/hso.c -+++ b/drivers/net/usb/hso.c -@@ -468,6 +468,7 @@ static const struct usb_device_id hso_id - {USB_DEVICE(0x0af0, 0x8900)}, - {USB_DEVICE(0x0af0, 0x9000)}, - {USB_DEVICE(0x0af0, 0x9200)}, /* Option GTM671WFS */ -+ {USB_DEVICE(0x0af0, 0x9300)}, /* GTM 66xxWFS */ - {USB_DEVICE(0x0af0, 0xd035)}, - {USB_DEVICE(0x0af0, 0xd055)}, - {USB_DEVICE(0x0af0, 0xd155)}, ---- a/drivers/usb/storage/unusual_devs.h -+++ b/drivers/usb/storage/unusual_devs.h -@@ -1330,6 +1330,12 @@ UNUSUAL_DEV( 0x0af0, 0x8304, 0x0000, 0x0 - USB_SC_DEVICE, USB_PR_DEVICE, NULL, - 0 ), - -+UNUSUAL_DEV( 0x0af0, 0x9300, 0x0000, 0x0000, -+ "Option", -+ "Globetrotter 66xxWFS SD-Card", -+ USB_SC_DEVICE, USB_PR_DEVICE, NULL, -+ 0 ), -+ - UNUSUAL_DEV( 0x0af0, 0xc100, 0x0000, 0x0000, - "Option", - "GI 070x SD-Card", diff --git a/target/linux/generic/pending-3.18/810-pci_disable_common_quirks.patch b/target/linux/generic/pending-3.18/810-pci_disable_common_quirks.patch deleted file mode 100644 index 5155bcdadf..0000000000 --- a/target/linux/generic/pending-3.18/810-pci_disable_common_quirks.patch +++ /dev/null @@ -1,51 +0,0 @@ ---- a/drivers/pci/Kconfig -+++ b/drivers/pci/Kconfig -@@ -58,6 +58,12 @@ config XEN_PCIDEV_FRONTEND - The PCI device frontend driver allows the kernel to import arbitrary - PCI devices from a PCI backend to support PCI driver domains. - -+config PCI_DISABLE_COMMON_QUIRKS -+ bool "PCI disable common quirks" -+ depends on PCI -+ help -+ If you don't know what to do here, say N. -+ - config HT_IRQ - bool "Interrupts on hypertransport devices" - default y ---- a/drivers/pci/quirks.c -+++ b/drivers/pci/quirks.c -@@ -41,6 +41,7 @@ static void quirk_mmio_always_on(struct - DECLARE_PCI_FIXUP_CLASS_EARLY(PCI_ANY_ID, PCI_ANY_ID, - PCI_CLASS_BRIDGE_HOST, 8, quirk_mmio_always_on); - -+#ifndef CONFIG_PCI_DISABLE_COMMON_QUIRKS - /* The Mellanox Tavor device gives false positive parity errors - * Mark this device with a broken_parity_status, to allow - * PCI scanning code to "skip" this now blacklisted device. -@@ -2929,6 +2930,7 @@ DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_I - DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x65f9, quirk_intel_mc_errata); - DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x65fa, quirk_intel_mc_errata); - -+#endif /* !CONFIG_PCI_DISABLE_COMMON_QUIRKS */ - - /* - * Ivytown NTB BAR sizes are misreported by the hardware due to an erratum. To -@@ -2985,6 +2987,8 @@ static void fixup_debug_report(struct pc - } - } - -+#ifndef CONFIG_PCI_DISABLE_COMMON_QUIRKS -+ - /* - * Some BIOS implementations leave the Intel GPU interrupts enabled, - * even though no one is handling them (f.e. i915 driver is never loaded). -@@ -3019,6 +3023,8 @@ DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_IN - DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x010a, disable_igfx_irq); - DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x0152, disable_igfx_irq); - -+#endif /* !CONFIG_PCI_DISABLE_COMMON_QUIRKS */ -+ - /* - * PCI devices which are on Intel chips can skip the 10ms delay - * before entering D3 mode. diff --git a/target/linux/generic/pending-3.18/811-pci_disable_usb_common_quirks.patch b/target/linux/generic/pending-3.18/811-pci_disable_usb_common_quirks.patch deleted file mode 100644 index ddc8549634..0000000000 --- a/target/linux/generic/pending-3.18/811-pci_disable_usb_common_quirks.patch +++ /dev/null @@ -1,101 +0,0 @@ - ---- a/drivers/usb/host/pci-quirks.c -+++ b/drivers/usb/host/pci-quirks.c -@@ -98,6 +98,8 @@ struct amd_chipset_type { - u8 rev; - }; - -+#ifndef CONFIG_PCI_DISABLE_COMMON_QUIRKS -+ - static struct amd_chipset_info { - struct pci_dev *nb_dev; - struct pci_dev *smbus_dev; -@@ -462,6 +464,10 @@ void usb_amd_dev_put(void) - } - EXPORT_SYMBOL_GPL(usb_amd_dev_put); - -+#endif /* CONFIG_PCI_DISABLE_COMMON_QUIRKS */ -+ -+#if IS_ENABLED(CONFIG_USB_UHCI_HCD) -+ - /* - * Make sure the controller is completely inactive, unable to - * generate interrupts or do DMA. -@@ -541,8 +547,17 @@ reset_needed: - uhci_reset_hc(pdev, base); - return 1; - } -+#else -+int uhci_check_and_reset_hc(struct pci_dev *pdev, unsigned long base) -+{ -+ return 0; -+} -+ -+#endif - EXPORT_SYMBOL_GPL(uhci_check_and_reset_hc); - -+#ifndef CONFIG_PCI_DISABLE_COMMON_QUIRKS -+ - static inline int io_type_enabled(struct pci_dev *pdev, unsigned int mask) - { - u16 cmd; -@@ -1103,3 +1118,4 @@ static void quirk_usb_early_handoff(stru - } - DECLARE_PCI_FIXUP_CLASS_FINAL(PCI_ANY_ID, PCI_ANY_ID, - PCI_CLASS_SERIAL_USB, 8, quirk_usb_early_handoff); -+#endif ---- a/drivers/usb/host/pci-quirks.h -+++ b/drivers/usb/host/pci-quirks.h -@@ -4,6 +4,9 @@ - #ifdef CONFIG_PCI - void uhci_reset_hc(struct pci_dev *pdev, unsigned long base); - int uhci_check_and_reset_hc(struct pci_dev *pdev, unsigned long base); -+#endif /* CONFIG_PCI */ -+ -+#if defined(CONFIG_PCI) && !defined(CONFIG_PCI_DISABLE_COMMON_QUIRKS) - int usb_amd_find_chipset_info(void); - int usb_hcd_amd_remote_wakeup_quirk(struct pci_dev *pdev); - bool usb_amd_hang_symptom_quirk(void); -@@ -16,11 +19,24 @@ void usb_disable_xhci_ports(struct pci_d - void sb800_prefetch(struct device *dev, int on); - #else - struct pci_dev; -+static inline int usb_amd_find_chipset_info(void) -+{ -+ return 0; -+} -+static inline bool usb_amd_hang_symptom_quirk(void) -+{ -+ return false; -+} -+static inline bool usb_amd_prefetch_quirk(void) -+{ -+ return false; -+} - static inline void usb_amd_quirk_pll_disable(void) {} - static inline void usb_amd_quirk_pll_enable(void) {} - static inline void usb_amd_dev_put(void) {} - static inline void usb_disable_xhci_ports(struct pci_dev *xhci_pdev) {} - static inline void sb800_prefetch(struct device *dev, int on) {} --#endif /* CONFIG_PCI */ -+static inline void usb_enable_intel_xhci_ports(struct pci_dev *xhci_pdev) {} -+#endif - - #endif /* __LINUX_USB_PCI_QUIRKS_H */ ---- a/include/linux/usb/hcd.h -+++ b/include/linux/usb/hcd.h -@@ -445,7 +445,14 @@ extern int usb_hcd_pci_probe(struct pci_ - extern void usb_hcd_pci_remove(struct pci_dev *dev); - extern void usb_hcd_pci_shutdown(struct pci_dev *dev); - -+#ifndef CONFIG_PCI_DISABLE_COMMON_QUIRKS - extern int usb_hcd_amd_remote_wakeup_quirk(struct pci_dev *dev); -+#else -+static inline int usb_hcd_amd_remote_wakeup_quirk(struct pci_dev *dev) -+{ -+ return 0; -+} -+#endif - - #ifdef CONFIG_PM - extern const struct dev_pm_ops usb_hcd_pci_pm_ops; diff --git a/target/linux/generic/pending-3.18/821-usb-dwc2-dualrole.patch b/target/linux/generic/pending-3.18/821-usb-dwc2-dualrole.patch deleted file mode 100644 index 9e841cb642..0000000000 --- a/target/linux/generic/pending-3.18/821-usb-dwc2-dualrole.patch +++ /dev/null @@ -1,146 +0,0 @@ ---- a/drivers/usb/dwc2/Kconfig -+++ b/drivers/usb/dwc2/Kconfig -@@ -1,6 +1,6 @@ - config USB_DWC2 -- bool "DesignWare USB2 DRD Core Support" -- depends on USB -+ tristate "DesignWare USB2 DRD Core Support" -+ depends on USB || USB_GADGET - help - Say Y here if your system has a Dual Role Hi-Speed USB - controller based on the DesignWare HSOTG IP Core. -@@ -10,49 +10,61 @@ config USB_DWC2 - bus interface module (if you have a PCI bus system) will be - called dwc2_pci.ko, and the platform interface module (for - controllers directly connected to the CPU) will be called -- dwc2_platform.ko. For gadget mode, there will be a single -- module called dwc2_gadget.ko. -- -- NOTE: The s3c-hsotg driver is now renamed to dwc2_gadget. The -- host and gadget drivers are still currently separate drivers. -- There are plans to merge the dwc2_gadget driver with the dwc2 -- host driver in the near future to create a dual-role driver. -+ dwc2_platform.ko. For all modes(host, gadget and dual-role), there -+ will be an additional module named dwc2.ko. - - if USB_DWC2 - -+choice -+ bool "DWC2 Mode Selection" -+ default USB_DWC2_DUAL_ROLE if (USB && USB_GADGET) -+ default USB_DWC2_HOST if (USB && !USB_GADGET) -+ default USB_DWC2_PERIPHERAL if (!USB && USB_GADGET) -+ - config USB_DWC2_HOST -- tristate "Host only mode" -+ bool "Host only mode" - depends on USB - help - The Designware USB2.0 high-speed host controller -- integrated into many SoCs. -+ integrated into many SoCs. Select this option if you want the -+ driver to operate in Host-only mode. - --config USB_DWC2_PLATFORM -- bool "DWC2 Platform" -- depends on USB_DWC2_HOST -- default USB_DWC2_HOST -+comment "Gadget/Dual-role mode requires USB Gadget support to be enabled" -+ -+config USB_DWC2_PERIPHERAL -+ bool "Gadget only mode" -+ depends on USB_GADGET=y || USB_GADGET=USB_DWC2 -+ help -+ The Designware USB2.0 high-speed gadget controller -+ integrated into many SoCs. Select this option if you want the -+ driver to operate in Peripheral-only mode. This option requires -+ USB_GADGET to be enabled. -+ -+config USB_DWC2_DUAL_ROLE -+ bool "Dual Role mode" -+ depends on (USB=y || USB=USB_DWC2) && (USB_GADGET=y || USB_GADGET=USB_DWC2) - help -- The Designware USB2.0 platform interface module for -- controllers directly connected to the CPU. This is only -- used for host mode. -+ Select this option if you want the driver to work in a dual-role -+ mode. In this mode both host and gadget features are enabled, and -+ the role will be determined by the cable that gets plugged-in. This -+ option requires USB_GADGET to be enabled. -+endchoice -+ -+config USB_DWC2_PLATFORM -+ tristate "DWC2 Platform" -+ default USB_DWC2_HOST || USB_DWC2_PERIPHERAL -+ help -+ The Designware USB2.0 platform interface module for -+ controllers directly connected to the CPU. - - config USB_DWC2_PCI -- bool "DWC2 PCI" -+ tristate "DWC2 PCI" - depends on USB_DWC2_HOST && PCI - default USB_DWC2_HOST - help - The Designware USB2.0 PCI interface module for controllers - connected to a PCI bus. This is only used for host mode. - --comment "Gadget mode requires USB Gadget support to be enabled" -- --config USB_DWC2_PERIPHERAL -- tristate "Gadget only mode" -- depends on USB_GADGET -- help -- The Designware USB2.0 high-speed gadget controller -- integrated into many SoCs. -- - config USB_DWC2_DEBUG - bool "Enable Debugging Messages" - help ---- a/drivers/usb/dwc2/Makefile -+++ b/drivers/usb/dwc2/Makefile -@@ -1,28 +1,28 @@ - ccflags-$(CONFIG_USB_DWC2_DEBUG) += -DDEBUG - ccflags-$(CONFIG_USB_DWC2_VERBOSE) += -DVERBOSE_DEBUG - --obj-$(CONFIG_USB_DWC2_HOST) += dwc2.o -+obj-$(CONFIG_USB_DWC2) += dwc2.o - dwc2-y := core.o core_intr.o --dwc2-y += hcd.o hcd_intr.o --dwc2-y += hcd_queue.o hcd_ddma.o -+ -+ifneq ($(filter y,$(CONFIG_USB_DWC2_HOST) $(CONFIG_USB_DWC2_DUAL_ROLE)),) -+ dwc2-y += hcd.o hcd_intr.o -+ dwc2-y += hcd_queue.o hcd_ddma.o -+endif -+ -+ifneq ($(filter y,$(CONFIG_USB_DWC2_PERIPHERAL) $(CONFIG_USB_DWC2_DUAL_ROLE)),) -+ dwc2-y += gadget.o -+endif - - # NOTE: The previous s3c-hsotg peripheral mode only driver has been moved to - # this location and renamed gadget.c. When building for dynamically linked --# modules, dwc2_gadget.ko will get built for peripheral mode. For host mode, --# the core module will be dwc2.ko, the PCI bus interface module will called --# dwc2_pci.ko and the platform interface module will be called dwc2_platform.ko. --# At present the host and gadget driver will be separate drivers, but there --# are plans in the near future to create a dual-role driver. -+# modules, dwc2.ko will get built for host mode, peripheral mode, and dual-role -+# mode. The PCI bus interface module will called dwc2_pci.ko and the platform -+# interface module will be called dwc2_platform.ko. - - ifneq ($(CONFIG_USB_DWC2_PCI),) -- obj-$(CONFIG_USB_DWC2_HOST) += dwc2_pci.o -+ obj-$(CONFIG_USB_DWC2) += dwc2_pci.o - dwc2_pci-y := pci.o - endif - --ifneq ($(CONFIG_USB_DWC2_PLATFORM),) -- obj-$(CONFIG_USB_DWC2_HOST) += dwc2_platform.o -- dwc2_platform-y := platform.o --endif -- --obj-$(CONFIG_USB_DWC2_PERIPHERAL) += dwc2_gadget.o --dwc2_gadget-y := gadget.o -+obj-$(CONFIG_USB_DWC2_PLATFORM) += dwc2_platform.o -+dwc2_platform-y := platform.o diff --git a/target/linux/generic/pending-3.18/834-ledtrig-libata.patch b/target/linux/generic/pending-3.18/834-ledtrig-libata.patch deleted file mode 100644 index b956dedcce..0000000000 --- a/target/linux/generic/pending-3.18/834-ledtrig-libata.patch +++ /dev/null @@ -1,153 +0,0 @@ -From 52cfd51cdf6a6e14d4fb270c6343abac3bac00f4 Mon Sep 17 00:00:00 2001 -From: Daniel Golle -Date: Fri, 12 Dec 2014 13:38:33 +0100 -Subject: [PATCH] libata: add ledtrig support -To: linux-ide@vger.kernel.org, - Tejun Heo - -This adds a LED trigger for each ATA port indicating disk activity. - -As this is needed only on specific platforms (NAS SoCs and such), -these platforms should define ARCH_WANTS_LIBATA_LEDS if there -are boards with LED(s) intended to indicate ATA disk activity and -need the OS to take care of that. -In that way, if not selected, LED trigger support not will be -included in libata-core and both, codepaths and structures remain -untouched. - -Signed-off-by: Daniel Golle ---- - drivers/ata/Kconfig | 16 ++++++++++++++++ - drivers/ata/libata-core.c | 41 +++++++++++++++++++++++++++++++++++++++++ - include/linux/libata.h | 9 +++++++++ - 3 files changed, 66 insertions(+) - ---- a/drivers/ata/Kconfig -+++ b/drivers/ata/Kconfig -@@ -46,6 +46,22 @@ config ATA_VERBOSE_ERROR - - If unsure, say Y. - -+config ARCH_WANT_LIBATA_LEDS -+ bool -+ -+config ATA_LEDS -+ bool "support ATA port LED triggers" -+ depends on ARCH_WANT_LIBATA_LEDS -+ select NEW_LEDS -+ select LEDS_CLASS -+ select LEDS_TRIGGERS -+ default y -+ help -+ This option adds a LED trigger for each registered ATA port. -+ It is used to drive disk activity leds connected via GPIO. -+ -+ If unsure, say N. -+ - config ATA_ACPI - bool "ATA ACPI Support" - depends on ACPI && PCI ---- a/drivers/ata/libata-core.c -+++ b/drivers/ata/libata-core.c -@@ -725,6 +725,19 @@ u64 ata_tf_read_block(struct ata_taskfil - return block; - } - -+#ifdef CONFIG_ATA_LEDS -+#define LIBATA_BLINK_DELAY 20 /* ms */ -+static inline void ata_led_act(struct ata_port *ap) -+{ -+ unsigned long led_delay = LIBATA_BLINK_DELAY; -+ -+ if (unlikely(!ap->ledtrig)) -+ return; -+ -+ led_trigger_blink_oneshot(ap->ledtrig, &led_delay, &led_delay, 0); -+} -+#endif -+ - /** - * ata_build_rw_tf - Build ATA taskfile for given read/write request - * @tf: Target ATA taskfile -@@ -4828,6 +4841,9 @@ static struct ata_queued_cmd *ata_qc_new - break; - } - } -+#ifdef CONFIG_ATA_LEDS -+ ata_led_act(ap); -+#endif - - return qc; - } -@@ -5737,6 +5753,9 @@ struct ata_port *ata_port_alloc(struct a - ap->stats.unhandled_irq = 1; - ap->stats.idle_irq = 1; - #endif -+#ifdef CONFIG_ATA_LEDS -+ ap->ledtrig = kzalloc(sizeof(struct led_trigger), GFP_KERNEL); -+#endif - ata_sff_port_init(ap); - - return ap; -@@ -5758,6 +5777,12 @@ static void ata_host_release(struct devi - - kfree(ap->pmp_link); - kfree(ap->slave_link); -+#ifdef CONFIG_ATA_LEDS -+ if (ap->ledtrig) { -+ led_trigger_unregister(ap->ledtrig); -+ kfree(ap->ledtrig); -+ }; -+#endif - kfree(ap); - host->ports[i] = NULL; - } -@@ -6204,7 +6229,23 @@ int ata_host_register(struct ata_host *h - host->ports[i]->print_id = atomic_inc_return(&ata_print_id); - host->ports[i]->local_port_no = i + 1; - } -+#ifdef CONFIG_ATA_LEDS -+ for (i = 0; i < host->n_ports; i++) { -+ if (unlikely(!host->ports[i]->ledtrig)) -+ continue; - -+ snprintf(host->ports[i]->ledtrig_name, -+ sizeof(host->ports[i]->ledtrig_name), "ata%u", -+ host->ports[i]->print_id); -+ -+ host->ports[i]->ledtrig->name = host->ports[i]->ledtrig_name; -+ -+ if (led_trigger_register(host->ports[i]->ledtrig)) { -+ kfree(host->ports[i]->ledtrig); -+ host->ports[i]->ledtrig = NULL; -+ } -+ } -+#endif - /* Create associated sysfs transport objects */ - for (i = 0; i < host->n_ports; i++) { - rc = ata_tport_add(host->dev,host->ports[i]); ---- a/include/linux/libata.h -+++ b/include/linux/libata.h -@@ -38,6 +38,9 @@ - #include - #include - #include -+#ifdef CONFIG_ATA_LEDS -+#include -+#endif - - /* - * Define if arch has non-standard setup. This is a _PCI_ standard -@@ -874,6 +877,12 @@ struct ata_port { - #ifdef CONFIG_ATA_ACPI - struct ata_acpi_gtm __acpi_init_gtm; /* use ata_acpi_init_gtm() */ - #endif -+ -+#ifdef CONFIG_ATA_LEDS -+ struct led_trigger *ledtrig; -+ char ledtrig_name[8]; -+#endif -+ - /* owned by EH */ - u8 sector_buf[ATA_SECT_SIZE] ____cacheline_aligned; - }; diff --git a/target/linux/generic/pending-3.18/840-rtc7301.patch b/target/linux/generic/pending-3.18/840-rtc7301.patch deleted file mode 100644 index 2134d87476..0000000000 --- a/target/linux/generic/pending-3.18/840-rtc7301.patch +++ /dev/null @@ -1,250 +0,0 @@ ---- a/drivers/rtc/Kconfig -+++ b/drivers/rtc/Kconfig -@@ -979,6 +979,15 @@ config RTC_DRV_NUC900 - If you say yes here you get support for the RTC subsystem of the - NUC910/NUC920 used in embedded systems. - -+config RTC_DRV_RTC7301 -+ tristate "Epson RTC-7301 SF/DG" -+ help -+ If you say Y here you will get support for the -+ Epson RTC-7301 SF/DG RTC chips. -+ -+ This driver can also be built as a module. If so, the module -+ will be called rtc-7301. -+ - comment "on-CPU RTC drivers" - - config RTC_DRV_DAVINCI ---- a/drivers/rtc/Makefile -+++ b/drivers/rtc/Makefile -@@ -115,6 +115,7 @@ obj-$(CONFIG_RTC_DRV_RP5C01) += rtc-rp5c - obj-$(CONFIG_RTC_DRV_RS5C313) += rtc-rs5c313.o - obj-$(CONFIG_RTC_DRV_RS5C348) += rtc-rs5c348.o - obj-$(CONFIG_RTC_DRV_RS5C372) += rtc-rs5c372.o -+obj-$(CONFIG_RTC_DRV_RTC7301) += rtc-rtc7301.o - obj-$(CONFIG_RTC_DRV_RV3029C2) += rtc-rv3029c2.o - obj-$(CONFIG_RTC_DRV_RX4581) += rtc-rx4581.o - obj-$(CONFIG_RTC_DRV_RX8025) += rtc-rx8025.o ---- /dev/null -+++ b/drivers/rtc/rtc-rtc7301.c -@@ -0,0 +1,219 @@ -+/* -+ * Driver for Epson RTC-7301SF/DG -+ * -+ * Copyright (C) 2009 Jose Vasconcellos -+ * -+ * 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 -+#include -+#include -+#include -+#include -+#include -+ -+#define RTC_NAME "rtc7301" -+#define RTC_VERSION "0.1" -+ -+/* Epson RTC-7301 register addresses */ -+#define RTC7301_SEC 0x00 -+#define RTC7301_SEC10 0x01 -+#define RTC7301_MIN 0x02 -+#define RTC7301_MIN10 0x03 -+#define RTC7301_HOUR 0x04 -+#define RTC7301_HOUR10 0x05 -+#define RTC7301_WEEKDAY 0x06 -+#define RTC7301_DAY 0x07 -+#define RTC7301_DAY10 0x08 -+#define RTC7301_MON 0x09 -+#define RTC7301_MON10 0x0A -+#define RTC7301_YEAR 0x0B -+#define RTC7301_YEAR10 0x0C -+#define RTC7301_YEAR100 0x0D -+#define RTC7301_YEAR1000 0x0E -+#define RTC7301_CTRLREG 0x0F -+ -+static uint8_t __iomem *rtc7301_base; -+ -+#define read_reg(offset) (readb(rtc7301_base + offset) & 0xf) -+#define write_reg(offset, data) writeb(data, rtc7301_base + (offset)) -+ -+#define rtc7301_isbusy() (read_reg(RTC7301_CTRLREG) & 1) -+ -+static void rtc7301_init_settings(void) -+{ -+ int i; -+ -+ write_reg(RTC7301_CTRLREG, 2); -+ write_reg(RTC7301_YEAR1000, 2); -+ udelay(122); -+ -+ /* bank 1 */ -+ write_reg(RTC7301_CTRLREG, 6); -+ for (i=0; i<15; i++) -+ write_reg(i, 0); -+ -+ /* bank 2 */ -+ write_reg(RTC7301_CTRLREG, 14); -+ for (i=0; i<15; i++) -+ write_reg(i, 0); -+ write_reg(RTC7301_CTRLREG, 0); -+} -+ -+static int rtc7301_get_datetime(struct device *dev, struct rtc_time *dt) -+{ -+ int cnt; -+ uint8_t buf[16]; -+ -+ cnt = 0; -+ while (rtc7301_isbusy()) { -+ udelay(244); -+ if (cnt++ > 100) { -+ dev_err(dev, "%s: timeout error %x\n", __func__, rtc7301_base[RTC7301_CTRLREG]); -+ return -EIO; -+ } -+ } -+ -+ for (cnt=0; cnt<16; cnt++) -+ buf[cnt] = read_reg(cnt); -+ -+ if (buf[RTC7301_SEC10] & 8) { -+ dev_err(dev, "%s: RTC not set\n", __func__); -+ return -EINVAL; -+ } -+ -+ memset(dt, 0, sizeof(*dt)); -+ -+ dt->tm_sec = buf[RTC7301_SEC] + buf[RTC7301_SEC10]*10; -+ dt->tm_min = buf[RTC7301_MIN] + buf[RTC7301_MIN10]*10; -+ dt->tm_hour = buf[RTC7301_HOUR] + buf[RTC7301_HOUR10]*10; -+ -+ dt->tm_mday = buf[RTC7301_DAY] + buf[RTC7301_DAY10]*10; -+ dt->tm_mon = buf[RTC7301_MON] + buf[RTC7301_MON10]*10 - 1; -+ dt->tm_year = buf[RTC7301_YEAR] + buf[RTC7301_YEAR10]*10 + -+ buf[RTC7301_YEAR100]*100 + -+ ((buf[RTC7301_YEAR1000] & 3)*1000) - 1900; -+ -+ /* the rtc device may contain illegal values on power up -+ * according to the data sheet. make sure they are valid. -+ */ -+ -+ return rtc_valid_tm(dt); -+} -+ -+static int rtc7301_set_datetime(struct device *dev, struct rtc_time *dt) -+{ -+ int data; -+ -+ data = dt->tm_year + 1900; -+ if (data >= 2100 || data < 1900) -+ return -EINVAL; -+ -+ write_reg(RTC7301_CTRLREG, 2); -+ udelay(122); -+ -+ data = bin2bcd(dt->tm_sec); -+ write_reg(RTC7301_SEC, data); -+ write_reg(RTC7301_SEC10, (data >> 4)); -+ -+ data = bin2bcd(dt->tm_min); -+ write_reg(RTC7301_MIN, data ); -+ write_reg(RTC7301_MIN10, (data >> 4)); -+ -+ data = bin2bcd(dt->tm_hour); -+ write_reg(RTC7301_HOUR, data); -+ write_reg(RTC7301_HOUR10, (data >> 4)); -+ -+ data = bin2bcd(dt->tm_mday); -+ write_reg(RTC7301_DAY, data); -+ write_reg(RTC7301_DAY10, (data>> 4)); -+ -+ data = bin2bcd(dt->tm_mon + 1); -+ write_reg(RTC7301_MON, data); -+ write_reg(RTC7301_MON10, (data >> 4)); -+ -+ data = bin2bcd(dt->tm_year % 100); -+ write_reg(RTC7301_YEAR, data); -+ write_reg(RTC7301_YEAR10, (data >> 4)); -+ data = bin2bcd((1900 + dt->tm_year) / 100); -+ write_reg(RTC7301_YEAR100, data); -+ -+ data = bin2bcd(dt->tm_wday); -+ write_reg(RTC7301_WEEKDAY, data); -+ -+ write_reg(RTC7301_CTRLREG, 0); -+ -+ return 0; -+} -+ -+static const struct rtc_class_ops rtc7301_rtc_ops = { -+ .read_time = rtc7301_get_datetime, -+ .set_time = rtc7301_set_datetime, -+}; -+ -+static int rtc7301_probe(struct platform_device *pdev) -+{ -+ struct rtc_device *rtc; -+ struct resource *res; -+ -+ res = platform_get_resource(pdev, IORESOURCE_MEM, 0); -+ if (!res) -+ return -ENOENT; -+ -+ rtc7301_base = ioremap_nocache(res->start, 0x1000 /*res->end - res->start + 1*/); -+ if (!rtc7301_base) -+ return -EINVAL; -+ -+ rtc = rtc_device_register(RTC_NAME, &pdev->dev, -+ &rtc7301_rtc_ops, THIS_MODULE); -+ if (IS_ERR(rtc)) { -+ iounmap(rtc7301_base); -+ return PTR_ERR(rtc); -+ } -+ -+ platform_set_drvdata(pdev, rtc); -+ -+ rtc7301_init_settings(); -+ return 0; -+} -+ -+static int rtc7301_remove(struct platform_device *pdev) -+{ -+ struct rtc_device *rtc = platform_get_drvdata(pdev); -+ -+ if (rtc) -+ rtc_device_unregister(rtc); -+ if (rtc7301_base) -+ iounmap(rtc7301_base); -+ return 0; -+} -+ -+static struct platform_driver rtc7301_driver = { -+ .driver = { -+ .name = RTC_NAME, -+ .owner = THIS_MODULE, -+ }, -+ .probe = rtc7301_probe, -+ .remove = rtc7301_remove, -+}; -+ -+static __init int rtc7301_init(void) -+{ -+ return platform_driver_register(&rtc7301_driver); -+} -+module_init(rtc7301_init); -+ -+static __exit void rtc7301_exit(void) -+{ -+ platform_driver_unregister(&rtc7301_driver); -+} -+module_exit(rtc7301_exit); -+ -+MODULE_DESCRIPTION("Epson 7301 RTC driver"); -+MODULE_AUTHOR("Jose Vasconcellos "); -+MODULE_LICENSE("GPL"); -+MODULE_ALIAS("platform:" RTC_NAME); -+MODULE_VERSION(RTC_VERSION); diff --git a/target/linux/generic/pending-3.18/841-rtc_pt7c4338.patch b/target/linux/generic/pending-3.18/841-rtc_pt7c4338.patch deleted file mode 100644 index 83b0232e13..0000000000 --- a/target/linux/generic/pending-3.18/841-rtc_pt7c4338.patch +++ /dev/null @@ -1,247 +0,0 @@ ---- a/drivers/rtc/Kconfig -+++ b/drivers/rtc/Kconfig -@@ -567,6 +567,15 @@ config RTC_DRV_S5M - This driver can also be built as a module. If so, the module - will be called rtc-s5m. - -+config RTC_DRV_PT7C4338 -+ tristate "Pericom Technology Inc. PT7C4338 RTC" -+ help -+ If you say yes here you get support for the Pericom Technology -+ Inc. PT7C4338 RTC chip. -+ -+ This driver can also be built as a module. If so, the module -+ will be called rtc-pt7c4338. -+ - endif # I2C - - comment "SPI RTC drivers" ---- a/drivers/rtc/Makefile -+++ b/drivers/rtc/Makefile -@@ -106,6 +106,7 @@ obj-$(CONFIG_RTC_DRV_PL030) += rtc-pl030 - obj-$(CONFIG_RTC_DRV_PL031) += rtc-pl031.o - obj-$(CONFIG_RTC_DRV_PM8XXX) += rtc-pm8xxx.o - obj-$(CONFIG_RTC_DRV_PS3) += rtc-ps3.o -+obj-$(CONFIG_RTC_DRV_PT7C4338) += rtc-pt7c4338.o - obj-$(CONFIG_RTC_DRV_PUV3) += rtc-puv3.o - obj-$(CONFIG_RTC_DRV_PXA) += rtc-pxa.o - obj-$(CONFIG_RTC_DRV_R9701) += rtc-r9701.o ---- /dev/null -+++ b/drivers/rtc/rtc-pt7c4338.c -@@ -0,0 +1,216 @@ -+/* -+ * Copyright 2010 Freescale Semiconductor, Inc. -+ * -+ * Author: Priyanka Jain -+ * -+ * 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 -+ */ -+ -+/* -+ * This file provides Date & Time support (no alarms) for PT7C4338 chip. -+ * -+ * This file is based on drivers/rtc/rtc-ds1307.c -+ * -+ * PT7C4338 chip is manufactured by Pericom Technology Inc. -+ * It is a serial real-time clock which provides -+ * 1)Low-power clock/calendar. -+ * 2)Programmable square-wave output. -+ * It has 56 bytes of nonvolatile RAM. -+ */ -+ -+#include -+#include -+#include -+#include -+#include -+#include -+ -+/* RTC register addresses */ -+#define PT7C4338_REG_SECONDS 0x00 -+#define PT7C4338_REG_MINUTES 0x01 -+#define PT7C4338_REG_HOURS 0x02 -+#define PT7C4338_REG_AMPM 0x02 -+#define PT7C4338_REG_DAY 0x03 -+#define PT7C4338_REG_DATE 0x04 -+#define PT7C4338_REG_MONTH 0x05 -+#define PT7C4338_REG_YEAR 0x06 -+#define PT7C4338_REG_CTRL_STAT 0x07 -+ -+/* RTC second register address bit */ -+#define PT7C4338_SEC_BIT_CH 0x80 /*Clock Halt (in Register 0)*/ -+ -+/* RTC control and status register bits */ -+#define PT7C4338_CTRL_STAT_BIT_RS0 0x1 /*Rate select 0*/ -+#define PT7C4338_CTRL_STAT_BIT_RS1 0x2 /*Rate select 1*/ -+#define PT7C4338_CTRL_STAT_BIT_SQWE 0x10 /*Square Wave Enable*/ -+#define PT7C4338_CTRL_STAT_BIT_OSF 0x20 /*Oscillator Stop Flag*/ -+#define PT7C4338_CTRL_STAT_BIT_OUT 0x80 /*Output Level Control*/ -+ -+static const struct i2c_device_id pt7c4338_id[] = { -+ { "pt7c4338", 0 }, -+ { } -+}; -+MODULE_DEVICE_TABLE(i2c, pt7c4338_id); -+ -+struct pt7c4338{ -+ struct i2c_client *client; -+ struct rtc_device *rtc; -+}; -+ -+static int pt7c4338_read_time(struct device *dev, struct rtc_time *time) -+{ -+ struct i2c_client *client = to_i2c_client(dev); -+ int ret; -+ u8 buf[7]; -+ u8 year, month, day, hour, minute, second; -+ u8 week, twelve_hr, am_pm; -+ -+ ret = i2c_smbus_read_i2c_block_data(client, -+ PT7C4338_REG_SECONDS, 7, buf); -+ if (ret < 0) -+ return ret; -+ if (ret < 7) -+ return -EIO; -+ -+ second = buf[0]; -+ minute = buf[1]; -+ hour = buf[2]; -+ week = buf[3]; -+ day = buf[4]; -+ month = buf[5]; -+ year = buf[6]; -+ -+ /* Extract additional information for AM/PM */ -+ twelve_hr = hour & 0x40; -+ am_pm = hour & 0x20; -+ -+ /* Write to rtc_time structure */ -+ time->tm_sec = bcd2bin(second & 0x7f); -+ time->tm_min = bcd2bin(minute & 0x7f); -+ if (twelve_hr) { -+ /* Convert to 24 hr */ -+ if (am_pm) -+ time->tm_hour = bcd2bin(hour & 0x10) + 12; -+ else -+ time->tm_hour = bcd2bin(hour & 0xBF); -+ } else { -+ time->tm_hour = bcd2bin(hour); -+ } -+ -+ time->tm_wday = bcd2bin(week & 0x07) - 1; -+ time->tm_mday = bcd2bin(day & 0x3f); -+ time->tm_mon = bcd2bin(month & 0x1F) - 1; -+ /* assume 20YY not 19YY */ -+ time->tm_year = bcd2bin(year) + 100; -+ -+ return 0; -+} -+ -+static int pt7c4338_set_time(struct device *dev, struct rtc_time *time) -+{ -+ struct i2c_client *client = to_i2c_client(dev); -+ u8 buf[7]; -+ -+ /* Extract time from rtc_time and load into pt7c4338*/ -+ buf[0] = bin2bcd(time->tm_sec); -+ buf[1] = bin2bcd(time->tm_min); -+ buf[2] = bin2bcd(time->tm_hour); -+ buf[3] = bin2bcd(time->tm_wday + 1); /* Day of the week */ -+ buf[4] = bin2bcd(time->tm_mday); /* Date */ -+ buf[5] = bin2bcd(time->tm_mon + 1); -+ -+ /* assume 20YY not 19YY */ -+ if (time->tm_year >= 100) -+ buf[6] = bin2bcd(time->tm_year - 100); -+ else -+ buf[6] = bin2bcd(time->tm_year); -+ -+ return i2c_smbus_write_i2c_block_data(client, -+ PT7C4338_REG_SECONDS, 7, buf); -+} -+ -+static const struct rtc_class_ops pt7c4338_rtc_ops = { -+ .read_time = pt7c4338_read_time, -+ .set_time = pt7c4338_set_time, -+}; -+ -+static int pt7c4338_probe(struct i2c_client *client, -+ const struct i2c_device_id *id) -+{ -+ struct pt7c4338 *pt7c4338; -+ struct i2c_adapter *adapter = to_i2c_adapter(client->dev.parent); -+ int ret; -+ -+ pt7c4338 = kzalloc(sizeof(struct pt7c4338), GFP_KERNEL); -+ if (!pt7c4338) -+ return -ENOMEM; -+ -+ pt7c4338->client = client; -+ i2c_set_clientdata(client, pt7c4338); -+ pt7c4338->rtc = rtc_device_register(client->name, &client->dev, -+ &pt7c4338_rtc_ops, THIS_MODULE); -+ if (IS_ERR(pt7c4338->rtc)) { -+ ret = PTR_ERR(pt7c4338->rtc); -+ dev_err(&client->dev, "unable to register the class device\n"); -+ goto out_free; -+ } -+ -+ return 0; -+out_free: -+ i2c_set_clientdata(client, NULL); -+ kfree(pt7c4338); -+ return ret; -+} -+ -+static int pt7c4338_remove(struct i2c_client *client) -+{ -+ struct pt7c4338 *pt7c4338 = i2c_get_clientdata(client); -+ -+ rtc_device_unregister(pt7c4338->rtc); -+ i2c_set_clientdata(client, NULL); -+ kfree(pt7c4338); -+ return 0; -+} -+ -+static struct i2c_driver pt7c4338_driver = { -+ .driver = { -+ .name = "rtc-pt7c4338", -+ .owner = THIS_MODULE, -+ }, -+ .probe = pt7c4338_probe, -+ .remove = pt7c4338_remove, -+ .id_table = pt7c4338_id, -+}; -+ -+static int __init pt7c4338_init(void) -+{ -+ return i2c_add_driver(&pt7c4338_driver); -+} -+ -+static void __exit pt7c4338_exit(void) -+{ -+ i2c_del_driver(&pt7c4338_driver); -+} -+ -+module_init(pt7c4338_init); -+module_exit(pt7c4338_exit); -+ -+MODULE_AUTHOR("Priyanka Jain "); -+MODULE_DESCRIPTION("pericom Technology Inc. PT7C4338 RTC Driver"); -+MODULE_LICENSE("GPL"); diff --git a/target/linux/generic/pending-3.18/861-04_spi_gpio_implement_spi_delay.patch b/target/linux/generic/pending-3.18/861-04_spi_gpio_implement_spi_delay.patch deleted file mode 100644 index e7b32a50bc..0000000000 --- a/target/linux/generic/pending-3.18/861-04_spi_gpio_implement_spi_delay.patch +++ /dev/null @@ -1,58 +0,0 @@ -Implement the SPI-GPIO delay function for busses that need speed limitation. - ---mb - - - ---- a/drivers/spi/spi-gpio.c -+++ b/drivers/spi/spi-gpio.c -@@ -21,6 +21,7 @@ - #include - #include - #include -+#include - #include - #include - #include -@@ -73,6 +74,7 @@ struct spi_gpio { - * #define SPI_MOSI_GPIO 120 - * #define SPI_SCK_GPIO 121 - * #define SPI_N_CHIPSEL 4 -+ * #undef NEED_SPIDELAY - * #include "spi-gpio.c" - */ - -@@ -80,6 +82,7 @@ struct spi_gpio { - #define DRIVER_NAME "spi_gpio" - - #define GENERIC_BITBANG /* vs tight inlines */ -+#define NEED_SPIDELAY 1 - - /* all functions referencing these symbols must define pdata */ - #define SPI_MISO_GPIO ((pdata)->miso) -@@ -130,12 +133,20 @@ static inline int getmiso(const struct s - #undef pdata - - /* -- * NOTE: this clocks "as fast as we can". It "should" be a function of the -- * requested device clock. Software overhead means we usually have trouble -- * reaching even one Mbit/sec (except when we can inline bitops), so for now -- * we'll just assume we never need additional per-bit slowdowns. -+ * NOTE: to clock "as fast as we can", set spi_device.max_speed_hz -+ * and spi_transfer.speed_hz to 0. -+ * Otherwise this is a function of the requested device clock. -+ * Software overhead means we usually have trouble -+ * reaching even one Mbit/sec (except when we can inline bitops). So on small -+ * embedded devices with fast SPI slaves you usually don't need a delay. - */ --#define spidelay(nsecs) do {} while (0) -+static inline void spidelay(unsigned nsecs) -+{ -+#ifdef NEED_SPIDELAY -+ if (unlikely(nsecs)) -+ ndelay(nsecs); -+#endif /* NEED_SPIDELAY */ -+} - - #include "spi-bitbang-txrx.h" - diff --git a/target/linux/generic/pending-3.18/862-gpio_spi_driver.patch b/target/linux/generic/pending-3.18/862-gpio_spi_driver.patch deleted file mode 100644 index 70bf11f8f5..0000000000 --- a/target/linux/generic/pending-3.18/862-gpio_spi_driver.patch +++ /dev/null @@ -1,373 +0,0 @@ -THIS CODE IS DEPRECATED. - -Please use the new mainline SPI-GPIO driver, as of 2.6.29. - ---mb - - - ---- - drivers/spi/Kconfig | 9 + - drivers/spi/Makefile | 1 - drivers/spi/spi_gpio_old.c | 251 +++++++++++++++++++++++++++++++++++++++ - include/linux/spi/spi_gpio_old.h | 73 +++++++++++ - 4 files changed, 334 insertions(+) - ---- /dev/null -+++ b/include/linux/spi/spi_gpio_old.h -@@ -0,0 +1,73 @@ -+/* -+ * spi_gpio interface to platform code -+ * -+ * Copyright (c) 2008 Piotr Skamruk -+ * Copyright (c) 2008 Michael Buesch -+ * -+ * 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 _LINUX_SPI_SPI_GPIO -+#define _LINUX_SPI_SPI_GPIO -+ -+#include -+#include -+ -+ -+/** -+ * struct spi_gpio_platform_data - Data definitions for a SPI-GPIO device. -+ * -+ * This structure holds information about a GPIO-based SPI device. -+ * -+ * @pin_clk: The GPIO pin number of the CLOCK pin. -+ * -+ * @pin_miso: The GPIO pin number of the MISO pin. -+ * -+ * @pin_mosi: The GPIO pin number of the MOSI pin. -+ * -+ * @pin_cs: The GPIO pin number of the CHIPSELECT pin. -+ * -+ * @cs_activelow: If true, the chip is selected when the CS line is low. -+ * -+ * @no_spi_delay: If true, no delay is done in the lowlevel bitbanging. -+ * Note that doing no delay is not standards compliant, -+ * but it might be needed to speed up transfers on some -+ * slow embedded machines. -+ * -+ * @boardinfo_setup: This callback is called after the -+ * SPI master device was registered, but before the -+ * device is registered. -+ * @boardinfo_setup_data: Data argument passed to boardinfo_setup(). -+ */ -+struct spi_gpio_platform_data { -+ unsigned int pin_clk; -+ unsigned int pin_miso; -+ unsigned int pin_mosi; -+ unsigned int pin_cs; -+ bool cs_activelow; -+ bool no_spi_delay; -+ int (*boardinfo_setup)(struct spi_board_info *bi, -+ struct spi_master *master, -+ void *data); -+ void *boardinfo_setup_data; -+}; -+ -+/** -+ * SPI_GPIO_PLATDEV_NAME - The platform device name string. -+ * -+ * The name string that has to be used for platform_device_alloc -+ * when allocating a spi-gpio device. -+ */ -+#define SPI_GPIO_PLATDEV_NAME "spi-gpio" -+ -+/** -+ * spi_gpio_next_id - Get another platform device ID number. -+ * -+ * This returns the next platform device ID number that has to be used -+ * for platform_device_alloc. The ID is opaque and should not be used for -+ * anything else. -+ */ -+int spi_gpio_next_id(void); -+ -+#endif /* _LINUX_SPI_SPI_GPIO */ ---- /dev/null -+++ b/drivers/spi/spi_gpio_old.c -@@ -0,0 +1,251 @@ -+/* -+ * Bitbanging SPI bus driver using GPIO API -+ * -+ * Copyright (c) 2008 Piotr Skamruk -+ * Copyright (c) 2008 Michael Buesch -+ * -+ * based on spi_s3c2410_gpio.c -+ * Copyright (c) 2006 Ben Dooks -+ * Copyright (c) 2006 Simtec Electronics -+ * and on i2c-gpio.c -+ * Copyright (C) 2007 Atmel Corporation -+ * -+ * 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 -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+ -+struct spi_gpio { -+ struct spi_bitbang bitbang; -+ struct spi_gpio_platform_data *info; -+ struct platform_device *pdev; -+ struct spi_board_info bi; -+}; -+ -+ -+static inline struct spi_gpio *spidev_to_sg(struct spi_device *dev) -+{ -+ return dev->controller_data; -+} -+ -+static inline void setsck(struct spi_device *dev, int val) -+{ -+ struct spi_gpio *sp = spidev_to_sg(dev); -+ gpio_set_value(sp->info->pin_clk, val ? 1 : 0); -+} -+ -+static inline void setmosi(struct spi_device *dev, int val) -+{ -+ struct spi_gpio *sp = spidev_to_sg(dev); -+ gpio_set_value(sp->info->pin_mosi, val ? 1 : 0); -+} -+ -+static inline u32 getmiso(struct spi_device *dev) -+{ -+ struct spi_gpio *sp = spidev_to_sg(dev); -+ return gpio_get_value(sp->info->pin_miso) ? 1 : 0; -+} -+ -+static inline void do_spidelay(struct spi_device *dev, unsigned nsecs) -+{ -+ struct spi_gpio *sp = spidev_to_sg(dev); -+ -+ if (!sp->info->no_spi_delay) -+ ndelay(nsecs); -+} -+ -+#define spidelay(nsecs) do { \ -+ /* Steal the spi_device pointer from our caller. \ -+ * The bitbang-API should probably get fixed here... */ \ -+ do_spidelay(spi, nsecs); \ -+ } while (0) -+ -+#define EXPAND_BITBANG_TXRX -+#include "spi-bitbang-txrx.h" -+ -+static u32 spi_gpio_txrx_mode0(struct spi_device *spi, -+ unsigned nsecs, u32 word, u8 bits) -+{ -+ return bitbang_txrx_be_cpha0(spi, nsecs, 0, 0, word, bits); -+} -+ -+static u32 spi_gpio_txrx_mode1(struct spi_device *spi, -+ unsigned nsecs, u32 word, u8 bits) -+{ -+ return bitbang_txrx_be_cpha1(spi, nsecs, 0, 0, word, bits); -+} -+ -+static u32 spi_gpio_txrx_mode2(struct spi_device *spi, -+ unsigned nsecs, u32 word, u8 bits) -+{ -+ return bitbang_txrx_be_cpha0(spi, nsecs, 1, 0, word, bits); -+} -+ -+static u32 spi_gpio_txrx_mode3(struct spi_device *spi, -+ unsigned nsecs, u32 word, u8 bits) -+{ -+ return bitbang_txrx_be_cpha1(spi, nsecs, 1, 0, word, bits); -+} -+ -+static void spi_gpio_chipselect(struct spi_device *dev, int on) -+{ -+ struct spi_gpio *sp = spidev_to_sg(dev); -+ -+ if (sp->info->cs_activelow) -+ on = !on; -+ gpio_set_value(sp->info->pin_cs, on ? 1 : 0); -+} -+ -+static int spi_gpio_probe(struct platform_device *pdev) -+{ -+ struct spi_master *master; -+ struct spi_gpio_platform_data *pdata; -+ struct spi_gpio *sp; -+ struct spi_device *spidev; -+ int err; -+ -+ pdata = pdev->dev.platform_data; -+ if (!pdata) -+ return -ENXIO; -+ -+ err = -ENOMEM; -+ master = spi_alloc_master(&pdev->dev, sizeof(struct spi_gpio)); -+ if (!master) -+ goto err_alloc_master; -+ -+ sp = spi_master_get_devdata(master); -+ platform_set_drvdata(pdev, sp); -+ sp->info = pdata; -+ -+ err = gpio_request(pdata->pin_clk, "spi_clock"); -+ if (err) -+ goto err_request_clk; -+ err = gpio_request(pdata->pin_mosi, "spi_mosi"); -+ if (err) -+ goto err_request_mosi; -+ err = gpio_request(pdata->pin_miso, "spi_miso"); -+ if (err) -+ goto err_request_miso; -+ err = gpio_request(pdata->pin_cs, "spi_cs"); -+ if (err) -+ goto err_request_cs; -+ -+ sp->bitbang.master = spi_master_get(master); -+ sp->bitbang.master->bus_num = -1; -+ sp->bitbang.master->num_chipselect = 1; -+ sp->bitbang.chipselect = spi_gpio_chipselect; -+ sp->bitbang.txrx_word[SPI_MODE_0] = spi_gpio_txrx_mode0; -+ sp->bitbang.txrx_word[SPI_MODE_1] = spi_gpio_txrx_mode1; -+ sp->bitbang.txrx_word[SPI_MODE_2] = spi_gpio_txrx_mode2; -+ sp->bitbang.txrx_word[SPI_MODE_3] = spi_gpio_txrx_mode3; -+ -+ gpio_direction_output(pdata->pin_clk, 0); -+ gpio_direction_output(pdata->pin_mosi, 0); -+ gpio_direction_output(pdata->pin_cs, -+ pdata->cs_activelow ? 1 : 0); -+ gpio_direction_input(pdata->pin_miso); -+ -+ err = spi_bitbang_start(&sp->bitbang); -+ if (err) -+ goto err_no_bitbang; -+ err = pdata->boardinfo_setup(&sp->bi, master, -+ pdata->boardinfo_setup_data); -+ if (err) -+ goto err_bi_setup; -+ sp->bi.controller_data = sp; -+ spidev = spi_new_device(master, &sp->bi); -+ if (!spidev) -+ goto err_new_dev; -+ -+ return 0; -+ -+err_new_dev: -+err_bi_setup: -+ spi_bitbang_stop(&sp->bitbang); -+err_no_bitbang: -+ spi_master_put(sp->bitbang.master); -+ gpio_free(pdata->pin_cs); -+err_request_cs: -+ gpio_free(pdata->pin_miso); -+err_request_miso: -+ gpio_free(pdata->pin_mosi); -+err_request_mosi: -+ gpio_free(pdata->pin_clk); -+err_request_clk: -+ kfree(master); -+ -+err_alloc_master: -+ return err; -+} -+ -+static int spi_gpio_remove(struct platform_device *pdev) -+{ -+ struct spi_gpio *sp; -+ struct spi_gpio_platform_data *pdata; -+ -+ pdata = pdev->dev.platform_data; -+ sp = platform_get_drvdata(pdev); -+ -+ gpio_free(pdata->pin_clk); -+ gpio_free(pdata->pin_mosi); -+ gpio_free(pdata->pin_miso); -+ gpio_free(pdata->pin_cs); -+ spi_bitbang_stop(&sp->bitbang); -+ spi_master_put(sp->bitbang.master); -+ -+ return 0; -+} -+ -+static struct platform_driver spi_gpio_driver = { -+ .driver = { -+ .name = SPI_GPIO_PLATDEV_NAME, -+ .owner = THIS_MODULE, -+ }, -+ .probe = spi_gpio_probe, -+ .remove = spi_gpio_remove, -+}; -+ -+int spi_gpio_next_id(void) -+{ -+ static atomic_t counter = ATOMIC_INIT(-1); -+ -+ return atomic_inc_return(&counter); -+} -+EXPORT_SYMBOL(spi_gpio_next_id); -+ -+static int __init spi_gpio_init(void) -+{ -+ int err; -+ -+ err = platform_driver_register(&spi_gpio_driver); -+ if (err) -+ printk(KERN_ERR "spi-gpio: register failed: %d\n", err); -+ -+ return err; -+} -+module_init(spi_gpio_init); -+ -+static void __exit spi_gpio_exit(void) -+{ -+ platform_driver_unregister(&spi_gpio_driver); -+} -+module_exit(spi_gpio_exit); -+ -+MODULE_AUTHOR("Piot Skamruk "); -+MODULE_AUTHOR("Michael Buesch"); -+MODULE_DESCRIPTION("Platform independent GPIO bitbanging SPI driver"); -+MODULE_LICENSE("GPL v2"); ---- a/drivers/spi/Kconfig -+++ b/drivers/spi/Kconfig -@@ -225,6 +225,15 @@ config SPI_GPIO - GPIO operations, you should be able to leverage that for better - speed with a custom version of this driver; see the source code. - -+config SPI_GPIO_OLD -+ tristate "Old GPIO API based bitbanging SPI controller (DEPRECATED)" -+ depends on SPI_MASTER && GPIOLIB -+ select SPI_BITBANG -+ help -+ This code is deprecated. Please use the new mainline SPI-GPIO driver. -+ -+ If unsure, say N. -+ - config SPI_IMX - tristate "Freescale i.MX SPI controllers" - depends on ARCH_MXC || COMPILE_TEST ---- a/drivers/spi/Makefile -+++ b/drivers/spi/Makefile -@@ -40,6 +40,7 @@ obj-$(CONFIG_SPI_FSL_LIB) += spi-fsl-li - obj-$(CONFIG_SPI_FSL_ESPI) += spi-fsl-espi.o - obj-$(CONFIG_SPI_FSL_SPI) += spi-fsl-spi.o - obj-$(CONFIG_SPI_GPIO) += spi-gpio.o -+obj-$(CONFIG_SPI_GPIO_OLD) += spi_gpio_old.o - obj-$(CONFIG_SPI_IMX) += spi-imx.o - obj-$(CONFIG_SPI_LM70_LLP) += spi-lm70llp.o - obj-$(CONFIG_SPI_MPC512x_PSC) += spi-mpc512x-psc.o diff --git a/target/linux/generic/pending-3.18/870-hifn795x_byteswap.patch b/target/linux/generic/pending-3.18/870-hifn795x_byteswap.patch deleted file mode 100644 index 3a37c951ec..0000000000 --- a/target/linux/generic/pending-3.18/870-hifn795x_byteswap.patch +++ /dev/null @@ -1,17 +0,0 @@ ---- a/drivers/crypto/hifn_795x.c -+++ b/drivers/crypto/hifn_795x.c -@@ -682,12 +682,12 @@ static inline u32 hifn_read_1(struct hif - - static inline void hifn_write_0(struct hifn_device *dev, u32 reg, u32 val) - { -- writel((__force u32)cpu_to_le32(val), dev->bar[0] + reg); -+ writel(val, dev->bar[0] + reg); - } - - static inline void hifn_write_1(struct hifn_device *dev, u32 reg, u32 val) - { -- writel((__force u32)cpu_to_le32(val), dev->bar[1] + reg); -+ writel(val, dev->bar[1] + reg); - } - - static void hifn_wait_puc(struct hifn_device *dev) diff --git a/target/linux/generic/pending-3.18/890-8250_optional_sysrq.patch b/target/linux/generic/pending-3.18/890-8250_optional_sysrq.patch deleted file mode 100644 index 8815e4c644..0000000000 --- a/target/linux/generic/pending-3.18/890-8250_optional_sysrq.patch +++ /dev/null @@ -1,24 +0,0 @@ ---- a/drivers/tty/serial/8250/8250_core.c -+++ b/drivers/tty/serial/8250/8250_core.c -@@ -16,7 +16,7 @@ - * membase is an 'ioremapped' cookie. - */ - --#if defined(CONFIG_SERIAL_8250_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ) -+#if defined(CONFIG_SERIAL_8250_SYSRQ) && defined(CONFIG_MAGIC_SYSRQ) - #define SUPPORT_SYSRQ - #endif - ---- a/drivers/tty/serial/8250/Kconfig -+++ b/drivers/tty/serial/8250/Kconfig -@@ -91,6 +91,10 @@ config SERIAL_8250_CONSOLE - - If unsure, say N. - -+config SERIAL_8250_SYSRQ -+ bool "Magic sysrq support on 8250/16550 devices" -+ depends on SERIAL_8250_CONSOLE -+ - config SERIAL_8250_GSC - tristate - depends on SERIAL_8250 && GSC diff --git a/target/linux/generic/pending-3.18/901-debloat_sock_diag.patch b/target/linux/generic/pending-3.18/901-debloat_sock_diag.patch deleted file mode 100644 index 41c9220a60..0000000000 --- a/target/linux/generic/pending-3.18/901-debloat_sock_diag.patch +++ /dev/null @@ -1,65 +0,0 @@ ---- a/net/Kconfig -+++ b/net/Kconfig -@@ -89,6 +89,9 @@ source "net/netlabel/Kconfig" - - endif # if INET - -+config SOCK_DIAG -+ bool -+ - config NETWORK_SECMARK - bool "Security Marking" - help ---- a/net/core/Makefile -+++ b/net/core/Makefile -@@ -9,8 +9,9 @@ obj-$(CONFIG_SYSCTL) += sysctl_net_core. - - obj-y += dev.o ethtool.o dev_addr_lists.o dst.o netevent.o \ - neighbour.o rtnetlink.o utils.o link_watch.o filter.o \ -- sock_diag.o dev_ioctl.o tso.o -+ dev_ioctl.o tso.o - -+obj-$(CONFIG_SOCK_DIAG) += sock_diag.o - obj-$(CONFIG_XFRM) += flow.o - obj-y += net-sysfs.o - obj-$(CONFIG_PROC_FS) += net-procfs.o ---- a/net/ipv4/Kconfig -+++ b/net/ipv4/Kconfig -@@ -419,6 +419,7 @@ config INET_LRO - - config INET_DIAG - tristate "INET: socket monitoring interface" -+ select SOCK_DIAG - default y - ---help--- - Support for INET (TCP, DCCP, etc) socket monitoring interface used by ---- a/net/unix/Kconfig -+++ b/net/unix/Kconfig -@@ -22,6 +22,7 @@ config UNIX - config UNIX_DIAG - tristate "UNIX: socket monitoring interface" - depends on UNIX -+ select SOCK_DIAG - default n - ---help--- - Support for UNIX socket monitoring interface used by the ss tool. ---- a/net/netlink/Kconfig -+++ b/net/netlink/Kconfig -@@ -4,6 +4,7 @@ - - config NETLINK_DIAG - tristate "NETLINK: socket monitoring interface" -+ select SOCK_DIAG - default n - ---help--- - Support for NETLINK socket monitoring interface used by the ss tool. ---- a/net/packet/Kconfig -+++ b/net/packet/Kconfig -@@ -18,6 +18,7 @@ config PACKET - config PACKET_DIAG - tristate "Packet: sockets monitoring interface" - depends on PACKET -+ select SOCK_DIAG - default n - ---help--- - Support for PF_PACKET sockets monitoring interface used by the ss tool. diff --git a/target/linux/generic/pending-3.18/902-debloat_proc.patch b/target/linux/generic/pending-3.18/902-debloat_proc.patch deleted file mode 100644 index 8b68cd36fa..0000000000 --- a/target/linux/generic/pending-3.18/902-debloat_proc.patch +++ /dev/null @@ -1,342 +0,0 @@ ---- a/fs/locks.c -+++ b/fs/locks.c -@@ -2620,6 +2620,8 @@ static const struct file_operations proc - - static int __init proc_locks_init(void) - { -+ if (IS_ENABLED(CONFIG_PROC_STRIPPED)) -+ return 0; - proc_create("locks", 0, NULL, &proc_locks_operations); - return 0; - } ---- a/fs/proc/Kconfig -+++ b/fs/proc/Kconfig -@@ -71,3 +71,8 @@ config PROC_PAGE_MONITOR - /proc/pid/smaps, /proc/pid/clear_refs, /proc/pid/pagemap, - /proc/kpagecount, and /proc/kpageflags. Disabling these - interfaces will reduce the size of the kernel by approximately 4kb. -+ -+config PROC_STRIPPED -+ default n -+ depends on EXPERT -+ bool "Strip non-essential /proc functionality to reduce code size" ---- a/fs/proc/consoles.c -+++ b/fs/proc/consoles.c -@@ -106,6 +106,9 @@ static const struct file_operations proc - - static int __init proc_consoles_init(void) - { -+ if (IS_ENABLED(CONFIG_PROC_STRIPPED)) -+ return 0; -+ - proc_create("consoles", 0, NULL, &proc_consoles_operations); - return 0; - } ---- a/fs/proc/proc_tty.c -+++ b/fs/proc/proc_tty.c -@@ -144,7 +144,10 @@ static const struct file_operations proc - void proc_tty_register_driver(struct tty_driver *driver) - { - struct proc_dir_entry *ent; -- -+ -+ if (IS_ENABLED(CONFIG_PROC_STRIPPED)) -+ return; -+ - if (!driver->driver_name || driver->proc_entry || - !driver->ops->proc_fops) - return; -@@ -161,6 +164,9 @@ void proc_tty_unregister_driver(struct t - { - struct proc_dir_entry *ent; - -+ if (IS_ENABLED(CONFIG_PROC_STRIPPED)) -+ return; -+ - ent = driver->proc_entry; - if (!ent) - return; -@@ -175,6 +181,9 @@ void proc_tty_unregister_driver(struct t - */ - void __init proc_tty_init(void) - { -+ if (IS_ENABLED(CONFIG_PROC_STRIPPED)) -+ return; -+ - if (!proc_mkdir("tty", NULL)) - return; - proc_mkdir("tty/ldisc", NULL); /* Preserved: it's userspace visible */ ---- a/kernel/exec_domain.c -+++ b/kernel/exec_domain.c -@@ -176,6 +176,8 @@ static const struct file_operations exec - - static int __init proc_execdomains_init(void) - { -+ if (IS_ENABLED(CONFIG_PROC_STRIPPED)) -+ return 0; - proc_create("execdomains", 0, NULL, &execdomains_proc_fops); - return 0; - } ---- a/kernel/irq/proc.c -+++ b/kernel/irq/proc.c -@@ -330,6 +330,9 @@ void register_irq_proc(unsigned int irq, - static DEFINE_MUTEX(register_lock); - char name [MAX_NAMELEN]; - -+ if (IS_ENABLED(CONFIG_PROC_STRIPPED) && !IS_ENABLED(CONFIG_SMP)) -+ return; -+ - if (!root_irq_dir || (desc->irq_data.chip == &no_irq_chip)) - return; - -@@ -379,6 +382,9 @@ void unregister_irq_proc(unsigned int ir - { - char name [MAX_NAMELEN]; - -+ if (IS_ENABLED(CONFIG_PROC_STRIPPED) && !IS_ENABLED(CONFIG_SMP)) -+ return; -+ - if (!root_irq_dir || !desc->dir) - return; - #ifdef CONFIG_SMP -@@ -414,6 +420,9 @@ void init_irq_proc(void) - unsigned int irq; - struct irq_desc *desc; - -+ if (IS_ENABLED(CONFIG_PROC_STRIPPED) && !IS_ENABLED(CONFIG_SMP)) -+ return; -+ - /* create /proc/irq */ - root_irq_dir = proc_mkdir("irq", NULL); - if (!root_irq_dir) ---- a/kernel/time/timer_list.c -+++ b/kernel/time/timer_list.c -@@ -362,6 +362,9 @@ static int __init init_timer_list_procfs - { - struct proc_dir_entry *pe; - -+ if (IS_ENABLED(CONFIG_PROC_STRIPPED)) -+ return 0; -+ - pe = proc_create("timer_list", 0400, NULL, &timer_list_fops); - if (!pe) - return -ENOMEM; ---- a/mm/vmalloc.c -+++ b/mm/vmalloc.c -@@ -2663,6 +2663,8 @@ static const struct file_operations proc - - static int __init proc_vmalloc_init(void) - { -+ if (IS_ENABLED(CONFIG_PROC_STRIPPED)) -+ return 0; - proc_create("vmallocinfo", S_IRUSR, NULL, &proc_vmalloc_operations); - return 0; - } ---- a/mm/vmstat.c -+++ b/mm/vmstat.c -@@ -1424,10 +1424,12 @@ static int __init setup_vmstat(void) - cpu_notifier_register_done(); - #endif - #ifdef CONFIG_PROC_FS -- proc_create("buddyinfo", S_IRUGO, NULL, &fragmentation_file_operations); -- proc_create("pagetypeinfo", S_IRUGO, NULL, &pagetypeinfo_file_ops); -+ if (!IS_ENABLED(CONFIG_PROC_STRIPPED)) { -+ proc_create("buddyinfo", S_IRUGO, NULL, &fragmentation_file_operations); -+ proc_create("pagetypeinfo", S_IRUGO, NULL, &pagetypeinfo_file_ops); -+ proc_create("zoneinfo", S_IRUGO, NULL, &proc_zoneinfo_file_operations); -+ } - proc_create("vmstat", S_IRUGO, NULL, &proc_vmstat_file_operations); -- proc_create("zoneinfo", S_IRUGO, NULL, &proc_zoneinfo_file_operations); - #endif - return 0; - } ---- a/net/8021q/vlanproc.c -+++ b/net/8021q/vlanproc.c -@@ -127,6 +127,9 @@ void vlan_proc_cleanup(struct net *net) - { - struct vlan_net *vn = net_generic(net, vlan_net_id); - -+ if (IS_ENABLED(CONFIG_PROC_STRIPPED)) -+ return; -+ - if (vn->proc_vlan_conf) - remove_proc_entry(name_conf, vn->proc_vlan_dir); - -@@ -146,6 +149,9 @@ int __net_init vlan_proc_init(struct net - { - struct vlan_net *vn = net_generic(net, vlan_net_id); - -+ if (IS_ENABLED(CONFIG_PROC_STRIPPED)) -+ return 0; -+ - vn->proc_vlan_dir = proc_net_mkdir(net, name_root, net->proc_net); - if (!vn->proc_vlan_dir) - goto err; ---- a/net/core/sock.c -+++ b/net/core/sock.c -@@ -2945,6 +2945,8 @@ static __net_initdata struct pernet_oper - - static int __init proto_init(void) - { -+ if (IS_ENABLED(CONFIG_PROC_STRIPPED)) -+ return 0; - return register_pernet_subsys(&proto_net_ops); - } - ---- a/net/ipv4/fib_trie.c -+++ b/net/ipv4/fib_trie.c -@@ -2490,10 +2490,12 @@ static const struct file_operations fib_ - - int __net_init fib_proc_init(struct net *net) - { -- if (!proc_create("fib_trie", S_IRUGO, net->proc_net, &fib_trie_fops)) -+ if (!IS_ENABLED(CONFIG_PROC_STRIPPED) && -+ !proc_create("fib_trie", S_IRUGO, net->proc_net, &fib_trie_fops)) - goto out1; - -- if (!proc_create("fib_triestat", S_IRUGO, net->proc_net, -+ if (!IS_ENABLED(CONFIG_PROC_STRIPPED) && -+ !proc_create("fib_triestat", S_IRUGO, net->proc_net, - &fib_triestat_fops)) - goto out2; - -@@ -2503,17 +2505,21 @@ int __net_init fib_proc_init(struct net - return 0; - - out3: -- remove_proc_entry("fib_triestat", net->proc_net); -+ if (!IS_ENABLED(CONFIG_PROC_STRIPPED)) -+ remove_proc_entry("fib_triestat", net->proc_net); - out2: -- remove_proc_entry("fib_trie", net->proc_net); -+ if (!IS_ENABLED(CONFIG_PROC_STRIPPED)) -+ remove_proc_entry("fib_trie", net->proc_net); - out1: - return -ENOMEM; - } - - void __net_exit fib_proc_exit(struct net *net) - { -- remove_proc_entry("fib_trie", net->proc_net); -- remove_proc_entry("fib_triestat", net->proc_net); -+ if (!IS_ENABLED(CONFIG_PROC_STRIPPED)) { -+ remove_proc_entry("fib_trie", net->proc_net); -+ remove_proc_entry("fib_triestat", net->proc_net); -+ } - remove_proc_entry("route", net->proc_net); - } - ---- a/net/ipv4/proc.c -+++ b/net/ipv4/proc.c -@@ -524,6 +524,9 @@ static __net_initdata struct pernet_oper - - int __init ip_misc_proc_init(void) - { -+ if (IS_ENABLED(CONFIG_PROC_STRIPPED)) -+ return 0; -+ - return register_pernet_subsys(&ip_proc_ops); - } - ---- a/net/ipv4/route.c -+++ b/net/ipv4/route.c -@@ -418,6 +418,9 @@ static struct pernet_operations ip_rt_pr - - static int __init ip_rt_proc_init(void) - { -+ if (IS_ENABLED(CONFIG_PROC_STRIPPED)) -+ return 0; -+ - return register_pernet_subsys(&ip_rt_proc_ops); - } - ---- a/ipc/msg.c -+++ b/ipc/msg.c -@@ -1075,6 +1075,9 @@ void __init msg_init(void) - printk(KERN_INFO "msgmni has been set to %d\n", - init_ipc_ns.msg_ctlmni); - -+ if (IS_ENABLED(CONFIG_PROC_STRIPPED)) -+ return; -+ - ipc_init_proc_interface("sysvipc/msg", - " key msqid perms cbytes qnum lspid lrpid uid gid cuid cgid stime rtime ctime\n", - IPC_MSG_IDS, sysvipc_msg_proc_show); ---- a/ipc/sem.c -+++ b/ipc/sem.c -@@ -191,6 +191,8 @@ void sem_exit_ns(struct ipc_namespace *n - void __init sem_init(void) - { - sem_init_ns(&init_ipc_ns); -+ if (IS_ENABLED(CONFIG_PROC_STRIPPED)) -+ return; - ipc_init_proc_interface("sysvipc/sem", - " key semid perms nsems uid gid cuid cgid otime ctime\n", - IPC_SEM_IDS, sysvipc_sem_proc_show); ---- a/ipc/shm.c -+++ b/ipc/shm.c -@@ -118,6 +118,8 @@ pure_initcall(ipc_ns_init); - - void __init shm_init(void) - { -+ if (IS_ENABLED(CONFIG_PROC_STRIPPED)) -+ return; - ipc_init_proc_interface("sysvipc/shm", - #if BITS_PER_LONG <= 32 - " key shmid perms size cpid lpid nattch uid gid cuid cgid atime dtime ctime rss swap\n", ---- a/ipc/util.c -+++ b/ipc/util.c -@@ -161,6 +161,9 @@ void __init ipc_init_proc_interface(cons - struct proc_dir_entry *pde; - struct ipc_proc_iface *iface; - -+ if (IS_ENABLED(CONFIG_PROC_STRIPPED)) -+ return; -+ - iface = kmalloc(sizeof(*iface), GFP_KERNEL); - if (!iface) - return; ---- a/net/core/net-procfs.c -+++ b/net/core/net-procfs.c -@@ -318,10 +318,12 @@ static int __net_init dev_proc_net_init( - - if (!proc_create("dev", S_IRUGO, net->proc_net, &dev_seq_fops)) - goto out; -- if (!proc_create("softnet_stat", S_IRUGO, net->proc_net, -+ if (!IS_ENABLED(CONFIG_PROC_STRIPPED) && -+ !proc_create("softnet_stat", S_IRUGO, net->proc_net, - &softnet_seq_fops)) - goto out_dev; -- if (!proc_create("ptype", S_IRUGO, net->proc_net, &ptype_seq_fops)) -+ if (!IS_ENABLED(CONFIG_PROC_STRIPPED) && -+ !proc_create("ptype", S_IRUGO, net->proc_net, &ptype_seq_fops)) - goto out_softnet; - - if (wext_proc_init(net)) -@@ -330,9 +332,11 @@ static int __net_init dev_proc_net_init( - out: - return rc; - out_ptype: -- remove_proc_entry("ptype", net->proc_net); -+ if (!IS_ENABLED(CONFIG_PROC_STRIPPED)) -+ remove_proc_entry("ptype", net->proc_net); - out_softnet: -- remove_proc_entry("softnet_stat", net->proc_net); -+ if (!IS_ENABLED(CONFIG_PROC_STRIPPED)) -+ remove_proc_entry("softnet_stat", net->proc_net); - out_dev: - remove_proc_entry("dev", net->proc_net); - goto out; -@@ -342,8 +346,10 @@ static void __net_exit dev_proc_net_exit - { - wext_proc_exit(net); - -- remove_proc_entry("ptype", net->proc_net); -- remove_proc_entry("softnet_stat", net->proc_net); -+ if (!IS_ENABLED(CONFIG_PROC_STRIPPED)) { -+ remove_proc_entry("ptype", net->proc_net); -+ remove_proc_entry("softnet_stat", net->proc_net); -+ } - remove_proc_entry("dev", net->proc_net); - } - diff --git a/target/linux/generic/pending-3.18/904-debloat_dma_buf.patch b/target/linux/generic/pending-3.18/904-debloat_dma_buf.patch deleted file mode 100644 index a5e0be2496..0000000000 --- a/target/linux/generic/pending-3.18/904-debloat_dma_buf.patch +++ /dev/null @@ -1,44 +0,0 @@ ---- a/drivers/base/Kconfig -+++ b/drivers/base/Kconfig -@@ -229,7 +229,7 @@ config SOC_BUS - source "drivers/base/regmap/Kconfig" - - config DMA_SHARED_BUFFER -- bool -+ tristate - default n - select ANON_INODES - help ---- a/drivers/dma-buf/Makefile -+++ b/drivers/dma-buf/Makefile -@@ -1 +1,2 @@ --obj-y := dma-buf.o fence.o reservation.o seqno-fence.o -+obj-$(CONFIG_DMA_SHARED_BUFFER) := dma-shared-buffer.o -+dma-shared-buffer-objs := dma-buf.o fence.o reservation.o seqno-fence.o ---- a/drivers/dma-buf/dma-buf.c -+++ b/drivers/dma-buf/dma-buf.c -@@ -32,6 +32,7 @@ - #include - #include - #include -+#include - - static inline int is_dma_buf_file(struct file *); - -@@ -904,4 +905,5 @@ static void __exit dma_buf_deinit(void) - { - dma_buf_uninit_debugfs(); - } --__exitcall(dma_buf_deinit); -+module_exit(dma_buf_deinit); -+MODULE_LICENSE("GPL"); ---- a/kernel/sched/core.c -+++ b/kernel/sched/core.c -@@ -1823,6 +1823,7 @@ int wake_up_state(struct task_struct *p, - { - return try_to_wake_up(p, state, 0); - } -+EXPORT_SYMBOL_GPL(wake_up_state); - - /* - * This function clears the sched_dl_entity static params. diff --git a/target/linux/generic/pending-3.18/910-kobject_uevent.patch b/target/linux/generic/pending-3.18/910-kobject_uevent.patch deleted file mode 100644 index f69294b4fe..0000000000 --- a/target/linux/generic/pending-3.18/910-kobject_uevent.patch +++ /dev/null @@ -1,21 +0,0 @@ ---- a/lib/kobject_uevent.c -+++ b/lib/kobject_uevent.c -@@ -53,6 +53,18 @@ static const char *kobject_actions[] = { - [KOBJ_OFFLINE] = "offline", - }; - -+u64 uevent_next_seqnum(void) -+{ -+ u64 seq; -+ -+ mutex_lock(&uevent_sock_mutex); -+ seq = ++uevent_seqnum; -+ mutex_unlock(&uevent_sock_mutex); -+ -+ return seq; -+} -+EXPORT_SYMBOL_GPL(uevent_next_seqnum); -+ - /** - * kobject_action_type - translate action string to numeric type - * diff --git a/target/linux/generic/pending-3.18/911-kobject_add_broadcast_uevent.patch b/target/linux/generic/pending-3.18/911-kobject_add_broadcast_uevent.patch deleted file mode 100644 index 6e4c140291..0000000000 --- a/target/linux/generic/pending-3.18/911-kobject_add_broadcast_uevent.patch +++ /dev/null @@ -1,65 +0,0 @@ ---- a/include/linux/kobject.h -+++ b/include/linux/kobject.h -@@ -32,6 +32,8 @@ - #define UEVENT_NUM_ENVP 32 /* number of env pointers */ - #define UEVENT_BUFFER_SIZE 2048 /* buffer for the variables */ - -+struct sk_buff; -+ - #ifdef CONFIG_UEVENT_HELPER - /* path to the userspace helper executed on an event */ - extern char uevent_helper[]; -@@ -221,4 +223,7 @@ int add_uevent_var(struct kobj_uevent_en - int kobject_action_type(const char *buf, size_t count, - enum kobject_action *type); - -+int broadcast_uevent(struct sk_buff *skb, __u32 pid, __u32 group, -+ gfp_t allocation); -+ - #endif /* _KOBJECT_H_ */ ---- a/lib/kobject_uevent.c -+++ b/lib/kobject_uevent.c -@@ -424,6 +424,43 @@ int add_uevent_var(struct kobj_uevent_en - EXPORT_SYMBOL_GPL(add_uevent_var); - - #if defined(CONFIG_NET) -+int broadcast_uevent(struct sk_buff *skb, __u32 pid, __u32 group, -+ gfp_t allocation) -+{ -+ struct uevent_sock *ue_sk; -+ int err = 0; -+ -+ /* send netlink message */ -+ mutex_lock(&uevent_sock_mutex); -+ list_for_each_entry(ue_sk, &uevent_sock_list, list) { -+ struct sock *uevent_sock = ue_sk->sk; -+ struct sk_buff *skb2; -+ -+ skb2 = skb_clone(skb, allocation); -+ if (!skb2) -+ break; -+ -+ err = netlink_broadcast(uevent_sock, skb2, pid, group, -+ allocation); -+ if (err) -+ break; -+ } -+ mutex_unlock(&uevent_sock_mutex); -+ -+ kfree_skb(skb); -+ return err; -+} -+#else -+int broadcast_uevent(struct sk_buff *skb, __u32 pid, __u32 group, -+ gfp_t allocation) -+{ -+ kfree_skb(skb); -+ return 0; -+} -+#endif -+EXPORT_SYMBOL_GPL(broadcast_uevent); -+ -+#if defined(CONFIG_NET) - static int uevent_net_init(struct net *net) - { - struct uevent_sock *ue_sk; diff --git a/target/linux/generic/pending-3.18/921-use_preinit_as_init.patch b/target/linux/generic/pending-3.18/921-use_preinit_as_init.patch deleted file mode 100644 index 57c2fe27be..0000000000 --- a/target/linux/generic/pending-3.18/921-use_preinit_as_init.patch +++ /dev/null @@ -1,12 +0,0 @@ ---- a/init/main.c -+++ b/init/main.c -@@ -963,7 +963,8 @@ static int __ref kernel_init(void *unuse - pr_err("Failed to execute %s (error %d). Attempting defaults...\n", - execute_command, ret); - } -- if (!try_to_run_init_process("/sbin/init") || -+ if (!try_to_run_init_process("/etc/preinit") || -+ !try_to_run_init_process("/sbin/init") || - !try_to_run_init_process("/etc/init") || - !try_to_run_init_process("/bin/init") || - !try_to_run_init_process("/bin/sh")) diff --git a/target/linux/generic/pending-3.18/922-always-create-console-node-in-initramfs.patch b/target/linux/generic/pending-3.18/922-always-create-console-node-in-initramfs.patch deleted file mode 100644 index 3b308dd2c4..0000000000 --- a/target/linux/generic/pending-3.18/922-always-create-console-node-in-initramfs.patch +++ /dev/null @@ -1,30 +0,0 @@ ---- a/scripts/gen_initramfs_list.sh -+++ b/scripts/gen_initramfs_list.sh -@@ -59,6 +59,18 @@ default_initramfs() { - EOF - } - -+list_librecmc_initramfs() { -+ : -+} -+ -+librecmc_initramfs() { -+ # make sure that /dev/console exists -+ cat <<-EOF >> ${output} -+ dir /dev 0755 0 0 -+ nod /dev/console 0600 0 0 c 5 1 -+ EOF -+} -+ - filetype() { - local argv1="$1" - -@@ -177,6 +189,8 @@ dir_filelist() { - if [ "$(echo "${dirlist}" | wc -l)" -gt 1 ]; then - ${dep_list}print_mtime "$1" - -+ ${dep_list}librecmc_initramfs -+ - echo "${dirlist}" | \ - while read x; do - ${dep_list}parse ${x} diff --git a/target/linux/generic/pending-3.18/930-crashlog.patch b/target/linux/generic/pending-3.18/930-crashlog.patch deleted file mode 100644 index 9b0eb732df..0000000000 --- a/target/linux/generic/pending-3.18/930-crashlog.patch +++ /dev/null @@ -1,276 +0,0 @@ ---- /dev/null -+++ b/include/linux/crashlog.h -@@ -0,0 +1,17 @@ -+#ifndef __CRASHLOG_H -+#define __CRASHLOG_H -+ -+#ifdef CONFIG_CRASHLOG -+void crashlog_init_bootmem(struct bootmem_data *bdata); -+void crashlog_init_memblock(phys_addr_t addr, phys_addr_t size); -+#else -+static inline void crashlog_init_bootmem(struct bootmem_data *bdata) -+{ -+} -+ -+static inline void crashlog_init_memblock(phys_addr_t addr, phys_addr_t size) -+{ -+} -+#endif -+ -+#endif ---- a/init/Kconfig -+++ b/init/Kconfig -@@ -1279,6 +1279,10 @@ config RELAY - - If unsure, say N. - -+config CRASHLOG -+ bool "Crash logging" -+ depends on (!NO_BOOTMEM || HAVE_MEMBLOCK) && !(ARM || SPARC || PPC) -+ - config BLK_DEV_INITRD - bool "Initial RAM filesystem and RAM disk (initramfs/initrd) support" - depends on BROKEN || !FRV ---- a/kernel/Makefile -+++ b/kernel/Makefile -@@ -96,6 +96,7 @@ obj-$(CONFIG_CRASH_DUMP) += crash_dump.o - obj-$(CONFIG_JUMP_LABEL) += jump_label.o - obj-$(CONFIG_CONTEXT_TRACKING) += context_tracking.o - obj-$(CONFIG_TORTURE_TEST) += torture.o -+obj-$(CONFIG_CRASHLOG) += crashlog.o - - $(obj)/configs.o: $(obj)/config_data.h - ---- /dev/null -+++ b/kernel/crashlog.c -@@ -0,0 +1,181 @@ -+/* -+ * Crash information logger -+ * Copyright (C) 2010 Felix Fietkau -+ * -+ * Based on ramoops.c -+ * Copyright (C) 2010 Marco Stornelli -+ * -+ * 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 -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+#define CRASHLOG_PAGES 4 -+#define CRASHLOG_SIZE (CRASHLOG_PAGES * PAGE_SIZE) -+#define CRASHLOG_MAGIC 0xa1eedead -+ -+/* -+ * Start the log at 1M before the end of RAM, as some boot loaders like -+ * to use the end of the RAM for stack usage and other things -+ * If this fails, fall back to using the last part. -+ */ -+#define CRASHLOG_OFFSET (1024 * 1024) -+ -+struct crashlog_data { -+ u32 magic; -+ u32 len; -+ u8 data[]; -+}; -+ -+static struct debugfs_blob_wrapper crashlog_blob; -+static unsigned long crashlog_addr = 0; -+static struct crashlog_data *crashlog_buf; -+static struct kmsg_dumper dump; -+static bool first = true; -+ -+extern struct list_head *crashlog_modules; -+ -+#ifndef CONFIG_NO_BOOTMEM -+void __init crashlog_init_bootmem(bootmem_data_t *bdata) -+{ -+ unsigned long addr; -+ -+ if (crashlog_addr) -+ return; -+ -+ addr = PFN_PHYS(bdata->node_low_pfn) - CRASHLOG_OFFSET; -+ if (reserve_bootmem(addr, CRASHLOG_SIZE, BOOTMEM_EXCLUSIVE) < 0) { -+ printk("Crashlog failed to allocate RAM at address 0x%lx\n", addr); -+ bdata->node_low_pfn -= CRASHLOG_PAGES; -+ addr = PFN_PHYS(bdata->node_low_pfn); -+ } -+ crashlog_addr = addr; -+} -+#endif -+ -+#ifdef CONFIG_HAVE_MEMBLOCK -+void __init_memblock crashlog_init_memblock(phys_addr_t addr, phys_addr_t size) -+{ -+ if (crashlog_addr) -+ return; -+ -+ addr += size - CRASHLOG_OFFSET; -+ if (memblock_reserve(addr, CRASHLOG_SIZE)) { -+ printk("Crashlog failed to allocate RAM at address 0x%lx\n", (unsigned long) addr); -+ return; -+ } -+ -+ crashlog_addr = addr; -+} -+#endif -+ -+static void __init crashlog_copy(void) -+{ -+ if (crashlog_buf->magic != CRASHLOG_MAGIC) -+ return; -+ -+ if (!crashlog_buf->len || crashlog_buf->len > -+ CRASHLOG_SIZE - sizeof(*crashlog_buf)) -+ return; -+ -+ crashlog_blob.size = crashlog_buf->len; -+ crashlog_blob.data = kmemdup(crashlog_buf->data, -+ crashlog_buf->len, GFP_KERNEL); -+ -+ debugfs_create_blob("crashlog", 0700, NULL, &crashlog_blob); -+} -+ -+static int get_maxlen(void) -+{ -+ return CRASHLOG_SIZE - sizeof(*crashlog_buf) - crashlog_buf->len; -+} -+ -+static void crashlog_printf(const char *fmt, ...) -+{ -+ va_list args; -+ int len = get_maxlen(); -+ -+ if (!len) -+ return; -+ -+ va_start(args, fmt); -+ crashlog_buf->len += vscnprintf( -+ &crashlog_buf->data[crashlog_buf->len], -+ len, fmt, args); -+ va_end(args); -+} -+ -+static void crashlog_do_dump(struct kmsg_dumper *dumper, -+ enum kmsg_dump_reason reason) -+{ -+ struct timeval tv; -+ struct module *m; -+ char *buf; -+ size_t len; -+ -+ if (!first) -+ crashlog_printf("\n===================================\n"); -+ -+ do_gettimeofday(&tv); -+ crashlog_printf("Time: %lu.%lu\n", -+ (long)tv.tv_sec, (long)tv.tv_usec); -+ -+ if (first) { -+ crashlog_printf("Modules:"); -+ list_for_each_entry(m, crashlog_modules, list) { -+ crashlog_printf("\t%s@%p+%x", m->name, -+ m->module_core, m->core_size, -+ m->module_init, m->init_size); -+ } -+ crashlog_printf("\n"); -+ first = false; -+ } -+ -+ buf = (char *)&crashlog_buf->data[crashlog_buf->len]; -+ -+ kmsg_dump_get_buffer(dumper, true, buf, get_maxlen(), &len); -+ -+ crashlog_buf->len += len; -+} -+ -+ -+int __init crashlog_init_fs(void) -+{ -+ if (!crashlog_addr) -+ return -ENOMEM; -+ -+ crashlog_buf = ioremap(crashlog_addr, CRASHLOG_SIZE); -+ -+ crashlog_copy(); -+ -+ crashlog_buf->magic = CRASHLOG_MAGIC; -+ crashlog_buf->len = 0; -+ -+ dump.max_reason = KMSG_DUMP_OOPS; -+ dump.dump = crashlog_do_dump; -+ kmsg_dump_register(&dump); -+ -+ return 0; -+} -+module_init(crashlog_init_fs); ---- a/mm/bootmem.c -+++ b/mm/bootmem.c -@@ -15,6 +15,7 @@ - #include - #include - #include -+#include - #include - #include - #include -@@ -177,6 +178,7 @@ static unsigned long __init free_all_boo - if (!bdata->node_bootmem_map) - return 0; - -+ crashlog_init_bootmem(bdata); - map = bdata->node_bootmem_map; - start = bdata->node_min_pfn; - end = bdata->node_low_pfn; ---- a/kernel/module.c -+++ b/kernel/module.c -@@ -105,6 +105,9 @@ static LIST_HEAD(modules); - #ifdef CONFIG_KGDB_KDB - struct list_head *kdb_modules = &modules; /* kdb needs the list of modules */ - #endif /* CONFIG_KGDB_KDB */ -+#ifdef CONFIG_CRASHLOG -+struct list_head *crashlog_modules = &modules; -+#endif - - #ifdef CONFIG_MODULE_SIG - #ifdef CONFIG_MODULE_SIG_FORCE ---- a/mm/memblock.c -+++ b/mm/memblock.c -@@ -19,6 +19,7 @@ - #include - #include - #include -+#include - - #include - #include -@@ -477,6 +478,8 @@ static void __init_memblock memblock_ins - memblock_set_region_node(rgn, nid); - type->cnt++; - type->total_size += size; -+ if (type == &memblock.memory && idx == 0) -+ crashlog_init_memblock(base, size); - } - - /** diff --git a/target/linux/generic/pending-3.18/970-remove-unsane-filenames-from-deps_initramfs-list.patch b/target/linux/generic/pending-3.18/970-remove-unsane-filenames-from-deps_initramfs-list.patch deleted file mode 100644 index ac13c9e673..0000000000 --- a/target/linux/generic/pending-3.18/970-remove-unsane-filenames-from-deps_initramfs-list.patch +++ /dev/null @@ -1,29 +0,0 @@ ---- a/usr/Makefile -+++ b/usr/Makefile -@@ -53,6 +53,8 @@ ifneq ($(wildcard $(obj)/.initramfs_data - include $(obj)/.initramfs_data.cpio.d - endif - -+deps_initramfs_sane := $(foreach v,$(deps_initramfs),$(if $(findstring :,$(v)),,$(v))) -+ - quiet_cmd_initfs = GEN $@ - cmd_initfs = $(initramfs) -o $@ $(ramfs-args) $(ramfs-input) - -@@ -61,14 +63,14 @@ targets := initramfs_data.cpio.gz initra - initramfs_data.cpio.lzo initramfs_data.cpio.lz4 \ - initramfs_data.cpio - # do not try to update files included in initramfs --$(deps_initramfs): ; -+$(deps_initramfs_sane): ; - --$(deps_initramfs): klibcdirs -+$(deps_initramfs_sane): klibcdirs - # We rebuild initramfs_data.cpio if: - # 1) Any included file is newer then initramfs_data.cpio - # 2) There are changes in which files are included (added or deleted) - # 3) If gen_init_cpio are newer than initramfs_data.cpio - # 4) arguments to gen_initramfs.sh changes --$(obj)/initramfs_data.cpio$(suffix_y): $(obj)/gen_init_cpio $(deps_initramfs) klibcdirs -+$(obj)/initramfs_data.cpio$(suffix_y): $(obj)/gen_init_cpio $(deps_initramfs_sane) klibcdirs - $(Q)$(initramfs) -l $(ramfs-input) > $(obj)/.initramfs_data.cpio.d - $(call if_changed,initfs) diff --git a/target/linux/generic/pending-3.18/980-arm_openwrt_machtypes.patch b/target/linux/generic/pending-3.18/980-arm_openwrt_machtypes.patch deleted file mode 100644 index 8303344b59..0000000000 --- a/target/linux/generic/pending-3.18/980-arm_openwrt_machtypes.patch +++ /dev/null @@ -1,32 +0,0 @@ ---- a/arch/arm/tools/mach-types -+++ b/arch/arm/tools/mach-types -@@ -1007,3 +1007,29 @@ eco5_bx2 MACH_ECO5_BX2 ECO5_BX2 4572 - eukrea_cpuimx28sd MACH_EUKREA_CPUIMX28SD EUKREA_CPUIMX28SD 4573 - domotab MACH_DOMOTAB DOMOTAB 4574 - pfla03 MACH_PFLA03 PFLA03 4575 -+# -+# Additional mach-types supported by libreCMC -+# -+wg302v1 MACH_WG302V1 WG302V1 889 -+pronghorn MACH_PRONGHORN PRONGHORN 928 -+pronghorn_metro MACH_PRONGHORNMETRO PRONGHORNMETRO 1040 -+sidewinder MACH_SIDEWINDER SIDEWINDER 1041 -+wrt300nv2 MACH_WRT300NV2 WRT300NV2 1077 -+compex42x MACH_COMPEXWP18 COMPEXWP18 1273 -+goldfish MACH_GOLDFISH GOLDFISH 1441 -+cambria MACH_CAMBRIA CAMBRIA 1468 -+dt2 MACH_DT2 DT2 1514 -+ap1000 MACH_AP1000 AP1000 1543 -+tw2662 MACH_TW2662 TW2662 1658 -+tw5334 MACH_TW5334 TW5334 1664 -+usr8200 MACH_USR8200 USR8200 1762 -+mi424wr MACH_MI424WR MI424WR 1778 -+gw2388 MACH_GW2388 GW2388 2635 -+iconnect MACH_ICONNECT ICONNECT 2870 -+nsb3ast MACH_NSB3AST NSB3AST 2917 -+goflexnet MACH_GOFLEXNET GOFLEXNET 3089 -+nas6210 MACH_NAS6210 NAS6210 3104 -+ns_k330 MACH_NS_K330 NS_K330 3108 -+bcm2708 MACH_BCM2708 BCM2708 3138 -+wn802t MACH_WN802T WN802T 3306 -+nsa310 MACH_NSA310 NSA310 4022 diff --git a/target/linux/generic/pending-3.18/990-gpio_wdt.patch b/target/linux/generic/pending-3.18/990-gpio_wdt.patch deleted file mode 100644 index 0d8d862e02..0000000000 --- a/target/linux/generic/pending-3.18/990-gpio_wdt.patch +++ /dev/null @@ -1,360 +0,0 @@ -This generic GPIO watchdog is used on Huawei E970 (brcm47xx) - -Signed-off-by: Mathias Adam - ---- a/drivers/watchdog/Kconfig -+++ b/drivers/watchdog/Kconfig -@@ -1139,6 +1139,15 @@ config WDT_MTX1 - Hardware driver for the MTX-1 boards. This is a watchdog timer that - will reboot the machine after a 100 seconds timer expired. - -+config GPIO_WDT -+ tristate "GPIO Hardware Watchdog" -+ help -+ Hardware driver for GPIO-controlled watchdogs. GPIO pin and -+ toggle interval settings are platform-specific. The driver -+ will stop toggling the GPIO (i.e. machine reboots) after a -+ 100 second timer expired and no process has written to -+ /dev/watchdog during that time. -+ - config PNX833X_WDT - tristate "PNX833x Hardware Watchdog" - depends on SOC_PNX8335 ---- a/drivers/watchdog/Makefile -+++ b/drivers/watchdog/Makefile -@@ -134,6 +134,7 @@ obj-$(CONFIG_RC32434_WDT) += rc32434_wdt - obj-$(CONFIG_INDYDOG) += indydog.o - obj-$(CONFIG_JZ4740_WDT) += jz4740_wdt.o - obj-$(CONFIG_WDT_MTX1) += mtx-1_wdt.o -+obj-$(CONFIG_GPIO_WDT) += old_gpio_wdt.o - obj-$(CONFIG_PNX833X_WDT) += pnx833x_wdt.o - obj-$(CONFIG_SIBYTE_WDOG) += sb_wdog.o - obj-$(CONFIG_AR7_WDT) += ar7_wdt.o ---- /dev/null -+++ b/drivers/watchdog/old_gpio_wdt.c -@@ -0,0 +1,301 @@ -+/* -+ * Driver for GPIO-controlled Hardware Watchdogs. -+ * -+ * Copyright (C) 2013 Mathias Adam -+ * -+ * Replaces mtx1_wdt (driver for the MTX-1 Watchdog): -+ * -+ * (C) Copyright 2005 4G Systems , -+ * All Rights Reserved. -+ * http://www.4g-systems.biz -+ * -+ * (C) Copyright 2007 OpenWrt.org, Florian Fainelli -+ * -+ * 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. -+ * -+ * Neither Michael Stickel nor 4G Systems admit liability nor provide -+ * warranty for any of this software. This material is provided -+ * "AS-IS" and at no charge. -+ * -+ * (c) Copyright 2005 4G Systems -+ * -+ * Release 0.01. -+ * Author: Michael Stickel michael.stickel@4g-systems.biz -+ * -+ * Release 0.02. -+ * Author: Florian Fainelli florian@openwrt.org -+ * use the Linux watchdog/timer APIs -+ * -+ * Release 0.03. -+ * Author: Mathias Adam -+ * make it a generic gpio watchdog driver -+ * -+ * The Watchdog is configured to reset the MTX-1 -+ * if it is not triggered for 100 seconds. -+ * It should not be triggered more often than 1.6 seconds. -+ * -+ * A timer triggers the watchdog every 5 seconds, until -+ * it is opened for the first time. After the first open -+ * it MUST be triggered every 2..95 seconds. -+ */ -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+static int ticks = 100 * HZ; -+ -+static struct { -+ struct completion stop; -+ spinlock_t lock; -+ int running; -+ struct timer_list timer; -+ int queue; -+ int default_ticks; -+ unsigned long inuse; -+ unsigned gpio; -+ unsigned int gstate; -+ int interval; -+ int first_interval; -+} gpio_wdt_device; -+ -+static void gpio_wdt_trigger(unsigned long unused) -+{ -+ spin_lock(&gpio_wdt_device.lock); -+ if (gpio_wdt_device.running && ticks > 0) -+ ticks -= gpio_wdt_device.interval; -+ -+ /* toggle wdt gpio */ -+ gpio_wdt_device.gstate = !gpio_wdt_device.gstate; -+ gpio_set_value(gpio_wdt_device.gpio, gpio_wdt_device.gstate); -+ -+ if (gpio_wdt_device.queue && ticks > 0) -+ mod_timer(&gpio_wdt_device.timer, jiffies + gpio_wdt_device.interval); -+ else -+ complete(&gpio_wdt_device.stop); -+ spin_unlock(&gpio_wdt_device.lock); -+} -+ -+static void gpio_wdt_reset(void) -+{ -+ ticks = gpio_wdt_device.default_ticks; -+} -+ -+ -+static void gpio_wdt_start(void) -+{ -+ unsigned long flags; -+ -+ spin_lock_irqsave(&gpio_wdt_device.lock, flags); -+ if (!gpio_wdt_device.queue) { -+ gpio_wdt_device.queue = 1; -+ gpio_wdt_device.gstate = 1; -+ gpio_set_value(gpio_wdt_device.gpio, 1); -+ mod_timer(&gpio_wdt_device.timer, jiffies + gpio_wdt_device.first_interval); -+ } -+ gpio_wdt_device.running++; -+ spin_unlock_irqrestore(&gpio_wdt_device.lock, flags); -+} -+ -+static int gpio_wdt_stop(void) -+{ -+ unsigned long flags; -+ -+ spin_lock_irqsave(&gpio_wdt_device.lock, flags); -+ if (gpio_wdt_device.queue) { -+ gpio_wdt_device.queue = 0; -+ gpio_wdt_device.gstate = 0; -+ gpio_set_value(gpio_wdt_device.gpio, 0); -+ } -+ ticks = gpio_wdt_device.default_ticks; -+ spin_unlock_irqrestore(&gpio_wdt_device.lock, flags); -+ return 0; -+} -+ -+/* Filesystem functions */ -+ -+static int gpio_wdt_open(struct inode *inode, struct file *file) -+{ -+ if (test_and_set_bit(0, &gpio_wdt_device.inuse)) -+ return -EBUSY; -+ return nonseekable_open(inode, file); -+} -+ -+ -+static int gpio_wdt_release(struct inode *inode, struct file *file) -+{ -+ clear_bit(0, &gpio_wdt_device.inuse); -+ return 0; -+} -+ -+static long gpio_wdt_ioctl(struct file *file, unsigned int cmd, -+ unsigned long arg) -+{ -+ void __user *argp = (void __user *)arg; -+ int __user *p = (int __user *)argp; -+ unsigned int value; -+ static const struct watchdog_info ident = { -+ .options = WDIOF_CARDRESET, -+ .identity = "GPIO WDT", -+ }; -+ -+ switch (cmd) { -+ case WDIOC_GETSUPPORT: -+ if (copy_to_user(argp, &ident, sizeof(ident))) -+ return -EFAULT; -+ break; -+ case WDIOC_GETSTATUS: -+ case WDIOC_GETBOOTSTATUS: -+ put_user(0, p); -+ break; -+ case WDIOC_SETOPTIONS: -+ if (get_user(value, p)) -+ return -EFAULT; -+ if (value & WDIOS_ENABLECARD) -+ gpio_wdt_start(); -+ else if (value & WDIOS_DISABLECARD) -+ gpio_wdt_stop(); -+ else -+ return -EINVAL; -+ return 0; -+ case WDIOC_KEEPALIVE: -+ gpio_wdt_reset(); -+ break; -+ default: -+ return -ENOTTY; -+ } -+ return 0; -+} -+ -+ -+static ssize_t gpio_wdt_write(struct file *file, const char *buf, -+ size_t count, loff_t *ppos) -+{ -+ if (!count) -+ return -EIO; -+ gpio_wdt_reset(); -+ return count; -+} -+ -+static const struct file_operations gpio_wdt_fops = { -+ .owner = THIS_MODULE, -+ .llseek = no_llseek, -+ .unlocked_ioctl = gpio_wdt_ioctl, -+ .open = gpio_wdt_open, -+ .write = gpio_wdt_write, -+ .release = gpio_wdt_release, -+}; -+ -+ -+static struct miscdevice gpio_wdt_misc = { -+ .minor = WATCHDOG_MINOR, -+ .name = "watchdog", -+ .fops = &gpio_wdt_fops, -+}; -+ -+ -+static int gpio_wdt_probe(struct platform_device *pdev) -+{ -+ int ret; -+ struct gpio_wdt_platform_data *gpio_wdt_data = pdev->dev.platform_data; -+ -+ gpio_wdt_device.gpio = gpio_wdt_data->gpio; -+ gpio_wdt_device.interval = gpio_wdt_data->interval; -+ gpio_wdt_device.first_interval = gpio_wdt_data->first_interval; -+ if (gpio_wdt_device.first_interval <= 0) { -+ gpio_wdt_device.first_interval = gpio_wdt_device.interval; -+ } -+ -+ ret = gpio_request(gpio_wdt_device.gpio, "gpio-wdt"); -+ if (ret < 0) { -+ dev_err(&pdev->dev, "failed to request gpio"); -+ return ret; -+ } -+ -+ spin_lock_init(&gpio_wdt_device.lock); -+ init_completion(&gpio_wdt_device.stop); -+ gpio_wdt_device.queue = 0; -+ clear_bit(0, &gpio_wdt_device.inuse); -+ setup_timer(&gpio_wdt_device.timer, gpio_wdt_trigger, 0L); -+ gpio_wdt_device.default_ticks = ticks; -+ -+ gpio_wdt_start(); -+ dev_info(&pdev->dev, "GPIO Hardware Watchdog driver (gpio=%i interval=%i/%i)\n", -+ gpio_wdt_data->gpio, gpio_wdt_data->first_interval, gpio_wdt_data->interval); -+ return 0; -+} -+ -+static int gpio_wdt_remove(struct platform_device *pdev) -+{ -+ /* FIXME: do we need to lock this test ? */ -+ if (gpio_wdt_device.queue) { -+ gpio_wdt_device.queue = 0; -+ wait_for_completion(&gpio_wdt_device.stop); -+ } -+ -+ gpio_free(gpio_wdt_device.gpio); -+ misc_deregister(&gpio_wdt_misc); -+ return 0; -+} -+ -+static struct platform_driver gpio_wdt_driver = { -+ .probe = gpio_wdt_probe, -+ .remove = gpio_wdt_remove, -+ .driver.name = "gpio-wdt", -+ .driver.owner = THIS_MODULE, -+}; -+ -+static int __init gpio_wdt_init(void) -+{ -+ return platform_driver_register(&gpio_wdt_driver); -+} -+arch_initcall(gpio_wdt_init); -+ -+/* -+ * We do wdt initialization in two steps: arch_initcall probes the wdt -+ * very early to start pinging the watchdog (misc devices are not yet -+ * available), and later module_init() just registers the misc device. -+ */ -+static int gpio_wdt_init_late(void) -+{ -+ int ret; -+ -+ ret = misc_register(&gpio_wdt_misc); -+ if (ret < 0) { -+ pr_err("GPIO_WDT: failed to register misc device\n"); -+ return ret; -+ } -+ return 0; -+} -+#ifndef MODULE -+module_init(gpio_wdt_init_late); -+#endif -+ -+static void __exit gpio_wdt_exit(void) -+{ -+ platform_driver_unregister(&gpio_wdt_driver); -+} -+module_exit(gpio_wdt_exit); -+ -+MODULE_AUTHOR("Michael Stickel, Florian Fainelli, Mathias Adam"); -+MODULE_DESCRIPTION("Driver for GPIO hardware watchdogs"); -+MODULE_LICENSE("GPL"); -+MODULE_ALIAS_MISCDEV(WATCHDOG_MINOR); -+MODULE_ALIAS("platform:gpio-wdt"); ---- /dev/null -+++ b/include/linux/old_gpio_wdt.h -@@ -0,0 +1,21 @@ -+/* -+ * Definitions for the GPIO watchdog driver -+ * -+ * Copyright (C) 2013 Mathias Adam -+ * -+ * 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 _GPIO_WDT_H_ -+#define _GPIO_WDT_H_ -+ -+struct gpio_wdt_platform_data { -+ int gpio; /* GPIO line number */ -+ int interval; /* watchdog reset interval in system ticks */ -+ int first_interval; /* first wd reset interval in system ticks */ -+}; -+ -+#endif /* _GPIO_WDT_H_ */ diff --git a/target/linux/generic/pending-3.18/995-mangle_bootargs.patch b/target/linux/generic/pending-3.18/995-mangle_bootargs.patch deleted file mode 100644 index 0029e90822..0000000000 --- a/target/linux/generic/pending-3.18/995-mangle_bootargs.patch +++ /dev/null @@ -1,58 +0,0 @@ ---- a/init/main.c -+++ b/init/main.c -@@ -362,6 +362,29 @@ static inline void setup_nr_cpu_ids(void - static inline void smp_prepare_cpus(unsigned int maxcpus) { } - #endif - -+#ifdef CONFIG_MANGLE_BOOTARGS -+static void __init mangle_bootargs(char *command_line) -+{ -+ char *rootdev; -+ char *rootfs; -+ -+ rootdev = strstr(command_line, "root=/dev/mtdblock"); -+ -+ if (rootdev) -+ strncpy(rootdev, "mangled_rootblock=", 18); -+ -+ rootfs = strstr(command_line, "rootfstype"); -+ -+ if (rootfs) -+ strncpy(rootfs, "mangled_fs", 10); -+ -+} -+#else -+static void __init mangle_bootargs(char *command_line) -+{ -+} -+#endif -+ - /* - * We need to store the untouched command line for future reference. - * We also need to store the touched command line since the parameter -@@ -530,6 +553,7 @@ asmlinkage __visible void __init start_k - pr_notice("%s", linux_banner); - setup_arch(&command_line); - mm_init_cpumask(&init_mm); -+ mangle_bootargs(command_line); - setup_command_line(command_line); - setup_nr_cpu_ids(); - setup_per_cpu_areas(); ---- a/init/Kconfig -+++ b/init/Kconfig -@@ -1597,6 +1597,15 @@ config EMBEDDED - an embedded system so certain expert options are available - for configuration. - -+config MANGLE_BOOTARGS -+ bool "Rename offending bootargs" -+ depends on EXPERT -+ help -+ Sometimes the bootloader passed bogus root= and rootfstype= -+ parameters to the kernel, and while you want to ignore them, -+ you need to know the values f.e. to support dual firmware -+ layouts on the flash. -+ - config HAVE_PERF_EVENTS - bool - help diff --git a/target/linux/generic/pending-3.18/997-device_tree_cmdline.patch b/target/linux/generic/pending-3.18/997-device_tree_cmdline.patch deleted file mode 100644 index 61fe71b784..0000000000 --- a/target/linux/generic/pending-3.18/997-device_tree_cmdline.patch +++ /dev/null @@ -1,24 +0,0 @@ ---- a/drivers/of/fdt.c -+++ b/drivers/of/fdt.c -@@ -909,6 +909,9 @@ int __init early_init_dt_scan_chosen(uns - p = of_get_flat_dt_prop(node, "bootargs", &l); - if (p != NULL && l > 0) - strlcpy(data, p, min((int)l, COMMAND_LINE_SIZE)); -+ p = of_get_flat_dt_prop(node, "bootargs-append", &l); -+ if (p != NULL && l > 0) -+ strlcat(data, p, min_t(int, strlen(data) + (int)l, COMMAND_LINE_SIZE)); - - /* - * CONFIG_CMDLINE is meant to be a default in case nothing else ---- a/arch/mips/kernel/prom.c -+++ b/arch/mips/kernel/prom.c -@@ -49,6 +49,9 @@ void * __init early_init_dt_alloc_memory - - void __init __dt_setup_arch(void *bph) - { -+ if (boot_command_line[0] == '\0') -+ strcpy(boot_command_line, arcs_cmdline); -+ - if (!early_init_dt_scan(bph)) - return; - diff --git a/target/linux/generic/pending-3.18/998-enable_wilink_platform_without_drivers.patch b/target/linux/generic/pending-3.18/998-enable_wilink_platform_without_drivers.patch deleted file mode 100644 index d317de1102..0000000000 --- a/target/linux/generic/pending-3.18/998-enable_wilink_platform_without_drivers.patch +++ /dev/null @@ -1,15 +0,0 @@ -We use backports for driver updates - make sure we can compile in the glue code regardless - -Signed-off-by: Imre Kaloz - ---- a/drivers/net/wireless/ti/Kconfig -+++ b/drivers/net/wireless/ti/Kconfig -@@ -15,7 +15,7 @@ source "drivers/net/wireless/ti/wlcore/K - - config WILINK_PLATFORM_DATA - bool "TI WiLink platform data" -- depends on WLCORE_SDIO || WL1251_SDIO -+ depends on WLCORE_SDIO || WL1251_SDIO || ARCH_OMAP2PLUS - default y - ---help--- - Small platform data bit needed to pass data to the sdio modules. diff --git a/target/linux/generic/pending-3.18/999-seccomp_log.patch b/target/linux/generic/pending-3.18/999-seccomp_log.patch deleted file mode 100644 index 1db6b18d4e..0000000000 --- a/target/linux/generic/pending-3.18/999-seccomp_log.patch +++ /dev/null @@ -1,34 +0,0 @@ ---- a/kernel/seccomp.c -+++ b/kernel/seccomp.c -@@ -614,6 +614,7 @@ int __secure_computing(void) - #ifdef CONFIG_SECCOMP_FILTER - static u32 __seccomp_phase1_filter(int this_syscall, struct seccomp_data *sd) - { -+ char name[sizeof(current->comm)]; - u32 filter_ret, action; - int data; - -@@ -644,6 +645,13 @@ static u32 __seccomp_phase1_filter(int t - case SECCOMP_RET_TRACE: - return filter_ret; /* Save the rest for phase 2. */ - -+ case SECCOMP_RET_LOG: -+ get_task_comm(name, current); -+ pr_err_ratelimited("seccomp: %s [%u] tried to call non-whitelisted syscall: %d\n", name, current->pid, this_syscall); -+ syscall_set_return_value(current, task_pt_regs(current), -+ -data, 0); -+ goto skip; -+ - case SECCOMP_RET_ALLOW: - return SECCOMP_PHASE1_OK; - ---- a/include/uapi/linux/seccomp.h -+++ b/include/uapi/linux/seccomp.h -@@ -28,6 +28,7 @@ - #define SECCOMP_RET_KILL 0x00000000U /* kill the task immediately */ - #define SECCOMP_RET_TRAP 0x00030000U /* disallow and force a SIGSYS */ - #define SECCOMP_RET_ERRNO 0x00050000U /* returns an errno */ -+#define SECCOMP_RET_LOG 0x00070000U /* allow + logline */ - #define SECCOMP_RET_TRACE 0x7ff00000U /* pass to a tracer or disallow */ - #define SECCOMP_RET_ALLOW 0x7fff0000U /* allow */ - diff --git a/target/linux/generic/pending-4.14/103-MIPS-perf-ath79-Fix-perfcount-IRQ-assignment.patch b/target/linux/generic/pending-4.14/103-MIPS-perf-ath79-Fix-perfcount-IRQ-assignment.patch new file mode 100644 index 0000000000..1990e87055 --- /dev/null +++ b/target/linux/generic/pending-4.14/103-MIPS-perf-ath79-Fix-perfcount-IRQ-assignment.patch @@ -0,0 +1,110 @@ +From 852a88f35f4b7e5ebb717fed3c3a3330d5ad4336 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Petr=20=C5=A0tetiar?= +Date: Wed, 10 Apr 2019 16:43:27 +0200 +Subject: [PATCH v2] MIPS: perf: ath79: Fix perfcount IRQ assignment +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Currently it's not possible to use perf on ath79 due to genirq flags +mismatch happening on static virtual IRQ 13 which is used for +performance counters hardware IRQ 5. + +On TP-Link Archer C7v5: + + CPU0 + 2: 0 MIPS 2 ath9k + 4: 318 MIPS 4 19000000.eth + 7: 55034 MIPS 7 timer + 8: 1236 MISC 3 ttyS0 + 12: 0 INTC 1 ehci_hcd:usb1 + 13: 0 gpio-ath79 2 keys + 14: 0 gpio-ath79 5 keys + 15: 31 AR724X PCI 1 ath10k_pci + + $ perf top + genirq: Flags mismatch irq 13. 00014c83 (mips_perf_pmu) vs. 00002003 (keys) + +On TP-Link Archer C7v4: + + CPU0 + 4: 0 MIPS 4 19000000.eth + 5: 7135 MIPS 5 1a000000.eth + 7: 98379 MIPS 7 timer + 8: 30 MISC 3 ttyS0 + 12: 90028 INTC 0 ath9k + 13: 5520 INTC 1 ehci_hcd:usb1 + 14: 4623 INTC 2 ehci_hcd:usb2 + 15: 32844 AR724X PCI 1 ath10k_pci + 16: 0 gpio-ath79 16 keys + 23: 0 gpio-ath79 23 keys + + $ perf top + genirq: Flags mismatch irq 13. 00014c80 (mips_perf_pmu) vs. 00000080 (ehci_hcd:usb1) + +This problem is happening, because currently statically assigned virtual +IRQ 13 for performance counters is not claimed during the initialization +of MIPS PMU during the bootup, so the IRQ subsystem doesn't know, that +this interrupt isn't available for further use. + +So this patch fixes the issue by simply booking hardware IRQ 5 for MIPS PMU. + +Tested-by: Kevin 'ldir' Darbyshire-Bryant +Signed-off-by: Petr Å tetiar +--- + +Changes since v1: + + I've incorporated two comments which I've received on IRC from blogic and + I've also reworded the commit message to match the changes in v2 of this + patch. + + * use actual hardware perfcount IRQ 5 instead of the virtual IRQ 13 + * dropped the CONFIG_PERF_EVENTS ifdef around irq_create_mapping + + arch/mips/ath79/setup.c | 6 ------ + drivers/irqchip/irq-ath79-misc.c | 11 +++++++++++ + 2 files changed, 11 insertions(+), 6 deletions(-) + +--- a/arch/mips/ath79/setup.c ++++ b/arch/mips/ath79/setup.c +@@ -183,12 +183,6 @@ const char *get_system_type(void) + return ath79_sys_type; + } + +-int get_c0_perfcount_int(void) +-{ +- return ATH79_MISC_IRQ(5); +-} +-EXPORT_SYMBOL_GPL(get_c0_perfcount_int); +- + unsigned int get_c0_compare_int(void) + { + return CP0_LEGACY_COMPARE_IRQ; +--- a/drivers/irqchip/irq-ath79-misc.c ++++ b/drivers/irqchip/irq-ath79-misc.c +@@ -22,6 +22,15 @@ + #define AR71XX_RESET_REG_MISC_INT_ENABLE 4 + + #define ATH79_MISC_IRQ_COUNT 32 ++#define ATH79_MISC_PERF_IRQ 5 ++ ++static int ath79_perfcount_irq; ++ ++int get_c0_perfcount_int(void) ++{ ++ return ath79_perfcount_irq; ++} ++EXPORT_SYMBOL_GPL(get_c0_perfcount_int); + + static void ath79_misc_irq_handler(struct irq_desc *desc) + { +@@ -113,6 +122,8 @@ static void __init ath79_misc_intc_domai + { + void __iomem *base = domain->host_data; + ++ ath79_perfcount_irq = irq_create_mapping(domain, ATH79_MISC_PERF_IRQ); ++ + /* Disable and clear all interrupts */ + __raw_writel(0, base + AR71XX_RESET_REG_MISC_INT_ENABLE); + __raw_writel(0, base + AR71XX_RESET_REG_MISC_INT_STATUS); diff --git a/target/linux/generic/pending-4.14/120-Fix-alloc_node_mem_map-with-ARCH_PFN_OFFSET-calcu.patch b/target/linux/generic/pending-4.14/120-Fix-alloc_node_mem_map-with-ARCH_PFN_OFFSET-calcu.patch index 61ececbc89..3308b1d71f 100644 --- a/target/linux/generic/pending-4.14/120-Fix-alloc_node_mem_map-with-ARCH_PFN_OFFSET-calcu.patch +++ b/target/linux/generic/pending-4.14/120-Fix-alloc_node_mem_map-with-ARCH_PFN_OFFSET-calcu.patch @@ -71,7 +71,7 @@ Signed-off-by: Tobias Wolf --- a/mm/page_alloc.c +++ b/mm/page_alloc.c -@@ -6143,7 +6143,7 @@ static void __ref alloc_node_mem_map(str +@@ -6145,7 +6145,7 @@ static void __ref alloc_node_mem_map(str mem_map = NODE_DATA(0)->node_mem_map; #if defined(CONFIG_HAVE_MEMBLOCK_NODE_MAP) || defined(CONFIG_FLATMEM) if (page_to_pfn(mem_map) != pgdat->node_start_pfn) diff --git a/target/linux/generic/pending-4.14/150-bridge_allow_receiption_on_disabled_port.patch b/target/linux/generic/pending-4.14/150-bridge_allow_receiption_on_disabled_port.patch index 9fcffdee06..d50280a881 100644 --- a/target/linux/generic/pending-4.14/150-bridge_allow_receiption_on_disabled_port.patch +++ b/target/linux/generic/pending-4.14/150-bridge_allow_receiption_on_disabled_port.patch @@ -15,17 +15,19 @@ Signed-off-by: Felix Fietkau --- a/net/bridge/br_input.c +++ b/net/bridge/br_input.c -@@ -239,7 +239,8 @@ static int br_handle_local_finish(struct +@@ -237,7 +237,10 @@ static void __br_handle_local_finish(str + /* note: already called with rcu_read_lock */ + static int br_handle_local_finish(struct net *net, struct sock *sk, struct sk_buff *skb) { - struct net_bridge_port *p = br_port_get_rcu(skb->dev); - - __br_handle_local_finish(skb); ++ struct net_bridge_port *p = br_port_get_rcu(skb->dev); ++ + if (p->state != BR_STATE_DISABLED) + __br_handle_local_finish(skb); - BR_INPUT_SKB_CB(skb)->brdev = p->br->dev; - br_pass_frame_up(skb); -@@ -327,6 +328,15 @@ rx_handler_result_t br_handle_frame(stru + /* return 1 to signal the okfn() was called so it's ok to use the skb */ + return 1; +@@ -332,6 +335,17 @@ rx_handler_result_t br_handle_frame(stru forward: switch (p->state) { @@ -33,9 +35,11 @@ Signed-off-by: Felix Fietkau + if (ether_addr_equal(p->br->dev->dev_addr, dest)) + skb->pkt_type = PACKET_HOST; + -+ NF_HOOK(NFPROTO_BRIDGE, NF_BR_PRE_ROUTING, ++ if (NF_HOOK(NFPROTO_BRIDGE, NF_BR_PRE_ROUTING, + dev_net(skb->dev), NULL, skb, skb->dev, NULL, -+ br_handle_local_finish); ++ br_handle_local_finish) == 1) { ++ return RX_HANDLER_PASS; ++ } + break; + case BR_STATE_FORWARDING: diff --git a/target/linux/generic/pending-4.14/171-usb-dwc2-Fix-inefficient-copy-of-unaligned-buffers.patch b/target/linux/generic/pending-4.14/171-usb-dwc2-Fix-inefficient-copy-of-unaligned-buffers.patch index 588b571e01..7f21fefc25 100644 --- a/target/linux/generic/pending-4.14/171-usb-dwc2-Fix-inefficient-copy-of-unaligned-buffers.patch +++ b/target/linux/generic/pending-4.14/171-usb-dwc2-Fix-inefficient-copy-of-unaligned-buffers.patch @@ -30,9 +30,9 @@ Signed-off-by: Antti Seppälä if (!(urb->transfer_flags & URB_ALIGNED_TEMP_BUFFER)) return; -@@ -2677,9 +2678,14 @@ static void dwc2_free_dma_aligned_buffer - memcpy(&stored_xfer_buffer, urb->transfer_buffer + - urb->transfer_buffer_length, sizeof(urb->transfer_buffer)); +@@ -2679,9 +2680,14 @@ static void dwc2_free_dma_aligned_buffer + dma_get_cache_alignment()), + sizeof(urb->transfer_buffer)); - if (usb_urb_dir_in(urb)) - memcpy(stored_xfer_buffer, urb->transfer_buffer, diff --git a/target/linux/generic/pending-4.14/201-extra_optimization.patch b/target/linux/generic/pending-4.14/201-extra_optimization.patch index c7790657fd..305ba3aad2 100644 --- a/target/linux/generic/pending-4.14/201-extra_optimization.patch +++ b/target/linux/generic/pending-4.14/201-extra_optimization.patch @@ -14,12 +14,12 @@ Signed-off-by: Felix Fietkau --- a/Makefile +++ b/Makefile -@@ -654,12 +654,12 @@ KBUILD_CFLAGS += $(call cc-disable-warni +@@ -656,12 +656,12 @@ KBUILD_CFLAGS += $(call cc-disable-warni + KBUILD_CFLAGS += $(call cc-disable-warning, attribute-alias) ifdef CONFIG_CC_OPTIMIZE_FOR_SIZE - KBUILD_CFLAGS += $(call cc-option,-Oz,-Os) --KBUILD_CFLAGS += $(call cc-disable-warning,maybe-uninitialized,) -+KBUILD_CFLAGS += $(call cc-disable-warning,maybe-uninitialized,) $(EXTRA_OPTIMIZATION) +-KBUILD_CFLAGS += -Os $(call cc-disable-warning,maybe-uninitialized,) ++KBUILD_CFLAGS += -Os $(call cc-disable-warning,maybe-uninitialized,) $(EXTRA_OPTIMIZATION) else ifdef CONFIG_PROFILE_ALL_BRANCHES -KBUILD_CFLAGS += -O2 $(call cc-disable-warning,maybe-uninitialized,) diff --git a/target/linux/generic/pending-4.14/203-kallsyms_uncompressed.patch b/target/linux/generic/pending-4.14/203-kallsyms_uncompressed.patch index 5f66c3d501..b0cd863be4 100644 --- a/target/linux/generic/pending-4.14/203-kallsyms_uncompressed.patch +++ b/target/linux/generic/pending-4.14/203-kallsyms_uncompressed.patch @@ -65,7 +65,7 @@ Signed-off-by: Felix Fietkau static int absolute_percpu = 0; static char symbol_prefix_char = '\0'; static int base_relative = 0; -@@ -458,6 +459,9 @@ static void write_src(void) +@@ -461,6 +462,9 @@ static void write_src(void) free(markers); @@ -75,7 +75,7 @@ Signed-off-by: Felix Fietkau output_label("kallsyms_token_table"); off = 0; for (i = 0; i < 256; i++) { -@@ -516,6 +520,9 @@ static void *find_token(unsigned char *s +@@ -519,6 +523,9 @@ static void *find_token(unsigned char *s { int i; @@ -85,7 +85,7 @@ Signed-off-by: Felix Fietkau for (i = 0; i < len - 1; i++) { if (str[i] == token[0] && str[i+1] == token[1]) return &str[i]; -@@ -588,6 +595,9 @@ static void optimize_result(void) +@@ -591,6 +598,9 @@ static void optimize_result(void) { int i, best; @@ -95,7 +95,7 @@ Signed-off-by: Felix Fietkau /* using the '\0' symbol last allows compress_symbols to use standard * fast string functions */ for (i = 255; i >= 0; i--) { -@@ -776,6 +786,8 @@ int main(int argc, char **argv) +@@ -779,6 +789,8 @@ int main(int argc, char **argv) symbol_prefix_char = *p; } else if (strcmp(argv[i], "--base-relative") == 0) base_relative = 1; diff --git a/target/linux/generic/pending-4.14/220-optimize_inlining.patch b/target/linux/generic/pending-4.14/220-optimize_inlining.patch index dca1dcb204..ff2bed17f3 100644 --- a/target/linux/generic/pending-4.14/220-optimize_inlining.patch +++ b/target/linux/generic/pending-4.14/220-optimize_inlining.patch @@ -1,3 +1,98 @@ +--- a/arch/arm/kernel/atags.h ++++ b/arch/arm/kernel/atags.h +@@ -5,7 +5,7 @@ void convert_to_tag_list(struct tag *tag + const struct machine_desc *setup_machine_tags(phys_addr_t __atags_pointer, + unsigned int machine_nr); + #else +-static inline const struct machine_desc * ++static inline const struct machine_desc * __init __noreturn + setup_machine_tags(phys_addr_t __atags_pointer, unsigned int machine_nr) + { + early_print("no ATAGS support: can't continue\n"); +--- a/arch/arm64/include/asm/cpufeature.h ++++ b/arch/arm64/include/asm/cpufeature.h +@@ -126,7 +126,7 @@ static inline bool cpu_have_feature(unsi + } + + /* System capability check for constant caps */ +-static inline bool __cpus_have_const_cap(int num) ++static __always_inline bool __cpus_have_const_cap(int num) + { + if (num >= ARM64_NCAPS) + return false; +@@ -140,7 +140,7 @@ static inline bool cpus_have_cap(unsigne + return test_bit(num, cpu_hwcaps); + } + +-static inline bool cpus_have_const_cap(int num) ++static __always_inline bool cpus_have_const_cap(int num) + { + if (static_branch_likely(&arm64_const_caps_ready)) + return __cpus_have_const_cap(num); +--- a/arch/mips/include/asm/bitops.h ++++ b/arch/mips/include/asm/bitops.h +@@ -462,7 +462,7 @@ static inline void __clear_bit_unlock(un + * Return the bit position (0..63) of the most significant 1 bit in a word + * Returns -1 if no 1 bit exists + */ +-static inline unsigned long __fls(unsigned long word) ++static __always_inline unsigned long __fls(unsigned long word) + { + int num; + +@@ -528,7 +528,7 @@ static inline unsigned long __fls(unsign + * Returns 0..SZLONG-1 + * Undefined if no bit exists, so code should check against 0 first. + */ +-static inline unsigned long __ffs(unsigned long word) ++static __always_inline unsigned long __ffs(unsigned long word) + { + return __fls(word & -word); + } +--- a/arch/mips/kernel/cpu-bugs64.c ++++ b/arch/mips/kernel/cpu-bugs64.c +@@ -42,8 +42,8 @@ static inline void align_mod(const int a + : GCC_IMM_ASM() (align), GCC_IMM_ASM() (mod)); + } + +-static inline void mult_sh_align_mod(long *v1, long *v2, long *w, +- const int align, const int mod) ++static __always_inline void mult_sh_align_mod(long *v1, long *v2, long *w, ++ const int align, const int mod) + { + unsigned long flags; + int m1, m2; +--- a/arch/powerpc/kernel/prom_init.c ++++ b/arch/powerpc/kernel/prom_init.c +@@ -474,14 +474,14 @@ static int __init prom_next_node(phandle + } + } + +-static inline int prom_getprop(phandle node, const char *pname, +- void *value, size_t valuelen) ++static inline int __init prom_getprop(phandle node, const char *pname, ++ void *value, size_t valuelen) + { + return call_prom("getprop", 4, 1, node, ADDR(pname), + (u32)(unsigned long) value, (u32) valuelen); + } + +-static inline int prom_getproplen(phandle node, const char *pname) ++static inline int __init prom_getproplen(phandle node, const char *pname) + { + return call_prom("getproplen", 2, 1, node, ADDR(pname)); + } +--- a/arch/s390/include/asm/cpacf.h ++++ b/arch/s390/include/asm/cpacf.h +@@ -184,7 +184,7 @@ static inline int __cpacf_check_opcode(u + } + } + +-static inline int cpacf_query(unsigned int opcode, cpacf_mask_t *mask) ++static __always_inline int cpacf_query(unsigned int opcode, cpacf_mask_t *mask) + { + if (__cpacf_check_opcode(opcode)) { + __cpacf_query(opcode, mask); --- a/arch/x86/Kconfig.debug +++ b/arch/x86/Kconfig.debug @@ -284,20 +284,6 @@ config CPA_DEBUG @@ -23,13 +118,13 @@ depends on DEBUG_KERNEL --- a/lib/Kconfig.debug +++ b/lib/Kconfig.debug -@@ -137,6 +137,20 @@ endmenu # "printk and dmesg options" - - menu "Compile-time checks and compiler options" +@@ -305,6 +305,20 @@ config HEADERS_CHECK + exported to $(INSTALL_HDR_PATH) (usually 'usr/include' in + your build tree), to make sure they're suitable. +config OPTIMIZE_INLINING -+ bool "Allow gcc to uninline functions marked 'inline'" -+ ---help--- ++ bool "Allow compiler to uninline functions marked 'inline'" ++ help + This option determines if the kernel forces gcc to inline the functions + developers have marked 'inline'. Doing so takes away freedom from gcc to + do what it thinks is best, which is desirable for the gcc 3.x series of @@ -41,9 +136,9 @@ + + If unsure, say N. + - config DEBUG_INFO - bool "Compile the kernel with debug info" - depends on DEBUG_KERNEL && !COMPILE_TEST + config DEBUG_SECTION_MISMATCH + bool "Enable full Section mismatch analysis" + help --- a/arch/x86/Kconfig +++ b/arch/x86/Kconfig @@ -296,9 +296,6 @@ config ZONE_DMA32 diff --git a/target/linux/generic/pending-4.14/305-mips_module_reloc.patch b/target/linux/generic/pending-4.14/305-mips_module_reloc.patch index 253b50f62c..609a96db49 100644 --- a/target/linux/generic/pending-4.14/305-mips_module_reloc.patch +++ b/target/linux/generic/pending-4.14/305-mips_module_reloc.patch @@ -11,7 +11,7 @@ Signed-off-by: Felix Fietkau --- a/arch/mips/Makefile +++ b/arch/mips/Makefile -@@ -93,8 +93,13 @@ all-$(CONFIG_SYS_SUPPORTS_ZBOOT)+= vmlin +@@ -93,8 +93,18 @@ all-$(CONFIG_SYS_SUPPORTS_ZBOOT)+= vmlin cflags-y += -G 0 -mno-abicalls -fno-pic -pipe -mno-branch-likely cflags-y += -msoft-float LDFLAGS_vmlinux += -G 0 -static -n -nostdlib @@ -19,8 +19,13 @@ Signed-off-by: Felix Fietkau KBUILD_AFLAGS_MODULE += -mlong-calls KBUILD_CFLAGS_MODULE += -mlong-calls +else -+KBUILD_AFLAGS_MODULE += -mno-long-calls -+KBUILD_CFLAGS_MODULE += -mno-long-calls ++ ifdef CONFIG_DYNAMIC_FTRACE ++ KBUILD_AFLAGS_MODULE += -mlong-calls ++ KBUILD_CFLAGS_MODULE += -mlong-calls ++ else ++ KBUILD_AFLAGS_MODULE += -mno-long-calls ++ KBUILD_CFLAGS_MODULE += -mno-long-calls ++ endif +endif ifeq ($(CONFIG_RELOCATABLE),y) diff --git a/target/linux/generic/pending-4.14/308-mips32r2_tune.patch b/target/linux/generic/pending-4.14/308-mips32r2_tune.patch index 39167bf4ae..a67306031c 100644 --- a/target/linux/generic/pending-4.14/308-mips32r2_tune.patch +++ b/target/linux/generic/pending-4.14/308-mips32r2_tune.patch @@ -11,7 +11,7 @@ Signed-off-by: Felix Fietkau --- a/arch/mips/Makefile +++ b/arch/mips/Makefile -@@ -161,7 +161,7 @@ cflags-$(CONFIG_CPU_VR41XX) += -march=r4 +@@ -166,7 +166,7 @@ cflags-$(CONFIG_CPU_VR41XX) += -march=r4 cflags-$(CONFIG_CPU_R4X00) += -march=r4600 -Wa,--trap cflags-$(CONFIG_CPU_TX49XX) += -march=r4600 -Wa,--trap cflags-$(CONFIG_CPU_MIPS32_R1) += -march=mips32 -Wa,--trap diff --git a/target/linux/generic/pending-4.14/332-arc-add-OWRTDTB-section.patch b/target/linux/generic/pending-4.14/332-arc-add-OWRTDTB-section.patch index 2c2d5e240e..4c8d6e9d37 100644 --- a/target/linux/generic/pending-4.14/332-arc-add-OWRTDTB-section.patch +++ b/target/linux/generic/pending-4.14/332-arc-add-OWRTDTB-section.patch @@ -1,5 +1,7 @@ -From: Alexey Brodkin -Subject: librecmc: arc - add OWRTDTB section +From 34ef04f3845ed2b47d57dd9d3b795b16e1f8185a Mon Sep 17 00:00:00 2001 +From: Evgeniy Didin +Date: Fri, 15 Mar 2019 18:53:38 +0300 +Subject: [PATCH] arc add OWRTDTB section This change allows OpenWRT to patch resulting kernel binary with external .dtb. @@ -10,7 +12,9 @@ given its ARC core configurations match (at least cache line sizes etc). ""patch-dtb" searches for ASCII "OWRTDTB:" strign and copies external .dtb right after it, keeping the string in place. +Signed-off-by: Eugeniy Paltsev Signed-off-by: Alexey Brodkin +Signed-off-by: Evgeniy Didin --- arch/arc/kernel/head.S | 10 ++++++++++ arch/arc/kernel/setup.c | 4 +++- @@ -19,18 +23,18 @@ Signed-off-by: Alexey Brodkin --- a/arch/arc/kernel/head.S +++ b/arch/arc/kernel/head.S -@@ -49,6 +49,16 @@ - 1: +@@ -59,6 +59,16 @@ + #endif .endm -+; Here "patch-dtb" will embed external .dtb -+; Note "patch-dtb" searches for ASCII "OWRTDTB:" string -+; and pastes .dtb right after it, hense the string precedes -+; __image_dtb symbol. ++ ; Here "patch-dtb" will embed external .dtb ++ ; Note "patch-dtb" searches for ASCII "OWRTDTB:" string ++ ; and pastes .dtb right after it, hense the string precedes ++ ; __image_dtb symbol. + .section .owrt, "aw",@progbits -+ .ascii "OWRTDTB:" ++ .ascii "OWRTDTB:" +ENTRY(__image_dtb) -+ .fill 0x4000 ++ .fill 0x4000 +END(__image_dtb) + .section .init.text, "ax",@progbits @@ -38,43 +42,43 @@ Signed-off-by: Alexey Brodkin ;---------------------------------------------------------------- --- a/arch/arc/kernel/setup.c +++ b/arch/arc/kernel/setup.c -@@ -421,6 +421,8 @@ static inline int is_kernel(unsigned lon - return 0; - } +@@ -437,6 +437,8 @@ static inline bool uboot_arg_invalid(uns + /* We always pass 0 as magic from U-boot */ + #define UBOOT_MAGIC_VALUE 0 +extern struct boot_param_header __image_dtb; + - void __init setup_arch(char **cmdline_p) + void __init handle_uboot_args(void) { - #ifdef CONFIG_ARC_UBOOT_SUPPORT -@@ -434,7 +436,7 @@ void __init setup_arch(char **cmdline_p) + bool use_embedded_dtb = true; +@@ -477,7 +479,7 @@ ignore_uboot_args: #endif - { - /* No, so try the embedded one */ + + if (use_embedded_dtb) { - machine_desc = setup_machine_fdt(__dtb_start); + machine_desc = setup_machine_fdt(&__image_dtb); if (!machine_desc) panic("Embedded DT invalid\n"); - + } --- a/arch/arc/kernel/vmlinux.lds.S +++ b/arch/arc/kernel/vmlinux.lds.S -@@ -30,6 +30,19 @@ SECTIONS +@@ -29,6 +29,19 @@ SECTIONS + */ . = CONFIG_LINUX_LINK_BASE; - + /* -+ * In OpenWRT we want to patch built binary embedding .dtb of choice. -+ * This is implemented with "patch-dtb" utility which searches for -+ * "OWRTDTB:" string in first 16k of image and if it is found -+ * copies .dtb right after mentioned string. -+ * -+ * Note: "OWRTDTB:" won't be overwritten with .dtb, .dtb will follow it. -+ */ -+ .owrt : { ++ * In OpenWRT we want to patch built binary embedding .dtb of choice. ++ * This is implemented with "patch-dtb" utility which searches for ++ * "OWRTDTB:" string in first 16k of image and if it is found ++ * copies .dtb right after mentioned string. ++ * ++ * Note: "OWRTDTB:" won't be overwritten with .dtb, .dtb will follow it. ++ */ ++ .owrt : { + *(.owrt) -+ . = ALIGN(PAGE_SIZE); ++ . = ALIGN(PAGE_SIZE); + } + + _int_vec_base_lds = .; .vector : { - *(.vector) diff --git a/target/linux/generic/pending-4.14/342-powerpc-Enable-kernel-XZ-compression-option-on-PPC_8.patch b/target/linux/generic/pending-4.14/342-powerpc-Enable-kernel-XZ-compression-option-on-PPC_8.patch new file mode 100644 index 0000000000..e3ae02a067 --- /dev/null +++ b/target/linux/generic/pending-4.14/342-powerpc-Enable-kernel-XZ-compression-option-on-PPC_8.patch @@ -0,0 +1,24 @@ +From 8cabf9d8bd67d3f8603a4c1ceedaa629a7212be8 Mon Sep 17 00:00:00 2001 +From: Pawel Dembicki +Date: Fri, 24 May 2019 17:56:19 +0200 +Subject: [PATCH] powerpc: Enable kernel XZ compression option on PPC_85xx + +Enable kernel XZ compression option on PPC_85xx. Tested with +simpleImage on TP-Link TL-WDR4900 (Freescale P1014 processor). + +Suggested-by: Christian Lamparter +Signed-off-by: Pawel Dembicki +--- + arch/powerpc/Kconfig | 1 + + 1 file changed, 1 insertion(+) + +--- a/arch/powerpc/Kconfig ++++ b/arch/powerpc/Kconfig +@@ -199,6 +199,7 @@ config PPC + select HAVE_IOREMAP_PROT + select HAVE_IRQ_EXIT_ON_IRQ_STACK + select HAVE_KERNEL_GZIP ++ select HAVE_KERNEL_XZ if PPC_85xx + select HAVE_KPROBES + select HAVE_KPROBES_ON_FTRACE + select HAVE_KRETPROBES diff --git a/target/linux/generic/pending-4.14/530-jffs2_make_lzma_available.patch b/target/linux/generic/pending-4.14/530-jffs2_make_lzma_available.patch index 834876fa84..e74a6a11ed 100644 --- a/target/linux/generic/pending-4.14/530-jffs2_make_lzma_available.patch +++ b/target/linux/generic/pending-4.14/530-jffs2_make_lzma_available.patch @@ -244,7 +244,7 @@ Signed-off-by: Alexandros C. Couloumbis +} --- a/fs/jffs2/super.c +++ b/fs/jffs2/super.c -@@ -371,14 +371,41 @@ static int __init init_jffs2_fs(void) +@@ -374,14 +374,41 @@ static int __init init_jffs2_fs(void) BUILD_BUG_ON(sizeof(struct jffs2_raw_inode) != 68); BUILD_BUG_ON(sizeof(struct jffs2_raw_summary) != 32); @@ -1119,7 +1119,7 @@ Signed-off-by: Alexandros C. Couloumbis ifdef CONFIG_FUNCTION_TRACER ORIG_CFLAGS := $(KBUILD_CFLAGS) KBUILD_CFLAGS = $(subst $(CC_FLAGS_FTRACE),,$(ORIG_CFLAGS)) -@@ -122,6 +132,8 @@ obj-$(CONFIG_ZSTD_COMPRESS) += zstd/ +@@ -134,6 +144,8 @@ obj-$(CONFIG_ZSTD_COMPRESS) += zstd/ obj-$(CONFIG_ZSTD_DECOMPRESS) += zstd/ obj-$(CONFIG_XZ_DEC) += xz/ obj-$(CONFIG_RAID6_PQ) += raid6/ diff --git a/target/linux/generic/pending-4.14/630-packet_socket_type.patch b/target/linux/generic/pending-4.14/630-packet_socket_type.patch index e8eae3b7ff..8dbe06023e 100644 --- a/target/linux/generic/pending-4.14/630-packet_socket_type.patch +++ b/target/linux/generic/pending-4.14/630-packet_socket_type.patch @@ -87,7 +87,7 @@ Signed-off-by: Felix Fietkau if (!net_eq(dev_net(dev), sock_net(sk))) goto drop; -@@ -3269,6 +3271,7 @@ static int packet_create(struct net *net +@@ -3294,6 +3296,7 @@ static int packet_create(struct net *net mutex_init(&po->pg_vec_lock); po->rollover = NULL; po->prot_hook.func = packet_rcv; @@ -95,7 +95,7 @@ Signed-off-by: Felix Fietkau if (sock->type == SOCK_PACKET) po->prot_hook.func = packet_rcv_spkt; -@@ -3882,6 +3885,16 @@ packet_setsockopt(struct socket *sock, i +@@ -3907,6 +3910,16 @@ packet_setsockopt(struct socket *sock, i po->xmit = val ? packet_direct_xmit : dev_queue_xmit; return 0; } @@ -112,7 +112,7 @@ Signed-off-by: Felix Fietkau default: return -ENOPROTOOPT; } -@@ -3934,6 +3947,13 @@ static int packet_getsockopt(struct sock +@@ -3959,6 +3972,13 @@ static int packet_getsockopt(struct sock case PACKET_VNET_HDR: val = po->has_vnet_hdr; break; @@ -128,7 +128,7 @@ Signed-off-by: Felix Fietkau break; --- a/net/packet/internal.h +++ b/net/packet/internal.h -@@ -131,6 +131,7 @@ struct packet_sock { +@@ -132,6 +132,7 @@ struct packet_sock { struct net_device __rcu *cached_dev; int (*xmit)(struct sk_buff *skb); struct packet_type prot_hook ____cacheline_aligned_in_smp; diff --git a/target/linux/generic/pending-4.14/640-netfilter-nf_flow_table-add-hardware-offload-support.patch b/target/linux/generic/pending-4.14/640-netfilter-nf_flow_table-add-hardware-offload-support.patch index 8d13eeff87..f0b1704f3b 100644 --- a/target/linux/generic/pending-4.14/640-netfilter-nf_flow_table-add-hardware-offload-support.patch +++ b/target/linux/generic/pending-4.14/640-netfilter-nf_flow_table-add-hardware-offload-support.patch @@ -506,7 +506,7 @@ Signed-off-by: Pablo Neira Ayuso +MODULE_ALIAS("nf-flow-table-hw"); --- a/net/netfilter/nf_tables_api.c +++ b/net/netfilter/nf_tables_api.c -@@ -4928,6 +4928,14 @@ static int nf_tables_flowtable_parse_hoo +@@ -4952,6 +4952,14 @@ static int nf_tables_flowtable_parse_hoo if (err < 0) goto err1; @@ -521,7 +521,7 @@ Signed-off-by: Pablo Neira Ayuso ops = kzalloc(sizeof(struct nf_hook_ops) * n, GFP_KERNEL); if (!ops) { err = -ENOMEM; -@@ -5058,10 +5066,19 @@ static int nf_tables_newflowtable(struct +@@ -5082,10 +5090,19 @@ static int nf_tables_newflowtable(struct } flowtable->data.type = type; @@ -541,7 +541,7 @@ Signed-off-by: Pablo Neira Ayuso err = nf_tables_flowtable_parse_hook(&ctx, nla[NFTA_FLOWTABLE_HOOK], flowtable); if (err < 0) -@@ -5159,7 +5176,8 @@ static int nf_tables_fill_flowtable_info +@@ -5183,7 +5200,8 @@ static int nf_tables_fill_flowtable_info nla_put_string(skb, NFTA_FLOWTABLE_NAME, flowtable->name) || nla_put_be32(skb, NFTA_FLOWTABLE_USE, htonl(flowtable->use)) || nla_put_be64(skb, NFTA_FLOWTABLE_HANDLE, cpu_to_be64(flowtable->handle), diff --git a/target/linux/generic/pending-4.14/642-net-8021q-support-hardware-flow-table-offload.patch b/target/linux/generic/pending-4.14/642-net-8021q-support-hardware-flow-table-offload.patch index 0d6eab16fd..4fabfdcb6c 100644 --- a/target/linux/generic/pending-4.14/642-net-8021q-support-hardware-flow-table-offload.patch +++ b/target/linux/generic/pending-4.14/642-net-8021q-support-hardware-flow-table-offload.patch @@ -20,7 +20,7 @@ Signed-off-by: Felix Fietkau #include "vlan.h" #include "vlanproc.h" -@@ -766,6 +770,27 @@ static int vlan_dev_get_iflink(const str +@@ -768,6 +772,27 @@ static int vlan_dev_get_iflink(const str return real_dev->ifindex; } @@ -48,7 +48,7 @@ Signed-off-by: Felix Fietkau static const struct ethtool_ops vlan_ethtool_ops = { .get_link_ksettings = vlan_ethtool_get_link_ksettings, .get_drvinfo = vlan_ethtool_get_drvinfo, -@@ -803,6 +828,9 @@ static const struct net_device_ops vlan_ +@@ -805,6 +830,9 @@ static const struct net_device_ops vlan_ .ndo_fix_features = vlan_dev_fix_features, .ndo_get_lock_subclass = vlan_dev_get_lock_subclass, .ndo_get_iflink = vlan_dev_get_iflink, diff --git a/target/linux/generic/pending-4.14/655-increase_skb_pad.patch b/target/linux/generic/pending-4.14/655-increase_skb_pad.patch index adb6b04529..f692dd3862 100644 --- a/target/linux/generic/pending-4.14/655-increase_skb_pad.patch +++ b/target/linux/generic/pending-4.14/655-increase_skb_pad.patch @@ -9,7 +9,7 @@ Signed-off-by: Felix Fietkau --- a/include/linux/skbuff.h +++ b/include/linux/skbuff.h -@@ -2476,7 +2476,7 @@ static inline int pskb_network_may_pull( +@@ -2478,7 +2478,7 @@ static inline int pskb_network_may_pull( * NET_IP_ALIGN(2) + ethernet_header(14) + IP_header(20/40) + ports(8) */ #ifndef NET_SKB_PAD diff --git a/target/linux/generic/pending-4.14/666-Add-support-for-MAP-E-FMRs-mesh-mode.patch b/target/linux/generic/pending-4.14/666-Add-support-for-MAP-E-FMRs-mesh-mode.patch index 89e6646c57..6e2eca6daf 100644 --- a/target/linux/generic/pending-4.14/666-Add-support-for-MAP-E-FMRs-mesh-mode.patch +++ b/target/linux/generic/pending-4.14/666-Add-support-for-MAP-E-FMRs-mesh-mode.patch @@ -300,7 +300,7 @@ Signed-off-by: Steven Barth /** * ip6_tnl_addr_conflict - compare packet addresses to tunnel's own * @t: the outgoing tunnel device -@@ -1306,6 +1446,7 @@ ip6ip6_tnl_xmit(struct sk_buff *skb, str +@@ -1305,6 +1445,7 @@ ip6ip6_tnl_xmit(struct sk_buff *skb, str { struct ip6_tnl *t = netdev_priv(dev); struct ipv6hdr *ipv6h; @@ -309,8 +309,8 @@ Signed-off-by: Steven Barth __u16 offset; struct flowi6 fl6; @@ -1372,6 +1513,18 @@ ip6ip6_tnl_xmit(struct sk_buff *skb, str - fl6.flowi6_uid = sock_net_uid(dev_net(dev), NULL); + dsfield = INET_ECN_encapsulate(dsfield, ipv6_get_dsfield(ipv6h)); + /* try to find matching FMR */ + for (fmr = t->parms.fmrs; fmr; fmr = fmr->next) { @@ -327,7 +327,7 @@ Signed-off-by: Steven Barth if (iptunnel_handle_offloads(skb, SKB_GSO_IPXIP6)) return -1; -@@ -1500,6 +1653,14 @@ ip6_tnl_change(struct ip6_tnl *t, const +@@ -1498,6 +1651,14 @@ ip6_tnl_change(struct ip6_tnl *t, const t->parms.link = p->link; t->parms.proto = p->proto; t->parms.fwmark = p->fwmark; @@ -342,7 +342,7 @@ Signed-off-by: Steven Barth dst_cache_reset(&t->dst_cache); ip6_tnl_link_config(t); return 0; -@@ -1538,6 +1699,7 @@ ip6_tnl_parm_from_user(struct __ip6_tnl_ +@@ -1536,6 +1697,7 @@ ip6_tnl_parm_from_user(struct __ip6_tnl_ p->flowinfo = u->flowinfo; p->link = u->link; p->proto = u->proto; @@ -350,7 +350,7 @@ Signed-off-by: Steven Barth memcpy(p->name, u->name, sizeof(u->name)); } -@@ -1924,6 +2086,15 @@ static int ip6_tnl_validate(struct nlatt +@@ -1922,6 +2084,15 @@ static int ip6_tnl_validate(struct nlatt return 0; } @@ -366,7 +366,7 @@ Signed-off-by: Steven Barth static void ip6_tnl_netlink_parms(struct nlattr *data[], struct __ip6_tnl_parm *parms) { -@@ -1961,6 +2132,46 @@ static void ip6_tnl_netlink_parms(struct +@@ -1959,6 +2130,46 @@ static void ip6_tnl_netlink_parms(struct if (data[IFLA_IPTUN_FWMARK]) parms->fwmark = nla_get_u32(data[IFLA_IPTUN_FWMARK]); @@ -413,7 +413,7 @@ Signed-off-by: Steven Barth } static bool ip6_tnl_netlink_encap_parms(struct nlattr *data[], -@@ -2076,6 +2287,12 @@ static void ip6_tnl_dellink(struct net_d +@@ -2074,6 +2285,12 @@ static void ip6_tnl_dellink(struct net_d static size_t ip6_tnl_get_size(const struct net_device *dev) { @@ -426,7 +426,7 @@ Signed-off-by: Steven Barth return /* IFLA_IPTUN_LINK */ nla_total_size(4) + -@@ -2105,6 +2322,24 @@ static size_t ip6_tnl_get_size(const str +@@ -2103,6 +2320,24 @@ static size_t ip6_tnl_get_size(const str nla_total_size(0) + /* IFLA_IPTUN_FWMARK */ nla_total_size(4) + @@ -451,7 +451,7 @@ Signed-off-by: Steven Barth 0; } -@@ -2112,6 +2347,9 @@ static int ip6_tnl_fill_info(struct sk_b +@@ -2110,6 +2345,9 @@ static int ip6_tnl_fill_info(struct sk_b { struct ip6_tnl *tunnel = netdev_priv(dev); struct __ip6_tnl_parm *parm = &tunnel->parms; @@ -461,7 +461,7 @@ Signed-off-by: Steven Barth if (nla_put_u32(skb, IFLA_IPTUN_LINK, parm->link) || nla_put_in6_addr(skb, IFLA_IPTUN_LOCAL, &parm->laddr) || -@@ -2121,9 +2359,27 @@ static int ip6_tnl_fill_info(struct sk_b +@@ -2119,9 +2357,27 @@ static int ip6_tnl_fill_info(struct sk_b nla_put_be32(skb, IFLA_IPTUN_FLOWINFO, parm->flowinfo) || nla_put_u32(skb, IFLA_IPTUN_FLAGS, parm->flags) || nla_put_u8(skb, IFLA_IPTUN_PROTO, parm->proto) || @@ -490,7 +490,7 @@ Signed-off-by: Steven Barth if (nla_put_u16(skb, IFLA_IPTUN_ENCAP_TYPE, tunnel->encap.type) || nla_put_be16(skb, IFLA_IPTUN_ENCAP_SPORT, tunnel->encap.sport) || nla_put_be16(skb, IFLA_IPTUN_ENCAP_DPORT, tunnel->encap.dport) || -@@ -2163,6 +2419,7 @@ static const struct nla_policy ip6_tnl_p +@@ -2161,6 +2417,7 @@ static const struct nla_policy ip6_tnl_p [IFLA_IPTUN_ENCAP_DPORT] = { .type = NLA_U16 }, [IFLA_IPTUN_COLLECT_METADATA] = { .type = NLA_FLAG }, [IFLA_IPTUN_FWMARK] = { .type = NLA_U32 }, diff --git a/target/linux/generic/pending-4.14/670-ipv6-allow-rejecting-with-source-address-failed-policy.patch b/target/linux/generic/pending-4.14/670-ipv6-allow-rejecting-with-source-address-failed-policy.patch index 03bb755619..e4fdd6c58b 100644 --- a/target/linux/generic/pending-4.14/670-ipv6-allow-rejecting-with-source-address-failed-policy.patch +++ b/target/linux/generic/pending-4.14/670-ipv6-allow-rejecting-with-source-address-failed-policy.patch @@ -181,7 +181,7 @@ Signed-off-by: Jonas Gorski cfg->fc_flags |= RTF_REJECT; if (rtm->rtm_type == RTN_LOCAL) -@@ -3502,6 +3536,9 @@ static int rt6_fill_node(struct net *net +@@ -3506,6 +3540,9 @@ static int rt6_fill_node(struct net *net case -EACCES: rtm->rtm_type = RTN_PROHIBIT; break; @@ -191,7 +191,7 @@ Signed-off-by: Jonas Gorski case -EAGAIN: rtm->rtm_type = RTN_THROW; break; -@@ -3820,6 +3857,8 @@ static int ip6_route_dev_notify(struct n +@@ -3824,6 +3861,8 @@ static int ip6_route_dev_notify(struct n #ifdef CONFIG_IPV6_MULTIPLE_TABLES net->ipv6.ip6_prohibit_entry->dst.dev = dev; net->ipv6.ip6_prohibit_entry->rt6i_idev = in6_dev_get(dev); @@ -200,7 +200,7 @@ Signed-off-by: Jonas Gorski net->ipv6.ip6_blk_hole_entry->dst.dev = dev; net->ipv6.ip6_blk_hole_entry->rt6i_idev = in6_dev_get(dev); #endif -@@ -3831,6 +3870,7 @@ static int ip6_route_dev_notify(struct n +@@ -3835,6 +3874,7 @@ static int ip6_route_dev_notify(struct n in6_dev_put_clear(&net->ipv6.ip6_null_entry->rt6i_idev); #ifdef CONFIG_IPV6_MULTIPLE_TABLES in6_dev_put_clear(&net->ipv6.ip6_prohibit_entry->rt6i_idev); @@ -208,7 +208,7 @@ Signed-off-by: Jonas Gorski in6_dev_put_clear(&net->ipv6.ip6_blk_hole_entry->rt6i_idev); #endif } -@@ -4047,6 +4087,17 @@ static int __net_init ip6_route_net_init +@@ -4051,6 +4091,17 @@ static int __net_init ip6_route_net_init net->ipv6.ip6_blk_hole_entry->dst.ops = &net->ipv6.ip6_dst_ops; dst_init_metrics(&net->ipv6.ip6_blk_hole_entry->dst, ip6_template_metrics, true); @@ -226,7 +226,7 @@ Signed-off-by: Jonas Gorski #endif net->ipv6.sysctl.flush_delay = 0; -@@ -4065,6 +4116,8 @@ out: +@@ -4069,6 +4120,8 @@ out: return ret; #ifdef CONFIG_IPV6_MULTIPLE_TABLES @@ -235,7 +235,7 @@ Signed-off-by: Jonas Gorski out_ip6_prohibit_entry: kfree(net->ipv6.ip6_prohibit_entry); out_ip6_null_entry: -@@ -4082,6 +4135,7 @@ static void __net_exit ip6_route_net_exi +@@ -4086,6 +4139,7 @@ static void __net_exit ip6_route_net_exi #ifdef CONFIG_IPV6_MULTIPLE_TABLES kfree(net->ipv6.ip6_prohibit_entry); kfree(net->ipv6.ip6_blk_hole_entry); @@ -243,7 +243,7 @@ Signed-off-by: Jonas Gorski #endif dst_entries_destroy(&net->ipv6.ip6_dst_ops); } -@@ -4155,6 +4209,9 @@ void __init ip6_route_init_special_entri +@@ -4159,6 +4213,9 @@ void __init ip6_route_init_special_entri init_net.ipv6.ip6_prohibit_entry->rt6i_idev = in6_dev_get(init_net.loopback_dev); init_net.ipv6.ip6_blk_hole_entry->dst.dev = init_net.loopback_dev; init_net.ipv6.ip6_blk_hole_entry->rt6i_idev = in6_dev_get(init_net.loopback_dev); diff --git a/target/linux/generic/pending-4.14/680-NET-skip-GRO-for-foreign-MAC-addresses.patch b/target/linux/generic/pending-4.14/680-NET-skip-GRO-for-foreign-MAC-addresses.patch index 4d4c740df8..f76c39ac18 100644 --- a/target/linux/generic/pending-4.14/680-NET-skip-GRO-for-foreign-MAC-addresses.patch +++ b/target/linux/generic/pending-4.14/680-NET-skip-GRO-for-foreign-MAC-addresses.patch @@ -42,7 +42,7 @@ Signed-off-by: Felix Fietkau if (netif_elide_gro(skb->dev)) goto normal; -@@ -6279,6 +6282,48 @@ static void __netdev_adjacent_dev_unlink +@@ -6282,6 +6285,48 @@ static void __netdev_adjacent_dev_unlink &upper_dev->adj_list.lower); } @@ -91,7 +91,7 @@ Signed-off-by: Felix Fietkau static int __netdev_upper_dev_link(struct net_device *dev, struct net_device *upper_dev, bool master, void *upper_priv, void *upper_info) -@@ -6317,6 +6362,7 @@ static int __netdev_upper_dev_link(struc +@@ -6320,6 +6365,7 @@ static int __netdev_upper_dev_link(struc if (ret) return ret; @@ -99,7 +99,7 @@ Signed-off-by: Felix Fietkau ret = call_netdevice_notifiers_info(NETDEV_CHANGEUPPER, dev, &changeupper_info.info); ret = notifier_to_errno(ret); -@@ -6394,6 +6440,7 @@ void netdev_upper_dev_unlink(struct net_ +@@ -6397,6 +6443,7 @@ void netdev_upper_dev_unlink(struct net_ __netdev_adjacent_dev_unlink_neighbour(dev, upper_dev); @@ -107,7 +107,7 @@ Signed-off-by: Felix Fietkau call_netdevice_notifiers_info(NETDEV_CHANGEUPPER, dev, &changeupper_info.info); } -@@ -6966,6 +7013,7 @@ int dev_set_mac_address(struct net_devic +@@ -6969,6 +7016,7 @@ int dev_set_mac_address(struct net_devic if (err) return err; dev->addr_assign_type = NET_ADDR_SET; diff --git a/target/linux/generic/pending-4.14/701-phy_extension.patch b/target/linux/generic/pending-4.14/701-phy_extension.patch deleted file mode 100644 index 0f0b0e0467..0000000000 --- a/target/linux/generic/pending-4.14/701-phy_extension.patch +++ /dev/null @@ -1,95 +0,0 @@ -From: John Crispin -Subject: net: phy: add phy_ethtool_ioctl() - -Signed-off-by: John Crispin ---- - drivers/net/phy/phy.c | 44 ++++++++++++++++++++++++++++++++++++++++++++ - include/linux/phy.h | 1 + - 2 files changed, 45 insertions(+) - ---- a/drivers/net/phy/phy.c -+++ b/drivers/net/phy/phy.c -@@ -382,6 +382,73 @@ void phy_ethtool_ksettings_get(struct ph - } - EXPORT_SYMBOL(phy_ethtool_ksettings_get); - -+static int phy_ethtool_gset(struct phy_device *phydev, struct ethtool_cmd *cmd) -+{ -+ cmd->supported = phydev->supported; -+ -+ cmd->advertising = phydev->advertising; -+ cmd->lp_advertising = phydev->lp_advertising; -+ -+ ethtool_cmd_speed_set(cmd, phydev->speed); -+ cmd->duplex = phydev->duplex; -+ if (phydev->interface == PHY_INTERFACE_MODE_MOCA) -+ cmd->port = PORT_BNC; -+ else -+ cmd->port = PORT_MII; -+ cmd->phy_address = phydev->mdio.addr; -+ cmd->transceiver = phy_is_internal(phydev) ? -+ XCVR_INTERNAL : XCVR_EXTERNAL; -+ cmd->autoneg = phydev->autoneg; -+ cmd->eth_tp_mdix_ctrl = phydev->mdix_ctrl; -+ cmd->eth_tp_mdix = phydev->mdix; -+ -+ return 0; -+} -+ -+int phy_ethtool_ioctl(struct phy_device *phydev, void *useraddr) -+{ -+ u32 cmd; -+ int tmp; -+ struct ethtool_cmd ecmd = { ETHTOOL_GSET }; -+ struct ethtool_value edata = { ETHTOOL_GLINK }; -+ -+ if (get_user(cmd, (u32 *) useraddr)) -+ return -EFAULT; -+ -+ switch (cmd) { -+ case ETHTOOL_GSET: -+ phy_ethtool_gset(phydev, &ecmd); -+ if (copy_to_user(useraddr, &ecmd, sizeof(ecmd))) -+ return -EFAULT; -+ return 0; -+ -+ case ETHTOOL_SSET: -+ if (copy_from_user(&ecmd, useraddr, sizeof(ecmd))) -+ return -EFAULT; -+ return phy_ethtool_sset(phydev, &ecmd); -+ -+ case ETHTOOL_NWAY_RST: -+ /* if autoneg is off, it's an error */ -+ tmp = phy_read(phydev, MII_BMCR); -+ if (tmp & BMCR_ANENABLE) { -+ tmp |= (BMCR_ANRESTART); -+ phy_write(phydev, MII_BMCR, tmp); -+ return 0; -+ } -+ return -EINVAL; -+ -+ case ETHTOOL_GLINK: -+ edata.data = (phy_read(phydev, -+ MII_BMSR) & BMSR_LSTATUS) ? 1 : 0; -+ if (copy_to_user(useraddr, &edata, sizeof(edata))) -+ return -EFAULT; -+ return 0; -+ } -+ -+ return -EOPNOTSUPP; -+} -+EXPORT_SYMBOL(phy_ethtool_ioctl); -+ - /** - * phy_mii_ioctl - generic PHY MII ioctl interface - * @phydev: the phy_device struct ---- a/include/linux/phy.h -+++ b/include/linux/phy.h -@@ -909,6 +909,7 @@ void phy_ethtool_ksettings_get(struct ph - struct ethtool_link_ksettings *cmd); - int phy_ethtool_ksettings_set(struct phy_device *phydev, - const struct ethtool_link_ksettings *cmd); -+int phy_ethtool_ioctl(struct phy_device *phydev, void *useraddr); - int phy_mii_ioctl(struct phy_device *phydev, struct ifreq *ifr, int cmd); - int phy_start_interrupts(struct phy_device *phydev); - void phy_print_status(struct phy_device *phydev); diff --git a/target/linux/generic/pending-4.14/703-phy-add-detach-callback-to-struct-phy_driver.patch b/target/linux/generic/pending-4.14/703-phy-add-detach-callback-to-struct-phy_driver.patch index 119b53c6d7..4ba722183c 100644 --- a/target/linux/generic/pending-4.14/703-phy-add-detach-callback-to-struct-phy_driver.patch +++ b/target/linux/generic/pending-4.14/703-phy-add-detach-callback-to-struct-phy_driver.patch @@ -11,7 +11,7 @@ Signed-off-by: Gabor Juhos --- a/drivers/net/phy/phy_device.c +++ b/drivers/net/phy/phy_device.c -@@ -1099,6 +1099,9 @@ void phy_detach(struct phy_device *phyde +@@ -1105,6 +1105,9 @@ void phy_detach(struct phy_device *phyde struct module *ndev_owner = dev->dev.parent->driver->owner; struct mii_bus *bus; diff --git a/target/linux/generic/pending-4.14/810-pci_disable_common_quirks.patch b/target/linux/generic/pending-4.14/810-pci_disable_common_quirks.patch index c80e58105d..949dbecfb6 100644 --- a/target/linux/generic/pending-4.14/810-pci_disable_common_quirks.patch +++ b/target/linux/generic/pending-4.14/810-pci_disable_common_quirks.patch @@ -32,7 +32,7 @@ Signed-off-by: Gabor Juhos /* The Mellanox Tavor device gives false positive parity errors * Mark this device with a broken_parity_status, to allow * PCI scanning code to "skip" this now blacklisted device. -@@ -3077,6 +3078,7 @@ DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_I +@@ -3094,6 +3095,7 @@ DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_I DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x65f9, quirk_intel_mc_errata); DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x65fa, quirk_intel_mc_errata); @@ -40,7 +40,7 @@ Signed-off-by: Gabor Juhos /* * Ivytown NTB BAR sizes are misreported by the hardware due to an erratum. To -@@ -3133,6 +3135,8 @@ static void fixup_debug_report(struct pc +@@ -3150,6 +3152,8 @@ static void fixup_debug_report(struct pc } } @@ -49,7 +49,7 @@ Signed-off-by: Gabor Juhos /* * Some BIOS implementations leave the Intel GPU interrupts enabled, * even though no one is handling them (f.e. i915 driver is never loaded). -@@ -3171,6 +3175,8 @@ DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_IN +@@ -3188,6 +3192,8 @@ DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_IN DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x010a, disable_igfx_irq); DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x0152, disable_igfx_irq); diff --git a/target/linux/generic/pending-4.14/811-pci_disable_usb_common_quirks.patch b/target/linux/generic/pending-4.14/811-pci_disable_usb_common_quirks.patch index f40214c29b..aeb13c5ef7 100644 --- a/target/linux/generic/pending-4.14/811-pci_disable_usb_common_quirks.patch +++ b/target/linux/generic/pending-4.14/811-pci_disable_usb_common_quirks.patch @@ -19,7 +19,7 @@ Signed-off-by: Felix Fietkau static struct amd_chipset_info { struct pci_dev *nb_dev; struct pci_dev *smbus_dev; -@@ -620,6 +622,10 @@ bool usb_amd_pt_check_port(struct device +@@ -627,6 +629,10 @@ bool usb_amd_pt_check_port(struct device } EXPORT_SYMBOL_GPL(usb_amd_pt_check_port); @@ -30,7 +30,7 @@ Signed-off-by: Felix Fietkau /* * Make sure the controller is completely inactive, unable to * generate interrupts or do DMA. -@@ -699,8 +705,17 @@ reset_needed: +@@ -706,8 +712,17 @@ reset_needed: uhci_reset_hc(pdev, base); return 1; } @@ -48,7 +48,7 @@ Signed-off-by: Felix Fietkau static inline int io_type_enabled(struct pci_dev *pdev, unsigned int mask) { u16 cmd; -@@ -1287,3 +1302,4 @@ bool usb_xhci_needs_pci_reset(struct pci +@@ -1294,3 +1309,4 @@ bool usb_xhci_needs_pci_reset(struct pci return false; } EXPORT_SYMBOL_GPL(usb_xhci_needs_pci_reset); diff --git a/target/linux/generic/pending-4.14/834-ledtrig-libata.patch b/target/linux/generic/pending-4.14/834-ledtrig-libata.patch index 392d41c94f..f59085b51c 100644 --- a/target/linux/generic/pending-4.14/834-ledtrig-libata.patch +++ b/target/linux/generic/pending-4.14/834-ledtrig-libata.patch @@ -65,7 +65,7 @@ Signed-off-by: Daniel Golle /** * ata_build_rw_tf - Build ATA taskfile for given read/write request * @tf: Target ATA taskfile -@@ -5121,6 +5134,9 @@ struct ata_queued_cmd *ata_qc_new_init(s +@@ -5124,6 +5137,9 @@ struct ata_queued_cmd *ata_qc_new_init(s if (tag < 0) return NULL; } @@ -75,7 +75,7 @@ Signed-off-by: Daniel Golle qc = __ata_qc_from_tag(ap, tag); qc->tag = tag; -@@ -6022,6 +6038,9 @@ struct ata_port *ata_port_alloc(struct a +@@ -6025,6 +6041,9 @@ struct ata_port *ata_port_alloc(struct a ap->stats.unhandled_irq = 1; ap->stats.idle_irq = 1; #endif @@ -85,7 +85,7 @@ Signed-off-by: Daniel Golle ata_sff_port_init(ap); return ap; -@@ -6043,6 +6062,12 @@ static void ata_host_release(struct devi +@@ -6046,6 +6065,12 @@ static void ata_host_release(struct devi kfree(ap->pmp_link); kfree(ap->slave_link); @@ -98,7 +98,7 @@ Signed-off-by: Daniel Golle kfree(ap); host->ports[i] = NULL; } -@@ -6489,7 +6514,23 @@ int ata_host_register(struct ata_host *h +@@ -6492,7 +6517,23 @@ int ata_host_register(struct ata_host *h host->ports[i]->print_id = atomic_inc_return(&ata_print_id); host->ports[i]->local_port_no = i + 1; } diff --git a/target/linux/generic/pending-4.14/950-tty-serial-exar-generalize-rs485-setup.patch b/target/linux/generic/pending-4.14/950-tty-serial-exar-generalize-rs485-setup.patch deleted file mode 100644 index 869bf7b9b2..0000000000 --- a/target/linux/generic/pending-4.14/950-tty-serial-exar-generalize-rs485-setup.patch +++ /dev/null @@ -1,76 +0,0 @@ -From 24d5ba8ad40c3ac7903f688580c345aafa764dc7 Mon Sep 17 00:00:00 2001 -From: Daniel Golle -Date: Mon, 4 Jun 2018 14:51:29 +0200 -Subject: [PATCH] tty: serial: exar: generalize rs485 setup -To: linux-serial@vger.kernel.org, - Greg Kroah-Hartman -Cc: Linus Walleij , - Jan Kiszka - -Move the non-board-specific part of the RS485 initialization -from iot2040_rs485_config function to a new generic function -used also for other boards. -This allows using PCIe boards which are hard-wired to RS485 -or have jumpers for their configurations. - -Signed-off-by: Daniel Golle ---- - drivers/tty/serial/8250/8250_exar.c | 38 +++++++++++++++++++---------- - 1 file changed, 25 insertions(+), 13 deletions(-) - ---- a/drivers/tty/serial/8250/8250_exar.c -+++ b/drivers/tty/serial/8250/8250_exar.c -@@ -275,8 +275,32 @@ static int xr17v35x_register_gpio(struct - return 0; - } - -+static int generic_rs485_config(struct uart_port *port, -+ struct serial_rs485 *rs485) -+{ -+ bool is_rs485 = !!(rs485->flags & SER_RS485_ENABLED); -+ u8 __iomem *p = port->membase; -+ u8 value; -+ -+ value = readb(p + UART_EXAR_FCTR); -+ if (is_rs485) -+ value |= UART_FCTR_EXAR_485; -+ else -+ value &= ~UART_FCTR_EXAR_485; -+ -+ writeb(value, p + UART_EXAR_FCTR); -+ -+ if (is_rs485) -+ writeb(UART_EXAR_RS485_DLY(4), p + UART_MSR); -+ -+ port->rs485 = *rs485; -+ -+ return 0; -+} -+ - static const struct exar8250_platform exar8250_default_platform = { - .register_gpio = xr17v35x_register_gpio, -+ .rs485_config = generic_rs485_config, - }; - - static int iot2040_rs485_config(struct uart_port *port, -@@ -309,19 +333,7 @@ static int iot2040_rs485_config(struct u - value |= mode; - writeb(value, p + UART_EXAR_MPIOLVL_7_0); - -- value = readb(p + UART_EXAR_FCTR); -- if (is_rs485) -- value |= UART_FCTR_EXAR_485; -- else -- value &= ~UART_FCTR_EXAR_485; -- writeb(value, p + UART_EXAR_FCTR); -- -- if (is_rs485) -- writeb(UART_EXAR_RS485_DLY(4), p + UART_MSR); -- -- port->rs485 = *rs485; -- -- return 0; -+ return generic_rs485_config(port, rs485); - } - - static const struct property_entry iot2040_gpio_properties[] = { diff --git a/target/linux/generic/pending-4.19/0931-w1-gpio-fix-problem-with-platfom-data-in-w1-gpio.patch b/target/linux/generic/pending-4.19/0931-w1-gpio-fix-problem-with-platfom-data-in-w1-gpio.patch deleted file mode 100644 index be9ceebc3a..0000000000 --- a/target/linux/generic/pending-4.19/0931-w1-gpio-fix-problem-with-platfom-data-in-w1-gpio.patch +++ /dev/null @@ -1,26 +0,0 @@ -From d9c8bc8c1408f3e8529db6e4e04017b4c579c342 Mon Sep 17 00:00:00 2001 -From: Pawel Dembicki -Date: Sun, 18 Feb 2018 17:08:04 +0100 -Subject: [PATCH] w1: gpio: fix problem with platfom data in w1-gpio - -In devices, where fdt is used, is impossible to apply platform data -without proper fdt node. - -This patch allow to use platform data in devices with fdt. - -Signed-off-by: Pawel Dembicki ---- - drivers/w1/masters/w1-gpio.c | 7 +++---- - 1 file changed, 3 insertions(+), 4 deletions(-) - ---- a/drivers/w1/masters/w1-gpio.c -+++ b/drivers/w1/masters/w1-gpio.c -@@ -79,7 +79,7 @@ static int w1_gpio_probe(struct platform - enum gpiod_flags gflags = GPIOD_OUT_LOW_OPEN_DRAIN; - int err; - -- if (of_have_populated_dt()) { -+ if (of_have_populated_dt() && !dev_get_platdata(&pdev->dev)) { - pdata = devm_kzalloc(&pdev->dev, sizeof(*pdata), GFP_KERNEL); - if (!pdata) - return -ENOMEM; diff --git a/target/linux/generic/pending-4.19/102-MIPS-only-process-negative-stack-offsets-on-stack-tr.patch b/target/linux/generic/pending-4.19/102-MIPS-only-process-negative-stack-offsets-on-stack-tr.patch deleted file mode 100644 index 0b87f493ec..0000000000 --- a/target/linux/generic/pending-4.19/102-MIPS-only-process-negative-stack-offsets-on-stack-tr.patch +++ /dev/null @@ -1,57 +0,0 @@ -From: Felix Fietkau -Date: Wed, 18 Apr 2018 10:50:05 +0200 -Subject: [PATCH] MIPS: only process negative stack offsets on stack traces - -Fixes endless back traces in cases where the compiler emits a stack -pointer increase in a branch delay slot (probably for some form of -function return). - -[ 3.475442] BUG: MAX_STACK_TRACE_ENTRIES too low! -[ 3.480070] turning off the locking correctness validator. -[ 3.485521] CPU: 0 PID: 1 Comm: swapper/0 Not tainted 4.14.34 #0 -[ 3.491475] Stack : 00000000 00000000 00000000 00000000 80e0fce2 00000034 00000000 00000000 -[ 3.499764] 87c3838c 80696377 8061047c 00000000 00000001 00000001 87c2d850 6534689f -[ 3.508059] 00000000 00000000 80e10000 00000000 00000000 000000cf 0000000f 00000000 -[ 3.516353] 00000000 806a0000 00076891 00000000 00000000 00000000 ffffffff 00000000 -[ 3.524648] 806c0000 00000004 80e10000 806a0000 00000003 80690000 00000000 80700000 -[ 3.532942] ... -[ 3.535362] Call Trace: -[ 3.537818] [<80010a48>] show_stack+0x58/0x100 -[ 3.542207] [<804c2f78>] dump_stack+0xe8/0x170 -[ 3.546613] [<80079f90>] save_trace+0xf0/0x110 -[ 3.551010] [<8007b1ec>] mark_lock+0x33c/0x78c -[ 3.555413] [<8007bf48>] __lock_acquire+0x2ac/0x1a08 -[ 3.560337] [<8007de60>] lock_acquire+0x64/0x8c -[ 3.564846] [<804e1570>] _raw_spin_lock_irqsave+0x54/0x78 -[ 3.570186] [<801b618c>] kernfs_notify+0x94/0xac -[ 3.574770] [<801b7b10>] sysfs_notify+0x74/0xa0 -[ 3.579257] [<801b618c>] kernfs_notify+0x94/0xac -[ 3.583839] [<801b7b10>] sysfs_notify+0x74/0xa0 -[ 3.588329] [<801b618c>] kernfs_notify+0x94/0xac -[ 3.592911] [<801b7b10>] sysfs_notify+0x74/0xa0 -[ 3.597401] [<801b618c>] kernfs_notify+0x94/0xac -[ 3.601983] [<801b7b10>] sysfs_notify+0x74/0xa0 -[ 3.606473] [<801b618c>] kernfs_notify+0x94/0xac -[ 3.611055] [<801b7b10>] sysfs_notify+0x74/0xa0 -[ 3.615545] [<801b618c>] kernfs_notify+0x94/0xac -[ 3.620125] [<801b7b10>] sysfs_notify+0x74/0xa0 -[ 3.624619] [<801b618c>] kernfs_notify+0x94/0xac -[ 3.629197] [<801b7b10>] sysfs_notify+0x74/0xa0 -[ 3.633691] [<801b618c>] kernfs_notify+0x94/0xac -[ 3.638269] [<801b7b10>] sysfs_notify+0x74/0xa0 -[ 3.642763] [<801b618c>] kernfs_notify+0x94/0xac - -Signed-off-by: Felix Fietkau ---- - ---- a/arch/mips/kernel/process.c -+++ b/arch/mips/kernel/process.c -@@ -361,6 +361,8 @@ static inline int is_sp_move_ins(union m - - if (ip->i_format.opcode == addiu_op || - ip->i_format.opcode == daddiu_op) { -+ if (ip->i_format.simmediate > 0) -+ return 0; - *frame_size = -ip->i_format.simmediate; - return 1; - } diff --git a/target/linux/generic/pending-4.19/110-ehci_hcd_ignore_oc.patch b/target/linux/generic/pending-4.19/110-ehci_hcd_ignore_oc.patch deleted file mode 100644 index cad00b5527..0000000000 --- a/target/linux/generic/pending-4.19/110-ehci_hcd_ignore_oc.patch +++ /dev/null @@ -1,79 +0,0 @@ -From: Florian Fainelli -Subject: USB: EHCI: add ignore_oc flag to disable overcurrent checking - -This patch adds an ignore_oc flag which can be set by EHCI controller -not supporting or wanting to disable overcurrent checking. The EHCI -platform data in include/linux/usb/ehci_pdriver.h is also augmented to -take advantage of this new flag. - -Signed-off-by: Florian Fainelli ---- - drivers/usb/host/ehci-hcd.c | 2 +- - drivers/usb/host/ehci-hub.c | 4 ++-- - drivers/usb/host/ehci-platform.c | 1 + - drivers/usb/host/ehci.h | 1 + - include/linux/usb/ehci_pdriver.h | 1 + - 5 files changed, 6 insertions(+), 3 deletions(-) - ---- a/drivers/usb/host/ehci-hcd.c -+++ b/drivers/usb/host/ehci-hcd.c -@@ -638,7 +638,7 @@ static int ehci_run (struct usb_hcd *hcd - "USB %x.%x started, EHCI %x.%02x%s\n", - ((ehci->sbrn & 0xf0)>>4), (ehci->sbrn & 0x0f), - temp >> 8, temp & 0xff, -- ignore_oc ? ", overcurrent ignored" : ""); -+ (ignore_oc || ehci->ignore_oc) ? ", overcurrent ignored" : ""); - - ehci_writel(ehci, INTR_MASK, - &ehci->regs->intr_enable); /* Turn On Interrupts */ ---- a/drivers/usb/host/ehci-hub.c -+++ b/drivers/usb/host/ehci-hub.c -@@ -641,7 +641,7 @@ ehci_hub_status_data (struct usb_hcd *hc - * always set, seem to clear PORT_OCC and PORT_CSC when writing to - * PORT_POWER; that's surprising, but maybe within-spec. - */ -- if (!ignore_oc) -+ if (!ignore_oc && !ehci->ignore_oc) - mask = PORT_CSC | PORT_PEC | PORT_OCC; - else - mask = PORT_CSC | PORT_PEC; -@@ -1011,7 +1011,7 @@ int ehci_hub_control( - if (temp & PORT_PEC) - status |= USB_PORT_STAT_C_ENABLE << 16; - -- if ((temp & PORT_OCC) && !ignore_oc){ -+ if ((temp & PORT_OCC) && (!ignore_oc && !ehci->ignore_oc)){ - status |= USB_PORT_STAT_C_OVERCURRENT << 16; - - /* ---- a/drivers/usb/host/ehci-platform.c -+++ b/drivers/usb/host/ehci-platform.c -@@ -208,6 +208,8 @@ static int ehci_platform_probe(struct pl - hcd->has_tt = 1; - if (pdata->reset_on_resume) - priv->reset_on_resume = true; -+ if (pdata->ignore_oc) -+ ehci->ignore_oc = 1; - - #ifndef CONFIG_USB_EHCI_BIG_ENDIAN_MMIO - if (ehci->big_endian_mmio) { ---- a/drivers/usb/host/ehci.h -+++ b/drivers/usb/host/ehci.h -@@ -218,6 +218,7 @@ struct ehci_hcd { /* one per controlle - unsigned frame_index_bug:1; /* MosChip (AKA NetMos) */ - unsigned need_oc_pp_cycle:1; /* MPC834X port power */ - unsigned imx28_write_fix:1; /* For Freescale i.MX28 */ -+ unsigned ignore_oc:1; - - /* required for usb32 quirk */ - #define OHCI_CTRL_HCFS (3 << 6) ---- a/include/linux/usb/ehci_pdriver.h -+++ b/include/linux/usb/ehci_pdriver.h -@@ -50,6 +50,7 @@ struct usb_ehci_pdata { - unsigned no_io_watchdog:1; - unsigned reset_on_resume:1; - unsigned dma_mask_64:1; -+ unsigned ignore_oc:1; - - /* Turn on all power and clocks */ - int (*power_on)(struct platform_device *pdev); diff --git a/target/linux/generic/pending-4.19/120-Fix-alloc_node_mem_map-with-ARCH_PFN_OFFSET-calcu.patch b/target/linux/generic/pending-4.19/120-Fix-alloc_node_mem_map-with-ARCH_PFN_OFFSET-calcu.patch deleted file mode 100644 index 3aca457660..0000000000 --- a/target/linux/generic/pending-4.19/120-Fix-alloc_node_mem_map-with-ARCH_PFN_OFFSET-calcu.patch +++ /dev/null @@ -1,82 +0,0 @@ -From: Tobias Wolf -Subject: mm: Fix alloc_node_mem_map with ARCH_PFN_OFFSET calculation - -An rt288x (ralink) based router (Belkin F5D8235 v1) does not boot with any -kernel beyond version 4.3 resulting in: - -BUG: Bad page state in process swapper pfn:086ac - -bisect resulted in: - -a1c34a3bf00af2cede839879502e12dc68491ad5 is the first bad commit -commit a1c34a3bf00af2cede839879502e12dc68491ad5 -Author: Laura Abbott -Date: Thu Nov 5 18:48:46 2015 -0800 - - mm: Don't offset memmap for flatmem - - Srinivas Kandagatla reported bad page messages when trying to remove the - bottom 2MB on an ARM based IFC6410 board - - BUG: Bad page state in process swapper pfn:fffa8 - page:ef7fb500 count:0 mapcount:0 mapping: (null) index:0x0 - flags: 0x96640253(locked|error|dirty|active|arch_1|reclaim|mlocked) - page dumped because: PAGE_FLAGS_CHECK_AT_FREE flag(s) set - bad because of flags: - flags: 0x200041(locked|active|mlocked) - Modules linked in: - CPU: 0 PID: 0 Comm: swapper Not tainted 3.19.0-rc3-00007-g412f9ba-dirty -#816 - Hardware name: Qualcomm (Flattened Device Tree) - unwind_backtrace - show_stack - dump_stack - bad_page - free_pages_prepare - free_hot_cold_page - __free_pages - free_highmem_page - mem_init - start_kernel - Disabling lock debugging due to kernel taint - [...] -:040000 040000 2de013c372345fd471cd58f0553c9b38b0ef1cc4 -0a8156f848733dfa21e16c196dfb6c0a76290709 M mm - -This fix for ARM does not account ARCH_PFN_OFFSET for mem_map as later used by -page_to_pfn anymore. - -The following output was generated with two hacked in printk statements: - -printk("before %p vs. %p or %p\n", mem_map, mem_map - offset, mem_map - -(pgdat->node_start_pfn - ARCH_PFN_OFFSET)); - if (page_to_pfn(mem_map) != pgdat->node_start_pfn) - mem_map -= offset + (pgdat->node_start_pfn - ARCH_PFN_OFFSET); -printk("after %p\n", mem_map); - -Output: - -[ 0.000000] before 8861b280 vs. 8861b280 or 8851b280 -[ 0.000000] after 8851b280 - -As seen in the first line mem_map with subtraction of offset does not equal the -mem_map after subtraction of ARCH_PFN_OFFSET. - -After adding the offset of ARCH_PFN_OFFSET as well to mem_map as the -previously calculated offset is zero for the named platform it is able to boot -4.4 and 4.9-rc7 again. - -Signed-off-by: Tobias Wolf ---- - ---- a/mm/page_alloc.c -+++ b/mm/page_alloc.c -@@ -6393,7 +6393,7 @@ static void __ref alloc_node_mem_map(str - mem_map = NODE_DATA(0)->node_mem_map; - #if defined(CONFIG_HAVE_MEMBLOCK_NODE_MAP) || defined(CONFIG_FLATMEM) - if (page_to_pfn(mem_map) != pgdat->node_start_pfn) -- mem_map -= offset; -+ mem_map -= offset + (pgdat->node_start_pfn - ARCH_PFN_OFFSET); - #endif /* CONFIG_HAVE_MEMBLOCK_NODE_MAP */ - } - #endif diff --git a/target/linux/generic/pending-4.19/130-add-linux-spidev-compatible-si3210.patch b/target/linux/generic/pending-4.19/130-add-linux-spidev-compatible-si3210.patch deleted file mode 100644 index b00fb8ee2e..0000000000 --- a/target/linux/generic/pending-4.19/130-add-linux-spidev-compatible-si3210.patch +++ /dev/null @@ -1,18 +0,0 @@ -From: Giuseppe Lippolis -Subject: Add the linux,spidev compatible in spidev Several device in ramips have this binding in the dts - -Signed-off-by: Giuseppe Lippolis ---- - drivers/spi/spidev.c | 1 + - 1 file changed, 1 insertion(+) - ---- a/drivers/spi/spidev.c -+++ b/drivers/spi/spidev.c -@@ -669,6 +669,7 @@ static const struct of_device_id spidev_ - { .compatible = "lineartechnology,ltc2488" }, - { .compatible = "ge,achc" }, - { .compatible = "semtech,sx1301" }, -+ { .compatible = "siliconlabs,si3210" }, - {}, - }; - MODULE_DEVICE_TABLE(of, spidev_dt_ids); diff --git a/target/linux/generic/pending-4.19/131-spi-use-gpio_set_value_cansleep-for-setting-chipsele.patch b/target/linux/generic/pending-4.19/131-spi-use-gpio_set_value_cansleep-for-setting-chipsele.patch deleted file mode 100644 index bd5ed6f888..0000000000 --- a/target/linux/generic/pending-4.19/131-spi-use-gpio_set_value_cansleep-for-setting-chipsele.patch +++ /dev/null @@ -1,20 +0,0 @@ -From: Felix Fietkau -Subject: spi: use gpio_set_value_cansleep for setting chipselect GPIO - -Sleeping is safe inside spi_transfer_one_message, and some GPIO chips -need to sleep for setting values - -Signed-off-by: Felix Fietkau ---- - ---- a/drivers/spi/spi.c -+++ b/drivers/spi/spi.c -@@ -733,7 +733,7 @@ static void spi_set_cs(struct spi_device - enable = !enable; - - if (gpio_is_valid(spi->cs_gpio)) { -- gpio_set_value(spi->cs_gpio, !enable); -+ gpio_set_value_cansleep(spi->cs_gpio, !enable); - /* Some SPI masters need both GPIO CS & slave_select */ - if ((spi->controller->flags & SPI_MASTER_GPIO_SS) && - spi->controller->set_cs) diff --git a/target/linux/generic/pending-4.19/140-jffs2-use-.rename2-and-add-RENAME_WHITEOUT-support.patch b/target/linux/generic/pending-4.19/140-jffs2-use-.rename2-and-add-RENAME_WHITEOUT-support.patch deleted file mode 100644 index c97e93250b..0000000000 --- a/target/linux/generic/pending-4.19/140-jffs2-use-.rename2-and-add-RENAME_WHITEOUT-support.patch +++ /dev/null @@ -1,62 +0,0 @@ -From: Felix Fietkau -Subject: jffs2: use .rename2 and add RENAME_WHITEOUT support - -It is required for renames on overlayfs - -Signed-off-by: Felix Fietkau ---- - ---- a/fs/jffs2/dir.c -+++ b/fs/jffs2/dir.c -@@ -752,6 +752,24 @@ static int jffs2_mknod (struct inode *di - return ret; - } - -+static int jffs2_whiteout (struct inode *old_dir, struct dentry *old_dentry) -+{ -+ struct dentry *wh; -+ int err; -+ -+ wh = d_alloc(old_dentry->d_parent, &old_dentry->d_name); -+ if (!wh) -+ return -ENOMEM; -+ -+ err = jffs2_mknod(old_dir, wh, S_IFCHR | WHITEOUT_MODE, -+ WHITEOUT_DEV); -+ if (err) -+ return err; -+ -+ d_rehash(wh); -+ return 0; -+} -+ - static int jffs2_rename (struct inode *old_dir_i, struct dentry *old_dentry, - struct inode *new_dir_i, struct dentry *new_dentry, - unsigned int flags) -@@ -762,7 +780,7 @@ static int jffs2_rename (struct inode *o - uint8_t type; - uint32_t now; - -- if (flags & ~RENAME_NOREPLACE) -+ if (flags & ~(RENAME_NOREPLACE|RENAME_WHITEOUT)) - return -EINVAL; - - /* The VFS will check for us and prevent trying to rename a -@@ -828,9 +846,14 @@ static int jffs2_rename (struct inode *o - if (d_is_dir(old_dentry) && !victim_f) - inc_nlink(new_dir_i); - -- /* Unlink the original */ -- ret = jffs2_do_unlink(c, JFFS2_INODE_INFO(old_dir_i), -- old_dentry->d_name.name, old_dentry->d_name.len, NULL, now); -+ if (flags & RENAME_WHITEOUT) -+ /* Replace with whiteout */ -+ ret = jffs2_whiteout(old_dir_i, old_dentry); -+ else -+ /* Unlink the original */ -+ ret = jffs2_do_unlink(c, JFFS2_INODE_INFO(old_dir_i), -+ old_dentry->d_name.name, -+ old_dentry->d_name.len, NULL, now); - - /* We don't touch inode->i_nlink */ - diff --git a/target/linux/generic/pending-4.19/141-jffs2-add-RENAME_EXCHANGE-support.patch b/target/linux/generic/pending-4.19/141-jffs2-add-RENAME_EXCHANGE-support.patch deleted file mode 100644 index 093a73ab66..0000000000 --- a/target/linux/generic/pending-4.19/141-jffs2-add-RENAME_EXCHANGE-support.patch +++ /dev/null @@ -1,73 +0,0 @@ -From: Felix Fietkau -Subject: jffs2: add RENAME_EXCHANGE support - -Signed-off-by: Felix Fietkau ---- - ---- a/fs/jffs2/dir.c -+++ b/fs/jffs2/dir.c -@@ -777,18 +777,31 @@ static int jffs2_rename (struct inode *o - int ret; - struct jffs2_sb_info *c = JFFS2_SB_INFO(old_dir_i->i_sb); - struct jffs2_inode_info *victim_f = NULL; -+ struct inode *fst_inode = d_inode(old_dentry); -+ struct inode *snd_inode = d_inode(new_dentry); - uint8_t type; - uint32_t now; - -- if (flags & ~(RENAME_NOREPLACE|RENAME_WHITEOUT)) -+ if (flags & ~(RENAME_NOREPLACE|RENAME_WHITEOUT|RENAME_EXCHANGE)) - return -EINVAL; - -+ if ((flags & RENAME_EXCHANGE) && (old_dir_i != new_dir_i)) { -+ if (S_ISDIR(fst_inode->i_mode) && !S_ISDIR(snd_inode->i_mode)) { -+ inc_nlink(new_dir_i); -+ drop_nlink(old_dir_i); -+ } -+ else if (!S_ISDIR(fst_inode->i_mode) && S_ISDIR(snd_inode->i_mode)) { -+ drop_nlink(new_dir_i); -+ inc_nlink(old_dir_i); -+ } -+ } -+ - /* The VFS will check for us and prevent trying to rename a - * file over a directory and vice versa, but if it's a directory, - * the VFS can't check whether the victim is empty. The filesystem - * needs to do that for itself. - */ -- if (d_really_is_positive(new_dentry)) { -+ if (d_really_is_positive(new_dentry) && !(flags & RENAME_EXCHANGE)) { - victim_f = JFFS2_INODE_INFO(d_inode(new_dentry)); - if (d_is_dir(new_dentry)) { - struct jffs2_full_dirent *fd; -@@ -823,7 +836,7 @@ static int jffs2_rename (struct inode *o - if (ret) - return ret; - -- if (victim_f) { -+ if (victim_f && !(flags & RENAME_EXCHANGE)) { - /* There was a victim. Kill it off nicely */ - if (d_is_dir(new_dentry)) - clear_nlink(d_inode(new_dentry)); -@@ -849,6 +862,12 @@ static int jffs2_rename (struct inode *o - if (flags & RENAME_WHITEOUT) - /* Replace with whiteout */ - ret = jffs2_whiteout(old_dir_i, old_dentry); -+ else if (flags & RENAME_EXCHANGE) -+ /* Replace the original */ -+ ret = jffs2_do_link(c, JFFS2_INODE_INFO(old_dir_i), -+ d_inode(new_dentry)->i_ino, type, -+ old_dentry->d_name.name, old_dentry->d_name.len, -+ now); - else - /* Unlink the original */ - ret = jffs2_do_unlink(c, JFFS2_INODE_INFO(old_dir_i), -@@ -880,7 +899,7 @@ static int jffs2_rename (struct inode *o - return ret; - } - -- if (d_is_dir(old_dentry)) -+ if (d_is_dir(old_dentry) && !(flags & RENAME_EXCHANGE)) - drop_nlink(old_dir_i); - - new_dir_i->i_mtime = new_dir_i->i_ctime = old_dir_i->i_mtime = old_dir_i->i_ctime = ITIME(now); diff --git a/target/linux/generic/pending-4.19/150-bridge_allow_receiption_on_disabled_port.patch b/target/linux/generic/pending-4.19/150-bridge_allow_receiption_on_disabled_port.patch deleted file mode 100644 index c8e68c2c96..0000000000 --- a/target/linux/generic/pending-4.19/150-bridge_allow_receiption_on_disabled_port.patch +++ /dev/null @@ -1,43 +0,0 @@ -From: Stephen Hemminger -Subject: bridge: allow receiption on disabled port - -When an ethernet device is enslaved to a bridge, and the bridge STP -detects loss of carrier (or operational state down), then normally -packet receiption is blocked. - -This breaks control applications like WPA which maybe expecting to -receive packets to negotiate to bring link up. The bridge needs to -block forwarding packets from these disabled ports, but there is no -hard requirement to not allow local packet delivery. - -Signed-off-by: Stephen Hemminger -Signed-off-by: Felix Fietkau - ---- a/net/bridge/br_input.c -+++ b/net/bridge/br_input.c -@@ -197,7 +197,8 @@ static int br_handle_local_finish(struct - { - struct net_bridge_port *p = br_port_get_rcu(skb->dev); - -- __br_handle_local_finish(skb); -+ if (p->state != BR_STATE_DISABLED) -+ __br_handle_local_finish(skb); - - BR_INPUT_SKB_CB(skb)->brdev = p->br->dev; - br_pass_frame_up(skb); -@@ -286,6 +287,15 @@ rx_handler_result_t br_handle_frame(stru - - forward: - switch (p->state) { -+ case BR_STATE_DISABLED: -+ if (ether_addr_equal(p->br->dev->dev_addr, dest)) -+ skb->pkt_type = PACKET_HOST; -+ -+ NF_HOOK(NFPROTO_BRIDGE, NF_BR_PRE_ROUTING, -+ dev_net(skb->dev), NULL, skb, skb->dev, NULL, -+ br_handle_local_finish); -+ break; -+ - case BR_STATE_FORWARDING: - rhook = rcu_dereference(br_should_route_hook); - if (rhook) { diff --git a/target/linux/generic/pending-4.19/180-net-phy-at803x-add-support-for-AT8032.patch b/target/linux/generic/pending-4.19/180-net-phy-at803x-add-support-for-AT8032.patch deleted file mode 100644 index e496301e4e..0000000000 --- a/target/linux/generic/pending-4.19/180-net-phy-at803x-add-support-for-AT8032.patch +++ /dev/null @@ -1,63 +0,0 @@ -From: Felix Fietkau -Subject: net: phy: at803x: add support for AT8032 - -Like AT8030, this PHY needs the GPIO reset workaround - -Signed-off-by: Felix Fietkau ---- - ---- a/drivers/net/phy/at803x.c -+++ b/drivers/net/phy/at803x.c -@@ -62,8 +62,10 @@ - - #define ATH8030_PHY_ID 0x004dd076 - #define ATH8031_PHY_ID 0x004dd074 -+#define ATH8032_PHY_ID 0x004dd023 - #define ATH8035_PHY_ID 0x004dd072 - #define AT803X_PHY_ID_MASK 0xffffffef -+#define AT8032_PHY_ID_MASK 0xffffffff - - MODULE_DESCRIPTION("Atheros 803x PHY driver"); - MODULE_AUTHOR("Matus Ujhelyi"); -@@ -308,7 +310,7 @@ static void at803x_link_change_notify(st - struct at803x_priv *priv = phydev->priv; - - /* -- * Conduct a hardware reset for AT8030 every time a link loss is -+ * Conduct a hardware reset for AT8030/2 every time a link loss is - * signalled. This is necessary to circumvent a hardware bug that - * occurs when the cable is unplugged while TX packets are pending - * in the FIFO. In such cases, the FIFO enters an error mode it -@@ -414,6 +416,24 @@ static struct phy_driver at803x_driver[] - .aneg_done = at803x_aneg_done, - .ack_interrupt = &at803x_ack_interrupt, - .config_intr = &at803x_config_intr, -+}, { -+ /* ATHEROS 8032 */ -+ .phy_id = ATH8032_PHY_ID, -+ .name = "Atheros 8032 ethernet", -+ .phy_id_mask = AT8032_PHY_ID_MASK, -+ .probe = at803x_probe, -+ .config_init = at803x_config_init, -+ .link_change_notify = at803x_link_change_notify, -+ .set_wol = at803x_set_wol, -+ .get_wol = at803x_get_wol, -+ .suspend = at803x_suspend, -+ .resume = at803x_resume, -+ .features = PHY_BASIC_FEATURES, -+ .flags = PHY_HAS_INTERRUPT, -+ .config_aneg = genphy_config_aneg, -+ .read_status = genphy_read_status, -+ .ack_interrupt = at803x_ack_interrupt, -+ .config_intr = at803x_config_intr, - } }; - - module_phy_driver(at803x_driver); -@@ -421,6 +441,7 @@ module_phy_driver(at803x_driver); - static struct mdio_device_id __maybe_unused atheros_tbl[] = { - { ATH8030_PHY_ID, AT803X_PHY_ID_MASK }, - { ATH8031_PHY_ID, AT803X_PHY_ID_MASK }, -+ { ATH8032_PHY_ID, AT8032_PHY_ID_MASK }, - { ATH8035_PHY_ID, AT803X_PHY_ID_MASK }, - { } - }; diff --git a/target/linux/generic/pending-4.19/201-extra_optimization.patch b/target/linux/generic/pending-4.19/201-extra_optimization.patch deleted file mode 100644 index d86e29fc75..0000000000 --- a/target/linux/generic/pending-4.19/201-extra_optimization.patch +++ /dev/null @@ -1,32 +0,0 @@ -From: Felix Fietkau -Subject: Upgrade to Linux 2.6.19 - -- Includes large parts of the patch from #1021 by dpalffy -- Includes RB532 NAND driver changes by n0-1 - -[john@phrozen.org: feix will add this to his upstream queue] - -lede-commit: bff468813f78f81e36ebb2a3f4354de7365e640f -Signed-off-by: Felix Fietkau ---- - Makefile | 6 +++--- - 1 file changed, 3 insertions(+), 3 deletions(-) - ---- a/Makefile -+++ b/Makefile -@@ -659,12 +659,12 @@ KBUILD_CFLAGS += $(call cc-disable-warni - - ifdef CONFIG_CC_OPTIMIZE_FOR_SIZE - KBUILD_CFLAGS += $(call cc-option,-Oz,-Os) --KBUILD_CFLAGS += $(call cc-disable-warning,maybe-uninitialized,) -+KBUILD_CFLAGS += $(call cc-disable-warning,maybe-uninitialized,) $(EXTRA_OPTIMIZATION) - else - ifdef CONFIG_PROFILE_ALL_BRANCHES --KBUILD_CFLAGS += -O2 $(call cc-disable-warning,maybe-uninitialized,) -+KBUILD_CFLAGS += -O2 $(call cc-disable-warning,maybe-uninitialized,) $(EXTRA_OPTIMIZATION) - else --KBUILD_CFLAGS += -O2 -+KBUILD_CFLAGS += -O2 -fno-reorder-blocks -fno-tree-ch $(EXTRA_OPTIMIZATION) - endif - endif - diff --git a/target/linux/generic/pending-4.19/203-kallsyms_uncompressed.patch b/target/linux/generic/pending-4.19/203-kallsyms_uncompressed.patch deleted file mode 100644 index 99922e35d8..0000000000 --- a/target/linux/generic/pending-4.19/203-kallsyms_uncompressed.patch +++ /dev/null @@ -1,119 +0,0 @@ -From: Felix Fietkau -Subject: kernel: add a config option for keeping the kallsyms table uncompressed, saving ~9kb kernel size after lzma on ar71xx - -[john@phrozen.org: added to my upstream queue 30.12.2016] -lede-commit: e0e3509b5ce2ccf93d4d67ea907613f5f7ec2eed -Signed-off-by: Felix Fietkau ---- - init/Kconfig | 11 +++++++++++ - kernel/kallsyms.c | 8 ++++++++ - scripts/kallsyms.c | 12 ++++++++++++ - scripts/link-vmlinux.sh | 4 ++++ - 4 files changed, 35 insertions(+) - ---- a/init/Kconfig -+++ b/init/Kconfig -@@ -1146,6 +1146,17 @@ config SYSCTL_ARCH_UNALIGN_ALLOW - the unaligned access emulation. - see arch/parisc/kernel/unaligned.c for reference - -+config KALLSYMS_UNCOMPRESSED -+ bool "Keep kallsyms uncompressed" -+ depends on KALLSYMS -+ help -+ Normally kallsyms contains compressed symbols (using a token table), -+ reducing the uncompressed kernel image size. Keeping the symbol table -+ uncompressed significantly improves the size of this part in compressed -+ kernel images. -+ -+ Say N unless you need compressed kernel images to be small. -+ - config HAVE_PCSPKR_PLATFORM - bool - ---- a/kernel/kallsyms.c -+++ b/kernel/kallsyms.c -@@ -74,6 +74,11 @@ static unsigned int kallsyms_expand_symb - * For every byte on the compressed symbol data, copy the table - * entry for that byte. - */ -+#ifdef CONFIG_KALLSYMS_UNCOMPRESSED -+ memcpy(result, data + 1, len - 1); -+ result += len - 1; -+ len = 0; -+#endif - while (len) { - tptr = &kallsyms_token_table[kallsyms_token_index[*data]]; - data++; -@@ -106,6 +111,9 @@ tail: - */ - static char kallsyms_get_symbol_type(unsigned int off) - { -+#ifdef CONFIG_KALLSYMS_UNCOMPRESSED -+ return kallsyms_names[off + 1]; -+#endif - /* - * Get just the first code, look it up in the token table, - * and return the first char from this token. ---- a/scripts/kallsyms.c -+++ b/scripts/kallsyms.c -@@ -61,6 +61,7 @@ static struct addr_range percpu_range = - static struct sym_entry *table; - static unsigned int table_size, table_cnt; - static int all_symbols = 0; -+static int uncompressed = 0; - static int absolute_percpu = 0; - static int base_relative = 0; - -@@ -439,6 +440,9 @@ static void write_src(void) - - free(markers); - -+ if (uncompressed) -+ return; -+ - output_label("kallsyms_token_table"); - off = 0; - for (i = 0; i < 256; i++) { -@@ -497,6 +501,9 @@ static void *find_token(unsigned char *s - { - int i; - -+ if (uncompressed) -+ return NULL; -+ - for (i = 0; i < len - 1; i++) { - if (str[i] == token[0] && str[i+1] == token[1]) - return &str[i]; -@@ -569,6 +576,9 @@ static void optimize_result(void) - { - int i, best; - -+ if (uncompressed) -+ return; -+ - /* using the '\0' symbol last allows compress_symbols to use standard - * fast string functions */ - for (i = 255; i >= 0; i--) { -@@ -751,6 +761,8 @@ int main(int argc, char **argv) - absolute_percpu = 1; - else if (strcmp(argv[i], "--base-relative") == 0) - base_relative = 1; -+ else if (strcmp(argv[i], "--uncompressed") == 0) -+ uncompressed = 1; - else - usage(); - } ---- a/scripts/link-vmlinux.sh -+++ b/scripts/link-vmlinux.sh -@@ -133,6 +133,10 @@ kallsyms() - kallsymopt="${kallsymopt} --base-relative" - fi - -+ if [ -n "${CONFIG_KALLSYMS_UNCOMPRESSED}" ]; then -+ kallsymopt="${kallsymopt} --uncompressed" -+ fi -+ - local aflags="${KBUILD_AFLAGS} ${KBUILD_AFLAGS_KERNEL} \ - ${NOSTDINC_FLAGS} ${LINUXINCLUDE} ${KBUILD_CPPFLAGS}" - diff --git a/target/linux/generic/pending-4.19/205-backtrace_module_info.patch b/target/linux/generic/pending-4.19/205-backtrace_module_info.patch deleted file mode 100644 index 5671173d45..0000000000 --- a/target/linux/generic/pending-4.19/205-backtrace_module_info.patch +++ /dev/null @@ -1,45 +0,0 @@ -From: Felix Fietkau -Subject: kernel: when KALLSYMS is disabled, print module address + size for matching backtrace entries - -[john@phrozen.org: felix will add this to his upstream queue] - -lede-commit 53827cdc824556cda910b23ce5030c363b8f1461 -Signed-off-by: Felix Fietkau ---- - lib/vsprintf.c | 15 +++++++++++---- - 1 file changed, 11 insertions(+), 4 deletions(-) - ---- a/lib/vsprintf.c -+++ b/lib/vsprintf.c -@@ -681,8 +681,10 @@ char *symbol_string(char *buf, char *end - struct printf_spec spec, const char *fmt) - { - unsigned long value; --#ifdef CONFIG_KALLSYMS - char sym[KSYM_SYMBOL_LEN]; -+#ifndef CONFIG_KALLSYMS -+ struct module *mod; -+ int len; - #endif - - if (fmt[1] == 'R') -@@ -696,11 +698,16 @@ char *symbol_string(char *buf, char *end - sprint_symbol(sym, value); - else - sprint_symbol_no_offset(sym, value); -- -- return string(buf, end, sym, spec); - #else -- return special_hex_number(buf, end, value, sizeof(void *)); -+ len = snprintf(sym, sizeof(sym), "0x%lx", value); -+ -+ mod = __module_address(value); -+ if (mod) -+ snprintf(sym + len, sizeof(sym) - len, " [%s@%p+0x%x]", -+ mod->name, mod->core_layout.base, -+ mod->core_layout.size); - #endif -+ return string(buf, end, sym, spec); - } - - static const struct printf_spec default_str_spec = { diff --git a/target/linux/generic/pending-4.19/220-optimize_inlining.patch b/target/linux/generic/pending-4.19/220-optimize_inlining.patch deleted file mode 100644 index 1411586086..0000000000 --- a/target/linux/generic/pending-4.19/220-optimize_inlining.patch +++ /dev/null @@ -1,70 +0,0 @@ ---- a/arch/x86/Kconfig.debug -+++ b/arch/x86/Kconfig.debug -@@ -276,20 +276,6 @@ config CPA_DEBUG - ---help--- - Do change_page_attr() self-tests every 30 seconds. - --config OPTIMIZE_INLINING -- bool "Allow gcc to uninline functions marked 'inline'" -- ---help--- -- This option determines if the kernel forces gcc to inline the functions -- developers have marked 'inline'. Doing so takes away freedom from gcc to -- do what it thinks is best, which is desirable for the gcc 3.x series of -- compilers. The gcc 4.x series have a rewritten inlining algorithm and -- enabling this option will generate a smaller kernel there. Hopefully -- this algorithm is so good that allowing gcc 4.x and above to make the -- decision will become the default in the future. Until then this option -- is there to test gcc for this. -- -- If unsure, say N. -- - config DEBUG_ENTRY - bool "Debug low-level entry code" - depends on DEBUG_KERNEL ---- a/lib/Kconfig.debug -+++ b/lib/Kconfig.debug -@@ -150,6 +150,20 @@ endmenu # "printk and dmesg options" - - menu "Compile-time checks and compiler options" - -+config OPTIMIZE_INLINING -+ bool "Allow gcc to uninline functions marked 'inline'" -+ ---help--- -+ This option determines if the kernel forces gcc to inline the functions -+ developers have marked 'inline'. Doing so takes away freedom from gcc to -+ do what it thinks is best, which is desirable for the gcc 3.x series of -+ compilers. The gcc 4.x series have a rewritten inlining algorithm and -+ enabling this option will generate a smaller kernel there. Hopefully -+ this algorithm is so good that allowing gcc 4.x and above to make the -+ decision will become the default in the future. Until then this option -+ is there to test gcc for this. -+ -+ If unsure, say N. -+ - config DEBUG_INFO - bool "Compile the kernel with debug info" - depends on DEBUG_KERNEL && !COMPILE_TEST ---- a/arch/x86/Kconfig -+++ b/arch/x86/Kconfig -@@ -306,9 +306,6 @@ config ZONE_DMA32 - config AUDIT_ARCH - def_bool y if X86_64 - --config ARCH_SUPPORTS_OPTIMIZED_INLINING -- def_bool y -- - config ARCH_SUPPORTS_DEBUG_PAGEALLOC - def_bool y - ---- a/include/linux/compiler_types.h -+++ b/include/linux/compiler_types.h -@@ -260,8 +260,7 @@ struct ftrace_likely_data { - * of extern inline functions at link time. - * A lot of inline functions can cause havoc with function tracing. - */ --#if !defined(CONFIG_ARCH_SUPPORTS_OPTIMIZED_INLINING) || \ -- !defined(CONFIG_OPTIMIZE_INLINING) -+#if !defined(CONFIG_OPTIMIZE_INLINING) - #define inline \ - inline __attribute__((always_inline, unused)) notrace __gnu_inline - #else diff --git a/target/linux/generic/pending-4.19/240-remove-unsane-filenames-from-deps_initramfs-list.patch b/target/linux/generic/pending-4.19/240-remove-unsane-filenames-from-deps_initramfs-list.patch deleted file mode 100644 index 8836031c20..0000000000 --- a/target/linux/generic/pending-4.19/240-remove-unsane-filenames-from-deps_initramfs-list.patch +++ /dev/null @@ -1,46 +0,0 @@ -From: Gabor Juhos -Subject: usr: sanitize deps_initramfs list - -If any filename in the intramfs dependency -list contains a colon, that causes a kernel -build error like this: - -/devel/librecmc/build_dir/linux-ar71xx_generic/linux-3.6.6/usr/Makefile:58: *** multiple target patterns. Stop. -make[5]: *** [usr] Error 2 - -Fix it by removing such filenames from the -deps_initramfs list. - -Signed-off-by: Gabor Juhos ---- - usr/Makefile | 8 +++++--- - 1 file changed, 5 insertions(+), 3 deletions(-) - ---- a/usr/Makefile -+++ b/usr/Makefile -@@ -39,20 +39,22 @@ ifneq ($(wildcard $(obj)/$(datafile_d_y) - include $(obj)/$(datafile_d_y) - endif - -+deps_initramfs_sane := $(foreach v,$(deps_initramfs),$(if $(findstring :,$(v)),,$(v))) -+ - quiet_cmd_initfs = GEN $@ - cmd_initfs = $(initramfs) -o $@ $(ramfs-args) $(ramfs-input) - - targets := $(datafile_y) - - # do not try to update files included in initramfs --$(deps_initramfs): ; -+$(deps_initramfs_sane): ; - --$(deps_initramfs): klibcdirs -+$(deps_initramfs_sane): klibcdirs - # We rebuild initramfs_data.cpio if: - # 1) Any included file is newer then initramfs_data.cpio - # 2) There are changes in which files are included (added or deleted) - # 3) If gen_init_cpio are newer than initramfs_data.cpio - # 4) arguments to gen_initramfs.sh changes --$(obj)/$(datafile_y): $(obj)/gen_init_cpio $(deps_initramfs) klibcdirs -+$(obj)/$(datafile_y): $(obj)/gen_init_cpio $(deps_initramfs_sane) klibcdirs - $(Q)$(initramfs) -l $(ramfs-input) > $(obj)/$(datafile_d_y) - $(call if_changed,initfs) diff --git a/target/linux/generic/pending-4.19/261-enable_wilink_platform_without_drivers.patch b/target/linux/generic/pending-4.19/261-enable_wilink_platform_without_drivers.patch deleted file mode 100644 index 9955ab3c0b..0000000000 --- a/target/linux/generic/pending-4.19/261-enable_wilink_platform_without_drivers.patch +++ /dev/null @@ -1,20 +0,0 @@ -From: Imre Kaloz -Subject: [PATCH] hack: net: wireless: make the wl12xx glue code available with - compat-wireless, too - -Signed-off-by: Imre Kaloz ---- - drivers/net/wireless/ti/Kconfig | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - ---- a/drivers/net/wireless/ti/Kconfig -+++ b/drivers/net/wireless/ti/Kconfig -@@ -19,7 +19,7 @@ source "drivers/net/wireless/ti/wlcore/K - - config WILINK_PLATFORM_DATA - bool "TI WiLink platform data" -- depends on WLCORE_SDIO || WL1251_SDIO -+ depends on WLCORE_SDIO || WL1251_SDIO || ARCH_OMAP2PLUS - default y - ---help--- - Small platform data bit needed to pass data to the sdio modules. diff --git a/target/linux/generic/pending-4.19/300-mips_expose_boot_raw.patch b/target/linux/generic/pending-4.19/300-mips_expose_boot_raw.patch deleted file mode 100644 index 5d10cae86c..0000000000 --- a/target/linux/generic/pending-4.19/300-mips_expose_boot_raw.patch +++ /dev/null @@ -1,40 +0,0 @@ -From: Mark Miller -Subject: mips: expose CONFIG_BOOT_RAW - -This exposes the CONFIG_BOOT_RAW symbol in Kconfig. This is needed on -certain Broadcom chipsets running CFE in order to load the kernel. - -Signed-off-by: Mark Miller -Acked-by: Rob Landley ---- ---- a/arch/mips/Kconfig -+++ b/arch/mips/Kconfig -@@ -1062,9 +1062,6 @@ config FW_ARC - config ARCH_MAY_HAVE_PC_FDC - bool - --config BOOT_RAW -- bool -- - config CEVT_BCM1480 - bool - -@@ -2968,6 +2965,18 @@ choice - bool "Extend builtin kernel arguments with bootloader arguments" - endchoice - -+config BOOT_RAW -+ bool "Enable the kernel to be executed from the load address" -+ default n -+ help -+ Allow the kernel to be executed from the load address for -+ bootloaders which cannot read the ELF format. This places -+ a jump to start_kernel at the load address. -+ -+ If unsure, say N. -+ -+ -+ - endmenu - - config LOCKDEP_SUPPORT diff --git a/target/linux/generic/pending-4.19/302-mips_no_branch_likely.patch b/target/linux/generic/pending-4.19/302-mips_no_branch_likely.patch deleted file mode 100644 index 0e4600237d..0000000000 --- a/target/linux/generic/pending-4.19/302-mips_no_branch_likely.patch +++ /dev/null @@ -1,22 +0,0 @@ -From: Felix Fietkau -Subject: mips: use -mno-branch-likely for kernel and userspace - -saves ~11k kernel size after lzma and ~12k squashfs size in the - -lede-commit: 41a039f46450ffae9483d6216422098669da2900 -Signed-off-by: Felix Fietkau ---- - arch/mips/Makefile | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - ---- a/arch/mips/Makefile -+++ b/arch/mips/Makefile -@@ -90,7 +90,7 @@ all-$(CONFIG_SYS_SUPPORTS_ZBOOT)+= vmlin - # machines may also. Since BFD is incredibly buggy with respect to - # crossformat linking we rely on the elf2ecoff tool for format conversion. - # --cflags-y += -G 0 -mno-abicalls -fno-pic -pipe -+cflags-y += -G 0 -mno-abicalls -fno-pic -pipe -mno-branch-likely - cflags-y += -msoft-float - LDFLAGS_vmlinux += -G 0 -static -n -nostdlib - KBUILD_AFLAGS_MODULE += -mlong-calls diff --git a/target/linux/generic/pending-4.19/304-mips_disable_fpu.patch b/target/linux/generic/pending-4.19/304-mips_disable_fpu.patch deleted file mode 100644 index 6e71c68dc5..0000000000 --- a/target/linux/generic/pending-4.19/304-mips_disable_fpu.patch +++ /dev/null @@ -1,137 +0,0 @@ -From: Manuel Lauss -Subject: [RFC PATCH v4 2/2] MIPS: make FPU emulator optional - -This small patch makes the MIPS FPU emulator optional. The kernel -kills float-users on systems without a hardware FPU by sending a SIGILL. - -Disabling the emulator shrinks vmlinux by about 54kBytes (32bit, -optimizing for size). - -Signed-off-by: Manuel Lauss ---- -v4: rediffed because of patch 1/2, should now work with micromips as well -v3: updated patch description with size savings. -v2: incorporated changes suggested by Jonas Gorski - force the fpu emulator on for micromips: relocating the parts - of the mmips code in the emulator to other areas would be a - much larger change; I went the cheap route instead with this. - - arch/mips/Kbuild | 2 +- - arch/mips/Kconfig | 14 ++++++++++++++ - arch/mips/include/asm/fpu.h | 5 +++-- - arch/mips/include/asm/fpu_emulator.h | 15 +++++++++++++++ - 4 files changed, 33 insertions(+), 3 deletions(-) - ---- a/arch/mips/Kconfig -+++ b/arch/mips/Kconfig -@@ -2892,6 +2892,20 @@ config MIPS_O32_FP64_SUPPORT - - If unsure, say N. - -+config MIPS_FPU_EMULATOR -+ bool "MIPS FPU Emulator" -+ default y -+ help -+ This option lets you disable the built-in MIPS FPU (Coprocessor 1) -+ emulator, which handles floating-point instructions on processors -+ without a hardware FPU. It is generally a good idea to keep the -+ emulator built-in, unless you are perfectly sure you have a -+ complete soft-float environment. With the emulator disabled, all -+ users of float operations will be killed with an illegal instr- -+ uction exception. -+ -+ Say Y, please. -+ - config USE_OF - bool - select OF ---- a/arch/mips/Makefile -+++ b/arch/mips/Makefile -@@ -322,7 +322,7 @@ OBJCOPYFLAGS += --remove-section=.regin - head-y := arch/mips/kernel/head.o - - libs-y += arch/mips/lib/ --libs-y += arch/mips/math-emu/ -+libs-$(CONFIG_MIPS_FPU_EMULATOR) += arch/mips/math-emu/ - - # See arch/mips/Kbuild for content of core part of the kernel - core-y += arch/mips/ ---- a/arch/mips/include/asm/fpu.h -+++ b/arch/mips/include/asm/fpu.h -@@ -230,8 +230,10 @@ static inline int init_fpu(void) - /* Restore FRE */ - write_c0_config5(config5); - enable_fpu_hazard(); -- } else -+ } else if (IS_ENABLED(CONFIG_MIPS_FPU_EMULATOR)) - fpu_emulator_init_fpu(); -+ else -+ ret = SIGILL; - - return ret; - } ---- a/arch/mips/include/asm/fpu_emulator.h -+++ b/arch/mips/include/asm/fpu_emulator.h -@@ -30,6 +30,7 @@ - #include - #include - -+#ifdef CONFIG_MIPS_FPU_EMULATOR - #ifdef CONFIG_DEBUG_FS - - struct mips_fpu_emulator_stats { -@@ -179,6 +180,16 @@ do { \ - extern int fpu_emulator_cop1Handler(struct pt_regs *xcp, - struct mips_fpu_struct *ctx, int has_fpu, - void __user **fault_addr); -+#else /* no CONFIG_MIPS_FPU_EMULATOR */ -+static inline int fpu_emulator_cop1Handler(struct pt_regs *xcp, -+ struct mips_fpu_struct *ctx, int has_fpu, -+ void __user **fault_addr) -+{ -+ *fault_addr = NULL; -+ return SIGILL; /* we don't speak MIPS FPU */ -+} -+#endif /* CONFIG_MIPS_FPU_EMULATOR */ -+ - void force_fcr31_sig(unsigned long fcr31, void __user *fault_addr, - struct task_struct *tsk); - int process_fpemu_return(int sig, void __user *fault_addr, ---- a/arch/mips/include/asm/dsemul.h -+++ b/arch/mips/include/asm/dsemul.h -@@ -41,6 +41,7 @@ struct task_struct; - extern int mips_dsemul(struct pt_regs *regs, mips_instruction ir, - unsigned long branch_pc, unsigned long cont_pc); - -+#ifdef CONFIG_MIPS_FPU_EMULATOR - /** - * do_dsemulret() - Return from a delay slot 'emulation' frame - * @xcp: User thread register context. -@@ -88,5 +89,27 @@ extern bool dsemul_thread_rollback(struc - * before @mm is freed in order to avoid memory leaks. - */ - extern void dsemul_mm_cleanup(struct mm_struct *mm); -+#else -+static inline bool do_dsemulret(struct pt_regs *xcp) -+{ -+ return false; -+} -+ -+static inline bool dsemul_thread_cleanup(struct task_struct *tsk) -+{ -+ return false; -+} -+ -+static inline bool dsemul_thread_rollback(struct pt_regs *regs) -+{ -+ return false; -+} -+ -+static inline void dsemul_mm_cleanup(struct mm_struct *mm) -+{ -+ -+} -+ -+#endif - - #endif /* __MIPS_ASM_DSEMUL_H__ */ diff --git a/target/linux/generic/pending-4.19/305-mips_module_reloc.patch b/target/linux/generic/pending-4.19/305-mips_module_reloc.patch deleted file mode 100644 index 253b50f62c..0000000000 --- a/target/linux/generic/pending-4.19/305-mips_module_reloc.patch +++ /dev/null @@ -1,366 +0,0 @@ -From: Felix Fietkau -Subject: mips: replace -mlong-calls with -mno-long-calls to make function calls faster in kernel modules to achieve this, try to - -lede-commit: 3b3d64743ba2a874df9d70cd19e242205b0a788c -Signed-off-by: Felix Fietkau ---- - arch/mips/Makefile | 5 + - arch/mips/include/asm/module.h | 5 + - arch/mips/kernel/module.c | 279 ++++++++++++++++++++++++++++++++++++++++- - 3 files changed, 284 insertions(+), 5 deletions(-) - ---- a/arch/mips/Makefile -+++ b/arch/mips/Makefile -@@ -93,8 +93,13 @@ all-$(CONFIG_SYS_SUPPORTS_ZBOOT)+= vmlin - cflags-y += -G 0 -mno-abicalls -fno-pic -pipe -mno-branch-likely - cflags-y += -msoft-float - LDFLAGS_vmlinux += -G 0 -static -n -nostdlib -+ifdef CONFIG_64BIT - KBUILD_AFLAGS_MODULE += -mlong-calls - KBUILD_CFLAGS_MODULE += -mlong-calls -+else -+KBUILD_AFLAGS_MODULE += -mno-long-calls -+KBUILD_CFLAGS_MODULE += -mno-long-calls -+endif - - ifeq ($(CONFIG_RELOCATABLE),y) - LDFLAGS_vmlinux += --emit-relocs ---- a/arch/mips/include/asm/module.h -+++ b/arch/mips/include/asm/module.h -@@ -12,6 +12,11 @@ struct mod_arch_specific { - const struct exception_table_entry *dbe_start; - const struct exception_table_entry *dbe_end; - struct mips_hi16 *r_mips_hi16_list; -+ -+ void *phys_plt_tbl; -+ void *virt_plt_tbl; -+ unsigned int phys_plt_offset; -+ unsigned int virt_plt_offset; - }; - - typedef uint8_t Elf64_Byte; /* Type for a 8-bit quantity. */ ---- a/arch/mips/kernel/module.c -+++ b/arch/mips/kernel/module.c -@@ -44,14 +44,221 @@ struct mips_hi16 { - static LIST_HEAD(dbe_list); - static DEFINE_SPINLOCK(dbe_lock); - --#ifdef MODULE_START -+/* -+ * Get the potential max trampolines size required of the init and -+ * non-init sections. Only used if we cannot find enough contiguous -+ * physically mapped memory to put the module into. -+ */ -+static unsigned int -+get_plt_size(const Elf_Ehdr *hdr, const Elf_Shdr *sechdrs, -+ const char *secstrings, unsigned int symindex, bool is_init) -+{ -+ unsigned long ret = 0; -+ unsigned int i, j; -+ Elf_Sym *syms; -+ -+ /* Everything marked ALLOC (this includes the exported symbols) */ -+ for (i = 1; i < hdr->e_shnum; ++i) { -+ unsigned int info = sechdrs[i].sh_info; -+ -+ if (sechdrs[i].sh_type != SHT_REL -+ && sechdrs[i].sh_type != SHT_RELA) -+ continue; -+ -+ /* Not a valid relocation section? */ -+ if (info >= hdr->e_shnum) -+ continue; -+ -+ /* Don't bother with non-allocated sections */ -+ if (!(sechdrs[info].sh_flags & SHF_ALLOC)) -+ continue; -+ -+ /* If it's called *.init*, and we're not init, we're -+ not interested */ -+ if ((strstr(secstrings + sechdrs[i].sh_name, ".init") != 0) -+ != is_init) -+ continue; -+ -+ syms = (Elf_Sym *) sechdrs[symindex].sh_addr; -+ if (sechdrs[i].sh_type == SHT_REL) { -+ Elf_Mips_Rel *rel = (void *) sechdrs[i].sh_addr; -+ unsigned int size = sechdrs[i].sh_size / sizeof(*rel); -+ -+ for (j = 0; j < size; ++j) { -+ Elf_Sym *sym; -+ -+ if (ELF_MIPS_R_TYPE(rel[j]) != R_MIPS_26) -+ continue; -+ -+ sym = syms + ELF_MIPS_R_SYM(rel[j]); -+ if (!is_init && sym->st_shndx != SHN_UNDEF) -+ continue; -+ -+ ret += 4 * sizeof(int); -+ } -+ } else { -+ Elf_Mips_Rela *rela = (void *) sechdrs[i].sh_addr; -+ unsigned int size = sechdrs[i].sh_size / sizeof(*rela); -+ -+ for (j = 0; j < size; ++j) { -+ Elf_Sym *sym; -+ -+ if (ELF_MIPS_R_TYPE(rela[j]) != R_MIPS_26) -+ continue; -+ -+ sym = syms + ELF_MIPS_R_SYM(rela[j]); -+ if (!is_init && sym->st_shndx != SHN_UNDEF) -+ continue; -+ -+ ret += 4 * sizeof(int); -+ } -+ } -+ } -+ -+ return ret; -+} -+ -+#ifndef MODULE_START -+static void *alloc_phys(unsigned long size) -+{ -+ unsigned order; -+ struct page *page; -+ struct page *p; -+ -+ size = PAGE_ALIGN(size); -+ order = get_order(size); -+ -+ page = alloc_pages(GFP_KERNEL | __GFP_NORETRY | __GFP_NOWARN | -+ __GFP_THISNODE, order); -+ if (!page) -+ return NULL; -+ -+ split_page(page, order); -+ -+ /* mark all pages except for the last one */ -+ for (p = page; p + 1 < page + (size >> PAGE_SHIFT); ++p) -+ set_bit(PG_owner_priv_1, &p->flags); -+ -+ for (p = page + (size >> PAGE_SHIFT); p < page + (1 << order); ++p) -+ __free_page(p); -+ -+ return page_address(page); -+} -+#endif -+ -+static void free_phys(void *ptr) -+{ -+ struct page *page; -+ bool free; -+ -+ page = virt_to_page(ptr); -+ do { -+ free = test_and_clear_bit(PG_owner_priv_1, &page->flags); -+ __free_page(page); -+ page++; -+ } while (free); -+} -+ -+ - void *module_alloc(unsigned long size) - { -+#ifdef MODULE_START - return __vmalloc_node_range(size, 1, MODULE_START, MODULE_END, - GFP_KERNEL, PAGE_KERNEL, 0, NUMA_NO_NODE, - __builtin_return_address(0)); -+#else -+ void *ptr; -+ -+ if (size == 0) -+ return NULL; -+ -+ ptr = alloc_phys(size); -+ -+ /* If we failed to allocate physically contiguous memory, -+ * fall back to regular vmalloc. The module loader code will -+ * create jump tables to handle long jumps */ -+ if (!ptr) -+ return vmalloc(size); -+ -+ return ptr; -+#endif - } -+ -+static inline bool is_phys_addr(void *ptr) -+{ -+#ifdef CONFIG_64BIT -+ return (KSEGX((unsigned long)ptr) == CKSEG0); -+#else -+ return (KSEGX(ptr) == KSEG0); - #endif -+} -+ -+/* Free memory returned from module_alloc */ -+void module_memfree(void *module_region) -+{ -+ if (is_phys_addr(module_region)) -+ free_phys(module_region); -+ else -+ vfree(module_region); -+} -+ -+static void *__module_alloc(int size, bool phys) -+{ -+ void *ptr; -+ -+ if (phys) -+ ptr = kmalloc(size, GFP_KERNEL); -+ else -+ ptr = vmalloc(size); -+ return ptr; -+} -+ -+static void __module_free(void *ptr) -+{ -+ if (is_phys_addr(ptr)) -+ kfree(ptr); -+ else -+ vfree(ptr); -+} -+ -+int module_frob_arch_sections(Elf_Ehdr *hdr, Elf_Shdr *sechdrs, -+ char *secstrings, struct module *mod) -+{ -+ unsigned int symindex = 0; -+ unsigned int core_size, init_size; -+ int i; -+ -+ mod->arch.phys_plt_offset = 0; -+ mod->arch.virt_plt_offset = 0; -+ mod->arch.phys_plt_tbl = NULL; -+ mod->arch.virt_plt_tbl = NULL; -+ -+ if (IS_ENABLED(CONFIG_64BIT)) -+ return 0; -+ -+ for (i = 1; i < hdr->e_shnum; i++) -+ if (sechdrs[i].sh_type == SHT_SYMTAB) -+ symindex = i; -+ -+ core_size = get_plt_size(hdr, sechdrs, secstrings, symindex, false); -+ init_size = get_plt_size(hdr, sechdrs, secstrings, symindex, true); -+ -+ if ((core_size + init_size) == 0) -+ return 0; -+ -+ mod->arch.phys_plt_tbl = __module_alloc(core_size + init_size, 1); -+ if (!mod->arch.phys_plt_tbl) -+ return -ENOMEM; -+ -+ mod->arch.virt_plt_tbl = __module_alloc(core_size + init_size, 0); -+ if (!mod->arch.virt_plt_tbl) { -+ __module_free(mod->arch.phys_plt_tbl); -+ mod->arch.phys_plt_tbl = NULL; -+ return -ENOMEM; -+ } -+ -+ return 0; -+} - - static int apply_r_mips_none(struct module *me, u32 *location, - u32 base, Elf_Addr v, bool rela) -@@ -67,9 +274,40 @@ static int apply_r_mips_32(struct module - return 0; - } - -+static Elf_Addr add_plt_entry_to(unsigned *plt_offset, -+ void *start, Elf_Addr v) -+{ -+ unsigned *tramp = start + *plt_offset; -+ *plt_offset += 4 * sizeof(int); -+ -+ /* adjust carry for addiu */ -+ if (v & 0x00008000) -+ v += 0x10000; -+ -+ tramp[0] = 0x3c190000 | (v >> 16); /* lui t9, hi16 */ -+ tramp[1] = 0x27390000 | (v & 0xffff); /* addiu t9, t9, lo16 */ -+ tramp[2] = 0x03200008; /* jr t9 */ -+ tramp[3] = 0x00000000; /* nop */ -+ -+ return (Elf_Addr) tramp; -+} -+ -+static Elf_Addr add_plt_entry(struct module *me, void *location, Elf_Addr v) -+{ -+ if (is_phys_addr(location)) -+ return add_plt_entry_to(&me->arch.phys_plt_offset, -+ me->arch.phys_plt_tbl, v); -+ else -+ return add_plt_entry_to(&me->arch.virt_plt_offset, -+ me->arch.virt_plt_tbl, v); -+ -+} -+ - static int apply_r_mips_26(struct module *me, u32 *location, - u32 base, Elf_Addr v, bool rela) - { -+ u32 ofs = base & 0x03ffffff; -+ - if (v % 4) { - pr_err("module %s: dangerous R_MIPS_26 relocation\n", - me->name); -@@ -77,13 +315,17 @@ static int apply_r_mips_26(struct module - } - - if ((v & 0xf0000000) != (((unsigned long)location + 4) & 0xf0000000)) { -- pr_err("module %s: relocation overflow\n", -- me->name); -- return -ENOEXEC; -+ v = add_plt_entry(me, location, v + (ofs << 2)); -+ if (!v) { -+ pr_err("module %s: relocation overflow\n", -+ me->name); -+ return -ENOEXEC; -+ } -+ ofs = 0; - } - - *location = (*location & ~0x03ffffff) | -- ((base + (v >> 2)) & 0x03ffffff); -+ ((ofs + (v >> 2)) & 0x03ffffff); - - return 0; - } -@@ -459,9 +701,36 @@ int module_finalize(const Elf_Ehdr *hdr, - list_add(&me->arch.dbe_list, &dbe_list); - spin_unlock_irq(&dbe_lock); - } -+ -+ /* Get rid of the fixup trampoline if we're running the module -+ * from physically mapped address space */ -+ if (me->arch.phys_plt_offset == 0) { -+ __module_free(me->arch.phys_plt_tbl); -+ me->arch.phys_plt_tbl = NULL; -+ } -+ if (me->arch.virt_plt_offset == 0) { -+ __module_free(me->arch.virt_plt_tbl); -+ me->arch.virt_plt_tbl = NULL; -+ } -+ - return 0; - } - -+void module_arch_freeing_init(struct module *mod) -+{ -+ if (mod->state == MODULE_STATE_LIVE) -+ return; -+ -+ if (mod->arch.phys_plt_tbl) { -+ __module_free(mod->arch.phys_plt_tbl); -+ mod->arch.phys_plt_tbl = NULL; -+ } -+ if (mod->arch.virt_plt_tbl) { -+ __module_free(mod->arch.virt_plt_tbl); -+ mod->arch.virt_plt_tbl = NULL; -+ } -+} -+ - void module_arch_cleanup(struct module *mod) - { - spin_lock_irq(&dbe_lock); diff --git a/target/linux/generic/pending-4.19/306-mips_mem_functions_performance.patch b/target/linux/generic/pending-4.19/306-mips_mem_functions_performance.patch deleted file mode 100644 index e73cfd61b3..0000000000 --- a/target/linux/generic/pending-4.19/306-mips_mem_functions_performance.patch +++ /dev/null @@ -1,106 +0,0 @@ -From: Felix Fietkau -Subject: [PATCH] mips: allow the compiler to optimize memset, memcmp, memcpy for better performance and (in some instances) smaller code - -lede-commit: 07e59c7bc7f375f792ec9734be42fe4fa391a8bb -Signed-off-by: Felix Fietkau ---- - arch/mips/boot/compressed/Makefile | 3 ++- - arch/mips/include/asm/string.h | 38 ++++++++++++++++++++++++++++++++++++++ - arch/mips/lib/Makefile | 2 +- - arch/mips/lib/memcmp.c | 22 ++++++++++++++++++++++ - 4 files changed, 63 insertions(+), 2 deletions(-) - create mode 100644 arch/mips/lib/memcmp.c - ---- a/arch/mips/boot/compressed/Makefile -+++ b/arch/mips/boot/compressed/Makefile -@@ -23,7 +23,8 @@ KBUILD_CFLAGS := $(filter-out -pg, $(KBU - KBUILD_CFLAGS := $(filter-out -fstack-protector, $(KBUILD_CFLAGS)) - - KBUILD_CFLAGS := $(KBUILD_CFLAGS) -D__KERNEL__ \ -- -DBOOT_HEAP_SIZE=$(BOOT_HEAP_SIZE) -D"VMLINUX_LOAD_ADDRESS_ULL=$(VMLINUX_LOAD_ADDRESS)ull" -+ -DBOOT_HEAP_SIZE=$(BOOT_HEAP_SIZE) -D"VMLINUX_LOAD_ADDRESS_ULL=$(VMLINUX_LOAD_ADDRESS)ull" \ -+ -D__ZBOOT__ - - KBUILD_AFLAGS := $(KBUILD_AFLAGS) -D__ASSEMBLY__ \ - -DBOOT_HEAP_SIZE=$(BOOT_HEAP_SIZE) \ ---- a/arch/mips/include/asm/string.h -+++ b/arch/mips/include/asm/string.h -@@ -140,4 +140,42 @@ extern void *memcpy(void *__to, __const_ - #define __HAVE_ARCH_MEMMOVE - extern void *memmove(void *__dest, __const__ void *__src, size_t __n); - -+#ifndef __ZBOOT__ -+#define memset(__s, __c, len) \ -+({ \ -+ size_t __len = (len); \ -+ void *__ret; \ -+ if (__builtin_constant_p(len) && __len >= 64) \ -+ __ret = memset((__s), (__c), __len); \ -+ else \ -+ __ret = __builtin_memset((__s), (__c), __len); \ -+ __ret; \ -+}) -+ -+#define memcpy(dst, src, len) \ -+({ \ -+ size_t __len = (len); \ -+ void *__ret; \ -+ if (__builtin_constant_p(len) && __len >= 64) \ -+ __ret = memcpy((dst), (src), __len); \ -+ else \ -+ __ret = __builtin_memcpy((dst), (src), __len); \ -+ __ret; \ -+}) -+ -+#define memmove(dst, src, len) \ -+({ \ -+ size_t __len = (len); \ -+ void *__ret; \ -+ if (__builtin_constant_p(len) && __len >= 64) \ -+ __ret = memmove((dst), (src), __len); \ -+ else \ -+ __ret = __builtin_memmove((dst), (src), __len); \ -+ __ret; \ -+}) -+ -+#define __HAVE_ARCH_MEMCMP -+#define memcmp(src1, src2, len) __builtin_memcmp((src1), (src2), (len)) -+#endif -+ - #endif /* _ASM_STRING_H */ ---- a/arch/mips/lib/Makefile -+++ b/arch/mips/lib/Makefile -@@ -5,7 +5,7 @@ - - lib-y += bitops.o csum_partial.o delay.o memcpy.o memset.o \ - mips-atomic.o strncpy_user.o \ -- strnlen_user.o uncached.o -+ strnlen_user.o uncached.o memcmp.o - - obj-y += iomap.o iomap_copy.o - obj-$(CONFIG_PCI) += iomap-pci.o ---- /dev/null -+++ b/arch/mips/lib/memcmp.c -@@ -0,0 +1,22 @@ -+/* -+ * copied from linux/lib/string.c -+ * -+ * Copyright (C) 1991, 1992 Linus Torvalds -+ */ -+ -+#include -+#include -+ -+#undef memcmp -+int memcmp(const void *cs, const void *ct, size_t count) -+{ -+ const unsigned char *su1, *su2; -+ int res = 0; -+ -+ for (su1 = cs, su2 = ct; 0 < count; ++su1, ++su2, count--) -+ if ((res = *su1 - *su2) != 0) -+ break; -+ return res; -+} -+EXPORT_SYMBOL(memcmp); -+ diff --git a/target/linux/generic/pending-4.19/307-mips_highmem_offset.patch b/target/linux/generic/pending-4.19/307-mips_highmem_offset.patch deleted file mode 100644 index 9dd2fa9863..0000000000 --- a/target/linux/generic/pending-4.19/307-mips_highmem_offset.patch +++ /dev/null @@ -1,19 +0,0 @@ -From: Felix Fietkau -Subject: kernel: adjust mips highmem offset to avoid the need for -mlong-calls on systems with >256M RAM - -Signed-off-by: Felix Fietkau ---- - arch/mips/include/asm/mach-generic/spaces.h | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - ---- a/arch/mips/include/asm/mach-generic/spaces.h -+++ b/arch/mips/include/asm/mach-generic/spaces.h -@@ -50,7 +50,7 @@ - * Memory above this physical address will be considered highmem. - */ - #ifndef HIGHMEM_START --#define HIGHMEM_START _AC(0x20000000, UL) -+#define HIGHMEM_START _AC(0x10000000, UL) - #endif - - #endif /* CONFIG_32BIT */ diff --git a/target/linux/generic/pending-4.19/308-mips32r2_tune.patch b/target/linux/generic/pending-4.19/308-mips32r2_tune.patch deleted file mode 100644 index 17c867acc5..0000000000 --- a/target/linux/generic/pending-4.19/308-mips32r2_tune.patch +++ /dev/null @@ -1,22 +0,0 @@ -From: Felix Fietkau -Subject: kernel: add -mtune=34kc to MIPS CFLAGS when building for mips32r2 - -This provides a good tradeoff across at least 24Kc-74Kc, while also -producing smaller code. - -Signed-off-by: Felix Fietkau ---- - arch/mips/Makefile | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - ---- a/arch/mips/Makefile -+++ b/arch/mips/Makefile -@@ -171,7 +171,7 @@ cflags-$(CONFIG_CPU_VR41XX) += -march=r4 - cflags-$(CONFIG_CPU_R4X00) += -march=r4600 -Wa,--trap - cflags-$(CONFIG_CPU_TX49XX) += -march=r4600 -Wa,--trap - cflags-$(CONFIG_CPU_MIPS32_R1) += -march=mips32 -Wa,--trap --cflags-$(CONFIG_CPU_MIPS32_R2) += -march=mips32r2 -Wa,--trap -+cflags-$(CONFIG_CPU_MIPS32_R2) += -march=mips32r2 -mtune=34kc -Wa,--trap - cflags-$(CONFIG_CPU_MIPS32_R6) += -march=mips32r6 -Wa,--trap -modd-spreg - cflags-$(CONFIG_CPU_MIPS64_R1) += -march=mips64 -Wa,--trap - cflags-$(CONFIG_CPU_MIPS64_R2) += -march=mips64r2 -Wa,--trap diff --git a/target/linux/generic/pending-4.19/309-MIPS-Add-CPU-option-reporting-to-proc-cpuinfo.patch b/target/linux/generic/pending-4.19/309-MIPS-Add-CPU-option-reporting-to-proc-cpuinfo.patch deleted file mode 100644 index 303654a60a..0000000000 --- a/target/linux/generic/pending-4.19/309-MIPS-Add-CPU-option-reporting-to-proc-cpuinfo.patch +++ /dev/null @@ -1,142 +0,0 @@ -From 87ec87c2ad615c1a177cd08ef5fa29fc739f6e50 Mon Sep 17 00:00:00 2001 -From: Hauke Mehrtens -Date: Sun, 23 Dec 2018 18:06:53 +0100 -Subject: [PATCH] MIPS: Add CPU option reporting to /proc/cpuinfo - -Many MIPS CPUs have optional CPU features which are not activates for -all CPU cores. Print the CPU options which are implemented in the core -in /proc/cpuinfo. This makes it possible to see what features are -supported and which are not supported. This should cover all standard -MIPS extensions, before it only printed information about the main MIPS -ASEs. - -Signed-off-by: Hauke Mehrtens ---- - arch/mips/kernel/proc.c | 116 ++++++++++++++++++++++++++++++++++++++++ - 1 file changed, 116 insertions(+) - ---- a/arch/mips/kernel/proc.c -+++ b/arch/mips/kernel/proc.c -@@ -130,6 +130,122 @@ static int show_cpuinfo(struct seq_file - seq_printf(m, "micromips kernel\t: %s\n", - (read_c0_config3() & MIPS_CONF3_ISA_OE) ? "yes" : "no"); - } -+ -+ seq_printf(m, "Options implemented\t:"); -+ if (cpu_has_tlb) -+ seq_printf(m, "%s", " tlb"); -+ if (cpu_has_ftlb) -+ seq_printf(m, "%s", " ftlb"); -+ if (cpu_has_tlbinv) -+ seq_printf(m, "%s", " tlbinv"); -+ if (cpu_has_segments) -+ seq_printf(m, "%s", " segments"); -+ if (cpu_has_rixiex) -+ seq_printf(m, "%s", " rixiex"); -+ if (cpu_has_ldpte) -+ seq_printf(m, "%s", " ldpte"); -+ if (cpu_has_maar) -+ seq_printf(m, "%s", " maar"); -+ if (cpu_has_rw_llb) -+ seq_printf(m, "%s", " rw_llb"); -+ if (cpu_has_4kex) -+ seq_printf(m, "%s", " 4kex"); -+ if (cpu_has_3k_cache) -+ seq_printf(m, "%s", " 3k_cache"); -+ if (cpu_has_4k_cache) -+ seq_printf(m, "%s", " 4k_cache"); -+ if (cpu_has_6k_cache) -+ seq_printf(m, "%s", " 6k_cache"); -+ if (cpu_has_8k_cache) -+ seq_printf(m, "%s", " 8k_cache"); -+ if (cpu_has_tx39_cache) -+ seq_printf(m, "%s", " tx39_cache"); -+ if (cpu_has_octeon_cache) -+ seq_printf(m, "%s", " octeon_cache"); -+ if (cpu_has_fpu) -+ seq_printf(m, "%s", " fpu"); -+ if (cpu_has_32fpr) -+ seq_printf(m, "%s", " 32fpr"); -+ if (cpu_has_cache_cdex_p) -+ seq_printf(m, "%s", " cache_cdex_p"); -+ if (cpu_has_cache_cdex_s) -+ seq_printf(m, "%s", " cache_cdex_s"); -+ if (cpu_has_prefetch) -+ seq_printf(m, "%s", " prefetch"); -+ if (cpu_has_mcheck) -+ seq_printf(m, "%s", " mcheck"); -+ if (cpu_has_ejtag) -+ seq_printf(m, "%s", " ejtag"); -+ if (cpu_has_llsc) -+ seq_printf(m, "%s", " llsc"); -+ if (cpu_has_bp_ghist) -+ seq_printf(m, "%s", " bp_ghist"); -+ if (cpu_has_guestctl0ext) -+ seq_printf(m, "%s", " guestctl0ext"); -+ if (cpu_has_guestctl1) -+ seq_printf(m, "%s", " guestctl1"); -+ if (cpu_has_guestctl2) -+ seq_printf(m, "%s", " guestctl2"); -+ if (cpu_has_guestid) -+ seq_printf(m, "%s", " guestid"); -+ if (cpu_has_drg) -+ seq_printf(m, "%s", " drg"); -+ if (cpu_has_rixi) -+ seq_printf(m, "%s", " rixi"); -+ if (cpu_has_lpa) -+ seq_printf(m, "%s", " lpa"); -+ if (cpu_has_mvh) -+ seq_printf(m, "%s", " mvh"); -+ if (cpu_has_vtag_icache) -+ seq_printf(m, "%s", " vtag_icache"); -+ if (cpu_has_dc_aliases) -+ seq_printf(m, "%s", " dc_aliases"); -+ if (cpu_has_ic_fills_f_dc) -+ seq_printf(m, "%s", " ic_fills_f_dc"); -+ if (cpu_has_pindexed_dcache) -+ seq_printf(m, "%s", " pindexed_dcache"); -+ if (cpu_has_userlocal) -+ seq_printf(m, "%s", " userlocal"); -+ if (cpu_has_nofpuex) -+ seq_printf(m, "%s", " nofpuex"); -+ if (cpu_has_vint) -+ seq_printf(m, "%s", " vint"); -+ if (cpu_has_veic) -+ seq_printf(m, "%s", " veic"); -+ if (cpu_has_inclusive_pcaches) -+ seq_printf(m, "%s", " inclusive_pcaches"); -+ if (cpu_has_perf_cntr_intr_bit) -+ seq_printf(m, "%s", " perf_cntr_intr_bit"); -+ if (cpu_has_ufr) -+ seq_printf(m, "%s", " ufr"); -+ if (cpu_has_fre) -+ seq_printf(m, "%s", " fre"); -+ if (cpu_has_cdmm) -+ seq_printf(m, "%s", " cdmm"); -+ if (cpu_has_small_pages) -+ seq_printf(m, "%s", " small_pages"); -+ if (cpu_has_nan_legacy) -+ seq_printf(m, "%s", " nan_legacy"); -+ if (cpu_has_nan_2008) -+ seq_printf(m, "%s", " nan_2008"); -+ if (cpu_has_ebase_wg) -+ seq_printf(m, "%s", " ebase_wg"); -+ if (cpu_has_badinstr) -+ seq_printf(m, "%s", " badinstr"); -+ if (cpu_has_badinstrp) -+ seq_printf(m, "%s", " badinstrp"); -+ if (cpu_has_contextconfig) -+ seq_printf(m, "%s", " contextconfig"); -+ if (cpu_has_perf) -+ seq_printf(m, "%s", " perf"); -+ if (cpu_has_shared_ftlb_ram) -+ seq_printf(m, "%s", " shared_ftlb_ram"); -+ if (cpu_has_shared_ftlb_entries) -+ seq_printf(m, "%s", " shared_ftlb_entries"); -+ if (cpu_has_mipsmt_pertccounters) -+ seq_printf(m, "%s", " mipsmt_pertccounters"); -+ seq_printf(m, "\n"); -+ - seq_printf(m, "shadow register sets\t: %d\n", - cpu_data[n].srsets); - seq_printf(m, "kscratch registers\t: %d\n", diff --git a/target/linux/generic/pending-4.19/310-arm_module_unresolved_weak_sym.patch b/target/linux/generic/pending-4.19/310-arm_module_unresolved_weak_sym.patch deleted file mode 100644 index bc9f0a4c4d..0000000000 --- a/target/linux/generic/pending-4.19/310-arm_module_unresolved_weak_sym.patch +++ /dev/null @@ -1,22 +0,0 @@ -From: Felix Fietkau -Subject: fix errors in unresolved weak symbols on arm - -lede-commit: 570699d4838a907c3ef9f2819bf19eb72997b32f -Signed-off-by: Felix Fietkau ---- - arch/arm/kernel/module.c | 4 ++++ - 1 file changed, 4 insertions(+) - ---- a/arch/arm/kernel/module.c -+++ b/arch/arm/kernel/module.c -@@ -95,6 +95,10 @@ apply_relocate(Elf32_Shdr *sechdrs, cons - return -ENOEXEC; - } - -+ if ((IS_ERR_VALUE(sym->st_value) || !sym->st_value) && -+ ELF_ST_BIND(sym->st_info) == STB_WEAK) -+ continue; -+ - loc = dstsec->sh_addr + rel->r_offset; - - switch (ELF32_R_TYPE(rel->r_info)) { diff --git a/target/linux/generic/pending-4.19/330-MIPS-kexec-Accept-command-line-parameters-from-users.patch b/target/linux/generic/pending-4.19/330-MIPS-kexec-Accept-command-line-parameters-from-users.patch deleted file mode 100644 index 1187543a46..0000000000 --- a/target/linux/generic/pending-4.19/330-MIPS-kexec-Accept-command-line-parameters-from-users.patch +++ /dev/null @@ -1,272 +0,0 @@ -From: Yousong Zhou -Subject: MIPS: kexec: Accept command line parameters from userspace. - -Signed-off-by: Yousong Zhou ---- - arch/mips/kernel/machine_kexec.c | 153 +++++++++++++++++++++++++++++++----- - arch/mips/kernel/machine_kexec.h | 20 +++++ - arch/mips/kernel/relocate_kernel.S | 21 +++-- - 3 files changed, 167 insertions(+), 27 deletions(-) - create mode 100644 arch/mips/kernel/machine_kexec.h - ---- a/arch/mips/kernel/machine_kexec.c -+++ b/arch/mips/kernel/machine_kexec.c -@@ -10,14 +10,11 @@ - #include - #include - -+#include - #include - #include -- --extern const unsigned char relocate_new_kernel[]; --extern const size_t relocate_new_kernel_size; -- --extern unsigned long kexec_start_address; --extern unsigned long kexec_indirection_page; -+#include -+#include "machine_kexec.h" - - int (*_machine_kexec_prepare)(struct kimage *) = NULL; - void (*_machine_kexec_shutdown)(void) = NULL; -@@ -28,6 +25,99 @@ atomic_t kexec_ready_to_reboot = ATOMIC_ - void (*_crash_smp_send_stop)(void) = NULL; - #endif - -+static void machine_kexec_print_args(void) -+{ -+ unsigned long argc = (int)kexec_args[0]; -+ int i; -+ -+ pr_info("kexec_args[0] (argc): %lu\n", argc); -+ pr_info("kexec_args[1] (argv): %p\n", (void *)kexec_args[1]); -+ pr_info("kexec_args[2] (env ): %p\n", (void *)kexec_args[2]); -+ pr_info("kexec_args[3] (desc): %p\n", (void *)kexec_args[3]); -+ -+ for (i = 0; i < argc; i++) { -+ pr_info("kexec_argv[%d] = %p, %s\n", -+ i, kexec_argv[i], kexec_argv[i]); -+ } -+} -+ -+static void machine_kexec_init_argv(struct kimage *image) -+{ -+ void __user *buf = NULL; -+ size_t bufsz; -+ size_t size; -+ int i; -+ -+ bufsz = 0; -+ for (i = 0; i < image->nr_segments; i++) { -+ struct kexec_segment *seg; -+ -+ seg = &image->segment[i]; -+ if (seg->bufsz < 6) -+ continue; -+ -+ if (strncmp((char *) seg->buf, "kexec ", 6)) -+ continue; -+ -+ buf = seg->buf; -+ bufsz = seg->bufsz; -+ break; -+ } -+ -+ if (!buf) -+ return; -+ -+ size = KEXEC_COMMAND_LINE_SIZE; -+ size = min(size, bufsz); -+ if (size < bufsz) -+ pr_warn("kexec command line truncated to %zd bytes\n", size); -+ -+ /* Copy to kernel space */ -+ copy_from_user(kexec_argv_buf, buf, size); -+ kexec_argv_buf[size - 1] = 0; -+} -+ -+static void machine_kexec_parse_argv(struct kimage *image) -+{ -+ char *reboot_code_buffer; -+ int reloc_delta; -+ char *ptr; -+ int argc; -+ int i; -+ -+ ptr = kexec_argv_buf; -+ argc = 0; -+ -+ /* -+ * convert command line string to array of parameters -+ * (as bootloader does). -+ */ -+ while (ptr && *ptr && (KEXEC_MAX_ARGC > argc)) { -+ if (*ptr == ' ') { -+ *ptr++ = '\0'; -+ continue; -+ } -+ -+ kexec_argv[argc++] = ptr; -+ ptr = strchr(ptr, ' '); -+ } -+ -+ if (!argc) -+ return; -+ -+ kexec_args[0] = argc; -+ kexec_args[1] = (unsigned long)kexec_argv; -+ kexec_args[2] = 0; -+ kexec_args[3] = 0; -+ -+ reboot_code_buffer = page_address(image->control_code_page); -+ reloc_delta = reboot_code_buffer - (char *)kexec_relocate_new_kernel; -+ -+ kexec_args[1] += reloc_delta; -+ for (i = 0; i < argc; i++) -+ kexec_argv[i] += reloc_delta; -+} -+ - static void kexec_image_info(const struct kimage *kimage) - { - unsigned long i; -@@ -52,6 +142,18 @@ int - machine_kexec_prepare(struct kimage *kimage) - { - kexec_image_info(kimage); -+ /* -+ * Whenever arguments passed from kexec-tools, Init the arguments as -+ * the original ones to try avoiding booting failure. -+ */ -+ -+ kexec_args[0] = fw_arg0; -+ kexec_args[1] = fw_arg1; -+ kexec_args[2] = fw_arg2; -+ kexec_args[3] = fw_arg3; -+ -+ machine_kexec_init_argv(kimage); -+ machine_kexec_parse_argv(kimage); - - if (_machine_kexec_prepare) - return _machine_kexec_prepare(kimage); -@@ -89,10 +191,12 @@ machine_kexec(struct kimage *image) - unsigned long *ptr; - - reboot_code_buffer = -- (unsigned long)page_address(image->control_code_page); -+ (unsigned long)page_address(image->control_code_page); -+ pr_info("reboot_code_buffer = %p\n", (void *)reboot_code_buffer); - - kexec_start_address = - (unsigned long) phys_to_virt(image->start); -+ pr_info("kexec_start_address = %p\n", (void *)kexec_start_address); - - if (image->type == KEXEC_TYPE_DEFAULT) { - kexec_indirection_page = -@@ -100,9 +204,19 @@ machine_kexec(struct kimage *image) - } else { - kexec_indirection_page = (unsigned long)&image->head; - } -+ pr_info("kexec_indirection_page = %p\n", (void *)kexec_indirection_page); - -- memcpy((void*)reboot_code_buffer, relocate_new_kernel, -- relocate_new_kernel_size); -+ pr_info("Where is memcpy: %p\n", memcpy); -+ pr_info("kexec_relocate_new_kernel = %p, kexec_relocate_new_kernel_end = %p\n", -+ (void *)kexec_relocate_new_kernel, &kexec_relocate_new_kernel_end); -+ pr_info("Copy %lu bytes from %p to %p\n", KEXEC_RELOCATE_NEW_KERNEL_SIZE, -+ (void *)kexec_relocate_new_kernel, (void *)reboot_code_buffer); -+ memcpy((void*)reboot_code_buffer, kexec_relocate_new_kernel, -+ KEXEC_RELOCATE_NEW_KERNEL_SIZE); -+ -+ pr_info("Before _print_args().\n"); -+ machine_kexec_print_args(); -+ pr_info("Before eval loop.\n"); - - /* - * The generic kexec code builds a page list with physical -@@ -124,15 +238,16 @@ machine_kexec(struct kimage *image) - /* - * we do not want to be bothered. - */ -+ pr_info("Before irq_disable.\n"); - local_irq_disable(); - -- printk("Will call new kernel at %08lx\n", image->start); -- printk("Bye ...\n"); -+ pr_info("Will call new kernel at %08lx\n", image->start); -+ pr_info("Bye ...\n"); - __flush_cache_all(); - #ifdef CONFIG_SMP - /* All secondary cpus now may jump to kexec_wait cycle */ - relocated_kexec_smp_wait = reboot_code_buffer + -- (void *)(kexec_smp_wait - relocate_new_kernel); -+ (void *)(kexec_smp_wait - kexec_relocate_new_kernel); - smp_wmb(); - atomic_set(&kexec_ready_to_reboot, 1); - #endif ---- /dev/null -+++ b/arch/mips/kernel/machine_kexec.h -@@ -0,0 +1,20 @@ -+#ifndef _MACHINE_KEXEC_H -+#define _MACHINE_KEXEC_H -+ -+#ifndef __ASSEMBLY__ -+extern const unsigned char kexec_relocate_new_kernel[]; -+extern unsigned long kexec_relocate_new_kernel_end; -+extern unsigned long kexec_start_address; -+extern unsigned long kexec_indirection_page; -+ -+extern char kexec_argv_buf[]; -+extern char *kexec_argv[]; -+ -+#define KEXEC_RELOCATE_NEW_KERNEL_SIZE ((unsigned long)&kexec_relocate_new_kernel_end - (unsigned long)kexec_relocate_new_kernel) -+#endif /* !__ASSEMBLY__ */ -+ -+#define KEXEC_COMMAND_LINE_SIZE 256 -+#define KEXEC_ARGV_SIZE (KEXEC_COMMAND_LINE_SIZE / 16) -+#define KEXEC_MAX_ARGC (KEXEC_ARGV_SIZE / sizeof(long)) -+ -+#endif ---- a/arch/mips/kernel/relocate_kernel.S -+++ b/arch/mips/kernel/relocate_kernel.S -@@ -12,8 +12,9 @@ - #include - #include - #include -+#include "machine_kexec.h" - --LEAF(relocate_new_kernel) -+LEAF(kexec_relocate_new_kernel) - PTR_L a0, arg0 - PTR_L a1, arg1 - PTR_L a2, arg2 -@@ -98,7 +99,7 @@ done: - #endif - /* jump to kexec_start_address */ - j s1 -- END(relocate_new_kernel) -+ END(kexec_relocate_new_kernel) - - #ifdef CONFIG_SMP - /* -@@ -184,9 +185,15 @@ kexec_indirection_page: - PTR 0 - .size kexec_indirection_page, PTRSIZE - --relocate_new_kernel_end: -+kexec_argv_buf: -+ EXPORT(kexec_argv_buf) -+ .skip KEXEC_COMMAND_LINE_SIZE -+ .size kexec_argv_buf, KEXEC_COMMAND_LINE_SIZE -+ -+kexec_argv: -+ EXPORT(kexec_argv) -+ .skip KEXEC_ARGV_SIZE -+ .size kexec_argv, KEXEC_ARGV_SIZE - --relocate_new_kernel_size: -- EXPORT(relocate_new_kernel_size) -- PTR relocate_new_kernel_end - relocate_new_kernel -- .size relocate_new_kernel_size, PTRSIZE -+kexec_relocate_new_kernel_end: -+ EXPORT(kexec_relocate_new_kernel_end) diff --git a/target/linux/generic/pending-4.19/332-arc-add-OWRTDTB-section.patch b/target/linux/generic/pending-4.19/332-arc-add-OWRTDTB-section.patch deleted file mode 100644 index 69acc8a089..0000000000 --- a/target/linux/generic/pending-4.19/332-arc-add-OWRTDTB-section.patch +++ /dev/null @@ -1,80 +0,0 @@ -From: Alexey Brodkin -Subject: librecmc: arc - add OWRTDTB section - -This change allows OpenWRT to patch resulting kernel binary with -external .dtb. - -That allows us to re-use exactky the same vmlinux on different boards -given its ARC core configurations match (at least cache line sizes etc). - -""patch-dtb" searches for ASCII "OWRTDTB:" strign and copies external -.dtb right after it, keeping the string in place. - -Signed-off-by: Alexey Brodkin ---- - arch/arc/kernel/head.S | 10 ++++++++++ - arch/arc/kernel/setup.c | 4 +++- - arch/arc/kernel/vmlinux.lds.S | 13 +++++++++++++ - 3 files changed, 26 insertions(+), 1 deletion(-) - ---- a/arch/arc/kernel/head.S -+++ b/arch/arc/kernel/head.S -@@ -49,6 +49,16 @@ - 1: - .endm - -+; Here "patch-dtb" will embed external .dtb -+; Note "patch-dtb" searches for ASCII "OWRTDTB:" string -+; and pastes .dtb right after it, hense the string precedes -+; __image_dtb symbol. -+ .section .owrt, "aw",@progbits -+ .ascii "OWRTDTB:" -+ENTRY(__image_dtb) -+ .fill 0x4000 -+END(__image_dtb) -+ - .section .init.text, "ax",@progbits - - ;---------------------------------------------------------------- ---- a/arch/arc/kernel/setup.c -+++ b/arch/arc/kernel/setup.c -@@ -456,6 +456,8 @@ static inline int is_kernel(unsigned lon - return 0; - } - -+extern struct boot_param_header __image_dtb; -+ - void __init setup_arch(char **cmdline_p) - { - #ifdef CONFIG_ARC_UBOOT_SUPPORT -@@ -469,7 +471,7 @@ void __init setup_arch(char **cmdline_p) - #endif - { - /* No, so try the embedded one */ -- machine_desc = setup_machine_fdt(__dtb_start); -+ machine_desc = setup_machine_fdt(&__image_dtb); - if (!machine_desc) - panic("Embedded DT invalid\n"); - ---- a/arch/arc/kernel/vmlinux.lds.S -+++ b/arch/arc/kernel/vmlinux.lds.S -@@ -30,6 +30,19 @@ SECTIONS - - . = CONFIG_LINUX_LINK_BASE; - -+ /* -+ * In OpenWRT we want to patch built binary embedding .dtb of choice. -+ * This is implemented with "patch-dtb" utility which searches for -+ * "OWRTDTB:" string in first 16k of image and if it is found -+ * copies .dtb right after mentioned string. -+ * -+ * Note: "OWRTDTB:" won't be overwritten with .dtb, .dtb will follow it. -+ */ -+ .owrt : { -+ *(.owrt) -+ . = ALIGN(PAGE_SIZE); -+ } -+ - _int_vec_base_lds = .; - .vector : { - *(.vector) diff --git a/target/linux/generic/pending-4.19/333-arc-enable-unaligned-access-in-kernel-mode.patch b/target/linux/generic/pending-4.19/333-arc-enable-unaligned-access-in-kernel-mode.patch deleted file mode 100644 index 4e0265aef5..0000000000 --- a/target/linux/generic/pending-4.19/333-arc-enable-unaligned-access-in-kernel-mode.patch +++ /dev/null @@ -1,24 +0,0 @@ -From: Alexey Brodkin -Subject: arc: enable unaligned access in kernel mode - -This enables misaligned access handling even in kernel mode. -Some wireless drivers (ath9k-htc and mt7601u) use misaligned accesses -here and there and to cope with that without fixing stuff in the drivers -we're just gracefully handling it on ARC. - -Signed-off-by: Alexey Brodkin ---- - arch/arc/kernel/unaligned.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - ---- a/arch/arc/kernel/unaligned.c -+++ b/arch/arc/kernel/unaligned.c -@@ -206,7 +206,7 @@ int misaligned_fixup(unsigned long addre - char buf[TASK_COMM_LEN]; - - /* handle user mode only and only if enabled by sysadmin */ -- if (!user_mode(regs) || !unaligned_enabled) -+ if (!unaligned_enabled) - return 1; - - if (no_unaligned_warning) { diff --git a/target/linux/generic/pending-4.19/341-MIPS-mm-remove-no-op-dma_map_ops-where-possible.patch b/target/linux/generic/pending-4.19/341-MIPS-mm-remove-no-op-dma_map_ops-where-possible.patch deleted file mode 100644 index d28bc7ba99..0000000000 --- a/target/linux/generic/pending-4.19/341-MIPS-mm-remove-no-op-dma_map_ops-where-possible.patch +++ /dev/null @@ -1,82 +0,0 @@ -From 203f17906ff45705fbdaa0430dbbc71142c2640f Mon Sep 17 00:00:00 2001 -From: Hauke Mehrtens -Date: Sat, 8 Dec 2018 21:45:53 +0100 -Subject: [PATCH 1/3] MIPS: Compile post DMA flush only when needed - -dma_sync_phys() is only called for some CPUs when a mapping is removed. -Add ARCH_HAS_SYNC_DMA_FOR_CPU only for the CPUs listed in -cpu_needs_post_dma_flush() which need this extra call and do not compile -this code in for other CPUs. We need this for R10000, R12000, BMIPS5000 -CPUs and CPUs supporting MAAR which was introduced in MIPS32r5. - -This will hopefully improve the performance of the not affected devices. - -Signed-off-by: Hauke Mehrtens ---- - arch/mips/Kconfig | 6 +++++- - arch/mips/mm/dma-noncoherent.c | 2 ++ - 2 files changed, 7 insertions(+), 1 deletion(-) - ---- a/arch/mips/Kconfig -+++ b/arch/mips/Kconfig -@@ -1116,7 +1116,6 @@ config DMA_PERDEV_COHERENT - config DMA_NONCOHERENT - bool - select ARCH_HAS_SYNC_DMA_FOR_DEVICE -- select ARCH_HAS_SYNC_DMA_FOR_CPU - select NEED_DMA_MAP_STATE - select DMA_NONCOHERENT_MMAP - select DMA_NONCOHERENT_CACHE_SYNC -@@ -1897,9 +1896,11 @@ config SYS_HAS_CPU_MIPS32_R3_5 - - config SYS_HAS_CPU_MIPS32_R5 - bool -+ select ARCH_HAS_SYNC_DMA_FOR_CPU - - config SYS_HAS_CPU_MIPS32_R6 - bool -+ select ARCH_HAS_SYNC_DMA_FOR_CPU - - config SYS_HAS_CPU_MIPS64_R1 - bool -@@ -1909,6 +1910,7 @@ config SYS_HAS_CPU_MIPS64_R2 - - config SYS_HAS_CPU_MIPS64_R6 - bool -+ select ARCH_HAS_SYNC_DMA_FOR_CPU - - config SYS_HAS_CPU_R3000 - bool -@@ -1945,6 +1947,7 @@ config SYS_HAS_CPU_R8000 - - config SYS_HAS_CPU_R10000 - bool -+ select ARCH_HAS_SYNC_DMA_FOR_CPU - - config SYS_HAS_CPU_RM7000 - bool -@@ -1973,6 +1976,7 @@ config SYS_HAS_CPU_BMIPS4380 - config SYS_HAS_CPU_BMIPS5000 - bool - select SYS_HAS_CPU_BMIPS -+ select ARCH_HAS_SYNC_DMA_FOR_CPU - - config SYS_HAS_CPU_XLR - bool ---- a/arch/mips/mm/dma-noncoherent.c -+++ b/arch/mips/mm/dma-noncoherent.c -@@ -191,12 +191,14 @@ void arch_sync_dma_for_device(struct dev - dma_sync_phys(paddr, size, dir); - } - -+#ifdef CONFIG_ARCH_HAS_SYNC_DMA_FOR_CPU - void arch_sync_dma_for_cpu(struct device *dev, phys_addr_t paddr, - size_t size, enum dma_data_direction dir) - { - if (cpu_needs_post_dma_flush(dev)) - dma_sync_phys(paddr, size, dir); - } -+#endif - - void arch_dma_cache_sync(struct device *dev, void *vaddr, size_t size, - enum dma_data_direction direction) diff --git a/target/linux/generic/pending-4.19/400-mtd-add-rootfs-split-support.patch b/target/linux/generic/pending-4.19/400-mtd-add-rootfs-split-support.patch deleted file mode 100644 index a3f13fad9f..0000000000 --- a/target/linux/generic/pending-4.19/400-mtd-add-rootfs-split-support.patch +++ /dev/null @@ -1,107 +0,0 @@ -From: Felix Fietkau -Subject: make rootfs split/detection more generic - patch can be moved to generic-2.6 after testing on other platforms - -lede-commit: 328e660b31f0937d52c5ae3d6e7029409918a9df -Signed-off-by: Felix Fietkau ---- - drivers/mtd/Kconfig | 17 +++++++++++++++++ - drivers/mtd/mtdpart.c | 35 +++++++++++++++++++++++++++++++++++ - include/linux/mtd/partitions.h | 2 ++ - 3 files changed, 54 insertions(+) - ---- a/drivers/mtd/Kconfig -+++ b/drivers/mtd/Kconfig -@@ -11,6 +11,23 @@ menuconfig MTD - - if MTD - -+menu "libreCMC specific MTD options" -+ -+config MTD_ROOTFS_ROOT_DEV -+ bool "Automatically set 'rootfs' partition to be root filesystem" -+ default y -+ -+config MTD_SPLIT_FIRMWARE -+ bool "Automatically split firmware partition for kernel+rootfs" -+ default y -+ -+config MTD_SPLIT_FIRMWARE_NAME -+ string "Firmware partition name" -+ depends on MTD_SPLIT_FIRMWARE -+ default "firmware" -+ -+endmenu -+ - config MTD_TESTS - tristate "MTD tests support (DANGEROUS)" - depends on m ---- a/drivers/mtd/mtdpart.c -+++ b/drivers/mtd/mtdpart.c -@@ -29,10 +29,12 @@ - #include - #include - #include -+#include - #include - #include - - #include "mtdcore.h" -+#include "mtdsplit/mtdsplit.h" - - /* Our partition linked list */ - static LIST_HEAD(mtd_partitions); -@@ -52,6 +54,8 @@ struct mtd_part { - struct list_head list; - }; - -+static void mtd_partition_split(struct mtd_info *master, struct mtd_part *part); -+ - /* - * Given a pointer to the MTD object in the mtd_part structure, we can retrieve - * the pointer to that structure. -@@ -623,6 +627,7 @@ int mtd_add_partition(struct mtd_info *p - mutex_unlock(&mtd_partitions_mutex); - - add_mtd_device(&new->mtd); -+ mtd_partition_split(parent, new); - - mtd_add_partition_attrs(new); - -@@ -701,6 +706,29 @@ int mtd_del_partition(struct mtd_info *m - } - EXPORT_SYMBOL_GPL(mtd_del_partition); - -+#ifdef CONFIG_MTD_SPLIT_FIRMWARE_NAME -+#define SPLIT_FIRMWARE_NAME CONFIG_MTD_SPLIT_FIRMWARE_NAME -+#else -+#define SPLIT_FIRMWARE_NAME "unused" -+#endif -+ -+static void split_firmware(struct mtd_info *master, struct mtd_part *part) -+{ -+} -+ -+static void mtd_partition_split(struct mtd_info *master, struct mtd_part *part) -+{ -+ static int rootfs_found = 0; -+ -+ if (rootfs_found) -+ return; -+ -+ if (IS_ENABLED(CONFIG_MTD_SPLIT_FIRMWARE) && -+ !strcmp(part->mtd.name, SPLIT_FIRMWARE_NAME) && -+ !of_find_property(mtd_get_of_node(&part->mtd), "compatible", NULL)) -+ split_firmware(master, part); -+} -+ - /* - * This function, given a master MTD object and a partition table, creates - * and registers slave MTD objects which are bound to the master according to -@@ -732,6 +760,7 @@ int add_mtd_partitions(struct mtd_info * - mutex_unlock(&mtd_partitions_mutex); - - add_mtd_device(&slave->mtd); -+ mtd_partition_split(master, slave); - mtd_add_partition_attrs(slave); - /* Look for subpartitions */ - parse_mtd_partitions(&slave->mtd, parts[i].types, NULL); diff --git a/target/linux/generic/pending-4.19/401-mtd-add-support-for-different-partition-parser-types.patch b/target/linux/generic/pending-4.19/401-mtd-add-support-for-different-partition-parser-types.patch deleted file mode 100644 index 4026a2050b..0000000000 --- a/target/linux/generic/pending-4.19/401-mtd-add-support-for-different-partition-parser-types.patch +++ /dev/null @@ -1,142 +0,0 @@ -From: Gabor Juhos -Subject: mtd: add support for different partition parser types - -Signed-off-by: Gabor Juhos ---- - drivers/mtd/mtdpart.c | 56 ++++++++++++++++++++++++++++++++++++++++ - include/linux/mtd/partitions.h | 11 ++++++++ - 2 files changed, 67 insertions(+) - ---- a/drivers/mtd/mtdpart.c -+++ b/drivers/mtd/mtdpart.c -@@ -55,6 +55,10 @@ struct mtd_part { - }; - - static void mtd_partition_split(struct mtd_info *master, struct mtd_part *part); -+static int parse_mtd_partitions_by_type(struct mtd_info *master, -+ enum mtd_parser_type type, -+ const struct mtd_partition **pparts, -+ struct mtd_part_parser_data *data); - - /* - * Given a pointer to the MTD object in the mtd_part structure, we can retrieve -@@ -706,6 +710,36 @@ int mtd_del_partition(struct mtd_info *m - } - EXPORT_SYMBOL_GPL(mtd_del_partition); - -+static int -+run_parsers_by_type(struct mtd_part *slave, enum mtd_parser_type type) -+{ -+ struct mtd_partition *parts; -+ int nr_parts; -+ int i; -+ -+ nr_parts = parse_mtd_partitions_by_type(&slave->mtd, type, (const struct mtd_partition **)&parts, -+ NULL); -+ if (nr_parts <= 0) -+ return nr_parts; -+ -+ if (WARN_ON(!parts)) -+ return 0; -+ -+ for (i = 0; i < nr_parts; i++) { -+ /* adjust partition offsets */ -+ parts[i].offset += slave->offset; -+ -+ mtd_add_partition(slave->parent, -+ parts[i].name, -+ parts[i].offset, -+ parts[i].size); -+ } -+ -+ kfree(parts); -+ -+ return nr_parts; -+} -+ - #ifdef CONFIG_MTD_SPLIT_FIRMWARE_NAME - #define SPLIT_FIRMWARE_NAME CONFIG_MTD_SPLIT_FIRMWARE_NAME - #else -@@ -1041,6 +1075,61 @@ void mtd_part_parser_cleanup(struct mtd_ - } - } - -+static struct mtd_part_parser * -+get_partition_parser_by_type(enum mtd_parser_type type, -+ struct mtd_part_parser *start) -+{ -+ struct mtd_part_parser *p, *ret = NULL; -+ -+ spin_lock(&part_parser_lock); -+ -+ p = list_prepare_entry(start, &part_parsers, list); -+ if (start) -+ mtd_part_parser_put(start); -+ -+ list_for_each_entry_continue(p, &part_parsers, list) { -+ if (p->type == type && try_module_get(p->owner)) { -+ ret = p; -+ break; -+ } -+ } -+ -+ spin_unlock(&part_parser_lock); -+ -+ return ret; -+} -+ -+static int parse_mtd_partitions_by_type(struct mtd_info *master, -+ enum mtd_parser_type type, -+ const struct mtd_partition **pparts, -+ struct mtd_part_parser_data *data) -+{ -+ struct mtd_part_parser *prev = NULL; -+ int ret = 0; -+ -+ while (1) { -+ struct mtd_part_parser *parser; -+ -+ parser = get_partition_parser_by_type(type, prev); -+ if (!parser) -+ break; -+ -+ ret = (*parser->parse_fn)(master, pparts, data); -+ -+ if (ret > 0) { -+ mtd_part_parser_put(parser); -+ printk(KERN_NOTICE -+ "%d %s partitions found on MTD device %s\n", -+ ret, parser->name, master->name); -+ break; -+ } -+ -+ prev = parser; -+ } -+ -+ return ret; -+} -+ - int mtd_is_partition(const struct mtd_info *mtd) - { - struct mtd_part *part; ---- a/include/linux/mtd/partitions.h -+++ b/include/linux/mtd/partitions.h -@@ -73,6 +73,10 @@ struct mtd_part_parser_data { - * Functions dealing with the various ways of partitioning the space - */ - -+enum mtd_parser_type { -+ MTD_PARSER_TYPE_DEVICE = 0, -+}; -+ - struct mtd_part_parser { - struct list_head list; - struct module *owner; -@@ -81,6 +85,7 @@ struct mtd_part_parser { - int (*parse_fn)(struct mtd_info *, const struct mtd_partition **, - struct mtd_part_parser_data *); - void (*cleanup)(const struct mtd_partition *pparts, int nr_parts); -+ enum mtd_parser_type type; - }; - - /* Container for passing around a set of parsed partitions */ diff --git a/target/linux/generic/pending-4.19/402-mtd-use-typed-mtd-parsers-for-rootfs-and-firmware-split.patch b/target/linux/generic/pending-4.19/402-mtd-use-typed-mtd-parsers-for-rootfs-and-firmware-split.patch deleted file mode 100644 index 8a90ce6a8b..0000000000 --- a/target/linux/generic/pending-4.19/402-mtd-use-typed-mtd-parsers-for-rootfs-and-firmware-split.patch +++ /dev/null @@ -1,44 +0,0 @@ -From: Gabor Juhos -Subject: kernel/3.10: allow to use partition parsers for rootfs and firmware split - -lede-commit: 3b71cd94bc9517bc25267dccb393b07d4b54564e -Signed-off-by: Gabor Juhos ---- - drivers/mtd/mtdpart.c | 37 +++++++++++++++++++++++++++++++++++++ - include/linux/mtd/partitions.h | 2 ++ - 2 files changed, 39 insertions(+) - ---- a/drivers/mtd/mtdpart.c -+++ b/drivers/mtd/mtdpart.c -@@ -748,6 +748,7 @@ run_parsers_by_type(struct mtd_part *sla - - static void split_firmware(struct mtd_info *master, struct mtd_part *part) - { -+ run_parsers_by_type(part, MTD_PARSER_TYPE_FIRMWARE); - } - - static void mtd_partition_split(struct mtd_info *master, struct mtd_part *part) -@@ -757,6 +758,12 @@ static void mtd_partition_split(struct m - if (rootfs_found) - return; - -+ if (!strcmp(part->mtd.name, "rootfs")) { -+ run_parsers_by_type(part, MTD_PARSER_TYPE_ROOTFS); -+ -+ rootfs_found = 1; -+ } -+ - if (IS_ENABLED(CONFIG_MTD_SPLIT_FIRMWARE) && - !strcmp(part->mtd.name, SPLIT_FIRMWARE_NAME) && - !of_find_property(mtd_get_of_node(&part->mtd), "compatible", NULL)) ---- a/include/linux/mtd/partitions.h -+++ b/include/linux/mtd/partitions.h -@@ -75,6 +75,8 @@ struct mtd_part_parser_data { - - enum mtd_parser_type { - MTD_PARSER_TYPE_DEVICE = 0, -+ MTD_PARSER_TYPE_ROOTFS, -+ MTD_PARSER_TYPE_FIRMWARE, - }; - - struct mtd_part_parser { diff --git a/target/linux/generic/pending-4.19/403-mtd-hook-mtdsplit-to-Kbuild.patch b/target/linux/generic/pending-4.19/403-mtd-hook-mtdsplit-to-Kbuild.patch deleted file mode 100644 index 60cf043e9b..0000000000 --- a/target/linux/generic/pending-4.19/403-mtd-hook-mtdsplit-to-Kbuild.patch +++ /dev/null @@ -1,32 +0,0 @@ -From: Gabor Juhos -Subject: [PATCH] kernel/3.10: move squashfs check from rootfs split code into a separate file - -lede-commit: d89bea92b31b4e157a0fa438e75370f089f73427 -Signed-off-by: Gabor Juhos ---- - drivers/mtd/Kconfig | 2 ++ - drivers/mtd/Makefile | 2 ++ - 2 files changed, 4 insertions(+) - ---- a/drivers/mtd/Kconfig -+++ b/drivers/mtd/Kconfig -@@ -26,6 +26,8 @@ config MTD_SPLIT_FIRMWARE_NAME - depends on MTD_SPLIT_FIRMWARE - default "firmware" - -+source "drivers/mtd/mtdsplit/Kconfig" -+ - endmenu - - config MTD_TESTS ---- a/drivers/mtd/Makefile -+++ b/drivers/mtd/Makefile -@@ -7,6 +7,8 @@ - obj-$(CONFIG_MTD) += mtd.o - mtd-y := mtdcore.o mtdsuper.o mtdconcat.o mtdpart.o mtdchar.o - -+obj-$(CONFIG_MTD_SPLIT) += mtdsplit/ -+ - obj-$(CONFIG_MTD_OF_PARTS) += ofpart.o - obj-$(CONFIG_MTD_REDBOOT_PARTS) += redboot.o - obj-$(CONFIG_MTD_CMDLINE_PARTS) += cmdlinepart.o diff --git a/target/linux/generic/pending-4.19/404-mtd-add-more-helper-functions.patch b/target/linux/generic/pending-4.19/404-mtd-add-more-helper-functions.patch deleted file mode 100644 index 2e95e99f6d..0000000000 --- a/target/linux/generic/pending-4.19/404-mtd-add-more-helper-functions.patch +++ /dev/null @@ -1,76 +0,0 @@ -From: Gabor Juhos -Subject: kernel/3.10: add separate rootfs partition parser - -lede-commit: daec7ad7688415156e2730e401503d09bd3acf91 -Signed-off-by: Gabor Juhos ---- - drivers/mtd/mtdpart.c | 29 +++++++++++++++++++++++++++++ - include/linux/mtd/mtd.h | 18 ++++++++++++++++++ - include/linux/mtd/partitions.h | 2 ++ - 3 files changed, 49 insertions(+) - ---- a/drivers/mtd/mtdpart.c -+++ b/drivers/mtd/mtdpart.c -@@ -1154,6 +1154,24 @@ int mtd_is_partition(const struct mtd_in - } - EXPORT_SYMBOL_GPL(mtd_is_partition); - -+struct mtd_info *mtdpart_get_master(const struct mtd_info *mtd) -+{ -+ if (!mtd_is_partition(mtd)) -+ return (struct mtd_info *)mtd; -+ -+ return mtd_to_part(mtd)->parent; -+} -+EXPORT_SYMBOL_GPL(mtdpart_get_master); -+ -+uint64_t mtdpart_get_offset(const struct mtd_info *mtd) -+{ -+ if (!mtd_is_partition(mtd)) -+ return 0; -+ -+ return mtd_to_part(mtd)->offset; -+} -+EXPORT_SYMBOL_GPL(mtdpart_get_offset); -+ - /* Returns the size of the entire flash chip */ - uint64_t mtd_get_device_size(const struct mtd_info *mtd) - { ---- a/include/linux/mtd/mtd.h -+++ b/include/linux/mtd/mtd.h -@@ -507,6 +507,24 @@ static inline void mtd_align_erase_req(s - req->len += mtd->erasesize - mod; - } - -+static inline uint64_t mtd_roundup_to_eb(uint64_t sz, struct mtd_info *mtd) -+{ -+ if (mtd_mod_by_eb(sz, mtd) == 0) -+ return sz; -+ -+ /* Round up to next erase block */ -+ return (mtd_div_by_eb(sz, mtd) + 1) * mtd->erasesize; -+} -+ -+static inline uint64_t mtd_rounddown_to_eb(uint64_t sz, struct mtd_info *mtd) -+{ -+ if (mtd_mod_by_eb(sz, mtd) == 0) -+ return sz; -+ -+ /* Round down to the start of the current erase block */ -+ return (mtd_div_by_eb(sz, mtd)) * mtd->erasesize; -+} -+ - static inline uint32_t mtd_div_by_ws(uint64_t sz, struct mtd_info *mtd) - { - if (mtd->writesize_shift) ---- a/include/linux/mtd/partitions.h -+++ b/include/linux/mtd/partitions.h -@@ -116,6 +116,8 @@ int mtd_is_partition(const struct mtd_in - int mtd_add_partition(struct mtd_info *master, const char *name, - long long offset, long long length); - int mtd_del_partition(struct mtd_info *master, int partno); -+struct mtd_info *mtdpart_get_master(const struct mtd_info *mtd); -+uint64_t mtdpart_get_offset(const struct mtd_info *mtd); - uint64_t mtd_get_device_size(const struct mtd_info *mtd); - - #endif diff --git a/target/linux/generic/pending-4.19/411-mtd-partial_eraseblock_write.patch b/target/linux/generic/pending-4.19/411-mtd-partial_eraseblock_write.patch deleted file mode 100644 index bf9822fda8..0000000000 --- a/target/linux/generic/pending-4.19/411-mtd-partial_eraseblock_write.patch +++ /dev/null @@ -1,132 +0,0 @@ -From: Felix Fietkau -Subject: mtd: implement write support for partitions covering only a part of an eraseblock (buffer data that would otherwise be erased) - -lede-commit: 87a8e8ac1067f58ba831c4aae443f3655c31cd80 -Signed-off-by: Felix Fietkau ---- - drivers/mtd/mtdpart.c | 90 ++++++++++++++++++++++++++++++++++++++++++++----- - include/linux/mtd/mtd.h | 4 +++ - 2 files changed, 85 insertions(+), 9 deletions(-) - ---- a/drivers/mtd/mtdpart.c -+++ b/drivers/mtd/mtdpart.c -@@ -36,6 +36,8 @@ - #include "mtdcore.h" - #include "mtdsplit/mtdsplit.h" - -+#define MTD_ERASE_PARTIAL 0x8000 /* partition only covers parts of an erase block */ -+ - /* Our partition linked list */ - static LIST_HEAD(mtd_partitions); - static DEFINE_MUTEX(mtd_partitions_mutex); -@@ -220,6 +222,53 @@ static int part_erase(struct mtd_info *m - { - struct mtd_part *part = mtd_to_part(mtd); - int ret; -+ size_t wrlen = 0; -+ u8 *erase_buf = NULL; -+ u32 erase_buf_ofs = 0; -+ bool partial_start = false; -+ -+ if (mtd->flags & MTD_ERASE_PARTIAL) { -+ size_t readlen = 0; -+ u64 mtd_ofs; -+ -+ erase_buf = kmalloc(part->parent->erasesize, GFP_ATOMIC); -+ if (!erase_buf) -+ return -ENOMEM; -+ -+ mtd_ofs = part->offset + instr->addr; -+ erase_buf_ofs = do_div(mtd_ofs, part->parent->erasesize); -+ -+ if (erase_buf_ofs > 0) { -+ instr->addr -= erase_buf_ofs; -+ ret = mtd_read(part->parent, -+ instr->addr + part->offset, -+ part->parent->erasesize, -+ &readlen, erase_buf); -+ -+ instr->len += erase_buf_ofs; -+ partial_start = true; -+ } else { -+ mtd_ofs = part->offset + part->mtd.size; -+ erase_buf_ofs = part->parent->erasesize - -+ do_div(mtd_ofs, part->parent->erasesize); -+ -+ if (erase_buf_ofs > 0) { -+ instr->len += erase_buf_ofs; -+ ret = mtd_read(part->parent, -+ part->offset + instr->addr + -+ instr->len - part->parent->erasesize, -+ part->parent->erasesize, &readlen, -+ erase_buf); -+ } else { -+ ret = 0; -+ } -+ } -+ if (ret < 0) { -+ kfree(erase_buf); -+ return ret; -+ } -+ -+ } - - instr->addr += part->offset; - ret = part->parent->_erase(part->parent, instr); -@@ -227,6 +276,24 @@ static int part_erase(struct mtd_info *m - instr->fail_addr -= part->offset; - instr->addr -= part->offset; - -+ if (mtd->flags & MTD_ERASE_PARTIAL) { -+ if (partial_start) { -+ part->parent->_write(part->parent, -+ instr->addr, erase_buf_ofs, -+ &wrlen, erase_buf); -+ instr->addr += erase_buf_ofs; -+ } else { -+ instr->len -= erase_buf_ofs; -+ part->parent->_write(part->parent, -+ instr->addr + instr->len, -+ erase_buf_ofs, &wrlen, -+ erase_buf + -+ part->parent->erasesize - -+ erase_buf_ofs); -+ } -+ kfree(erase_buf); -+ } -+ - return ret; - } - -@@ -539,19 +606,22 @@ static struct mtd_part *allocate_partiti - remainder = do_div(tmp, wr_alignment); - if ((slave->mtd.flags & MTD_WRITEABLE) && remainder) { - /* Doesn't start on a boundary of major erase size */ -- /* FIXME: Let it be writable if it is on a boundary of -- * _minor_ erase size though */ -- slave->mtd.flags &= ~MTD_WRITEABLE; -- printk(KERN_WARNING"mtd: partition \"%s\" doesn't start on an erase/write block boundary -- force read-only\n", -- part->name); -+ slave->mtd.flags |= MTD_ERASE_PARTIAL; -+ if (((u32)slave->mtd.size) > parent->erasesize) -+ slave->mtd.flags &= ~MTD_WRITEABLE; -+ else -+ slave->mtd.erasesize = slave->mtd.size; - } - -- tmp = part_absolute_offset(parent) + slave->mtd.size; -+ tmp = part_absolute_offset(parent) + slave->offset + slave->mtd.size; - remainder = do_div(tmp, wr_alignment); - if ((slave->mtd.flags & MTD_WRITEABLE) && remainder) { -- slave->mtd.flags &= ~MTD_WRITEABLE; -- printk(KERN_WARNING"mtd: partition \"%s\" doesn't end on an erase/write block -- force read-only\n", -- part->name); -+ slave->mtd.flags |= MTD_ERASE_PARTIAL; -+ -+ if ((u32)slave->mtd.size > parent->erasesize) -+ slave->mtd.flags &= ~MTD_WRITEABLE; -+ else -+ slave->mtd.erasesize = slave->mtd.size; - } - - mtd_set_ooblayout(&slave->mtd, &part_ooblayout_ops); diff --git a/target/linux/generic/pending-4.19/412-mtd-partial_eraseblock_unlock.patch b/target/linux/generic/pending-4.19/412-mtd-partial_eraseblock_unlock.patch deleted file mode 100644 index a54603a0f8..0000000000 --- a/target/linux/generic/pending-4.19/412-mtd-partial_eraseblock_unlock.patch +++ /dev/null @@ -1,40 +0,0 @@ -From: Tim Harvey -Subject: mtd: allow partial block unlock - -This allows sysupgrade for devices such as the Gateworks Avila/Cambria -product families based on the ixp4xx using the redboot bootloader with -combined FIS directory and RedBoot config partitions on larger FLASH -devices with larger eraseblocks. - -This second iteration of this patch addresses previous issues: -- whitespace breakage fixed -- unlock in all scenarios -- simplification and fix logic bug - -[john@phrozen.org: this should be moved to the ixp4xx folder] - -Signed-off-by: Tim Harvey ---- - drivers/mtd/mtdpart.c | 11 ++++++++++- - 1 file changed, 10 insertions(+), 1 deletion(-) - ---- a/drivers/mtd/mtdpart.c -+++ b/drivers/mtd/mtdpart.c -@@ -306,7 +306,16 @@ static int part_lock(struct mtd_info *mt - static int part_unlock(struct mtd_info *mtd, loff_t ofs, uint64_t len) - { - struct mtd_part *part = mtd_to_part(mtd); -- return part->parent->_unlock(part->parent, ofs + part->offset, len); -+ -+ ofs += part->offset; -+ -+ if (mtd->flags & MTD_ERASE_PARTIAL) { -+ /* round up len to next erasesize and round down offset to prev block */ -+ len = (mtd_div_by_eb(len, part->parent) + 1) * part->parent->erasesize; -+ ofs &= ~(part->parent->erasesize - 1); -+ } -+ -+ return part->parent->_unlock(part->parent, ofs, len); - } - - static int part_is_locked(struct mtd_info *mtd, loff_t ofs, uint64_t len) diff --git a/target/linux/generic/pending-4.19/419-mtd-redboot-add-of_match_table-with-DT-binding.patch b/target/linux/generic/pending-4.19/419-mtd-redboot-add-of_match_table-with-DT-binding.patch deleted file mode 100644 index fbf9a0553c..0000000000 --- a/target/linux/generic/pending-4.19/419-mtd-redboot-add-of_match_table-with-DT-binding.patch +++ /dev/null @@ -1,31 +0,0 @@ -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= -Subject: [PATCH] mtd: redboot: add of_match_table with DT binding -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -This allows parsing RedBoot compatible partitions for properly described -flash device in DT. - -Signed-off-by: Rafał Miłecki ---- - ---- a/drivers/mtd/redboot.c -+++ b/drivers/mtd/redboot.c -@@ -289,9 +289,16 @@ static int parse_redboot_partitions(stru - return ret; - } - -+static const struct of_device_id redboot_parser_of_match_table[] = { -+ { .compatible = "ecoscentric,redboot-fis-partitions" }, -+ {}, -+}; -+MODULE_DEVICE_TABLE(of, redboot_parser_of_match_table); -+ - static struct mtd_part_parser redboot_parser = { - .parse_fn = parse_redboot_partitions, - .name = "RedBoot", -+ .of_match_table = redboot_parser_of_match_table, - }; - module_mtd_part_parser(redboot_parser); - diff --git a/target/linux/generic/pending-4.19/420-mtd-redboot_space.patch b/target/linux/generic/pending-4.19/420-mtd-redboot_space.patch deleted file mode 100644 index 85fbe0512d..0000000000 --- a/target/linux/generic/pending-4.19/420-mtd-redboot_space.patch +++ /dev/null @@ -1,41 +0,0 @@ -From: Felix Fietkau -Subject: add patch for including unpartitioned space in the rootfs partition for redboot devices (if applicable) - -[john@phrozen.org: used by ixp and others] - -lede-commit: 394918851f84e4d00fa16eb900e7700e95091f00 -Signed-off-by: Felix Fietkau ---- - drivers/mtd/redboot.c | 19 +++++++++++++------ - 1 file changed, 13 insertions(+), 6 deletions(-) - ---- a/drivers/mtd/redboot.c -+++ b/drivers/mtd/redboot.c -@@ -265,14 +265,21 @@ static int parse_redboot_partitions(stru - #endif - names += strlen(names)+1; - --#ifdef CONFIG_MTD_REDBOOT_PARTS_UNALLOCATED - if(fl->next && fl->img->flash_base + fl->img->size + master->erasesize <= fl->next->img->flash_base) { -- i++; -- parts[i].offset = parts[i-1].size + parts[i-1].offset; -- parts[i].size = fl->next->img->flash_base - parts[i].offset; -- parts[i].name = nullname; -- } -+ if (!strcmp(parts[i].name, "rootfs")) { -+ parts[i].size = fl->next->img->flash_base; -+ parts[i].size &= ~(master->erasesize - 1); -+ parts[i].size -= parts[i].offset; -+#ifdef CONFIG_MTD_REDBOOT_PARTS_UNALLOCATED -+ nrparts--; -+ } else { -+ i++; -+ parts[i].offset = parts[i-1].size + parts[i-1].offset; -+ parts[i].size = fl->next->img->flash_base - parts[i].offset; -+ parts[i].name = nullname; - #endif -+ } -+ } - tmp_fl = fl; - fl = fl->next; - kfree(tmp_fl); diff --git a/target/linux/generic/pending-4.19/430-mtd-add-myloader-partition-parser.patch b/target/linux/generic/pending-4.19/430-mtd-add-myloader-partition-parser.patch deleted file mode 100644 index bd49893dd8..0000000000 --- a/target/linux/generic/pending-4.19/430-mtd-add-myloader-partition-parser.patch +++ /dev/null @@ -1,47 +0,0 @@ -From: Florian Fainelli -Subject: Add myloader partition table parser - -[john@phozen.org: shoud be upstreamable] - -lede-commit: d8bf22859b51faa09d22c056fe221a45d2f7a3b8 -Signed-off-by: Florian Fainelli ---- - drivers/mtd/Kconfig | 16 ++++++++++++++++ - drivers/mtd/Makefile | 1 + - 2 files changed, 17 insertions(+) - ---- a/drivers/mtd/Kconfig -+++ b/drivers/mtd/Kconfig -@@ -177,6 +177,22 @@ menu "Partition parsers" - source "drivers/mtd/parsers/Kconfig" - endmenu - -+config MTD_MYLOADER_PARTS -+ tristate "MyLoader partition parsing" -+ depends on ADM5120 || ATH25 || ATH79 -+ ---help--- -+ MyLoader is a bootloader which allows the user to define partitions -+ in flash devices, by putting a table in the second erase block -+ on the device, similar to a partition table. This table gives the -+ offsets and lengths of the user defined partitions. -+ -+ If you need code which can detect and parse these tables, and -+ register MTD 'partitions' corresponding to each image detected, -+ enable this option. -+ -+ You will still need the parsing functions to be called by the driver -+ for your particular device. It won't happen automatically. -+ - comment "User Modules And Translation Layers" - - # ---- a/drivers/mtd/Makefile -+++ b/drivers/mtd/Makefile -@@ -16,6 +16,7 @@ obj-$(CONFIG_MTD_AFS_PARTS) += afs.o - obj-$(CONFIG_MTD_AR7_PARTS) += ar7part.o - obj-$(CONFIG_MTD_BCM63XX_PARTS) += bcm63xxpart.o - obj-$(CONFIG_MTD_BCM47XX_PARTS) += bcm47xxpart.o -+obj-$(CONFIG_MTD_MYLOADER_PARTS) += myloader.o - obj-y += parsers/ - - # 'Users' - code which presents functionality to userspace. diff --git a/target/linux/generic/pending-4.19/431-mtd-bcm47xxpart-check-for-bad-blocks-when-calculatin.patch b/target/linux/generic/pending-4.19/431-mtd-bcm47xxpart-check-for-bad-blocks-when-calculatin.patch deleted file mode 100644 index d54c284c34..0000000000 --- a/target/linux/generic/pending-4.19/431-mtd-bcm47xxpart-check-for-bad-blocks-when-calculatin.patch +++ /dev/null @@ -1,68 +0,0 @@ -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= -Subject: [PATCH] mtd: bcm47xxpart: check for bad blocks when calculating offsets - -Signed-off-by: Rafał Miłecki ---- - ---- a/drivers/mtd/parsers/parser_trx.c -+++ b/drivers/mtd/parsers/parser_trx.c -@@ -29,6 +29,33 @@ struct trx_header { - uint32_t offset[3]; - } __packed; - -+/* -+ * Calculate real end offset (address) for a given amount of data. It checks -+ * all blocks skipping bad ones. -+ */ -+static size_t parser_trx_real_offset(struct mtd_info *mtd, size_t bytes) -+{ -+ size_t real_offset = 0; -+ -+ if (mtd_block_isbad(mtd, real_offset)) -+ pr_warn("Base offset shouldn't be at bad block"); -+ -+ while (bytes >= mtd->erasesize) { -+ bytes -= mtd->erasesize; -+ real_offset += mtd->erasesize; -+ while (mtd_block_isbad(mtd, real_offset)) { -+ real_offset += mtd->erasesize; -+ -+ if (real_offset >= mtd->size) -+ return real_offset - mtd->erasesize; -+ } -+ } -+ -+ real_offset += bytes; -+ -+ return real_offset; -+} -+ - static const char *parser_trx_data_part_name(struct mtd_info *master, - size_t offset) - { -@@ -83,21 +110,21 @@ static int parser_trx_parse(struct mtd_i - if (trx.offset[2]) { - part = &parts[curr_part++]; - part->name = "loader"; -- part->offset = trx.offset[i]; -+ part->offset = parser_trx_real_offset(mtd, trx.offset[i]); - i++; - } - - if (trx.offset[i]) { - part = &parts[curr_part++]; - part->name = "linux"; -- part->offset = trx.offset[i]; -+ part->offset = parser_trx_real_offset(mtd, trx.offset[i]); - i++; - } - - if (trx.offset[i]) { - part = &parts[curr_part++]; -- part->name = parser_trx_data_part_name(mtd, trx.offset[i]); -- part->offset = trx.offset[i]; -+ part->offset = parser_trx_real_offset(mtd, trx.offset[i]); -+ part->name = parser_trx_data_part_name(mtd, part->offset); - i++; - } - diff --git a/target/linux/generic/pending-4.19/432-mtd-bcm47xxpart-detect-T_Meter-partition.patch b/target/linux/generic/pending-4.19/432-mtd-bcm47xxpart-detect-T_Meter-partition.patch deleted file mode 100644 index a6d0828b99..0000000000 --- a/target/linux/generic/pending-4.19/432-mtd-bcm47xxpart-detect-T_Meter-partition.patch +++ /dev/null @@ -1,37 +0,0 @@ -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= -Subject: mtd: bcm47xxpart: detect T_Meter partition - -It can be found on many Netgear devices. It consists of many 0x30 blocks -starting with 4D 54. - -Signed-off-by: Rafał Miłecki ---- - drivers/mtd/bcm47xxpart.c | 10 ++++++++++ - 1 file changed, 10 insertions(+) - ---- a/drivers/mtd/bcm47xxpart.c -+++ b/drivers/mtd/bcm47xxpart.c -@@ -39,6 +39,7 @@ - #define NVRAM_HEADER 0x48534C46 /* FLSH */ - #define POT_MAGIC1 0x54544f50 /* POTT */ - #define POT_MAGIC2 0x504f /* OP */ -+#define T_METER_MAGIC 0x4D540000 /* MT */ - #define ML_MAGIC1 0x39685a42 - #define ML_MAGIC2 0x26594131 - #define TRX_MAGIC 0x30524448 -@@ -182,6 +183,15 @@ static int bcm47xxpart_parse(struct mtd_ - MTD_WRITEABLE); - continue; - } -+ -+ /* T_Meter */ -+ if ((le32_to_cpu(buf[0x000 / 4]) & 0xFFFF0000) == T_METER_MAGIC && -+ (le32_to_cpu(buf[0x030 / 4]) & 0xFFFF0000) == T_METER_MAGIC && -+ (le32_to_cpu(buf[0x060 / 4]) & 0xFFFF0000) == T_METER_MAGIC) { -+ bcm47xxpart_add_part(&parts[curr_part++], "T_Meter", offset, -+ MTD_WRITEABLE); -+ continue; -+ } - - /* TRX */ - if (buf[0x000 / 4] == TRX_MAGIC) { diff --git a/target/linux/generic/pending-4.19/440-block2mtd_init.patch b/target/linux/generic/pending-4.19/440-block2mtd_init.patch deleted file mode 100644 index b8ec11f3dd..0000000000 --- a/target/linux/generic/pending-4.19/440-block2mtd_init.patch +++ /dev/null @@ -1,116 +0,0 @@ -From: Felix Fietkau -Subject: block2mtd - -Signed-off-by: Felix Fietkau ---- - drivers/mtd/devices/block2mtd.c | 30 ++++++++++++++++++++---------- - 1 file changed, 20 insertions(+), 10 deletions(-) - ---- a/drivers/mtd/devices/block2mtd.c -+++ b/drivers/mtd/devices/block2mtd.c -@@ -26,6 +26,7 @@ - #include - #include - #include -+#include - #include - #include - #include -@@ -214,7 +215,7 @@ static void block2mtd_free_device(struct - - - static struct block2mtd_dev *add_device(char *devname, int erase_size, -- int timeout) -+ const char *mtdname, int timeout) - { - #ifndef MODULE - int i; -@@ -222,6 +223,7 @@ static struct block2mtd_dev *add_device( - const fmode_t mode = FMODE_READ | FMODE_WRITE | FMODE_EXCL; - struct block_device *bdev; - struct block2mtd_dev *dev; -+ struct mtd_partition *part; - char *name; - - if (!devname) -@@ -278,13 +280,16 @@ static struct block2mtd_dev *add_device( - - /* Setup the MTD structure */ - /* make the name contain the block device in */ -- name = kasprintf(GFP_KERNEL, "block2mtd: %s", devname); -+ if (!mtdname) -+ mtdname = devname; -+ name = kmalloc(strlen(mtdname) + 1, GFP_KERNEL); - if (!name) - goto err_destroy_mutex; - -+ strcpy(name, mtdname); - dev->mtd.name = name; - -- dev->mtd.size = dev->blkdev->bd_inode->i_size & PAGE_MASK; -+ dev->mtd.size = dev->blkdev->bd_inode->i_size & PAGE_MASK & ~(erase_size - 1); - dev->mtd.erasesize = erase_size; - dev->mtd.writesize = 1; - dev->mtd.writebufsize = PAGE_SIZE; -@@ -297,7 +302,11 @@ static struct block2mtd_dev *add_device( - dev->mtd.priv = dev; - dev->mtd.owner = THIS_MODULE; - -- if (mtd_device_register(&dev->mtd, NULL, 0)) { -+ part = kzalloc(sizeof(struct mtd_partition), GFP_KERNEL); -+ part->name = name; -+ part->offset = 0; -+ part->size = dev->mtd.size; -+ if (mtd_device_register(&dev->mtd, part, 1)) { - /* Device didn't get added, so free the entry */ - goto err_destroy_mutex; - } -@@ -305,8 +314,7 @@ static struct block2mtd_dev *add_device( - list_add(&dev->list, &blkmtd_device_list); - pr_info("mtd%d: [%s] erase_size = %dKiB [%d]\n", - dev->mtd.index, -- dev->mtd.name + strlen("block2mtd: "), -- dev->mtd.erasesize >> 10, dev->mtd.erasesize); -+ mtdname, dev->mtd.erasesize >> 10, dev->mtd.erasesize); - return dev; - - err_destroy_mutex: -@@ -379,7 +387,7 @@ static int block2mtd_setup2(const char * - /* 80 for device, 12 for erase size, 80 for name, 8 for timeout */ - char buf[80 + 12 + 80 + 8]; - char *str = buf; -- char *token[2]; -+ char *token[3]; - char *name; - size_t erase_size = PAGE_SIZE; - unsigned long timeout = MTD_DEFAULT_TIMEOUT; -@@ -393,7 +401,7 @@ static int block2mtd_setup2(const char * - strcpy(str, val); - kill_final_newline(str); - -- for (i = 0; i < 2; i++) -+ for (i = 0; i < 3; i++) - token[i] = strsep(&str, ","); - - if (str) { -@@ -419,8 +427,10 @@ static int block2mtd_setup2(const char * - return 0; - } - } -+ if (token[2] && (strlen(token[2]) + 1 > 80)) -+ pr_err("mtd device name too long\n"); - -- add_device(name, erase_size, timeout); -+ add_device(name, erase_size, token[2], timeout); - - return 0; - } -@@ -454,7 +464,7 @@ static int block2mtd_setup(const char *v - - - module_param_call(block2mtd, block2mtd_setup, NULL, NULL, 0200); --MODULE_PARM_DESC(block2mtd, "Device to use. \"block2mtd=[,]\""); -+MODULE_PARM_DESC(block2mtd, "Device to use. \"block2mtd=[,[,]]\""); - - static int __init block2mtd_init(void) - { diff --git a/target/linux/generic/pending-4.19/441-block2mtd_probe.patch b/target/linux/generic/pending-4.19/441-block2mtd_probe.patch deleted file mode 100644 index 7e974e01ed..0000000000 --- a/target/linux/generic/pending-4.19/441-block2mtd_probe.patch +++ /dev/null @@ -1,47 +0,0 @@ -From: Felix Fietkau -Subject: block2mtd - -Signed-off-by: Felix Fietkau ---- - drivers/mtd/devices/block2mtd.c | 9 ++++++--- - 1 file changed, 6 insertions(+), 3 deletions(-) - ---- a/drivers/mtd/devices/block2mtd.c -+++ b/drivers/mtd/devices/block2mtd.c -@@ -387,7 +387,7 @@ static int block2mtd_setup2(const char * - /* 80 for device, 12 for erase size, 80 for name, 8 for timeout */ - char buf[80 + 12 + 80 + 8]; - char *str = buf; -- char *token[3]; -+ char *token[4]; - char *name; - size_t erase_size = PAGE_SIZE; - unsigned long timeout = MTD_DEFAULT_TIMEOUT; -@@ -401,7 +401,7 @@ static int block2mtd_setup2(const char * - strcpy(str, val); - kill_final_newline(str); - -- for (i = 0; i < 3; i++) -+ for (i = 0; i < 4; i++) - token[i] = strsep(&str, ","); - - if (str) { -@@ -430,6 +430,9 @@ static int block2mtd_setup2(const char * - if (token[2] && (strlen(token[2]) + 1 > 80)) - pr_err("mtd device name too long\n"); - -+ if (token[3] && kstrtoul(token[3], 0, &timeout)) -+ pr_err("invalid timeout\n"); -+ - add_device(name, erase_size, token[2], timeout); - - return 0; -@@ -464,7 +467,7 @@ static int block2mtd_setup(const char *v - - - module_param_call(block2mtd, block2mtd_setup, NULL, NULL, 0200); --MODULE_PARM_DESC(block2mtd, "Device to use. \"block2mtd=[,[,]]\""); -+MODULE_PARM_DESC(block2mtd, "Device to use. \"block2mtd=[,[,[,]]]\""); - - static int __init block2mtd_init(void) - { diff --git a/target/linux/generic/pending-4.19/450-mtd-spi-nor-allow-NOR-driver-to-write-fewer-bytes-th.patch b/target/linux/generic/pending-4.19/450-mtd-spi-nor-allow-NOR-driver-to-write-fewer-bytes-th.patch deleted file mode 100644 index ecc3ea1de6..0000000000 --- a/target/linux/generic/pending-4.19/450-mtd-spi-nor-allow-NOR-driver-to-write-fewer-bytes-th.patch +++ /dev/null @@ -1,36 +0,0 @@ -From: Felix Fietkau -Date: Thu, 22 Feb 2018 11:11:57 +0100 -Subject: [PATCH] mtd: spi-nor: allow NOR driver to write fewer bytes than - requested - -The write size can be constrained by the maximum message/transfer size -of the SPI controller. Only check for ret = 0 to avoid an infinite loop. - -Signed-off-by: Felix Fietkau ---- - ---- a/drivers/mtd/spi-nor/spi-nor.c -+++ b/drivers/mtd/spi-nor/spi-nor.c -@@ -1455,7 +1455,7 @@ static int spi_nor_write(struct mtd_info - - write_enable(nor); - ret = nor->write(nor, addr, page_remain, buf + i); -- if (ret < 0) -+ if (ret <= 0) - goto write_err; - written = ret; - -@@ -1464,13 +1464,6 @@ static int spi_nor_write(struct mtd_info - goto write_err; - *retlen += written; - i += written; -- if (written != page_remain) { -- dev_err(nor->dev, -- "While writing %zu bytes written %zd bytes\n", -- page_remain, written); -- ret = -EIO; -- goto write_err; -- } - } - - write_err: diff --git a/target/linux/generic/pending-4.19/460-mtd-cfi_cmdset_0002-no-erase_suspend.patch b/target/linux/generic/pending-4.19/460-mtd-cfi_cmdset_0002-no-erase_suspend.patch deleted file mode 100644 index 88d386302a..0000000000 --- a/target/linux/generic/pending-4.19/460-mtd-cfi_cmdset_0002-no-erase_suspend.patch +++ /dev/null @@ -1,25 +0,0 @@ -From: Felix Fietkau -Subject: kernel: disable cfi cmdset 0002 erase suspend - -on some platforms, erase suspend leads to data corruption and lockups when write -ops collide with erase ops. this has been observed on the buffalo wzr-hp-g300nh. -rather than play whack-a-mole with a hard to reproduce issue on a variety of devices, -simply disable erase suspend, as it will usually not produce any useful gain on -the small filesystems used on embedded hardware. - -Signed-off-by: Felix Fietkau ---- - drivers/mtd/chips/cfi_cmdset_0002.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - ---- a/drivers/mtd/chips/cfi_cmdset_0002.c -+++ b/drivers/mtd/chips/cfi_cmdset_0002.c -@@ -812,7 +812,7 @@ static int get_chip(struct map_info *map - return 0; - - case FL_ERASING: -- if (!cfip || !(cfip->EraseSuspend & (0x1|0x2)) || -+ if (1 /* no suspend */ || !cfip || !(cfip->EraseSuspend & (0x1|0x2)) || - !(mode == FL_READY || mode == FL_POINT || - (mode == FL_WRITING && (cfip->EraseSuspend & 0x2)))) - goto sleep; diff --git a/target/linux/generic/pending-4.19/461-mtd-cfi_cmdset_0002-add-buffer-write-cmd-timeout.patch b/target/linux/generic/pending-4.19/461-mtd-cfi_cmdset_0002-add-buffer-write-cmd-timeout.patch deleted file mode 100644 index f4ba5b72f7..0000000000 --- a/target/linux/generic/pending-4.19/461-mtd-cfi_cmdset_0002-add-buffer-write-cmd-timeout.patch +++ /dev/null @@ -1,17 +0,0 @@ -From: George Kashperko -Subject: Issue map read after Write Buffer Load command to ensure chip is ready to receive data. - -Signed-off-by: George Kashperko ---- - drivers/mtd/chips/cfi_cmdset_0002.c | 1 + - 1 file changed, 1 insertion(+) ---- a/drivers/mtd/chips/cfi_cmdset_0002.c -+++ b/drivers/mtd/chips/cfi_cmdset_0002.c -@@ -1832,6 +1832,7 @@ static int __xipram do_write_buffer(stru - - /* Write Buffer Load */ - map_write(map, CMD(0x25), cmd_adr); -+ (void) map_read(map, cmd_adr); - - chip->state = FL_WRITING_TO_BUFFER; - diff --git a/target/linux/generic/pending-4.19/465-m25p80-mx-disable-software-protection.patch b/target/linux/generic/pending-4.19/465-m25p80-mx-disable-software-protection.patch deleted file mode 100644 index fa25c65564..0000000000 --- a/target/linux/generic/pending-4.19/465-m25p80-mx-disable-software-protection.patch +++ /dev/null @@ -1,18 +0,0 @@ -From: Felix Fietkau -Subject: Disable software protection bits for Macronix flashes. - -Signed-off-by: Felix Fietkau ---- - drivers/mtd/spi-nor/spi-nor.c | 1 + - 1 file changed, 1 insertion(+) - ---- a/drivers/mtd/spi-nor/spi-nor.c -+++ b/drivers/mtd/spi-nor/spi-nor.c -@@ -2733,6 +2733,7 @@ static int spi_nor_init(struct spi_nor * - */ - if (JEDEC_MFR(nor->info) == SNOR_MFR_ATMEL || - JEDEC_MFR(nor->info) == SNOR_MFR_INTEL || -+ JEDEC_MFR(nor->info) == SNOR_MFR_MACRONIX || - JEDEC_MFR(nor->info) == SNOR_MFR_SST || - nor->info->flags & SPI_NOR_HAS_LOCK) { - write_enable(nor); diff --git a/target/linux/generic/pending-4.19/466-Revert-mtd-spi-nor-fix-Spansion-regressions-aliased-.patch b/target/linux/generic/pending-4.19/466-Revert-mtd-spi-nor-fix-Spansion-regressions-aliased-.patch deleted file mode 100644 index dcb86f69bf..0000000000 --- a/target/linux/generic/pending-4.19/466-Revert-mtd-spi-nor-fix-Spansion-regressions-aliased-.patch +++ /dev/null @@ -1,37 +0,0 @@ -From: Matthias Schiffer -Date: Tue, 9 Jan 2018 20:41:48 +0100 -Subject: [PATCH] Revert "mtd: spi-nor: fix Spansion regressions (aliased with - Winbond)" - -This reverts commit 67b9bcd36906e12a15ffec19463afbbd6a41660e. - -The underlying issue breaking Spansion flash has been fixed with "mtd: spi-nor: -wait until lock/unlock operations are ready" and "mtd: spi-nor: wait for SR_WIP -to clear on initial unlock", so we can support unlocking for Winbond flash -again. - -Signed-off-by: Matthias Schiffer ---- - drivers/mtd/spi-nor/spi-nor.c | 4 +++- - 1 file changed, 3 insertions(+), 1 deletion(-) - ---- a/drivers/mtd/spi-nor/spi-nor.c -+++ b/drivers/mtd/spi-nor/spi-nor.c -@@ -2735,6 +2735,7 @@ static int spi_nor_init(struct spi_nor * - JEDEC_MFR(nor->info) == SNOR_MFR_INTEL || - JEDEC_MFR(nor->info) == SNOR_MFR_MACRONIX || - JEDEC_MFR(nor->info) == SNOR_MFR_SST || -+ JEDEC_MFR(nor->info) == SNOR_MFR_WINBOND || - nor->info->flags & SPI_NOR_HAS_LOCK) { - write_enable(nor); - write_sr(nor, 0); -@@ -2871,7 +2872,8 @@ int spi_nor_scan(struct spi_nor *nor, co - - /* NOR protection support for STmicro/Micron chips and similar */ - if (JEDEC_MFR(info) == SNOR_MFR_MICRON || -- info->flags & SPI_NOR_HAS_LOCK) { -+ JEDEC_MFR(info) == SNOR_MFR_WINBOND || -+ info->flags & SPI_NOR_HAS_LOCK) { - nor->flash_lock = stm_lock; - nor->flash_unlock = stm_unlock; - nor->flash_is_locked = stm_is_locked; diff --git a/target/linux/generic/pending-4.19/470-mtd-spi-nor-support-limiting-4K-sectors-support-base.patch b/target/linux/generic/pending-4.19/470-mtd-spi-nor-support-limiting-4K-sectors-support-base.patch deleted file mode 100644 index a2ab6f3da5..0000000000 --- a/target/linux/generic/pending-4.19/470-mtd-spi-nor-support-limiting-4K-sectors-support-base.patch +++ /dev/null @@ -1,56 +0,0 @@ -From: Felix Fietkau -Date: Sat, 4 Nov 2017 07:40:23 +0100 -Subject: [PATCH] mtd: spi-nor: support limiting 4K sectors support based on - flash size - -Some devices need 4K sectors to be able to deal with small flash chips. -For instance, w25x05 is 64 KiB in size, and without 4K sectors, the -entire chip is just one erase block. -On bigger flash chip sizes, using 4K sectors can significantly slow down -many operations, including using a writable filesystem. There are several -platforms where it makes sense to use a single kernel on both kinds of -devices. - -To support this properly, allow configuring an upper flash chip size -limit for 4K sectors support. - -Signed-off-by: Felix Fietkau ---- - ---- a/drivers/mtd/spi-nor/Kconfig -+++ b/drivers/mtd/spi-nor/Kconfig -@@ -39,6 +39,17 @@ config SPI_ASPEED_SMC - and support for the SPI flash memory controller (SPI) for - the host firmware. The implementation only supports SPI NOR. - -+config MTD_SPI_NOR_USE_4K_SECTORS_LIMIT -+ int "Maximum flash chip size to use 4K sectors on (in KiB)" -+ depends on MTD_SPI_NOR_USE_4K_SECTORS -+ default "4096" -+ help -+ There are many flash chips that support 4K sectors, but are so large -+ that using them significantly slows down writing large amounts of -+ data or using a writable filesystem. -+ Any flash chip larger than the size specified in this option will -+ not use 4K sectors. -+ - config SPI_ATMEL_QUADSPI - tristate "Atmel Quad SPI Controller" - depends on ARCH_AT91 || (ARM && COMPILE_TEST && !ARCH_EBSA110) ---- a/drivers/mtd/spi-nor/spi-nor.c -+++ b/drivers/mtd/spi-nor/spi-nor.c -@@ -2647,10 +2647,12 @@ static int spi_nor_select_erase(struct s - - #ifdef CONFIG_MTD_SPI_NOR_USE_4K_SECTORS - /* prefer "small sector" erase if possible */ -- if (info->flags & SECT_4K) { -+ if ((info->flags & SECT_4K) && (mtd->size <= -+ CONFIG_MTD_SPI_NOR_USE_4K_SECTORS_LIMIT * 1024)) { - nor->erase_opcode = SPINOR_OP_BE_4K; - mtd->erasesize = 4096; -- } else if (info->flags & SECT_4K_PMC) { -+ } else if ((info->flags & SECT_4K_PMC) && (mtd->size <= -+ CONFIG_MTD_SPI_NOR_USE_4K_SECTORS_LIMIT * 1024)) { - nor->erase_opcode = SPINOR_OP_BE_4K_PMC; - mtd->erasesize = 4096; - } else diff --git a/target/linux/generic/pending-4.19/475-mtd-spi-nor-Add-Winbond-w25q128jv-support.patch b/target/linux/generic/pending-4.19/475-mtd-spi-nor-Add-Winbond-w25q128jv-support.patch deleted file mode 100644 index 8b5dc4eb01..0000000000 --- a/target/linux/generic/pending-4.19/475-mtd-spi-nor-Add-Winbond-w25q128jv-support.patch +++ /dev/null @@ -1,34 +0,0 @@ -From: Robert Marko -To: linux-mtd@lists.infradead.org -Subject: mtd: spi-nor: Add Winbond w25q128jv support -Date: Mon, 25 Jun 2018 13:17:48 +0200 - -Datasheet: -http://www.winbond.com/resource-files/w25q128jv%20revf%2003272018%20plus.pdf - -Testing done on Mikrotik Routerboard wAP R board. -It does not support Dual or Quad modes. - -Signed-off-by: Robert Marko ---- - -Changes in v2: - - Correct the title ---- - drivers/mtd/spi-nor/spi-nor.c | 5 +++++ - 1 file changed, 5 insertions(+) - ---- a/drivers/mtd/spi-nor/spi-nor.c -+++ b/drivers/mtd/spi-nor/spi-nor.c -@@ -1239,6 +1239,11 @@ static const struct flash_info spi_nor_i - SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ | - SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB) - }, -+ { -+ "w25q128jv", INFO(0xef7018, 0, 64 * 1024, 256, -+ SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ | -+ SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB) -+ }, - { "w25q80", INFO(0xef5014, 0, 64 * 1024, 16, SECT_4K) }, - { "w25q80bl", INFO(0xef4014, 0, 64 * 1024, 16, SECT_4K) }, - { "w25q128", INFO(0xef4018, 0, 64 * 1024, 256, SECT_4K) }, diff --git a/target/linux/generic/pending-4.19/476-mtd-spi-nor-add-eon-en25q128.patch b/target/linux/generic/pending-4.19/476-mtd-spi-nor-add-eon-en25q128.patch deleted file mode 100644 index 69ac17ce4c..0000000000 --- a/target/linux/generic/pending-4.19/476-mtd-spi-nor-add-eon-en25q128.patch +++ /dev/null @@ -1,18 +0,0 @@ -From: Piotr Dymacz -Subject: kernel/mtd: add support for EON EN25Q128 - -Signed-off-by: Piotr Dymacz ---- - drivers/mtd/spi-nor/spi-nor.c | 1 + - 1 file changed, 1 insertion(+) - ---- a/drivers/mtd/spi-nor/spi-nor.c -+++ b/drivers/mtd/spi-nor/spi-nor.c -@@ -994,6 +994,7 @@ static const struct flash_info spi_nor_i - { "en25q32b", INFO(0x1c3016, 0, 64 * 1024, 64, 0) }, - { "en25p64", INFO(0x1c2017, 0, 64 * 1024, 128, 0) }, - { "en25q64", INFO(0x1c3017, 0, 64 * 1024, 128, SECT_4K) }, -+ { "en25q128", INFO(0x1c3018, 0, 64 * 1024, 256, SECT_4K) }, - { "en25qh32", INFO(0x1c7016, 0, 64 * 1024, 64, 0) }, - { "en25qh128", INFO(0x1c7018, 0, 64 * 1024, 256, 0) }, - { "en25qh256", INFO(0x1c7019, 0, 64 * 1024, 512, 0) }, diff --git a/target/linux/generic/pending-4.19/477-mtd-add-spi-nor-add-mx25u3235f.patch b/target/linux/generic/pending-4.19/477-mtd-add-spi-nor-add-mx25u3235f.patch deleted file mode 100644 index 0648b12e12..0000000000 --- a/target/linux/generic/pending-4.19/477-mtd-add-spi-nor-add-mx25u3235f.patch +++ /dev/null @@ -1,18 +0,0 @@ -From: André Valentin -Subject: linux/mtd: add id for mx25u3235f needed by ZyXEL NBG6817 - -Signed-off-by: André Valentin ---- - drivers/mtd/spi-nor/spi-nor.c | 1 + - 1 file changed, 1 insertion(+) - ---- a/drivers/mtd/spi-nor/spi-nor.c -+++ b/drivers/mtd/spi-nor/spi-nor.c -@@ -1083,6 +1083,7 @@ static const struct flash_info spi_nor_i - { "mx25l3205d", INFO(0xc22016, 0, 64 * 1024, 64, SECT_4K) }, - { "mx25l3255e", INFO(0xc29e16, 0, 64 * 1024, 64, SECT_4K) }, - { "mx25l6405d", INFO(0xc22017, 0, 64 * 1024, 128, SECT_4K) }, -+ { "mx25u3235f", INFO(0xc22536, 0, 64 * 1024, 64, 0) }, - { "mx25u2033e", INFO(0xc22532, 0, 64 * 1024, 4, SECT_4K) }, - { "mx25u4035", INFO(0xc22533, 0, 64 * 1024, 8, SECT_4K) }, - { "mx25u8035", INFO(0xc22534, 0, 64 * 1024, 16, SECT_4K) }, diff --git a/target/linux/generic/pending-4.19/479-mtd-spi-nor-add-eon-en25qh64.patch b/target/linux/generic/pending-4.19/479-mtd-spi-nor-add-eon-en25qh64.patch deleted file mode 100644 index 6bb7754733..0000000000 --- a/target/linux/generic/pending-4.19/479-mtd-spi-nor-add-eon-en25qh64.patch +++ /dev/null @@ -1,10 +0,0 @@ ---- a/drivers/mtd/spi-nor/spi-nor.c -+++ b/drivers/mtd/spi-nor/spi-nor.c -@@ -996,6 +996,7 @@ static const struct flash_info spi_nor_i - { "en25q64", INFO(0x1c3017, 0, 64 * 1024, 128, SECT_4K) }, - { "en25q128", INFO(0x1c3018, 0, 64 * 1024, 256, SECT_4K) }, - { "en25qh32", INFO(0x1c7016, 0, 64 * 1024, 64, 0) }, -+ { "en25qh64", INFO(0x1c7017, 0, 64 * 1024, 128, 0) }, - { "en25qh128", INFO(0x1c7018, 0, 64 * 1024, 256, 0) }, - { "en25qh256", INFO(0x1c7019, 0, 64 * 1024, 512, 0) }, - { "en25s64", INFO(0x1c3817, 0, 64 * 1024, 128, SECT_4K) }, diff --git a/target/linux/generic/pending-4.19/480-mtd-set-rootfs-to-be-root-dev.patch b/target/linux/generic/pending-4.19/480-mtd-set-rootfs-to-be-root-dev.patch deleted file mode 100644 index dce0432fac..0000000000 --- a/target/linux/generic/pending-4.19/480-mtd-set-rootfs-to-be-root-dev.patch +++ /dev/null @@ -1,38 +0,0 @@ -From: Gabor Juhos -Subject: kernel/3.1[02]: move MTD root device setup code to mtdcore - -The current code only allows to automatically set -root device on MTD partitions. Move the code to MTD -core to allow to use it with all MTD devices. - -Signed-off-by: Gabor Juhos ---- - drivers/mtd/mtdcore.c | 10 ++++++++++ - 1 file changed, 10 insertions(+) - ---- a/drivers/mtd/mtdcore.c -+++ b/drivers/mtd/mtdcore.c -@@ -41,6 +41,7 @@ - #include - #include - #include -+#include - - #include - #include -@@ -593,6 +594,15 @@ int add_mtd_device(struct mtd_info *mtd) - of this try_ nonsense, and no bitching about it - either. :) */ - __module_get(THIS_MODULE); -+ -+ if (!strcmp(mtd->name, "rootfs") && -+ IS_ENABLED(CONFIG_MTD_ROOTFS_ROOT_DEV) && -+ ROOT_DEV == 0) { -+ pr_notice("mtd: device %d (%s) set to be root filesystem\n", -+ mtd->index, mtd->name); -+ ROOT_DEV = MKDEV(MTD_BLOCK_MAJOR, mtd->index); -+ } -+ - return 0; - - fail_added: diff --git a/target/linux/generic/pending-4.19/490-ubi-auto-attach-mtd-device-named-ubi-or-data-on-boot.patch b/target/linux/generic/pending-4.19/490-ubi-auto-attach-mtd-device-named-ubi-or-data-on-boot.patch deleted file mode 100644 index 79d18d036f..0000000000 --- a/target/linux/generic/pending-4.19/490-ubi-auto-attach-mtd-device-named-ubi-or-data-on-boot.patch +++ /dev/null @@ -1,97 +0,0 @@ -From: Daniel Golle -Subject: ubi: auto-attach mtd device named "ubi" or "data" on boot - -Signed-off-by: Daniel Golle ---- - drivers/mtd/ubi/build.c | 36 ++++++++++++++++++++++++++++++++++++ - 1 file changed, 36 insertions(+) - ---- a/drivers/mtd/ubi/build.c -+++ b/drivers/mtd/ubi/build.c -@@ -1181,6 +1181,73 @@ static struct mtd_info * __init open_mtd - return mtd; - } - -+/* -+ * This function tries attaching mtd partitions named either "ubi" or "data" -+ * during boot. -+ */ -+static void __init ubi_auto_attach(void) -+{ -+ int err; -+ struct mtd_info *mtd; -+ loff_t offset = 0; -+ size_t len; -+ char magic[4]; -+ -+ /* try attaching mtd device named "ubi" or "data" */ -+ mtd = open_mtd_device("ubi"); -+ if (IS_ERR(mtd)) -+ mtd = open_mtd_device("data"); -+ -+ if (IS_ERR(mtd)) -+ return; -+ -+ /* get the first not bad block */ -+ if (mtd_can_have_bb(mtd)) -+ while (mtd_block_isbad(mtd, offset)) { -+ offset += mtd->erasesize; -+ -+ if (offset > mtd->size) { -+ pr_err("UBI error: Failed to find a non-bad " -+ "block on mtd%d\n", mtd->index); -+ goto cleanup; -+ } -+ } -+ -+ /* check if the read from flash was successful */ -+ err = mtd_read(mtd, offset, 4, &len, (void *) magic); -+ if ((err && !mtd_is_bitflip(err)) || len != 4) { -+ pr_err("UBI error: unable to read from mtd%d\n", mtd->index); -+ goto cleanup; -+ } -+ -+ /* check for a valid ubi magic */ -+ if (strncmp(magic, "UBI#", 4)) { -+ pr_err("UBI error: no valid UBI magic found inside mtd%d\n", mtd->index); -+ goto cleanup; -+ } -+ -+ /* don't auto-add media types where UBI doesn't makes sense */ -+ if (mtd->type != MTD_NANDFLASH && -+ mtd->type != MTD_NORFLASH && -+ mtd->type != MTD_DATAFLASH && -+ mtd->type != MTD_MLCNANDFLASH) -+ goto cleanup; -+ -+ mutex_lock(&ubi_devices_mutex); -+ pr_notice("UBI: auto-attach mtd%d\n", mtd->index); -+ err = ubi_attach_mtd_dev(mtd, UBI_DEV_NUM_AUTO, 0, 0); -+ mutex_unlock(&ubi_devices_mutex); -+ if (err < 0) { -+ pr_err("UBI error: cannot attach mtd%d\n", mtd->index); -+ goto cleanup; -+ } -+ -+ return; -+ -+cleanup: -+ put_mtd_device(mtd); -+} -+ - static int __init ubi_init(void) - { - int err, i, k; -@@ -1264,6 +1331,12 @@ static int __init ubi_init(void) - } - } - -+ /* auto-attach mtd devices only if built-in to the kernel and no ubi.mtd -+ * parameter was given */ -+ if (IS_ENABLED(CONFIG_MTD_ROOTFS_ROOT_DEV) && -+ !ubi_is_module() && !mtd_devs) -+ ubi_auto_attach(); -+ - err = ubiblock_init(); - if (err) { - pr_err("UBI error: block: cannot initialize, error %d\n", err); diff --git a/target/linux/generic/pending-4.19/491-ubi-auto-create-ubiblock-device-for-rootfs.patch b/target/linux/generic/pending-4.19/491-ubi-auto-create-ubiblock-device-for-rootfs.patch deleted file mode 100644 index cb2d525610..0000000000 --- a/target/linux/generic/pending-4.19/491-ubi-auto-create-ubiblock-device-for-rootfs.patch +++ /dev/null @@ -1,66 +0,0 @@ -From: Daniel Golle -Subject: ubi: auto-create ubiblock device for rootfs - -Signed-off-by: Daniel Golle ---- - drivers/mtd/ubi/block.c | 42 ++++++++++++++++++++++++++++++++++++++++++ - 1 file changed, 42 insertions(+) - ---- a/drivers/mtd/ubi/block.c -+++ b/drivers/mtd/ubi/block.c -@@ -633,6 +633,44 @@ static void __init ubiblock_create_from_ - } - } - -+#define UBIFS_NODE_MAGIC 0x06101831 -+static inline int ubi_vol_is_ubifs(struct ubi_volume_desc *desc) -+{ -+ int ret; -+ uint32_t magic_of, magic; -+ ret = ubi_read(desc, 0, (char *)&magic_of, 0, 4); -+ if (ret) -+ return 0; -+ magic = le32_to_cpu(magic_of); -+ return magic == UBIFS_NODE_MAGIC; -+} -+ -+static void __init ubiblock_create_auto_rootfs(void) -+{ -+ int ubi_num, ret, is_ubifs; -+ struct ubi_volume_desc *desc; -+ struct ubi_volume_info vi; -+ -+ for (ubi_num = 0; ubi_num < UBI_MAX_DEVICES; ubi_num++) { -+ desc = ubi_open_volume_nm(ubi_num, "rootfs", UBI_READONLY); -+ if (IS_ERR(desc)) -+ continue; -+ -+ ubi_get_volume_info(desc, &vi); -+ is_ubifs = ubi_vol_is_ubifs(desc); -+ ubi_close_volume(desc); -+ if (is_ubifs) -+ break; -+ -+ ret = ubiblock_create(&vi); -+ if (ret) -+ pr_err("UBI error: block: can't add '%s' volume, err=%d\n", -+ vi.name, ret); -+ /* always break if we get here */ -+ break; -+ } -+} -+ - static void ubiblock_remove_all(void) - { - struct ubiblock *next; -@@ -665,6 +703,10 @@ int __init ubiblock_init(void) - */ - ubiblock_create_from_param(); - -+ /* auto-attach "rootfs" volume if existing and non-ubifs */ -+ if (IS_ENABLED(CONFIG_MTD_ROOTFS_ROOT_DEV)) -+ ubiblock_create_auto_rootfs(); -+ - /* - * Block devices are only created upon user requests, so we ignore - * existing volumes. diff --git a/target/linux/generic/pending-4.19/492-try-auto-mounting-ubi0-rootfs-in-init-do_mounts.c.patch b/target/linux/generic/pending-4.19/492-try-auto-mounting-ubi0-rootfs-in-init-do_mounts.c.patch deleted file mode 100644 index b76e83e4a3..0000000000 --- a/target/linux/generic/pending-4.19/492-try-auto-mounting-ubi0-rootfs-in-init-do_mounts.c.patch +++ /dev/null @@ -1,51 +0,0 @@ -From: Daniel Golle -Subject: try auto-mounting ubi0:rootfs in init/do_mounts.c - -Signed-off-by: Daniel Golle ---- - init/do_mounts.c | 26 +++++++++++++++++++++++++- - 1 file changed, 25 insertions(+), 1 deletion(-) - ---- a/init/do_mounts.c -+++ b/init/do_mounts.c -@@ -427,7 +427,28 @@ retry: - out: - put_page(page); - } -- -+ -+static int __init mount_ubi_rootfs(void) -+{ -+ int flags = MS_SILENT; -+ int err, tried = 0; -+ -+ while (tried < 2) { -+ err = do_mount_root("ubi0:rootfs", "ubifs", flags, \ -+ root_mount_data); -+ switch (err) { -+ case -EACCES: -+ flags |= MS_RDONLY; -+ tried++; -+ break; -+ default: -+ return err; -+ } -+ } -+ -+ return -EINVAL; -+} -+ - #ifdef CONFIG_ROOT_NFS - - #define NFSROOT_TIMEOUT_MIN 5 -@@ -521,6 +542,10 @@ void __init mount_root(void) - change_floppy("root floppy"); - } - #endif -+#ifdef CONFIG_MTD_ROOTFS_ROOT_DEV -+ if (!mount_ubi_rootfs()) -+ return; -+#endif - #ifdef CONFIG_BLOCK - { - int err = create_dev("/dev/root", ROOT_DEV); diff --git a/target/linux/generic/pending-4.19/493-ubi-set-ROOT_DEV-to-ubiblock-rootfs-if-unset.patch b/target/linux/generic/pending-4.19/493-ubi-set-ROOT_DEV-to-ubiblock-rootfs-if-unset.patch deleted file mode 100644 index 1bb53ada7f..0000000000 --- a/target/linux/generic/pending-4.19/493-ubi-set-ROOT_DEV-to-ubiblock-rootfs-if-unset.patch +++ /dev/null @@ -1,34 +0,0 @@ -From: Daniel Golle -Subject: ubi: set ROOT_DEV to ubiblock "rootfs" if unset - -Signed-off-by: Daniel Golle ---- - drivers/mtd/ubi/block.c | 10 ++++++++++ - 1 file changed, 10 insertions(+) - ---- a/drivers/mtd/ubi/block.c -+++ b/drivers/mtd/ubi/block.c -@@ -50,6 +50,7 @@ - #include - #include - #include -+#include - - #include "ubi-media.h" - #include "ubi.h" -@@ -445,6 +446,15 @@ int ubiblock_create(struct ubi_volume_in - dev_info(disk_to_dev(dev->gd), "created from ubi%d:%d(%s)", - dev->ubi_num, dev->vol_id, vi->name); - mutex_unlock(&devices_mutex); -+ -+ if (!strcmp(vi->name, "rootfs") && -+ IS_ENABLED(CONFIG_MTD_ROOTFS_ROOT_DEV) && -+ ROOT_DEV == 0) { -+ pr_notice("ubiblock: device ubiblock%d_%d (%s) set to be root filesystem\n", -+ dev->ubi_num, dev->vol_id, vi->name); -+ ROOT_DEV = MKDEV(gd->major, gd->first_minor); -+ } -+ - return 0; - - out_free_queue: diff --git a/target/linux/generic/pending-4.19/494-mtd-ubi-add-EOF-marker-support.patch b/target/linux/generic/pending-4.19/494-mtd-ubi-add-EOF-marker-support.patch deleted file mode 100644 index e38f11e592..0000000000 --- a/target/linux/generic/pending-4.19/494-mtd-ubi-add-EOF-marker-support.patch +++ /dev/null @@ -1,60 +0,0 @@ -From: Gabor Juhos -Subject: mtd: add EOF marker support to the UBI layer - -Signed-off-by: Gabor Juhos ---- - drivers/mtd/ubi/attach.c | 25 ++++++++++++++++++++++--- - drivers/mtd/ubi/ubi.h | 1 + - 2 files changed, 23 insertions(+), 3 deletions(-) - ---- a/drivers/mtd/ubi/attach.c -+++ b/drivers/mtd/ubi/attach.c -@@ -939,6 +939,13 @@ static bool vol_ignored(int vol_id) - #endif - } - -+static bool ec_hdr_has_eof(struct ubi_ec_hdr *ech) -+{ -+ return ech->padding1[0] == 'E' && -+ ech->padding1[1] == 'O' && -+ ech->padding1[2] == 'F'; -+} -+ - /** - * scan_peb - scan and process UBI headers of a PEB. - * @ubi: UBI device description object -@@ -971,9 +978,21 @@ static int scan_peb(struct ubi_device *u - return 0; - } - -- err = ubi_io_read_ec_hdr(ubi, pnum, ech, 0); -- if (err < 0) -- return err; -+ if (!ai->eof_found) { -+ err = ubi_io_read_ec_hdr(ubi, pnum, ech, 0); -+ if (err < 0) -+ return err; -+ -+ if (ec_hdr_has_eof(ech)) { -+ pr_notice("UBI: EOF marker found, PEBs from %d will be erased\n", -+ pnum); -+ ai->eof_found = true; -+ } -+ } -+ -+ if (ai->eof_found) -+ err = UBI_IO_FF_BITFLIPS; -+ - switch (err) { - case 0: - break; ---- a/drivers/mtd/ubi/ubi.h -+++ b/drivers/mtd/ubi/ubi.h -@@ -789,6 +789,7 @@ struct ubi_attach_info { - int mean_ec; - uint64_t ec_sum; - int ec_count; -+ bool eof_found; - struct kmem_cache *aeb_slab_cache; - struct ubi_ec_hdr *ech; - struct ubi_vid_io_buf *vidb; diff --git a/target/linux/generic/pending-4.19/495-mtd-core-add-get_mtd_device_by_node.patch b/target/linux/generic/pending-4.19/495-mtd-core-add-get_mtd_device_by_node.patch deleted file mode 100644 index 1446ca2abc..0000000000 --- a/target/linux/generic/pending-4.19/495-mtd-core-add-get_mtd_device_by_node.patch +++ /dev/null @@ -1,75 +0,0 @@ -From 1bd1b740f208d1cf4071932cc51860d37266c402 Mon Sep 17 00:00:00 2001 -From: Bernhard Frauendienst -Date: Sat, 1 Sep 2018 00:30:11 +0200 -Subject: [PATCH 495/497] mtd: core: add get_mtd_device_by_node - -Add function to retrieve a mtd device by its OF node. Since drivers can -assign arbitrary names to mtd devices in the absence of a label -property, there is no other reliable way to retrieve a mtd device for a -given OF node. - -Signed-off-by: Bernhard Frauendienst -Reviewed-by: Miquel Raynal ---- - drivers/mtd/mtdcore.c | 38 ++++++++++++++++++++++++++++++++++++++ - include/linux/mtd/mtd.h | 2 ++ - 2 files changed, 40 insertions(+) - ---- a/drivers/mtd/mtdcore.c -+++ b/drivers/mtd/mtdcore.c -@@ -938,6 +938,44 @@ out_unlock: - } - EXPORT_SYMBOL_GPL(get_mtd_device_nm); - -+/** -+ * get_mtd_device_by_node - obtain a validated handle for an MTD device -+ * by of_node -+ * @of_node: OF node of MTD device to open -+ * -+ * This function returns MTD device description structure in case of -+ * success and an error code in case of failure. -+ */ -+struct mtd_info *get_mtd_device_by_node(const struct device_node *of_node) -+{ -+ int err = -ENODEV; -+ struct mtd_info *mtd = NULL, *other; -+ -+ mutex_lock(&mtd_table_mutex); -+ -+ mtd_for_each_device(other) { -+ if (of_node == other->dev.of_node) { -+ mtd = other; -+ break; -+ } -+ } -+ -+ if (!mtd) -+ goto out_unlock; -+ -+ err = __get_mtd_device(mtd); -+ if (err) -+ goto out_unlock; -+ -+ mutex_unlock(&mtd_table_mutex); -+ return mtd; -+ -+out_unlock: -+ mutex_unlock(&mtd_table_mutex); -+ return ERR_PTR(err); -+} -+EXPORT_SYMBOL_GPL(get_mtd_device_by_node); -+ - void put_mtd_device(struct mtd_info *mtd) - { - mutex_lock(&mtd_table_mutex); ---- a/include/linux/mtd/mtd.h -+++ b/include/linux/mtd/mtd.h -@@ -589,6 +589,8 @@ extern struct mtd_info *get_mtd_device(s - extern int __get_mtd_device(struct mtd_info *mtd); - extern void __put_mtd_device(struct mtd_info *mtd); - extern struct mtd_info *get_mtd_device_nm(const char *name); -+extern struct mtd_info *get_mtd_device_by_node( -+ const struct device_node *of_node); - extern void put_mtd_device(struct mtd_info *mtd); - - diff --git a/target/linux/generic/pending-4.19/496-dt-bindings-add-bindings-for-mtd-concat-devices.patch b/target/linux/generic/pending-4.19/496-dt-bindings-add-bindings-for-mtd-concat-devices.patch deleted file mode 100644 index 01f3b9ec2d..0000000000 --- a/target/linux/generic/pending-4.19/496-dt-bindings-add-bindings-for-mtd-concat-devices.patch +++ /dev/null @@ -1,52 +0,0 @@ -From 5734c6669fba7ddb5ef491ccff7159d15dba0b59 Mon Sep 17 00:00:00 2001 -From: Bernhard Frauendienst -Date: Wed, 5 Sep 2018 01:32:51 +0200 -Subject: [PATCH 496/497] dt-bindings: add bindings for mtd-concat devices - -Document virtual mtd-concat device bindings. - -Signed-off-by: Bernhard Frauendienst ---- - .../devicetree/bindings/mtd/mtd-concat.txt | 36 +++++++++++++++++++ - 1 file changed, 36 insertions(+) - create mode 100644 Documentation/devicetree/bindings/mtd/mtd-concat.txt - ---- /dev/null -+++ b/Documentation/devicetree/bindings/mtd/mtd-concat.txt -@@ -0,0 +1,36 @@ -+Virtual MTD concat device -+ -+Requires properties: -+- devices: list of phandles to mtd nodes that should be concatenated -+ -+Example: -+ -+&spi { -+ flash0: flash@0 { -+ ... -+ }; -+ flash1: flash@1 { -+ ... -+ }; -+}; -+ -+flash { -+ compatible = "mtd-concat"; -+ -+ devices = <&flash0 &flash1>; -+ -+ partitions { -+ compatible = "fixed-partitions"; -+ -+ partition@0 { -+ label = "boot"; -+ reg = <0x0000000 0x0040000>; -+ read-only; -+ }; -+ -+ partition@40000 { -+ label = "firmware"; -+ reg = <0x0040000 0x1fc0000>; -+ }; -+ } -+} diff --git a/target/linux/generic/pending-4.19/497-mtd-mtdconcat-add-dt-driver-for-concat-devices.patch b/target/linux/generic/pending-4.19/497-mtd-mtdconcat-add-dt-driver-for-concat-devices.patch deleted file mode 100644 index 6584e22882..0000000000 --- a/target/linux/generic/pending-4.19/497-mtd-mtdconcat-add-dt-driver-for-concat-devices.patch +++ /dev/null @@ -1,216 +0,0 @@ -From e53f712d8eac71f54399b61038ccf87d2cee99d7 Mon Sep 17 00:00:00 2001 -From: Bernhard Frauendienst -Date: Sat, 25 Aug 2018 12:35:22 +0200 -Subject: [PATCH 497/497] mtd: mtdconcat: add dt driver for concat devices - -Some mtd drivers like physmap variants have support for concatenating -multiple mtd devices, but there is no generic way to define such a -concat device from within the device tree. - -This is useful for some SoC boards that use multiple flash chips as -memory banks of a single mtd device, with partitions spanning chip -borders. - -This commit adds a driver for creating virtual mtd-concat devices. They -must have a compatible = "mtd-concat" line, and define a list of devices -to concat in the 'devices' property, for example: - -flash { - compatible = "mtd-concat"; - - devices = <&flash0 &flash1>; - - partitions { - ... - }; -}; - -The driver is added to the very end of the mtd Makefile to increase the -likelyhood of all child devices already being loaded at the time of -probing, preventing unnecessary deferred probes. - -Signed-off-by: Bernhard Frauendienst ---- - drivers/mtd/Kconfig | 2 + - drivers/mtd/Makefile | 3 + - drivers/mtd/composite/Kconfig | 12 +++ - drivers/mtd/composite/Makefile | 6 ++ - drivers/mtd/composite/virt_concat.c | 128 ++++++++++++++++++++++++++++ - 5 files changed, 151 insertions(+) - create mode 100644 drivers/mtd/composite/Kconfig - create mode 100644 drivers/mtd/composite/Makefile - create mode 100644 drivers/mtd/composite/virt_concat.c - ---- a/drivers/mtd/Kconfig -+++ b/drivers/mtd/Kconfig -@@ -374,4 +374,6 @@ source "drivers/mtd/spi-nor/Kconfig" - - source "drivers/mtd/ubi/Kconfig" - -+source "drivers/mtd/composite/Kconfig" -+ - endif # MTD ---- a/drivers/mtd/Makefile -+++ b/drivers/mtd/Makefile -@@ -39,3 +39,6 @@ obj-y += chips/ lpddr/ maps/ devices/ n - - obj-$(CONFIG_MTD_SPI_NOR) += spi-nor/ - obj-$(CONFIG_MTD_UBI) += ubi/ -+ -+# Composite drivers must be loaded last -+obj-y += composite/ ---- /dev/null -+++ b/drivers/mtd/composite/Kconfig -@@ -0,0 +1,12 @@ -+menu "Composite MTD device drivers" -+ depends on MTD!=n -+ -+config MTD_VIRT_CONCAT -+ tristate "Virtual concat MTD device" -+ help -+ This driver allows creation of a virtual MTD concat device, which -+ concatenates multiple underlying MTD devices to a single device. -+ This is required by some SoC boards where multiple memory banks are -+ used as one device with partitions spanning across device boundaries. -+ -+endmenu ---- /dev/null -+++ b/drivers/mtd/composite/Makefile -@@ -0,0 +1,6 @@ -+# SPDX-License-Identifier: GPL-2.0 -+# -+# linux/drivers/mtd/composite/Makefile -+# -+ -+obj-$(CONFIG_MTD_VIRT_CONCAT) += virt_concat.o ---- /dev/null -+++ b/drivers/mtd/composite/virt_concat.c -@@ -0,0 +1,128 @@ -+// SPDX-License-Identifier: GPL-2.0+ -+/* -+ * Virtual concat MTD device driver -+ * -+ * Copyright (C) 2018 Bernhard Frauendienst -+ * Author: Bernhard Frauendienst, kernel@nospam.obeliks.de -+ */ -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+/* -+ * struct of_virt_concat - platform device driver data. -+ * @cmtd the final mtd_concat device -+ * @num_devices the number of devices in @devices -+ * @devices points to an array of devices already loaded -+ */ -+struct of_virt_concat { -+ struct mtd_info *cmtd; -+ int num_devices; -+ struct mtd_info **devices; -+}; -+ -+static int virt_concat_remove(struct platform_device *pdev) -+{ -+ struct of_virt_concat *info; -+ int i; -+ -+ info = platform_get_drvdata(pdev); -+ if (!info) -+ return 0; -+ -+ // unset data for when this is called after a probe error -+ platform_set_drvdata(pdev, NULL); -+ -+ if (info->cmtd) { -+ mtd_device_unregister(info->cmtd); -+ mtd_concat_destroy(info->cmtd); -+ } -+ -+ if (info->devices) { -+ for (i = 0; i < info->num_devices; i++) -+ put_mtd_device(info->devices[i]); -+ } -+ -+ return 0; -+} -+ -+static int virt_concat_probe(struct platform_device *pdev) -+{ -+ struct device_node *node = pdev->dev.of_node; -+ struct of_phandle_iterator it; -+ struct of_virt_concat *info; -+ struct mtd_info *mtd; -+ int err = 0, count; -+ -+ count = of_count_phandle_with_args(node, "devices", NULL); -+ if (count <= 0) -+ return -EINVAL; -+ -+ info = devm_kzalloc(&pdev->dev, sizeof(*info), GFP_KERNEL); -+ if (!info) -+ return -ENOMEM; -+ info->devices = devm_kcalloc(&pdev->dev, count, -+ sizeof(*(info->devices)), GFP_KERNEL); -+ if (!info->devices) { -+ err = -ENOMEM; -+ goto err_remove; -+ } -+ -+ platform_set_drvdata(pdev, info); -+ -+ of_for_each_phandle(&it, err, node, "devices", NULL, 0) { -+ mtd = get_mtd_device_by_node(it.node); -+ if (IS_ERR(mtd)) { -+ of_node_put(it.node); -+ err = -EPROBE_DEFER; -+ goto err_remove; -+ } -+ -+ info->devices[info->num_devices++] = mtd; -+ } -+ -+ info->cmtd = mtd_concat_create(info->devices, info->num_devices, -+ dev_name(&pdev->dev)); -+ if (!info->cmtd) { -+ err = -ENXIO; -+ goto err_remove; -+ } -+ -+ info->cmtd->dev.parent = &pdev->dev; -+ mtd_set_of_node(info->cmtd, node); -+ mtd_device_register(info->cmtd, NULL, 0); -+ -+ return 0; -+ -+err_remove: -+ virt_concat_remove(pdev); -+ -+ return err; -+} -+ -+static const struct of_device_id virt_concat_of_match[] = { -+ { .compatible = "mtd-concat", }, -+ { /* sentinel */ } -+}; -+MODULE_DEVICE_TABLE(of, virt_concat_of_match); -+ -+static struct platform_driver virt_concat_driver = { -+ .probe = virt_concat_probe, -+ .remove = virt_concat_remove, -+ .driver = { -+ .name = "virt-mtdconcat", -+ .of_match_table = virt_concat_of_match, -+ }, -+}; -+ -+module_platform_driver(virt_concat_driver); -+ -+MODULE_LICENSE("GPL v2"); -+MODULE_AUTHOR("Bernhard Frauendienst "); -+MODULE_DESCRIPTION("Virtual concat MTD device driver"); diff --git a/target/linux/generic/pending-4.19/530-jffs2_make_lzma_available.patch b/target/linux/generic/pending-4.19/530-jffs2_make_lzma_available.patch deleted file mode 100644 index f0b4bdf036..0000000000 --- a/target/linux/generic/pending-4.19/530-jffs2_make_lzma_available.patch +++ /dev/null @@ -1,5180 +0,0 @@ -From: Alexandros C. Couloumbis -Subject: fs: add jffs2/lzma support (not activated by default yet) - -lede-commit: c2c88d315fa0e881f8b19da07b62859b915b11b2 -Signed-off-by: Alexandros C. Couloumbis ---- - fs/jffs2/Kconfig | 9 + - fs/jffs2/Makefile | 3 + - fs/jffs2/compr.c | 6 + - fs/jffs2/compr.h | 10 +- - fs/jffs2/compr_lzma.c | 128 +++ - fs/jffs2/super.c | 33 +- - include/linux/lzma.h | 62 ++ - include/linux/lzma/LzFind.h | 115 +++ - include/linux/lzma/LzHash.h | 54 + - include/linux/lzma/LzmaDec.h | 231 +++++ - include/linux/lzma/LzmaEnc.h | 80 ++ - include/linux/lzma/Types.h | 226 +++++ - include/uapi/linux/jffs2.h | 1 + - lib/Kconfig | 6 + - lib/Makefile | 12 + - lib/lzma/LzFind.c | 761 ++++++++++++++ - lib/lzma/LzmaDec.c | 999 +++++++++++++++++++ - lib/lzma/LzmaEnc.c | 2271 ++++++++++++++++++++++++++++++++++++++++++ - lib/lzma/Makefile | 7 + - 19 files changed, 5008 insertions(+), 6 deletions(-) - create mode 100644 fs/jffs2/compr_lzma.c - create mode 100644 include/linux/lzma.h - create mode 100644 include/linux/lzma/LzFind.h - create mode 100644 include/linux/lzma/LzHash.h - create mode 100644 include/linux/lzma/LzmaDec.h - create mode 100644 include/linux/lzma/LzmaEnc.h - create mode 100644 include/linux/lzma/Types.h - create mode 100644 lib/lzma/LzFind.c - create mode 100644 lib/lzma/LzmaDec.c - create mode 100644 lib/lzma/LzmaEnc.c - create mode 100644 lib/lzma/Makefile - ---- a/fs/jffs2/Kconfig -+++ b/fs/jffs2/Kconfig -@@ -135,6 +135,15 @@ config JFFS2_LZO - This feature was added in July, 2007. Say 'N' if you need - compatibility with older bootloaders or kernels. - -+config JFFS2_LZMA -+ bool "JFFS2 LZMA compression support" if JFFS2_COMPRESSION_OPTIONS -+ select LZMA_COMPRESS -+ select LZMA_DECOMPRESS -+ depends on JFFS2_FS -+ default n -+ help -+ JFFS2 wrapper to the LZMA C SDK -+ - config JFFS2_RTIME - bool "JFFS2 RTIME compression support" if JFFS2_COMPRESSION_OPTIONS - depends on JFFS2_FS ---- a/fs/jffs2/Makefile -+++ b/fs/jffs2/Makefile -@@ -19,4 +19,7 @@ jffs2-$(CONFIG_JFFS2_RUBIN) += compr_rub - jffs2-$(CONFIG_JFFS2_RTIME) += compr_rtime.o - jffs2-$(CONFIG_JFFS2_ZLIB) += compr_zlib.o - jffs2-$(CONFIG_JFFS2_LZO) += compr_lzo.o -+jffs2-$(CONFIG_JFFS2_LZMA) += compr_lzma.o - jffs2-$(CONFIG_JFFS2_SUMMARY) += summary.o -+ -+CFLAGS_compr_lzma.o += -Iinclude/linux -Ilib/lzma ---- a/fs/jffs2/compr.c -+++ b/fs/jffs2/compr.c -@@ -378,6 +378,9 @@ int __init jffs2_compressors_init(void) - #ifdef CONFIG_JFFS2_LZO - jffs2_lzo_init(); - #endif -+#ifdef CONFIG_JFFS2_LZMA -+ jffs2_lzma_init(); -+#endif - /* Setting default compression mode */ - #ifdef CONFIG_JFFS2_CMODE_NONE - jffs2_compression_mode = JFFS2_COMPR_MODE_NONE; -@@ -401,6 +404,9 @@ int __init jffs2_compressors_init(void) - int jffs2_compressors_exit(void) - { - /* Unregistering compressors */ -+#ifdef CONFIG_JFFS2_LZMA -+ jffs2_lzma_exit(); -+#endif - #ifdef CONFIG_JFFS2_LZO - jffs2_lzo_exit(); - #endif ---- a/fs/jffs2/compr.h -+++ b/fs/jffs2/compr.h -@@ -29,9 +29,9 @@ - #define JFFS2_DYNRUBIN_PRIORITY 20 - #define JFFS2_LZARI_PRIORITY 30 - #define JFFS2_RTIME_PRIORITY 50 --#define JFFS2_ZLIB_PRIORITY 60 --#define JFFS2_LZO_PRIORITY 80 -- -+#define JFFS2_LZMA_PRIORITY 70 -+#define JFFS2_ZLIB_PRIORITY 80 -+#define JFFS2_LZO_PRIORITY 90 - - #define JFFS2_RUBINMIPS_DISABLED /* RUBINs will be used only */ - #define JFFS2_DYNRUBIN_DISABLED /* for decompression */ -@@ -101,5 +101,9 @@ void jffs2_zlib_exit(void); - int jffs2_lzo_init(void); - void jffs2_lzo_exit(void); - #endif -+#ifdef CONFIG_JFFS2_LZMA -+int jffs2_lzma_init(void); -+void jffs2_lzma_exit(void); -+#endif - - #endif /* __JFFS2_COMPR_H__ */ ---- /dev/null -+++ b/fs/jffs2/compr_lzma.c -@@ -0,0 +1,128 @@ -+/* -+ * JFFS2 -- Journalling Flash File System, Version 2. -+ * -+ * For licensing information, see the file 'LICENCE' in this directory. -+ * -+ * JFFS2 wrapper to the LZMA C SDK -+ * -+ */ -+ -+#include -+#include "compr.h" -+ -+#ifdef __KERNEL__ -+ static DEFINE_MUTEX(deflate_mutex); -+#endif -+ -+CLzmaEncHandle *p; -+Byte propsEncoded[LZMA_PROPS_SIZE]; -+SizeT propsSize = sizeof(propsEncoded); -+ -+STATIC void lzma_free_workspace(void) -+{ -+ LzmaEnc_Destroy(p, &lzma_alloc, &lzma_alloc); -+} -+ -+STATIC int INIT lzma_alloc_workspace(CLzmaEncProps *props) -+{ -+ if ((p = (CLzmaEncHandle *)LzmaEnc_Create(&lzma_alloc)) == NULL) -+ { -+ PRINT_ERROR("Failed to allocate lzma deflate workspace\n"); -+ return -ENOMEM; -+ } -+ -+ if (LzmaEnc_SetProps(p, props) != SZ_OK) -+ { -+ lzma_free_workspace(); -+ return -1; -+ } -+ -+ if (LzmaEnc_WriteProperties(p, propsEncoded, &propsSize) != SZ_OK) -+ { -+ lzma_free_workspace(); -+ return -1; -+ } -+ -+ return 0; -+} -+ -+STATIC int jffs2_lzma_compress(unsigned char *data_in, unsigned char *cpage_out, -+ uint32_t *sourcelen, uint32_t *dstlen) -+{ -+ SizeT compress_size = (SizeT)(*dstlen); -+ int ret; -+ -+ #ifdef __KERNEL__ -+ mutex_lock(&deflate_mutex); -+ #endif -+ -+ ret = LzmaEnc_MemEncode(p, cpage_out, &compress_size, data_in, *sourcelen, -+ 0, NULL, &lzma_alloc, &lzma_alloc); -+ -+ #ifdef __KERNEL__ -+ mutex_unlock(&deflate_mutex); -+ #endif -+ -+ if (ret != SZ_OK) -+ return -1; -+ -+ *dstlen = (uint32_t)compress_size; -+ -+ return 0; -+} -+ -+STATIC int jffs2_lzma_decompress(unsigned char *data_in, unsigned char *cpage_out, -+ uint32_t srclen, uint32_t destlen) -+{ -+ int ret; -+ SizeT dl = (SizeT)destlen; -+ SizeT sl = (SizeT)srclen; -+ ELzmaStatus status; -+ -+ ret = LzmaDecode(cpage_out, &dl, data_in, &sl, propsEncoded, -+ propsSize, LZMA_FINISH_ANY, &status, &lzma_alloc); -+ -+ if (ret != SZ_OK || status == LZMA_STATUS_NOT_FINISHED || dl != (SizeT)destlen) -+ return -1; -+ -+ return 0; -+} -+ -+static struct jffs2_compressor jffs2_lzma_comp = { -+ .priority = JFFS2_LZMA_PRIORITY, -+ .name = "lzma", -+ .compr = JFFS2_COMPR_LZMA, -+ .compress = &jffs2_lzma_compress, -+ .decompress = &jffs2_lzma_decompress, -+ .disabled = 0, -+}; -+ -+int INIT jffs2_lzma_init(void) -+{ -+ int ret; -+ CLzmaEncProps props; -+ LzmaEncProps_Init(&props); -+ -+ props.dictSize = LZMA_BEST_DICT(0x2000); -+ props.level = LZMA_BEST_LEVEL; -+ props.lc = LZMA_BEST_LC; -+ props.lp = LZMA_BEST_LP; -+ props.pb = LZMA_BEST_PB; -+ props.fb = LZMA_BEST_FB; -+ -+ ret = lzma_alloc_workspace(&props); -+ if (ret < 0) -+ return ret; -+ -+ ret = jffs2_register_compressor(&jffs2_lzma_comp); -+ if (ret) -+ lzma_free_workspace(); -+ -+ return ret; -+} -+ -+void jffs2_lzma_exit(void) -+{ -+ jffs2_unregister_compressor(&jffs2_lzma_comp); -+ lzma_free_workspace(); -+} ---- a/fs/jffs2/super.c -+++ b/fs/jffs2/super.c -@@ -371,14 +371,41 @@ static int __init init_jffs2_fs(void) - BUILD_BUG_ON(sizeof(struct jffs2_raw_inode) != 68); - BUILD_BUG_ON(sizeof(struct jffs2_raw_summary) != 32); - -- pr_info("version 2.2." -+ pr_info("version 2.2" - #ifdef CONFIG_JFFS2_FS_WRITEBUFFER - " (NAND)" - #endif - #ifdef CONFIG_JFFS2_SUMMARY -- " (SUMMARY) " -+ " (SUMMARY)" - #endif -- " © 2001-2006 Red Hat, Inc.\n"); -+#ifdef CONFIG_JFFS2_ZLIB -+ " (ZLIB)" -+#endif -+#ifdef CONFIG_JFFS2_LZO -+ " (LZO)" -+#endif -+#ifdef CONFIG_JFFS2_LZMA -+ " (LZMA)" -+#endif -+#ifdef CONFIG_JFFS2_RTIME -+ " (RTIME)" -+#endif -+#ifdef CONFIG_JFFS2_RUBIN -+ " (RUBIN)" -+#endif -+#ifdef CONFIG_JFFS2_CMODE_NONE -+ " (CMODE_NONE)" -+#endif -+#ifdef CONFIG_JFFS2_CMODE_PRIORITY -+ " (CMODE_PRIORITY)" -+#endif -+#ifdef CONFIG_JFFS2_CMODE_SIZE -+ " (CMODE_SIZE)" -+#endif -+#ifdef CONFIG_JFFS2_CMODE_FAVOURLZO -+ " (CMODE_FAVOURLZO)" -+#endif -+ " (c) 2001-2006 Red Hat, Inc.\n"); - - jffs2_inode_cachep = kmem_cache_create("jffs2_i", - sizeof(struct jffs2_inode_info), ---- /dev/null -+++ b/include/linux/lzma.h -@@ -0,0 +1,62 @@ -+#ifndef __LZMA_H__ -+#define __LZMA_H__ -+ -+#ifdef __KERNEL__ -+ #include -+ #include -+ #include -+ #include -+ #include -+ #define LZMA_MALLOC vmalloc -+ #define LZMA_FREE vfree -+ #define PRINT_ERROR(msg) printk(KERN_WARNING #msg) -+ #define INIT __init -+ #define STATIC static -+#else -+ #include -+ #include -+ #include -+ #include -+ #include -+ #include -+ #include -+ #include -+ #ifndef PAGE_SIZE -+ extern int page_size; -+ #define PAGE_SIZE page_size -+ #endif -+ #define LZMA_MALLOC malloc -+ #define LZMA_FREE free -+ #define PRINT_ERROR(msg) fprintf(stderr, msg) -+ #define INIT -+ #define STATIC -+#endif -+ -+#include "lzma/LzmaDec.h" -+#include "lzma/LzmaEnc.h" -+ -+#define LZMA_BEST_LEVEL (9) -+#define LZMA_BEST_LC (0) -+#define LZMA_BEST_LP (0) -+#define LZMA_BEST_PB (0) -+#define LZMA_BEST_FB (273) -+ -+#define LZMA_BEST_DICT(n) (((int)((n) / 2)) * 2) -+ -+static void *p_lzma_malloc(void *p, size_t size) -+{ -+ if (size == 0) -+ return NULL; -+ -+ return LZMA_MALLOC(size); -+} -+ -+static void p_lzma_free(void *p, void *address) -+{ -+ if (address != NULL) -+ LZMA_FREE(address); -+} -+ -+static ISzAlloc lzma_alloc = {p_lzma_malloc, p_lzma_free}; -+ -+#endif ---- /dev/null -+++ b/include/linux/lzma/LzFind.h -@@ -0,0 +1,115 @@ -+/* LzFind.h -- Match finder for LZ algorithms -+2009-04-22 : Igor Pavlov : Public domain */ -+ -+#ifndef __LZ_FIND_H -+#define __LZ_FIND_H -+ -+#include "Types.h" -+ -+#ifdef __cplusplus -+extern "C" { -+#endif -+ -+typedef UInt32 CLzRef; -+ -+typedef struct _CMatchFinder -+{ -+ Byte *buffer; -+ UInt32 pos; -+ UInt32 posLimit; -+ UInt32 streamPos; -+ UInt32 lenLimit; -+ -+ UInt32 cyclicBufferPos; -+ UInt32 cyclicBufferSize; /* it must be = (historySize + 1) */ -+ -+ UInt32 matchMaxLen; -+ CLzRef *hash; -+ CLzRef *son; -+ UInt32 hashMask; -+ UInt32 cutValue; -+ -+ Byte *bufferBase; -+ ISeqInStream *stream; -+ int streamEndWasReached; -+ -+ UInt32 blockSize; -+ UInt32 keepSizeBefore; -+ UInt32 keepSizeAfter; -+ -+ UInt32 numHashBytes; -+ int directInput; -+ size_t directInputRem; -+ int btMode; -+ int bigHash; -+ UInt32 historySize; -+ UInt32 fixedHashSize; -+ UInt32 hashSizeSum; -+ UInt32 numSons; -+ SRes result; -+ UInt32 crc[256]; -+} CMatchFinder; -+ -+#define Inline_MatchFinder_GetPointerToCurrentPos(p) ((p)->buffer) -+#define Inline_MatchFinder_GetIndexByte(p, index) ((p)->buffer[(Int32)(index)]) -+ -+#define Inline_MatchFinder_GetNumAvailableBytes(p) ((p)->streamPos - (p)->pos) -+ -+int MatchFinder_NeedMove(CMatchFinder *p); -+Byte *MatchFinder_GetPointerToCurrentPos(CMatchFinder *p); -+void MatchFinder_MoveBlock(CMatchFinder *p); -+void MatchFinder_ReadIfRequired(CMatchFinder *p); -+ -+void MatchFinder_Construct(CMatchFinder *p); -+ -+/* Conditions: -+ historySize <= 3 GB -+ keepAddBufferBefore + matchMaxLen + keepAddBufferAfter < 511MB -+*/ -+int MatchFinder_Create(CMatchFinder *p, UInt32 historySize, -+ UInt32 keepAddBufferBefore, UInt32 matchMaxLen, UInt32 keepAddBufferAfter, -+ ISzAlloc *alloc); -+void MatchFinder_Free(CMatchFinder *p, ISzAlloc *alloc); -+void MatchFinder_Normalize3(UInt32 subValue, CLzRef *items, UInt32 numItems); -+void MatchFinder_ReduceOffsets(CMatchFinder *p, UInt32 subValue); -+ -+UInt32 * GetMatchesSpec1(UInt32 lenLimit, UInt32 curMatch, UInt32 pos, const Byte *buffer, CLzRef *son, -+ UInt32 _cyclicBufferPos, UInt32 _cyclicBufferSize, UInt32 _cutValue, -+ UInt32 *distances, UInt32 maxLen); -+ -+/* -+Conditions: -+ Mf_GetNumAvailableBytes_Func must be called before each Mf_GetMatchLen_Func. -+ Mf_GetPointerToCurrentPos_Func's result must be used only before any other function -+*/ -+ -+typedef void (*Mf_Init_Func)(void *object); -+typedef Byte (*Mf_GetIndexByte_Func)(void *object, Int32 index); -+typedef UInt32 (*Mf_GetNumAvailableBytes_Func)(void *object); -+typedef const Byte * (*Mf_GetPointerToCurrentPos_Func)(void *object); -+typedef UInt32 (*Mf_GetMatches_Func)(void *object, UInt32 *distances); -+typedef void (*Mf_Skip_Func)(void *object, UInt32); -+ -+typedef struct _IMatchFinder -+{ -+ Mf_Init_Func Init; -+ Mf_GetIndexByte_Func GetIndexByte; -+ Mf_GetNumAvailableBytes_Func GetNumAvailableBytes; -+ Mf_GetPointerToCurrentPos_Func GetPointerToCurrentPos; -+ Mf_GetMatches_Func GetMatches; -+ Mf_Skip_Func Skip; -+} IMatchFinder; -+ -+void MatchFinder_CreateVTable(CMatchFinder *p, IMatchFinder *vTable); -+ -+void MatchFinder_Init(CMatchFinder *p); -+UInt32 Bt3Zip_MatchFinder_GetMatches(CMatchFinder *p, UInt32 *distances); -+UInt32 Hc3Zip_MatchFinder_GetMatches(CMatchFinder *p, UInt32 *distances); -+void Bt3Zip_MatchFinder_Skip(CMatchFinder *p, UInt32 num); -+void Hc3Zip_MatchFinder_Skip(CMatchFinder *p, UInt32 num); -+ -+#ifdef __cplusplus -+} -+#endif -+ -+#endif ---- /dev/null -+++ b/include/linux/lzma/LzHash.h -@@ -0,0 +1,54 @@ -+/* LzHash.h -- HASH functions for LZ algorithms -+2009-02-07 : Igor Pavlov : Public domain */ -+ -+#ifndef __LZ_HASH_H -+#define __LZ_HASH_H -+ -+#define kHash2Size (1 << 10) -+#define kHash3Size (1 << 16) -+#define kHash4Size (1 << 20) -+ -+#define kFix3HashSize (kHash2Size) -+#define kFix4HashSize (kHash2Size + kHash3Size) -+#define kFix5HashSize (kHash2Size + kHash3Size + kHash4Size) -+ -+#define HASH2_CALC hashValue = cur[0] | ((UInt32)cur[1] << 8); -+ -+#define HASH3_CALC { \ -+ UInt32 temp = p->crc[cur[0]] ^ cur[1]; \ -+ hash2Value = temp & (kHash2Size - 1); \ -+ hashValue = (temp ^ ((UInt32)cur[2] << 8)) & p->hashMask; } -+ -+#define HASH4_CALC { \ -+ UInt32 temp = p->crc[cur[0]] ^ cur[1]; \ -+ hash2Value = temp & (kHash2Size - 1); \ -+ hash3Value = (temp ^ ((UInt32)cur[2] << 8)) & (kHash3Size - 1); \ -+ hashValue = (temp ^ ((UInt32)cur[2] << 8) ^ (p->crc[cur[3]] << 5)) & p->hashMask; } -+ -+#define HASH5_CALC { \ -+ UInt32 temp = p->crc[cur[0]] ^ cur[1]; \ -+ hash2Value = temp & (kHash2Size - 1); \ -+ hash3Value = (temp ^ ((UInt32)cur[2] << 8)) & (kHash3Size - 1); \ -+ hash4Value = (temp ^ ((UInt32)cur[2] << 8) ^ (p->crc[cur[3]] << 5)); \ -+ hashValue = (hash4Value ^ (p->crc[cur[4]] << 3)) & p->hashMask; \ -+ hash4Value &= (kHash4Size - 1); } -+ -+/* #define HASH_ZIP_CALC hashValue = ((cur[0] | ((UInt32)cur[1] << 8)) ^ p->crc[cur[2]]) & 0xFFFF; */ -+#define HASH_ZIP_CALC hashValue = ((cur[2] | ((UInt32)cur[0] << 8)) ^ p->crc[cur[1]]) & 0xFFFF; -+ -+ -+#define MT_HASH2_CALC \ -+ hash2Value = (p->crc[cur[0]] ^ cur[1]) & (kHash2Size - 1); -+ -+#define MT_HASH3_CALC { \ -+ UInt32 temp = p->crc[cur[0]] ^ cur[1]; \ -+ hash2Value = temp & (kHash2Size - 1); \ -+ hash3Value = (temp ^ ((UInt32)cur[2] << 8)) & (kHash3Size - 1); } -+ -+#define MT_HASH4_CALC { \ -+ UInt32 temp = p->crc[cur[0]] ^ cur[1]; \ -+ hash2Value = temp & (kHash2Size - 1); \ -+ hash3Value = (temp ^ ((UInt32)cur[2] << 8)) & (kHash3Size - 1); \ -+ hash4Value = (temp ^ ((UInt32)cur[2] << 8) ^ (p->crc[cur[3]] << 5)) & (kHash4Size - 1); } -+ -+#endif ---- /dev/null -+++ b/include/linux/lzma/LzmaDec.h -@@ -0,0 +1,231 @@ -+/* LzmaDec.h -- LZMA Decoder -+2009-02-07 : Igor Pavlov : Public domain */ -+ -+#ifndef __LZMA_DEC_H -+#define __LZMA_DEC_H -+ -+#include "Types.h" -+ -+#ifdef __cplusplus -+extern "C" { -+#endif -+ -+/* #define _LZMA_PROB32 */ -+/* _LZMA_PROB32 can increase the speed on some CPUs, -+ but memory usage for CLzmaDec::probs will be doubled in that case */ -+ -+#ifdef _LZMA_PROB32 -+#define CLzmaProb UInt32 -+#else -+#define CLzmaProb UInt16 -+#endif -+ -+ -+/* ---------- LZMA Properties ---------- */ -+ -+#define LZMA_PROPS_SIZE 5 -+ -+typedef struct _CLzmaProps -+{ -+ unsigned lc, lp, pb; -+ UInt32 dicSize; -+} CLzmaProps; -+ -+/* LzmaProps_Decode - decodes properties -+Returns: -+ SZ_OK -+ SZ_ERROR_UNSUPPORTED - Unsupported properties -+*/ -+ -+SRes LzmaProps_Decode(CLzmaProps *p, const Byte *data, unsigned size); -+ -+ -+/* ---------- LZMA Decoder state ---------- */ -+ -+/* LZMA_REQUIRED_INPUT_MAX = number of required input bytes for worst case. -+ Num bits = log2((2^11 / 31) ^ 22) + 26 < 134 + 26 = 160; */ -+ -+#define LZMA_REQUIRED_INPUT_MAX 20 -+ -+typedef struct -+{ -+ CLzmaProps prop; -+ CLzmaProb *probs; -+ Byte *dic; -+ const Byte *buf; -+ UInt32 range, code; -+ SizeT dicPos; -+ SizeT dicBufSize; -+ UInt32 processedPos; -+ UInt32 checkDicSize; -+ unsigned state; -+ UInt32 reps[4]; -+ unsigned remainLen; -+ int needFlush; -+ int needInitState; -+ UInt32 numProbs; -+ unsigned tempBufSize; -+ Byte tempBuf[LZMA_REQUIRED_INPUT_MAX]; -+} CLzmaDec; -+ -+#define LzmaDec_Construct(p) { (p)->dic = 0; (p)->probs = 0; } -+ -+void LzmaDec_Init(CLzmaDec *p); -+ -+/* There are two types of LZMA streams: -+ 0) Stream with end mark. That end mark adds about 6 bytes to compressed size. -+ 1) Stream without end mark. You must know exact uncompressed size to decompress such stream. */ -+ -+typedef enum -+{ -+ LZMA_FINISH_ANY, /* finish at any point */ -+ LZMA_FINISH_END /* block must be finished at the end */ -+} ELzmaFinishMode; -+ -+/* ELzmaFinishMode has meaning only if the decoding reaches output limit !!! -+ -+ You must use LZMA_FINISH_END, when you know that current output buffer -+ covers last bytes of block. In other cases you must use LZMA_FINISH_ANY. -+ -+ If LZMA decoder sees end marker before reaching output limit, it returns SZ_OK, -+ and output value of destLen will be less than output buffer size limit. -+ You can check status result also. -+ -+ You can use multiple checks to test data integrity after full decompression: -+ 1) Check Result and "status" variable. -+ 2) Check that output(destLen) = uncompressedSize, if you know real uncompressedSize. -+ 3) Check that output(srcLen) = compressedSize, if you know real compressedSize. -+ You must use correct finish mode in that case. */ -+ -+typedef enum -+{ -+ LZMA_STATUS_NOT_SPECIFIED, /* use main error code instead */ -+ LZMA_STATUS_FINISHED_WITH_MARK, /* stream was finished with end mark. */ -+ LZMA_STATUS_NOT_FINISHED, /* stream was not finished */ -+ LZMA_STATUS_NEEDS_MORE_INPUT, /* you must provide more input bytes */ -+ LZMA_STATUS_MAYBE_FINISHED_WITHOUT_MARK /* there is probability that stream was finished without end mark */ -+} ELzmaStatus; -+ -+/* ELzmaStatus is used only as output value for function call */ -+ -+ -+/* ---------- Interfaces ---------- */ -+ -+/* There are 3 levels of interfaces: -+ 1) Dictionary Interface -+ 2) Buffer Interface -+ 3) One Call Interface -+ You can select any of these interfaces, but don't mix functions from different -+ groups for same object. */ -+ -+ -+/* There are two variants to allocate state for Dictionary Interface: -+ 1) LzmaDec_Allocate / LzmaDec_Free -+ 2) LzmaDec_AllocateProbs / LzmaDec_FreeProbs -+ You can use variant 2, if you set dictionary buffer manually. -+ For Buffer Interface you must always use variant 1. -+ -+LzmaDec_Allocate* can return: -+ SZ_OK -+ SZ_ERROR_MEM - Memory allocation error -+ SZ_ERROR_UNSUPPORTED - Unsupported properties -+*/ -+ -+SRes LzmaDec_AllocateProbs(CLzmaDec *p, const Byte *props, unsigned propsSize, ISzAlloc *alloc); -+void LzmaDec_FreeProbs(CLzmaDec *p, ISzAlloc *alloc); -+ -+SRes LzmaDec_Allocate(CLzmaDec *state, const Byte *prop, unsigned propsSize, ISzAlloc *alloc); -+void LzmaDec_Free(CLzmaDec *state, ISzAlloc *alloc); -+ -+/* ---------- Dictionary Interface ---------- */ -+ -+/* You can use it, if you want to eliminate the overhead for data copying from -+ dictionary to some other external buffer. -+ You must work with CLzmaDec variables directly in this interface. -+ -+ STEPS: -+ LzmaDec_Constr() -+ LzmaDec_Allocate() -+ for (each new stream) -+ { -+ LzmaDec_Init() -+ while (it needs more decompression) -+ { -+ LzmaDec_DecodeToDic() -+ use data from CLzmaDec::dic and update CLzmaDec::dicPos -+ } -+ } -+ LzmaDec_Free() -+*/ -+ -+/* LzmaDec_DecodeToDic -+ -+ The decoding to internal dictionary buffer (CLzmaDec::dic). -+ You must manually update CLzmaDec::dicPos, if it reaches CLzmaDec::dicBufSize !!! -+ -+finishMode: -+ It has meaning only if the decoding reaches output limit (dicLimit). -+ LZMA_FINISH_ANY - Decode just dicLimit bytes. -+ LZMA_FINISH_END - Stream must be finished after dicLimit. -+ -+Returns: -+ SZ_OK -+ status: -+ LZMA_STATUS_FINISHED_WITH_MARK -+ LZMA_STATUS_NOT_FINISHED -+ LZMA_STATUS_NEEDS_MORE_INPUT -+ LZMA_STATUS_MAYBE_FINISHED_WITHOUT_MARK -+ SZ_ERROR_DATA - Data error -+*/ -+ -+SRes LzmaDec_DecodeToDic(CLzmaDec *p, SizeT dicLimit, -+ const Byte *src, SizeT *srcLen, ELzmaFinishMode finishMode, ELzmaStatus *status); -+ -+ -+/* ---------- Buffer Interface ---------- */ -+ -+/* It's zlib-like interface. -+ See LzmaDec_DecodeToDic description for information about STEPS and return results, -+ but you must use LzmaDec_DecodeToBuf instead of LzmaDec_DecodeToDic and you don't need -+ to work with CLzmaDec variables manually. -+ -+finishMode: -+ It has meaning only if the decoding reaches output limit (*destLen). -+ LZMA_FINISH_ANY - Decode just destLen bytes. -+ LZMA_FINISH_END - Stream must be finished after (*destLen). -+*/ -+ -+SRes LzmaDec_DecodeToBuf(CLzmaDec *p, Byte *dest, SizeT *destLen, -+ const Byte *src, SizeT *srcLen, ELzmaFinishMode finishMode, ELzmaStatus *status); -+ -+ -+/* ---------- One Call Interface ---------- */ -+ -+/* LzmaDecode -+ -+finishMode: -+ It has meaning only if the decoding reaches output limit (*destLen). -+ LZMA_FINISH_ANY - Decode just destLen bytes. -+ LZMA_FINISH_END - Stream must be finished after (*destLen). -+ -+Returns: -+ SZ_OK -+ status: -+ LZMA_STATUS_FINISHED_WITH_MARK -+ LZMA_STATUS_NOT_FINISHED -+ LZMA_STATUS_MAYBE_FINISHED_WITHOUT_MARK -+ SZ_ERROR_DATA - Data error -+ SZ_ERROR_MEM - Memory allocation error -+ SZ_ERROR_UNSUPPORTED - Unsupported properties -+ SZ_ERROR_INPUT_EOF - It needs more bytes in input buffer (src). -+*/ -+ -+SRes LzmaDecode(Byte *dest, SizeT *destLen, const Byte *src, SizeT *srcLen, -+ const Byte *propData, unsigned propSize, ELzmaFinishMode finishMode, -+ ELzmaStatus *status, ISzAlloc *alloc); -+ -+#ifdef __cplusplus -+} -+#endif -+ -+#endif ---- /dev/null -+++ b/include/linux/lzma/LzmaEnc.h -@@ -0,0 +1,80 @@ -+/* LzmaEnc.h -- LZMA Encoder -+2009-02-07 : Igor Pavlov : Public domain */ -+ -+#ifndef __LZMA_ENC_H -+#define __LZMA_ENC_H -+ -+#include "Types.h" -+ -+#ifdef __cplusplus -+extern "C" { -+#endif -+ -+#define LZMA_PROPS_SIZE 5 -+ -+typedef struct _CLzmaEncProps -+{ -+ int level; /* 0 <= level <= 9 */ -+ UInt32 dictSize; /* (1 << 12) <= dictSize <= (1 << 27) for 32-bit version -+ (1 << 12) <= dictSize <= (1 << 30) for 64-bit version -+ default = (1 << 24) */ -+ int lc; /* 0 <= lc <= 8, default = 3 */ -+ int lp; /* 0 <= lp <= 4, default = 0 */ -+ int pb; /* 0 <= pb <= 4, default = 2 */ -+ int algo; /* 0 - fast, 1 - normal, default = 1 */ -+ int fb; /* 5 <= fb <= 273, default = 32 */ -+ int btMode; /* 0 - hashChain Mode, 1 - binTree mode - normal, default = 1 */ -+ int numHashBytes; /* 2, 3 or 4, default = 4 */ -+ UInt32 mc; /* 1 <= mc <= (1 << 30), default = 32 */ -+ unsigned writeEndMark; /* 0 - do not write EOPM, 1 - write EOPM, default = 0 */ -+ int numThreads; /* 1 or 2, default = 2 */ -+} CLzmaEncProps; -+ -+void LzmaEncProps_Init(CLzmaEncProps *p); -+void LzmaEncProps_Normalize(CLzmaEncProps *p); -+UInt32 LzmaEncProps_GetDictSize(const CLzmaEncProps *props2); -+ -+ -+/* ---------- CLzmaEncHandle Interface ---------- */ -+ -+/* LzmaEnc_* functions can return the following exit codes: -+Returns: -+ SZ_OK - OK -+ SZ_ERROR_MEM - Memory allocation error -+ SZ_ERROR_PARAM - Incorrect paramater in props -+ SZ_ERROR_WRITE - Write callback error. -+ SZ_ERROR_PROGRESS - some break from progress callback -+ SZ_ERROR_THREAD - errors in multithreading functions (only for Mt version) -+*/ -+ -+typedef void * CLzmaEncHandle; -+ -+CLzmaEncHandle LzmaEnc_Create(ISzAlloc *alloc); -+void LzmaEnc_Destroy(CLzmaEncHandle p, ISzAlloc *alloc, ISzAlloc *allocBig); -+SRes LzmaEnc_SetProps(CLzmaEncHandle p, const CLzmaEncProps *props); -+SRes LzmaEnc_WriteProperties(CLzmaEncHandle p, Byte *properties, SizeT *size); -+SRes LzmaEnc_Encode(CLzmaEncHandle p, ISeqOutStream *outStream, ISeqInStream *inStream, -+ ICompressProgress *progress, ISzAlloc *alloc, ISzAlloc *allocBig); -+SRes LzmaEnc_MemEncode(CLzmaEncHandle p, Byte *dest, SizeT *destLen, const Byte *src, SizeT srcLen, -+ int writeEndMark, ICompressProgress *progress, ISzAlloc *alloc, ISzAlloc *allocBig); -+ -+/* ---------- One Call Interface ---------- */ -+ -+/* LzmaEncode -+Return code: -+ SZ_OK - OK -+ SZ_ERROR_MEM - Memory allocation error -+ SZ_ERROR_PARAM - Incorrect paramater -+ SZ_ERROR_OUTPUT_EOF - output buffer overflow -+ SZ_ERROR_THREAD - errors in multithreading functions (only for Mt version) -+*/ -+ -+SRes LzmaEncode(Byte *dest, SizeT *destLen, const Byte *src, SizeT srcLen, -+ const CLzmaEncProps *props, Byte *propsEncoded, SizeT *propsSize, int writeEndMark, -+ ICompressProgress *progress, ISzAlloc *alloc, ISzAlloc *allocBig); -+ -+#ifdef __cplusplus -+} -+#endif -+ -+#endif ---- /dev/null -+++ b/include/linux/lzma/Types.h -@@ -0,0 +1,226 @@ -+/* Types.h -- Basic types -+2009-11-23 : Igor Pavlov : Public domain */ -+ -+#ifndef __7Z_TYPES_H -+#define __7Z_TYPES_H -+ -+#include -+ -+#ifdef _WIN32 -+#include -+#endif -+ -+#ifndef EXTERN_C_BEGIN -+#ifdef __cplusplus -+#define EXTERN_C_BEGIN extern "C" { -+#define EXTERN_C_END } -+#else -+#define EXTERN_C_BEGIN -+#define EXTERN_C_END -+#endif -+#endif -+ -+EXTERN_C_BEGIN -+ -+#define SZ_OK 0 -+ -+#define SZ_ERROR_DATA 1 -+#define SZ_ERROR_MEM 2 -+#define SZ_ERROR_CRC 3 -+#define SZ_ERROR_UNSUPPORTED 4 -+#define SZ_ERROR_PARAM 5 -+#define SZ_ERROR_INPUT_EOF 6 -+#define SZ_ERROR_OUTPUT_EOF 7 -+#define SZ_ERROR_READ 8 -+#define SZ_ERROR_WRITE 9 -+#define SZ_ERROR_PROGRESS 10 -+#define SZ_ERROR_FAIL 11 -+#define SZ_ERROR_THREAD 12 -+ -+#define SZ_ERROR_ARCHIVE 16 -+#define SZ_ERROR_NO_ARCHIVE 17 -+ -+typedef int SRes; -+ -+#ifdef _WIN32 -+typedef DWORD WRes; -+#else -+typedef int WRes; -+#endif -+ -+#ifndef RINOK -+#define RINOK(x) { int __result__ = (x); if (__result__ != 0) return __result__; } -+#endif -+ -+typedef unsigned char Byte; -+typedef short Int16; -+typedef unsigned short UInt16; -+ -+#ifdef _LZMA_UINT32_IS_ULONG -+typedef long Int32; -+typedef unsigned long UInt32; -+#else -+typedef int Int32; -+typedef unsigned int UInt32; -+#endif -+ -+#ifdef _SZ_NO_INT_64 -+ -+/* define _SZ_NO_INT_64, if your compiler doesn't support 64-bit integers. -+ NOTES: Some code will work incorrectly in that case! */ -+ -+typedef long Int64; -+typedef unsigned long UInt64; -+ -+#else -+ -+#if defined(_MSC_VER) || defined(__BORLANDC__) -+typedef __int64 Int64; -+typedef unsigned __int64 UInt64; -+#else -+typedef long long int Int64; -+typedef unsigned long long int UInt64; -+#endif -+ -+#endif -+ -+#ifdef _LZMA_NO_SYSTEM_SIZE_T -+typedef UInt32 SizeT; -+#else -+typedef size_t SizeT; -+#endif -+ -+typedef int Bool; -+#define True 1 -+#define False 0 -+ -+ -+#ifdef _WIN32 -+#define MY_STD_CALL __stdcall -+#else -+#define MY_STD_CALL -+#endif -+ -+#ifdef _MSC_VER -+ -+#if _MSC_VER >= 1300 -+#define MY_NO_INLINE __declspec(noinline) -+#else -+#define MY_NO_INLINE -+#endif -+ -+#define MY_CDECL __cdecl -+#define MY_FAST_CALL __fastcall -+ -+#else -+ -+#define MY_CDECL -+#define MY_FAST_CALL -+ -+#endif -+ -+ -+/* The following interfaces use first parameter as pointer to structure */ -+ -+typedef struct -+{ -+ SRes (*Read)(void *p, void *buf, size_t *size); -+ /* if (input(*size) != 0 && output(*size) == 0) means end_of_stream. -+ (output(*size) < input(*size)) is allowed */ -+} ISeqInStream; -+ -+/* it can return SZ_ERROR_INPUT_EOF */ -+SRes SeqInStream_Read(ISeqInStream *stream, void *buf, size_t size); -+SRes SeqInStream_Read2(ISeqInStream *stream, void *buf, size_t size, SRes errorType); -+SRes SeqInStream_ReadByte(ISeqInStream *stream, Byte *buf); -+ -+typedef struct -+{ -+ size_t (*Write)(void *p, const void *buf, size_t size); -+ /* Returns: result - the number of actually written bytes. -+ (result < size) means error */ -+} ISeqOutStream; -+ -+typedef enum -+{ -+ SZ_SEEK_SET = 0, -+ SZ_SEEK_CUR = 1, -+ SZ_SEEK_END = 2 -+} ESzSeek; -+ -+typedef struct -+{ -+ SRes (*Read)(void *p, void *buf, size_t *size); /* same as ISeqInStream::Read */ -+ SRes (*Seek)(void *p, Int64 *pos, ESzSeek origin); -+} ISeekInStream; -+ -+typedef struct -+{ -+ SRes (*Look)(void *p, void **buf, size_t *size); -+ /* if (input(*size) != 0 && output(*size) == 0) means end_of_stream. -+ (output(*size) > input(*size)) is not allowed -+ (output(*size) < input(*size)) is allowed */ -+ SRes (*Skip)(void *p, size_t offset); -+ /* offset must be <= output(*size) of Look */ -+ -+ SRes (*Read)(void *p, void *buf, size_t *size); -+ /* reads directly (without buffer). It's same as ISeqInStream::Read */ -+ SRes (*Seek)(void *p, Int64 *pos, ESzSeek origin); -+} ILookInStream; -+ -+SRes LookInStream_LookRead(ILookInStream *stream, void *buf, size_t *size); -+SRes LookInStream_SeekTo(ILookInStream *stream, UInt64 offset); -+ -+/* reads via ILookInStream::Read */ -+SRes LookInStream_Read2(ILookInStream *stream, void *buf, size_t size, SRes errorType); -+SRes LookInStream_Read(ILookInStream *stream, void *buf, size_t size); -+ -+#define LookToRead_BUF_SIZE (1 << 14) -+ -+typedef struct -+{ -+ ILookInStream s; -+ ISeekInStream *realStream; -+ size_t pos; -+ size_t size; -+ Byte buf[LookToRead_BUF_SIZE]; -+} CLookToRead; -+ -+void LookToRead_CreateVTable(CLookToRead *p, int lookahead); -+void LookToRead_Init(CLookToRead *p); -+ -+typedef struct -+{ -+ ISeqInStream s; -+ ILookInStream *realStream; -+} CSecToLook; -+ -+void SecToLook_CreateVTable(CSecToLook *p); -+ -+typedef struct -+{ -+ ISeqInStream s; -+ ILookInStream *realStream; -+} CSecToRead; -+ -+void SecToRead_CreateVTable(CSecToRead *p); -+ -+typedef struct -+{ -+ SRes (*Progress)(void *p, UInt64 inSize, UInt64 outSize); -+ /* Returns: result. (result != SZ_OK) means break. -+ Value (UInt64)(Int64)-1 for size means unknown value. */ -+} ICompressProgress; -+ -+typedef struct -+{ -+ void *(*Alloc)(void *p, size_t size); -+ void (*Free)(void *p, void *address); /* address can be 0 */ -+} ISzAlloc; -+ -+#define IAlloc_Alloc(p, size) (p)->Alloc((p), size) -+#define IAlloc_Free(p, a) (p)->Free((p), a) -+ -+EXTERN_C_END -+ -+#endif ---- a/include/uapi/linux/jffs2.h -+++ b/include/uapi/linux/jffs2.h -@@ -46,6 +46,7 @@ - #define JFFS2_COMPR_DYNRUBIN 0x05 - #define JFFS2_COMPR_ZLIB 0x06 - #define JFFS2_COMPR_LZO 0x07 -+#define JFFS2_COMPR_LZMA 0x08 - /* Compatibility flags. */ - #define JFFS2_COMPAT_MASK 0xc000 /* What do to if an unknown nodetype is found */ - #define JFFS2_NODE_ACCURATE 0x2000 ---- a/lib/Kconfig -+++ b/lib/Kconfig -@@ -278,6 +278,12 @@ config ZSTD_DECOMPRESS - - source "lib/xz/Kconfig" - -+config LZMA_COMPRESS -+ tristate -+ -+config LZMA_DECOMPRESS -+ tristate -+ - # - # These all provide a common interface (hence the apparent duplication with - # ZLIB_INFLATE; DECOMPRESS_GZIP is just a wrapper.) ---- a/lib/Makefile -+++ b/lib/Makefile -@@ -3,6 +3,16 @@ - # Makefile for some libs needed in the kernel. - # - -+ifdef CONFIG_JFFS2_ZLIB -+ CONFIG_ZLIB_INFLATE:=y -+ CONFIG_ZLIB_DEFLATE:=y -+endif -+ -+ifdef CONFIG_JFFS2_LZMA -+ CONFIG_LZMA_DECOMPRESS:=y -+ CONFIG_LZMA_COMPRESS:=y -+endif -+ - ifdef CONFIG_FUNCTION_TRACER - ORIG_CFLAGS := $(KBUILD_CFLAGS) - KBUILD_CFLAGS = $(subst $(CC_FLAGS_FTRACE),,$(ORIG_CFLAGS)) -@@ -128,6 +138,8 @@ obj-$(CONFIG_ZSTD_COMPRESS) += zstd/ - obj-$(CONFIG_ZSTD_DECOMPRESS) += zstd/ - obj-$(CONFIG_XZ_DEC) += xz/ - obj-$(CONFIG_RAID6_PQ) += raid6/ -+obj-$(CONFIG_LZMA_COMPRESS) += lzma/ -+obj-$(CONFIG_LZMA_DECOMPRESS) += lzma/ - - lib-$(CONFIG_DECOMPRESS_GZIP) += decompress_inflate.o - lib-$(CONFIG_DECOMPRESS_BZIP2) += decompress_bunzip2.o ---- /dev/null -+++ b/lib/lzma/LzFind.c -@@ -0,0 +1,761 @@ -+/* LzFind.c -- Match finder for LZ algorithms -+2009-04-22 : Igor Pavlov : Public domain */ -+ -+#include -+ -+#include "LzFind.h" -+#include "LzHash.h" -+ -+#define kEmptyHashValue 0 -+#define kMaxValForNormalize ((UInt32)0xFFFFFFFF) -+#define kNormalizeStepMin (1 << 10) /* it must be power of 2 */ -+#define kNormalizeMask (~(kNormalizeStepMin - 1)) -+#define kMaxHistorySize ((UInt32)3 << 30) -+ -+#define kStartMaxLen 3 -+ -+static void LzInWindow_Free(CMatchFinder *p, ISzAlloc *alloc) -+{ -+ if (!p->directInput) -+ { -+ alloc->Free(alloc, p->bufferBase); -+ p->bufferBase = 0; -+ } -+} -+ -+/* keepSizeBefore + keepSizeAfter + keepSizeReserv must be < 4G) */ -+ -+static int LzInWindow_Create(CMatchFinder *p, UInt32 keepSizeReserv, ISzAlloc *alloc) -+{ -+ UInt32 blockSize = p->keepSizeBefore + p->keepSizeAfter + keepSizeReserv; -+ if (p->directInput) -+ { -+ p->blockSize = blockSize; -+ return 1; -+ } -+ if (p->bufferBase == 0 || p->blockSize != blockSize) -+ { -+ LzInWindow_Free(p, alloc); -+ p->blockSize = blockSize; -+ p->bufferBase = (Byte *)alloc->Alloc(alloc, (size_t)blockSize); -+ } -+ return (p->bufferBase != 0); -+} -+ -+Byte *MatchFinder_GetPointerToCurrentPos(CMatchFinder *p) { return p->buffer; } -+Byte MatchFinder_GetIndexByte(CMatchFinder *p, Int32 index) { return p->buffer[index]; } -+ -+UInt32 MatchFinder_GetNumAvailableBytes(CMatchFinder *p) { return p->streamPos - p->pos; } -+ -+void MatchFinder_ReduceOffsets(CMatchFinder *p, UInt32 subValue) -+{ -+ p->posLimit -= subValue; -+ p->pos -= subValue; -+ p->streamPos -= subValue; -+} -+ -+static void MatchFinder_ReadBlock(CMatchFinder *p) -+{ -+ if (p->streamEndWasReached || p->result != SZ_OK) -+ return; -+ if (p->directInput) -+ { -+ UInt32 curSize = 0xFFFFFFFF - p->streamPos; -+ if (curSize > p->directInputRem) -+ curSize = (UInt32)p->directInputRem; -+ p->directInputRem -= curSize; -+ p->streamPos += curSize; -+ if (p->directInputRem == 0) -+ p->streamEndWasReached = 1; -+ return; -+ } -+ for (;;) -+ { -+ Byte *dest = p->buffer + (p->streamPos - p->pos); -+ size_t size = (p->bufferBase + p->blockSize - dest); -+ if (size == 0) -+ return; -+ p->result = p->stream->Read(p->stream, dest, &size); -+ if (p->result != SZ_OK) -+ return; -+ if (size == 0) -+ { -+ p->streamEndWasReached = 1; -+ return; -+ } -+ p->streamPos += (UInt32)size; -+ if (p->streamPos - p->pos > p->keepSizeAfter) -+ return; -+ } -+} -+ -+void MatchFinder_MoveBlock(CMatchFinder *p) -+{ -+ memmove(p->bufferBase, -+ p->buffer - p->keepSizeBefore, -+ (size_t)(p->streamPos - p->pos + p->keepSizeBefore)); -+ p->buffer = p->bufferBase + p->keepSizeBefore; -+} -+ -+int MatchFinder_NeedMove(CMatchFinder *p) -+{ -+ if (p->directInput) -+ return 0; -+ /* if (p->streamEndWasReached) return 0; */ -+ return ((size_t)(p->bufferBase + p->blockSize - p->buffer) <= p->keepSizeAfter); -+} -+ -+void MatchFinder_ReadIfRequired(CMatchFinder *p) -+{ -+ if (p->streamEndWasReached) -+ return; -+ if (p->keepSizeAfter >= p->streamPos - p->pos) -+ MatchFinder_ReadBlock(p); -+} -+ -+static void MatchFinder_CheckAndMoveAndRead(CMatchFinder *p) -+{ -+ if (MatchFinder_NeedMove(p)) -+ MatchFinder_MoveBlock(p); -+ MatchFinder_ReadBlock(p); -+} -+ -+static void MatchFinder_SetDefaultSettings(CMatchFinder *p) -+{ -+ p->cutValue = 32; -+ p->btMode = 1; -+ p->numHashBytes = 4; -+ p->bigHash = 0; -+} -+ -+#define kCrcPoly 0xEDB88320 -+ -+void MatchFinder_Construct(CMatchFinder *p) -+{ -+ UInt32 i; -+ p->bufferBase = 0; -+ p->directInput = 0; -+ p->hash = 0; -+ MatchFinder_SetDefaultSettings(p); -+ -+ for (i = 0; i < 256; i++) -+ { -+ UInt32 r = i; -+ int j; -+ for (j = 0; j < 8; j++) -+ r = (r >> 1) ^ (kCrcPoly & ~((r & 1) - 1)); -+ p->crc[i] = r; -+ } -+} -+ -+static void MatchFinder_FreeThisClassMemory(CMatchFinder *p, ISzAlloc *alloc) -+{ -+ alloc->Free(alloc, p->hash); -+ p->hash = 0; -+} -+ -+void MatchFinder_Free(CMatchFinder *p, ISzAlloc *alloc) -+{ -+ MatchFinder_FreeThisClassMemory(p, alloc); -+ LzInWindow_Free(p, alloc); -+} -+ -+static CLzRef* AllocRefs(UInt32 num, ISzAlloc *alloc) -+{ -+ size_t sizeInBytes = (size_t)num * sizeof(CLzRef); -+ if (sizeInBytes / sizeof(CLzRef) != num) -+ return 0; -+ return (CLzRef *)alloc->Alloc(alloc, sizeInBytes); -+} -+ -+int MatchFinder_Create(CMatchFinder *p, UInt32 historySize, -+ UInt32 keepAddBufferBefore, UInt32 matchMaxLen, UInt32 keepAddBufferAfter, -+ ISzAlloc *alloc) -+{ -+ UInt32 sizeReserv; -+ if (historySize > kMaxHistorySize) -+ { -+ MatchFinder_Free(p, alloc); -+ return 0; -+ } -+ sizeReserv = historySize >> 1; -+ if (historySize > ((UInt32)2 << 30)) -+ sizeReserv = historySize >> 2; -+ sizeReserv += (keepAddBufferBefore + matchMaxLen + keepAddBufferAfter) / 2 + (1 << 19); -+ -+ p->keepSizeBefore = historySize + keepAddBufferBefore + 1; -+ p->keepSizeAfter = matchMaxLen + keepAddBufferAfter; -+ /* we need one additional byte, since we use MoveBlock after pos++ and before dictionary using */ -+ if (LzInWindow_Create(p, sizeReserv, alloc)) -+ { -+ UInt32 newCyclicBufferSize = historySize + 1; -+ UInt32 hs; -+ p->matchMaxLen = matchMaxLen; -+ { -+ p->fixedHashSize = 0; -+ if (p->numHashBytes == 2) -+ hs = (1 << 16) - 1; -+ else -+ { -+ hs = historySize - 1; -+ hs |= (hs >> 1); -+ hs |= (hs >> 2); -+ hs |= (hs >> 4); -+ hs |= (hs >> 8); -+ hs >>= 1; -+ hs |= 0xFFFF; /* don't change it! It's required for Deflate */ -+ if (hs > (1 << 24)) -+ { -+ if (p->numHashBytes == 3) -+ hs = (1 << 24) - 1; -+ else -+ hs >>= 1; -+ } -+ } -+ p->hashMask = hs; -+ hs++; -+ if (p->numHashBytes > 2) p->fixedHashSize += kHash2Size; -+ if (p->numHashBytes > 3) p->fixedHashSize += kHash3Size; -+ if (p->numHashBytes > 4) p->fixedHashSize += kHash4Size; -+ hs += p->fixedHashSize; -+ } -+ -+ { -+ UInt32 prevSize = p->hashSizeSum + p->numSons; -+ UInt32 newSize; -+ p->historySize = historySize; -+ p->hashSizeSum = hs; -+ p->cyclicBufferSize = newCyclicBufferSize; -+ p->numSons = (p->btMode ? newCyclicBufferSize * 2 : newCyclicBufferSize); -+ newSize = p->hashSizeSum + p->numSons; -+ if (p->hash != 0 && prevSize == newSize) -+ return 1; -+ MatchFinder_FreeThisClassMemory(p, alloc); -+ p->hash = AllocRefs(newSize, alloc); -+ if (p->hash != 0) -+ { -+ p->son = p->hash + p->hashSizeSum; -+ return 1; -+ } -+ } -+ } -+ MatchFinder_Free(p, alloc); -+ return 0; -+} -+ -+static void MatchFinder_SetLimits(CMatchFinder *p) -+{ -+ UInt32 limit = kMaxValForNormalize - p->pos; -+ UInt32 limit2 = p->cyclicBufferSize - p->cyclicBufferPos; -+ if (limit2 < limit) -+ limit = limit2; -+ limit2 = p->streamPos - p->pos; -+ if (limit2 <= p->keepSizeAfter) -+ { -+ if (limit2 > 0) -+ limit2 = 1; -+ } -+ else -+ limit2 -= p->keepSizeAfter; -+ if (limit2 < limit) -+ limit = limit2; -+ { -+ UInt32 lenLimit = p->streamPos - p->pos; -+ if (lenLimit > p->matchMaxLen) -+ lenLimit = p->matchMaxLen; -+ p->lenLimit = lenLimit; -+ } -+ p->posLimit = p->pos + limit; -+} -+ -+void MatchFinder_Init(CMatchFinder *p) -+{ -+ UInt32 i; -+ for (i = 0; i < p->hashSizeSum; i++) -+ p->hash[i] = kEmptyHashValue; -+ p->cyclicBufferPos = 0; -+ p->buffer = p->bufferBase; -+ p->pos = p->streamPos = p->cyclicBufferSize; -+ p->result = SZ_OK; -+ p->streamEndWasReached = 0; -+ MatchFinder_ReadBlock(p); -+ MatchFinder_SetLimits(p); -+} -+ -+static UInt32 MatchFinder_GetSubValue(CMatchFinder *p) -+{ -+ return (p->pos - p->historySize - 1) & kNormalizeMask; -+} -+ -+void MatchFinder_Normalize3(UInt32 subValue, CLzRef *items, UInt32 numItems) -+{ -+ UInt32 i; -+ for (i = 0; i < numItems; i++) -+ { -+ UInt32 value = items[i]; -+ if (value <= subValue) -+ value = kEmptyHashValue; -+ else -+ value -= subValue; -+ items[i] = value; -+ } -+} -+ -+static void MatchFinder_Normalize(CMatchFinder *p) -+{ -+ UInt32 subValue = MatchFinder_GetSubValue(p); -+ MatchFinder_Normalize3(subValue, p->hash, p->hashSizeSum + p->numSons); -+ MatchFinder_ReduceOffsets(p, subValue); -+} -+ -+static void MatchFinder_CheckLimits(CMatchFinder *p) -+{ -+ if (p->pos == kMaxValForNormalize) -+ MatchFinder_Normalize(p); -+ if (!p->streamEndWasReached && p->keepSizeAfter == p->streamPos - p->pos) -+ MatchFinder_CheckAndMoveAndRead(p); -+ if (p->cyclicBufferPos == p->cyclicBufferSize) -+ p->cyclicBufferPos = 0; -+ MatchFinder_SetLimits(p); -+} -+ -+static UInt32 * Hc_GetMatchesSpec(UInt32 lenLimit, UInt32 curMatch, UInt32 pos, const Byte *cur, CLzRef *son, -+ UInt32 _cyclicBufferPos, UInt32 _cyclicBufferSize, UInt32 cutValue, -+ UInt32 *distances, UInt32 maxLen) -+{ -+ son[_cyclicBufferPos] = curMatch; -+ for (;;) -+ { -+ UInt32 delta = pos - curMatch; -+ if (cutValue-- == 0 || delta >= _cyclicBufferSize) -+ return distances; -+ { -+ const Byte *pb = cur - delta; -+ curMatch = son[_cyclicBufferPos - delta + ((delta > _cyclicBufferPos) ? _cyclicBufferSize : 0)]; -+ if (pb[maxLen] == cur[maxLen] && *pb == *cur) -+ { -+ UInt32 len = 0; -+ while (++len != lenLimit) -+ if (pb[len] != cur[len]) -+ break; -+ if (maxLen < len) -+ { -+ *distances++ = maxLen = len; -+ *distances++ = delta - 1; -+ if (len == lenLimit) -+ return distances; -+ } -+ } -+ } -+ } -+} -+ -+UInt32 * GetMatchesSpec1(UInt32 lenLimit, UInt32 curMatch, UInt32 pos, const Byte *cur, CLzRef *son, -+ UInt32 _cyclicBufferPos, UInt32 _cyclicBufferSize, UInt32 cutValue, -+ UInt32 *distances, UInt32 maxLen) -+{ -+ CLzRef *ptr0 = son + (_cyclicBufferPos << 1) + 1; -+ CLzRef *ptr1 = son + (_cyclicBufferPos << 1); -+ UInt32 len0 = 0, len1 = 0; -+ for (;;) -+ { -+ UInt32 delta = pos - curMatch; -+ if (cutValue-- == 0 || delta >= _cyclicBufferSize) -+ { -+ *ptr0 = *ptr1 = kEmptyHashValue; -+ return distances; -+ } -+ { -+ CLzRef *pair = son + ((_cyclicBufferPos - delta + ((delta > _cyclicBufferPos) ? _cyclicBufferSize : 0)) << 1); -+ const Byte *pb = cur - delta; -+ UInt32 len = (len0 < len1 ? len0 : len1); -+ if (pb[len] == cur[len]) -+ { -+ if (++len != lenLimit && pb[len] == cur[len]) -+ while (++len != lenLimit) -+ if (pb[len] != cur[len]) -+ break; -+ if (maxLen < len) -+ { -+ *distances++ = maxLen = len; -+ *distances++ = delta - 1; -+ if (len == lenLimit) -+ { -+ *ptr1 = pair[0]; -+ *ptr0 = pair[1]; -+ return distances; -+ } -+ } -+ } -+ if (pb[len] < cur[len]) -+ { -+ *ptr1 = curMatch; -+ ptr1 = pair + 1; -+ curMatch = *ptr1; -+ len1 = len; -+ } -+ else -+ { -+ *ptr0 = curMatch; -+ ptr0 = pair; -+ curMatch = *ptr0; -+ len0 = len; -+ } -+ } -+ } -+} -+ -+static void SkipMatchesSpec(UInt32 lenLimit, UInt32 curMatch, UInt32 pos, const Byte *cur, CLzRef *son, -+ UInt32 _cyclicBufferPos, UInt32 _cyclicBufferSize, UInt32 cutValue) -+{ -+ CLzRef *ptr0 = son + (_cyclicBufferPos << 1) + 1; -+ CLzRef *ptr1 = son + (_cyclicBufferPos << 1); -+ UInt32 len0 = 0, len1 = 0; -+ for (;;) -+ { -+ UInt32 delta = pos - curMatch; -+ if (cutValue-- == 0 || delta >= _cyclicBufferSize) -+ { -+ *ptr0 = *ptr1 = kEmptyHashValue; -+ return; -+ } -+ { -+ CLzRef *pair = son + ((_cyclicBufferPos - delta + ((delta > _cyclicBufferPos) ? _cyclicBufferSize : 0)) << 1); -+ const Byte *pb = cur - delta; -+ UInt32 len = (len0 < len1 ? len0 : len1); -+ if (pb[len] == cur[len]) -+ { -+ while (++len != lenLimit) -+ if (pb[len] != cur[len]) -+ break; -+ { -+ if (len == lenLimit) -+ { -+ *ptr1 = pair[0]; -+ *ptr0 = pair[1]; -+ return; -+ } -+ } -+ } -+ if (pb[len] < cur[len]) -+ { -+ *ptr1 = curMatch; -+ ptr1 = pair + 1; -+ curMatch = *ptr1; -+ len1 = len; -+ } -+ else -+ { -+ *ptr0 = curMatch; -+ ptr0 = pair; -+ curMatch = *ptr0; -+ len0 = len; -+ } -+ } -+ } -+} -+ -+#define MOVE_POS \ -+ ++p->cyclicBufferPos; \ -+ p->buffer++; \ -+ if (++p->pos == p->posLimit) MatchFinder_CheckLimits(p); -+ -+#define MOVE_POS_RET MOVE_POS return offset; -+ -+static void MatchFinder_MovePos(CMatchFinder *p) { MOVE_POS; } -+ -+#define GET_MATCHES_HEADER2(minLen, ret_op) \ -+ UInt32 lenLimit; UInt32 hashValue; const Byte *cur; UInt32 curMatch; \ -+ lenLimit = p->lenLimit; { if (lenLimit < minLen) { MatchFinder_MovePos(p); ret_op; }} \ -+ cur = p->buffer; -+ -+#define GET_MATCHES_HEADER(minLen) GET_MATCHES_HEADER2(minLen, return 0) -+#define SKIP_HEADER(minLen) GET_MATCHES_HEADER2(minLen, continue) -+ -+#define MF_PARAMS(p) p->pos, p->buffer, p->son, p->cyclicBufferPos, p->cyclicBufferSize, p->cutValue -+ -+#define GET_MATCHES_FOOTER(offset, maxLen) \ -+ offset = (UInt32)(GetMatchesSpec1(lenLimit, curMatch, MF_PARAMS(p), \ -+ distances + offset, maxLen) - distances); MOVE_POS_RET; -+ -+#define SKIP_FOOTER \ -+ SkipMatchesSpec(lenLimit, curMatch, MF_PARAMS(p)); MOVE_POS; -+ -+static UInt32 Bt2_MatchFinder_GetMatches(CMatchFinder *p, UInt32 *distances) -+{ -+ UInt32 offset; -+ GET_MATCHES_HEADER(2) -+ HASH2_CALC; -+ curMatch = p->hash[hashValue]; -+ p->hash[hashValue] = p->pos; -+ offset = 0; -+ GET_MATCHES_FOOTER(offset, 1) -+} -+ -+UInt32 Bt3Zip_MatchFinder_GetMatches(CMatchFinder *p, UInt32 *distances) -+{ -+ UInt32 offset; -+ GET_MATCHES_HEADER(3) -+ HASH_ZIP_CALC; -+ curMatch = p->hash[hashValue]; -+ p->hash[hashValue] = p->pos; -+ offset = 0; -+ GET_MATCHES_FOOTER(offset, 2) -+} -+ -+static UInt32 Bt3_MatchFinder_GetMatches(CMatchFinder *p, UInt32 *distances) -+{ -+ UInt32 hash2Value, delta2, maxLen, offset; -+ GET_MATCHES_HEADER(3) -+ -+ HASH3_CALC; -+ -+ delta2 = p->pos - p->hash[hash2Value]; -+ curMatch = p->hash[kFix3HashSize + hashValue]; -+ -+ p->hash[hash2Value] = -+ p->hash[kFix3HashSize + hashValue] = p->pos; -+ -+ -+ maxLen = 2; -+ offset = 0; -+ if (delta2 < p->cyclicBufferSize && *(cur - delta2) == *cur) -+ { -+ for (; maxLen != lenLimit; maxLen++) -+ if (cur[(ptrdiff_t)maxLen - delta2] != cur[maxLen]) -+ break; -+ distances[0] = maxLen; -+ distances[1] = delta2 - 1; -+ offset = 2; -+ if (maxLen == lenLimit) -+ { -+ SkipMatchesSpec(lenLimit, curMatch, MF_PARAMS(p)); -+ MOVE_POS_RET; -+ } -+ } -+ GET_MATCHES_FOOTER(offset, maxLen) -+} -+ -+static UInt32 Bt4_MatchFinder_GetMatches(CMatchFinder *p, UInt32 *distances) -+{ -+ UInt32 hash2Value, hash3Value, delta2, delta3, maxLen, offset; -+ GET_MATCHES_HEADER(4) -+ -+ HASH4_CALC; -+ -+ delta2 = p->pos - p->hash[ hash2Value]; -+ delta3 = p->pos - p->hash[kFix3HashSize + hash3Value]; -+ curMatch = p->hash[kFix4HashSize + hashValue]; -+ -+ p->hash[ hash2Value] = -+ p->hash[kFix3HashSize + hash3Value] = -+ p->hash[kFix4HashSize + hashValue] = p->pos; -+ -+ maxLen = 1; -+ offset = 0; -+ if (delta2 < p->cyclicBufferSize && *(cur - delta2) == *cur) -+ { -+ distances[0] = maxLen = 2; -+ distances[1] = delta2 - 1; -+ offset = 2; -+ } -+ if (delta2 != delta3 && delta3 < p->cyclicBufferSize && *(cur - delta3) == *cur) -+ { -+ maxLen = 3; -+ distances[offset + 1] = delta3 - 1; -+ offset += 2; -+ delta2 = delta3; -+ } -+ if (offset != 0) -+ { -+ for (; maxLen != lenLimit; maxLen++) -+ if (cur[(ptrdiff_t)maxLen - delta2] != cur[maxLen]) -+ break; -+ distances[offset - 2] = maxLen; -+ if (maxLen == lenLimit) -+ { -+ SkipMatchesSpec(lenLimit, curMatch, MF_PARAMS(p)); -+ MOVE_POS_RET; -+ } -+ } -+ if (maxLen < 3) -+ maxLen = 3; -+ GET_MATCHES_FOOTER(offset, maxLen) -+} -+ -+static UInt32 Hc4_MatchFinder_GetMatches(CMatchFinder *p, UInt32 *distances) -+{ -+ UInt32 hash2Value, hash3Value, delta2, delta3, maxLen, offset; -+ GET_MATCHES_HEADER(4) -+ -+ HASH4_CALC; -+ -+ delta2 = p->pos - p->hash[ hash2Value]; -+ delta3 = p->pos - p->hash[kFix3HashSize + hash3Value]; -+ curMatch = p->hash[kFix4HashSize + hashValue]; -+ -+ p->hash[ hash2Value] = -+ p->hash[kFix3HashSize + hash3Value] = -+ p->hash[kFix4HashSize + hashValue] = p->pos; -+ -+ maxLen = 1; -+ offset = 0; -+ if (delta2 < p->cyclicBufferSize && *(cur - delta2) == *cur) -+ { -+ distances[0] = maxLen = 2; -+ distances[1] = delta2 - 1; -+ offset = 2; -+ } -+ if (delta2 != delta3 && delta3 < p->cyclicBufferSize && *(cur - delta3) == *cur) -+ { -+ maxLen = 3; -+ distances[offset + 1] = delta3 - 1; -+ offset += 2; -+ delta2 = delta3; -+ } -+ if (offset != 0) -+ { -+ for (; maxLen != lenLimit; maxLen++) -+ if (cur[(ptrdiff_t)maxLen - delta2] != cur[maxLen]) -+ break; -+ distances[offset - 2] = maxLen; -+ if (maxLen == lenLimit) -+ { -+ p->son[p->cyclicBufferPos] = curMatch; -+ MOVE_POS_RET; -+ } -+ } -+ if (maxLen < 3) -+ maxLen = 3; -+ offset = (UInt32)(Hc_GetMatchesSpec(lenLimit, curMatch, MF_PARAMS(p), -+ distances + offset, maxLen) - (distances)); -+ MOVE_POS_RET -+} -+ -+UInt32 Hc3Zip_MatchFinder_GetMatches(CMatchFinder *p, UInt32 *distances) -+{ -+ UInt32 offset; -+ GET_MATCHES_HEADER(3) -+ HASH_ZIP_CALC; -+ curMatch = p->hash[hashValue]; -+ p->hash[hashValue] = p->pos; -+ offset = (UInt32)(Hc_GetMatchesSpec(lenLimit, curMatch, MF_PARAMS(p), -+ distances, 2) - (distances)); -+ MOVE_POS_RET -+} -+ -+static void Bt2_MatchFinder_Skip(CMatchFinder *p, UInt32 num) -+{ -+ do -+ { -+ SKIP_HEADER(2) -+ HASH2_CALC; -+ curMatch = p->hash[hashValue]; -+ p->hash[hashValue] = p->pos; -+ SKIP_FOOTER -+ } -+ while (--num != 0); -+} -+ -+void Bt3Zip_MatchFinder_Skip(CMatchFinder *p, UInt32 num) -+{ -+ do -+ { -+ SKIP_HEADER(3) -+ HASH_ZIP_CALC; -+ curMatch = p->hash[hashValue]; -+ p->hash[hashValue] = p->pos; -+ SKIP_FOOTER -+ } -+ while (--num != 0); -+} -+ -+static void Bt3_MatchFinder_Skip(CMatchFinder *p, UInt32 num) -+{ -+ do -+ { -+ UInt32 hash2Value; -+ SKIP_HEADER(3) -+ HASH3_CALC; -+ curMatch = p->hash[kFix3HashSize + hashValue]; -+ p->hash[hash2Value] = -+ p->hash[kFix3HashSize + hashValue] = p->pos; -+ SKIP_FOOTER -+ } -+ while (--num != 0); -+} -+ -+static void Bt4_MatchFinder_Skip(CMatchFinder *p, UInt32 num) -+{ -+ do -+ { -+ UInt32 hash2Value, hash3Value; -+ SKIP_HEADER(4) -+ HASH4_CALC; -+ curMatch = p->hash[kFix4HashSize + hashValue]; -+ p->hash[ hash2Value] = -+ p->hash[kFix3HashSize + hash3Value] = p->pos; -+ p->hash[kFix4HashSize + hashValue] = p->pos; -+ SKIP_FOOTER -+ } -+ while (--num != 0); -+} -+ -+static void Hc4_MatchFinder_Skip(CMatchFinder *p, UInt32 num) -+{ -+ do -+ { -+ UInt32 hash2Value, hash3Value; -+ SKIP_HEADER(4) -+ HASH4_CALC; -+ curMatch = p->hash[kFix4HashSize + hashValue]; -+ p->hash[ hash2Value] = -+ p->hash[kFix3HashSize + hash3Value] = -+ p->hash[kFix4HashSize + hashValue] = p->pos; -+ p->son[p->cyclicBufferPos] = curMatch; -+ MOVE_POS -+ } -+ while (--num != 0); -+} -+ -+void Hc3Zip_MatchFinder_Skip(CMatchFinder *p, UInt32 num) -+{ -+ do -+ { -+ SKIP_HEADER(3) -+ HASH_ZIP_CALC; -+ curMatch = p->hash[hashValue]; -+ p->hash[hashValue] = p->pos; -+ p->son[p->cyclicBufferPos] = curMatch; -+ MOVE_POS -+ } -+ while (--num != 0); -+} -+ -+void MatchFinder_CreateVTable(CMatchFinder *p, IMatchFinder *vTable) -+{ -+ vTable->Init = (Mf_Init_Func)MatchFinder_Init; -+ vTable->GetIndexByte = (Mf_GetIndexByte_Func)MatchFinder_GetIndexByte; -+ vTable->GetNumAvailableBytes = (Mf_GetNumAvailableBytes_Func)MatchFinder_GetNumAvailableBytes; -+ vTable->GetPointerToCurrentPos = (Mf_GetPointerToCurrentPos_Func)MatchFinder_GetPointerToCurrentPos; -+ if (!p->btMode) -+ { -+ vTable->GetMatches = (Mf_GetMatches_Func)Hc4_MatchFinder_GetMatches; -+ vTable->Skip = (Mf_Skip_Func)Hc4_MatchFinder_Skip; -+ } -+ else if (p->numHashBytes == 2) -+ { -+ vTable->GetMatches = (Mf_GetMatches_Func)Bt2_MatchFinder_GetMatches; -+ vTable->Skip = (Mf_Skip_Func)Bt2_MatchFinder_Skip; -+ } -+ else if (p->numHashBytes == 3) -+ { -+ vTable->GetMatches = (Mf_GetMatches_Func)Bt3_MatchFinder_GetMatches; -+ vTable->Skip = (Mf_Skip_Func)Bt3_MatchFinder_Skip; -+ } -+ else -+ { -+ vTable->GetMatches = (Mf_GetMatches_Func)Bt4_MatchFinder_GetMatches; -+ vTable->Skip = (Mf_Skip_Func)Bt4_MatchFinder_Skip; -+ } -+} ---- /dev/null -+++ b/lib/lzma/LzmaDec.c -@@ -0,0 +1,999 @@ -+/* LzmaDec.c -- LZMA Decoder -+2009-09-20 : Igor Pavlov : Public domain */ -+ -+#include "LzmaDec.h" -+ -+#include -+ -+#define kNumTopBits 24 -+#define kTopValue ((UInt32)1 << kNumTopBits) -+ -+#define kNumBitModelTotalBits 11 -+#define kBitModelTotal (1 << kNumBitModelTotalBits) -+#define kNumMoveBits 5 -+ -+#define RC_INIT_SIZE 5 -+ -+#define NORMALIZE if (range < kTopValue) { range <<= 8; code = (code << 8) | (*buf++); } -+ -+#define IF_BIT_0(p) ttt = *(p); NORMALIZE; bound = (range >> kNumBitModelTotalBits) * ttt; if (code < bound) -+#define UPDATE_0(p) range = bound; *(p) = (CLzmaProb)(ttt + ((kBitModelTotal - ttt) >> kNumMoveBits)); -+#define UPDATE_1(p) range -= bound; code -= bound; *(p) = (CLzmaProb)(ttt - (ttt >> kNumMoveBits)); -+#define GET_BIT2(p, i, A0, A1) IF_BIT_0(p) \ -+ { UPDATE_0(p); i = (i + i); A0; } else \ -+ { UPDATE_1(p); i = (i + i) + 1; A1; } -+#define GET_BIT(p, i) GET_BIT2(p, i, ; , ;) -+ -+#define TREE_GET_BIT(probs, i) { GET_BIT((probs + i), i); } -+#define TREE_DECODE(probs, limit, i) \ -+ { i = 1; do { TREE_GET_BIT(probs, i); } while (i < limit); i -= limit; } -+ -+/* #define _LZMA_SIZE_OPT */ -+ -+#ifdef _LZMA_SIZE_OPT -+#define TREE_6_DECODE(probs, i) TREE_DECODE(probs, (1 << 6), i) -+#else -+#define TREE_6_DECODE(probs, i) \ -+ { i = 1; \ -+ TREE_GET_BIT(probs, i); \ -+ TREE_GET_BIT(probs, i); \ -+ TREE_GET_BIT(probs, i); \ -+ TREE_GET_BIT(probs, i); \ -+ TREE_GET_BIT(probs, i); \ -+ TREE_GET_BIT(probs, i); \ -+ i -= 0x40; } -+#endif -+ -+#define NORMALIZE_CHECK if (range < kTopValue) { if (buf >= bufLimit) return DUMMY_ERROR; range <<= 8; code = (code << 8) | (*buf++); } -+ -+#define IF_BIT_0_CHECK(p) ttt = *(p); NORMALIZE_CHECK; bound = (range >> kNumBitModelTotalBits) * ttt; if (code < bound) -+#define UPDATE_0_CHECK range = bound; -+#define UPDATE_1_CHECK range -= bound; code -= bound; -+#define GET_BIT2_CHECK(p, i, A0, A1) IF_BIT_0_CHECK(p) \ -+ { UPDATE_0_CHECK; i = (i + i); A0; } else \ -+ { UPDATE_1_CHECK; i = (i + i) + 1; A1; } -+#define GET_BIT_CHECK(p, i) GET_BIT2_CHECK(p, i, ; , ;) -+#define TREE_DECODE_CHECK(probs, limit, i) \ -+ { i = 1; do { GET_BIT_CHECK(probs + i, i) } while (i < limit); i -= limit; } -+ -+ -+#define kNumPosBitsMax 4 -+#define kNumPosStatesMax (1 << kNumPosBitsMax) -+ -+#define kLenNumLowBits 3 -+#define kLenNumLowSymbols (1 << kLenNumLowBits) -+#define kLenNumMidBits 3 -+#define kLenNumMidSymbols (1 << kLenNumMidBits) -+#define kLenNumHighBits 8 -+#define kLenNumHighSymbols (1 << kLenNumHighBits) -+ -+#define LenChoice 0 -+#define LenChoice2 (LenChoice + 1) -+#define LenLow (LenChoice2 + 1) -+#define LenMid (LenLow + (kNumPosStatesMax << kLenNumLowBits)) -+#define LenHigh (LenMid + (kNumPosStatesMax << kLenNumMidBits)) -+#define kNumLenProbs (LenHigh + kLenNumHighSymbols) -+ -+ -+#define kNumStates 12 -+#define kNumLitStates 7 -+ -+#define kStartPosModelIndex 4 -+#define kEndPosModelIndex 14 -+#define kNumFullDistances (1 << (kEndPosModelIndex >> 1)) -+ -+#define kNumPosSlotBits 6 -+#define kNumLenToPosStates 4 -+ -+#define kNumAlignBits 4 -+#define kAlignTableSize (1 << kNumAlignBits) -+ -+#define kMatchMinLen 2 -+#define kMatchSpecLenStart (kMatchMinLen + kLenNumLowSymbols + kLenNumMidSymbols + kLenNumHighSymbols) -+ -+#define IsMatch 0 -+#define IsRep (IsMatch + (kNumStates << kNumPosBitsMax)) -+#define IsRepG0 (IsRep + kNumStates) -+#define IsRepG1 (IsRepG0 + kNumStates) -+#define IsRepG2 (IsRepG1 + kNumStates) -+#define IsRep0Long (IsRepG2 + kNumStates) -+#define PosSlot (IsRep0Long + (kNumStates << kNumPosBitsMax)) -+#define SpecPos (PosSlot + (kNumLenToPosStates << kNumPosSlotBits)) -+#define Align (SpecPos + kNumFullDistances - kEndPosModelIndex) -+#define LenCoder (Align + kAlignTableSize) -+#define RepLenCoder (LenCoder + kNumLenProbs) -+#define Literal (RepLenCoder + kNumLenProbs) -+ -+#define LZMA_BASE_SIZE 1846 -+#define LZMA_LIT_SIZE 768 -+ -+#define LzmaProps_GetNumProbs(p) ((UInt32)LZMA_BASE_SIZE + (LZMA_LIT_SIZE << ((p)->lc + (p)->lp))) -+ -+#if Literal != LZMA_BASE_SIZE -+StopCompilingDueBUG -+#endif -+ -+#define LZMA_DIC_MIN (1 << 12) -+ -+/* First LZMA-symbol is always decoded. -+And it decodes new LZMA-symbols while (buf < bufLimit), but "buf" is without last normalization -+Out: -+ Result: -+ SZ_OK - OK -+ SZ_ERROR_DATA - Error -+ p->remainLen: -+ < kMatchSpecLenStart : normal remain -+ = kMatchSpecLenStart : finished -+ = kMatchSpecLenStart + 1 : Flush marker -+ = kMatchSpecLenStart + 2 : State Init Marker -+*/ -+ -+static int MY_FAST_CALL LzmaDec_DecodeReal(CLzmaDec *p, SizeT limit, const Byte *bufLimit) -+{ -+ CLzmaProb *probs = p->probs; -+ -+ unsigned state = p->state; -+ UInt32 rep0 = p->reps[0], rep1 = p->reps[1], rep2 = p->reps[2], rep3 = p->reps[3]; -+ unsigned pbMask = ((unsigned)1 << (p->prop.pb)) - 1; -+ unsigned lpMask = ((unsigned)1 << (p->prop.lp)) - 1; -+ unsigned lc = p->prop.lc; -+ -+ Byte *dic = p->dic; -+ SizeT dicBufSize = p->dicBufSize; -+ SizeT dicPos = p->dicPos; -+ -+ UInt32 processedPos = p->processedPos; -+ UInt32 checkDicSize = p->checkDicSize; -+ unsigned len = 0; -+ -+ const Byte *buf = p->buf; -+ UInt32 range = p->range; -+ UInt32 code = p->code; -+ -+ do -+ { -+ CLzmaProb *prob; -+ UInt32 bound; -+ unsigned ttt; -+ unsigned posState = processedPos & pbMask; -+ -+ prob = probs + IsMatch + (state << kNumPosBitsMax) + posState; -+ IF_BIT_0(prob) -+ { -+ unsigned symbol; -+ UPDATE_0(prob); -+ prob = probs + Literal; -+ if (checkDicSize != 0 || processedPos != 0) -+ prob += (LZMA_LIT_SIZE * (((processedPos & lpMask) << lc) + -+ (dic[(dicPos == 0 ? dicBufSize : dicPos) - 1] >> (8 - lc)))); -+ -+ if (state < kNumLitStates) -+ { -+ state -= (state < 4) ? state : 3; -+ symbol = 1; -+ do { GET_BIT(prob + symbol, symbol) } while (symbol < 0x100); -+ } -+ else -+ { -+ unsigned matchByte = p->dic[(dicPos - rep0) + ((dicPos < rep0) ? dicBufSize : 0)]; -+ unsigned offs = 0x100; -+ state -= (state < 10) ? 3 : 6; -+ symbol = 1; -+ do -+ { -+ unsigned bit; -+ CLzmaProb *probLit; -+ matchByte <<= 1; -+ bit = (matchByte & offs); -+ probLit = prob + offs + bit + symbol; -+ GET_BIT2(probLit, symbol, offs &= ~bit, offs &= bit) -+ } -+ while (symbol < 0x100); -+ } -+ dic[dicPos++] = (Byte)symbol; -+ processedPos++; -+ continue; -+ } -+ else -+ { -+ UPDATE_1(prob); -+ prob = probs + IsRep + state; -+ IF_BIT_0(prob) -+ { -+ UPDATE_0(prob); -+ state += kNumStates; -+ prob = probs + LenCoder; -+ } -+ else -+ { -+ UPDATE_1(prob); -+ if (checkDicSize == 0 && processedPos == 0) -+ return SZ_ERROR_DATA; -+ prob = probs + IsRepG0 + state; -+ IF_BIT_0(prob) -+ { -+ UPDATE_0(prob); -+ prob = probs + IsRep0Long + (state << kNumPosBitsMax) + posState; -+ IF_BIT_0(prob) -+ { -+ UPDATE_0(prob); -+ dic[dicPos] = dic[(dicPos - rep0) + ((dicPos < rep0) ? dicBufSize : 0)]; -+ dicPos++; -+ processedPos++; -+ state = state < kNumLitStates ? 9 : 11; -+ continue; -+ } -+ UPDATE_1(prob); -+ } -+ else -+ { -+ UInt32 distance; -+ UPDATE_1(prob); -+ prob = probs + IsRepG1 + state; -+ IF_BIT_0(prob) -+ { -+ UPDATE_0(prob); -+ distance = rep1; -+ } -+ else -+ { -+ UPDATE_1(prob); -+ prob = probs + IsRepG2 + state; -+ IF_BIT_0(prob) -+ { -+ UPDATE_0(prob); -+ distance = rep2; -+ } -+ else -+ { -+ UPDATE_1(prob); -+ distance = rep3; -+ rep3 = rep2; -+ } -+ rep2 = rep1; -+ } -+ rep1 = rep0; -+ rep0 = distance; -+ } -+ state = state < kNumLitStates ? 8 : 11; -+ prob = probs + RepLenCoder; -+ } -+ { -+ unsigned limit, offset; -+ CLzmaProb *probLen = prob + LenChoice; -+ IF_BIT_0(probLen) -+ { -+ UPDATE_0(probLen); -+ probLen = prob + LenLow + (posState << kLenNumLowBits); -+ offset = 0; -+ limit = (1 << kLenNumLowBits); -+ } -+ else -+ { -+ UPDATE_1(probLen); -+ probLen = prob + LenChoice2; -+ IF_BIT_0(probLen) -+ { -+ UPDATE_0(probLen); -+ probLen = prob + LenMid + (posState << kLenNumMidBits); -+ offset = kLenNumLowSymbols; -+ limit = (1 << kLenNumMidBits); -+ } -+ else -+ { -+ UPDATE_1(probLen); -+ probLen = prob + LenHigh; -+ offset = kLenNumLowSymbols + kLenNumMidSymbols; -+ limit = (1 << kLenNumHighBits); -+ } -+ } -+ TREE_DECODE(probLen, limit, len); -+ len += offset; -+ } -+ -+ if (state >= kNumStates) -+ { -+ UInt32 distance; -+ prob = probs + PosSlot + -+ ((len < kNumLenToPosStates ? len : kNumLenToPosStates - 1) << kNumPosSlotBits); -+ TREE_6_DECODE(prob, distance); -+ if (distance >= kStartPosModelIndex) -+ { -+ unsigned posSlot = (unsigned)distance; -+ int numDirectBits = (int)(((distance >> 1) - 1)); -+ distance = (2 | (distance & 1)); -+ if (posSlot < kEndPosModelIndex) -+ { -+ distance <<= numDirectBits; -+ prob = probs + SpecPos + distance - posSlot - 1; -+ { -+ UInt32 mask = 1; -+ unsigned i = 1; -+ do -+ { -+ GET_BIT2(prob + i, i, ; , distance |= mask); -+ mask <<= 1; -+ } -+ while (--numDirectBits != 0); -+ } -+ } -+ else -+ { -+ numDirectBits -= kNumAlignBits; -+ do -+ { -+ NORMALIZE -+ range >>= 1; -+ -+ { -+ UInt32 t; -+ code -= range; -+ t = (0 - ((UInt32)code >> 31)); /* (UInt32)((Int32)code >> 31) */ -+ distance = (distance << 1) + (t + 1); -+ code += range & t; -+ } -+ /* -+ distance <<= 1; -+ if (code >= range) -+ { -+ code -= range; -+ distance |= 1; -+ } -+ */ -+ } -+ while (--numDirectBits != 0); -+ prob = probs + Align; -+ distance <<= kNumAlignBits; -+ { -+ unsigned i = 1; -+ GET_BIT2(prob + i, i, ; , distance |= 1); -+ GET_BIT2(prob + i, i, ; , distance |= 2); -+ GET_BIT2(prob + i, i, ; , distance |= 4); -+ GET_BIT2(prob + i, i, ; , distance |= 8); -+ } -+ if (distance == (UInt32)0xFFFFFFFF) -+ { -+ len += kMatchSpecLenStart; -+ state -= kNumStates; -+ break; -+ } -+ } -+ } -+ rep3 = rep2; -+ rep2 = rep1; -+ rep1 = rep0; -+ rep0 = distance + 1; -+ if (checkDicSize == 0) -+ { -+ if (distance >= processedPos) -+ return SZ_ERROR_DATA; -+ } -+ else if (distance >= checkDicSize) -+ return SZ_ERROR_DATA; -+ state = (state < kNumStates + kNumLitStates) ? kNumLitStates : kNumLitStates + 3; -+ } -+ -+ len += kMatchMinLen; -+ -+ if (limit == dicPos) -+ return SZ_ERROR_DATA; -+ { -+ SizeT rem = limit - dicPos; -+ unsigned curLen = ((rem < len) ? (unsigned)rem : len); -+ SizeT pos = (dicPos - rep0) + ((dicPos < rep0) ? dicBufSize : 0); -+ -+ processedPos += curLen; -+ -+ len -= curLen; -+ if (pos + curLen <= dicBufSize) -+ { -+ Byte *dest = dic + dicPos; -+ ptrdiff_t src = (ptrdiff_t)pos - (ptrdiff_t)dicPos; -+ const Byte *lim = dest + curLen; -+ dicPos += curLen; -+ do -+ *(dest) = (Byte)*(dest + src); -+ while (++dest != lim); -+ } -+ else -+ { -+ do -+ { -+ dic[dicPos++] = dic[pos]; -+ if (++pos == dicBufSize) -+ pos = 0; -+ } -+ while (--curLen != 0); -+ } -+ } -+ } -+ } -+ while (dicPos < limit && buf < bufLimit); -+ NORMALIZE; -+ p->buf = buf; -+ p->range = range; -+ p->code = code; -+ p->remainLen = len; -+ p->dicPos = dicPos; -+ p->processedPos = processedPos; -+ p->reps[0] = rep0; -+ p->reps[1] = rep1; -+ p->reps[2] = rep2; -+ p->reps[3] = rep3; -+ p->state = state; -+ -+ return SZ_OK; -+} -+ -+static void MY_FAST_CALL LzmaDec_WriteRem(CLzmaDec *p, SizeT limit) -+{ -+ if (p->remainLen != 0 && p->remainLen < kMatchSpecLenStart) -+ { -+ Byte *dic = p->dic; -+ SizeT dicPos = p->dicPos; -+ SizeT dicBufSize = p->dicBufSize; -+ unsigned len = p->remainLen; -+ UInt32 rep0 = p->reps[0]; -+ if (limit - dicPos < len) -+ len = (unsigned)(limit - dicPos); -+ -+ if (p->checkDicSize == 0 && p->prop.dicSize - p->processedPos <= len) -+ p->checkDicSize = p->prop.dicSize; -+ -+ p->processedPos += len; -+ p->remainLen -= len; -+ while (len-- != 0) -+ { -+ dic[dicPos] = dic[(dicPos - rep0) + ((dicPos < rep0) ? dicBufSize : 0)]; -+ dicPos++; -+ } -+ p->dicPos = dicPos; -+ } -+} -+ -+static int MY_FAST_CALL LzmaDec_DecodeReal2(CLzmaDec *p, SizeT limit, const Byte *bufLimit) -+{ -+ do -+ { -+ SizeT limit2 = limit; -+ if (p->checkDicSize == 0) -+ { -+ UInt32 rem = p->prop.dicSize - p->processedPos; -+ if (limit - p->dicPos > rem) -+ limit2 = p->dicPos + rem; -+ } -+ RINOK(LzmaDec_DecodeReal(p, limit2, bufLimit)); -+ if (p->processedPos >= p->prop.dicSize) -+ p->checkDicSize = p->prop.dicSize; -+ LzmaDec_WriteRem(p, limit); -+ } -+ while (p->dicPos < limit && p->buf < bufLimit && p->remainLen < kMatchSpecLenStart); -+ -+ if (p->remainLen > kMatchSpecLenStart) -+ { -+ p->remainLen = kMatchSpecLenStart; -+ } -+ return 0; -+} -+ -+typedef enum -+{ -+ DUMMY_ERROR, /* unexpected end of input stream */ -+ DUMMY_LIT, -+ DUMMY_MATCH, -+ DUMMY_REP -+} ELzmaDummy; -+ -+static ELzmaDummy LzmaDec_TryDummy(const CLzmaDec *p, const Byte *buf, SizeT inSize) -+{ -+ UInt32 range = p->range; -+ UInt32 code = p->code; -+ const Byte *bufLimit = buf + inSize; -+ CLzmaProb *probs = p->probs; -+ unsigned state = p->state; -+ ELzmaDummy res; -+ -+ { -+ CLzmaProb *prob; -+ UInt32 bound; -+ unsigned ttt; -+ unsigned posState = (p->processedPos) & ((1 << p->prop.pb) - 1); -+ -+ prob = probs + IsMatch + (state << kNumPosBitsMax) + posState; -+ IF_BIT_0_CHECK(prob) -+ { -+ UPDATE_0_CHECK -+ -+ /* if (bufLimit - buf >= 7) return DUMMY_LIT; */ -+ -+ prob = probs + Literal; -+ if (p->checkDicSize != 0 || p->processedPos != 0) -+ prob += (LZMA_LIT_SIZE * -+ ((((p->processedPos) & ((1 << (p->prop.lp)) - 1)) << p->prop.lc) + -+ (p->dic[(p->dicPos == 0 ? p->dicBufSize : p->dicPos) - 1] >> (8 - p->prop.lc)))); -+ -+ if (state < kNumLitStates) -+ { -+ unsigned symbol = 1; -+ do { GET_BIT_CHECK(prob + symbol, symbol) } while (symbol < 0x100); -+ } -+ else -+ { -+ unsigned matchByte = p->dic[p->dicPos - p->reps[0] + -+ ((p->dicPos < p->reps[0]) ? p->dicBufSize : 0)]; -+ unsigned offs = 0x100; -+ unsigned symbol = 1; -+ do -+ { -+ unsigned bit; -+ CLzmaProb *probLit; -+ matchByte <<= 1; -+ bit = (matchByte & offs); -+ probLit = prob + offs + bit + symbol; -+ GET_BIT2_CHECK(probLit, symbol, offs &= ~bit, offs &= bit) -+ } -+ while (symbol < 0x100); -+ } -+ res = DUMMY_LIT; -+ } -+ else -+ { -+ unsigned len; -+ UPDATE_1_CHECK; -+ -+ prob = probs + IsRep + state; -+ IF_BIT_0_CHECK(prob) -+ { -+ UPDATE_0_CHECK; -+ state = 0; -+ prob = probs + LenCoder; -+ res = DUMMY_MATCH; -+ } -+ else -+ { -+ UPDATE_1_CHECK; -+ res = DUMMY_REP; -+ prob = probs + IsRepG0 + state; -+ IF_BIT_0_CHECK(prob) -+ { -+ UPDATE_0_CHECK; -+ prob = probs + IsRep0Long + (state << kNumPosBitsMax) + posState; -+ IF_BIT_0_CHECK(prob) -+ { -+ UPDATE_0_CHECK; -+ NORMALIZE_CHECK; -+ return DUMMY_REP; -+ } -+ else -+ { -+ UPDATE_1_CHECK; -+ } -+ } -+ else -+ { -+ UPDATE_1_CHECK; -+ prob = probs + IsRepG1 + state; -+ IF_BIT_0_CHECK(prob) -+ { -+ UPDATE_0_CHECK; -+ } -+ else -+ { -+ UPDATE_1_CHECK; -+ prob = probs + IsRepG2 + state; -+ IF_BIT_0_CHECK(prob) -+ { -+ UPDATE_0_CHECK; -+ } -+ else -+ { -+ UPDATE_1_CHECK; -+ } -+ } -+ } -+ state = kNumStates; -+ prob = probs + RepLenCoder; -+ } -+ { -+ unsigned limit, offset; -+ CLzmaProb *probLen = prob + LenChoice; -+ IF_BIT_0_CHECK(probLen) -+ { -+ UPDATE_0_CHECK; -+ probLen = prob + LenLow + (posState << kLenNumLowBits); -+ offset = 0; -+ limit = 1 << kLenNumLowBits; -+ } -+ else -+ { -+ UPDATE_1_CHECK; -+ probLen = prob + LenChoice2; -+ IF_BIT_0_CHECK(probLen) -+ { -+ UPDATE_0_CHECK; -+ probLen = prob + LenMid + (posState << kLenNumMidBits); -+ offset = kLenNumLowSymbols; -+ limit = 1 << kLenNumMidBits; -+ } -+ else -+ { -+ UPDATE_1_CHECK; -+ probLen = prob + LenHigh; -+ offset = kLenNumLowSymbols + kLenNumMidSymbols; -+ limit = 1 << kLenNumHighBits; -+ } -+ } -+ TREE_DECODE_CHECK(probLen, limit, len); -+ len += offset; -+ } -+ -+ if (state < 4) -+ { -+ unsigned posSlot; -+ prob = probs + PosSlot + -+ ((len < kNumLenToPosStates ? len : kNumLenToPosStates - 1) << -+ kNumPosSlotBits); -+ TREE_DECODE_CHECK(prob, 1 << kNumPosSlotBits, posSlot); -+ if (posSlot >= kStartPosModelIndex) -+ { -+ int numDirectBits = ((posSlot >> 1) - 1); -+ -+ /* if (bufLimit - buf >= 8) return DUMMY_MATCH; */ -+ -+ if (posSlot < kEndPosModelIndex) -+ { -+ prob = probs + SpecPos + ((2 | (posSlot & 1)) << numDirectBits) - posSlot - 1; -+ } -+ else -+ { -+ numDirectBits -= kNumAlignBits; -+ do -+ { -+ NORMALIZE_CHECK -+ range >>= 1; -+ code -= range & (((code - range) >> 31) - 1); -+ /* if (code >= range) code -= range; */ -+ } -+ while (--numDirectBits != 0); -+ prob = probs + Align; -+ numDirectBits = kNumAlignBits; -+ } -+ { -+ unsigned i = 1; -+ do -+ { -+ GET_BIT_CHECK(prob + i, i); -+ } -+ while (--numDirectBits != 0); -+ } -+ } -+ } -+ } -+ } -+ NORMALIZE_CHECK; -+ return res; -+} -+ -+ -+static void LzmaDec_InitRc(CLzmaDec *p, const Byte *data) -+{ -+ p->code = ((UInt32)data[1] << 24) | ((UInt32)data[2] << 16) | ((UInt32)data[3] << 8) | ((UInt32)data[4]); -+ p->range = 0xFFFFFFFF; -+ p->needFlush = 0; -+} -+ -+void LzmaDec_InitDicAndState(CLzmaDec *p, Bool initDic, Bool initState) -+{ -+ p->needFlush = 1; -+ p->remainLen = 0; -+ p->tempBufSize = 0; -+ -+ if (initDic) -+ { -+ p->processedPos = 0; -+ p->checkDicSize = 0; -+ p->needInitState = 1; -+ } -+ if (initState) -+ p->needInitState = 1; -+} -+ -+void LzmaDec_Init(CLzmaDec *p) -+{ -+ p->dicPos = 0; -+ LzmaDec_InitDicAndState(p, True, True); -+} -+ -+static void LzmaDec_InitStateReal(CLzmaDec *p) -+{ -+ UInt32 numProbs = Literal + ((UInt32)LZMA_LIT_SIZE << (p->prop.lc + p->prop.lp)); -+ UInt32 i; -+ CLzmaProb *probs = p->probs; -+ for (i = 0; i < numProbs; i++) -+ probs[i] = kBitModelTotal >> 1; -+ p->reps[0] = p->reps[1] = p->reps[2] = p->reps[3] = 1; -+ p->state = 0; -+ p->needInitState = 0; -+} -+ -+SRes LzmaDec_DecodeToDic(CLzmaDec *p, SizeT dicLimit, const Byte *src, SizeT *srcLen, -+ ELzmaFinishMode finishMode, ELzmaStatus *status) -+{ -+ SizeT inSize = *srcLen; -+ (*srcLen) = 0; -+ LzmaDec_WriteRem(p, dicLimit); -+ -+ *status = LZMA_STATUS_NOT_SPECIFIED; -+ -+ while (p->remainLen != kMatchSpecLenStart) -+ { -+ int checkEndMarkNow; -+ -+ if (p->needFlush != 0) -+ { -+ for (; inSize > 0 && p->tempBufSize < RC_INIT_SIZE; (*srcLen)++, inSize--) -+ p->tempBuf[p->tempBufSize++] = *src++; -+ if (p->tempBufSize < RC_INIT_SIZE) -+ { -+ *status = LZMA_STATUS_NEEDS_MORE_INPUT; -+ return SZ_OK; -+ } -+ if (p->tempBuf[0] != 0) -+ return SZ_ERROR_DATA; -+ -+ LzmaDec_InitRc(p, p->tempBuf); -+ p->tempBufSize = 0; -+ } -+ -+ checkEndMarkNow = 0; -+ if (p->dicPos >= dicLimit) -+ { -+ if (p->remainLen == 0 && p->code == 0) -+ { -+ *status = LZMA_STATUS_MAYBE_FINISHED_WITHOUT_MARK; -+ return SZ_OK; -+ } -+ if (finishMode == LZMA_FINISH_ANY) -+ { -+ *status = LZMA_STATUS_NOT_FINISHED; -+ return SZ_OK; -+ } -+ if (p->remainLen != 0) -+ { -+ *status = LZMA_STATUS_NOT_FINISHED; -+ return SZ_ERROR_DATA; -+ } -+ checkEndMarkNow = 1; -+ } -+ -+ if (p->needInitState) -+ LzmaDec_InitStateReal(p); -+ -+ if (p->tempBufSize == 0) -+ { -+ SizeT processed; -+ const Byte *bufLimit; -+ if (inSize < LZMA_REQUIRED_INPUT_MAX || checkEndMarkNow) -+ { -+ int dummyRes = LzmaDec_TryDummy(p, src, inSize); -+ if (dummyRes == DUMMY_ERROR) -+ { -+ memcpy(p->tempBuf, src, inSize); -+ p->tempBufSize = (unsigned)inSize; -+ (*srcLen) += inSize; -+ *status = LZMA_STATUS_NEEDS_MORE_INPUT; -+ return SZ_OK; -+ } -+ if (checkEndMarkNow && dummyRes != DUMMY_MATCH) -+ { -+ *status = LZMA_STATUS_NOT_FINISHED; -+ return SZ_ERROR_DATA; -+ } -+ bufLimit = src; -+ } -+ else -+ bufLimit = src + inSize - LZMA_REQUIRED_INPUT_MAX; -+ p->buf = src; -+ if (LzmaDec_DecodeReal2(p, dicLimit, bufLimit) != 0) -+ return SZ_ERROR_DATA; -+ processed = (SizeT)(p->buf - src); -+ (*srcLen) += processed; -+ src += processed; -+ inSize -= processed; -+ } -+ else -+ { -+ unsigned rem = p->tempBufSize, lookAhead = 0; -+ while (rem < LZMA_REQUIRED_INPUT_MAX && lookAhead < inSize) -+ p->tempBuf[rem++] = src[lookAhead++]; -+ p->tempBufSize = rem; -+ if (rem < LZMA_REQUIRED_INPUT_MAX || checkEndMarkNow) -+ { -+ int dummyRes = LzmaDec_TryDummy(p, p->tempBuf, rem); -+ if (dummyRes == DUMMY_ERROR) -+ { -+ (*srcLen) += lookAhead; -+ *status = LZMA_STATUS_NEEDS_MORE_INPUT; -+ return SZ_OK; -+ } -+ if (checkEndMarkNow && dummyRes != DUMMY_MATCH) -+ { -+ *status = LZMA_STATUS_NOT_FINISHED; -+ return SZ_ERROR_DATA; -+ } -+ } -+ p->buf = p->tempBuf; -+ if (LzmaDec_DecodeReal2(p, dicLimit, p->buf) != 0) -+ return SZ_ERROR_DATA; -+ lookAhead -= (rem - (unsigned)(p->buf - p->tempBuf)); -+ (*srcLen) += lookAhead; -+ src += lookAhead; -+ inSize -= lookAhead; -+ p->tempBufSize = 0; -+ } -+ } -+ if (p->code == 0) -+ *status = LZMA_STATUS_FINISHED_WITH_MARK; -+ return (p->code == 0) ? SZ_OK : SZ_ERROR_DATA; -+} -+ -+SRes LzmaDec_DecodeToBuf(CLzmaDec *p, Byte *dest, SizeT *destLen, const Byte *src, SizeT *srcLen, ELzmaFinishMode finishMode, ELzmaStatus *status) -+{ -+ SizeT outSize = *destLen; -+ SizeT inSize = *srcLen; -+ *srcLen = *destLen = 0; -+ for (;;) -+ { -+ SizeT inSizeCur = inSize, outSizeCur, dicPos; -+ ELzmaFinishMode curFinishMode; -+ SRes res; -+ if (p->dicPos == p->dicBufSize) -+ p->dicPos = 0; -+ dicPos = p->dicPos; -+ if (outSize > p->dicBufSize - dicPos) -+ { -+ outSizeCur = p->dicBufSize; -+ curFinishMode = LZMA_FINISH_ANY; -+ } -+ else -+ { -+ outSizeCur = dicPos + outSize; -+ curFinishMode = finishMode; -+ } -+ -+ res = LzmaDec_DecodeToDic(p, outSizeCur, src, &inSizeCur, curFinishMode, status); -+ src += inSizeCur; -+ inSize -= inSizeCur; -+ *srcLen += inSizeCur; -+ outSizeCur = p->dicPos - dicPos; -+ memcpy(dest, p->dic + dicPos, outSizeCur); -+ dest += outSizeCur; -+ outSize -= outSizeCur; -+ *destLen += outSizeCur; -+ if (res != 0) -+ return res; -+ if (outSizeCur == 0 || outSize == 0) -+ return SZ_OK; -+ } -+} -+ -+void LzmaDec_FreeProbs(CLzmaDec *p, ISzAlloc *alloc) -+{ -+ alloc->Free(alloc, p->probs); -+ p->probs = 0; -+} -+ -+static void LzmaDec_FreeDict(CLzmaDec *p, ISzAlloc *alloc) -+{ -+ alloc->Free(alloc, p->dic); -+ p->dic = 0; -+} -+ -+void LzmaDec_Free(CLzmaDec *p, ISzAlloc *alloc) -+{ -+ LzmaDec_FreeProbs(p, alloc); -+ LzmaDec_FreeDict(p, alloc); -+} -+ -+SRes LzmaProps_Decode(CLzmaProps *p, const Byte *data, unsigned size) -+{ -+ UInt32 dicSize; -+ Byte d; -+ -+ if (size < LZMA_PROPS_SIZE) -+ return SZ_ERROR_UNSUPPORTED; -+ else -+ dicSize = data[1] | ((UInt32)data[2] << 8) | ((UInt32)data[3] << 16) | ((UInt32)data[4] << 24); -+ -+ if (dicSize < LZMA_DIC_MIN) -+ dicSize = LZMA_DIC_MIN; -+ p->dicSize = dicSize; -+ -+ d = data[0]; -+ if (d >= (9 * 5 * 5)) -+ return SZ_ERROR_UNSUPPORTED; -+ -+ p->lc = d % 9; -+ d /= 9; -+ p->pb = d / 5; -+ p->lp = d % 5; -+ -+ return SZ_OK; -+} -+ -+static SRes LzmaDec_AllocateProbs2(CLzmaDec *p, const CLzmaProps *propNew, ISzAlloc *alloc) -+{ -+ UInt32 numProbs = LzmaProps_GetNumProbs(propNew); -+ if (p->probs == 0 || numProbs != p->numProbs) -+ { -+ LzmaDec_FreeProbs(p, alloc); -+ p->probs = (CLzmaProb *)alloc->Alloc(alloc, numProbs * sizeof(CLzmaProb)); -+ p->numProbs = numProbs; -+ if (p->probs == 0) -+ return SZ_ERROR_MEM; -+ } -+ return SZ_OK; -+} -+ -+SRes LzmaDec_AllocateProbs(CLzmaDec *p, const Byte *props, unsigned propsSize, ISzAlloc *alloc) -+{ -+ CLzmaProps propNew; -+ RINOK(LzmaProps_Decode(&propNew, props, propsSize)); -+ RINOK(LzmaDec_AllocateProbs2(p, &propNew, alloc)); -+ p->prop = propNew; -+ return SZ_OK; -+} -+ -+SRes LzmaDec_Allocate(CLzmaDec *p, const Byte *props, unsigned propsSize, ISzAlloc *alloc) -+{ -+ CLzmaProps propNew; -+ SizeT dicBufSize; -+ RINOK(LzmaProps_Decode(&propNew, props, propsSize)); -+ RINOK(LzmaDec_AllocateProbs2(p, &propNew, alloc)); -+ dicBufSize = propNew.dicSize; -+ if (p->dic == 0 || dicBufSize != p->dicBufSize) -+ { -+ LzmaDec_FreeDict(p, alloc); -+ p->dic = (Byte *)alloc->Alloc(alloc, dicBufSize); -+ if (p->dic == 0) -+ { -+ LzmaDec_FreeProbs(p, alloc); -+ return SZ_ERROR_MEM; -+ } -+ } -+ p->dicBufSize = dicBufSize; -+ p->prop = propNew; -+ return SZ_OK; -+} -+ -+SRes LzmaDecode(Byte *dest, SizeT *destLen, const Byte *src, SizeT *srcLen, -+ const Byte *propData, unsigned propSize, ELzmaFinishMode finishMode, -+ ELzmaStatus *status, ISzAlloc *alloc) -+{ -+ CLzmaDec p; -+ SRes res; -+ SizeT inSize = *srcLen; -+ SizeT outSize = *destLen; -+ *srcLen = *destLen = 0; -+ if (inSize < RC_INIT_SIZE) -+ return SZ_ERROR_INPUT_EOF; -+ -+ LzmaDec_Construct(&p); -+ res = LzmaDec_AllocateProbs(&p, propData, propSize, alloc); -+ if (res != 0) -+ return res; -+ p.dic = dest; -+ p.dicBufSize = outSize; -+ -+ LzmaDec_Init(&p); -+ -+ *srcLen = inSize; -+ res = LzmaDec_DecodeToDic(&p, outSize, src, srcLen, finishMode, status); -+ -+ if (res == SZ_OK && *status == LZMA_STATUS_NEEDS_MORE_INPUT) -+ res = SZ_ERROR_INPUT_EOF; -+ -+ (*destLen) = p.dicPos; -+ LzmaDec_FreeProbs(&p, alloc); -+ return res; -+} ---- /dev/null -+++ b/lib/lzma/LzmaEnc.c -@@ -0,0 +1,2271 @@ -+/* LzmaEnc.c -- LZMA Encoder -+2009-11-24 : Igor Pavlov : Public domain */ -+ -+#include -+ -+/* #define SHOW_STAT */ -+/* #define SHOW_STAT2 */ -+ -+#if defined(SHOW_STAT) || defined(SHOW_STAT2) -+#include -+#endif -+ -+#include "LzmaEnc.h" -+ -+/* disable MT */ -+#define _7ZIP_ST -+ -+#include "LzFind.h" -+#ifndef _7ZIP_ST -+#include "LzFindMt.h" -+#endif -+ -+#ifdef SHOW_STAT -+static int ttt = 0; -+#endif -+ -+#define kBlockSizeMax ((1 << LZMA_NUM_BLOCK_SIZE_BITS) - 1) -+ -+#define kBlockSize (9 << 10) -+#define kUnpackBlockSize (1 << 18) -+#define kMatchArraySize (1 << 21) -+#define kMatchRecordMaxSize ((LZMA_MATCH_LEN_MAX * 2 + 3) * LZMA_MATCH_LEN_MAX) -+ -+#define kNumMaxDirectBits (31) -+ -+#define kNumTopBits 24 -+#define kTopValue ((UInt32)1 << kNumTopBits) -+ -+#define kNumBitModelTotalBits 11 -+#define kBitModelTotal (1 << kNumBitModelTotalBits) -+#define kNumMoveBits 5 -+#define kProbInitValue (kBitModelTotal >> 1) -+ -+#define kNumMoveReducingBits 4 -+#define kNumBitPriceShiftBits 4 -+#define kBitPrice (1 << kNumBitPriceShiftBits) -+ -+void LzmaEncProps_Init(CLzmaEncProps *p) -+{ -+ p->level = 5; -+ p->dictSize = p->mc = 0; -+ p->lc = p->lp = p->pb = p->algo = p->fb = p->btMode = p->numHashBytes = p->numThreads = -1; -+ p->writeEndMark = 0; -+} -+ -+void LzmaEncProps_Normalize(CLzmaEncProps *p) -+{ -+ int level = p->level; -+ if (level < 0) level = 5; -+ p->level = level; -+ if (p->dictSize == 0) p->dictSize = (level <= 5 ? (1 << (level * 2 + 14)) : (level == 6 ? (1 << 25) : (1 << 26))); -+ if (p->lc < 0) p->lc = 3; -+ if (p->lp < 0) p->lp = 0; -+ if (p->pb < 0) p->pb = 2; -+ if (p->algo < 0) p->algo = (level < 5 ? 0 : 1); -+ if (p->fb < 0) p->fb = (level < 7 ? 32 : 64); -+ if (p->btMode < 0) p->btMode = (p->algo == 0 ? 0 : 1); -+ if (p->numHashBytes < 0) p->numHashBytes = 4; -+ if (p->mc == 0) p->mc = (16 + (p->fb >> 1)) >> (p->btMode ? 0 : 1); -+ if (p->numThreads < 0) -+ p->numThreads = -+ #ifndef _7ZIP_ST -+ ((p->btMode && p->algo) ? 2 : 1); -+ #else -+ 1; -+ #endif -+} -+ -+UInt32 LzmaEncProps_GetDictSize(const CLzmaEncProps *props2) -+{ -+ CLzmaEncProps props = *props2; -+ LzmaEncProps_Normalize(&props); -+ return props.dictSize; -+} -+ -+/* #define LZMA_LOG_BSR */ -+/* Define it for Intel's CPU */ -+ -+ -+#ifdef LZMA_LOG_BSR -+ -+#define kDicLogSizeMaxCompress 30 -+ -+#define BSR2_RET(pos, res) { unsigned long i; _BitScanReverse(&i, (pos)); res = (i + i) + ((pos >> (i - 1)) & 1); } -+ -+UInt32 GetPosSlot1(UInt32 pos) -+{ -+ UInt32 res; -+ BSR2_RET(pos, res); -+ return res; -+} -+#define GetPosSlot2(pos, res) { BSR2_RET(pos, res); } -+#define GetPosSlot(pos, res) { if (pos < 2) res = pos; else BSR2_RET(pos, res); } -+ -+#else -+ -+#define kNumLogBits (9 + (int)sizeof(size_t) / 2) -+#define kDicLogSizeMaxCompress ((kNumLogBits - 1) * 2 + 7) -+ -+void LzmaEnc_FastPosInit(Byte *g_FastPos) -+{ -+ int c = 2, slotFast; -+ g_FastPos[0] = 0; -+ g_FastPos[1] = 1; -+ -+ for (slotFast = 2; slotFast < kNumLogBits * 2; slotFast++) -+ { -+ UInt32 k = (1 << ((slotFast >> 1) - 1)); -+ UInt32 j; -+ for (j = 0; j < k; j++, c++) -+ g_FastPos[c] = (Byte)slotFast; -+ } -+} -+ -+#define BSR2_RET(pos, res) { UInt32 i = 6 + ((kNumLogBits - 1) & \ -+ (0 - (((((UInt32)1 << (kNumLogBits + 6)) - 1) - pos) >> 31))); \ -+ res = p->g_FastPos[pos >> i] + (i * 2); } -+/* -+#define BSR2_RET(pos, res) { res = (pos < (1 << (kNumLogBits + 6))) ? \ -+ p->g_FastPos[pos >> 6] + 12 : \ -+ p->g_FastPos[pos >> (6 + kNumLogBits - 1)] + (6 + (kNumLogBits - 1)) * 2; } -+*/ -+ -+#define GetPosSlot1(pos) p->g_FastPos[pos] -+#define GetPosSlot2(pos, res) { BSR2_RET(pos, res); } -+#define GetPosSlot(pos, res) { if (pos < kNumFullDistances) res = p->g_FastPos[pos]; else BSR2_RET(pos, res); } -+ -+#endif -+ -+ -+#define LZMA_NUM_REPS 4 -+ -+typedef unsigned CState; -+ -+typedef struct -+{ -+ UInt32 price; -+ -+ CState state; -+ int prev1IsChar; -+ int prev2; -+ -+ UInt32 posPrev2; -+ UInt32 backPrev2; -+ -+ UInt32 posPrev; -+ UInt32 backPrev; -+ UInt32 backs[LZMA_NUM_REPS]; -+} COptimal; -+ -+#define kNumOpts (1 << 12) -+ -+#define kNumLenToPosStates 4 -+#define kNumPosSlotBits 6 -+#define kDicLogSizeMin 0 -+#define kDicLogSizeMax 32 -+#define kDistTableSizeMax (kDicLogSizeMax * 2) -+ -+ -+#define kNumAlignBits 4 -+#define kAlignTableSize (1 << kNumAlignBits) -+#define kAlignMask (kAlignTableSize - 1) -+ -+#define kStartPosModelIndex 4 -+#define kEndPosModelIndex 14 -+#define kNumPosModels (kEndPosModelIndex - kStartPosModelIndex) -+ -+#define kNumFullDistances (1 << (kEndPosModelIndex >> 1)) -+ -+#ifdef _LZMA_PROB32 -+#define CLzmaProb UInt32 -+#else -+#define CLzmaProb UInt16 -+#endif -+ -+#define LZMA_PB_MAX 4 -+#define LZMA_LC_MAX 8 -+#define LZMA_LP_MAX 4 -+ -+#define LZMA_NUM_PB_STATES_MAX (1 << LZMA_PB_MAX) -+ -+ -+#define kLenNumLowBits 3 -+#define kLenNumLowSymbols (1 << kLenNumLowBits) -+#define kLenNumMidBits 3 -+#define kLenNumMidSymbols (1 << kLenNumMidBits) -+#define kLenNumHighBits 8 -+#define kLenNumHighSymbols (1 << kLenNumHighBits) -+ -+#define kLenNumSymbolsTotal (kLenNumLowSymbols + kLenNumMidSymbols + kLenNumHighSymbols) -+ -+#define LZMA_MATCH_LEN_MIN 2 -+#define LZMA_MATCH_LEN_MAX (LZMA_MATCH_LEN_MIN + kLenNumSymbolsTotal - 1) -+ -+#define kNumStates 12 -+ -+typedef struct -+{ -+ CLzmaProb choice; -+ CLzmaProb choice2; -+ CLzmaProb low[LZMA_NUM_PB_STATES_MAX << kLenNumLowBits]; -+ CLzmaProb mid[LZMA_NUM_PB_STATES_MAX << kLenNumMidBits]; -+ CLzmaProb high[kLenNumHighSymbols]; -+} CLenEnc; -+ -+typedef struct -+{ -+ CLenEnc p; -+ UInt32 prices[LZMA_NUM_PB_STATES_MAX][kLenNumSymbolsTotal]; -+ UInt32 tableSize; -+ UInt32 counters[LZMA_NUM_PB_STATES_MAX]; -+} CLenPriceEnc; -+ -+typedef struct -+{ -+ UInt32 range; -+ Byte cache; -+ UInt64 low; -+ UInt64 cacheSize; -+ Byte *buf; -+ Byte *bufLim; -+ Byte *bufBase; -+ ISeqOutStream *outStream; -+ UInt64 processed; -+ SRes res; -+} CRangeEnc; -+ -+typedef struct -+{ -+ CLzmaProb *litProbs; -+ -+ CLzmaProb isMatch[kNumStates][LZMA_NUM_PB_STATES_MAX]; -+ CLzmaProb isRep[kNumStates]; -+ CLzmaProb isRepG0[kNumStates]; -+ CLzmaProb isRepG1[kNumStates]; -+ CLzmaProb isRepG2[kNumStates]; -+ CLzmaProb isRep0Long[kNumStates][LZMA_NUM_PB_STATES_MAX]; -+ -+ CLzmaProb posSlotEncoder[kNumLenToPosStates][1 << kNumPosSlotBits]; -+ CLzmaProb posEncoders[kNumFullDistances - kEndPosModelIndex]; -+ CLzmaProb posAlignEncoder[1 << kNumAlignBits]; -+ -+ CLenPriceEnc lenEnc; -+ CLenPriceEnc repLenEnc; -+ -+ UInt32 reps[LZMA_NUM_REPS]; -+ UInt32 state; -+} CSaveState; -+ -+typedef struct -+{ -+ IMatchFinder matchFinder; -+ void *matchFinderObj; -+ -+ #ifndef _7ZIP_ST -+ Bool mtMode; -+ CMatchFinderMt matchFinderMt; -+ #endif -+ -+ CMatchFinder matchFinderBase; -+ -+ #ifndef _7ZIP_ST -+ Byte pad[128]; -+ #endif -+ -+ UInt32 optimumEndIndex; -+ UInt32 optimumCurrentIndex; -+ -+ UInt32 longestMatchLength; -+ UInt32 numPairs; -+ UInt32 numAvail; -+ COptimal opt[kNumOpts]; -+ -+ #ifndef LZMA_LOG_BSR -+ Byte g_FastPos[1 << kNumLogBits]; -+ #endif -+ -+ UInt32 ProbPrices[kBitModelTotal >> kNumMoveReducingBits]; -+ UInt32 matches[LZMA_MATCH_LEN_MAX * 2 + 2 + 1]; -+ UInt32 numFastBytes; -+ UInt32 additionalOffset; -+ UInt32 reps[LZMA_NUM_REPS]; -+ UInt32 state; -+ -+ UInt32 posSlotPrices[kNumLenToPosStates][kDistTableSizeMax]; -+ UInt32 distancesPrices[kNumLenToPosStates][kNumFullDistances]; -+ UInt32 alignPrices[kAlignTableSize]; -+ UInt32 alignPriceCount; -+ -+ UInt32 distTableSize; -+ -+ unsigned lc, lp, pb; -+ unsigned lpMask, pbMask; -+ -+ CLzmaProb *litProbs; -+ -+ CLzmaProb isMatch[kNumStates][LZMA_NUM_PB_STATES_MAX]; -+ CLzmaProb isRep[kNumStates]; -+ CLzmaProb isRepG0[kNumStates]; -+ CLzmaProb isRepG1[kNumStates]; -+ CLzmaProb isRepG2[kNumStates]; -+ CLzmaProb isRep0Long[kNumStates][LZMA_NUM_PB_STATES_MAX]; -+ -+ CLzmaProb posSlotEncoder[kNumLenToPosStates][1 << kNumPosSlotBits]; -+ CLzmaProb posEncoders[kNumFullDistances - kEndPosModelIndex]; -+ CLzmaProb posAlignEncoder[1 << kNumAlignBits]; -+ -+ CLenPriceEnc lenEnc; -+ CLenPriceEnc repLenEnc; -+ -+ unsigned lclp; -+ -+ Bool fastMode; -+ -+ CRangeEnc rc; -+ -+ Bool writeEndMark; -+ UInt64 nowPos64; -+ UInt32 matchPriceCount; -+ Bool finished; -+ Bool multiThread; -+ -+ SRes result; -+ UInt32 dictSize; -+ UInt32 matchFinderCycles; -+ -+ int needInit; -+ -+ CSaveState saveState; -+} CLzmaEnc; -+ -+void LzmaEnc_SaveState(CLzmaEncHandle pp) -+{ -+ CLzmaEnc *p = (CLzmaEnc *)pp; -+ CSaveState *dest = &p->saveState; -+ int i; -+ dest->lenEnc = p->lenEnc; -+ dest->repLenEnc = p->repLenEnc; -+ dest->state = p->state; -+ -+ for (i = 0; i < kNumStates; i++) -+ { -+ memcpy(dest->isMatch[i], p->isMatch[i], sizeof(p->isMatch[i])); -+ memcpy(dest->isRep0Long[i], p->isRep0Long[i], sizeof(p->isRep0Long[i])); -+ } -+ for (i = 0; i < kNumLenToPosStates; i++) -+ memcpy(dest->posSlotEncoder[i], p->posSlotEncoder[i], sizeof(p->posSlotEncoder[i])); -+ memcpy(dest->isRep, p->isRep, sizeof(p->isRep)); -+ memcpy(dest->isRepG0, p->isRepG0, sizeof(p->isRepG0)); -+ memcpy(dest->isRepG1, p->isRepG1, sizeof(p->isRepG1)); -+ memcpy(dest->isRepG2, p->isRepG2, sizeof(p->isRepG2)); -+ memcpy(dest->posEncoders, p->posEncoders, sizeof(p->posEncoders)); -+ memcpy(dest->posAlignEncoder, p->posAlignEncoder, sizeof(p->posAlignEncoder)); -+ memcpy(dest->reps, p->reps, sizeof(p->reps)); -+ memcpy(dest->litProbs, p->litProbs, (0x300 << p->lclp) * sizeof(CLzmaProb)); -+} -+ -+void LzmaEnc_RestoreState(CLzmaEncHandle pp) -+{ -+ CLzmaEnc *dest = (CLzmaEnc *)pp; -+ const CSaveState *p = &dest->saveState; -+ int i; -+ dest->lenEnc = p->lenEnc; -+ dest->repLenEnc = p->repLenEnc; -+ dest->state = p->state; -+ -+ for (i = 0; i < kNumStates; i++) -+ { -+ memcpy(dest->isMatch[i], p->isMatch[i], sizeof(p->isMatch[i])); -+ memcpy(dest->isRep0Long[i], p->isRep0Long[i], sizeof(p->isRep0Long[i])); -+ } -+ for (i = 0; i < kNumLenToPosStates; i++) -+ memcpy(dest->posSlotEncoder[i], p->posSlotEncoder[i], sizeof(p->posSlotEncoder[i])); -+ memcpy(dest->isRep, p->isRep, sizeof(p->isRep)); -+ memcpy(dest->isRepG0, p->isRepG0, sizeof(p->isRepG0)); -+ memcpy(dest->isRepG1, p->isRepG1, sizeof(p->isRepG1)); -+ memcpy(dest->isRepG2, p->isRepG2, sizeof(p->isRepG2)); -+ memcpy(dest->posEncoders, p->posEncoders, sizeof(p->posEncoders)); -+ memcpy(dest->posAlignEncoder, p->posAlignEncoder, sizeof(p->posAlignEncoder)); -+ memcpy(dest->reps, p->reps, sizeof(p->reps)); -+ memcpy(dest->litProbs, p->litProbs, (0x300 << dest->lclp) * sizeof(CLzmaProb)); -+} -+ -+SRes LzmaEnc_SetProps(CLzmaEncHandle pp, const CLzmaEncProps *props2) -+{ -+ CLzmaEnc *p = (CLzmaEnc *)pp; -+ CLzmaEncProps props = *props2; -+ LzmaEncProps_Normalize(&props); -+ -+ if (props.lc > LZMA_LC_MAX || props.lp > LZMA_LP_MAX || props.pb > LZMA_PB_MAX || -+ props.dictSize > (1 << kDicLogSizeMaxCompress) || props.dictSize > (1 << 30)) -+ return SZ_ERROR_PARAM; -+ p->dictSize = props.dictSize; -+ p->matchFinderCycles = props.mc; -+ { -+ unsigned fb = props.fb; -+ if (fb < 5) -+ fb = 5; -+ if (fb > LZMA_MATCH_LEN_MAX) -+ fb = LZMA_MATCH_LEN_MAX; -+ p->numFastBytes = fb; -+ } -+ p->lc = props.lc; -+ p->lp = props.lp; -+ p->pb = props.pb; -+ p->fastMode = (props.algo == 0); -+ p->matchFinderBase.btMode = props.btMode; -+ { -+ UInt32 numHashBytes = 4; -+ if (props.btMode) -+ { -+ if (props.numHashBytes < 2) -+ numHashBytes = 2; -+ else if (props.numHashBytes < 4) -+ numHashBytes = props.numHashBytes; -+ } -+ p->matchFinderBase.numHashBytes = numHashBytes; -+ } -+ -+ p->matchFinderBase.cutValue = props.mc; -+ -+ p->writeEndMark = props.writeEndMark; -+ -+ #ifndef _7ZIP_ST -+ /* -+ if (newMultiThread != _multiThread) -+ { -+ ReleaseMatchFinder(); -+ _multiThread = newMultiThread; -+ } -+ */ -+ p->multiThread = (props.numThreads > 1); -+ #endif -+ -+ return SZ_OK; -+} -+ -+static const int kLiteralNextStates[kNumStates] = {0, 0, 0, 0, 1, 2, 3, 4, 5, 6, 4, 5}; -+static const int kMatchNextStates[kNumStates] = {7, 7, 7, 7, 7, 7, 7, 10, 10, 10, 10, 10}; -+static const int kRepNextStates[kNumStates] = {8, 8, 8, 8, 8, 8, 8, 11, 11, 11, 11, 11}; -+static const int kShortRepNextStates[kNumStates]= {9, 9, 9, 9, 9, 9, 9, 11, 11, 11, 11, 11}; -+ -+#define IsCharState(s) ((s) < 7) -+ -+#define GetLenToPosState(len) (((len) < kNumLenToPosStates + 1) ? (len) - 2 : kNumLenToPosStates - 1) -+ -+#define kInfinityPrice (1 << 30) -+ -+static void RangeEnc_Construct(CRangeEnc *p) -+{ -+ p->outStream = 0; -+ p->bufBase = 0; -+} -+ -+#define RangeEnc_GetProcessed(p) ((p)->processed + ((p)->buf - (p)->bufBase) + (p)->cacheSize) -+ -+#define RC_BUF_SIZE (1 << 16) -+static int RangeEnc_Alloc(CRangeEnc *p, ISzAlloc *alloc) -+{ -+ if (p->bufBase == 0) -+ { -+ p->bufBase = (Byte *)alloc->Alloc(alloc, RC_BUF_SIZE); -+ if (p->bufBase == 0) -+ return 0; -+ p->bufLim = p->bufBase + RC_BUF_SIZE; -+ } -+ return 1; -+} -+ -+static void RangeEnc_Free(CRangeEnc *p, ISzAlloc *alloc) -+{ -+ alloc->Free(alloc, p->bufBase); -+ p->bufBase = 0; -+} -+ -+static void RangeEnc_Init(CRangeEnc *p) -+{ -+ /* Stream.Init(); */ -+ p->low = 0; -+ p->range = 0xFFFFFFFF; -+ p->cacheSize = 1; -+ p->cache = 0; -+ -+ p->buf = p->bufBase; -+ -+ p->processed = 0; -+ p->res = SZ_OK; -+} -+ -+static void RangeEnc_FlushStream(CRangeEnc *p) -+{ -+ size_t num; -+ if (p->res != SZ_OK) -+ return; -+ num = p->buf - p->bufBase; -+ if (num != p->outStream->Write(p->outStream, p->bufBase, num)) -+ p->res = SZ_ERROR_WRITE; -+ p->processed += num; -+ p->buf = p->bufBase; -+} -+ -+static void MY_FAST_CALL RangeEnc_ShiftLow(CRangeEnc *p) -+{ -+ if ((UInt32)p->low < (UInt32)0xFF000000 || (int)(p->low >> 32) != 0) -+ { -+ Byte temp = p->cache; -+ do -+ { -+ Byte *buf = p->buf; -+ *buf++ = (Byte)(temp + (Byte)(p->low >> 32)); -+ p->buf = buf; -+ if (buf == p->bufLim) -+ RangeEnc_FlushStream(p); -+ temp = 0xFF; -+ } -+ while (--p->cacheSize != 0); -+ p->cache = (Byte)((UInt32)p->low >> 24); -+ } -+ p->cacheSize++; -+ p->low = (UInt32)p->low << 8; -+} -+ -+static void RangeEnc_FlushData(CRangeEnc *p) -+{ -+ int i; -+ for (i = 0; i < 5; i++) -+ RangeEnc_ShiftLow(p); -+} -+ -+static void RangeEnc_EncodeDirectBits(CRangeEnc *p, UInt32 value, int numBits) -+{ -+ do -+ { -+ p->range >>= 1; -+ p->low += p->range & (0 - ((value >> --numBits) & 1)); -+ if (p->range < kTopValue) -+ { -+ p->range <<= 8; -+ RangeEnc_ShiftLow(p); -+ } -+ } -+ while (numBits != 0); -+} -+ -+static void RangeEnc_EncodeBit(CRangeEnc *p, CLzmaProb *prob, UInt32 symbol) -+{ -+ UInt32 ttt = *prob; -+ UInt32 newBound = (p->range >> kNumBitModelTotalBits) * ttt; -+ if (symbol == 0) -+ { -+ p->range = newBound; -+ ttt += (kBitModelTotal - ttt) >> kNumMoveBits; -+ } -+ else -+ { -+ p->low += newBound; -+ p->range -= newBound; -+ ttt -= ttt >> kNumMoveBits; -+ } -+ *prob = (CLzmaProb)ttt; -+ if (p->range < kTopValue) -+ { -+ p->range <<= 8; -+ RangeEnc_ShiftLow(p); -+ } -+} -+ -+static void LitEnc_Encode(CRangeEnc *p, CLzmaProb *probs, UInt32 symbol) -+{ -+ symbol |= 0x100; -+ do -+ { -+ RangeEnc_EncodeBit(p, probs + (symbol >> 8), (symbol >> 7) & 1); -+ symbol <<= 1; -+ } -+ while (symbol < 0x10000); -+} -+ -+static void LitEnc_EncodeMatched(CRangeEnc *p, CLzmaProb *probs, UInt32 symbol, UInt32 matchByte) -+{ -+ UInt32 offs = 0x100; -+ symbol |= 0x100; -+ do -+ { -+ matchByte <<= 1; -+ RangeEnc_EncodeBit(p, probs + (offs + (matchByte & offs) + (symbol >> 8)), (symbol >> 7) & 1); -+ symbol <<= 1; -+ offs &= ~(matchByte ^ symbol); -+ } -+ while (symbol < 0x10000); -+} -+ -+void LzmaEnc_InitPriceTables(UInt32 *ProbPrices) -+{ -+ UInt32 i; -+ for (i = (1 << kNumMoveReducingBits) / 2; i < kBitModelTotal; i += (1 << kNumMoveReducingBits)) -+ { -+ const int kCyclesBits = kNumBitPriceShiftBits; -+ UInt32 w = i; -+ UInt32 bitCount = 0; -+ int j; -+ for (j = 0; j < kCyclesBits; j++) -+ { -+ w = w * w; -+ bitCount <<= 1; -+ while (w >= ((UInt32)1 << 16)) -+ { -+ w >>= 1; -+ bitCount++; -+ } -+ } -+ ProbPrices[i >> kNumMoveReducingBits] = ((kNumBitModelTotalBits << kCyclesBits) - 15 - bitCount); -+ } -+} -+ -+ -+#define GET_PRICE(prob, symbol) \ -+ p->ProbPrices[((prob) ^ (((-(int)(symbol))) & (kBitModelTotal - 1))) >> kNumMoveReducingBits]; -+ -+#define GET_PRICEa(prob, symbol) \ -+ ProbPrices[((prob) ^ ((-((int)(symbol))) & (kBitModelTotal - 1))) >> kNumMoveReducingBits]; -+ -+#define GET_PRICE_0(prob) p->ProbPrices[(prob) >> kNumMoveReducingBits] -+#define GET_PRICE_1(prob) p->ProbPrices[((prob) ^ (kBitModelTotal - 1)) >> kNumMoveReducingBits] -+ -+#define GET_PRICE_0a(prob) ProbPrices[(prob) >> kNumMoveReducingBits] -+#define GET_PRICE_1a(prob) ProbPrices[((prob) ^ (kBitModelTotal - 1)) >> kNumMoveReducingBits] -+ -+static UInt32 LitEnc_GetPrice(const CLzmaProb *probs, UInt32 symbol, UInt32 *ProbPrices) -+{ -+ UInt32 price = 0; -+ symbol |= 0x100; -+ do -+ { -+ price += GET_PRICEa(probs[symbol >> 8], (symbol >> 7) & 1); -+ symbol <<= 1; -+ } -+ while (symbol < 0x10000); -+ return price; -+} -+ -+static UInt32 LitEnc_GetPriceMatched(const CLzmaProb *probs, UInt32 symbol, UInt32 matchByte, UInt32 *ProbPrices) -+{ -+ UInt32 price = 0; -+ UInt32 offs = 0x100; -+ symbol |= 0x100; -+ do -+ { -+ matchByte <<= 1; -+ price += GET_PRICEa(probs[offs + (matchByte & offs) + (symbol >> 8)], (symbol >> 7) & 1); -+ symbol <<= 1; -+ offs &= ~(matchByte ^ symbol); -+ } -+ while (symbol < 0x10000); -+ return price; -+} -+ -+ -+static void RcTree_Encode(CRangeEnc *rc, CLzmaProb *probs, int numBitLevels, UInt32 symbol) -+{ -+ UInt32 m = 1; -+ int i; -+ for (i = numBitLevels; i != 0;) -+ { -+ UInt32 bit; -+ i--; -+ bit = (symbol >> i) & 1; -+ RangeEnc_EncodeBit(rc, probs + m, bit); -+ m = (m << 1) | bit; -+ } -+} -+ -+static void RcTree_ReverseEncode(CRangeEnc *rc, CLzmaProb *probs, int numBitLevels, UInt32 symbol) -+{ -+ UInt32 m = 1; -+ int i; -+ for (i = 0; i < numBitLevels; i++) -+ { -+ UInt32 bit = symbol & 1; -+ RangeEnc_EncodeBit(rc, probs + m, bit); -+ m = (m << 1) | bit; -+ symbol >>= 1; -+ } -+} -+ -+static UInt32 RcTree_GetPrice(const CLzmaProb *probs, int numBitLevels, UInt32 symbol, UInt32 *ProbPrices) -+{ -+ UInt32 price = 0; -+ symbol |= (1 << numBitLevels); -+ while (symbol != 1) -+ { -+ price += GET_PRICEa(probs[symbol >> 1], symbol & 1); -+ symbol >>= 1; -+ } -+ return price; -+} -+ -+static UInt32 RcTree_ReverseGetPrice(const CLzmaProb *probs, int numBitLevels, UInt32 symbol, UInt32 *ProbPrices) -+{ -+ UInt32 price = 0; -+ UInt32 m = 1; -+ int i; -+ for (i = numBitLevels; i != 0; i--) -+ { -+ UInt32 bit = symbol & 1; -+ symbol >>= 1; -+ price += GET_PRICEa(probs[m], bit); -+ m = (m << 1) | bit; -+ } -+ return price; -+} -+ -+ -+static void LenEnc_Init(CLenEnc *p) -+{ -+ unsigned i; -+ p->choice = p->choice2 = kProbInitValue; -+ for (i = 0; i < (LZMA_NUM_PB_STATES_MAX << kLenNumLowBits); i++) -+ p->low[i] = kProbInitValue; -+ for (i = 0; i < (LZMA_NUM_PB_STATES_MAX << kLenNumMidBits); i++) -+ p->mid[i] = kProbInitValue; -+ for (i = 0; i < kLenNumHighSymbols; i++) -+ p->high[i] = kProbInitValue; -+} -+ -+static void LenEnc_Encode(CLenEnc *p, CRangeEnc *rc, UInt32 symbol, UInt32 posState) -+{ -+ if (symbol < kLenNumLowSymbols) -+ { -+ RangeEnc_EncodeBit(rc, &p->choice, 0); -+ RcTree_Encode(rc, p->low + (posState << kLenNumLowBits), kLenNumLowBits, symbol); -+ } -+ else -+ { -+ RangeEnc_EncodeBit(rc, &p->choice, 1); -+ if (symbol < kLenNumLowSymbols + kLenNumMidSymbols) -+ { -+ RangeEnc_EncodeBit(rc, &p->choice2, 0); -+ RcTree_Encode(rc, p->mid + (posState << kLenNumMidBits), kLenNumMidBits, symbol - kLenNumLowSymbols); -+ } -+ else -+ { -+ RangeEnc_EncodeBit(rc, &p->choice2, 1); -+ RcTree_Encode(rc, p->high, kLenNumHighBits, symbol - kLenNumLowSymbols - kLenNumMidSymbols); -+ } -+ } -+} -+ -+static void LenEnc_SetPrices(CLenEnc *p, UInt32 posState, UInt32 numSymbols, UInt32 *prices, UInt32 *ProbPrices) -+{ -+ UInt32 a0 = GET_PRICE_0a(p->choice); -+ UInt32 a1 = GET_PRICE_1a(p->choice); -+ UInt32 b0 = a1 + GET_PRICE_0a(p->choice2); -+ UInt32 b1 = a1 + GET_PRICE_1a(p->choice2); -+ UInt32 i = 0; -+ for (i = 0; i < kLenNumLowSymbols; i++) -+ { -+ if (i >= numSymbols) -+ return; -+ prices[i] = a0 + RcTree_GetPrice(p->low + (posState << kLenNumLowBits), kLenNumLowBits, i, ProbPrices); -+ } -+ for (; i < kLenNumLowSymbols + kLenNumMidSymbols; i++) -+ { -+ if (i >= numSymbols) -+ return; -+ prices[i] = b0 + RcTree_GetPrice(p->mid + (posState << kLenNumMidBits), kLenNumMidBits, i - kLenNumLowSymbols, ProbPrices); -+ } -+ for (; i < numSymbols; i++) -+ prices[i] = b1 + RcTree_GetPrice(p->high, kLenNumHighBits, i - kLenNumLowSymbols - kLenNumMidSymbols, ProbPrices); -+} -+ -+static void MY_FAST_CALL LenPriceEnc_UpdateTable(CLenPriceEnc *p, UInt32 posState, UInt32 *ProbPrices) -+{ -+ LenEnc_SetPrices(&p->p, posState, p->tableSize, p->prices[posState], ProbPrices); -+ p->counters[posState] = p->tableSize; -+} -+ -+static void LenPriceEnc_UpdateTables(CLenPriceEnc *p, UInt32 numPosStates, UInt32 *ProbPrices) -+{ -+ UInt32 posState; -+ for (posState = 0; posState < numPosStates; posState++) -+ LenPriceEnc_UpdateTable(p, posState, ProbPrices); -+} -+ -+static void LenEnc_Encode2(CLenPriceEnc *p, CRangeEnc *rc, UInt32 symbol, UInt32 posState, Bool updatePrice, UInt32 *ProbPrices) -+{ -+ LenEnc_Encode(&p->p, rc, symbol, posState); -+ if (updatePrice) -+ if (--p->counters[posState] == 0) -+ LenPriceEnc_UpdateTable(p, posState, ProbPrices); -+} -+ -+ -+ -+ -+static void MovePos(CLzmaEnc *p, UInt32 num) -+{ -+ #ifdef SHOW_STAT -+ ttt += num; -+ printf("\n MovePos %d", num); -+ #endif -+ if (num != 0) -+ { -+ p->additionalOffset += num; -+ p->matchFinder.Skip(p->matchFinderObj, num); -+ } -+} -+ -+static UInt32 ReadMatchDistances(CLzmaEnc *p, UInt32 *numDistancePairsRes) -+{ -+ UInt32 lenRes = 0, numPairs; -+ p->numAvail = p->matchFinder.GetNumAvailableBytes(p->matchFinderObj); -+ numPairs = p->matchFinder.GetMatches(p->matchFinderObj, p->matches); -+ #ifdef SHOW_STAT -+ printf("\n i = %d numPairs = %d ", ttt, numPairs / 2); -+ ttt++; -+ { -+ UInt32 i; -+ for (i = 0; i < numPairs; i += 2) -+ printf("%2d %6d | ", p->matches[i], p->matches[i + 1]); -+ } -+ #endif -+ if (numPairs > 0) -+ { -+ lenRes = p->matches[numPairs - 2]; -+ if (lenRes == p->numFastBytes) -+ { -+ const Byte *pby = p->matchFinder.GetPointerToCurrentPos(p->matchFinderObj) - 1; -+ UInt32 distance = p->matches[numPairs - 1] + 1; -+ UInt32 numAvail = p->numAvail; -+ if (numAvail > LZMA_MATCH_LEN_MAX) -+ numAvail = LZMA_MATCH_LEN_MAX; -+ { -+ const Byte *pby2 = pby - distance; -+ for (; lenRes < numAvail && pby[lenRes] == pby2[lenRes]; lenRes++); -+ } -+ } -+ } -+ p->additionalOffset++; -+ *numDistancePairsRes = numPairs; -+ return lenRes; -+} -+ -+ -+#define MakeAsChar(p) (p)->backPrev = (UInt32)(-1); (p)->prev1IsChar = False; -+#define MakeAsShortRep(p) (p)->backPrev = 0; (p)->prev1IsChar = False; -+#define IsShortRep(p) ((p)->backPrev == 0) -+ -+static UInt32 GetRepLen1Price(CLzmaEnc *p, UInt32 state, UInt32 posState) -+{ -+ return -+ GET_PRICE_0(p->isRepG0[state]) + -+ GET_PRICE_0(p->isRep0Long[state][posState]); -+} -+ -+static UInt32 GetPureRepPrice(CLzmaEnc *p, UInt32 repIndex, UInt32 state, UInt32 posState) -+{ -+ UInt32 price; -+ if (repIndex == 0) -+ { -+ price = GET_PRICE_0(p->isRepG0[state]); -+ price += GET_PRICE_1(p->isRep0Long[state][posState]); -+ } -+ else -+ { -+ price = GET_PRICE_1(p->isRepG0[state]); -+ if (repIndex == 1) -+ price += GET_PRICE_0(p->isRepG1[state]); -+ else -+ { -+ price += GET_PRICE_1(p->isRepG1[state]); -+ price += GET_PRICE(p->isRepG2[state], repIndex - 2); -+ } -+ } -+ return price; -+} -+ -+static UInt32 GetRepPrice(CLzmaEnc *p, UInt32 repIndex, UInt32 len, UInt32 state, UInt32 posState) -+{ -+ return p->repLenEnc.prices[posState][len - LZMA_MATCH_LEN_MIN] + -+ GetPureRepPrice(p, repIndex, state, posState); -+} -+ -+static UInt32 Backward(CLzmaEnc *p, UInt32 *backRes, UInt32 cur) -+{ -+ UInt32 posMem = p->opt[cur].posPrev; -+ UInt32 backMem = p->opt[cur].backPrev; -+ p->optimumEndIndex = cur; -+ do -+ { -+ if (p->opt[cur].prev1IsChar) -+ { -+ MakeAsChar(&p->opt[posMem]) -+ p->opt[posMem].posPrev = posMem - 1; -+ if (p->opt[cur].prev2) -+ { -+ p->opt[posMem - 1].prev1IsChar = False; -+ p->opt[posMem - 1].posPrev = p->opt[cur].posPrev2; -+ p->opt[posMem - 1].backPrev = p->opt[cur].backPrev2; -+ } -+ } -+ { -+ UInt32 posPrev = posMem; -+ UInt32 backCur = backMem; -+ -+ backMem = p->opt[posPrev].backPrev; -+ posMem = p->opt[posPrev].posPrev; -+ -+ p->opt[posPrev].backPrev = backCur; -+ p->opt[posPrev].posPrev = cur; -+ cur = posPrev; -+ } -+ } -+ while (cur != 0); -+ *backRes = p->opt[0].backPrev; -+ p->optimumCurrentIndex = p->opt[0].posPrev; -+ return p->optimumCurrentIndex; -+} -+ -+#define LIT_PROBS(pos, prevByte) (p->litProbs + ((((pos) & p->lpMask) << p->lc) + ((prevByte) >> (8 - p->lc))) * 0x300) -+ -+static UInt32 GetOptimum(CLzmaEnc *p, UInt32 position, UInt32 *backRes) -+{ -+ UInt32 numAvail, mainLen, numPairs, repMaxIndex, i, posState, lenEnd, len, cur; -+ UInt32 matchPrice, repMatchPrice, normalMatchPrice; -+ UInt32 reps[LZMA_NUM_REPS], repLens[LZMA_NUM_REPS]; -+ UInt32 *matches; -+ const Byte *data; -+ Byte curByte, matchByte; -+ if (p->optimumEndIndex != p->optimumCurrentIndex) -+ { -+ const COptimal *opt = &p->opt[p->optimumCurrentIndex]; -+ UInt32 lenRes = opt->posPrev - p->optimumCurrentIndex; -+ *backRes = opt->backPrev; -+ p->optimumCurrentIndex = opt->posPrev; -+ return lenRes; -+ } -+ p->optimumCurrentIndex = p->optimumEndIndex = 0; -+ -+ if (p->additionalOffset == 0) -+ mainLen = ReadMatchDistances(p, &numPairs); -+ else -+ { -+ mainLen = p->longestMatchLength; -+ numPairs = p->numPairs; -+ } -+ -+ numAvail = p->numAvail; -+ if (numAvail < 2) -+ { -+ *backRes = (UInt32)(-1); -+ return 1; -+ } -+ if (numAvail > LZMA_MATCH_LEN_MAX) -+ numAvail = LZMA_MATCH_LEN_MAX; -+ -+ data = p->matchFinder.GetPointerToCurrentPos(p->matchFinderObj) - 1; -+ repMaxIndex = 0; -+ for (i = 0; i < LZMA_NUM_REPS; i++) -+ { -+ UInt32 lenTest; -+ const Byte *data2; -+ reps[i] = p->reps[i]; -+ data2 = data - (reps[i] + 1); -+ if (data[0] != data2[0] || data[1] != data2[1]) -+ { -+ repLens[i] = 0; -+ continue; -+ } -+ for (lenTest = 2; lenTest < numAvail && data[lenTest] == data2[lenTest]; lenTest++); -+ repLens[i] = lenTest; -+ if (lenTest > repLens[repMaxIndex]) -+ repMaxIndex = i; -+ } -+ if (repLens[repMaxIndex] >= p->numFastBytes) -+ { -+ UInt32 lenRes; -+ *backRes = repMaxIndex; -+ lenRes = repLens[repMaxIndex]; -+ MovePos(p, lenRes - 1); -+ return lenRes; -+ } -+ -+ matches = p->matches; -+ if (mainLen >= p->numFastBytes) -+ { -+ *backRes = matches[numPairs - 1] + LZMA_NUM_REPS; -+ MovePos(p, mainLen - 1); -+ return mainLen; -+ } -+ curByte = *data; -+ matchByte = *(data - (reps[0] + 1)); -+ -+ if (mainLen < 2 && curByte != matchByte && repLens[repMaxIndex] < 2) -+ { -+ *backRes = (UInt32)-1; -+ return 1; -+ } -+ -+ p->opt[0].state = (CState)p->state; -+ -+ posState = (position & p->pbMask); -+ -+ { -+ const CLzmaProb *probs = LIT_PROBS(position, *(data - 1)); -+ p->opt[1].price = GET_PRICE_0(p->isMatch[p->state][posState]) + -+ (!IsCharState(p->state) ? -+ LitEnc_GetPriceMatched(probs, curByte, matchByte, p->ProbPrices) : -+ LitEnc_GetPrice(probs, curByte, p->ProbPrices)); -+ } -+ -+ MakeAsChar(&p->opt[1]); -+ -+ matchPrice = GET_PRICE_1(p->isMatch[p->state][posState]); -+ repMatchPrice = matchPrice + GET_PRICE_1(p->isRep[p->state]); -+ -+ if (matchByte == curByte) -+ { -+ UInt32 shortRepPrice = repMatchPrice + GetRepLen1Price(p, p->state, posState); -+ if (shortRepPrice < p->opt[1].price) -+ { -+ p->opt[1].price = shortRepPrice; -+ MakeAsShortRep(&p->opt[1]); -+ } -+ } -+ lenEnd = ((mainLen >= repLens[repMaxIndex]) ? mainLen : repLens[repMaxIndex]); -+ -+ if (lenEnd < 2) -+ { -+ *backRes = p->opt[1].backPrev; -+ return 1; -+ } -+ -+ p->opt[1].posPrev = 0; -+ for (i = 0; i < LZMA_NUM_REPS; i++) -+ p->opt[0].backs[i] = reps[i]; -+ -+ len = lenEnd; -+ do -+ p->opt[len--].price = kInfinityPrice; -+ while (len >= 2); -+ -+ for (i = 0; i < LZMA_NUM_REPS; i++) -+ { -+ UInt32 repLen = repLens[i]; -+ UInt32 price; -+ if (repLen < 2) -+ continue; -+ price = repMatchPrice + GetPureRepPrice(p, i, p->state, posState); -+ do -+ { -+ UInt32 curAndLenPrice = price + p->repLenEnc.prices[posState][repLen - 2]; -+ COptimal *opt = &p->opt[repLen]; -+ if (curAndLenPrice < opt->price) -+ { -+ opt->price = curAndLenPrice; -+ opt->posPrev = 0; -+ opt->backPrev = i; -+ opt->prev1IsChar = False; -+ } -+ } -+ while (--repLen >= 2); -+ } -+ -+ normalMatchPrice = matchPrice + GET_PRICE_0(p->isRep[p->state]); -+ -+ len = ((repLens[0] >= 2) ? repLens[0] + 1 : 2); -+ if (len <= mainLen) -+ { -+ UInt32 offs = 0; -+ while (len > matches[offs]) -+ offs += 2; -+ for (; ; len++) -+ { -+ COptimal *opt; -+ UInt32 distance = matches[offs + 1]; -+ -+ UInt32 curAndLenPrice = normalMatchPrice + p->lenEnc.prices[posState][len - LZMA_MATCH_LEN_MIN]; -+ UInt32 lenToPosState = GetLenToPosState(len); -+ if (distance < kNumFullDistances) -+ curAndLenPrice += p->distancesPrices[lenToPosState][distance]; -+ else -+ { -+ UInt32 slot; -+ GetPosSlot2(distance, slot); -+ curAndLenPrice += p->alignPrices[distance & kAlignMask] + p->posSlotPrices[lenToPosState][slot]; -+ } -+ opt = &p->opt[len]; -+ if (curAndLenPrice < opt->price) -+ { -+ opt->price = curAndLenPrice; -+ opt->posPrev = 0; -+ opt->backPrev = distance + LZMA_NUM_REPS; -+ opt->prev1IsChar = False; -+ } -+ if (len == matches[offs]) -+ { -+ offs += 2; -+ if (offs == numPairs) -+ break; -+ } -+ } -+ } -+ -+ cur = 0; -+ -+ #ifdef SHOW_STAT2 -+ if (position >= 0) -+ { -+ unsigned i; -+ printf("\n pos = %4X", position); -+ for (i = cur; i <= lenEnd; i++) -+ printf("\nprice[%4X] = %d", position - cur + i, p->opt[i].price); -+ } -+ #endif -+ -+ for (;;) -+ { -+ UInt32 numAvailFull, newLen, numPairs, posPrev, state, posState, startLen; -+ UInt32 curPrice, curAnd1Price, matchPrice, repMatchPrice; -+ Bool nextIsChar; -+ Byte curByte, matchByte; -+ const Byte *data; -+ COptimal *curOpt; -+ COptimal *nextOpt; -+ -+ cur++; -+ if (cur == lenEnd) -+ return Backward(p, backRes, cur); -+ -+ newLen = ReadMatchDistances(p, &numPairs); -+ if (newLen >= p->numFastBytes) -+ { -+ p->numPairs = numPairs; -+ p->longestMatchLength = newLen; -+ return Backward(p, backRes, cur); -+ } -+ position++; -+ curOpt = &p->opt[cur]; -+ posPrev = curOpt->posPrev; -+ if (curOpt->prev1IsChar) -+ { -+ posPrev--; -+ if (curOpt->prev2) -+ { -+ state = p->opt[curOpt->posPrev2].state; -+ if (curOpt->backPrev2 < LZMA_NUM_REPS) -+ state = kRepNextStates[state]; -+ else -+ state = kMatchNextStates[state]; -+ } -+ else -+ state = p->opt[posPrev].state; -+ state = kLiteralNextStates[state]; -+ } -+ else -+ state = p->opt[posPrev].state; -+ if (posPrev == cur - 1) -+ { -+ if (IsShortRep(curOpt)) -+ state = kShortRepNextStates[state]; -+ else -+ state = kLiteralNextStates[state]; -+ } -+ else -+ { -+ UInt32 pos; -+ const COptimal *prevOpt; -+ if (curOpt->prev1IsChar && curOpt->prev2) -+ { -+ posPrev = curOpt->posPrev2; -+ pos = curOpt->backPrev2; -+ state = kRepNextStates[state]; -+ } -+ else -+ { -+ pos = curOpt->backPrev; -+ if (pos < LZMA_NUM_REPS) -+ state = kRepNextStates[state]; -+ else -+ state = kMatchNextStates[state]; -+ } -+ prevOpt = &p->opt[posPrev]; -+ if (pos < LZMA_NUM_REPS) -+ { -+ UInt32 i; -+ reps[0] = prevOpt->backs[pos]; -+ for (i = 1; i <= pos; i++) -+ reps[i] = prevOpt->backs[i - 1]; -+ for (; i < LZMA_NUM_REPS; i++) -+ reps[i] = prevOpt->backs[i]; -+ } -+ else -+ { -+ UInt32 i; -+ reps[0] = (pos - LZMA_NUM_REPS); -+ for (i = 1; i < LZMA_NUM_REPS; i++) -+ reps[i] = prevOpt->backs[i - 1]; -+ } -+ } -+ curOpt->state = (CState)state; -+ -+ curOpt->backs[0] = reps[0]; -+ curOpt->backs[1] = reps[1]; -+ curOpt->backs[2] = reps[2]; -+ curOpt->backs[3] = reps[3]; -+ -+ curPrice = curOpt->price; -+ nextIsChar = False; -+ data = p->matchFinder.GetPointerToCurrentPos(p->matchFinderObj) - 1; -+ curByte = *data; -+ matchByte = *(data - (reps[0] + 1)); -+ -+ posState = (position & p->pbMask); -+ -+ curAnd1Price = curPrice + GET_PRICE_0(p->isMatch[state][posState]); -+ { -+ const CLzmaProb *probs = LIT_PROBS(position, *(data - 1)); -+ curAnd1Price += -+ (!IsCharState(state) ? -+ LitEnc_GetPriceMatched(probs, curByte, matchByte, p->ProbPrices) : -+ LitEnc_GetPrice(probs, curByte, p->ProbPrices)); -+ } -+ -+ nextOpt = &p->opt[cur + 1]; -+ -+ if (curAnd1Price < nextOpt->price) -+ { -+ nextOpt->price = curAnd1Price; -+ nextOpt->posPrev = cur; -+ MakeAsChar(nextOpt); -+ nextIsChar = True; -+ } -+ -+ matchPrice = curPrice + GET_PRICE_1(p->isMatch[state][posState]); -+ repMatchPrice = matchPrice + GET_PRICE_1(p->isRep[state]); -+ -+ if (matchByte == curByte && !(nextOpt->posPrev < cur && nextOpt->backPrev == 0)) -+ { -+ UInt32 shortRepPrice = repMatchPrice + GetRepLen1Price(p, state, posState); -+ if (shortRepPrice <= nextOpt->price) -+ { -+ nextOpt->price = shortRepPrice; -+ nextOpt->posPrev = cur; -+ MakeAsShortRep(nextOpt); -+ nextIsChar = True; -+ } -+ } -+ numAvailFull = p->numAvail; -+ { -+ UInt32 temp = kNumOpts - 1 - cur; -+ if (temp < numAvailFull) -+ numAvailFull = temp; -+ } -+ -+ if (numAvailFull < 2) -+ continue; -+ numAvail = (numAvailFull <= p->numFastBytes ? numAvailFull : p->numFastBytes); -+ -+ if (!nextIsChar && matchByte != curByte) /* speed optimization */ -+ { -+ /* try Literal + rep0 */ -+ UInt32 temp; -+ UInt32 lenTest2; -+ const Byte *data2 = data - (reps[0] + 1); -+ UInt32 limit = p->numFastBytes + 1; -+ if (limit > numAvailFull) -+ limit = numAvailFull; -+ -+ for (temp = 1; temp < limit && data[temp] == data2[temp]; temp++); -+ lenTest2 = temp - 1; -+ if (lenTest2 >= 2) -+ { -+ UInt32 state2 = kLiteralNextStates[state]; -+ UInt32 posStateNext = (position + 1) & p->pbMask; -+ UInt32 nextRepMatchPrice = curAnd1Price + -+ GET_PRICE_1(p->isMatch[state2][posStateNext]) + -+ GET_PRICE_1(p->isRep[state2]); -+ /* for (; lenTest2 >= 2; lenTest2--) */ -+ { -+ UInt32 curAndLenPrice; -+ COptimal *opt; -+ UInt32 offset = cur + 1 + lenTest2; -+ while (lenEnd < offset) -+ p->opt[++lenEnd].price = kInfinityPrice; -+ curAndLenPrice = nextRepMatchPrice + GetRepPrice(p, 0, lenTest2, state2, posStateNext); -+ opt = &p->opt[offset]; -+ if (curAndLenPrice < opt->price) -+ { -+ opt->price = curAndLenPrice; -+ opt->posPrev = cur + 1; -+ opt->backPrev = 0; -+ opt->prev1IsChar = True; -+ opt->prev2 = False; -+ } -+ } -+ } -+ } -+ -+ startLen = 2; /* speed optimization */ -+ { -+ UInt32 repIndex; -+ for (repIndex = 0; repIndex < LZMA_NUM_REPS; repIndex++) -+ { -+ UInt32 lenTest; -+ UInt32 lenTestTemp; -+ UInt32 price; -+ const Byte *data2 = data - (reps[repIndex] + 1); -+ if (data[0] != data2[0] || data[1] != data2[1]) -+ continue; -+ for (lenTest = 2; lenTest < numAvail && data[lenTest] == data2[lenTest]; lenTest++); -+ while (lenEnd < cur + lenTest) -+ p->opt[++lenEnd].price = kInfinityPrice; -+ lenTestTemp = lenTest; -+ price = repMatchPrice + GetPureRepPrice(p, repIndex, state, posState); -+ do -+ { -+ UInt32 curAndLenPrice = price + p->repLenEnc.prices[posState][lenTest - 2]; -+ COptimal *opt = &p->opt[cur + lenTest]; -+ if (curAndLenPrice < opt->price) -+ { -+ opt->price = curAndLenPrice; -+ opt->posPrev = cur; -+ opt->backPrev = repIndex; -+ opt->prev1IsChar = False; -+ } -+ } -+ while (--lenTest >= 2); -+ lenTest = lenTestTemp; -+ -+ if (repIndex == 0) -+ startLen = lenTest + 1; -+ -+ /* if (_maxMode) */ -+ { -+ UInt32 lenTest2 = lenTest + 1; -+ UInt32 limit = lenTest2 + p->numFastBytes; -+ UInt32 nextRepMatchPrice; -+ if (limit > numAvailFull) -+ limit = numAvailFull; -+ for (; lenTest2 < limit && data[lenTest2] == data2[lenTest2]; lenTest2++); -+ lenTest2 -= lenTest + 1; -+ if (lenTest2 >= 2) -+ { -+ UInt32 state2 = kRepNextStates[state]; -+ UInt32 posStateNext = (position + lenTest) & p->pbMask; -+ UInt32 curAndLenCharPrice = -+ price + p->repLenEnc.prices[posState][lenTest - 2] + -+ GET_PRICE_0(p->isMatch[state2][posStateNext]) + -+ LitEnc_GetPriceMatched(LIT_PROBS(position + lenTest, data[lenTest - 1]), -+ data[lenTest], data2[lenTest], p->ProbPrices); -+ state2 = kLiteralNextStates[state2]; -+ posStateNext = (position + lenTest + 1) & p->pbMask; -+ nextRepMatchPrice = curAndLenCharPrice + -+ GET_PRICE_1(p->isMatch[state2][posStateNext]) + -+ GET_PRICE_1(p->isRep[state2]); -+ -+ /* for (; lenTest2 >= 2; lenTest2--) */ -+ { -+ UInt32 curAndLenPrice; -+ COptimal *opt; -+ UInt32 offset = cur + lenTest + 1 + lenTest2; -+ while (lenEnd < offset) -+ p->opt[++lenEnd].price = kInfinityPrice; -+ curAndLenPrice = nextRepMatchPrice + GetRepPrice(p, 0, lenTest2, state2, posStateNext); -+ opt = &p->opt[offset]; -+ if (curAndLenPrice < opt->price) -+ { -+ opt->price = curAndLenPrice; -+ opt->posPrev = cur + lenTest + 1; -+ opt->backPrev = 0; -+ opt->prev1IsChar = True; -+ opt->prev2 = True; -+ opt->posPrev2 = cur; -+ opt->backPrev2 = repIndex; -+ } -+ } -+ } -+ } -+ } -+ } -+ /* for (UInt32 lenTest = 2; lenTest <= newLen; lenTest++) */ -+ if (newLen > numAvail) -+ { -+ newLen = numAvail; -+ for (numPairs = 0; newLen > matches[numPairs]; numPairs += 2); -+ matches[numPairs] = newLen; -+ numPairs += 2; -+ } -+ if (newLen >= startLen) -+ { -+ UInt32 normalMatchPrice = matchPrice + GET_PRICE_0(p->isRep[state]); -+ UInt32 offs, curBack, posSlot; -+ UInt32 lenTest; -+ while (lenEnd < cur + newLen) -+ p->opt[++lenEnd].price = kInfinityPrice; -+ -+ offs = 0; -+ while (startLen > matches[offs]) -+ offs += 2; -+ curBack = matches[offs + 1]; -+ GetPosSlot2(curBack, posSlot); -+ for (lenTest = /*2*/ startLen; ; lenTest++) -+ { -+ UInt32 curAndLenPrice = normalMatchPrice + p->lenEnc.prices[posState][lenTest - LZMA_MATCH_LEN_MIN]; -+ UInt32 lenToPosState = GetLenToPosState(lenTest); -+ COptimal *opt; -+ if (curBack < kNumFullDistances) -+ curAndLenPrice += p->distancesPrices[lenToPosState][curBack]; -+ else -+ curAndLenPrice += p->posSlotPrices[lenToPosState][posSlot] + p->alignPrices[curBack & kAlignMask]; -+ -+ opt = &p->opt[cur + lenTest]; -+ if (curAndLenPrice < opt->price) -+ { -+ opt->price = curAndLenPrice; -+ opt->posPrev = cur; -+ opt->backPrev = curBack + LZMA_NUM_REPS; -+ opt->prev1IsChar = False; -+ } -+ -+ if (/*_maxMode && */lenTest == matches[offs]) -+ { -+ /* Try Match + Literal + Rep0 */ -+ const Byte *data2 = data - (curBack + 1); -+ UInt32 lenTest2 = lenTest + 1; -+ UInt32 limit = lenTest2 + p->numFastBytes; -+ UInt32 nextRepMatchPrice; -+ if (limit > numAvailFull) -+ limit = numAvailFull; -+ for (; lenTest2 < limit && data[lenTest2] == data2[lenTest2]; lenTest2++); -+ lenTest2 -= lenTest + 1; -+ if (lenTest2 >= 2) -+ { -+ UInt32 state2 = kMatchNextStates[state]; -+ UInt32 posStateNext = (position + lenTest) & p->pbMask; -+ UInt32 curAndLenCharPrice = curAndLenPrice + -+ GET_PRICE_0(p->isMatch[state2][posStateNext]) + -+ LitEnc_GetPriceMatched(LIT_PROBS(position + lenTest, data[lenTest - 1]), -+ data[lenTest], data2[lenTest], p->ProbPrices); -+ state2 = kLiteralNextStates[state2]; -+ posStateNext = (posStateNext + 1) & p->pbMask; -+ nextRepMatchPrice = curAndLenCharPrice + -+ GET_PRICE_1(p->isMatch[state2][posStateNext]) + -+ GET_PRICE_1(p->isRep[state2]); -+ -+ /* for (; lenTest2 >= 2; lenTest2--) */ -+ { -+ UInt32 offset = cur + lenTest + 1 + lenTest2; -+ UInt32 curAndLenPrice; -+ COptimal *opt; -+ while (lenEnd < offset) -+ p->opt[++lenEnd].price = kInfinityPrice; -+ curAndLenPrice = nextRepMatchPrice + GetRepPrice(p, 0, lenTest2, state2, posStateNext); -+ opt = &p->opt[offset]; -+ if (curAndLenPrice < opt->price) -+ { -+ opt->price = curAndLenPrice; -+ opt->posPrev = cur + lenTest + 1; -+ opt->backPrev = 0; -+ opt->prev1IsChar = True; -+ opt->prev2 = True; -+ opt->posPrev2 = cur; -+ opt->backPrev2 = curBack + LZMA_NUM_REPS; -+ } -+ } -+ } -+ offs += 2; -+ if (offs == numPairs) -+ break; -+ curBack = matches[offs + 1]; -+ if (curBack >= kNumFullDistances) -+ GetPosSlot2(curBack, posSlot); -+ } -+ } -+ } -+ } -+} -+ -+#define ChangePair(smallDist, bigDist) (((bigDist) >> 7) > (smallDist)) -+ -+static UInt32 GetOptimumFast(CLzmaEnc *p, UInt32 *backRes) -+{ -+ UInt32 numAvail, mainLen, mainDist, numPairs, repIndex, repLen, i; -+ const Byte *data; -+ const UInt32 *matches; -+ -+ if (p->additionalOffset == 0) -+ mainLen = ReadMatchDistances(p, &numPairs); -+ else -+ { -+ mainLen = p->longestMatchLength; -+ numPairs = p->numPairs; -+ } -+ -+ numAvail = p->numAvail; -+ *backRes = (UInt32)-1; -+ if (numAvail < 2) -+ return 1; -+ if (numAvail > LZMA_MATCH_LEN_MAX) -+ numAvail = LZMA_MATCH_LEN_MAX; -+ data = p->matchFinder.GetPointerToCurrentPos(p->matchFinderObj) - 1; -+ -+ repLen = repIndex = 0; -+ for (i = 0; i < LZMA_NUM_REPS; i++) -+ { -+ UInt32 len; -+ const Byte *data2 = data - (p->reps[i] + 1); -+ if (data[0] != data2[0] || data[1] != data2[1]) -+ continue; -+ for (len = 2; len < numAvail && data[len] == data2[len]; len++); -+ if (len >= p->numFastBytes) -+ { -+ *backRes = i; -+ MovePos(p, len - 1); -+ return len; -+ } -+ if (len > repLen) -+ { -+ repIndex = i; -+ repLen = len; -+ } -+ } -+ -+ matches = p->matches; -+ if (mainLen >= p->numFastBytes) -+ { -+ *backRes = matches[numPairs - 1] + LZMA_NUM_REPS; -+ MovePos(p, mainLen - 1); -+ return mainLen; -+ } -+ -+ mainDist = 0; /* for GCC */ -+ if (mainLen >= 2) -+ { -+ mainDist = matches[numPairs - 1]; -+ while (numPairs > 2 && mainLen == matches[numPairs - 4] + 1) -+ { -+ if (!ChangePair(matches[numPairs - 3], mainDist)) -+ break; -+ numPairs -= 2; -+ mainLen = matches[numPairs - 2]; -+ mainDist = matches[numPairs - 1]; -+ } -+ if (mainLen == 2 && mainDist >= 0x80) -+ mainLen = 1; -+ } -+ -+ if (repLen >= 2 && ( -+ (repLen + 1 >= mainLen) || -+ (repLen + 2 >= mainLen && mainDist >= (1 << 9)) || -+ (repLen + 3 >= mainLen && mainDist >= (1 << 15)))) -+ { -+ *backRes = repIndex; -+ MovePos(p, repLen - 1); -+ return repLen; -+ } -+ -+ if (mainLen < 2 || numAvail <= 2) -+ return 1; -+ -+ p->longestMatchLength = ReadMatchDistances(p, &p->numPairs); -+ if (p->longestMatchLength >= 2) -+ { -+ UInt32 newDistance = matches[p->numPairs - 1]; -+ if ((p->longestMatchLength >= mainLen && newDistance < mainDist) || -+ (p->longestMatchLength == mainLen + 1 && !ChangePair(mainDist, newDistance)) || -+ (p->longestMatchLength > mainLen + 1) || -+ (p->longestMatchLength + 1 >= mainLen && mainLen >= 3 && ChangePair(newDistance, mainDist))) -+ return 1; -+ } -+ -+ data = p->matchFinder.GetPointerToCurrentPos(p->matchFinderObj) - 1; -+ for (i = 0; i < LZMA_NUM_REPS; i++) -+ { -+ UInt32 len, limit; -+ const Byte *data2 = data - (p->reps[i] + 1); -+ if (data[0] != data2[0] || data[1] != data2[1]) -+ continue; -+ limit = mainLen - 1; -+ for (len = 2; len < limit && data[len] == data2[len]; len++); -+ if (len >= limit) -+ return 1; -+ } -+ *backRes = mainDist + LZMA_NUM_REPS; -+ MovePos(p, mainLen - 2); -+ return mainLen; -+} -+ -+static void WriteEndMarker(CLzmaEnc *p, UInt32 posState) -+{ -+ UInt32 len; -+ RangeEnc_EncodeBit(&p->rc, &p->isMatch[p->state][posState], 1); -+ RangeEnc_EncodeBit(&p->rc, &p->isRep[p->state], 0); -+ p->state = kMatchNextStates[p->state]; -+ len = LZMA_MATCH_LEN_MIN; -+ LenEnc_Encode2(&p->lenEnc, &p->rc, len - LZMA_MATCH_LEN_MIN, posState, !p->fastMode, p->ProbPrices); -+ RcTree_Encode(&p->rc, p->posSlotEncoder[GetLenToPosState(len)], kNumPosSlotBits, (1 << kNumPosSlotBits) - 1); -+ RangeEnc_EncodeDirectBits(&p->rc, (((UInt32)1 << 30) - 1) >> kNumAlignBits, 30 - kNumAlignBits); -+ RcTree_ReverseEncode(&p->rc, p->posAlignEncoder, kNumAlignBits, kAlignMask); -+} -+ -+static SRes CheckErrors(CLzmaEnc *p) -+{ -+ if (p->result != SZ_OK) -+ return p->result; -+ if (p->rc.res != SZ_OK) -+ p->result = SZ_ERROR_WRITE; -+ if (p->matchFinderBase.result != SZ_OK) -+ p->result = SZ_ERROR_READ; -+ if (p->result != SZ_OK) -+ p->finished = True; -+ return p->result; -+} -+ -+static SRes Flush(CLzmaEnc *p, UInt32 nowPos) -+{ -+ /* ReleaseMFStream(); */ -+ p->finished = True; -+ if (p->writeEndMark) -+ WriteEndMarker(p, nowPos & p->pbMask); -+ RangeEnc_FlushData(&p->rc); -+ RangeEnc_FlushStream(&p->rc); -+ return CheckErrors(p); -+} -+ -+static void FillAlignPrices(CLzmaEnc *p) -+{ -+ UInt32 i; -+ for (i = 0; i < kAlignTableSize; i++) -+ p->alignPrices[i] = RcTree_ReverseGetPrice(p->posAlignEncoder, kNumAlignBits, i, p->ProbPrices); -+ p->alignPriceCount = 0; -+} -+ -+static void FillDistancesPrices(CLzmaEnc *p) -+{ -+ UInt32 tempPrices[kNumFullDistances]; -+ UInt32 i, lenToPosState; -+ for (i = kStartPosModelIndex; i < kNumFullDistances; i++) -+ { -+ UInt32 posSlot = GetPosSlot1(i); -+ UInt32 footerBits = ((posSlot >> 1) - 1); -+ UInt32 base = ((2 | (posSlot & 1)) << footerBits); -+ tempPrices[i] = RcTree_ReverseGetPrice(p->posEncoders + base - posSlot - 1, footerBits, i - base, p->ProbPrices); -+ } -+ -+ for (lenToPosState = 0; lenToPosState < kNumLenToPosStates; lenToPosState++) -+ { -+ UInt32 posSlot; -+ const CLzmaProb *encoder = p->posSlotEncoder[lenToPosState]; -+ UInt32 *posSlotPrices = p->posSlotPrices[lenToPosState]; -+ for (posSlot = 0; posSlot < p->distTableSize; posSlot++) -+ posSlotPrices[posSlot] = RcTree_GetPrice(encoder, kNumPosSlotBits, posSlot, p->ProbPrices); -+ for (posSlot = kEndPosModelIndex; posSlot < p->distTableSize; posSlot++) -+ posSlotPrices[posSlot] += ((((posSlot >> 1) - 1) - kNumAlignBits) << kNumBitPriceShiftBits); -+ -+ { -+ UInt32 *distancesPrices = p->distancesPrices[lenToPosState]; -+ UInt32 i; -+ for (i = 0; i < kStartPosModelIndex; i++) -+ distancesPrices[i] = posSlotPrices[i]; -+ for (; i < kNumFullDistances; i++) -+ distancesPrices[i] = posSlotPrices[GetPosSlot1(i)] + tempPrices[i]; -+ } -+ } -+ p->matchPriceCount = 0; -+} -+ -+void LzmaEnc_Construct(CLzmaEnc *p) -+{ -+ RangeEnc_Construct(&p->rc); -+ MatchFinder_Construct(&p->matchFinderBase); -+ #ifndef _7ZIP_ST -+ MatchFinderMt_Construct(&p->matchFinderMt); -+ p->matchFinderMt.MatchFinder = &p->matchFinderBase; -+ #endif -+ -+ { -+ CLzmaEncProps props; -+ LzmaEncProps_Init(&props); -+ LzmaEnc_SetProps(p, &props); -+ } -+ -+ #ifndef LZMA_LOG_BSR -+ LzmaEnc_FastPosInit(p->g_FastPos); -+ #endif -+ -+ LzmaEnc_InitPriceTables(p->ProbPrices); -+ p->litProbs = 0; -+ p->saveState.litProbs = 0; -+} -+ -+CLzmaEncHandle LzmaEnc_Create(ISzAlloc *alloc) -+{ -+ void *p; -+ p = alloc->Alloc(alloc, sizeof(CLzmaEnc)); -+ if (p != 0) -+ LzmaEnc_Construct((CLzmaEnc *)p); -+ return p; -+} -+ -+void LzmaEnc_FreeLits(CLzmaEnc *p, ISzAlloc *alloc) -+{ -+ alloc->Free(alloc, p->litProbs); -+ alloc->Free(alloc, p->saveState.litProbs); -+ p->litProbs = 0; -+ p->saveState.litProbs = 0; -+} -+ -+void LzmaEnc_Destruct(CLzmaEnc *p, ISzAlloc *alloc, ISzAlloc *allocBig) -+{ -+ #ifndef _7ZIP_ST -+ MatchFinderMt_Destruct(&p->matchFinderMt, allocBig); -+ #endif -+ MatchFinder_Free(&p->matchFinderBase, allocBig); -+ LzmaEnc_FreeLits(p, alloc); -+ RangeEnc_Free(&p->rc, alloc); -+} -+ -+void LzmaEnc_Destroy(CLzmaEncHandle p, ISzAlloc *alloc, ISzAlloc *allocBig) -+{ -+ LzmaEnc_Destruct((CLzmaEnc *)p, alloc, allocBig); -+ alloc->Free(alloc, p); -+} -+ -+static SRes LzmaEnc_CodeOneBlock(CLzmaEnc *p, Bool useLimits, UInt32 maxPackSize, UInt32 maxUnpackSize) -+{ -+ UInt32 nowPos32, startPos32; -+ if (p->needInit) -+ { -+ p->matchFinder.Init(p->matchFinderObj); -+ p->needInit = 0; -+ } -+ -+ if (p->finished) -+ return p->result; -+ RINOK(CheckErrors(p)); -+ -+ nowPos32 = (UInt32)p->nowPos64; -+ startPos32 = nowPos32; -+ -+ if (p->nowPos64 == 0) -+ { -+ UInt32 numPairs; -+ Byte curByte; -+ if (p->matchFinder.GetNumAvailableBytes(p->matchFinderObj) == 0) -+ return Flush(p, nowPos32); -+ ReadMatchDistances(p, &numPairs); -+ RangeEnc_EncodeBit(&p->rc, &p->isMatch[p->state][0], 0); -+ p->state = kLiteralNextStates[p->state]; -+ curByte = p->matchFinder.GetIndexByte(p->matchFinderObj, 0 - p->additionalOffset); -+ LitEnc_Encode(&p->rc, p->litProbs, curByte); -+ p->additionalOffset--; -+ nowPos32++; -+ } -+ -+ if (p->matchFinder.GetNumAvailableBytes(p->matchFinderObj) != 0) -+ for (;;) -+ { -+ UInt32 pos, len, posState; -+ -+ if (p->fastMode) -+ len = GetOptimumFast(p, &pos); -+ else -+ len = GetOptimum(p, nowPos32, &pos); -+ -+ #ifdef SHOW_STAT2 -+ printf("\n pos = %4X, len = %d pos = %d", nowPos32, len, pos); -+ #endif -+ -+ posState = nowPos32 & p->pbMask; -+ if (len == 1 && pos == (UInt32)-1) -+ { -+ Byte curByte; -+ CLzmaProb *probs; -+ const Byte *data; -+ -+ RangeEnc_EncodeBit(&p->rc, &p->isMatch[p->state][posState], 0); -+ data = p->matchFinder.GetPointerToCurrentPos(p->matchFinderObj) - p->additionalOffset; -+ curByte = *data; -+ probs = LIT_PROBS(nowPos32, *(data - 1)); -+ if (IsCharState(p->state)) -+ LitEnc_Encode(&p->rc, probs, curByte); -+ else -+ LitEnc_EncodeMatched(&p->rc, probs, curByte, *(data - p->reps[0] - 1)); -+ p->state = kLiteralNextStates[p->state]; -+ } -+ else -+ { -+ RangeEnc_EncodeBit(&p->rc, &p->isMatch[p->state][posState], 1); -+ if (pos < LZMA_NUM_REPS) -+ { -+ RangeEnc_EncodeBit(&p->rc, &p->isRep[p->state], 1); -+ if (pos == 0) -+ { -+ RangeEnc_EncodeBit(&p->rc, &p->isRepG0[p->state], 0); -+ RangeEnc_EncodeBit(&p->rc, &p->isRep0Long[p->state][posState], ((len == 1) ? 0 : 1)); -+ } -+ else -+ { -+ UInt32 distance = p->reps[pos]; -+ RangeEnc_EncodeBit(&p->rc, &p->isRepG0[p->state], 1); -+ if (pos == 1) -+ RangeEnc_EncodeBit(&p->rc, &p->isRepG1[p->state], 0); -+ else -+ { -+ RangeEnc_EncodeBit(&p->rc, &p->isRepG1[p->state], 1); -+ RangeEnc_EncodeBit(&p->rc, &p->isRepG2[p->state], pos - 2); -+ if (pos == 3) -+ p->reps[3] = p->reps[2]; -+ p->reps[2] = p->reps[1]; -+ } -+ p->reps[1] = p->reps[0]; -+ p->reps[0] = distance; -+ } -+ if (len == 1) -+ p->state = kShortRepNextStates[p->state]; -+ else -+ { -+ LenEnc_Encode2(&p->repLenEnc, &p->rc, len - LZMA_MATCH_LEN_MIN, posState, !p->fastMode, p->ProbPrices); -+ p->state = kRepNextStates[p->state]; -+ } -+ } -+ else -+ { -+ UInt32 posSlot; -+ RangeEnc_EncodeBit(&p->rc, &p->isRep[p->state], 0); -+ p->state = kMatchNextStates[p->state]; -+ LenEnc_Encode2(&p->lenEnc, &p->rc, len - LZMA_MATCH_LEN_MIN, posState, !p->fastMode, p->ProbPrices); -+ pos -= LZMA_NUM_REPS; -+ GetPosSlot(pos, posSlot); -+ RcTree_Encode(&p->rc, p->posSlotEncoder[GetLenToPosState(len)], kNumPosSlotBits, posSlot); -+ -+ if (posSlot >= kStartPosModelIndex) -+ { -+ UInt32 footerBits = ((posSlot >> 1) - 1); -+ UInt32 base = ((2 | (posSlot & 1)) << footerBits); -+ UInt32 posReduced = pos - base; -+ -+ if (posSlot < kEndPosModelIndex) -+ RcTree_ReverseEncode(&p->rc, p->posEncoders + base - posSlot - 1, footerBits, posReduced); -+ else -+ { -+ RangeEnc_EncodeDirectBits(&p->rc, posReduced >> kNumAlignBits, footerBits - kNumAlignBits); -+ RcTree_ReverseEncode(&p->rc, p->posAlignEncoder, kNumAlignBits, posReduced & kAlignMask); -+ p->alignPriceCount++; -+ } -+ } -+ p->reps[3] = p->reps[2]; -+ p->reps[2] = p->reps[1]; -+ p->reps[1] = p->reps[0]; -+ p->reps[0] = pos; -+ p->matchPriceCount++; -+ } -+ } -+ p->additionalOffset -= len; -+ nowPos32 += len; -+ if (p->additionalOffset == 0) -+ { -+ UInt32 processed; -+ if (!p->fastMode) -+ { -+ if (p->matchPriceCount >= (1 << 7)) -+ FillDistancesPrices(p); -+ if (p->alignPriceCount >= kAlignTableSize) -+ FillAlignPrices(p); -+ } -+ if (p->matchFinder.GetNumAvailableBytes(p->matchFinderObj) == 0) -+ break; -+ processed = nowPos32 - startPos32; -+ if (useLimits) -+ { -+ if (processed + kNumOpts + 300 >= maxUnpackSize || -+ RangeEnc_GetProcessed(&p->rc) + kNumOpts * 2 >= maxPackSize) -+ break; -+ } -+ else if (processed >= (1 << 15)) -+ { -+ p->nowPos64 += nowPos32 - startPos32; -+ return CheckErrors(p); -+ } -+ } -+ } -+ p->nowPos64 += nowPos32 - startPos32; -+ return Flush(p, nowPos32); -+} -+ -+#define kBigHashDicLimit ((UInt32)1 << 24) -+ -+static SRes LzmaEnc_Alloc(CLzmaEnc *p, UInt32 keepWindowSize, ISzAlloc *alloc, ISzAlloc *allocBig) -+{ -+ UInt32 beforeSize = kNumOpts; -+ Bool btMode; -+ if (!RangeEnc_Alloc(&p->rc, alloc)) -+ return SZ_ERROR_MEM; -+ btMode = (p->matchFinderBase.btMode != 0); -+ #ifndef _7ZIP_ST -+ p->mtMode = (p->multiThread && !p->fastMode && btMode); -+ #endif -+ -+ { -+ unsigned lclp = p->lc + p->lp; -+ if (p->litProbs == 0 || p->saveState.litProbs == 0 || p->lclp != lclp) -+ { -+ LzmaEnc_FreeLits(p, alloc); -+ p->litProbs = (CLzmaProb *)alloc->Alloc(alloc, (0x300 << lclp) * sizeof(CLzmaProb)); -+ p->saveState.litProbs = (CLzmaProb *)alloc->Alloc(alloc, (0x300 << lclp) * sizeof(CLzmaProb)); -+ if (p->litProbs == 0 || p->saveState.litProbs == 0) -+ { -+ LzmaEnc_FreeLits(p, alloc); -+ return SZ_ERROR_MEM; -+ } -+ p->lclp = lclp; -+ } -+ } -+ -+ p->matchFinderBase.bigHash = (p->dictSize > kBigHashDicLimit); -+ -+ if (beforeSize + p->dictSize < keepWindowSize) -+ beforeSize = keepWindowSize - p->dictSize; -+ -+ #ifndef _7ZIP_ST -+ if (p->mtMode) -+ { -+ RINOK(MatchFinderMt_Create(&p->matchFinderMt, p->dictSize, beforeSize, p->numFastBytes, LZMA_MATCH_LEN_MAX, allocBig)); -+ p->matchFinderObj = &p->matchFinderMt; -+ MatchFinderMt_CreateVTable(&p->matchFinderMt, &p->matchFinder); -+ } -+ else -+ #endif -+ { -+ if (!MatchFinder_Create(&p->matchFinderBase, p->dictSize, beforeSize, p->numFastBytes, LZMA_MATCH_LEN_MAX, allocBig)) -+ return SZ_ERROR_MEM; -+ p->matchFinderObj = &p->matchFinderBase; -+ MatchFinder_CreateVTable(&p->matchFinderBase, &p->matchFinder); -+ } -+ return SZ_OK; -+} -+ -+void LzmaEnc_Init(CLzmaEnc *p) -+{ -+ UInt32 i; -+ p->state = 0; -+ for (i = 0 ; i < LZMA_NUM_REPS; i++) -+ p->reps[i] = 0; -+ -+ RangeEnc_Init(&p->rc); -+ -+ -+ for (i = 0; i < kNumStates; i++) -+ { -+ UInt32 j; -+ for (j = 0; j < LZMA_NUM_PB_STATES_MAX; j++) -+ { -+ p->isMatch[i][j] = kProbInitValue; -+ p->isRep0Long[i][j] = kProbInitValue; -+ } -+ p->isRep[i] = kProbInitValue; -+ p->isRepG0[i] = kProbInitValue; -+ p->isRepG1[i] = kProbInitValue; -+ p->isRepG2[i] = kProbInitValue; -+ } -+ -+ { -+ UInt32 num = 0x300 << (p->lp + p->lc); -+ for (i = 0; i < num; i++) -+ p->litProbs[i] = kProbInitValue; -+ } -+ -+ { -+ for (i = 0; i < kNumLenToPosStates; i++) -+ { -+ CLzmaProb *probs = p->posSlotEncoder[i]; -+ UInt32 j; -+ for (j = 0; j < (1 << kNumPosSlotBits); j++) -+ probs[j] = kProbInitValue; -+ } -+ } -+ { -+ for (i = 0; i < kNumFullDistances - kEndPosModelIndex; i++) -+ p->posEncoders[i] = kProbInitValue; -+ } -+ -+ LenEnc_Init(&p->lenEnc.p); -+ LenEnc_Init(&p->repLenEnc.p); -+ -+ for (i = 0; i < (1 << kNumAlignBits); i++) -+ p->posAlignEncoder[i] = kProbInitValue; -+ -+ p->optimumEndIndex = 0; -+ p->optimumCurrentIndex = 0; -+ p->additionalOffset = 0; -+ -+ p->pbMask = (1 << p->pb) - 1; -+ p->lpMask = (1 << p->lp) - 1; -+} -+ -+void LzmaEnc_InitPrices(CLzmaEnc *p) -+{ -+ if (!p->fastMode) -+ { -+ FillDistancesPrices(p); -+ FillAlignPrices(p); -+ } -+ -+ p->lenEnc.tableSize = -+ p->repLenEnc.tableSize = -+ p->numFastBytes + 1 - LZMA_MATCH_LEN_MIN; -+ LenPriceEnc_UpdateTables(&p->lenEnc, 1 << p->pb, p->ProbPrices); -+ LenPriceEnc_UpdateTables(&p->repLenEnc, 1 << p->pb, p->ProbPrices); -+} -+ -+static SRes LzmaEnc_AllocAndInit(CLzmaEnc *p, UInt32 keepWindowSize, ISzAlloc *alloc, ISzAlloc *allocBig) -+{ -+ UInt32 i; -+ for (i = 0; i < (UInt32)kDicLogSizeMaxCompress; i++) -+ if (p->dictSize <= ((UInt32)1 << i)) -+ break; -+ p->distTableSize = i * 2; -+ -+ p->finished = False; -+ p->result = SZ_OK; -+ RINOK(LzmaEnc_Alloc(p, keepWindowSize, alloc, allocBig)); -+ LzmaEnc_Init(p); -+ LzmaEnc_InitPrices(p); -+ p->nowPos64 = 0; -+ return SZ_OK; -+} -+ -+static SRes LzmaEnc_Prepare(CLzmaEncHandle pp, ISeqOutStream *outStream, ISeqInStream *inStream, -+ ISzAlloc *alloc, ISzAlloc *allocBig) -+{ -+ CLzmaEnc *p = (CLzmaEnc *)pp; -+ p->matchFinderBase.stream = inStream; -+ p->needInit = 1; -+ p->rc.outStream = outStream; -+ return LzmaEnc_AllocAndInit(p, 0, alloc, allocBig); -+} -+ -+SRes LzmaEnc_PrepareForLzma2(CLzmaEncHandle pp, -+ ISeqInStream *inStream, UInt32 keepWindowSize, -+ ISzAlloc *alloc, ISzAlloc *allocBig) -+{ -+ CLzmaEnc *p = (CLzmaEnc *)pp; -+ p->matchFinderBase.stream = inStream; -+ p->needInit = 1; -+ return LzmaEnc_AllocAndInit(p, keepWindowSize, alloc, allocBig); -+} -+ -+static void LzmaEnc_SetInputBuf(CLzmaEnc *p, const Byte *src, SizeT srcLen) -+{ -+ p->matchFinderBase.directInput = 1; -+ p->matchFinderBase.bufferBase = (Byte *)src; -+ p->matchFinderBase.directInputRem = srcLen; -+} -+ -+SRes LzmaEnc_MemPrepare(CLzmaEncHandle pp, const Byte *src, SizeT srcLen, -+ UInt32 keepWindowSize, ISzAlloc *alloc, ISzAlloc *allocBig) -+{ -+ CLzmaEnc *p = (CLzmaEnc *)pp; -+ LzmaEnc_SetInputBuf(p, src, srcLen); -+ p->needInit = 1; -+ -+ return LzmaEnc_AllocAndInit(p, keepWindowSize, alloc, allocBig); -+} -+ -+void LzmaEnc_Finish(CLzmaEncHandle pp) -+{ -+ #ifndef _7ZIP_ST -+ CLzmaEnc *p = (CLzmaEnc *)pp; -+ if (p->mtMode) -+ MatchFinderMt_ReleaseStream(&p->matchFinderMt); -+ #else -+ pp = pp; -+ #endif -+} -+ -+typedef struct -+{ -+ ISeqOutStream funcTable; -+ Byte *data; -+ SizeT rem; -+ Bool overflow; -+} CSeqOutStreamBuf; -+ -+static size_t MyWrite(void *pp, const void *data, size_t size) -+{ -+ CSeqOutStreamBuf *p = (CSeqOutStreamBuf *)pp; -+ if (p->rem < size) -+ { -+ size = p->rem; -+ p->overflow = True; -+ } -+ memcpy(p->data, data, size); -+ p->rem -= size; -+ p->data += size; -+ return size; -+} -+ -+ -+UInt32 LzmaEnc_GetNumAvailableBytes(CLzmaEncHandle pp) -+{ -+ const CLzmaEnc *p = (CLzmaEnc *)pp; -+ return p->matchFinder.GetNumAvailableBytes(p->matchFinderObj); -+} -+ -+const Byte *LzmaEnc_GetCurBuf(CLzmaEncHandle pp) -+{ -+ const CLzmaEnc *p = (CLzmaEnc *)pp; -+ return p->matchFinder.GetPointerToCurrentPos(p->matchFinderObj) - p->additionalOffset; -+} -+ -+SRes LzmaEnc_CodeOneMemBlock(CLzmaEncHandle pp, Bool reInit, -+ Byte *dest, size_t *destLen, UInt32 desiredPackSize, UInt32 *unpackSize) -+{ -+ CLzmaEnc *p = (CLzmaEnc *)pp; -+ UInt64 nowPos64; -+ SRes res; -+ CSeqOutStreamBuf outStream; -+ -+ outStream.funcTable.Write = MyWrite; -+ outStream.data = dest; -+ outStream.rem = *destLen; -+ outStream.overflow = False; -+ -+ p->writeEndMark = False; -+ p->finished = False; -+ p->result = SZ_OK; -+ -+ if (reInit) -+ LzmaEnc_Init(p); -+ LzmaEnc_InitPrices(p); -+ nowPos64 = p->nowPos64; -+ RangeEnc_Init(&p->rc); -+ p->rc.outStream = &outStream.funcTable; -+ -+ res = LzmaEnc_CodeOneBlock(p, True, desiredPackSize, *unpackSize); -+ -+ *unpackSize = (UInt32)(p->nowPos64 - nowPos64); -+ *destLen -= outStream.rem; -+ if (outStream.overflow) -+ return SZ_ERROR_OUTPUT_EOF; -+ -+ return res; -+} -+ -+static SRes LzmaEnc_Encode2(CLzmaEnc *p, ICompressProgress *progress) -+{ -+ SRes res = SZ_OK; -+ -+ #ifndef _7ZIP_ST -+ Byte allocaDummy[0x300]; -+ int i = 0; -+ for (i = 0; i < 16; i++) -+ allocaDummy[i] = (Byte)i; -+ #endif -+ -+ for (;;) -+ { -+ res = LzmaEnc_CodeOneBlock(p, False, 0, 0); -+ if (res != SZ_OK || p->finished != 0) -+ break; -+ if (progress != 0) -+ { -+ res = progress->Progress(progress, p->nowPos64, RangeEnc_GetProcessed(&p->rc)); -+ if (res != SZ_OK) -+ { -+ res = SZ_ERROR_PROGRESS; -+ break; -+ } -+ } -+ } -+ LzmaEnc_Finish(p); -+ return res; -+} -+ -+SRes LzmaEnc_Encode(CLzmaEncHandle pp, ISeqOutStream *outStream, ISeqInStream *inStream, ICompressProgress *progress, -+ ISzAlloc *alloc, ISzAlloc *allocBig) -+{ -+ RINOK(LzmaEnc_Prepare(pp, outStream, inStream, alloc, allocBig)); -+ return LzmaEnc_Encode2((CLzmaEnc *)pp, progress); -+} -+ -+SRes LzmaEnc_WriteProperties(CLzmaEncHandle pp, Byte *props, SizeT *size) -+{ -+ CLzmaEnc *p = (CLzmaEnc *)pp; -+ int i; -+ UInt32 dictSize = p->dictSize; -+ if (*size < LZMA_PROPS_SIZE) -+ return SZ_ERROR_PARAM; -+ *size = LZMA_PROPS_SIZE; -+ props[0] = (Byte)((p->pb * 5 + p->lp) * 9 + p->lc); -+ -+ for (i = 11; i <= 30; i++) -+ { -+ if (dictSize <= ((UInt32)2 << i)) -+ { -+ dictSize = (2 << i); -+ break; -+ } -+ if (dictSize <= ((UInt32)3 << i)) -+ { -+ dictSize = (3 << i); -+ break; -+ } -+ } -+ -+ for (i = 0; i < 4; i++) -+ props[1 + i] = (Byte)(dictSize >> (8 * i)); -+ return SZ_OK; -+} -+ -+SRes LzmaEnc_MemEncode(CLzmaEncHandle pp, Byte *dest, SizeT *destLen, const Byte *src, SizeT srcLen, -+ int writeEndMark, ICompressProgress *progress, ISzAlloc *alloc, ISzAlloc *allocBig) -+{ -+ SRes res; -+ CLzmaEnc *p = (CLzmaEnc *)pp; -+ -+ CSeqOutStreamBuf outStream; -+ -+ LzmaEnc_SetInputBuf(p, src, srcLen); -+ -+ outStream.funcTable.Write = MyWrite; -+ outStream.data = dest; -+ outStream.rem = *destLen; -+ outStream.overflow = False; -+ -+ p->writeEndMark = writeEndMark; -+ -+ p->rc.outStream = &outStream.funcTable; -+ res = LzmaEnc_MemPrepare(pp, src, srcLen, 0, alloc, allocBig); -+ if (res == SZ_OK) -+ res = LzmaEnc_Encode2(p, progress); -+ -+ *destLen -= outStream.rem; -+ if (outStream.overflow) -+ return SZ_ERROR_OUTPUT_EOF; -+ return res; -+} -+ -+SRes LzmaEncode(Byte *dest, SizeT *destLen, const Byte *src, SizeT srcLen, -+ const CLzmaEncProps *props, Byte *propsEncoded, SizeT *propsSize, int writeEndMark, -+ ICompressProgress *progress, ISzAlloc *alloc, ISzAlloc *allocBig) -+{ -+ CLzmaEnc *p = (CLzmaEnc *)LzmaEnc_Create(alloc); -+ SRes res; -+ if (p == 0) -+ return SZ_ERROR_MEM; -+ -+ res = LzmaEnc_SetProps(p, props); -+ if (res == SZ_OK) -+ { -+ res = LzmaEnc_WriteProperties(p, propsEncoded, propsSize); -+ if (res == SZ_OK) -+ res = LzmaEnc_MemEncode(p, dest, destLen, src, srcLen, -+ writeEndMark, progress, alloc, allocBig); -+ } -+ -+ LzmaEnc_Destroy(p, alloc, allocBig); -+ return res; -+} ---- /dev/null -+++ b/lib/lzma/Makefile -@@ -0,0 +1,7 @@ -+lzma_compress-objs := LzFind.o LzmaEnc.o -+lzma_decompress-objs := LzmaDec.o -+ -+obj-$(CONFIG_LZMA_COMPRESS) += lzma_compress.o -+obj-$(CONFIG_LZMA_DECOMPRESS) += lzma_decompress.o -+ -+EXTRA_CFLAGS += -Iinclude/linux -Iinclude/linux/lzma -include types.h diff --git a/target/linux/generic/pending-4.19/532-jffs2_eofdetect.patch b/target/linux/generic/pending-4.19/532-jffs2_eofdetect.patch deleted file mode 100644 index e9952c6d84..0000000000 --- a/target/linux/generic/pending-4.19/532-jffs2_eofdetect.patch +++ /dev/null @@ -1,65 +0,0 @@ -From: Felix Fietkau -Subject: fs: jffs2: EOF marker - -Signed-off-by: Felix Fietkau ---- - fs/jffs2/build.c | 10 ++++++++++ - fs/jffs2/scan.c | 21 +++++++++++++++++++-- - 2 files changed, 29 insertions(+), 2 deletions(-) - ---- a/fs/jffs2/build.c -+++ b/fs/jffs2/build.c -@@ -117,6 +117,16 @@ static int jffs2_build_filesystem(struct - dbg_fsbuild("scanned flash completely\n"); - jffs2_dbg_dump_block_lists_nolock(c); - -+ if (c->flags & (1 << 7)) { -+ printk("%s(): unlocking the mtd device... ", __func__); -+ mtd_unlock(c->mtd, 0, c->mtd->size); -+ printk("done.\n"); -+ -+ printk("%s(): erasing all blocks after the end marker... ", __func__); -+ jffs2_erase_pending_blocks(c, -1); -+ printk("done.\n"); -+ } -+ - dbg_fsbuild("pass 1 starting\n"); - c->flags |= JFFS2_SB_FLAG_BUILDING; - /* Now scan the directory tree, increasing nlink according to every dirent found. */ ---- a/fs/jffs2/scan.c -+++ b/fs/jffs2/scan.c -@@ -148,8 +148,14 @@ int jffs2_scan_medium(struct jffs2_sb_in - /* reset summary info for next eraseblock scan */ - jffs2_sum_reset_collected(s); - -- ret = jffs2_scan_eraseblock(c, jeb, buf_size?flashbuf:(flashbuf+jeb->offset), -- buf_size, s); -+ if (c->flags & (1 << 7)) { -+ if (mtd_block_isbad(c->mtd, jeb->offset)) -+ ret = BLK_STATE_BADBLOCK; -+ else -+ ret = BLK_STATE_ALLFF; -+ } else -+ ret = jffs2_scan_eraseblock(c, jeb, buf_size?flashbuf:(flashbuf+jeb->offset), -+ buf_size, s); - - if (ret < 0) - goto out; -@@ -561,6 +567,17 @@ full_scan: - return err; - } - -+ if ((buf[0] == 0xde) && -+ (buf[1] == 0xad) && -+ (buf[2] == 0xc0) && -+ (buf[3] == 0xde)) { -+ /* end of filesystem. erase everything after this point */ -+ printk("%s(): End of filesystem marker found at 0x%x\n", __func__, jeb->offset); -+ c->flags |= (1 << 7); -+ -+ return BLK_STATE_ALLFF; -+ } -+ - /* We temporarily use 'ofs' as a pointer into the buffer/jeb */ - ofs = 0; - max_ofs = EMPTY_SCAN_SIZE(c->sector_size); diff --git a/target/linux/generic/pending-4.19/551-ubifs-fix-default-compression-selection.patch b/target/linux/generic/pending-4.19/551-ubifs-fix-default-compression-selection.patch deleted file mode 100644 index 60d5619989..0000000000 --- a/target/linux/generic/pending-4.19/551-ubifs-fix-default-compression-selection.patch +++ /dev/null @@ -1,37 +0,0 @@ -From: Gabor Juhos -Subject: fs: ubifs: fix default compression selection in ubifs - -Signed-off-by: Gabor Juhos ---- - fs/ubifs/sb.c | 13 ++++++++++++- - 1 file changed, 12 insertions(+), 1 deletion(-) - ---- a/fs/ubifs/sb.c -+++ b/fs/ubifs/sb.c -@@ -63,6 +63,17 @@ - /* Default time granularity in nanoseconds */ - #define DEFAULT_TIME_GRAN 1000000000 - -+static int get_default_compressor(struct ubifs_info *c) -+{ -+ if (ubifs_compr_present(c, UBIFS_COMPR_LZO)) -+ return UBIFS_COMPR_LZO; -+ -+ if (ubifs_compr_present(c, UBIFS_COMPR_ZLIB)) -+ return UBIFS_COMPR_ZLIB; -+ -+ return UBIFS_COMPR_NONE; -+} -+ - /** - * create_default_filesystem - format empty UBI volume. - * @c: UBIFS file-system description object -@@ -186,7 +197,7 @@ static int create_default_filesystem(str - if (c->mount_opts.override_compr) - sup->default_compr = cpu_to_le16(c->mount_opts.compr_type); - else -- sup->default_compr = cpu_to_le16(UBIFS_COMPR_LZO); -+ sup->default_compr = cpu_to_le16(get_default_compressor(c)); - - generate_random_uuid(sup->uuid); - diff --git a/target/linux/generic/pending-4.19/553-ubifs-Add-option-to-create-UBI-FS-version-4-on-empty.patch b/target/linux/generic/pending-4.19/553-ubifs-Add-option-to-create-UBI-FS-version-4-on-empty.patch deleted file mode 100644 index 02c9b4c0fa..0000000000 --- a/target/linux/generic/pending-4.19/553-ubifs-Add-option-to-create-UBI-FS-version-4-on-empty.patch +++ /dev/null @@ -1,63 +0,0 @@ -From 93c33e6a7f3b0aef99d02252e6232a3d8b80f2d5 Mon Sep 17 00:00:00 2001 -From: Hauke Mehrtens -Date: Sun, 21 Jan 2018 15:47:50 +0100 -Subject: ubifs: Add option to create UBI FS version 4 on empty UBI volume - -Instead of creating an ubifs file system with format version 5 by -default on empty UBI volumes add a compile option to create an older ubi -with file system format version 4 instated. This allows it to be mount -as a volume on kernel versions < 4.10, which does not support format -version 5. -We saw that some people can not access their older data when they -downgraded from kernel 4.14 to kernel 4.9 to prevent this this option -would help. - -Signed-off-by: Hauke Mehrtens ---- - fs/ubifs/Kconfig | 13 +++++++++++++ - fs/ubifs/sb.c | 6 ++++++ - 2 files changed, 19 insertions(+) - ---- a/fs/ubifs/Kconfig -+++ b/fs/ubifs/Kconfig -@@ -85,3 +85,16 @@ config UBIFS_FS_SECURITY - the extended attribute support in advance. - - If you are not using a security module, say N. -+ -+config UBIFS_FS_FORMAT4 -+ bool "Use file system format version 4 for new file systems" -+ depends on UBIFS_FS -+ help -+ Instead of creating new file systems with the new ubifs file -+ system version 5, use the old format version 4 for implicitly -+ by the driver created file systems on an empty UBI volume. This -+ makes it possible to mount these file systems also with kernel -+ versions before 4.10. The driver will still support file system -+ format version 5 for ubifs file systems created with version 5. -+ -+ If you are unsure, say N. ---- a/fs/ubifs/sb.c -+++ b/fs/ubifs/sb.c -@@ -176,7 +176,9 @@ static int create_default_filesystem(str - tmp64 = (long long)max_buds * c->leb_size; - if (big_lpt) - sup_flags |= UBIFS_FLG_BIGLPT; -+#ifndef CONFIG_UBIFS_FS_FORMAT4 - sup_flags |= UBIFS_FLG_DOUBLE_HASH; -+#endif - - sup->ch.node_type = UBIFS_SB_NODE; - sup->key_hash = UBIFS_KEY_HASH_R5; -@@ -192,7 +194,11 @@ static int create_default_filesystem(str - sup->jhead_cnt = cpu_to_le32(DEFAULT_JHEADS_CNT); - sup->fanout = cpu_to_le32(DEFAULT_FANOUT); - sup->lsave_cnt = cpu_to_le32(c->lsave_cnt); -+#ifdef CONFIG_UBIFS_FS_FORMAT4 -+ sup->fmt_version = cpu_to_le32(4); -+#else - sup->fmt_version = cpu_to_le32(UBIFS_FORMAT_VERSION); -+#endif - sup->time_gran = cpu_to_le32(DEFAULT_TIME_GRAN); - if (c->mount_opts.override_compr) - sup->default_compr = cpu_to_le16(c->mount_opts.compr_type); diff --git a/target/linux/generic/pending-4.19/600-netfilter_conntrack_flush.patch b/target/linux/generic/pending-4.19/600-netfilter_conntrack_flush.patch deleted file mode 100644 index fa32f88e17..0000000000 --- a/target/linux/generic/pending-4.19/600-netfilter_conntrack_flush.patch +++ /dev/null @@ -1,88 +0,0 @@ -From: Felix Fietkau -Subject: netfilter: add support for flushing conntrack via /proc - -lede-commit 8193bbe59a74d34d6a26d4a8cb857b1952905314 -Signed-off-by: Felix Fietkau ---- - net/netfilter/nf_conntrack_standalone.c | 59 ++++++++++++++++++++++++++++++++- - 1 file changed, 58 insertions(+), 1 deletion(-) - ---- a/net/netfilter/nf_conntrack_standalone.c -+++ b/net/netfilter/nf_conntrack_standalone.c -@@ -9,6 +9,7 @@ - #include - #include - #include -+#include - #include - #ifdef CONFIG_SYSCTL - #include -@@ -433,6 +434,56 @@ static int ct_cpu_seq_show(struct seq_fi - return 0; - } - -+struct kill_request { -+ u16 family; -+ union nf_inet_addr addr; -+}; -+ -+static int kill_matching(struct nf_conn *i, void *data) -+{ -+ struct kill_request *kr = data; -+ struct nf_conntrack_tuple *t1 = &i->tuplehash[IP_CT_DIR_ORIGINAL].tuple; -+ struct nf_conntrack_tuple *t2 = &i->tuplehash[IP_CT_DIR_REPLY].tuple; -+ -+ if (!kr->family) -+ return 1; -+ -+ if (t1->src.l3num != kr->family) -+ return 0; -+ -+ return (nf_inet_addr_cmp(&kr->addr, &t1->src.u3) || -+ nf_inet_addr_cmp(&kr->addr, &t1->dst.u3) || -+ nf_inet_addr_cmp(&kr->addr, &t2->src.u3) || -+ nf_inet_addr_cmp(&kr->addr, &t2->dst.u3)); -+} -+ -+static int ct_file_write(struct file *file, char *buf, size_t count) -+{ -+ struct seq_file *seq = file->private_data; -+ struct net *net = seq_file_net(seq); -+ struct kill_request kr = { }; -+ -+ if (count == 0) -+ return 0; -+ -+ if (count >= INET6_ADDRSTRLEN) -+ count = INET6_ADDRSTRLEN - 1; -+ -+ if (strnchr(buf, count, ':')) { -+ kr.family = AF_INET6; -+ if (!in6_pton(buf, count, (void *)&kr.addr, '\n', NULL)) -+ return -EINVAL; -+ } else if (strnchr(buf, count, '.')) { -+ kr.family = AF_INET; -+ if (!in4_pton(buf, count, (void *)&kr.addr, '\n', NULL)) -+ return -EINVAL; -+ } -+ -+ nf_ct_iterate_cleanup_net(net, kill_matching, &kr, 0, 0); -+ -+ return 0; -+} -+ - static const struct seq_operations ct_cpu_seq_ops = { - .start = ct_cpu_seq_start, - .next = ct_cpu_seq_next, -@@ -446,8 +497,9 @@ static int nf_conntrack_standalone_init_ - kuid_t root_uid; - kgid_t root_gid; - -- pde = proc_create_net("nf_conntrack", 0440, net->proc_net, &ct_seq_ops, -- sizeof(struct ct_iter_state)); -+ pde = proc_create_net_data_write("nf_conntrack", 0440, net->proc_net, -+ &ct_seq_ops, &ct_file_write, -+ sizeof(struct ct_iter_state), NULL); - if (!pde) - goto out_nf_conntrack; - diff --git a/target/linux/generic/pending-4.19/610-netfilter_match_bypass_default_checks.patch b/target/linux/generic/pending-4.19/610-netfilter_match_bypass_default_checks.patch deleted file mode 100644 index 1691146825..0000000000 --- a/target/linux/generic/pending-4.19/610-netfilter_match_bypass_default_checks.patch +++ /dev/null @@ -1,110 +0,0 @@ -From: Felix Fietkau -Subject: kernel: add a new version of my netfilter speedup patches for linux 2.6.39 and 3.0 - -Signed-off-by: Felix Fietkau ---- - include/uapi/linux/netfilter_ipv4/ip_tables.h | 1 + - net/ipv4/netfilter/ip_tables.c | 37 +++++++++++++++++++++++++++ - 2 files changed, 38 insertions(+) - ---- a/include/uapi/linux/netfilter_ipv4/ip_tables.h -+++ b/include/uapi/linux/netfilter_ipv4/ip_tables.h -@@ -89,6 +89,7 @@ struct ipt_ip { - #define IPT_F_FRAG 0x01 /* Set if rule is a fragment rule */ - #define IPT_F_GOTO 0x02 /* Set if jump is a goto */ - #define IPT_F_MASK 0x03 /* All possible flag bits mask. */ -+#define IPT_F_NO_DEF_MATCH 0x80 /* Internal: no default match rules present */ - - /* Values for "inv" field in struct ipt_ip. */ - #define IPT_INV_VIA_IN 0x01 /* Invert the sense of IN IFACE. */ ---- a/net/ipv4/netfilter/ip_tables.c -+++ b/net/ipv4/netfilter/ip_tables.c -@@ -53,6 +53,9 @@ ip_packet_match(const struct iphdr *ip, - { - unsigned long ret; - -+ if (ipinfo->flags & IPT_F_NO_DEF_MATCH) -+ return true; -+ - if (NF_INVF(ipinfo, IPT_INV_SRCIP, - (ip->saddr & ipinfo->smsk.s_addr) != ipinfo->src.s_addr) || - NF_INVF(ipinfo, IPT_INV_DSTIP, -@@ -83,6 +86,29 @@ ip_packet_match(const struct iphdr *ip, - return true; - } - -+static void -+ip_checkdefault(struct ipt_ip *ip) -+{ -+ static const char iface_mask[IFNAMSIZ] = {}; -+ -+ if (ip->invflags || ip->flags & IPT_F_FRAG) -+ return; -+ -+ if (memcmp(ip->iniface_mask, iface_mask, IFNAMSIZ) != 0) -+ return; -+ -+ if (memcmp(ip->outiface_mask, iface_mask, IFNAMSIZ) != 0) -+ return; -+ -+ if (ip->smsk.s_addr || ip->dmsk.s_addr) -+ return; -+ -+ if (ip->proto) -+ return; -+ -+ ip->flags |= IPT_F_NO_DEF_MATCH; -+} -+ - static bool - ip_checkentry(const struct ipt_ip *ip) - { -@@ -527,6 +553,8 @@ find_check_entry(struct ipt_entry *e, st - struct xt_mtchk_param mtpar; - struct xt_entry_match *ematch; - -+ ip_checkdefault(&e->ip); -+ - if (!xt_percpu_counter_alloc(alloc_state, &e->counters)) - return -ENOMEM; - -@@ -821,6 +849,7 @@ copy_entries_to_user(unsigned int total_ - const struct xt_table_info *private = table->private; - int ret = 0; - const void *loc_cpu_entry; -+ u8 flags; - - counters = alloc_counters(table); - if (IS_ERR(counters)) -@@ -848,6 +877,14 @@ copy_entries_to_user(unsigned int total_ - goto free_counters; - } - -+ flags = e->ip.flags & IPT_F_MASK; -+ if (copy_to_user(userptr + off -+ + offsetof(struct ipt_entry, ip.flags), -+ &flags, sizeof(flags)) != 0) { -+ ret = -EFAULT; -+ goto free_counters; -+ } -+ - for (i = sizeof(struct ipt_entry); - i < e->target_offset; - i += m->u.match_size) { -@@ -1228,12 +1265,15 @@ compat_copy_entry_to_user(struct ipt_ent - compat_uint_t origsize; - const struct xt_entry_match *ematch; - int ret = 0; -+ u8 flags = e->ip.flags & IPT_F_MASK; - - origsize = *size; - ce = *dstptr; - if (copy_to_user(ce, e, sizeof(struct ipt_entry)) != 0 || - copy_to_user(&ce->counters, &counters[i], -- sizeof(counters[i])) != 0) -+ sizeof(counters[i])) != 0 || -+ copy_to_user(&ce->ip.flags, &flags, -+ sizeof(flags)) != 0) - return -EFAULT; - - *dstptr += sizeof(struct compat_ipt_entry); diff --git a/target/linux/generic/pending-4.19/611-netfilter_match_bypass_default_table.patch b/target/linux/generic/pending-4.19/611-netfilter_match_bypass_default_table.patch deleted file mode 100644 index ba976b0751..0000000000 --- a/target/linux/generic/pending-4.19/611-netfilter_match_bypass_default_table.patch +++ /dev/null @@ -1,106 +0,0 @@ -From: Felix Fietkau -Subject: netfilter: match bypass default table - -Signed-off-by: Felix Fietkau ---- - net/ipv4/netfilter/ip_tables.c | 79 +++++++++++++++++++++++++++++++----------- - 1 file changed, 58 insertions(+), 21 deletions(-) - ---- a/net/ipv4/netfilter/ip_tables.c -+++ b/net/ipv4/netfilter/ip_tables.c -@@ -249,6 +249,33 @@ struct ipt_entry *ipt_next_entry(const s - return (void *)entry + entry->next_offset; - } - -+static bool -+ipt_handle_default_rule(struct ipt_entry *e, unsigned int *verdict) -+{ -+ struct xt_entry_target *t; -+ struct xt_standard_target *st; -+ -+ if (e->target_offset != sizeof(struct ipt_entry)) -+ return false; -+ -+ if (!(e->ip.flags & IPT_F_NO_DEF_MATCH)) -+ return false; -+ -+ t = ipt_get_target(e); -+ if (t->u.kernel.target->target) -+ return false; -+ -+ st = (struct xt_standard_target *) t; -+ if (st->verdict == XT_RETURN) -+ return false; -+ -+ if (st->verdict >= 0) -+ return false; -+ -+ *verdict = (unsigned)(-st->verdict) - 1; -+ return true; -+} -+ - /* Returns one of the generic firewall policies, like NF_ACCEPT. */ - unsigned int - ipt_do_table(struct sk_buff *skb, -@@ -269,27 +296,28 @@ ipt_do_table(struct sk_buff *skb, - unsigned int addend; - - /* Initialization */ -+ WARN_ON(!(table->valid_hooks & (1 << hook))); -+ local_bh_disable(); -+ private = READ_ONCE(table->private); /* Address dependency. */ -+ cpu = smp_processor_id(); -+ table_base = private->entries; -+ -+ e = get_entry(table_base, private->hook_entry[hook]); -+ if (ipt_handle_default_rule(e, &verdict)) { -+ struct xt_counters *counter; -+ -+ counter = xt_get_this_cpu_counter(&e->counters); -+ ADD_COUNTER(*counter, skb->len, 1); -+ local_bh_enable(); -+ return verdict; -+ } -+ - stackidx = 0; - ip = ip_hdr(skb); - indev = state->in ? state->in->name : nulldevname; - outdev = state->out ? state->out->name : nulldevname; -- /* We handle fragments by dealing with the first fragment as -- * if it was a normal packet. All other fragments are treated -- * normally, except that they will NEVER match rules that ask -- * things we don't know, ie. tcp syn flag or ports). If the -- * rule is also a fragment-specific rule, non-fragments won't -- * match it. */ -- acpar.fragoff = ntohs(ip->frag_off) & IP_OFFSET; -- acpar.thoff = ip_hdrlen(skb); -- acpar.hotdrop = false; -- acpar.state = state; - -- WARN_ON(!(table->valid_hooks & (1 << hook))); -- local_bh_disable(); - addend = xt_write_recseq_begin(); -- private = READ_ONCE(table->private); /* Address dependency. */ -- cpu = smp_processor_id(); -- table_base = private->entries; - jumpstack = (struct ipt_entry **)private->jumpstack[cpu]; - - /* Switch to alternate jumpstack if we're being invoked via TEE. -@@ -302,7 +330,16 @@ ipt_do_table(struct sk_buff *skb, - if (static_key_false(&xt_tee_enabled)) - jumpstack += private->stacksize * __this_cpu_read(nf_skb_duplicated); - -- e = get_entry(table_base, private->hook_entry[hook]); -+ /* We handle fragments by dealing with the first fragment as -+ * if it was a normal packet. All other fragments are treated -+ * normally, except that they will NEVER match rules that ask -+ * things we don't know, ie. tcp syn flag or ports). If the -+ * rule is also a fragment-specific rule, non-fragments won't -+ * match it. */ -+ acpar.fragoff = ntohs(ip->frag_off) & IP_OFFSET; -+ acpar.thoff = ip_hdrlen(skb); -+ acpar.hotdrop = false; -+ acpar.state = state; - - do { - const struct xt_entry_target *t; diff --git a/target/linux/generic/pending-4.19/612-netfilter_match_reduce_memory_access.patch b/target/linux/generic/pending-4.19/612-netfilter_match_reduce_memory_access.patch deleted file mode 100644 index cd6fcf8e74..0000000000 --- a/target/linux/generic/pending-4.19/612-netfilter_match_reduce_memory_access.patch +++ /dev/null @@ -1,22 +0,0 @@ -From: Felix Fietkau -Subject: netfilter: reduce match memory access - -Signed-off-by: Felix Fietkau ---- - net/ipv4/netfilter/ip_tables.c | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - ---- a/net/ipv4/netfilter/ip_tables.c -+++ b/net/ipv4/netfilter/ip_tables.c -@@ -56,9 +56,9 @@ ip_packet_match(const struct iphdr *ip, - if (ipinfo->flags & IPT_F_NO_DEF_MATCH) - return true; - -- if (NF_INVF(ipinfo, IPT_INV_SRCIP, -+ if (NF_INVF(ipinfo, IPT_INV_SRCIP, ipinfo->smsk.s_addr && - (ip->saddr & ipinfo->smsk.s_addr) != ipinfo->src.s_addr) || -- NF_INVF(ipinfo, IPT_INV_DSTIP, -+ NF_INVF(ipinfo, IPT_INV_DSTIP, ipinfo->dmsk.s_addr && - (ip->daddr & ipinfo->dmsk.s_addr) != ipinfo->dst.s_addr)) - return false; - diff --git a/target/linux/generic/pending-4.19/613-netfilter_optional_tcp_window_check.patch b/target/linux/generic/pending-4.19/613-netfilter_optional_tcp_window_check.patch deleted file mode 100644 index f9613a1ff6..0000000000 --- a/target/linux/generic/pending-4.19/613-netfilter_optional_tcp_window_check.patch +++ /dev/null @@ -1,44 +0,0 @@ -From: Felix Fietkau -Subject: netfilter: optional tcp window check - -Signed-off-by: Felix Fietkau ---- - net/netfilter/nf_conntrack_proto_tcp.c | 13 +++++++++++++ - 1 file changed, 13 insertions(+) - ---- a/net/netfilter/nf_conntrack_proto_tcp.c -+++ b/net/netfilter/nf_conntrack_proto_tcp.c -@@ -34,6 +34,9 @@ - #include - #include - -+/* Do not check the TCP window for incoming packets */ -+static int nf_ct_tcp_no_window_check __read_mostly = 1; -+ - /* "Be conservative in what you do, - be liberal in what you accept from others." - If it's non-zero, we mark only out of window RST segments as INVALID. */ -@@ -483,6 +486,9 @@ static bool tcp_in_window(const struct n - s32 receiver_offset; - bool res, in_recv_win; - -+ if (nf_ct_tcp_no_window_check) -+ return true; -+ - /* - * Get the required data from the packet. - */ -@@ -1476,6 +1482,13 @@ static struct ctl_table tcp_sysctl_table - .mode = 0644, - .proc_handler = proc_dointvec, - }, -+ { -+ .procname = "nf_conntrack_tcp_no_window_check", -+ .data = &nf_ct_tcp_no_window_check, -+ .maxlen = sizeof(unsigned int), -+ .mode = 0644, -+ .proc_handler = proc_dointvec, -+ }, - { } - }; - #endif /* CONFIG_SYSCTL */ diff --git a/target/linux/generic/pending-4.19/616-net_optimize_xfrm_calls.patch b/target/linux/generic/pending-4.19/616-net_optimize_xfrm_calls.patch deleted file mode 100644 index 6a5801027c..0000000000 --- a/target/linux/generic/pending-4.19/616-net_optimize_xfrm_calls.patch +++ /dev/null @@ -1,20 +0,0 @@ -From: Felix Fietkau -Subject: kernel: add a small xfrm related performance optimization - -Signed-off-by: Felix Fietkau ---- - net/netfilter/nf_nat_core.c | 3 +++ - 1 file changed, 3 insertions(+) - ---- a/net/netfilter/nf_nat_core.c -+++ b/net/netfilter/nf_nat_core.c -@@ -110,6 +110,9 @@ int nf_xfrm_me_harder(struct net *net, s - struct sock *sk = skb->sk; - int err; - -+ if (skb->dev && !dev_net(skb->dev)->xfrm.policy_count[XFRM_POLICY_OUT]) -+ return 0; -+ - err = xfrm_decode_session(skb, &fl, family); - if (err < 0) - return err; diff --git a/target/linux/generic/pending-4.19/620-net_sched-codel-do-not-defer-queue-length-update.patch b/target/linux/generic/pending-4.19/620-net_sched-codel-do-not-defer-queue-length-update.patch deleted file mode 100644 index 457c812841..0000000000 --- a/target/linux/generic/pending-4.19/620-net_sched-codel-do-not-defer-queue-length-update.patch +++ /dev/null @@ -1,86 +0,0 @@ -From: Konstantin Khlebnikov -Date: Mon, 21 Aug 2017 11:14:14 +0300 -Subject: [PATCH] net_sched/codel: do not defer queue length update - -When codel wants to drop last packet in ->dequeue() it cannot call -qdisc_tree_reduce_backlog() right away - it will notify parent qdisc -about zero qlen and HTB/HFSC will deactivate class. The same class will -be deactivated second time by caller of ->dequeue(). Currently codel and -fq_codel defer update. This triggers warning in HFSC when it's qlen != 0 -but there is no active classes. - -This patch update parent queue length immediately: just temporary increase -qlen around qdisc_tree_reduce_backlog() to prevent first class deactivation -if we have skb to return. - -This might open another problem in HFSC - now operation peek could fail and -deactivate parent class. - -Signed-off-by: Konstantin Khlebnikov -Link: https://bugzilla.kernel.org/show_bug.cgi?id=109581 ---- - ---- a/net/sched/sch_codel.c -+++ b/net/sched/sch_codel.c -@@ -95,11 +95,17 @@ static struct sk_buff *codel_qdisc_deque - &q->stats, qdisc_pkt_len, codel_get_enqueue_time, - drop_func, dequeue_func); - -- /* We cant call qdisc_tree_reduce_backlog() if our qlen is 0, -- * or HTB crashes. Defer it for next round. -+ /* If our qlen is 0 qdisc_tree_reduce_backlog() will deactivate -+ * parent class, dequeue in parent qdisc will do the same if we -+ * return skb. Temporary increment qlen if we have skb. - */ -- if (q->stats.drop_count && sch->q.qlen) { -- qdisc_tree_reduce_backlog(sch, q->stats.drop_count, q->stats.drop_len); -+ if (q->stats.drop_count) { -+ if (skb) -+ sch->q.qlen++; -+ qdisc_tree_reduce_backlog(sch, q->stats.drop_count, -+ q->stats.drop_len); -+ if (skb) -+ sch->q.qlen--; - q->stats.drop_count = 0; - q->stats.drop_len = 0; - } ---- a/net/sched/sch_fq_codel.c -+++ b/net/sched/sch_fq_codel.c -@@ -317,6 +317,21 @@ begin: - flow->dropped += q->cstats.drop_count - prev_drop_count; - flow->dropped += q->cstats.ecn_mark - prev_ecn_mark; - -+ /* If our qlen is 0 qdisc_tree_reduce_backlog() will deactivate -+ * parent class, dequeue in parent qdisc will do the same if we -+ * return skb. Temporary increment qlen if we have skb. -+ */ -+ if (q->cstats.drop_count) { -+ if (skb) -+ sch->q.qlen++; -+ qdisc_tree_reduce_backlog(sch, q->cstats.drop_count, -+ q->cstats.drop_len); -+ if (skb) -+ sch->q.qlen--; -+ q->cstats.drop_count = 0; -+ q->cstats.drop_len = 0; -+ } -+ - if (!skb) { - /* force a pass through old_flows to prevent starvation */ - if ((head == &q->new_flows) && !list_empty(&q->old_flows)) -@@ -327,15 +342,6 @@ begin: - } - qdisc_bstats_update(sch, skb); - flow->deficit -= qdisc_pkt_len(skb); -- /* We cant call qdisc_tree_reduce_backlog() if our qlen is 0, -- * or HTB crashes. Defer it for next round. -- */ -- if (q->cstats.drop_count && sch->q.qlen) { -- qdisc_tree_reduce_backlog(sch, q->cstats.drop_count, -- q->cstats.drop_len); -- q->cstats.drop_count = 0; -- q->cstats.drop_len = 0; -- } - return skb; - } - diff --git a/target/linux/generic/pending-4.19/630-packet_socket_type.patch b/target/linux/generic/pending-4.19/630-packet_socket_type.patch deleted file mode 100644 index a0d177586a..0000000000 --- a/target/linux/generic/pending-4.19/630-packet_socket_type.patch +++ /dev/null @@ -1,138 +0,0 @@ -From: Felix Fietkau -Subject: net: add an optimization for dealing with raw sockets - -lede-commit: 4898039703d7315f0f3431c860123338ec3be0f6 -Signed-off-by: Felix Fietkau ---- - include/uapi/linux/if_packet.h | 3 +++ - net/packet/af_packet.c | 34 +++++++++++++++++++++++++++------- - net/packet/internal.h | 1 + - 3 files changed, 31 insertions(+), 7 deletions(-) - ---- a/include/uapi/linux/if_packet.h -+++ b/include/uapi/linux/if_packet.h -@@ -32,6 +32,8 @@ struct sockaddr_ll { - #define PACKET_KERNEL 7 /* To kernel space */ - /* Unused, PACKET_FASTROUTE and PACKET_LOOPBACK are invisible to user space */ - #define PACKET_FASTROUTE 6 /* Fastrouted frame */ -+#define PACKET_MASK_ANY 0xffffffff /* mask for packet type bits */ -+ - - /* Packet socket options */ - -@@ -57,6 +59,7 @@ struct sockaddr_ll { - #define PACKET_QDISC_BYPASS 20 - #define PACKET_ROLLOVER_STATS 21 - #define PACKET_FANOUT_DATA 22 -+#define PACKET_RECV_TYPE 23 - - #define PACKET_FANOUT_HASH 0 - #define PACKET_FANOUT_LB 1 ---- a/net/packet/af_packet.c -+++ b/net/packet/af_packet.c -@@ -1789,6 +1789,7 @@ static int packet_rcv_spkt(struct sk_buf - { - struct sock *sk; - struct sockaddr_pkt *spkt; -+ struct packet_sock *po; - - /* - * When we registered the protocol we saved the socket in the data -@@ -1796,6 +1797,7 @@ static int packet_rcv_spkt(struct sk_buf - */ - - sk = pt->af_packet_priv; -+ po = pkt_sk(sk); - - /* - * Yank back the headers [hope the device set this -@@ -1808,7 +1810,7 @@ static int packet_rcv_spkt(struct sk_buf - * so that this procedure is noop. - */ - -- if (skb->pkt_type == PACKET_LOOPBACK) -+ if (!(po->pkt_type & (1 << skb->pkt_type))) - goto out; - - if (!net_eq(dev_net(dev), sock_net(sk))) -@@ -2036,12 +2038,12 @@ static int packet_rcv(struct sk_buff *sk - unsigned int snaplen, res; - bool is_drop_n_account = false; - -- if (skb->pkt_type == PACKET_LOOPBACK) -- goto drop; -- - sk = pt->af_packet_priv; - po = pkt_sk(sk); - -+ if (!(po->pkt_type & (1 << skb->pkt_type))) -+ goto drop; -+ - if (!net_eq(dev_net(dev), sock_net(sk))) - goto drop; - -@@ -2167,12 +2169,12 @@ static int tpacket_rcv(struct sk_buff *s - BUILD_BUG_ON(TPACKET_ALIGN(sizeof(*h.h2)) != 32); - BUILD_BUG_ON(TPACKET_ALIGN(sizeof(*h.h3)) != 48); - -- if (skb->pkt_type == PACKET_LOOPBACK) -- goto drop; -- - sk = pt->af_packet_priv; - po = pkt_sk(sk); - -+ if (!(po->pkt_type & (1 << skb->pkt_type))) -+ goto drop; -+ - if (!net_eq(dev_net(dev), sock_net(sk))) - goto drop; - -@@ -3233,6 +3235,7 @@ static int packet_create(struct net *net - mutex_init(&po->pg_vec_lock); - po->rollover = NULL; - po->prot_hook.func = packet_rcv; -+ po->pkt_type = PACKET_MASK_ANY & ~(1 << PACKET_LOOPBACK); - - if (sock->type == SOCK_PACKET) - po->prot_hook.func = packet_rcv_spkt; -@@ -3844,6 +3847,16 @@ packet_setsockopt(struct socket *sock, i - po->xmit = val ? packet_direct_xmit : dev_queue_xmit; - return 0; - } -+ case PACKET_RECV_TYPE: -+ { -+ unsigned int val; -+ if (optlen != sizeof(val)) -+ return -EINVAL; -+ if (copy_from_user(&val, optval, sizeof(val))) -+ return -EFAULT; -+ po->pkt_type = val & ~BIT(PACKET_LOOPBACK); -+ return 0; -+ } - default: - return -ENOPROTOOPT; - } -@@ -3896,6 +3909,13 @@ static int packet_getsockopt(struct sock - case PACKET_VNET_HDR: - val = po->has_vnet_hdr; - break; -+ case PACKET_RECV_TYPE: -+ if (len > sizeof(unsigned int)) -+ len = sizeof(unsigned int); -+ val = po->pkt_type; -+ -+ data = &val; -+ break; - case PACKET_VERSION: - val = po->tp_version; - break; ---- a/net/packet/internal.h -+++ b/net/packet/internal.h -@@ -131,6 +131,7 @@ struct packet_sock { - struct net_device __rcu *cached_dev; - int (*xmit)(struct sk_buff *skb); - struct packet_type prot_hook ____cacheline_aligned_in_smp; -+ unsigned int pkt_type; - }; - - static struct packet_sock *pkt_sk(struct sock *sk) diff --git a/target/linux/generic/pending-4.19/640-netfilter-nf_flow_table-add-hardware-offload-support.patch b/target/linux/generic/pending-4.19/640-netfilter-nf_flow_table-add-hardware-offload-support.patch deleted file mode 100644 index 0ac545c51c..0000000000 --- a/target/linux/generic/pending-4.19/640-netfilter-nf_flow_table-add-hardware-offload-support.patch +++ /dev/null @@ -1,564 +0,0 @@ -From: Pablo Neira Ayuso -Date: Thu, 11 Jan 2018 16:32:00 +0100 -Subject: [PATCH] netfilter: nf_flow_table: add hardware offload support - -This patch adds the infrastructure to offload flows to hardware, in case -the nic/switch comes with built-in flow tables capabilities. - -If the hardware comes with no hardware flow tables or they have -limitations in terms of features, the existing infrastructure falls back -to the software flow table implementation. - -The software flow table garbage collector skips entries that resides in -the hardware, so the hardware will be responsible for releasing this -flow table entry too via flow_offload_dead(). - -Hardware configuration, either to add or to delete entries, is done from -the hardware offload workqueue, to ensure this is done from user context -given that we may sleep when grabbing the mdio mutex. - -Signed-off-by: Pablo Neira Ayuso ---- - create mode 100644 net/netfilter/nf_flow_table_hw.c - ---- a/include/linux/netdevice.h -+++ b/include/linux/netdevice.h -@@ -918,6 +918,13 @@ struct dev_ifalias { - char ifalias[]; - }; - -+struct flow_offload; -+ -+enum flow_offload_type { -+ FLOW_OFFLOAD_ADD = 0, -+ FLOW_OFFLOAD_DEL, -+}; -+ - /* - * This structure defines the management hooks for network devices. - * The following hooks can be defined; unless noted otherwise, they are -@@ -1150,6 +1157,10 @@ struct dev_ifalias { - * int (*ndo_bridge_dellink)(struct net_device *dev, struct nlmsghdr *nlh, - * u16 flags); - * -+ * int (*ndo_flow_offload)(enum flow_offload_type type, -+ * struct flow_offload *flow); -+ * Adds/deletes flow entry to/from net device flowtable. -+ * - * int (*ndo_change_carrier)(struct net_device *dev, bool new_carrier); - * Called to change device carrier. Soft-devices (like dummy, team, etc) - * which do not represent real hardware may define this to allow their -@@ -1377,6 +1388,8 @@ struct net_device_ops { - int (*ndo_bridge_dellink)(struct net_device *dev, - struct nlmsghdr *nlh, - u16 flags); -+ int (*ndo_flow_offload)(enum flow_offload_type type, -+ struct flow_offload *flow); - int (*ndo_change_carrier)(struct net_device *dev, - bool new_carrier); - int (*ndo_get_phys_port_id)(struct net_device *dev, ---- a/include/net/netfilter/nf_flow_table.h -+++ b/include/net/netfilter/nf_flow_table.h -@@ -20,11 +20,17 @@ struct nf_flowtable_type { - struct module *owner; - }; - -+enum nf_flowtable_flags { -+ NF_FLOWTABLE_F_HW = 0x1, -+}; -+ - struct nf_flowtable { - struct list_head list; - struct rhashtable rhashtable; - const struct nf_flowtable_type *type; -+ u32 flags; - struct delayed_work gc_work; -+ possible_net_t ft_net; - }; - - enum flow_offload_tuple_dir { -@@ -69,6 +75,7 @@ struct flow_offload_tuple_rhash { - #define FLOW_OFFLOAD_DNAT 0x2 - #define FLOW_OFFLOAD_DYING 0x4 - #define FLOW_OFFLOAD_TEARDOWN 0x8 -+#define FLOW_OFFLOAD_HW 0x10 - - struct flow_offload { - struct flow_offload_tuple_rhash tuplehash[FLOW_OFFLOAD_DIR_MAX]; -@@ -126,6 +133,22 @@ unsigned int nf_flow_offload_ip_hook(voi - unsigned int nf_flow_offload_ipv6_hook(void *priv, struct sk_buff *skb, - const struct nf_hook_state *state); - -+void nf_flow_offload_hw_add(struct net *net, struct flow_offload *flow, -+ struct nf_conn *ct); -+void nf_flow_offload_hw_del(struct net *net, struct flow_offload *flow); -+ -+struct nf_flow_table_hw { -+ struct module *owner; -+ void (*add)(struct net *net, struct flow_offload *flow, -+ struct nf_conn *ct); -+ void (*del)(struct net *net, struct flow_offload *flow); -+}; -+ -+int nf_flow_table_hw_register(const struct nf_flow_table_hw *offload); -+void nf_flow_table_hw_unregister(const struct nf_flow_table_hw *offload); -+ -+extern struct work_struct nf_flow_offload_hw_work; -+ - #define MODULE_ALIAS_NF_FLOWTABLE(family) \ - MODULE_ALIAS("nf-flowtable-" __stringify(family)) - ---- a/include/uapi/linux/netfilter/nf_tables.h -+++ b/include/uapi/linux/netfilter/nf_tables.h -@@ -1464,6 +1464,7 @@ enum nft_object_attributes { - * @NFTA_FLOWTABLE_HOOK: netfilter hook configuration(NLA_U32) - * @NFTA_FLOWTABLE_USE: number of references to this flow table (NLA_U32) - * @NFTA_FLOWTABLE_HANDLE: object handle (NLA_U64) -+ * @NFTA_FLOWTABLE_FLAGS: flags (NLA_U32) - */ - enum nft_flowtable_attributes { - NFTA_FLOWTABLE_UNSPEC, -@@ -1473,6 +1474,7 @@ enum nft_flowtable_attributes { - NFTA_FLOWTABLE_USE, - NFTA_FLOWTABLE_HANDLE, - NFTA_FLOWTABLE_PAD, -+ NFTA_FLOWTABLE_FLAGS, - __NFTA_FLOWTABLE_MAX - }; - #define NFTA_FLOWTABLE_MAX (__NFTA_FLOWTABLE_MAX - 1) ---- a/net/netfilter/Kconfig -+++ b/net/netfilter/Kconfig -@@ -714,6 +714,15 @@ config NF_FLOW_TABLE - - To compile it as a module, choose M here. - -+config NF_FLOW_TABLE_HW -+ tristate "Netfilter flow table hardware offload module" -+ depends on NF_FLOW_TABLE -+ help -+ This option adds hardware offload support for the flow table core -+ infrastructure. -+ -+ To compile it as a module, choose M here. -+ - config NETFILTER_XTABLES - tristate "Netfilter Xtables support (required for ip_tables)" - default m if NETFILTER_ADVANCED=n ---- a/net/netfilter/Makefile -+++ b/net/netfilter/Makefile -@@ -126,6 +126,7 @@ obj-$(CONFIG_NF_FLOW_TABLE) += nf_flow_t - nf_flow_table-objs := nf_flow_table_core.o nf_flow_table_ip.o - - obj-$(CONFIG_NF_FLOW_TABLE_INET) += nf_flow_table_inet.o -+obj-$(CONFIG_NF_FLOW_TABLE_HW) += nf_flow_table_hw.o - - # generic X tables - obj-$(CONFIG_NETFILTER_XTABLES) += x_tables.o xt_tcpudp.o ---- a/net/netfilter/nf_flow_table_core.c -+++ b/net/netfilter/nf_flow_table_core.c -@@ -215,10 +215,16 @@ int flow_offload_add(struct nf_flowtable - } - EXPORT_SYMBOL_GPL(flow_offload_add); - -+static inline bool nf_flow_in_hw(const struct flow_offload *flow) -+{ -+ return flow->flags & FLOW_OFFLOAD_HW; -+} -+ - static void flow_offload_del(struct nf_flowtable *flow_table, - struct flow_offload *flow) - { - struct flow_offload_entry *e; -+ struct net *net = read_pnet(&flow_table->ft_net); - - rhashtable_remove_fast(&flow_table->rhashtable, - &flow->tuplehash[FLOW_OFFLOAD_DIR_ORIGINAL].node, -@@ -233,6 +239,9 @@ static void flow_offload_del(struct nf_f - if (!(flow->flags & FLOW_OFFLOAD_TEARDOWN)) - flow_offload_fixup_ct_state(e->ct); - -+ if (nf_flow_in_hw(flow)) -+ nf_flow_offload_hw_del(net, flow); -+ - flow_offload_free(flow); - } - -@@ -346,6 +355,9 @@ static int nf_flow_offload_gc_step(struc - if (!teardown) - nf_ct_offload_timeout(flow); - -+ if (nf_flow_in_hw(flow) && !teardown) -+ continue; -+ - if (nf_flow_has_expired(flow) || teardown) - flow_offload_del(flow_table, flow); - } -@@ -481,10 +493,43 @@ int nf_flow_dnat_port(const struct flow_ - } - EXPORT_SYMBOL_GPL(nf_flow_dnat_port); - -+static const struct nf_flow_table_hw __rcu *nf_flow_table_hw_hook __read_mostly; -+ -+static int nf_flow_offload_hw_init(struct nf_flowtable *flow_table) -+{ -+ const struct nf_flow_table_hw *offload; -+ -+ if (!rcu_access_pointer(nf_flow_table_hw_hook)) -+ request_module("nf-flow-table-hw"); -+ -+ rcu_read_lock(); -+ offload = rcu_dereference(nf_flow_table_hw_hook); -+ if (!offload) -+ goto err_no_hw_offload; -+ -+ if (!try_module_get(offload->owner)) -+ goto err_no_hw_offload; -+ -+ rcu_read_unlock(); -+ -+ return 0; -+ -+err_no_hw_offload: -+ rcu_read_unlock(); -+ -+ return -EOPNOTSUPP; -+} -+ - int nf_flow_table_init(struct nf_flowtable *flowtable) - { - int err; - -+ if (flowtable->flags & NF_FLOWTABLE_F_HW) { -+ err = nf_flow_offload_hw_init(flowtable); -+ if (err) -+ return err; -+ } -+ - INIT_DEFERRABLE_WORK(&flowtable->gc_work, nf_flow_offload_work_gc); - - err = rhashtable_init(&flowtable->rhashtable, -@@ -522,6 +567,8 @@ static void nf_flow_table_iterate_cleanu - { - nf_flow_table_iterate(flowtable, nf_flow_table_do_cleanup, dev); - flush_delayed_work(&flowtable->gc_work); -+ if (flowtable->flags & NF_FLOWTABLE_F_HW) -+ flush_work(&nf_flow_offload_hw_work); - } - - void nf_flow_table_cleanup(struct net *net, struct net_device *dev) -@@ -535,6 +582,26 @@ void nf_flow_table_cleanup(struct net *n - } - EXPORT_SYMBOL_GPL(nf_flow_table_cleanup); - -+struct work_struct nf_flow_offload_hw_work; -+EXPORT_SYMBOL_GPL(nf_flow_offload_hw_work); -+ -+/* Give the hardware workqueue the chance to remove entries from hardware.*/ -+static void nf_flow_offload_hw_free(struct nf_flowtable *flowtable) -+{ -+ const struct nf_flow_table_hw *offload; -+ -+ flush_work(&nf_flow_offload_hw_work); -+ -+ rcu_read_lock(); -+ offload = rcu_dereference(nf_flow_table_hw_hook); -+ if (!offload) { -+ rcu_read_unlock(); -+ return; -+ } -+ module_put(offload->owner); -+ rcu_read_unlock(); -+} -+ - void nf_flow_table_free(struct nf_flowtable *flow_table) - { - mutex_lock(&flowtable_lock); -@@ -544,9 +611,58 @@ void nf_flow_table_free(struct nf_flowta - nf_flow_table_iterate(flow_table, nf_flow_table_do_cleanup, NULL); - WARN_ON(!nf_flow_offload_gc_step(flow_table)); - rhashtable_destroy(&flow_table->rhashtable); -+ if (flow_table->flags & NF_FLOWTABLE_F_HW) -+ nf_flow_offload_hw_free(flow_table); - } - EXPORT_SYMBOL_GPL(nf_flow_table_free); - -+/* Must be called from user context. */ -+void nf_flow_offload_hw_add(struct net *net, struct flow_offload *flow, -+ struct nf_conn *ct) -+{ -+ const struct nf_flow_table_hw *offload; -+ -+ rcu_read_lock(); -+ offload = rcu_dereference(nf_flow_table_hw_hook); -+ if (offload) -+ offload->add(net, flow, ct); -+ rcu_read_unlock(); -+} -+EXPORT_SYMBOL_GPL(nf_flow_offload_hw_add); -+ -+/* Must be called from user context. */ -+void nf_flow_offload_hw_del(struct net *net, struct flow_offload *flow) -+{ -+ const struct nf_flow_table_hw *offload; -+ -+ rcu_read_lock(); -+ offload = rcu_dereference(nf_flow_table_hw_hook); -+ if (offload) -+ offload->del(net, flow); -+ rcu_read_unlock(); -+} -+EXPORT_SYMBOL_GPL(nf_flow_offload_hw_del); -+ -+int nf_flow_table_hw_register(const struct nf_flow_table_hw *offload) -+{ -+ if (rcu_access_pointer(nf_flow_table_hw_hook)) -+ return -EBUSY; -+ -+ rcu_assign_pointer(nf_flow_table_hw_hook, offload); -+ -+ return 0; -+} -+EXPORT_SYMBOL_GPL(nf_flow_table_hw_register); -+ -+void nf_flow_table_hw_unregister(const struct nf_flow_table_hw *offload) -+{ -+ WARN_ON(rcu_access_pointer(nf_flow_table_hw_hook) != offload); -+ rcu_assign_pointer(nf_flow_table_hw_hook, NULL); -+ -+ synchronize_rcu(); -+} -+EXPORT_SYMBOL_GPL(nf_flow_table_hw_unregister); -+ - static int nf_flow_table_netdev_event(struct notifier_block *this, - unsigned long event, void *ptr) - { ---- /dev/null -+++ b/net/netfilter/nf_flow_table_hw.c -@@ -0,0 +1,169 @@ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+static DEFINE_SPINLOCK(flow_offload_hw_pending_list_lock); -+static LIST_HEAD(flow_offload_hw_pending_list); -+ -+static DEFINE_MUTEX(nf_flow_offload_hw_mutex); -+ -+struct flow_offload_hw { -+ struct list_head list; -+ enum flow_offload_type type; -+ struct flow_offload *flow; -+ struct nf_conn *ct; -+ possible_net_t flow_hw_net; -+}; -+ -+static int do_flow_offload_hw(struct net *net, struct flow_offload *flow, -+ int type) -+{ -+ struct net_device *indev; -+ int ret, ifindex; -+ -+ ifindex = flow->tuplehash[FLOW_OFFLOAD_DIR_ORIGINAL].tuple.iifidx; -+ indev = dev_get_by_index(net, ifindex); -+ if (WARN_ON(!indev)) -+ return 0; -+ -+ mutex_lock(&nf_flow_offload_hw_mutex); -+ ret = indev->netdev_ops->ndo_flow_offload(type, flow); -+ mutex_unlock(&nf_flow_offload_hw_mutex); -+ -+ dev_put(indev); -+ -+ return ret; -+} -+ -+static void flow_offload_hw_work_add(struct flow_offload_hw *offload) -+{ -+ struct net *net; -+ int ret; -+ -+ if (nf_ct_is_dying(offload->ct)) -+ return; -+ -+ net = read_pnet(&offload->flow_hw_net); -+ ret = do_flow_offload_hw(net, offload->flow, FLOW_OFFLOAD_ADD); -+ if (ret >= 0) -+ offload->flow->flags |= FLOW_OFFLOAD_HW; -+} -+ -+static void flow_offload_hw_work_del(struct flow_offload_hw *offload) -+{ -+ struct net *net = read_pnet(&offload->flow_hw_net); -+ -+ do_flow_offload_hw(net, offload->flow, FLOW_OFFLOAD_DEL); -+} -+ -+static void flow_offload_hw_work(struct work_struct *work) -+{ -+ struct flow_offload_hw *offload, *next; -+ LIST_HEAD(hw_offload_pending); -+ -+ spin_lock_bh(&flow_offload_hw_pending_list_lock); -+ list_replace_init(&flow_offload_hw_pending_list, &hw_offload_pending); -+ spin_unlock_bh(&flow_offload_hw_pending_list_lock); -+ -+ list_for_each_entry_safe(offload, next, &hw_offload_pending, list) { -+ switch (offload->type) { -+ case FLOW_OFFLOAD_ADD: -+ flow_offload_hw_work_add(offload); -+ break; -+ case FLOW_OFFLOAD_DEL: -+ flow_offload_hw_work_del(offload); -+ break; -+ } -+ if (offload->ct) -+ nf_conntrack_put(&offload->ct->ct_general); -+ list_del(&offload->list); -+ kfree(offload); -+ } -+} -+ -+static void flow_offload_queue_work(struct flow_offload_hw *offload) -+{ -+ spin_lock_bh(&flow_offload_hw_pending_list_lock); -+ list_add_tail(&offload->list, &flow_offload_hw_pending_list); -+ spin_unlock_bh(&flow_offload_hw_pending_list_lock); -+ -+ schedule_work(&nf_flow_offload_hw_work); -+} -+ -+static void flow_offload_hw_add(struct net *net, struct flow_offload *flow, -+ struct nf_conn *ct) -+{ -+ struct flow_offload_hw *offload; -+ -+ offload = kmalloc(sizeof(struct flow_offload_hw), GFP_ATOMIC); -+ if (!offload) -+ return; -+ -+ nf_conntrack_get(&ct->ct_general); -+ offload->type = FLOW_OFFLOAD_ADD; -+ offload->ct = ct; -+ offload->flow = flow; -+ write_pnet(&offload->flow_hw_net, net); -+ -+ flow_offload_queue_work(offload); -+} -+ -+static void flow_offload_hw_del(struct net *net, struct flow_offload *flow) -+{ -+ struct flow_offload_hw *offload; -+ -+ offload = kmalloc(sizeof(struct flow_offload_hw), GFP_ATOMIC); -+ if (!offload) -+ return; -+ -+ offload->type = FLOW_OFFLOAD_DEL; -+ offload->ct = NULL; -+ offload->flow = flow; -+ write_pnet(&offload->flow_hw_net, net); -+ -+ flow_offload_queue_work(offload); -+} -+ -+static const struct nf_flow_table_hw flow_offload_hw = { -+ .add = flow_offload_hw_add, -+ .del = flow_offload_hw_del, -+ .owner = THIS_MODULE, -+}; -+ -+static int __init nf_flow_table_hw_module_init(void) -+{ -+ INIT_WORK(&nf_flow_offload_hw_work, flow_offload_hw_work); -+ nf_flow_table_hw_register(&flow_offload_hw); -+ -+ return 0; -+} -+ -+static void __exit nf_flow_table_hw_module_exit(void) -+{ -+ struct flow_offload_hw *offload, *next; -+ LIST_HEAD(hw_offload_pending); -+ -+ nf_flow_table_hw_unregister(&flow_offload_hw); -+ cancel_work_sync(&nf_flow_offload_hw_work); -+ -+ list_for_each_entry_safe(offload, next, &hw_offload_pending, list) { -+ if (offload->ct) -+ nf_conntrack_put(&offload->ct->ct_general); -+ list_del(&offload->list); -+ kfree(offload); -+ } -+} -+ -+module_init(nf_flow_table_hw_module_init); -+module_exit(nf_flow_table_hw_module_exit); -+ -+MODULE_LICENSE("GPL"); -+MODULE_AUTHOR("Pablo Neira Ayuso "); -+MODULE_ALIAS("nf-flow-table-hw"); ---- a/net/netfilter/nf_tables_api.c -+++ b/net/netfilter/nf_tables_api.c -@@ -5394,6 +5394,13 @@ static int nf_tables_flowtable_parse_hoo - if (err < 0) - return err; - -+ for (i = 0; i < n; i++) { -+ if (flowtable->data.flags & NF_FLOWTABLE_F_HW && -+ !dev_array[i]->netdev_ops->ndo_flow_offload) { -+ return -EOPNOTSUPP; -+ } -+ } -+ - ops = kcalloc(n, sizeof(struct nf_hook_ops), GFP_KERNEL); - if (!ops) - return -ENOMEM; -@@ -5525,10 +5532,19 @@ static int nf_tables_newflowtable(struct - } - - flowtable->data.type = type; -+ write_pnet(&flowtable->data.ft_net, net); -+ - err = type->init(&flowtable->data); - if (err < 0) - goto err3; - -+ if (nla[NFTA_FLOWTABLE_FLAGS]) { -+ flowtable->data.flags = -+ ntohl(nla_get_be32(nla[NFTA_FLOWTABLE_FLAGS])); -+ if (flowtable->data.flags & ~NF_FLOWTABLE_F_HW) -+ goto err4; -+ } -+ - err = nf_tables_flowtable_parse_hook(&ctx, nla[NFTA_FLOWTABLE_HOOK], - flowtable); - if (err < 0) -@@ -5654,7 +5670,8 @@ static int nf_tables_fill_flowtable_info - nla_put_string(skb, NFTA_FLOWTABLE_NAME, flowtable->name) || - nla_put_be32(skb, NFTA_FLOWTABLE_USE, htonl(flowtable->use)) || - nla_put_be64(skb, NFTA_FLOWTABLE_HANDLE, cpu_to_be64(flowtable->handle), -- NFTA_FLOWTABLE_PAD)) -+ NFTA_FLOWTABLE_PAD) || -+ nla_put_be32(skb, NFTA_FLOWTABLE_FLAGS, htonl(flowtable->data.flags))) - goto nla_put_failure; - - nest = nla_nest_start(skb, NFTA_FLOWTABLE_HOOK); ---- a/net/netfilter/nft_flow_offload.c -+++ b/net/netfilter/nft_flow_offload.c -@@ -121,6 +121,9 @@ static void nft_flow_offload_eval(const - if (ret < 0) - goto err_flow_add; - -+ if (flowtable->flags & NF_FLOWTABLE_F_HW) -+ nf_flow_offload_hw_add(nft_net(pkt), flow, ct); -+ - return; - - err_flow_add: diff --git a/target/linux/generic/pending-4.19/641-netfilter-nf_flow_table-support-hw-offload-through-v.patch b/target/linux/generic/pending-4.19/641-netfilter-nf_flow_table-support-hw-offload-through-v.patch deleted file mode 100644 index 87ff634793..0000000000 --- a/target/linux/generic/pending-4.19/641-netfilter-nf_flow_table-support-hw-offload-through-v.patch +++ /dev/null @@ -1,303 +0,0 @@ -From: Felix Fietkau -Date: Thu, 15 Mar 2018 20:46:31 +0100 -Subject: [PATCH] netfilter: nf_flow_table: support hw offload through - virtual interfaces - -There are hardware offload devices that support offloading VLANs and -PPPoE devices. Additionally, it is useful to be able to offload packets -routed through bridge interfaces as well. -Add support for finding the path to the offload device through these -virtual interfaces, while collecting useful parameters for the offload -device, like VLAN ID/protocol, PPPoE session and Ethernet MAC address. - -Signed-off-by: Felix Fietkau ---- - ---- a/include/linux/netdevice.h -+++ b/include/linux/netdevice.h -@@ -919,6 +919,7 @@ struct dev_ifalias { - }; - - struct flow_offload; -+struct flow_offload_hw_path; - - enum flow_offload_type { - FLOW_OFFLOAD_ADD = 0, -@@ -1157,8 +1158,15 @@ enum flow_offload_type { - * int (*ndo_bridge_dellink)(struct net_device *dev, struct nlmsghdr *nlh, - * u16 flags); - * -+ * int (*ndo_flow_offload_check)(struct flow_offload_hw_path *path); -+ * For virtual devices like bridges, vlan, and pppoe, fill in the -+ * underlying network device that can be used for offloading connections. -+ * Return an error if offloading is not supported. -+ * - * int (*ndo_flow_offload)(enum flow_offload_type type, -- * struct flow_offload *flow); -+ * struct flow_offload *flow, -+ * struct flow_offload_hw_path *src, -+ * struct flow_offload_hw_path *dest); - * Adds/deletes flow entry to/from net device flowtable. - * - * int (*ndo_change_carrier)(struct net_device *dev, bool new_carrier); -@@ -1388,8 +1396,11 @@ struct net_device_ops { - int (*ndo_bridge_dellink)(struct net_device *dev, - struct nlmsghdr *nlh, - u16 flags); -+ int (*ndo_flow_offload_check)(struct flow_offload_hw_path *path); - int (*ndo_flow_offload)(enum flow_offload_type type, -- struct flow_offload *flow); -+ struct flow_offload *flow, -+ struct flow_offload_hw_path *src, -+ struct flow_offload_hw_path *dest); - int (*ndo_change_carrier)(struct net_device *dev, - bool new_carrier); - int (*ndo_get_phys_port_id)(struct net_device *dev, ---- a/include/net/netfilter/nf_flow_table.h -+++ b/include/net/netfilter/nf_flow_table.h -@@ -86,6 +86,21 @@ struct flow_offload { - }; - }; - -+#define FLOW_OFFLOAD_PATH_ETHERNET BIT(0) -+#define FLOW_OFFLOAD_PATH_VLAN BIT(1) -+#define FLOW_OFFLOAD_PATH_PPPOE BIT(2) -+ -+struct flow_offload_hw_path { -+ struct net_device *dev; -+ u32 flags; -+ -+ u8 eth_src[ETH_ALEN]; -+ u8 eth_dest[ETH_ALEN]; -+ u16 vlan_proto; -+ u16 vlan_id; -+ u16 pppoe_sid; -+}; -+ - #define NF_FLOW_TIMEOUT (30 * HZ) - - struct nf_flow_route { ---- a/net/netfilter/nf_flow_table_hw.c -+++ b/net/netfilter/nf_flow_table_hw.c -@@ -19,48 +19,75 @@ struct flow_offload_hw { - enum flow_offload_type type; - struct flow_offload *flow; - struct nf_conn *ct; -- possible_net_t flow_hw_net; -+ -+ struct flow_offload_hw_path src; -+ struct flow_offload_hw_path dest; - }; - --static int do_flow_offload_hw(struct net *net, struct flow_offload *flow, -- int type) -+static void flow_offload_check_ethernet(struct flow_offload_tuple *tuple, -+ struct flow_offload_hw_path *path) - { -- struct net_device *indev; -- int ret, ifindex; -+ struct net_device *dev = path->dev; -+ struct neighbour *n; - -- ifindex = flow->tuplehash[FLOW_OFFLOAD_DIR_ORIGINAL].tuple.iifidx; -- indev = dev_get_by_index(net, ifindex); -- if (WARN_ON(!indev)) -- return 0; -- -- mutex_lock(&nf_flow_offload_hw_mutex); -- ret = indev->netdev_ops->ndo_flow_offload(type, flow); -- mutex_unlock(&nf_flow_offload_hw_mutex); -+ if (dev->type != ARPHRD_ETHER) -+ return; - -- dev_put(indev); -+ memcpy(path->eth_src, path->dev->dev_addr, ETH_ALEN); -+ n = dst_neigh_lookup(tuple->dst_cache, &tuple->src_v4); -+ if (!n) -+ return; - -- return ret; -+ memcpy(path->eth_dest, n->ha, ETH_ALEN); -+ path->flags |= FLOW_OFFLOAD_PATH_ETHERNET; -+ neigh_release(n); - } - --static void flow_offload_hw_work_add(struct flow_offload_hw *offload) -+static int flow_offload_check_path(struct net *net, -+ struct flow_offload_tuple *tuple, -+ struct flow_offload_hw_path *path) - { -- struct net *net; -- int ret; -+ struct net_device *dev; - -- if (nf_ct_is_dying(offload->ct)) -- return; -+ dev = dev_get_by_index_rcu(net, tuple->iifidx); -+ if (!dev) -+ return -ENOENT; -+ -+ path->dev = dev; -+ flow_offload_check_ethernet(tuple, path); - -- net = read_pnet(&offload->flow_hw_net); -- ret = do_flow_offload_hw(net, offload->flow, FLOW_OFFLOAD_ADD); -- if (ret >= 0) -- offload->flow->flags |= FLOW_OFFLOAD_HW; -+ if (dev->netdev_ops->ndo_flow_offload_check) -+ return dev->netdev_ops->ndo_flow_offload_check(path); -+ -+ return 0; - } - --static void flow_offload_hw_work_del(struct flow_offload_hw *offload) -+static int do_flow_offload_hw(struct flow_offload_hw *offload) - { -- struct net *net = read_pnet(&offload->flow_hw_net); -+ struct net_device *src_dev = offload->src.dev; -+ struct net_device *dest_dev = offload->dest.dev; -+ int ret; -+ -+ ret = src_dev->netdev_ops->ndo_flow_offload(offload->type, -+ offload->flow, -+ &offload->src, -+ &offload->dest); -+ -+ /* restore devices in case the driver mangled them */ -+ offload->src.dev = src_dev; -+ offload->dest.dev = dest_dev; -+ -+ return ret; -+} - -- do_flow_offload_hw(net, offload->flow, FLOW_OFFLOAD_DEL); -+static void flow_offload_hw_free(struct flow_offload_hw *offload) -+{ -+ dev_put(offload->src.dev); -+ dev_put(offload->dest.dev); -+ if (offload->ct) -+ nf_conntrack_put(&offload->ct->ct_general); -+ list_del(&offload->list); -+ kfree(offload); - } - - static void flow_offload_hw_work(struct work_struct *work) -@@ -73,18 +100,22 @@ static void flow_offload_hw_work(struct - spin_unlock_bh(&flow_offload_hw_pending_list_lock); - - list_for_each_entry_safe(offload, next, &hw_offload_pending, list) { -+ mutex_lock(&nf_flow_offload_hw_mutex); - switch (offload->type) { - case FLOW_OFFLOAD_ADD: -- flow_offload_hw_work_add(offload); -+ if (nf_ct_is_dying(offload->ct)) -+ break; -+ -+ if (do_flow_offload_hw(offload) >= 0) -+ offload->flow->flags |= FLOW_OFFLOAD_HW; - break; - case FLOW_OFFLOAD_DEL: -- flow_offload_hw_work_del(offload); -+ do_flow_offload_hw(offload); - break; - } -- if (offload->ct) -- nf_conntrack_put(&offload->ct->ct_general); -- list_del(&offload->list); -- kfree(offload); -+ mutex_unlock(&nf_flow_offload_hw_mutex); -+ -+ flow_offload_hw_free(offload); - } - } - -@@ -97,20 +128,55 @@ static void flow_offload_queue_work(stru - schedule_work(&nf_flow_offload_hw_work); - } - -+static struct flow_offload_hw * -+flow_offload_hw_prepare(struct net *net, struct flow_offload *flow) -+{ -+ struct flow_offload_hw_path src = {}; -+ struct flow_offload_hw_path dest = {}; -+ struct flow_offload_tuple *tuple; -+ struct flow_offload_hw *offload = NULL; -+ -+ rcu_read_lock_bh(); -+ -+ tuple = &flow->tuplehash[FLOW_OFFLOAD_DIR_ORIGINAL].tuple; -+ if (flow_offload_check_path(net, tuple, &src)) -+ goto out; -+ -+ tuple = &flow->tuplehash[FLOW_OFFLOAD_DIR_REPLY].tuple; -+ if (flow_offload_check_path(net, tuple, &dest)) -+ goto out; -+ -+ if (!src.dev->netdev_ops->ndo_flow_offload) -+ goto out; -+ -+ offload = kzalloc(sizeof(struct flow_offload_hw), GFP_ATOMIC); -+ if (!offload) -+ goto out; -+ -+ dev_hold(src.dev); -+ dev_hold(dest.dev); -+ offload->src = src; -+ offload->dest = dest; -+ offload->flow = flow; -+ -+out: -+ rcu_read_unlock_bh(); -+ -+ return offload; -+} -+ - static void flow_offload_hw_add(struct net *net, struct flow_offload *flow, - struct nf_conn *ct) - { - struct flow_offload_hw *offload; - -- offload = kmalloc(sizeof(struct flow_offload_hw), GFP_ATOMIC); -+ offload = flow_offload_hw_prepare(net, flow); - if (!offload) - return; - - nf_conntrack_get(&ct->ct_general); - offload->type = FLOW_OFFLOAD_ADD; - offload->ct = ct; -- offload->flow = flow; -- write_pnet(&offload->flow_hw_net, net); - - flow_offload_queue_work(offload); - } -@@ -119,14 +185,11 @@ static void flow_offload_hw_del(struct n - { - struct flow_offload_hw *offload; - -- offload = kmalloc(sizeof(struct flow_offload_hw), GFP_ATOMIC); -+ offload = flow_offload_hw_prepare(net, flow); - if (!offload) - return; - - offload->type = FLOW_OFFLOAD_DEL; -- offload->ct = NULL; -- offload->flow = flow; -- write_pnet(&offload->flow_hw_net, net); - - flow_offload_queue_work(offload); - } -@@ -153,12 +216,8 @@ static void __exit nf_flow_table_hw_modu - nf_flow_table_hw_unregister(&flow_offload_hw); - cancel_work_sync(&nf_flow_offload_hw_work); - -- list_for_each_entry_safe(offload, next, &hw_offload_pending, list) { -- if (offload->ct) -- nf_conntrack_put(&offload->ct->ct_general); -- list_del(&offload->list); -- kfree(offload); -- } -+ list_for_each_entry_safe(offload, next, &hw_offload_pending, list) -+ flow_offload_hw_free(offload); - } - - module_init(nf_flow_table_hw_module_init); diff --git a/target/linux/generic/pending-4.19/642-net-8021q-support-hardware-flow-table-offload.patch b/target/linux/generic/pending-4.19/642-net-8021q-support-hardware-flow-table-offload.patch deleted file mode 100644 index 4fabfdcb6c..0000000000 --- a/target/linux/generic/pending-4.19/642-net-8021q-support-hardware-flow-table-offload.patch +++ /dev/null @@ -1,60 +0,0 @@ -From: Felix Fietkau -Date: Thu, 15 Mar 2018 20:49:58 +0100 -Subject: [PATCH] net: 8021q: support hardware flow table offload - -Add the VLAN ID and protocol information - -Signed-off-by: Felix Fietkau ---- - ---- a/net/8021q/vlan_dev.c -+++ b/net/8021q/vlan_dev.c -@@ -32,6 +32,10 @@ - #include - #include - #include -+#if IS_ENABLED(CONFIG_NF_FLOW_TABLE) -+#include -+#include -+#endif - - #include "vlan.h" - #include "vlanproc.h" -@@ -768,6 +772,27 @@ static int vlan_dev_get_iflink(const str - return real_dev->ifindex; - } - -+#if IS_ENABLED(CONFIG_NF_FLOW_TABLE) -+static int vlan_dev_flow_offload_check(struct flow_offload_hw_path *path) -+{ -+ struct net_device *dev = path->dev; -+ struct vlan_dev_priv *vlan = vlan_dev_priv(dev); -+ -+ if (path->flags & FLOW_OFFLOAD_PATH_VLAN) -+ return -EEXIST; -+ -+ path->flags |= FLOW_OFFLOAD_PATH_VLAN; -+ path->vlan_proto = vlan->vlan_proto; -+ path->vlan_id = vlan->vlan_id; -+ path->dev = vlan->real_dev; -+ -+ if (vlan->real_dev->netdev_ops->ndo_flow_offload_check) -+ return vlan->real_dev->netdev_ops->ndo_flow_offload_check(path); -+ -+ return 0; -+} -+#endif /* CONFIG_NF_FLOW_TABLE */ -+ - static const struct ethtool_ops vlan_ethtool_ops = { - .get_link_ksettings = vlan_ethtool_get_link_ksettings, - .get_drvinfo = vlan_ethtool_get_drvinfo, -@@ -805,6 +830,9 @@ static const struct net_device_ops vlan_ - .ndo_fix_features = vlan_dev_fix_features, - .ndo_get_lock_subclass = vlan_dev_get_lock_subclass, - .ndo_get_iflink = vlan_dev_get_iflink, -+#if IS_ENABLED(CONFIG_NF_FLOW_TABLE) -+ .ndo_flow_offload_check = vlan_dev_flow_offload_check, -+#endif - }; - - static void vlan_dev_free(struct net_device *dev) diff --git a/target/linux/generic/pending-4.19/643-net-bridge-support-hardware-flow-table-offload.patch b/target/linux/generic/pending-4.19/643-net-bridge-support-hardware-flow-table-offload.patch deleted file mode 100644 index 7d9c8abe9c..0000000000 --- a/target/linux/generic/pending-4.19/643-net-bridge-support-hardware-flow-table-offload.patch +++ /dev/null @@ -1,61 +0,0 @@ -From: Felix Fietkau -Date: Thu, 15 Mar 2018 20:50:37 +0100 -Subject: [PATCH] net: bridge: support hardware flow table offload - -Look up the real device and pass it on - -Signed-off-by: Felix Fietkau ---- - ---- a/net/bridge/br_device.c -+++ b/net/bridge/br_device.c -@@ -18,6 +18,10 @@ - #include - #include - #include -+#if IS_ENABLED(CONFIG_NF_FLOW_TABLE) -+#include -+#include -+#endif - - #include - #include "br_private.h" -@@ -370,6 +374,28 @@ static const struct ethtool_ops br_ethto - .get_link = ethtool_op_get_link, - }; - -+#if IS_ENABLED(CONFIG_NF_FLOW_TABLE) -+static int br_flow_offload_check(struct flow_offload_hw_path *path) -+{ -+ struct net_device *dev = path->dev; -+ struct net_bridge *br = netdev_priv(dev); -+ struct net_bridge_fdb_entry *dst; -+ -+ if (!(path->flags & FLOW_OFFLOAD_PATH_ETHERNET)) -+ return -EINVAL; -+ -+ dst = br_fdb_find_rcu(br, path->eth_dest, path->vlan_id); -+ if (!dst || !dst->dst) -+ return -ENOENT; -+ -+ path->dev = dst->dst->dev; -+ if (path->dev->netdev_ops->ndo_flow_offload_check) -+ return path->dev->netdev_ops->ndo_flow_offload_check(path); -+ -+ return 0; -+} -+#endif /* CONFIG_NF_FLOW_TABLE */ -+ - static const struct net_device_ops br_netdev_ops = { - .ndo_open = br_dev_open, - .ndo_stop = br_dev_stop, -@@ -397,6 +423,9 @@ static const struct net_device_ops br_ne - .ndo_bridge_setlink = br_setlink, - .ndo_bridge_dellink = br_dellink, - .ndo_features_check = passthru_features_check, -+#if IS_ENABLED(CONFIG_NF_FLOW_TABLE) -+ .ndo_flow_offload_check = br_flow_offload_check, -+#endif - }; - - static struct device_type br_type = { diff --git a/target/linux/generic/pending-4.19/644-net-pppoe-support-hardware-flow-table-offload.patch b/target/linux/generic/pending-4.19/644-net-pppoe-support-hardware-flow-table-offload.patch deleted file mode 100644 index 26d46ec005..0000000000 --- a/target/linux/generic/pending-4.19/644-net-pppoe-support-hardware-flow-table-offload.patch +++ /dev/null @@ -1,125 +0,0 @@ -From: Felix Fietkau -Date: Thu, 15 Mar 2018 21:15:00 +0100 -Subject: [PATCH] net: pppoe: support hardware flow table offload - -Pass on the PPPoE session ID and the remote MAC address - -Signed-off-by: Felix Fietkau ---- - ---- a/drivers/net/ppp/ppp_generic.c -+++ b/drivers/net/ppp/ppp_generic.c -@@ -57,6 +57,11 @@ - #include - #include - -+#if IS_ENABLED(CONFIG_NF_FLOW_TABLE) -+#include -+#include -+#endif -+ - #define PPP_VERSION "2.4.2" - - /* -@@ -1368,12 +1373,37 @@ static void ppp_dev_priv_destructor(stru - ppp_destroy_interface(ppp); - } - -+#if IS_ENABLED(CONFIG_NF_FLOW_TABLE) -+static int ppp_flow_offload_check(struct flow_offload_hw_path *path) -+{ -+ struct ppp *ppp = netdev_priv(path->dev); -+ struct ppp_channel *chan; -+ struct channel *pch; -+ -+ if (ppp->flags & SC_MULTILINK) -+ return -EOPNOTSUPP; -+ -+ if (list_empty(&ppp->channels)) -+ return -ENODEV; -+ -+ pch = list_first_entry(&ppp->channels, struct channel, clist); -+ chan = pch->chan; -+ if (!chan->ops->flow_offload_check) -+ return -EOPNOTSUPP; -+ -+ return chan->ops->flow_offload_check(chan, path); -+} -+#endif /* CONFIG_NF_FLOW_TABLE */ -+ - static const struct net_device_ops ppp_netdev_ops = { - .ndo_init = ppp_dev_init, - .ndo_uninit = ppp_dev_uninit, - .ndo_start_xmit = ppp_start_xmit, - .ndo_do_ioctl = ppp_net_ioctl, - .ndo_get_stats64 = ppp_get_stats64, -+#if IS_ENABLED(CONFIG_NF_FLOW_TABLE) -+ .ndo_flow_offload_check = ppp_flow_offload_check, -+#endif - }; - - static struct device_type ppp_type = { ---- a/drivers/net/ppp/pppoe.c -+++ b/drivers/net/ppp/pppoe.c -@@ -78,6 +78,11 @@ - #include - #include - -+#if IS_ENABLED(CONFIG_NF_FLOW_TABLE) -+#include -+#include -+#endif -+ - #include - #include - #include -@@ -976,8 +981,36 @@ static int pppoe_xmit(struct ppp_channel - return __pppoe_xmit(sk, skb); - } - -+#if IS_ENABLED(CONFIG_NF_FLOW_TABLE) -+static int pppoe_flow_offload_check(struct ppp_channel *chan, -+ struct flow_offload_hw_path *path) -+{ -+ struct sock *sk = (struct sock *)chan->private; -+ struct pppox_sock *po = pppox_sk(sk); -+ struct net_device *dev = po->pppoe_dev; -+ -+ if (sock_flag(sk, SOCK_DEAD) || -+ !(sk->sk_state & PPPOX_CONNECTED) || !dev) -+ return -ENODEV; -+ -+ path->dev = po->pppoe_dev; -+ path->flags |= FLOW_OFFLOAD_PATH_PPPOE; -+ memcpy(path->eth_src, po->pppoe_dev->dev_addr, ETH_ALEN); -+ memcpy(path->eth_dest, po->pppoe_pa.remote, ETH_ALEN); -+ path->pppoe_sid = be16_to_cpu(po->num); -+ -+ if (path->dev->netdev_ops->ndo_flow_offload_check) -+ return path->dev->netdev_ops->ndo_flow_offload_check(path); -+ -+ return 0; -+} -+#endif /* CONFIG_NF_FLOW_TABLE */ -+ - static const struct ppp_channel_ops pppoe_chan_ops = { - .start_xmit = pppoe_xmit, -+#if IS_ENABLED(CONFIG_NF_FLOW_TABLE) -+ .flow_offload_check = pppoe_flow_offload_check, -+#endif - }; - - static int pppoe_recvmsg(struct socket *sock, struct msghdr *m, ---- a/include/linux/ppp_channel.h -+++ b/include/linux/ppp_channel.h -@@ -32,6 +32,10 @@ struct ppp_channel_ops { - int (*start_xmit)(struct ppp_channel *, struct sk_buff *); - /* Handle an ioctl call that has come in via /dev/ppp. */ - int (*ioctl)(struct ppp_channel *, unsigned int, unsigned long); -+ -+#if IS_ENABLED(CONFIG_NF_FLOW_TABLE) -+ int (*flow_offload_check)(struct ppp_channel *, struct flow_offload_hw_path *); -+#endif - }; - - struct ppp_channel { diff --git a/target/linux/generic/pending-4.19/645-netfilter-nf_flow_table-rework-hardware-offload-time.patch b/target/linux/generic/pending-4.19/645-netfilter-nf_flow_table-rework-hardware-offload-time.patch deleted file mode 100644 index 2b3725f81e..0000000000 --- a/target/linux/generic/pending-4.19/645-netfilter-nf_flow_table-rework-hardware-offload-time.patch +++ /dev/null @@ -1,37 +0,0 @@ -From: Felix Fietkau -Date: Sun, 25 Mar 2018 21:10:55 +0200 -Subject: [PATCH] netfilter: nf_flow_table: rework hardware offload timeout - handling - -Some offload implementations send keepalive packets + explicit -notifications of TCP FIN/RST packets. In this case it is more convenient -to simply let the driver update flow->timeout handling and use the -regular flow offload gc step. - -For drivers that manage their own lifetime, a separate flag can be set -to avoid gc timeouts. - -Signed-off-by: Felix Fietkau ---- - ---- a/include/net/netfilter/nf_flow_table.h -+++ b/include/net/netfilter/nf_flow_table.h -@@ -76,6 +76,7 @@ struct flow_offload_tuple_rhash { - #define FLOW_OFFLOAD_DYING 0x4 - #define FLOW_OFFLOAD_TEARDOWN 0x8 - #define FLOW_OFFLOAD_HW 0x10 -+#define FLOW_OFFLOAD_KEEP 0x20 - - struct flow_offload { - struct flow_offload_tuple_rhash tuplehash[FLOW_OFFLOAD_DIR_MAX]; ---- a/net/netfilter/nf_flow_table_core.c -+++ b/net/netfilter/nf_flow_table_core.c -@@ -355,7 +355,7 @@ static int nf_flow_offload_gc_step(struc - if (!teardown) - nf_ct_offload_timeout(flow); - -- if (nf_flow_in_hw(flow) && !teardown) -+ if ((flow->flags & FLOW_OFFLOAD_KEEP) && !teardown) - continue; - - if (nf_flow_has_expired(flow) || teardown) diff --git a/target/linux/generic/pending-4.19/646-netfilter-nf_flow_table-rework-private-driver-data.patch b/target/linux/generic/pending-4.19/646-netfilter-nf_flow_table-rework-private-driver-data.patch deleted file mode 100644 index f94d7ad301..0000000000 --- a/target/linux/generic/pending-4.19/646-netfilter-nf_flow_table-rework-private-driver-data.patch +++ /dev/null @@ -1,25 +0,0 @@ -From: Felix Fietkau -Date: Fri, 27 Apr 2018 14:42:14 +0200 -Subject: [PATCH] netfilter: nf_flow_table: rework private driver data - -Move the timeout out of the union, since it can be shared between the -driver and the stack. Add a private pointer that the driver can use to -point to its own data structures - -Signed-off-by: Felix Fietkau ---- - ---- a/include/net/netfilter/nf_flow_table.h -+++ b/include/net/netfilter/nf_flow_table.h -@@ -81,9 +81,10 @@ struct flow_offload_tuple_rhash { - struct flow_offload { - struct flow_offload_tuple_rhash tuplehash[FLOW_OFFLOAD_DIR_MAX]; - u32 flags; -+ u32 timeout; - union { - /* Your private driver data here. */ -- u32 timeout; -+ void *priv; - }; - }; - diff --git a/target/linux/generic/pending-4.19/655-increase_skb_pad.patch b/target/linux/generic/pending-4.19/655-increase_skb_pad.patch deleted file mode 100644 index 20b0fd894f..0000000000 --- a/target/linux/generic/pending-4.19/655-increase_skb_pad.patch +++ /dev/null @@ -1,20 +0,0 @@ -From: Felix Fietkau -Subject: kernel: add a few patches for avoiding unnecessary skb reallocations - significantly improves ethernet<->wireless performance - -lede-commit: 6f89cffc9add6939d44a6b54cf9a5e77849aa7fd -Signed-off-by: Felix Fietkau ---- - include/linux/skbuff.h | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - ---- a/include/linux/skbuff.h -+++ b/include/linux/skbuff.h -@@ -2491,7 +2491,7 @@ static inline int pskb_network_may_pull( - * NET_IP_ALIGN(2) + ethernet_header(14) + IP_header(20/40) + ports(8) - */ - #ifndef NET_SKB_PAD --#define NET_SKB_PAD max(32, L1_CACHE_BYTES) -+#define NET_SKB_PAD max(64, L1_CACHE_BYTES) - #endif - - int ___pskb_trim(struct sk_buff *skb, unsigned int len); diff --git a/target/linux/generic/pending-4.19/666-Add-support-for-MAP-E-FMRs-mesh-mode.patch b/target/linux/generic/pending-4.19/666-Add-support-for-MAP-E-FMRs-mesh-mode.patch deleted file mode 100644 index e21f510fee..0000000000 --- a/target/linux/generic/pending-4.19/666-Add-support-for-MAP-E-FMRs-mesh-mode.patch +++ /dev/null @@ -1,500 +0,0 @@ -From: Steven Barth -Subject: Add support for MAP-E FMRs (mesh mode) - -MAP-E FMRs (draft-ietf-softwire-map-10) are rules for IPv4-communication -between MAP CEs (mesh mode) without the need to forward such data to a -border relay. This is similar to how 6rd works but for IPv4 over IPv6. - -Signed-off-by: Steven Barth ---- - include/net/ip6_tunnel.h | 13 ++ - include/uapi/linux/if_tunnel.h | 13 ++ - net/ipv6/ip6_tunnel.c | 276 +++++++++++++++++++++++++++++++++++++++-- - 3 files changed, 291 insertions(+), 11 deletions(-) - ---- a/include/net/ip6_tunnel.h -+++ b/include/net/ip6_tunnel.h -@@ -18,6 +18,18 @@ - /* determine capability on a per-packet basis */ - #define IP6_TNL_F_CAP_PER_PACKET 0x40000 - -+/* IPv6 tunnel FMR */ -+struct __ip6_tnl_fmr { -+ struct __ip6_tnl_fmr *next; /* next fmr in list */ -+ struct in6_addr ip6_prefix; -+ struct in_addr ip4_prefix; -+ -+ __u8 ip6_prefix_len; -+ __u8 ip4_prefix_len; -+ __u8 ea_len; -+ __u8 offset; -+}; -+ - struct __ip6_tnl_parm { - char name[IFNAMSIZ]; /* name of tunnel device */ - int link; /* ifindex of underlying L2 interface */ -@@ -29,6 +41,7 @@ struct __ip6_tnl_parm { - __u32 flags; /* tunnel flags */ - struct in6_addr laddr; /* local tunnel end-point address */ - struct in6_addr raddr; /* remote tunnel end-point address */ -+ struct __ip6_tnl_fmr *fmrs; /* FMRs */ - - __be16 i_flags; - __be16 o_flags; ---- a/include/uapi/linux/if_tunnel.h -+++ b/include/uapi/linux/if_tunnel.h -@@ -77,10 +77,23 @@ enum { - IFLA_IPTUN_ENCAP_DPORT, - IFLA_IPTUN_COLLECT_METADATA, - IFLA_IPTUN_FWMARK, -+ IFLA_IPTUN_FMRS, - __IFLA_IPTUN_MAX, - }; - #define IFLA_IPTUN_MAX (__IFLA_IPTUN_MAX - 1) - -+enum { -+ IFLA_IPTUN_FMR_UNSPEC, -+ IFLA_IPTUN_FMR_IP6_PREFIX, -+ IFLA_IPTUN_FMR_IP4_PREFIX, -+ IFLA_IPTUN_FMR_IP6_PREFIX_LEN, -+ IFLA_IPTUN_FMR_IP4_PREFIX_LEN, -+ IFLA_IPTUN_FMR_EA_LEN, -+ IFLA_IPTUN_FMR_OFFSET, -+ __IFLA_IPTUN_FMR_MAX, -+}; -+#define IFLA_IPTUN_FMR_MAX (__IFLA_IPTUN_FMR_MAX - 1) -+ - enum tunnel_encap_types { - TUNNEL_ENCAP_NONE, - TUNNEL_ENCAP_FOU, ---- a/net/ipv6/ip6_tunnel.c -+++ b/net/ipv6/ip6_tunnel.c -@@ -16,6 +16,8 @@ - * as published by the Free Software Foundation; either version - * 2 of the License, or (at your option) any later version. - * -+ * Changes: -+ * Steven Barth : MAP-E FMR support - */ - - #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt -@@ -72,9 +74,9 @@ static bool log_ecn_error = true; - module_param(log_ecn_error, bool, 0644); - MODULE_PARM_DESC(log_ecn_error, "Log packets received with corrupted ECN"); - --static u32 HASH(const struct in6_addr *addr1, const struct in6_addr *addr2) -+static u32 HASH(const struct in6_addr *addr) - { -- u32 hash = ipv6_addr_hash(addr1) ^ ipv6_addr_hash(addr2); -+ u32 hash = ipv6_addr_hash(addr); - - return hash_32(hash, IP6_TUNNEL_HASH_SIZE_SHIFT); - } -@@ -141,20 +143,29 @@ static struct net_device_stats *ip6_get_ - static struct ip6_tnl * - ip6_tnl_lookup(struct net *net, const struct in6_addr *remote, const struct in6_addr *local) - { -- unsigned int hash = HASH(remote, local); -+ unsigned int hash = HASH(local); - struct ip6_tnl *t; - struct ip6_tnl_net *ip6n = net_generic(net, ip6_tnl_net_id); - struct in6_addr any; -+ struct __ip6_tnl_fmr *fmr; - - for_each_ip6_tunnel_rcu(ip6n->tnls_r_l[hash]) { -- if (ipv6_addr_equal(local, &t->parms.laddr) && -- ipv6_addr_equal(remote, &t->parms.raddr) && -- (t->dev->flags & IFF_UP)) -+ if (!ipv6_addr_equal(local, &t->parms.laddr) || -+ !(t->dev->flags & IFF_UP)) -+ continue; -+ -+ if (ipv6_addr_equal(remote, &t->parms.raddr)) - return t; -+ -+ for (fmr = t->parms.fmrs; fmr; fmr = fmr->next) { -+ if (ipv6_prefix_equal(remote, &fmr->ip6_prefix, -+ fmr->ip6_prefix_len)) -+ return t; -+ } - } - - memset(&any, 0, sizeof(any)); -- hash = HASH(&any, local); -+ hash = HASH(local); - for_each_ip6_tunnel_rcu(ip6n->tnls_r_l[hash]) { - if (ipv6_addr_equal(local, &t->parms.laddr) && - ipv6_addr_any(&t->parms.raddr) && -@@ -162,7 +173,7 @@ ip6_tnl_lookup(struct net *net, const st - return t; - } - -- hash = HASH(remote, &any); -+ hash = HASH(&any); - for_each_ip6_tunnel_rcu(ip6n->tnls_r_l[hash]) { - if (ipv6_addr_equal(remote, &t->parms.raddr) && - ipv6_addr_any(&t->parms.laddr) && -@@ -202,7 +213,7 @@ ip6_tnl_bucket(struct ip6_tnl_net *ip6n, - - if (!ipv6_addr_any(remote) || !ipv6_addr_any(local)) { - prio = 1; -- h = HASH(remote, local); -+ h = HASH(local); - } - return &ip6n->tnls[prio][h]; - } -@@ -383,6 +394,12 @@ ip6_tnl_dev_uninit(struct net_device *de - struct net *net = t->net; - struct ip6_tnl_net *ip6n = net_generic(net, ip6_tnl_net_id); - -+ while (t->parms.fmrs) { -+ struct __ip6_tnl_fmr *next = t->parms.fmrs->next; -+ kfree(t->parms.fmrs); -+ t->parms.fmrs = next; -+ } -+ - if (dev == ip6n->fb_tnl_dev) - RCU_INIT_POINTER(ip6n->tnls_wc[0], NULL); - else -@@ -772,6 +789,107 @@ int ip6_tnl_rcv_ctl(struct ip6_tnl *t, - } - EXPORT_SYMBOL_GPL(ip6_tnl_rcv_ctl); - -+/** -+ * ip4ip6_fmr_calc - calculate target / source IPv6-address based on FMR -+ * @dest: destination IPv6 address buffer -+ * @skb: received socket buffer -+ * @fmr: MAP FMR -+ * @xmit: Calculate for xmit or rcv -+ **/ -+static void ip4ip6_fmr_calc(struct in6_addr *dest, -+ const struct iphdr *iph, const uint8_t *end, -+ const struct __ip6_tnl_fmr *fmr, bool xmit) -+{ -+ int psidlen = fmr->ea_len - (32 - fmr->ip4_prefix_len); -+ u8 *portp = NULL; -+ bool use_dest_addr; -+ const struct iphdr *dsth = iph; -+ -+ if ((u8*)dsth >= end) -+ return; -+ -+ /* find significant IP header */ -+ if (iph->protocol == IPPROTO_ICMP) { -+ struct icmphdr *ih = (struct icmphdr*)(((u8*)dsth) + dsth->ihl * 4); -+ if (ih && ((u8*)&ih[1]) <= end && ( -+ ih->type == ICMP_DEST_UNREACH || -+ ih->type == ICMP_SOURCE_QUENCH || -+ ih->type == ICMP_TIME_EXCEEDED || -+ ih->type == ICMP_PARAMETERPROB || -+ ih->type == ICMP_REDIRECT)) -+ dsth = (const struct iphdr*)&ih[1]; -+ } -+ -+ /* in xmit-path use dest port by default and source port only if -+ this is an ICMP reply to something else; vice versa in rcv-path */ -+ use_dest_addr = (xmit && dsth == iph) || (!xmit && dsth != iph); -+ -+ /* get dst port */ -+ if (((u8*)&dsth[1]) <= end && ( -+ dsth->protocol == IPPROTO_UDP || -+ dsth->protocol == IPPROTO_TCP || -+ dsth->protocol == IPPROTO_SCTP || -+ dsth->protocol == IPPROTO_DCCP)) { -+ /* for UDP, TCP, SCTP and DCCP source and dest port -+ follow IPv4 header directly */ -+ portp = ((u8*)dsth) + dsth->ihl * 4; -+ -+ if (use_dest_addr) -+ portp += sizeof(u16); -+ } else if (iph->protocol == IPPROTO_ICMP) { -+ struct icmphdr *ih = (struct icmphdr*)(((u8*)dsth) + dsth->ihl * 4); -+ -+ /* use icmp identifier as port */ -+ if (((u8*)&ih) <= end && ( -+ (use_dest_addr && ( -+ ih->type == ICMP_ECHOREPLY || -+ ih->type == ICMP_TIMESTAMPREPLY || -+ ih->type == ICMP_INFO_REPLY || -+ ih->type == ICMP_ADDRESSREPLY)) || -+ (!use_dest_addr && ( -+ ih->type == ICMP_ECHO || -+ ih->type == ICMP_TIMESTAMP || -+ ih->type == ICMP_INFO_REQUEST || -+ ih->type == ICMP_ADDRESS) -+ ))) -+ portp = (u8*)&ih->un.echo.id; -+ } -+ -+ if ((portp && &portp[2] <= end) || psidlen == 0) { -+ int frombyte = fmr->ip6_prefix_len / 8; -+ int fromrem = fmr->ip6_prefix_len % 8; -+ int bytes = sizeof(struct in6_addr) - frombyte; -+ const u32 *addr = (use_dest_addr) ? &iph->daddr : &iph->saddr; -+ u64 eabits = ((u64)ntohl(*addr)) << (32 + fmr->ip4_prefix_len); -+ u64 t = 0; -+ -+ /* extract PSID from port and add it to eabits */ -+ u16 psidbits = 0; -+ if (psidlen > 0) { -+ psidbits = ((u16)portp[0]) << 8 | ((u16)portp[1]); -+ psidbits >>= 16 - psidlen - fmr->offset; -+ psidbits = (u16)(psidbits << (16 - psidlen)); -+ eabits |= ((u64)psidbits) << (48 - (fmr->ea_len - psidlen)); -+ } -+ -+ /* rewrite destination address */ -+ *dest = fmr->ip6_prefix; -+ memcpy(&dest->s6_addr[10], addr, sizeof(*addr)); -+ dest->s6_addr16[7] = htons(psidbits >> (16 - psidlen)); -+ -+ if (bytes > sizeof(u64)) -+ bytes = sizeof(u64); -+ -+ /* insert eabits */ -+ memcpy(&t, &dest->s6_addr[frombyte], bytes); -+ t = be64_to_cpu(t) & ~(((((u64)1) << fmr->ea_len) - 1) -+ << (64 - fmr->ea_len - fromrem)); -+ t = cpu_to_be64(t | (eabits >> fromrem)); -+ memcpy(&dest->s6_addr[frombyte], &t, bytes); -+ } -+} -+ -+ - static int __ip6_tnl_rcv(struct ip6_tnl *tunnel, struct sk_buff *skb, - const struct tnl_ptk_info *tpi, - struct metadata_dst *tun_dst, -@@ -824,6 +942,27 @@ static int __ip6_tnl_rcv(struct ip6_tnl - skb_reset_network_header(skb); - memset(skb->cb, 0, sizeof(struct inet6_skb_parm)); - -+ if (tpi->proto == htons(ETH_P_IP) && tunnel->parms.fmrs && -+ !ipv6_addr_equal(&ipv6h->saddr, &tunnel->parms.raddr)) { -+ /* Packet didn't come from BR, so lookup FMR */ -+ struct __ip6_tnl_fmr *fmr; -+ struct in6_addr expected = tunnel->parms.raddr; -+ for (fmr = tunnel->parms.fmrs; fmr; fmr = fmr->next) -+ if (ipv6_prefix_equal(&ipv6h->saddr, -+ &fmr->ip6_prefix, fmr->ip6_prefix_len)) -+ break; -+ -+ /* Check that IPv6 matches IPv4 source to prevent spoofing */ -+ if (fmr) -+ ip4ip6_fmr_calc(&expected, ip_hdr(skb), -+ skb_tail_pointer(skb), fmr, false); -+ -+ if (!ipv6_addr_equal(&ipv6h->saddr, &expected)) { -+ rcu_read_unlock(); -+ goto drop; -+ } -+ } -+ - __skb_tunnel_rx(skb, tunnel->dev, tunnel->net); - - err = dscp_ecn_decapsulate(tunnel, ipv6h, skb); -@@ -956,6 +1095,7 @@ static void init_tel_txopt(struct ipv6_t - opt->ops.opt_nflen = 8; - } - -+ - /** - * ip6_tnl_addr_conflict - compare packet addresses to tunnel's own - * @t: the outgoing tunnel device -@@ -1309,6 +1449,7 @@ ip6ip6_tnl_xmit(struct sk_buff *skb, str - { - struct ip6_tnl *t = netdev_priv(dev); - struct ipv6hdr *ipv6h; -+ struct __ip6_tnl_fmr *fmr; - int encap_limit = -1; - __u16 offset; - struct flowi6 fl6; -@@ -1373,6 +1514,18 @@ ip6ip6_tnl_xmit(struct sk_buff *skb, str - - fl6.flowi6_uid = sock_net_uid(dev_net(dev), NULL); - -+ /* try to find matching FMR */ -+ for (fmr = t->parms.fmrs; fmr; fmr = fmr->next) { -+ unsigned mshift = 32 - fmr->ip4_prefix_len; -+ if (ntohl(fmr->ip4_prefix.s_addr) >> mshift == -+ ntohl(ip_hdr(skb)->daddr) >> mshift) -+ break; -+ } -+ -+ /* change dstaddr according to FMR */ -+ if (fmr) -+ ip4ip6_fmr_calc(&fl6.daddr, ip_hdr(skb), skb_tail_pointer(skb), fmr, true); -+ - if (iptunnel_handle_offloads(skb, SKB_GSO_IPXIP6)) - return -1; - -@@ -1504,6 +1657,14 @@ ip6_tnl_change(struct ip6_tnl *t, const - t->parms.link = p->link; - t->parms.proto = p->proto; - t->parms.fwmark = p->fwmark; -+ -+ while (t->parms.fmrs) { -+ struct __ip6_tnl_fmr *next = t->parms.fmrs->next; -+ kfree(t->parms.fmrs); -+ t->parms.fmrs = next; -+ } -+ t->parms.fmrs = p->fmrs; -+ - dst_cache_reset(&t->dst_cache); - ip6_tnl_link_config(t); - return 0; -@@ -1542,6 +1703,7 @@ ip6_tnl_parm_from_user(struct __ip6_tnl_ - p->flowinfo = u->flowinfo; - p->link = u->link; - p->proto = u->proto; -+ p->fmrs = NULL; - memcpy(p->name, u->name, sizeof(u->name)); - } - -@@ -1928,6 +2090,15 @@ static int ip6_tnl_validate(struct nlatt - return 0; - } - -+static const struct nla_policy ip6_tnl_fmr_policy[IFLA_IPTUN_FMR_MAX + 1] = { -+ [IFLA_IPTUN_FMR_IP6_PREFIX] = { .len = sizeof(struct in6_addr) }, -+ [IFLA_IPTUN_FMR_IP4_PREFIX] = { .len = sizeof(struct in_addr) }, -+ [IFLA_IPTUN_FMR_IP6_PREFIX_LEN] = { .type = NLA_U8 }, -+ [IFLA_IPTUN_FMR_IP4_PREFIX_LEN] = { .type = NLA_U8 }, -+ [IFLA_IPTUN_FMR_EA_LEN] = { .type = NLA_U8 }, -+ [IFLA_IPTUN_FMR_OFFSET] = { .type = NLA_U8 } -+}; -+ - static void ip6_tnl_netlink_parms(struct nlattr *data[], - struct __ip6_tnl_parm *parms) - { -@@ -1965,6 +2136,46 @@ static void ip6_tnl_netlink_parms(struct - - if (data[IFLA_IPTUN_FWMARK]) - parms->fwmark = nla_get_u32(data[IFLA_IPTUN_FWMARK]); -+ -+ if (data[IFLA_IPTUN_FMRS]) { -+ unsigned rem; -+ struct nlattr *fmr; -+ nla_for_each_nested(fmr, data[IFLA_IPTUN_FMRS], rem) { -+ struct nlattr *fmrd[IFLA_IPTUN_FMR_MAX + 1], *c; -+ struct __ip6_tnl_fmr *nfmr; -+ -+ nla_parse_nested(fmrd, IFLA_IPTUN_FMR_MAX, -+ fmr, ip6_tnl_fmr_policy, NULL); -+ -+ if (!(nfmr = kzalloc(sizeof(*nfmr), GFP_KERNEL))) -+ continue; -+ -+ nfmr->offset = 6; -+ -+ if ((c = fmrd[IFLA_IPTUN_FMR_IP6_PREFIX])) -+ nla_memcpy(&nfmr->ip6_prefix, fmrd[IFLA_IPTUN_FMR_IP6_PREFIX], -+ sizeof(nfmr->ip6_prefix)); -+ -+ if ((c = fmrd[IFLA_IPTUN_FMR_IP4_PREFIX])) -+ nla_memcpy(&nfmr->ip4_prefix, fmrd[IFLA_IPTUN_FMR_IP4_PREFIX], -+ sizeof(nfmr->ip4_prefix)); -+ -+ if ((c = fmrd[IFLA_IPTUN_FMR_IP6_PREFIX_LEN])) -+ nfmr->ip6_prefix_len = nla_get_u8(c); -+ -+ if ((c = fmrd[IFLA_IPTUN_FMR_IP4_PREFIX_LEN])) -+ nfmr->ip4_prefix_len = nla_get_u8(c); -+ -+ if ((c = fmrd[IFLA_IPTUN_FMR_EA_LEN])) -+ nfmr->ea_len = nla_get_u8(c); -+ -+ if ((c = fmrd[IFLA_IPTUN_FMR_OFFSET])) -+ nfmr->offset = nla_get_u8(c); -+ -+ nfmr->next = parms->fmrs; -+ parms->fmrs = nfmr; -+ } -+ } - } - - static bool ip6_tnl_netlink_encap_parms(struct nlattr *data[], -@@ -2080,6 +2291,12 @@ static void ip6_tnl_dellink(struct net_d - - static size_t ip6_tnl_get_size(const struct net_device *dev) - { -+ const struct ip6_tnl *t = netdev_priv(dev); -+ struct __ip6_tnl_fmr *c; -+ int fmrs = 0; -+ for (c = t->parms.fmrs; c; c = c->next) -+ ++fmrs; -+ - return - /* IFLA_IPTUN_LINK */ - nla_total_size(4) + -@@ -2109,6 +2326,24 @@ static size_t ip6_tnl_get_size(const str - nla_total_size(0) + - /* IFLA_IPTUN_FWMARK */ - nla_total_size(4) + -+ /* IFLA_IPTUN_FMRS */ -+ nla_total_size(0) + -+ ( -+ /* nest */ -+ nla_total_size(0) + -+ /* IFLA_IPTUN_FMR_IP6_PREFIX */ -+ nla_total_size(sizeof(struct in6_addr)) + -+ /* IFLA_IPTUN_FMR_IP4_PREFIX */ -+ nla_total_size(sizeof(struct in_addr)) + -+ /* IFLA_IPTUN_FMR_EA_LEN */ -+ nla_total_size(1) + -+ /* IFLA_IPTUN_FMR_IP6_PREFIX_LEN */ -+ nla_total_size(1) + -+ /* IFLA_IPTUN_FMR_IP4_PREFIX_LEN */ -+ nla_total_size(1) + -+ /* IFLA_IPTUN_FMR_OFFSET */ -+ nla_total_size(1) -+ ) * fmrs + - 0; - } - -@@ -2116,6 +2351,9 @@ static int ip6_tnl_fill_info(struct sk_b - { - struct ip6_tnl *tunnel = netdev_priv(dev); - struct __ip6_tnl_parm *parm = &tunnel->parms; -+ struct __ip6_tnl_fmr *c; -+ int fmrcnt = 0; -+ struct nlattr *fmrs; - - if (nla_put_u32(skb, IFLA_IPTUN_LINK, parm->link) || - nla_put_in6_addr(skb, IFLA_IPTUN_LOCAL, &parm->laddr) || -@@ -2125,9 +2363,27 @@ static int ip6_tnl_fill_info(struct sk_b - nla_put_be32(skb, IFLA_IPTUN_FLOWINFO, parm->flowinfo) || - nla_put_u32(skb, IFLA_IPTUN_FLAGS, parm->flags) || - nla_put_u8(skb, IFLA_IPTUN_PROTO, parm->proto) || -- nla_put_u32(skb, IFLA_IPTUN_FWMARK, parm->fwmark)) -+ nla_put_u32(skb, IFLA_IPTUN_FWMARK, parm->fwmark) || -+ !(fmrs = nla_nest_start(skb, IFLA_IPTUN_FMRS))) - goto nla_put_failure; - -+ for (c = parm->fmrs; c; c = c->next) { -+ struct nlattr *fmr = nla_nest_start(skb, ++fmrcnt); -+ if (!fmr || -+ nla_put(skb, IFLA_IPTUN_FMR_IP6_PREFIX, -+ sizeof(c->ip6_prefix), &c->ip6_prefix) || -+ nla_put(skb, IFLA_IPTUN_FMR_IP4_PREFIX, -+ sizeof(c->ip4_prefix), &c->ip4_prefix) || -+ nla_put_u8(skb, IFLA_IPTUN_FMR_IP6_PREFIX_LEN, c->ip6_prefix_len) || -+ nla_put_u8(skb, IFLA_IPTUN_FMR_IP4_PREFIX_LEN, c->ip4_prefix_len) || -+ nla_put_u8(skb, IFLA_IPTUN_FMR_EA_LEN, c->ea_len) || -+ nla_put_u8(skb, IFLA_IPTUN_FMR_OFFSET, c->offset)) -+ goto nla_put_failure; -+ -+ nla_nest_end(skb, fmr); -+ } -+ nla_nest_end(skb, fmrs); -+ - if (nla_put_u16(skb, IFLA_IPTUN_ENCAP_TYPE, tunnel->encap.type) || - nla_put_be16(skb, IFLA_IPTUN_ENCAP_SPORT, tunnel->encap.sport) || - nla_put_be16(skb, IFLA_IPTUN_ENCAP_DPORT, tunnel->encap.dport) || -@@ -2167,6 +2423,7 @@ static const struct nla_policy ip6_tnl_p - [IFLA_IPTUN_ENCAP_DPORT] = { .type = NLA_U16 }, - [IFLA_IPTUN_COLLECT_METADATA] = { .type = NLA_FLAG }, - [IFLA_IPTUN_FWMARK] = { .type = NLA_U32 }, -+ [IFLA_IPTUN_FMRS] = { .type = NLA_NESTED }, - }; - - static struct rtnl_link_ops ip6_link_ops __read_mostly = { diff --git a/target/linux/generic/pending-4.19/670-ipv6-allow-rejecting-with-source-address-failed-policy.patch b/target/linux/generic/pending-4.19/670-ipv6-allow-rejecting-with-source-address-failed-policy.patch deleted file mode 100644 index c664cb2b25..0000000000 --- a/target/linux/generic/pending-4.19/670-ipv6-allow-rejecting-with-source-address-failed-policy.patch +++ /dev/null @@ -1,247 +0,0 @@ -From: Jonas Gorski -Subject: ipv6: allow rejecting with "source address failed policy" - -RFC6204 L-14 requires rejecting traffic from invalid addresses with -ICMPv6 Destination Unreachable, Code 5 (Source address failed ingress/ -egress policy) on the LAN side, so add an appropriate rule for that. - -Signed-off-by: Jonas Gorski ---- - include/net/netns/ipv6.h | 1 + - include/uapi/linux/fib_rules.h | 4 +++ - include/uapi/linux/rtnetlink.h | 1 + - net/ipv4/fib_semantics.c | 4 +++ - net/ipv4/fib_trie.c | 1 + - net/ipv4/ipmr.c | 1 + - net/ipv6/fib6_rules.c | 4 +++ - net/ipv6/ip6mr.c | 2 ++ - net/ipv6/route.c | 58 +++++++++++++++++++++++++++++++++++++++++- - 9 files changed, 75 insertions(+), 1 deletion(-) - ---- a/include/net/netns/ipv6.h -+++ b/include/net/netns/ipv6.h -@@ -78,6 +78,7 @@ struct netns_ipv6 { - unsigned int fib6_rules_require_fldissect; - bool fib6_has_custom_rules; - struct rt6_info *ip6_prohibit_entry; -+ struct rt6_info *ip6_policy_failed_entry; - struct rt6_info *ip6_blk_hole_entry; - struct fib6_table *fib6_local_tbl; - struct fib_rules_ops *fib6_rules_ops; ---- a/include/uapi/linux/fib_rules.h -+++ b/include/uapi/linux/fib_rules.h -@@ -82,6 +82,10 @@ enum { - FR_ACT_BLACKHOLE, /* Drop without notification */ - FR_ACT_UNREACHABLE, /* Drop with ENETUNREACH */ - FR_ACT_PROHIBIT, /* Drop with EACCES */ -+ FR_ACT_RES9, -+ FR_ACT_RES10, -+ FR_ACT_RES11, -+ FR_ACT_POLICY_FAILED, /* Drop with EACCES */ - __FR_ACT_MAX, - }; - ---- a/include/uapi/linux/rtnetlink.h -+++ b/include/uapi/linux/rtnetlink.h -@@ -228,6 +228,7 @@ enum { - RTN_THROW, /* Not in this table */ - RTN_NAT, /* Translate this address */ - RTN_XRESOLVE, /* Use external resolver */ -+ RTN_POLICY_FAILED, /* Failed ingress/egress policy */ - __RTN_MAX - }; - ---- a/net/ipv4/fib_semantics.c -+++ b/net/ipv4/fib_semantics.c -@@ -139,6 +139,10 @@ const struct fib_prop fib_props[RTN_MAX - .error = -EINVAL, - .scope = RT_SCOPE_NOWHERE, - }, -+ [RTN_POLICY_FAILED] = { -+ .error = -EACCES, -+ .scope = RT_SCOPE_UNIVERSE, -+ }, - }; - - static void rt_fibinfo_free(struct rtable __rcu **rtp) ---- a/net/ipv4/fib_trie.c -+++ b/net/ipv4/fib_trie.c -@@ -2474,6 +2474,7 @@ static const char *const rtn_type_names[ - [RTN_THROW] = "THROW", - [RTN_NAT] = "NAT", - [RTN_XRESOLVE] = "XRESOLVE", -+ [RTN_POLICY_FAILED] = "POLICY_FAILED", - }; - - static inline const char *rtn_type(char *buf, size_t len, unsigned int t) ---- a/net/ipv4/ipmr.c -+++ b/net/ipv4/ipmr.c -@@ -179,6 +179,7 @@ static int ipmr_rule_action(struct fib_r - case FR_ACT_UNREACHABLE: - return -ENETUNREACH; - case FR_ACT_PROHIBIT: -+ case FR_ACT_POLICY_FAILED: - return -EACCES; - case FR_ACT_BLACKHOLE: - default: ---- a/net/ipv6/fib6_rules.c -+++ b/net/ipv6/fib6_rules.c -@@ -221,6 +221,10 @@ static int __fib6_rule_action(struct fib - err = -EACCES; - rt = net->ipv6.ip6_prohibit_entry; - goto discard_pkt; -+ case FR_ACT_POLICY_FAILED: -+ err = -EACCES; -+ rt = net->ipv6.ip6_policy_failed_entry; -+ goto discard_pkt; - } - - tb_id = fib_rule_get_table(rule, arg); ---- a/net/ipv6/ip6mr.c -+++ b/net/ipv6/ip6mr.c -@@ -162,6 +162,8 @@ static int ip6mr_rule_action(struct fib_ - return -ENETUNREACH; - case FR_ACT_PROHIBIT: - return -EACCES; -+ case FR_ACT_POLICY_FAILED: -+ return -EACCES; - case FR_ACT_BLACKHOLE: - default: - return -EINVAL; ---- a/net/ipv6/route.c -+++ b/net/ipv6/route.c -@@ -97,6 +97,8 @@ static int ip6_pkt_discard(struct sk_bu - static int ip6_pkt_discard_out(struct net *net, struct sock *sk, struct sk_buff *skb); - static int ip6_pkt_prohibit(struct sk_buff *skb); - static int ip6_pkt_prohibit_out(struct net *net, struct sock *sk, struct sk_buff *skb); -+static int ip6_pkt_policy_failed(struct sk_buff *skb); -+static int ip6_pkt_policy_failed_out(struct net *net, struct sock *sk, struct sk_buff *skb); - static void ip6_link_failure(struct sk_buff *skb); - static void ip6_rt_update_pmtu(struct dst_entry *dst, struct sock *sk, - struct sk_buff *skb, u32 mtu); -@@ -326,6 +328,18 @@ static const struct rt6_info ip6_prohibi - .rt6i_flags = (RTF_REJECT | RTF_NONEXTHOP), - }; - -+static const struct rt6_info ip6_policy_failed_entry_template = { -+ .dst = { -+ .__refcnt = ATOMIC_INIT(1), -+ .__use = 1, -+ .obsolete = DST_OBSOLETE_FORCE_CHK, -+ .error = -EACCES, -+ .input = ip6_pkt_policy_failed, -+ .output = ip6_pkt_policy_failed_out, -+ }, -+ .rt6i_flags = (RTF_REJECT | RTF_NONEXTHOP), -+}; -+ - static const struct rt6_info ip6_blk_hole_entry_template = { - .dst = { - .__refcnt = ATOMIC_INIT(1), -@@ -903,6 +917,7 @@ static const int fib6_prop[RTN_MAX + 1] - [RTN_BLACKHOLE] = -EINVAL, - [RTN_UNREACHABLE] = -EHOSTUNREACH, - [RTN_PROHIBIT] = -EACCES, -+ [RTN_POLICY_FAILED] = -EACCES, - [RTN_THROW] = -EAGAIN, - [RTN_NAT] = -EINVAL, - [RTN_XRESOLVE] = -EINVAL, -@@ -940,6 +955,10 @@ static void ip6_rt_init_dst_reject(struc - rt->dst.output = ip6_pkt_prohibit_out; - rt->dst.input = ip6_pkt_prohibit; - break; -+ case RTN_POLICY_FAILED: -+ rt->dst.output = ip6_pkt_policy_failed_out; -+ rt->dst.input = ip6_pkt_policy_failed; -+ break; - case RTN_THROW: - case RTN_UNREACHABLE: - default: -@@ -3747,6 +3766,17 @@ static int ip6_pkt_prohibit_out(struct n - return ip6_pkt_drop(skb, ICMPV6_ADM_PROHIBITED, IPSTATS_MIB_OUTNOROUTES); - } - -+static int ip6_pkt_policy_failed(struct sk_buff *skb) -+{ -+ return ip6_pkt_drop(skb, ICMPV6_POLICY_FAIL, IPSTATS_MIB_INNOROUTES); -+} -+ -+static int ip6_pkt_policy_failed_out(struct net *net, struct sock *sk, struct sk_buff *skb) -+{ -+ skb->dev = skb_dst(skb)->dev; -+ return ip6_pkt_drop(skb, ICMPV6_POLICY_FAIL, IPSTATS_MIB_OUTNOROUTES); -+} -+ - /* - * Allocate a dst for local (unicast / anycast) address. - */ -@@ -4194,7 +4224,8 @@ static int rtm_to_fib6_config(struct sk_ - if (rtm->rtm_type == RTN_UNREACHABLE || - rtm->rtm_type == RTN_BLACKHOLE || - rtm->rtm_type == RTN_PROHIBIT || -- rtm->rtm_type == RTN_THROW) -+ rtm->rtm_type == RTN_THROW || -+ rtm->rtm_type == RTN_POLICY_FAILED) - cfg->fc_flags |= RTF_REJECT; - - if (rtm->rtm_type == RTN_LOCAL) -@@ -5033,6 +5064,8 @@ static int ip6_route_dev_notify(struct n - #ifdef CONFIG_IPV6_MULTIPLE_TABLES - net->ipv6.ip6_prohibit_entry->dst.dev = dev; - net->ipv6.ip6_prohibit_entry->rt6i_idev = in6_dev_get(dev); -+ net->ipv6.ip6_policy_failed_entry->dst.dev = dev; -+ net->ipv6.ip6_policy_failed_entry->rt6i_idev = in6_dev_get(dev); - net->ipv6.ip6_blk_hole_entry->dst.dev = dev; - net->ipv6.ip6_blk_hole_entry->rt6i_idev = in6_dev_get(dev); - #endif -@@ -5044,6 +5077,7 @@ static int ip6_route_dev_notify(struct n - in6_dev_put_clear(&net->ipv6.ip6_null_entry->rt6i_idev); - #ifdef CONFIG_IPV6_MULTIPLE_TABLES - in6_dev_put_clear(&net->ipv6.ip6_prohibit_entry->rt6i_idev); -+ in6_dev_put_clear(&net->ipv6.ip6_policy_failed_entry->rt6i_idev); - in6_dev_put_clear(&net->ipv6.ip6_blk_hole_entry->rt6i_idev); - #endif - } -@@ -5238,6 +5272,15 @@ static int __net_init ip6_route_net_init - net->ipv6.ip6_blk_hole_entry->dst.ops = &net->ipv6.ip6_dst_ops; - dst_init_metrics(&net->ipv6.ip6_blk_hole_entry->dst, - ip6_template_metrics, true); -+ -+ net->ipv6.ip6_policy_failed_entry = -+ kmemdup(&ip6_policy_failed_entry_template, -+ sizeof(*net->ipv6.ip6_policy_failed_entry), GFP_KERNEL); -+ if (!net->ipv6.ip6_policy_failed_entry) -+ goto out_ip6_blk_hole_entry; -+ net->ipv6.ip6_policy_failed_entry->dst.ops = &net->ipv6.ip6_dst_ops; -+ dst_init_metrics(&net->ipv6.ip6_policy_failed_entry->dst, -+ ip6_template_metrics, true); - #endif - - net->ipv6.sysctl.flush_delay = 0; -@@ -5256,6 +5299,8 @@ out: - return ret; - - #ifdef CONFIG_IPV6_MULTIPLE_TABLES -+out_ip6_blk_hole_entry: -+ kfree(net->ipv6.ip6_blk_hole_entry); - out_ip6_prohibit_entry: - kfree(net->ipv6.ip6_prohibit_entry); - out_ip6_null_entry: -@@ -5276,6 +5321,7 @@ static void __net_exit ip6_route_net_exi - #ifdef CONFIG_IPV6_MULTIPLE_TABLES - kfree(net->ipv6.ip6_prohibit_entry); - kfree(net->ipv6.ip6_blk_hole_entry); -+ kfree(net->ipv6.ip6_policy_failed_entry); - #endif - dst_entries_destroy(&net->ipv6.ip6_dst_ops); - } -@@ -5352,6 +5398,9 @@ void __init ip6_route_init_special_entri - init_net.ipv6.ip6_prohibit_entry->rt6i_idev = in6_dev_get(init_net.loopback_dev); - init_net.ipv6.ip6_blk_hole_entry->dst.dev = init_net.loopback_dev; - init_net.ipv6.ip6_blk_hole_entry->rt6i_idev = in6_dev_get(init_net.loopback_dev); -+ init_net.ipv6.ip6_policy_failed_entry->dst.dev = init_net.loopback_dev; -+ init_net.ipv6.ip6_policy_failed_entry->rt6i_idev = -+ in6_dev_get(init_net.loopback_dev); - #endif - } - diff --git a/target/linux/generic/pending-4.19/671-net-provide-defines-for-_POLICY_FAILED-until-all-cod.patch b/target/linux/generic/pending-4.19/671-net-provide-defines-for-_POLICY_FAILED-until-all-cod.patch deleted file mode 100644 index 85adfedc94..0000000000 --- a/target/linux/generic/pending-4.19/671-net-provide-defines-for-_POLICY_FAILED-until-all-cod.patch +++ /dev/null @@ -1,50 +0,0 @@ -From: Jonas Gorski -Subject: net: provide defines for _POLICY_FAILED until all code is updated - -Upstream introduced ICMPV6_POLICY_FAIL for code 5 of destination -unreachable, conflicting with our name. - -Add appropriate defines to allow our code to build with the new -name until we have updated our local patches for older kernels -and userspace packages. - -Signed-off-by: Jonas Gorski ---- - include/uapi/linux/fib_rules.h | 2 ++ - include/uapi/linux/icmpv6.h | 2 ++ - include/uapi/linux/rtnetlink.h | 2 ++ - 3 files changed, 6 insertions(+) - ---- a/include/uapi/linux/fib_rules.h -+++ b/include/uapi/linux/fib_rules.h -@@ -89,6 +89,8 @@ enum { - __FR_ACT_MAX, - }; - -+#define FR_ACT_FAILED_POLICY FR_ACT_POLICY_FAILED -+ - #define FR_ACT_MAX (__FR_ACT_MAX - 1) - - #endif ---- a/include/uapi/linux/icmpv6.h -+++ b/include/uapi/linux/icmpv6.h -@@ -119,6 +119,8 @@ struct icmp6hdr { - #define ICMPV6_POLICY_FAIL 5 - #define ICMPV6_REJECT_ROUTE 6 - -+#define ICMPV6_FAILED_POLICY ICMPV6_POLICY_FAIL -+ - /* - * Codes for Time Exceeded - */ ---- a/include/uapi/linux/rtnetlink.h -+++ b/include/uapi/linux/rtnetlink.h -@@ -232,6 +232,8 @@ enum { - __RTN_MAX - }; - -+#define RTN_FAILED_POLICY RTN_POLICY_FAILED -+ - #define RTN_MAX (__RTN_MAX - 1) - - diff --git a/target/linux/generic/pending-4.19/680-NET-skip-GRO-for-foreign-MAC-addresses.patch b/target/linux/generic/pending-4.19/680-NET-skip-GRO-for-foreign-MAC-addresses.patch deleted file mode 100644 index 828c9554d4..0000000000 --- a/target/linux/generic/pending-4.19/680-NET-skip-GRO-for-foreign-MAC-addresses.patch +++ /dev/null @@ -1,152 +0,0 @@ -From: Felix Fietkau -Subject: net: replace GRO optimization patch with a new one that supports VLANs/bridges with different MAC addresses - -Signed-off-by: Felix Fietkau ---- - include/linux/netdevice.h | 2 ++ - include/linux/skbuff.h | 3 ++- - net/core/dev.c | 48 +++++++++++++++++++++++++++++++++++++++++++++++ - net/ethernet/eth.c | 18 +++++++++++++++++- - 4 files changed, 69 insertions(+), 2 deletions(-) - ---- a/include/linux/netdevice.h -+++ b/include/linux/netdevice.h -@@ -1879,6 +1879,8 @@ struct net_device { - struct netdev_hw_addr_list mc; - struct netdev_hw_addr_list dev_addrs; - -+ unsigned char local_addr_mask[MAX_ADDR_LEN]; -+ - #ifdef CONFIG_SYSFS - struct kset *queues_kset; - #endif ---- a/include/linux/skbuff.h -+++ b/include/linux/skbuff.h -@@ -799,6 +799,7 @@ struct sk_buff { - #ifdef CONFIG_TLS_DEVICE - __u8 decrypted:1; - #endif -+ __u8 gro_skip:1; - - #ifdef CONFIG_NET_SCHED - __u16 tc_index; /* traffic control index */ ---- a/net/core/dev.c -+++ b/net/core/dev.c -@@ -5452,6 +5452,9 @@ static enum gro_result dev_gro_receive(s - int same_flow; - int grow; - -+ if (skb->gro_skip) -+ goto normal; -+ - if (netif_elide_gro(skb->dev)) - goto normal; - -@@ -6946,6 +6949,48 @@ static void __netdev_adjacent_dev_unlink - &upper_dev->adj_list.lower); - } - -+static void __netdev_addr_mask(unsigned char *mask, const unsigned char *addr, -+ struct net_device *dev) -+{ -+ int i; -+ -+ for (i = 0; i < dev->addr_len; i++) -+ mask[i] |= addr[i] ^ dev->dev_addr[i]; -+} -+ -+static void __netdev_upper_mask(unsigned char *mask, struct net_device *dev, -+ struct net_device *lower) -+{ -+ struct net_device *cur; -+ struct list_head *iter; -+ -+ netdev_for_each_upper_dev_rcu(dev, cur, iter) { -+ __netdev_addr_mask(mask, cur->dev_addr, lower); -+ __netdev_upper_mask(mask, cur, lower); -+ } -+} -+ -+static void __netdev_update_addr_mask(struct net_device *dev) -+{ -+ unsigned char mask[MAX_ADDR_LEN]; -+ struct net_device *cur; -+ struct list_head *iter; -+ -+ memset(mask, 0, sizeof(mask)); -+ __netdev_upper_mask(mask, dev, dev); -+ memcpy(dev->local_addr_mask, mask, dev->addr_len); -+ -+ netdev_for_each_lower_dev(dev, cur, iter) -+ __netdev_update_addr_mask(cur); -+} -+ -+static void netdev_update_addr_mask(struct net_device *dev) -+{ -+ rcu_read_lock(); -+ __netdev_update_addr_mask(dev); -+ rcu_read_unlock(); -+} -+ - static int __netdev_upper_dev_link(struct net_device *dev, - struct net_device *upper_dev, bool master, - void *upper_priv, void *upper_info, -@@ -6993,6 +7038,7 @@ static int __netdev_upper_dev_link(struc - if (ret) - return ret; - -+ netdev_update_addr_mask(dev); - ret = call_netdevice_notifiers_info(NETDEV_CHANGEUPPER, - &changeupper_info.info); - ret = notifier_to_errno(ret); -@@ -7079,6 +7125,7 @@ void netdev_upper_dev_unlink(struct net_ - - __netdev_adjacent_dev_unlink_neighbour(dev, upper_dev); - -+ netdev_update_addr_mask(dev); - call_netdevice_notifiers_info(NETDEV_CHANGEUPPER, - &changeupper_info.info); - } -@@ -7702,6 +7749,7 @@ int dev_set_mac_address(struct net_devic - if (err) - return err; - dev->addr_assign_type = NET_ADDR_SET; -+ netdev_update_addr_mask(dev); - call_netdevice_notifiers(NETDEV_CHANGEADDR, dev); - add_device_randomness(dev->dev_addr, dev->addr_len); - return 0; ---- a/net/ethernet/eth.c -+++ b/net/ethernet/eth.c -@@ -144,6 +144,18 @@ u32 eth_get_headlen(void *data, unsigned - } - EXPORT_SYMBOL(eth_get_headlen); - -+static inline bool -+eth_check_local_mask(const void *addr1, const void *addr2, const void *mask) -+{ -+ const u16 *a1 = addr1; -+ const u16 *a2 = addr2; -+ const u16 *m = mask; -+ -+ return (((a1[0] ^ a2[0]) & ~m[0]) | -+ ((a1[1] ^ a2[1]) & ~m[1]) | -+ ((a1[2] ^ a2[2]) & ~m[2])); -+} -+ - /** - * eth_type_trans - determine the packet's protocol ID. - * @skb: received socket data -@@ -172,8 +184,12 @@ __be16 eth_type_trans(struct sk_buff *sk - skb->pkt_type = PACKET_MULTICAST; - } - else if (unlikely(!ether_addr_equal_64bits(eth->h_dest, -- dev->dev_addr))) -+ dev->dev_addr))) { - skb->pkt_type = PACKET_OTHERHOST; -+ if (eth_check_local_mask(eth->h_dest, dev->dev_addr, -+ dev->local_addr_mask)) -+ skb->gro_skip = 1; -+ } - - /* - * Some variants of DSA tagging don't have an ethertype field diff --git a/target/linux/generic/pending-4.19/681-NET-add-of_get_mac_address_mtd.patch b/target/linux/generic/pending-4.19/681-NET-add-of_get_mac_address_mtd.patch deleted file mode 100644 index 13f5640590..0000000000 --- a/target/linux/generic/pending-4.19/681-NET-add-of_get_mac_address_mtd.patch +++ /dev/null @@ -1,133 +0,0 @@ -From: John Crispin -Subject: NET: add mtd-mac-address support to of_get_mac_address() - -Many embedded devices have information such as mac addresses stored inside mtd -devices. This patch allows us to add a property inside a node describing a -network interface. The new property points at a mtd partition with an offset -where the mac address can be found. - -Signed-off-by: John Crispin -Signed-off-by: Felix Fietkau ---- - drivers/of/of_net.c | 37 +++++++++++++++++++++++++++++++++++++ - include/linux/of_net.h | 1 + - 2 files changed, 38 insertions(+) - ---- a/drivers/of/of_net.c -+++ b/drivers/of/of_net.c -@@ -11,6 +11,7 @@ - #include - #include - #include -+#include - - /** - * of_get_phy_mode - Get phy mode for given device_node -@@ -39,7 +40,7 @@ int of_get_phy_mode(struct device_node * - } - EXPORT_SYMBOL_GPL(of_get_phy_mode); - --static const void *of_get_mac_addr(struct device_node *np, const char *name) -+static void *of_get_mac_addr(struct device_node *np, const char *name) - { - struct property *pp = of_find_property(np, name, NULL); - -@@ -48,6 +49,79 @@ static const void *of_get_mac_addr(struc - return NULL; - } - -+static const void *of_get_mac_address_mtd(struct device_node *np) -+{ -+#ifdef CONFIG_MTD -+ struct device_node *mtd_np = NULL; -+ struct property *prop; -+ size_t retlen; -+ int size, ret; -+ struct mtd_info *mtd; -+ const char *part; -+ const __be32 *list; -+ phandle phandle; -+ u32 mac_inc = 0; -+ u8 mac[ETH_ALEN]; -+ void *addr; -+ u32 inc_idx; -+ -+ list = of_get_property(np, "mtd-mac-address", &size); -+ if (!list || (size != (2 * sizeof(*list)))) -+ return NULL; -+ -+ phandle = be32_to_cpup(list++); -+ if (phandle) -+ mtd_np = of_find_node_by_phandle(phandle); -+ -+ if (!mtd_np) -+ return NULL; -+ -+ part = of_get_property(mtd_np, "label", NULL); -+ if (!part) -+ part = mtd_np->name; -+ -+ mtd = get_mtd_device_nm(part); -+ if (IS_ERR(mtd)) -+ return NULL; -+ -+ ret = mtd_read(mtd, be32_to_cpup(list), 6, &retlen, mac); -+ put_mtd_device(mtd); -+ -+ if (of_property_read_u32(np, "mtd-mac-address-increment-byte", &inc_idx)) -+ inc_idx = 5; -+ if (inc_idx > 5) -+ return NULL; -+ -+ if (!of_property_read_u32(np, "mtd-mac-address-increment", &mac_inc)) -+ mac[inc_idx] += mac_inc; -+ -+ if (!is_valid_ether_addr(mac)) -+ return NULL; -+ -+ addr = of_get_mac_addr(np, "mac-address"); -+ if (addr) { -+ memcpy(addr, mac, ETH_ALEN); -+ return addr; -+ } -+ -+ prop = kzalloc(sizeof(*prop), GFP_KERNEL); -+ if (!prop) -+ return NULL; -+ -+ prop->name = "mac-address"; -+ prop->length = ETH_ALEN; -+ prop->value = kmemdup(mac, ETH_ALEN, GFP_KERNEL); -+ if (!prop->value || of_add_property(np, prop)) -+ goto free; -+ -+ return prop->value; -+free: -+ kfree(prop->value); -+ kfree(prop); -+#endif -+ return NULL; -+} -+ - /** - * Search the device tree for the best MAC address to use. 'mac-address' is - * checked first, because that is supposed to contain to "most recent" MAC -@@ -65,11 +139,18 @@ static const void *of_get_mac_addr(struc - * addresses. Some older U-Boots only initialized 'local-mac-address'. In - * this case, the real MAC is in 'local-mac-address', and 'mac-address' exists - * but is all zeros. -+ * -+ * If a mtd-mac-address property exists, try to fetch the MAC address from the -+ * specified mtd device, and store it as a 'mac-address' property - */ - const void *of_get_mac_address(struct device_node *np) - { - const void *addr; - -+ addr = of_get_mac_address_mtd(np); -+ if (addr) -+ return addr; -+ - addr = of_get_mac_addr(np, "mac-address"); - if (addr) - return addr; diff --git a/target/linux/generic/pending-4.19/701-phy_extension.patch b/target/linux/generic/pending-4.19/701-phy_extension.patch deleted file mode 100644 index a340872e56..0000000000 --- a/target/linux/generic/pending-4.19/701-phy_extension.patch +++ /dev/null @@ -1,95 +0,0 @@ -From: John Crispin -Subject: net: phy: add phy_ethtool_ioctl() - -Signed-off-by: John Crispin ---- - drivers/net/phy/phy.c | 44 ++++++++++++++++++++++++++++++++++++++++++++ - include/linux/phy.h | 1 + - 2 files changed, 45 insertions(+) - ---- a/drivers/net/phy/phy.c -+++ b/drivers/net/phy/phy.c -@@ -382,6 +382,73 @@ void phy_ethtool_ksettings_get(struct ph - } - EXPORT_SYMBOL(phy_ethtool_ksettings_get); - -+static int phy_ethtool_gset(struct phy_device *phydev, struct ethtool_cmd *cmd) -+{ -+ cmd->supported = phydev->supported; -+ -+ cmd->advertising = phydev->advertising; -+ cmd->lp_advertising = phydev->lp_advertising; -+ -+ ethtool_cmd_speed_set(cmd, phydev->speed); -+ cmd->duplex = phydev->duplex; -+ if (phydev->interface == PHY_INTERFACE_MODE_MOCA) -+ cmd->port = PORT_BNC; -+ else -+ cmd->port = PORT_MII; -+ cmd->phy_address = phydev->mdio.addr; -+ cmd->transceiver = phy_is_internal(phydev) ? -+ XCVR_INTERNAL : XCVR_EXTERNAL; -+ cmd->autoneg = phydev->autoneg; -+ cmd->eth_tp_mdix_ctrl = phydev->mdix_ctrl; -+ cmd->eth_tp_mdix = phydev->mdix; -+ -+ return 0; -+} -+ -+int phy_ethtool_ioctl(struct phy_device *phydev, void *useraddr) -+{ -+ u32 cmd; -+ int tmp; -+ struct ethtool_cmd ecmd = { ETHTOOL_GSET }; -+ struct ethtool_value edata = { ETHTOOL_GLINK }; -+ -+ if (get_user(cmd, (u32 *) useraddr)) -+ return -EFAULT; -+ -+ switch (cmd) { -+ case ETHTOOL_GSET: -+ phy_ethtool_gset(phydev, &ecmd); -+ if (copy_to_user(useraddr, &ecmd, sizeof(ecmd))) -+ return -EFAULT; -+ return 0; -+ -+ case ETHTOOL_SSET: -+ if (copy_from_user(&ecmd, useraddr, sizeof(ecmd))) -+ return -EFAULT; -+ return phy_ethtool_sset(phydev, &ecmd); -+ -+ case ETHTOOL_NWAY_RST: -+ /* if autoneg is off, it's an error */ -+ tmp = phy_read(phydev, MII_BMCR); -+ if (tmp & BMCR_ANENABLE) { -+ tmp |= (BMCR_ANRESTART); -+ phy_write(phydev, MII_BMCR, tmp); -+ return 0; -+ } -+ return -EINVAL; -+ -+ case ETHTOOL_GLINK: -+ edata.data = (phy_read(phydev, -+ MII_BMSR) & BMSR_LSTATUS) ? 1 : 0; -+ if (copy_to_user(useraddr, &edata, sizeof(edata))) -+ return -EFAULT; -+ return 0; -+ } -+ -+ return -EOPNOTSUPP; -+} -+EXPORT_SYMBOL(phy_ethtool_ioctl); -+ - /** - * phy_mii_ioctl - generic PHY MII ioctl interface - * @phydev: the phy_device struct ---- a/include/linux/phy.h -+++ b/include/linux/phy.h -@@ -1045,6 +1045,7 @@ void phy_ethtool_ksettings_get(struct ph - struct ethtool_link_ksettings *cmd); - int phy_ethtool_ksettings_set(struct phy_device *phydev, - const struct ethtool_link_ksettings *cmd); -+int phy_ethtool_ioctl(struct phy_device *phydev, void *useraddr); - int phy_mii_ioctl(struct phy_device *phydev, struct ifreq *ifr, int cmd); - int phy_start_interrupts(struct phy_device *phydev); - void phy_print_status(struct phy_device *phydev); diff --git a/target/linux/generic/pending-4.19/703-phy-add-detach-callback-to-struct-phy_driver.patch b/target/linux/generic/pending-4.19/703-phy-add-detach-callback-to-struct-phy_driver.patch deleted file mode 100644 index 0cf187a491..0000000000 --- a/target/linux/generic/pending-4.19/703-phy-add-detach-callback-to-struct-phy_driver.patch +++ /dev/null @@ -1,38 +0,0 @@ -From: Gabor Juhos -Subject: generic: add detach callback to struct phy_driver - -lede-commit: fe61fc2d7d0b3fb348b502f68f98243b3ddf5867 - -Signed-off-by: Gabor Juhos ---- - drivers/net/phy/phy_device.c | 3 +++ - include/linux/phy.h | 6 ++++++ - 2 files changed, 9 insertions(+) - ---- a/drivers/net/phy/phy_device.c -+++ b/drivers/net/phy/phy_device.c -@@ -1130,6 +1130,9 @@ void phy_detach(struct phy_device *phyde - struct module *ndev_owner = dev->dev.parent->driver->owner; - struct mii_bus *bus; - -+ if (phydev->drv && phydev->drv->detach) -+ phydev->drv->detach(phydev); -+ - if (phydev->sysfs_links) { - sysfs_remove_link(&dev->dev.kobj, "phydev"); - sysfs_remove_link(&phydev->mdio.dev.kobj, "attached_dev"); ---- a/include/linux/phy.h -+++ b/include/linux/phy.h -@@ -560,6 +560,12 @@ struct phy_driver { - */ - int (*did_interrupt)(struct phy_device *phydev); - -+ /* -+ * Called before an ethernet device is detached -+ * from the PHY. -+ */ -+ void (*detach)(struct phy_device *phydev); -+ - /* Clears up any memory if needed */ - void (*remove)(struct phy_device *phydev); - diff --git a/target/linux/generic/pending-4.19/734-net-phy-at803x-allow-to-configure-via-pdata.patch b/target/linux/generic/pending-4.19/734-net-phy-at803x-allow-to-configure-via-pdata.patch deleted file mode 100644 index e56e77addf..0000000000 --- a/target/linux/generic/pending-4.19/734-net-phy-at803x-allow-to-configure-via-pdata.patch +++ /dev/null @@ -1,142 +0,0 @@ -From: Gabor Juhos -Subject: net: phy: allow to configure AR803x PHYs via platform data - -Add a patch for the at803x phy driver, in order to be able -to configure some register settings via platform data. - -Signed-off-by: Gabor Juhos ---- - drivers/net/phy/at803x.c | 56 ++++++++++++++++++++++++++++++++ - include/linux/platform_data/phy-at803x.h | 11 +++++++ - 2 files changed, 67 insertions(+) - create mode 100644 include/linux/platform_data/phy-at803x.h - ---- a/drivers/net/phy/at803x.c -+++ b/drivers/net/phy/at803x.c -@@ -12,12 +12,14 @@ - */ - - #include -+#include - #include - #include - #include - #include - #include - #include -+#include - - #define AT803X_INTR_ENABLE 0x12 - #define AT803X_INTR_ENABLE_AUTONEG_ERR BIT(15) -@@ -45,6 +47,11 @@ - #define AT803X_REG_CHIP_CONFIG 0x1f - #define AT803X_BT_BX_REG_SEL 0x8000 - -+#define AT803X_PCS_SMART_EEE_CTRL3 0x805D -+#define AT803X_SMART_EEE_CTRL3_LPI_TX_DELAY_SEL_MASK 0x3 -+#define AT803X_SMART_EEE_CTRL3_LPI_TX_DELAY_SEL_SHIFT 12 -+#define AT803X_SMART_EEE_CTRL3_LPI_EN BIT(8) -+ - #define AT803X_DEBUG_ADDR 0x1D - #define AT803X_DEBUG_DATA 0x1E - -@@ -73,6 +80,7 @@ MODULE_LICENSE("GPL"); - - struct at803x_priv { - bool phy_reset:1; -+ int prev_speed; - }; - - struct at803x_context { -@@ -249,8 +257,16 @@ static int at803x_probe(struct phy_devic - return 0; - } - -+static void at803x_disable_smarteee(struct phy_device *phydev) -+{ -+ phy_write_mmd(phydev, MDIO_MMD_PCS, AT803X_PCS_SMART_EEE_CTRL3, -+ 1 << AT803X_SMART_EEE_CTRL3_LPI_TX_DELAY_SEL_SHIFT); -+ phy_write_mmd(phydev, MDIO_MMD_AN, MDIO_AN_EEE_ADV, 0); -+} -+ - static int at803x_config_init(struct phy_device *phydev) - { -+ struct at803x_platform_data *pdata; - int ret; - - ret = genphy_config_init(phydev); -@@ -271,6 +287,26 @@ static int at803x_config_init(struct phy - return ret; - } - -+ pdata = dev_get_platdata(&phydev->mdio.dev); -+ if (pdata) { -+ if (pdata->disable_smarteee) -+ at803x_disable_smarteee(phydev); -+ -+ if (pdata->enable_rgmii_rx_delay) -+ at803x_debug_reg_mask(phydev, AT803X_DEBUG_REG_0, 0, -+ AT803X_DEBUG_RX_CLK_DLY_EN); -+ else -+ at803x_debug_reg_mask(phydev, AT803X_DEBUG_REG_0, -+ AT803X_DEBUG_RX_CLK_DLY_EN, 0); -+ -+ if (pdata->enable_rgmii_tx_delay) -+ at803x_debug_reg_mask(phydev, AT803X_DEBUG_REG_5, 0, -+ AT803X_DEBUG_TX_CLK_DLY_EN); -+ else -+ at803x_debug_reg_mask(phydev, AT803X_DEBUG_REG_5, -+ AT803X_DEBUG_TX_CLK_DLY_EN, 0); -+ } -+ - return 0; - } - -@@ -308,6 +344,8 @@ static int at803x_config_intr(struct phy - static void at803x_link_change_notify(struct phy_device *phydev) - { - struct at803x_priv *priv = phydev->priv; -+ struct at803x_platform_data *pdata; -+ pdata = dev_get_platdata(&phydev->mdio.dev); - - /* - * Conduct a hardware reset for AT8030/2 every time a link loss is -@@ -336,6 +374,24 @@ static void at803x_link_change_notify(st - } else { - priv->phy_reset = false; - } -+ if (pdata && pdata->fixup_rgmii_tx_delay && -+ phydev->speed != priv->prev_speed) { -+ switch (phydev->speed) { -+ case SPEED_10: -+ case SPEED_100: -+ at803x_debug_reg_mask(phydev, AT803X_DEBUG_REG_5, 0, -+ AT803X_DEBUG_TX_CLK_DLY_EN); -+ break; -+ case SPEED_1000: -+ at803x_debug_reg_mask(phydev, AT803X_DEBUG_REG_5, -+ AT803X_DEBUG_TX_CLK_DLY_EN, 0); -+ break; -+ default: -+ break; -+ } -+ -+ priv->prev_speed = phydev->speed; -+ } - } - - static int at803x_aneg_done(struct phy_device *phydev) ---- /dev/null -+++ b/include/linux/platform_data/phy-at803x.h -@@ -0,0 +1,11 @@ -+#ifndef _PHY_AT803X_PDATA_H -+#define _PHY_AT803X_PDATA_H -+ -+struct at803x_platform_data { -+ int disable_smarteee:1; -+ int enable_rgmii_tx_delay:1; -+ int enable_rgmii_rx_delay:1; -+ int fixup_rgmii_tx_delay:1; -+}; -+ -+#endif /* _PHY_AT803X_PDATA_H */ diff --git a/target/linux/generic/pending-4.19/735-net-phy-at803x-fix-at8033-sgmii-mode.patch b/target/linux/generic/pending-4.19/735-net-phy-at803x-fix-at8033-sgmii-mode.patch deleted file mode 100644 index 1f81b37f71..0000000000 --- a/target/linux/generic/pending-4.19/735-net-phy-at803x-fix-at8033-sgmii-mode.patch +++ /dev/null @@ -1,51 +0,0 @@ -From: Roman Yeryomin -Subject: kernel: add at803x fix for sgmii mode - -Some (possibly broken) bootloaders incorreclty initialize at8033 -phy. This patch enables sgmii autonegotiation mode. - -[john@phrozen.org: felix added this to his upstream queue] - -Signed-off-by: Roman Yeryomin ---- - drivers/net/phy/at803x.c | 25 +++++++++++++++++++++++++ - 1 file changed, 25 insertions(+) - ---- a/drivers/net/phy/at803x.c -+++ b/drivers/net/phy/at803x.c -@@ -46,6 +46,7 @@ - #define AT803X_FUNC_DATA 0x4003 - #define AT803X_REG_CHIP_CONFIG 0x1f - #define AT803X_BT_BX_REG_SEL 0x8000 -+#define AT803X_SGMII_ANEG_EN 0x1000 - - #define AT803X_PCS_SMART_EEE_CTRL3 0x805D - #define AT803X_SMART_EEE_CTRL3_LPI_TX_DELAY_SEL_MASK 0x3 -@@ -268,6 +269,27 @@ static int at803x_config_init(struct phy - { - struct at803x_platform_data *pdata; - int ret; -+ u32 v; -+ -+ if (phydev->drv->phy_id == ATH8031_PHY_ID && -+ phydev->interface == PHY_INTERFACE_MODE_SGMII) -+ { -+ v = phy_read(phydev, AT803X_REG_CHIP_CONFIG); -+ /* select SGMII/fiber page */ -+ ret = phy_write(phydev, AT803X_REG_CHIP_CONFIG, -+ v & ~AT803X_BT_BX_REG_SEL); -+ if (ret) -+ return ret; -+ /* enable SGMII autonegotiation */ -+ ret = phy_write(phydev, MII_BMCR, AT803X_SGMII_ANEG_EN); -+ if (ret) -+ return ret; -+ /* select copper page */ -+ ret = phy_write(phydev, AT803X_REG_CHIP_CONFIG, -+ v | AT803X_BT_BX_REG_SEL); -+ if (ret) -+ return ret; -+ } - - ret = genphy_config_init(phydev); - if (ret < 0) diff --git a/target/linux/generic/pending-4.19/736-net-phy-at803x-allow-to-configure-via-dt.patch b/target/linux/generic/pending-4.19/736-net-phy-at803x-allow-to-configure-via-dt.patch deleted file mode 100644 index 496700f377..0000000000 --- a/target/linux/generic/pending-4.19/736-net-phy-at803x-allow-to-configure-via-dt.patch +++ /dev/null @@ -1,47 +0,0 @@ ---- a/drivers/net/phy/at803x.c -+++ b/drivers/net/phy/at803x.c -@@ -329,6 +329,14 @@ static int at803x_config_init(struct phy - AT803X_DEBUG_TX_CLK_DLY_EN, 0); - } - -+#ifdef CONFIG_OF_MDIO -+ if (phydev->mdio.dev.of_node && -+ of_property_read_bool(phydev->mdio.dev.of_node, -+ "at803x-disable-smarteee")) { -+ at803x_disable_smarteee(phydev); -+ } -+#endif -+ - return 0; - } - -@@ -367,6 +375,7 @@ static void at803x_link_change_notify(st - { - struct at803x_priv *priv = phydev->priv; - struct at803x_platform_data *pdata; -+ u8 fixup_rgmii_tx_delay = 0; - pdata = dev_get_platdata(&phydev->mdio.dev); - - /* -@@ -396,8 +405,19 @@ static void at803x_link_change_notify(st - } else { - priv->phy_reset = false; - } -- if (pdata && pdata->fixup_rgmii_tx_delay && -- phydev->speed != priv->prev_speed) { -+ -+ if (pdata && pdata->fixup_rgmii_tx_delay) -+ fixup_rgmii_tx_delay = 1; -+ -+#ifdef CONFIG_OF_MDIO -+ if (phydev->mdio.dev.of_node && -+ of_property_read_bool(phydev->mdio.dev.of_node, -+ "at803x-fixup-rgmii-tx-delay")) { -+ fixup_rgmii_tx_delay = 1; -+ } -+#endif -+ -+ if (fixup_rgmii_tx_delay && phydev->speed != priv->prev_speed) { - switch (phydev->speed) { - case SPEED_10: - case SPEED_100: diff --git a/target/linux/generic/pending-4.19/800-bcma-get-SoC-device-struct-copy-its-DMA-params-to-th.patch b/target/linux/generic/pending-4.19/800-bcma-get-SoC-device-struct-copy-its-DMA-params-to-th.patch deleted file mode 100644 index cb02c71829..0000000000 --- a/target/linux/generic/pending-4.19/800-bcma-get-SoC-device-struct-copy-its-DMA-params-to-th.patch +++ /dev/null @@ -1,70 +0,0 @@ -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= -Subject: [PATCH] bcma: get SoC device struct & copy its DMA params to the - subdevices -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -For bus devices to be fully usable it's required to set their DMA -parameters. - -For years it has been missing and remained unnoticed because of -mips_dma_alloc_coherent() silently handling the empty coherent_dma_mask. -Kernel 4.19 came with a lot of DMA changes and caused a regression on -the bcm47xx. Starting with the commit f8c55dc6e828 ("MIPS: use generic -dma noncoherent ops for simple noncoherent platforms") DMA coherent -allocations just fail. Example: -[ 1.114914] bgmac_bcma bcma0:2: Allocation of TX ring 0x200 failed -[ 1.121215] bgmac_bcma bcma0:2: Unable to alloc memory for DMA -[ 1.127626] bgmac_bcma: probe of bcma0:2 failed with error -12 -[ 1.133838] bgmac_bcma: Broadcom 47xx GBit MAC driver loaded - -This change fixes above regression in addition to the MIPS bcm47xx -commit 321c46b91550 ("MIPS: BCM47XX: Setup struct device for the SoC"). - -It also fixes another *old* GPIO regression caused by a parent pointing -to the NULL: -[ 0.157054] missing gpiochip .dev parent pointer -[ 0.157287] bcma: bus0: Error registering GPIO driver: -22 -introduced by the commit 74f4e0cc6108 ("bcma: switch GPIO portions to -use GPIOLIB_IRQCHIP"). - -Fixes: f8c55dc6e828 ("MIPS: use generic dma noncoherent ops for simple noncoherent platforms") -Fixes: 74f4e0cc6108 ("bcma: switch GPIO portions to use GPIOLIB_IRQCHIP") -Cc: linux-mips@linux-mips.org -Cc: Christoph Hellwig -Cc: Linus Walleij -Signed-off-by: Rafał Miłecki ---- - ---- a/drivers/bcma/host_soc.c -+++ b/drivers/bcma/host_soc.c -@@ -191,6 +191,8 @@ int __init bcma_host_soc_init(struct bcm - struct bcma_bus *bus = &soc->bus; - int err; - -+ bus->dev = soc->dev; -+ - /* Scan bus and initialize it */ - err = bcma_bus_early_register(bus); - if (err) ---- a/drivers/bcma/main.c -+++ b/drivers/bcma/main.c -@@ -236,12 +236,16 @@ EXPORT_SYMBOL(bcma_core_irq); - - void bcma_prepare_core(struct bcma_bus *bus, struct bcma_device *core) - { -+ struct device *dev = &core->dev; -+ - core->dev.release = bcma_release_core_dev; - core->dev.bus = &bcma_bus_type; - dev_set_name(&core->dev, "bcma%d:%d", bus->num, core->core_index); - core->dev.parent = bus->dev; -- if (bus->dev) -+ if (bus->dev) { - bcma_of_fill_device(bus->dev, core); -+ dma_coerce_mask_and_coherent(dev, bus->dev->coherent_dma_mask); -+ } - - switch (bus->hosttype) { - case BCMA_HOSTTYPE_PCI: diff --git a/target/linux/generic/pending-4.19/810-pci_disable_common_quirks.patch b/target/linux/generic/pending-4.19/810-pci_disable_common_quirks.patch deleted file mode 100644 index 3f452ebf48..0000000000 --- a/target/linux/generic/pending-4.19/810-pci_disable_common_quirks.patch +++ /dev/null @@ -1,62 +0,0 @@ -From: Gabor Juhos -Subject: debloat: add kernel config option to disabling common PCI quirks - -Signed-off-by: Gabor Juhos ---- - drivers/pci/Kconfig | 6 ++++++ - drivers/pci/quirks.c | 6 ++++++ - 2 files changed, 12 insertions(+) - ---- a/drivers/pci/Kconfig -+++ b/drivers/pci/Kconfig -@@ -89,6 +89,13 @@ config XEN_PCIDEV_FRONTEND - The PCI device frontend driver allows the kernel to import arbitrary - PCI devices from a PCI backend to support PCI driver domains. - -+config PCI_DISABLE_COMMON_QUIRKS -+ bool "PCI disable common quirks" -+ depends on PCI -+ help -+ If you don't know what to do here, say N. -+ -+ - config PCI_ATS - bool - ---- a/drivers/pci/quirks.c -+++ b/drivers/pci/quirks.c -@@ -207,6 +207,7 @@ static void quirk_mmio_always_on(struct - DECLARE_PCI_FIXUP_CLASS_EARLY(PCI_ANY_ID, PCI_ANY_ID, - PCI_CLASS_BRIDGE_HOST, 8, quirk_mmio_always_on); - -+#ifndef CONFIG_PCI_DISABLE_COMMON_QUIRKS - /* - * The Mellanox Tavor device gives false positive parity errors. Mark this - * device with a broken_parity_status to allow PCI scanning code to "skip" -@@ -3135,6 +3136,8 @@ DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_I - DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x65f9, quirk_intel_mc_errata); - DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x65fa, quirk_intel_mc_errata); - -+#endif /* !CONFIG_PCI_DISABLE_COMMON_QUIRKS */ -+ - /* - * Ivytown NTB BAR sizes are misreported by the hardware due to an erratum. - * To work around this, query the size it should be configured to by the -@@ -3160,6 +3163,8 @@ static void quirk_intel_ntb(struct pci_d - DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x0e08, quirk_intel_ntb); - DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x0e0d, quirk_intel_ntb); - -+#ifndef CONFIG_PCI_DISABLE_COMMON_QUIRKS -+ - /* - * Some BIOS implementations leave the Intel GPU interrupts enabled, even - * though no one is handling them (e.g., if the i915 driver is never -@@ -3198,6 +3203,8 @@ DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_IN - DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x010a, disable_igfx_irq); - DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x0152, disable_igfx_irq); - -+#endif /* !CONFIG_PCI_DISABLE_COMMON_QUIRKS */ -+ - /* - * PCI devices which are on Intel chips can skip the 10ms delay - * before entering D3 mode. diff --git a/target/linux/generic/pending-4.19/811-pci_disable_usb_common_quirks.patch b/target/linux/generic/pending-4.19/811-pci_disable_usb_common_quirks.patch deleted file mode 100644 index 7d36af7d26..0000000000 --- a/target/linux/generic/pending-4.19/811-pci_disable_usb_common_quirks.patch +++ /dev/null @@ -1,115 +0,0 @@ -From: Felix Fietkau -Subject: debloat: disable common USB quirks - -Signed-off-by: Felix Fietkau ---- - drivers/usb/host/pci-quirks.c | 16 ++++++++++++++++ - drivers/usb/host/pci-quirks.h | 18 +++++++++++++++++- - include/linux/usb/hcd.h | 7 +++++++ - 3 files changed, 40 insertions(+), 1 deletion(-) - ---- a/drivers/usb/host/pci-quirks.c -+++ b/drivers/usb/host/pci-quirks.c -@@ -125,6 +125,8 @@ struct amd_chipset_type { - u8 rev; - }; - -+#ifndef CONFIG_PCI_DISABLE_COMMON_QUIRKS -+ - static struct amd_chipset_info { - struct pci_dev *nb_dev; - struct pci_dev *smbus_dev; -@@ -621,6 +623,10 @@ bool usb_amd_pt_check_port(struct device - } - EXPORT_SYMBOL_GPL(usb_amd_pt_check_port); - -+#endif /* CONFIG_PCI_DISABLE_COMMON_QUIRKS */ -+ -+#if IS_ENABLED(CONFIG_USB_UHCI_HCD) -+ - /* - * Make sure the controller is completely inactive, unable to - * generate interrupts or do DMA. -@@ -700,8 +706,17 @@ reset_needed: - uhci_reset_hc(pdev, base); - return 1; - } -+#else -+int uhci_check_and_reset_hc(struct pci_dev *pdev, unsigned long base) -+{ -+ return 0; -+} -+ -+#endif - EXPORT_SYMBOL_GPL(uhci_check_and_reset_hc); - -+#ifndef CONFIG_PCI_DISABLE_COMMON_QUIRKS -+ - static inline int io_type_enabled(struct pci_dev *pdev, unsigned int mask) - { - u16 cmd; -@@ -1268,3 +1283,4 @@ static void quirk_usb_early_handoff(stru - } - DECLARE_PCI_FIXUP_CLASS_FINAL(PCI_ANY_ID, PCI_ANY_ID, - PCI_CLASS_SERIAL_USB, 8, quirk_usb_early_handoff); -+#endif ---- a/drivers/usb/host/pci-quirks.h -+++ b/drivers/usb/host/pci-quirks.h -@@ -5,6 +5,9 @@ - #ifdef CONFIG_USB_PCI - void uhci_reset_hc(struct pci_dev *pdev, unsigned long base); - int uhci_check_and_reset_hc(struct pci_dev *pdev, unsigned long base); -+#endif /* CONFIG_USB_PCI */ -+ -+#if defined(CONFIG_USB_PCI) && !defined(CONFIG_PCI_DISABLE_COMMON_QUIRKS) - int usb_amd_find_chipset_info(void); - int usb_hcd_amd_remote_wakeup_quirk(struct pci_dev *pdev); - bool usb_amd_hang_symptom_quirk(void); -@@ -19,6 +22,18 @@ void sb800_prefetch(struct device *dev, - bool usb_amd_pt_check_port(struct device *device, int port); - #else - struct pci_dev; -+static inline int usb_amd_find_chipset_info(void) -+{ -+ return 0; -+} -+static inline bool usb_amd_hang_symptom_quirk(void) -+{ -+ return false; -+} -+static inline bool usb_amd_prefetch_quirk(void) -+{ -+ return false; -+} - static inline void usb_amd_quirk_pll_disable(void) {} - static inline void usb_amd_quirk_pll_enable(void) {} - static inline void usb_asmedia_modifyflowcontrol(struct pci_dev *pdev) {} -@@ -29,6 +44,11 @@ static inline bool usb_amd_pt_check_port - { - return false; - } -+static inline void usb_enable_intel_xhci_ports(struct pci_dev *xhci_pdev) {} -+static inline bool usb_xhci_needs_pci_reset(struct pci_dev *pdev) -+{ -+ return false; -+} - #endif /* CONFIG_USB_PCI */ - - #endif /* __LINUX_USB_PCI_QUIRKS_H */ ---- a/include/linux/usb/hcd.h -+++ b/include/linux/usb/hcd.h -@@ -473,7 +473,14 @@ extern int usb_hcd_pci_probe(struct pci_ - extern void usb_hcd_pci_remove(struct pci_dev *dev); - extern void usb_hcd_pci_shutdown(struct pci_dev *dev); - -+#ifndef CONFIG_PCI_DISABLE_COMMON_QUIRKS - extern int usb_hcd_amd_remote_wakeup_quirk(struct pci_dev *dev); -+#else -+static inline int usb_hcd_amd_remote_wakeup_quirk(struct pci_dev *dev) -+{ -+ return 0; -+} -+#endif - - #ifdef CONFIG_PM - extern const struct dev_pm_ops usb_hcd_pci_pm_ops; diff --git a/target/linux/generic/pending-4.19/834-ledtrig-libata.patch b/target/linux/generic/pending-4.19/834-ledtrig-libata.patch deleted file mode 100644 index 70d3de05d0..0000000000 --- a/target/linux/generic/pending-4.19/834-ledtrig-libata.patch +++ /dev/null @@ -1,149 +0,0 @@ -From: Daniel Golle -Subject: libata: add ledtrig support - -This adds a LED trigger for each ATA port indicating disk activity. - -As this is needed only on specific platforms (NAS SoCs and such), -these platforms should define ARCH_WANTS_LIBATA_LEDS if there -are boards with LED(s) intended to indicate ATA disk activity and -need the OS to take care of that. -In that way, if not selected, LED trigger support not will be -included in libata-core and both, codepaths and structures remain -untouched. - -Signed-off-by: Daniel Golle ---- - drivers/ata/Kconfig | 16 ++++++++++++++++ - drivers/ata/libata-core.c | 41 +++++++++++++++++++++++++++++++++++++++++ - include/linux/libata.h | 9 +++++++++ - 3 files changed, 66 insertions(+) - ---- a/drivers/ata/Kconfig -+++ b/drivers/ata/Kconfig -@@ -46,6 +46,22 @@ config ATA_VERBOSE_ERROR - - If unsure, say Y. - -+config ARCH_WANT_LIBATA_LEDS -+ bool -+ -+config ATA_LEDS -+ bool "support ATA port LED triggers" -+ depends on ARCH_WANT_LIBATA_LEDS -+ select NEW_LEDS -+ select LEDS_CLASS -+ select LEDS_TRIGGERS -+ default y -+ help -+ This option adds a LED trigger for each registered ATA port. -+ It is used to drive disk activity leds connected via GPIO. -+ -+ If unsure, say N. -+ - config ATA_ACPI - bool "ATA ACPI Support" - depends on ACPI ---- a/drivers/ata/libata-core.c -+++ b/drivers/ata/libata-core.c -@@ -731,6 +731,19 @@ u64 ata_tf_read_block(const struct ata_t - return block; - } - -+#ifdef CONFIG_ATA_LEDS -+#define LIBATA_BLINK_DELAY 20 /* ms */ -+static inline void ata_led_act(struct ata_port *ap) -+{ -+ unsigned long led_delay = LIBATA_BLINK_DELAY; -+ -+ if (unlikely(!ap->ledtrig)) -+ return; -+ -+ led_trigger_blink_oneshot(ap->ledtrig, &led_delay, &led_delay, 0); -+} -+#endif -+ - /** - * ata_build_rw_tf - Build ATA taskfile for given read/write request - * @tf: Target ATA taskfile -@@ -5131,6 +5144,9 @@ struct ata_queued_cmd *ata_qc_new_init(s - if (tag < 0) - return NULL; - } -+#ifdef CONFIG_ATA_LEDS -+ ata_led_act(ap); -+#endif - - qc = __ata_qc_from_tag(ap, tag); - qc->tag = qc->hw_tag = tag; -@@ -6041,6 +6057,9 @@ struct ata_port *ata_port_alloc(struct a - ap->stats.unhandled_irq = 1; - ap->stats.idle_irq = 1; - #endif -+#ifdef CONFIG_ATA_LEDS -+ ap->ledtrig = kzalloc(sizeof(struct led_trigger), GFP_KERNEL); -+#endif - ata_sff_port_init(ap); - - return ap; -@@ -6076,6 +6095,12 @@ static void ata_host_release(struct kref - - kfree(ap->pmp_link); - kfree(ap->slave_link); -+#ifdef CONFIG_ATA_LEDS -+ if (ap->ledtrig) { -+ led_trigger_unregister(ap->ledtrig); -+ kfree(ap->ledtrig); -+ }; -+#endif - kfree(ap); - host->ports[i] = NULL; - } -@@ -6539,7 +6564,23 @@ int ata_host_register(struct ata_host *h - host->ports[i]->print_id = atomic_inc_return(&ata_print_id); - host->ports[i]->local_port_no = i + 1; - } -+#ifdef CONFIG_ATA_LEDS -+ for (i = 0; i < host->n_ports; i++) { -+ if (unlikely(!host->ports[i]->ledtrig)) -+ continue; - -+ snprintf(host->ports[i]->ledtrig_name, -+ sizeof(host->ports[i]->ledtrig_name), "ata%u", -+ host->ports[i]->print_id); -+ -+ host->ports[i]->ledtrig->name = host->ports[i]->ledtrig_name; -+ -+ if (led_trigger_register(host->ports[i]->ledtrig)) { -+ kfree(host->ports[i]->ledtrig); -+ host->ports[i]->ledtrig = NULL; -+ } -+ } -+#endif - /* Create associated sysfs transport objects */ - for (i = 0; i < host->n_ports; i++) { - rc = ata_tport_add(host->dev,host->ports[i]); ---- a/include/linux/libata.h -+++ b/include/linux/libata.h -@@ -38,6 +38,9 @@ - #include - #include - #include -+#ifdef CONFIG_ATA_LEDS -+#include -+#endif - - /* - * Define if arch has non-standard setup. This is a _PCI_ standard -@@ -893,6 +896,12 @@ struct ata_port { - #ifdef CONFIG_ATA_ACPI - struct ata_acpi_gtm __acpi_init_gtm; /* use ata_acpi_init_gtm() */ - #endif -+ -+#ifdef CONFIG_ATA_LEDS -+ struct led_trigger *ledtrig; -+ char ledtrig_name[8]; -+#endif -+ - /* owned by EH */ - u8 sector_buf[ATA_SECT_SIZE] ____cacheline_aligned; - }; diff --git a/target/linux/generic/pending-4.19/920-mangle_bootargs.patch b/target/linux/generic/pending-4.19/920-mangle_bootargs.patch deleted file mode 100644 index 4438e6cd1d..0000000000 --- a/target/linux/generic/pending-4.19/920-mangle_bootargs.patch +++ /dev/null @@ -1,71 +0,0 @@ -From: Imre Kaloz -Subject: init: add CONFIG_MANGLE_BOOTARGS and disable it by default - -Enabling this option renames the bootloader supplied root= -and rootfstype= variables, which might have to be know but -would break the automatisms libreCMC uses. - -Signed-off-by: Imre Kaloz ---- - init/Kconfig | 9 +++++++++ - init/main.c | 24 ++++++++++++++++++++++++ - 2 files changed, 33 insertions(+) - ---- a/init/Kconfig -+++ b/init/Kconfig -@@ -1528,6 +1528,15 @@ config EMBEDDED - an embedded system so certain expert options are available - for configuration. - -+config MANGLE_BOOTARGS -+ bool "Rename offending bootargs" -+ depends on EXPERT -+ help -+ Sometimes the bootloader passed bogus root= and rootfstype= -+ parameters to the kernel, and while you want to ignore them, -+ you need to know the values f.e. to support dual firmware -+ layouts on the flash. -+ - config HAVE_PERF_EVENTS - bool - help ---- a/init/main.c -+++ b/init/main.c -@@ -366,6 +366,29 @@ static inline void setup_nr_cpu_ids(void - static inline void smp_prepare_cpus(unsigned int maxcpus) { } - #endif - -+#ifdef CONFIG_MANGLE_BOOTARGS -+static void __init mangle_bootargs(char *command_line) -+{ -+ char *rootdev; -+ char *rootfs; -+ -+ rootdev = strstr(command_line, "root=/dev/mtdblock"); -+ -+ if (rootdev) -+ strncpy(rootdev, "mangled_rootblock=", 18); -+ -+ rootfs = strstr(command_line, "rootfstype"); -+ -+ if (rootfs) -+ strncpy(rootfs, "mangled_fs", 10); -+ -+} -+#else -+static void __init mangle_bootargs(char *command_line) -+{ -+} -+#endif -+ - /* - * We need to store the untouched command line for future reference. - * We also need to store the touched command line since the parameter -@@ -558,6 +581,7 @@ asmlinkage __visible void __init start_k - add_device_randomness(command_line, strlen(command_line)); - boot_init_stack_canary(); - mm_init_cpumask(&init_mm); -+ mangle_bootargs(command_line); - setup_command_line(command_line); - setup_nr_cpu_ids(); - setup_per_cpu_areas(); diff --git a/target/linux/generic/pending-4.9/0931-w1-gpio-fix-problem-with-platfom-data-in-w1-gpio.patch b/target/linux/generic/pending-4.9/0931-w1-gpio-fix-problem-with-platfom-data-in-w1-gpio.patch deleted file mode 100644 index 524c6f98df..0000000000 --- a/target/linux/generic/pending-4.9/0931-w1-gpio-fix-problem-with-platfom-data-in-w1-gpio.patch +++ /dev/null @@ -1,38 +0,0 @@ -From d9c8bc8c1408f3e8529db6e4e04017b4c579c342 Mon Sep 17 00:00:00 2001 -From: Pawel Dembicki -Date: Sun, 18 Feb 2018 17:08:04 +0100 -Subject: [PATCH] w1: gpio: fix problem with platfom data in w1-gpio - -In devices, where fdt is used, is impossible to apply platform data -without proper fdt node. - -This patch allow to use platform data in devices with fdt. - -Signed-off-by: Pawel Dembicki ---- - drivers/w1/masters/w1-gpio.c | 7 +++---- - 1 file changed, 3 insertions(+), 4 deletions(-) - ---- a/drivers/w1/masters/w1-gpio.c -+++ b/drivers/w1/masters/w1-gpio.c -@@ -113,17 +113,16 @@ static int w1_gpio_probe_dt(struct platf - 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 = dev_get_platdata(&pdev->dev); - int err; - -- if (of_have_populated_dt()) { -+ if (of_have_populated_dt() && !pdata) { - err = w1_gpio_probe_dt(pdev); - if (err < 0) - return err; -+ pdata = dev_get_platdata(&pdev->dev); - } - -- pdata = dev_get_platdata(&pdev->dev); -- - if (!pdata) { - dev_err(&pdev->dev, "No configuration data\n"); - return -ENXIO; diff --git a/target/linux/generic/pending-4.9/100-MIPS-fix-cache-flushing-for-highmem-pages.patch b/target/linux/generic/pending-4.9/100-MIPS-fix-cache-flushing-for-highmem-pages.patch deleted file mode 100644 index 622fab65b7..0000000000 --- a/target/linux/generic/pending-4.9/100-MIPS-fix-cache-flushing-for-highmem-pages.patch +++ /dev/null @@ -1,30 +0,0 @@ -From: Felix Fietkau -Subject: MIPS: fix cache flushing for highmem pages - -Most cache flush ops were no-op for highmem pages. This led to nasty -segfaults and (in the case of page_address(page) == NULL) kernel -crashes. - -Fix this by always flushing highmem pages using kmap/kunmap_atomic -around the actual cache flush. This might be a bit inefficient, but at -least it's stable. - -Signed-off-by: Felix Fietkau ---- - ---- a/arch/mips/mm/cache.c -+++ b/arch/mips/mm/cache.c -@@ -115,6 +115,13 @@ void __flush_anon_page(struct page *page - { - unsigned long addr = (unsigned long) page_address(page); - -+ if (PageHighMem(page)) { -+ addr = (unsigned long)kmap_atomic(page); -+ flush_data_cache_page(addr); -+ __kunmap_atomic((void *)addr); -+ return; -+ } -+ - if (pages_do_alias(addr, vmaddr)) { - if (page_mapcount(page) && !Page_dcache_dirty(page)) { - void *kaddr; diff --git a/target/linux/generic/pending-4.9/110-ehci_hcd_ignore_oc.patch b/target/linux/generic/pending-4.9/110-ehci_hcd_ignore_oc.patch deleted file mode 100644 index 644d936574..0000000000 --- a/target/linux/generic/pending-4.9/110-ehci_hcd_ignore_oc.patch +++ /dev/null @@ -1,79 +0,0 @@ -From: Florian Fainelli -Subject: USB: EHCI: add ignore_oc flag to disable overcurrent checking - -This patch adds an ignore_oc flag which can be set by EHCI controller -not supporting or wanting to disable overcurrent checking. The EHCI -platform data in include/linux/usb/ehci_pdriver.h is also augmented to -take advantage of this new flag. - -Signed-off-by: Florian Fainelli ---- - drivers/usb/host/ehci-hcd.c | 2 +- - drivers/usb/host/ehci-hub.c | 4 ++-- - drivers/usb/host/ehci-platform.c | 1 + - drivers/usb/host/ehci.h | 1 + - include/linux/usb/ehci_pdriver.h | 1 + - 5 files changed, 6 insertions(+), 3 deletions(-) - ---- a/drivers/usb/host/ehci-hcd.c -+++ b/drivers/usb/host/ehci-hcd.c -@@ -651,7 +651,7 @@ static int ehci_run (struct usb_hcd *hcd - "USB %x.%x started, EHCI %x.%02x%s\n", - ((ehci->sbrn & 0xf0)>>4), (ehci->sbrn & 0x0f), - temp >> 8, temp & 0xff, -- ignore_oc ? ", overcurrent ignored" : ""); -+ (ignore_oc || ehci->ignore_oc) ? ", overcurrent ignored" : ""); - - ehci_writel(ehci, INTR_MASK, - &ehci->regs->intr_enable); /* Turn On Interrupts */ ---- a/drivers/usb/host/ehci-hub.c -+++ b/drivers/usb/host/ehci-hub.c -@@ -638,7 +638,7 @@ ehci_hub_status_data (struct usb_hcd *hc - * always set, seem to clear PORT_OCC and PORT_CSC when writing to - * PORT_POWER; that's surprising, but maybe within-spec. - */ -- if (!ignore_oc) -+ if (!ignore_oc && !ehci->ignore_oc) - mask = PORT_CSC | PORT_PEC | PORT_OCC; - else - mask = PORT_CSC | PORT_PEC; -@@ -1008,7 +1008,7 @@ int ehci_hub_control( - if (temp & PORT_PEC) - status |= USB_PORT_STAT_C_ENABLE << 16; - -- if ((temp & PORT_OCC) && !ignore_oc){ -+ if ((temp & PORT_OCC) && (!ignore_oc && !ehci->ignore_oc)){ - status |= USB_PORT_STAT_C_OVERCURRENT << 16; - - /* ---- a/drivers/usb/host/ehci-platform.c -+++ b/drivers/usb/host/ehci-platform.c -@@ -259,6 +259,8 @@ static int ehci_platform_probe(struct pl - hcd->has_tt = 1; - if (pdata->reset_on_resume) - priv->reset_on_resume = true; -+ if (pdata->ignore_oc) -+ ehci->ignore_oc = 1; - - #ifndef CONFIG_USB_EHCI_BIG_ENDIAN_MMIO - if (ehci->big_endian_mmio) { ---- a/drivers/usb/host/ehci.h -+++ b/drivers/usb/host/ehci.h -@@ -230,6 +230,7 @@ struct ehci_hcd { /* one per controlle - unsigned frame_index_bug:1; /* MosChip (AKA NetMos) */ - unsigned need_oc_pp_cycle:1; /* MPC834X port power */ - unsigned imx28_write_fix:1; /* For Freescale i.MX28 */ -+ unsigned ignore_oc:1; - - /* required for usb32 quirk */ - #define OHCI_CTRL_HCFS (3 << 6) ---- a/include/linux/usb/ehci_pdriver.h -+++ b/include/linux/usb/ehci_pdriver.h -@@ -49,6 +49,7 @@ struct usb_ehci_pdata { - unsigned no_io_watchdog:1; - unsigned reset_on_resume:1; - unsigned dma_mask_64:1; -+ unsigned ignore_oc:1; - - /* Turn on all power and clocks */ - int (*power_on)(struct platform_device *pdev); diff --git a/target/linux/generic/pending-4.9/120-Fix-alloc_node_mem_map-with-ARCH_PFN_OFFSET-calcu.patch b/target/linux/generic/pending-4.9/120-Fix-alloc_node_mem_map-with-ARCH_PFN_OFFSET-calcu.patch deleted file mode 100644 index d010445bcb..0000000000 --- a/target/linux/generic/pending-4.9/120-Fix-alloc_node_mem_map-with-ARCH_PFN_OFFSET-calcu.patch +++ /dev/null @@ -1,82 +0,0 @@ -From: Tobias Wolf -Subject: mm: Fix alloc_node_mem_map with ARCH_PFN_OFFSET calculation - -An rt288x (ralink) based router (Belkin F5D8235 v1) does not boot with any -kernel beyond version 4.3 resulting in: - -BUG: Bad page state in process swapper pfn:086ac - -bisect resulted in: - -a1c34a3bf00af2cede839879502e12dc68491ad5 is the first bad commit -commit a1c34a3bf00af2cede839879502e12dc68491ad5 -Author: Laura Abbott -Date: Thu Nov 5 18:48:46 2015 -0800 - - mm: Don't offset memmap for flatmem - - Srinivas Kandagatla reported bad page messages when trying to remove the - bottom 2MB on an ARM based IFC6410 board - - BUG: Bad page state in process swapper pfn:fffa8 - page:ef7fb500 count:0 mapcount:0 mapping: (null) index:0x0 - flags: 0x96640253(locked|error|dirty|active|arch_1|reclaim|mlocked) - page dumped because: PAGE_FLAGS_CHECK_AT_FREE flag(s) set - bad because of flags: - flags: 0x200041(locked|active|mlocked) - Modules linked in: - CPU: 0 PID: 0 Comm: swapper Not tainted 3.19.0-rc3-00007-g412f9ba-dirty -#816 - Hardware name: Qualcomm (Flattened Device Tree) - unwind_backtrace - show_stack - dump_stack - bad_page - free_pages_prepare - free_hot_cold_page - __free_pages - free_highmem_page - mem_init - start_kernel - Disabling lock debugging due to kernel taint - [...] -:040000 040000 2de013c372345fd471cd58f0553c9b38b0ef1cc4 -0a8156f848733dfa21e16c196dfb6c0a76290709 M mm - -This fix for ARM does not account ARCH_PFN_OFFSET for mem_map as later used by -page_to_pfn anymore. - -The following output was generated with two hacked in printk statements: - -printk("before %p vs. %p or %p\n", mem_map, mem_map - offset, mem_map - -(pgdat->node_start_pfn - ARCH_PFN_OFFSET)); - if (page_to_pfn(mem_map) != pgdat->node_start_pfn) - mem_map -= offset + (pgdat->node_start_pfn - ARCH_PFN_OFFSET); -printk("after %p\n", mem_map); - -Output: - -[ 0.000000] before 8861b280 vs. 8861b280 or 8851b280 -[ 0.000000] after 8851b280 - -As seen in the first line mem_map with subtraction of offset does not equal the -mem_map after subtraction of ARCH_PFN_OFFSET. - -After adding the offset of ARCH_PFN_OFFSET as well to mem_map as the -previously calculated offset is zero for the named platform it is able to boot -4.4 and 4.9-rc7 again. - -Signed-off-by: Tobias Wolf ---- - ---- a/mm/page_alloc.c -+++ b/mm/page_alloc.c -@@ -5922,7 +5922,7 @@ static void __ref alloc_node_mem_map(str - mem_map = NODE_DATA(0)->node_mem_map; - #if defined(CONFIG_HAVE_MEMBLOCK_NODE_MAP) || defined(CONFIG_FLATMEM) - if (page_to_pfn(mem_map) != pgdat->node_start_pfn) -- mem_map -= offset; -+ mem_map -= offset + (pgdat->node_start_pfn - ARCH_PFN_OFFSET); - #endif /* CONFIG_HAVE_MEMBLOCK_NODE_MAP */ - } - #endif diff --git a/target/linux/generic/pending-4.9/130-add-linux-spidev-compatible-si3210.patch b/target/linux/generic/pending-4.9/130-add-linux-spidev-compatible-si3210.patch deleted file mode 100644 index b3de75fbbe..0000000000 --- a/target/linux/generic/pending-4.9/130-add-linux-spidev-compatible-si3210.patch +++ /dev/null @@ -1,18 +0,0 @@ -From: Giuseppe Lippolis -Subject: Add the linux,spidev compatible in spidev Several device in ramips have this binding in the dts - -Signed-off-by: Giuseppe Lippolis ---- - drivers/spi/spidev.c | 1 + - 1 file changed, 1 insertion(+) - ---- a/drivers/spi/spidev.c -+++ b/drivers/spi/spidev.c -@@ -696,6 +696,7 @@ static struct class *spidev_class; - static const struct of_device_id spidev_dt_ids[] = { - { .compatible = "rohm,dh2228fv" }, - { .compatible = "lineartechnology,ltc2488" }, -+ { .compatible = "siliconlabs,si3210" }, - {}, - }; - MODULE_DEVICE_TABLE(of, spidev_dt_ids); diff --git a/target/linux/generic/pending-4.9/131-spi-use-gpio_set_value_cansleep-for-setting-chipsele.patch b/target/linux/generic/pending-4.9/131-spi-use-gpio_set_value_cansleep-for-setting-chipsele.patch deleted file mode 100644 index 8c2d68b9db..0000000000 --- a/target/linux/generic/pending-4.9/131-spi-use-gpio_set_value_cansleep-for-setting-chipsele.patch +++ /dev/null @@ -1,20 +0,0 @@ -From: Felix Fietkau -Subject: spi: use gpio_set_value_cansleep for setting chipselect GPIO - -Sleeping is safe inside spi_transfer_one_message, and some GPIO chips -need to sleep for setting values - -Signed-off-by: Felix Fietkau ---- - ---- a/drivers/spi/spi.c -+++ b/drivers/spi/spi.c -@@ -700,7 +700,7 @@ static void spi_set_cs(struct spi_device - enable = !enable; - - if (gpio_is_valid(spi->cs_gpio)) -- gpio_set_value(spi->cs_gpio, !enable); -+ gpio_set_value_cansleep(spi->cs_gpio, !enable); - else if (spi->master->set_cs) - spi->master->set_cs(spi, !enable); - } diff --git a/target/linux/generic/pending-4.9/140-jffs2-use-.rename2-and-add-RENAME_WHITEOUT-support.patch b/target/linux/generic/pending-4.9/140-jffs2-use-.rename2-and-add-RENAME_WHITEOUT-support.patch deleted file mode 100644 index c97e93250b..0000000000 --- a/target/linux/generic/pending-4.9/140-jffs2-use-.rename2-and-add-RENAME_WHITEOUT-support.patch +++ /dev/null @@ -1,62 +0,0 @@ -From: Felix Fietkau -Subject: jffs2: use .rename2 and add RENAME_WHITEOUT support - -It is required for renames on overlayfs - -Signed-off-by: Felix Fietkau ---- - ---- a/fs/jffs2/dir.c -+++ b/fs/jffs2/dir.c -@@ -752,6 +752,24 @@ static int jffs2_mknod (struct inode *di - return ret; - } - -+static int jffs2_whiteout (struct inode *old_dir, struct dentry *old_dentry) -+{ -+ struct dentry *wh; -+ int err; -+ -+ wh = d_alloc(old_dentry->d_parent, &old_dentry->d_name); -+ if (!wh) -+ return -ENOMEM; -+ -+ err = jffs2_mknod(old_dir, wh, S_IFCHR | WHITEOUT_MODE, -+ WHITEOUT_DEV); -+ if (err) -+ return err; -+ -+ d_rehash(wh); -+ return 0; -+} -+ - static int jffs2_rename (struct inode *old_dir_i, struct dentry *old_dentry, - struct inode *new_dir_i, struct dentry *new_dentry, - unsigned int flags) -@@ -762,7 +780,7 @@ static int jffs2_rename (struct inode *o - uint8_t type; - uint32_t now; - -- if (flags & ~RENAME_NOREPLACE) -+ if (flags & ~(RENAME_NOREPLACE|RENAME_WHITEOUT)) - return -EINVAL; - - /* The VFS will check for us and prevent trying to rename a -@@ -828,9 +846,14 @@ static int jffs2_rename (struct inode *o - if (d_is_dir(old_dentry) && !victim_f) - inc_nlink(new_dir_i); - -- /* Unlink the original */ -- ret = jffs2_do_unlink(c, JFFS2_INODE_INFO(old_dir_i), -- old_dentry->d_name.name, old_dentry->d_name.len, NULL, now); -+ if (flags & RENAME_WHITEOUT) -+ /* Replace with whiteout */ -+ ret = jffs2_whiteout(old_dir_i, old_dentry); -+ else -+ /* Unlink the original */ -+ ret = jffs2_do_unlink(c, JFFS2_INODE_INFO(old_dir_i), -+ old_dentry->d_name.name, -+ old_dentry->d_name.len, NULL, now); - - /* We don't touch inode->i_nlink */ - diff --git a/target/linux/generic/pending-4.9/141-jffs2-add-RENAME_EXCHANGE-support.patch b/target/linux/generic/pending-4.9/141-jffs2-add-RENAME_EXCHANGE-support.patch deleted file mode 100644 index 093a73ab66..0000000000 --- a/target/linux/generic/pending-4.9/141-jffs2-add-RENAME_EXCHANGE-support.patch +++ /dev/null @@ -1,73 +0,0 @@ -From: Felix Fietkau -Subject: jffs2: add RENAME_EXCHANGE support - -Signed-off-by: Felix Fietkau ---- - ---- a/fs/jffs2/dir.c -+++ b/fs/jffs2/dir.c -@@ -777,18 +777,31 @@ static int jffs2_rename (struct inode *o - int ret; - struct jffs2_sb_info *c = JFFS2_SB_INFO(old_dir_i->i_sb); - struct jffs2_inode_info *victim_f = NULL; -+ struct inode *fst_inode = d_inode(old_dentry); -+ struct inode *snd_inode = d_inode(new_dentry); - uint8_t type; - uint32_t now; - -- if (flags & ~(RENAME_NOREPLACE|RENAME_WHITEOUT)) -+ if (flags & ~(RENAME_NOREPLACE|RENAME_WHITEOUT|RENAME_EXCHANGE)) - return -EINVAL; - -+ if ((flags & RENAME_EXCHANGE) && (old_dir_i != new_dir_i)) { -+ if (S_ISDIR(fst_inode->i_mode) && !S_ISDIR(snd_inode->i_mode)) { -+ inc_nlink(new_dir_i); -+ drop_nlink(old_dir_i); -+ } -+ else if (!S_ISDIR(fst_inode->i_mode) && S_ISDIR(snd_inode->i_mode)) { -+ drop_nlink(new_dir_i); -+ inc_nlink(old_dir_i); -+ } -+ } -+ - /* The VFS will check for us and prevent trying to rename a - * file over a directory and vice versa, but if it's a directory, - * the VFS can't check whether the victim is empty. The filesystem - * needs to do that for itself. - */ -- if (d_really_is_positive(new_dentry)) { -+ if (d_really_is_positive(new_dentry) && !(flags & RENAME_EXCHANGE)) { - victim_f = JFFS2_INODE_INFO(d_inode(new_dentry)); - if (d_is_dir(new_dentry)) { - struct jffs2_full_dirent *fd; -@@ -823,7 +836,7 @@ static int jffs2_rename (struct inode *o - if (ret) - return ret; - -- if (victim_f) { -+ if (victim_f && !(flags & RENAME_EXCHANGE)) { - /* There was a victim. Kill it off nicely */ - if (d_is_dir(new_dentry)) - clear_nlink(d_inode(new_dentry)); -@@ -849,6 +862,12 @@ static int jffs2_rename (struct inode *o - if (flags & RENAME_WHITEOUT) - /* Replace with whiteout */ - ret = jffs2_whiteout(old_dir_i, old_dentry); -+ else if (flags & RENAME_EXCHANGE) -+ /* Replace the original */ -+ ret = jffs2_do_link(c, JFFS2_INODE_INFO(old_dir_i), -+ d_inode(new_dentry)->i_ino, type, -+ old_dentry->d_name.name, old_dentry->d_name.len, -+ now); - else - /* Unlink the original */ - ret = jffs2_do_unlink(c, JFFS2_INODE_INFO(old_dir_i), -@@ -880,7 +899,7 @@ static int jffs2_rename (struct inode *o - return ret; - } - -- if (d_is_dir(old_dentry)) -+ if (d_is_dir(old_dentry) && !(flags & RENAME_EXCHANGE)) - drop_nlink(old_dir_i); - - new_dir_i->i_mtime = new_dir_i->i_ctime = old_dir_i->i_mtime = old_dir_i->i_ctime = ITIME(now); diff --git a/target/linux/generic/pending-4.9/150-bridge_allow_receiption_on_disabled_port.patch b/target/linux/generic/pending-4.9/150-bridge_allow_receiption_on_disabled_port.patch deleted file mode 100644 index a164f6e7ea..0000000000 --- a/target/linux/generic/pending-4.9/150-bridge_allow_receiption_on_disabled_port.patch +++ /dev/null @@ -1,43 +0,0 @@ -From: Stephen Hemminger -Subject: bridge: allow receiption on disabled port - -When an ethernet device is enslaved to a bridge, and the bridge STP -detects loss of carrier (or operational state down), then normally -packet receiption is blocked. - -This breaks control applications like WPA which maybe expecting to -receive packets to negotiate to bring link up. The bridge needs to -block forwarding packets from these disabled ports, but there is no -hard requirement to not allow local packet delivery. - -Signed-off-by: Stephen Hemminger -Signed-off-by: Felix Fietkau - ---- a/net/bridge/br_input.c -+++ b/net/bridge/br_input.c -@@ -233,7 +233,8 @@ static int br_handle_local_finish(struct - { - struct net_bridge_port *p = br_port_get_rcu(skb->dev); - -- __br_handle_local_finish(skb); -+ if (p->state != BR_STATE_DISABLED) -+ __br_handle_local_finish(skb); - - BR_INPUT_SKB_CB(skb)->brdev = p->br->dev; - br_pass_frame_up(skb); -@@ -316,6 +317,15 @@ rx_handler_result_t br_handle_frame(stru - - forward: - switch (p->state) { -+ case BR_STATE_DISABLED: -+ if (ether_addr_equal(p->br->dev->dev_addr, dest)) -+ skb->pkt_type = PACKET_HOST; -+ -+ NF_HOOK(NFPROTO_BRIDGE, NF_BR_PRE_ROUTING, -+ dev_net(skb->dev), NULL, skb, skb->dev, NULL, -+ br_handle_local_finish); -+ break; -+ - case BR_STATE_FORWARDING: - rhook = rcu_dereference(br_should_route_hook); - if (rhook) { diff --git a/target/linux/generic/pending-4.9/161-mtd-part-add-generic-parsing-of-linux-part-probe.patch b/target/linux/generic/pending-4.9/161-mtd-part-add-generic-parsing-of-linux-part-probe.patch deleted file mode 100644 index 1b6290fca2..0000000000 --- a/target/linux/generic/pending-4.9/161-mtd-part-add-generic-parsing-of-linux-part-probe.patch +++ /dev/null @@ -1,181 +0,0 @@ -From: Hauke Mehrtens -Subject: mtd: part: add generic parsing of linux,part-probe - -This moves the linux,part-probe device tree parsing code from -physmap_of.c to mtdpart.c. Now all drivers can use this feature by just -providing a reference to their device tree node in struct -mtd_part_parser_data. - -Signed-off-by: Hauke Mehrtens ---- - Documentation/devicetree/bindings/mtd/nand.txt | 16 +++++++++ - drivers/mtd/maps/physmap_of.c | 46 +------------------------- - drivers/mtd/mtdpart.c | 45 +++++++++++++++++++++++++ - 3 files changed, 62 insertions(+), 45 deletions(-) - ---- a/Documentation/devicetree/bindings/mtd/nand.txt -+++ b/Documentation/devicetree/bindings/mtd/nand.txt -@@ -44,6 +44,22 @@ Optional NAND chip properties: - used by the upper layers, and you want to make your NAND - as reliable as possible. - -+- linux,part-probe: list of name as strings of the partition parser -+ which should be used to parse the partition table. -+ They will be tried in the specified ordering and -+ the next one will be used if the previous one -+ failed. -+ -+ Example: linux,part-probe = "cmdlinepart", "ofpart"; -+ -+ This is also the default value, which will be used -+ if this attribute is not specified. It could be -+ that the flash driver in use overwrote the default -+ value and uses some other default. -+ -+ Possible values are: bcm47xxpart, afs, ar7part, -+ ofoldpart, ofpart, bcm63xxpart, RedBoot, cmdlinepart -+ - The ECC strength and ECC step size properties define the correction capability - of a controller. Together, they say a controller can correct "{strength} bit - errors per {size} bytes". ---- a/drivers/mtd/maps/physmap_of.c -+++ b/drivers/mtd/maps/physmap_of.c -@@ -113,47 +113,9 @@ static struct mtd_info *obsolete_probe(s - static const char * const part_probe_types_def[] = { - "cmdlinepart", "RedBoot", "ofpart", "ofoldpart", NULL }; - --static const char * const *of_get_probes(struct device_node *dp) --{ -- const char *cp; -- int cplen; -- unsigned int l; -- unsigned int count; -- const char **res; -- -- cp = of_get_property(dp, "linux,part-probe", &cplen); -- if (cp == NULL) -- return part_probe_types_def; -- -- count = 0; -- for (l = 0; l != cplen; l++) -- if (cp[l] == 0) -- count++; -- -- res = kzalloc((count + 1)*sizeof(*res), GFP_KERNEL); -- if (!res) -- return NULL; -- count = 0; -- while (cplen > 0) { -- res[count] = cp; -- l = strlen(cp) + 1; -- cp += l; -- cplen -= l; -- count++; -- } -- return res; --} -- --static void of_free_probes(const char * const *probes) --{ -- if (probes != part_probe_types_def) -- kfree(probes); --} -- - static const struct of_device_id of_flash_match[]; - static int of_flash_probe(struct platform_device *dev) - { -- const char * const *part_probe_types; - const struct of_device_id *match; - struct device_node *dp = dev->dev.of_node; - struct resource res; -@@ -317,14 +279,8 @@ static int of_flash_probe(struct platfor - - info->cmtd->dev.parent = &dev->dev; - mtd_set_of_node(info->cmtd, dp); -- part_probe_types = of_get_probes(dp); -- if (!part_probe_types) { -- err = -ENOMEM; -- goto err_out; -- } -- mtd_device_parse_register(info->cmtd, part_probe_types, NULL, -+ mtd_device_parse_register(info->cmtd, part_probe_types_def, NULL, - NULL, 0); -- of_free_probes(part_probe_types); - - kfree(mtd_list); - ---- a/drivers/mtd/mtdpart.c -+++ b/drivers/mtd/mtdpart.c -@@ -29,6 +29,7 @@ - #include - #include - #include -+#include - #include - #include - -@@ -827,6 +828,42 @@ void deregister_mtd_parser(struct mtd_pa - EXPORT_SYMBOL_GPL(deregister_mtd_parser); - - /* -+ * Parses the linux,part-probe device tree property. -+ * When a non null value is returned it has to be freed with kfree() by -+ * the caller. -+ */ -+static const char * const *of_get_probes(struct device_node *dp) -+{ -+ const char *cp; -+ int cplen; -+ unsigned int l; -+ unsigned int count; -+ const char **res; -+ -+ cp = of_get_property(dp, "linux,part-probe", &cplen); -+ if (cp == NULL) -+ return NULL; -+ -+ count = 0; -+ for (l = 0; l != cplen; l++) -+ if (cp[l] == 0) -+ count++; -+ -+ res = kzalloc((count + 1) * sizeof(*res), GFP_KERNEL); -+ if (!res) -+ return NULL; -+ count = 0; -+ while (cplen > 0) { -+ res[count] = cp; -+ l = strlen(cp) + 1; -+ cp += l; -+ cplen -= l; -+ count++; -+ } -+ return res; -+} -+ -+/* - * Do not forget to update 'parse_mtd_partitions()' kerneldoc comment if you - * are changing this array! - */ -@@ -975,6 +1012,13 @@ int parse_mtd_partitions(struct mtd_info - struct mtd_partitions pparts = { }; - struct mtd_part_parser *parser; - int ret, err = 0; -+ const char *const *types_of = NULL; -+ -+ if (mtd_get_of_node(master)) { -+ types_of = of_get_probes(mtd_get_of_node(master)); -+ if (types_of != NULL) -+ types = types_of; -+ } - - if (!types) - types = mtd_is_partition(master) ? default_subpartition_types : -@@ -1016,6 +1060,7 @@ int parse_mtd_partitions(struct mtd_info - if (ret < 0 && !err) - err = ret; - } -+ kfree(types_of); - return err; - } - diff --git a/target/linux/generic/pending-4.9/170-MIPS-PCI-add-controllers-before-the-specified-head.patch b/target/linux/generic/pending-4.9/170-MIPS-PCI-add-controllers-before-the-specified-head.patch deleted file mode 100644 index 33f28912a2..0000000000 --- a/target/linux/generic/pending-4.9/170-MIPS-PCI-add-controllers-before-the-specified-head.patch +++ /dev/null @@ -1,30 +0,0 @@ -From: Mathias Kresin -Subject: MIPS: PCI: add controllers before the specified head - -With commit 23dac14d058f ("MIPS: PCI: Use struct list_head lists") new -controllers are added after the specified head where they were added -before the specified head previously. - -Use list_add_tail to restore the former order. - -This patches fixes the following PCI error on lantiq: - - pci 0000:01:00.0: BAR 0: error updating (0x1c000004 != 0x000000) - -Fixes: 23dac14d058f ("MIPS: PCI: Use struct list_head lists") -Signed-off-by: Mathias Kresin ---- - arch/mips/pci/pci-legacy.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - ---- a/arch/mips/pci/pci-legacy.c -+++ b/arch/mips/pci/pci-legacy.c -@@ -194,7 +194,7 @@ void register_pci_controller(struct pci_ - } - - INIT_LIST_HEAD(&hose->list); -- list_add(&hose->list, &controllers); -+ list_add_tail(&hose->list, &controllers); - - /* - * Do not panic here but later - this might happen before console init. diff --git a/target/linux/generic/pending-4.9/180-net-phy-at803x-add-support-for-AT8032.patch b/target/linux/generic/pending-4.9/180-net-phy-at803x-add-support-for-AT8032.patch deleted file mode 100644 index f2d5df503f..0000000000 --- a/target/linux/generic/pending-4.9/180-net-phy-at803x-add-support-for-AT8032.patch +++ /dev/null @@ -1,70 +0,0 @@ -From: Felix Fietkau -Subject: net: phy: at803x: add support for AT8032 - -Like AT8030, this PHY needs the GPIO reset workaround - -Signed-off-by: Felix Fietkau ---- - ---- a/drivers/net/phy/at803x.c -+++ b/drivers/net/phy/at803x.c -@@ -62,6 +62,7 @@ - - #define ATH8030_PHY_ID 0x004dd076 - #define ATH8031_PHY_ID 0x004dd074 -+#define ATH8032_PHY_ID 0x004dd023 - #define ATH8035_PHY_ID 0x004dd072 - - MODULE_DESCRIPTION("Atheros 803x PHY driver"); -@@ -259,7 +260,8 @@ static int at803x_probe(struct phy_devic - if (!priv) - return -ENOMEM; - -- if (phydev->drv->phy_id != ATH8030_PHY_ID) -+ if (phydev->drv->phy_id != ATH8030_PHY_ID && -+ phydev->drv->phy_id != ATH8032_PHY_ID) - goto does_not_require_reset_workaround; - - gpiod_reset = devm_gpiod_get_optional(dev, "reset", GPIOD_OUT_LOW); -@@ -335,7 +337,7 @@ static void at803x_link_change_notify(st - struct at803x_priv *priv = phydev->priv; - - /* -- * Conduct a hardware reset for AT8030 every time a link loss is -+ * Conduct a hardware reset for AT8030/2 every time a link loss is - * signalled. This is necessary to circumvent a hardware bug that - * occurs when the cable is unplugged while TX packets are pending - * in the FIFO. In such cases, the FIFO enters an error mode it -@@ -447,6 +449,24 @@ static struct phy_driver at803x_driver[] - .aneg_done = at803x_aneg_done, - .ack_interrupt = &at803x_ack_interrupt, - .config_intr = &at803x_config_intr, -+}, { -+ /* ATHEROS 8032 */ -+ .phy_id = ATH8032_PHY_ID, -+ .name = "Atheros 8032 ethernet", -+ .phy_id_mask = 0xffffffef, -+ .probe = at803x_probe, -+ .config_init = at803x_config_init, -+ .link_change_notify = at803x_link_change_notify, -+ .set_wol = at803x_set_wol, -+ .get_wol = at803x_get_wol, -+ .suspend = at803x_suspend, -+ .resume = at803x_resume, -+ .features = PHY_BASIC_FEATURES, -+ .flags = PHY_HAS_INTERRUPT, -+ .config_aneg = genphy_config_aneg, -+ .read_status = genphy_read_status, -+ .ack_interrupt = at803x_ack_interrupt, -+ .config_intr = at803x_config_intr, - } }; - - module_phy_driver(at803x_driver); -@@ -454,6 +474,7 @@ module_phy_driver(at803x_driver); - static struct mdio_device_id __maybe_unused atheros_tbl[] = { - { ATH8030_PHY_ID, 0xffffffef }, - { ATH8031_PHY_ID, 0xffffffef }, -+ { ATH8032_PHY_ID, 0xffffffef }, - { ATH8035_PHY_ID, 0xffffffef }, - { } - }; diff --git a/target/linux/generic/pending-4.9/190-2-5-e1000e-Fix-wrong-comment-related-to-link-detection.patch b/target/linux/generic/pending-4.9/190-2-5-e1000e-Fix-wrong-comment-related-to-link-detection.patch deleted file mode 100644 index 8899664fba..0000000000 --- a/target/linux/generic/pending-4.9/190-2-5-e1000e-Fix-wrong-comment-related-to-link-detection.patch +++ /dev/null @@ -1,43 +0,0 @@ -From patchwork Fri Jul 21 18:36:24 2017 -Content-Type: text/plain; charset="utf-8" -MIME-Version: 1.0 -Content-Transfer-Encoding: 7bit -Subject: [2/5] e1000e: Fix wrong comment related to link detection -From: Benjamin Poirier -X-Patchwork-Id: 9857489 -Message-Id: <20170721183627.13373-2-bpoirier@suse.com> -To: Jeff Kirsher -Cc: Lennart Sorensen , - intel-wired-lan@lists.osuosl.org, netdev@vger.kernel.org, - linux-kernel@vger.kernel.org -Date: Fri, 21 Jul 2017 11:36:24 -0700 - -Reading e1000e_check_for_copper_link() shows that get_link_status is set to -false after link has been detected. Therefore, it stays TRUE until then. - -Signed-off-by: Benjamin Poirier -Tested-by: Aaron Brown ---- - drivers/net/ethernet/intel/e1000e/netdev.c | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - ---- a/drivers/net/ethernet/intel/e1000e/netdev.c -+++ b/drivers/net/ethernet/intel/e1000e/netdev.c -@@ -5067,7 +5067,7 @@ static bool e1000e_has_link(struct e1000 - - /* get_link_status is set on LSC (link status) interrupt or - * Rx sequence error interrupt. get_link_status will stay -- * false until the check_for_link establishes link -+ * true until the check_for_link establishes link - * for copper adapters ONLY - */ - switch (hw->phy.media_type) { -@@ -5085,7 +5085,7 @@ static bool e1000e_has_link(struct e1000 - break; - case e1000_media_type_internal_serdes: - ret_val = hw->mac.ops.check_for_link(hw); -- link_active = adapter->hw.mac.serdes_has_link; -+ link_active = hw->mac.serdes_has_link; - break; - default: - case e1000_media_type_unknown: diff --git a/target/linux/generic/pending-4.9/201-extra_optimization.patch b/target/linux/generic/pending-4.9/201-extra_optimization.patch deleted file mode 100644 index 7a9d131995..0000000000 --- a/target/linux/generic/pending-4.9/201-extra_optimization.patch +++ /dev/null @@ -1,32 +0,0 @@ -From: Felix Fietkau -Subject: Upgrade to Linux 2.6.19 - -- Includes large parts of the patch from #1021 by dpalffy -- Includes RB532 NAND driver changes by n0-1 - -[john@phrozen.org: feix will add this to his upstream queue] - -lede-commit: bff468813f78f81e36ebb2a3f4354de7365e640f -Signed-off-by: Felix Fietkau ---- - Makefile | 6 +++--- - 1 file changed, 3 insertions(+), 3 deletions(-) - ---- a/Makefile -+++ b/Makefile -@@ -680,12 +680,12 @@ endif - - ifdef CONFIG_CC_OPTIMIZE_FOR_SIZE - KBUILD_CFLAGS += $(call cc-option,-Oz,-Os) --KBUILD_CFLAGS += $(call cc-disable-warning,maybe-uninitialized,) -+KBUILD_CFLAGS += $(call cc-disable-warning,maybe-uninitialized,) $(EXTRA_OPTIMIZATION) - else - ifdef CONFIG_PROFILE_ALL_BRANCHES --KBUILD_CFLAGS += -O2 $(call cc-disable-warning,maybe-uninitialized,) -+KBUILD_CFLAGS += -O2 $(call cc-disable-warning,maybe-uninitialized,) $(EXTRA_OPTIMIZATION) - else --KBUILD_CFLAGS += -O2 -+KBUILD_CFLAGS += -O2 -fno-reorder-blocks -fno-tree-ch $(EXTRA_OPTIMIZATION) - endif - endif - diff --git a/target/linux/generic/pending-4.9/203-kallsyms_uncompressed.patch b/target/linux/generic/pending-4.9/203-kallsyms_uncompressed.patch deleted file mode 100644 index f275194739..0000000000 --- a/target/linux/generic/pending-4.9/203-kallsyms_uncompressed.patch +++ /dev/null @@ -1,119 +0,0 @@ -From: Felix Fietkau -Subject: kernel: add a config option for keeping the kallsyms table uncompressed, saving ~9kb kernel size after lzma on ar71xx - -[john@phrozen.org: added to my upstream queue 30.12.2016] -lede-commit: e0e3509b5ce2ccf93d4d67ea907613f5f7ec2eed -Signed-off-by: Felix Fietkau ---- - init/Kconfig | 11 +++++++++++ - kernel/kallsyms.c | 8 ++++++++ - scripts/kallsyms.c | 12 ++++++++++++ - scripts/link-vmlinux.sh | 4 ++++ - 4 files changed, 35 insertions(+) - ---- a/init/Kconfig -+++ b/init/Kconfig -@@ -1370,6 +1370,17 @@ config SYSCTL_ARCH_UNALIGN_ALLOW - the unaligned access emulation. - see arch/parisc/kernel/unaligned.c for reference - -+config KALLSYMS_UNCOMPRESSED -+ bool "Keep kallsyms uncompressed" -+ depends on KALLSYMS -+ help -+ Normally kallsyms contains compressed symbols (using a token table), -+ reducing the uncompressed kernel image size. Keeping the symbol table -+ uncompressed significantly improves the size of this part in compressed -+ kernel images. -+ -+ Say N unless you need compressed kernel images to be small. -+ - config HAVE_PCSPKR_PLATFORM - bool - ---- a/kernel/kallsyms.c -+++ b/kernel/kallsyms.c -@@ -113,6 +113,11 @@ static unsigned int kallsyms_expand_symb - * For every byte on the compressed symbol data, copy the table - * entry for that byte. - */ -+#ifdef CONFIG_KALLSYMS_UNCOMPRESSED -+ memcpy(result, data + 1, len - 1); -+ result += len - 1; -+ len = 0; -+#endif - while (len) { - tptr = &kallsyms_token_table[kallsyms_token_index[*data]]; - data++; -@@ -145,6 +150,9 @@ tail: - */ - static char kallsyms_get_symbol_type(unsigned int off) - { -+#ifdef CONFIG_KALLSYMS_UNCOMPRESSED -+ return kallsyms_names[off + 1]; -+#endif - /* - * Get just the first code, look it up in the token table, - * and return the first char from this token. ---- a/scripts/kallsyms.c -+++ b/scripts/kallsyms.c -@@ -61,6 +61,7 @@ static struct addr_range percpu_range = - static struct sym_entry *table; - static unsigned int table_size, table_cnt; - static int all_symbols = 0; -+static int uncompressed = 0; - static int absolute_percpu = 0; - static char symbol_prefix_char = '\0'; - static int base_relative = 0; -@@ -446,6 +447,9 @@ static void write_src(void) - - free(markers); - -+ if (uncompressed) -+ return; -+ - output_label("kallsyms_token_table"); - off = 0; - for (i = 0; i < 256; i++) { -@@ -504,6 +508,9 @@ static void *find_token(unsigned char *s - { - int i; - -+ if (uncompressed) -+ return NULL; -+ - for (i = 0; i < len - 1; i++) { - if (str[i] == token[0] && str[i+1] == token[1]) - return &str[i]; -@@ -576,6 +583,9 @@ static void optimize_result(void) - { - int i, best; - -+ if (uncompressed) -+ return; -+ - /* using the '\0' symbol last allows compress_symbols to use standard - * fast string functions */ - for (i = 255; i >= 0; i--) { -@@ -764,6 +774,8 @@ int main(int argc, char **argv) - symbol_prefix_char = *p; - } else if (strcmp(argv[i], "--base-relative") == 0) - base_relative = 1; -+ else if (strcmp(argv[i], "--uncompressed") == 0) -+ uncompressed = 1; - else - usage(); - } ---- a/scripts/link-vmlinux.sh -+++ b/scripts/link-vmlinux.sh -@@ -136,6 +136,10 @@ kallsyms() - kallsymopt="${kallsymopt} --base-relative" - fi - -+ if [ -n "${CONFIG_KALLSYMS_UNCOMPRESSED}" ]; then -+ kallsymopt="${kallsymopt} --uncompressed" -+ fi -+ - local aflags="${KBUILD_AFLAGS} ${KBUILD_AFLAGS_KERNEL} \ - ${NOSTDINC_FLAGS} ${LINUXINCLUDE} ${KBUILD_CPPFLAGS}" - diff --git a/target/linux/generic/pending-4.9/205-backtrace_module_info.patch b/target/linux/generic/pending-4.9/205-backtrace_module_info.patch deleted file mode 100644 index 03c14e048f..0000000000 --- a/target/linux/generic/pending-4.9/205-backtrace_module_info.patch +++ /dev/null @@ -1,45 +0,0 @@ -From: Felix Fietkau -Subject: kernel: when KALLSYMS is disabled, print module address + size for matching backtrace entries - -[john@phrozen.org: felix will add this to his upstream queue] - -lede-commit 53827cdc824556cda910b23ce5030c363b8f1461 -Signed-off-by: Felix Fietkau ---- - lib/vsprintf.c | 15 +++++++++++---- - 1 file changed, 11 insertions(+), 4 deletions(-) - ---- a/lib/vsprintf.c -+++ b/lib/vsprintf.c -@@ -669,8 +669,10 @@ char *symbol_string(char *buf, char *end - struct printf_spec spec, const char *fmt) - { - unsigned long value; --#ifdef CONFIG_KALLSYMS - char sym[KSYM_SYMBOL_LEN]; -+#ifndef CONFIG_KALLSYMS -+ struct module *mod; -+ int len; - #endif - - if (fmt[1] == 'R') -@@ -684,11 +686,16 @@ char *symbol_string(char *buf, char *end - sprint_symbol(sym, value); - else - sprint_symbol_no_offset(sym, value); -- -- return string(buf, end, sym, spec); - #else -- return special_hex_number(buf, end, value, sizeof(void *)); -+ len = snprintf(sym, sizeof(sym), "0x%lx", value); -+ -+ mod = __module_address(value); -+ if (mod) -+ snprintf(sym + len, sizeof(sym) - len, " [%s@%p+0x%x]", -+ mod->name, mod->core_layout.base, -+ mod->core_layout.size); - #endif -+ return string(buf, end, sym, spec); - } - - static noinline_for_stack diff --git a/target/linux/generic/pending-4.9/220-optimize_inlining.patch b/target/linux/generic/pending-4.9/220-optimize_inlining.patch deleted file mode 100644 index 75c04ea15c..0000000000 --- a/target/linux/generic/pending-4.9/220-optimize_inlining.patch +++ /dev/null @@ -1,70 +0,0 @@ ---- a/arch/x86/Kconfig.debug -+++ b/arch/x86/Kconfig.debug -@@ -287,20 +287,6 @@ config CPA_DEBUG - ---help--- - Do change_page_attr() self-tests every 30 seconds. - --config OPTIMIZE_INLINING -- bool "Allow gcc to uninline functions marked 'inline'" -- ---help--- -- This option determines if the kernel forces gcc to inline the functions -- developers have marked 'inline'. Doing so takes away freedom from gcc to -- do what it thinks is best, which is desirable for the gcc 3.x series of -- compilers. The gcc 4.x series have a rewritten inlining algorithm and -- enabling this option will generate a smaller kernel there. Hopefully -- this algorithm is so good that allowing gcc 4.x and above to make the -- decision will become the default in the future. Until then this option -- is there to test gcc for this. -- -- If unsure, say N. -- - config DEBUG_ENTRY - bool "Debug low-level entry code" - depends on DEBUG_KERNEL ---- a/lib/Kconfig.debug -+++ b/lib/Kconfig.debug -@@ -117,6 +117,20 @@ endmenu # "printk and dmesg options" - - menu "Compile-time checks and compiler options" - -+config OPTIMIZE_INLINING -+ bool "Allow gcc to uninline functions marked 'inline'" -+ ---help--- -+ This option determines if the kernel forces gcc to inline the functions -+ developers have marked 'inline'. Doing so takes away freedom from gcc to -+ do what it thinks is best, which is desirable for the gcc 3.x series of -+ compilers. The gcc 4.x series have a rewritten inlining algorithm and -+ enabling this option will generate a smaller kernel there. Hopefully -+ this algorithm is so good that allowing gcc 4.x and above to make the -+ decision will become the default in the future. Until then this option -+ is there to test gcc for this. -+ -+ If unsure, say N. -+ - config DEBUG_INFO - bool "Compile the kernel with debug info" - depends on DEBUG_KERNEL && !COMPILE_TEST ---- a/arch/x86/Kconfig -+++ b/arch/x86/Kconfig -@@ -273,9 +273,6 @@ config ZONE_DMA32 - config AUDIT_ARCH - def_bool y if X86_64 - --config ARCH_SUPPORTS_OPTIMIZED_INLINING -- def_bool y -- - config ARCH_SUPPORTS_DEBUG_PAGEALLOC - def_bool y - ---- a/include/linux/compiler-gcc.h -+++ b/include/linux/compiler-gcc.h -@@ -89,8 +89,7 @@ - * of extern inline functions at link time. - * A lot of inline functions can cause havoc with function tracing. - */ --#if !defined(CONFIG_ARCH_SUPPORTS_OPTIMIZED_INLINING) || \ -- !defined(CONFIG_OPTIMIZE_INLINING) || (__GNUC__ < 4) -+#if !defined(CONFIG_OPTIMIZE_INLINING) || (__GNUC__ < 4) - #define inline \ - inline __attribute__((always_inline, unused)) notrace __gnu_inline - #else diff --git a/target/linux/generic/pending-4.9/240-remove-unsane-filenames-from-deps_initramfs-list.patch b/target/linux/generic/pending-4.9/240-remove-unsane-filenames-from-deps_initramfs-list.patch deleted file mode 100644 index 3f3cc6311b..0000000000 --- a/target/linux/generic/pending-4.9/240-remove-unsane-filenames-from-deps_initramfs-list.patch +++ /dev/null @@ -1,47 +0,0 @@ -From: Gabor Juhos -Subject: usr: sanitize deps_initramfs list - -If any filename in the intramfs dependency -list contains a colon, that causes a kernel -build error like this: - -/devel/librecmc/build_dir/linux-ar71xx_generic/linux-3.6.6/usr/Makefile:58: *** multiple target patterns. Stop. -make[5]: *** [usr] Error 2 - -Fix it by removing such filenames from the -deps_initramfs list. - -Signed-off-by: Gabor Juhos ---- - usr/Makefile | 8 +++++--- - 1 file changed, 5 insertions(+), 3 deletions(-) - ---- a/usr/Makefile -+++ b/usr/Makefile -@@ -53,6 +53,8 @@ ifneq ($(wildcard $(obj)/.initramfs_data - include $(obj)/.initramfs_data.cpio.d - endif - -+deps_initramfs_sane := $(foreach v,$(deps_initramfs),$(if $(findstring :,$(v)),,$(v))) -+ - quiet_cmd_initfs = GEN $@ - cmd_initfs = $(initramfs) -o $@ $(ramfs-args) $(ramfs-input) - -@@ -61,14 +63,14 @@ targets := initramfs_data.cpio.gz initra - initramfs_data.cpio.lzo initramfs_data.cpio.lz4 \ - initramfs_data.cpio - # do not try to update files included in initramfs --$(deps_initramfs): ; -+$(deps_initramfs_sane): ; - --$(deps_initramfs): klibcdirs -+$(deps_initramfs_sane): klibcdirs - # We rebuild initramfs_data.cpio if: - # 1) Any included file is newer then initramfs_data.cpio - # 2) There are changes in which files are included (added or deleted) - # 3) If gen_init_cpio are newer than initramfs_data.cpio - # 4) arguments to gen_initramfs.sh changes --$(obj)/initramfs_data.cpio$(suffix_y): $(obj)/gen_init_cpio $(deps_initramfs) klibcdirs -+$(obj)/initramfs_data.cpio$(suffix_y): $(obj)/gen_init_cpio $(deps_initramfs_sane) klibcdirs - $(Q)$(initramfs) -l $(ramfs-input) > $(obj)/.initramfs_data.cpio.d - $(call if_changed,initfs) diff --git a/target/linux/generic/pending-4.9/261-enable_wilink_platform_without_drivers.patch b/target/linux/generic/pending-4.9/261-enable_wilink_platform_without_drivers.patch deleted file mode 100644 index 9955ab3c0b..0000000000 --- a/target/linux/generic/pending-4.9/261-enable_wilink_platform_without_drivers.patch +++ /dev/null @@ -1,20 +0,0 @@ -From: Imre Kaloz -Subject: [PATCH] hack: net: wireless: make the wl12xx glue code available with - compat-wireless, too - -Signed-off-by: Imre Kaloz ---- - drivers/net/wireless/ti/Kconfig | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - ---- a/drivers/net/wireless/ti/Kconfig -+++ b/drivers/net/wireless/ti/Kconfig -@@ -19,7 +19,7 @@ source "drivers/net/wireless/ti/wlcore/K - - config WILINK_PLATFORM_DATA - bool "TI WiLink platform data" -- depends on WLCORE_SDIO || WL1251_SDIO -+ depends on WLCORE_SDIO || WL1251_SDIO || ARCH_OMAP2PLUS - default y - ---help--- - Small platform data bit needed to pass data to the sdio modules. diff --git a/target/linux/generic/pending-4.9/300-mips_expose_boot_raw.patch b/target/linux/generic/pending-4.9/300-mips_expose_boot_raw.patch deleted file mode 100644 index 68a0833580..0000000000 --- a/target/linux/generic/pending-4.9/300-mips_expose_boot_raw.patch +++ /dev/null @@ -1,40 +0,0 @@ -From: Mark Miller -Subject: mips: expose CONFIG_BOOT_RAW - -This exposes the CONFIG_BOOT_RAW symbol in Kconfig. This is needed on -certain Broadcom chipsets running CFE in order to load the kernel. - -Signed-off-by: Mark Miller -Acked-by: Rob Landley ---- ---- a/arch/mips/Kconfig -+++ b/arch/mips/Kconfig -@@ -1068,9 +1068,6 @@ config FW_ARC - config ARCH_MAY_HAVE_PC_FDC - bool - --config BOOT_RAW -- bool -- - config CEVT_BCM1480 - bool - -@@ -2967,6 +2964,18 @@ choice - bool "Extend builtin kernel arguments with bootloader arguments" - endchoice - -+config BOOT_RAW -+ bool "Enable the kernel to be executed from the load address" -+ default n -+ help -+ Allow the kernel to be executed from the load address for -+ bootloaders which cannot read the ELF format. This places -+ a jump to start_kernel at the load address. -+ -+ If unsure, say N. -+ -+ -+ - endmenu - - config LOCKDEP_SUPPORT diff --git a/target/linux/generic/pending-4.9/302-mips_no_branch_likely.patch b/target/linux/generic/pending-4.9/302-mips_no_branch_likely.patch deleted file mode 100644 index 0e4600237d..0000000000 --- a/target/linux/generic/pending-4.9/302-mips_no_branch_likely.patch +++ /dev/null @@ -1,22 +0,0 @@ -From: Felix Fietkau -Subject: mips: use -mno-branch-likely for kernel and userspace - -saves ~11k kernel size after lzma and ~12k squashfs size in the - -lede-commit: 41a039f46450ffae9483d6216422098669da2900 -Signed-off-by: Felix Fietkau ---- - arch/mips/Makefile | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - ---- a/arch/mips/Makefile -+++ b/arch/mips/Makefile -@@ -90,7 +90,7 @@ all-$(CONFIG_SYS_SUPPORTS_ZBOOT)+= vmlin - # machines may also. Since BFD is incredibly buggy with respect to - # crossformat linking we rely on the elf2ecoff tool for format conversion. - # --cflags-y += -G 0 -mno-abicalls -fno-pic -pipe -+cflags-y += -G 0 -mno-abicalls -fno-pic -pipe -mno-branch-likely - cflags-y += -msoft-float - LDFLAGS_vmlinux += -G 0 -static -n -nostdlib - KBUILD_AFLAGS_MODULE += -mlong-calls diff --git a/target/linux/generic/pending-4.9/304-mips_disable_fpu.patch b/target/linux/generic/pending-4.9/304-mips_disable_fpu.patch deleted file mode 100644 index 889c79ad9b..0000000000 --- a/target/linux/generic/pending-4.9/304-mips_disable_fpu.patch +++ /dev/null @@ -1,137 +0,0 @@ -From: Manuel Lauss -Subject: [RFC PATCH v4 2/2] MIPS: make FPU emulator optional - -This small patch makes the MIPS FPU emulator optional. The kernel -kills float-users on systems without a hardware FPU by sending a SIGILL. - -Disabling the emulator shrinks vmlinux by about 54kBytes (32bit, -optimizing for size). - -Signed-off-by: Manuel Lauss ---- -v4: rediffed because of patch 1/2, should now work with micromips as well -v3: updated patch description with size savings. -v2: incorporated changes suggested by Jonas Gorski - force the fpu emulator on for micromips: relocating the parts - of the mmips code in the emulator to other areas would be a - much larger change; I went the cheap route instead with this. - - arch/mips/Kbuild | 2 +- - arch/mips/Kconfig | 14 ++++++++++++++ - arch/mips/include/asm/fpu.h | 5 +++-- - arch/mips/include/asm/fpu_emulator.h | 15 +++++++++++++++ - 4 files changed, 33 insertions(+), 3 deletions(-) - ---- a/arch/mips/Kconfig -+++ b/arch/mips/Kconfig -@@ -2891,6 +2891,20 @@ config MIPS_O32_FP64_SUPPORT - - If unsure, say N. - -+config MIPS_FPU_EMULATOR -+ bool "MIPS FPU Emulator" -+ default y -+ help -+ This option lets you disable the built-in MIPS FPU (Coprocessor 1) -+ emulator, which handles floating-point instructions on processors -+ without a hardware FPU. It is generally a good idea to keep the -+ emulator built-in, unless you are perfectly sure you have a -+ complete soft-float environment. With the emulator disabled, all -+ users of float operations will be killed with an illegal instr- -+ uction exception. -+ -+ Say Y, please. -+ - config USE_OF - bool - select OF ---- a/arch/mips/Makefile -+++ b/arch/mips/Makefile -@@ -287,7 +287,7 @@ OBJCOPYFLAGS += --remove-section=.regin - head-y := arch/mips/kernel/head.o - - libs-y += arch/mips/lib/ --libs-y += arch/mips/math-emu/ -+libs-$(CONFIG_MIPS_FPU_EMULATOR) += arch/mips/math-emu/ - - # See arch/mips/Kbuild for content of core part of the kernel - core-y += arch/mips/ ---- a/arch/mips/include/asm/fpu.h -+++ b/arch/mips/include/asm/fpu.h -@@ -227,8 +227,10 @@ static inline int init_fpu(void) - /* Restore FRE */ - write_c0_config5(config5); - enable_fpu_hazard(); -- } else -+ } else if (IS_ENABLED(CONFIG_MIPS_FPU_EMULATOR)) - fpu_emulator_init_fpu(); -+ else -+ ret = SIGILL; - - return ret; - } ---- a/arch/mips/include/asm/fpu_emulator.h -+++ b/arch/mips/include/asm/fpu_emulator.h -@@ -30,6 +30,7 @@ - #include - #include - -+#ifdef CONFIG_MIPS_FPU_EMULATOR - #ifdef CONFIG_DEBUG_FS - - struct mips_fpu_emulator_stats { -@@ -63,6 +64,16 @@ do { \ - extern int fpu_emulator_cop1Handler(struct pt_regs *xcp, - struct mips_fpu_struct *ctx, int has_fpu, - void *__user *fault_addr); -+#else /* no CONFIG_MIPS_FPU_EMULATOR */ -+static inline int fpu_emulator_cop1Handler(struct pt_regs *xcp, -+ struct mips_fpu_struct *ctx, int has_fpu, -+ void *__user *fault_addr) -+{ -+ *fault_addr = NULL; -+ return SIGILL; /* we don't speak MIPS FPU */ -+} -+#endif /* CONFIG_MIPS_FPU_EMULATOR */ -+ - void force_fcr31_sig(unsigned long fcr31, void __user *fault_addr, - struct task_struct *tsk); - int process_fpemu_return(int sig, void __user *fault_addr, ---- a/arch/mips/include/asm/dsemul.h -+++ b/arch/mips/include/asm/dsemul.h -@@ -41,6 +41,7 @@ struct task_struct; - extern int mips_dsemul(struct pt_regs *regs, mips_instruction ir, - unsigned long branch_pc, unsigned long cont_pc); - -+#ifdef CONFIG_MIPS_FPU_EMULATOR - /** - * do_dsemulret() - Return from a delay slot 'emulation' frame - * @xcp: User thread register context. -@@ -88,5 +89,27 @@ extern bool dsemul_thread_rollback(struc - * before @mm is freed in order to avoid memory leaks. - */ - extern void dsemul_mm_cleanup(struct mm_struct *mm); -+#else -+static inline bool do_dsemulret(struct pt_regs *xcp) -+{ -+ return false; -+} -+ -+static inline bool dsemul_thread_cleanup(struct task_struct *tsk) -+{ -+ return false; -+} -+ -+static inline bool dsemul_thread_rollback(struct pt_regs *regs) -+{ -+ return false; -+} -+ -+static inline void dsemul_mm_cleanup(struct mm_struct *mm) -+{ -+ -+} -+ -+#endif - - #endif /* __MIPS_ASM_DSEMUL_H__ */ diff --git a/target/linux/generic/pending-4.9/305-mips_module_reloc.patch b/target/linux/generic/pending-4.9/305-mips_module_reloc.patch deleted file mode 100644 index 10d9f0bdd5..0000000000 --- a/target/linux/generic/pending-4.9/305-mips_module_reloc.patch +++ /dev/null @@ -1,370 +0,0 @@ -From: Felix Fietkau -Subject: mips: replace -mlong-calls with -mno-long-calls to make function calls faster in kernel modules to achieve this, try to - -lede-commit: 3b3d64743ba2a874df9d70cd19e242205b0a788c -Signed-off-by: Felix Fietkau ---- - arch/mips/Makefile | 5 + - arch/mips/include/asm/module.h | 5 + - arch/mips/kernel/module.c | 279 ++++++++++++++++++++++++++++++++++++++++- - 3 files changed, 284 insertions(+), 5 deletions(-) - ---- a/arch/mips/Makefile -+++ b/arch/mips/Makefile -@@ -93,8 +93,18 @@ all-$(CONFIG_SYS_SUPPORTS_ZBOOT)+= vmlin - cflags-y += -G 0 -mno-abicalls -fno-pic -pipe -mno-branch-likely - cflags-y += -msoft-float - LDFLAGS_vmlinux += -G 0 -static -n -nostdlib -+ifdef CONFIG_64BIT - KBUILD_AFLAGS_MODULE += -mlong-calls - KBUILD_CFLAGS_MODULE += -mlong-calls -+else -+ ifdef CONFIG_DYNAMIC_FTRACE -+ KBUILD_AFLAGS_MODULE += -mlong-calls -+ KBUILD_CFLAGS_MODULE += -mlong-calls -+ else -+ KBUILD_AFLAGS_MODULE += -mno-long-calls -+ KBUILD_CFLAGS_MODULE += -mno-long-calls -+ endif -+endif - - ifeq ($(CONFIG_RELOCATABLE),y) - LDFLAGS_vmlinux += --emit-relocs ---- a/arch/mips/include/asm/module.h -+++ b/arch/mips/include/asm/module.h -@@ -11,6 +11,11 @@ struct mod_arch_specific { - const struct exception_table_entry *dbe_start; - const struct exception_table_entry *dbe_end; - struct mips_hi16 *r_mips_hi16_list; -+ -+ void *phys_plt_tbl; -+ void *virt_plt_tbl; -+ unsigned int phys_plt_offset; -+ unsigned int virt_plt_offset; - }; - - typedef uint8_t Elf64_Byte; /* Type for a 8-bit quantity. */ ---- a/arch/mips/kernel/module.c -+++ b/arch/mips/kernel/module.c -@@ -44,14 +44,221 @@ struct mips_hi16 { - static LIST_HEAD(dbe_list); - static DEFINE_SPINLOCK(dbe_lock); - --#ifdef MODULE_START -+/* -+ * Get the potential max trampolines size required of the init and -+ * non-init sections. Only used if we cannot find enough contiguous -+ * physically mapped memory to put the module into. -+ */ -+static unsigned int -+get_plt_size(const Elf_Ehdr *hdr, const Elf_Shdr *sechdrs, -+ const char *secstrings, unsigned int symindex, bool is_init) -+{ -+ unsigned long ret = 0; -+ unsigned int i, j; -+ Elf_Sym *syms; -+ -+ /* Everything marked ALLOC (this includes the exported symbols) */ -+ for (i = 1; i < hdr->e_shnum; ++i) { -+ unsigned int info = sechdrs[i].sh_info; -+ -+ if (sechdrs[i].sh_type != SHT_REL -+ && sechdrs[i].sh_type != SHT_RELA) -+ continue; -+ -+ /* Not a valid relocation section? */ -+ if (info >= hdr->e_shnum) -+ continue; -+ -+ /* Don't bother with non-allocated sections */ -+ if (!(sechdrs[info].sh_flags & SHF_ALLOC)) -+ continue; -+ -+ /* If it's called *.init*, and we're not init, we're -+ not interested */ -+ if ((strstr(secstrings + sechdrs[i].sh_name, ".init") != 0) -+ != is_init) -+ continue; -+ -+ syms = (Elf_Sym *) sechdrs[symindex].sh_addr; -+ if (sechdrs[i].sh_type == SHT_REL) { -+ Elf_Mips_Rel *rel = (void *) sechdrs[i].sh_addr; -+ unsigned int size = sechdrs[i].sh_size / sizeof(*rel); -+ -+ for (j = 0; j < size; ++j) { -+ Elf_Sym *sym; -+ -+ if (ELF_MIPS_R_TYPE(rel[j]) != R_MIPS_26) -+ continue; -+ -+ sym = syms + ELF_MIPS_R_SYM(rel[j]); -+ if (!is_init && sym->st_shndx != SHN_UNDEF) -+ continue; -+ -+ ret += 4 * sizeof(int); -+ } -+ } else { -+ Elf_Mips_Rela *rela = (void *) sechdrs[i].sh_addr; -+ unsigned int size = sechdrs[i].sh_size / sizeof(*rela); -+ -+ for (j = 0; j < size; ++j) { -+ Elf_Sym *sym; -+ -+ if (ELF_MIPS_R_TYPE(rela[j]) != R_MIPS_26) -+ continue; -+ -+ sym = syms + ELF_MIPS_R_SYM(rela[j]); -+ if (!is_init && sym->st_shndx != SHN_UNDEF) -+ continue; -+ -+ ret += 4 * sizeof(int); -+ } -+ } -+ } -+ -+ return ret; -+} -+ -+#ifndef MODULE_START -+static void *alloc_phys(unsigned long size) -+{ -+ unsigned order; -+ struct page *page; -+ struct page *p; -+ -+ size = PAGE_ALIGN(size); -+ order = get_order(size); -+ -+ page = alloc_pages(GFP_KERNEL | __GFP_NORETRY | __GFP_NOWARN | -+ __GFP_THISNODE, order); -+ if (!page) -+ return NULL; -+ -+ split_page(page, order); -+ -+ /* mark all pages except for the last one */ -+ for (p = page; p + 1 < page + (size >> PAGE_SHIFT); ++p) -+ set_bit(PG_owner_priv_1, &p->flags); -+ -+ for (p = page + (size >> PAGE_SHIFT); p < page + (1 << order); ++p) -+ __free_page(p); -+ -+ return page_address(page); -+} -+#endif -+ -+static void free_phys(void *ptr) -+{ -+ struct page *page; -+ bool free; -+ -+ page = virt_to_page(ptr); -+ do { -+ free = test_and_clear_bit(PG_owner_priv_1, &page->flags); -+ __free_page(page); -+ page++; -+ } while (free); -+} -+ -+ - void *module_alloc(unsigned long size) - { -+#ifdef MODULE_START - return __vmalloc_node_range(size, 1, MODULE_START, MODULE_END, - GFP_KERNEL, PAGE_KERNEL, 0, NUMA_NO_NODE, - __builtin_return_address(0)); -+#else -+ void *ptr; -+ -+ if (size == 0) -+ return NULL; -+ -+ ptr = alloc_phys(size); -+ -+ /* If we failed to allocate physically contiguous memory, -+ * fall back to regular vmalloc. The module loader code will -+ * create jump tables to handle long jumps */ -+ if (!ptr) -+ return vmalloc(size); -+ -+ return ptr; -+#endif - } -+ -+static inline bool is_phys_addr(void *ptr) -+{ -+#ifdef CONFIG_64BIT -+ return (KSEGX((unsigned long)ptr) == CKSEG0); -+#else -+ return (KSEGX(ptr) == KSEG0); - #endif -+} -+ -+/* Free memory returned from module_alloc */ -+void module_memfree(void *module_region) -+{ -+ if (is_phys_addr(module_region)) -+ free_phys(module_region); -+ else -+ vfree(module_region); -+} -+ -+static void *__module_alloc(int size, bool phys) -+{ -+ void *ptr; -+ -+ if (phys) -+ ptr = kmalloc(size, GFP_KERNEL); -+ else -+ ptr = vmalloc(size); -+ return ptr; -+} -+ -+static void __module_free(void *ptr) -+{ -+ if (is_phys_addr(ptr)) -+ kfree(ptr); -+ else -+ vfree(ptr); -+} -+ -+int module_frob_arch_sections(Elf_Ehdr *hdr, Elf_Shdr *sechdrs, -+ char *secstrings, struct module *mod) -+{ -+ unsigned int symindex = 0; -+ unsigned int core_size, init_size; -+ int i; -+ -+ mod->arch.phys_plt_offset = 0; -+ mod->arch.virt_plt_offset = 0; -+ mod->arch.phys_plt_tbl = NULL; -+ mod->arch.virt_plt_tbl = NULL; -+ -+ if (IS_ENABLED(CONFIG_64BIT)) -+ return 0; -+ -+ for (i = 1; i < hdr->e_shnum; i++) -+ if (sechdrs[i].sh_type == SHT_SYMTAB) -+ symindex = i; -+ -+ core_size = get_plt_size(hdr, sechdrs, secstrings, symindex, false); -+ init_size = get_plt_size(hdr, sechdrs, secstrings, symindex, true); -+ -+ if ((core_size + init_size) == 0) -+ return 0; -+ -+ mod->arch.phys_plt_tbl = __module_alloc(core_size + init_size, 1); -+ if (!mod->arch.phys_plt_tbl) -+ return -ENOMEM; -+ -+ mod->arch.virt_plt_tbl = __module_alloc(core_size + init_size, 0); -+ if (!mod->arch.virt_plt_tbl) { -+ __module_free(mod->arch.phys_plt_tbl); -+ mod->arch.phys_plt_tbl = NULL; -+ return -ENOMEM; -+ } -+ -+ return 0; -+} - - int apply_r_mips_none(struct module *me, u32 *location, Elf_Addr v) - { -@@ -65,8 +272,39 @@ static int apply_r_mips_32_rel(struct mo - return 0; - } - -+static Elf_Addr add_plt_entry_to(unsigned *plt_offset, -+ void *start, Elf_Addr v) -+{ -+ unsigned *tramp = start + *plt_offset; -+ *plt_offset += 4 * sizeof(int); -+ -+ /* adjust carry for addiu */ -+ if (v & 0x00008000) -+ v += 0x10000; -+ -+ tramp[0] = 0x3c190000 | (v >> 16); /* lui t9, hi16 */ -+ tramp[1] = 0x27390000 | (v & 0xffff); /* addiu t9, t9, lo16 */ -+ tramp[2] = 0x03200008; /* jr t9 */ -+ tramp[3] = 0x00000000; /* nop */ -+ -+ return (Elf_Addr) tramp; -+} -+ -+static Elf_Addr add_plt_entry(struct module *me, void *location, Elf_Addr v) -+{ -+ if (is_phys_addr(location)) -+ return add_plt_entry_to(&me->arch.phys_plt_offset, -+ me->arch.phys_plt_tbl, v); -+ else -+ return add_plt_entry_to(&me->arch.virt_plt_offset, -+ me->arch.virt_plt_tbl, v); -+ -+} -+ - static int apply_r_mips_26_rel(struct module *me, u32 *location, Elf_Addr v) - { -+ u32 ofs = *location & 0x03ffffff; -+ - if (v % 4) { - pr_err("module %s: dangerous R_MIPS_26 REL relocation\n", - me->name); -@@ -74,13 +312,17 @@ static int apply_r_mips_26_rel(struct mo - } - - if ((v & 0xf0000000) != (((unsigned long)location + 4) & 0xf0000000)) { -- pr_err("module %s: relocation overflow\n", -- me->name); -- return -ENOEXEC; -+ v = add_plt_entry(me, location, v + (ofs << 2)); -+ if (!v) { -+ pr_err("module %s: relocation overflow\n", -+ me->name); -+ return -ENOEXEC; -+ } -+ ofs = 0; - } - - *location = (*location & ~0x03ffffff) | -- ((*location + (v >> 2)) & 0x03ffffff); -+ ((ofs + (v >> 2)) & 0x03ffffff); - - return 0; - } -@@ -349,9 +591,36 @@ int module_finalize(const Elf_Ehdr *hdr, - list_add(&me->arch.dbe_list, &dbe_list); - spin_unlock_irq(&dbe_lock); - } -+ -+ /* Get rid of the fixup trampoline if we're running the module -+ * from physically mapped address space */ -+ if (me->arch.phys_plt_offset == 0) { -+ __module_free(me->arch.phys_plt_tbl); -+ me->arch.phys_plt_tbl = NULL; -+ } -+ if (me->arch.virt_plt_offset == 0) { -+ __module_free(me->arch.virt_plt_tbl); -+ me->arch.virt_plt_tbl = NULL; -+ } -+ - return 0; - } - -+void module_arch_freeing_init(struct module *mod) -+{ -+ if (mod->state == MODULE_STATE_LIVE) -+ return; -+ -+ if (mod->arch.phys_plt_tbl) { -+ __module_free(mod->arch.phys_plt_tbl); -+ mod->arch.phys_plt_tbl = NULL; -+ } -+ if (mod->arch.virt_plt_tbl) { -+ __module_free(mod->arch.virt_plt_tbl); -+ mod->arch.virt_plt_tbl = NULL; -+ } -+} -+ - void module_arch_cleanup(struct module *mod) - { - spin_lock_irq(&dbe_lock); diff --git a/target/linux/generic/pending-4.9/306-mips_mem_functions_performance.patch b/target/linux/generic/pending-4.9/306-mips_mem_functions_performance.patch deleted file mode 100644 index 2e404b2236..0000000000 --- a/target/linux/generic/pending-4.9/306-mips_mem_functions_performance.patch +++ /dev/null @@ -1,106 +0,0 @@ -From: Felix Fietkau -Subject: [PATCH] mips: allow the compiler to optimize memset, memcmp, memcpy for better performance and (in some instances) smaller code - -lede-commit: 07e59c7bc7f375f792ec9734be42fe4fa391a8bb -Signed-off-by: Felix Fietkau ---- - arch/mips/boot/compressed/Makefile | 3 ++- - arch/mips/include/asm/string.h | 38 ++++++++++++++++++++++++++++++++++++++ - arch/mips/lib/Makefile | 2 +- - arch/mips/lib/memcmp.c | 22 ++++++++++++++++++++++ - 4 files changed, 63 insertions(+), 2 deletions(-) - create mode 100644 arch/mips/lib/memcmp.c - ---- a/arch/mips/boot/compressed/Makefile -+++ b/arch/mips/boot/compressed/Makefile -@@ -23,7 +23,8 @@ KBUILD_CFLAGS := $(shell echo $(KBUILD_C - KBUILD_CFLAGS := $(filter-out -fstack-protector, $(KBUILD_CFLAGS)) - - KBUILD_CFLAGS := $(LINUXINCLUDE) $(KBUILD_CFLAGS) -D__KERNEL__ \ -- -DBOOT_HEAP_SIZE=$(BOOT_HEAP_SIZE) -D"VMLINUX_LOAD_ADDRESS_ULL=$(VMLINUX_LOAD_ADDRESS)ull" -+ -DBOOT_HEAP_SIZE=$(BOOT_HEAP_SIZE) -D"VMLINUX_LOAD_ADDRESS_ULL=$(VMLINUX_LOAD_ADDRESS)ull" \ -+ -D__ZBOOT__ - - KBUILD_AFLAGS := $(LINUXINCLUDE) $(KBUILD_AFLAGS) -D__ASSEMBLY__ \ - -DBOOT_HEAP_SIZE=$(BOOT_HEAP_SIZE) \ ---- a/arch/mips/include/asm/string.h -+++ b/arch/mips/include/asm/string.h -@@ -140,4 +140,42 @@ extern void *memcpy(void *__to, __const_ - #define __HAVE_ARCH_MEMMOVE - extern void *memmove(void *__dest, __const__ void *__src, size_t __n); - -+#ifndef __ZBOOT__ -+#define memset(__s, __c, len) \ -+({ \ -+ size_t __len = (len); \ -+ void *__ret; \ -+ if (__builtin_constant_p(len) && __len >= 64) \ -+ __ret = memset((__s), (__c), __len); \ -+ else \ -+ __ret = __builtin_memset((__s), (__c), __len); \ -+ __ret; \ -+}) -+ -+#define memcpy(dst, src, len) \ -+({ \ -+ size_t __len = (len); \ -+ void *__ret; \ -+ if (__builtin_constant_p(len) && __len >= 64) \ -+ __ret = memcpy((dst), (src), __len); \ -+ else \ -+ __ret = __builtin_memcpy((dst), (src), __len); \ -+ __ret; \ -+}) -+ -+#define memmove(dst, src, len) \ -+({ \ -+ size_t __len = (len); \ -+ void *__ret; \ -+ if (__builtin_constant_p(len) && __len >= 64) \ -+ __ret = memmove((dst), (src), __len); \ -+ else \ -+ __ret = __builtin_memmove((dst), (src), __len); \ -+ __ret; \ -+}) -+ -+#define __HAVE_ARCH_MEMCMP -+#define memcmp(src1, src2, len) __builtin_memcmp((src1), (src2), (len)) -+#endif -+ - #endif /* _ASM_STRING_H */ ---- a/arch/mips/lib/Makefile -+++ b/arch/mips/lib/Makefile -@@ -4,7 +4,7 @@ - - lib-y += bitops.o csum_partial.o delay.o memcpy.o memset.o \ - mips-atomic.o strlen_user.o strncpy_user.o \ -- strnlen_user.o uncached.o -+ strnlen_user.o uncached.o memcmp.o - - obj-y += iomap.o - obj-$(CONFIG_PCI) += iomap-pci.o ---- /dev/null -+++ b/arch/mips/lib/memcmp.c -@@ -0,0 +1,22 @@ -+/* -+ * copied from linux/lib/string.c -+ * -+ * Copyright (C) 1991, 1992 Linus Torvalds -+ */ -+ -+#include -+#include -+ -+#undef memcmp -+int memcmp(const void *cs, const void *ct, size_t count) -+{ -+ const unsigned char *su1, *su2; -+ int res = 0; -+ -+ for (su1 = cs, su2 = ct; 0 < count; ++su1, ++su2, count--) -+ if ((res = *su1 - *su2) != 0) -+ break; -+ return res; -+} -+EXPORT_SYMBOL(memcmp); -+ diff --git a/target/linux/generic/pending-4.9/307-mips_highmem_offset.patch b/target/linux/generic/pending-4.9/307-mips_highmem_offset.patch deleted file mode 100644 index 0529b0c5c8..0000000000 --- a/target/linux/generic/pending-4.9/307-mips_highmem_offset.patch +++ /dev/null @@ -1,19 +0,0 @@ -From: Felix Fietkau -Subject: kernel: adjust mips highmem offset to avoid the need for -mlong-calls on systems with >256M RAM - -Signed-off-by: Felix Fietkau ---- - arch/mips/include/asm/mach-generic/spaces.h | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - ---- a/arch/mips/include/asm/mach-generic/spaces.h -+++ b/arch/mips/include/asm/mach-generic/spaces.h -@@ -46,7 +46,7 @@ - * Memory above this physical address will be considered highmem. - */ - #ifndef HIGHMEM_START --#define HIGHMEM_START _AC(0x20000000, UL) -+#define HIGHMEM_START _AC(0x10000000, UL) - #endif - - #endif /* CONFIG_32BIT */ diff --git a/target/linux/generic/pending-4.9/308-mips32r2_tune.patch b/target/linux/generic/pending-4.9/308-mips32r2_tune.patch deleted file mode 100644 index 9e1efe2713..0000000000 --- a/target/linux/generic/pending-4.9/308-mips32r2_tune.patch +++ /dev/null @@ -1,22 +0,0 @@ -From: Felix Fietkau -Subject: kernel: add -mtune=34kc to MIPS CFLAGS when building for mips32r2 - -This provides a good tradeoff across at least 24Kc-74Kc, while also -producing smaller code. - -Signed-off-by: Felix Fietkau ---- - arch/mips/Makefile | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - ---- a/arch/mips/Makefile -+++ b/arch/mips/Makefile -@@ -153,7 +153,7 @@ cflags-$(CONFIG_CPU_R4X00) += -march=r46 - cflags-$(CONFIG_CPU_TX49XX) += -march=r4600 -Wa,--trap - cflags-$(CONFIG_CPU_MIPS32_R1) += $(call cc-option,-march=mips32,-mips32 -U_MIPS_ISA -D_MIPS_ISA=_MIPS_ISA_MIPS32) \ - -Wa,-mips32 -Wa,--trap --cflags-$(CONFIG_CPU_MIPS32_R2) += $(call cc-option,-march=mips32r2,-mips32r2 -U_MIPS_ISA -D_MIPS_ISA=_MIPS_ISA_MIPS32) \ -+cflags-$(CONFIG_CPU_MIPS32_R2) += $(call cc-option,-march=mips32r2 -mtune=34kc,-mips32r2 -U_MIPS_ISA -D_MIPS_ISA=_MIPS_ISA_MIPS32) \ - -Wa,-mips32r2 -Wa,--trap - cflags-$(CONFIG_CPU_MIPS32_R6) += -march=mips32r6 -Wa,--trap - cflags-$(CONFIG_CPU_MIPS64_R1) += $(call cc-option,-march=mips64,-mips64 -U_MIPS_ISA -D_MIPS_ISA=_MIPS_ISA_MIPS64) \ diff --git a/target/linux/generic/pending-4.9/309-MIPS-Add-CPU-option-reporting-to-proc-cpuinfo.patch b/target/linux/generic/pending-4.9/309-MIPS-Add-CPU-option-reporting-to-proc-cpuinfo.patch deleted file mode 100644 index b9c072b237..0000000000 --- a/target/linux/generic/pending-4.9/309-MIPS-Add-CPU-option-reporting-to-proc-cpuinfo.patch +++ /dev/null @@ -1,134 +0,0 @@ -From 87ec87c2ad615c1a177cd08ef5fa29fc739f6e50 Mon Sep 17 00:00:00 2001 -From: Hauke Mehrtens -Date: Sun, 23 Dec 2018 18:06:53 +0100 -Subject: [PATCH] MIPS: Add CPU option reporting to /proc/cpuinfo - -Many MIPS CPUs have optional CPU features which are not activates for -all CPU cores. Print the CPU options which are implemented in the core -in /proc/cpuinfo. This makes it possible to see what features are -supported and which are not supported. This should cover all standard -MIPS extensions, before it only printed information about the main MIPS -ASEs. - -Signed-off-by: Hauke Mehrtens ---- - arch/mips/kernel/proc.c | 116 ++++++++++++++++++++++++++++++++++++++++ - 1 file changed, 116 insertions(+) - ---- a/arch/mips/kernel/proc.c -+++ b/arch/mips/kernel/proc.c -@@ -128,6 +128,114 @@ static int show_cpuinfo(struct seq_file - seq_printf(m, "micromips kernel\t: %s\n", - (read_c0_config3() & MIPS_CONF3_ISA_OE) ? "yes" : "no"); - } -+ -+ seq_printf(m, "Options implemented\t:"); -+ if (cpu_has_tlb) -+ seq_printf(m, "%s", " tlb"); -+ if (cpu_has_ftlb) -+ seq_printf(m, "%s", " ftlb"); -+ if (cpu_has_tlbinv) -+ seq_printf(m, "%s", " tlbinv"); -+ if (cpu_has_segments) -+ seq_printf(m, "%s", " segments"); -+ if (cpu_has_rixiex) -+ seq_printf(m, "%s", " rixiex"); -+ if (cpu_has_ldpte) -+ seq_printf(m, "%s", " ldpte"); -+ if (cpu_has_maar) -+ seq_printf(m, "%s", " maar"); -+ if (cpu_has_rw_llb) -+ seq_printf(m, "%s", " rw_llb"); -+ if (cpu_has_4kex) -+ seq_printf(m, "%s", " 4kex"); -+ if (cpu_has_3k_cache) -+ seq_printf(m, "%s", " 3k_cache"); -+ if (cpu_has_4k_cache) -+ seq_printf(m, "%s", " 4k_cache"); -+ if (cpu_has_6k_cache) -+ seq_printf(m, "%s", " 6k_cache"); -+ if (cpu_has_8k_cache) -+ seq_printf(m, "%s", " 8k_cache"); -+ if (cpu_has_tx39_cache) -+ seq_printf(m, "%s", " tx39_cache"); -+ if (cpu_has_octeon_cache) -+ seq_printf(m, "%s", " octeon_cache"); -+ if (cpu_has_fpu) -+ seq_printf(m, "%s", " fpu"); -+ if (cpu_has_32fpr) -+ seq_printf(m, "%s", " 32fpr"); -+ if (cpu_has_cache_cdex_p) -+ seq_printf(m, "%s", " cache_cdex_p"); -+ if (cpu_has_cache_cdex_s) -+ seq_printf(m, "%s", " cache_cdex_s"); -+ if (cpu_has_prefetch) -+ seq_printf(m, "%s", " prefetch"); -+ if (cpu_has_mcheck) -+ seq_printf(m, "%s", " mcheck"); -+ if (cpu_has_ejtag) -+ seq_printf(m, "%s", " ejtag"); -+ if (cpu_has_llsc) -+ seq_printf(m, "%s", " llsc"); -+ if (cpu_has_bp_ghist) -+ seq_printf(m, "%s", " bp_ghist"); -+ if (cpu_has_guestctl0ext) -+ seq_printf(m, "%s", " guestctl0ext"); -+ if (cpu_has_guestctl1) -+ seq_printf(m, "%s", " guestctl1"); -+ if (cpu_has_guestctl2) -+ seq_printf(m, "%s", " guestctl2"); -+ if (cpu_has_guestid) -+ seq_printf(m, "%s", " guestid"); -+ if (cpu_has_drg) -+ seq_printf(m, "%s", " drg"); -+ if (cpu_has_rixi) -+ seq_printf(m, "%s", " rixi"); -+ if (cpu_has_lpa) -+ seq_printf(m, "%s", " lpa"); -+ if (cpu_has_mvh) -+ seq_printf(m, "%s", " mvh"); -+ if (cpu_has_vtag_icache) -+ seq_printf(m, "%s", " vtag_icache"); -+ if (cpu_has_dc_aliases) -+ seq_printf(m, "%s", " dc_aliases"); -+ if (cpu_has_ic_fills_f_dc) -+ seq_printf(m, "%s", " ic_fills_f_dc"); -+ if (cpu_has_pindexed_dcache) -+ seq_printf(m, "%s", " pindexed_dcache"); -+ if (cpu_has_userlocal) -+ seq_printf(m, "%s", " userlocal"); -+ if (cpu_has_nofpuex) -+ seq_printf(m, "%s", " nofpuex"); -+ if (cpu_has_vint) -+ seq_printf(m, "%s", " vint"); -+ if (cpu_has_veic) -+ seq_printf(m, "%s", " veic"); -+ if (cpu_has_inclusive_pcaches) -+ seq_printf(m, "%s", " inclusive_pcaches"); -+ if (cpu_has_perf_cntr_intr_bit) -+ seq_printf(m, "%s", " perf_cntr_intr_bit"); -+ if (cpu_has_fre) -+ seq_printf(m, "%s", " fre"); -+ if (cpu_has_cdmm) -+ seq_printf(m, "%s", " cdmm"); -+ if (cpu_has_small_pages) -+ seq_printf(m, "%s", " small_pages"); -+ if (cpu_has_nan_legacy) -+ seq_printf(m, "%s", " nan_legacy"); -+ if (cpu_has_nan_2008) -+ seq_printf(m, "%s", " nan_2008"); -+ if (cpu_has_ebase_wg) -+ seq_printf(m, "%s", " ebase_wg"); -+ if (cpu_has_badinstr) -+ seq_printf(m, "%s", " badinstr"); -+ if (cpu_has_badinstrp) -+ seq_printf(m, "%s", " badinstrp"); -+ if (cpu_has_contextconfig) -+ seq_printf(m, "%s", " contextconfig"); -+ if (cpu_has_perf) -+ seq_printf(m, "%s", " perf"); -+ seq_printf(m, "\n"); -+ - seq_printf(m, "shadow register sets\t: %d\n", - cpu_data[n].srsets); - seq_printf(m, "kscratch registers\t: %d\n", diff --git a/target/linux/generic/pending-4.9/310-arm_module_unresolved_weak_sym.patch b/target/linux/generic/pending-4.9/310-arm_module_unresolved_weak_sym.patch deleted file mode 100644 index cc1a51d17d..0000000000 --- a/target/linux/generic/pending-4.9/310-arm_module_unresolved_weak_sym.patch +++ /dev/null @@ -1,22 +0,0 @@ -From: Felix Fietkau -Subject: fix errors in unresolved weak symbols on arm - -lede-commit: 570699d4838a907c3ef9f2819bf19eb72997b32f -Signed-off-by: Felix Fietkau ---- - arch/arm/kernel/module.c | 4 ++++ - 1 file changed, 4 insertions(+) - ---- a/arch/arm/kernel/module.c -+++ b/arch/arm/kernel/module.c -@@ -88,6 +88,10 @@ apply_relocate(Elf32_Shdr *sechdrs, cons - return -ENOEXEC; - } - -+ if ((IS_ERR_VALUE(sym->st_value) || !sym->st_value) && -+ ELF_ST_BIND(sym->st_info) == STB_WEAK) -+ continue; -+ - loc = dstsec->sh_addr + rel->r_offset; - - switch (ELF32_R_TYPE(rel->r_info)) { diff --git a/target/linux/generic/pending-4.9/330-MIPS-kexec-Accept-command-line-parameters-from-users.patch b/target/linux/generic/pending-4.9/330-MIPS-kexec-Accept-command-line-parameters-from-users.patch deleted file mode 100644 index c7abd99b3b..0000000000 --- a/target/linux/generic/pending-4.9/330-MIPS-kexec-Accept-command-line-parameters-from-users.patch +++ /dev/null @@ -1,269 +0,0 @@ -From: Yousong Zhou -Subject: MIPS: kexec: Accept command line parameters from userspace. - -Signed-off-by: Yousong Zhou ---- - arch/mips/kernel/machine_kexec.c | 153 +++++++++++++++++++++++++++++++----- - arch/mips/kernel/machine_kexec.h | 20 +++++ - arch/mips/kernel/relocate_kernel.S | 21 +++-- - 3 files changed, 167 insertions(+), 27 deletions(-) - create mode 100644 arch/mips/kernel/machine_kexec.h - ---- a/arch/mips/kernel/machine_kexec.c -+++ b/arch/mips/kernel/machine_kexec.c -@@ -10,14 +10,11 @@ - #include - #include - -+#include - #include - #include -- --extern const unsigned char relocate_new_kernel[]; --extern const size_t relocate_new_kernel_size; -- --extern unsigned long kexec_start_address; --extern unsigned long kexec_indirection_page; -+#include -+#include "machine_kexec.h" - - int (*_machine_kexec_prepare)(struct kimage *) = NULL; - void (*_machine_kexec_shutdown)(void) = NULL; -@@ -28,9 +25,115 @@ atomic_t kexec_ready_to_reboot = ATOMIC_ - void (*_crash_smp_send_stop)(void) = NULL; - #endif - -+static void machine_kexec_print_args(void) -+{ -+ unsigned long argc = (int)kexec_args[0]; -+ int i; -+ -+ pr_info("kexec_args[0] (argc): %lu\n", argc); -+ pr_info("kexec_args[1] (argv): %p\n", (void *)kexec_args[1]); -+ pr_info("kexec_args[2] (env ): %p\n", (void *)kexec_args[2]); -+ pr_info("kexec_args[3] (desc): %p\n", (void *)kexec_args[3]); -+ -+ for (i = 0; i < argc; i++) { -+ pr_info("kexec_argv[%d] = %p, %s\n", -+ i, kexec_argv[i], kexec_argv[i]); -+ } -+} -+ -+static void machine_kexec_init_argv(struct kimage *image) -+{ -+ void __user *buf = NULL; -+ size_t bufsz; -+ size_t size; -+ int i; -+ -+ bufsz = 0; -+ for (i = 0; i < image->nr_segments; i++) { -+ struct kexec_segment *seg; -+ -+ seg = &image->segment[i]; -+ if (seg->bufsz < 6) -+ continue; -+ -+ if (strncmp((char *) seg->buf, "kexec ", 6)) -+ continue; -+ -+ buf = seg->buf; -+ bufsz = seg->bufsz; -+ break; -+ } -+ -+ if (!buf) -+ return; -+ -+ size = KEXEC_COMMAND_LINE_SIZE; -+ size = min(size, bufsz); -+ if (size < bufsz) -+ pr_warn("kexec command line truncated to %zd bytes\n", size); -+ -+ /* Copy to kernel space */ -+ copy_from_user(kexec_argv_buf, buf, size); -+ kexec_argv_buf[size - 1] = 0; -+} -+ -+static void machine_kexec_parse_argv(struct kimage *image) -+{ -+ char *reboot_code_buffer; -+ int reloc_delta; -+ char *ptr; -+ int argc; -+ int i; -+ -+ ptr = kexec_argv_buf; -+ argc = 0; -+ -+ /* -+ * convert command line string to array of parameters -+ * (as bootloader does). -+ */ -+ while (ptr && *ptr && (KEXEC_MAX_ARGC > argc)) { -+ if (*ptr == ' ') { -+ *ptr++ = '\0'; -+ continue; -+ } -+ -+ kexec_argv[argc++] = ptr; -+ ptr = strchr(ptr, ' '); -+ } -+ -+ if (!argc) -+ return; -+ -+ kexec_args[0] = argc; -+ kexec_args[1] = (unsigned long)kexec_argv; -+ kexec_args[2] = 0; -+ kexec_args[3] = 0; -+ -+ reboot_code_buffer = page_address(image->control_code_page); -+ reloc_delta = reboot_code_buffer - (char *)kexec_relocate_new_kernel; -+ -+ kexec_args[1] += reloc_delta; -+ for (i = 0; i < argc; i++) -+ kexec_argv[i] += reloc_delta; -+} -+ - int - machine_kexec_prepare(struct kimage *kimage) - { -+ /* -+ * Whenever arguments passed from kexec-tools, Init the arguments as -+ * the original ones to try avoiding booting failure. -+ */ -+ -+ kexec_args[0] = fw_arg0; -+ kexec_args[1] = fw_arg1; -+ kexec_args[2] = fw_arg2; -+ kexec_args[3] = fw_arg3; -+ -+ machine_kexec_init_argv(kimage); -+ machine_kexec_parse_argv(kimage); -+ - if (_machine_kexec_prepare) - return _machine_kexec_prepare(kimage); - return 0; -@@ -67,10 +170,12 @@ machine_kexec(struct kimage *image) - unsigned long *ptr; - - reboot_code_buffer = -- (unsigned long)page_address(image->control_code_page); -+ (unsigned long)page_address(image->control_code_page); -+ pr_info("reboot_code_buffer = %p\n", (void *)reboot_code_buffer); - - kexec_start_address = - (unsigned long) phys_to_virt(image->start); -+ pr_info("kexec_start_address = %p\n", (void *)kexec_start_address); - - if (image->type == KEXEC_TYPE_DEFAULT) { - kexec_indirection_page = -@@ -78,9 +183,19 @@ machine_kexec(struct kimage *image) - } else { - kexec_indirection_page = (unsigned long)&image->head; - } -+ pr_info("kexec_indirection_page = %p\n", (void *)kexec_indirection_page); - -- memcpy((void*)reboot_code_buffer, relocate_new_kernel, -- relocate_new_kernel_size); -+ pr_info("Where is memcpy: %p\n", memcpy); -+ pr_info("kexec_relocate_new_kernel = %p, kexec_relocate_new_kernel_end = %p\n", -+ (void *)kexec_relocate_new_kernel, &kexec_relocate_new_kernel_end); -+ pr_info("Copy %lu bytes from %p to %p\n", KEXEC_RELOCATE_NEW_KERNEL_SIZE, -+ (void *)kexec_relocate_new_kernel, (void *)reboot_code_buffer); -+ memcpy((void*)reboot_code_buffer, kexec_relocate_new_kernel, -+ KEXEC_RELOCATE_NEW_KERNEL_SIZE); -+ -+ pr_info("Before _print_args().\n"); -+ machine_kexec_print_args(); -+ pr_info("Before eval loop.\n"); - - /* - * The generic kexec code builds a page list with physical -@@ -102,15 +217,16 @@ machine_kexec(struct kimage *image) - /* - * we do not want to be bothered. - */ -+ pr_info("Before irq_disable.\n"); - local_irq_disable(); - -- printk("Will call new kernel at %08lx\n", image->start); -- printk("Bye ...\n"); -+ pr_info("Will call new kernel at %08lx\n", image->start); -+ pr_info("Bye ...\n"); - __flush_cache_all(); - #ifdef CONFIG_SMP - /* All secondary cpus now may jump to kexec_wait cycle */ - relocated_kexec_smp_wait = reboot_code_buffer + -- (void *)(kexec_smp_wait - relocate_new_kernel); -+ (void *)(kexec_smp_wait - kexec_relocate_new_kernel); - smp_wmb(); - atomic_set(&kexec_ready_to_reboot, 1); - #endif ---- /dev/null -+++ b/arch/mips/kernel/machine_kexec.h -@@ -0,0 +1,20 @@ -+#ifndef _MACHINE_KEXEC_H -+#define _MACHINE_KEXEC_H -+ -+#ifndef __ASSEMBLY__ -+extern const unsigned char kexec_relocate_new_kernel[]; -+extern unsigned long kexec_relocate_new_kernel_end; -+extern unsigned long kexec_start_address; -+extern unsigned long kexec_indirection_page; -+ -+extern char kexec_argv_buf[]; -+extern char *kexec_argv[]; -+ -+#define KEXEC_RELOCATE_NEW_KERNEL_SIZE ((unsigned long)&kexec_relocate_new_kernel_end - (unsigned long)kexec_relocate_new_kernel) -+#endif /* !__ASSEMBLY__ */ -+ -+#define KEXEC_COMMAND_LINE_SIZE 256 -+#define KEXEC_ARGV_SIZE (KEXEC_COMMAND_LINE_SIZE / 16) -+#define KEXEC_MAX_ARGC (KEXEC_ARGV_SIZE / sizeof(long)) -+ -+#endif ---- a/arch/mips/kernel/relocate_kernel.S -+++ b/arch/mips/kernel/relocate_kernel.S -@@ -12,8 +12,9 @@ - #include - #include - #include -+#include "machine_kexec.h" - --LEAF(relocate_new_kernel) -+LEAF(kexec_relocate_new_kernel) - PTR_L a0, arg0 - PTR_L a1, arg1 - PTR_L a2, arg2 -@@ -98,7 +99,7 @@ done: - #endif - /* jump to kexec_start_address */ - j s1 -- END(relocate_new_kernel) -+ END(kexec_relocate_new_kernel) - - #ifdef CONFIG_SMP - /* -@@ -184,9 +185,15 @@ kexec_indirection_page: - PTR 0 - .size kexec_indirection_page, PTRSIZE - --relocate_new_kernel_end: -+kexec_argv_buf: -+ EXPORT(kexec_argv_buf) -+ .skip KEXEC_COMMAND_LINE_SIZE -+ .size kexec_argv_buf, KEXEC_COMMAND_LINE_SIZE -+ -+kexec_argv: -+ EXPORT(kexec_argv) -+ .skip KEXEC_ARGV_SIZE -+ .size kexec_argv, KEXEC_ARGV_SIZE - --relocate_new_kernel_size: -- EXPORT(relocate_new_kernel_size) -- PTR relocate_new_kernel_end - relocate_new_kernel -- .size relocate_new_kernel_size, PTRSIZE -+kexec_relocate_new_kernel_end: -+ EXPORT(kexec_relocate_new_kernel_end) diff --git a/target/linux/generic/pending-4.9/332-arc-add-OWRTDTB-section.patch b/target/linux/generic/pending-4.9/332-arc-add-OWRTDTB-section.patch deleted file mode 100644 index fa1527ff81..0000000000 --- a/target/linux/generic/pending-4.9/332-arc-add-OWRTDTB-section.patch +++ /dev/null @@ -1,80 +0,0 @@ -From: Alexey Brodkin -Subject: librecmc: arc - add OWRTDTB section - -This change allows OpenWRT to patch resulting kernel binary with -external .dtb. - -That allows us to re-use exactky the same vmlinux on different boards -given its ARC core configurations match (at least cache line sizes etc). - -""patch-dtb" searches for ASCII "OWRTDTB:" strign and copies external -.dtb right after it, keeping the string in place. - -Signed-off-by: Alexey Brodkin ---- - arch/arc/kernel/head.S | 10 ++++++++++ - arch/arc/kernel/setup.c | 4 +++- - arch/arc/kernel/vmlinux.lds.S | 13 +++++++++++++ - 3 files changed, 26 insertions(+), 1 deletion(-) - ---- a/arch/arc/kernel/head.S -+++ b/arch/arc/kernel/head.S -@@ -49,6 +49,16 @@ - 1: - .endm - -+; Here "patch-dtb" will embed external .dtb -+; Note "patch-dtb" searches for ASCII "OWRTDTB:" string -+; and pastes .dtb right after it, hense the string precedes -+; __image_dtb symbol. -+ .section .owrt, "aw",@progbits -+ .ascii "OWRTDTB:" -+ENTRY(__image_dtb) -+ .fill 0x4000 -+END(__image_dtb) -+ - .section .init.text, "ax",@progbits - - ;---------------------------------------------------------------- ---- a/arch/arc/kernel/setup.c -+++ b/arch/arc/kernel/setup.c -@@ -388,6 +388,8 @@ static inline int is_kernel(unsigned lon - return 0; - } - -+extern struct boot_param_header __image_dtb; -+ - void __init setup_arch(char **cmdline_p) - { - #ifdef CONFIG_ARC_UBOOT_SUPPORT -@@ -401,7 +403,7 @@ void __init setup_arch(char **cmdline_p) - #endif - { - /* No, so try the embedded one */ -- machine_desc = setup_machine_fdt(__dtb_start); -+ machine_desc = setup_machine_fdt(&__image_dtb); - if (!machine_desc) - panic("Embedded DT invalid\n"); - ---- a/arch/arc/kernel/vmlinux.lds.S -+++ b/arch/arc/kernel/vmlinux.lds.S -@@ -30,6 +30,19 @@ SECTIONS - - . = CONFIG_LINUX_LINK_BASE; - -+ /* -+ * In OpenWRT we want to patch built binary embedding .dtb of choice. -+ * This is implemented with "patch-dtb" utility which searches for -+ * "OWRTDTB:" string in first 16k of image and if it is found -+ * copies .dtb right after mentioned string. -+ * -+ * Note: "OWRTDTB:" won't be overwritten with .dtb, .dtb will follow it. -+ */ -+ .owrt : { -+ *(.owrt) -+ . = ALIGN(PAGE_SIZE); -+ } -+ - _int_vec_base_lds = .; - .vector : { - *(.vector) diff --git a/target/linux/generic/pending-4.9/333-arc-enable-unaligned-access-in-kernel-mode.patch b/target/linux/generic/pending-4.9/333-arc-enable-unaligned-access-in-kernel-mode.patch deleted file mode 100644 index 4e0265aef5..0000000000 --- a/target/linux/generic/pending-4.9/333-arc-enable-unaligned-access-in-kernel-mode.patch +++ /dev/null @@ -1,24 +0,0 @@ -From: Alexey Brodkin -Subject: arc: enable unaligned access in kernel mode - -This enables misaligned access handling even in kernel mode. -Some wireless drivers (ath9k-htc and mt7601u) use misaligned accesses -here and there and to cope with that without fixing stuff in the drivers -we're just gracefully handling it on ARC. - -Signed-off-by: Alexey Brodkin ---- - arch/arc/kernel/unaligned.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - ---- a/arch/arc/kernel/unaligned.c -+++ b/arch/arc/kernel/unaligned.c -@@ -206,7 +206,7 @@ int misaligned_fixup(unsigned long addre - char buf[TASK_COMM_LEN]; - - /* handle user mode only and only if enabled by sysadmin */ -- if (!user_mode(regs) || !unaligned_enabled) -+ if (!unaligned_enabled) - return 1; - - if (no_unaligned_warning) { diff --git a/target/linux/generic/pending-4.9/340-MIPS-mm-remove-mips_dma_mapping_error.patch b/target/linux/generic/pending-4.9/340-MIPS-mm-remove-mips_dma_mapping_error.patch deleted file mode 100644 index 4091542581..0000000000 --- a/target/linux/generic/pending-4.9/340-MIPS-mm-remove-mips_dma_mapping_error.patch +++ /dev/null @@ -1,32 +0,0 @@ -From: Felix Fietkau -Date: Tue, 5 Dec 2017 12:34:31 +0100 -Subject: [PATCH] MIPS: mm: remove mips_dma_mapping_error - -dma_mapping_error() already checks if ops->mapping_error is a null -pointer - -Signed-off-by: Felix Fietkau ---- - ---- a/arch/mips/mm/dma-default.c -+++ b/arch/mips/mm/dma-default.c -@@ -394,11 +394,6 @@ static void mips_dma_sync_sg_for_device( - } - } - --int mips_dma_mapping_error(struct device *dev, dma_addr_t dma_addr) --{ -- return 0; --} -- - int mips_dma_supported(struct device *dev, u64 mask) - { - return plat_dma_supported(dev, mask); -@@ -427,7 +422,6 @@ static struct dma_map_ops mips_default_d - .sync_single_for_device = mips_dma_sync_single_for_device, - .sync_sg_for_cpu = mips_dma_sync_sg_for_cpu, - .sync_sg_for_device = mips_dma_sync_sg_for_device, -- .mapping_error = mips_dma_mapping_error, - .dma_supported = mips_dma_supported - }; - diff --git a/target/linux/generic/pending-4.9/341-MIPS-mm-remove-no-op-dma_map_ops-where-possible.patch b/target/linux/generic/pending-4.9/341-MIPS-mm-remove-no-op-dma_map_ops-where-possible.patch deleted file mode 100644 index 15788c7860..0000000000 --- a/target/linux/generic/pending-4.9/341-MIPS-mm-remove-no-op-dma_map_ops-where-possible.patch +++ /dev/null @@ -1,140 +0,0 @@ -From: Felix Fietkau -Date: Tue, 5 Dec 2017 12:46:01 +0100 -Subject: [PATCH] MIPS: mm: remove no-op dma_map_ops where possible - -If no post-DMA flush is required, and the platform does not provide -plat_unmap_dma_mem(), there is no need to include unmap or sync_for_cpu -ops. - -With this patch they are compiled out to improve icache footprint -on devices that handle lots of DMA traffic (especially network routers). - -Signed-off-by: Felix Fietkau ---- - ---- a/arch/mips/Kconfig -+++ b/arch/mips/Kconfig -@@ -214,6 +214,7 @@ config BMIPS_GENERIC - select BRCMSTB_L2_IRQ - select IRQ_MIPS_CPU - select DMA_NONCOHERENT -+ select DMA_UNMAP_POST_FLUSH - select SYS_SUPPORTS_32BIT_KERNEL - select SYS_SUPPORTS_LITTLE_ENDIAN - select SYS_SUPPORTS_BIG_ENDIAN -@@ -339,6 +340,7 @@ config MACH_JAZZ - select CSRC_R4K - select DEFAULT_SGI_PARTITION if CPU_BIG_ENDIAN - select GENERIC_ISA_DMA -+ select DMA_UNMAP_POST_FLUSH - select HAVE_PCSPKR_PLATFORM - select IRQ_MIPS_CPU - select I8253 -@@ -1129,6 +1131,9 @@ config DMA_NONCOHERENT - bool - select NEED_DMA_MAP_STATE - -+config DMA_UNMAP_POST_FLUSH -+ bool -+ - config NEED_DMA_MAP_STATE - bool - -@@ -1653,6 +1658,7 @@ config CPU_R10000 - select CPU_SUPPORTS_64BIT_KERNEL - select CPU_SUPPORTS_HIGHMEM - select CPU_SUPPORTS_HUGEPAGES -+ select DMA_UNMAP_POST_FLUSH - help - MIPS Technologies R10000-series processors. - -@@ -1898,9 +1904,11 @@ config SYS_HAS_CPU_MIPS32_R3_5 - bool - - config SYS_HAS_CPU_MIPS32_R5 -+ select DMA_UNMAP_POST_FLUSH - bool - - config SYS_HAS_CPU_MIPS32_R6 -+ select DMA_UNMAP_POST_FLUSH - bool - - config SYS_HAS_CPU_MIPS64_R1 -@@ -1910,6 +1918,7 @@ config SYS_HAS_CPU_MIPS64_R2 - bool - - config SYS_HAS_CPU_MIPS64_R6 -+ select DMA_UNMAP_POST_FLUSH - bool - - config SYS_HAS_CPU_R3000 ---- a/arch/mips/mm/dma-default.c -+++ b/arch/mips/mm/dma-default.c -@@ -290,8 +290,9 @@ static inline void __dma_sync(struct pag - } while (left); - } - --static void mips_dma_unmap_page(struct device *dev, dma_addr_t dma_addr, -- size_t size, enum dma_data_direction direction, unsigned long attrs) -+static void __maybe_unused -+mips_dma_unmap_page(struct device *dev, dma_addr_t dma_addr, size_t size, -+ enum dma_data_direction direction, unsigned long attrs) - { - if (cpu_needs_post_dma_flush(dev)) - __dma_sync(dma_addr_to_page(dev, dma_addr), -@@ -330,9 +331,10 @@ static dma_addr_t mips_dma_map_page(stru - return plat_map_dma_mem_page(dev, page) + offset; - } - --static void mips_dma_unmap_sg(struct device *dev, struct scatterlist *sglist, -- int nhwentries, enum dma_data_direction direction, -- unsigned long attrs) -+static void __maybe_unused -+mips_dma_unmap_sg(struct device *dev, struct scatterlist *sglist, -+ int nhwentries, enum dma_data_direction direction, -+ unsigned long attrs) - { - int i; - struct scatterlist *sg; -@@ -346,8 +348,9 @@ static void mips_dma_unmap_sg(struct dev - } - } - --static void mips_dma_sync_single_for_cpu(struct device *dev, -- dma_addr_t dma_handle, size_t size, enum dma_data_direction direction) -+static void __maybe_unused -+mips_dma_sync_single_for_cpu(struct device *dev, dma_addr_t dma_handle, -+ size_t size, enum dma_data_direction direction) - { - if (cpu_needs_post_dma_flush(dev)) - __dma_sync(dma_addr_to_page(dev, dma_handle), -@@ -363,9 +366,9 @@ static void mips_dma_sync_single_for_dev - dma_handle & ~PAGE_MASK, size, direction); - } - --static void mips_dma_sync_sg_for_cpu(struct device *dev, -- struct scatterlist *sglist, int nelems, -- enum dma_data_direction direction) -+static void __maybe_unused -+mips_dma_sync_sg_for_cpu(struct device *dev, struct scatterlist *sglist, -+ int nelems, enum dma_data_direction direction) - { - int i; - struct scatterlist *sg; -@@ -415,12 +418,14 @@ static struct dma_map_ops mips_default_d - .free = mips_dma_free_coherent, - .mmap = mips_dma_mmap, - .map_page = mips_dma_map_page, -- .unmap_page = mips_dma_unmap_page, - .map_sg = mips_dma_map_sg, -+#ifdef CONFIG_DMA_UNMAP_POST_FLUSH -+ .unmap_page = mips_dma_unmap_page, - .unmap_sg = mips_dma_unmap_sg, - .sync_single_for_cpu = mips_dma_sync_single_for_cpu, -- .sync_single_for_device = mips_dma_sync_single_for_device, - .sync_sg_for_cpu = mips_dma_sync_sg_for_cpu, -+#endif -+ .sync_single_for_device = mips_dma_sync_single_for_device, - .sync_sg_for_device = mips_dma_sync_sg_for_device, - .dma_supported = mips_dma_supported - }; diff --git a/target/linux/generic/pending-4.9/400-mtd-add-rootfs-split-support.patch b/target/linux/generic/pending-4.9/400-mtd-add-rootfs-split-support.patch deleted file mode 100644 index c1cf648429..0000000000 --- a/target/linux/generic/pending-4.9/400-mtd-add-rootfs-split-support.patch +++ /dev/null @@ -1,108 +0,0 @@ -From: Felix Fietkau -Subject: make rootfs split/detection more generic - patch can be moved to generic-2.6 after testing on other platforms - -lede-commit: 328e660b31f0937d52c5ae3d6e7029409918a9df -Signed-off-by: Felix Fietkau ---- - drivers/mtd/Kconfig | 17 +++++++++++++++++ - drivers/mtd/mtdpart.c | 35 +++++++++++++++++++++++++++++++++++ - include/linux/mtd/partitions.h | 2 ++ - 3 files changed, 54 insertions(+) - ---- a/drivers/mtd/Kconfig -+++ b/drivers/mtd/Kconfig -@@ -12,6 +12,23 @@ menuconfig MTD - - if MTD - -+menu "libreCMC specific MTD options" -+ -+config MTD_ROOTFS_ROOT_DEV -+ bool "Automatically set 'rootfs' partition to be root filesystem" -+ default y -+ -+config MTD_SPLIT_FIRMWARE -+ bool "Automatically split firmware partition for kernel+rootfs" -+ default y -+ -+config MTD_SPLIT_FIRMWARE_NAME -+ string "Firmware partition name" -+ depends on MTD_SPLIT_FIRMWARE -+ default "firmware" -+ -+endmenu -+ - config MTD_TESTS - tristate "MTD tests support (DANGEROUS)" - depends on m ---- a/drivers/mtd/mtdpart.c -+++ b/drivers/mtd/mtdpart.c -@@ -29,11 +29,13 @@ - #include - #include - #include -+#include - #include - #include - #include - - #include "mtdcore.h" -+#include "mtdsplit/mtdsplit.h" - - /* Our partition linked list */ - static LIST_HEAD(mtd_partitions); -@@ -53,6 +55,8 @@ struct mtd_part { - struct list_head list; - }; - -+static void mtd_partition_split(struct mtd_info *master, struct mtd_part *part); -+ - /* - * Given a pointer to the MTD object in the mtd_part structure, we can retrieve - * the pointer to that structure. -@@ -650,6 +654,7 @@ int mtd_add_partition(struct mtd_info *p - mutex_unlock(&mtd_partitions_mutex); - - add_mtd_device(&new->mtd); -+ mtd_partition_split(parent, new); - - mtd_add_partition_attrs(new); - -@@ -728,6 +733,29 @@ int mtd_del_partition(struct mtd_info *m - } - EXPORT_SYMBOL_GPL(mtd_del_partition); - -+#ifdef CONFIG_MTD_SPLIT_FIRMWARE_NAME -+#define SPLIT_FIRMWARE_NAME CONFIG_MTD_SPLIT_FIRMWARE_NAME -+#else -+#define SPLIT_FIRMWARE_NAME "unused" -+#endif -+ -+static void split_firmware(struct mtd_info *master, struct mtd_part *part) -+{ -+} -+ -+static void mtd_partition_split(struct mtd_info *master, struct mtd_part *part) -+{ -+ static int rootfs_found = 0; -+ -+ if (rootfs_found) -+ return; -+ -+ if (IS_ENABLED(CONFIG_MTD_SPLIT_FIRMWARE) && -+ !strcmp(part->mtd.name, SPLIT_FIRMWARE_NAME) && -+ !of_find_property(mtd_get_of_node(&part->mtd), "compatible", NULL)) -+ split_firmware(master, part); -+} -+ - /* - * This function, given a master MTD object and a partition table, creates - * and registers slave MTD objects which are bound to the master according to -@@ -759,6 +787,7 @@ int add_mtd_partitions(struct mtd_info * - mutex_unlock(&mtd_partitions_mutex); - - add_mtd_device(&slave->mtd); -+ mtd_partition_split(master, slave); - mtd_add_partition_attrs(slave); - /* Look for subpartitions */ - parse_mtd_partitions(&slave->mtd, parts[i].types, NULL); diff --git a/target/linux/generic/pending-4.9/401-mtd-add-support-for-different-partition-parser-types.patch b/target/linux/generic/pending-4.9/401-mtd-add-support-for-different-partition-parser-types.patch deleted file mode 100644 index 5a9d3f7560..0000000000 --- a/target/linux/generic/pending-4.9/401-mtd-add-support-for-different-partition-parser-types.patch +++ /dev/null @@ -1,142 +0,0 @@ -From: Gabor Juhos -Subject: mtd: add support for different partition parser types - -Signed-off-by: Gabor Juhos ---- - drivers/mtd/mtdpart.c | 56 ++++++++++++++++++++++++++++++++++++++++ - include/linux/mtd/partitions.h | 11 ++++++++ - 2 files changed, 67 insertions(+) - ---- a/drivers/mtd/mtdpart.c -+++ b/drivers/mtd/mtdpart.c -@@ -56,6 +56,10 @@ struct mtd_part { - }; - - static void mtd_partition_split(struct mtd_info *master, struct mtd_part *part); -+static int parse_mtd_partitions_by_type(struct mtd_info *master, -+ enum mtd_parser_type type, -+ const struct mtd_partition **pparts, -+ struct mtd_part_parser_data *data); - - /* - * Given a pointer to the MTD object in the mtd_part structure, we can retrieve -@@ -733,6 +737,36 @@ int mtd_del_partition(struct mtd_info *m - } - EXPORT_SYMBOL_GPL(mtd_del_partition); - -+static int -+run_parsers_by_type(struct mtd_part *slave, enum mtd_parser_type type) -+{ -+ struct mtd_partition *parts; -+ int nr_parts; -+ int i; -+ -+ nr_parts = parse_mtd_partitions_by_type(&slave->mtd, type, (const struct mtd_partition **)&parts, -+ NULL); -+ if (nr_parts <= 0) -+ return nr_parts; -+ -+ if (WARN_ON(!parts)) -+ return 0; -+ -+ for (i = 0; i < nr_parts; i++) { -+ /* adjust partition offsets */ -+ parts[i].offset += slave->offset; -+ -+ mtd_add_partition(slave->parent, -+ parts[i].name, -+ parts[i].offset, -+ parts[i].size); -+ } -+ -+ kfree(parts); -+ -+ return nr_parts; -+} -+ - #ifdef CONFIG_MTD_SPLIT_FIRMWARE_NAME - #define SPLIT_FIRMWARE_NAME CONFIG_MTD_SPLIT_FIRMWARE_NAME - #else -@@ -1109,6 +1143,61 @@ void mtd_part_parser_cleanup(struct mtd_ - } - } - -+static struct mtd_part_parser * -+get_partition_parser_by_type(enum mtd_parser_type type, -+ struct mtd_part_parser *start) -+{ -+ struct mtd_part_parser *p, *ret = NULL; -+ -+ spin_lock(&part_parser_lock); -+ -+ p = list_prepare_entry(start, &part_parsers, list); -+ if (start) -+ mtd_part_parser_put(start); -+ -+ list_for_each_entry_continue(p, &part_parsers, list) { -+ if (p->type == type && try_module_get(p->owner)) { -+ ret = p; -+ break; -+ } -+ } -+ -+ spin_unlock(&part_parser_lock); -+ -+ return ret; -+} -+ -+static int parse_mtd_partitions_by_type(struct mtd_info *master, -+ enum mtd_parser_type type, -+ const struct mtd_partition **pparts, -+ struct mtd_part_parser_data *data) -+{ -+ struct mtd_part_parser *prev = NULL; -+ int ret = 0; -+ -+ while (1) { -+ struct mtd_part_parser *parser; -+ -+ parser = get_partition_parser_by_type(type, prev); -+ if (!parser) -+ break; -+ -+ ret = (*parser->parse_fn)(master, pparts, data); -+ -+ if (ret > 0) { -+ mtd_part_parser_put(parser); -+ printk(KERN_NOTICE -+ "%d %s partitions found on MTD device %s\n", -+ ret, parser->name, master->name); -+ break; -+ } -+ -+ prev = parser; -+ } -+ -+ return ret; -+} -+ - int mtd_is_partition(const struct mtd_info *mtd) - { - struct mtd_part *part; ---- a/include/linux/mtd/partitions.h -+++ b/include/linux/mtd/partitions.h -@@ -73,6 +73,10 @@ struct mtd_part_parser_data { - * Functions dealing with the various ways of partitioning the space - */ - -+enum mtd_parser_type { -+ MTD_PARSER_TYPE_DEVICE = 0, -+}; -+ - struct mtd_part_parser { - struct list_head list; - struct module *owner; -@@ -81,6 +85,7 @@ struct mtd_part_parser { - int (*parse_fn)(struct mtd_info *, const struct mtd_partition **, - struct mtd_part_parser_data *); - void (*cleanup)(const struct mtd_partition *pparts, int nr_parts); -+ enum mtd_parser_type type; - }; - - /* Container for passing around a set of parsed partitions */ diff --git a/target/linux/generic/pending-4.9/402-mtd-use-typed-mtd-parsers-for-rootfs-and-firmware-split.patch b/target/linux/generic/pending-4.9/402-mtd-use-typed-mtd-parsers-for-rootfs-and-firmware-split.patch deleted file mode 100644 index 42d95360fd..0000000000 --- a/target/linux/generic/pending-4.9/402-mtd-use-typed-mtd-parsers-for-rootfs-and-firmware-split.patch +++ /dev/null @@ -1,44 +0,0 @@ -From: Gabor Juhos -Subject: kernel/3.10: allow to use partition parsers for rootfs and firmware split - -lede-commit: 3b71cd94bc9517bc25267dccb393b07d4b54564e -Signed-off-by: Gabor Juhos ---- - drivers/mtd/mtdpart.c | 37 +++++++++++++++++++++++++++++++++++++ - include/linux/mtd/partitions.h | 2 ++ - 2 files changed, 39 insertions(+) - ---- a/drivers/mtd/mtdpart.c -+++ b/drivers/mtd/mtdpart.c -@@ -775,6 +775,7 @@ run_parsers_by_type(struct mtd_part *sla - - static void split_firmware(struct mtd_info *master, struct mtd_part *part) - { -+ run_parsers_by_type(part, MTD_PARSER_TYPE_FIRMWARE); - } - - static void mtd_partition_split(struct mtd_info *master, struct mtd_part *part) -@@ -784,6 +785,12 @@ static void mtd_partition_split(struct m - if (rootfs_found) - return; - -+ if (!strcmp(part->mtd.name, "rootfs")) { -+ run_parsers_by_type(part, MTD_PARSER_TYPE_ROOTFS); -+ -+ rootfs_found = 1; -+ } -+ - if (IS_ENABLED(CONFIG_MTD_SPLIT_FIRMWARE) && - !strcmp(part->mtd.name, SPLIT_FIRMWARE_NAME) && - !of_find_property(mtd_get_of_node(&part->mtd), "compatible", NULL)) ---- a/include/linux/mtd/partitions.h -+++ b/include/linux/mtd/partitions.h -@@ -75,6 +75,8 @@ struct mtd_part_parser_data { - - enum mtd_parser_type { - MTD_PARSER_TYPE_DEVICE = 0, -+ MTD_PARSER_TYPE_ROOTFS, -+ MTD_PARSER_TYPE_FIRMWARE, - }; - - struct mtd_part_parser { diff --git a/target/linux/generic/pending-4.9/403-mtd-hook-mtdsplit-to-Kbuild.patch b/target/linux/generic/pending-4.9/403-mtd-hook-mtdsplit-to-Kbuild.patch deleted file mode 100644 index 917cd9cafe..0000000000 --- a/target/linux/generic/pending-4.9/403-mtd-hook-mtdsplit-to-Kbuild.patch +++ /dev/null @@ -1,32 +0,0 @@ -From: Gabor Juhos -Subject: [PATCH] kernel/3.10: move squashfs check from rootfs split code into a separate file - -lede-commit: d89bea92b31b4e157a0fa438e75370f089f73427 -Signed-off-by: Gabor Juhos ---- - drivers/mtd/Kconfig | 2 ++ - drivers/mtd/Makefile | 2 ++ - 2 files changed, 4 insertions(+) - ---- a/drivers/mtd/Kconfig -+++ b/drivers/mtd/Kconfig -@@ -27,6 +27,8 @@ config MTD_SPLIT_FIRMWARE_NAME - depends on MTD_SPLIT_FIRMWARE - default "firmware" - -+source "drivers/mtd/mtdsplit/Kconfig" -+ - endmenu - - config MTD_TESTS ---- a/drivers/mtd/Makefile -+++ b/drivers/mtd/Makefile -@@ -6,6 +6,8 @@ - obj-$(CONFIG_MTD) += mtd.o - mtd-y := mtdcore.o mtdsuper.o mtdconcat.o mtdpart.o mtdchar.o - -+obj-$(CONFIG_MTD_SPLIT) += mtdsplit/ -+ - obj-$(CONFIG_MTD_OF_PARTS) += ofpart.o - obj-$(CONFIG_MTD_REDBOOT_PARTS) += redboot.o - obj-$(CONFIG_MTD_CMDLINE_PARTS) += cmdlinepart.o diff --git a/target/linux/generic/pending-4.9/404-mtd-add-more-helper-functions.patch b/target/linux/generic/pending-4.9/404-mtd-add-more-helper-functions.patch deleted file mode 100644 index b59977455e..0000000000 --- a/target/linux/generic/pending-4.9/404-mtd-add-more-helper-functions.patch +++ /dev/null @@ -1,76 +0,0 @@ -From: Gabor Juhos -Subject: kernel/3.10: add separate rootfs partition parser - -lede-commit: daec7ad7688415156e2730e401503d09bd3acf91 -Signed-off-by: Gabor Juhos ---- - drivers/mtd/mtdpart.c | 29 +++++++++++++++++++++++++++++ - include/linux/mtd/mtd.h | 18 ++++++++++++++++++ - include/linux/mtd/partitions.h | 2 ++ - 3 files changed, 49 insertions(+) - ---- a/drivers/mtd/mtdpart.c -+++ b/drivers/mtd/mtdpart.c -@@ -1222,6 +1222,24 @@ int mtd_is_partition(const struct mtd_in - } - EXPORT_SYMBOL_GPL(mtd_is_partition); - -+struct mtd_info *mtdpart_get_master(const struct mtd_info *mtd) -+{ -+ if (!mtd_is_partition(mtd)) -+ return (struct mtd_info *)mtd; -+ -+ return mtd_to_part(mtd)->parent; -+} -+EXPORT_SYMBOL_GPL(mtdpart_get_master); -+ -+uint64_t mtdpart_get_offset(const struct mtd_info *mtd) -+{ -+ if (!mtd_is_partition(mtd)) -+ return 0; -+ -+ return mtd_to_part(mtd)->offset; -+} -+EXPORT_SYMBOL_GPL(mtdpart_get_offset); -+ - /* Returns the size of the entire flash chip */ - uint64_t mtd_get_device_size(const struct mtd_info *mtd) - { ---- a/include/linux/mtd/mtd.h -+++ b/include/linux/mtd/mtd.h -@@ -485,6 +485,24 @@ static inline uint32_t mtd_mod_by_eb(uin - return do_div(sz, mtd->erasesize); - } - -+static inline uint64_t mtd_roundup_to_eb(uint64_t sz, struct mtd_info *mtd) -+{ -+ if (mtd_mod_by_eb(sz, mtd) == 0) -+ return sz; -+ -+ /* Round up to next erase block */ -+ return (mtd_div_by_eb(sz, mtd) + 1) * mtd->erasesize; -+} -+ -+static inline uint64_t mtd_rounddown_to_eb(uint64_t sz, struct mtd_info *mtd) -+{ -+ if (mtd_mod_by_eb(sz, mtd) == 0) -+ return sz; -+ -+ /* Round down to the start of the current erase block */ -+ return (mtd_div_by_eb(sz, mtd)) * mtd->erasesize; -+} -+ - static inline uint32_t mtd_div_by_ws(uint64_t sz, struct mtd_info *mtd) - { - if (mtd->writesize_shift) ---- a/include/linux/mtd/partitions.h -+++ b/include/linux/mtd/partitions.h -@@ -116,6 +116,8 @@ int mtd_is_partition(const struct mtd_in - int mtd_add_partition(struct mtd_info *master, const char *name, - long long offset, long long length); - int mtd_del_partition(struct mtd_info *master, int partno); -+struct mtd_info *mtdpart_get_master(const struct mtd_info *mtd); -+uint64_t mtdpart_get_offset(const struct mtd_info *mtd); - uint64_t mtd_get_device_size(const struct mtd_info *mtd); - - #endif diff --git a/target/linux/generic/pending-4.9/411-mtd-partial_eraseblock_write.patch b/target/linux/generic/pending-4.9/411-mtd-partial_eraseblock_write.patch deleted file mode 100644 index 5a59dfa0c6..0000000000 --- a/target/linux/generic/pending-4.9/411-mtd-partial_eraseblock_write.patch +++ /dev/null @@ -1,154 +0,0 @@ -From: Felix Fietkau -Subject: mtd: implement write support for partitions covering only a part of an eraseblock (buffer data that would otherwise be erased) - -lede-commit: 87a8e8ac1067f58ba831c4aae443f3655c31cd80 -Signed-off-by: Felix Fietkau ---- - drivers/mtd/mtdpart.c | 90 ++++++++++++++++++++++++++++++++++++++++++++----- - include/linux/mtd/mtd.h | 4 +++ - 2 files changed, 85 insertions(+), 9 deletions(-) - ---- a/drivers/mtd/mtdpart.c -+++ b/drivers/mtd/mtdpart.c -@@ -37,6 +37,8 @@ - #include "mtdcore.h" - #include "mtdsplit/mtdsplit.h" - -+#define MTD_ERASE_PARTIAL 0x8000 /* partition only covers parts of an erase block */ -+ - /* Our partition linked list */ - static LIST_HEAD(mtd_partitions); - static DEFINE_MUTEX(mtd_partitions_mutex); -@@ -246,13 +248,61 @@ static int part_erase(struct mtd_info *m - struct mtd_part *part = mtd_to_part(mtd); - int ret; - -+ -+ instr->partial_start = false; -+ if (mtd->flags & MTD_ERASE_PARTIAL) { -+ size_t readlen = 0; -+ u64 mtd_ofs; -+ -+ instr->erase_buf = kmalloc(part->parent->erasesize, GFP_ATOMIC); -+ if (!instr->erase_buf) -+ return -ENOMEM; -+ -+ mtd_ofs = part->offset + instr->addr; -+ instr->erase_buf_ofs = do_div(mtd_ofs, part->parent->erasesize); -+ -+ if (instr->erase_buf_ofs > 0) { -+ instr->addr -= instr->erase_buf_ofs; -+ ret = mtd_read(part->parent, -+ instr->addr + part->offset, -+ part->parent->erasesize, -+ &readlen, instr->erase_buf); -+ -+ instr->len += instr->erase_buf_ofs; -+ instr->partial_start = true; -+ } else { -+ mtd_ofs = part->offset + part->mtd.size; -+ instr->erase_buf_ofs = part->parent->erasesize - -+ do_div(mtd_ofs, part->parent->erasesize); -+ -+ if (instr->erase_buf_ofs > 0) { -+ instr->len += instr->erase_buf_ofs; -+ ret = mtd_read(part->parent, -+ part->offset + instr->addr + -+ instr->len - part->parent->erasesize, -+ part->parent->erasesize, &readlen, -+ instr->erase_buf); -+ } else { -+ ret = 0; -+ } -+ } -+ if (ret < 0) { -+ kfree(instr->erase_buf); -+ return ret; -+ } -+ -+ } -+ - instr->addr += part->offset; - ret = part->parent->_erase(part->parent, instr); - if (ret) { - if (instr->fail_addr != MTD_FAIL_ADDR_UNKNOWN) - instr->fail_addr -= part->offset; - instr->addr -= part->offset; -+ if (mtd->flags & MTD_ERASE_PARTIAL) -+ kfree(instr->erase_buf); - } -+ - return ret; - } - -@@ -260,6 +310,25 @@ void mtd_erase_callback(struct erase_inf - { - if (instr->mtd->_erase == part_erase) { - struct mtd_part *part = mtd_to_part(instr->mtd); -+ size_t wrlen = 0; -+ -+ if (instr->mtd->flags & MTD_ERASE_PARTIAL) { -+ if (instr->partial_start) { -+ part->parent->_write(part->parent, -+ instr->addr, instr->erase_buf_ofs, -+ &wrlen, instr->erase_buf); -+ instr->addr += instr->erase_buf_ofs; -+ } else { -+ instr->len -= instr->erase_buf_ofs; -+ part->parent->_write(part->parent, -+ instr->addr + instr->len, -+ instr->erase_buf_ofs, &wrlen, -+ instr->erase_buf + -+ part->parent->erasesize - -+ instr->erase_buf_ofs); -+ } -+ kfree(instr->erase_buf); -+ } - - if (instr->fail_addr != MTD_FAIL_ADDR_UNKNOWN) - instr->fail_addr -= part->offset; -@@ -566,19 +635,22 @@ static struct mtd_part *allocate_partiti - remainder = do_div(tmp, wr_alignment); - if ((slave->mtd.flags & MTD_WRITEABLE) && remainder) { - /* Doesn't start on a boundary of major erase size */ -- /* FIXME: Let it be writable if it is on a boundary of -- * _minor_ erase size though */ -- slave->mtd.flags &= ~MTD_WRITEABLE; -- printk(KERN_WARNING"mtd: partition \"%s\" doesn't start on an erase/write block boundary -- force read-only\n", -- part->name); -+ slave->mtd.flags |= MTD_ERASE_PARTIAL; -+ if (((u32)slave->mtd.size) > parent->erasesize) -+ slave->mtd.flags &= ~MTD_WRITEABLE; -+ else -+ slave->mtd.erasesize = slave->mtd.size; - } - -- tmp = slave->mtd.size; -+ tmp = slave->offset + slave->mtd.size; - remainder = do_div(tmp, wr_alignment); - if ((slave->mtd.flags & MTD_WRITEABLE) && remainder) { -- slave->mtd.flags &= ~MTD_WRITEABLE; -- printk(KERN_WARNING"mtd: partition \"%s\" doesn't end on an erase/write block -- force read-only\n", -- part->name); -+ slave->mtd.flags |= MTD_ERASE_PARTIAL; -+ -+ if ((u32)slave->mtd.size > parent->erasesize) -+ slave->mtd.flags &= ~MTD_WRITEABLE; -+ else -+ slave->mtd.erasesize = slave->mtd.size; - } - - mtd_set_ooblayout(&slave->mtd, &part_ooblayout_ops); ---- a/include/linux/mtd/mtd.h -+++ b/include/linux/mtd/mtd.h -@@ -55,6 +55,10 @@ struct erase_info { - u_long priv; - u_char state; - struct erase_info *next; -+ -+ u8 *erase_buf; -+ u32 erase_buf_ofs; -+ bool partial_start; - }; - - struct mtd_erase_region_info { diff --git a/target/linux/generic/pending-4.9/412-mtd-partial_eraseblock_unlock.patch b/target/linux/generic/pending-4.9/412-mtd-partial_eraseblock_unlock.patch deleted file mode 100644 index 1e8c90931c..0000000000 --- a/target/linux/generic/pending-4.9/412-mtd-partial_eraseblock_unlock.patch +++ /dev/null @@ -1,40 +0,0 @@ -From: Tim Harvey -Subject: mtd: allow partial block unlock - -This allows sysupgrade for devices such as the Gateworks Avila/Cambria -product families based on the ixp4xx using the redboot bootloader with -combined FIS directory and RedBoot config partitions on larger FLASH -devices with larger eraseblocks. - -This second iteration of this patch addresses previous issues: -- whitespace breakage fixed -- unlock in all scenarios -- simplification and fix logic bug - -[john@phrozen.org: this should be moved to the ixp4xx folder] - -Signed-off-by: Tim Harvey ---- - drivers/mtd/mtdpart.c | 11 ++++++++++- - 1 file changed, 10 insertions(+), 1 deletion(-) - ---- a/drivers/mtd/mtdpart.c -+++ b/drivers/mtd/mtdpart.c -@@ -348,7 +348,16 @@ static int part_lock(struct mtd_info *mt - static int part_unlock(struct mtd_info *mtd, loff_t ofs, uint64_t len) - { - struct mtd_part *part = mtd_to_part(mtd); -- return part->parent->_unlock(part->parent, ofs + part->offset, len); -+ -+ ofs += part->offset; -+ -+ if (mtd->flags & MTD_ERASE_PARTIAL) { -+ /* round up len to next erasesize and round down offset to prev block */ -+ len = (mtd_div_by_eb(len, part->parent) + 1) * part->parent->erasesize; -+ ofs &= ~(part->parent->erasesize - 1); -+ } -+ -+ return part->parent->_unlock(part->parent, ofs, len); - } - - static int part_is_locked(struct mtd_info *mtd, loff_t ofs, uint64_t len) diff --git a/target/linux/generic/pending-4.9/419-mtd-redboot-add-of_match_table-with-DT-binding.patch b/target/linux/generic/pending-4.9/419-mtd-redboot-add-of_match_table-with-DT-binding.patch deleted file mode 100644 index 4da571a60f..0000000000 --- a/target/linux/generic/pending-4.9/419-mtd-redboot-add-of_match_table-with-DT-binding.patch +++ /dev/null @@ -1,39 +0,0 @@ -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= -Subject: [PATCH] mtd: redboot: add of_match_table with DT binding -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -This allows parsing RedBoot compatible partitions for properly described -flash device in DT. - -Signed-off-by: Rafał Miłecki ---- - ---- a/drivers/mtd/redboot.c -+++ b/drivers/mtd/redboot.c -@@ -29,6 +29,7 @@ - #include - #include - #include -+#include - - struct fis_image_desc { - unsigned char name[16]; // Null terminated name -@@ -289,9 +290,16 @@ static int parse_redboot_partitions(stru - return ret; - } - -+static const struct of_device_id redboot_parser_of_match_table[] = { -+ { .compatible = "ecoscentric,redboot-fis-partitions" }, -+ {}, -+}; -+MODULE_DEVICE_TABLE(of, redboot_parser_of_match_table); -+ - static struct mtd_part_parser redboot_parser = { - .parse_fn = parse_redboot_partitions, - .name = "RedBoot", -+ .of_match_table = redboot_parser_of_match_table, - }; - module_mtd_part_parser(redboot_parser); - diff --git a/target/linux/generic/pending-4.9/420-mtd-redboot_space.patch b/target/linux/generic/pending-4.9/420-mtd-redboot_space.patch deleted file mode 100644 index 6a612a0e75..0000000000 --- a/target/linux/generic/pending-4.9/420-mtd-redboot_space.patch +++ /dev/null @@ -1,41 +0,0 @@ -From: Felix Fietkau -Subject: add patch for including unpartitioned space in the rootfs partition for redboot devices (if applicable) - -[john@phrozen.org: used by ixp and others] - -lede-commit: 394918851f84e4d00fa16eb900e7700e95091f00 -Signed-off-by: Felix Fietkau ---- - drivers/mtd/redboot.c | 19 +++++++++++++------ - 1 file changed, 13 insertions(+), 6 deletions(-) - ---- a/drivers/mtd/redboot.c -+++ b/drivers/mtd/redboot.c -@@ -266,14 +266,21 @@ static int parse_redboot_partitions(stru - #endif - names += strlen(names)+1; - --#ifdef CONFIG_MTD_REDBOOT_PARTS_UNALLOCATED - if(fl->next && fl->img->flash_base + fl->img->size + master->erasesize <= fl->next->img->flash_base) { -- i++; -- parts[i].offset = parts[i-1].size + parts[i-1].offset; -- parts[i].size = fl->next->img->flash_base - parts[i].offset; -- parts[i].name = nullname; -- } -+ if (!strcmp(parts[i].name, "rootfs")) { -+ parts[i].size = fl->next->img->flash_base; -+ parts[i].size &= ~(master->erasesize - 1); -+ parts[i].size -= parts[i].offset; -+#ifdef CONFIG_MTD_REDBOOT_PARTS_UNALLOCATED -+ nrparts--; -+ } else { -+ i++; -+ parts[i].offset = parts[i-1].size + parts[i-1].offset; -+ parts[i].size = fl->next->img->flash_base - parts[i].offset; -+ parts[i].name = nullname; - #endif -+ } -+ } - tmp_fl = fl; - fl = fl->next; - kfree(tmp_fl); diff --git a/target/linux/generic/pending-4.9/430-mtd-add-myloader-partition-parser.patch b/target/linux/generic/pending-4.9/430-mtd-add-myloader-partition-parser.patch deleted file mode 100644 index eb969a0d91..0000000000 --- a/target/linux/generic/pending-4.9/430-mtd-add-myloader-partition-parser.patch +++ /dev/null @@ -1,47 +0,0 @@ -From: Florian Fainelli -Subject: Add myloader partition table parser - -[john@phozen.org: shoud be upstreamable] - -lede-commit: d8bf22859b51faa09d22c056fe221a45d2f7a3b8 -Signed-off-by: Florian Fainelli ---- - drivers/mtd/Kconfig | 16 ++++++++++++++++ - drivers/mtd/Makefile | 1 + - 2 files changed, 17 insertions(+) - ---- a/drivers/mtd/Kconfig -+++ b/drivers/mtd/Kconfig -@@ -178,6 +178,22 @@ menu "Partition parsers" - source "drivers/mtd/parsers/Kconfig" - endmenu - -+config MTD_MYLOADER_PARTS -+ tristate "MyLoader partition parsing" -+ depends on ADM5120 || ATH25 || ATH79 -+ ---help--- -+ MyLoader is a bootloader which allows the user to define partitions -+ in flash devices, by putting a table in the second erase block -+ on the device, similar to a partition table. This table gives the -+ offsets and lengths of the user defined partitions. -+ -+ If you need code which can detect and parse these tables, and -+ register MTD 'partitions' corresponding to each image detected, -+ enable this option. -+ -+ You will still need the parsing functions to be called by the driver -+ for your particular device. It won't happen automatically. -+ - comment "User Modules And Translation Layers" - - # ---- a/drivers/mtd/Makefile -+++ b/drivers/mtd/Makefile -@@ -15,6 +15,7 @@ obj-$(CONFIG_MTD_AFS_PARTS) += afs.o - obj-$(CONFIG_MTD_AR7_PARTS) += ar7part.o - obj-$(CONFIG_MTD_BCM63XX_PARTS) += bcm63xxpart.o - obj-$(CONFIG_MTD_BCM47XX_PARTS) += bcm47xxpart.o -+obj-$(CONFIG_MTD_MYLOADER_PARTS) += myloader.o - obj-y += parsers/ - - # 'Users' - code which presents functionality to userspace. diff --git a/target/linux/generic/pending-4.9/431-mtd-bcm47xxpart-check-for-bad-blocks-when-calculatin.patch b/target/linux/generic/pending-4.9/431-mtd-bcm47xxpart-check-for-bad-blocks-when-calculatin.patch deleted file mode 100644 index cbd185e0ae..0000000000 --- a/target/linux/generic/pending-4.9/431-mtd-bcm47xxpart-check-for-bad-blocks-when-calculatin.patch +++ /dev/null @@ -1,68 +0,0 @@ -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= -Subject: [PATCH] mtd: bcm47xxpart: check for bad blocks when calculating offsets - -Signed-off-by: Rafał Miłecki ---- - ---- a/drivers/mtd/parsers/parser_trx.c -+++ b/drivers/mtd/parsers/parser_trx.c -@@ -30,6 +30,33 @@ struct trx_header { - uint32_t offset[3]; - } __packed; - -+/* -+ * Calculate real end offset (address) for a given amount of data. It checks -+ * all blocks skipping bad ones. -+ */ -+static size_t parser_trx_real_offset(struct mtd_info *mtd, size_t bytes) -+{ -+ size_t real_offset = 0; -+ -+ if (mtd_block_isbad(mtd, real_offset)) -+ pr_warn("Base offset shouldn't be at bad block"); -+ -+ while (bytes >= mtd->erasesize) { -+ bytes -= mtd->erasesize; -+ real_offset += mtd->erasesize; -+ while (mtd_block_isbad(mtd, real_offset)) { -+ real_offset += mtd->erasesize; -+ -+ if (real_offset >= mtd->size) -+ return real_offset - mtd->erasesize; -+ } -+ } -+ -+ real_offset += bytes; -+ -+ return real_offset; -+} -+ - static const char *parser_trx_data_part_name(struct mtd_info *master, - size_t offset) - { -@@ -84,21 +111,21 @@ static int parser_trx_parse(struct mtd_i - if (trx.offset[2]) { - part = &parts[curr_part++]; - part->name = "loader"; -- part->offset = trx.offset[i]; -+ part->offset = parser_trx_real_offset(mtd, trx.offset[i]); - i++; - } - - if (trx.offset[i]) { - part = &parts[curr_part++]; - part->name = "linux"; -- part->offset = trx.offset[i]; -+ part->offset = parser_trx_real_offset(mtd, trx.offset[i]); - i++; - } - - if (trx.offset[i]) { - part = &parts[curr_part++]; -- part->name = parser_trx_data_part_name(mtd, trx.offset[i]); -- part->offset = trx.offset[i]; -+ part->offset = parser_trx_real_offset(mtd, trx.offset[i]); -+ part->name = parser_trx_data_part_name(mtd, part->offset); - i++; - } - diff --git a/target/linux/generic/pending-4.9/432-mtd-bcm47xxpart-detect-T_Meter-partition.patch b/target/linux/generic/pending-4.9/432-mtd-bcm47xxpart-detect-T_Meter-partition.patch deleted file mode 100644 index 3970641555..0000000000 --- a/target/linux/generic/pending-4.9/432-mtd-bcm47xxpart-detect-T_Meter-partition.patch +++ /dev/null @@ -1,37 +0,0 @@ -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= -Subject: mtd: bcm47xxpart: detect T_Meter partition - -It can be found on many Netgear devices. It consists of many 0x30 blocks -starting with 4D 54. - -Signed-off-by: Rafał Miłecki ---- - drivers/mtd/bcm47xxpart.c | 10 ++++++++++ - 1 file changed, 10 insertions(+) - ---- a/drivers/mtd/bcm47xxpart.c -+++ b/drivers/mtd/bcm47xxpart.c -@@ -40,6 +40,7 @@ - #define NVRAM_HEADER 0x48534C46 /* FLSH */ - #define POT_MAGIC1 0x54544f50 /* POTT */ - #define POT_MAGIC2 0x504f /* OP */ -+#define T_METER_MAGIC 0x4D540000 /* MT */ - #define ML_MAGIC1 0x39685a42 - #define ML_MAGIC2 0x26594131 - #define TRX_MAGIC 0x30524448 -@@ -183,6 +184,15 @@ static int bcm47xxpart_parse(struct mtd_ - MTD_WRITEABLE); - continue; - } -+ -+ /* T_Meter */ -+ if ((le32_to_cpu(buf[0x000 / 4]) & 0xFFFF0000) == T_METER_MAGIC && -+ (le32_to_cpu(buf[0x030 / 4]) & 0xFFFF0000) == T_METER_MAGIC && -+ (le32_to_cpu(buf[0x060 / 4]) & 0xFFFF0000) == T_METER_MAGIC) { -+ bcm47xxpart_add_part(&parts[curr_part++], "T_Meter", offset, -+ MTD_WRITEABLE); -+ continue; -+ } - - /* TRX */ - if (buf[0x000 / 4] == TRX_MAGIC) { diff --git a/target/linux/generic/pending-4.9/440-block2mtd_init.patch b/target/linux/generic/pending-4.9/440-block2mtd_init.patch deleted file mode 100644 index 8834788732..0000000000 --- a/target/linux/generic/pending-4.9/440-block2mtd_init.patch +++ /dev/null @@ -1,116 +0,0 @@ -From: Felix Fietkau -Subject: block2mtd - -Signed-off-by: Felix Fietkau ---- - drivers/mtd/devices/block2mtd.c | 30 ++++++++++++++++++++---------- - 1 file changed, 20 insertions(+), 10 deletions(-) - ---- a/drivers/mtd/devices/block2mtd.c -+++ b/drivers/mtd/devices/block2mtd.c -@@ -26,6 +26,7 @@ - #include - #include - #include -+#include - #include - #include - #include -@@ -219,7 +220,7 @@ static void block2mtd_free_device(struct - - - static struct block2mtd_dev *add_device(char *devname, int erase_size, -- int timeout) -+ const char *mtdname, int timeout) - { - #ifndef MODULE - int i; -@@ -227,6 +228,7 @@ static struct block2mtd_dev *add_device( - const fmode_t mode = FMODE_READ | FMODE_WRITE | FMODE_EXCL; - struct block_device *bdev = ERR_PTR(-ENODEV); - struct block2mtd_dev *dev; -+ struct mtd_partition *part; - char *name; - - if (!devname) -@@ -283,13 +285,16 @@ static struct block2mtd_dev *add_device( - - /* Setup the MTD structure */ - /* make the name contain the block device in */ -- name = kasprintf(GFP_KERNEL, "block2mtd: %s", devname); -+ if (!mtdname) -+ mtdname = devname; -+ name = kmalloc(strlen(mtdname) + 1, GFP_KERNEL); - if (!name) - goto err_destroy_mutex; - -+ strcpy(name, mtdname); - dev->mtd.name = name; - -- dev->mtd.size = dev->blkdev->bd_inode->i_size & PAGE_MASK; -+ dev->mtd.size = dev->blkdev->bd_inode->i_size & PAGE_MASK & ~(erase_size - 1); - dev->mtd.erasesize = erase_size; - dev->mtd.writesize = 1; - dev->mtd.writebufsize = PAGE_SIZE; -@@ -302,7 +307,11 @@ static struct block2mtd_dev *add_device( - dev->mtd.priv = dev; - dev->mtd.owner = THIS_MODULE; - -- if (mtd_device_register(&dev->mtd, NULL, 0)) { -+ part = kzalloc(sizeof(struct mtd_partition), GFP_KERNEL); -+ part->name = name; -+ part->offset = 0; -+ part->size = dev->mtd.size; -+ if (mtd_device_register(&dev->mtd, part, 1)) { - /* Device didn't get added, so free the entry */ - goto err_destroy_mutex; - } -@@ -310,8 +319,7 @@ static struct block2mtd_dev *add_device( - list_add(&dev->list, &blkmtd_device_list); - pr_info("mtd%d: [%s] erase_size = %dKiB [%d]\n", - dev->mtd.index, -- dev->mtd.name + strlen("block2mtd: "), -- dev->mtd.erasesize >> 10, dev->mtd.erasesize); -+ mtdname, dev->mtd.erasesize >> 10, dev->mtd.erasesize); - return dev; - - err_destroy_mutex: -@@ -384,7 +392,7 @@ static int block2mtd_setup2(const char * - /* 80 for device, 12 for erase size, 80 for name, 8 for timeout */ - char buf[80 + 12 + 80 + 8]; - char *str = buf; -- char *token[2]; -+ char *token[3]; - char *name; - size_t erase_size = PAGE_SIZE; - unsigned long timeout = MTD_DEFAULT_TIMEOUT; -@@ -398,7 +406,7 @@ static int block2mtd_setup2(const char * - strcpy(str, val); - kill_final_newline(str); - -- for (i = 0; i < 2; i++) -+ for (i = 0; i < 3; i++) - token[i] = strsep(&str, ","); - - if (str) { -@@ -424,8 +432,10 @@ static int block2mtd_setup2(const char * - return 0; - } - } -+ if (token[2] && (strlen(token[2]) + 1 > 80)) -+ pr_err("mtd device name too long\n"); - -- add_device(name, erase_size, timeout); -+ add_device(name, erase_size, token[2], timeout); - - return 0; - } -@@ -459,7 +469,7 @@ static int block2mtd_setup(const char *v - - - module_param_call(block2mtd, block2mtd_setup, NULL, NULL, 0200); --MODULE_PARM_DESC(block2mtd, "Device to use. \"block2mtd=[,]\""); -+MODULE_PARM_DESC(block2mtd, "Device to use. \"block2mtd=[,[,]]\""); - - static int __init block2mtd_init(void) - { diff --git a/target/linux/generic/pending-4.9/441-block2mtd_probe.patch b/target/linux/generic/pending-4.9/441-block2mtd_probe.patch deleted file mode 100644 index fee970ab61..0000000000 --- a/target/linux/generic/pending-4.9/441-block2mtd_probe.patch +++ /dev/null @@ -1,47 +0,0 @@ -From: Felix Fietkau -Subject: block2mtd - -Signed-off-by: Felix Fietkau ---- - drivers/mtd/devices/block2mtd.c | 9 ++++++--- - 1 file changed, 6 insertions(+), 3 deletions(-) - ---- a/drivers/mtd/devices/block2mtd.c -+++ b/drivers/mtd/devices/block2mtd.c -@@ -392,7 +392,7 @@ static int block2mtd_setup2(const char * - /* 80 for device, 12 for erase size, 80 for name, 8 for timeout */ - char buf[80 + 12 + 80 + 8]; - char *str = buf; -- char *token[3]; -+ char *token[4]; - char *name; - size_t erase_size = PAGE_SIZE; - unsigned long timeout = MTD_DEFAULT_TIMEOUT; -@@ -406,7 +406,7 @@ static int block2mtd_setup2(const char * - strcpy(str, val); - kill_final_newline(str); - -- for (i = 0; i < 3; i++) -+ for (i = 0; i < 4; i++) - token[i] = strsep(&str, ","); - - if (str) { -@@ -435,6 +435,9 @@ static int block2mtd_setup2(const char * - if (token[2] && (strlen(token[2]) + 1 > 80)) - pr_err("mtd device name too long\n"); - -+ if (token[3] && kstrtoul(token[3], 0, &timeout)) -+ pr_err("invalid timeout\n"); -+ - add_device(name, erase_size, token[2], timeout); - - return 0; -@@ -469,7 +472,7 @@ static int block2mtd_setup(const char *v - - - module_param_call(block2mtd, block2mtd_setup, NULL, NULL, 0200); --MODULE_PARM_DESC(block2mtd, "Device to use. \"block2mtd=[,[,]]\""); -+MODULE_PARM_DESC(block2mtd, "Device to use. \"block2mtd=[,[,[,]]]\""); - - static int __init block2mtd_init(void) - { diff --git a/target/linux/generic/pending-4.9/450-mtd-m25p80-allow-fallback-from-spi_flash_read-to-reg.patch b/target/linux/generic/pending-4.9/450-mtd-m25p80-allow-fallback-from-spi_flash_read-to-reg.patch deleted file mode 100644 index feaf8cb25c..0000000000 --- a/target/linux/generic/pending-4.9/450-mtd-m25p80-allow-fallback-from-spi_flash_read-to-reg.patch +++ /dev/null @@ -1,36 +0,0 @@ -From: Felix Fietkau -Date: Fri, 23 Feb 2018 17:12:16 +0100 -Subject: [PATCH] mtd: m25p80: allow fallback from spi_flash_read to regular - SPI transfer - -Some flash controllers, e.g. on the ath79 platform can support a fast -flash read via memory mapping, but only if the flash chip is in -3-byte address mode. - -Since spi_flash_read_supported does not have access to the same data as -spi_flash_read, the driver can't detect an unsupported call until m25p80 -has decided to use spi_flash_read. - -Allow the driver to indicate a fallback to a regular SPI transfer by -returning -EOPNOTSUPP - -Signed-off-by: Felix Fietkau ---- - ---- a/drivers/mtd/devices/m25p80.c -+++ b/drivers/mtd/devices/m25p80.c -@@ -155,9 +155,11 @@ static ssize_t m25p80_read(struct spi_no - msg.data_nbits = m25p80_rx_nbits(nor); - - ret = spi_flash_read(spi, &msg); -- if (ret < 0) -- return ret; -- return msg.retlen; -+ if (ret != -EOPNOTSUPP) { -+ if (ret < 0) -+ return ret; -+ return msg.retlen; -+ } - } - - spi_message_init(&m); diff --git a/target/linux/generic/pending-4.9/460-mtd-cfi_cmdset_0002-no-erase_suspend.patch b/target/linux/generic/pending-4.9/460-mtd-cfi_cmdset_0002-no-erase_suspend.patch deleted file mode 100644 index c52d7de762..0000000000 --- a/target/linux/generic/pending-4.9/460-mtd-cfi_cmdset_0002-no-erase_suspend.patch +++ /dev/null @@ -1,25 +0,0 @@ -From: Felix Fietkau -Subject: kernel: disable cfi cmdset 0002 erase suspend - -on some platforms, erase suspend leads to data corruption and lockups when write -ops collide with erase ops. this has been observed on the buffalo wzr-hp-g300nh. -rather than play whack-a-mole with a hard to reproduce issue on a variety of devices, -simply disable erase suspend, as it will usually not produce any useful gain on -the small filesystems used on embedded hardware. - -Signed-off-by: Felix Fietkau ---- - drivers/mtd/chips/cfi_cmdset_0002.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - ---- a/drivers/mtd/chips/cfi_cmdset_0002.c -+++ b/drivers/mtd/chips/cfi_cmdset_0002.c -@@ -807,7 +807,7 @@ static int get_chip(struct map_info *map - return 0; - - case FL_ERASING: -- if (!cfip || !(cfip->EraseSuspend & (0x1|0x2)) || -+ if (1 /* no suspend */ || !cfip || !(cfip->EraseSuspend & (0x1|0x2)) || - !(mode == FL_READY || mode == FL_POINT || - (mode == FL_WRITING && (cfip->EraseSuspend & 0x2)))) - goto sleep; diff --git a/target/linux/generic/pending-4.9/461-mtd-cfi_cmdset_0002-add-buffer-write-cmd-timeout.patch b/target/linux/generic/pending-4.9/461-mtd-cfi_cmdset_0002-add-buffer-write-cmd-timeout.patch deleted file mode 100644 index 905675e50c..0000000000 --- a/target/linux/generic/pending-4.9/461-mtd-cfi_cmdset_0002-add-buffer-write-cmd-timeout.patch +++ /dev/null @@ -1,17 +0,0 @@ -From: George Kashperko -Subject: Issue map read after Write Buffer Load command to ensure chip is ready to receive data. - -Signed-off-by: George Kashperko ---- - drivers/mtd/chips/cfi_cmdset_0002.c | 1 + - 1 file changed, 1 insertion(+) ---- a/drivers/mtd/chips/cfi_cmdset_0002.c -+++ b/drivers/mtd/chips/cfi_cmdset_0002.c -@@ -1829,6 +1829,7 @@ static int __xipram do_write_buffer(stru - - /* Write Buffer Load */ - map_write(map, CMD(0x25), cmd_adr); -+ (void) map_read(map, cmd_adr); - - chip->state = FL_WRITING_TO_BUFFER; - diff --git a/target/linux/generic/pending-4.9/465-m25p80-mx-disable-software-protection.patch b/target/linux/generic/pending-4.9/465-m25p80-mx-disable-software-protection.patch deleted file mode 100644 index 27adddeb30..0000000000 --- a/target/linux/generic/pending-4.9/465-m25p80-mx-disable-software-protection.patch +++ /dev/null @@ -1,18 +0,0 @@ -From: Felix Fietkau -Subject: Disable software protection bits for Macronix flashes. - -Signed-off-by: Felix Fietkau ---- - drivers/mtd/spi-nor/spi-nor.c | 1 + - 1 file changed, 1 insertion(+) - ---- a/drivers/mtd/spi-nor/spi-nor.c -+++ b/drivers/mtd/spi-nor/spi-nor.c -@@ -1601,6 +1601,7 @@ int spi_nor_scan(struct spi_nor *nor, co - - if (JEDEC_MFR(info) == SNOR_MFR_ATMEL || - JEDEC_MFR(info) == SNOR_MFR_INTEL || -+ JEDEC_MFR(info) == SNOR_MFR_MACRONIX || - JEDEC_MFR(info) == SNOR_MFR_SST || - info->flags & SPI_NOR_HAS_LOCK) { - write_enable(nor); diff --git a/target/linux/generic/pending-4.9/466-Revert-mtd-spi-nor-fix-Spansion-regressions-aliased-.patch b/target/linux/generic/pending-4.9/466-Revert-mtd-spi-nor-fix-Spansion-regressions-aliased-.patch deleted file mode 100644 index e1681d61dd..0000000000 --- a/target/linux/generic/pending-4.9/466-Revert-mtd-spi-nor-fix-Spansion-regressions-aliased-.patch +++ /dev/null @@ -1,37 +0,0 @@ -From: Matthias Schiffer -Date: Tue, 9 Jan 2018 20:41:48 +0100 -Subject: [PATCH] Revert "mtd: spi-nor: fix Spansion regressions (aliased with - Winbond)" - -This reverts commit 67b9bcd36906e12a15ffec19463afbbd6a41660e. - -The underlying issue breaking Spansion flash has been fixed with "mtd: spi-nor: -wait until lock/unlock operations are ready" and "mtd: spi-nor: wait for SR_WIP -to clear on initial unlock", so we can support unlocking for Winbond flash -again. - -Signed-off-by: Matthias Schiffer ---- - drivers/mtd/spi-nor/spi-nor.c | 4 +++- - 1 file changed, 3 insertions(+), 1 deletion(-) - ---- a/drivers/mtd/spi-nor/spi-nor.c -+++ b/drivers/mtd/spi-nor/spi-nor.c -@@ -1603,6 +1603,7 @@ int spi_nor_scan(struct spi_nor *nor, co - JEDEC_MFR(info) == SNOR_MFR_INTEL || - JEDEC_MFR(info) == SNOR_MFR_MACRONIX || - JEDEC_MFR(info) == SNOR_MFR_SST || -+ JEDEC_MFR(info) == SNOR_MFR_WINBOND || - info->flags & SPI_NOR_HAS_LOCK) { - write_enable(nor); - write_sr(nor, 0); -@@ -1621,7 +1622,8 @@ int spi_nor_scan(struct spi_nor *nor, co - - /* NOR protection support for STmicro/Micron chips and similar */ - if (JEDEC_MFR(info) == SNOR_MFR_MICRON || -- info->flags & SPI_NOR_HAS_LOCK) { -+ JEDEC_MFR(info) == SNOR_MFR_WINBOND || -+ info->flags & SPI_NOR_HAS_LOCK) { - nor->flash_lock = stm_lock; - nor->flash_unlock = stm_unlock; - nor->flash_is_locked = stm_is_locked; diff --git a/target/linux/generic/pending-4.9/470-mtd-spi-nor-support-limiting-4K-sectors-support-base.patch b/target/linux/generic/pending-4.9/470-mtd-spi-nor-support-limiting-4K-sectors-support-base.patch deleted file mode 100644 index f4ccc5fc44..0000000000 --- a/target/linux/generic/pending-4.9/470-mtd-spi-nor-support-limiting-4K-sectors-support-base.patch +++ /dev/null @@ -1,56 +0,0 @@ -From: Felix Fietkau -Date: Sat, 4 Nov 2017 07:40:23 +0100 -Subject: [PATCH] mtd: spi-nor: support limiting 4K sectors support based on - flash size - -Some devices need 4K sectors to be able to deal with small flash chips. -For instance, w25x05 is 64 KiB in size, and without 4K sectors, the -entire chip is just one erase block. -On bigger flash chip sizes, using 4K sectors can significantly slow down -many operations, including using a writable filesystem. There are several -platforms where it makes sense to use a single kernel on both kinds of -devices. - -To support this properly, allow configuring an upper flash chip size -limit for 4K sectors support. - -Signed-off-by: Felix Fietkau ---- - ---- a/drivers/mtd/spi-nor/Kconfig -+++ b/drivers/mtd/spi-nor/Kconfig -@@ -29,6 +29,17 @@ config MTD_SPI_NOR_USE_4K_SECTORS - Please note that some tools/drivers/filesystems may not work with - 4096 B erase size (e.g. UBIFS requires 15 KiB as a minimum). - -+config MTD_SPI_NOR_USE_4K_SECTORS_LIMIT -+ int "Maximum flash chip size to use 4K sectors on (in KiB)" -+ depends on MTD_SPI_NOR_USE_4K_SECTORS -+ default "4096" -+ help -+ There are many flash chips that support 4K sectors, but are so large -+ that using them significantly slows down writing large amounts of -+ data or using a writable filesystem. -+ Any flash chip larger than the size specified in this option will -+ not use 4K sectors. -+ - config SPI_ATMEL_QUADSPI - tristate "Atmel Quad SPI Controller" - depends on ARCH_AT91 || (ARM && COMPILE_TEST && !ARCH_EBSA110) ---- a/drivers/mtd/spi-nor/spi-nor.c -+++ b/drivers/mtd/spi-nor/spi-nor.c -@@ -1648,10 +1648,12 @@ int spi_nor_scan(struct spi_nor *nor, co - - #ifdef CONFIG_MTD_SPI_NOR_USE_4K_SECTORS - /* prefer "small sector" erase if possible */ -- if (info->flags & SECT_4K) { -+ if ((info->flags & SECT_4K) && (mtd->size <= -+ CONFIG_MTD_SPI_NOR_USE_4K_SECTORS_LIMIT * 1024)) { - nor->erase_opcode = SPINOR_OP_BE_4K; - mtd->erasesize = 4096; -- } else if (info->flags & SECT_4K_PMC) { -+ } else if ((info->flags & SECT_4K_PMC) && (mtd->size <= -+ CONFIG_MTD_SPI_NOR_USE_4K_SECTORS_LIMIT * 1024)) { - nor->erase_opcode = SPINOR_OP_BE_4K_PMC; - mtd->erasesize = 4096; - } else diff --git a/target/linux/generic/pending-4.9/475-mtd-spi-nor-Add-Winbond-w25q128jv-support.patch b/target/linux/generic/pending-4.9/475-mtd-spi-nor-Add-Winbond-w25q128jv-support.patch deleted file mode 100644 index d54ee4f25a..0000000000 --- a/target/linux/generic/pending-4.9/475-mtd-spi-nor-Add-Winbond-w25q128jv-support.patch +++ /dev/null @@ -1,34 +0,0 @@ -From: Robert Marko -To: linux-mtd@lists.infradead.org -Subject: mtd: spi-nor: Add Winbond w25q128jv support -Date: Mon, 25 Jun 2018 13:17:48 +0200 - -Datasheet: -http://www.winbond.com/resource-files/w25q128jv%20revf%2003272018%20plus.pdf - -Testing done on Mikrotik Routerboard wAP R board. -It does not support Dual or Quad modes. - -Signed-off-by: Robert Marko ---- - -Changes in v2: - - Correct the title ---- - drivers/mtd/spi-nor/spi-nor.c | 5 +++++ - 1 file changed, 5 insertions(+) - ---- a/drivers/mtd/spi-nor/spi-nor.c -+++ b/drivers/mtd/spi-nor/spi-nor.c -@@ -1152,6 +1152,11 @@ static const struct flash_info spi_nor_i - SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ | - SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB) - }, -+ { -+ "w25q128jv", INFO(0xef7018, 0, 64 * 1024, 256, -+ SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ | -+ SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB) -+ }, - { "w25q80", INFO(0xef5014, 0, 64 * 1024, 16, SECT_4K) }, - { "w25q80bl", INFO(0xef4014, 0, 64 * 1024, 16, SECT_4K) }, - { "w25q128", INFO(0xef4018, 0, 64 * 1024, 256, SECT_4K) }, diff --git a/target/linux/generic/pending-4.9/476-mtd-spi-nor-add-eon-en25q128.patch b/target/linux/generic/pending-4.9/476-mtd-spi-nor-add-eon-en25q128.patch deleted file mode 100644 index ac1fda5159..0000000000 --- a/target/linux/generic/pending-4.9/476-mtd-spi-nor-add-eon-en25q128.patch +++ /dev/null @@ -1,18 +0,0 @@ -From: Piotr Dymacz -Subject: kernel/mtd: add support for EON EN25Q128 - -Signed-off-by: Piotr Dymacz ---- - drivers/mtd/spi-nor/spi-nor.c | 1 + - 1 file changed, 1 insertion(+) - ---- a/drivers/mtd/spi-nor/spi-nor.c -+++ b/drivers/mtd/spi-nor/spi-nor.c -@@ -954,6 +954,7 @@ static const struct flash_info spi_nor_i - { "en25q32b", INFO(0x1c3016, 0, 64 * 1024, 64, 0) }, - { "en25p64", INFO(0x1c2017, 0, 64 * 1024, 128, 0) }, - { "en25q64", INFO(0x1c3017, 0, 64 * 1024, 128, SECT_4K) }, -+ { "en25q128", INFO(0x1c3018, 0, 64 * 1024, 256, SECT_4K) }, - { "en25qh128", INFO(0x1c7018, 0, 64 * 1024, 256, 0) }, - { "en25qh256", INFO(0x1c7019, 0, 64 * 1024, 512, 0) }, - { "en25s64", INFO(0x1c3817, 0, 64 * 1024, 128, SECT_4K) }, diff --git a/target/linux/generic/pending-4.9/477-mtd-add-spi-nor-add-mx25u3235f.patch b/target/linux/generic/pending-4.9/477-mtd-add-spi-nor-add-mx25u3235f.patch deleted file mode 100644 index 62f6314e93..0000000000 --- a/target/linux/generic/pending-4.9/477-mtd-add-spi-nor-add-mx25u3235f.patch +++ /dev/null @@ -1,18 +0,0 @@ -From: André Valentin -Subject: linux/mtd: add id for mx25u3235f needed by ZyXEL NBG6817 - -Signed-off-by: André Valentin ---- - drivers/mtd/spi-nor/spi-nor.c | 1 + - 1 file changed, 1 insertion(+) - ---- a/drivers/mtd/spi-nor/spi-nor.c -+++ b/drivers/mtd/spi-nor/spi-nor.c -@@ -1020,6 +1020,7 @@ static const struct flash_info spi_nor_i - { "mx25l3205d", INFO(0xc22016, 0, 64 * 1024, 64, SECT_4K) }, - { "mx25l3255e", INFO(0xc29e16, 0, 64 * 1024, 64, SECT_4K) }, - { "mx25l6405d", INFO(0xc22017, 0, 64 * 1024, 128, SECT_4K) }, -+ { "mx25u3235f", INFO(0xc22536, 0, 64 * 1024, 64, 0) }, - { "mx25u6435f", INFO(0xc22537, 0, 64 * 1024, 128, SECT_4K) }, - { "mx25l12805d", INFO(0xc22018, 0, 64 * 1024, 256, 0) }, - { "mx25l12855e", INFO(0xc22618, 0, 64 * 1024, 256, 0) }, diff --git a/target/linux/generic/pending-4.9/478-mtd-spi-nor-Add-support-for-XM25QH64A-and-XM25QH128A.patch b/target/linux/generic/pending-4.9/478-mtd-spi-nor-Add-support-for-XM25QH64A-and-XM25QH128A.patch deleted file mode 100644 index 011f4b4458..0000000000 --- a/target/linux/generic/pending-4.9/478-mtd-spi-nor-Add-support-for-XM25QH64A-and-XM25QH128A.patch +++ /dev/null @@ -1,30 +0,0 @@ -From b02f3405c935a28200db26b63e42086057565cf4 Mon Sep 17 00:00:00 2001 -From: Hauke Mehrtens -Date: Sat, 31 Mar 2018 20:09:54 +0200 -Subject: [PATCH] mtd: spi-nor: Add support for XM25QH64A and XM25QH128A - -These devices are produced by Wuhan Xinxin Semiconductor Manufacturing -Corp. (XMC) and found on some routers from Chinese manufactures. - -The data sheets can be found here: -http://www.xmcwh.com/Uploads/2018-03-01/5a9799e4cb355.pdf -http://www.xmcwh.com/Uploads/2018-02-05/5a77e6dbe968b.pdf - -Signed-off-by: Hauke Mehrtens ---- - drivers/mtd/spi-nor/spi-nor.c | 4 ++++ - 1 file changed, 4 insertions(+) - ---- a/drivers/mtd/spi-nor/spi-nor.c -+++ b/drivers/mtd/spi-nor/spi-nor.c -@@ -1177,6 +1177,10 @@ static const struct flash_info spi_nor_i - { "3S400AN", S3AN_INFO(0x1f2400, 256, 264) }, - { "3S700AN", S3AN_INFO(0x1f2500, 512, 264) }, - { "3S1400AN", S3AN_INFO(0x1f2600, 512, 528) }, -+ -+ /* XMC (Wuhan Xinxin Semiconductor Manufacturing Corp.) */ -+ { "XM25QH64A", INFO(0x207017, 0, 64 * 1024, 128, SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ) }, -+ { "XM25QH128A", INFO(0x207018, 0, 64 * 1024, 256, SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ) }, - { }, - }; - diff --git a/target/linux/generic/pending-4.9/479-mtd-spi-nor-add-eon-en25qh32.patch b/target/linux/generic/pending-4.9/479-mtd-spi-nor-add-eon-en25qh32.patch deleted file mode 100644 index b8d5101514..0000000000 --- a/target/linux/generic/pending-4.9/479-mtd-spi-nor-add-eon-en25qh32.patch +++ /dev/null @@ -1,10 +0,0 @@ ---- a/drivers/mtd/spi-nor/spi-nor.c -+++ b/drivers/mtd/spi-nor/spi-nor.c -@@ -955,6 +955,7 @@ static const struct flash_info spi_nor_i - { "en25p64", INFO(0x1c2017, 0, 64 * 1024, 128, 0) }, - { "en25q64", INFO(0x1c3017, 0, 64 * 1024, 128, SECT_4K) }, - { "en25q128", INFO(0x1c3018, 0, 64 * 1024, 256, SECT_4K) }, -+ { "en25qh32", INFO(0x1c7016, 0, 64 * 1024, 64, 0) }, - { "en25qh128", INFO(0x1c7018, 0, 64 * 1024, 256, 0) }, - { "en25qh256", INFO(0x1c7019, 0, 64 * 1024, 512, 0) }, - { "en25s64", INFO(0x1c3817, 0, 64 * 1024, 128, SECT_4K) }, diff --git a/target/linux/generic/pending-4.9/480-mtd-set-rootfs-to-be-root-dev.patch b/target/linux/generic/pending-4.9/480-mtd-set-rootfs-to-be-root-dev.patch deleted file mode 100644 index 1bc958c2f7..0000000000 --- a/target/linux/generic/pending-4.9/480-mtd-set-rootfs-to-be-root-dev.patch +++ /dev/null @@ -1,38 +0,0 @@ -From: Gabor Juhos -Subject: kernel/3.1[02]: move MTD root device setup code to mtdcore - -The current code only allows to automatically set -root device on MTD partitions. Move the code to MTD -core to allow to use it with all MTD devices. - -Signed-off-by: Gabor Juhos ---- - drivers/mtd/mtdcore.c | 10 ++++++++++ - 1 file changed, 10 insertions(+) - ---- a/drivers/mtd/mtdcore.c -+++ b/drivers/mtd/mtdcore.c -@@ -40,6 +40,7 @@ - #include - #include - #include -+#include - - #include - #include -@@ -570,6 +571,15 @@ int add_mtd_device(struct mtd_info *mtd) - of this try_ nonsense, and no bitching about it - either. :) */ - __module_get(THIS_MODULE); -+ -+ if (!strcmp(mtd->name, "rootfs") && -+ IS_ENABLED(CONFIG_MTD_ROOTFS_ROOT_DEV) && -+ ROOT_DEV == 0) { -+ pr_notice("mtd: device %d (%s) set to be root filesystem\n", -+ mtd->index, mtd->name); -+ ROOT_DEV = MKDEV(MTD_BLOCK_MAJOR, mtd->index); -+ } -+ - return 0; - - fail_added: diff --git a/target/linux/generic/pending-4.9/490-ubi-auto-attach-mtd-device-named-ubi-or-data-on-boot.patch b/target/linux/generic/pending-4.9/490-ubi-auto-attach-mtd-device-named-ubi-or-data-on-boot.patch deleted file mode 100644 index 168cfe50ee..0000000000 --- a/target/linux/generic/pending-4.9/490-ubi-auto-attach-mtd-device-named-ubi-or-data-on-boot.patch +++ /dev/null @@ -1,97 +0,0 @@ -From: Daniel Golle -Subject: ubi: auto-attach mtd device named "ubi" or "data" on boot - -Signed-off-by: Daniel Golle ---- - drivers/mtd/ubi/build.c | 36 ++++++++++++++++++++++++++++++++++++ - 1 file changed, 36 insertions(+) - ---- a/drivers/mtd/ubi/build.c -+++ b/drivers/mtd/ubi/build.c -@@ -1226,6 +1226,73 @@ static struct mtd_info * __init open_mtd - return mtd; - } - -+/* -+ * This function tries attaching mtd partitions named either "ubi" or "data" -+ * during boot. -+ */ -+static void __init ubi_auto_attach(void) -+{ -+ int err; -+ struct mtd_info *mtd; -+ loff_t offset = 0; -+ size_t len; -+ char magic[4]; -+ -+ /* try attaching mtd device named "ubi" or "data" */ -+ mtd = open_mtd_device("ubi"); -+ if (IS_ERR(mtd)) -+ mtd = open_mtd_device("data"); -+ -+ if (IS_ERR(mtd)) -+ return; -+ -+ /* get the first not bad block */ -+ if (mtd_can_have_bb(mtd)) -+ while (mtd_block_isbad(mtd, offset)) { -+ offset += mtd->erasesize; -+ -+ if (offset > mtd->size) { -+ pr_err("UBI error: Failed to find a non-bad " -+ "block on mtd%d\n", mtd->index); -+ goto cleanup; -+ } -+ } -+ -+ /* check if the read from flash was successful */ -+ err = mtd_read(mtd, offset, 4, &len, (void *) magic); -+ if ((err && !mtd_is_bitflip(err)) || len != 4) { -+ pr_err("UBI error: unable to read from mtd%d\n", mtd->index); -+ goto cleanup; -+ } -+ -+ /* check for a valid ubi magic */ -+ if (strncmp(magic, "UBI#", 4)) { -+ pr_err("UBI error: no valid UBI magic found inside mtd%d\n", mtd->index); -+ goto cleanup; -+ } -+ -+ /* don't auto-add media types where UBI doesn't makes sense */ -+ if (mtd->type != MTD_NANDFLASH && -+ mtd->type != MTD_NORFLASH && -+ mtd->type != MTD_DATAFLASH && -+ mtd->type != MTD_MLCNANDFLASH) -+ goto cleanup; -+ -+ mutex_lock(&ubi_devices_mutex); -+ pr_notice("UBI: auto-attach mtd%d\n", mtd->index); -+ err = ubi_attach_mtd_dev(mtd, UBI_DEV_NUM_AUTO, 0, 0); -+ mutex_unlock(&ubi_devices_mutex); -+ if (err < 0) { -+ pr_err("UBI error: cannot attach mtd%d\n", mtd->index); -+ goto cleanup; -+ } -+ -+ return; -+ -+cleanup: -+ put_mtd_device(mtd); -+} -+ - static int __init ubi_init(void) - { - int err, i, k; -@@ -1309,6 +1376,12 @@ static int __init ubi_init(void) - } - } - -+ /* auto-attach mtd devices only if built-in to the kernel and no ubi.mtd -+ * parameter was given */ -+ if (IS_ENABLED(CONFIG_MTD_ROOTFS_ROOT_DEV) && -+ !ubi_is_module() && !mtd_devs) -+ ubi_auto_attach(); -+ - err = ubiblock_init(); - if (err) { - pr_err("UBI error: block: cannot initialize, error %d", err); diff --git a/target/linux/generic/pending-4.9/491-ubi-auto-create-ubiblock-device-for-rootfs.patch b/target/linux/generic/pending-4.9/491-ubi-auto-create-ubiblock-device-for-rootfs.patch deleted file mode 100644 index adc653ddcd..0000000000 --- a/target/linux/generic/pending-4.9/491-ubi-auto-create-ubiblock-device-for-rootfs.patch +++ /dev/null @@ -1,66 +0,0 @@ -From: Daniel Golle -Subject: ubi: auto-create ubiblock device for rootfs - -Signed-off-by: Daniel Golle ---- - drivers/mtd/ubi/block.c | 42 ++++++++++++++++++++++++++++++++++++++++++ - 1 file changed, 42 insertions(+) - ---- a/drivers/mtd/ubi/block.c -+++ b/drivers/mtd/ubi/block.c -@@ -635,6 +635,44 @@ static void __init ubiblock_create_from_ - } - } - -+#define UBIFS_NODE_MAGIC 0x06101831 -+static inline int ubi_vol_is_ubifs(struct ubi_volume_desc *desc) -+{ -+ int ret; -+ uint32_t magic_of, magic; -+ ret = ubi_read(desc, 0, (char *)&magic_of, 0, 4); -+ if (ret) -+ return 0; -+ magic = le32_to_cpu(magic_of); -+ return magic == UBIFS_NODE_MAGIC; -+} -+ -+static void __init ubiblock_create_auto_rootfs(void) -+{ -+ int ubi_num, ret, is_ubifs; -+ struct ubi_volume_desc *desc; -+ struct ubi_volume_info vi; -+ -+ for (ubi_num = 0; ubi_num < UBI_MAX_DEVICES; ubi_num++) { -+ desc = ubi_open_volume_nm(ubi_num, "rootfs", UBI_READONLY); -+ if (IS_ERR(desc)) -+ continue; -+ -+ ubi_get_volume_info(desc, &vi); -+ is_ubifs = ubi_vol_is_ubifs(desc); -+ ubi_close_volume(desc); -+ if (is_ubifs) -+ break; -+ -+ ret = ubiblock_create(&vi); -+ if (ret) -+ pr_err("UBI error: block: can't add '%s' volume, err=%d\n", -+ vi.name, ret); -+ /* always break if we get here */ -+ break; -+ } -+} -+ - static void ubiblock_remove_all(void) - { - struct ubiblock *next; -@@ -667,6 +705,10 @@ int __init ubiblock_init(void) - */ - ubiblock_create_from_param(); - -+ /* auto-attach "rootfs" volume if existing and non-ubifs */ -+ if (IS_ENABLED(CONFIG_MTD_ROOTFS_ROOT_DEV)) -+ ubiblock_create_auto_rootfs(); -+ - /* - * Block devices are only created upon user requests, so we ignore - * existing volumes. diff --git a/target/linux/generic/pending-4.9/492-try-auto-mounting-ubi0-rootfs-in-init-do_mounts.c.patch b/target/linux/generic/pending-4.9/492-try-auto-mounting-ubi0-rootfs-in-init-do_mounts.c.patch deleted file mode 100644 index 69a35c25e7..0000000000 --- a/target/linux/generic/pending-4.9/492-try-auto-mounting-ubi0-rootfs-in-init-do_mounts.c.patch +++ /dev/null @@ -1,51 +0,0 @@ -From: Daniel Golle -Subject: try auto-mounting ubi0:rootfs in init/do_mounts.c - -Signed-off-by: Daniel Golle ---- - init/do_mounts.c | 26 +++++++++++++++++++++++++- - 1 file changed, 25 insertions(+), 1 deletion(-) - ---- a/init/do_mounts.c -+++ b/init/do_mounts.c -@@ -438,7 +438,28 @@ retry: - out: - put_page(page); - } -- -+ -+static int __init mount_ubi_rootfs(void) -+{ -+ int flags = MS_SILENT; -+ int err, tried = 0; -+ -+ while (tried < 2) { -+ err = do_mount_root("ubi0:rootfs", "ubifs", flags, \ -+ root_mount_data); -+ switch (err) { -+ case -EACCES: -+ flags |= MS_RDONLY; -+ tried++; -+ break; -+ default: -+ return err; -+ } -+ } -+ -+ return -EINVAL; -+} -+ - #ifdef CONFIG_ROOT_NFS - - #define NFSROOT_TIMEOUT_MIN 5 -@@ -532,6 +553,10 @@ void __init mount_root(void) - change_floppy("root floppy"); - } - #endif -+#ifdef CONFIG_MTD_ROOTFS_ROOT_DEV -+ if (!mount_ubi_rootfs()) -+ return; -+#endif - #ifdef CONFIG_BLOCK - { - int err = create_dev("/dev/root", ROOT_DEV); diff --git a/target/linux/generic/pending-4.9/493-ubi-set-ROOT_DEV-to-ubiblock-rootfs-if-unset.patch b/target/linux/generic/pending-4.9/493-ubi-set-ROOT_DEV-to-ubiblock-rootfs-if-unset.patch deleted file mode 100644 index 8b8bef2641..0000000000 --- a/target/linux/generic/pending-4.9/493-ubi-set-ROOT_DEV-to-ubiblock-rootfs-if-unset.patch +++ /dev/null @@ -1,34 +0,0 @@ -From: Daniel Golle -Subject: ubi: set ROOT_DEV to ubiblock "rootfs" if unset - -Signed-off-by: Daniel Golle ---- - drivers/mtd/ubi/block.c | 10 ++++++++++ - 1 file changed, 10 insertions(+) - ---- a/drivers/mtd/ubi/block.c -+++ b/drivers/mtd/ubi/block.c -@@ -50,6 +50,7 @@ - #include - #include - #include -+#include - - #include "ubi-media.h" - #include "ubi.h" -@@ -447,6 +448,15 @@ int ubiblock_create(struct ubi_volume_in - dev_info(disk_to_dev(dev->gd), "created from ubi%d:%d(%s)", - dev->ubi_num, dev->vol_id, vi->name); - mutex_unlock(&devices_mutex); -+ -+ if (!strcmp(vi->name, "rootfs") && -+ IS_ENABLED(CONFIG_MTD_ROOTFS_ROOT_DEV) && -+ ROOT_DEV == 0) { -+ pr_notice("ubiblock: device ubiblock%d_%d (%s) set to be root filesystem\n", -+ dev->ubi_num, dev->vol_id, vi->name); -+ ROOT_DEV = MKDEV(gd->major, gd->first_minor); -+ } -+ - return 0; - - out_free_queue: diff --git a/target/linux/generic/pending-4.9/494-mtd-ubi-add-EOF-marker-support.patch b/target/linux/generic/pending-4.9/494-mtd-ubi-add-EOF-marker-support.patch deleted file mode 100644 index 0b2314955b..0000000000 --- a/target/linux/generic/pending-4.9/494-mtd-ubi-add-EOF-marker-support.patch +++ /dev/null @@ -1,60 +0,0 @@ -From: Gabor Juhos -Subject: mtd: add EOF marker support to the UBI layer - -Signed-off-by: Gabor Juhos ---- - drivers/mtd/ubi/attach.c | 25 ++++++++++++++++++++++--- - drivers/mtd/ubi/ubi.h | 1 + - 2 files changed, 23 insertions(+), 3 deletions(-) - ---- a/drivers/mtd/ubi/attach.c -+++ b/drivers/mtd/ubi/attach.c -@@ -939,6 +939,13 @@ static bool vol_ignored(int vol_id) - #endif - } - -+static bool ec_hdr_has_eof(struct ubi_ec_hdr *ech) -+{ -+ return ech->padding1[0] == 'E' && -+ ech->padding1[1] == 'O' && -+ ech->padding1[2] == 'F'; -+} -+ - /** - * scan_peb - scan and process UBI headers of a PEB. - * @ubi: UBI device description object -@@ -971,9 +978,21 @@ static int scan_peb(struct ubi_device *u - return 0; - } - -- err = ubi_io_read_ec_hdr(ubi, pnum, ech, 0); -- if (err < 0) -- return err; -+ if (!ai->eof_found) { -+ err = ubi_io_read_ec_hdr(ubi, pnum, ech, 0); -+ if (err < 0) -+ return err; -+ -+ if (ec_hdr_has_eof(ech)) { -+ pr_notice("UBI: EOF marker found, PEBs from %d will be erased\n", -+ pnum); -+ ai->eof_found = true; -+ } -+ } -+ -+ if (ai->eof_found) -+ err = UBI_IO_FF_BITFLIPS; -+ - switch (err) { - case 0: - break; ---- a/drivers/mtd/ubi/ubi.h -+++ b/drivers/mtd/ubi/ubi.h -@@ -779,6 +779,7 @@ struct ubi_attach_info { - int mean_ec; - uint64_t ec_sum; - int ec_count; -+ bool eof_found; - struct kmem_cache *aeb_slab_cache; - struct ubi_ec_hdr *ech; - struct ubi_vid_io_buf *vidb; diff --git a/target/linux/generic/pending-4.9/530-jffs2_make_lzma_available.patch b/target/linux/generic/pending-4.9/530-jffs2_make_lzma_available.patch deleted file mode 100644 index 8c8a025f78..0000000000 --- a/target/linux/generic/pending-4.9/530-jffs2_make_lzma_available.patch +++ /dev/null @@ -1,5180 +0,0 @@ -From: Alexandros C. Couloumbis -Subject: fs: add jffs2/lzma support (not activated by default yet) - -lede-commit: c2c88d315fa0e881f8b19da07b62859b915b11b2 -Signed-off-by: Alexandros C. Couloumbis ---- - fs/jffs2/Kconfig | 9 + - fs/jffs2/Makefile | 3 + - fs/jffs2/compr.c | 6 + - fs/jffs2/compr.h | 10 +- - fs/jffs2/compr_lzma.c | 128 +++ - fs/jffs2/super.c | 33 +- - include/linux/lzma.h | 62 ++ - include/linux/lzma/LzFind.h | 115 +++ - include/linux/lzma/LzHash.h | 54 + - include/linux/lzma/LzmaDec.h | 231 +++++ - include/linux/lzma/LzmaEnc.h | 80 ++ - include/linux/lzma/Types.h | 226 +++++ - include/uapi/linux/jffs2.h | 1 + - lib/Kconfig | 6 + - lib/Makefile | 12 + - lib/lzma/LzFind.c | 761 ++++++++++++++ - lib/lzma/LzmaDec.c | 999 +++++++++++++++++++ - lib/lzma/LzmaEnc.c | 2271 ++++++++++++++++++++++++++++++++++++++++++ - lib/lzma/Makefile | 7 + - 19 files changed, 5008 insertions(+), 6 deletions(-) - create mode 100644 fs/jffs2/compr_lzma.c - create mode 100644 include/linux/lzma.h - create mode 100644 include/linux/lzma/LzFind.h - create mode 100644 include/linux/lzma/LzHash.h - create mode 100644 include/linux/lzma/LzmaDec.h - create mode 100644 include/linux/lzma/LzmaEnc.h - create mode 100644 include/linux/lzma/Types.h - create mode 100644 lib/lzma/LzFind.c - create mode 100644 lib/lzma/LzmaDec.c - create mode 100644 lib/lzma/LzmaEnc.c - create mode 100644 lib/lzma/Makefile - ---- a/fs/jffs2/Kconfig -+++ b/fs/jffs2/Kconfig -@@ -139,6 +139,15 @@ config JFFS2_LZO - This feature was added in July, 2007. Say 'N' if you need - compatibility with older bootloaders or kernels. - -+config JFFS2_LZMA -+ bool "JFFS2 LZMA compression support" if JFFS2_COMPRESSION_OPTIONS -+ select LZMA_COMPRESS -+ select LZMA_DECOMPRESS -+ depends on JFFS2_FS -+ default n -+ help -+ JFFS2 wrapper to the LZMA C SDK -+ - config JFFS2_RTIME - bool "JFFS2 RTIME compression support" if JFFS2_COMPRESSION_OPTIONS - depends on JFFS2_FS ---- a/fs/jffs2/Makefile -+++ b/fs/jffs2/Makefile -@@ -18,4 +18,7 @@ jffs2-$(CONFIG_JFFS2_RUBIN) += compr_rub - jffs2-$(CONFIG_JFFS2_RTIME) += compr_rtime.o - jffs2-$(CONFIG_JFFS2_ZLIB) += compr_zlib.o - jffs2-$(CONFIG_JFFS2_LZO) += compr_lzo.o -+jffs2-$(CONFIG_JFFS2_LZMA) += compr_lzma.o - jffs2-$(CONFIG_JFFS2_SUMMARY) += summary.o -+ -+CFLAGS_compr_lzma.o += -Iinclude/linux -Ilib/lzma ---- a/fs/jffs2/compr.c -+++ b/fs/jffs2/compr.c -@@ -378,6 +378,9 @@ int __init jffs2_compressors_init(void) - #ifdef CONFIG_JFFS2_LZO - jffs2_lzo_init(); - #endif -+#ifdef CONFIG_JFFS2_LZMA -+ jffs2_lzma_init(); -+#endif - /* Setting default compression mode */ - #ifdef CONFIG_JFFS2_CMODE_NONE - jffs2_compression_mode = JFFS2_COMPR_MODE_NONE; -@@ -401,6 +404,9 @@ int __init jffs2_compressors_init(void) - int jffs2_compressors_exit(void) - { - /* Unregistering compressors */ -+#ifdef CONFIG_JFFS2_LZMA -+ jffs2_lzma_exit(); -+#endif - #ifdef CONFIG_JFFS2_LZO - jffs2_lzo_exit(); - #endif ---- a/fs/jffs2/compr.h -+++ b/fs/jffs2/compr.h -@@ -29,9 +29,9 @@ - #define JFFS2_DYNRUBIN_PRIORITY 20 - #define JFFS2_LZARI_PRIORITY 30 - #define JFFS2_RTIME_PRIORITY 50 --#define JFFS2_ZLIB_PRIORITY 60 --#define JFFS2_LZO_PRIORITY 80 -- -+#define JFFS2_LZMA_PRIORITY 70 -+#define JFFS2_ZLIB_PRIORITY 80 -+#define JFFS2_LZO_PRIORITY 90 - - #define JFFS2_RUBINMIPS_DISABLED /* RUBINs will be used only */ - #define JFFS2_DYNRUBIN_DISABLED /* for decompression */ -@@ -101,5 +101,9 @@ void jffs2_zlib_exit(void); - int jffs2_lzo_init(void); - void jffs2_lzo_exit(void); - #endif -+#ifdef CONFIG_JFFS2_LZMA -+int jffs2_lzma_init(void); -+void jffs2_lzma_exit(void); -+#endif - - #endif /* __JFFS2_COMPR_H__ */ ---- /dev/null -+++ b/fs/jffs2/compr_lzma.c -@@ -0,0 +1,128 @@ -+/* -+ * JFFS2 -- Journalling Flash File System, Version 2. -+ * -+ * For licensing information, see the file 'LICENCE' in this directory. -+ * -+ * JFFS2 wrapper to the LZMA C SDK -+ * -+ */ -+ -+#include -+#include "compr.h" -+ -+#ifdef __KERNEL__ -+ static DEFINE_MUTEX(deflate_mutex); -+#endif -+ -+CLzmaEncHandle *p; -+Byte propsEncoded[LZMA_PROPS_SIZE]; -+SizeT propsSize = sizeof(propsEncoded); -+ -+STATIC void lzma_free_workspace(void) -+{ -+ LzmaEnc_Destroy(p, &lzma_alloc, &lzma_alloc); -+} -+ -+STATIC int INIT lzma_alloc_workspace(CLzmaEncProps *props) -+{ -+ if ((p = (CLzmaEncHandle *)LzmaEnc_Create(&lzma_alloc)) == NULL) -+ { -+ PRINT_ERROR("Failed to allocate lzma deflate workspace\n"); -+ return -ENOMEM; -+ } -+ -+ if (LzmaEnc_SetProps(p, props) != SZ_OK) -+ { -+ lzma_free_workspace(); -+ return -1; -+ } -+ -+ if (LzmaEnc_WriteProperties(p, propsEncoded, &propsSize) != SZ_OK) -+ { -+ lzma_free_workspace(); -+ return -1; -+ } -+ -+ return 0; -+} -+ -+STATIC int jffs2_lzma_compress(unsigned char *data_in, unsigned char *cpage_out, -+ uint32_t *sourcelen, uint32_t *dstlen) -+{ -+ SizeT compress_size = (SizeT)(*dstlen); -+ int ret; -+ -+ #ifdef __KERNEL__ -+ mutex_lock(&deflate_mutex); -+ #endif -+ -+ ret = LzmaEnc_MemEncode(p, cpage_out, &compress_size, data_in, *sourcelen, -+ 0, NULL, &lzma_alloc, &lzma_alloc); -+ -+ #ifdef __KERNEL__ -+ mutex_unlock(&deflate_mutex); -+ #endif -+ -+ if (ret != SZ_OK) -+ return -1; -+ -+ *dstlen = (uint32_t)compress_size; -+ -+ return 0; -+} -+ -+STATIC int jffs2_lzma_decompress(unsigned char *data_in, unsigned char *cpage_out, -+ uint32_t srclen, uint32_t destlen) -+{ -+ int ret; -+ SizeT dl = (SizeT)destlen; -+ SizeT sl = (SizeT)srclen; -+ ELzmaStatus status; -+ -+ ret = LzmaDecode(cpage_out, &dl, data_in, &sl, propsEncoded, -+ propsSize, LZMA_FINISH_ANY, &status, &lzma_alloc); -+ -+ if (ret != SZ_OK || status == LZMA_STATUS_NOT_FINISHED || dl != (SizeT)destlen) -+ return -1; -+ -+ return 0; -+} -+ -+static struct jffs2_compressor jffs2_lzma_comp = { -+ .priority = JFFS2_LZMA_PRIORITY, -+ .name = "lzma", -+ .compr = JFFS2_COMPR_LZMA, -+ .compress = &jffs2_lzma_compress, -+ .decompress = &jffs2_lzma_decompress, -+ .disabled = 0, -+}; -+ -+int INIT jffs2_lzma_init(void) -+{ -+ int ret; -+ CLzmaEncProps props; -+ LzmaEncProps_Init(&props); -+ -+ props.dictSize = LZMA_BEST_DICT(0x2000); -+ props.level = LZMA_BEST_LEVEL; -+ props.lc = LZMA_BEST_LC; -+ props.lp = LZMA_BEST_LP; -+ props.pb = LZMA_BEST_PB; -+ props.fb = LZMA_BEST_FB; -+ -+ ret = lzma_alloc_workspace(&props); -+ if (ret < 0) -+ return ret; -+ -+ ret = jffs2_register_compressor(&jffs2_lzma_comp); -+ if (ret) -+ lzma_free_workspace(); -+ -+ return ret; -+} -+ -+void jffs2_lzma_exit(void) -+{ -+ jffs2_unregister_compressor(&jffs2_lzma_comp); -+ lzma_free_workspace(); -+} ---- a/fs/jffs2/super.c -+++ b/fs/jffs2/super.c -@@ -371,14 +371,41 @@ static int __init init_jffs2_fs(void) - BUILD_BUG_ON(sizeof(struct jffs2_raw_inode) != 68); - BUILD_BUG_ON(sizeof(struct jffs2_raw_summary) != 32); - -- pr_info("version 2.2." -+ pr_info("version 2.2" - #ifdef CONFIG_JFFS2_FS_WRITEBUFFER - " (NAND)" - #endif - #ifdef CONFIG_JFFS2_SUMMARY -- " (SUMMARY) " -+ " (SUMMARY)" - #endif -- " © 2001-2006 Red Hat, Inc.\n"); -+#ifdef CONFIG_JFFS2_ZLIB -+ " (ZLIB)" -+#endif -+#ifdef CONFIG_JFFS2_LZO -+ " (LZO)" -+#endif -+#ifdef CONFIG_JFFS2_LZMA -+ " (LZMA)" -+#endif -+#ifdef CONFIG_JFFS2_RTIME -+ " (RTIME)" -+#endif -+#ifdef CONFIG_JFFS2_RUBIN -+ " (RUBIN)" -+#endif -+#ifdef CONFIG_JFFS2_CMODE_NONE -+ " (CMODE_NONE)" -+#endif -+#ifdef CONFIG_JFFS2_CMODE_PRIORITY -+ " (CMODE_PRIORITY)" -+#endif -+#ifdef CONFIG_JFFS2_CMODE_SIZE -+ " (CMODE_SIZE)" -+#endif -+#ifdef CONFIG_JFFS2_CMODE_FAVOURLZO -+ " (CMODE_FAVOURLZO)" -+#endif -+ " (c) 2001-2006 Red Hat, Inc.\n"); - - jffs2_inode_cachep = kmem_cache_create("jffs2_i", - sizeof(struct jffs2_inode_info), ---- /dev/null -+++ b/include/linux/lzma.h -@@ -0,0 +1,62 @@ -+#ifndef __LZMA_H__ -+#define __LZMA_H__ -+ -+#ifdef __KERNEL__ -+ #include -+ #include -+ #include -+ #include -+ #include -+ #define LZMA_MALLOC vmalloc -+ #define LZMA_FREE vfree -+ #define PRINT_ERROR(msg) printk(KERN_WARNING #msg) -+ #define INIT __init -+ #define STATIC static -+#else -+ #include -+ #include -+ #include -+ #include -+ #include -+ #include -+ #include -+ #include -+ #ifndef PAGE_SIZE -+ extern int page_size; -+ #define PAGE_SIZE page_size -+ #endif -+ #define LZMA_MALLOC malloc -+ #define LZMA_FREE free -+ #define PRINT_ERROR(msg) fprintf(stderr, msg) -+ #define INIT -+ #define STATIC -+#endif -+ -+#include "lzma/LzmaDec.h" -+#include "lzma/LzmaEnc.h" -+ -+#define LZMA_BEST_LEVEL (9) -+#define LZMA_BEST_LC (0) -+#define LZMA_BEST_LP (0) -+#define LZMA_BEST_PB (0) -+#define LZMA_BEST_FB (273) -+ -+#define LZMA_BEST_DICT(n) (((int)((n) / 2)) * 2) -+ -+static void *p_lzma_malloc(void *p, size_t size) -+{ -+ if (size == 0) -+ return NULL; -+ -+ return LZMA_MALLOC(size); -+} -+ -+static void p_lzma_free(void *p, void *address) -+{ -+ if (address != NULL) -+ LZMA_FREE(address); -+} -+ -+static ISzAlloc lzma_alloc = {p_lzma_malloc, p_lzma_free}; -+ -+#endif ---- /dev/null -+++ b/include/linux/lzma/LzFind.h -@@ -0,0 +1,115 @@ -+/* LzFind.h -- Match finder for LZ algorithms -+2009-04-22 : Igor Pavlov : Public domain */ -+ -+#ifndef __LZ_FIND_H -+#define __LZ_FIND_H -+ -+#include "Types.h" -+ -+#ifdef __cplusplus -+extern "C" { -+#endif -+ -+typedef UInt32 CLzRef; -+ -+typedef struct _CMatchFinder -+{ -+ Byte *buffer; -+ UInt32 pos; -+ UInt32 posLimit; -+ UInt32 streamPos; -+ UInt32 lenLimit; -+ -+ UInt32 cyclicBufferPos; -+ UInt32 cyclicBufferSize; /* it must be = (historySize + 1) */ -+ -+ UInt32 matchMaxLen; -+ CLzRef *hash; -+ CLzRef *son; -+ UInt32 hashMask; -+ UInt32 cutValue; -+ -+ Byte *bufferBase; -+ ISeqInStream *stream; -+ int streamEndWasReached; -+ -+ UInt32 blockSize; -+ UInt32 keepSizeBefore; -+ UInt32 keepSizeAfter; -+ -+ UInt32 numHashBytes; -+ int directInput; -+ size_t directInputRem; -+ int btMode; -+ int bigHash; -+ UInt32 historySize; -+ UInt32 fixedHashSize; -+ UInt32 hashSizeSum; -+ UInt32 numSons; -+ SRes result; -+ UInt32 crc[256]; -+} CMatchFinder; -+ -+#define Inline_MatchFinder_GetPointerToCurrentPos(p) ((p)->buffer) -+#define Inline_MatchFinder_GetIndexByte(p, index) ((p)->buffer[(Int32)(index)]) -+ -+#define Inline_MatchFinder_GetNumAvailableBytes(p) ((p)->streamPos - (p)->pos) -+ -+int MatchFinder_NeedMove(CMatchFinder *p); -+Byte *MatchFinder_GetPointerToCurrentPos(CMatchFinder *p); -+void MatchFinder_MoveBlock(CMatchFinder *p); -+void MatchFinder_ReadIfRequired(CMatchFinder *p); -+ -+void MatchFinder_Construct(CMatchFinder *p); -+ -+/* Conditions: -+ historySize <= 3 GB -+ keepAddBufferBefore + matchMaxLen + keepAddBufferAfter < 511MB -+*/ -+int MatchFinder_Create(CMatchFinder *p, UInt32 historySize, -+ UInt32 keepAddBufferBefore, UInt32 matchMaxLen, UInt32 keepAddBufferAfter, -+ ISzAlloc *alloc); -+void MatchFinder_Free(CMatchFinder *p, ISzAlloc *alloc); -+void MatchFinder_Normalize3(UInt32 subValue, CLzRef *items, UInt32 numItems); -+void MatchFinder_ReduceOffsets(CMatchFinder *p, UInt32 subValue); -+ -+UInt32 * GetMatchesSpec1(UInt32 lenLimit, UInt32 curMatch, UInt32 pos, const Byte *buffer, CLzRef *son, -+ UInt32 _cyclicBufferPos, UInt32 _cyclicBufferSize, UInt32 _cutValue, -+ UInt32 *distances, UInt32 maxLen); -+ -+/* -+Conditions: -+ Mf_GetNumAvailableBytes_Func must be called before each Mf_GetMatchLen_Func. -+ Mf_GetPointerToCurrentPos_Func's result must be used only before any other function -+*/ -+ -+typedef void (*Mf_Init_Func)(void *object); -+typedef Byte (*Mf_GetIndexByte_Func)(void *object, Int32 index); -+typedef UInt32 (*Mf_GetNumAvailableBytes_Func)(void *object); -+typedef const Byte * (*Mf_GetPointerToCurrentPos_Func)(void *object); -+typedef UInt32 (*Mf_GetMatches_Func)(void *object, UInt32 *distances); -+typedef void (*Mf_Skip_Func)(void *object, UInt32); -+ -+typedef struct _IMatchFinder -+{ -+ Mf_Init_Func Init; -+ Mf_GetIndexByte_Func GetIndexByte; -+ Mf_GetNumAvailableBytes_Func GetNumAvailableBytes; -+ Mf_GetPointerToCurrentPos_Func GetPointerToCurrentPos; -+ Mf_GetMatches_Func GetMatches; -+ Mf_Skip_Func Skip; -+} IMatchFinder; -+ -+void MatchFinder_CreateVTable(CMatchFinder *p, IMatchFinder *vTable); -+ -+void MatchFinder_Init(CMatchFinder *p); -+UInt32 Bt3Zip_MatchFinder_GetMatches(CMatchFinder *p, UInt32 *distances); -+UInt32 Hc3Zip_MatchFinder_GetMatches(CMatchFinder *p, UInt32 *distances); -+void Bt3Zip_MatchFinder_Skip(CMatchFinder *p, UInt32 num); -+void Hc3Zip_MatchFinder_Skip(CMatchFinder *p, UInt32 num); -+ -+#ifdef __cplusplus -+} -+#endif -+ -+#endif ---- /dev/null -+++ b/include/linux/lzma/LzHash.h -@@ -0,0 +1,54 @@ -+/* LzHash.h -- HASH functions for LZ algorithms -+2009-02-07 : Igor Pavlov : Public domain */ -+ -+#ifndef __LZ_HASH_H -+#define __LZ_HASH_H -+ -+#define kHash2Size (1 << 10) -+#define kHash3Size (1 << 16) -+#define kHash4Size (1 << 20) -+ -+#define kFix3HashSize (kHash2Size) -+#define kFix4HashSize (kHash2Size + kHash3Size) -+#define kFix5HashSize (kHash2Size + kHash3Size + kHash4Size) -+ -+#define HASH2_CALC hashValue = cur[0] | ((UInt32)cur[1] << 8); -+ -+#define HASH3_CALC { \ -+ UInt32 temp = p->crc[cur[0]] ^ cur[1]; \ -+ hash2Value = temp & (kHash2Size - 1); \ -+ hashValue = (temp ^ ((UInt32)cur[2] << 8)) & p->hashMask; } -+ -+#define HASH4_CALC { \ -+ UInt32 temp = p->crc[cur[0]] ^ cur[1]; \ -+ hash2Value = temp & (kHash2Size - 1); \ -+ hash3Value = (temp ^ ((UInt32)cur[2] << 8)) & (kHash3Size - 1); \ -+ hashValue = (temp ^ ((UInt32)cur[2] << 8) ^ (p->crc[cur[3]] << 5)) & p->hashMask; } -+ -+#define HASH5_CALC { \ -+ UInt32 temp = p->crc[cur[0]] ^ cur[1]; \ -+ hash2Value = temp & (kHash2Size - 1); \ -+ hash3Value = (temp ^ ((UInt32)cur[2] << 8)) & (kHash3Size - 1); \ -+ hash4Value = (temp ^ ((UInt32)cur[2] << 8) ^ (p->crc[cur[3]] << 5)); \ -+ hashValue = (hash4Value ^ (p->crc[cur[4]] << 3)) & p->hashMask; \ -+ hash4Value &= (kHash4Size - 1); } -+ -+/* #define HASH_ZIP_CALC hashValue = ((cur[0] | ((UInt32)cur[1] << 8)) ^ p->crc[cur[2]]) & 0xFFFF; */ -+#define HASH_ZIP_CALC hashValue = ((cur[2] | ((UInt32)cur[0] << 8)) ^ p->crc[cur[1]]) & 0xFFFF; -+ -+ -+#define MT_HASH2_CALC \ -+ hash2Value = (p->crc[cur[0]] ^ cur[1]) & (kHash2Size - 1); -+ -+#define MT_HASH3_CALC { \ -+ UInt32 temp = p->crc[cur[0]] ^ cur[1]; \ -+ hash2Value = temp & (kHash2Size - 1); \ -+ hash3Value = (temp ^ ((UInt32)cur[2] << 8)) & (kHash3Size - 1); } -+ -+#define MT_HASH4_CALC { \ -+ UInt32 temp = p->crc[cur[0]] ^ cur[1]; \ -+ hash2Value = temp & (kHash2Size - 1); \ -+ hash3Value = (temp ^ ((UInt32)cur[2] << 8)) & (kHash3Size - 1); \ -+ hash4Value = (temp ^ ((UInt32)cur[2] << 8) ^ (p->crc[cur[3]] << 5)) & (kHash4Size - 1); } -+ -+#endif ---- /dev/null -+++ b/include/linux/lzma/LzmaDec.h -@@ -0,0 +1,231 @@ -+/* LzmaDec.h -- LZMA Decoder -+2009-02-07 : Igor Pavlov : Public domain */ -+ -+#ifndef __LZMA_DEC_H -+#define __LZMA_DEC_H -+ -+#include "Types.h" -+ -+#ifdef __cplusplus -+extern "C" { -+#endif -+ -+/* #define _LZMA_PROB32 */ -+/* _LZMA_PROB32 can increase the speed on some CPUs, -+ but memory usage for CLzmaDec::probs will be doubled in that case */ -+ -+#ifdef _LZMA_PROB32 -+#define CLzmaProb UInt32 -+#else -+#define CLzmaProb UInt16 -+#endif -+ -+ -+/* ---------- LZMA Properties ---------- */ -+ -+#define LZMA_PROPS_SIZE 5 -+ -+typedef struct _CLzmaProps -+{ -+ unsigned lc, lp, pb; -+ UInt32 dicSize; -+} CLzmaProps; -+ -+/* LzmaProps_Decode - decodes properties -+Returns: -+ SZ_OK -+ SZ_ERROR_UNSUPPORTED - Unsupported properties -+*/ -+ -+SRes LzmaProps_Decode(CLzmaProps *p, const Byte *data, unsigned size); -+ -+ -+/* ---------- LZMA Decoder state ---------- */ -+ -+/* LZMA_REQUIRED_INPUT_MAX = number of required input bytes for worst case. -+ Num bits = log2((2^11 / 31) ^ 22) + 26 < 134 + 26 = 160; */ -+ -+#define LZMA_REQUIRED_INPUT_MAX 20 -+ -+typedef struct -+{ -+ CLzmaProps prop; -+ CLzmaProb *probs; -+ Byte *dic; -+ const Byte *buf; -+ UInt32 range, code; -+ SizeT dicPos; -+ SizeT dicBufSize; -+ UInt32 processedPos; -+ UInt32 checkDicSize; -+ unsigned state; -+ UInt32 reps[4]; -+ unsigned remainLen; -+ int needFlush; -+ int needInitState; -+ UInt32 numProbs; -+ unsigned tempBufSize; -+ Byte tempBuf[LZMA_REQUIRED_INPUT_MAX]; -+} CLzmaDec; -+ -+#define LzmaDec_Construct(p) { (p)->dic = 0; (p)->probs = 0; } -+ -+void LzmaDec_Init(CLzmaDec *p); -+ -+/* There are two types of LZMA streams: -+ 0) Stream with end mark. That end mark adds about 6 bytes to compressed size. -+ 1) Stream without end mark. You must know exact uncompressed size to decompress such stream. */ -+ -+typedef enum -+{ -+ LZMA_FINISH_ANY, /* finish at any point */ -+ LZMA_FINISH_END /* block must be finished at the end */ -+} ELzmaFinishMode; -+ -+/* ELzmaFinishMode has meaning only if the decoding reaches output limit !!! -+ -+ You must use LZMA_FINISH_END, when you know that current output buffer -+ covers last bytes of block. In other cases you must use LZMA_FINISH_ANY. -+ -+ If LZMA decoder sees end marker before reaching output limit, it returns SZ_OK, -+ and output value of destLen will be less than output buffer size limit. -+ You can check status result also. -+ -+ You can use multiple checks to test data integrity after full decompression: -+ 1) Check Result and "status" variable. -+ 2) Check that output(destLen) = uncompressedSize, if you know real uncompressedSize. -+ 3) Check that output(srcLen) = compressedSize, if you know real compressedSize. -+ You must use correct finish mode in that case. */ -+ -+typedef enum -+{ -+ LZMA_STATUS_NOT_SPECIFIED, /* use main error code instead */ -+ LZMA_STATUS_FINISHED_WITH_MARK, /* stream was finished with end mark. */ -+ LZMA_STATUS_NOT_FINISHED, /* stream was not finished */ -+ LZMA_STATUS_NEEDS_MORE_INPUT, /* you must provide more input bytes */ -+ LZMA_STATUS_MAYBE_FINISHED_WITHOUT_MARK /* there is probability that stream was finished without end mark */ -+} ELzmaStatus; -+ -+/* ELzmaStatus is used only as output value for function call */ -+ -+ -+/* ---------- Interfaces ---------- */ -+ -+/* There are 3 levels of interfaces: -+ 1) Dictionary Interface -+ 2) Buffer Interface -+ 3) One Call Interface -+ You can select any of these interfaces, but don't mix functions from different -+ groups for same object. */ -+ -+ -+/* There are two variants to allocate state for Dictionary Interface: -+ 1) LzmaDec_Allocate / LzmaDec_Free -+ 2) LzmaDec_AllocateProbs / LzmaDec_FreeProbs -+ You can use variant 2, if you set dictionary buffer manually. -+ For Buffer Interface you must always use variant 1. -+ -+LzmaDec_Allocate* can return: -+ SZ_OK -+ SZ_ERROR_MEM - Memory allocation error -+ SZ_ERROR_UNSUPPORTED - Unsupported properties -+*/ -+ -+SRes LzmaDec_AllocateProbs(CLzmaDec *p, const Byte *props, unsigned propsSize, ISzAlloc *alloc); -+void LzmaDec_FreeProbs(CLzmaDec *p, ISzAlloc *alloc); -+ -+SRes LzmaDec_Allocate(CLzmaDec *state, const Byte *prop, unsigned propsSize, ISzAlloc *alloc); -+void LzmaDec_Free(CLzmaDec *state, ISzAlloc *alloc); -+ -+/* ---------- Dictionary Interface ---------- */ -+ -+/* You can use it, if you want to eliminate the overhead for data copying from -+ dictionary to some other external buffer. -+ You must work with CLzmaDec variables directly in this interface. -+ -+ STEPS: -+ LzmaDec_Constr() -+ LzmaDec_Allocate() -+ for (each new stream) -+ { -+ LzmaDec_Init() -+ while (it needs more decompression) -+ { -+ LzmaDec_DecodeToDic() -+ use data from CLzmaDec::dic and update CLzmaDec::dicPos -+ } -+ } -+ LzmaDec_Free() -+*/ -+ -+/* LzmaDec_DecodeToDic -+ -+ The decoding to internal dictionary buffer (CLzmaDec::dic). -+ You must manually update CLzmaDec::dicPos, if it reaches CLzmaDec::dicBufSize !!! -+ -+finishMode: -+ It has meaning only if the decoding reaches output limit (dicLimit). -+ LZMA_FINISH_ANY - Decode just dicLimit bytes. -+ LZMA_FINISH_END - Stream must be finished after dicLimit. -+ -+Returns: -+ SZ_OK -+ status: -+ LZMA_STATUS_FINISHED_WITH_MARK -+ LZMA_STATUS_NOT_FINISHED -+ LZMA_STATUS_NEEDS_MORE_INPUT -+ LZMA_STATUS_MAYBE_FINISHED_WITHOUT_MARK -+ SZ_ERROR_DATA - Data error -+*/ -+ -+SRes LzmaDec_DecodeToDic(CLzmaDec *p, SizeT dicLimit, -+ const Byte *src, SizeT *srcLen, ELzmaFinishMode finishMode, ELzmaStatus *status); -+ -+ -+/* ---------- Buffer Interface ---------- */ -+ -+/* It's zlib-like interface. -+ See LzmaDec_DecodeToDic description for information about STEPS and return results, -+ but you must use LzmaDec_DecodeToBuf instead of LzmaDec_DecodeToDic and you don't need -+ to work with CLzmaDec variables manually. -+ -+finishMode: -+ It has meaning only if the decoding reaches output limit (*destLen). -+ LZMA_FINISH_ANY - Decode just destLen bytes. -+ LZMA_FINISH_END - Stream must be finished after (*destLen). -+*/ -+ -+SRes LzmaDec_DecodeToBuf(CLzmaDec *p, Byte *dest, SizeT *destLen, -+ const Byte *src, SizeT *srcLen, ELzmaFinishMode finishMode, ELzmaStatus *status); -+ -+ -+/* ---------- One Call Interface ---------- */ -+ -+/* LzmaDecode -+ -+finishMode: -+ It has meaning only if the decoding reaches output limit (*destLen). -+ LZMA_FINISH_ANY - Decode just destLen bytes. -+ LZMA_FINISH_END - Stream must be finished after (*destLen). -+ -+Returns: -+ SZ_OK -+ status: -+ LZMA_STATUS_FINISHED_WITH_MARK -+ LZMA_STATUS_NOT_FINISHED -+ LZMA_STATUS_MAYBE_FINISHED_WITHOUT_MARK -+ SZ_ERROR_DATA - Data error -+ SZ_ERROR_MEM - Memory allocation error -+ SZ_ERROR_UNSUPPORTED - Unsupported properties -+ SZ_ERROR_INPUT_EOF - It needs more bytes in input buffer (src). -+*/ -+ -+SRes LzmaDecode(Byte *dest, SizeT *destLen, const Byte *src, SizeT *srcLen, -+ const Byte *propData, unsigned propSize, ELzmaFinishMode finishMode, -+ ELzmaStatus *status, ISzAlloc *alloc); -+ -+#ifdef __cplusplus -+} -+#endif -+ -+#endif ---- /dev/null -+++ b/include/linux/lzma/LzmaEnc.h -@@ -0,0 +1,80 @@ -+/* LzmaEnc.h -- LZMA Encoder -+2009-02-07 : Igor Pavlov : Public domain */ -+ -+#ifndef __LZMA_ENC_H -+#define __LZMA_ENC_H -+ -+#include "Types.h" -+ -+#ifdef __cplusplus -+extern "C" { -+#endif -+ -+#define LZMA_PROPS_SIZE 5 -+ -+typedef struct _CLzmaEncProps -+{ -+ int level; /* 0 <= level <= 9 */ -+ UInt32 dictSize; /* (1 << 12) <= dictSize <= (1 << 27) for 32-bit version -+ (1 << 12) <= dictSize <= (1 << 30) for 64-bit version -+ default = (1 << 24) */ -+ int lc; /* 0 <= lc <= 8, default = 3 */ -+ int lp; /* 0 <= lp <= 4, default = 0 */ -+ int pb; /* 0 <= pb <= 4, default = 2 */ -+ int algo; /* 0 - fast, 1 - normal, default = 1 */ -+ int fb; /* 5 <= fb <= 273, default = 32 */ -+ int btMode; /* 0 - hashChain Mode, 1 - binTree mode - normal, default = 1 */ -+ int numHashBytes; /* 2, 3 or 4, default = 4 */ -+ UInt32 mc; /* 1 <= mc <= (1 << 30), default = 32 */ -+ unsigned writeEndMark; /* 0 - do not write EOPM, 1 - write EOPM, default = 0 */ -+ int numThreads; /* 1 or 2, default = 2 */ -+} CLzmaEncProps; -+ -+void LzmaEncProps_Init(CLzmaEncProps *p); -+void LzmaEncProps_Normalize(CLzmaEncProps *p); -+UInt32 LzmaEncProps_GetDictSize(const CLzmaEncProps *props2); -+ -+ -+/* ---------- CLzmaEncHandle Interface ---------- */ -+ -+/* LzmaEnc_* functions can return the following exit codes: -+Returns: -+ SZ_OK - OK -+ SZ_ERROR_MEM - Memory allocation error -+ SZ_ERROR_PARAM - Incorrect paramater in props -+ SZ_ERROR_WRITE - Write callback error. -+ SZ_ERROR_PROGRESS - some break from progress callback -+ SZ_ERROR_THREAD - errors in multithreading functions (only for Mt version) -+*/ -+ -+typedef void * CLzmaEncHandle; -+ -+CLzmaEncHandle LzmaEnc_Create(ISzAlloc *alloc); -+void LzmaEnc_Destroy(CLzmaEncHandle p, ISzAlloc *alloc, ISzAlloc *allocBig); -+SRes LzmaEnc_SetProps(CLzmaEncHandle p, const CLzmaEncProps *props); -+SRes LzmaEnc_WriteProperties(CLzmaEncHandle p, Byte *properties, SizeT *size); -+SRes LzmaEnc_Encode(CLzmaEncHandle p, ISeqOutStream *outStream, ISeqInStream *inStream, -+ ICompressProgress *progress, ISzAlloc *alloc, ISzAlloc *allocBig); -+SRes LzmaEnc_MemEncode(CLzmaEncHandle p, Byte *dest, SizeT *destLen, const Byte *src, SizeT srcLen, -+ int writeEndMark, ICompressProgress *progress, ISzAlloc *alloc, ISzAlloc *allocBig); -+ -+/* ---------- One Call Interface ---------- */ -+ -+/* LzmaEncode -+Return code: -+ SZ_OK - OK -+ SZ_ERROR_MEM - Memory allocation error -+ SZ_ERROR_PARAM - Incorrect paramater -+ SZ_ERROR_OUTPUT_EOF - output buffer overflow -+ SZ_ERROR_THREAD - errors in multithreading functions (only for Mt version) -+*/ -+ -+SRes LzmaEncode(Byte *dest, SizeT *destLen, const Byte *src, SizeT srcLen, -+ const CLzmaEncProps *props, Byte *propsEncoded, SizeT *propsSize, int writeEndMark, -+ ICompressProgress *progress, ISzAlloc *alloc, ISzAlloc *allocBig); -+ -+#ifdef __cplusplus -+} -+#endif -+ -+#endif ---- /dev/null -+++ b/include/linux/lzma/Types.h -@@ -0,0 +1,226 @@ -+/* Types.h -- Basic types -+2009-11-23 : Igor Pavlov : Public domain */ -+ -+#ifndef __7Z_TYPES_H -+#define __7Z_TYPES_H -+ -+#include -+ -+#ifdef _WIN32 -+#include -+#endif -+ -+#ifndef EXTERN_C_BEGIN -+#ifdef __cplusplus -+#define EXTERN_C_BEGIN extern "C" { -+#define EXTERN_C_END } -+#else -+#define EXTERN_C_BEGIN -+#define EXTERN_C_END -+#endif -+#endif -+ -+EXTERN_C_BEGIN -+ -+#define SZ_OK 0 -+ -+#define SZ_ERROR_DATA 1 -+#define SZ_ERROR_MEM 2 -+#define SZ_ERROR_CRC 3 -+#define SZ_ERROR_UNSUPPORTED 4 -+#define SZ_ERROR_PARAM 5 -+#define SZ_ERROR_INPUT_EOF 6 -+#define SZ_ERROR_OUTPUT_EOF 7 -+#define SZ_ERROR_READ 8 -+#define SZ_ERROR_WRITE 9 -+#define SZ_ERROR_PROGRESS 10 -+#define SZ_ERROR_FAIL 11 -+#define SZ_ERROR_THREAD 12 -+ -+#define SZ_ERROR_ARCHIVE 16 -+#define SZ_ERROR_NO_ARCHIVE 17 -+ -+typedef int SRes; -+ -+#ifdef _WIN32 -+typedef DWORD WRes; -+#else -+typedef int WRes; -+#endif -+ -+#ifndef RINOK -+#define RINOK(x) { int __result__ = (x); if (__result__ != 0) return __result__; } -+#endif -+ -+typedef unsigned char Byte; -+typedef short Int16; -+typedef unsigned short UInt16; -+ -+#ifdef _LZMA_UINT32_IS_ULONG -+typedef long Int32; -+typedef unsigned long UInt32; -+#else -+typedef int Int32; -+typedef unsigned int UInt32; -+#endif -+ -+#ifdef _SZ_NO_INT_64 -+ -+/* define _SZ_NO_INT_64, if your compiler doesn't support 64-bit integers. -+ NOTES: Some code will work incorrectly in that case! */ -+ -+typedef long Int64; -+typedef unsigned long UInt64; -+ -+#else -+ -+#if defined(_MSC_VER) || defined(__BORLANDC__) -+typedef __int64 Int64; -+typedef unsigned __int64 UInt64; -+#else -+typedef long long int Int64; -+typedef unsigned long long int UInt64; -+#endif -+ -+#endif -+ -+#ifdef _LZMA_NO_SYSTEM_SIZE_T -+typedef UInt32 SizeT; -+#else -+typedef size_t SizeT; -+#endif -+ -+typedef int Bool; -+#define True 1 -+#define False 0 -+ -+ -+#ifdef _WIN32 -+#define MY_STD_CALL __stdcall -+#else -+#define MY_STD_CALL -+#endif -+ -+#ifdef _MSC_VER -+ -+#if _MSC_VER >= 1300 -+#define MY_NO_INLINE __declspec(noinline) -+#else -+#define MY_NO_INLINE -+#endif -+ -+#define MY_CDECL __cdecl -+#define MY_FAST_CALL __fastcall -+ -+#else -+ -+#define MY_CDECL -+#define MY_FAST_CALL -+ -+#endif -+ -+ -+/* The following interfaces use first parameter as pointer to structure */ -+ -+typedef struct -+{ -+ SRes (*Read)(void *p, void *buf, size_t *size); -+ /* if (input(*size) != 0 && output(*size) == 0) means end_of_stream. -+ (output(*size) < input(*size)) is allowed */ -+} ISeqInStream; -+ -+/* it can return SZ_ERROR_INPUT_EOF */ -+SRes SeqInStream_Read(ISeqInStream *stream, void *buf, size_t size); -+SRes SeqInStream_Read2(ISeqInStream *stream, void *buf, size_t size, SRes errorType); -+SRes SeqInStream_ReadByte(ISeqInStream *stream, Byte *buf); -+ -+typedef struct -+{ -+ size_t (*Write)(void *p, const void *buf, size_t size); -+ /* Returns: result - the number of actually written bytes. -+ (result < size) means error */ -+} ISeqOutStream; -+ -+typedef enum -+{ -+ SZ_SEEK_SET = 0, -+ SZ_SEEK_CUR = 1, -+ SZ_SEEK_END = 2 -+} ESzSeek; -+ -+typedef struct -+{ -+ SRes (*Read)(void *p, void *buf, size_t *size); /* same as ISeqInStream::Read */ -+ SRes (*Seek)(void *p, Int64 *pos, ESzSeek origin); -+} ISeekInStream; -+ -+typedef struct -+{ -+ SRes (*Look)(void *p, void **buf, size_t *size); -+ /* if (input(*size) != 0 && output(*size) == 0) means end_of_stream. -+ (output(*size) > input(*size)) is not allowed -+ (output(*size) < input(*size)) is allowed */ -+ SRes (*Skip)(void *p, size_t offset); -+ /* offset must be <= output(*size) of Look */ -+ -+ SRes (*Read)(void *p, void *buf, size_t *size); -+ /* reads directly (without buffer). It's same as ISeqInStream::Read */ -+ SRes (*Seek)(void *p, Int64 *pos, ESzSeek origin); -+} ILookInStream; -+ -+SRes LookInStream_LookRead(ILookInStream *stream, void *buf, size_t *size); -+SRes LookInStream_SeekTo(ILookInStream *stream, UInt64 offset); -+ -+/* reads via ILookInStream::Read */ -+SRes LookInStream_Read2(ILookInStream *stream, void *buf, size_t size, SRes errorType); -+SRes LookInStream_Read(ILookInStream *stream, void *buf, size_t size); -+ -+#define LookToRead_BUF_SIZE (1 << 14) -+ -+typedef struct -+{ -+ ILookInStream s; -+ ISeekInStream *realStream; -+ size_t pos; -+ size_t size; -+ Byte buf[LookToRead_BUF_SIZE]; -+} CLookToRead; -+ -+void LookToRead_CreateVTable(CLookToRead *p, int lookahead); -+void LookToRead_Init(CLookToRead *p); -+ -+typedef struct -+{ -+ ISeqInStream s; -+ ILookInStream *realStream; -+} CSecToLook; -+ -+void SecToLook_CreateVTable(CSecToLook *p); -+ -+typedef struct -+{ -+ ISeqInStream s; -+ ILookInStream *realStream; -+} CSecToRead; -+ -+void SecToRead_CreateVTable(CSecToRead *p); -+ -+typedef struct -+{ -+ SRes (*Progress)(void *p, UInt64 inSize, UInt64 outSize); -+ /* Returns: result. (result != SZ_OK) means break. -+ Value (UInt64)(Int64)-1 for size means unknown value. */ -+} ICompressProgress; -+ -+typedef struct -+{ -+ void *(*Alloc)(void *p, size_t size); -+ void (*Free)(void *p, void *address); /* address can be 0 */ -+} ISzAlloc; -+ -+#define IAlloc_Alloc(p, size) (p)->Alloc((p), size) -+#define IAlloc_Free(p, a) (p)->Free((p), a) -+ -+EXTERN_C_END -+ -+#endif ---- a/include/uapi/linux/jffs2.h -+++ b/include/uapi/linux/jffs2.h -@@ -46,6 +46,7 @@ - #define JFFS2_COMPR_DYNRUBIN 0x05 - #define JFFS2_COMPR_ZLIB 0x06 - #define JFFS2_COMPR_LZO 0x07 -+#define JFFS2_COMPR_LZMA 0x08 - /* Compatibility flags. */ - #define JFFS2_COMPAT_MASK 0xc000 /* What do to if an unknown nodetype is found */ - #define JFFS2_NODE_ACCURATE 0x2000 ---- a/lib/Kconfig -+++ b/lib/Kconfig -@@ -241,6 +241,12 @@ config LZ4_DECOMPRESS - - source "lib/xz/Kconfig" - -+config LZMA_COMPRESS -+ tristate -+ -+config LZMA_DECOMPRESS -+ tristate -+ - # - # These all provide a common interface (hence the apparent duplication with - # ZLIB_INFLATE; DECOMPRESS_GZIP is just a wrapper.) ---- a/lib/Makefile -+++ b/lib/Makefile -@@ -2,6 +2,16 @@ - # Makefile for some libs needed in the kernel. - # - -+ifdef CONFIG_JFFS2_ZLIB -+ CONFIG_ZLIB_INFLATE:=y -+ CONFIG_ZLIB_DEFLATE:=y -+endif -+ -+ifdef CONFIG_JFFS2_LZMA -+ CONFIG_LZMA_DECOMPRESS:=y -+ CONFIG_LZMA_COMPRESS:=y -+endif -+ - ifdef CONFIG_FUNCTION_TRACER - ORIG_CFLAGS := $(KBUILD_CFLAGS) - KBUILD_CFLAGS = $(subst $(CC_FLAGS_FTRACE),,$(ORIG_CFLAGS)) -@@ -108,6 +118,8 @@ obj-$(CONFIG_LZ4HC_COMPRESS) += lz4/ - obj-$(CONFIG_LZ4_DECOMPRESS) += lz4/ - obj-$(CONFIG_XZ_DEC) += xz/ - obj-$(CONFIG_RAID6_PQ) += raid6/ -+obj-$(CONFIG_LZMA_COMPRESS) += lzma/ -+obj-$(CONFIG_LZMA_DECOMPRESS) += lzma/ - - lib-$(CONFIG_DECOMPRESS_GZIP) += decompress_inflate.o - lib-$(CONFIG_DECOMPRESS_BZIP2) += decompress_bunzip2.o ---- /dev/null -+++ b/lib/lzma/LzFind.c -@@ -0,0 +1,761 @@ -+/* LzFind.c -- Match finder for LZ algorithms -+2009-04-22 : Igor Pavlov : Public domain */ -+ -+#include -+ -+#include "LzFind.h" -+#include "LzHash.h" -+ -+#define kEmptyHashValue 0 -+#define kMaxValForNormalize ((UInt32)0xFFFFFFFF) -+#define kNormalizeStepMin (1 << 10) /* it must be power of 2 */ -+#define kNormalizeMask (~(kNormalizeStepMin - 1)) -+#define kMaxHistorySize ((UInt32)3 << 30) -+ -+#define kStartMaxLen 3 -+ -+static void LzInWindow_Free(CMatchFinder *p, ISzAlloc *alloc) -+{ -+ if (!p->directInput) -+ { -+ alloc->Free(alloc, p->bufferBase); -+ p->bufferBase = 0; -+ } -+} -+ -+/* keepSizeBefore + keepSizeAfter + keepSizeReserv must be < 4G) */ -+ -+static int LzInWindow_Create(CMatchFinder *p, UInt32 keepSizeReserv, ISzAlloc *alloc) -+{ -+ UInt32 blockSize = p->keepSizeBefore + p->keepSizeAfter + keepSizeReserv; -+ if (p->directInput) -+ { -+ p->blockSize = blockSize; -+ return 1; -+ } -+ if (p->bufferBase == 0 || p->blockSize != blockSize) -+ { -+ LzInWindow_Free(p, alloc); -+ p->blockSize = blockSize; -+ p->bufferBase = (Byte *)alloc->Alloc(alloc, (size_t)blockSize); -+ } -+ return (p->bufferBase != 0); -+} -+ -+Byte *MatchFinder_GetPointerToCurrentPos(CMatchFinder *p) { return p->buffer; } -+Byte MatchFinder_GetIndexByte(CMatchFinder *p, Int32 index) { return p->buffer[index]; } -+ -+UInt32 MatchFinder_GetNumAvailableBytes(CMatchFinder *p) { return p->streamPos - p->pos; } -+ -+void MatchFinder_ReduceOffsets(CMatchFinder *p, UInt32 subValue) -+{ -+ p->posLimit -= subValue; -+ p->pos -= subValue; -+ p->streamPos -= subValue; -+} -+ -+static void MatchFinder_ReadBlock(CMatchFinder *p) -+{ -+ if (p->streamEndWasReached || p->result != SZ_OK) -+ return; -+ if (p->directInput) -+ { -+ UInt32 curSize = 0xFFFFFFFF - p->streamPos; -+ if (curSize > p->directInputRem) -+ curSize = (UInt32)p->directInputRem; -+ p->directInputRem -= curSize; -+ p->streamPos += curSize; -+ if (p->directInputRem == 0) -+ p->streamEndWasReached = 1; -+ return; -+ } -+ for (;;) -+ { -+ Byte *dest = p->buffer + (p->streamPos - p->pos); -+ size_t size = (p->bufferBase + p->blockSize - dest); -+ if (size == 0) -+ return; -+ p->result = p->stream->Read(p->stream, dest, &size); -+ if (p->result != SZ_OK) -+ return; -+ if (size == 0) -+ { -+ p->streamEndWasReached = 1; -+ return; -+ } -+ p->streamPos += (UInt32)size; -+ if (p->streamPos - p->pos > p->keepSizeAfter) -+ return; -+ } -+} -+ -+void MatchFinder_MoveBlock(CMatchFinder *p) -+{ -+ memmove(p->bufferBase, -+ p->buffer - p->keepSizeBefore, -+ (size_t)(p->streamPos - p->pos + p->keepSizeBefore)); -+ p->buffer = p->bufferBase + p->keepSizeBefore; -+} -+ -+int MatchFinder_NeedMove(CMatchFinder *p) -+{ -+ if (p->directInput) -+ return 0; -+ /* if (p->streamEndWasReached) return 0; */ -+ return ((size_t)(p->bufferBase + p->blockSize - p->buffer) <= p->keepSizeAfter); -+} -+ -+void MatchFinder_ReadIfRequired(CMatchFinder *p) -+{ -+ if (p->streamEndWasReached) -+ return; -+ if (p->keepSizeAfter >= p->streamPos - p->pos) -+ MatchFinder_ReadBlock(p); -+} -+ -+static void MatchFinder_CheckAndMoveAndRead(CMatchFinder *p) -+{ -+ if (MatchFinder_NeedMove(p)) -+ MatchFinder_MoveBlock(p); -+ MatchFinder_ReadBlock(p); -+} -+ -+static void MatchFinder_SetDefaultSettings(CMatchFinder *p) -+{ -+ p->cutValue = 32; -+ p->btMode = 1; -+ p->numHashBytes = 4; -+ p->bigHash = 0; -+} -+ -+#define kCrcPoly 0xEDB88320 -+ -+void MatchFinder_Construct(CMatchFinder *p) -+{ -+ UInt32 i; -+ p->bufferBase = 0; -+ p->directInput = 0; -+ p->hash = 0; -+ MatchFinder_SetDefaultSettings(p); -+ -+ for (i = 0; i < 256; i++) -+ { -+ UInt32 r = i; -+ int j; -+ for (j = 0; j < 8; j++) -+ r = (r >> 1) ^ (kCrcPoly & ~((r & 1) - 1)); -+ p->crc[i] = r; -+ } -+} -+ -+static void MatchFinder_FreeThisClassMemory(CMatchFinder *p, ISzAlloc *alloc) -+{ -+ alloc->Free(alloc, p->hash); -+ p->hash = 0; -+} -+ -+void MatchFinder_Free(CMatchFinder *p, ISzAlloc *alloc) -+{ -+ MatchFinder_FreeThisClassMemory(p, alloc); -+ LzInWindow_Free(p, alloc); -+} -+ -+static CLzRef* AllocRefs(UInt32 num, ISzAlloc *alloc) -+{ -+ size_t sizeInBytes = (size_t)num * sizeof(CLzRef); -+ if (sizeInBytes / sizeof(CLzRef) != num) -+ return 0; -+ return (CLzRef *)alloc->Alloc(alloc, sizeInBytes); -+} -+ -+int MatchFinder_Create(CMatchFinder *p, UInt32 historySize, -+ UInt32 keepAddBufferBefore, UInt32 matchMaxLen, UInt32 keepAddBufferAfter, -+ ISzAlloc *alloc) -+{ -+ UInt32 sizeReserv; -+ if (historySize > kMaxHistorySize) -+ { -+ MatchFinder_Free(p, alloc); -+ return 0; -+ } -+ sizeReserv = historySize >> 1; -+ if (historySize > ((UInt32)2 << 30)) -+ sizeReserv = historySize >> 2; -+ sizeReserv += (keepAddBufferBefore + matchMaxLen + keepAddBufferAfter) / 2 + (1 << 19); -+ -+ p->keepSizeBefore = historySize + keepAddBufferBefore + 1; -+ p->keepSizeAfter = matchMaxLen + keepAddBufferAfter; -+ /* we need one additional byte, since we use MoveBlock after pos++ and before dictionary using */ -+ if (LzInWindow_Create(p, sizeReserv, alloc)) -+ { -+ UInt32 newCyclicBufferSize = historySize + 1; -+ UInt32 hs; -+ p->matchMaxLen = matchMaxLen; -+ { -+ p->fixedHashSize = 0; -+ if (p->numHashBytes == 2) -+ hs = (1 << 16) - 1; -+ else -+ { -+ hs = historySize - 1; -+ hs |= (hs >> 1); -+ hs |= (hs >> 2); -+ hs |= (hs >> 4); -+ hs |= (hs >> 8); -+ hs >>= 1; -+ hs |= 0xFFFF; /* don't change it! It's required for Deflate */ -+ if (hs > (1 << 24)) -+ { -+ if (p->numHashBytes == 3) -+ hs = (1 << 24) - 1; -+ else -+ hs >>= 1; -+ } -+ } -+ p->hashMask = hs; -+ hs++; -+ if (p->numHashBytes > 2) p->fixedHashSize += kHash2Size; -+ if (p->numHashBytes > 3) p->fixedHashSize += kHash3Size; -+ if (p->numHashBytes > 4) p->fixedHashSize += kHash4Size; -+ hs += p->fixedHashSize; -+ } -+ -+ { -+ UInt32 prevSize = p->hashSizeSum + p->numSons; -+ UInt32 newSize; -+ p->historySize = historySize; -+ p->hashSizeSum = hs; -+ p->cyclicBufferSize = newCyclicBufferSize; -+ p->numSons = (p->btMode ? newCyclicBufferSize * 2 : newCyclicBufferSize); -+ newSize = p->hashSizeSum + p->numSons; -+ if (p->hash != 0 && prevSize == newSize) -+ return 1; -+ MatchFinder_FreeThisClassMemory(p, alloc); -+ p->hash = AllocRefs(newSize, alloc); -+ if (p->hash != 0) -+ { -+ p->son = p->hash + p->hashSizeSum; -+ return 1; -+ } -+ } -+ } -+ MatchFinder_Free(p, alloc); -+ return 0; -+} -+ -+static void MatchFinder_SetLimits(CMatchFinder *p) -+{ -+ UInt32 limit = kMaxValForNormalize - p->pos; -+ UInt32 limit2 = p->cyclicBufferSize - p->cyclicBufferPos; -+ if (limit2 < limit) -+ limit = limit2; -+ limit2 = p->streamPos - p->pos; -+ if (limit2 <= p->keepSizeAfter) -+ { -+ if (limit2 > 0) -+ limit2 = 1; -+ } -+ else -+ limit2 -= p->keepSizeAfter; -+ if (limit2 < limit) -+ limit = limit2; -+ { -+ UInt32 lenLimit = p->streamPos - p->pos; -+ if (lenLimit > p->matchMaxLen) -+ lenLimit = p->matchMaxLen; -+ p->lenLimit = lenLimit; -+ } -+ p->posLimit = p->pos + limit; -+} -+ -+void MatchFinder_Init(CMatchFinder *p) -+{ -+ UInt32 i; -+ for (i = 0; i < p->hashSizeSum; i++) -+ p->hash[i] = kEmptyHashValue; -+ p->cyclicBufferPos = 0; -+ p->buffer = p->bufferBase; -+ p->pos = p->streamPos = p->cyclicBufferSize; -+ p->result = SZ_OK; -+ p->streamEndWasReached = 0; -+ MatchFinder_ReadBlock(p); -+ MatchFinder_SetLimits(p); -+} -+ -+static UInt32 MatchFinder_GetSubValue(CMatchFinder *p) -+{ -+ return (p->pos - p->historySize - 1) & kNormalizeMask; -+} -+ -+void MatchFinder_Normalize3(UInt32 subValue, CLzRef *items, UInt32 numItems) -+{ -+ UInt32 i; -+ for (i = 0; i < numItems; i++) -+ { -+ UInt32 value = items[i]; -+ if (value <= subValue) -+ value = kEmptyHashValue; -+ else -+ value -= subValue; -+ items[i] = value; -+ } -+} -+ -+static void MatchFinder_Normalize(CMatchFinder *p) -+{ -+ UInt32 subValue = MatchFinder_GetSubValue(p); -+ MatchFinder_Normalize3(subValue, p->hash, p->hashSizeSum + p->numSons); -+ MatchFinder_ReduceOffsets(p, subValue); -+} -+ -+static void MatchFinder_CheckLimits(CMatchFinder *p) -+{ -+ if (p->pos == kMaxValForNormalize) -+ MatchFinder_Normalize(p); -+ if (!p->streamEndWasReached && p->keepSizeAfter == p->streamPos - p->pos) -+ MatchFinder_CheckAndMoveAndRead(p); -+ if (p->cyclicBufferPos == p->cyclicBufferSize) -+ p->cyclicBufferPos = 0; -+ MatchFinder_SetLimits(p); -+} -+ -+static UInt32 * Hc_GetMatchesSpec(UInt32 lenLimit, UInt32 curMatch, UInt32 pos, const Byte *cur, CLzRef *son, -+ UInt32 _cyclicBufferPos, UInt32 _cyclicBufferSize, UInt32 cutValue, -+ UInt32 *distances, UInt32 maxLen) -+{ -+ son[_cyclicBufferPos] = curMatch; -+ for (;;) -+ { -+ UInt32 delta = pos - curMatch; -+ if (cutValue-- == 0 || delta >= _cyclicBufferSize) -+ return distances; -+ { -+ const Byte *pb = cur - delta; -+ curMatch = son[_cyclicBufferPos - delta + ((delta > _cyclicBufferPos) ? _cyclicBufferSize : 0)]; -+ if (pb[maxLen] == cur[maxLen] && *pb == *cur) -+ { -+ UInt32 len = 0; -+ while (++len != lenLimit) -+ if (pb[len] != cur[len]) -+ break; -+ if (maxLen < len) -+ { -+ *distances++ = maxLen = len; -+ *distances++ = delta - 1; -+ if (len == lenLimit) -+ return distances; -+ } -+ } -+ } -+ } -+} -+ -+UInt32 * GetMatchesSpec1(UInt32 lenLimit, UInt32 curMatch, UInt32 pos, const Byte *cur, CLzRef *son, -+ UInt32 _cyclicBufferPos, UInt32 _cyclicBufferSize, UInt32 cutValue, -+ UInt32 *distances, UInt32 maxLen) -+{ -+ CLzRef *ptr0 = son + (_cyclicBufferPos << 1) + 1; -+ CLzRef *ptr1 = son + (_cyclicBufferPos << 1); -+ UInt32 len0 = 0, len1 = 0; -+ for (;;) -+ { -+ UInt32 delta = pos - curMatch; -+ if (cutValue-- == 0 || delta >= _cyclicBufferSize) -+ { -+ *ptr0 = *ptr1 = kEmptyHashValue; -+ return distances; -+ } -+ { -+ CLzRef *pair = son + ((_cyclicBufferPos - delta + ((delta > _cyclicBufferPos) ? _cyclicBufferSize : 0)) << 1); -+ const Byte *pb = cur - delta; -+ UInt32 len = (len0 < len1 ? len0 : len1); -+ if (pb[len] == cur[len]) -+ { -+ if (++len != lenLimit && pb[len] == cur[len]) -+ while (++len != lenLimit) -+ if (pb[len] != cur[len]) -+ break; -+ if (maxLen < len) -+ { -+ *distances++ = maxLen = len; -+ *distances++ = delta - 1; -+ if (len == lenLimit) -+ { -+ *ptr1 = pair[0]; -+ *ptr0 = pair[1]; -+ return distances; -+ } -+ } -+ } -+ if (pb[len] < cur[len]) -+ { -+ *ptr1 = curMatch; -+ ptr1 = pair + 1; -+ curMatch = *ptr1; -+ len1 = len; -+ } -+ else -+ { -+ *ptr0 = curMatch; -+ ptr0 = pair; -+ curMatch = *ptr0; -+ len0 = len; -+ } -+ } -+ } -+} -+ -+static void SkipMatchesSpec(UInt32 lenLimit, UInt32 curMatch, UInt32 pos, const Byte *cur, CLzRef *son, -+ UInt32 _cyclicBufferPos, UInt32 _cyclicBufferSize, UInt32 cutValue) -+{ -+ CLzRef *ptr0 = son + (_cyclicBufferPos << 1) + 1; -+ CLzRef *ptr1 = son + (_cyclicBufferPos << 1); -+ UInt32 len0 = 0, len1 = 0; -+ for (;;) -+ { -+ UInt32 delta = pos - curMatch; -+ if (cutValue-- == 0 || delta >= _cyclicBufferSize) -+ { -+ *ptr0 = *ptr1 = kEmptyHashValue; -+ return; -+ } -+ { -+ CLzRef *pair = son + ((_cyclicBufferPos - delta + ((delta > _cyclicBufferPos) ? _cyclicBufferSize : 0)) << 1); -+ const Byte *pb = cur - delta; -+ UInt32 len = (len0 < len1 ? len0 : len1); -+ if (pb[len] == cur[len]) -+ { -+ while (++len != lenLimit) -+ if (pb[len] != cur[len]) -+ break; -+ { -+ if (len == lenLimit) -+ { -+ *ptr1 = pair[0]; -+ *ptr0 = pair[1]; -+ return; -+ } -+ } -+ } -+ if (pb[len] < cur[len]) -+ { -+ *ptr1 = curMatch; -+ ptr1 = pair + 1; -+ curMatch = *ptr1; -+ len1 = len; -+ } -+ else -+ { -+ *ptr0 = curMatch; -+ ptr0 = pair; -+ curMatch = *ptr0; -+ len0 = len; -+ } -+ } -+ } -+} -+ -+#define MOVE_POS \ -+ ++p->cyclicBufferPos; \ -+ p->buffer++; \ -+ if (++p->pos == p->posLimit) MatchFinder_CheckLimits(p); -+ -+#define MOVE_POS_RET MOVE_POS return offset; -+ -+static void MatchFinder_MovePos(CMatchFinder *p) { MOVE_POS; } -+ -+#define GET_MATCHES_HEADER2(minLen, ret_op) \ -+ UInt32 lenLimit; UInt32 hashValue; const Byte *cur; UInt32 curMatch; \ -+ lenLimit = p->lenLimit; { if (lenLimit < minLen) { MatchFinder_MovePos(p); ret_op; }} \ -+ cur = p->buffer; -+ -+#define GET_MATCHES_HEADER(minLen) GET_MATCHES_HEADER2(minLen, return 0) -+#define SKIP_HEADER(minLen) GET_MATCHES_HEADER2(minLen, continue) -+ -+#define MF_PARAMS(p) p->pos, p->buffer, p->son, p->cyclicBufferPos, p->cyclicBufferSize, p->cutValue -+ -+#define GET_MATCHES_FOOTER(offset, maxLen) \ -+ offset = (UInt32)(GetMatchesSpec1(lenLimit, curMatch, MF_PARAMS(p), \ -+ distances + offset, maxLen) - distances); MOVE_POS_RET; -+ -+#define SKIP_FOOTER \ -+ SkipMatchesSpec(lenLimit, curMatch, MF_PARAMS(p)); MOVE_POS; -+ -+static UInt32 Bt2_MatchFinder_GetMatches(CMatchFinder *p, UInt32 *distances) -+{ -+ UInt32 offset; -+ GET_MATCHES_HEADER(2) -+ HASH2_CALC; -+ curMatch = p->hash[hashValue]; -+ p->hash[hashValue] = p->pos; -+ offset = 0; -+ GET_MATCHES_FOOTER(offset, 1) -+} -+ -+UInt32 Bt3Zip_MatchFinder_GetMatches(CMatchFinder *p, UInt32 *distances) -+{ -+ UInt32 offset; -+ GET_MATCHES_HEADER(3) -+ HASH_ZIP_CALC; -+ curMatch = p->hash[hashValue]; -+ p->hash[hashValue] = p->pos; -+ offset = 0; -+ GET_MATCHES_FOOTER(offset, 2) -+} -+ -+static UInt32 Bt3_MatchFinder_GetMatches(CMatchFinder *p, UInt32 *distances) -+{ -+ UInt32 hash2Value, delta2, maxLen, offset; -+ GET_MATCHES_HEADER(3) -+ -+ HASH3_CALC; -+ -+ delta2 = p->pos - p->hash[hash2Value]; -+ curMatch = p->hash[kFix3HashSize + hashValue]; -+ -+ p->hash[hash2Value] = -+ p->hash[kFix3HashSize + hashValue] = p->pos; -+ -+ -+ maxLen = 2; -+ offset = 0; -+ if (delta2 < p->cyclicBufferSize && *(cur - delta2) == *cur) -+ { -+ for (; maxLen != lenLimit; maxLen++) -+ if (cur[(ptrdiff_t)maxLen - delta2] != cur[maxLen]) -+ break; -+ distances[0] = maxLen; -+ distances[1] = delta2 - 1; -+ offset = 2; -+ if (maxLen == lenLimit) -+ { -+ SkipMatchesSpec(lenLimit, curMatch, MF_PARAMS(p)); -+ MOVE_POS_RET; -+ } -+ } -+ GET_MATCHES_FOOTER(offset, maxLen) -+} -+ -+static UInt32 Bt4_MatchFinder_GetMatches(CMatchFinder *p, UInt32 *distances) -+{ -+ UInt32 hash2Value, hash3Value, delta2, delta3, maxLen, offset; -+ GET_MATCHES_HEADER(4) -+ -+ HASH4_CALC; -+ -+ delta2 = p->pos - p->hash[ hash2Value]; -+ delta3 = p->pos - p->hash[kFix3HashSize + hash3Value]; -+ curMatch = p->hash[kFix4HashSize + hashValue]; -+ -+ p->hash[ hash2Value] = -+ p->hash[kFix3HashSize + hash3Value] = -+ p->hash[kFix4HashSize + hashValue] = p->pos; -+ -+ maxLen = 1; -+ offset = 0; -+ if (delta2 < p->cyclicBufferSize && *(cur - delta2) == *cur) -+ { -+ distances[0] = maxLen = 2; -+ distances[1] = delta2 - 1; -+ offset = 2; -+ } -+ if (delta2 != delta3 && delta3 < p->cyclicBufferSize && *(cur - delta3) == *cur) -+ { -+ maxLen = 3; -+ distances[offset + 1] = delta3 - 1; -+ offset += 2; -+ delta2 = delta3; -+ } -+ if (offset != 0) -+ { -+ for (; maxLen != lenLimit; maxLen++) -+ if (cur[(ptrdiff_t)maxLen - delta2] != cur[maxLen]) -+ break; -+ distances[offset - 2] = maxLen; -+ if (maxLen == lenLimit) -+ { -+ SkipMatchesSpec(lenLimit, curMatch, MF_PARAMS(p)); -+ MOVE_POS_RET; -+ } -+ } -+ if (maxLen < 3) -+ maxLen = 3; -+ GET_MATCHES_FOOTER(offset, maxLen) -+} -+ -+static UInt32 Hc4_MatchFinder_GetMatches(CMatchFinder *p, UInt32 *distances) -+{ -+ UInt32 hash2Value, hash3Value, delta2, delta3, maxLen, offset; -+ GET_MATCHES_HEADER(4) -+ -+ HASH4_CALC; -+ -+ delta2 = p->pos - p->hash[ hash2Value]; -+ delta3 = p->pos - p->hash[kFix3HashSize + hash3Value]; -+ curMatch = p->hash[kFix4HashSize + hashValue]; -+ -+ p->hash[ hash2Value] = -+ p->hash[kFix3HashSize + hash3Value] = -+ p->hash[kFix4HashSize + hashValue] = p->pos; -+ -+ maxLen = 1; -+ offset = 0; -+ if (delta2 < p->cyclicBufferSize && *(cur - delta2) == *cur) -+ { -+ distances[0] = maxLen = 2; -+ distances[1] = delta2 - 1; -+ offset = 2; -+ } -+ if (delta2 != delta3 && delta3 < p->cyclicBufferSize && *(cur - delta3) == *cur) -+ { -+ maxLen = 3; -+ distances[offset + 1] = delta3 - 1; -+ offset += 2; -+ delta2 = delta3; -+ } -+ if (offset != 0) -+ { -+ for (; maxLen != lenLimit; maxLen++) -+ if (cur[(ptrdiff_t)maxLen - delta2] != cur[maxLen]) -+ break; -+ distances[offset - 2] = maxLen; -+ if (maxLen == lenLimit) -+ { -+ p->son[p->cyclicBufferPos] = curMatch; -+ MOVE_POS_RET; -+ } -+ } -+ if (maxLen < 3) -+ maxLen = 3; -+ offset = (UInt32)(Hc_GetMatchesSpec(lenLimit, curMatch, MF_PARAMS(p), -+ distances + offset, maxLen) - (distances)); -+ MOVE_POS_RET -+} -+ -+UInt32 Hc3Zip_MatchFinder_GetMatches(CMatchFinder *p, UInt32 *distances) -+{ -+ UInt32 offset; -+ GET_MATCHES_HEADER(3) -+ HASH_ZIP_CALC; -+ curMatch = p->hash[hashValue]; -+ p->hash[hashValue] = p->pos; -+ offset = (UInt32)(Hc_GetMatchesSpec(lenLimit, curMatch, MF_PARAMS(p), -+ distances, 2) - (distances)); -+ MOVE_POS_RET -+} -+ -+static void Bt2_MatchFinder_Skip(CMatchFinder *p, UInt32 num) -+{ -+ do -+ { -+ SKIP_HEADER(2) -+ HASH2_CALC; -+ curMatch = p->hash[hashValue]; -+ p->hash[hashValue] = p->pos; -+ SKIP_FOOTER -+ } -+ while (--num != 0); -+} -+ -+void Bt3Zip_MatchFinder_Skip(CMatchFinder *p, UInt32 num) -+{ -+ do -+ { -+ SKIP_HEADER(3) -+ HASH_ZIP_CALC; -+ curMatch = p->hash[hashValue]; -+ p->hash[hashValue] = p->pos; -+ SKIP_FOOTER -+ } -+ while (--num != 0); -+} -+ -+static void Bt3_MatchFinder_Skip(CMatchFinder *p, UInt32 num) -+{ -+ do -+ { -+ UInt32 hash2Value; -+ SKIP_HEADER(3) -+ HASH3_CALC; -+ curMatch = p->hash[kFix3HashSize + hashValue]; -+ p->hash[hash2Value] = -+ p->hash[kFix3HashSize + hashValue] = p->pos; -+ SKIP_FOOTER -+ } -+ while (--num != 0); -+} -+ -+static void Bt4_MatchFinder_Skip(CMatchFinder *p, UInt32 num) -+{ -+ do -+ { -+ UInt32 hash2Value, hash3Value; -+ SKIP_HEADER(4) -+ HASH4_CALC; -+ curMatch = p->hash[kFix4HashSize + hashValue]; -+ p->hash[ hash2Value] = -+ p->hash[kFix3HashSize + hash3Value] = p->pos; -+ p->hash[kFix4HashSize + hashValue] = p->pos; -+ SKIP_FOOTER -+ } -+ while (--num != 0); -+} -+ -+static void Hc4_MatchFinder_Skip(CMatchFinder *p, UInt32 num) -+{ -+ do -+ { -+ UInt32 hash2Value, hash3Value; -+ SKIP_HEADER(4) -+ HASH4_CALC; -+ curMatch = p->hash[kFix4HashSize + hashValue]; -+ p->hash[ hash2Value] = -+ p->hash[kFix3HashSize + hash3Value] = -+ p->hash[kFix4HashSize + hashValue] = p->pos; -+ p->son[p->cyclicBufferPos] = curMatch; -+ MOVE_POS -+ } -+ while (--num != 0); -+} -+ -+void Hc3Zip_MatchFinder_Skip(CMatchFinder *p, UInt32 num) -+{ -+ do -+ { -+ SKIP_HEADER(3) -+ HASH_ZIP_CALC; -+ curMatch = p->hash[hashValue]; -+ p->hash[hashValue] = p->pos; -+ p->son[p->cyclicBufferPos] = curMatch; -+ MOVE_POS -+ } -+ while (--num != 0); -+} -+ -+void MatchFinder_CreateVTable(CMatchFinder *p, IMatchFinder *vTable) -+{ -+ vTable->Init = (Mf_Init_Func)MatchFinder_Init; -+ vTable->GetIndexByte = (Mf_GetIndexByte_Func)MatchFinder_GetIndexByte; -+ vTable->GetNumAvailableBytes = (Mf_GetNumAvailableBytes_Func)MatchFinder_GetNumAvailableBytes; -+ vTable->GetPointerToCurrentPos = (Mf_GetPointerToCurrentPos_Func)MatchFinder_GetPointerToCurrentPos; -+ if (!p->btMode) -+ { -+ vTable->GetMatches = (Mf_GetMatches_Func)Hc4_MatchFinder_GetMatches; -+ vTable->Skip = (Mf_Skip_Func)Hc4_MatchFinder_Skip; -+ } -+ else if (p->numHashBytes == 2) -+ { -+ vTable->GetMatches = (Mf_GetMatches_Func)Bt2_MatchFinder_GetMatches; -+ vTable->Skip = (Mf_Skip_Func)Bt2_MatchFinder_Skip; -+ } -+ else if (p->numHashBytes == 3) -+ { -+ vTable->GetMatches = (Mf_GetMatches_Func)Bt3_MatchFinder_GetMatches; -+ vTable->Skip = (Mf_Skip_Func)Bt3_MatchFinder_Skip; -+ } -+ else -+ { -+ vTable->GetMatches = (Mf_GetMatches_Func)Bt4_MatchFinder_GetMatches; -+ vTable->Skip = (Mf_Skip_Func)Bt4_MatchFinder_Skip; -+ } -+} ---- /dev/null -+++ b/lib/lzma/LzmaDec.c -@@ -0,0 +1,999 @@ -+/* LzmaDec.c -- LZMA Decoder -+2009-09-20 : Igor Pavlov : Public domain */ -+ -+#include "LzmaDec.h" -+ -+#include -+ -+#define kNumTopBits 24 -+#define kTopValue ((UInt32)1 << kNumTopBits) -+ -+#define kNumBitModelTotalBits 11 -+#define kBitModelTotal (1 << kNumBitModelTotalBits) -+#define kNumMoveBits 5 -+ -+#define RC_INIT_SIZE 5 -+ -+#define NORMALIZE if (range < kTopValue) { range <<= 8; code = (code << 8) | (*buf++); } -+ -+#define IF_BIT_0(p) ttt = *(p); NORMALIZE; bound = (range >> kNumBitModelTotalBits) * ttt; if (code < bound) -+#define UPDATE_0(p) range = bound; *(p) = (CLzmaProb)(ttt + ((kBitModelTotal - ttt) >> kNumMoveBits)); -+#define UPDATE_1(p) range -= bound; code -= bound; *(p) = (CLzmaProb)(ttt - (ttt >> kNumMoveBits)); -+#define GET_BIT2(p, i, A0, A1) IF_BIT_0(p) \ -+ { UPDATE_0(p); i = (i + i); A0; } else \ -+ { UPDATE_1(p); i = (i + i) + 1; A1; } -+#define GET_BIT(p, i) GET_BIT2(p, i, ; , ;) -+ -+#define TREE_GET_BIT(probs, i) { GET_BIT((probs + i), i); } -+#define TREE_DECODE(probs, limit, i) \ -+ { i = 1; do { TREE_GET_BIT(probs, i); } while (i < limit); i -= limit; } -+ -+/* #define _LZMA_SIZE_OPT */ -+ -+#ifdef _LZMA_SIZE_OPT -+#define TREE_6_DECODE(probs, i) TREE_DECODE(probs, (1 << 6), i) -+#else -+#define TREE_6_DECODE(probs, i) \ -+ { i = 1; \ -+ TREE_GET_BIT(probs, i); \ -+ TREE_GET_BIT(probs, i); \ -+ TREE_GET_BIT(probs, i); \ -+ TREE_GET_BIT(probs, i); \ -+ TREE_GET_BIT(probs, i); \ -+ TREE_GET_BIT(probs, i); \ -+ i -= 0x40; } -+#endif -+ -+#define NORMALIZE_CHECK if (range < kTopValue) { if (buf >= bufLimit) return DUMMY_ERROR; range <<= 8; code = (code << 8) | (*buf++); } -+ -+#define IF_BIT_0_CHECK(p) ttt = *(p); NORMALIZE_CHECK; bound = (range >> kNumBitModelTotalBits) * ttt; if (code < bound) -+#define UPDATE_0_CHECK range = bound; -+#define UPDATE_1_CHECK range -= bound; code -= bound; -+#define GET_BIT2_CHECK(p, i, A0, A1) IF_BIT_0_CHECK(p) \ -+ { UPDATE_0_CHECK; i = (i + i); A0; } else \ -+ { UPDATE_1_CHECK; i = (i + i) + 1; A1; } -+#define GET_BIT_CHECK(p, i) GET_BIT2_CHECK(p, i, ; , ;) -+#define TREE_DECODE_CHECK(probs, limit, i) \ -+ { i = 1; do { GET_BIT_CHECK(probs + i, i) } while (i < limit); i -= limit; } -+ -+ -+#define kNumPosBitsMax 4 -+#define kNumPosStatesMax (1 << kNumPosBitsMax) -+ -+#define kLenNumLowBits 3 -+#define kLenNumLowSymbols (1 << kLenNumLowBits) -+#define kLenNumMidBits 3 -+#define kLenNumMidSymbols (1 << kLenNumMidBits) -+#define kLenNumHighBits 8 -+#define kLenNumHighSymbols (1 << kLenNumHighBits) -+ -+#define LenChoice 0 -+#define LenChoice2 (LenChoice + 1) -+#define LenLow (LenChoice2 + 1) -+#define LenMid (LenLow + (kNumPosStatesMax << kLenNumLowBits)) -+#define LenHigh (LenMid + (kNumPosStatesMax << kLenNumMidBits)) -+#define kNumLenProbs (LenHigh + kLenNumHighSymbols) -+ -+ -+#define kNumStates 12 -+#define kNumLitStates 7 -+ -+#define kStartPosModelIndex 4 -+#define kEndPosModelIndex 14 -+#define kNumFullDistances (1 << (kEndPosModelIndex >> 1)) -+ -+#define kNumPosSlotBits 6 -+#define kNumLenToPosStates 4 -+ -+#define kNumAlignBits 4 -+#define kAlignTableSize (1 << kNumAlignBits) -+ -+#define kMatchMinLen 2 -+#define kMatchSpecLenStart (kMatchMinLen + kLenNumLowSymbols + kLenNumMidSymbols + kLenNumHighSymbols) -+ -+#define IsMatch 0 -+#define IsRep (IsMatch + (kNumStates << kNumPosBitsMax)) -+#define IsRepG0 (IsRep + kNumStates) -+#define IsRepG1 (IsRepG0 + kNumStates) -+#define IsRepG2 (IsRepG1 + kNumStates) -+#define IsRep0Long (IsRepG2 + kNumStates) -+#define PosSlot (IsRep0Long + (kNumStates << kNumPosBitsMax)) -+#define SpecPos (PosSlot + (kNumLenToPosStates << kNumPosSlotBits)) -+#define Align (SpecPos + kNumFullDistances - kEndPosModelIndex) -+#define LenCoder (Align + kAlignTableSize) -+#define RepLenCoder (LenCoder + kNumLenProbs) -+#define Literal (RepLenCoder + kNumLenProbs) -+ -+#define LZMA_BASE_SIZE 1846 -+#define LZMA_LIT_SIZE 768 -+ -+#define LzmaProps_GetNumProbs(p) ((UInt32)LZMA_BASE_SIZE + (LZMA_LIT_SIZE << ((p)->lc + (p)->lp))) -+ -+#if Literal != LZMA_BASE_SIZE -+StopCompilingDueBUG -+#endif -+ -+#define LZMA_DIC_MIN (1 << 12) -+ -+/* First LZMA-symbol is always decoded. -+And it decodes new LZMA-symbols while (buf < bufLimit), but "buf" is without last normalization -+Out: -+ Result: -+ SZ_OK - OK -+ SZ_ERROR_DATA - Error -+ p->remainLen: -+ < kMatchSpecLenStart : normal remain -+ = kMatchSpecLenStart : finished -+ = kMatchSpecLenStart + 1 : Flush marker -+ = kMatchSpecLenStart + 2 : State Init Marker -+*/ -+ -+static int MY_FAST_CALL LzmaDec_DecodeReal(CLzmaDec *p, SizeT limit, const Byte *bufLimit) -+{ -+ CLzmaProb *probs = p->probs; -+ -+ unsigned state = p->state; -+ UInt32 rep0 = p->reps[0], rep1 = p->reps[1], rep2 = p->reps[2], rep3 = p->reps[3]; -+ unsigned pbMask = ((unsigned)1 << (p->prop.pb)) - 1; -+ unsigned lpMask = ((unsigned)1 << (p->prop.lp)) - 1; -+ unsigned lc = p->prop.lc; -+ -+ Byte *dic = p->dic; -+ SizeT dicBufSize = p->dicBufSize; -+ SizeT dicPos = p->dicPos; -+ -+ UInt32 processedPos = p->processedPos; -+ UInt32 checkDicSize = p->checkDicSize; -+ unsigned len = 0; -+ -+ const Byte *buf = p->buf; -+ UInt32 range = p->range; -+ UInt32 code = p->code; -+ -+ do -+ { -+ CLzmaProb *prob; -+ UInt32 bound; -+ unsigned ttt; -+ unsigned posState = processedPos & pbMask; -+ -+ prob = probs + IsMatch + (state << kNumPosBitsMax) + posState; -+ IF_BIT_0(prob) -+ { -+ unsigned symbol; -+ UPDATE_0(prob); -+ prob = probs + Literal; -+ if (checkDicSize != 0 || processedPos != 0) -+ prob += (LZMA_LIT_SIZE * (((processedPos & lpMask) << lc) + -+ (dic[(dicPos == 0 ? dicBufSize : dicPos) - 1] >> (8 - lc)))); -+ -+ if (state < kNumLitStates) -+ { -+ state -= (state < 4) ? state : 3; -+ symbol = 1; -+ do { GET_BIT(prob + symbol, symbol) } while (symbol < 0x100); -+ } -+ else -+ { -+ unsigned matchByte = p->dic[(dicPos - rep0) + ((dicPos < rep0) ? dicBufSize : 0)]; -+ unsigned offs = 0x100; -+ state -= (state < 10) ? 3 : 6; -+ symbol = 1; -+ do -+ { -+ unsigned bit; -+ CLzmaProb *probLit; -+ matchByte <<= 1; -+ bit = (matchByte & offs); -+ probLit = prob + offs + bit + symbol; -+ GET_BIT2(probLit, symbol, offs &= ~bit, offs &= bit) -+ } -+ while (symbol < 0x100); -+ } -+ dic[dicPos++] = (Byte)symbol; -+ processedPos++; -+ continue; -+ } -+ else -+ { -+ UPDATE_1(prob); -+ prob = probs + IsRep + state; -+ IF_BIT_0(prob) -+ { -+ UPDATE_0(prob); -+ state += kNumStates; -+ prob = probs + LenCoder; -+ } -+ else -+ { -+ UPDATE_1(prob); -+ if (checkDicSize == 0 && processedPos == 0) -+ return SZ_ERROR_DATA; -+ prob = probs + IsRepG0 + state; -+ IF_BIT_0(prob) -+ { -+ UPDATE_0(prob); -+ prob = probs + IsRep0Long + (state << kNumPosBitsMax) + posState; -+ IF_BIT_0(prob) -+ { -+ UPDATE_0(prob); -+ dic[dicPos] = dic[(dicPos - rep0) + ((dicPos < rep0) ? dicBufSize : 0)]; -+ dicPos++; -+ processedPos++; -+ state = state < kNumLitStates ? 9 : 11; -+ continue; -+ } -+ UPDATE_1(prob); -+ } -+ else -+ { -+ UInt32 distance; -+ UPDATE_1(prob); -+ prob = probs + IsRepG1 + state; -+ IF_BIT_0(prob) -+ { -+ UPDATE_0(prob); -+ distance = rep1; -+ } -+ else -+ { -+ UPDATE_1(prob); -+ prob = probs + IsRepG2 + state; -+ IF_BIT_0(prob) -+ { -+ UPDATE_0(prob); -+ distance = rep2; -+ } -+ else -+ { -+ UPDATE_1(prob); -+ distance = rep3; -+ rep3 = rep2; -+ } -+ rep2 = rep1; -+ } -+ rep1 = rep0; -+ rep0 = distance; -+ } -+ state = state < kNumLitStates ? 8 : 11; -+ prob = probs + RepLenCoder; -+ } -+ { -+ unsigned limit, offset; -+ CLzmaProb *probLen = prob + LenChoice; -+ IF_BIT_0(probLen) -+ { -+ UPDATE_0(probLen); -+ probLen = prob + LenLow + (posState << kLenNumLowBits); -+ offset = 0; -+ limit = (1 << kLenNumLowBits); -+ } -+ else -+ { -+ UPDATE_1(probLen); -+ probLen = prob + LenChoice2; -+ IF_BIT_0(probLen) -+ { -+ UPDATE_0(probLen); -+ probLen = prob + LenMid + (posState << kLenNumMidBits); -+ offset = kLenNumLowSymbols; -+ limit = (1 << kLenNumMidBits); -+ } -+ else -+ { -+ UPDATE_1(probLen); -+ probLen = prob + LenHigh; -+ offset = kLenNumLowSymbols + kLenNumMidSymbols; -+ limit = (1 << kLenNumHighBits); -+ } -+ } -+ TREE_DECODE(probLen, limit, len); -+ len += offset; -+ } -+ -+ if (state >= kNumStates) -+ { -+ UInt32 distance; -+ prob = probs + PosSlot + -+ ((len < kNumLenToPosStates ? len : kNumLenToPosStates - 1) << kNumPosSlotBits); -+ TREE_6_DECODE(prob, distance); -+ if (distance >= kStartPosModelIndex) -+ { -+ unsigned posSlot = (unsigned)distance; -+ int numDirectBits = (int)(((distance >> 1) - 1)); -+ distance = (2 | (distance & 1)); -+ if (posSlot < kEndPosModelIndex) -+ { -+ distance <<= numDirectBits; -+ prob = probs + SpecPos + distance - posSlot - 1; -+ { -+ UInt32 mask = 1; -+ unsigned i = 1; -+ do -+ { -+ GET_BIT2(prob + i, i, ; , distance |= mask); -+ mask <<= 1; -+ } -+ while (--numDirectBits != 0); -+ } -+ } -+ else -+ { -+ numDirectBits -= kNumAlignBits; -+ do -+ { -+ NORMALIZE -+ range >>= 1; -+ -+ { -+ UInt32 t; -+ code -= range; -+ t = (0 - ((UInt32)code >> 31)); /* (UInt32)((Int32)code >> 31) */ -+ distance = (distance << 1) + (t + 1); -+ code += range & t; -+ } -+ /* -+ distance <<= 1; -+ if (code >= range) -+ { -+ code -= range; -+ distance |= 1; -+ } -+ */ -+ } -+ while (--numDirectBits != 0); -+ prob = probs + Align; -+ distance <<= kNumAlignBits; -+ { -+ unsigned i = 1; -+ GET_BIT2(prob + i, i, ; , distance |= 1); -+ GET_BIT2(prob + i, i, ; , distance |= 2); -+ GET_BIT2(prob + i, i, ; , distance |= 4); -+ GET_BIT2(prob + i, i, ; , distance |= 8); -+ } -+ if (distance == (UInt32)0xFFFFFFFF) -+ { -+ len += kMatchSpecLenStart; -+ state -= kNumStates; -+ break; -+ } -+ } -+ } -+ rep3 = rep2; -+ rep2 = rep1; -+ rep1 = rep0; -+ rep0 = distance + 1; -+ if (checkDicSize == 0) -+ { -+ if (distance >= processedPos) -+ return SZ_ERROR_DATA; -+ } -+ else if (distance >= checkDicSize) -+ return SZ_ERROR_DATA; -+ state = (state < kNumStates + kNumLitStates) ? kNumLitStates : kNumLitStates + 3; -+ } -+ -+ len += kMatchMinLen; -+ -+ if (limit == dicPos) -+ return SZ_ERROR_DATA; -+ { -+ SizeT rem = limit - dicPos; -+ unsigned curLen = ((rem < len) ? (unsigned)rem : len); -+ SizeT pos = (dicPos - rep0) + ((dicPos < rep0) ? dicBufSize : 0); -+ -+ processedPos += curLen; -+ -+ len -= curLen; -+ if (pos + curLen <= dicBufSize) -+ { -+ Byte *dest = dic + dicPos; -+ ptrdiff_t src = (ptrdiff_t)pos - (ptrdiff_t)dicPos; -+ const Byte *lim = dest + curLen; -+ dicPos += curLen; -+ do -+ *(dest) = (Byte)*(dest + src); -+ while (++dest != lim); -+ } -+ else -+ { -+ do -+ { -+ dic[dicPos++] = dic[pos]; -+ if (++pos == dicBufSize) -+ pos = 0; -+ } -+ while (--curLen != 0); -+ } -+ } -+ } -+ } -+ while (dicPos < limit && buf < bufLimit); -+ NORMALIZE; -+ p->buf = buf; -+ p->range = range; -+ p->code = code; -+ p->remainLen = len; -+ p->dicPos = dicPos; -+ p->processedPos = processedPos; -+ p->reps[0] = rep0; -+ p->reps[1] = rep1; -+ p->reps[2] = rep2; -+ p->reps[3] = rep3; -+ p->state = state; -+ -+ return SZ_OK; -+} -+ -+static void MY_FAST_CALL LzmaDec_WriteRem(CLzmaDec *p, SizeT limit) -+{ -+ if (p->remainLen != 0 && p->remainLen < kMatchSpecLenStart) -+ { -+ Byte *dic = p->dic; -+ SizeT dicPos = p->dicPos; -+ SizeT dicBufSize = p->dicBufSize; -+ unsigned len = p->remainLen; -+ UInt32 rep0 = p->reps[0]; -+ if (limit - dicPos < len) -+ len = (unsigned)(limit - dicPos); -+ -+ if (p->checkDicSize == 0 && p->prop.dicSize - p->processedPos <= len) -+ p->checkDicSize = p->prop.dicSize; -+ -+ p->processedPos += len; -+ p->remainLen -= len; -+ while (len-- != 0) -+ { -+ dic[dicPos] = dic[(dicPos - rep0) + ((dicPos < rep0) ? dicBufSize : 0)]; -+ dicPos++; -+ } -+ p->dicPos = dicPos; -+ } -+} -+ -+static int MY_FAST_CALL LzmaDec_DecodeReal2(CLzmaDec *p, SizeT limit, const Byte *bufLimit) -+{ -+ do -+ { -+ SizeT limit2 = limit; -+ if (p->checkDicSize == 0) -+ { -+ UInt32 rem = p->prop.dicSize - p->processedPos; -+ if (limit - p->dicPos > rem) -+ limit2 = p->dicPos + rem; -+ } -+ RINOK(LzmaDec_DecodeReal(p, limit2, bufLimit)); -+ if (p->processedPos >= p->prop.dicSize) -+ p->checkDicSize = p->prop.dicSize; -+ LzmaDec_WriteRem(p, limit); -+ } -+ while (p->dicPos < limit && p->buf < bufLimit && p->remainLen < kMatchSpecLenStart); -+ -+ if (p->remainLen > kMatchSpecLenStart) -+ { -+ p->remainLen = kMatchSpecLenStart; -+ } -+ return 0; -+} -+ -+typedef enum -+{ -+ DUMMY_ERROR, /* unexpected end of input stream */ -+ DUMMY_LIT, -+ DUMMY_MATCH, -+ DUMMY_REP -+} ELzmaDummy; -+ -+static ELzmaDummy LzmaDec_TryDummy(const CLzmaDec *p, const Byte *buf, SizeT inSize) -+{ -+ UInt32 range = p->range; -+ UInt32 code = p->code; -+ const Byte *bufLimit = buf + inSize; -+ CLzmaProb *probs = p->probs; -+ unsigned state = p->state; -+ ELzmaDummy res; -+ -+ { -+ CLzmaProb *prob; -+ UInt32 bound; -+ unsigned ttt; -+ unsigned posState = (p->processedPos) & ((1 << p->prop.pb) - 1); -+ -+ prob = probs + IsMatch + (state << kNumPosBitsMax) + posState; -+ IF_BIT_0_CHECK(prob) -+ { -+ UPDATE_0_CHECK -+ -+ /* if (bufLimit - buf >= 7) return DUMMY_LIT; */ -+ -+ prob = probs + Literal; -+ if (p->checkDicSize != 0 || p->processedPos != 0) -+ prob += (LZMA_LIT_SIZE * -+ ((((p->processedPos) & ((1 << (p->prop.lp)) - 1)) << p->prop.lc) + -+ (p->dic[(p->dicPos == 0 ? p->dicBufSize : p->dicPos) - 1] >> (8 - p->prop.lc)))); -+ -+ if (state < kNumLitStates) -+ { -+ unsigned symbol = 1; -+ do { GET_BIT_CHECK(prob + symbol, symbol) } while (symbol < 0x100); -+ } -+ else -+ { -+ unsigned matchByte = p->dic[p->dicPos - p->reps[0] + -+ ((p->dicPos < p->reps[0]) ? p->dicBufSize : 0)]; -+ unsigned offs = 0x100; -+ unsigned symbol = 1; -+ do -+ { -+ unsigned bit; -+ CLzmaProb *probLit; -+ matchByte <<= 1; -+ bit = (matchByte & offs); -+ probLit = prob + offs + bit + symbol; -+ GET_BIT2_CHECK(probLit, symbol, offs &= ~bit, offs &= bit) -+ } -+ while (symbol < 0x100); -+ } -+ res = DUMMY_LIT; -+ } -+ else -+ { -+ unsigned len; -+ UPDATE_1_CHECK; -+ -+ prob = probs + IsRep + state; -+ IF_BIT_0_CHECK(prob) -+ { -+ UPDATE_0_CHECK; -+ state = 0; -+ prob = probs + LenCoder; -+ res = DUMMY_MATCH; -+ } -+ else -+ { -+ UPDATE_1_CHECK; -+ res = DUMMY_REP; -+ prob = probs + IsRepG0 + state; -+ IF_BIT_0_CHECK(prob) -+ { -+ UPDATE_0_CHECK; -+ prob = probs + IsRep0Long + (state << kNumPosBitsMax) + posState; -+ IF_BIT_0_CHECK(prob) -+ { -+ UPDATE_0_CHECK; -+ NORMALIZE_CHECK; -+ return DUMMY_REP; -+ } -+ else -+ { -+ UPDATE_1_CHECK; -+ } -+ } -+ else -+ { -+ UPDATE_1_CHECK; -+ prob = probs + IsRepG1 + state; -+ IF_BIT_0_CHECK(prob) -+ { -+ UPDATE_0_CHECK; -+ } -+ else -+ { -+ UPDATE_1_CHECK; -+ prob = probs + IsRepG2 + state; -+ IF_BIT_0_CHECK(prob) -+ { -+ UPDATE_0_CHECK; -+ } -+ else -+ { -+ UPDATE_1_CHECK; -+ } -+ } -+ } -+ state = kNumStates; -+ prob = probs + RepLenCoder; -+ } -+ { -+ unsigned limit, offset; -+ CLzmaProb *probLen = prob + LenChoice; -+ IF_BIT_0_CHECK(probLen) -+ { -+ UPDATE_0_CHECK; -+ probLen = prob + LenLow + (posState << kLenNumLowBits); -+ offset = 0; -+ limit = 1 << kLenNumLowBits; -+ } -+ else -+ { -+ UPDATE_1_CHECK; -+ probLen = prob + LenChoice2; -+ IF_BIT_0_CHECK(probLen) -+ { -+ UPDATE_0_CHECK; -+ probLen = prob + LenMid + (posState << kLenNumMidBits); -+ offset = kLenNumLowSymbols; -+ limit = 1 << kLenNumMidBits; -+ } -+ else -+ { -+ UPDATE_1_CHECK; -+ probLen = prob + LenHigh; -+ offset = kLenNumLowSymbols + kLenNumMidSymbols; -+ limit = 1 << kLenNumHighBits; -+ } -+ } -+ TREE_DECODE_CHECK(probLen, limit, len); -+ len += offset; -+ } -+ -+ if (state < 4) -+ { -+ unsigned posSlot; -+ prob = probs + PosSlot + -+ ((len < kNumLenToPosStates ? len : kNumLenToPosStates - 1) << -+ kNumPosSlotBits); -+ TREE_DECODE_CHECK(prob, 1 << kNumPosSlotBits, posSlot); -+ if (posSlot >= kStartPosModelIndex) -+ { -+ int numDirectBits = ((posSlot >> 1) - 1); -+ -+ /* if (bufLimit - buf >= 8) return DUMMY_MATCH; */ -+ -+ if (posSlot < kEndPosModelIndex) -+ { -+ prob = probs + SpecPos + ((2 | (posSlot & 1)) << numDirectBits) - posSlot - 1; -+ } -+ else -+ { -+ numDirectBits -= kNumAlignBits; -+ do -+ { -+ NORMALIZE_CHECK -+ range >>= 1; -+ code -= range & (((code - range) >> 31) - 1); -+ /* if (code >= range) code -= range; */ -+ } -+ while (--numDirectBits != 0); -+ prob = probs + Align; -+ numDirectBits = kNumAlignBits; -+ } -+ { -+ unsigned i = 1; -+ do -+ { -+ GET_BIT_CHECK(prob + i, i); -+ } -+ while (--numDirectBits != 0); -+ } -+ } -+ } -+ } -+ } -+ NORMALIZE_CHECK; -+ return res; -+} -+ -+ -+static void LzmaDec_InitRc(CLzmaDec *p, const Byte *data) -+{ -+ p->code = ((UInt32)data[1] << 24) | ((UInt32)data[2] << 16) | ((UInt32)data[3] << 8) | ((UInt32)data[4]); -+ p->range = 0xFFFFFFFF; -+ p->needFlush = 0; -+} -+ -+void LzmaDec_InitDicAndState(CLzmaDec *p, Bool initDic, Bool initState) -+{ -+ p->needFlush = 1; -+ p->remainLen = 0; -+ p->tempBufSize = 0; -+ -+ if (initDic) -+ { -+ p->processedPos = 0; -+ p->checkDicSize = 0; -+ p->needInitState = 1; -+ } -+ if (initState) -+ p->needInitState = 1; -+} -+ -+void LzmaDec_Init(CLzmaDec *p) -+{ -+ p->dicPos = 0; -+ LzmaDec_InitDicAndState(p, True, True); -+} -+ -+static void LzmaDec_InitStateReal(CLzmaDec *p) -+{ -+ UInt32 numProbs = Literal + ((UInt32)LZMA_LIT_SIZE << (p->prop.lc + p->prop.lp)); -+ UInt32 i; -+ CLzmaProb *probs = p->probs; -+ for (i = 0; i < numProbs; i++) -+ probs[i] = kBitModelTotal >> 1; -+ p->reps[0] = p->reps[1] = p->reps[2] = p->reps[3] = 1; -+ p->state = 0; -+ p->needInitState = 0; -+} -+ -+SRes LzmaDec_DecodeToDic(CLzmaDec *p, SizeT dicLimit, const Byte *src, SizeT *srcLen, -+ ELzmaFinishMode finishMode, ELzmaStatus *status) -+{ -+ SizeT inSize = *srcLen; -+ (*srcLen) = 0; -+ LzmaDec_WriteRem(p, dicLimit); -+ -+ *status = LZMA_STATUS_NOT_SPECIFIED; -+ -+ while (p->remainLen != kMatchSpecLenStart) -+ { -+ int checkEndMarkNow; -+ -+ if (p->needFlush != 0) -+ { -+ for (; inSize > 0 && p->tempBufSize < RC_INIT_SIZE; (*srcLen)++, inSize--) -+ p->tempBuf[p->tempBufSize++] = *src++; -+ if (p->tempBufSize < RC_INIT_SIZE) -+ { -+ *status = LZMA_STATUS_NEEDS_MORE_INPUT; -+ return SZ_OK; -+ } -+ if (p->tempBuf[0] != 0) -+ return SZ_ERROR_DATA; -+ -+ LzmaDec_InitRc(p, p->tempBuf); -+ p->tempBufSize = 0; -+ } -+ -+ checkEndMarkNow = 0; -+ if (p->dicPos >= dicLimit) -+ { -+ if (p->remainLen == 0 && p->code == 0) -+ { -+ *status = LZMA_STATUS_MAYBE_FINISHED_WITHOUT_MARK; -+ return SZ_OK; -+ } -+ if (finishMode == LZMA_FINISH_ANY) -+ { -+ *status = LZMA_STATUS_NOT_FINISHED; -+ return SZ_OK; -+ } -+ if (p->remainLen != 0) -+ { -+ *status = LZMA_STATUS_NOT_FINISHED; -+ return SZ_ERROR_DATA; -+ } -+ checkEndMarkNow = 1; -+ } -+ -+ if (p->needInitState) -+ LzmaDec_InitStateReal(p); -+ -+ if (p->tempBufSize == 0) -+ { -+ SizeT processed; -+ const Byte *bufLimit; -+ if (inSize < LZMA_REQUIRED_INPUT_MAX || checkEndMarkNow) -+ { -+ int dummyRes = LzmaDec_TryDummy(p, src, inSize); -+ if (dummyRes == DUMMY_ERROR) -+ { -+ memcpy(p->tempBuf, src, inSize); -+ p->tempBufSize = (unsigned)inSize; -+ (*srcLen) += inSize; -+ *status = LZMA_STATUS_NEEDS_MORE_INPUT; -+ return SZ_OK; -+ } -+ if (checkEndMarkNow && dummyRes != DUMMY_MATCH) -+ { -+ *status = LZMA_STATUS_NOT_FINISHED; -+ return SZ_ERROR_DATA; -+ } -+ bufLimit = src; -+ } -+ else -+ bufLimit = src + inSize - LZMA_REQUIRED_INPUT_MAX; -+ p->buf = src; -+ if (LzmaDec_DecodeReal2(p, dicLimit, bufLimit) != 0) -+ return SZ_ERROR_DATA; -+ processed = (SizeT)(p->buf - src); -+ (*srcLen) += processed; -+ src += processed; -+ inSize -= processed; -+ } -+ else -+ { -+ unsigned rem = p->tempBufSize, lookAhead = 0; -+ while (rem < LZMA_REQUIRED_INPUT_MAX && lookAhead < inSize) -+ p->tempBuf[rem++] = src[lookAhead++]; -+ p->tempBufSize = rem; -+ if (rem < LZMA_REQUIRED_INPUT_MAX || checkEndMarkNow) -+ { -+ int dummyRes = LzmaDec_TryDummy(p, p->tempBuf, rem); -+ if (dummyRes == DUMMY_ERROR) -+ { -+ (*srcLen) += lookAhead; -+ *status = LZMA_STATUS_NEEDS_MORE_INPUT; -+ return SZ_OK; -+ } -+ if (checkEndMarkNow && dummyRes != DUMMY_MATCH) -+ { -+ *status = LZMA_STATUS_NOT_FINISHED; -+ return SZ_ERROR_DATA; -+ } -+ } -+ p->buf = p->tempBuf; -+ if (LzmaDec_DecodeReal2(p, dicLimit, p->buf) != 0) -+ return SZ_ERROR_DATA; -+ lookAhead -= (rem - (unsigned)(p->buf - p->tempBuf)); -+ (*srcLen) += lookAhead; -+ src += lookAhead; -+ inSize -= lookAhead; -+ p->tempBufSize = 0; -+ } -+ } -+ if (p->code == 0) -+ *status = LZMA_STATUS_FINISHED_WITH_MARK; -+ return (p->code == 0) ? SZ_OK : SZ_ERROR_DATA; -+} -+ -+SRes LzmaDec_DecodeToBuf(CLzmaDec *p, Byte *dest, SizeT *destLen, const Byte *src, SizeT *srcLen, ELzmaFinishMode finishMode, ELzmaStatus *status) -+{ -+ SizeT outSize = *destLen; -+ SizeT inSize = *srcLen; -+ *srcLen = *destLen = 0; -+ for (;;) -+ { -+ SizeT inSizeCur = inSize, outSizeCur, dicPos; -+ ELzmaFinishMode curFinishMode; -+ SRes res; -+ if (p->dicPos == p->dicBufSize) -+ p->dicPos = 0; -+ dicPos = p->dicPos; -+ if (outSize > p->dicBufSize - dicPos) -+ { -+ outSizeCur = p->dicBufSize; -+ curFinishMode = LZMA_FINISH_ANY; -+ } -+ else -+ { -+ outSizeCur = dicPos + outSize; -+ curFinishMode = finishMode; -+ } -+ -+ res = LzmaDec_DecodeToDic(p, outSizeCur, src, &inSizeCur, curFinishMode, status); -+ src += inSizeCur; -+ inSize -= inSizeCur; -+ *srcLen += inSizeCur; -+ outSizeCur = p->dicPos - dicPos; -+ memcpy(dest, p->dic + dicPos, outSizeCur); -+ dest += outSizeCur; -+ outSize -= outSizeCur; -+ *destLen += outSizeCur; -+ if (res != 0) -+ return res; -+ if (outSizeCur == 0 || outSize == 0) -+ return SZ_OK; -+ } -+} -+ -+void LzmaDec_FreeProbs(CLzmaDec *p, ISzAlloc *alloc) -+{ -+ alloc->Free(alloc, p->probs); -+ p->probs = 0; -+} -+ -+static void LzmaDec_FreeDict(CLzmaDec *p, ISzAlloc *alloc) -+{ -+ alloc->Free(alloc, p->dic); -+ p->dic = 0; -+} -+ -+void LzmaDec_Free(CLzmaDec *p, ISzAlloc *alloc) -+{ -+ LzmaDec_FreeProbs(p, alloc); -+ LzmaDec_FreeDict(p, alloc); -+} -+ -+SRes LzmaProps_Decode(CLzmaProps *p, const Byte *data, unsigned size) -+{ -+ UInt32 dicSize; -+ Byte d; -+ -+ if (size < LZMA_PROPS_SIZE) -+ return SZ_ERROR_UNSUPPORTED; -+ else -+ dicSize = data[1] | ((UInt32)data[2] << 8) | ((UInt32)data[3] << 16) | ((UInt32)data[4] << 24); -+ -+ if (dicSize < LZMA_DIC_MIN) -+ dicSize = LZMA_DIC_MIN; -+ p->dicSize = dicSize; -+ -+ d = data[0]; -+ if (d >= (9 * 5 * 5)) -+ return SZ_ERROR_UNSUPPORTED; -+ -+ p->lc = d % 9; -+ d /= 9; -+ p->pb = d / 5; -+ p->lp = d % 5; -+ -+ return SZ_OK; -+} -+ -+static SRes LzmaDec_AllocateProbs2(CLzmaDec *p, const CLzmaProps *propNew, ISzAlloc *alloc) -+{ -+ UInt32 numProbs = LzmaProps_GetNumProbs(propNew); -+ if (p->probs == 0 || numProbs != p->numProbs) -+ { -+ LzmaDec_FreeProbs(p, alloc); -+ p->probs = (CLzmaProb *)alloc->Alloc(alloc, numProbs * sizeof(CLzmaProb)); -+ p->numProbs = numProbs; -+ if (p->probs == 0) -+ return SZ_ERROR_MEM; -+ } -+ return SZ_OK; -+} -+ -+SRes LzmaDec_AllocateProbs(CLzmaDec *p, const Byte *props, unsigned propsSize, ISzAlloc *alloc) -+{ -+ CLzmaProps propNew; -+ RINOK(LzmaProps_Decode(&propNew, props, propsSize)); -+ RINOK(LzmaDec_AllocateProbs2(p, &propNew, alloc)); -+ p->prop = propNew; -+ return SZ_OK; -+} -+ -+SRes LzmaDec_Allocate(CLzmaDec *p, const Byte *props, unsigned propsSize, ISzAlloc *alloc) -+{ -+ CLzmaProps propNew; -+ SizeT dicBufSize; -+ RINOK(LzmaProps_Decode(&propNew, props, propsSize)); -+ RINOK(LzmaDec_AllocateProbs2(p, &propNew, alloc)); -+ dicBufSize = propNew.dicSize; -+ if (p->dic == 0 || dicBufSize != p->dicBufSize) -+ { -+ LzmaDec_FreeDict(p, alloc); -+ p->dic = (Byte *)alloc->Alloc(alloc, dicBufSize); -+ if (p->dic == 0) -+ { -+ LzmaDec_FreeProbs(p, alloc); -+ return SZ_ERROR_MEM; -+ } -+ } -+ p->dicBufSize = dicBufSize; -+ p->prop = propNew; -+ return SZ_OK; -+} -+ -+SRes LzmaDecode(Byte *dest, SizeT *destLen, const Byte *src, SizeT *srcLen, -+ const Byte *propData, unsigned propSize, ELzmaFinishMode finishMode, -+ ELzmaStatus *status, ISzAlloc *alloc) -+{ -+ CLzmaDec p; -+ SRes res; -+ SizeT inSize = *srcLen; -+ SizeT outSize = *destLen; -+ *srcLen = *destLen = 0; -+ if (inSize < RC_INIT_SIZE) -+ return SZ_ERROR_INPUT_EOF; -+ -+ LzmaDec_Construct(&p); -+ res = LzmaDec_AllocateProbs(&p, propData, propSize, alloc); -+ if (res != 0) -+ return res; -+ p.dic = dest; -+ p.dicBufSize = outSize; -+ -+ LzmaDec_Init(&p); -+ -+ *srcLen = inSize; -+ res = LzmaDec_DecodeToDic(&p, outSize, src, srcLen, finishMode, status); -+ -+ if (res == SZ_OK && *status == LZMA_STATUS_NEEDS_MORE_INPUT) -+ res = SZ_ERROR_INPUT_EOF; -+ -+ (*destLen) = p.dicPos; -+ LzmaDec_FreeProbs(&p, alloc); -+ return res; -+} ---- /dev/null -+++ b/lib/lzma/LzmaEnc.c -@@ -0,0 +1,2271 @@ -+/* LzmaEnc.c -- LZMA Encoder -+2009-11-24 : Igor Pavlov : Public domain */ -+ -+#include -+ -+/* #define SHOW_STAT */ -+/* #define SHOW_STAT2 */ -+ -+#if defined(SHOW_STAT) || defined(SHOW_STAT2) -+#include -+#endif -+ -+#include "LzmaEnc.h" -+ -+/* disable MT */ -+#define _7ZIP_ST -+ -+#include "LzFind.h" -+#ifndef _7ZIP_ST -+#include "LzFindMt.h" -+#endif -+ -+#ifdef SHOW_STAT -+static int ttt = 0; -+#endif -+ -+#define kBlockSizeMax ((1 << LZMA_NUM_BLOCK_SIZE_BITS) - 1) -+ -+#define kBlockSize (9 << 10) -+#define kUnpackBlockSize (1 << 18) -+#define kMatchArraySize (1 << 21) -+#define kMatchRecordMaxSize ((LZMA_MATCH_LEN_MAX * 2 + 3) * LZMA_MATCH_LEN_MAX) -+ -+#define kNumMaxDirectBits (31) -+ -+#define kNumTopBits 24 -+#define kTopValue ((UInt32)1 << kNumTopBits) -+ -+#define kNumBitModelTotalBits 11 -+#define kBitModelTotal (1 << kNumBitModelTotalBits) -+#define kNumMoveBits 5 -+#define kProbInitValue (kBitModelTotal >> 1) -+ -+#define kNumMoveReducingBits 4 -+#define kNumBitPriceShiftBits 4 -+#define kBitPrice (1 << kNumBitPriceShiftBits) -+ -+void LzmaEncProps_Init(CLzmaEncProps *p) -+{ -+ p->level = 5; -+ p->dictSize = p->mc = 0; -+ p->lc = p->lp = p->pb = p->algo = p->fb = p->btMode = p->numHashBytes = p->numThreads = -1; -+ p->writeEndMark = 0; -+} -+ -+void LzmaEncProps_Normalize(CLzmaEncProps *p) -+{ -+ int level = p->level; -+ if (level < 0) level = 5; -+ p->level = level; -+ if (p->dictSize == 0) p->dictSize = (level <= 5 ? (1 << (level * 2 + 14)) : (level == 6 ? (1 << 25) : (1 << 26))); -+ if (p->lc < 0) p->lc = 3; -+ if (p->lp < 0) p->lp = 0; -+ if (p->pb < 0) p->pb = 2; -+ if (p->algo < 0) p->algo = (level < 5 ? 0 : 1); -+ if (p->fb < 0) p->fb = (level < 7 ? 32 : 64); -+ if (p->btMode < 0) p->btMode = (p->algo == 0 ? 0 : 1); -+ if (p->numHashBytes < 0) p->numHashBytes = 4; -+ if (p->mc == 0) p->mc = (16 + (p->fb >> 1)) >> (p->btMode ? 0 : 1); -+ if (p->numThreads < 0) -+ p->numThreads = -+ #ifndef _7ZIP_ST -+ ((p->btMode && p->algo) ? 2 : 1); -+ #else -+ 1; -+ #endif -+} -+ -+UInt32 LzmaEncProps_GetDictSize(const CLzmaEncProps *props2) -+{ -+ CLzmaEncProps props = *props2; -+ LzmaEncProps_Normalize(&props); -+ return props.dictSize; -+} -+ -+/* #define LZMA_LOG_BSR */ -+/* Define it for Intel's CPU */ -+ -+ -+#ifdef LZMA_LOG_BSR -+ -+#define kDicLogSizeMaxCompress 30 -+ -+#define BSR2_RET(pos, res) { unsigned long i; _BitScanReverse(&i, (pos)); res = (i + i) + ((pos >> (i - 1)) & 1); } -+ -+UInt32 GetPosSlot1(UInt32 pos) -+{ -+ UInt32 res; -+ BSR2_RET(pos, res); -+ return res; -+} -+#define GetPosSlot2(pos, res) { BSR2_RET(pos, res); } -+#define GetPosSlot(pos, res) { if (pos < 2) res = pos; else BSR2_RET(pos, res); } -+ -+#else -+ -+#define kNumLogBits (9 + (int)sizeof(size_t) / 2) -+#define kDicLogSizeMaxCompress ((kNumLogBits - 1) * 2 + 7) -+ -+void LzmaEnc_FastPosInit(Byte *g_FastPos) -+{ -+ int c = 2, slotFast; -+ g_FastPos[0] = 0; -+ g_FastPos[1] = 1; -+ -+ for (slotFast = 2; slotFast < kNumLogBits * 2; slotFast++) -+ { -+ UInt32 k = (1 << ((slotFast >> 1) - 1)); -+ UInt32 j; -+ for (j = 0; j < k; j++, c++) -+ g_FastPos[c] = (Byte)slotFast; -+ } -+} -+ -+#define BSR2_RET(pos, res) { UInt32 i = 6 + ((kNumLogBits - 1) & \ -+ (0 - (((((UInt32)1 << (kNumLogBits + 6)) - 1) - pos) >> 31))); \ -+ res = p->g_FastPos[pos >> i] + (i * 2); } -+/* -+#define BSR2_RET(pos, res) { res = (pos < (1 << (kNumLogBits + 6))) ? \ -+ p->g_FastPos[pos >> 6] + 12 : \ -+ p->g_FastPos[pos >> (6 + kNumLogBits - 1)] + (6 + (kNumLogBits - 1)) * 2; } -+*/ -+ -+#define GetPosSlot1(pos) p->g_FastPos[pos] -+#define GetPosSlot2(pos, res) { BSR2_RET(pos, res); } -+#define GetPosSlot(pos, res) { if (pos < kNumFullDistances) res = p->g_FastPos[pos]; else BSR2_RET(pos, res); } -+ -+#endif -+ -+ -+#define LZMA_NUM_REPS 4 -+ -+typedef unsigned CState; -+ -+typedef struct -+{ -+ UInt32 price; -+ -+ CState state; -+ int prev1IsChar; -+ int prev2; -+ -+ UInt32 posPrev2; -+ UInt32 backPrev2; -+ -+ UInt32 posPrev; -+ UInt32 backPrev; -+ UInt32 backs[LZMA_NUM_REPS]; -+} COptimal; -+ -+#define kNumOpts (1 << 12) -+ -+#define kNumLenToPosStates 4 -+#define kNumPosSlotBits 6 -+#define kDicLogSizeMin 0 -+#define kDicLogSizeMax 32 -+#define kDistTableSizeMax (kDicLogSizeMax * 2) -+ -+ -+#define kNumAlignBits 4 -+#define kAlignTableSize (1 << kNumAlignBits) -+#define kAlignMask (kAlignTableSize - 1) -+ -+#define kStartPosModelIndex 4 -+#define kEndPosModelIndex 14 -+#define kNumPosModels (kEndPosModelIndex - kStartPosModelIndex) -+ -+#define kNumFullDistances (1 << (kEndPosModelIndex >> 1)) -+ -+#ifdef _LZMA_PROB32 -+#define CLzmaProb UInt32 -+#else -+#define CLzmaProb UInt16 -+#endif -+ -+#define LZMA_PB_MAX 4 -+#define LZMA_LC_MAX 8 -+#define LZMA_LP_MAX 4 -+ -+#define LZMA_NUM_PB_STATES_MAX (1 << LZMA_PB_MAX) -+ -+ -+#define kLenNumLowBits 3 -+#define kLenNumLowSymbols (1 << kLenNumLowBits) -+#define kLenNumMidBits 3 -+#define kLenNumMidSymbols (1 << kLenNumMidBits) -+#define kLenNumHighBits 8 -+#define kLenNumHighSymbols (1 << kLenNumHighBits) -+ -+#define kLenNumSymbolsTotal (kLenNumLowSymbols + kLenNumMidSymbols + kLenNumHighSymbols) -+ -+#define LZMA_MATCH_LEN_MIN 2 -+#define LZMA_MATCH_LEN_MAX (LZMA_MATCH_LEN_MIN + kLenNumSymbolsTotal - 1) -+ -+#define kNumStates 12 -+ -+typedef struct -+{ -+ CLzmaProb choice; -+ CLzmaProb choice2; -+ CLzmaProb low[LZMA_NUM_PB_STATES_MAX << kLenNumLowBits]; -+ CLzmaProb mid[LZMA_NUM_PB_STATES_MAX << kLenNumMidBits]; -+ CLzmaProb high[kLenNumHighSymbols]; -+} CLenEnc; -+ -+typedef struct -+{ -+ CLenEnc p; -+ UInt32 prices[LZMA_NUM_PB_STATES_MAX][kLenNumSymbolsTotal]; -+ UInt32 tableSize; -+ UInt32 counters[LZMA_NUM_PB_STATES_MAX]; -+} CLenPriceEnc; -+ -+typedef struct -+{ -+ UInt32 range; -+ Byte cache; -+ UInt64 low; -+ UInt64 cacheSize; -+ Byte *buf; -+ Byte *bufLim; -+ Byte *bufBase; -+ ISeqOutStream *outStream; -+ UInt64 processed; -+ SRes res; -+} CRangeEnc; -+ -+typedef struct -+{ -+ CLzmaProb *litProbs; -+ -+ CLzmaProb isMatch[kNumStates][LZMA_NUM_PB_STATES_MAX]; -+ CLzmaProb isRep[kNumStates]; -+ CLzmaProb isRepG0[kNumStates]; -+ CLzmaProb isRepG1[kNumStates]; -+ CLzmaProb isRepG2[kNumStates]; -+ CLzmaProb isRep0Long[kNumStates][LZMA_NUM_PB_STATES_MAX]; -+ -+ CLzmaProb posSlotEncoder[kNumLenToPosStates][1 << kNumPosSlotBits]; -+ CLzmaProb posEncoders[kNumFullDistances - kEndPosModelIndex]; -+ CLzmaProb posAlignEncoder[1 << kNumAlignBits]; -+ -+ CLenPriceEnc lenEnc; -+ CLenPriceEnc repLenEnc; -+ -+ UInt32 reps[LZMA_NUM_REPS]; -+ UInt32 state; -+} CSaveState; -+ -+typedef struct -+{ -+ IMatchFinder matchFinder; -+ void *matchFinderObj; -+ -+ #ifndef _7ZIP_ST -+ Bool mtMode; -+ CMatchFinderMt matchFinderMt; -+ #endif -+ -+ CMatchFinder matchFinderBase; -+ -+ #ifndef _7ZIP_ST -+ Byte pad[128]; -+ #endif -+ -+ UInt32 optimumEndIndex; -+ UInt32 optimumCurrentIndex; -+ -+ UInt32 longestMatchLength; -+ UInt32 numPairs; -+ UInt32 numAvail; -+ COptimal opt[kNumOpts]; -+ -+ #ifndef LZMA_LOG_BSR -+ Byte g_FastPos[1 << kNumLogBits]; -+ #endif -+ -+ UInt32 ProbPrices[kBitModelTotal >> kNumMoveReducingBits]; -+ UInt32 matches[LZMA_MATCH_LEN_MAX * 2 + 2 + 1]; -+ UInt32 numFastBytes; -+ UInt32 additionalOffset; -+ UInt32 reps[LZMA_NUM_REPS]; -+ UInt32 state; -+ -+ UInt32 posSlotPrices[kNumLenToPosStates][kDistTableSizeMax]; -+ UInt32 distancesPrices[kNumLenToPosStates][kNumFullDistances]; -+ UInt32 alignPrices[kAlignTableSize]; -+ UInt32 alignPriceCount; -+ -+ UInt32 distTableSize; -+ -+ unsigned lc, lp, pb; -+ unsigned lpMask, pbMask; -+ -+ CLzmaProb *litProbs; -+ -+ CLzmaProb isMatch[kNumStates][LZMA_NUM_PB_STATES_MAX]; -+ CLzmaProb isRep[kNumStates]; -+ CLzmaProb isRepG0[kNumStates]; -+ CLzmaProb isRepG1[kNumStates]; -+ CLzmaProb isRepG2[kNumStates]; -+ CLzmaProb isRep0Long[kNumStates][LZMA_NUM_PB_STATES_MAX]; -+ -+ CLzmaProb posSlotEncoder[kNumLenToPosStates][1 << kNumPosSlotBits]; -+ CLzmaProb posEncoders[kNumFullDistances - kEndPosModelIndex]; -+ CLzmaProb posAlignEncoder[1 << kNumAlignBits]; -+ -+ CLenPriceEnc lenEnc; -+ CLenPriceEnc repLenEnc; -+ -+ unsigned lclp; -+ -+ Bool fastMode; -+ -+ CRangeEnc rc; -+ -+ Bool writeEndMark; -+ UInt64 nowPos64; -+ UInt32 matchPriceCount; -+ Bool finished; -+ Bool multiThread; -+ -+ SRes result; -+ UInt32 dictSize; -+ UInt32 matchFinderCycles; -+ -+ int needInit; -+ -+ CSaveState saveState; -+} CLzmaEnc; -+ -+void LzmaEnc_SaveState(CLzmaEncHandle pp) -+{ -+ CLzmaEnc *p = (CLzmaEnc *)pp; -+ CSaveState *dest = &p->saveState; -+ int i; -+ dest->lenEnc = p->lenEnc; -+ dest->repLenEnc = p->repLenEnc; -+ dest->state = p->state; -+ -+ for (i = 0; i < kNumStates; i++) -+ { -+ memcpy(dest->isMatch[i], p->isMatch[i], sizeof(p->isMatch[i])); -+ memcpy(dest->isRep0Long[i], p->isRep0Long[i], sizeof(p->isRep0Long[i])); -+ } -+ for (i = 0; i < kNumLenToPosStates; i++) -+ memcpy(dest->posSlotEncoder[i], p->posSlotEncoder[i], sizeof(p->posSlotEncoder[i])); -+ memcpy(dest->isRep, p->isRep, sizeof(p->isRep)); -+ memcpy(dest->isRepG0, p->isRepG0, sizeof(p->isRepG0)); -+ memcpy(dest->isRepG1, p->isRepG1, sizeof(p->isRepG1)); -+ memcpy(dest->isRepG2, p->isRepG2, sizeof(p->isRepG2)); -+ memcpy(dest->posEncoders, p->posEncoders, sizeof(p->posEncoders)); -+ memcpy(dest->posAlignEncoder, p->posAlignEncoder, sizeof(p->posAlignEncoder)); -+ memcpy(dest->reps, p->reps, sizeof(p->reps)); -+ memcpy(dest->litProbs, p->litProbs, (0x300 << p->lclp) * sizeof(CLzmaProb)); -+} -+ -+void LzmaEnc_RestoreState(CLzmaEncHandle pp) -+{ -+ CLzmaEnc *dest = (CLzmaEnc *)pp; -+ const CSaveState *p = &dest->saveState; -+ int i; -+ dest->lenEnc = p->lenEnc; -+ dest->repLenEnc = p->repLenEnc; -+ dest->state = p->state; -+ -+ for (i = 0; i < kNumStates; i++) -+ { -+ memcpy(dest->isMatch[i], p->isMatch[i], sizeof(p->isMatch[i])); -+ memcpy(dest->isRep0Long[i], p->isRep0Long[i], sizeof(p->isRep0Long[i])); -+ } -+ for (i = 0; i < kNumLenToPosStates; i++) -+ memcpy(dest->posSlotEncoder[i], p->posSlotEncoder[i], sizeof(p->posSlotEncoder[i])); -+ memcpy(dest->isRep, p->isRep, sizeof(p->isRep)); -+ memcpy(dest->isRepG0, p->isRepG0, sizeof(p->isRepG0)); -+ memcpy(dest->isRepG1, p->isRepG1, sizeof(p->isRepG1)); -+ memcpy(dest->isRepG2, p->isRepG2, sizeof(p->isRepG2)); -+ memcpy(dest->posEncoders, p->posEncoders, sizeof(p->posEncoders)); -+ memcpy(dest->posAlignEncoder, p->posAlignEncoder, sizeof(p->posAlignEncoder)); -+ memcpy(dest->reps, p->reps, sizeof(p->reps)); -+ memcpy(dest->litProbs, p->litProbs, (0x300 << dest->lclp) * sizeof(CLzmaProb)); -+} -+ -+SRes LzmaEnc_SetProps(CLzmaEncHandle pp, const CLzmaEncProps *props2) -+{ -+ CLzmaEnc *p = (CLzmaEnc *)pp; -+ CLzmaEncProps props = *props2; -+ LzmaEncProps_Normalize(&props); -+ -+ if (props.lc > LZMA_LC_MAX || props.lp > LZMA_LP_MAX || props.pb > LZMA_PB_MAX || -+ props.dictSize > (1 << kDicLogSizeMaxCompress) || props.dictSize > (1 << 30)) -+ return SZ_ERROR_PARAM; -+ p->dictSize = props.dictSize; -+ p->matchFinderCycles = props.mc; -+ { -+ unsigned fb = props.fb; -+ if (fb < 5) -+ fb = 5; -+ if (fb > LZMA_MATCH_LEN_MAX) -+ fb = LZMA_MATCH_LEN_MAX; -+ p->numFastBytes = fb; -+ } -+ p->lc = props.lc; -+ p->lp = props.lp; -+ p->pb = props.pb; -+ p->fastMode = (props.algo == 0); -+ p->matchFinderBase.btMode = props.btMode; -+ { -+ UInt32 numHashBytes = 4; -+ if (props.btMode) -+ { -+ if (props.numHashBytes < 2) -+ numHashBytes = 2; -+ else if (props.numHashBytes < 4) -+ numHashBytes = props.numHashBytes; -+ } -+ p->matchFinderBase.numHashBytes = numHashBytes; -+ } -+ -+ p->matchFinderBase.cutValue = props.mc; -+ -+ p->writeEndMark = props.writeEndMark; -+ -+ #ifndef _7ZIP_ST -+ /* -+ if (newMultiThread != _multiThread) -+ { -+ ReleaseMatchFinder(); -+ _multiThread = newMultiThread; -+ } -+ */ -+ p->multiThread = (props.numThreads > 1); -+ #endif -+ -+ return SZ_OK; -+} -+ -+static const int kLiteralNextStates[kNumStates] = {0, 0, 0, 0, 1, 2, 3, 4, 5, 6, 4, 5}; -+static const int kMatchNextStates[kNumStates] = {7, 7, 7, 7, 7, 7, 7, 10, 10, 10, 10, 10}; -+static const int kRepNextStates[kNumStates] = {8, 8, 8, 8, 8, 8, 8, 11, 11, 11, 11, 11}; -+static const int kShortRepNextStates[kNumStates]= {9, 9, 9, 9, 9, 9, 9, 11, 11, 11, 11, 11}; -+ -+#define IsCharState(s) ((s) < 7) -+ -+#define GetLenToPosState(len) (((len) < kNumLenToPosStates + 1) ? (len) - 2 : kNumLenToPosStates - 1) -+ -+#define kInfinityPrice (1 << 30) -+ -+static void RangeEnc_Construct(CRangeEnc *p) -+{ -+ p->outStream = 0; -+ p->bufBase = 0; -+} -+ -+#define RangeEnc_GetProcessed(p) ((p)->processed + ((p)->buf - (p)->bufBase) + (p)->cacheSize) -+ -+#define RC_BUF_SIZE (1 << 16) -+static int RangeEnc_Alloc(CRangeEnc *p, ISzAlloc *alloc) -+{ -+ if (p->bufBase == 0) -+ { -+ p->bufBase = (Byte *)alloc->Alloc(alloc, RC_BUF_SIZE); -+ if (p->bufBase == 0) -+ return 0; -+ p->bufLim = p->bufBase + RC_BUF_SIZE; -+ } -+ return 1; -+} -+ -+static void RangeEnc_Free(CRangeEnc *p, ISzAlloc *alloc) -+{ -+ alloc->Free(alloc, p->bufBase); -+ p->bufBase = 0; -+} -+ -+static void RangeEnc_Init(CRangeEnc *p) -+{ -+ /* Stream.Init(); */ -+ p->low = 0; -+ p->range = 0xFFFFFFFF; -+ p->cacheSize = 1; -+ p->cache = 0; -+ -+ p->buf = p->bufBase; -+ -+ p->processed = 0; -+ p->res = SZ_OK; -+} -+ -+static void RangeEnc_FlushStream(CRangeEnc *p) -+{ -+ size_t num; -+ if (p->res != SZ_OK) -+ return; -+ num = p->buf - p->bufBase; -+ if (num != p->outStream->Write(p->outStream, p->bufBase, num)) -+ p->res = SZ_ERROR_WRITE; -+ p->processed += num; -+ p->buf = p->bufBase; -+} -+ -+static void MY_FAST_CALL RangeEnc_ShiftLow(CRangeEnc *p) -+{ -+ if ((UInt32)p->low < (UInt32)0xFF000000 || (int)(p->low >> 32) != 0) -+ { -+ Byte temp = p->cache; -+ do -+ { -+ Byte *buf = p->buf; -+ *buf++ = (Byte)(temp + (Byte)(p->low >> 32)); -+ p->buf = buf; -+ if (buf == p->bufLim) -+ RangeEnc_FlushStream(p); -+ temp = 0xFF; -+ } -+ while (--p->cacheSize != 0); -+ p->cache = (Byte)((UInt32)p->low >> 24); -+ } -+ p->cacheSize++; -+ p->low = (UInt32)p->low << 8; -+} -+ -+static void RangeEnc_FlushData(CRangeEnc *p) -+{ -+ int i; -+ for (i = 0; i < 5; i++) -+ RangeEnc_ShiftLow(p); -+} -+ -+static void RangeEnc_EncodeDirectBits(CRangeEnc *p, UInt32 value, int numBits) -+{ -+ do -+ { -+ p->range >>= 1; -+ p->low += p->range & (0 - ((value >> --numBits) & 1)); -+ if (p->range < kTopValue) -+ { -+ p->range <<= 8; -+ RangeEnc_ShiftLow(p); -+ } -+ } -+ while (numBits != 0); -+} -+ -+static void RangeEnc_EncodeBit(CRangeEnc *p, CLzmaProb *prob, UInt32 symbol) -+{ -+ UInt32 ttt = *prob; -+ UInt32 newBound = (p->range >> kNumBitModelTotalBits) * ttt; -+ if (symbol == 0) -+ { -+ p->range = newBound; -+ ttt += (kBitModelTotal - ttt) >> kNumMoveBits; -+ } -+ else -+ { -+ p->low += newBound; -+ p->range -= newBound; -+ ttt -= ttt >> kNumMoveBits; -+ } -+ *prob = (CLzmaProb)ttt; -+ if (p->range < kTopValue) -+ { -+ p->range <<= 8; -+ RangeEnc_ShiftLow(p); -+ } -+} -+ -+static void LitEnc_Encode(CRangeEnc *p, CLzmaProb *probs, UInt32 symbol) -+{ -+ symbol |= 0x100; -+ do -+ { -+ RangeEnc_EncodeBit(p, probs + (symbol >> 8), (symbol >> 7) & 1); -+ symbol <<= 1; -+ } -+ while (symbol < 0x10000); -+} -+ -+static void LitEnc_EncodeMatched(CRangeEnc *p, CLzmaProb *probs, UInt32 symbol, UInt32 matchByte) -+{ -+ UInt32 offs = 0x100; -+ symbol |= 0x100; -+ do -+ { -+ matchByte <<= 1; -+ RangeEnc_EncodeBit(p, probs + (offs + (matchByte & offs) + (symbol >> 8)), (symbol >> 7) & 1); -+ symbol <<= 1; -+ offs &= ~(matchByte ^ symbol); -+ } -+ while (symbol < 0x10000); -+} -+ -+void LzmaEnc_InitPriceTables(UInt32 *ProbPrices) -+{ -+ UInt32 i; -+ for (i = (1 << kNumMoveReducingBits) / 2; i < kBitModelTotal; i += (1 << kNumMoveReducingBits)) -+ { -+ const int kCyclesBits = kNumBitPriceShiftBits; -+ UInt32 w = i; -+ UInt32 bitCount = 0; -+ int j; -+ for (j = 0; j < kCyclesBits; j++) -+ { -+ w = w * w; -+ bitCount <<= 1; -+ while (w >= ((UInt32)1 << 16)) -+ { -+ w >>= 1; -+ bitCount++; -+ } -+ } -+ ProbPrices[i >> kNumMoveReducingBits] = ((kNumBitModelTotalBits << kCyclesBits) - 15 - bitCount); -+ } -+} -+ -+ -+#define GET_PRICE(prob, symbol) \ -+ p->ProbPrices[((prob) ^ (((-(int)(symbol))) & (kBitModelTotal - 1))) >> kNumMoveReducingBits]; -+ -+#define GET_PRICEa(prob, symbol) \ -+ ProbPrices[((prob) ^ ((-((int)(symbol))) & (kBitModelTotal - 1))) >> kNumMoveReducingBits]; -+ -+#define GET_PRICE_0(prob) p->ProbPrices[(prob) >> kNumMoveReducingBits] -+#define GET_PRICE_1(prob) p->ProbPrices[((prob) ^ (kBitModelTotal - 1)) >> kNumMoveReducingBits] -+ -+#define GET_PRICE_0a(prob) ProbPrices[(prob) >> kNumMoveReducingBits] -+#define GET_PRICE_1a(prob) ProbPrices[((prob) ^ (kBitModelTotal - 1)) >> kNumMoveReducingBits] -+ -+static UInt32 LitEnc_GetPrice(const CLzmaProb *probs, UInt32 symbol, UInt32 *ProbPrices) -+{ -+ UInt32 price = 0; -+ symbol |= 0x100; -+ do -+ { -+ price += GET_PRICEa(probs[symbol >> 8], (symbol >> 7) & 1); -+ symbol <<= 1; -+ } -+ while (symbol < 0x10000); -+ return price; -+} -+ -+static UInt32 LitEnc_GetPriceMatched(const CLzmaProb *probs, UInt32 symbol, UInt32 matchByte, UInt32 *ProbPrices) -+{ -+ UInt32 price = 0; -+ UInt32 offs = 0x100; -+ symbol |= 0x100; -+ do -+ { -+ matchByte <<= 1; -+ price += GET_PRICEa(probs[offs + (matchByte & offs) + (symbol >> 8)], (symbol >> 7) & 1); -+ symbol <<= 1; -+ offs &= ~(matchByte ^ symbol); -+ } -+ while (symbol < 0x10000); -+ return price; -+} -+ -+ -+static void RcTree_Encode(CRangeEnc *rc, CLzmaProb *probs, int numBitLevels, UInt32 symbol) -+{ -+ UInt32 m = 1; -+ int i; -+ for (i = numBitLevels; i != 0;) -+ { -+ UInt32 bit; -+ i--; -+ bit = (symbol >> i) & 1; -+ RangeEnc_EncodeBit(rc, probs + m, bit); -+ m = (m << 1) | bit; -+ } -+} -+ -+static void RcTree_ReverseEncode(CRangeEnc *rc, CLzmaProb *probs, int numBitLevels, UInt32 symbol) -+{ -+ UInt32 m = 1; -+ int i; -+ for (i = 0; i < numBitLevels; i++) -+ { -+ UInt32 bit = symbol & 1; -+ RangeEnc_EncodeBit(rc, probs + m, bit); -+ m = (m << 1) | bit; -+ symbol >>= 1; -+ } -+} -+ -+static UInt32 RcTree_GetPrice(const CLzmaProb *probs, int numBitLevels, UInt32 symbol, UInt32 *ProbPrices) -+{ -+ UInt32 price = 0; -+ symbol |= (1 << numBitLevels); -+ while (symbol != 1) -+ { -+ price += GET_PRICEa(probs[symbol >> 1], symbol & 1); -+ symbol >>= 1; -+ } -+ return price; -+} -+ -+static UInt32 RcTree_ReverseGetPrice(const CLzmaProb *probs, int numBitLevels, UInt32 symbol, UInt32 *ProbPrices) -+{ -+ UInt32 price = 0; -+ UInt32 m = 1; -+ int i; -+ for (i = numBitLevels; i != 0; i--) -+ { -+ UInt32 bit = symbol & 1; -+ symbol >>= 1; -+ price += GET_PRICEa(probs[m], bit); -+ m = (m << 1) | bit; -+ } -+ return price; -+} -+ -+ -+static void LenEnc_Init(CLenEnc *p) -+{ -+ unsigned i; -+ p->choice = p->choice2 = kProbInitValue; -+ for (i = 0; i < (LZMA_NUM_PB_STATES_MAX << kLenNumLowBits); i++) -+ p->low[i] = kProbInitValue; -+ for (i = 0; i < (LZMA_NUM_PB_STATES_MAX << kLenNumMidBits); i++) -+ p->mid[i] = kProbInitValue; -+ for (i = 0; i < kLenNumHighSymbols; i++) -+ p->high[i] = kProbInitValue; -+} -+ -+static void LenEnc_Encode(CLenEnc *p, CRangeEnc *rc, UInt32 symbol, UInt32 posState) -+{ -+ if (symbol < kLenNumLowSymbols) -+ { -+ RangeEnc_EncodeBit(rc, &p->choice, 0); -+ RcTree_Encode(rc, p->low + (posState << kLenNumLowBits), kLenNumLowBits, symbol); -+ } -+ else -+ { -+ RangeEnc_EncodeBit(rc, &p->choice, 1); -+ if (symbol < kLenNumLowSymbols + kLenNumMidSymbols) -+ { -+ RangeEnc_EncodeBit(rc, &p->choice2, 0); -+ RcTree_Encode(rc, p->mid + (posState << kLenNumMidBits), kLenNumMidBits, symbol - kLenNumLowSymbols); -+ } -+ else -+ { -+ RangeEnc_EncodeBit(rc, &p->choice2, 1); -+ RcTree_Encode(rc, p->high, kLenNumHighBits, symbol - kLenNumLowSymbols - kLenNumMidSymbols); -+ } -+ } -+} -+ -+static void LenEnc_SetPrices(CLenEnc *p, UInt32 posState, UInt32 numSymbols, UInt32 *prices, UInt32 *ProbPrices) -+{ -+ UInt32 a0 = GET_PRICE_0a(p->choice); -+ UInt32 a1 = GET_PRICE_1a(p->choice); -+ UInt32 b0 = a1 + GET_PRICE_0a(p->choice2); -+ UInt32 b1 = a1 + GET_PRICE_1a(p->choice2); -+ UInt32 i = 0; -+ for (i = 0; i < kLenNumLowSymbols; i++) -+ { -+ if (i >= numSymbols) -+ return; -+ prices[i] = a0 + RcTree_GetPrice(p->low + (posState << kLenNumLowBits), kLenNumLowBits, i, ProbPrices); -+ } -+ for (; i < kLenNumLowSymbols + kLenNumMidSymbols; i++) -+ { -+ if (i >= numSymbols) -+ return; -+ prices[i] = b0 + RcTree_GetPrice(p->mid + (posState << kLenNumMidBits), kLenNumMidBits, i - kLenNumLowSymbols, ProbPrices); -+ } -+ for (; i < numSymbols; i++) -+ prices[i] = b1 + RcTree_GetPrice(p->high, kLenNumHighBits, i - kLenNumLowSymbols - kLenNumMidSymbols, ProbPrices); -+} -+ -+static void MY_FAST_CALL LenPriceEnc_UpdateTable(CLenPriceEnc *p, UInt32 posState, UInt32 *ProbPrices) -+{ -+ LenEnc_SetPrices(&p->p, posState, p->tableSize, p->prices[posState], ProbPrices); -+ p->counters[posState] = p->tableSize; -+} -+ -+static void LenPriceEnc_UpdateTables(CLenPriceEnc *p, UInt32 numPosStates, UInt32 *ProbPrices) -+{ -+ UInt32 posState; -+ for (posState = 0; posState < numPosStates; posState++) -+ LenPriceEnc_UpdateTable(p, posState, ProbPrices); -+} -+ -+static void LenEnc_Encode2(CLenPriceEnc *p, CRangeEnc *rc, UInt32 symbol, UInt32 posState, Bool updatePrice, UInt32 *ProbPrices) -+{ -+ LenEnc_Encode(&p->p, rc, symbol, posState); -+ if (updatePrice) -+ if (--p->counters[posState] == 0) -+ LenPriceEnc_UpdateTable(p, posState, ProbPrices); -+} -+ -+ -+ -+ -+static void MovePos(CLzmaEnc *p, UInt32 num) -+{ -+ #ifdef SHOW_STAT -+ ttt += num; -+ printf("\n MovePos %d", num); -+ #endif -+ if (num != 0) -+ { -+ p->additionalOffset += num; -+ p->matchFinder.Skip(p->matchFinderObj, num); -+ } -+} -+ -+static UInt32 ReadMatchDistances(CLzmaEnc *p, UInt32 *numDistancePairsRes) -+{ -+ UInt32 lenRes = 0, numPairs; -+ p->numAvail = p->matchFinder.GetNumAvailableBytes(p->matchFinderObj); -+ numPairs = p->matchFinder.GetMatches(p->matchFinderObj, p->matches); -+ #ifdef SHOW_STAT -+ printf("\n i = %d numPairs = %d ", ttt, numPairs / 2); -+ ttt++; -+ { -+ UInt32 i; -+ for (i = 0; i < numPairs; i += 2) -+ printf("%2d %6d | ", p->matches[i], p->matches[i + 1]); -+ } -+ #endif -+ if (numPairs > 0) -+ { -+ lenRes = p->matches[numPairs - 2]; -+ if (lenRes == p->numFastBytes) -+ { -+ const Byte *pby = p->matchFinder.GetPointerToCurrentPos(p->matchFinderObj) - 1; -+ UInt32 distance = p->matches[numPairs - 1] + 1; -+ UInt32 numAvail = p->numAvail; -+ if (numAvail > LZMA_MATCH_LEN_MAX) -+ numAvail = LZMA_MATCH_LEN_MAX; -+ { -+ const Byte *pby2 = pby - distance; -+ for (; lenRes < numAvail && pby[lenRes] == pby2[lenRes]; lenRes++); -+ } -+ } -+ } -+ p->additionalOffset++; -+ *numDistancePairsRes = numPairs; -+ return lenRes; -+} -+ -+ -+#define MakeAsChar(p) (p)->backPrev = (UInt32)(-1); (p)->prev1IsChar = False; -+#define MakeAsShortRep(p) (p)->backPrev = 0; (p)->prev1IsChar = False; -+#define IsShortRep(p) ((p)->backPrev == 0) -+ -+static UInt32 GetRepLen1Price(CLzmaEnc *p, UInt32 state, UInt32 posState) -+{ -+ return -+ GET_PRICE_0(p->isRepG0[state]) + -+ GET_PRICE_0(p->isRep0Long[state][posState]); -+} -+ -+static UInt32 GetPureRepPrice(CLzmaEnc *p, UInt32 repIndex, UInt32 state, UInt32 posState) -+{ -+ UInt32 price; -+ if (repIndex == 0) -+ { -+ price = GET_PRICE_0(p->isRepG0[state]); -+ price += GET_PRICE_1(p->isRep0Long[state][posState]); -+ } -+ else -+ { -+ price = GET_PRICE_1(p->isRepG0[state]); -+ if (repIndex == 1) -+ price += GET_PRICE_0(p->isRepG1[state]); -+ else -+ { -+ price += GET_PRICE_1(p->isRepG1[state]); -+ price += GET_PRICE(p->isRepG2[state], repIndex - 2); -+ } -+ } -+ return price; -+} -+ -+static UInt32 GetRepPrice(CLzmaEnc *p, UInt32 repIndex, UInt32 len, UInt32 state, UInt32 posState) -+{ -+ return p->repLenEnc.prices[posState][len - LZMA_MATCH_LEN_MIN] + -+ GetPureRepPrice(p, repIndex, state, posState); -+} -+ -+static UInt32 Backward(CLzmaEnc *p, UInt32 *backRes, UInt32 cur) -+{ -+ UInt32 posMem = p->opt[cur].posPrev; -+ UInt32 backMem = p->opt[cur].backPrev; -+ p->optimumEndIndex = cur; -+ do -+ { -+ if (p->opt[cur].prev1IsChar) -+ { -+ MakeAsChar(&p->opt[posMem]) -+ p->opt[posMem].posPrev = posMem - 1; -+ if (p->opt[cur].prev2) -+ { -+ p->opt[posMem - 1].prev1IsChar = False; -+ p->opt[posMem - 1].posPrev = p->opt[cur].posPrev2; -+ p->opt[posMem - 1].backPrev = p->opt[cur].backPrev2; -+ } -+ } -+ { -+ UInt32 posPrev = posMem; -+ UInt32 backCur = backMem; -+ -+ backMem = p->opt[posPrev].backPrev; -+ posMem = p->opt[posPrev].posPrev; -+ -+ p->opt[posPrev].backPrev = backCur; -+ p->opt[posPrev].posPrev = cur; -+ cur = posPrev; -+ } -+ } -+ while (cur != 0); -+ *backRes = p->opt[0].backPrev; -+ p->optimumCurrentIndex = p->opt[0].posPrev; -+ return p->optimumCurrentIndex; -+} -+ -+#define LIT_PROBS(pos, prevByte) (p->litProbs + ((((pos) & p->lpMask) << p->lc) + ((prevByte) >> (8 - p->lc))) * 0x300) -+ -+static UInt32 GetOptimum(CLzmaEnc *p, UInt32 position, UInt32 *backRes) -+{ -+ UInt32 numAvail, mainLen, numPairs, repMaxIndex, i, posState, lenEnd, len, cur; -+ UInt32 matchPrice, repMatchPrice, normalMatchPrice; -+ UInt32 reps[LZMA_NUM_REPS], repLens[LZMA_NUM_REPS]; -+ UInt32 *matches; -+ const Byte *data; -+ Byte curByte, matchByte; -+ if (p->optimumEndIndex != p->optimumCurrentIndex) -+ { -+ const COptimal *opt = &p->opt[p->optimumCurrentIndex]; -+ UInt32 lenRes = opt->posPrev - p->optimumCurrentIndex; -+ *backRes = opt->backPrev; -+ p->optimumCurrentIndex = opt->posPrev; -+ return lenRes; -+ } -+ p->optimumCurrentIndex = p->optimumEndIndex = 0; -+ -+ if (p->additionalOffset == 0) -+ mainLen = ReadMatchDistances(p, &numPairs); -+ else -+ { -+ mainLen = p->longestMatchLength; -+ numPairs = p->numPairs; -+ } -+ -+ numAvail = p->numAvail; -+ if (numAvail < 2) -+ { -+ *backRes = (UInt32)(-1); -+ return 1; -+ } -+ if (numAvail > LZMA_MATCH_LEN_MAX) -+ numAvail = LZMA_MATCH_LEN_MAX; -+ -+ data = p->matchFinder.GetPointerToCurrentPos(p->matchFinderObj) - 1; -+ repMaxIndex = 0; -+ for (i = 0; i < LZMA_NUM_REPS; i++) -+ { -+ UInt32 lenTest; -+ const Byte *data2; -+ reps[i] = p->reps[i]; -+ data2 = data - (reps[i] + 1); -+ if (data[0] != data2[0] || data[1] != data2[1]) -+ { -+ repLens[i] = 0; -+ continue; -+ } -+ for (lenTest = 2; lenTest < numAvail && data[lenTest] == data2[lenTest]; lenTest++); -+ repLens[i] = lenTest; -+ if (lenTest > repLens[repMaxIndex]) -+ repMaxIndex = i; -+ } -+ if (repLens[repMaxIndex] >= p->numFastBytes) -+ { -+ UInt32 lenRes; -+ *backRes = repMaxIndex; -+ lenRes = repLens[repMaxIndex]; -+ MovePos(p, lenRes - 1); -+ return lenRes; -+ } -+ -+ matches = p->matches; -+ if (mainLen >= p->numFastBytes) -+ { -+ *backRes = matches[numPairs - 1] + LZMA_NUM_REPS; -+ MovePos(p, mainLen - 1); -+ return mainLen; -+ } -+ curByte = *data; -+ matchByte = *(data - (reps[0] + 1)); -+ -+ if (mainLen < 2 && curByte != matchByte && repLens[repMaxIndex] < 2) -+ { -+ *backRes = (UInt32)-1; -+ return 1; -+ } -+ -+ p->opt[0].state = (CState)p->state; -+ -+ posState = (position & p->pbMask); -+ -+ { -+ const CLzmaProb *probs = LIT_PROBS(position, *(data - 1)); -+ p->opt[1].price = GET_PRICE_0(p->isMatch[p->state][posState]) + -+ (!IsCharState(p->state) ? -+ LitEnc_GetPriceMatched(probs, curByte, matchByte, p->ProbPrices) : -+ LitEnc_GetPrice(probs, curByte, p->ProbPrices)); -+ } -+ -+ MakeAsChar(&p->opt[1]); -+ -+ matchPrice = GET_PRICE_1(p->isMatch[p->state][posState]); -+ repMatchPrice = matchPrice + GET_PRICE_1(p->isRep[p->state]); -+ -+ if (matchByte == curByte) -+ { -+ UInt32 shortRepPrice = repMatchPrice + GetRepLen1Price(p, p->state, posState); -+ if (shortRepPrice < p->opt[1].price) -+ { -+ p->opt[1].price = shortRepPrice; -+ MakeAsShortRep(&p->opt[1]); -+ } -+ } -+ lenEnd = ((mainLen >= repLens[repMaxIndex]) ? mainLen : repLens[repMaxIndex]); -+ -+ if (lenEnd < 2) -+ { -+ *backRes = p->opt[1].backPrev; -+ return 1; -+ } -+ -+ p->opt[1].posPrev = 0; -+ for (i = 0; i < LZMA_NUM_REPS; i++) -+ p->opt[0].backs[i] = reps[i]; -+ -+ len = lenEnd; -+ do -+ p->opt[len--].price = kInfinityPrice; -+ while (len >= 2); -+ -+ for (i = 0; i < LZMA_NUM_REPS; i++) -+ { -+ UInt32 repLen = repLens[i]; -+ UInt32 price; -+ if (repLen < 2) -+ continue; -+ price = repMatchPrice + GetPureRepPrice(p, i, p->state, posState); -+ do -+ { -+ UInt32 curAndLenPrice = price + p->repLenEnc.prices[posState][repLen - 2]; -+ COptimal *opt = &p->opt[repLen]; -+ if (curAndLenPrice < opt->price) -+ { -+ opt->price = curAndLenPrice; -+ opt->posPrev = 0; -+ opt->backPrev = i; -+ opt->prev1IsChar = False; -+ } -+ } -+ while (--repLen >= 2); -+ } -+ -+ normalMatchPrice = matchPrice + GET_PRICE_0(p->isRep[p->state]); -+ -+ len = ((repLens[0] >= 2) ? repLens[0] + 1 : 2); -+ if (len <= mainLen) -+ { -+ UInt32 offs = 0; -+ while (len > matches[offs]) -+ offs += 2; -+ for (; ; len++) -+ { -+ COptimal *opt; -+ UInt32 distance = matches[offs + 1]; -+ -+ UInt32 curAndLenPrice = normalMatchPrice + p->lenEnc.prices[posState][len - LZMA_MATCH_LEN_MIN]; -+ UInt32 lenToPosState = GetLenToPosState(len); -+ if (distance < kNumFullDistances) -+ curAndLenPrice += p->distancesPrices[lenToPosState][distance]; -+ else -+ { -+ UInt32 slot; -+ GetPosSlot2(distance, slot); -+ curAndLenPrice += p->alignPrices[distance & kAlignMask] + p->posSlotPrices[lenToPosState][slot]; -+ } -+ opt = &p->opt[len]; -+ if (curAndLenPrice < opt->price) -+ { -+ opt->price = curAndLenPrice; -+ opt->posPrev = 0; -+ opt->backPrev = distance + LZMA_NUM_REPS; -+ opt->prev1IsChar = False; -+ } -+ if (len == matches[offs]) -+ { -+ offs += 2; -+ if (offs == numPairs) -+ break; -+ } -+ } -+ } -+ -+ cur = 0; -+ -+ #ifdef SHOW_STAT2 -+ if (position >= 0) -+ { -+ unsigned i; -+ printf("\n pos = %4X", position); -+ for (i = cur; i <= lenEnd; i++) -+ printf("\nprice[%4X] = %d", position - cur + i, p->opt[i].price); -+ } -+ #endif -+ -+ for (;;) -+ { -+ UInt32 numAvailFull, newLen, numPairs, posPrev, state, posState, startLen; -+ UInt32 curPrice, curAnd1Price, matchPrice, repMatchPrice; -+ Bool nextIsChar; -+ Byte curByte, matchByte; -+ const Byte *data; -+ COptimal *curOpt; -+ COptimal *nextOpt; -+ -+ cur++; -+ if (cur == lenEnd) -+ return Backward(p, backRes, cur); -+ -+ newLen = ReadMatchDistances(p, &numPairs); -+ if (newLen >= p->numFastBytes) -+ { -+ p->numPairs = numPairs; -+ p->longestMatchLength = newLen; -+ return Backward(p, backRes, cur); -+ } -+ position++; -+ curOpt = &p->opt[cur]; -+ posPrev = curOpt->posPrev; -+ if (curOpt->prev1IsChar) -+ { -+ posPrev--; -+ if (curOpt->prev2) -+ { -+ state = p->opt[curOpt->posPrev2].state; -+ if (curOpt->backPrev2 < LZMA_NUM_REPS) -+ state = kRepNextStates[state]; -+ else -+ state = kMatchNextStates[state]; -+ } -+ else -+ state = p->opt[posPrev].state; -+ state = kLiteralNextStates[state]; -+ } -+ else -+ state = p->opt[posPrev].state; -+ if (posPrev == cur - 1) -+ { -+ if (IsShortRep(curOpt)) -+ state = kShortRepNextStates[state]; -+ else -+ state = kLiteralNextStates[state]; -+ } -+ else -+ { -+ UInt32 pos; -+ const COptimal *prevOpt; -+ if (curOpt->prev1IsChar && curOpt->prev2) -+ { -+ posPrev = curOpt->posPrev2; -+ pos = curOpt->backPrev2; -+ state = kRepNextStates[state]; -+ } -+ else -+ { -+ pos = curOpt->backPrev; -+ if (pos < LZMA_NUM_REPS) -+ state = kRepNextStates[state]; -+ else -+ state = kMatchNextStates[state]; -+ } -+ prevOpt = &p->opt[posPrev]; -+ if (pos < LZMA_NUM_REPS) -+ { -+ UInt32 i; -+ reps[0] = prevOpt->backs[pos]; -+ for (i = 1; i <= pos; i++) -+ reps[i] = prevOpt->backs[i - 1]; -+ for (; i < LZMA_NUM_REPS; i++) -+ reps[i] = prevOpt->backs[i]; -+ } -+ else -+ { -+ UInt32 i; -+ reps[0] = (pos - LZMA_NUM_REPS); -+ for (i = 1; i < LZMA_NUM_REPS; i++) -+ reps[i] = prevOpt->backs[i - 1]; -+ } -+ } -+ curOpt->state = (CState)state; -+ -+ curOpt->backs[0] = reps[0]; -+ curOpt->backs[1] = reps[1]; -+ curOpt->backs[2] = reps[2]; -+ curOpt->backs[3] = reps[3]; -+ -+ curPrice = curOpt->price; -+ nextIsChar = False; -+ data = p->matchFinder.GetPointerToCurrentPos(p->matchFinderObj) - 1; -+ curByte = *data; -+ matchByte = *(data - (reps[0] + 1)); -+ -+ posState = (position & p->pbMask); -+ -+ curAnd1Price = curPrice + GET_PRICE_0(p->isMatch[state][posState]); -+ { -+ const CLzmaProb *probs = LIT_PROBS(position, *(data - 1)); -+ curAnd1Price += -+ (!IsCharState(state) ? -+ LitEnc_GetPriceMatched(probs, curByte, matchByte, p->ProbPrices) : -+ LitEnc_GetPrice(probs, curByte, p->ProbPrices)); -+ } -+ -+ nextOpt = &p->opt[cur + 1]; -+ -+ if (curAnd1Price < nextOpt->price) -+ { -+ nextOpt->price = curAnd1Price; -+ nextOpt->posPrev = cur; -+ MakeAsChar(nextOpt); -+ nextIsChar = True; -+ } -+ -+ matchPrice = curPrice + GET_PRICE_1(p->isMatch[state][posState]); -+ repMatchPrice = matchPrice + GET_PRICE_1(p->isRep[state]); -+ -+ if (matchByte == curByte && !(nextOpt->posPrev < cur && nextOpt->backPrev == 0)) -+ { -+ UInt32 shortRepPrice = repMatchPrice + GetRepLen1Price(p, state, posState); -+ if (shortRepPrice <= nextOpt->price) -+ { -+ nextOpt->price = shortRepPrice; -+ nextOpt->posPrev = cur; -+ MakeAsShortRep(nextOpt); -+ nextIsChar = True; -+ } -+ } -+ numAvailFull = p->numAvail; -+ { -+ UInt32 temp = kNumOpts - 1 - cur; -+ if (temp < numAvailFull) -+ numAvailFull = temp; -+ } -+ -+ if (numAvailFull < 2) -+ continue; -+ numAvail = (numAvailFull <= p->numFastBytes ? numAvailFull : p->numFastBytes); -+ -+ if (!nextIsChar && matchByte != curByte) /* speed optimization */ -+ { -+ /* try Literal + rep0 */ -+ UInt32 temp; -+ UInt32 lenTest2; -+ const Byte *data2 = data - (reps[0] + 1); -+ UInt32 limit = p->numFastBytes + 1; -+ if (limit > numAvailFull) -+ limit = numAvailFull; -+ -+ for (temp = 1; temp < limit && data[temp] == data2[temp]; temp++); -+ lenTest2 = temp - 1; -+ if (lenTest2 >= 2) -+ { -+ UInt32 state2 = kLiteralNextStates[state]; -+ UInt32 posStateNext = (position + 1) & p->pbMask; -+ UInt32 nextRepMatchPrice = curAnd1Price + -+ GET_PRICE_1(p->isMatch[state2][posStateNext]) + -+ GET_PRICE_1(p->isRep[state2]); -+ /* for (; lenTest2 >= 2; lenTest2--) */ -+ { -+ UInt32 curAndLenPrice; -+ COptimal *opt; -+ UInt32 offset = cur + 1 + lenTest2; -+ while (lenEnd < offset) -+ p->opt[++lenEnd].price = kInfinityPrice; -+ curAndLenPrice = nextRepMatchPrice + GetRepPrice(p, 0, lenTest2, state2, posStateNext); -+ opt = &p->opt[offset]; -+ if (curAndLenPrice < opt->price) -+ { -+ opt->price = curAndLenPrice; -+ opt->posPrev = cur + 1; -+ opt->backPrev = 0; -+ opt->prev1IsChar = True; -+ opt->prev2 = False; -+ } -+ } -+ } -+ } -+ -+ startLen = 2; /* speed optimization */ -+ { -+ UInt32 repIndex; -+ for (repIndex = 0; repIndex < LZMA_NUM_REPS; repIndex++) -+ { -+ UInt32 lenTest; -+ UInt32 lenTestTemp; -+ UInt32 price; -+ const Byte *data2 = data - (reps[repIndex] + 1); -+ if (data[0] != data2[0] || data[1] != data2[1]) -+ continue; -+ for (lenTest = 2; lenTest < numAvail && data[lenTest] == data2[lenTest]; lenTest++); -+ while (lenEnd < cur + lenTest) -+ p->opt[++lenEnd].price = kInfinityPrice; -+ lenTestTemp = lenTest; -+ price = repMatchPrice + GetPureRepPrice(p, repIndex, state, posState); -+ do -+ { -+ UInt32 curAndLenPrice = price + p->repLenEnc.prices[posState][lenTest - 2]; -+ COptimal *opt = &p->opt[cur + lenTest]; -+ if (curAndLenPrice < opt->price) -+ { -+ opt->price = curAndLenPrice; -+ opt->posPrev = cur; -+ opt->backPrev = repIndex; -+ opt->prev1IsChar = False; -+ } -+ } -+ while (--lenTest >= 2); -+ lenTest = lenTestTemp; -+ -+ if (repIndex == 0) -+ startLen = lenTest + 1; -+ -+ /* if (_maxMode) */ -+ { -+ UInt32 lenTest2 = lenTest + 1; -+ UInt32 limit = lenTest2 + p->numFastBytes; -+ UInt32 nextRepMatchPrice; -+ if (limit > numAvailFull) -+ limit = numAvailFull; -+ for (; lenTest2 < limit && data[lenTest2] == data2[lenTest2]; lenTest2++); -+ lenTest2 -= lenTest + 1; -+ if (lenTest2 >= 2) -+ { -+ UInt32 state2 = kRepNextStates[state]; -+ UInt32 posStateNext = (position + lenTest) & p->pbMask; -+ UInt32 curAndLenCharPrice = -+ price + p->repLenEnc.prices[posState][lenTest - 2] + -+ GET_PRICE_0(p->isMatch[state2][posStateNext]) + -+ LitEnc_GetPriceMatched(LIT_PROBS(position + lenTest, data[lenTest - 1]), -+ data[lenTest], data2[lenTest], p->ProbPrices); -+ state2 = kLiteralNextStates[state2]; -+ posStateNext = (position + lenTest + 1) & p->pbMask; -+ nextRepMatchPrice = curAndLenCharPrice + -+ GET_PRICE_1(p->isMatch[state2][posStateNext]) + -+ GET_PRICE_1(p->isRep[state2]); -+ -+ /* for (; lenTest2 >= 2; lenTest2--) */ -+ { -+ UInt32 curAndLenPrice; -+ COptimal *opt; -+ UInt32 offset = cur + lenTest + 1 + lenTest2; -+ while (lenEnd < offset) -+ p->opt[++lenEnd].price = kInfinityPrice; -+ curAndLenPrice = nextRepMatchPrice + GetRepPrice(p, 0, lenTest2, state2, posStateNext); -+ opt = &p->opt[offset]; -+ if (curAndLenPrice < opt->price) -+ { -+ opt->price = curAndLenPrice; -+ opt->posPrev = cur + lenTest + 1; -+ opt->backPrev = 0; -+ opt->prev1IsChar = True; -+ opt->prev2 = True; -+ opt->posPrev2 = cur; -+ opt->backPrev2 = repIndex; -+ } -+ } -+ } -+ } -+ } -+ } -+ /* for (UInt32 lenTest = 2; lenTest <= newLen; lenTest++) */ -+ if (newLen > numAvail) -+ { -+ newLen = numAvail; -+ for (numPairs = 0; newLen > matches[numPairs]; numPairs += 2); -+ matches[numPairs] = newLen; -+ numPairs += 2; -+ } -+ if (newLen >= startLen) -+ { -+ UInt32 normalMatchPrice = matchPrice + GET_PRICE_0(p->isRep[state]); -+ UInt32 offs, curBack, posSlot; -+ UInt32 lenTest; -+ while (lenEnd < cur + newLen) -+ p->opt[++lenEnd].price = kInfinityPrice; -+ -+ offs = 0; -+ while (startLen > matches[offs]) -+ offs += 2; -+ curBack = matches[offs + 1]; -+ GetPosSlot2(curBack, posSlot); -+ for (lenTest = /*2*/ startLen; ; lenTest++) -+ { -+ UInt32 curAndLenPrice = normalMatchPrice + p->lenEnc.prices[posState][lenTest - LZMA_MATCH_LEN_MIN]; -+ UInt32 lenToPosState = GetLenToPosState(lenTest); -+ COptimal *opt; -+ if (curBack < kNumFullDistances) -+ curAndLenPrice += p->distancesPrices[lenToPosState][curBack]; -+ else -+ curAndLenPrice += p->posSlotPrices[lenToPosState][posSlot] + p->alignPrices[curBack & kAlignMask]; -+ -+ opt = &p->opt[cur + lenTest]; -+ if (curAndLenPrice < opt->price) -+ { -+ opt->price = curAndLenPrice; -+ opt->posPrev = cur; -+ opt->backPrev = curBack + LZMA_NUM_REPS; -+ opt->prev1IsChar = False; -+ } -+ -+ if (/*_maxMode && */lenTest == matches[offs]) -+ { -+ /* Try Match + Literal + Rep0 */ -+ const Byte *data2 = data - (curBack + 1); -+ UInt32 lenTest2 = lenTest + 1; -+ UInt32 limit = lenTest2 + p->numFastBytes; -+ UInt32 nextRepMatchPrice; -+ if (limit > numAvailFull) -+ limit = numAvailFull; -+ for (; lenTest2 < limit && data[lenTest2] == data2[lenTest2]; lenTest2++); -+ lenTest2 -= lenTest + 1; -+ if (lenTest2 >= 2) -+ { -+ UInt32 state2 = kMatchNextStates[state]; -+ UInt32 posStateNext = (position + lenTest) & p->pbMask; -+ UInt32 curAndLenCharPrice = curAndLenPrice + -+ GET_PRICE_0(p->isMatch[state2][posStateNext]) + -+ LitEnc_GetPriceMatched(LIT_PROBS(position + lenTest, data[lenTest - 1]), -+ data[lenTest], data2[lenTest], p->ProbPrices); -+ state2 = kLiteralNextStates[state2]; -+ posStateNext = (posStateNext + 1) & p->pbMask; -+ nextRepMatchPrice = curAndLenCharPrice + -+ GET_PRICE_1(p->isMatch[state2][posStateNext]) + -+ GET_PRICE_1(p->isRep[state2]); -+ -+ /* for (; lenTest2 >= 2; lenTest2--) */ -+ { -+ UInt32 offset = cur + lenTest + 1 + lenTest2; -+ UInt32 curAndLenPrice; -+ COptimal *opt; -+ while (lenEnd < offset) -+ p->opt[++lenEnd].price = kInfinityPrice; -+ curAndLenPrice = nextRepMatchPrice + GetRepPrice(p, 0, lenTest2, state2, posStateNext); -+ opt = &p->opt[offset]; -+ if (curAndLenPrice < opt->price) -+ { -+ opt->price = curAndLenPrice; -+ opt->posPrev = cur + lenTest + 1; -+ opt->backPrev = 0; -+ opt->prev1IsChar = True; -+ opt->prev2 = True; -+ opt->posPrev2 = cur; -+ opt->backPrev2 = curBack + LZMA_NUM_REPS; -+ } -+ } -+ } -+ offs += 2; -+ if (offs == numPairs) -+ break; -+ curBack = matches[offs + 1]; -+ if (curBack >= kNumFullDistances) -+ GetPosSlot2(curBack, posSlot); -+ } -+ } -+ } -+ } -+} -+ -+#define ChangePair(smallDist, bigDist) (((bigDist) >> 7) > (smallDist)) -+ -+static UInt32 GetOptimumFast(CLzmaEnc *p, UInt32 *backRes) -+{ -+ UInt32 numAvail, mainLen, mainDist, numPairs, repIndex, repLen, i; -+ const Byte *data; -+ const UInt32 *matches; -+ -+ if (p->additionalOffset == 0) -+ mainLen = ReadMatchDistances(p, &numPairs); -+ else -+ { -+ mainLen = p->longestMatchLength; -+ numPairs = p->numPairs; -+ } -+ -+ numAvail = p->numAvail; -+ *backRes = (UInt32)-1; -+ if (numAvail < 2) -+ return 1; -+ if (numAvail > LZMA_MATCH_LEN_MAX) -+ numAvail = LZMA_MATCH_LEN_MAX; -+ data = p->matchFinder.GetPointerToCurrentPos(p->matchFinderObj) - 1; -+ -+ repLen = repIndex = 0; -+ for (i = 0; i < LZMA_NUM_REPS; i++) -+ { -+ UInt32 len; -+ const Byte *data2 = data - (p->reps[i] + 1); -+ if (data[0] != data2[0] || data[1] != data2[1]) -+ continue; -+ for (len = 2; len < numAvail && data[len] == data2[len]; len++); -+ if (len >= p->numFastBytes) -+ { -+ *backRes = i; -+ MovePos(p, len - 1); -+ return len; -+ } -+ if (len > repLen) -+ { -+ repIndex = i; -+ repLen = len; -+ } -+ } -+ -+ matches = p->matches; -+ if (mainLen >= p->numFastBytes) -+ { -+ *backRes = matches[numPairs - 1] + LZMA_NUM_REPS; -+ MovePos(p, mainLen - 1); -+ return mainLen; -+ } -+ -+ mainDist = 0; /* for GCC */ -+ if (mainLen >= 2) -+ { -+ mainDist = matches[numPairs - 1]; -+ while (numPairs > 2 && mainLen == matches[numPairs - 4] + 1) -+ { -+ if (!ChangePair(matches[numPairs - 3], mainDist)) -+ break; -+ numPairs -= 2; -+ mainLen = matches[numPairs - 2]; -+ mainDist = matches[numPairs - 1]; -+ } -+ if (mainLen == 2 && mainDist >= 0x80) -+ mainLen = 1; -+ } -+ -+ if (repLen >= 2 && ( -+ (repLen + 1 >= mainLen) || -+ (repLen + 2 >= mainLen && mainDist >= (1 << 9)) || -+ (repLen + 3 >= mainLen && mainDist >= (1 << 15)))) -+ { -+ *backRes = repIndex; -+ MovePos(p, repLen - 1); -+ return repLen; -+ } -+ -+ if (mainLen < 2 || numAvail <= 2) -+ return 1; -+ -+ p->longestMatchLength = ReadMatchDistances(p, &p->numPairs); -+ if (p->longestMatchLength >= 2) -+ { -+ UInt32 newDistance = matches[p->numPairs - 1]; -+ if ((p->longestMatchLength >= mainLen && newDistance < mainDist) || -+ (p->longestMatchLength == mainLen + 1 && !ChangePair(mainDist, newDistance)) || -+ (p->longestMatchLength > mainLen + 1) || -+ (p->longestMatchLength + 1 >= mainLen && mainLen >= 3 && ChangePair(newDistance, mainDist))) -+ return 1; -+ } -+ -+ data = p->matchFinder.GetPointerToCurrentPos(p->matchFinderObj) - 1; -+ for (i = 0; i < LZMA_NUM_REPS; i++) -+ { -+ UInt32 len, limit; -+ const Byte *data2 = data - (p->reps[i] + 1); -+ if (data[0] != data2[0] || data[1] != data2[1]) -+ continue; -+ limit = mainLen - 1; -+ for (len = 2; len < limit && data[len] == data2[len]; len++); -+ if (len >= limit) -+ return 1; -+ } -+ *backRes = mainDist + LZMA_NUM_REPS; -+ MovePos(p, mainLen - 2); -+ return mainLen; -+} -+ -+static void WriteEndMarker(CLzmaEnc *p, UInt32 posState) -+{ -+ UInt32 len; -+ RangeEnc_EncodeBit(&p->rc, &p->isMatch[p->state][posState], 1); -+ RangeEnc_EncodeBit(&p->rc, &p->isRep[p->state], 0); -+ p->state = kMatchNextStates[p->state]; -+ len = LZMA_MATCH_LEN_MIN; -+ LenEnc_Encode2(&p->lenEnc, &p->rc, len - LZMA_MATCH_LEN_MIN, posState, !p->fastMode, p->ProbPrices); -+ RcTree_Encode(&p->rc, p->posSlotEncoder[GetLenToPosState(len)], kNumPosSlotBits, (1 << kNumPosSlotBits) - 1); -+ RangeEnc_EncodeDirectBits(&p->rc, (((UInt32)1 << 30) - 1) >> kNumAlignBits, 30 - kNumAlignBits); -+ RcTree_ReverseEncode(&p->rc, p->posAlignEncoder, kNumAlignBits, kAlignMask); -+} -+ -+static SRes CheckErrors(CLzmaEnc *p) -+{ -+ if (p->result != SZ_OK) -+ return p->result; -+ if (p->rc.res != SZ_OK) -+ p->result = SZ_ERROR_WRITE; -+ if (p->matchFinderBase.result != SZ_OK) -+ p->result = SZ_ERROR_READ; -+ if (p->result != SZ_OK) -+ p->finished = True; -+ return p->result; -+} -+ -+static SRes Flush(CLzmaEnc *p, UInt32 nowPos) -+{ -+ /* ReleaseMFStream(); */ -+ p->finished = True; -+ if (p->writeEndMark) -+ WriteEndMarker(p, nowPos & p->pbMask); -+ RangeEnc_FlushData(&p->rc); -+ RangeEnc_FlushStream(&p->rc); -+ return CheckErrors(p); -+} -+ -+static void FillAlignPrices(CLzmaEnc *p) -+{ -+ UInt32 i; -+ for (i = 0; i < kAlignTableSize; i++) -+ p->alignPrices[i] = RcTree_ReverseGetPrice(p->posAlignEncoder, kNumAlignBits, i, p->ProbPrices); -+ p->alignPriceCount = 0; -+} -+ -+static void FillDistancesPrices(CLzmaEnc *p) -+{ -+ UInt32 tempPrices[kNumFullDistances]; -+ UInt32 i, lenToPosState; -+ for (i = kStartPosModelIndex; i < kNumFullDistances; i++) -+ { -+ UInt32 posSlot = GetPosSlot1(i); -+ UInt32 footerBits = ((posSlot >> 1) - 1); -+ UInt32 base = ((2 | (posSlot & 1)) << footerBits); -+ tempPrices[i] = RcTree_ReverseGetPrice(p->posEncoders + base - posSlot - 1, footerBits, i - base, p->ProbPrices); -+ } -+ -+ for (lenToPosState = 0; lenToPosState < kNumLenToPosStates; lenToPosState++) -+ { -+ UInt32 posSlot; -+ const CLzmaProb *encoder = p->posSlotEncoder[lenToPosState]; -+ UInt32 *posSlotPrices = p->posSlotPrices[lenToPosState]; -+ for (posSlot = 0; posSlot < p->distTableSize; posSlot++) -+ posSlotPrices[posSlot] = RcTree_GetPrice(encoder, kNumPosSlotBits, posSlot, p->ProbPrices); -+ for (posSlot = kEndPosModelIndex; posSlot < p->distTableSize; posSlot++) -+ posSlotPrices[posSlot] += ((((posSlot >> 1) - 1) - kNumAlignBits) << kNumBitPriceShiftBits); -+ -+ { -+ UInt32 *distancesPrices = p->distancesPrices[lenToPosState]; -+ UInt32 i; -+ for (i = 0; i < kStartPosModelIndex; i++) -+ distancesPrices[i] = posSlotPrices[i]; -+ for (; i < kNumFullDistances; i++) -+ distancesPrices[i] = posSlotPrices[GetPosSlot1(i)] + tempPrices[i]; -+ } -+ } -+ p->matchPriceCount = 0; -+} -+ -+void LzmaEnc_Construct(CLzmaEnc *p) -+{ -+ RangeEnc_Construct(&p->rc); -+ MatchFinder_Construct(&p->matchFinderBase); -+ #ifndef _7ZIP_ST -+ MatchFinderMt_Construct(&p->matchFinderMt); -+ p->matchFinderMt.MatchFinder = &p->matchFinderBase; -+ #endif -+ -+ { -+ CLzmaEncProps props; -+ LzmaEncProps_Init(&props); -+ LzmaEnc_SetProps(p, &props); -+ } -+ -+ #ifndef LZMA_LOG_BSR -+ LzmaEnc_FastPosInit(p->g_FastPos); -+ #endif -+ -+ LzmaEnc_InitPriceTables(p->ProbPrices); -+ p->litProbs = 0; -+ p->saveState.litProbs = 0; -+} -+ -+CLzmaEncHandle LzmaEnc_Create(ISzAlloc *alloc) -+{ -+ void *p; -+ p = alloc->Alloc(alloc, sizeof(CLzmaEnc)); -+ if (p != 0) -+ LzmaEnc_Construct((CLzmaEnc *)p); -+ return p; -+} -+ -+void LzmaEnc_FreeLits(CLzmaEnc *p, ISzAlloc *alloc) -+{ -+ alloc->Free(alloc, p->litProbs); -+ alloc->Free(alloc, p->saveState.litProbs); -+ p->litProbs = 0; -+ p->saveState.litProbs = 0; -+} -+ -+void LzmaEnc_Destruct(CLzmaEnc *p, ISzAlloc *alloc, ISzAlloc *allocBig) -+{ -+ #ifndef _7ZIP_ST -+ MatchFinderMt_Destruct(&p->matchFinderMt, allocBig); -+ #endif -+ MatchFinder_Free(&p->matchFinderBase, allocBig); -+ LzmaEnc_FreeLits(p, alloc); -+ RangeEnc_Free(&p->rc, alloc); -+} -+ -+void LzmaEnc_Destroy(CLzmaEncHandle p, ISzAlloc *alloc, ISzAlloc *allocBig) -+{ -+ LzmaEnc_Destruct((CLzmaEnc *)p, alloc, allocBig); -+ alloc->Free(alloc, p); -+} -+ -+static SRes LzmaEnc_CodeOneBlock(CLzmaEnc *p, Bool useLimits, UInt32 maxPackSize, UInt32 maxUnpackSize) -+{ -+ UInt32 nowPos32, startPos32; -+ if (p->needInit) -+ { -+ p->matchFinder.Init(p->matchFinderObj); -+ p->needInit = 0; -+ } -+ -+ if (p->finished) -+ return p->result; -+ RINOK(CheckErrors(p)); -+ -+ nowPos32 = (UInt32)p->nowPos64; -+ startPos32 = nowPos32; -+ -+ if (p->nowPos64 == 0) -+ { -+ UInt32 numPairs; -+ Byte curByte; -+ if (p->matchFinder.GetNumAvailableBytes(p->matchFinderObj) == 0) -+ return Flush(p, nowPos32); -+ ReadMatchDistances(p, &numPairs); -+ RangeEnc_EncodeBit(&p->rc, &p->isMatch[p->state][0], 0); -+ p->state = kLiteralNextStates[p->state]; -+ curByte = p->matchFinder.GetIndexByte(p->matchFinderObj, 0 - p->additionalOffset); -+ LitEnc_Encode(&p->rc, p->litProbs, curByte); -+ p->additionalOffset--; -+ nowPos32++; -+ } -+ -+ if (p->matchFinder.GetNumAvailableBytes(p->matchFinderObj) != 0) -+ for (;;) -+ { -+ UInt32 pos, len, posState; -+ -+ if (p->fastMode) -+ len = GetOptimumFast(p, &pos); -+ else -+ len = GetOptimum(p, nowPos32, &pos); -+ -+ #ifdef SHOW_STAT2 -+ printf("\n pos = %4X, len = %d pos = %d", nowPos32, len, pos); -+ #endif -+ -+ posState = nowPos32 & p->pbMask; -+ if (len == 1 && pos == (UInt32)-1) -+ { -+ Byte curByte; -+ CLzmaProb *probs; -+ const Byte *data; -+ -+ RangeEnc_EncodeBit(&p->rc, &p->isMatch[p->state][posState], 0); -+ data = p->matchFinder.GetPointerToCurrentPos(p->matchFinderObj) - p->additionalOffset; -+ curByte = *data; -+ probs = LIT_PROBS(nowPos32, *(data - 1)); -+ if (IsCharState(p->state)) -+ LitEnc_Encode(&p->rc, probs, curByte); -+ else -+ LitEnc_EncodeMatched(&p->rc, probs, curByte, *(data - p->reps[0] - 1)); -+ p->state = kLiteralNextStates[p->state]; -+ } -+ else -+ { -+ RangeEnc_EncodeBit(&p->rc, &p->isMatch[p->state][posState], 1); -+ if (pos < LZMA_NUM_REPS) -+ { -+ RangeEnc_EncodeBit(&p->rc, &p->isRep[p->state], 1); -+ if (pos == 0) -+ { -+ RangeEnc_EncodeBit(&p->rc, &p->isRepG0[p->state], 0); -+ RangeEnc_EncodeBit(&p->rc, &p->isRep0Long[p->state][posState], ((len == 1) ? 0 : 1)); -+ } -+ else -+ { -+ UInt32 distance = p->reps[pos]; -+ RangeEnc_EncodeBit(&p->rc, &p->isRepG0[p->state], 1); -+ if (pos == 1) -+ RangeEnc_EncodeBit(&p->rc, &p->isRepG1[p->state], 0); -+ else -+ { -+ RangeEnc_EncodeBit(&p->rc, &p->isRepG1[p->state], 1); -+ RangeEnc_EncodeBit(&p->rc, &p->isRepG2[p->state], pos - 2); -+ if (pos == 3) -+ p->reps[3] = p->reps[2]; -+ p->reps[2] = p->reps[1]; -+ } -+ p->reps[1] = p->reps[0]; -+ p->reps[0] = distance; -+ } -+ if (len == 1) -+ p->state = kShortRepNextStates[p->state]; -+ else -+ { -+ LenEnc_Encode2(&p->repLenEnc, &p->rc, len - LZMA_MATCH_LEN_MIN, posState, !p->fastMode, p->ProbPrices); -+ p->state = kRepNextStates[p->state]; -+ } -+ } -+ else -+ { -+ UInt32 posSlot; -+ RangeEnc_EncodeBit(&p->rc, &p->isRep[p->state], 0); -+ p->state = kMatchNextStates[p->state]; -+ LenEnc_Encode2(&p->lenEnc, &p->rc, len - LZMA_MATCH_LEN_MIN, posState, !p->fastMode, p->ProbPrices); -+ pos -= LZMA_NUM_REPS; -+ GetPosSlot(pos, posSlot); -+ RcTree_Encode(&p->rc, p->posSlotEncoder[GetLenToPosState(len)], kNumPosSlotBits, posSlot); -+ -+ if (posSlot >= kStartPosModelIndex) -+ { -+ UInt32 footerBits = ((posSlot >> 1) - 1); -+ UInt32 base = ((2 | (posSlot & 1)) << footerBits); -+ UInt32 posReduced = pos - base; -+ -+ if (posSlot < kEndPosModelIndex) -+ RcTree_ReverseEncode(&p->rc, p->posEncoders + base - posSlot - 1, footerBits, posReduced); -+ else -+ { -+ RangeEnc_EncodeDirectBits(&p->rc, posReduced >> kNumAlignBits, footerBits - kNumAlignBits); -+ RcTree_ReverseEncode(&p->rc, p->posAlignEncoder, kNumAlignBits, posReduced & kAlignMask); -+ p->alignPriceCount++; -+ } -+ } -+ p->reps[3] = p->reps[2]; -+ p->reps[2] = p->reps[1]; -+ p->reps[1] = p->reps[0]; -+ p->reps[0] = pos; -+ p->matchPriceCount++; -+ } -+ } -+ p->additionalOffset -= len; -+ nowPos32 += len; -+ if (p->additionalOffset == 0) -+ { -+ UInt32 processed; -+ if (!p->fastMode) -+ { -+ if (p->matchPriceCount >= (1 << 7)) -+ FillDistancesPrices(p); -+ if (p->alignPriceCount >= kAlignTableSize) -+ FillAlignPrices(p); -+ } -+ if (p->matchFinder.GetNumAvailableBytes(p->matchFinderObj) == 0) -+ break; -+ processed = nowPos32 - startPos32; -+ if (useLimits) -+ { -+ if (processed + kNumOpts + 300 >= maxUnpackSize || -+ RangeEnc_GetProcessed(&p->rc) + kNumOpts * 2 >= maxPackSize) -+ break; -+ } -+ else if (processed >= (1 << 15)) -+ { -+ p->nowPos64 += nowPos32 - startPos32; -+ return CheckErrors(p); -+ } -+ } -+ } -+ p->nowPos64 += nowPos32 - startPos32; -+ return Flush(p, nowPos32); -+} -+ -+#define kBigHashDicLimit ((UInt32)1 << 24) -+ -+static SRes LzmaEnc_Alloc(CLzmaEnc *p, UInt32 keepWindowSize, ISzAlloc *alloc, ISzAlloc *allocBig) -+{ -+ UInt32 beforeSize = kNumOpts; -+ Bool btMode; -+ if (!RangeEnc_Alloc(&p->rc, alloc)) -+ return SZ_ERROR_MEM; -+ btMode = (p->matchFinderBase.btMode != 0); -+ #ifndef _7ZIP_ST -+ p->mtMode = (p->multiThread && !p->fastMode && btMode); -+ #endif -+ -+ { -+ unsigned lclp = p->lc + p->lp; -+ if (p->litProbs == 0 || p->saveState.litProbs == 0 || p->lclp != lclp) -+ { -+ LzmaEnc_FreeLits(p, alloc); -+ p->litProbs = (CLzmaProb *)alloc->Alloc(alloc, (0x300 << lclp) * sizeof(CLzmaProb)); -+ p->saveState.litProbs = (CLzmaProb *)alloc->Alloc(alloc, (0x300 << lclp) * sizeof(CLzmaProb)); -+ if (p->litProbs == 0 || p->saveState.litProbs == 0) -+ { -+ LzmaEnc_FreeLits(p, alloc); -+ return SZ_ERROR_MEM; -+ } -+ p->lclp = lclp; -+ } -+ } -+ -+ p->matchFinderBase.bigHash = (p->dictSize > kBigHashDicLimit); -+ -+ if (beforeSize + p->dictSize < keepWindowSize) -+ beforeSize = keepWindowSize - p->dictSize; -+ -+ #ifndef _7ZIP_ST -+ if (p->mtMode) -+ { -+ RINOK(MatchFinderMt_Create(&p->matchFinderMt, p->dictSize, beforeSize, p->numFastBytes, LZMA_MATCH_LEN_MAX, allocBig)); -+ p->matchFinderObj = &p->matchFinderMt; -+ MatchFinderMt_CreateVTable(&p->matchFinderMt, &p->matchFinder); -+ } -+ else -+ #endif -+ { -+ if (!MatchFinder_Create(&p->matchFinderBase, p->dictSize, beforeSize, p->numFastBytes, LZMA_MATCH_LEN_MAX, allocBig)) -+ return SZ_ERROR_MEM; -+ p->matchFinderObj = &p->matchFinderBase; -+ MatchFinder_CreateVTable(&p->matchFinderBase, &p->matchFinder); -+ } -+ return SZ_OK; -+} -+ -+void LzmaEnc_Init(CLzmaEnc *p) -+{ -+ UInt32 i; -+ p->state = 0; -+ for (i = 0 ; i < LZMA_NUM_REPS; i++) -+ p->reps[i] = 0; -+ -+ RangeEnc_Init(&p->rc); -+ -+ -+ for (i = 0; i < kNumStates; i++) -+ { -+ UInt32 j; -+ for (j = 0; j < LZMA_NUM_PB_STATES_MAX; j++) -+ { -+ p->isMatch[i][j] = kProbInitValue; -+ p->isRep0Long[i][j] = kProbInitValue; -+ } -+ p->isRep[i] = kProbInitValue; -+ p->isRepG0[i] = kProbInitValue; -+ p->isRepG1[i] = kProbInitValue; -+ p->isRepG2[i] = kProbInitValue; -+ } -+ -+ { -+ UInt32 num = 0x300 << (p->lp + p->lc); -+ for (i = 0; i < num; i++) -+ p->litProbs[i] = kProbInitValue; -+ } -+ -+ { -+ for (i = 0; i < kNumLenToPosStates; i++) -+ { -+ CLzmaProb *probs = p->posSlotEncoder[i]; -+ UInt32 j; -+ for (j = 0; j < (1 << kNumPosSlotBits); j++) -+ probs[j] = kProbInitValue; -+ } -+ } -+ { -+ for (i = 0; i < kNumFullDistances - kEndPosModelIndex; i++) -+ p->posEncoders[i] = kProbInitValue; -+ } -+ -+ LenEnc_Init(&p->lenEnc.p); -+ LenEnc_Init(&p->repLenEnc.p); -+ -+ for (i = 0; i < (1 << kNumAlignBits); i++) -+ p->posAlignEncoder[i] = kProbInitValue; -+ -+ p->optimumEndIndex = 0; -+ p->optimumCurrentIndex = 0; -+ p->additionalOffset = 0; -+ -+ p->pbMask = (1 << p->pb) - 1; -+ p->lpMask = (1 << p->lp) - 1; -+} -+ -+void LzmaEnc_InitPrices(CLzmaEnc *p) -+{ -+ if (!p->fastMode) -+ { -+ FillDistancesPrices(p); -+ FillAlignPrices(p); -+ } -+ -+ p->lenEnc.tableSize = -+ p->repLenEnc.tableSize = -+ p->numFastBytes + 1 - LZMA_MATCH_LEN_MIN; -+ LenPriceEnc_UpdateTables(&p->lenEnc, 1 << p->pb, p->ProbPrices); -+ LenPriceEnc_UpdateTables(&p->repLenEnc, 1 << p->pb, p->ProbPrices); -+} -+ -+static SRes LzmaEnc_AllocAndInit(CLzmaEnc *p, UInt32 keepWindowSize, ISzAlloc *alloc, ISzAlloc *allocBig) -+{ -+ UInt32 i; -+ for (i = 0; i < (UInt32)kDicLogSizeMaxCompress; i++) -+ if (p->dictSize <= ((UInt32)1 << i)) -+ break; -+ p->distTableSize = i * 2; -+ -+ p->finished = False; -+ p->result = SZ_OK; -+ RINOK(LzmaEnc_Alloc(p, keepWindowSize, alloc, allocBig)); -+ LzmaEnc_Init(p); -+ LzmaEnc_InitPrices(p); -+ p->nowPos64 = 0; -+ return SZ_OK; -+} -+ -+static SRes LzmaEnc_Prepare(CLzmaEncHandle pp, ISeqOutStream *outStream, ISeqInStream *inStream, -+ ISzAlloc *alloc, ISzAlloc *allocBig) -+{ -+ CLzmaEnc *p = (CLzmaEnc *)pp; -+ p->matchFinderBase.stream = inStream; -+ p->needInit = 1; -+ p->rc.outStream = outStream; -+ return LzmaEnc_AllocAndInit(p, 0, alloc, allocBig); -+} -+ -+SRes LzmaEnc_PrepareForLzma2(CLzmaEncHandle pp, -+ ISeqInStream *inStream, UInt32 keepWindowSize, -+ ISzAlloc *alloc, ISzAlloc *allocBig) -+{ -+ CLzmaEnc *p = (CLzmaEnc *)pp; -+ p->matchFinderBase.stream = inStream; -+ p->needInit = 1; -+ return LzmaEnc_AllocAndInit(p, keepWindowSize, alloc, allocBig); -+} -+ -+static void LzmaEnc_SetInputBuf(CLzmaEnc *p, const Byte *src, SizeT srcLen) -+{ -+ p->matchFinderBase.directInput = 1; -+ p->matchFinderBase.bufferBase = (Byte *)src; -+ p->matchFinderBase.directInputRem = srcLen; -+} -+ -+SRes LzmaEnc_MemPrepare(CLzmaEncHandle pp, const Byte *src, SizeT srcLen, -+ UInt32 keepWindowSize, ISzAlloc *alloc, ISzAlloc *allocBig) -+{ -+ CLzmaEnc *p = (CLzmaEnc *)pp; -+ LzmaEnc_SetInputBuf(p, src, srcLen); -+ p->needInit = 1; -+ -+ return LzmaEnc_AllocAndInit(p, keepWindowSize, alloc, allocBig); -+} -+ -+void LzmaEnc_Finish(CLzmaEncHandle pp) -+{ -+ #ifndef _7ZIP_ST -+ CLzmaEnc *p = (CLzmaEnc *)pp; -+ if (p->mtMode) -+ MatchFinderMt_ReleaseStream(&p->matchFinderMt); -+ #else -+ pp = pp; -+ #endif -+} -+ -+typedef struct -+{ -+ ISeqOutStream funcTable; -+ Byte *data; -+ SizeT rem; -+ Bool overflow; -+} CSeqOutStreamBuf; -+ -+static size_t MyWrite(void *pp, const void *data, size_t size) -+{ -+ CSeqOutStreamBuf *p = (CSeqOutStreamBuf *)pp; -+ if (p->rem < size) -+ { -+ size = p->rem; -+ p->overflow = True; -+ } -+ memcpy(p->data, data, size); -+ p->rem -= size; -+ p->data += size; -+ return size; -+} -+ -+ -+UInt32 LzmaEnc_GetNumAvailableBytes(CLzmaEncHandle pp) -+{ -+ const CLzmaEnc *p = (CLzmaEnc *)pp; -+ return p->matchFinder.GetNumAvailableBytes(p->matchFinderObj); -+} -+ -+const Byte *LzmaEnc_GetCurBuf(CLzmaEncHandle pp) -+{ -+ const CLzmaEnc *p = (CLzmaEnc *)pp; -+ return p->matchFinder.GetPointerToCurrentPos(p->matchFinderObj) - p->additionalOffset; -+} -+ -+SRes LzmaEnc_CodeOneMemBlock(CLzmaEncHandle pp, Bool reInit, -+ Byte *dest, size_t *destLen, UInt32 desiredPackSize, UInt32 *unpackSize) -+{ -+ CLzmaEnc *p = (CLzmaEnc *)pp; -+ UInt64 nowPos64; -+ SRes res; -+ CSeqOutStreamBuf outStream; -+ -+ outStream.funcTable.Write = MyWrite; -+ outStream.data = dest; -+ outStream.rem = *destLen; -+ outStream.overflow = False; -+ -+ p->writeEndMark = False; -+ p->finished = False; -+ p->result = SZ_OK; -+ -+ if (reInit) -+ LzmaEnc_Init(p); -+ LzmaEnc_InitPrices(p); -+ nowPos64 = p->nowPos64; -+ RangeEnc_Init(&p->rc); -+ p->rc.outStream = &outStream.funcTable; -+ -+ res = LzmaEnc_CodeOneBlock(p, True, desiredPackSize, *unpackSize); -+ -+ *unpackSize = (UInt32)(p->nowPos64 - nowPos64); -+ *destLen -= outStream.rem; -+ if (outStream.overflow) -+ return SZ_ERROR_OUTPUT_EOF; -+ -+ return res; -+} -+ -+static SRes LzmaEnc_Encode2(CLzmaEnc *p, ICompressProgress *progress) -+{ -+ SRes res = SZ_OK; -+ -+ #ifndef _7ZIP_ST -+ Byte allocaDummy[0x300]; -+ int i = 0; -+ for (i = 0; i < 16; i++) -+ allocaDummy[i] = (Byte)i; -+ #endif -+ -+ for (;;) -+ { -+ res = LzmaEnc_CodeOneBlock(p, False, 0, 0); -+ if (res != SZ_OK || p->finished != 0) -+ break; -+ if (progress != 0) -+ { -+ res = progress->Progress(progress, p->nowPos64, RangeEnc_GetProcessed(&p->rc)); -+ if (res != SZ_OK) -+ { -+ res = SZ_ERROR_PROGRESS; -+ break; -+ } -+ } -+ } -+ LzmaEnc_Finish(p); -+ return res; -+} -+ -+SRes LzmaEnc_Encode(CLzmaEncHandle pp, ISeqOutStream *outStream, ISeqInStream *inStream, ICompressProgress *progress, -+ ISzAlloc *alloc, ISzAlloc *allocBig) -+{ -+ RINOK(LzmaEnc_Prepare(pp, outStream, inStream, alloc, allocBig)); -+ return LzmaEnc_Encode2((CLzmaEnc *)pp, progress); -+} -+ -+SRes LzmaEnc_WriteProperties(CLzmaEncHandle pp, Byte *props, SizeT *size) -+{ -+ CLzmaEnc *p = (CLzmaEnc *)pp; -+ int i; -+ UInt32 dictSize = p->dictSize; -+ if (*size < LZMA_PROPS_SIZE) -+ return SZ_ERROR_PARAM; -+ *size = LZMA_PROPS_SIZE; -+ props[0] = (Byte)((p->pb * 5 + p->lp) * 9 + p->lc); -+ -+ for (i = 11; i <= 30; i++) -+ { -+ if (dictSize <= ((UInt32)2 << i)) -+ { -+ dictSize = (2 << i); -+ break; -+ } -+ if (dictSize <= ((UInt32)3 << i)) -+ { -+ dictSize = (3 << i); -+ break; -+ } -+ } -+ -+ for (i = 0; i < 4; i++) -+ props[1 + i] = (Byte)(dictSize >> (8 * i)); -+ return SZ_OK; -+} -+ -+SRes LzmaEnc_MemEncode(CLzmaEncHandle pp, Byte *dest, SizeT *destLen, const Byte *src, SizeT srcLen, -+ int writeEndMark, ICompressProgress *progress, ISzAlloc *alloc, ISzAlloc *allocBig) -+{ -+ SRes res; -+ CLzmaEnc *p = (CLzmaEnc *)pp; -+ -+ CSeqOutStreamBuf outStream; -+ -+ LzmaEnc_SetInputBuf(p, src, srcLen); -+ -+ outStream.funcTable.Write = MyWrite; -+ outStream.data = dest; -+ outStream.rem = *destLen; -+ outStream.overflow = False; -+ -+ p->writeEndMark = writeEndMark; -+ -+ p->rc.outStream = &outStream.funcTable; -+ res = LzmaEnc_MemPrepare(pp, src, srcLen, 0, alloc, allocBig); -+ if (res == SZ_OK) -+ res = LzmaEnc_Encode2(p, progress); -+ -+ *destLen -= outStream.rem; -+ if (outStream.overflow) -+ return SZ_ERROR_OUTPUT_EOF; -+ return res; -+} -+ -+SRes LzmaEncode(Byte *dest, SizeT *destLen, const Byte *src, SizeT srcLen, -+ const CLzmaEncProps *props, Byte *propsEncoded, SizeT *propsSize, int writeEndMark, -+ ICompressProgress *progress, ISzAlloc *alloc, ISzAlloc *allocBig) -+{ -+ CLzmaEnc *p = (CLzmaEnc *)LzmaEnc_Create(alloc); -+ SRes res; -+ if (p == 0) -+ return SZ_ERROR_MEM; -+ -+ res = LzmaEnc_SetProps(p, props); -+ if (res == SZ_OK) -+ { -+ res = LzmaEnc_WriteProperties(p, propsEncoded, propsSize); -+ if (res == SZ_OK) -+ res = LzmaEnc_MemEncode(p, dest, destLen, src, srcLen, -+ writeEndMark, progress, alloc, allocBig); -+ } -+ -+ LzmaEnc_Destroy(p, alloc, allocBig); -+ return res; -+} ---- /dev/null -+++ b/lib/lzma/Makefile -@@ -0,0 +1,7 @@ -+lzma_compress-objs := LzFind.o LzmaEnc.o -+lzma_decompress-objs := LzmaDec.o -+ -+obj-$(CONFIG_LZMA_COMPRESS) += lzma_compress.o -+obj-$(CONFIG_LZMA_DECOMPRESS) += lzma_decompress.o -+ -+EXTRA_CFLAGS += -Iinclude/linux -Iinclude/linux/lzma -include types.h diff --git a/target/linux/generic/pending-4.9/532-jffs2_eofdetect.patch b/target/linux/generic/pending-4.9/532-jffs2_eofdetect.patch deleted file mode 100644 index e9952c6d84..0000000000 --- a/target/linux/generic/pending-4.9/532-jffs2_eofdetect.patch +++ /dev/null @@ -1,65 +0,0 @@ -From: Felix Fietkau -Subject: fs: jffs2: EOF marker - -Signed-off-by: Felix Fietkau ---- - fs/jffs2/build.c | 10 ++++++++++ - fs/jffs2/scan.c | 21 +++++++++++++++++++-- - 2 files changed, 29 insertions(+), 2 deletions(-) - ---- a/fs/jffs2/build.c -+++ b/fs/jffs2/build.c -@@ -117,6 +117,16 @@ static int jffs2_build_filesystem(struct - dbg_fsbuild("scanned flash completely\n"); - jffs2_dbg_dump_block_lists_nolock(c); - -+ if (c->flags & (1 << 7)) { -+ printk("%s(): unlocking the mtd device... ", __func__); -+ mtd_unlock(c->mtd, 0, c->mtd->size); -+ printk("done.\n"); -+ -+ printk("%s(): erasing all blocks after the end marker... ", __func__); -+ jffs2_erase_pending_blocks(c, -1); -+ printk("done.\n"); -+ } -+ - dbg_fsbuild("pass 1 starting\n"); - c->flags |= JFFS2_SB_FLAG_BUILDING; - /* Now scan the directory tree, increasing nlink according to every dirent found. */ ---- a/fs/jffs2/scan.c -+++ b/fs/jffs2/scan.c -@@ -148,8 +148,14 @@ int jffs2_scan_medium(struct jffs2_sb_in - /* reset summary info for next eraseblock scan */ - jffs2_sum_reset_collected(s); - -- ret = jffs2_scan_eraseblock(c, jeb, buf_size?flashbuf:(flashbuf+jeb->offset), -- buf_size, s); -+ if (c->flags & (1 << 7)) { -+ if (mtd_block_isbad(c->mtd, jeb->offset)) -+ ret = BLK_STATE_BADBLOCK; -+ else -+ ret = BLK_STATE_ALLFF; -+ } else -+ ret = jffs2_scan_eraseblock(c, jeb, buf_size?flashbuf:(flashbuf+jeb->offset), -+ buf_size, s); - - if (ret < 0) - goto out; -@@ -561,6 +567,17 @@ full_scan: - return err; - } - -+ if ((buf[0] == 0xde) && -+ (buf[1] == 0xad) && -+ (buf[2] == 0xc0) && -+ (buf[3] == 0xde)) { -+ /* end of filesystem. erase everything after this point */ -+ printk("%s(): End of filesystem marker found at 0x%x\n", __func__, jeb->offset); -+ c->flags |= (1 << 7); -+ -+ return BLK_STATE_ALLFF; -+ } -+ - /* We temporarily use 'ofs' as a pointer into the buffer/jeb */ - ofs = 0; - max_ofs = EMPTY_SCAN_SIZE(c->sector_size); diff --git a/target/linux/generic/pending-4.9/551-ubifs-fix-default-compression-selection.patch b/target/linux/generic/pending-4.9/551-ubifs-fix-default-compression-selection.patch deleted file mode 100644 index ca96cbbdb8..0000000000 --- a/target/linux/generic/pending-4.9/551-ubifs-fix-default-compression-selection.patch +++ /dev/null @@ -1,37 +0,0 @@ -From: Gabor Juhos -Subject: fs: ubifs: fix default compression selection in ubifs - -Signed-off-by: Gabor Juhos ---- - fs/ubifs/sb.c | 13 ++++++++++++- - 1 file changed, 12 insertions(+), 1 deletion(-) - ---- a/fs/ubifs/sb.c -+++ b/fs/ubifs/sb.c -@@ -63,6 +63,17 @@ - /* Default time granularity in nanoseconds */ - #define DEFAULT_TIME_GRAN 1000000000 - -+static int get_default_compressor(void) -+{ -+ if (ubifs_compr_present(UBIFS_COMPR_LZO)) -+ return UBIFS_COMPR_LZO; -+ -+ if (ubifs_compr_present(UBIFS_COMPR_ZLIB)) -+ return UBIFS_COMPR_ZLIB; -+ -+ return UBIFS_COMPR_NONE; -+} -+ - /** - * create_default_filesystem - format empty UBI volume. - * @c: UBIFS file-system description object -@@ -183,7 +194,7 @@ static int create_default_filesystem(str - if (c->mount_opts.override_compr) - sup->default_compr = cpu_to_le16(c->mount_opts.compr_type); - else -- sup->default_compr = cpu_to_le16(UBIFS_COMPR_LZO); -+ sup->default_compr = cpu_to_le16(get_default_compressor()); - - generate_random_uuid(sup->uuid); - diff --git a/target/linux/generic/pending-4.9/600-netfilter_conntrack_flush.patch b/target/linux/generic/pending-4.9/600-netfilter_conntrack_flush.patch deleted file mode 100644 index 81dac2ab23..0000000000 --- a/target/linux/generic/pending-4.9/600-netfilter_conntrack_flush.patch +++ /dev/null @@ -1,95 +0,0 @@ -From: Felix Fietkau -Subject: netfilter: add support for flushing conntrack via /proc - -lede-commit 8193bbe59a74d34d6a26d4a8cb857b1952905314 -Signed-off-by: Felix Fietkau ---- - net/netfilter/nf_conntrack_standalone.c | 59 ++++++++++++++++++++++++++++++++- - 1 file changed, 58 insertions(+), 1 deletion(-) - ---- a/net/netfilter/nf_conntrack_standalone.c -+++ b/net/netfilter/nf_conntrack_standalone.c -@@ -17,6 +17,7 @@ - #include - #include - #include -+#include - #include - #ifdef CONFIG_SYSCTL - #include -@@ -298,10 +299,66 @@ static int ct_open(struct inode *inode, - sizeof(struct ct_iter_state)); - } - -+struct kill_request { -+ u16 family; -+ union nf_inet_addr addr; -+}; -+ -+static int kill_matching(struct nf_conn *i, void *data) -+{ -+ struct kill_request *kr = data; -+ struct nf_conntrack_tuple *t1 = &i->tuplehash[IP_CT_DIR_ORIGINAL].tuple; -+ struct nf_conntrack_tuple *t2 = &i->tuplehash[IP_CT_DIR_REPLY].tuple; -+ -+ if (!kr->family) -+ return 1; -+ -+ if (t1->src.l3num != kr->family) -+ return 0; -+ -+ return (nf_inet_addr_cmp(&kr->addr, &t1->src.u3) || -+ nf_inet_addr_cmp(&kr->addr, &t1->dst.u3) || -+ nf_inet_addr_cmp(&kr->addr, &t2->src.u3) || -+ nf_inet_addr_cmp(&kr->addr, &t2->dst.u3)); -+} -+ -+static ssize_t ct_file_write(struct file *file, const char __user *buf, -+ size_t count, loff_t *ppos) -+{ -+ struct seq_file *seq = file->private_data; -+ struct net *net = seq_file_net(seq); -+ struct kill_request kr = { }; -+ char req[INET6_ADDRSTRLEN] = { }; -+ -+ if (count == 0) -+ return 0; -+ -+ if (count >= INET6_ADDRSTRLEN) -+ count = INET6_ADDRSTRLEN - 1; -+ -+ if (copy_from_user(req, buf, count)) -+ return -EFAULT; -+ -+ if (strnchr(req, count, ':')) { -+ kr.family = AF_INET6; -+ if (!in6_pton(req, count, (void *)&kr.addr, '\n', NULL)) -+ return -EINVAL; -+ } else if (strnchr(req, count, '.')) { -+ kr.family = AF_INET; -+ if (!in4_pton(req, count, (void *)&kr.addr, '\n', NULL)) -+ return -EINVAL; -+ } -+ -+ nf_ct_iterate_cleanup(net, kill_matching, &kr, 0, 0); -+ -+ return count; -+} -+ - static const struct file_operations ct_file_ops = { - .owner = THIS_MODULE, - .open = ct_open, - .read = seq_read, -+ .write = ct_file_write, - .llseek = seq_lseek, - .release = seq_release_net, - }; -@@ -405,7 +462,7 @@ static int nf_conntrack_standalone_init_ - kuid_t root_uid; - kgid_t root_gid; - -- pde = proc_create("nf_conntrack", 0440, net->proc_net, &ct_file_ops); -+ pde = proc_create("nf_conntrack", 0660, net->proc_net, &ct_file_ops); - if (!pde) - goto out_nf_conntrack; - diff --git a/target/linux/generic/pending-4.9/610-netfilter_match_bypass_default_checks.patch b/target/linux/generic/pending-4.9/610-netfilter_match_bypass_default_checks.patch deleted file mode 100644 index d3a6afa804..0000000000 --- a/target/linux/generic/pending-4.9/610-netfilter_match_bypass_default_checks.patch +++ /dev/null @@ -1,110 +0,0 @@ -From: Felix Fietkau -Subject: kernel: add a new version of my netfilter speedup patches for linux 2.6.39 and 3.0 - -Signed-off-by: Felix Fietkau ---- - include/uapi/linux/netfilter_ipv4/ip_tables.h | 1 + - net/ipv4/netfilter/ip_tables.c | 37 +++++++++++++++++++++++++++ - 2 files changed, 38 insertions(+) - ---- a/include/uapi/linux/netfilter_ipv4/ip_tables.h -+++ b/include/uapi/linux/netfilter_ipv4/ip_tables.h -@@ -88,6 +88,7 @@ struct ipt_ip { - #define IPT_F_FRAG 0x01 /* Set if rule is a fragment rule */ - #define IPT_F_GOTO 0x02 /* Set if jump is a goto */ - #define IPT_F_MASK 0x03 /* All possible flag bits mask. */ -+#define IPT_F_NO_DEF_MATCH 0x80 /* Internal: no default match rules present */ - - /* Values for "inv" field in struct ipt_ip. */ - #define IPT_INV_VIA_IN 0x01 /* Invert the sense of IN IFACE. */ ---- a/net/ipv4/netfilter/ip_tables.c -+++ b/net/ipv4/netfilter/ip_tables.c -@@ -58,6 +58,9 @@ ip_packet_match(const struct iphdr *ip, - { - unsigned long ret; - -+ if (ipinfo->flags & IPT_F_NO_DEF_MATCH) -+ return true; -+ - if (NF_INVF(ipinfo, IPT_INV_SRCIP, - (ip->saddr & ipinfo->smsk.s_addr) != ipinfo->src.s_addr) || - NF_INVF(ipinfo, IPT_INV_DSTIP, -@@ -88,6 +91,29 @@ ip_packet_match(const struct iphdr *ip, - return true; - } - -+static void -+ip_checkdefault(struct ipt_ip *ip) -+{ -+ static const char iface_mask[IFNAMSIZ] = {}; -+ -+ if (ip->invflags || ip->flags & IPT_F_FRAG) -+ return; -+ -+ if (memcmp(ip->iniface_mask, iface_mask, IFNAMSIZ) != 0) -+ return; -+ -+ if (memcmp(ip->outiface_mask, iface_mask, IFNAMSIZ) != 0) -+ return; -+ -+ if (ip->smsk.s_addr || ip->dmsk.s_addr) -+ return; -+ -+ if (ip->proto) -+ return; -+ -+ ip->flags |= IPT_F_NO_DEF_MATCH; -+} -+ - static bool - ip_checkentry(const struct ipt_ip *ip) - { -@@ -550,6 +576,8 @@ find_check_entry(struct ipt_entry *e, st - struct xt_mtchk_param mtpar; - struct xt_entry_match *ematch; - -+ ip_checkdefault(&e->ip); -+ - if (!xt_percpu_counter_alloc(alloc_state, &e->counters)) - return -ENOMEM; - -@@ -830,6 +858,7 @@ copy_entries_to_user(unsigned int total_ - const struct xt_table_info *private = table->private; - int ret = 0; - const void *loc_cpu_entry; -+ u8 flags; - - counters = alloc_counters(table); - if (IS_ERR(counters)) -@@ -857,6 +886,14 @@ copy_entries_to_user(unsigned int total_ - goto free_counters; - } - -+ flags = e->ip.flags & IPT_F_MASK; -+ if (copy_to_user(userptr + off -+ + offsetof(struct ipt_entry, ip.flags), -+ &flags, sizeof(flags)) != 0) { -+ ret = -EFAULT; -+ goto free_counters; -+ } -+ - for (i = sizeof(struct ipt_entry); - i < e->target_offset; - i += m->u.match_size) { -@@ -1246,12 +1283,15 @@ compat_copy_entry_to_user(struct ipt_ent - compat_uint_t origsize; - const struct xt_entry_match *ematch; - int ret = 0; -+ u8 flags = e->ip.flags & IPT_F_MASK; - - origsize = *size; - ce = (struct compat_ipt_entry __user *)*dstptr; - if (copy_to_user(ce, e, sizeof(struct ipt_entry)) != 0 || - copy_to_user(&ce->counters, &counters[i], -- sizeof(counters[i])) != 0) -+ sizeof(counters[i])) != 0 || -+ copy_to_user(&ce->ip.flags, &flags, -+ sizeof(flags)) != 0) - return -EFAULT; - - *dstptr += sizeof(struct compat_ipt_entry); diff --git a/target/linux/generic/pending-4.9/611-netfilter_match_bypass_default_table.patch b/target/linux/generic/pending-4.9/611-netfilter_match_bypass_default_table.patch deleted file mode 100644 index 12e4bd5c57..0000000000 --- a/target/linux/generic/pending-4.9/611-netfilter_match_bypass_default_table.patch +++ /dev/null @@ -1,119 +0,0 @@ -From: Felix Fietkau -Subject: netfilter: match bypass default table - -Signed-off-by: Felix Fietkau ---- - net/ipv4/netfilter/ip_tables.c | 79 +++++++++++++++++++++++++++++++----------- - 1 file changed, 58 insertions(+), 21 deletions(-) - ---- a/net/ipv4/netfilter/ip_tables.c -+++ b/net/ipv4/netfilter/ip_tables.c -@@ -254,6 +254,33 @@ struct ipt_entry *ipt_next_entry(const s - return (void *)entry + entry->next_offset; - } - -+static bool -+ipt_handle_default_rule(struct ipt_entry *e, unsigned int *verdict) -+{ -+ struct xt_entry_target *t; -+ struct xt_standard_target *st; -+ -+ if (e->target_offset != sizeof(struct ipt_entry)) -+ return false; -+ -+ if (!(e->ip.flags & IPT_F_NO_DEF_MATCH)) -+ return false; -+ -+ t = ipt_get_target(e); -+ if (t->u.kernel.target->target) -+ return false; -+ -+ st = (struct xt_standard_target *) t; -+ if (st->verdict == XT_RETURN) -+ return false; -+ -+ if (st->verdict >= 0) -+ return false; -+ -+ *verdict = (unsigned)(-st->verdict) - 1; -+ return true; -+} -+ - /* Returns one of the generic firewall policies, like NF_ACCEPT. */ - unsigned int - ipt_do_table(struct sk_buff *skb, -@@ -274,28 +301,8 @@ ipt_do_table(struct sk_buff *skb, - unsigned int addend; - - /* Initialization */ -- stackidx = 0; -- ip = ip_hdr(skb); -- indev = state->in ? state->in->name : nulldevname; -- outdev = state->out ? state->out->name : nulldevname; -- /* We handle fragments by dealing with the first fragment as -- * if it was a normal packet. All other fragments are treated -- * normally, except that they will NEVER match rules that ask -- * things we don't know, ie. tcp syn flag or ports). If the -- * rule is also a fragment-specific rule, non-fragments won't -- * match it. */ -- acpar.fragoff = ntohs(ip->frag_off) & IP_OFFSET; -- acpar.thoff = ip_hdrlen(skb); -- acpar.hotdrop = false; -- acpar.net = state->net; -- acpar.in = state->in; -- acpar.out = state->out; -- acpar.family = NFPROTO_IPV4; -- acpar.hooknum = hook; -- - IP_NF_ASSERT(table->valid_hooks & (1 << hook)); - local_bh_disable(); -- addend = xt_write_recseq_begin(); - private = table->private; - cpu = smp_processor_id(); - /* -@@ -304,6 +311,23 @@ ipt_do_table(struct sk_buff *skb, - */ - smp_read_barrier_depends(); - table_base = private->entries; -+ -+ e = get_entry(table_base, private->hook_entry[hook]); -+ if (ipt_handle_default_rule(e, &verdict)) { -+ struct xt_counters *counter; -+ -+ counter = xt_get_this_cpu_counter(&e->counters); -+ ADD_COUNTER(*counter, skb->len, 1); -+ local_bh_enable(); -+ return verdict; -+ } -+ -+ stackidx = 0; -+ ip = ip_hdr(skb); -+ indev = state->in ? state->in->name : nulldevname; -+ outdev = state->out ? state->out->name : nulldevname; -+ -+ addend = xt_write_recseq_begin(); - jumpstack = (struct ipt_entry **)private->jumpstack[cpu]; - - /* Switch to alternate jumpstack if we're being invoked via TEE. -@@ -316,7 +340,20 @@ ipt_do_table(struct sk_buff *skb, - if (static_key_false(&xt_tee_enabled)) - jumpstack += private->stacksize * __this_cpu_read(nf_skb_duplicated); - -- e = get_entry(table_base, private->hook_entry[hook]); -+ /* We handle fragments by dealing with the first fragment as -+ * if it was a normal packet. All other fragments are treated -+ * normally, except that they will NEVER match rules that ask -+ * things we don't know, ie. tcp syn flag or ports). If the -+ * rule is also a fragment-specific rule, non-fragments won't -+ * match it. */ -+ acpar.fragoff = ntohs(ip->frag_off) & IP_OFFSET; -+ acpar.thoff = ip_hdrlen(skb); -+ acpar.hotdrop = false; -+ acpar.net = state->net; -+ acpar.in = state->in; -+ acpar.out = state->out; -+ acpar.family = NFPROTO_IPV4; -+ acpar.hooknum = hook; - - do { - const struct xt_entry_target *t; diff --git a/target/linux/generic/pending-4.9/612-netfilter_match_reduce_memory_access.patch b/target/linux/generic/pending-4.9/612-netfilter_match_reduce_memory_access.patch deleted file mode 100644 index c6c5172d2f..0000000000 --- a/target/linux/generic/pending-4.9/612-netfilter_match_reduce_memory_access.patch +++ /dev/null @@ -1,22 +0,0 @@ -From: Felix Fietkau -Subject: netfilter: reduce match memory access - -Signed-off-by: Felix Fietkau ---- - net/ipv4/netfilter/ip_tables.c | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - ---- a/net/ipv4/netfilter/ip_tables.c -+++ b/net/ipv4/netfilter/ip_tables.c -@@ -61,9 +61,9 @@ ip_packet_match(const struct iphdr *ip, - if (ipinfo->flags & IPT_F_NO_DEF_MATCH) - return true; - -- if (NF_INVF(ipinfo, IPT_INV_SRCIP, -+ if (NF_INVF(ipinfo, IPT_INV_SRCIP, ipinfo->smsk.s_addr && - (ip->saddr & ipinfo->smsk.s_addr) != ipinfo->src.s_addr) || -- NF_INVF(ipinfo, IPT_INV_DSTIP, -+ NF_INVF(ipinfo, IPT_INV_DSTIP, ipinfo->dmsk.s_addr && - (ip->daddr & ipinfo->dmsk.s_addr) != ipinfo->dst.s_addr)) - return false; - diff --git a/target/linux/generic/pending-4.9/613-netfilter_optional_tcp_window_check.patch b/target/linux/generic/pending-4.9/613-netfilter_optional_tcp_window_check.patch deleted file mode 100644 index 78a9617762..0000000000 --- a/target/linux/generic/pending-4.9/613-netfilter_optional_tcp_window_check.patch +++ /dev/null @@ -1,44 +0,0 @@ -From: Felix Fietkau -Subject: netfilter: optional tcp window check - -Signed-off-by: Felix Fietkau ---- - net/netfilter/nf_conntrack_proto_tcp.c | 13 +++++++++++++ - 1 file changed, 13 insertions(+) - ---- a/net/netfilter/nf_conntrack_proto_tcp.c -+++ b/net/netfilter/nf_conntrack_proto_tcp.c -@@ -33,6 +33,9 @@ - #include - #include - -+/* Do not check the TCP window for incoming packets */ -+static int nf_ct_tcp_no_window_check __read_mostly = 1; -+ - /* "Be conservative in what you do, - be liberal in what you accept from others." - If it's non-zero, we mark only out of window RST segments as INVALID. */ -@@ -513,6 +516,9 @@ static bool tcp_in_window(const struct n - s32 receiver_offset; - bool res, in_recv_win; - -+ if (nf_ct_tcp_no_window_check) -+ return true; -+ - /* - * Get the required data from the packet. - */ -@@ -1479,6 +1485,13 @@ static struct ctl_table tcp_sysctl_table - .mode = 0644, - .proc_handler = proc_dointvec, - }, -+ { -+ .procname = "nf_conntrack_tcp_no_window_check", -+ .data = &nf_ct_tcp_no_window_check, -+ .maxlen = sizeof(unsigned int), -+ .mode = 0644, -+ .proc_handler = proc_dointvec, -+ }, - { } - }; - #endif /* CONFIG_SYSCTL */ diff --git a/target/linux/generic/pending-4.9/616-net_optimize_xfrm_calls.patch b/target/linux/generic/pending-4.9/616-net_optimize_xfrm_calls.patch deleted file mode 100644 index a147f5f94f..0000000000 --- a/target/linux/generic/pending-4.9/616-net_optimize_xfrm_calls.patch +++ /dev/null @@ -1,20 +0,0 @@ -From: Felix Fietkau -Subject: kernel: add a small xfrm related performance optimization - -Signed-off-by: Felix Fietkau ---- - net/netfilter/nf_nat_core.c | 3 +++ - 1 file changed, 3 insertions(+) - ---- a/net/netfilter/nf_nat_core.c -+++ b/net/netfilter/nf_nat_core.c -@@ -93,6 +93,9 @@ int nf_xfrm_me_harder(struct net *net, s - struct dst_entry *dst; - int err; - -+ if (skb->dev && !dev_net(skb->dev)->xfrm.policy_count[XFRM_POLICY_OUT]) -+ return 0; -+ - err = xfrm_decode_session(skb, &fl, family); - if (err < 0) - return err; diff --git a/target/linux/generic/pending-4.9/620-net_sched-codel-do-not-defer-queue-length-update.patch b/target/linux/generic/pending-4.9/620-net_sched-codel-do-not-defer-queue-length-update.patch deleted file mode 100644 index 6fe863a9e5..0000000000 --- a/target/linux/generic/pending-4.9/620-net_sched-codel-do-not-defer-queue-length-update.patch +++ /dev/null @@ -1,86 +0,0 @@ -From: Konstantin Khlebnikov -Date: Mon, 21 Aug 2017 11:14:14 +0300 -Subject: [PATCH] net_sched/codel: do not defer queue length update - -When codel wants to drop last packet in ->dequeue() it cannot call -qdisc_tree_reduce_backlog() right away - it will notify parent qdisc -about zero qlen and HTB/HFSC will deactivate class. The same class will -be deactivated second time by caller of ->dequeue(). Currently codel and -fq_codel defer update. This triggers warning in HFSC when it's qlen != 0 -but there is no active classes. - -This patch update parent queue length immediately: just temporary increase -qlen around qdisc_tree_reduce_backlog() to prevent first class deactivation -if we have skb to return. - -This might open another problem in HFSC - now operation peek could fail and -deactivate parent class. - -Signed-off-by: Konstantin Khlebnikov -Link: https://bugzilla.kernel.org/show_bug.cgi?id=109581 ---- - ---- a/net/sched/sch_codel.c -+++ b/net/sched/sch_codel.c -@@ -95,11 +95,17 @@ static struct sk_buff *codel_qdisc_deque - &q->stats, qdisc_pkt_len, codel_get_enqueue_time, - drop_func, dequeue_func); - -- /* We cant call qdisc_tree_reduce_backlog() if our qlen is 0, -- * or HTB crashes. Defer it for next round. -+ /* If our qlen is 0 qdisc_tree_reduce_backlog() will deactivate -+ * parent class, dequeue in parent qdisc will do the same if we -+ * return skb. Temporary increment qlen if we have skb. - */ -- if (q->stats.drop_count && sch->q.qlen) { -- qdisc_tree_reduce_backlog(sch, q->stats.drop_count, q->stats.drop_len); -+ if (q->stats.drop_count) { -+ if (skb) -+ sch->q.qlen++; -+ qdisc_tree_reduce_backlog(sch, q->stats.drop_count, -+ q->stats.drop_len); -+ if (skb) -+ sch->q.qlen--; - q->stats.drop_count = 0; - q->stats.drop_len = 0; - } ---- a/net/sched/sch_fq_codel.c -+++ b/net/sched/sch_fq_codel.c -@@ -318,6 +318,21 @@ begin: - flow->dropped += q->cstats.drop_count - prev_drop_count; - flow->dropped += q->cstats.ecn_mark - prev_ecn_mark; - -+ /* If our qlen is 0 qdisc_tree_reduce_backlog() will deactivate -+ * parent class, dequeue in parent qdisc will do the same if we -+ * return skb. Temporary increment qlen if we have skb. -+ */ -+ if (q->cstats.drop_count) { -+ if (skb) -+ sch->q.qlen++; -+ qdisc_tree_reduce_backlog(sch, q->cstats.drop_count, -+ q->cstats.drop_len); -+ if (skb) -+ sch->q.qlen--; -+ q->cstats.drop_count = 0; -+ q->cstats.drop_len = 0; -+ } -+ - if (!skb) { - /* force a pass through old_flows to prevent starvation */ - if ((head == &q->new_flows) && !list_empty(&q->old_flows)) -@@ -328,15 +343,6 @@ begin: - } - qdisc_bstats_update(sch, skb); - flow->deficit -= qdisc_pkt_len(skb); -- /* We cant call qdisc_tree_reduce_backlog() if our qlen is 0, -- * or HTB crashes. Defer it for next round. -- */ -- if (q->cstats.drop_count && sch->q.qlen) { -- qdisc_tree_reduce_backlog(sch, q->cstats.drop_count, -- q->cstats.drop_len); -- q->cstats.drop_count = 0; -- q->cstats.drop_len = 0; -- } - return skb; - } - diff --git a/target/linux/generic/pending-4.9/630-packet_socket_type.patch b/target/linux/generic/pending-4.9/630-packet_socket_type.patch deleted file mode 100644 index 13a544736d..0000000000 --- a/target/linux/generic/pending-4.9/630-packet_socket_type.patch +++ /dev/null @@ -1,138 +0,0 @@ -From: Felix Fietkau -Subject: net: add an optimization for dealing with raw sockets - -lede-commit: 4898039703d7315f0f3431c860123338ec3be0f6 -Signed-off-by: Felix Fietkau ---- - include/uapi/linux/if_packet.h | 3 +++ - net/packet/af_packet.c | 34 +++++++++++++++++++++++++++------- - net/packet/internal.h | 1 + - 3 files changed, 31 insertions(+), 7 deletions(-) - ---- a/include/uapi/linux/if_packet.h -+++ b/include/uapi/linux/if_packet.h -@@ -31,6 +31,8 @@ struct sockaddr_ll { - #define PACKET_KERNEL 7 /* To kernel space */ - /* Unused, PACKET_FASTROUTE and PACKET_LOOPBACK are invisible to user space */ - #define PACKET_FASTROUTE 6 /* Fastrouted frame */ -+#define PACKET_MASK_ANY 0xffffffff /* mask for packet type bits */ -+ - - /* Packet socket options */ - -@@ -56,6 +58,7 @@ struct sockaddr_ll { - #define PACKET_QDISC_BYPASS 20 - #define PACKET_ROLLOVER_STATS 21 - #define PACKET_FANOUT_DATA 22 -+#define PACKET_RECV_TYPE 23 - - #define PACKET_FANOUT_HASH 0 - #define PACKET_FANOUT_LB 1 ---- a/net/packet/af_packet.c -+++ b/net/packet/af_packet.c -@@ -1780,6 +1780,7 @@ static int packet_rcv_spkt(struct sk_buf - { - struct sock *sk; - struct sockaddr_pkt *spkt; -+ struct packet_sock *po; - - /* - * When we registered the protocol we saved the socket in the data -@@ -1787,6 +1788,7 @@ static int packet_rcv_spkt(struct sk_buf - */ - - sk = pt->af_packet_priv; -+ po = pkt_sk(sk); - - /* - * Yank back the headers [hope the device set this -@@ -1799,7 +1801,7 @@ static int packet_rcv_spkt(struct sk_buf - * so that this procedure is noop. - */ - -- if (skb->pkt_type == PACKET_LOOPBACK) -+ if (!(po->pkt_type & (1 << skb->pkt_type))) - goto out; - - if (!net_eq(dev_net(dev), sock_net(sk))) -@@ -2037,12 +2039,12 @@ static int packet_rcv(struct sk_buff *sk - unsigned int snaplen, res; - bool is_drop_n_account = false; - -- if (skb->pkt_type == PACKET_LOOPBACK) -- goto drop; -- - sk = pt->af_packet_priv; - po = pkt_sk(sk); - -+ if (!(po->pkt_type & (1 << skb->pkt_type))) -+ goto drop; -+ - if (!net_eq(dev_net(dev), sock_net(sk))) - goto drop; - -@@ -2168,12 +2170,12 @@ static int tpacket_rcv(struct sk_buff *s - BUILD_BUG_ON(TPACKET_ALIGN(sizeof(*h.h2)) != 32); - BUILD_BUG_ON(TPACKET_ALIGN(sizeof(*h.h3)) != 48); - -- if (skb->pkt_type == PACKET_LOOPBACK) -- goto drop; -- - sk = pt->af_packet_priv; - po = pkt_sk(sk); - -+ if (!(po->pkt_type & (1 << skb->pkt_type))) -+ goto drop; -+ - if (!net_eq(dev_net(dev), sock_net(sk))) - goto drop; - -@@ -3266,6 +3268,7 @@ static int packet_create(struct net *net - mutex_init(&po->pg_vec_lock); - po->rollover = NULL; - po->prot_hook.func = packet_rcv; -+ po->pkt_type = PACKET_MASK_ANY & ~(1 << PACKET_LOOPBACK); - - if (sock->type == SOCK_PACKET) - po->prot_hook.func = packet_rcv_spkt; -@@ -3879,6 +3882,16 @@ packet_setsockopt(struct socket *sock, i - po->xmit = val ? packet_direct_xmit : dev_queue_xmit; - return 0; - } -+ case PACKET_RECV_TYPE: -+ { -+ unsigned int val; -+ if (optlen != sizeof(val)) -+ return -EINVAL; -+ if (copy_from_user(&val, optval, sizeof(val))) -+ return -EFAULT; -+ po->pkt_type = val & ~BIT(PACKET_LOOPBACK); -+ return 0; -+ } - default: - return -ENOPROTOOPT; - } -@@ -3931,6 +3944,13 @@ static int packet_getsockopt(struct sock - case PACKET_VNET_HDR: - val = po->has_vnet_hdr; - break; -+ case PACKET_RECV_TYPE: -+ if (len > sizeof(unsigned int)) -+ len = sizeof(unsigned int); -+ val = po->pkt_type; -+ -+ data = &val; -+ break; - case PACKET_VERSION: - val = po->tp_version; - break; ---- a/net/packet/internal.h -+++ b/net/packet/internal.h -@@ -128,6 +128,7 @@ struct packet_sock { - struct net_device __rcu *cached_dev; - int (*xmit)(struct sk_buff *skb); - struct packet_type prot_hook ____cacheline_aligned_in_smp; -+ unsigned int pkt_type; - }; - - static struct packet_sock *pkt_sk(struct sock *sk) diff --git a/target/linux/generic/pending-4.9/655-increase_skb_pad.patch b/target/linux/generic/pending-4.9/655-increase_skb_pad.patch deleted file mode 100644 index de96d9a41d..0000000000 --- a/target/linux/generic/pending-4.9/655-increase_skb_pad.patch +++ /dev/null @@ -1,20 +0,0 @@ -From: Felix Fietkau -Subject: kernel: add a few patches for avoiding unnecessary skb reallocations - significantly improves ethernet<->wireless performance - -lede-commit: 6f89cffc9add6939d44a6b54cf9a5e77849aa7fd -Signed-off-by: Felix Fietkau ---- - include/linux/skbuff.h | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - ---- a/include/linux/skbuff.h -+++ b/include/linux/skbuff.h -@@ -2303,7 +2303,7 @@ static inline int pskb_network_may_pull( - * NET_IP_ALIGN(2) + ethernet_header(14) + IP_header(20/40) + ports(8) - */ - #ifndef NET_SKB_PAD --#define NET_SKB_PAD max(32, L1_CACHE_BYTES) -+#define NET_SKB_PAD max(64, L1_CACHE_BYTES) - #endif - - int ___pskb_trim(struct sk_buff *skb, unsigned int len); diff --git a/target/linux/generic/pending-4.9/666-Add-support-for-MAP-E-FMRs-mesh-mode.patch b/target/linux/generic/pending-4.9/666-Add-support-for-MAP-E-FMRs-mesh-mode.patch deleted file mode 100644 index af9a5b1914..0000000000 --- a/target/linux/generic/pending-4.9/666-Add-support-for-MAP-E-FMRs-mesh-mode.patch +++ /dev/null @@ -1,500 +0,0 @@ -From: Steven Barth -Subject: Add support for MAP-E FMRs (mesh mode) - -MAP-E FMRs (draft-ietf-softwire-map-10) are rules for IPv4-communication -between MAP CEs (mesh mode) without the need to forward such data to a -border relay. This is similar to how 6rd works but for IPv4 over IPv6. - -Signed-off-by: Steven Barth ---- - include/net/ip6_tunnel.h | 13 ++ - include/uapi/linux/if_tunnel.h | 13 ++ - net/ipv6/ip6_tunnel.c | 276 +++++++++++++++++++++++++++++++++++++++-- - 3 files changed, 291 insertions(+), 11 deletions(-) - ---- a/include/net/ip6_tunnel.h -+++ b/include/net/ip6_tunnel.h -@@ -17,6 +17,18 @@ - /* determine capability on a per-packet basis */ - #define IP6_TNL_F_CAP_PER_PACKET 0x40000 - -+/* IPv6 tunnel FMR */ -+struct __ip6_tnl_fmr { -+ struct __ip6_tnl_fmr *next; /* next fmr in list */ -+ struct in6_addr ip6_prefix; -+ struct in_addr ip4_prefix; -+ -+ __u8 ip6_prefix_len; -+ __u8 ip4_prefix_len; -+ __u8 ea_len; -+ __u8 offset; -+}; -+ - struct __ip6_tnl_parm { - char name[IFNAMSIZ]; /* name of tunnel device */ - int link; /* ifindex of underlying L2 interface */ -@@ -28,6 +40,7 @@ struct __ip6_tnl_parm { - __u32 flags; /* tunnel flags */ - struct in6_addr laddr; /* local tunnel end-point address */ - struct in6_addr raddr; /* remote tunnel end-point address */ -+ struct __ip6_tnl_fmr *fmrs; /* FMRs */ - - __be16 i_flags; - __be16 o_flags; ---- a/include/uapi/linux/if_tunnel.h -+++ b/include/uapi/linux/if_tunnel.h -@@ -75,10 +75,23 @@ enum { - IFLA_IPTUN_ENCAP_SPORT, - IFLA_IPTUN_ENCAP_DPORT, - IFLA_IPTUN_COLLECT_METADATA, -+ IFLA_IPTUN_FMRS, - __IFLA_IPTUN_MAX, - }; - #define IFLA_IPTUN_MAX (__IFLA_IPTUN_MAX - 1) - -+enum { -+ IFLA_IPTUN_FMR_UNSPEC, -+ IFLA_IPTUN_FMR_IP6_PREFIX, -+ IFLA_IPTUN_FMR_IP4_PREFIX, -+ IFLA_IPTUN_FMR_IP6_PREFIX_LEN, -+ IFLA_IPTUN_FMR_IP4_PREFIX_LEN, -+ IFLA_IPTUN_FMR_EA_LEN, -+ IFLA_IPTUN_FMR_OFFSET, -+ __IFLA_IPTUN_FMR_MAX, -+}; -+#define IFLA_IPTUN_FMR_MAX (__IFLA_IPTUN_FMR_MAX - 1) -+ - enum tunnel_encap_types { - TUNNEL_ENCAP_NONE, - TUNNEL_ENCAP_FOU, ---- a/net/ipv6/ip6_tunnel.c -+++ b/net/ipv6/ip6_tunnel.c -@@ -16,6 +16,8 @@ - * as published by the Free Software Foundation; either version - * 2 of the License, or (at your option) any later version. - * -+ * Changes: -+ * Steven Barth : MAP-E FMR support - */ - - #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt -@@ -72,9 +74,9 @@ static bool log_ecn_error = true; - module_param(log_ecn_error, bool, 0644); - MODULE_PARM_DESC(log_ecn_error, "Log packets received with corrupted ECN"); - --static u32 HASH(const struct in6_addr *addr1, const struct in6_addr *addr2) -+static u32 HASH(const struct in6_addr *addr) - { -- u32 hash = ipv6_addr_hash(addr1) ^ ipv6_addr_hash(addr2); -+ u32 hash = ipv6_addr_hash(addr); - - return hash_32(hash, IP6_TUNNEL_HASH_SIZE_SHIFT); - } -@@ -141,20 +143,29 @@ static struct net_device_stats *ip6_get_ - static struct ip6_tnl * - ip6_tnl_lookup(struct net *net, const struct in6_addr *remote, const struct in6_addr *local) - { -- unsigned int hash = HASH(remote, local); -+ unsigned int hash = HASH(local); - struct ip6_tnl *t; - struct ip6_tnl_net *ip6n = net_generic(net, ip6_tnl_net_id); - struct in6_addr any; -+ struct __ip6_tnl_fmr *fmr; - - for_each_ip6_tunnel_rcu(ip6n->tnls_r_l[hash]) { -- if (ipv6_addr_equal(local, &t->parms.laddr) && -- ipv6_addr_equal(remote, &t->parms.raddr) && -- (t->dev->flags & IFF_UP)) -+ if (!ipv6_addr_equal(local, &t->parms.laddr) || -+ !(t->dev->flags & IFF_UP)) -+ continue; -+ -+ if (ipv6_addr_equal(remote, &t->parms.raddr)) - return t; -+ -+ for (fmr = t->parms.fmrs; fmr; fmr = fmr->next) { -+ if (ipv6_prefix_equal(remote, &fmr->ip6_prefix, -+ fmr->ip6_prefix_len)) -+ return t; -+ } - } - - memset(&any, 0, sizeof(any)); -- hash = HASH(&any, local); -+ hash = HASH(local); - for_each_ip6_tunnel_rcu(ip6n->tnls_r_l[hash]) { - if (ipv6_addr_equal(local, &t->parms.laddr) && - ipv6_addr_any(&t->parms.raddr) && -@@ -162,7 +173,7 @@ ip6_tnl_lookup(struct net *net, const st - return t; - } - -- hash = HASH(remote, &any); -+ hash = HASH(&any); - for_each_ip6_tunnel_rcu(ip6n->tnls_r_l[hash]) { - if (ipv6_addr_equal(remote, &t->parms.raddr) && - ipv6_addr_any(&t->parms.laddr) && -@@ -202,7 +213,7 @@ ip6_tnl_bucket(struct ip6_tnl_net *ip6n, - - if (!ipv6_addr_any(remote) || !ipv6_addr_any(local)) { - prio = 1; -- h = HASH(remote, local); -+ h = HASH(local); - } - return &ip6n->tnls[prio][h]; - } -@@ -384,6 +395,12 @@ ip6_tnl_dev_uninit(struct net_device *de - struct net *net = t->net; - struct ip6_tnl_net *ip6n = net_generic(net, ip6_tnl_net_id); - -+ while (t->parms.fmrs) { -+ struct __ip6_tnl_fmr *next = t->parms.fmrs->next; -+ kfree(t->parms.fmrs); -+ t->parms.fmrs = next; -+ } -+ - if (dev == ip6n->fb_tnl_dev) - RCU_INIT_POINTER(ip6n->tnls_wc[0], NULL); - else -@@ -780,6 +797,107 @@ int ip6_tnl_rcv_ctl(struct ip6_tnl *t, - } - EXPORT_SYMBOL_GPL(ip6_tnl_rcv_ctl); - -+/** -+ * ip4ip6_fmr_calc - calculate target / source IPv6-address based on FMR -+ * @dest: destination IPv6 address buffer -+ * @skb: received socket buffer -+ * @fmr: MAP FMR -+ * @xmit: Calculate for xmit or rcv -+ **/ -+static void ip4ip6_fmr_calc(struct in6_addr *dest, -+ const struct iphdr *iph, const uint8_t *end, -+ const struct __ip6_tnl_fmr *fmr, bool xmit) -+{ -+ int psidlen = fmr->ea_len - (32 - fmr->ip4_prefix_len); -+ u8 *portp = NULL; -+ bool use_dest_addr; -+ const struct iphdr *dsth = iph; -+ -+ if ((u8*)dsth >= end) -+ return; -+ -+ /* find significant IP header */ -+ if (iph->protocol == IPPROTO_ICMP) { -+ struct icmphdr *ih = (struct icmphdr*)(((u8*)dsth) + dsth->ihl * 4); -+ if (ih && ((u8*)&ih[1]) <= end && ( -+ ih->type == ICMP_DEST_UNREACH || -+ ih->type == ICMP_SOURCE_QUENCH || -+ ih->type == ICMP_TIME_EXCEEDED || -+ ih->type == ICMP_PARAMETERPROB || -+ ih->type == ICMP_REDIRECT)) -+ dsth = (const struct iphdr*)&ih[1]; -+ } -+ -+ /* in xmit-path use dest port by default and source port only if -+ this is an ICMP reply to something else; vice versa in rcv-path */ -+ use_dest_addr = (xmit && dsth == iph) || (!xmit && dsth != iph); -+ -+ /* get dst port */ -+ if (((u8*)&dsth[1]) <= end && ( -+ dsth->protocol == IPPROTO_UDP || -+ dsth->protocol == IPPROTO_TCP || -+ dsth->protocol == IPPROTO_SCTP || -+ dsth->protocol == IPPROTO_DCCP)) { -+ /* for UDP, TCP, SCTP and DCCP source and dest port -+ follow IPv4 header directly */ -+ portp = ((u8*)dsth) + dsth->ihl * 4; -+ -+ if (use_dest_addr) -+ portp += sizeof(u16); -+ } else if (iph->protocol == IPPROTO_ICMP) { -+ struct icmphdr *ih = (struct icmphdr*)(((u8*)dsth) + dsth->ihl * 4); -+ -+ /* use icmp identifier as port */ -+ if (((u8*)&ih) <= end && ( -+ (use_dest_addr && ( -+ ih->type == ICMP_ECHOREPLY || -+ ih->type == ICMP_TIMESTAMPREPLY || -+ ih->type == ICMP_INFO_REPLY || -+ ih->type == ICMP_ADDRESSREPLY)) || -+ (!use_dest_addr && ( -+ ih->type == ICMP_ECHO || -+ ih->type == ICMP_TIMESTAMP || -+ ih->type == ICMP_INFO_REQUEST || -+ ih->type == ICMP_ADDRESS) -+ ))) -+ portp = (u8*)&ih->un.echo.id; -+ } -+ -+ if ((portp && &portp[2] <= end) || psidlen == 0) { -+ int frombyte = fmr->ip6_prefix_len / 8; -+ int fromrem = fmr->ip6_prefix_len % 8; -+ int bytes = sizeof(struct in6_addr) - frombyte; -+ const u32 *addr = (use_dest_addr) ? &iph->daddr : &iph->saddr; -+ u64 eabits = ((u64)ntohl(*addr)) << (32 + fmr->ip4_prefix_len); -+ u64 t = 0; -+ -+ /* extract PSID from port and add it to eabits */ -+ u16 psidbits = 0; -+ if (psidlen > 0) { -+ psidbits = ((u16)portp[0]) << 8 | ((u16)portp[1]); -+ psidbits >>= 16 - psidlen - fmr->offset; -+ psidbits = (u16)(psidbits << (16 - psidlen)); -+ eabits |= ((u64)psidbits) << (48 - (fmr->ea_len - psidlen)); -+ } -+ -+ /* rewrite destination address */ -+ *dest = fmr->ip6_prefix; -+ memcpy(&dest->s6_addr[10], addr, sizeof(*addr)); -+ dest->s6_addr16[7] = htons(psidbits >> (16 - psidlen)); -+ -+ if (bytes > sizeof(u64)) -+ bytes = sizeof(u64); -+ -+ /* insert eabits */ -+ memcpy(&t, &dest->s6_addr[frombyte], bytes); -+ t = be64_to_cpu(t) & ~(((((u64)1) << fmr->ea_len) - 1) -+ << (64 - fmr->ea_len - fromrem)); -+ t = cpu_to_be64(t | (eabits >> fromrem)); -+ memcpy(&dest->s6_addr[frombyte], &t, bytes); -+ } -+} -+ -+ - static int __ip6_tnl_rcv(struct ip6_tnl *tunnel, struct sk_buff *skb, - const struct tnl_ptk_info *tpi, - struct metadata_dst *tun_dst, -@@ -832,6 +950,27 @@ static int __ip6_tnl_rcv(struct ip6_tnl - skb_reset_network_header(skb); - memset(skb->cb, 0, sizeof(struct inet6_skb_parm)); - -+ if (tpi->proto == htons(ETH_P_IP) && tunnel->parms.fmrs && -+ !ipv6_addr_equal(&ipv6h->saddr, &tunnel->parms.raddr)) { -+ /* Packet didn't come from BR, so lookup FMR */ -+ struct __ip6_tnl_fmr *fmr; -+ struct in6_addr expected = tunnel->parms.raddr; -+ for (fmr = tunnel->parms.fmrs; fmr; fmr = fmr->next) -+ if (ipv6_prefix_equal(&ipv6h->saddr, -+ &fmr->ip6_prefix, fmr->ip6_prefix_len)) -+ break; -+ -+ /* Check that IPv6 matches IPv4 source to prevent spoofing */ -+ if (fmr) -+ ip4ip6_fmr_calc(&expected, ip_hdr(skb), -+ skb_tail_pointer(skb), fmr, false); -+ -+ if (!ipv6_addr_equal(&ipv6h->saddr, &expected)) { -+ rcu_read_unlock(); -+ goto drop; -+ } -+ } -+ - __skb_tunnel_rx(skb, tunnel->dev, tunnel->net); - - err = dscp_ecn_decapsulate(tunnel, ipv6h, skb); -@@ -962,6 +1101,7 @@ static void init_tel_txopt(struct ipv6_t - opt->ops.opt_nflen = 8; - } - -+ - /** - * ip6_tnl_addr_conflict - compare packet addresses to tunnel's own - * @t: the outgoing tunnel device -@@ -1300,6 +1440,7 @@ ip6ip6_tnl_xmit(struct sk_buff *skb, str - { - struct ip6_tnl *t = netdev_priv(dev); - struct ipv6hdr *ipv6h; -+ struct __ip6_tnl_fmr *fmr; - int encap_limit = -1; - __u16 offset; - struct flowi6 fl6; -@@ -1362,6 +1503,18 @@ ip6ip6_tnl_xmit(struct sk_buff *skb, str - fl6.flowi6_mark = skb->mark; - } - -+ /* try to find matching FMR */ -+ for (fmr = t->parms.fmrs; fmr; fmr = fmr->next) { -+ unsigned mshift = 32 - fmr->ip4_prefix_len; -+ if (ntohl(fmr->ip4_prefix.s_addr) >> mshift == -+ ntohl(ip_hdr(skb)->daddr) >> mshift) -+ break; -+ } -+ -+ /* change dstaddr according to FMR */ -+ if (fmr) -+ ip4ip6_fmr_calc(&fl6.daddr, ip_hdr(skb), skb_tail_pointer(skb), fmr, true); -+ - if (iptunnel_handle_offloads(skb, SKB_GSO_IPXIP6)) - return -1; - -@@ -1489,6 +1642,14 @@ ip6_tnl_change(struct ip6_tnl *t, const - t->parms.flowinfo = p->flowinfo; - t->parms.link = p->link; - t->parms.proto = p->proto; -+ -+ while (t->parms.fmrs) { -+ struct __ip6_tnl_fmr *next = t->parms.fmrs->next; -+ kfree(t->parms.fmrs); -+ t->parms.fmrs = next; -+ } -+ t->parms.fmrs = p->fmrs; -+ - dst_cache_reset(&t->dst_cache); - ip6_tnl_link_config(t); - return 0; -@@ -1527,6 +1688,7 @@ ip6_tnl_parm_from_user(struct __ip6_tnl_ - p->flowinfo = u->flowinfo; - p->link = u->link; - p->proto = u->proto; -+ p->fmrs = NULL; - memcpy(p->name, u->name, sizeof(u->name)); - } - -@@ -1904,6 +2066,15 @@ static int ip6_tnl_validate(struct nlatt - return 0; - } - -+static const struct nla_policy ip6_tnl_fmr_policy[IFLA_IPTUN_FMR_MAX + 1] = { -+ [IFLA_IPTUN_FMR_IP6_PREFIX] = { .len = sizeof(struct in6_addr) }, -+ [IFLA_IPTUN_FMR_IP4_PREFIX] = { .len = sizeof(struct in_addr) }, -+ [IFLA_IPTUN_FMR_IP6_PREFIX_LEN] = { .type = NLA_U8 }, -+ [IFLA_IPTUN_FMR_IP4_PREFIX_LEN] = { .type = NLA_U8 }, -+ [IFLA_IPTUN_FMR_EA_LEN] = { .type = NLA_U8 }, -+ [IFLA_IPTUN_FMR_OFFSET] = { .type = NLA_U8 } -+}; -+ - static void ip6_tnl_netlink_parms(struct nlattr *data[], - struct __ip6_tnl_parm *parms) - { -@@ -1938,6 +2109,46 @@ static void ip6_tnl_netlink_parms(struct - - if (data[IFLA_IPTUN_COLLECT_METADATA]) - parms->collect_md = true; -+ -+ if (data[IFLA_IPTUN_FMRS]) { -+ unsigned rem; -+ struct nlattr *fmr; -+ nla_for_each_nested(fmr, data[IFLA_IPTUN_FMRS], rem) { -+ struct nlattr *fmrd[IFLA_IPTUN_FMR_MAX + 1], *c; -+ struct __ip6_tnl_fmr *nfmr; -+ -+ nla_parse_nested(fmrd, IFLA_IPTUN_FMR_MAX, -+ fmr, ip6_tnl_fmr_policy); -+ -+ if (!(nfmr = kzalloc(sizeof(*nfmr), GFP_KERNEL))) -+ continue; -+ -+ nfmr->offset = 6; -+ -+ if ((c = fmrd[IFLA_IPTUN_FMR_IP6_PREFIX])) -+ nla_memcpy(&nfmr->ip6_prefix, fmrd[IFLA_IPTUN_FMR_IP6_PREFIX], -+ sizeof(nfmr->ip6_prefix)); -+ -+ if ((c = fmrd[IFLA_IPTUN_FMR_IP4_PREFIX])) -+ nla_memcpy(&nfmr->ip4_prefix, fmrd[IFLA_IPTUN_FMR_IP4_PREFIX], -+ sizeof(nfmr->ip4_prefix)); -+ -+ if ((c = fmrd[IFLA_IPTUN_FMR_IP6_PREFIX_LEN])) -+ nfmr->ip6_prefix_len = nla_get_u8(c); -+ -+ if ((c = fmrd[IFLA_IPTUN_FMR_IP4_PREFIX_LEN])) -+ nfmr->ip4_prefix_len = nla_get_u8(c); -+ -+ if ((c = fmrd[IFLA_IPTUN_FMR_EA_LEN])) -+ nfmr->ea_len = nla_get_u8(c); -+ -+ if ((c = fmrd[IFLA_IPTUN_FMR_OFFSET])) -+ nfmr->offset = nla_get_u8(c); -+ -+ nfmr->next = parms->fmrs; -+ parms->fmrs = nfmr; -+ } -+ } - } - - static bool ip6_tnl_netlink_encap_parms(struct nlattr *data[], -@@ -2051,6 +2262,12 @@ static void ip6_tnl_dellink(struct net_d - - static size_t ip6_tnl_get_size(const struct net_device *dev) - { -+ const struct ip6_tnl *t = netdev_priv(dev); -+ struct __ip6_tnl_fmr *c; -+ int fmrs = 0; -+ for (c = t->parms.fmrs; c; c = c->next) -+ ++fmrs; -+ - return - /* IFLA_IPTUN_LINK */ - nla_total_size(4) + -@@ -2078,6 +2295,24 @@ static size_t ip6_tnl_get_size(const str - nla_total_size(2) + - /* IFLA_IPTUN_COLLECT_METADATA */ - nla_total_size(0) + -+ /* IFLA_IPTUN_FMRS */ -+ nla_total_size(0) + -+ ( -+ /* nest */ -+ nla_total_size(0) + -+ /* IFLA_IPTUN_FMR_IP6_PREFIX */ -+ nla_total_size(sizeof(struct in6_addr)) + -+ /* IFLA_IPTUN_FMR_IP4_PREFIX */ -+ nla_total_size(sizeof(struct in_addr)) + -+ /* IFLA_IPTUN_FMR_EA_LEN */ -+ nla_total_size(1) + -+ /* IFLA_IPTUN_FMR_IP6_PREFIX_LEN */ -+ nla_total_size(1) + -+ /* IFLA_IPTUN_FMR_IP4_PREFIX_LEN */ -+ nla_total_size(1) + -+ /* IFLA_IPTUN_FMR_OFFSET */ -+ nla_total_size(1) -+ ) * fmrs + - 0; - } - -@@ -2085,6 +2320,9 @@ static int ip6_tnl_fill_info(struct sk_b - { - struct ip6_tnl *tunnel = netdev_priv(dev); - struct __ip6_tnl_parm *parm = &tunnel->parms; -+ struct __ip6_tnl_fmr *c; -+ int fmrcnt = 0; -+ struct nlattr *fmrs; - - if (nla_put_u32(skb, IFLA_IPTUN_LINK, parm->link) || - nla_put_in6_addr(skb, IFLA_IPTUN_LOCAL, &parm->laddr) || -@@ -2093,9 +2331,27 @@ static int ip6_tnl_fill_info(struct sk_b - nla_put_u8(skb, IFLA_IPTUN_ENCAP_LIMIT, parm->encap_limit) || - nla_put_be32(skb, IFLA_IPTUN_FLOWINFO, parm->flowinfo) || - nla_put_u32(skb, IFLA_IPTUN_FLAGS, parm->flags) || -- nla_put_u8(skb, IFLA_IPTUN_PROTO, parm->proto)) -+ nla_put_u8(skb, IFLA_IPTUN_PROTO, parm->proto) || -+ !(fmrs = nla_nest_start(skb, IFLA_IPTUN_FMRS))) - goto nla_put_failure; - -+ for (c = parm->fmrs; c; c = c->next) { -+ struct nlattr *fmr = nla_nest_start(skb, ++fmrcnt); -+ if (!fmr || -+ nla_put(skb, IFLA_IPTUN_FMR_IP6_PREFIX, -+ sizeof(c->ip6_prefix), &c->ip6_prefix) || -+ nla_put(skb, IFLA_IPTUN_FMR_IP4_PREFIX, -+ sizeof(c->ip4_prefix), &c->ip4_prefix) || -+ nla_put_u8(skb, IFLA_IPTUN_FMR_IP6_PREFIX_LEN, c->ip6_prefix_len) || -+ nla_put_u8(skb, IFLA_IPTUN_FMR_IP4_PREFIX_LEN, c->ip4_prefix_len) || -+ nla_put_u8(skb, IFLA_IPTUN_FMR_EA_LEN, c->ea_len) || -+ nla_put_u8(skb, IFLA_IPTUN_FMR_OFFSET, c->offset)) -+ goto nla_put_failure; -+ -+ nla_nest_end(skb, fmr); -+ } -+ nla_nest_end(skb, fmrs); -+ - if (nla_put_u16(skb, IFLA_IPTUN_ENCAP_TYPE, tunnel->encap.type) || - nla_put_be16(skb, IFLA_IPTUN_ENCAP_SPORT, tunnel->encap.sport) || - nla_put_be16(skb, IFLA_IPTUN_ENCAP_DPORT, tunnel->encap.dport) || -@@ -2133,6 +2389,7 @@ static const struct nla_policy ip6_tnl_p - [IFLA_IPTUN_ENCAP_SPORT] = { .type = NLA_U16 }, - [IFLA_IPTUN_ENCAP_DPORT] = { .type = NLA_U16 }, - [IFLA_IPTUN_COLLECT_METADATA] = { .type = NLA_FLAG }, -+ [IFLA_IPTUN_FMRS] = { .type = NLA_NESTED }, - }; - - static struct rtnl_link_ops ip6_link_ops __read_mostly = { diff --git a/target/linux/generic/pending-4.9/670-ipv6-allow-rejecting-with-source-address-failed-policy.patch b/target/linux/generic/pending-4.9/670-ipv6-allow-rejecting-with-source-address-failed-policy.patch deleted file mode 100644 index 3f6b406cf2..0000000000 --- a/target/linux/generic/pending-4.9/670-ipv6-allow-rejecting-with-source-address-failed-policy.patch +++ /dev/null @@ -1,255 +0,0 @@ -From: Jonas Gorski -Subject: ipv6: allow rejecting with "source address failed policy" - -RFC6204 L-14 requires rejecting traffic from invalid addresses with -ICMPv6 Destination Unreachable, Code 5 (Source address failed ingress/ -egress policy) on the LAN side, so add an appropriate rule for that. - -Signed-off-by: Jonas Gorski ---- - include/net/netns/ipv6.h | 1 + - include/uapi/linux/fib_rules.h | 4 +++ - include/uapi/linux/rtnetlink.h | 1 + - net/ipv4/fib_semantics.c | 4 +++ - net/ipv4/fib_trie.c | 1 + - net/ipv4/ipmr.c | 1 + - net/ipv6/fib6_rules.c | 4 +++ - net/ipv6/ip6mr.c | 2 ++ - net/ipv6/route.c | 58 +++++++++++++++++++++++++++++++++++++++++- - 9 files changed, 75 insertions(+), 1 deletion(-) - ---- a/include/net/netns/ipv6.h -+++ b/include/net/netns/ipv6.h -@@ -66,6 +66,7 @@ struct netns_ipv6 { - unsigned long ip6_rt_last_gc; - #ifdef CONFIG_IPV6_MULTIPLE_TABLES - struct rt6_info *ip6_prohibit_entry; -+ struct rt6_info *ip6_policy_failed_entry; - struct rt6_info *ip6_blk_hole_entry; - struct fib6_table *fib6_local_tbl; - struct fib_rules_ops *fib6_rules_ops; ---- a/include/uapi/linux/fib_rules.h -+++ b/include/uapi/linux/fib_rules.h -@@ -66,6 +66,10 @@ enum { - FR_ACT_BLACKHOLE, /* Drop without notification */ - FR_ACT_UNREACHABLE, /* Drop with ENETUNREACH */ - FR_ACT_PROHIBIT, /* Drop with EACCES */ -+ FR_ACT_RES9, -+ FR_ACT_RES10, -+ FR_ACT_RES11, -+ FR_ACT_POLICY_FAILED, /* Drop with EACCES */ - __FR_ACT_MAX, - }; - ---- a/include/uapi/linux/rtnetlink.h -+++ b/include/uapi/linux/rtnetlink.h -@@ -215,6 +215,7 @@ enum { - RTN_THROW, /* Not in this table */ - RTN_NAT, /* Translate this address */ - RTN_XRESOLVE, /* Use external resolver */ -+ RTN_POLICY_FAILED, /* Failed ingress/egress policy */ - __RTN_MAX - }; - ---- a/net/ipv4/fib_semantics.c -+++ b/net/ipv4/fib_semantics.c -@@ -138,6 +138,10 @@ const struct fib_prop fib_props[RTN_MAX - .error = -EINVAL, - .scope = RT_SCOPE_NOWHERE, - }, -+ [RTN_POLICY_FAILED] = { -+ .error = -EACCES, -+ .scope = RT_SCOPE_UNIVERSE, -+ }, - }; - - static void rt_fibinfo_free(struct rtable __rcu **rtp) ---- a/net/ipv4/fib_trie.c -+++ b/net/ipv4/fib_trie.c -@@ -2406,6 +2406,7 @@ static const char *const rtn_type_names[ - [RTN_THROW] = "THROW", - [RTN_NAT] = "NAT", - [RTN_XRESOLVE] = "XRESOLVE", -+ [RTN_POLICY_FAILED] = "POLICY_FAILED", - }; - - static inline const char *rtn_type(char *buf, size_t len, unsigned int t) ---- a/net/ipv4/ipmr.c -+++ b/net/ipv4/ipmr.c -@@ -159,6 +159,7 @@ static int ipmr_rule_action(struct fib_r - case FR_ACT_UNREACHABLE: - return -ENETUNREACH; - case FR_ACT_PROHIBIT: -+ case FR_ACT_POLICY_FAILED: - return -EACCES; - case FR_ACT_BLACKHOLE: - default: ---- a/net/ipv6/fib6_rules.c -+++ b/net/ipv6/fib6_rules.c -@@ -77,6 +77,10 @@ static int fib6_rule_action(struct fib_r - err = -EACCES; - rt = net->ipv6.ip6_prohibit_entry; - goto discard_pkt; -+ case FR_ACT_POLICY_FAILED: -+ err = -EACCES; -+ rt = net->ipv6.ip6_policy_failed_entry; -+ goto discard_pkt; - } - - tb_id = fib_rule_get_table(rule, arg); ---- a/net/ipv6/ip6mr.c -+++ b/net/ipv6/ip6mr.c -@@ -169,6 +169,8 @@ static int ip6mr_rule_action(struct fib_ - return -ENETUNREACH; - case FR_ACT_PROHIBIT: - return -EACCES; -+ case FR_ACT_POLICY_FAILED: -+ return -EACCES; - case FR_ACT_BLACKHOLE: - default: - return -EINVAL; ---- a/net/ipv6/route.c -+++ b/net/ipv6/route.c -@@ -91,6 +91,8 @@ static int ip6_pkt_discard(struct sk_bu - static int ip6_pkt_discard_out(struct net *net, struct sock *sk, struct sk_buff *skb); - static int ip6_pkt_prohibit(struct sk_buff *skb); - static int ip6_pkt_prohibit_out(struct net *net, struct sock *sk, struct sk_buff *skb); -+static int ip6_pkt_policy_failed(struct sk_buff *skb); -+static int ip6_pkt_policy_failed_out(struct net *net, struct sock *sk, struct sk_buff *skb); - static void ip6_link_failure(struct sk_buff *skb); - static void ip6_rt_update_pmtu(struct dst_entry *dst, struct sock *sk, - struct sk_buff *skb, u32 mtu); -@@ -300,6 +302,21 @@ static const struct rt6_info ip6_prohibi - .rt6i_ref = ATOMIC_INIT(1), - }; - -+static const struct rt6_info ip6_policy_failed_entry_template = { -+ .dst = { -+ .__refcnt = ATOMIC_INIT(1), -+ .__use = 1, -+ .obsolete = DST_OBSOLETE_FORCE_CHK, -+ .error = -EACCES, -+ .input = ip6_pkt_policy_failed, -+ .output = ip6_pkt_policy_failed_out, -+ }, -+ .rt6i_flags = (RTF_REJECT | RTF_NONEXTHOP), -+ .rt6i_protocol = RTPROT_KERNEL, -+ .rt6i_metric = ~(u32) 0, -+ .rt6i_ref = ATOMIC_INIT(1), -+}; -+ - static const struct rt6_info ip6_blk_hole_entry_template = { - .dst = { - .__refcnt = ATOMIC_INIT(1), -@@ -1970,6 +1987,11 @@ static struct rt6_info *ip6_route_info_c - rt->dst.output = ip6_pkt_prohibit_out; - rt->dst.input = ip6_pkt_prohibit; - break; -+ case RTN_POLICY_FAILED: -+ rt->dst.error = -EACCES; -+ rt->dst.output = ip6_pkt_policy_failed_out; -+ rt->dst.input = ip6_pkt_policy_failed; -+ break; - case RTN_THROW: - case RTN_UNREACHABLE: - default: -@@ -2613,6 +2635,17 @@ static int ip6_pkt_prohibit_out(struct n - return ip6_pkt_drop(skb, ICMPV6_ADM_PROHIBITED, IPSTATS_MIB_OUTNOROUTES); - } - -+static int ip6_pkt_policy_failed(struct sk_buff *skb) -+{ -+ return ip6_pkt_drop(skb, ICMPV6_POLICY_FAIL, IPSTATS_MIB_INNOROUTES); -+} -+ -+static int ip6_pkt_policy_failed_out(struct net *net, struct sock *sk, struct sk_buff *skb) -+{ -+ skb->dev = skb_dst(skb)->dev; -+ return ip6_pkt_drop(skb, ICMPV6_POLICY_FAIL, IPSTATS_MIB_OUTNOROUTES); -+} -+ - /* - * Allocate a dst for local (unicast / anycast) address. - */ -@@ -2850,7 +2883,8 @@ static int rtm_to_fib6_config(struct sk_ - if (rtm->rtm_type == RTN_UNREACHABLE || - rtm->rtm_type == RTN_BLACKHOLE || - rtm->rtm_type == RTN_PROHIBIT || -- rtm->rtm_type == RTN_THROW) -+ rtm->rtm_type == RTN_THROW || -+ rtm->rtm_type == RTN_POLICY_FAILED) - cfg->fc_flags |= RTF_REJECT; - - if (rtm->rtm_type == RTN_LOCAL) -@@ -3222,6 +3256,9 @@ static int rt6_fill_node(struct net *net - case -EACCES: - rtm->rtm_type = RTN_PROHIBIT; - break; -+ case -EPERM: -+ rtm->rtm_type = RTN_POLICY_FAILED; -+ break; - case -EAGAIN: - rtm->rtm_type = RTN_THROW; - break; -@@ -3498,6 +3535,8 @@ static int ip6_route_dev_notify(struct n - #ifdef CONFIG_IPV6_MULTIPLE_TABLES - net->ipv6.ip6_prohibit_entry->dst.dev = dev; - net->ipv6.ip6_prohibit_entry->rt6i_idev = in6_dev_get(dev); -+ net->ipv6.ip6_policy_failed_entry->dst.dev = dev; -+ net->ipv6.ip6_policy_failed_entry->rt6i_idev = in6_dev_get(dev); - net->ipv6.ip6_blk_hole_entry->dst.dev = dev; - net->ipv6.ip6_blk_hole_entry->rt6i_idev = in6_dev_get(dev); - #endif -@@ -3509,6 +3548,7 @@ static int ip6_route_dev_notify(struct n - in6_dev_put(net->ipv6.ip6_null_entry->rt6i_idev); - #ifdef CONFIG_IPV6_MULTIPLE_TABLES - in6_dev_put(net->ipv6.ip6_prohibit_entry->rt6i_idev); -+ in6_dev_put(net->ipv6.ip6_policy_failed_entry->rt6i_idev); - in6_dev_put(net->ipv6.ip6_blk_hole_entry->rt6i_idev); - #endif - } -@@ -3724,6 +3764,17 @@ static int __net_init ip6_route_net_init - net->ipv6.ip6_blk_hole_entry->dst.ops = &net->ipv6.ip6_dst_ops; - dst_init_metrics(&net->ipv6.ip6_blk_hole_entry->dst, - ip6_template_metrics, true); -+ -+ net->ipv6.ip6_policy_failed_entry = -+ kmemdup(&ip6_policy_failed_entry_template, -+ sizeof(*net->ipv6.ip6_policy_failed_entry), GFP_KERNEL); -+ if (!net->ipv6.ip6_policy_failed_entry) -+ goto out_ip6_blk_hole_entry; -+ net->ipv6.ip6_policy_failed_entry->dst.path = -+ (struct dst_entry *)net->ipv6.ip6_policy_failed_entry; -+ net->ipv6.ip6_policy_failed_entry->dst.ops = &net->ipv6.ip6_dst_ops; -+ dst_init_metrics(&net->ipv6.ip6_policy_failed_entry->dst, -+ ip6_template_metrics, true); - #endif - - net->ipv6.sysctl.flush_delay = 0; -@@ -3742,6 +3793,8 @@ out: - return ret; - - #ifdef CONFIG_IPV6_MULTIPLE_TABLES -+out_ip6_blk_hole_entry: -+ kfree(net->ipv6.ip6_blk_hole_entry); - out_ip6_prohibit_entry: - kfree(net->ipv6.ip6_prohibit_entry); - out_ip6_null_entry: -@@ -3759,6 +3812,7 @@ static void __net_exit ip6_route_net_exi - #ifdef CONFIG_IPV6_MULTIPLE_TABLES - kfree(net->ipv6.ip6_prohibit_entry); - kfree(net->ipv6.ip6_blk_hole_entry); -+ kfree(net->ipv6.ip6_policy_failed_entry); - #endif - dst_entries_destroy(&net->ipv6.ip6_dst_ops); - } -@@ -3832,6 +3886,9 @@ void __init ip6_route_init_special_entri - init_net.ipv6.ip6_prohibit_entry->rt6i_idev = in6_dev_get(init_net.loopback_dev); - init_net.ipv6.ip6_blk_hole_entry->dst.dev = init_net.loopback_dev; - init_net.ipv6.ip6_blk_hole_entry->rt6i_idev = in6_dev_get(init_net.loopback_dev); -+ init_net.ipv6.ip6_policy_failed_entry->dst.dev = init_net.loopback_dev; -+ init_net.ipv6.ip6_policy_failed_entry->rt6i_idev = -+ in6_dev_get(init_net.loopback_dev); - #endif - } - diff --git a/target/linux/generic/pending-4.9/671-net-provide-defines-for-_POLICY_FAILED-until-all-cod.patch b/target/linux/generic/pending-4.9/671-net-provide-defines-for-_POLICY_FAILED-until-all-cod.patch deleted file mode 100644 index cd627667d3..0000000000 --- a/target/linux/generic/pending-4.9/671-net-provide-defines-for-_POLICY_FAILED-until-all-cod.patch +++ /dev/null @@ -1,50 +0,0 @@ -From: Jonas Gorski -Subject: net: provide defines for _POLICY_FAILED until all code is updated - -Upstream introduced ICMPV6_POLICY_FAIL for code 5 of destination -unreachable, conflicting with our name. - -Add appropriate defines to allow our code to build with the new -name until we have updated our local patches for older kernels -and userspace packages. - -Signed-off-by: Jonas Gorski ---- - include/uapi/linux/fib_rules.h | 2 ++ - include/uapi/linux/icmpv6.h | 2 ++ - include/uapi/linux/rtnetlink.h | 2 ++ - 3 files changed, 6 insertions(+) - ---- a/include/uapi/linux/fib_rules.h -+++ b/include/uapi/linux/fib_rules.h -@@ -73,6 +73,8 @@ enum { - __FR_ACT_MAX, - }; - -+#define FR_ACT_FAILED_POLICY FR_ACT_POLICY_FAILED -+ - #define FR_ACT_MAX (__FR_ACT_MAX - 1) - - #endif ---- a/include/uapi/linux/icmpv6.h -+++ b/include/uapi/linux/icmpv6.h -@@ -118,6 +118,8 @@ struct icmp6hdr { - #define ICMPV6_POLICY_FAIL 5 - #define ICMPV6_REJECT_ROUTE 6 - -+#define ICMPV6_FAILED_POLICY ICMPV6_POLICY_FAIL -+ - /* - * Codes for Time Exceeded - */ ---- a/include/uapi/linux/rtnetlink.h -+++ b/include/uapi/linux/rtnetlink.h -@@ -219,6 +219,8 @@ enum { - __RTN_MAX - }; - -+#define RTN_FAILED_POLICY RTN_POLICY_FAILED -+ - #define RTN_MAX (__RTN_MAX - 1) - - diff --git a/target/linux/generic/pending-4.9/680-NET-skip-GRO-for-foreign-MAC-addresses.patch b/target/linux/generic/pending-4.9/680-NET-skip-GRO-for-foreign-MAC-addresses.patch deleted file mode 100644 index d113be6439..0000000000 --- a/target/linux/generic/pending-4.9/680-NET-skip-GRO-for-foreign-MAC-addresses.patch +++ /dev/null @@ -1,154 +0,0 @@ -From: Felix Fietkau -Subject: net: replace GRO optimization patch with a new one that supports VLANs/bridges with different MAC addresses - -Signed-off-by: Felix Fietkau ---- - include/linux/netdevice.h | 2 ++ - include/linux/skbuff.h | 3 ++- - net/core/dev.c | 48 +++++++++++++++++++++++++++++++++++++++++++++++ - net/ethernet/eth.c | 18 +++++++++++++++++- - 4 files changed, 69 insertions(+), 2 deletions(-) - ---- a/include/linux/netdevice.h -+++ b/include/linux/netdevice.h -@@ -1752,6 +1752,8 @@ struct net_device { - struct netdev_hw_addr_list mc; - struct netdev_hw_addr_list dev_addrs; - -+ unsigned char local_addr_mask[MAX_ADDR_LEN]; -+ - #ifdef CONFIG_SYSFS - struct kset *queues_kset; - #endif ---- a/include/linux/skbuff.h -+++ b/include/linux/skbuff.h -@@ -747,7 +747,8 @@ struct sk_buff { - #ifdef CONFIG_NET_SWITCHDEV - __u8 offload_fwd_mark:1; - #endif -- /* 2, 4 or 5 bit hole */ -+ __u8 gro_skip:1; -+ /* 1, 3 or 4 bit hole */ - - #ifdef CONFIG_NET_SCHED - __u16 tc_index; /* traffic control index */ ---- a/net/core/dev.c -+++ b/net/core/dev.c -@@ -4572,6 +4572,9 @@ static enum gro_result dev_gro_receive(s - enum gro_result ret; - int grow; - -+ if (skb->gro_skip) -+ goto normal; -+ - if (!(skb->dev->features & NETIF_F_GRO)) - goto normal; - -@@ -5864,6 +5867,48 @@ static void __netdev_adjacent_dev_unlink - &upper_dev->adj_list.lower); - } - -+static void __netdev_addr_mask(unsigned char *mask, const unsigned char *addr, -+ struct net_device *dev) -+{ -+ int i; -+ -+ for (i = 0; i < dev->addr_len; i++) -+ mask[i] |= addr[i] ^ dev->dev_addr[i]; -+} -+ -+static void __netdev_upper_mask(unsigned char *mask, struct net_device *dev, -+ struct net_device *lower) -+{ -+ struct net_device *cur; -+ struct list_head *iter; -+ -+ netdev_for_each_upper_dev_rcu(dev, cur, iter) { -+ __netdev_addr_mask(mask, cur->dev_addr, lower); -+ __netdev_upper_mask(mask, cur, lower); -+ } -+} -+ -+static void __netdev_update_addr_mask(struct net_device *dev) -+{ -+ unsigned char mask[MAX_ADDR_LEN]; -+ struct net_device *cur; -+ struct list_head *iter; -+ -+ memset(mask, 0, sizeof(mask)); -+ __netdev_upper_mask(mask, dev, dev); -+ memcpy(dev->local_addr_mask, mask, dev->addr_len); -+ -+ netdev_for_each_lower_dev(dev, cur, iter) -+ __netdev_update_addr_mask(cur); -+} -+ -+static void netdev_update_addr_mask(struct net_device *dev) -+{ -+ rcu_read_lock(); -+ __netdev_update_addr_mask(dev); -+ rcu_read_unlock(); -+} -+ - static int __netdev_upper_dev_link(struct net_device *dev, - struct net_device *upper_dev, bool master, - void *upper_priv, void *upper_info) -@@ -5936,6 +5981,7 @@ static int __netdev_upper_dev_link(struc - goto rollback_lower_mesh; - } - -+ netdev_update_addr_mask(dev); - ret = call_netdevice_notifiers_info(NETDEV_CHANGEUPPER, dev, - &changeupper_info.info); - ret = notifier_to_errno(ret); -@@ -6062,6 +6108,7 @@ void netdev_upper_dev_unlink(struct net_ - list_for_each_entry(i, &upper_dev->all_adj_list.upper, list) - __netdev_adjacent_dev_unlink(dev, i->dev, i->ref_nr); - -+ netdev_update_addr_mask(dev); - call_netdevice_notifiers_info(NETDEV_CHANGEUPPER, dev, - &changeupper_info.info); - } -@@ -6664,6 +6711,7 @@ int dev_set_mac_address(struct net_devic - if (err) - return err; - dev->addr_assign_type = NET_ADDR_SET; -+ netdev_update_addr_mask(dev); - call_netdevice_notifiers(NETDEV_CHANGEADDR, dev); - add_device_randomness(dev->dev_addr, dev->addr_len); - return 0; ---- a/net/ethernet/eth.c -+++ b/net/ethernet/eth.c -@@ -143,6 +143,18 @@ u32 eth_get_headlen(void *data, unsigned - } - EXPORT_SYMBOL(eth_get_headlen); - -+static inline bool -+eth_check_local_mask(const void *addr1, const void *addr2, const void *mask) -+{ -+ const u16 *a1 = addr1; -+ const u16 *a2 = addr2; -+ const u16 *m = mask; -+ -+ return (((a1[0] ^ a2[0]) & ~m[0]) | -+ ((a1[1] ^ a2[1]) & ~m[1]) | -+ ((a1[2] ^ a2[2]) & ~m[2])); -+} -+ - /** - * eth_type_trans - determine the packet's protocol ID. - * @skb: received socket data -@@ -171,8 +183,12 @@ __be16 eth_type_trans(struct sk_buff *sk - skb->pkt_type = PACKET_MULTICAST; - } - else if (unlikely(!ether_addr_equal_64bits(eth->h_dest, -- dev->dev_addr))) -+ dev->dev_addr))) { - skb->pkt_type = PACKET_OTHERHOST; -+ if (eth_check_local_mask(eth->h_dest, dev->dev_addr, -+ dev->local_addr_mask)) -+ skb->gro_skip = 1; -+ } - - /* - * Some variants of DSA tagging don't have an ethertype field diff --git a/target/linux/generic/pending-4.9/681-NET-add-of_get_mac_address_mtd.patch b/target/linux/generic/pending-4.9/681-NET-add-of_get_mac_address_mtd.patch deleted file mode 100644 index b29b5f11b0..0000000000 --- a/target/linux/generic/pending-4.9/681-NET-add-of_get_mac_address_mtd.patch +++ /dev/null @@ -1,127 +0,0 @@ -From: John Crispin -Subject: NET: add mtd-mac-address support to of_get_mac_address() - -Many embedded devices have information such as mac addresses stored inside mtd -devices. This patch allows us to add a property inside a node describing a -network interface. The new property points at a mtd partition with an offset -where the mac address can be found. - -Signed-off-by: John Crispin -Signed-off-by: Felix Fietkau ---- - drivers/of/of_net.c | 37 +++++++++++++++++++++++++++++++++++++ - include/linux/of_net.h | 1 + - 2 files changed, 38 insertions(+) - ---- a/drivers/of/of_net.c -+++ b/drivers/of/of_net.c -@@ -10,6 +10,7 @@ - #include - #include - #include -+#include - - /** - * of_get_phy_mode - Get phy mode for given device_node -@@ -38,7 +39,7 @@ int of_get_phy_mode(struct device_node * - } - EXPORT_SYMBOL_GPL(of_get_phy_mode); - --static const void *of_get_mac_addr(struct device_node *np, const char *name) -+static void *of_get_mac_addr(struct device_node *np, const char *name) - { - struct property *pp = of_find_property(np, name, NULL); - -@@ -47,6 +48,73 @@ static const void *of_get_mac_addr(struc - return NULL; - } - -+static const void *of_get_mac_address_mtd(struct device_node *np) -+{ -+#ifdef CONFIG_MTD -+ struct device_node *mtd_np = NULL; -+ struct property *prop; -+ size_t retlen; -+ int size, ret; -+ struct mtd_info *mtd; -+ const char *part; -+ const __be32 *list; -+ phandle phandle; -+ u32 mac_inc = 0; -+ u8 mac[ETH_ALEN]; -+ void *addr; -+ -+ list = of_get_property(np, "mtd-mac-address", &size); -+ if (!list || (size != (2 * sizeof(*list)))) -+ return NULL; -+ -+ phandle = be32_to_cpup(list++); -+ if (phandle) -+ mtd_np = of_find_node_by_phandle(phandle); -+ -+ if (!mtd_np) -+ return NULL; -+ -+ part = of_get_property(mtd_np, "label", NULL); -+ if (!part) -+ part = mtd_np->name; -+ -+ mtd = get_mtd_device_nm(part); -+ if (IS_ERR(mtd)) -+ return NULL; -+ -+ ret = mtd_read(mtd, be32_to_cpup(list), 6, &retlen, mac); -+ put_mtd_device(mtd); -+ -+ if (!of_property_read_u32(np, "mtd-mac-address-increment", &mac_inc)) -+ mac[5] += mac_inc; -+ -+ if (!is_valid_ether_addr(mac)) -+ return NULL; -+ -+ addr = of_get_mac_addr(np, "mac-address"); -+ if (addr) { -+ memcpy(addr, mac, ETH_ALEN); -+ return addr; -+ } -+ -+ prop = kzalloc(sizeof(*prop), GFP_KERNEL); -+ if (!prop) -+ return NULL; -+ -+ prop->name = "mac-address"; -+ prop->length = ETH_ALEN; -+ prop->value = kmemdup(mac, ETH_ALEN, GFP_KERNEL); -+ if (!prop->value || of_add_property(np, prop)) -+ goto free; -+ -+ return prop->value; -+free: -+ kfree(prop->value); -+ kfree(prop); -+#endif -+ return NULL; -+} -+ - /** - * Search the device tree for the best MAC address to use. 'mac-address' is - * checked first, because that is supposed to contain to "most recent" MAC -@@ -64,11 +132,18 @@ static const void *of_get_mac_addr(struc - * addresses. Some older U-Boots only initialized 'local-mac-address'. In - * this case, the real MAC is in 'local-mac-address', and 'mac-address' exists - * but is all zeros. -+ * -+ * If a mtd-mac-address property exists, try to fetch the MAC address from the -+ * specified mtd device, and store it as a 'mac-address' property - */ - const void *of_get_mac_address(struct device_node *np) - { - const void *addr; - -+ addr = of_get_mac_address_mtd(np); -+ if (addr) -+ return addr; -+ - addr = of_get_mac_addr(np, "mac-address"); - if (addr) - return addr; diff --git a/target/linux/generic/pending-4.9/701-phy_extension.patch b/target/linux/generic/pending-4.9/701-phy_extension.patch deleted file mode 100644 index 628e1d31b9..0000000000 --- a/target/linux/generic/pending-4.9/701-phy_extension.patch +++ /dev/null @@ -1,72 +0,0 @@ -From: John Crispin -Subject: net: phy: add phy_ethtool_ioctl() - -Signed-off-by: John Crispin ---- - drivers/net/phy/phy.c | 44 ++++++++++++++++++++++++++++++++++++++++++++ - include/linux/phy.h | 1 + - 2 files changed, 45 insertions(+) - ---- a/drivers/net/phy/phy.c -+++ b/drivers/net/phy/phy.c -@@ -472,6 +472,50 @@ int phy_ethtool_ksettings_get(struct phy - } - EXPORT_SYMBOL(phy_ethtool_ksettings_get); - -+int phy_ethtool_ioctl(struct phy_device *phydev, void *useraddr) -+{ -+ u32 cmd; -+ int tmp; -+ struct ethtool_cmd ecmd = { ETHTOOL_GSET }; -+ struct ethtool_value edata = { ETHTOOL_GLINK }; -+ -+ if (get_user(cmd, (u32 *) useraddr)) -+ return -EFAULT; -+ -+ switch (cmd) { -+ case ETHTOOL_GSET: -+ phy_ethtool_gset(phydev, &ecmd); -+ if (copy_to_user(useraddr, &ecmd, sizeof(ecmd))) -+ return -EFAULT; -+ return 0; -+ -+ case ETHTOOL_SSET: -+ if (copy_from_user(&ecmd, useraddr, sizeof(ecmd))) -+ return -EFAULT; -+ return phy_ethtool_sset(phydev, &ecmd); -+ -+ case ETHTOOL_NWAY_RST: -+ /* if autoneg is off, it's an error */ -+ tmp = phy_read(phydev, MII_BMCR); -+ if (tmp & BMCR_ANENABLE) { -+ tmp |= (BMCR_ANRESTART); -+ phy_write(phydev, MII_BMCR, tmp); -+ return 0; -+ } -+ return -EINVAL; -+ -+ case ETHTOOL_GLINK: -+ edata.data = (phy_read(phydev, -+ MII_BMSR) & BMSR_LSTATUS) ? 1 : 0; -+ if (copy_to_user(useraddr, &edata, sizeof(edata))) -+ return -EFAULT; -+ return 0; -+ } -+ -+ return -EOPNOTSUPP; -+} -+EXPORT_SYMBOL(phy_ethtool_ioctl); -+ - /** - * phy_mii_ioctl - generic PHY MII ioctl interface - * @phydev: the phy_device struct ---- a/include/linux/phy.h -+++ b/include/linux/phy.h -@@ -827,6 +827,7 @@ int phy_ethtool_ksettings_get(struct phy - struct ethtool_link_ksettings *cmd); - int phy_ethtool_ksettings_set(struct phy_device *phydev, - const struct ethtool_link_ksettings *cmd); -+int phy_ethtool_ioctl(struct phy_device *phydev, void *useraddr); - int phy_mii_ioctl(struct phy_device *phydev, struct ifreq *ifr, int cmd); - int phy_start_interrupts(struct phy_device *phydev); - void phy_print_status(struct phy_device *phydev); diff --git a/target/linux/generic/pending-4.9/703-phy-add-detach-callback-to-struct-phy_driver.patch b/target/linux/generic/pending-4.9/703-phy-add-detach-callback-to-struct-phy_driver.patch deleted file mode 100644 index 5c7ae72bcb..0000000000 --- a/target/linux/generic/pending-4.9/703-phy-add-detach-callback-to-struct-phy_driver.patch +++ /dev/null @@ -1,38 +0,0 @@ -From: Gabor Juhos -Subject: generic: add detach callback to struct phy_driver - -lede-commit: fe61fc2d7d0b3fb348b502f68f98243b3ddf5867 - -Signed-off-by: Gabor Juhos ---- - drivers/net/phy/phy_device.c | 3 +++ - include/linux/phy.h | 6 ++++++ - 2 files changed, 9 insertions(+) - ---- a/drivers/net/phy/phy_device.c -+++ b/drivers/net/phy/phy_device.c -@@ -998,6 +998,9 @@ void phy_detach(struct phy_device *phyde - struct mii_bus *bus; - int i; - -+ if (phydev->drv && phydev->drv->detach) -+ phydev->drv->detach(phydev); -+ - phydev->attached_dev->phydev = NULL; - phydev->attached_dev = NULL; - phy_suspend(phydev); ---- a/include/linux/phy.h -+++ b/include/linux/phy.h -@@ -507,6 +507,12 @@ struct phy_driver { - */ - int (*did_interrupt)(struct phy_device *phydev); - -+ /* -+ * Called before an ethernet device is detached -+ * from the PHY. -+ */ -+ void (*detach)(struct phy_device *phydev); -+ - /* Clears up any memory if needed */ - void (*remove)(struct phy_device *phydev); - diff --git a/target/linux/generic/pending-4.9/734-net-phy-at803x-allow-to-configure-via-pdata.patch b/target/linux/generic/pending-4.9/734-net-phy-at803x-allow-to-configure-via-pdata.patch deleted file mode 100644 index 69b21be951..0000000000 --- a/target/linux/generic/pending-4.9/734-net-phy-at803x-allow-to-configure-via-pdata.patch +++ /dev/null @@ -1,142 +0,0 @@ -From: Gabor Juhos -Subject: net: phy: allow to configure AR803x PHYs via platform data - -Add a patch for the at803x phy driver, in order to be able -to configure some register settings via platform data. - -Signed-off-by: Gabor Juhos ---- - drivers/net/phy/at803x.c | 56 ++++++++++++++++++++++++++++++++ - include/linux/platform_data/phy-at803x.h | 11 +++++++ - 2 files changed, 67 insertions(+) - create mode 100644 include/linux/platform_data/phy-at803x.h - ---- a/drivers/net/phy/at803x.c -+++ b/drivers/net/phy/at803x.c -@@ -12,12 +12,14 @@ - */ - - #include -+#include - #include - #include - #include - #include - #include - #include -+#include - - #define AT803X_INTR_ENABLE 0x12 - #define AT803X_INTR_ENABLE_AUTONEG_ERR BIT(15) -@@ -45,6 +47,11 @@ - #define AT803X_REG_CHIP_CONFIG 0x1f - #define AT803X_BT_BX_REG_SEL 0x8000 - -+#define AT803X_PCS_SMART_EEE_CTRL3 0x805D -+#define AT803X_SMART_EEE_CTRL3_LPI_TX_DELAY_SEL_MASK 0x3 -+#define AT803X_SMART_EEE_CTRL3_LPI_TX_DELAY_SEL_SHIFT 12 -+#define AT803X_SMART_EEE_CTRL3_LPI_EN BIT(8) -+ - #define AT803X_DEBUG_ADDR 0x1D - #define AT803X_DEBUG_DATA 0x1E - -@@ -72,6 +79,7 @@ MODULE_LICENSE("GPL"); - struct at803x_priv { - bool phy_reset:1; - struct gpio_desc *gpiod_reset; -+ int prev_speed; - }; - - struct at803x_context { -@@ -276,8 +284,16 @@ does_not_require_reset_workaround: - return 0; - } - -+static void at803x_disable_smarteee(struct phy_device *phydev) -+{ -+ phy_write_mmd(phydev, MDIO_MMD_PCS, AT803X_PCS_SMART_EEE_CTRL3, -+ 1 << AT803X_SMART_EEE_CTRL3_LPI_TX_DELAY_SEL_SHIFT); -+ phy_write_mmd(phydev, MDIO_MMD_AN, MDIO_AN_EEE_ADV, 0); -+} -+ - static int at803x_config_init(struct phy_device *phydev) - { -+ struct at803x_platform_data *pdata; - int ret; - - ret = genphy_config_init(phydev); -@@ -298,6 +314,26 @@ static int at803x_config_init(struct phy - return ret; - } - -+ pdata = dev_get_platdata(&phydev->mdio.dev); -+ if (pdata) { -+ if (pdata->disable_smarteee) -+ at803x_disable_smarteee(phydev); -+ -+ if (pdata->enable_rgmii_rx_delay) -+ at803x_debug_reg_mask(phydev, AT803X_DEBUG_REG_0, 0, -+ AT803X_DEBUG_RX_CLK_DLY_EN); -+ else -+ at803x_debug_reg_mask(phydev, AT803X_DEBUG_REG_0, -+ AT803X_DEBUG_RX_CLK_DLY_EN, 0); -+ -+ if (pdata->enable_rgmii_tx_delay) -+ at803x_debug_reg_mask(phydev, AT803X_DEBUG_REG_5, 0, -+ AT803X_DEBUG_TX_CLK_DLY_EN); -+ else -+ at803x_debug_reg_mask(phydev, AT803X_DEBUG_REG_5, -+ AT803X_DEBUG_TX_CLK_DLY_EN, 0); -+ } -+ - return 0; - } - -@@ -335,6 +371,8 @@ static int at803x_config_intr(struct phy - static void at803x_link_change_notify(struct phy_device *phydev) - { - struct at803x_priv *priv = phydev->priv; -+ struct at803x_platform_data *pdata; -+ pdata = dev_get_platdata(&phydev->mdio.dev); - - /* - * Conduct a hardware reset for AT8030/2 every time a link loss is -@@ -363,6 +401,24 @@ static void at803x_link_change_notify(st - } else { - priv->phy_reset = false; - } -+ if (pdata && pdata->fixup_rgmii_tx_delay && -+ phydev->speed != priv->prev_speed) { -+ switch (phydev->speed) { -+ case SPEED_10: -+ case SPEED_100: -+ at803x_debug_reg_mask(phydev, AT803X_DEBUG_REG_5, 0, -+ AT803X_DEBUG_TX_CLK_DLY_EN); -+ break; -+ case SPEED_1000: -+ at803x_debug_reg_mask(phydev, AT803X_DEBUG_REG_5, -+ AT803X_DEBUG_TX_CLK_DLY_EN, 0); -+ break; -+ default: -+ break; -+ } -+ -+ priv->prev_speed = phydev->speed; -+ } - } - - static int at803x_aneg_done(struct phy_device *phydev) ---- /dev/null -+++ b/include/linux/platform_data/phy-at803x.h -@@ -0,0 +1,11 @@ -+#ifndef _PHY_AT803X_PDATA_H -+#define _PHY_AT803X_PDATA_H -+ -+struct at803x_platform_data { -+ int disable_smarteee:1; -+ int enable_rgmii_tx_delay:1; -+ int enable_rgmii_rx_delay:1; -+ int fixup_rgmii_tx_delay:1; -+}; -+ -+#endif /* _PHY_AT803X_PDATA_H */ diff --git a/target/linux/generic/pending-4.9/735-net-phy-at803x-fix-at8033-sgmii-mode.patch b/target/linux/generic/pending-4.9/735-net-phy-at803x-fix-at8033-sgmii-mode.patch deleted file mode 100644 index 381b2d09fa..0000000000 --- a/target/linux/generic/pending-4.9/735-net-phy-at803x-fix-at8033-sgmii-mode.patch +++ /dev/null @@ -1,51 +0,0 @@ -From: Roman Yeryomin -Subject: kernel: add at803x fix for sgmii mode - -Some (possibly broken) bootloaders incorreclty initialize at8033 -phy. This patch enables sgmii autonegotiation mode. - -[john@phrozen.org: felix added this to his upstream queue] - -Signed-off-by: Roman Yeryomin ---- - drivers/net/phy/at803x.c | 25 +++++++++++++++++++++++++ - 1 file changed, 25 insertions(+) - ---- a/drivers/net/phy/at803x.c -+++ b/drivers/net/phy/at803x.c -@@ -46,6 +46,7 @@ - #define AT803X_FUNC_DATA 0x4003 - #define AT803X_REG_CHIP_CONFIG 0x1f - #define AT803X_BT_BX_REG_SEL 0x8000 -+#define AT803X_SGMII_ANEG_EN 0x1000 - - #define AT803X_PCS_SMART_EEE_CTRL3 0x805D - #define AT803X_SMART_EEE_CTRL3_LPI_TX_DELAY_SEL_MASK 0x3 -@@ -295,6 +296,27 @@ static int at803x_config_init(struct phy - { - struct at803x_platform_data *pdata; - int ret; -+ u32 v; -+ -+ if (phydev->drv->phy_id == ATH8031_PHY_ID && -+ phydev->interface == PHY_INTERFACE_MODE_SGMII) -+ { -+ v = phy_read(phydev, AT803X_REG_CHIP_CONFIG); -+ /* select SGMII/fiber page */ -+ ret = phy_write(phydev, AT803X_REG_CHIP_CONFIG, -+ v & ~AT803X_BT_BX_REG_SEL); -+ if (ret) -+ return ret; -+ /* enable SGMII autonegotiation */ -+ ret = phy_write(phydev, MII_BMCR, AT803X_SGMII_ANEG_EN); -+ if (ret) -+ return ret; -+ /* select copper page */ -+ ret = phy_write(phydev, AT803X_REG_CHIP_CONFIG, -+ v | AT803X_BT_BX_REG_SEL); -+ if (ret) -+ return ret; -+ } - - ret = genphy_config_init(phydev); - if (ret < 0) diff --git a/target/linux/generic/pending-4.9/810-pci_disable_common_quirks.patch b/target/linux/generic/pending-4.9/810-pci_disable_common_quirks.patch deleted file mode 100644 index f730e83878..0000000000 --- a/target/linux/generic/pending-4.9/810-pci_disable_common_quirks.patch +++ /dev/null @@ -1,60 +0,0 @@ -From: Gabor Juhos -Subject: debloat: add kernel config option to disabling common PCI quirks - -Signed-off-by: Gabor Juhos ---- - drivers/pci/Kconfig | 6 ++++++ - drivers/pci/quirks.c | 6 ++++++ - 2 files changed, 12 insertions(+) - ---- a/drivers/pci/Kconfig -+++ b/drivers/pci/Kconfig -@@ -71,6 +71,12 @@ config XEN_PCIDEV_FRONTEND - The PCI device frontend driver allows the kernel to import arbitrary - PCI devices from a PCI backend to support PCI driver domains. - -+config PCI_DISABLE_COMMON_QUIRKS -+ bool "PCI disable common quirks" -+ depends on PCI -+ help -+ If you don't know what to do here, say N. -+ - config HT_IRQ - bool "Interrupts on hypertransport devices" - default y ---- a/drivers/pci/quirks.c -+++ b/drivers/pci/quirks.c -@@ -41,6 +41,7 @@ static void quirk_mmio_always_on(struct - DECLARE_PCI_FIXUP_CLASS_EARLY(PCI_ANY_ID, PCI_ANY_ID, - PCI_CLASS_BRIDGE_HOST, 8, quirk_mmio_always_on); - -+#ifndef CONFIG_PCI_DISABLE_COMMON_QUIRKS - /* The Mellanox Tavor device gives false positive parity errors - * Mark this device with a broken_parity_status, to allow - * PCI scanning code to "skip" this now blacklisted device. -@@ -3038,6 +3039,7 @@ DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_I - DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x65f9, quirk_intel_mc_errata); - DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x65fa, quirk_intel_mc_errata); - -+#endif /* !CONFIG_PCI_DISABLE_COMMON_QUIRKS */ - - /* - * Ivytown NTB BAR sizes are misreported by the hardware due to an erratum. To -@@ -3094,6 +3096,8 @@ static void fixup_debug_report(struct pc - } - } - -+#ifndef CONFIG_PCI_DISABLE_COMMON_QUIRKS -+ - /* - * Some BIOS implementations leave the Intel GPU interrupts enabled, - * even though no one is handling them (f.e. i915 driver is never loaded). -@@ -3132,6 +3136,8 @@ DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_IN - DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x010a, disable_igfx_irq); - DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x0152, disable_igfx_irq); - -+#endif /* !CONFIG_PCI_DISABLE_COMMON_QUIRKS */ -+ - /* - * PCI devices which are on Intel chips can skip the 10ms delay - * before entering D3 mode. diff --git a/target/linux/generic/pending-4.9/811-pci_disable_usb_common_quirks.patch b/target/linux/generic/pending-4.9/811-pci_disable_usb_common_quirks.patch deleted file mode 100644 index 9dbb2ca8cd..0000000000 --- a/target/linux/generic/pending-4.9/811-pci_disable_usb_common_quirks.patch +++ /dev/null @@ -1,110 +0,0 @@ -From: Felix Fietkau -Subject: debloat: disable common USB quirks - -Signed-off-by: Felix Fietkau ---- - drivers/usb/host/pci-quirks.c | 16 ++++++++++++++++ - drivers/usb/host/pci-quirks.h | 18 +++++++++++++++++- - include/linux/usb/hcd.h | 7 +++++++ - 3 files changed, 40 insertions(+), 1 deletion(-) - ---- a/drivers/usb/host/pci-quirks.c -+++ b/drivers/usb/host/pci-quirks.c -@@ -107,6 +107,8 @@ struct amd_chipset_type { - u8 rev; - }; - -+#ifndef CONFIG_PCI_DISABLE_COMMON_QUIRKS -+ - static struct amd_chipset_info { - struct pci_dev *nb_dev; - struct pci_dev *smbus_dev; -@@ -511,6 +513,10 @@ void usb_amd_dev_put(void) - } - EXPORT_SYMBOL_GPL(usb_amd_dev_put); - -+#endif /* CONFIG_PCI_DISABLE_COMMON_QUIRKS */ -+ -+#if IS_ENABLED(CONFIG_USB_UHCI_HCD) -+ - /* - * Make sure the controller is completely inactive, unable to - * generate interrupts or do DMA. -@@ -590,8 +596,17 @@ reset_needed: - uhci_reset_hc(pdev, base); - return 1; - } -+#else -+int uhci_check_and_reset_hc(struct pci_dev *pdev, unsigned long base) -+{ -+ return 0; -+} -+ -+#endif - EXPORT_SYMBOL_GPL(uhci_check_and_reset_hc); - -+#ifndef CONFIG_PCI_DISABLE_COMMON_QUIRKS -+ - static inline int io_type_enabled(struct pci_dev *pdev, unsigned int mask) - { - u16 cmd; -@@ -1158,3 +1173,4 @@ static void quirk_usb_early_handoff(stru - } - DECLARE_PCI_FIXUP_CLASS_FINAL(PCI_ANY_ID, PCI_ANY_ID, - PCI_CLASS_SERIAL_USB, 8, quirk_usb_early_handoff); -+#endif ---- a/drivers/usb/host/pci-quirks.h -+++ b/drivers/usb/host/pci-quirks.h -@@ -4,6 +4,9 @@ - #ifdef CONFIG_PCI - void uhci_reset_hc(struct pci_dev *pdev, unsigned long base); - int uhci_check_and_reset_hc(struct pci_dev *pdev, unsigned long base); -+#endif /* CONFIG_PCI */ -+ -+#if defined(CONFIG_PCI) && !defined(CONFIG_PCI_DISABLE_COMMON_QUIRKS) - int usb_amd_find_chipset_info(void); - int usb_hcd_amd_remote_wakeup_quirk(struct pci_dev *pdev); - bool usb_amd_hang_symptom_quirk(void); -@@ -17,12 +20,25 @@ void usb_disable_xhci_ports(struct pci_d - void sb800_prefetch(struct device *dev, int on); - #else - struct pci_dev; -+static inline int usb_amd_find_chipset_info(void) -+{ -+ return 0; -+} -+static inline bool usb_amd_hang_symptom_quirk(void) -+{ -+ return false; -+} -+static inline bool usb_amd_prefetch_quirk(void) -+{ -+ return false; -+} - static inline void usb_amd_quirk_pll_disable(void) {} - static inline void usb_amd_quirk_pll_enable(void) {} - static inline void usb_asmedia_modifyflowcontrol(struct pci_dev *pdev) {} - static inline void usb_amd_dev_put(void) {} - static inline void usb_disable_xhci_ports(struct pci_dev *xhci_pdev) {} - static inline void sb800_prefetch(struct device *dev, int on) {} -+static inline void usb_enable_intel_xhci_ports(struct pci_dev *xhci_pdev) {} - #endif /* CONFIG_PCI */ - - #endif /* __LINUX_USB_PCI_QUIRKS_H */ ---- a/include/linux/usb/hcd.h -+++ b/include/linux/usb/hcd.h -@@ -461,7 +461,14 @@ extern int usb_hcd_pci_probe(struct pci_ - extern void usb_hcd_pci_remove(struct pci_dev *dev); - extern void usb_hcd_pci_shutdown(struct pci_dev *dev); - -+#ifndef CONFIG_PCI_DISABLE_COMMON_QUIRKS - extern int usb_hcd_amd_remote_wakeup_quirk(struct pci_dev *dev); -+#else -+static inline int usb_hcd_amd_remote_wakeup_quirk(struct pci_dev *dev) -+{ -+ return 0; -+} -+#endif - - #ifdef CONFIG_PM - extern const struct dev_pm_ops usb_hcd_pci_pm_ops; diff --git a/target/linux/generic/pending-4.9/821-usb-Remove-annoying-warning-about-bogus-URB.patch b/target/linux/generic/pending-4.9/821-usb-Remove-annoying-warning-about-bogus-URB.patch deleted file mode 100644 index dc60557f4e..0000000000 --- a/target/linux/generic/pending-4.9/821-usb-Remove-annoying-warning-about-bogus-URB.patch +++ /dev/null @@ -1,76 +0,0 @@ -From: Alexey Brodkin -Subject: usb: Remove annoying warning about bogus URB - -When ath9k-htc Wi-Fi dongle is used with generic OHCI controller -infinite stream of warnings appears in debug console like this: --------------------------->8---------------------- -usb 1-1: new full-speed USB device number 2 using ohci-platform -usb 1-1: ath9k_htc: Firmware ath9k_htc/htc_9271-1.4.0.fw requested -usb 1-1: ath9k_htc: Transferred FW: ath9k_htc/htc_9271-1.4.0.fw, size: -51008 -------------[ cut here ]------------ -WARNING: CPU: 0 PID: 19 at drivers/usb/core/urb.c:449 -usb_submit_urb+0x1b4/0x498() -usb 1-1: BOGUS urb xfer, pipe 1 != type 3 -Modules linked in: -CPU: 0 PID: 19 Comm: kworker/0:1 Not tainted -4.4.0-rc4-00017-g00e2d79-dirty #3 -Workqueue: events request_firmware_work_func - -Stack Trace: - arc_unwind_core.constprop.1+0xa4/0x110 ----[ end trace 649ef8c342817fc2 ]--- -------------[ cut here ]------------ -WARNING: CPU: 0 PID: 19 at drivers/usb/core/urb.c:449 -usb_submit_urb+0x1b4/0x498() -usb 1-1: BOGUS urb xfer, pipe 1 != type 3 -Modules linked in: -CPU: 0 PID: 19 Comm: kworker/0:1 Tainted: G W -4.4.0-rc4-00017-g00e2d79-dirty #3 -Workqueue: events request_firmware_work_func - -Stack Trace: - arc_unwind_core.constprop.1+0xa4/0x110 ----[ end trace 649ef8c342817fc3 ]--- -------------[ cut here ]------------ --------------------------->8---------------------- - -There're some discussions in mailing lists proposing to disable -that particular check alltogether and magically all seem to work -fine with muted warning. - -Anyways new thread on that regard could be found here: -http://lists.infradead.org/pipermail/linux-snps-arc/2016-July/001310.html - -Let's see what comes out of that new discussion, hopefully patching -of generic USB stuff won't be required then. - -Signed-off-by: Alexey Brodkin ---- - drivers/usb/core/urb.c | 5 ----- - 1 file changed, 5 deletions(-) - ---- a/drivers/usb/core/urb.c -+++ b/drivers/usb/core/urb.c -@@ -321,9 +321,6 @@ EXPORT_SYMBOL_GPL(usb_unanchor_urb); - */ - int usb_submit_urb(struct urb *urb, gfp_t mem_flags) - { -- static int pipetypes[4] = { -- PIPE_CONTROL, PIPE_ISOCHRONOUS, PIPE_BULK, PIPE_INTERRUPT -- }; - int xfertype, max; - struct usb_device *dev; - struct usb_host_endpoint *ep; -@@ -441,11 +438,6 @@ int usb_submit_urb(struct urb *urb, gfp_ - * cause problems in HCDs if they get it wrong. - */ - -- /* Check that the pipe's type matches the endpoint's type */ -- if (usb_pipetype(urb->pipe) != pipetypes[xfertype]) -- dev_WARN(&dev->dev, "BOGUS urb xfer, pipe %x != type %x\n", -- usb_pipetype(urb->pipe), pipetypes[xfertype]); -- - /* Check against a simple/standard policy */ - allowed = (URB_NO_TRANSFER_DMA_MAP | URB_NO_INTERRUPT | URB_DIR_MASK | - URB_FREE_BUFFER); diff --git a/target/linux/generic/pending-4.9/834-ledtrig-libata.patch b/target/linux/generic/pending-4.9/834-ledtrig-libata.patch deleted file mode 100644 index 4715182c6b..0000000000 --- a/target/linux/generic/pending-4.9/834-ledtrig-libata.patch +++ /dev/null @@ -1,149 +0,0 @@ -From: Daniel Golle -Subject: libata: add ledtrig support - -This adds a LED trigger for each ATA port indicating disk activity. - -As this is needed only on specific platforms (NAS SoCs and such), -these platforms should define ARCH_WANTS_LIBATA_LEDS if there -are boards with LED(s) intended to indicate ATA disk activity and -need the OS to take care of that. -In that way, if not selected, LED trigger support not will be -included in libata-core and both, codepaths and structures remain -untouched. - -Signed-off-by: Daniel Golle ---- - drivers/ata/Kconfig | 16 ++++++++++++++++ - drivers/ata/libata-core.c | 41 +++++++++++++++++++++++++++++++++++++++++ - include/linux/libata.h | 9 +++++++++ - 3 files changed, 66 insertions(+) - ---- a/drivers/ata/Kconfig -+++ b/drivers/ata/Kconfig -@@ -46,6 +46,22 @@ config ATA_VERBOSE_ERROR - - If unsure, say Y. - -+config ARCH_WANT_LIBATA_LEDS -+ bool -+ -+config ATA_LEDS -+ bool "support ATA port LED triggers" -+ depends on ARCH_WANT_LIBATA_LEDS -+ select NEW_LEDS -+ select LEDS_CLASS -+ select LEDS_TRIGGERS -+ default y -+ help -+ This option adds a LED trigger for each registered ATA port. -+ It is used to drive disk activity leds connected via GPIO. -+ -+ If unsure, say N. -+ - config ATA_ACPI - bool "ATA ACPI Support" - depends on ACPI ---- a/drivers/ata/libata-core.c -+++ b/drivers/ata/libata-core.c -@@ -731,6 +731,19 @@ u64 ata_tf_read_block(const struct ata_t - return block; - } - -+#ifdef CONFIG_ATA_LEDS -+#define LIBATA_BLINK_DELAY 20 /* ms */ -+static inline void ata_led_act(struct ata_port *ap) -+{ -+ unsigned long led_delay = LIBATA_BLINK_DELAY; -+ -+ if (unlikely(!ap->ledtrig)) -+ return; -+ -+ led_trigger_blink_oneshot(ap->ledtrig, &led_delay, &led_delay, 0); -+} -+#endif -+ - /** - * ata_build_rw_tf - Build ATA taskfile for given read/write request - * @tf: Target ATA taskfile -@@ -4995,6 +5008,9 @@ struct ata_queued_cmd *ata_qc_new_init(s - if (tag < 0) - return NULL; - } -+#ifdef CONFIG_ATA_LEDS -+ ata_led_act(ap); -+#endif - - qc = __ata_qc_from_tag(ap, tag); - qc->tag = tag; -@@ -5896,6 +5912,9 @@ struct ata_port *ata_port_alloc(struct a - ap->stats.unhandled_irq = 1; - ap->stats.idle_irq = 1; - #endif -+#ifdef CONFIG_ATA_LEDS -+ ap->ledtrig = kzalloc(sizeof(struct led_trigger), GFP_KERNEL); -+#endif - ata_sff_port_init(ap); - - return ap; -@@ -5917,6 +5936,12 @@ static void ata_host_release(struct devi - - kfree(ap->pmp_link); - kfree(ap->slave_link); -+#ifdef CONFIG_ATA_LEDS -+ if (ap->ledtrig) { -+ led_trigger_unregister(ap->ledtrig); -+ kfree(ap->ledtrig); -+ }; -+#endif - kfree(ap); - host->ports[i] = NULL; - } -@@ -6363,7 +6388,23 @@ int ata_host_register(struct ata_host *h - host->ports[i]->print_id = atomic_inc_return(&ata_print_id); - host->ports[i]->local_port_no = i + 1; - } -+#ifdef CONFIG_ATA_LEDS -+ for (i = 0; i < host->n_ports; i++) { -+ if (unlikely(!host->ports[i]->ledtrig)) -+ continue; - -+ snprintf(host->ports[i]->ledtrig_name, -+ sizeof(host->ports[i]->ledtrig_name), "ata%u", -+ host->ports[i]->print_id); -+ -+ host->ports[i]->ledtrig->name = host->ports[i]->ledtrig_name; -+ -+ if (led_trigger_register(host->ports[i]->ledtrig)) { -+ kfree(host->ports[i]->ledtrig); -+ host->ports[i]->ledtrig = NULL; -+ } -+ } -+#endif - /* Create associated sysfs transport objects */ - for (i = 0; i < host->n_ports; i++) { - rc = ata_tport_add(host->dev,host->ports[i]); ---- a/include/linux/libata.h -+++ b/include/linux/libata.h -@@ -38,6 +38,9 @@ - #include - #include - #include -+#ifdef CONFIG_ATA_LEDS -+#include -+#endif - - /* - * Define if arch has non-standard setup. This is a _PCI_ standard -@@ -884,6 +887,12 @@ struct ata_port { - #ifdef CONFIG_ATA_ACPI - struct ata_acpi_gtm __acpi_init_gtm; /* use ata_acpi_init_gtm() */ - #endif -+ -+#ifdef CONFIG_ATA_LEDS -+ struct led_trigger *ledtrig; -+ char ledtrig_name[8]; -+#endif -+ - /* owned by EH */ - u8 sector_buf[ATA_SECT_SIZE] ____cacheline_aligned; - }; diff --git a/target/linux/generic/pending-4.9/890-uart_optional_sysrq.patch b/target/linux/generic/pending-4.9/890-uart_optional_sysrq.patch deleted file mode 100644 index d80246db99..0000000000 --- a/target/linux/generic/pending-4.9/890-uart_optional_sysrq.patch +++ /dev/null @@ -1,40 +0,0 @@ -From: John Crispin -Subject: serial: do not accept sysrq characters via serial port - -many embedded boards have a disconnected TTL level serial which can -generate some garbage that can lead to spurious false sysrq detects. - -[john@phrozen.org: sent upstream 22.12.2016] - -Signed-off-by: John Crispin -Signed-off-by: Felix Fietkau ---- - include/linux/serial_core.h | 2 +- - lib/Kconfig.debug | 5 +++++ - 2 files changed, 6 insertions(+), 1 deletion(-) - ---- a/include/linux/serial_core.h -+++ b/include/linux/serial_core.h -@@ -456,7 +456,7 @@ extern void uart_handle_cts_change(struc - extern void uart_insert_char(struct uart_port *port, unsigned int status, - unsigned int overrun, unsigned int ch, unsigned int flag); - --#ifdef SUPPORT_SYSRQ -+#if defined(SUPPORT_SYSRQ) && defined(CONFIG_MAGIC_SYSRQ_SERIAL) - static inline int - uart_handle_sysrq_char(struct uart_port *port, unsigned int ch) - { ---- a/lib/Kconfig.debug -+++ b/lib/Kconfig.debug -@@ -410,6 +410,11 @@ config MAGIC_SYSRQ_DEFAULT_ENABLE - This may be set to 1 or 0 to enable or disable them all, or - to a bitmask as described in Documentation/sysrq.txt. - -+config MAGIC_SYSRQ_SERIAL -+ bool "Enable magic SysRq key over serial" -+ depends on MAGIC_SYSRQ -+ default y -+ - config DEBUG_KERNEL - bool "Kernel debugging" - help diff --git a/target/linux/generic/pending-4.9/920-mangle_bootargs.patch b/target/linux/generic/pending-4.9/920-mangle_bootargs.patch deleted file mode 100644 index f437a8c4a0..0000000000 --- a/target/linux/generic/pending-4.9/920-mangle_bootargs.patch +++ /dev/null @@ -1,71 +0,0 @@ -From: Imre Kaloz -Subject: init: add CONFIG_MANGLE_BOOTARGS and disable it by default - -Enabling this option renames the bootloader supplied root= -and rootfstype= variables, which might have to be know but -would break the automatisms libreCMC uses. - -Signed-off-by: Imre Kaloz ---- - init/Kconfig | 9 +++++++++ - init/main.c | 24 ++++++++++++++++++++++++ - 2 files changed, 33 insertions(+) - ---- a/init/Kconfig -+++ b/init/Kconfig -@@ -1694,6 +1694,15 @@ config EMBEDDED - an embedded system so certain expert options are available - for configuration. - -+config MANGLE_BOOTARGS -+ bool "Rename offending bootargs" -+ depends on EXPERT -+ help -+ Sometimes the bootloader passed bogus root= and rootfstype= -+ parameters to the kernel, and while you want to ignore them, -+ you need to know the values f.e. to support dual firmware -+ layouts on the flash. -+ - config HAVE_PERF_EVENTS - bool - help ---- a/init/main.c -+++ b/init/main.c -@@ -353,6 +353,29 @@ static inline void setup_nr_cpu_ids(void - static inline void smp_prepare_cpus(unsigned int maxcpus) { } - #endif - -+#ifdef CONFIG_MANGLE_BOOTARGS -+static void __init mangle_bootargs(char *command_line) -+{ -+ char *rootdev; -+ char *rootfs; -+ -+ rootdev = strstr(command_line, "root=/dev/mtdblock"); -+ -+ if (rootdev) -+ strncpy(rootdev, "mangled_rootblock=", 18); -+ -+ rootfs = strstr(command_line, "rootfstype"); -+ -+ if (rootfs) -+ strncpy(rootfs, "mangled_fs", 10); -+ -+} -+#else -+static void __init mangle_bootargs(char *command_line) -+{ -+} -+#endif -+ - /* - * We need to store the untouched command line for future reference. - * We also need to store the touched command line since the parameter -@@ -506,6 +529,7 @@ asmlinkage __visible void __init start_k - pr_notice("%s", linux_banner); - setup_arch(&command_line); - mm_init_cpumask(&init_mm); -+ mangle_bootargs(command_line); - setup_command_line(command_line); - setup_nr_cpu_ids(); - setup_per_cpu_areas(); diff --git a/target/linux/sunxi/base-files/lib/preinit/79_move_config b/target/linux/sunxi/base-files/lib/preinit/79_move_config index c112588689..83171b3ba9 100644 --- a/target/linux/sunxi/base-files/lib/preinit/79_move_config +++ b/target/linux/sunxi/base-files/lib/preinit/79_move_config @@ -6,7 +6,7 @@ move_config() { . /lib/upgrade/common.sh - if export_bootdevice && export_partdevice partdev -1; then + if export_bootdevice && export_partdevice partdev 1; then if mount -t vfat -o rw,noatime "/dev/$partdev" /mnt; then if [ -f /mnt/sysupgrade.tgz ]; then mv -f /mnt/sysupgrade.tgz / diff --git a/target/linux/sunxi/base-files/lib/upgrade/platform.sh b/target/linux/sunxi/base-files/lib/upgrade/platform.sh index 88ef4790e9..abe910b154 100644 --- a/target/linux/sunxi/base-files/lib/upgrade/platform.sh +++ b/target/linux/sunxi/base-files/lib/upgrade/platform.sh @@ -1,7 +1,7 @@ platform_check_image() { local diskdev partdev diff - export_bootdevice && export_partdevice diskdev -2 || { + export_bootdevice && export_partdevice diskdev 0 || { echo "Unable to determine upgrade device" return 1 } @@ -28,7 +28,7 @@ platform_check_image() { platform_copy_config() { local partdev - if export_partdevice partdev -1; then + if export_partdevice partdev 1; then mount -t vfat -o rw,noatime "/dev/$partdev" /mnt cp -af "$CONF_TAR" /mnt/ umount /mnt @@ -38,7 +38,7 @@ platform_copy_config() { platform_do_upgrade() { local diskdev partdev diff - export_bootdevice && export_partdevice diskdev -2 || { + export_bootdevice && export_partdevice diskdev 0 || { echo "Unable to determine upgrade device" return 1 } @@ -74,7 +74,6 @@ platform_do_upgrade() { get_image "$@" | dd of="$diskdev" bs=1024 skip=8 seek=8 count=1016 conv=fsync #iterate over each partition from the image and write it to the boot disk while read part start size; do - part="$(($part - 2))" if export_partdevice partdev $part; then echo "Writing image to /dev/$partdev..." get_image "$@" | dd of="/dev/$partdev" ibs="512" obs=1M skip="$start" count="$size" conv=fsync diff --git a/target/linux/sunxi/config-4.14 b/target/linux/sunxi/config-4.14 index d7d9f60a6d..ab7dc9c9b8 100644 --- a/target/linux/sunxi/config-4.14 +++ b/target/linux/sunxi/config-4.14 @@ -65,7 +65,6 @@ CONFIG_AXP20X_POWER=y CONFIG_BACKLIGHT_CLASS_DEVICE=y CONFIG_BACKLIGHT_LCD_SUPPORT=y CONFIG_BACKLIGHT_PWM=y -CONFIG_BINFMT_MISC=y CONFIG_BLK_DEV_LOOP=y CONFIG_BLK_DEV_SD=y CONFIG_BLK_SCSI_REQUEST=y diff --git a/target/linux/sunxi/config-4.19 b/target/linux/sunxi/config-4.19 index c684c04e17..ef5e1b28d3 100644 --- a/target/linux/sunxi/config-4.19 +++ b/target/linux/sunxi/config-4.19 @@ -73,7 +73,6 @@ CONFIG_AXP20X_POWER=y CONFIG_BACKLIGHT_CLASS_DEVICE=y CONFIG_BACKLIGHT_LCD_SUPPORT=y CONFIG_BACKLIGHT_PWM=y -CONFIG_BINFMT_MISC=y CONFIG_BLK_DEV_LOOP=y CONFIG_BLK_DEV_SD=y CONFIG_BLK_SCSI_REQUEST=y diff --git a/target/linux/sunxi/cortexa53/config-4.14 b/target/linux/sunxi/cortexa53/config-4.14 index b46c4aa414..1ba379ea65 100644 --- a/target/linux/sunxi/cortexa53/config-4.14 +++ b/target/linux/sunxi/cortexa53/config-4.14 @@ -35,7 +35,6 @@ CONFIG_ARM64_PAGE_SHIFT=12 # CONFIG_ARM64_PTDUMP_DEBUGFS is not set # CONFIG_ARM64_RANDOMIZE_TEXT_OFFSET is not set CONFIG_ARM64_SSBD=y -# CONFIG_ARM64_SW_TTBR0_PAN is not set # CONFIG_ARM64_UAO is not set CONFIG_ARM64_VA_BITS=39 CONFIG_ARM64_VA_BITS_39=y @@ -45,7 +44,6 @@ CONFIG_ARM_AMBA=y CONFIG_ARM_GIC_V3=y # CONFIG_ARM_SP805_WATCHDOG is not set CONFIG_AUDIT_ARCH_COMPAT_GENERIC=y -# CONFIG_COMPAT is not set CONFIG_DWMAC_SUN8I=y CONFIG_FRAME_POINTER=y CONFIG_GENERIC_BUG_RELATIVE_POINTERS=y diff --git a/target/linux/sunxi/cortexa53/config-4.19 b/target/linux/sunxi/cortexa53/config-4.19 index a35c84b905..67ff2c2633 100644 --- a/target/linux/sunxi/cortexa53/config-4.19 +++ b/target/linux/sunxi/cortexa53/config-4.19 @@ -37,7 +37,6 @@ CONFIG_ARM64_PA_BITS_48=y # CONFIG_ARM64_PTDUMP_DEBUGFS is not set # CONFIG_ARM64_RANDOMIZE_TEXT_OFFSET is not set CONFIG_ARM64_SSBD=y -# CONFIG_ARM64_SW_TTBR0_PAN is not set # CONFIG_ARM64_UAO is not set CONFIG_ARM64_VA_BITS=39 CONFIG_ARM64_VA_BITS_39=y @@ -46,7 +45,6 @@ CONFIG_ARM64_VA_BITS_39=y CONFIG_ARM_AMBA=y # CONFIG_ARM_SP805_WATCHDOG is not set CONFIG_AUDIT_ARCH_COMPAT_GENERIC=y -# CONFIG_COMPAT is not set CONFIG_DMA_DIRECT_OPS=y CONFIG_DWMAC_SUN8I=y # CONFIG_FLATMEM_MANUAL is not set diff --git a/target/linux/sunxi/image/cortex-a7.mk b/target/linux/sunxi/image/cortex-a7.mk index a9045c7d5a..ce0cbe5a5c 100644 --- a/target/linux/sunxi/image/cortex-a7.mk +++ b/target/linux/sunxi/image/cortex-a7.mk @@ -179,6 +179,16 @@ endef TARGET_DEVICES += sun8i-h3-orangepi-pc +define Device/sun8i-h3-orangepi-pc-plus + DEVICE_TITLE:=Xunlong Orange Pi PC Plus + DEVICE_PACKAGES:=kmod-rtc-sunxi kmod-gpio-button-hotplug + SUPPORTED_DEVICES:=xunlong,orangepi-pc-plus + SUNXI_DTS:=sun8i-h3-orangepi-pc-plus +endef + +TARGET_DEVICES += sun8i-h3-orangepi-pc-plus + + define Device/sun8i-h3-orangepi-plus DEVICE_TITLE:=Xunlong Orange Pi Plus DEVICE_PACKAGES:=kmod-rtc-sunxi diff --git a/target/linux/sunxi/patches-4.14/002-net-stmmac-dwmac-sun8i-Handle-integrated-external-MD.patch b/target/linux/sunxi/patches-4.14/002-net-stmmac-dwmac-sun8i-Handle-integrated-external-MD.patch index 8e0527f3d8..b354c13347 100644 --- a/target/linux/sunxi/patches-4.14/002-net-stmmac-dwmac-sun8i-Handle-integrated-external-MD.patch +++ b/target/linux/sunxi/patches-4.14/002-net-stmmac-dwmac-sun8i-Handle-integrated-external-MD.patch @@ -115,7 +115,7 @@ Signed-off-by: David S. Miller /* H3/A64 specific bits */ #define SYSCON_RMII_EN BIT(13) /* 1: enable RMII (overrides EPIT) */ -@@ -634,6 +640,159 @@ static int sun8i_dwmac_reset(struct stmm +@@ -635,6 +641,159 @@ static int sun8i_dwmac_reset(struct stmm return 0; } @@ -275,7 +275,7 @@ Signed-off-by: David S. Miller static int sun8i_dwmac_set_syscon(struct stmmac_priv *priv) { struct sunxi_priv_data *gmac = priv->plat->bsp_priv; -@@ -648,35 +807,25 @@ static int sun8i_dwmac_set_syscon(struct +@@ -649,35 +808,25 @@ static int sun8i_dwmac_set_syscon(struct "Current syscon value is not the default %x (expect %x)\n", val, reg); @@ -329,7 +329,7 @@ Signed-off-by: David S. Miller } if (!of_property_read_u32(node, "allwinner,tx-delay-ps", &val)) { -@@ -746,81 +895,21 @@ static void sun8i_dwmac_unset_syscon(str +@@ -747,81 +896,21 @@ static void sun8i_dwmac_unset_syscon(str regmap_write(gmac->regmap, SYSCON_EMAC_REG, reg); } @@ -420,7 +420,7 @@ Signed-off-by: David S. Miller clk_disable_unprepare(gmac->tx_clk); -@@ -849,7 +938,7 @@ static struct mac_device_info *sun8i_dwm +@@ -850,7 +939,7 @@ static struct mac_device_info *sun8i_dwm if (!mac) return NULL; @@ -429,7 +429,7 @@ Signed-off-by: David S. Miller if (ret) return NULL; -@@ -889,6 +978,8 @@ static int sun8i_dwmac_probe(struct plat +@@ -892,6 +981,8 @@ static int sun8i_dwmac_probe(struct plat struct sunxi_priv_data *gmac; struct device *dev = &pdev->dev; int ret; @@ -438,7 +438,7 @@ Signed-off-by: David S. Miller ret = stmmac_get_platform_resources(pdev, &stmmac_res); if (ret) -@@ -932,29 +1023,6 @@ static int sun8i_dwmac_probe(struct plat +@@ -935,29 +1026,6 @@ static int sun8i_dwmac_probe(struct plat } plat_dat->interface = of_get_phy_mode(dev->of_node); @@ -468,7 +468,7 @@ Signed-off-by: David S. Miller /* platform data specifying hardware features and callbacks. * hardware features were copied from Allwinner drivers. -@@ -973,9 +1041,34 @@ static int sun8i_dwmac_probe(struct plat +@@ -976,9 +1044,34 @@ static int sun8i_dwmac_probe(struct plat ret = stmmac_dvr_probe(&pdev->dev, plat_dat, &stmmac_res); if (ret) diff --git a/target/linux/sunxi/patches-4.14/003-net-stmmac-sun8i-Restore-the-compatibles.patch b/target/linux/sunxi/patches-4.14/003-net-stmmac-sun8i-Restore-the-compatibles.patch index 2f43585053..02115c832b 100644 --- a/target/linux/sunxi/patches-4.14/003-net-stmmac-sun8i-Restore-the-compatibles.patch +++ b/target/linux/sunxi/patches-4.14/003-net-stmmac-sun8i-Restore-the-compatibles.patch @@ -18,7 +18,7 @@ Signed-off-by: David S. Miller --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c -@@ -1072,6 +1072,14 @@ return ret; +@@ -1075,6 +1075,14 @@ return ret; } static const struct of_device_id sun8i_dwmac_match[] = { diff --git a/target/linux/sunxi/patches-4.14/004-net-stmmac-dwmac-sun8i-fix-allwinner-leds-active-low.patch b/target/linux/sunxi/patches-4.14/004-net-stmmac-dwmac-sun8i-fix-allwinner-leds-active-low.patch index b8b5b53b3f..1bd5e16c16 100644 --- a/target/linux/sunxi/patches-4.14/004-net-stmmac-dwmac-sun8i-fix-allwinner-leds-active-low.patch +++ b/target/linux/sunxi/patches-4.14/004-net-stmmac-dwmac-sun8i-fix-allwinner-leds-active-low.patch @@ -17,7 +17,7 @@ Signed-off-by: David S. Miller --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c -@@ -808,8 +808,7 @@ static int sun8i_dwmac_set_syscon(struct +@@ -809,8 +809,7 @@ static int sun8i_dwmac_set_syscon(struct val, reg); if (gmac->variant->soc_has_internal_phy) { diff --git a/target/linux/sunxi/patches-4.19/100-clocksource-drivers-arch_timer-Workaround-for-Allwin.patch b/target/linux/sunxi/patches-4.19/100-clocksource-drivers-arch_timer-Workaround-for-Allwin.patch deleted file mode 100644 index c25e3c4aee..0000000000 --- a/target/linux/sunxi/patches-4.19/100-clocksource-drivers-arch_timer-Workaround-for-Allwin.patch +++ /dev/null @@ -1,244 +0,0 @@ -From 7cd6dca3600d8d71328950216688ecd00015d1ce Mon Sep 17 00:00:00 2001 -From: Samuel Holland -Date: Sat, 12 Jan 2019 20:17:18 -0600 -Subject: [PATCH] clocksource/drivers/arch_timer: Workaround for Allwinner A64 - timer instability -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -The Allwinner A64 SoC is known[1] to have an unstable architectural -timer, which manifests itself most obviously in the time jumping forward -a multiple of 95 years[2][3]. This coincides with 2^56 cycles at a -timer frequency of 24 MHz, implying that the time went slightly backward -(and this was interpreted by the kernel as it jumping forward and -wrapping around past the epoch). - -Investigation revealed instability in the low bits of CNTVCT at the -point a high bit rolls over. This leads to power-of-two cycle forward -and backward jumps. (Testing shows that forward jumps are about twice as -likely as backward jumps.) Since the counter value returns to normal -after an indeterminate read, each "jump" really consists of both a -forward and backward jump from the software perspective. - -Unless the kernel is trapping CNTVCT reads, a userspace program is able -to read the register in a loop faster than it changes. A test program -running on all 4 CPU cores that reported jumps larger than 100 ms was -run for 13.6 hours and reported the following: - - Count | Event --------+--------------------------- - 9940 | jumped backward 699ms - 268 | jumped backward 1398ms - 1 | jumped backward 2097ms - 16020 | jumped forward 175ms - 6443 | jumped forward 699ms - 2976 | jumped forward 1398ms - 9 | jumped forward 356516ms - 9 | jumped forward 357215ms - 4 | jumped forward 714430ms - 1 | jumped forward 3578440ms - -This works out to a jump larger than 100 ms about every 5.5 seconds on -each CPU core. - -The largest jump (almost an hour!) was the following sequence of reads: - 0x0000007fffffffff → 0x00000093feffffff → 0x0000008000000000 - -Note that the middle bits don't necessarily all read as all zeroes or -all ones during the anomalous behavior; however the low 10 bits checked -by the function in this patch have never been observed with any other -value. - -Also note that smaller jumps are much more common, with backward jumps -of 2048 (2^11) cycles observed over 400 times per second on each core. -(Of course, this is partially explained by lower bits rolling over more -frequently.) Any one of these could have caused the 95 year time skip. - -Similar anomalies were observed while reading CNTPCT (after patching the -kernel to allow reads from userspace). However, the CNTPCT jumps are -much less frequent, and only small jumps were observed. The same program -as before (except now reading CNTPCT) observed after 72 hours: - - Count | Event --------+--------------------------- - 17 | jumped backward 699ms - 52 | jumped forward 175ms - 2831 | jumped forward 699ms - 5 | jumped forward 1398ms - -Further investigation showed that the instability in CNTPCT/CNTVCT also -affected the respective timer's TVAL register. The following values were -observed immediately after writing CNVT_TVAL to 0x10000000: - - CNTVCT | CNTV_TVAL | CNTV_CVAL | CNTV_TVAL Error ---------------------+------------+--------------------+----------------- - 0x000000d4a2d8bfff | 0x10003fff | 0x000000d4b2d8bfff | +0x00004000 - 0x000000d4a2d94000 | 0x0fffffff | 0x000000d4b2d97fff | -0x00004000 - 0x000000d4a2d97fff | 0x10003fff | 0x000000d4b2d97fff | +0x00004000 - 0x000000d4a2d9c000 | 0x0fffffff | 0x000000d4b2d9ffff | -0x00004000 - -The pattern of errors in CNTV_TVAL seemed to depend on exactly which -value was written to it. For example, after writing 0x10101010: - - CNTVCT | CNTV_TVAL | CNTV_CVAL | CNTV_TVAL Error ---------------------+------------+--------------------+----------------- - 0x000001ac3effffff | 0x1110100f | 0x000001ac4f10100f | +0x1000000 - 0x000001ac40000000 | 0x1010100f | 0x000001ac5110100f | -0x1000000 - 0x000001ac58ffffff | 0x1110100f | 0x000001ac6910100f | +0x1000000 - 0x000001ac66000000 | 0x1010100f | 0x000001ac7710100f | -0x1000000 - 0x000001ac6affffff | 0x1110100f | 0x000001ac7b10100f | +0x1000000 - 0x000001ac6e000000 | 0x1010100f | 0x000001ac7f10100f | -0x1000000 - -I was also twice able to reproduce the issue covered by Allwinner's -workaround[4], that writing to TVAL sometimes fails, and both CVAL and -TVAL are left with entirely bogus values. One was the following values: - - CNTVCT | CNTV_TVAL | CNTV_CVAL ---------------------+------------+-------------------------------------- - 0x000000d4a2d6014c | 0x8fbd5721 | 0x000000d132935fff (615s in the past) -Reviewed-by: Marc Zyngier - -======================================================================== - -Because the CPU can read the CNTPCT/CNTVCT registers faster than they -change, performing two reads of the register and comparing the high bits -(like other workarounds) is not a workable solution. And because the -timer can jump both forward and backward, no pair of reads can -distinguish a good value from a bad one. The only way to guarantee a -good value from consecutive reads would be to read _three_ times, and -take the middle value only if the three values are 1) each unique and -2) increasing. This takes at minimum 3 counter cycles (125 ns), or more -if an anomaly is detected. - -However, since there is a distinct pattern to the bad values, we can -optimize the common case (1022/1024 of the time) to a single read by -simply ignoring values that match the error pattern. This still takes no -more than 3 cycles in the worst case, and requires much less code. As an -additional safety check, we still limit the loop iteration to the number -of max-frequency (1.2 GHz) CPU cycles in three 24 MHz counter periods. - -For the TVAL registers, the simple solution is to not use them. Instead, -read or write the CVAL and calculate the TVAL value in software. - -Although the manufacturer is aware of at least part of the erratum[4], -there is no official name for it. For now, use the kernel-internal name -"UNKNOWN1". - -[1]: https://github.com/armbian/build/commit/a08cd6fe7ae9 -[2]: https://forum.armbian.com/topic/3458-a64-datetime-clock-issue/ -[3]: https://irclog.whitequark.org/linux-sunxi/2018-01-26 -[4]: https://github.com/Allwinner-Homlet/H6-BSP4.9-linux/blob/master/drivers/clocksource/arm_arch_timer.c#L272 - -Acked-by: Maxime Ripard -Tested-by: Andre Przywara -Signed-off-by: Samuel Holland -Cc: stable@vger.kernel.org -Signed-off-by: Daniel Lezcano ---- - Documentation/arm64/silicon-errata.txt | 2 + - drivers/clocksource/Kconfig | 10 +++++ - drivers/clocksource/arm_arch_timer.c | 55 ++++++++++++++++++++++++++ - 3 files changed, 67 insertions(+) - ---- a/Documentation/arm64/silicon-errata.txt -+++ b/Documentation/arm64/silicon-errata.txt -@@ -44,6 +44,8 @@ stable kernels. - - | Implementor | Component | Erratum ID | Kconfig | - +----------------+-----------------+-----------------+-----------------------------+ -+| Allwinner | A64/R18 | UNKNOWN1 | SUN50I_ERRATUM_UNKNOWN1 | -+| | | | | - | ARM | Cortex-A53 | #826319 | ARM64_ERRATUM_826319 | - | ARM | Cortex-A53 | #827319 | ARM64_ERRATUM_827319 | - | ARM | Cortex-A53 | #824069 | ARM64_ERRATUM_824069 | ---- a/drivers/clocksource/Kconfig -+++ b/drivers/clocksource/Kconfig -@@ -365,6 +365,16 @@ config ARM64_ERRATUM_858921 - The workaround will be dynamically enabled when an affected - core is detected. - -+config SUN50I_ERRATUM_UNKNOWN1 -+ bool "Workaround for Allwinner A64 erratum UNKNOWN1" -+ default y -+ depends on ARM_ARCH_TIMER && ARM64 && ARCH_SUNXI -+ select ARM_ARCH_TIMER_OOL_WORKAROUND -+ help -+ This option enables a workaround for instability in the timer on -+ the Allwinner A64 SoC. The workaround will only be active if the -+ allwinner,erratum-unknown1 property is found in the timer node. -+ - config ARM_GLOBAL_TIMER - bool "Support for the ARM global timer" if COMPILE_TEST - select TIMER_OF if OF ---- a/drivers/clocksource/arm_arch_timer.c -+++ b/drivers/clocksource/arm_arch_timer.c -@@ -319,6 +319,48 @@ static u64 notrace arm64_858921_read_cnt - } - #endif - -+#ifdef CONFIG_SUN50I_ERRATUM_UNKNOWN1 -+/* -+ * The low bits of the counter registers are indeterminate while bit 10 or -+ * greater is rolling over. Since the counter value can jump both backward -+ * (7ff -> 000 -> 800) and forward (7ff -> fff -> 800), ignore register values -+ * with all ones or all zeros in the low bits. Bound the loop by the maximum -+ * number of CPU cycles in 3 consecutive 24 MHz counter periods. -+ */ -+#define __sun50i_a64_read_reg(reg) ({ \ -+ u64 _val; \ -+ int _retries = 150; \ -+ \ -+ do { \ -+ _val = read_sysreg(reg); \ -+ _retries--; \ -+ } while (((_val + 1) & GENMASK(9, 0)) <= 1 && _retries); \ -+ \ -+ WARN_ON_ONCE(!_retries); \ -+ _val; \ -+}) -+ -+static u64 notrace sun50i_a64_read_cntpct_el0(void) -+{ -+ return __sun50i_a64_read_reg(cntpct_el0); -+} -+ -+static u64 notrace sun50i_a64_read_cntvct_el0(void) -+{ -+ return __sun50i_a64_read_reg(cntvct_el0); -+} -+ -+static u32 notrace sun50i_a64_read_cntp_tval_el0(void) -+{ -+ return read_sysreg(cntp_cval_el0) - sun50i_a64_read_cntpct_el0(); -+} -+ -+static u32 notrace sun50i_a64_read_cntv_tval_el0(void) -+{ -+ return read_sysreg(cntv_cval_el0) - sun50i_a64_read_cntvct_el0(); -+} -+#endif -+ - #ifdef CONFIG_ARM_ARCH_TIMER_OOL_WORKAROUND - DEFINE_PER_CPU(const struct arch_timer_erratum_workaround *, timer_unstable_counter_workaround); - EXPORT_SYMBOL_GPL(timer_unstable_counter_workaround); -@@ -408,6 +450,19 @@ static const struct arch_timer_erratum_w - .read_cntvct_el0 = arm64_858921_read_cntvct_el0, - }, - #endif -+#ifdef CONFIG_SUN50I_ERRATUM_UNKNOWN1 -+ { -+ .match_type = ate_match_dt, -+ .id = "allwinner,erratum-unknown1", -+ .desc = "Allwinner erratum UNKNOWN1", -+ .read_cntp_tval_el0 = sun50i_a64_read_cntp_tval_el0, -+ .read_cntv_tval_el0 = sun50i_a64_read_cntv_tval_el0, -+ .read_cntpct_el0 = sun50i_a64_read_cntpct_el0, -+ .read_cntvct_el0 = sun50i_a64_read_cntvct_el0, -+ .set_next_event_phys = erratum_set_next_event_tval_phys, -+ .set_next_event_virt = erratum_set_next_event_tval_virt, -+ }, -+#endif - }; - - typedef bool (*ate_match_fn_t)(const struct arch_timer_erratum_workaround *, diff --git a/target/linux/sunxi/patches-4.19/101-arm64-dts-allwinner-a64-Enable-A64-timer-workaround.patch b/target/linux/sunxi/patches-4.19/101-arm64-dts-allwinner-a64-Enable-A64-timer-workaround.patch deleted file mode 100644 index ef7867af81..0000000000 --- a/target/linux/sunxi/patches-4.19/101-arm64-dts-allwinner-a64-Enable-A64-timer-workaround.patch +++ /dev/null @@ -1,26 +0,0 @@ -From 55ec26d6a4241363fa94f15377ebd8f1116fbfd7 Mon Sep 17 00:00:00 2001 -From: Samuel Holland -Date: Sat, 12 Jan 2019 20:17:19 -0600 -Subject: [PATCH] arm64: dts: allwinner: a64: Enable A64 timer workaround - -As instability in the architectural timer has been observed on multiple -devices using this SoC, inluding the Pine64 and the Orange Pi Win, -enable the workaround in the SoC's device tree. - -Acked-by: Maxime Ripard -Signed-off-by: Samuel Holland -Signed-off-by: Chen-Yu Tsai ---- - arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi | 1 + - 1 file changed, 1 insertion(+) - ---- a/arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi -+++ b/arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi -@@ -159,6 +159,7 @@ - - timer { - compatible = "arm,armv8-timer"; -+ allwinner,erratum-unknown1; - interrupts = , - ; -+ linux,code = ; - gpios = <&r_pio 0 3 GPIO_ACTIVE_LOW>; - }; - }; -@@ -238,7 +238,7 @@ - }; - - &usb_otg { -- dr_mode = "otg"; -+ dr_mode = "host"; - status = "okay"; - }; - diff --git a/target/linux/sunxi/patches-4.19/310-Revert-ARM-dts-sun7i-Add-BCM53125-switch-nodes-to-th.patch b/target/linux/sunxi/patches-4.19/310-Revert-ARM-dts-sun7i-Add-BCM53125-switch-nodes-to-th.patch deleted file mode 100644 index 2a47a529d5..0000000000 --- a/target/linux/sunxi/patches-4.19/310-Revert-ARM-dts-sun7i-Add-BCM53125-switch-nodes-to-th.patch +++ /dev/null @@ -1,88 +0,0 @@ -From 49cd9ea6dc8d68eb519ccd9f31c9730dec8a181a Mon Sep 17 00:00:00 2001 -From: Hauke Mehrtens -Date: Thu, 8 Mar 2018 22:14:50 +0100 -Subject: [PATCH] Revert "ARM: dts: sun7i: Add BCM53125 switch nodes to the - lamobo-r1 board" - -This reverts the changes needed for the upstream b53 DSA switch driver -to use the libreCMC b43 swconfig switch driver. - -This reverts commit 0cdefd5b5485ee6eb3512a75739d09a4090176ed. -This reverts commit d7b9eaff5f0ca00726336b4c0c3c29decf30412a. ---- - arch/arm/boot/dts/sun7i-a20-lamobo-r1.dts | 60 ++----------------------------- - 1 file changed, 3 insertions(+), 57 deletions(-) - ---- a/arch/arm/boot/dts/sun7i-a20-lamobo-r1.dts -+++ b/arch/arm/boot/dts/sun7i-a20-lamobo-r1.dts -@@ -124,67 +124,13 @@ - &gmac { - pinctrl-names = "default"; - pinctrl-0 = <&gmac_pins_rgmii_a>; -+ phy = <&phy1>; - phy-mode = "rgmii"; - phy-supply = <®_gmac_3v3>; - status = "okay"; - -- fixed-link { -- speed = <1000>; -- full-duplex; -- }; -- -- mdio { -- compatible = "snps,dwmac-mdio"; -- #address-cells = <1>; -- #size-cells = <0>; -- -- switch: ethernet-switch@1e { -- compatible = "brcm,bcm53125"; -- reg = <30>; -- #address-cells = <1>; -- #size-cells = <0>; -- -- ports { -- #address-cells = <1>; -- #size-cells = <0>; -- -- port0: port@0 { -- reg = <0>; -- label = "lan2"; -- }; -- -- port1: port@1 { -- reg = <1>; -- label = "lan3"; -- }; -- -- port2: port@2 { -- reg = <2>; -- label = "lan4"; -- }; -- -- port3: port@3 { -- reg = <3>; -- label = "wan"; -- }; -- -- port4: port@4 { -- reg = <4>; -- label = "lan1"; -- }; -- -- port8: port@8 { -- reg = <8>; -- label = "cpu"; -- ethernet = <&gmac>; -- phy-mode = "rgmii-txid"; -- fixed-link { -- speed = <1000>; -- full-duplex; -- }; -- }; -- }; -- }; -+ phy1: ethernet-phy@1 { -+ reg = <1>; - }; - }; - diff --git a/target/linux/sunxi/patches-4.19/400-arm64-allwinner-a64-sopine-Add-Sopine-flash-partitio.patch b/target/linux/sunxi/patches-4.19/400-arm64-allwinner-a64-sopine-Add-Sopine-flash-partitio.patch deleted file mode 100644 index ee70abee27..0000000000 --- a/target/linux/sunxi/patches-4.19/400-arm64-allwinner-a64-sopine-Add-Sopine-flash-partitio.patch +++ /dev/null @@ -1,46 +0,0 @@ -From 7d87d3dafc4b1ea5659eb71ee6c5fd5308490d1f Mon Sep 17 00:00:00 2001 -From: Oskari Lemmela -Date: Mon, 31 Dec 2018 07:44:49 +0200 -Subject: [PATCH] arm64: allwinner: a64-sopine: Add Sopine flash partitions. - -First 896kB to u-boot. Enough space for SPL, u-boot and ATF. -Next 128kB to u-boot environment and rest to firmware. - -Firmware partition is compatible FIT image dynamic splitting. - -Signed-off-by: Oskari Lemmela ---- - .../boot/dts/allwinner/sun50i-a64-sopine.dtsi | 22 +++++++++++++++++++ - 1 file changed, 22 insertions(+) - ---- a/arch/arm64/boot/dts/allwinner/sun50i-a64-sopine.dtsi -+++ b/arch/arm64/boot/dts/allwinner/sun50i-a64-sopine.dtsi -@@ -78,6 +78,28 @@ - compatible = "jedec,spi-nor"; - reg = <0>; - spi-max-frequency = <40000000>; -+ -+ partitions { -+ compatible = "fixed-partitions"; -+ #address-cells = <1>; -+ #size-cells = <1>; -+ -+ partition@0 { -+ label = "u-boot"; -+ reg = <0x000000 0x0E0000>; -+ }; -+ -+ partition@e0000 { -+ label = "u-boot-env"; -+ reg = <0x0E0000 0x020000>; -+ }; -+ -+ partition@100000 { -+ compatible = "denx,fit"; -+ label = "firmware"; -+ reg = <0x100000 0xF00000>; -+ }; -+ }; - }; - }; - diff --git a/target/linux/uml/config/x86_64 b/target/linux/uml/config/x86_64 index 22fc8fb7e0..7223edd8a2 100644 --- a/target/linux/uml/config/x86_64 +++ b/target/linux/uml/config/x86_64 @@ -10,7 +10,6 @@ CONFIG_ARCH_HAS_KCOV=y # CONFIG_ARCH_OPTIONAL_KERNEL_RWX is not set # CONFIG_ARCH_OPTIONAL_KERNEL_RWX_DEFAULT is not set # CONFIG_ARCH_REUSE_HOST_VSYSCALL_AREA is not set -CONFIG_BINFMT_MISC=m CONFIG_BLK_DEV_COW_COMMON=y CONFIG_BLK_DEV_LOOP=y CONFIG_BLK_DEV_UBD=y diff --git a/target/linux/x86/64/config-4.14 b/target/linux/x86/64/config-4.14 index 2aad5acc09..d4d464b61b 100644 --- a/target/linux/x86/64/config-4.14 +++ b/target/linux/x86/64/config-4.14 @@ -273,6 +273,7 @@ CONFIG_INTEL_SOC_DTS_THERMAL=y # CONFIG_IOMMU_DEBUG is not set CONFIG_IOSF_MBI=y # CONFIG_IOSF_MBI_DEBUG is not set +# CONFIG_ISCSI_IBFT is not set # CONFIG_ISCSI_IBFT_FIND is not set CONFIG_KALLSYMS_ABSOLUTE_PERCPU=y # CONFIG_KVM_DEBUG_FS is not set diff --git a/target/linux/x86/config-4.14 b/target/linux/x86/config-4.14 index c31783eb8f..014e7b275b 100644 --- a/target/linux/x86/config-4.14 +++ b/target/linux/x86/config-4.14 @@ -54,7 +54,6 @@ CONFIG_ARCH_WANT_IPC_PARSE_VERSION=y CONFIG_ATA=y CONFIG_ATA_GENERIC=y CONFIG_ATA_PIIX=y -CONFIG_BINFMT_MISC=y CONFIG_BLK_DEV_LOOP=y CONFIG_BLK_DEV_SD=y CONFIG_BLK_MQ_PCI=y @@ -506,7 +505,7 @@ CONFIG_X86_PPRO_FENCE=y # CONFIG_X86_REBOOTFIXUPS is not set CONFIG_X86_REROUTE_FOR_BROKEN_BOOT_IRQS=y CONFIG_X86_RESERVE_LOW=64 -# CONFIG_X86_SMAP is not set +CONFIG_X86_SMAP=y # CONFIG_X86_SPEEDSTEP_CENTRINO is not set # CONFIG_X86_SPEEDSTEP_ICH is not set # CONFIG_X86_SPEEDSTEP_LIB is not set diff --git a/target/linux/x86/config-4.19 b/target/linux/x86/config-4.19 index 80a94b24d3..d8c2d966d0 100644 --- a/target/linux/x86/config-4.19 +++ b/target/linux/x86/config-4.19 @@ -53,7 +53,6 @@ CONFIG_ARCH_WANT_IPC_PARSE_VERSION=y CONFIG_ATA=y CONFIG_ATA_GENERIC=y CONFIG_ATA_PIIX=y -CONFIG_BINFMT_MISC=y CONFIG_BLK_DEV_LOOP=y CONFIG_BLK_DEV_SD=y CONFIG_BLK_MQ_PCI=y @@ -485,7 +484,7 @@ CONFIG_X86_PLATFORM_DEVICES=y # CONFIG_X86_REBOOTFIXUPS is not set CONFIG_X86_REROUTE_FOR_BROKEN_BOOT_IRQS=y CONFIG_X86_RESERVE_LOW=64 -# CONFIG_X86_SMAP is not set +CONFIG_X86_SMAP=y # CONFIG_X86_SPEEDSTEP_CENTRINO is not set # CONFIG_X86_SPEEDSTEP_ICH is not set # CONFIG_X86_SPEEDSTEP_SMI is not set diff --git a/target/linux/x86/generic/config-4.14 b/target/linux/x86/generic/config-4.14 index 92380f526d..1e31e117dd 100644 --- a/target/linux/x86/generic/config-4.14 +++ b/target/linux/x86/generic/config-4.14 @@ -214,6 +214,7 @@ CONFIG_IRQ_BYPASS_MANAGER=y CONFIG_ISA=y CONFIG_ISAPNP=y CONFIG_ISA_BUS_API=y +# CONFIG_ISCSI_IBFT is not set # CONFIG_ISCSI_IBFT_FIND is not set CONFIG_ISO9660_FS=y # CONFIG_JOLIET is not set diff --git a/target/linux/x86/generic/profiles/000-Generic.mk b/target/linux/x86/generic/profiles/000-Generic.mk index 90f989a91d..4760767eee 100644 --- a/target/linux/x86/generic/profiles/000-Generic.mk +++ b/target/linux/x86/generic/profiles/000-Generic.mk @@ -7,7 +7,8 @@ define Profile/Generic NAME:=Generic - PACKAGES:=kmod-3c59x kmod-e100 kmod-e1000 kmod-natsemi kmod-ne2k-pci \ + PACKAGES:=kmod-e1000e kmod-igb kmod-bnx2 \ + kmod-3c59x kmod-e100 kmod-e1000 kmod-natsemi kmod-ne2k-pci \ kmod-pcnet32 kmod-8139too kmod-r8169 kmod-sis900 kmod-tg3 \ kmod-via-rhine kmod-via-velocity endef diff --git a/target/linux/x86/geode/config-4.14 b/target/linux/x86/geode/config-4.14 index f75891cee7..796aba7cd2 100644 --- a/target/linux/x86/geode/config-4.14 +++ b/target/linux/x86/geode/config-4.14 @@ -73,6 +73,7 @@ CONFIG_IOSF_MBI=y CONFIG_ISA=y # CONFIG_ISAPNP is not set CONFIG_ISA_BUS_API=y +# CONFIG_ISCSI_IBFT is not set # CONFIG_ISCSI_IBFT_FIND is not set # CONFIG_LANCE is not set CONFIG_LEDS_GPIO=y diff --git a/target/linux/x86/legacy/config-4.14 b/target/linux/x86/legacy/config-4.14 index dab36d39fc..6fa2d083ab 100644 --- a/target/linux/x86/legacy/config-4.14 +++ b/target/linux/x86/legacy/config-4.14 @@ -133,6 +133,7 @@ CONFIG_IOSF_MBI=y CONFIG_ISA=y CONFIG_ISAPNP=y CONFIG_ISA_BUS_API=y +# CONFIG_ISCSI_IBFT is not set # CONFIG_ISCSI_IBFT_FIND is not set CONFIG_ISO9660_FS=y # CONFIG_JOLIET is not set diff --git a/target/linux/x86/patches-4.14/200-pcengines-apu2-reboot.patch b/target/linux/x86/patches-4.14/200-pcengines-apu2-reboot.patch index 048dfae04e..1426140183 100644 --- a/target/linux/x86/patches-4.14/200-pcengines-apu2-reboot.patch +++ b/target/linux/x86/patches-4.14/200-pcengines-apu2-reboot.patch @@ -1,6 +1,6 @@ --- a/arch/x86/kernel/reboot.c +++ b/arch/x86/kernel/reboot.c -@@ -448,6 +448,16 @@ static const struct dmi_system_id reboot +@@ -469,6 +469,16 @@ static const struct dmi_system_id reboot }, }, diff --git a/target/linux/x86/patches-4.19/011-tune_lzma_options.patch b/target/linux/x86/patches-4.19/011-tune_lzma_options.patch deleted file mode 100644 index e680f9c484..0000000000 --- a/target/linux/x86/patches-4.19/011-tune_lzma_options.patch +++ /dev/null @@ -1,22 +0,0 @@ ---- a/scripts/Makefile.lib -+++ b/scripts/Makefile.lib -@@ -324,7 +324,7 @@ cmd_bzip2 = (cat $(filter-out FORCE,$^) - - quiet_cmd_lzma = LZMA $@ - cmd_lzma = (cat $(filter-out FORCE,$^) | \ -- lzma e -d20 -lc1 -lp2 -pb2 -eos -si -so && $(call size_append, $(filter-out FORCE,$^))) > $@ || \ -+ lzma e -lc8 -eos -si -so && $(call size_append, $(filter-out FORCE,$^))) > $@ || \ - (rm -f $@ ; false) - - quiet_cmd_lzo = LZO $@ ---- a/arch/x86/include/asm/boot.h -+++ b/arch/x86/include/asm/boot.h -@@ -24,7 +24,7 @@ - # error "Invalid value for CONFIG_PHYSICAL_ALIGN" - #endif - --#ifdef CONFIG_KERNEL_BZIP2 -+#if defined(CONFIG_KERNEL_BZIP2) || defined(CONFIG_KERNEL_LZMA) - # define BOOT_HEAP_SIZE 0x400000 - #else /* !CONFIG_KERNEL_BZIP2 */ - # define BOOT_HEAP_SIZE 0x10000 diff --git a/target/linux/x86/patches-4.19/100-fix_cs5535_clockevt.patch b/target/linux/x86/patches-4.19/100-fix_cs5535_clockevt.patch deleted file mode 100644 index c3a7fce9ce..0000000000 --- a/target/linux/x86/patches-4.19/100-fix_cs5535_clockevt.patch +++ /dev/null @@ -1,12 +0,0 @@ ---- a/drivers/clocksource/cs5535-clockevt.c -+++ b/drivers/clocksource/cs5535-clockevt.c -@@ -130,7 +130,8 @@ static irqreturn_t mfgpt_tick(int irq, v - cs5535_mfgpt_write(cs5535_event_clock, MFGPT_REG_SETUP, - MFGPT_SETUP_CNTEN | MFGPT_SETUP_CMP2); - -- cs5535_clockevent.event_handler(&cs5535_clockevent); -+ if (cs5535_clockevent.event_handler) -+ cs5535_clockevent.event_handler(&cs5535_clockevent); - return IRQ_HANDLED; - } - diff --git a/target/linux/x86/patches-4.19/200-pcengines-apu2-reboot.patch b/target/linux/x86/patches-4.19/200-pcengines-apu2-reboot.patch deleted file mode 100644 index 048dfae04e..0000000000 --- a/target/linux/x86/patches-4.19/200-pcengines-apu2-reboot.patch +++ /dev/null @@ -1,19 +0,0 @@ ---- a/arch/x86/kernel/reboot.c -+++ b/arch/x86/kernel/reboot.c -@@ -448,6 +448,16 @@ static const struct dmi_system_id reboot - }, - }, - -+ /* PC Engines */ -+ { /* Handle problems with rebooting on PC Engines apu2 */ -+ .callback = set_pci_reboot, -+ .ident = "PC Engines apu2", -+ .matches = { -+ DMI_MATCH(DMI_BOARD_VENDOR, "PC Engines"), -+ DMI_MATCH(DMI_BOARD_NAME, "apu2"), -+ }, -+ }, -+ - /* Sony */ - { /* Handle problems with rebooting on Sony VGN-Z540N */ - .callback = set_bios_reboot, diff --git a/target/linux/x86/patches-4.19/800-hwmon-w83627ehf-dont-claim-nct677x.patch b/target/linux/x86/patches-4.19/800-hwmon-w83627ehf-dont-claim-nct677x.patch deleted file mode 100644 index ef2e1333e7..0000000000 --- a/target/linux/x86/patches-4.19/800-hwmon-w83627ehf-dont-claim-nct677x.patch +++ /dev/null @@ -1,30 +0,0 @@ ---- a/drivers/hwmon/w83627ehf.c -+++ b/drivers/hwmon/w83627ehf.c -@@ -2717,8 +2717,8 @@ static int __init w83627ehf_find(int sio - static const char sio_name_W83627UHG[] __initconst = "W83627UHG"; - static const char sio_name_W83667HG[] __initconst = "W83667HG"; - static const char sio_name_W83667HG_B[] __initconst = "W83667HG-B"; -- static const char sio_name_NCT6775[] __initconst = "NCT6775F"; -- static const char sio_name_NCT6776[] __initconst = "NCT6776F"; -+/* static const char sio_name_NCT6775[] __initconst = "NCT6775F"; -+ static const char sio_name_NCT6776[] __initconst = "NCT6776F"; */ - - u16 val; - const char *sio_name; -@@ -2762,14 +2762,14 @@ static int __init w83627ehf_find(int sio - sio_data->kind = w83667hg_b; - sio_name = sio_name_W83667HG_B; - break; -- case SIO_NCT6775_ID: -+/* case SIO_NCT6775_ID: - sio_data->kind = nct6775; - sio_name = sio_name_NCT6775; - break; - case SIO_NCT6776_ID: - sio_data->kind = nct6776; - sio_name = sio_name_NCT6776; -- break; -+ break; */ - default: - if (val != 0xffff) - pr_debug("unsupported chip ID: 0x%04x\n", val); diff --git a/target/linux/xburst/Makefile b/target/linux/xburst/Makefile deleted file mode 100644 index 16d0b8b1b4..0000000000 --- a/target/linux/xburst/Makefile +++ /dev/null @@ -1,25 +0,0 @@ -# -# Copyright (C) 2009-2011 OpenWrt.org -# -# This is free software, licensed under the GNU General Public License v2. -# See /LICENSE for more information. -# -include $(TOPDIR)/rules.mk - -ARCH:=mipsel -BOARD:=xburst -BOARDNAME:=Ingenic XBurst -FEATURES:=targz nand ubifs audio source-only -SUBTARGETS:=qi_lb60 - -KERNEL_PATCHVER:=3.18 - -DEVICE_TYPE:=other - -define Target/Description - Build firmware images for XBurst JZ47x0 based boards. -endef - -include $(INCLUDE_DIR)/target.mk - -$(eval $(call BuildTarget)) diff --git a/target/linux/xburst/base-files/etc/board.d/01_system b/target/linux/xburst/base-files/etc/board.d/01_system deleted file mode 100755 index 16f4987aae..0000000000 --- a/target/linux/xburst/base-files/etc/board.d/01_system +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/sh - -. /lib/functions/uci-defaults.sh - -board_config_update - -ucidef_set_hostname "BenNanoNote" -ucidef_set_ntpserver - -board_config_flush - -exit 0 diff --git a/target/linux/xburst/base-files/etc/config/fstab b/target/linux/xburst/base-files/etc/config/fstab deleted file mode 100644 index 522356112f..0000000000 --- a/target/linux/xburst/base-files/etc/config/fstab +++ /dev/null @@ -1,6 +0,0 @@ -config mount - option target /card - option device /dev/mmcblk0p1 - option fstype auto - option options rw,sync - option enabled 1 diff --git a/target/linux/xburst/base-files/etc/config/network b/target/linux/xburst/base-files/etc/config/network deleted file mode 100644 index a086003e32..0000000000 --- a/target/linux/xburst/base-files/etc/config/network +++ /dev/null @@ -1,13 +0,0 @@ -# Copyright (C) 2006 OpenWrt.org - -config interface loopback - option ifname lo - option proto static - option ipaddr 127.0.0.1 - option netmask 255.0.0.0 - -config interface lan - option ifname usb0 - option proto static - option ipaddr 192.168.1.1 - option netmask 255.255.255.0 diff --git a/target/linux/xburst/config-3.18 b/target/linux/xburst/config-3.18 deleted file mode 100644 index 099f5b0ed6..0000000000 --- a/target/linux/xburst/config-3.18 +++ /dev/null @@ -1,346 +0,0 @@ -CONFIG_ARCH_BINFMT_ELF_RANDOMIZE_PIE=y -CONFIG_ARCH_DISCARD_MEMBLOCK=y -CONFIG_ARCH_HAS_ATOMIC64_DEC_IF_POSITIVE=y -# CONFIG_ARCH_HAS_SG_CHAIN is not set -CONFIG_ARCH_HAVE_CUSTOM_GPIO_H=y -CONFIG_ARCH_HIBERNATION_POSSIBLE=y -CONFIG_ARCH_MIGHT_HAVE_PC_PARPORT=y -CONFIG_ARCH_MIGHT_HAVE_PC_SERIO=y -CONFIG_ARCH_REQUIRE_GPIOLIB=y -CONFIG_ARCH_SUSPEND_POSSIBLE=y -CONFIG_ARCH_WANT_IPC_PARSE_VERSION=y -# CONFIG_BACKLIGHT_ADP8860 is not set -# CONFIG_BACKLIGHT_ADP8870 is not set -CONFIG_BACKLIGHT_CLASS_DEVICE=y -# CONFIG_BACKLIGHT_GENERIC is not set -CONFIG_BACKLIGHT_LCD_SUPPORT=y -# CONFIG_BACKLIGHT_PWM is not set -CONFIG_BATTERY_JZ4740=y -# CONFIG_BLK_DEV_INITRD is not set -CONFIG_CHARGER_GPIO=y -CONFIG_CLONE_BACKWARDS=y -CONFIG_CONFIGFS_FS=y -CONFIG_CONSOLE_TRANSLATIONS=y -CONFIG_CPU_GENERIC_DUMP_TLB=y -CONFIG_CPU_HAS_PREFETCH=y -CONFIG_CPU_HAS_SYNC=y -CONFIG_CPU_LITTLE_ENDIAN=y -CONFIG_CPU_MIPS32=y -CONFIG_CPU_MIPS32_R1=y -CONFIG_CPU_MIPSR1=y -CONFIG_CPU_NEEDS_NO_SMARTMIPS_OR_MICROMIPS=y -CONFIG_CPU_R4K_CACHE_TLB=y -CONFIG_CPU_R4K_FPU=y -CONFIG_CPU_SUPPORTS_32BIT_KERNEL=y -CONFIG_CPU_SUPPORTS_HIGHMEM=y -CONFIG_CRC16=y -CONFIG_CRYPTO_CRC32C=y -CONFIG_CRYPTO_DEFLATE=y -CONFIG_CRYPTO_HASH=y -CONFIG_CRYPTO_HASH2=y -CONFIG_CRYPTO_LZO=y -CONFIG_CRYPTO_RNG2=y -CONFIG_CRYPTO_WORKQUEUE=y -CONFIG_DMADEVICES=y -CONFIG_DMA_ENGINE=y -CONFIG_DMA_JZ4740=y -CONFIG_DMA_NONCOHERENT=y -CONFIG_DMA_VIRTUAL_CHANNELS=y -CONFIG_DUMMY_CONSOLE=y -# CONFIG_DW_DMAC_CORE is not set -CONFIG_EARLY_PRINTK=y -CONFIG_ENABLE_MUST_CHECK=y -CONFIG_EXT4_FS=y -CONFIG_FAT_FS=y -CONFIG_FB=y -CONFIG_FB_CMDLINE=y -CONFIG_FB_JZ4740=y -CONFIG_FB_SYS_COPYAREA=y -CONFIG_FB_SYS_FILLRECT=y -CONFIG_FB_SYS_IMAGEBLIT=y -CONFIG_FONTS=y -# CONFIG_FONT_10x18 is not set -# CONFIG_FONT_6x10 is not set -CONFIG_FONT_6x11=y -# CONFIG_FONT_7x14 is not set -# CONFIG_FONT_8x16 is not set -# CONFIG_FONT_8x8 is not set -# CONFIG_FONT_ACORN_8x8 is not set -# CONFIG_FONT_MINI_4x6 is not set -# CONFIG_FONT_PEARL_8x8 is not set -# CONFIG_FONT_SUN12x22 is not set -# CONFIG_FONT_SUN8x16 is not set -CONFIG_FONT_SUPPORT=y -CONFIG_FORCE_MAX_ZONEORDER=12 -CONFIG_FRAMEBUFFER_CONSOLE=y -# CONFIG_FRAMEBUFFER_CONSOLE_DETECT_PRIMARY is not set -# CONFIG_FRAMEBUFFER_CONSOLE_ROTATION is not set -CONFIG_FREEZER=y -CONFIG_FS_MBCACHE=y -CONFIG_GENERIC_ATOMIC64=y -CONFIG_GENERIC_CLOCKEVENTS=y -CONFIG_GENERIC_CLOCKEVENTS_BUILD=y -CONFIG_GENERIC_CMOS_UPDATE=y -CONFIG_GENERIC_IO=y -CONFIG_GENERIC_IRQ_CHIP=y -CONFIG_GENERIC_IRQ_SHOW=y -CONFIG_GENERIC_PCI_IOMAP=y -CONFIG_GENERIC_SMP_IDLE_THREAD=y -CONFIG_GPIOLIB=y -CONFIG_GPIO_DEVRES=y -CONFIG_HARDWARE_WATCHPOINTS=y -CONFIG_HAS_DMA=y -CONFIG_HAS_IOMEM=y -CONFIG_HAS_IOPORT_MAP=y -# CONFIG_HAVE_64BIT_ALIGNED_ACCESS is not set -CONFIG_HAVE_ARCH_JUMP_LABEL=y -CONFIG_HAVE_ARCH_KGDB=y -CONFIG_HAVE_ARCH_SECCOMP_FILTER=y -CONFIG_HAVE_ARCH_TRACEHOOK=y -# CONFIG_HAVE_BOOTMEM_INFO_NODE is not set -CONFIG_HAVE_BPF_JIT=y -CONFIG_HAVE_CC_STACKPROTECTOR=y -CONFIG_HAVE_CLK=y -CONFIG_HAVE_CONTEXT_TRACKING=y -CONFIG_HAVE_C_RECORDMCOUNT=y -CONFIG_HAVE_DEBUG_KMEMLEAK=y -CONFIG_HAVE_DEBUG_STACKOVERFLOW=y -CONFIG_HAVE_DMA_API_DEBUG=y -CONFIG_HAVE_DMA_ATTRS=y -CONFIG_HAVE_DMA_CONTIGUOUS=y -CONFIG_HAVE_DYNAMIC_FTRACE=y -CONFIG_HAVE_FTRACE_MCOUNT_RECORD=y -CONFIG_HAVE_FUNCTION_GRAPH_TRACER=y -CONFIG_HAVE_FUNCTION_TRACER=y -CONFIG_HAVE_GENERIC_DMA_COHERENT=y -CONFIG_HAVE_IDE=y -CONFIG_HAVE_KERNEL_BZIP2=y -CONFIG_HAVE_KERNEL_GZIP=y -CONFIG_HAVE_KERNEL_LZ4=y -CONFIG_HAVE_KERNEL_LZMA=y -CONFIG_HAVE_KERNEL_LZO=y -CONFIG_HAVE_KERNEL_XZ=y -CONFIG_HAVE_MEMBLOCK=y -CONFIG_HAVE_MEMBLOCK_NODE_MAP=y -CONFIG_HAVE_MOD_ARCH_SPECIFIC=y -CONFIG_HAVE_NET_DSA=y -CONFIG_HAVE_OPROFILE=y -CONFIG_HAVE_PERF_EVENTS=y -CONFIG_HAVE_SYSCALL_TRACEPOINTS=y -CONFIG_HW_CONSOLE=y -CONFIG_HZ_PERIODIC=y -CONFIG_I2C=y -CONFIG_I2C_BOARDINFO=y -CONFIG_INPUT=y -CONFIG_INPUT_EVDEV=y -CONFIG_INPUT_KEYBOARD=y -CONFIG_INPUT_MATRIXKMAP=y -CONFIG_INPUT_MOUSE=y -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_PWM_BEEPER=y -CONFIG_INPUT_UINPUT=y -CONFIG_IRQ_CPU=y -CONFIG_IRQ_DOMAIN=y -CONFIG_IRQ_FORCED_THREADING=y -CONFIG_IRQ_WORK=y -CONFIG_JBD2=y -CONFIG_JZ4740_QI_LB60=y -CONFIG_KALLSYMS=y -CONFIG_KEXEC=y -CONFIG_KEYBOARD_GPIO=y -CONFIG_KEYBOARD_MATRIX=y -# CONFIG_LCD_AMS369FG06 is not set -CONFIG_LCD_CLASS_DEVICE=y -CONFIG_LCD_ILI8960=y -# CONFIG_LCD_L4F00242T03 is not set -# CONFIG_LCD_LD9040 is not set -# CONFIG_LCD_LMS283GF05 is not set -# CONFIG_LCD_LTV350QV is not set -# CONFIG_LCD_PLATFORM is not set -# CONFIG_LCD_S6E63M0 is not set -# CONFIG_LCD_TDO24M is not set -# CONFIG_LCD_VGG2432A4 is not set -CONFIG_LEGACY_PTYS=y -CONFIG_LEGACY_PTY_COUNT=2 -CONFIG_LZO_COMPRESS=y -CONFIG_LZO_DECOMPRESS=y -CONFIG_MACH_JZ4740=y -CONFIG_MFD_CORE=y -CONFIG_MFD_JZ4740_ADC=y -CONFIG_MIPS=y -# CONFIG_MIPS_HUGE_TLB_SUPPORT is not set -CONFIG_MIPS_L1_CACHE_SHIFT=5 -# CONFIG_MIPS_MACHINE is not set -CONFIG_MMC=y -CONFIG_MMC_BLOCK=y -# CONFIG_MMC_BLOCK_BOUNCE is not set -CONFIG_MMC_JZ4740=y -CONFIG_MODULES_USE_ELF_REL=y -# CONFIG_MOUSE_BCM5974 is not set -# CONFIG_MOUSE_CYAPA is not set -# CONFIG_MOUSE_PS2 is not set -# CONFIG_MOUSE_SERIAL is not set -# CONFIG_MOUSE_VSXXXAA is not set -# CONFIG_MTD_CFI is not set -# CONFIG_MTD_COMPLEX_MAPPINGS is not set -CONFIG_MTD_NAND=y -CONFIG_MTD_NAND_ECC=y -CONFIG_MTD_NAND_JZ4740=y -CONFIG_MTD_UBI=y -CONFIG_MTD_UBI_BEB_LIMIT=20 -# CONFIG_MTD_UBI_BLOCK is not set -# CONFIG_MTD_UBI_FASTMAP is not set -# CONFIG_MTD_UBI_GLUEBI is not set -CONFIG_MTD_UBI_WL_THRESHOLD=4096 -CONFIG_MUSB_PIO_ONLY=y -CONFIG_NEED_DMA_MAP_STATE=y -CONFIG_NEED_PER_CPU_KM=y -CONFIG_NLS=y -CONFIG_NLS_ASCII=y -CONFIG_NLS_CODEPAGE_1250=y -CONFIG_NLS_CODEPAGE_1251=y -CONFIG_NLS_CODEPAGE_437=y -CONFIG_NLS_CODEPAGE_737=y -CONFIG_NLS_CODEPAGE_775=y -CONFIG_NLS_CODEPAGE_850=y -CONFIG_NLS_CODEPAGE_852=y -CONFIG_NLS_CODEPAGE_855=y -CONFIG_NLS_CODEPAGE_857=y -CONFIG_NLS_CODEPAGE_860=y -CONFIG_NLS_CODEPAGE_861=y -CONFIG_NLS_CODEPAGE_862=y -CONFIG_NLS_CODEPAGE_863=y -CONFIG_NLS_CODEPAGE_864=y -CONFIG_NLS_CODEPAGE_865=y -CONFIG_NLS_CODEPAGE_866=y -CONFIG_NLS_CODEPAGE_869=y -CONFIG_NLS_CODEPAGE_874=y -CONFIG_NLS_CODEPAGE_932=y -CONFIG_NLS_CODEPAGE_936=y -CONFIG_NLS_CODEPAGE_949=y -CONFIG_NLS_CODEPAGE_950=y -CONFIG_NLS_ISO8859_1=y -CONFIG_NLS_ISO8859_13=y -CONFIG_NLS_ISO8859_14=y -CONFIG_NLS_ISO8859_15=y -CONFIG_NLS_ISO8859_2=y -CONFIG_NLS_ISO8859_3=y -CONFIG_NLS_ISO8859_4=y -CONFIG_NLS_ISO8859_5=y -CONFIG_NLS_ISO8859_6=y -CONFIG_NLS_ISO8859_7=y -CONFIG_NLS_ISO8859_8=y -CONFIG_NLS_ISO8859_9=y -CONFIG_NLS_KOI8_R=y -CONFIG_NLS_KOI8_U=y -CONFIG_NLS_UTF8=y -CONFIG_NOP_USB_XCEIV=y -# CONFIG_NO_IOPORT_MAP is not set -CONFIG_PAGEFLAGS_EXTENDED=y -CONFIG_PERF_USE_VMALLOC=y -CONFIG_PM=y -CONFIG_PM_CLK=y -# CONFIG_PM_DEBUG is not set -CONFIG_PM_SLEEP=y -CONFIG_POWER_SUPPLY=y -CONFIG_PREEMPT=y -CONFIG_PREEMPT_COUNT=y -# CONFIG_PREEMPT_NONE is not set -CONFIG_PREEMPT_RCU=y -CONFIG_PRINTK_TIME=y -CONFIG_PWM=y -CONFIG_PWM_JZ4740=y -CONFIG_PWM_SYSFS=y -# CONFIG_RCU_BOOST is not set -CONFIG_RCU_CPU_STALL_VERBOSE=y -CONFIG_RCU_STALL_COMMON=y -CONFIG_REGMAP=y -CONFIG_REGMAP_I2C=y -CONFIG_REGMAP_MMIO=y -CONFIG_REGMAP_SPI=y -CONFIG_RTC_CLASS=y -# CONFIG_RTC_DRV_CMOS is not set -CONFIG_RTC_DRV_JZ4740=y -# CONFIG_SCSI_DMA is not set -CONFIG_SERIO=y -CONFIG_SERIO_LIBPS2=y -CONFIG_SND=y -CONFIG_SND_COMPRESS_OFFLOAD=y -CONFIG_SND_DMAENGINE_PCM=y -# CONFIG_SND_EMU10K1_SEQ is not set -CONFIG_SND_JACK=y -CONFIG_SND_JZ4740_SOC=y -CONFIG_SND_JZ4740_SOC_I2S=y -CONFIG_SND_JZ4740_SOC_QI_LB60=y -# CONFIG_SND_OPL3_LIB_SEQ is not set -# CONFIG_SND_OPL4_LIB_SEQ is not set -CONFIG_SND_PCM=y -# CONFIG_SND_RAWMIDI_SEQ is not set -# CONFIG_SND_SBAWE_SEQ is not set -CONFIG_SND_SOC=y -# CONFIG_SND_SOC_FSL_SSI is not set -CONFIG_SND_SOC_GENERIC_DMAENGINE_PCM=y -CONFIG_SND_SOC_I2C_AND_SPI=y -# CONFIG_SND_SOC_IMX_AUDMUX is not set -CONFIG_SND_SOC_JZ4740_CODEC=y -CONFIG_SND_TIMER=y -CONFIG_SOUND=y -# CONFIG_SOUND_OSS_CORE is not set -CONFIG_SPI=y -CONFIG_SPI_BITBANG=y -CONFIG_SPI_GPIO=y -CONFIG_SPI_MASTER=y -# CONFIG_SQUASHFS is not set -# CONFIG_STAGING is not set -CONFIG_SUSPEND=y -CONFIG_SUSPEND_FREEZER=y -# CONFIG_SYN_COOKIES is not set -CONFIG_SYS_HAS_CPU_MIPS32_R1=y -CONFIG_SYS_HAS_EARLY_PRINTK=y -CONFIG_SYS_SUPPORTS_32BIT_KERNEL=y -CONFIG_SYS_SUPPORTS_ARBIT_HZ=y -CONFIG_SYS_SUPPORTS_LITTLE_ENDIAN=y -CONFIG_SYS_SUPPORTS_ZBOOT=y -CONFIG_SYS_SUPPORTS_ZBOOT_UART16550=y -CONFIG_TICK_CPU_ACCOUNTING=y -CONFIG_TREE_PREEMPT_RCU=y -CONFIG_UBIFS_FS=y -CONFIG_UBIFS_FS_ADVANCED_COMPR=y -CONFIG_UBIFS_FS_LZO=y -CONFIG_UBIFS_FS_ZLIB=y -CONFIG_UNINLINE_SPIN_UNLOCK=y -CONFIG_USB=y -# CONFIG_USB_AUDIO is not set -CONFIG_USB_COMMON=y -# CONFIG_USB_EHCI_HCD is not set -CONFIG_USB_ETH=y -# CONFIG_USB_ETH_EEM is not set -# CONFIG_USB_ETH_RNDIS is not set -CONFIG_USB_F_ECM=y -CONFIG_USB_F_SUBSET=y -CONFIG_USB_GADGET=y -CONFIG_USB_LIBCOMPOSITE=y -# CONFIG_USB_MUSB_DUAL_ROLE is not set -CONFIG_USB_MUSB_GADGET=y -CONFIG_USB_MUSB_HDRC=y -# CONFIG_USB_MUSB_HOST is not set -CONFIG_USB_MUSB_JZ4740=y -# CONFIG_USB_MUSB_TUSB6010 is not set -# CONFIG_USB_MUSB_UX500 is not set -CONFIG_USB_OTG_BLACKLIST_HUB=y -CONFIG_USB_PHY=y -CONFIG_USB_SUPPORT=y -CONFIG_USB_U_ETHER=y -CONFIG_VFAT_FS=y -# CONFIG_VGA_CONSOLE is not set -CONFIG_VT=y -CONFIG_VT_CONSOLE=y -CONFIG_VT_CONSOLE_SLEEP=y -CONFIG_VT_HW_CONSOLE_BINDING=y -# CONFIG_WATCHDOG is not set -CONFIG_ZLIB_DEFLATE=y -CONFIG_ZLIB_INFLATE=y -CONFIG_ZONE_DMA_FLAG=0 diff --git a/target/linux/xburst/image/Makefile b/target/linux/xburst/image/Makefile deleted file mode 100644 index 35bff51375..0000000000 --- a/target/linux/xburst/image/Makefile +++ /dev/null @@ -1,46 +0,0 @@ -# -# Copyright (C) 2009-2010 OpenWrt.org -# -# This is free software, licensed under the GNU General Public License v2. -# See /LICENSE for more information. -# - -JFFS2_BLOCKSIZE=256k 512k - -include $(TOPDIR)/rules.mk -include $(INCLUDE_DIR)/image.mk - -ifneq ($(CONFIG_TARGET_xburst_qi_lb60),) -UBI_OPTS = -m 4096 -p 512KiB -UBIFS_OPTS = -m 4096 -e 516096 -c 4095 -else -UBI_OPTS = -m 2048 -p 128KiB -s 512 -UBIFS_OPTS = -m 2048 -e 126KiB -c 4096 -endif - -UIMAGE:=$(BIN_DIR)/$(IMG_PREFIX)-uImage.bin - -define MkImageGzip - gzip -9n -c $(1) > $(1).gz - mkimage -A mips -O linux -T kernel -a 0x80010000 -C gzip \ - -e 0x80010000 -n 'MIPS libreCMC Linux-$(LINUX_VERSION)' \ - -d $(1).gz $(2) -endef - -define Image/Prepare - $(call MkImageGzip,$(KDIR)/vmlinux,$(KDIR)/uimage) -endef - -define Image/BuildKernel - cp $(KDIR)/uimage $(UIMAGE) -endef - -define Image/Build/squashfs - $(call prepare_generic_squashfs,$(KDIR)/root.squashfs) -endef - -define Image/Build - dd if=$(KDIR)/root.$(1) of=$(BIN_DIR)/$(IMG_PREFIX)-root.$(1) bs=128k conv=sync -endef - -$(eval $(call BuildImage)) diff --git a/target/linux/xburst/image/ubinize.cfg b/target/linux/xburst/image/ubinize.cfg deleted file mode 100644 index 49d55b9840..0000000000 --- a/target/linux/xburst/image/ubinize.cfg +++ /dev/null @@ -1,14 +0,0 @@ -[rootfs] -# Volume mode (other option is static) -mode=ubi -# Source image -image=root.ubifs -# Volume ID in UBI image -vol_id=0 -# Allow for dynamic resize -vol_type=dynamic -# Volume name -vol_name=rootfs -# Autoresize volume at first mount -vol_flags=autoresize - diff --git a/target/linux/xburst/modules.mk b/target/linux/xburst/modules.mk deleted file mode 100644 index 95cebdad6a..0000000000 --- a/target/linux/xburst/modules.mk +++ /dev/null @@ -1,40 +0,0 @@ - - -SOUND_MENU:=Sound Support - -define KernelPackage/sound-soc-jz4740 - SUBMENU:=$(SOUND_MENU) - DEPENDS:=kmod-sound-soc-core @TARGET_xburst @BROKEN - TITLE:=JZ4740 SoC sound support - KCONFIG:=CONFIG_SND_JZ4740_SOC CONFIG_SND_JZ4740_SOC_I2S - FILES:= \ - $(LINUX_DIR)/sound/soc/jz4740/snd-soc-jz4740.ko \ - $(LINUX_DIR)/sound/soc/jz4740/snd-soc-jz4740-i2s.ko - AUTOLOAD:=$(call AutoLoad,60,snd-soc-jz4740 snd-soc-jz4740-i2s) -endef - -define KernelPackage/sound-soc-jz4740-codec - SUBMENU:=$(SOUND_MENU) - DEPENDS:=kmod-sound-soc-core @TARGET_xburst @BROKEN - TITLE:=JZ4740 SoC internal codec support - KCONFIG:=CONFIG_SND_SOC_JZ4740_CODEC - FILES:=$(LINUX_DIR)/sound/soc/codecs/snd-soc-jz4740-codec.ko - AUTOLOAD:=$(call AutoLoad,60,snd-soc-jz4740-codec) -endef - -define KernelPackage/sound-soc-xburst/default - SUBMENU:=$(SOUND_MENU) - DEPENDS:=kmod-sound-soc-jz4740 kmod-sound-soc-jz4740-codec @TARGET_xburst_$(if $(4),$(4),$(3)) @BROKEN - TITLE:=$(1) sound support - KCONFIG:=CONFIG_SND_JZ4740_SOC_$(2) - FILES:=$(LINUX_DIR)/sound/soc/jz4740/snd-soc-$(3).ko - AUTOLOAD:=$(call AutoLoad,65,snd-soc-$(3)) -endef - -define KernelPackage/sound-soc-qilb60 -$(call KernelPackage/sound-soc-xburst/default,QI NanoNote,QI_LB60,qi-lb60,qi_lb60) -endef - -$(eval $(call KernelPackage,sound-soc-jz4740)) -$(eval $(call KernelPackage,sound-soc-jz4740-codec)) -$(eval $(call KernelPackage,sound-soc-qilb60)) diff --git a/target/linux/xburst/patches-3.18/001-ubi-Read-only-the-vid-header-instead-of-the-whole-pa.patch b/target/linux/xburst/patches-3.18/001-ubi-Read-only-the-vid-header-instead-of-the-whole-pa.patch deleted file mode 100644 index 93851d7283..0000000000 --- a/target/linux/xburst/patches-3.18/001-ubi-Read-only-the-vid-header-instead-of-the-whole-pa.patch +++ /dev/null @@ -1,20 +0,0 @@ -From b0eb5175e0de3e5134a36a7da382d8811562af12 Mon Sep 17 00:00:00 2001 -From: Lars-Peter Clausen -Date: Tue, 15 Mar 2011 12:49:15 +0100 -Subject: [PATCH 1/7] ubi: Read only the vid header instead of the whole page - ---- - drivers/mtd/ubi/io.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - ---- a/drivers/mtd/ubi/io.c -+++ b/drivers/mtd/ubi/io.c -@@ -1014,7 +1014,7 @@ int ubi_io_read_vid_hdr(struct ubi_devic - - p = (char *)vid_hdr - ubi->vid_hdr_shift; - read_err = ubi_io_read(ubi, p, pnum, ubi->vid_hdr_aloffset, -- ubi->vid_hdr_alsize); -+ UBI_VID_HDR_SIZE + ubi->vid_hdr_shift); - if (read_err && read_err != UBI_IO_BITFLIPS && !mtd_is_eccerr(read_err)) - return read_err; - diff --git a/target/linux/xburst/patches-3.18/002-NAND-Optimize-NAND_ECC_HW_OOB_FIRST-read.patch b/target/linux/xburst/patches-3.18/002-NAND-Optimize-NAND_ECC_HW_OOB_FIRST-read.patch deleted file mode 100644 index ce87452a16..0000000000 --- a/target/linux/xburst/patches-3.18/002-NAND-Optimize-NAND_ECC_HW_OOB_FIRST-read.patch +++ /dev/null @@ -1,43 +0,0 @@ -From 98d33db1c87e2447b9b203399d2f995e05ecdb52 Mon Sep 17 00:00:00 2001 -From: Lars-Peter Clausen -Date: Sat, 26 Feb 2011 15:30:07 +0100 -Subject: [PATCH 2/7] NAND: Optimize NAND_ECC_HW_OOB_FIRST read - -Avoid sending unnecessary READ commands to the chip. ---- - drivers/mtd/nand/nand_base.c | 17 +++++++++++++---- - 1 file changed, 13 insertions(+), 4 deletions(-) - ---- a/drivers/mtd/nand/nand_base.c -+++ b/drivers/mtd/nand/nand_base.c -@@ -1365,9 +1365,16 @@ static int nand_read_page_hwecc_oob_firs - unsigned int max_bitflips = 0; - - /* Read the OOB area first */ -- chip->cmdfunc(mtd, NAND_CMD_READOOB, 0, page); -- chip->read_buf(mtd, chip->oob_poi, mtd->oobsize); -- chip->cmdfunc(mtd, NAND_CMD_READ0, 0, page); -+ /* Read the OOB area first */ -+ if (mtd->writesize > 512) { -+ chip->cmdfunc(mtd, NAND_CMD_READ0, mtd->writesize, page); -+ chip->read_buf(mtd, chip->oob_poi, mtd->oobsize); -+ chip->cmdfunc(mtd, NAND_CMD_RNDOUT, 0, -1); -+ } else { -+ chip->cmdfunc(mtd, NAND_CMD_READOOB, 0, page); -+ chip->read_buf(mtd, chip->oob_poi, mtd->oobsize); -+ chip->cmdfunc(mtd, NAND_CMD_READ0, 0, page); -+ } - - for (i = 0; i < chip->ecc.total; i++) - ecc_code[i] = chip->oob_poi[eccpos[i]]; -@@ -1580,7 +1587,9 @@ static int nand_do_read_ops(struct mtd_i - __func__, buf); - - read_retry: -- chip->cmdfunc(mtd, NAND_CMD_READ0, 0x00, page); -+ if (chip->ecc.mode != NAND_ECC_HW_OOB_FIRST) { -+ chip->cmdfunc(mtd, NAND_CMD_READ0, 0x00, page); -+ } - - /* - * Now read the page into the buffer. Absent an error, diff --git a/target/linux/xburst/patches-3.18/003-NAND-Add-support-for-subpage-reads-for-NAND_ECC_HW_O.patch b/target/linux/xburst/patches-3.18/003-NAND-Add-support-for-subpage-reads-for-NAND_ECC_HW_O.patch deleted file mode 100644 index 65e739d479..0000000000 --- a/target/linux/xburst/patches-3.18/003-NAND-Add-support-for-subpage-reads-for-NAND_ECC_HW_O.patch +++ /dev/null @@ -1,104 +0,0 @@ -From 6031a240816d1c9a10f596d0648e586f6b878809 Mon Sep 17 00:00:00 2001 -From: Lars-Peter Clausen -Date: Tue, 15 Mar 2011 12:33:41 +0100 -Subject: [PATCH 3/7] NAND: Add support for subpage reads for - NAND_ECC_HW_OOB_FIRST - ---- - drivers/mtd/nand/nand_base.c | 77 +++++++++++++++++++++++++++++++++++++++++- - 1 file changed, 76 insertions(+), 1 deletion(-) - ---- a/drivers/mtd/nand/nand_base.c -+++ b/drivers/mtd/nand/nand_base.c -@@ -1398,6 +1398,75 @@ static int nand_read_page_hwecc_oob_firs - } - - /** -+ * nand_read_subpage_hwecc_oob_first - [REPLACABLE] hw ecc based sub-page read function -+ * @mtd: mtd info structure -+ * @chip: nand chip info structure -+ * @data_offs: offset of requested data within the page -+ * @readlen: data length -+ * @bufpoi: buffer to store read data -+ * @page: page number to read -+ * -+ * Hardware ECC for large page chips, require OOB to be read first. -+ * For this ECC mode, the write_page method is re-used from ECC_HW. -+ * These methods read/write ECC from the OOB area, unlike the -+ * ECC_HW_SYNDROME support with multiple ECC steps, follows the -+ * "infix ECC" scheme and reads/writes ECC from the data area, by -+ * overwriting the NAND manufacturer bad block markings. -+ */ -+static int nand_read_subpage_hwecc_oob_first(struct mtd_info *mtd, struct nand_chip *chip, -+ uint32_t data_offs, uint32_t readlen, uint8_t *bufpoi, int page) -+{ -+ int start_step, end_step, num_steps; -+ uint32_t *eccpos = chip->ecc.layout->eccpos; -+ uint8_t *p; -+ int data_col_addr; -+ int eccsize = chip->ecc.size; -+ int eccbytes = chip->ecc.bytes; -+ uint8_t *ecc_code = chip->buffers->ecccode; -+ uint8_t *ecc_calc = chip->buffers->ecccalc; -+ int i; -+ -+ /* Column address wihin the page aligned to ECC size */ -+ start_step = data_offs / chip->ecc.size; -+ end_step = (data_offs + readlen - 1) / chip->ecc.size; -+ num_steps = end_step - start_step + 1; -+ -+ data_col_addr = start_step * chip->ecc.size; -+ -+ /* Read the OOB area first */ -+ if (mtd->writesize > 512) { -+ chip->cmdfunc(mtd, NAND_CMD_READ0, mtd->writesize, page); -+ chip->read_buf(mtd, chip->oob_poi, mtd->oobsize); -+ chip->cmdfunc(mtd, NAND_CMD_RNDOUT, data_col_addr, -1); -+ } else { -+ chip->cmdfunc(mtd, NAND_CMD_READOOB, 0, page); -+ chip->read_buf(mtd, chip->oob_poi, mtd->oobsize); -+ chip->cmdfunc(mtd, NAND_CMD_READ0, data_col_addr, page); -+ } -+ -+ for (i = 0; i < chip->ecc.total; i++) -+ ecc_code[i] = chip->oob_poi[eccpos[i]]; -+ -+ p = bufpoi + data_col_addr; -+ -+ for (i = eccbytes * start_step; num_steps; num_steps--, i += eccbytes, p += eccsize) { -+ int stat; -+ -+ chip->ecc.hwctl(mtd, NAND_ECC_READ); -+ chip->read_buf(mtd, p, eccsize); -+ chip->ecc.calculate(mtd, p, &ecc_calc[i]); -+ -+ stat = chip->ecc.correct(mtd, p, &ecc_code[i], NULL); -+ if (stat < 0) -+ mtd->ecc_stats.failed++; -+ else -+ mtd->ecc_stats.corrected += stat; -+ } -+ -+ return 0; -+} -+ -+/** - * nand_read_page_syndrome - [REPLACEABLE] hardware ECC syndrome based page read - * @mtd: mtd info structure - * @chip: nand chip info structure -@@ -3961,8 +4030,14 @@ int nand_scan_tail(struct mtd_info *mtd) - pr_warn("No ECC functions supplied; hardware ECC not possible\n"); - BUG(); - } -- if (!ecc->read_page) -+ -+ if (!ecc->read_page) { - ecc->read_page = nand_read_page_hwecc_oob_first; -+ if (!ecc->read_subpage) { -+ ecc->read_subpage = nand_read_subpage_hwecc_oob_first; -+ chip->options |= NAND_SUBPAGE_READ; -+ } -+ } - - case NAND_ECC_HW: - /* Use standard hwecc read page function? */ diff --git a/target/linux/xburst/patches-3.18/004-ASoC-JZ4740-delay-activation-of-the-DAC-to-work-arou.patch b/target/linux/xburst/patches-3.18/004-ASoC-JZ4740-delay-activation-of-the-DAC-to-work-arou.patch deleted file mode 100644 index f2c26ade09..0000000000 --- a/target/linux/xburst/patches-3.18/004-ASoC-JZ4740-delay-activation-of-the-DAC-to-work-arou.patch +++ /dev/null @@ -1,33 +0,0 @@ -From 1a1095927d224403af8ad57c354cc64521bf3081 Mon Sep 17 00:00:00 2001 -From: Paul Cercueil -Date: Sat, 16 Jun 2012 19:36:31 +0200 -Subject: [PATCH 4/7] ASoC: JZ4740: delay activation of the DAC to work around - a sound bug. - -A proper fix of that bug would require a big rewrite of the driver, -which (I hope) will be done eventually. ---- - sound/soc/codecs/jz4740.c | 9 ++++++--- - 1 file changed, 6 insertions(+), 3 deletions(-) - ---- a/sound/soc/codecs/jz4740.c -+++ b/sound/soc/codecs/jz4740.c -@@ -249,12 +249,15 @@ static int jz4740_codec_set_bias_level(s - case SND_SOC_BIAS_ON: - break; - case SND_SOC_BIAS_PREPARE: -- mask = JZ4740_CODEC_1_VREF_DISABLE | -- JZ4740_CODEC_1_VREF_AMP_DISABLE | -- JZ4740_CODEC_1_HEADPHONE_POWERDOWN_M; -+ mask = JZ4740_CODEC_1_HEADPHONE_POWERDOWN_M; - value = 0; - - regmap_update_bits(regmap, JZ4740_REG_CODEC_1, mask, value); -+ -+ msleep(500); -+ mask = JZ4740_CODEC_1_VREF_DISABLE | -+ JZ4740_CODEC_1_VREF_AMP_DISABLE; -+ regmap_update_bits(regmap, JZ4740_REG_CODEC_1, mask, 0); - break; - case SND_SOC_BIAS_STANDBY: - /* The only way to clear the suspend flag is to reset the codec */ diff --git a/target/linux/xburst/patches-3.18/005-RTC-JZ4740-Init-the-regulator-register-on-startup.patch b/target/linux/xburst/patches-3.18/005-RTC-JZ4740-Init-the-regulator-register-on-startup.patch deleted file mode 100644 index f38483ab5c..0000000000 --- a/target/linux/xburst/patches-3.18/005-RTC-JZ4740-Init-the-regulator-register-on-startup.patch +++ /dev/null @@ -1,55 +0,0 @@ -From f05b1ecd7e4fde7e69320a4b7be461636e982991 Mon Sep 17 00:00:00 2001 -From: Paul Cercueil -Date: Thu, 13 Sep 2012 00:09:20 +0200 -Subject: [PATCH 5/7] RTC: JZ4740: Init the "regulator" register on startup. - -This register controls the accuracy of the RTC. uC/OS-II use -the RTC as a 100Hz clock, and writes a completely wrong value -on that register, that we have to overwrite if we want a working -real-time clock. - -Signed-off-by: Paul Cercueil ---- - drivers/rtc/rtc-jz4740.c | 17 +++++++++++++++++ - 1 file changed, 17 insertions(+) - ---- a/drivers/rtc/rtc-jz4740.c -+++ b/drivers/rtc/rtc-jz4740.c -@@ -15,6 +15,7 @@ - */ - - #include -+#include - #include - #include - #include -@@ -216,6 +217,7 @@ static int jz4740_rtc_probe(struct platf - struct jz4740_rtc *rtc; - uint32_t scratchpad; - struct resource *mem; -+ struct clk *rtc_clk; - - rtc = devm_kzalloc(&pdev->dev, sizeof(*rtc), GFP_KERNEL); - if (!rtc) -@@ -263,6 +265,21 @@ static int jz4740_rtc_probe(struct platf - } - } - -+ rtc_clk = clk_get(&pdev->dev, "rtc"); -+ if (IS_ERR(rtc_clk)) { -+ dev_err(&pdev->dev, "Failed to get RTC clock\n"); -+ return PTR_ERR(rtc_clk); -+ } -+ -+ /* TODO: initialize the ADJC bits (25:16) to fine-tune -+ * the accuracy of the RTC */ -+ ret = jz4740_rtc_reg_write(rtc, JZ_REG_RTC_REGULATOR, -+ (clk_get_rate(rtc_clk) - 1) & 0xffff); -+ clk_put(rtc_clk); -+ -+ if (ret) -+ dev_warn(&pdev->dev, "Could not update RTC regulator register\n"); -+ - return 0; - } - diff --git a/target/linux/xburst/patches-3.18/006-Add-ili8960-lcd-driver.patch b/target/linux/xburst/patches-3.18/006-Add-ili8960-lcd-driver.patch deleted file mode 100644 index dc12d93409..0000000000 --- a/target/linux/xburst/patches-3.18/006-Add-ili8960-lcd-driver.patch +++ /dev/null @@ -1,309 +0,0 @@ -From 8741ead92bc93e66740237e51b88b8690ebcbba3 Mon Sep 17 00:00:00 2001 -From: Lars-Peter Clausen -Date: Sun, 1 Aug 2010 21:19:40 +0200 -Subject: [PATCH 6/7] Add ili8960 lcd driver - -Includes the following changes from the jz-3.5 branch: -- Use module_spi_driver -- Use devm_kzalloc -- Use kstrtoul - -Signed-off-by: Lars-Peter Clausen ---- - drivers/video/backlight/Kconfig | 7 + - drivers/video/backlight/Makefile | 1 + - drivers/video/backlight/ili8960.c | 262 +++++++++++++++++++++++++++++++++++++ - 3 files changed, 270 insertions(+) - create mode 100644 drivers/video/backlight/ili8960.c - ---- a/drivers/video/backlight/Kconfig -+++ b/drivers/video/backlight/Kconfig -@@ -59,6 +59,13 @@ config LCD_LTV350QV - - The LTV350QV panel is present on all ATSTK1000 boards. - -+config LCD_ILI8960 -+ tristate "Ilitek ili8960 LCD driver" -+ depends on LCD_CLASS_DEVICE && SPI -+ default n -+ help -+ Driver for the Ilitek ili8960 LCD controller chip. -+ - config LCD_ILI922X - tristate "ILI Technology ILI9221/ILI9222 support" - depends on SPI ---- a/drivers/video/backlight/Makefile -+++ b/drivers/video/backlight/Makefile -@@ -5,6 +5,7 @@ obj-$(CONFIG_LCD_CLASS_DEVICE) += lcd.o - obj-$(CONFIG_LCD_CORGI) += corgi_lcd.o - obj-$(CONFIG_LCD_HP700) += jornada720_lcd.o - obj-$(CONFIG_LCD_HX8357) += hx8357.o -+obj-$(CONFIG_LCD_ILI8960) += ili8960.o - obj-$(CONFIG_LCD_ILI922X) += ili922x.o - obj-$(CONFIG_LCD_ILI9320) += ili9320.o - obj-$(CONFIG_LCD_L4F00242T03) += l4f00242t03.o ---- /dev/null -+++ b/drivers/video/backlight/ili8960.c -@@ -0,0 +1,262 @@ -+/* -+ * Copyright (C) 2009-2010, Lars-Peter Clausen -+ * Driver for Ilitek ili8960 LCD -+ * -+ * 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. -+ * -+ * 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. -+ * -+ */ -+ -+#include -+#include -+#include -+#include -+ -+struct ili8960 { -+ struct spi_device *spi; -+ struct lcd_device *lcd; -+ bool enabled; -+ unsigned int brightness; -+}; -+ -+#define ILI8960_REG_BRIGHTNESS 0x03 -+#define ILI8960_REG_POWER 0x05 -+#define ILI8960_REG_CONTRAST 0x0d -+ -+static int ili8960_write_reg(struct spi_device *spi, uint8_t reg, -+ uint8_t data) -+{ -+ uint8_t buf[2]; -+ buf[0] = ((reg & 0x40) << 1) | (reg & 0x3f); -+ buf[1] = data; -+ -+ return spi_write(spi, buf, sizeof(buf)); -+} -+ -+static int ili8960_programm_power(struct spi_device *spi, bool enabled) -+{ -+ int ret; -+ -+ if (enabled) -+ mdelay(20); -+ -+ ret = ili8960_write_reg(spi, ILI8960_REG_POWER, enabled ? 0xc7 : 0xc6); -+ -+ if (!enabled) -+ mdelay(20); -+ -+ return ret; -+} -+ -+static int ili8960_set_power(struct lcd_device *lcd, int power) -+{ -+ struct ili8960 *ili8960 = lcd_get_data(lcd); -+ -+ switch (power) { -+ case FB_BLANK_UNBLANK: -+ ili8960->enabled = true; -+ break; -+ default: -+ return 0; -+ } -+ -+ return ili8960_programm_power(ili8960->spi, ili8960->enabled); -+} -+ -+static int ili8960_early_set_power(struct lcd_device *lcd, int power) -+{ -+ struct ili8960 *ili8960 = lcd_get_data(lcd); -+ -+ switch (power) { -+ case FB_BLANK_UNBLANK: -+ return 0; -+ default: -+ ili8960->enabled = false; -+ break; -+ } -+ -+ return ili8960_programm_power(ili8960->spi, ili8960->enabled); -+} -+ -+static int ili8960_get_power(struct lcd_device *lcd) -+{ -+ struct ili8960 *ili8960 = lcd_get_data(lcd); -+ return ili8960->enabled ? FB_BLANK_UNBLANK : FB_BLANK_POWERDOWN; -+} -+ -+static int ili8960_set_contrast(struct lcd_device *lcd, int contrast) -+{ -+ struct ili8960 *ili8960 = lcd_get_data(lcd); -+ -+ return ili8960_write_reg(ili8960->spi, ILI8960_REG_CONTRAST, contrast); -+} -+ -+static int ili8960_set_mode(struct lcd_device *lcd, struct fb_videomode *mode) -+{ -+ if (mode->xres != 320 && mode->yres != 240) -+ return -EINVAL; -+ -+ return 0; -+} -+ -+static int ili8960_set_brightness(struct ili8960 *ili8960, int brightness) -+{ -+ int ret; -+ -+ ret = ili8960_write_reg(ili8960->spi, ILI8960_REG_BRIGHTNESS, brightness); -+ -+ if (ret == 0) -+ ili8960->brightness = brightness; -+ -+ return ret; -+} -+ -+static ssize_t ili8960_show_brightness(struct device *dev, -+ struct device_attribute *attr, char *buf) -+{ -+ struct lcd_device *ld = to_lcd_device(dev); -+ struct ili8960 *ili8960 = lcd_get_data(ld); -+ -+ return sprintf(buf, "%u\n", ili8960->brightness); -+} -+ -+static ssize_t ili8960_store_brightness(struct device *dev, -+ struct device_attribute *attr, const char *buf, size_t count) -+{ -+ struct lcd_device *ld = to_lcd_device(dev); -+ struct ili8960 *ili8960 = lcd_get_data(ld); -+ unsigned long brightness; -+ int ret; -+ -+ ret = kstrtoul(buf, 0, &brightness); -+ if (ret) -+ return ret; -+ -+ if (brightness > 255) -+ return -EINVAL; -+ -+ ili8960_set_brightness(ili8960, brightness); -+ -+ return count; -+} -+ -+ -+static DEVICE_ATTR(brightness, 0644, ili8960_show_brightness, -+ ili8960_store_brightness); -+ -+static struct lcd_ops ili8960_lcd_ops = { -+ .set_power = ili8960_set_power, -+ .early_set_power = ili8960_early_set_power, -+ .get_power = ili8960_get_power, -+ .set_contrast = ili8960_set_contrast, -+ .set_mode = ili8960_set_mode, -+}; -+ -+static int ili8960_probe(struct spi_device *spi) -+{ -+ int ret; -+ struct ili8960 *ili8960; -+ -+ ili8960 = devm_kzalloc(&spi->dev, sizeof(*ili8960), GFP_KERNEL); -+ if (!ili8960) -+ return -ENOMEM; -+ -+ spi->bits_per_word = 8; -+ spi->mode = SPI_MODE_3; -+ -+ ret = spi_setup(spi); -+ if (ret) { -+ dev_err(&spi->dev, "Failed to setup spi\n"); -+ return ret; -+ } -+ -+ ili8960->spi = spi; -+ -+ ili8960->lcd = lcd_device_register("ili8960-lcd", &spi->dev, ili8960, -+ &ili8960_lcd_ops); -+ -+ if (IS_ERR(ili8960->lcd)) { -+ ret = PTR_ERR(ili8960->lcd); -+ dev_err(&spi->dev, "Failed to register lcd device: %d\n", ret); -+ return ret; -+ } -+ -+ ili8960->lcd->props.max_contrast = 255; -+ -+ ret = device_create_file(&ili8960->lcd->dev, &dev_attr_brightness); -+ if (ret) -+ goto err_unregister_lcd; -+ -+ ili8960_programm_power(ili8960->spi, true); -+ ili8960->enabled = true; -+ -+ spi_set_drvdata(spi, ili8960); -+ -+ ili8960_write_reg(spi, 0x13, 0x01); -+ -+ return 0; -+err_unregister_lcd: -+ lcd_device_unregister(ili8960->lcd); -+ return ret; -+} -+ -+static int ili8960_remove(struct spi_device *spi) -+{ -+ struct ili8960 *ili8960 = spi_get_drvdata(spi); -+ -+ device_remove_file(&ili8960->lcd->dev, &dev_attr_brightness); -+ lcd_device_unregister(ili8960->lcd); -+ -+ spi_set_drvdata(spi, NULL); -+ return 0; -+} -+ -+#ifdef CONFIG_PM -+ -+static int ili8960_suspend(struct spi_device *spi, pm_message_t state) -+{ -+ struct ili8960 *ili8960 = spi_get_drvdata(spi); -+ -+ if (ili8960->enabled) -+ ili8960_programm_power(ili8960->spi, false); -+ -+ return 0; -+} -+ -+static int ili8960_resume(struct spi_device *spi) -+{ -+ struct ili8960 *ili8960 = spi_get_drvdata(spi); -+ -+ if (ili8960->enabled) -+ ili8960_programm_power(ili8960->spi, true); -+ -+ return 0; -+} -+ -+#else -+#define ili8960_suspend NULL -+#define ili8960_resume NULL -+#endif -+ -+static struct spi_driver ili8960_driver = { -+ .driver = { -+ .name = "ili8960", -+ .owner = THIS_MODULE, -+ }, -+ .probe = ili8960_probe, -+ .remove = ili8960_remove, -+ .suspend = ili8960_suspend, -+ .resume = ili8960_resume, -+}; -+module_spi_driver(ili8960_driver); -+ -+MODULE_AUTHOR("Lars-Peter Clausen"); -+MODULE_LICENSE("GPL"); -+MODULE_DESCRIPTION("LCD driver for Ilitek ili8960"); -+MODULE_ALIAS("spi:ili8960"); diff --git a/target/linux/xburst/patches-3.18/007-qi_lb60-Don-t-use-3-wire-spi-mode-for-the-display-fo.patch b/target/linux/xburst/patches-3.18/007-qi_lb60-Don-t-use-3-wire-spi-mode-for-the-display-fo.patch deleted file mode 100644 index fd89ad3bca..0000000000 --- a/target/linux/xburst/patches-3.18/007-qi_lb60-Don-t-use-3-wire-spi-mode-for-the-display-fo.patch +++ /dev/null @@ -1,21 +0,0 @@ -From 4371d60ae342c76708c4317e06fb7dcf0159c2f1 Mon Sep 17 00:00:00 2001 -From: Lars-Peter Clausen -Date: Wed, 13 Oct 2010 01:17:24 +0200 -Subject: [PATCH 7/7] qi_lb60: Don't use 3-wire spi mode for the display for - now - -The spi_gpio driver does not support 3-wire mode. ---- - arch/mips/jz4740/board-qi_lb60.c | 1 - - 1 file changed, 1 deletion(-) - ---- a/arch/mips/jz4740/board-qi_lb60.c -+++ b/arch/mips/jz4740/board-qi_lb60.c -@@ -313,7 +313,6 @@ static struct spi_board_info qi_lb60_spi - .chip_select = 0, - .bus_num = 1, - .max_speed_hz = 30 * 1000, -- .mode = SPI_3WIRE, - }, - }; - diff --git a/target/linux/xburst/qi_lb60/config-default b/target/linux/xburst/qi_lb60/config-default deleted file mode 100644 index 1fd421b5fc..0000000000 --- a/target/linux/xburst/qi_lb60/config-default +++ /dev/null @@ -1,33 +0,0 @@ -# CONFIG_BACKLIGHT_CLASS_DEVICE is not set -CONFIG_BACKLIGHT_LCD_SUPPORT=y -CONFIG_INPUT_MATRIXKMAP=y -CONFIG_KEYBOARD_GPIO=y -CONFIG_KEYBOARD_MATRIX=y -CONFIG_LCD_CLASS_DEVICE=y -CONFIG_LCD_ILI8960=y -# CONFIG_LCD_L4F00242T03 is not set -# CONFIG_LCD_LMS283GF05 is not set -# CONFIG_LCD_LTV350QV is not set -# CONFIG_LCD_PLATFORM is not set -# CONFIG_LCD_TDO24M is not set -# CONFIG_LCD_VGG2432A4 is not set -CONFIG_LOGO=y -# CONFIG_LOGO_LINUX_CLUT224 is not set -# CONFIG_LOGO_LINUX_MONO is not set -# CONFIG_LOGO_LINUX_VGA16 is not set -CONFIG_REGMAP_SPI=y -CONFIG_SND_HWDEP=y -CONFIG_SND_MIXER_OSS=y -CONFIG_SND_PCM_OSS=y -CONFIG_SND_SEQUENCER=y -# CONFIG_SND_SEQUENCER_OSS is not set -CONFIG_SND_SEQ_DUMMY=y -# CONFIG_SND_VIRMIDI is not set -CONFIG_SOUND_OSS_CORE=y -CONFIG_SOUND_OSS_CORE_PRECLAIM=y -CONFIG_SPI=y -CONFIG_SPI_BITBANG=y -CONFIG_SPI_GPIO=y -CONFIG_SPI_MASTER=y -# CONFIG_USB_FUSB300 is not set -CONFIG_USB_JZ4740=y diff --git a/target/linux/xburst/qi_lb60/target.mk b/target/linux/xburst/qi_lb60/target.mk deleted file mode 100644 index 8ae71bd9cb..0000000000 --- a/target/linux/xburst/qi_lb60/target.mk +++ /dev/null @@ -1 +0,0 @@ -BOARDNAME:=QI Ben Nanonote (qi_lb60) diff --git a/target/sdk/Makefile b/target/sdk/Makefile index 6092f3d709..0a7aa13b8a 100644 --- a/target/sdk/Makefile +++ b/target/sdk/Makefile @@ -94,6 +94,14 @@ $(BIN_DIR)/$(SDK_NAME).tar.xz: clean $(TAR) -cf - -C $(TOPDIR) $(KDIR_BASE)/tools/usb/usbip/ | \ $(TAR) -xf - -C $(SDK_BUILD_DIR) + # Copy objtool executables. They are required for building external + # modules if "Compile-time stack metadata validation" is enabled. + if grep -q '^CONFIG_STACK_VALIDATION=y' $(LINUX_DIR)/.config; then \ + $(TAR) -cf - -C $(TOPDIR) \ + `cd $(TOPDIR); find $(KDIR_BASE)/tools/objtool -type f -executable` | \ + $(TAR) -xf - -C $(SDK_BUILD_DIR); \ + fi + (cd $(SDK_BUILD_DIR); find $(STAGING_SUBDIR_HOST)/bin $(STAGING_SUBDIR_HOST)/usr/bin \ $(STAGING_SUBDIR_TOOLCHAIN)/bin $(STAGING_SUBDIR_TOOLCHAIN)/*/bin $(STAGING_SUBDIR_TOOLCHAIN)/libexec \ -type f | $(XARGS) $(SCRIPT_DIR)/bundle-libraries.sh $(SDK_BUILD_DIR)/$(STAGING_SUBDIR_HOST)) diff --git a/toolchain/Config.in b/toolchain/Config.in index 82dddbc209..95087b7078 100644 --- a/toolchain/Config.in +++ b/toolchain/Config.in @@ -42,7 +42,7 @@ menuconfig EXTERNAL_TOOLCHAIN bool prompt "Use external toolchain" if DEVEL help - If enabled, LEDE will compile using an existing toolchain instead of + If enabled, the buildroot will compile using an existing toolchain instead of compiling one. config NATIVE_TOOLCHAIN @@ -51,7 +51,7 @@ menuconfig EXTERNAL_TOOLCHAIN depends on EXTERNAL_TOOLCHAIN select NO_STRIP help - If enabled, LEDE will compile using the native toolchain for your + If enabled, the buildroot will compile using the native toolchain for your host instead of compiling one. config TARGET_NAME diff --git a/toolchain/binutils/Config.in b/toolchain/binutils/Config.in index 950ce838c5..685e89be96 100644 --- a/toolchain/binutils/Config.in +++ b/toolchain/binutils/Config.in @@ -3,15 +3,10 @@ choice prompt "Binutils Version" if TOOLCHAINOPTS default BINUTILS_USE_VERSION_2_31_1 if !arc - default BINUTILS_USE_VERSION_2_29_ARC if arc + default BINUTILS_USE_VERSION_2_32 if arc help Select the version of binutils you wish to use. - config BINUTILS_USE_VERSION_2_29_ARC - depends on arc - bool "ARC binutils 2.29" - select BINUTILS_VERSION_2_29_ARC - config BINUTILS_USE_VERSION_2_29_1 depends on !arc bool "Binutils 2.29.1" @@ -23,7 +18,6 @@ choice select BINUTILS_VERSION_2_31_1 config BINUTILS_USE_VERSION_2_32 - depends on !arc bool "Binutils 2.32" select BINUTILS_VERSION_2_32 diff --git a/toolchain/binutils/Config.version b/toolchain/binutils/Config.version index f125bf74bf..3ffcf57347 100644 --- a/toolchain/binutils/Config.version +++ b/toolchain/binutils/Config.version @@ -1,7 +1,3 @@ -config BINUTILS_VERSION_2_29_ARC - default y if (!TOOLCHAINOPTS && arc) - bool - config BINUTILS_VERSION_2_29_1 bool @@ -10,6 +6,7 @@ config BINUTILS_VERSION_2_31_1 bool config BINUTILS_VERSION_2_32 + default y if (!TOOLCHAINOPTS && arc) bool config BINUTILS_VERSION @@ -17,4 +14,3 @@ config BINUTILS_VERSION default "2.29.1" if BINUTILS_VERSION_2_29_1 default "2.31.1" if BINUTILS_VERSION_2_31_1 default "2.32" if BINUTILS_VERSION_2_32 - default "arc-2017.09" if BINUTILS_VERSION_2_29_ARC diff --git a/toolchain/binutils/Makefile b/toolchain/binutils/Makefile index 6f7b2cb75a..24eaf70566 100644 --- a/toolchain/binutils/Makefile +++ b/toolchain/binutils/Makefile @@ -27,49 +27,39 @@ ifeq ($(PKG_VERSION),2.32) PKG_HASH:=0ab6c55dd86a92ed561972ba15b9b70a8b9f75557f896446c82e8b36e473ee04 endif -ifneq ($(CONFIG_BINUTILS_VERSION_2_29_ARC),) - PKG_REV:=arc-2017.09-release - PKG_SOURCE_URL:=https://github.com/foss-for-synopsys-dwc-arc-processors/binutils-gdb/archive/$(PKG_REV)/ - PKG_SOURCE:=$(PKG_NAME)-$(PKG_REV).tar.gz - PKG_HASH:=2ea086fd5521e942926dd6ff6922ce31c29ee7ffc754fca3d06385e0f27600f8 - BINUTILS_DIR:=$(PKG_NAME)-gdb-$(PKG_REV) - HOST_BUILD_DIR:=$(BUILD_DIR_TOOLCHAIN)/$(BINUTILS_DIR) -endif - HOST_BUILD_PARALLEL:=1 PATCH_DIR:=./patches/$(PKG_VERSION) include $(INCLUDE_DIR)/toolchain-build.mk -BINUTILS_CONFIGURE:= \ - ./configure \ - --prefix=$(TOOLCHAIN_DIR) \ - --build=$(GNU_HOST_NAME) \ - --host=$(GNU_HOST_NAME) \ - --target=$(REAL_GNU_TARGET_NAME) \ - --with-sysroot=$(TOOLCHAIN_DIR) \ - --enable-deterministic-archives \ - --enable-plugins \ - --disable-multilib \ - --disable-werror \ - --disable-nls \ - --disable-sim \ - --disable-gdb \ - $(GRAPHITE_CONFIGURE) \ - $(SOFT_FLOAT_CONFIG_OPTION) \ - $(call qstrip,$(CONFIG_EXTRA_BINUTILS_CONFIG_OPTIONS)) +HOST_CONFIGURE_ARGS = \ + --prefix=$(TOOLCHAIN_DIR) \ + --build=$(GNU_HOST_NAME) \ + --host=$(GNU_HOST_NAME) \ + --target=$(REAL_GNU_TARGET_NAME) \ + --with-sysroot=$(TOOLCHAIN_DIR) \ + --enable-deterministic-archives \ + --enable-plugins \ + --disable-multilib \ + --disable-werror \ + --disable-nls \ + --disable-sim \ + --disable-gdb \ + $(GRAPHITE_CONFIGURE) \ + $(SOFT_FLOAT_CONFIG_OPTION) \ + $(call qstrip,$(CONFIG_EXTRA_BINUTILS_CONFIG_OPTIONS)) ifneq ($(CONFIG_SSP_SUPPORT),) - BINUTILS_CONFIGURE+= \ + HOST_CONFIGURE_ARGS+= \ --enable-libssp else - BINUTILS_CONFIGURE+= \ + HOST_CONFIGURE_ARGS+= \ --disable-libssp endif ifneq ($(CONFIG_EXTRA_TARGET_ARCH),) - BINUTILS_CONFIGURE+= \ + HOST_CONFIGURE_ARGS+= \ --enable-targets=$(call qstrip,$(CONFIG_EXTRA_TARGET_ARCH_NAME))-linux-$(TARGET_SUFFIX) endif @@ -80,12 +70,6 @@ define Host/Prepare $(SED) 's, " Linaro.*,,' $(HOST_BUILD_DIR)/bfd/version.h endef -define Host/Configure - (cd $(HOST_BUILD_DIR); \ - $(BINUTILS_CONFIGURE) \ - ); -endef - define Host/Compile +$(MAKE) $(HOST_JOBS) -C $(HOST_BUILD_DIR) all endef diff --git a/toolchain/binutils/patches/2.32/300-012_check_ldrunpath_length.patch b/toolchain/binutils/patches/2.32/300-012_check_ldrunpath_length.patch index 58ee759de6..1e8695f2fc 100644 --- a/toolchain/binutils/patches/2.32/300-012_check_ldrunpath_length.patch +++ b/toolchain/binutils/patches/2.32/300-012_check_ldrunpath_length.patch @@ -9,7 +9,7 @@ if (path && gld${EMULATION_NAME}_search_needed (path, &n, force)) break; -@@ -1751,6 +1753,8 @@ gld${EMULATION_NAME}_before_allocation ( +@@ -1746,6 +1748,8 @@ gld${EMULATION_NAME}_before_allocation ( rpath = command_line.rpath; if (rpath == NULL) rpath = (const char *) getenv ("LD_RUN_PATH"); diff --git a/toolchain/binutils/patches/2.32/400-mips_no_dynamic_linking_sym.patch b/toolchain/binutils/patches/2.32/400-mips_no_dynamic_linking_sym.patch index 91ff77f827..fb3f7f59b9 100644 --- a/toolchain/binutils/patches/2.32/400-mips_no_dynamic_linking_sym.patch +++ b/toolchain/binutils/patches/2.32/400-mips_no_dynamic_linking_sym.patch @@ -1,6 +1,6 @@ --- a/bfd/elfxx-mips.c +++ b/bfd/elfxx-mips.c -@@ -7888,6 +7888,7 @@ _bfd_mips_elf_create_dynamic_sections (b +@@ -8001,6 +8001,7 @@ _bfd_mips_elf_create_dynamic_sections (b name = SGI_COMPAT (abfd) ? "_DYNAMIC_LINK" : "_DYNAMIC_LINKING"; bh = NULL; @@ -8,7 +8,7 @@ if (!(_bfd_generic_link_add_one_symbol (info, abfd, name, BSF_GLOBAL, bfd_abs_section_ptr, 0, NULL, FALSE, get_elf_backend_data (abfd)->collect, &bh))) -@@ -7900,6 +7901,7 @@ _bfd_mips_elf_create_dynamic_sections (b +@@ -8013,6 +8014,7 @@ _bfd_mips_elf_create_dynamic_sections (b if (! bfd_elf_link_record_dynamic_symbol (info, h)) return FALSE; diff --git a/toolchain/binutils/patches/2.32/500-Change-default-emulation-for-mips64-linux.patch b/toolchain/binutils/patches/2.32/500-Change-default-emulation-for-mips64-linux.patch index c6e123e88e..bd7f7f29ad 100644 --- a/toolchain/binutils/patches/2.32/500-Change-default-emulation-for-mips64-linux.patch +++ b/toolchain/binutils/patches/2.32/500-Change-default-emulation-for-mips64-linux.patch @@ -1,6 +1,6 @@ --- a/bfd/config.bfd +++ b/bfd/config.bfd -@@ -913,12 +913,12 @@ case "${targ}" in +@@ -919,12 +919,12 @@ case "${targ}" in targ_selvecs="mips_elf32_le_vec mips_elf64_be_vec mips_elf64_le_vec mips_ecoff_be_vec mips_ecoff_le_vec" ;; mips64*el-*-linux*) @@ -19,7 +19,7 @@ targ_defvec=mips_elf32_trad_le_vec --- a/ld/configure.tgt +++ b/ld/configure.tgt -@@ -464,11 +464,11 @@ mips*el-*-vxworks*) targ_emul=elf32elmip +@@ -468,11 +468,11 @@ mips*el-*-vxworks*) targ_emul=elf32elmip mips*-*-vxworks*) targ_emul=elf32ebmipvxworks targ_extra_emuls="elf32elmipvxworks" ;; mips*-*-windiss) targ_emul=elf32mipswindiss ;; diff --git a/toolchain/gcc/Config.in b/toolchain/gcc/Config.in index d85e8cd402..a069cb69e7 100644 --- a/toolchain/gcc/Config.in +++ b/toolchain/gcc/Config.in @@ -2,16 +2,11 @@ choice prompt "GCC compiler Version" if TOOLCHAINOPTS - default GCC_USE_VERSION_7_1_ARC if arc + default GCC_USE_VERSION_8 if arc default GCC_USE_VERSION_7 help Select the version of gcc you wish to use. - config GCC_USE_VERSION_7_1_ARC - select GCC_VERSION_7_1_ARC - bool "gcc 7.1.x with support of ARC cores" - depends on arc - config GCC_USE_VERSION_5 bool "gcc 5.x" depends on !arc diff --git a/toolchain/gcc/Config.version b/toolchain/gcc/Config.version index ff574fffcd..74d96a7a66 100644 --- a/toolchain/gcc/Config.version +++ b/toolchain/gcc/Config.version @@ -1,13 +1,10 @@ -config GCC_VERSION_7_1_ARC - default y if (!TOOLCHAINOPTS && arc) - bool - config GCC_VERSION_5 default y if GCC_USE_VERSION_5 bool config GCC_VERSION_8 default y if GCC_USE_VERSION_8 + default y if arc bool config GCC_USE_EMBEDDED_PATH_REMAP @@ -18,6 +15,5 @@ config GCC_USE_EMBEDDED_PATH_REMAP config GCC_VERSION string default "5.5.0" if GCC_VERSION_5 - default "arc-2017.09-release" if GCC_VERSION_7_1_ARC default "8.3.0" if GCC_VERSION_8 default "7.4.0" diff --git a/toolchain/gcc/common.mk b/toolchain/gcc/common.mk index 3c1725cd8a..431001f12d 100644 --- a/toolchain/gcc/common.mk +++ b/toolchain/gcc/common.mk @@ -40,19 +40,9 @@ ifeq ($(PKG_VERSION),8.3.0) PKG_HASH:=64baadfe6cc0f4947a84cb12d7f0dfaf45bb58b7e92461639596c21e02d97d2c endif -ifneq ($(CONFIG_GCC_VERSION_7_1_ARC),) - PKG_VERSION:=7.1.1 - PKG_SOURCE_URL:=https://github.com/foss-for-synopsys-dwc-arc-processors/gcc/archive/$(GCC_VERSION) - PKG_SOURCE:=$(PKG_NAME)-$(GCC_VERSION).tar.gz - PKG_HASH:=90596af8b9c26a434cec0a3b3d37d0c7c755ab6a65496af6ca32529fab5a6cfe - PKG_REV:=2017.09-release - GCC_DIR:=gcc-arc-$(PKG_REV) - HOST_BUILD_DIR = $(BUILD_DIR_HOST)/$(PKG_NAME)-$(GCC_VERSION) -endif - PATCH_DIR=../patches/$(GCC_VERSION) -BUGURL=http://www.lede-project.org/bugs/ +BUGURL=http://bugs.openwrt.org/ PKGVERSION=libreCMC GCC $(PKG_VERSION) $(REVISION) HOST_BUILD_PARALLEL:=1 @@ -171,11 +161,20 @@ ifneq ($(GCC_ARCH),) GCC_CONFIGURE+= --with-arch=$(GCC_ARCH) endif -ifneq ($(CONFIG_SOFT_FLOAT),y) - ifeq ($(CONFIG_arm),y) +ifeq ($(CONFIG_arm),y) + GCC_CONFIGURE+= \ + --with-cpu=$(word 1, $(subst +," ,$(CONFIG_CPU_TYPE))) + + ifneq ($(CONFIG_SOFT_FLOAT),y) GCC_CONFIGURE+= \ + --with-fpu=$(word 2, $(subst +, ",$(CONFIG_CPU_TYPE))) \ --with-float=hard endif + + # Do not let TARGET_CFLAGS get poisoned by extra CPU optimization flags + # that do not belong here. The cpu,fpu type should be specified via + # --with-cpu and --with-fpu for ARM and not CFLAGS. + TARGET_CFLAGS:=$(filter-out -m%,$(call qstrip,$(TARGET_CFLAGS))) endif ifeq ($(CONFIG_TARGET_x86)$(CONFIG_USE_GLIBC)$(CONFIG_INSTALL_GCCGO),yyy) diff --git a/toolchain/gcc/patches/arc-2017.09-release/001-revert_register_mode_search.patch b/toolchain/gcc/patches/arc-2017.09-release/001-revert_register_mode_search.patch deleted file mode 100644 index 63e3fee003..0000000000 --- a/toolchain/gcc/patches/arc-2017.09-release/001-revert_register_mode_search.patch +++ /dev/null @@ -1,77 +0,0 @@ -commit 31285a20390a5e53a74a2a71d1b5c82f366ddd5a -Author: Felix Fietkau -Date: Tue May 6 11:49:05 2014 +0000 - - gcc: revert an upstream patch that is causing a regression on powerpc - - https://forum.openwrt.org/viewtopic.php?pid=232494#p232494 - - Signed-off-by: Felix Fietkau - - SVN-Revision: 40709 - -Revert of: - -commit 275035b56823b26d5fb7e90fad945b998648edf2 -Author: bergner -Date: Thu Sep 5 14:09:07 2013 +0000 - - PR target/58139 - * reginfo.c (choose_hard_reg_mode): Scan through all mode classes - looking for widest mode. - - - git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@202286 138bc75d-0d04-0410-961f-82ee72b054a4 - - ---- a/gcc/reginfo.c -+++ b/gcc/reginfo.c -@@ -637,35 +637,40 @@ choose_hard_reg_mode (unsigned int regno - mode = GET_MODE_WIDER_MODE (mode)) - if ((unsigned) hard_regno_nregs[regno][mode] == nregs - && HARD_REGNO_MODE_OK (regno, mode) -- && (! call_saved || ! HARD_REGNO_CALL_PART_CLOBBERED (regno, mode)) -- && GET_MODE_SIZE (mode) > GET_MODE_SIZE (found_mode)) -+ && (! call_saved || ! HARD_REGNO_CALL_PART_CLOBBERED (regno, mode))) - found_mode = mode; - -+ if (found_mode != VOIDmode) -+ return found_mode; -+ - for (mode = GET_CLASS_NARROWEST_MODE (MODE_FLOAT); - mode != VOIDmode; - mode = GET_MODE_WIDER_MODE (mode)) - if ((unsigned) hard_regno_nregs[regno][mode] == nregs - && HARD_REGNO_MODE_OK (regno, mode) -- && (! call_saved || ! HARD_REGNO_CALL_PART_CLOBBERED (regno, mode)) -- && GET_MODE_SIZE (mode) > GET_MODE_SIZE (found_mode)) -+ && (! call_saved || ! HARD_REGNO_CALL_PART_CLOBBERED (regno, mode))) - found_mode = mode; - -+ if (found_mode != VOIDmode) -+ return found_mode; -+ - for (mode = GET_CLASS_NARROWEST_MODE (MODE_VECTOR_FLOAT); - mode != VOIDmode; - mode = GET_MODE_WIDER_MODE (mode)) - if ((unsigned) hard_regno_nregs[regno][mode] == nregs - && HARD_REGNO_MODE_OK (regno, mode) -- && (! call_saved || ! HARD_REGNO_CALL_PART_CLOBBERED (regno, mode)) -- && GET_MODE_SIZE (mode) > GET_MODE_SIZE (found_mode)) -+ && (! call_saved || ! HARD_REGNO_CALL_PART_CLOBBERED (regno, mode))) - found_mode = mode; - -+ if (found_mode != VOIDmode) -+ return found_mode; -+ - for (mode = GET_CLASS_NARROWEST_MODE (MODE_VECTOR_INT); - mode != VOIDmode; - mode = GET_MODE_WIDER_MODE (mode)) - if ((unsigned) hard_regno_nregs[regno][mode] == nregs - && HARD_REGNO_MODE_OK (regno, mode) -- && (! call_saved || ! HARD_REGNO_CALL_PART_CLOBBERED (regno, mode)) -- && GET_MODE_SIZE (mode) > GET_MODE_SIZE (found_mode)) -+ && (! call_saved || ! HARD_REGNO_CALL_PART_CLOBBERED (regno, mode))) - found_mode = mode; - - if (found_mode != VOIDmode) diff --git a/toolchain/gcc/patches/arc-2017.09-release/002-case_insensitive.patch b/toolchain/gcc/patches/arc-2017.09-release/002-case_insensitive.patch deleted file mode 100644 index 3442076d7d..0000000000 --- a/toolchain/gcc/patches/arc-2017.09-release/002-case_insensitive.patch +++ /dev/null @@ -1,24 +0,0 @@ -commit 81cc26c706b2bc8c8c1eb1a322e5c5157900836e -Author: Felix Fietkau -Date: Sun Oct 19 21:45:51 2014 +0000 - - gcc: do not assume that the Mac OS X filesystem is case insensitive - - Signed-off-by: Felix Fietkau - - SVN-Revision: 42973 - ---- a/include/filenames.h -+++ b/include/filenames.h -@@ -43,11 +43,6 @@ extern "C" { - # define IS_DIR_SEPARATOR(c) IS_DOS_DIR_SEPARATOR (c) - # define IS_ABSOLUTE_PATH(f) IS_DOS_ABSOLUTE_PATH (f) - #else /* not DOSish */ --# if defined(__APPLE__) --# ifndef HAVE_CASE_INSENSITIVE_FILE_SYSTEM --# define HAVE_CASE_INSENSITIVE_FILE_SYSTEM 1 --# endif --# endif /* __APPLE__ */ - # define HAS_DRIVE_SPEC(f) (0) - # define IS_DIR_SEPARATOR(c) IS_UNIX_DIR_SEPARATOR (c) - # define IS_ABSOLUTE_PATH(f) IS_UNIX_ABSOLUTE_PATH (f) diff --git a/toolchain/gcc/patches/arc-2017.09-release/010-documentation.patch b/toolchain/gcc/patches/arc-2017.09-release/010-documentation.patch deleted file mode 100644 index 0106814f41..0000000000 --- a/toolchain/gcc/patches/arc-2017.09-release/010-documentation.patch +++ /dev/null @@ -1,35 +0,0 @@ -commit 098bd91f5eae625c7d2ee621e10930fc4434e5e2 -Author: Luka Perkov -Date: Tue Feb 26 16:16:33 2013 +0000 - - gcc: don't build documentation - - This closes #13039. - - Signed-off-by: Luka Perkov - - SVN-Revision: 35807 - ---- a/gcc/Makefile.in -+++ b/gcc/Makefile.in -@@ -3121,18 +3121,10 @@ doc/gcc.info: $(TEXI_GCC_FILES) - doc/gccint.info: $(TEXI_GCCINT_FILES) - doc/cppinternals.info: $(TEXI_CPPINT_FILES) - --doc/%.info: %.texi -- if [ x$(BUILD_INFO) = xinfo ]; then \ -- $(MAKEINFO) $(MAKEINFOFLAGS) -I . -I $(gcc_docdir) \ -- -I $(gcc_docdir)/include -o $@ $<; \ -- fi -+doc/%.info: - - # Duplicate entry to handle renaming of gccinstall.info --doc/gccinstall.info: $(TEXI_GCCINSTALL_FILES) -- if [ x$(BUILD_INFO) = xinfo ]; then \ -- $(MAKEINFO) $(MAKEINFOFLAGS) -I $(gcc_docdir) \ -- -I $(gcc_docdir)/include -o $@ $<; \ -- fi -+doc/gccinstall.info: - - doc/cpp.dvi: $(TEXI_CPP_FILES) - doc/gcc.dvi: $(TEXI_GCC_FILES) diff --git a/toolchain/gcc/patches/arc-2017.09-release/230-musl_libssp.patch b/toolchain/gcc/patches/arc-2017.09-release/230-musl_libssp.patch deleted file mode 100644 index eebee9175c..0000000000 --- a/toolchain/gcc/patches/arc-2017.09-release/230-musl_libssp.patch +++ /dev/null @@ -1,28 +0,0 @@ -commit 1877bc9d8f2be143fbe530347a945850d0ecd234 -Author: Steven Barth -Date: Mon Jun 22 10:31:07 2015 +0000 - - gcc/musl: rework SSP-support - - Make musl provide libssp_nonshared.a and make GCC link it unconditionally - if musl is used. This should be a no-op if SSP is disabled and seems to be - the only reliable way of dealing with SSP over all packages due to the mess - that is linkerflags handling in packages. - - Signed-off-by: Steven Barth - - SVN-Revision: 46108 - ---- a/gcc/gcc.c -+++ b/gcc/gcc.c -@@ -861,7 +861,9 @@ proper position among the other output f - #endif - - #ifndef LINK_SSP_SPEC --#ifdef TARGET_LIBC_PROVIDES_SSP -+#if DEFAULT_LIBC == LIBC_MUSL -+#define LINK_SSP_SPEC "-lssp_nonshared" -+#elif defined(TARGET_LIBC_PROVIDES_SSP) - #define LINK_SSP_SPEC "%{fstack-protector|fstack-protector-all" \ - "|fstack-protector-strong|fstack-protector-explicit:}" - #else diff --git a/toolchain/gcc/patches/arc-2017.09-release/300-mips_Os_cpu_rtx_cost_model.patch b/toolchain/gcc/patches/arc-2017.09-release/300-mips_Os_cpu_rtx_cost_model.patch deleted file mode 100644 index 84c0fdab66..0000000000 --- a/toolchain/gcc/patches/arc-2017.09-release/300-mips_Os_cpu_rtx_cost_model.patch +++ /dev/null @@ -1,21 +0,0 @@ -commit ecf7671b769fe96f7b5134be442089f8bdba55d2 -Author: Felix Fietkau -Date: Thu Aug 4 20:29:45 2016 +0200 - -gcc: add a patch to generate better code with Os on mips - -Also happens to reduce compressed code size a bit - -Signed-off-by: Felix Fietkau - ---- a/gcc/config/mips/mips.c -+++ b/gcc/config/mips/mips.c -@@ -19784,7 +19784,7 @@ mips_option_override (void) - flag_pcc_struct_return = 0; - - /* Decide which rtx_costs structure to use. */ -- if (optimize_size) -+ if (0 && optimize_size) - mips_cost = &mips_rtx_cost_optimize_size; - else - mips_cost = &mips_rtx_cost_data[mips_tune]; diff --git a/toolchain/gcc/patches/arc-2017.09-release/800-arm_v5te_no_ldrd_strd.patch b/toolchain/gcc/patches/arc-2017.09-release/800-arm_v5te_no_ldrd_strd.patch deleted file mode 100644 index 76200a1661..0000000000 --- a/toolchain/gcc/patches/arc-2017.09-release/800-arm_v5te_no_ldrd_strd.patch +++ /dev/null @@ -1,32 +0,0 @@ -commit b050f87d13b5dc7ed82feb9a90f4529de58bdf25 -Author: Felix Fietkau -Date: Wed Feb 19 19:20:10 2014 +0000 - - gcc: prevent the use of LDRD/STRD on ARMv5TE - - These instructions are for 64-bit load/store. On ARMv5TE, the CPU - requires addresses to be aligned to 64-bit. When misaligned, behavior is - undefined (effectively either loads the same word twice on LDRD, or - corrupts surrounding memory on STRD). - - On ARMv6 and newer, unaligned access is safe. - - Removing these instructions for ARMv5TE is necessary, because GCC - ignores alignment information in pointers and does unsafe optimizations - that have shown up as bugs in various places. - - Signed-off-by: Felix Fietkau - - SVN-Revision: 39638 - ---- a/gcc/config/arm/arm.h -+++ b/gcc/config/arm/arm.h -@@ -150,7 +150,7 @@ extern tree arm_fp16_type_node; - /* Thumb-1 only. */ - #define TARGET_THUMB1_ONLY (TARGET_THUMB1 && !arm_arch_notm) - --#define TARGET_LDRD (arm_arch5e && ARM_DOUBLEWORD_ALIGN \ -+#define TARGET_LDRD (arm_arch6 && ARM_DOUBLEWORD_ALIGN \ - && !TARGET_THUMB1) - - #define TARGET_CRC32 (arm_arch_crc) diff --git a/toolchain/gcc/patches/arc-2017.09-release/810-arm-softfloat-libgcc.patch b/toolchain/gcc/patches/arc-2017.09-release/810-arm-softfloat-libgcc.patch deleted file mode 100644 index 5c9d86aead..0000000000 --- a/toolchain/gcc/patches/arc-2017.09-release/810-arm-softfloat-libgcc.patch +++ /dev/null @@ -1,33 +0,0 @@ -commit 8570c4be394cff7282f332f97da2ff569a927ddb -Author: Imre Kaloz -Date: Wed Feb 2 20:06:12 2011 +0000 - - fixup arm soft-float symbols - - SVN-Revision: 25325 - ---- a/libgcc/config/arm/t-linux -+++ b/libgcc/config/arm/t-linux -@@ -1,6 +1,10 @@ - LIB1ASMSRC = arm/lib1funcs.S - LIB1ASMFUNCS = _udivsi3 _divsi3 _umodsi3 _modsi3 _dvmd_lnx _clzsi2 _clzdi2 \ -- _ctzsi2 _arm_addsubdf3 _arm_addsubsf3 -+ _ctzsi2 _arm_addsubdf3 _arm_addsubsf3 \ -+ _arm_negdf2 _arm_muldivdf3 _arm_cmpdf2 _arm_unorddf2 \ -+ _arm_fixdfsi _arm_fixunsdfsi _arm_truncdfsf2 \ -+ _arm_negsf2 _arm_muldivsf3 _arm_cmpsf2 _arm_unordsf2 \ -+ _arm_fixsfsi _arm_fixunssfsi - - # Just for these, we omit the frame pointer since it makes such a big - # difference. ---- a/gcc/config/arm/linux-elf.h -+++ b/gcc/config/arm/linux-elf.h -@@ -58,8 +58,6 @@ - %{shared:-lc} \ - %{!shared:%{profile:-lc_p}%{!profile:-lc}}" - --#define LIBGCC_SPEC "%{mfloat-abi=soft*:-lfloat} -lgcc" -- - #define GLIBC_DYNAMIC_LINKER "/lib/ld-linux.so.2" - - #define LINUX_TARGET_LINK_SPEC "%{h*} \ diff --git a/toolchain/gcc/patches/arc-2017.09-release/820-libgcc_pic.patch b/toolchain/gcc/patches/arc-2017.09-release/820-libgcc_pic.patch deleted file mode 100644 index 0cc1e07e2b..0000000000 --- a/toolchain/gcc/patches/arc-2017.09-release/820-libgcc_pic.patch +++ /dev/null @@ -1,44 +0,0 @@ -commit c96312958c0621e72c9b32da5bc224ffe2161384 -Author: Felix Fietkau -Date: Mon Oct 19 23:26:09 2009 +0000 - - gcc: create a proper libgcc_pic.a static library for relinking (4.3.3+ for now, backport will follow) - - SVN-Revision: 18086 - ---- a/libgcc/Makefile.in -+++ b/libgcc/Makefile.in -@@ -920,11 +920,12 @@ $(libgcov-driver-objects): %$(objext): $ - - # Static libraries. - libgcc.a: $(libgcc-objects) -+libgcc_pic.a: $(libgcc-s-objects) - libgcov.a: $(libgcov-objects) - libunwind.a: $(libunwind-objects) - libgcc_eh.a: $(libgcc-eh-objects) - --libgcc.a libgcov.a libunwind.a libgcc_eh.a: -+libgcc.a libgcov.a libunwind.a libgcc_eh.a libgcc_pic.a: - -rm -f $@ - - objects="$(objects)"; \ -@@ -945,7 +946,7 @@ all: libunwind.a - endif - - ifeq ($(enable_shared),yes) --all: libgcc_eh.a libgcc_s$(SHLIB_EXT) -+all: libgcc_eh.a libgcc_pic.a libgcc_s$(SHLIB_EXT) - ifneq ($(LIBUNWIND),) - all: libunwind$(SHLIB_EXT) - libgcc_s$(SHLIB_EXT): libunwind$(SHLIB_EXT) -@@ -1151,6 +1152,10 @@ install-shared: - chmod 644 $(DESTDIR)$(inst_libdir)/libgcc_eh.a - $(RANLIB) $(DESTDIR)$(inst_libdir)/libgcc_eh.a - -+ $(INSTALL_DATA) libgcc_pic.a $(mapfile) $(DESTDIR)$(inst_libdir)/ -+ chmod 644 $(DESTDIR)$(inst_libdir)/libgcc_pic.a -+ $(RANLIB) $(DESTDIR)$(inst_libdir)/libgcc_pic.a -+ - $(subst @multilib_dir@,$(MULTIDIR),$(subst \ - @shlib_base_name@,libgcc_s,$(subst \ - @shlib_slibdir_qual@,$(MULTIOSSUBDIR),$(SHLIB_INSTALL)))) diff --git a/toolchain/gcc/patches/arc-2017.09-release/840-armv4_pass_fix-v4bx_to_ld.patch b/toolchain/gcc/patches/arc-2017.09-release/840-armv4_pass_fix-v4bx_to_ld.patch deleted file mode 100644 index b9c9b161ad..0000000000 --- a/toolchain/gcc/patches/arc-2017.09-release/840-armv4_pass_fix-v4bx_to_ld.patch +++ /dev/null @@ -1,28 +0,0 @@ -commit 7edc8ca5456d9743dd0075eb3cc5b04f4f24c8cc -Author: Imre Kaloz -Date: Wed Feb 2 19:34:36 2011 +0000 - - add armv4 fixup patches - - SVN-Revision: 25322 - - ---- a/gcc/config/arm/linux-eabi.h -+++ b/gcc/config/arm/linux-eabi.h -@@ -88,10 +88,15 @@ - #define MUSL_DYNAMIC_LINKER \ - "/lib/ld-musl-arm" MUSL_DYNAMIC_LINKER_E "%{mfloat-abi=hard:hf}.so.1" - -+/* For armv4 we pass --fix-v4bx to linker to support EABI */ -+#undef TARGET_FIX_V4BX_SPEC -+#define TARGET_FIX_V4BX_SPEC " %{mcpu=arm8|mcpu=arm810|mcpu=strongarm*"\ -+ "|march=armv4|mcpu=fa526|mcpu=fa626:--fix-v4bx}" -+ - /* At this point, bpabi.h will have clobbered LINK_SPEC. We want to - use the GNU/Linux version, not the generic BPABI version. */ - #undef LINK_SPEC --#define LINK_SPEC EABI_LINK_SPEC \ -+#define LINK_SPEC EABI_LINK_SPEC TARGET_FIX_V4BX_SPEC \ - LINUX_OR_ANDROID_LD (LINUX_TARGET_LINK_SPEC, \ - LINUX_TARGET_LINK_SPEC " " ANDROID_LINK_SPEC) - diff --git a/toolchain/gcc/patches/arc-2017.09-release/850-use_shared_libgcc.patch b/toolchain/gcc/patches/arc-2017.09-release/850-use_shared_libgcc.patch deleted file mode 100644 index 1d07efed80..0000000000 --- a/toolchain/gcc/patches/arc-2017.09-release/850-use_shared_libgcc.patch +++ /dev/null @@ -1,54 +0,0 @@ -commit dcfc40358b5a3cae7320c17f8d1cebd5ad5540cd -Author: Felix Fietkau -Date: Sun Feb 12 20:25:47 2012 +0000 - - gcc 4.6: port over the missing patch 850-use_shared_libgcc.patch to prevent libgcc crap from leaking into every single binary - - SVN-Revision: 30486 ---- a/gcc/config/arm/linux-eabi.h -+++ b/gcc/config/arm/linux-eabi.h -@@ -126,10 +126,6 @@ - "%{Ofast|ffast-math|funsafe-math-optimizations:crtfastmath.o%s} " \ - LINUX_OR_ANDROID_LD (GNU_USER_TARGET_ENDFILE_SPEC, ANDROID_ENDFILE_SPEC) - --/* Use the default LIBGCC_SPEC, not the version in linux-elf.h, as we -- do not use -lfloat. */ --#undef LIBGCC_SPEC -- - /* Clear the instruction cache from `beg' to `end'. This is - implemented in lib1funcs.S, so ensure an error if this definition - is used. */ ---- a/gcc/config/linux.h -+++ b/gcc/config/linux.h -@@ -53,6 +53,10 @@ see the files COPYING3 and COPYING.RUNTI - builtin_assert ("system=posix"); \ - } while (0) - -+#ifndef LIBGCC_SPEC -+#define LIBGCC_SPEC "%{static|static-libgcc:-lgcc}%{!static:%{!static-libgcc:-lgcc_s}}" -+#endif -+ - /* Determine which dynamic linker to use depending on whether GLIBC or - uClibc or Bionic or musl is the default C library and whether - -muclibc or -mglibc or -mbionic or -mmusl has been passed to change ---- a/libgcc/mkmap-symver.awk -+++ b/libgcc/mkmap-symver.awk -@@ -136,5 +136,5 @@ function output(lib) { - else if (inherit[lib]) - printf("} %s;\n", inherit[lib]); - else -- printf ("\n local:\n\t*;\n};\n"); -+ printf ("\n\t*;\n};\n"); - } ---- a/gcc/config/rs6000/linux.h -+++ b/gcc/config/rs6000/linux.h -@@ -60,6 +60,9 @@ - #undef CPP_OS_DEFAULT_SPEC - #define CPP_OS_DEFAULT_SPEC "%(cpp_os_linux)" - -+#undef LIBGCC_SPEC -+#define LIBGCC_SPEC "%{!static:%{!static-libgcc:-lgcc_s}} -lgcc" -+ - #undef LINK_SHLIB_SPEC - #define LINK_SHLIB_SPEC "%{shared:-shared} %{!shared: %{static:-static}}" - diff --git a/toolchain/gcc/patches/arc-2017.09-release/851-libgcc_no_compat.patch b/toolchain/gcc/patches/arc-2017.09-release/851-libgcc_no_compat.patch deleted file mode 100644 index d710e40717..0000000000 --- a/toolchain/gcc/patches/arc-2017.09-release/851-libgcc_no_compat.patch +++ /dev/null @@ -1,22 +0,0 @@ -commit 64661de100da1ec1061ef3e5e400285dce115e6b -Author: Felix Fietkau -Date: Sun May 10 13:16:35 2015 +0000 - - gcc: add some size optimization patches - - Signed-off-by: Felix Fietkau - - SVN-Revision: 45664 - ---- a/libgcc/config/t-libunwind -+++ b/libgcc/config/t-libunwind -@@ -2,8 +2,7 @@ - - HOST_LIBGCC2_CFLAGS += -DUSE_GAS_SYMVER - --LIB2ADDEH = $(srcdir)/unwind-sjlj.c $(srcdir)/unwind-c.c \ -- $(srcdir)/unwind-compat.c $(srcdir)/unwind-dw2-fde-compat.c -+LIB2ADDEH = $(srcdir)/unwind-sjlj.c $(srcdir)/unwind-c.c - LIB2ADDEHSTATIC = $(srcdir)/unwind-sjlj.c $(srcdir)/unwind-c.c - - # Override the default value from t-slibgcc-elf-ver and mention -lunwind diff --git a/toolchain/gcc/patches/arc-2017.09-release/870-ppc_no_crtsavres.patch b/toolchain/gcc/patches/arc-2017.09-release/870-ppc_no_crtsavres.patch deleted file mode 100644 index 156468b45e..0000000000 --- a/toolchain/gcc/patches/arc-2017.09-release/870-ppc_no_crtsavres.patch +++ /dev/null @@ -1,18 +0,0 @@ -commit d8c570a1531035c3e26bcd94741e5f5b9c36b5d9 -Author: Felix Fietkau -Date: Mon Mar 5 00:51:01 2012 +0000 - - gcc: do not emit references to _savegpr_* and _restgpr_* on powerpc, as they are tricky to deal with wrt. libgcc. they cannot be linked dynamically - - SVN-Revision: 30814 ---- a/gcc/config/rs6000/rs6000.c -+++ b/gcc/config/rs6000/rs6000.c -@@ -26936,7 +26936,7 @@ rs6000_savres_strategy (rs6000_stack_t * - /* Define cutoff for using out-of-line functions to save registers. */ - if (DEFAULT_ABI == ABI_V4 || TARGET_ELF) - { -- if (!optimize_size) -+ if (1) - { - strategy |= SAVE_INLINE_FPRS | REST_INLINE_FPRS; - strategy |= SAVE_INLINE_GPRS | REST_INLINE_GPRS; diff --git a/toolchain/gcc/patches/arc-2017.09-release/881-no_tm_section.patch b/toolchain/gcc/patches/arc-2017.09-release/881-no_tm_section.patch deleted file mode 100644 index a58dc27e64..0000000000 --- a/toolchain/gcc/patches/arc-2017.09-release/881-no_tm_section.patch +++ /dev/null @@ -1,22 +0,0 @@ -commit 565988ab47bd9b96b50608564aee2104aeb4b7ae -Author: Felix Fietkau -Date: Tue Dec 13 14:20:49 2016 +0100 - - gcc: rip out transactional memory related bloat from crtbegin - - Slightly improves compression for each executable, saving about 4k from - the default ar71xx rootfs - - Signed-off-by: Felix Fietkau - ---- a/libgcc/crtstuff.c -+++ b/libgcc/crtstuff.c -@@ -152,7 +152,7 @@ call_ ## FUNC (void) \ - #endif - - #if !defined(USE_TM_CLONE_REGISTRY) && defined(OBJECT_FORMAT_ELF) --# define USE_TM_CLONE_REGISTRY 1 -+# define USE_TM_CLONE_REGISTRY 0 - #endif - - /* We do not want to add the weak attribute to the declarations of these diff --git a/toolchain/gcc/patches/arc-2017.09-release/900-bad-mips16-crt.patch b/toolchain/gcc/patches/arc-2017.09-release/900-bad-mips16-crt.patch deleted file mode 100644 index f5cc0a74ee..0000000000 --- a/toolchain/gcc/patches/arc-2017.09-release/900-bad-mips16-crt.patch +++ /dev/null @@ -1,30 +0,0 @@ -commit 9dc38e48f7a6f88b7ac7bfaced91f53660204e46 -Author: Florian Fainelli -Date: Fri Apr 5 12:36:06 2013 +0000 - - toolchain/gcc: .init and .fini need to pick one ISA - - The .init and .fini sections are built by concatenating code - fragments. Putting mips16 code in the middle of a mips32 code block - doesn't work. Make gcc built the magic crt stuff in no-mips16 mode. - - This is specific to 4.6-linaro but is probably portable to other gcc - flavors. Adding this to the t-libgcc-mips16 makefile fragment is a - hack not suitable for pushing upstream, but there is no mips/t-linux - or mips/t-uclibc and I am not going to touch gcc/configure for two - lines. - - Signed-off-by: Jay Carlson - Signed-off-by: Florian Fainelli - - SVN-Revision: 36200 - ---- a/libgcc/config/mips/t-mips16 -+++ b/libgcc/config/mips/t-mips16 -@@ -43,3 +43,6 @@ SYNC_CFLAGS = -mno-mips16 - - # Version these symbols if building libgcc.so. - SHLIB_MAPFILES += $(srcdir)/config/mips/libgcc-mips16.ver -+ -+CRTSTUFF_T_CFLAGS += -mno-mips16 -+CRTSTUFF_T_CFLAGS_S += -mno-mips16 diff --git a/toolchain/gcc/patches/arc-2017.09-release/910-mbsd_multi.patch b/toolchain/gcc/patches/arc-2017.09-release/910-mbsd_multi.patch deleted file mode 100644 index 286cfadae7..0000000000 --- a/toolchain/gcc/patches/arc-2017.09-release/910-mbsd_multi.patch +++ /dev/null @@ -1,146 +0,0 @@ -commit 99368862e44740ff4fd33760893f04e14f9dbdf1 -Author: Felix Fietkau -Date: Tue Jul 31 00:52:27 2007 +0000 - - Port the mbsd_multi patch from freewrt, which adds -fhonour-copts. This will emit warnings in packages that don't use our target cflags properly - - SVN-Revision: 8256 - - This patch brings over a feature from MirBSD: - * -fhonour-copts - If this option is not given, it's warned (depending - on environment variables). This is to catch errors - of misbuilt packages which override CFLAGS themselves. - - This patch was authored by Thorsten Glaser - with copyright assignment to the FSF in effect. - ---- a/gcc/c-family/c-opts.c -+++ b/gcc/c-family/c-opts.c -@@ -108,6 +108,9 @@ static int class_dump_flags; - /* Whether any standard preincluded header has been preincluded. */ - static bool done_preinclude; - -+/* Check if a port honours COPTS. */ -+static int honour_copts = 0; -+ - static void handle_OPT_d (const char *); - static void set_std_cxx98 (int); - static void set_std_cxx11 (int); -@@ -456,6 +459,12 @@ c_common_handle_option (size_t scode, co - flag_no_builtin = !value; - break; - -+ case OPT_fhonour_copts: -+ if (c_language == clk_c) { -+ honour_copts++; -+ } -+ break; -+ - case OPT_fconstant_string_class_: - constant_string_class_name = arg; - break; -@@ -1084,6 +1093,47 @@ c_common_init (void) - return false; - } - -+ if (c_language == clk_c) { -+ char *ev = getenv ("GCC_HONOUR_COPTS"); -+ int evv; -+ if (ev == NULL) -+ evv = -1; -+ else if ((*ev == '0') || (*ev == '\0')) -+ evv = 0; -+ else if (*ev == '1') -+ evv = 1; -+ else if (*ev == '2') -+ evv = 2; -+ else if (*ev == 's') -+ evv = -1; -+ else { -+ warning (0, "unknown GCC_HONOUR_COPTS value, assuming 1"); -+ evv = 1; /* maybe depend this on something like MIRBSD_NATIVE? */ -+ } -+ if (evv == 1) { -+ if (honour_copts == 0) { -+ error ("someone does not honour COPTS at all in lenient mode"); -+ return false; -+ } else if (honour_copts != 1) { -+ warning (0, "someone does not honour COPTS correctly, passed %d times", -+ honour_copts); -+ } -+ } else if (evv == 2) { -+ if (honour_copts == 0) { -+ error ("someone does not honour COPTS at all in strict mode"); -+ return false; -+ } else if (honour_copts != 1) { -+ error ("someone does not honour COPTS correctly, passed %d times", -+ honour_copts); -+ return false; -+ } -+ } else if (evv == 0) { -+ if (honour_copts != 1) -+ inform (0, "someone does not honour COPTS correctly, passed %d times", -+ honour_copts); -+ } -+ } -+ - return true; - } - ---- a/gcc/c-family/c.opt -+++ b/gcc/c-family/c.opt -@@ -1412,6 +1412,9 @@ C++ ObjC++ Optimization Alias(fexception - fhonor-std - C++ ObjC++ Ignore Warn(switch %qs is no longer supported) - -+fhonour-copts -+C ObjC C++ ObjC++ RejectNegative -+ - fhosted - C ObjC - Assume normal C execution environment. ---- a/gcc/common.opt -+++ b/gcc/common.opt -@@ -1510,6 +1510,9 @@ fguess-branch-probability - Common Report Var(flag_guess_branch_prob) Optimization - Enable guessing of branch probabilities. - -+fhonour-copts -+Common RejectNegative -+ - ; Nonzero means ignore `#ident' directives. 0 means handle them. - ; Generate position-independent code for executables if possible - ; On SVR4 targets, it also controls whether or not to emit a ---- a/gcc/opts.c -+++ b/gcc/opts.c -@@ -1928,6 +1928,9 @@ common_handle_option (struct gcc_options - opts, opts_set, loc, dc); - break; - -+ case OPT_fhonour_copts: -+ break; -+ - case OPT_Wlarger_than_: - opts->x_larger_than_size = value; - opts->x_warn_larger_than = value != -1; ---- a/gcc/doc/invoke.texi -+++ b/gcc/doc/invoke.texi -@@ -6567,6 +6567,17 @@ This option is only supported for C and - @option{-Wall} and by @option{-Wpedantic}, which can be disabled with - @option{-Wno-pointer-sign}. - -+@item -fhonour-copts -+@opindex fhonour-copts -+If @env{GCC_HONOUR_COPTS} is set to 1, abort if this option is not -+given at least once, and warn if it is given more than once. -+If @env{GCC_HONOUR_COPTS} is set to 2, abort if this option is not -+given exactly once. -+If @env{GCC_HONOUR_COPTS} is set to 0 or unset, warn if this option -+is not given exactly once. -+The warning is quelled if @env{GCC_HONOUR_COPTS} is set to @samp{s}. -+This flag and environment variable only affect the C language. -+ - @item -Wstack-protector - @opindex Wstack-protector - @opindex Wno-stack-protector diff --git a/toolchain/gcc/patches/arc-2017.09-release/920-specs_nonfatal_getenv.patch b/toolchain/gcc/patches/arc-2017.09-release/920-specs_nonfatal_getenv.patch deleted file mode 100644 index 69b40621dc..0000000000 --- a/toolchain/gcc/patches/arc-2017.09-release/920-specs_nonfatal_getenv.patch +++ /dev/null @@ -1,22 +0,0 @@ -Author: Jo-Philipp Wich -Date: Sat Apr 21 03:02:39 2012 +0000 - - gcc: add patch to make the getenv() spec function nonfatal if requested environment variable is unset - - SVN-Revision: 31390 - ---- a/gcc/gcc.c -+++ b/gcc/gcc.c -@@ -9280,8 +9280,10 @@ getenv_spec_function (int argc, const ch - value = varname; - - if (!value) -- fatal_error (input_location, -- "environment variable %qs not defined", varname); -+ { -+ warning (input_location, "environment variable %qs not defined", varname); -+ value = ""; -+ } - - /* We have to escape every character of the environment variable so - they are not interpreted as active spec characters. A diff --git a/toolchain/gcc/patches/arc-2017.09-release/930-fix-mips-noexecstack.patch b/toolchain/gcc/patches/arc-2017.09-release/930-fix-mips-noexecstack.patch deleted file mode 100644 index 90d10f11e4..0000000000 --- a/toolchain/gcc/patches/arc-2017.09-release/930-fix-mips-noexecstack.patch +++ /dev/null @@ -1,111 +0,0 @@ -From da45b3fde60095756f5f6030f6012c23a3d34429 Mon Sep 17 00:00:00 2001 -From: Andrew McDonnell -Date: Fri, 3 Oct 2014 19:09:00 +0930 -Subject: Add .note.GNU-stack section - -See http://lists.busybox.net/pipermail/uclibc/2014-October/048671.html -Below copied from https://gcc.gnu.org/ml/gcc-patches/2014-09/msg02430.html - -Re: [Patch, MIPS] Add .note.GNU-stack section - - From: Steve Ellcey - -On Wed, 2014-09-10 at 10:15 -0700, Eric Christopher wrote: -> -> -> On Wed, Sep 10, 2014 at 9:27 AM, wrote: - -> This works except you did not update the assembly files in -> libgcc or glibc. We (Cavium) have the same patch in our tree -> for a few released versions. - -> Mind just checking yours in then Andrew? - -> Thanks! -> -eric - -I talked to Andrew about what files he changed in GCC and created and -tested this new patch. Andrew also mentioned changing some assembly -files in glibc but I don't see any use of '.section .note.GNU-stack' in -any assembly files in glibc (for any platform) so I wasn't planning on -creating a glibc to add them to mips glibc assembly language files. - -OK to check in this patch? - -Steve Ellcey -sellcey@mips.com - - - -2014-09-26 Steve Ellcey ---- - gcc/config/mips/mips.c | 3 +++ - libgcc/config/mips/crti.S | 4 ++++ - libgcc/config/mips/crtn.S | 3 +++ - libgcc/config/mips/mips16.S | 4 ++++ - libgcc/config/mips/vr4120-div.S | 4 ++++ - 5 files changed, 18 insertions(+) - ---- a/gcc/config/mips/mips.c -+++ b/gcc/config/mips/mips.c -@@ -22561,6 +22561,9 @@ mips_promote_function_mode (const_tree t - #undef TARGET_CUSTOM_FUNCTION_DESCRIPTORS - #define TARGET_CUSTOM_FUNCTION_DESCRIPTORS 2 - -+#undef TARGET_ASM_FILE_END -+#define TARGET_ASM_FILE_END file_end_indicate_exec_stack -+ - struct gcc_target targetm = TARGET_INITIALIZER; - - #include "gt-mips.h" ---- a/libgcc/config/mips/crti.S -+++ b/libgcc/config/mips/crti.S -@@ -21,6 +21,10 @@ a copy of the GCC Runtime Library Except - see the files COPYING3 and COPYING.RUNTIME respectively. If not, see - . */ - -+ -+/* An executable stack is *not* required for these functions. */ -+ .section .note.GNU-stack,"",%progbits -+ - /* 4 slots for argument spill area. 1 for cpreturn, 1 for stack. - Return spill offset of 40 and 20. Aligned to 16 bytes for n32. */ - ---- a/libgcc/config/mips/crtn.S -+++ b/libgcc/config/mips/crtn.S -@@ -21,6 +21,9 @@ a copy of the GCC Runtime Library Except - see the files COPYING3 and COPYING.RUNTIME respectively. If not, see - . */ - -+/* An executable stack is *not* required for these functions. */ -+ .section .note.GNU-stack,"",%progbits -+ - /* 4 slots for argument spill area. 1 for cpreturn, 1 for stack. - Return spill offset of 40 and 20. Aligned to 16 bytes for n32. */ - ---- a/libgcc/config/mips/mips16.S -+++ b/libgcc/config/mips/mips16.S -@@ -48,6 +48,10 @@ see the files COPYING3 and COPYING.RUNTI - values using the soft-float calling convention, but do the actual - operation using the hard floating point instructions. */ - -+/* An executable stack is *not* required for these functions. */ -+ .section .note.GNU-stack,"",%progbits -+ .previous -+ - #if defined _MIPS_SIM && (_MIPS_SIM == _ABIO32 || _MIPS_SIM == _ABIO64) - - /* This file contains 32-bit assembly code. */ ---- a/libgcc/config/mips/vr4120-div.S -+++ b/libgcc/config/mips/vr4120-div.S -@@ -26,6 +26,10 @@ see the files COPYING3 and COPYING.RUNTI - -mfix-vr4120. div and ddiv do not give the correct result when one - of the operands is negative. */ - -+/* An executable stack is *not* required for these functions. */ -+ .section .note.GNU-stack,"",%progbits -+ .previous -+ - .set nomips16 - - #define DIV \ diff --git a/toolchain/gcc/patches/arc-2017.09-release/940-no-clobber-stamp-bits.patch b/toolchain/gcc/patches/arc-2017.09-release/940-no-clobber-stamp-bits.patch deleted file mode 100644 index 8b88b4066d..0000000000 --- a/toolchain/gcc/patches/arc-2017.09-release/940-no-clobber-stamp-bits.patch +++ /dev/null @@ -1,33 +0,0 @@ -commit 548d9a008ff265e9eaa3c7e0e6e301c6bd5645e6 -Author: Felix Fietkau -Date: Fri Dec 12 17:01:57 2014 +0000 - - gcc: don't clobber stamp-bits with a symlink to itself - - Several versions of gcc have an issue in libstdc++v3 where the build may - clobber stamp-bits with a link to itself. This doesn't manifest itself - on all systems. On several Ubuntu systems, this doesn't appear to be a - problem, but it is an issue on Fedora 16 systems. - - To fix the issue, we'll simply filter out stamp-bits from the symlinks - to be generated. - - Note: gcc 4.4.7 is unaffected by this issue, so no fix is necessary - there. - - Signed-off-by: John Szakmeister - - SVN-Revision: 43669 - - ---- a/libstdc++-v3/include/Makefile.in -+++ b/libstdc++-v3/include/Makefile.in -@@ -1476,7 +1476,7 @@ stamp-bits: ${bits_headers} - @$(STAMP) stamp-bits - - stamp-bits-sup: stamp-bits ${bits_sup_headers} -- @-cd ${bits_builddir} && $(LN_S) $? . 2>/dev/null -+ @-cd ${bits_builddir} && $(LN_S) $(filter-out stamp-bits,$?) . 2>/dev/null - @$(STAMP) stamp-bits-sup - - stamp-c_base: ${c_base_headers} diff --git a/toolchain/gcc/patches/arc-2017.09-release/950-cpp_file_path_translation.patch b/toolchain/gcc/patches/arc-2017.09-release/950-cpp_file_path_translation.patch deleted file mode 100644 index 60729dd7fe..0000000000 --- a/toolchain/gcc/patches/arc-2017.09-release/950-cpp_file_path_translation.patch +++ /dev/null @@ -1,181 +0,0 @@ -commit 331735a357a73c7b8adc205241ac3cc6543d985e -Author: Felix Fietkau -Date: Tue Nov 17 12:38:22 2015 +0000 - - gcc: add a patch to 5.x that supports translation of __FILE__ paths - - Signed-off-by: Felix Fietkau - - SVN-Revision: 47490 - -Forward ported from attachment to https://gcc.gnu.org/bugzilla/show_bug.cgi?id=47047 - ---- a/gcc/c-family/c-opts.c -+++ b/gcc/c-family/c-opts.c -@@ -588,6 +588,10 @@ c_common_handle_option (size_t scode, co - add_path (xstrdup (arg), SYSTEM, 0, true); - break; - -+ case OPT_iremap: -+ add_cpp_remap_path (arg); -+ break; -+ - case OPT_iwithprefix: - add_prefixed_path (arg, SYSTEM); - break; ---- a/gcc/c-family/c.opt -+++ b/gcc/c-family/c.opt -@@ -1825,6 +1825,10 @@ iquote - C ObjC C++ ObjC++ Joined Separate MissingArgError(missing path after %qs) - -iquote Add to the end of the quote include path. - -+iremap -+C ObjC C++ ObjC++ Joined Separate -+-iremap Convert to if it occurs as prefix in __FILE__. -+ - iwithprefix - C ObjC C++ ObjC++ Joined Separate - -iwithprefix Add to the end of the system include path. ---- a/gcc/doc/cpp.texi -+++ b/gcc/doc/cpp.texi -@@ -4272,6 +4272,7 @@ Refer to the GCC manual for full documen - @c man begin SYNOPSIS - cpp [@option{-D}@var{macro}[=@var{defn}]@dots{}] [@option{-U}@var{macro}] - [@option{-I}@var{dir}@dots{}] [@option{-iquote}@var{dir}@dots{}] -+ [@option{-iremap}@var{src}:@var{dst}] - [@option{-M}|@option{-MM}] [@option{-MG}] [@option{-MF} @var{filename}] - [@option{-MP}] [@option{-MQ} @var{target}@dots{}] - [@option{-MT} @var{target}@dots{}] ---- a/gcc/doc/cppopts.texi -+++ b/gcc/doc/cppopts.texi -@@ -220,6 +220,12 @@ extensions @samp{.i}, @samp{.ii} or @sam - extensions that GCC uses for preprocessed files created by - @option{-save-temps}. - -+@item -iremap @var{src}:@var{dst} -+@opindex iremap -+Replace the prefix @var{src} in __FILE__ with @var{dst} at expansion time. -+This option can be specified more than once. Processing stops at the first -+match. -+ - @item -fdirectives-only - @opindex fdirectives-only - When preprocessing, handle directives, but do not expand macros. ---- a/gcc/doc/invoke.texi -+++ b/gcc/doc/invoke.texi -@@ -11863,6 +11863,12 @@ by @option{-fplugin=@var{name}} instead - @option{-fplugin=@var{path}/@var{name}.so}. This option is not meant - to be used by the user, but only passed by the driver. - -+@item -iremap @var{src}:@var{dst} -+@opindex iremap -+Replace the prefix @var{src} in __FILE__ with @var{dst} at expansion time. -+This option can be specified more than once. Processing stops at the first -+match. -+ - @item -L@var{dir} - @opindex L - Add directory @var{dir} to the list of directories to be searched ---- a/libcpp/include/cpplib.h -+++ b/libcpp/include/cpplib.h -@@ -820,6 +820,9 @@ extern void cpp_set_lang (cpp_reader *, - /* Set the include paths. */ - extern void cpp_set_include_chains (cpp_reader *, cpp_dir *, cpp_dir *, int); - -+/* Provide src:dst pair for __FILE__ remapping. */ -+extern void add_cpp_remap_path (const char *); -+ - /* Call these to get pointers to the options, callback, and deps - structures for a given reader. These pointers are good until you - call cpp_finish on that reader. You can either edit the callbacks ---- a/libcpp/macro.c -+++ b/libcpp/macro.c -@@ -227,6 +227,64 @@ static const char * const monthnames[] = - "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" - }; - -+static size_t remap_pairs; -+static char **remap_src; -+static char **remap_dst; -+ -+void -+add_cpp_remap_path (const char *arg) -+{ -+ const char *arg_dst; -+ size_t len; -+ -+ arg_dst = strchr(arg, ':'); -+ if (arg_dst == NULL) -+ { -+ fprintf(stderr, "Invalid argument for -iremap\n"); -+ exit(1); -+ } -+ -+ len = arg_dst - arg; -+ ++arg_dst; -+ -+ remap_src = (char **) xrealloc(remap_src, sizeof(char *) * (remap_pairs + 1)); -+ remap_dst = (char **) xrealloc(remap_dst, sizeof(char *) * (remap_pairs + 1)); -+ -+ remap_src[remap_pairs] = (char *) xmalloc(len + 1); -+ memcpy(remap_src[remap_pairs], arg, len); -+ remap_src[remap_pairs][len] = '\0'; -+ remap_dst[remap_pairs] = xstrdup(arg_dst); -+ ++remap_pairs; -+} -+ -+static const char * -+cpp_remap_file (const char *arg, char **tmp_name) -+{ -+ char *result; -+ size_t i, len; -+ -+ for (i = 0; i < remap_pairs; ++i) -+ { -+ len = strlen (remap_src[i]); -+ if (strncmp (remap_src[i], arg, len)) -+ continue; -+ if (arg[len] == '\0') -+ return xstrdup (remap_dst[i]); -+ if (arg[len] != '/') -+ continue; -+ arg += len; -+ len = strlen (remap_dst[i]); -+ result = (char *) xmalloc (len + strlen (arg) + 1); -+ memcpy(result, remap_dst[i], len); -+ strcpy(result + len, arg); -+ *tmp_name = result; -+ -+ return result; -+ } -+ -+ return arg; -+} -+ - /* Helper function for builtin_macro. Returns the text generated by - a builtin macro. */ - const uchar * -@@ -290,6 +348,7 @@ _cpp_builtin_macro_text (cpp_reader *pfi - { - unsigned int len; - const char *name; -+ char *tmp_name = NULL; - uchar *buf; - - if (node->value.builtin == BT_FILE) -@@ -301,6 +360,7 @@ _cpp_builtin_macro_text (cpp_reader *pfi - if (!name) - abort (); - } -+ name = cpp_remap_file (name, &tmp_name); - len = strlen (name); - buf = _cpp_unaligned_alloc (pfile, len * 2 + 3); - result = buf; -@@ -308,6 +368,7 @@ _cpp_builtin_macro_text (cpp_reader *pfi - buf = cpp_quote_string (buf + 1, (const unsigned char *) name, len); - *buf++ = '"'; - *buf = '\0'; -+ free (tmp_name); - } - break; - diff --git a/toolchain/glibc/common.mk b/toolchain/glibc/common.mk index 93aab8efd2..cdc5f20bf6 100644 --- a/toolchain/glibc/common.mk +++ b/toolchain/glibc/common.mk @@ -11,8 +11,8 @@ PKG_VERSION:=2.27 PKG_SOURCE_PROTO:=git PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION) -PKG_SOURCE_VERSION:=9f44fa22cb66067e92dc27167426ef4ad046c959 -PKG_MIRROR_HASH:=fa7f165b8b8f92e7813b69b9b3ce4ce8205bfdc12acae3f513b4456ec899bb2b +PKG_SOURCE_VERSION:=54ba8bcd42355ad0c0ca763b6bba40a2b2829f38 +PKG_MIRROR_HASH:=88d2672e0ac4192b6c28378b85bf3bcaec404f448bef418c790cd9f830012a3f PKG_SOURCE_URL:=https://sourceware.org/git/glibc.git PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.xz diff --git a/toolchain/musl/common.mk b/toolchain/musl/common.mk index b52263c43b..bb93b7b28d 100644 --- a/toolchain/musl/common.mk +++ b/toolchain/musl/common.mk @@ -8,13 +8,13 @@ include $(TOPDIR)/rules.mk include $(INCLUDE_DIR)/target.mk PKG_NAME:=musl -PKG_VERSION:=1.1.21 -PKG_RELEASE:=1 +PKG_VERSION:=1.1.23 +PKG_RELEASE:=3 PKG_SOURCE_PROTO:=git PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION) -PKG_SOURCE_VERSION:=1691b23955590d1eb66a11158fdd91c86337e886 -PKG_MIRROR_HASH:=4fa312d0ca020d31603ced84a7103fb328c6ae9508239491a228be17e7807147 +PKG_SOURCE_VERSION:=b07d45eb01e900f0176894fdedab62285f5cb8be +PKG_MIRROR_HASH:=47aa4608384cfde1da3e310051a15ddb58ab25d62d8232b6e17e56a681dce44e PKG_SOURCE_URL:=git://git.musl-libc.org/musl PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.xz diff --git a/toolchain/musl/patches/020-mips-dlsym_donot_return_address_from_undef_sym.patch b/toolchain/musl/patches/020-mips-dlsym_donot_return_address_from_undef_sym.patch new file mode 100644 index 0000000000..b3559471f3 --- /dev/null +++ b/toolchain/musl/patches/020-mips-dlsym_donot_return_address_from_undef_sym.patch @@ -0,0 +1,136 @@ +>From a57cd35acf26ba6202ed6534a57f496464f431a1 Mon Sep 17 00:00:00 2001 +From: Szabolcs Nagy +Date: Sat, 10 Aug 2019 23:14:40 +0000 +Subject: [PATCH] make relocation time symbol lookup and dlsym consistent + +Using common code path for all symbol lookups fixes three dlsym issues: + +- st_shndx of STT_TLS symbols were not checked and thus an undefined + tls symbol reference could be incorrectly treated as a definition + (the sysv hash lookup returns undefined symbols, gnu does not, so should + be rare in practice). + +- symbol binding was not checked so a hidden symbol may be returned + (in principle STB_LOCAL symbols may appear in the dynamic symbol table + for hidden symbols, but linkers most likely don't produce it). + +- mips specific behaviour was not applied (ARCH_SYM_REJECT_UND) so + undefined symbols may be returned on mips. + +always_inline is used to avoid relocation performance regression, the +code generation for find_sym should not be affected. +--- + ldso/dynlink.c | 84 +++++++++++++++++++------------------------------- + 1 file changed, 31 insertions(+), 53 deletions(-) + +--- a/ldso/dynlink.c ++++ b/ldso/dynlink.c +@@ -283,12 +283,16 @@ static Sym *gnu_lookup_filtered(uint32_t + #define ARCH_SYM_REJECT_UND(s) 0 + #endif + +-static struct symdef find_sym(struct dso *dso, const char *s, int need_def) ++#if defined(__GNUC__) ++__attribute__((always_inline)) ++#endif ++static inline struct symdef find_sym2(struct dso *dso, const char *s, int need_def, int use_deps) + { + uint32_t h = 0, gh = gnu_hash(s), gho = gh / (8*sizeof(size_t)), *ght; + size_t ghm = 1ul << gh % (8*sizeof(size_t)); + struct symdef def = {0}; +- for (; dso; dso=dso->syms_next) { ++ struct dso **deps = use_deps ? dso->deps : 0; ++ for (; dso; dso=use_deps ? *deps++ : dso->syms_next) { + Sym *sym; + if ((ght = dso->ghashtab)) { + sym = gnu_lookup_filtered(gh, ght, dso, s, gho, ghm); +@@ -313,6 +317,11 @@ static struct symdef find_sym(struct dso + return def; + } + ++static struct symdef find_sym(struct dso *dso, const char *s, int need_def) ++{ ++ return find_sym2(dso, s, need_def, 0); ++} ++ + static void do_relocs(struct dso *dso, size_t *rel, size_t rel_size, size_t stride) + { + unsigned char *base = dso->base; +@@ -2118,58 +2127,27 @@ static void *addr2dso(size_t a) + + static void *do_dlsym(struct dso *p, const char *s, void *ra) + { +- size_t i; +- uint32_t h = 0, gh = 0, *ght; +- Sym *sym; +- if (p == head || p == RTLD_DEFAULT || p == RTLD_NEXT) { +- if (p == RTLD_DEFAULT) { +- p = head; +- } else if (p == RTLD_NEXT) { +- p = addr2dso((size_t)ra); +- if (!p) p=head; +- p = p->next; +- } +- struct symdef def = find_sym(p, s, 0); +- if (!def.sym) goto failed; +- if ((def.sym->st_info&0xf) == STT_TLS) +- return __tls_get_addr((tls_mod_off_t []){def.dso->tls_id, def.sym->st_value-DTP_OFFSET}); +- if (DL_FDPIC && (def.sym->st_info&0xf) == STT_FUNC) +- return def.dso->funcdescs + (def.sym - def.dso->syms); +- return laddr(def.dso, def.sym->st_value); +- } +- if (__dl_invalid_handle(p)) ++ int use_deps = 0; ++ if (p == head || p == RTLD_DEFAULT) { ++ p = head; ++ } else if (p == RTLD_NEXT) { ++ p = addr2dso((size_t)ra); ++ if (!p) p=head; ++ p = p->next; ++ } else if (__dl_invalid_handle(p)) { ++ return 0; ++ } else ++ use_deps = 1; ++ struct symdef def = find_sym2(p, s, 0, use_deps); ++ if (!def.sym) { ++ error("Symbol not found: %s", s); + return 0; +- if ((ght = p->ghashtab)) { +- gh = gnu_hash(s); +- sym = gnu_lookup(gh, ght, p, s); +- } else { +- h = sysv_hash(s); +- sym = sysv_lookup(s, h, p); +- } +- if (sym && (sym->st_info&0xf) == STT_TLS) +- return __tls_get_addr((tls_mod_off_t []){p->tls_id, sym->st_value-DTP_OFFSET}); +- if (DL_FDPIC && sym && sym->st_shndx && (sym->st_info&0xf) == STT_FUNC) +- return p->funcdescs + (sym - p->syms); +- if (sym && sym->st_value && (1<<(sym->st_info&0xf) & OK_TYPES)) +- return laddr(p, sym->st_value); +- for (i=0; p->deps[i]; i++) { +- if ((ght = p->deps[i]->ghashtab)) { +- if (!gh) gh = gnu_hash(s); +- sym = gnu_lookup(gh, ght, p->deps[i], s); +- } else { +- if (!h) h = sysv_hash(s); +- sym = sysv_lookup(s, h, p->deps[i]); +- } +- if (sym && (sym->st_info&0xf) == STT_TLS) +- return __tls_get_addr((tls_mod_off_t []){p->deps[i]->tls_id, sym->st_value-DTP_OFFSET}); +- if (DL_FDPIC && sym && sym->st_shndx && (sym->st_info&0xf) == STT_FUNC) +- return p->deps[i]->funcdescs + (sym - p->deps[i]->syms); +- if (sym && sym->st_value && (1<<(sym->st_info&0xf) & OK_TYPES)) +- return laddr(p->deps[i], sym->st_value); + } +-failed: +- error("Symbol not found: %s", s); +- return 0; ++ if ((def.sym->st_info&0xf) == STT_TLS) ++ return __tls_get_addr((tls_mod_off_t []){def.dso->tls_id, def.sym->st_value-DTP_OFFSET}); ++ if (DL_FDPIC && (def.sym->st_info&0xf) == STT_FUNC) ++ return def.dso->funcdescs + (def.sym - def.dso->syms); ++ return laddr(def.dso, def.sym->st_value); + } + + int dladdr(const void *addr_arg, Dl_info *info) diff --git a/toolchain/musl/patches/030-fix-x87-stack-imbalance-in-corner-cases-of-i386-math.patch b/toolchain/musl/patches/030-fix-x87-stack-imbalance-in-corner-cases-of-i386-math.patch new file mode 100644 index 0000000000..a709330079 --- /dev/null +++ b/toolchain/musl/patches/030-fix-x87-stack-imbalance-in-corner-cases-of-i386-math.patch @@ -0,0 +1,179 @@ +From f3ed8bfe8a82af1870ddc8696ed4cc1d5aa6b441 Mon Sep 17 00:00:00 2001 +From: Rich Felker +Date: Mon, 5 Aug 2019 18:41:47 -0400 +Subject: fix x87 stack imbalance in corner cases of i386 math asm + +commit 31c5fb80b9eae86f801be4f46025bc6532a554c5 introduced underflow +code paths for the i386 math asm, along with checks on the fpu status +word to skip the underflow-generation instructions if the underflow +flag was already raised. unfortunately, at least one such path, in +log1p, returned with 2 items on the x87 stack rather than just 1 item +for the return value. this is a violation of the ABI's calling +convention, and could cause subsequent floating point code to produce +NANs due to x87 stack overflow. if floating point results are used in +flow control, this can lead to runaway wrong code execution. + +rather than reviewing each "underflow already raised" code path for +correctness, remove them all. they're likely slower than just +performing the underflow code unconditionally, and significantly more +complex. + +all of this code should be ripped out and replaced by C source files +with inline asm. doing so would preclude this kind of error by having +the compiler perform all x87 stack register allocation and stack +manipulation, and would produce comparable or better code. however +such a change is a much larger project. +--- + src/math/i386/asin.s | 10 ++-------- + src/math/i386/atan.s | 7 ++----- + src/math/i386/atan2.s | 5 +---- + src/math/i386/atan2f.s | 5 +---- + src/math/i386/atanf.s | 7 ++----- + src/math/i386/exp.s | 10 ++-------- + src/math/i386/log1p.s | 7 ++----- + src/math/i386/log1pf.s | 7 ++----- + 8 files changed, 14 insertions(+), 44 deletions(-) + +--- a/src/math/i386/asin.s ++++ b/src/math/i386/asin.s +@@ -7,13 +7,10 @@ asinf: + cmp $0x01000000,%eax + jae 1f + # subnormal x, return x with underflow +- fnstsw %ax +- and $16,%ax +- jnz 2f + fld %st(0) + fmul %st(1) + fstps 4(%esp) +-2: ret ++ ret + + .global asinl + .type asinl,@function +@@ -30,11 +27,8 @@ asin: + cmp $0x00200000,%eax + jae 1f + # subnormal x, return x with underflow +- fnstsw %ax +- and $16,%ax +- jnz 2f + fsts 4(%esp) +-2: ret ++ ret + 1: fld %st(0) + fld1 + fsub %st(0),%st(1) +--- a/src/math/i386/atan.s ++++ b/src/math/i386/atan.s +@@ -10,8 +10,5 @@ atan: + fpatan + ret + # subnormal x, return x with underflow +-1: fnstsw %ax +- and $16,%ax +- jnz 2f +- fsts 4(%esp) +-2: ret ++1: fsts 4(%esp) ++ ret +--- a/src/math/i386/atan2.s ++++ b/src/math/i386/atan2.s +@@ -10,8 +10,5 @@ atan2: + cmp $0x00200000,%eax + jae 1f + # subnormal x, return x with underflow +- fnstsw %ax +- and $16,%ax +- jnz 1f + fsts 4(%esp) +-1: ret ++ ret +--- a/src/math/i386/atan2f.s ++++ b/src/math/i386/atan2f.s +@@ -10,10 +10,7 @@ atan2f: + cmp $0x01000000,%eax + jae 1f + # subnormal x, return x with underflow +- fnstsw %ax +- and $16,%ax +- jnz 1f + fld %st(0) + fmul %st(1) + fstps 4(%esp) +-1: ret ++ ret +--- a/src/math/i386/atanf.s ++++ b/src/math/i386/atanf.s +@@ -10,10 +10,7 @@ atanf: + fpatan + ret + # subnormal x, return x with underflow +-1: fnstsw %ax +- and $16,%ax +- jnz 2f +- fld %st(0) ++1: fld %st(0) + fmul %st(1) + fstps 4(%esp) +-2: ret ++ ret +--- a/src/math/i386/exp.s ++++ b/src/math/i386/exp.s +@@ -7,13 +7,10 @@ expm1f: + cmp $0x01000000,%eax + jae 1f + # subnormal x, return x with underflow +- fnstsw %ax +- and $16,%ax +- jnz 2f + fld %st(0) + fmul %st(1) + fstps 4(%esp) +-2: ret ++ ret + + .global expm1l + .type expm1l,@function +@@ -30,11 +27,8 @@ expm1: + cmp $0x00200000,%eax + jae 1f + # subnormal x, return x with underflow +- fnstsw %ax +- and $16,%ax +- jnz 2f + fsts 4(%esp) +-2: ret ++ ret + 1: fldl2e + fmulp + mov $0xc2820000,%eax +--- a/src/math/i386/log1p.s ++++ b/src/math/i386/log1p.s +@@ -16,9 +16,6 @@ log1p: + fyl2x + ret + # subnormal x, return x with underflow +-2: fnstsw %ax +- and $16,%ax +- jnz 1f +- fsts 4(%esp) ++2: fsts 4(%esp) + fstp %st(1) +-1: ret ++ ret +--- a/src/math/i386/log1pf.s ++++ b/src/math/i386/log1pf.s +@@ -16,10 +16,7 @@ log1pf: + fyl2x + ret + # subnormal x, return x with underflow +-2: fnstsw %ax +- and $16,%ax +- jnz 1f +- fxch ++2: fxch + fmul %st(1) + fstps 4(%esp) +-1: ret ++ ret diff --git a/toolchain/musl/patches/031-fix-build-regression-in-i386-asm-for-atan2-atan2f.patch b/toolchain/musl/patches/031-fix-build-regression-in-i386-asm-for-atan2-atan2f.patch new file mode 100644 index 0000000000..8c5161b52c --- /dev/null +++ b/toolchain/musl/patches/031-fix-build-regression-in-i386-asm-for-atan2-atan2f.patch @@ -0,0 +1,28 @@ +From 6818c31c9bc4bbad5357f1de14bedf781e5b349e Mon Sep 17 00:00:00 2001 +From: Rich Felker +Date: Mon, 5 Aug 2019 19:57:07 -0400 +Subject: fix build regression in i386 asm for atan2, atan2f + +commit f3ed8bfe8a82af1870ddc8696ed4cc1d5aa6b441 inadvertently removed +labels that were still needed. +--- + src/math/i386/atan2.s | 2 +- + src/math/i386/atan2f.s | 2 +- + 2 files changed, 2 insertions(+), 2 deletions(-) + +--- a/src/math/i386/atan2.s ++++ b/src/math/i386/atan2.s +@@ -11,4 +11,4 @@ atan2: + jae 1f + # subnormal x, return x with underflow + fsts 4(%esp) +- ret ++1: ret +--- a/src/math/i386/atan2f.s ++++ b/src/math/i386/atan2f.s +@@ -13,4 +13,4 @@ atan2f: + fld %st(0) + fmul %st(1) + fstps 4(%esp) +- ret ++1: ret diff --git a/toolchain/musl/patches/400-Add-format-attribute-to-some-function-declarations.patch b/toolchain/musl/patches/400-Add-format-attribute-to-some-function-declarations.patch index f7eff9141f..06aeb34ced 100644 --- a/toolchain/musl/patches/400-Add-format-attribute-to-some-function-declarations.patch +++ b/toolchain/musl/patches/400-Add-format-attribute-to-some-function-declarations.patch @@ -87,7 +87,7 @@ Signed-off-by: Hauke Mehrtens } --- a/include/stdio.h +++ b/include/stdio.h -@@ -21,6 +21,14 @@ extern "C" { +@@ -25,6 +25,14 @@ extern "C" { #include @@ -102,7 +102,7 @@ Signed-off-by: Hauke Mehrtens #ifdef __cplusplus #define NULL 0L #else -@@ -103,19 +111,19 @@ int puts(const char *); +@@ -107,19 +115,19 @@ int puts(const char *); int printf(const char *__restrict, ...); int fprintf(FILE *__restrict, const char *__restrict, ...); int sprintf(char *__restrict, const char *__restrict, ...); @@ -127,7 +127,7 @@ Signed-off-by: Hauke Mehrtens void perror(const char *); -@@ -136,8 +144,8 @@ int pclose(FILE *); +@@ -140,8 +148,8 @@ int pclose(FILE *); int fileno(FILE *); int fseeko(FILE *, off_t, int); off_t ftello(FILE *); @@ -138,7 +138,7 @@ Signed-off-by: Hauke Mehrtens void flockfile(FILE *); int ftrylockfile(FILE *); void funlockfile(FILE *); -@@ -176,8 +184,8 @@ int fileno_unlocked(FILE *); +@@ -180,8 +188,8 @@ int fileno_unlocked(FILE *); int getw(FILE *); int putw(int, FILE *); char *fgetln(FILE *, size_t *); @@ -149,7 +149,7 @@ Signed-off-by: Hauke Mehrtens #endif #ifdef _GNU_SOURCE -@@ -199,6 +207,9 @@ typedef struct _IO_cookie_io_functions_t +@@ -203,6 +211,9 @@ typedef struct _IO_cookie_io_functions_t FILE *fopencookie(void *, const char *, cookie_io_functions_t); #endif diff --git a/toolchain/nasm/Makefile b/toolchain/nasm/Makefile index 53b7848caf..3efcc86203 100644 --- a/toolchain/nasm/Makefile +++ b/toolchain/nasm/Makefile @@ -5,12 +5,12 @@ include $(TOPDIR)/rules.mk PKG_NAME:=nasm -PKG_VERSION:=2.13.03 +PKG_VERSION:=2.14 PKG_SOURCE_URL:=https://www.nasm.us/pub/nasm/releasebuilds/$(PKG_VERSION)/ PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz -PKG_HASH:=812ecfb0dcbc5bd409aaa8f61c7de94c5b8752a7b00c632883d15b2ed6452573 +PKG_HASH:=97c615dbf02ef80e4e2b6c385f7e28368d51efc214daa98e600ca4572500eec0 HOST_BUILD_PARALLEL:=1 diff --git a/toolchain/nasm/patches/100-backport-upstream-GCC8-compatibility-fixes.patch b/toolchain/nasm/patches/100-backport-upstream-GCC8-compatibility-fixes.patch deleted file mode 100644 index a6c5027bec..0000000000 --- a/toolchain/nasm/patches/100-backport-upstream-GCC8-compatibility-fixes.patch +++ /dev/null @@ -1,15 +0,0 @@ ---- a/include/nasmlib.h -+++ b/include/nasmlib.h -@@ -188,11 +188,9 @@ int64_t readnum(char *str, bool *error); - int64_t readstrnum(char *str, int length, bool *warn); - - /* -- * seg_init: Initialise the segment-number allocator. - * seg_alloc: allocate a hitherto unused segment number. - */ --void pure_func seg_init(void); --int32_t pure_func seg_alloc(void); -+int32_t seg_alloc(void); - - /* - * many output formats will be able to make use of this: a standard diff --git a/tools/Makefile b/tools/Makefile index b3f56aaf4e..56040a4173 100644 --- a/tools/Makefile +++ b/tools/Makefile @@ -24,6 +24,7 @@ tools-y += sstrip make-ext4fs e2fsprogs mtd-utils mkimage tools-y += firmware-utils patch-image quilt padjffs2 tools-y += mm-macros missing-macros cmake scons bc findutils gengetopt patchelf tools-y += mtools dosfstools libressl +tools-$(CONFIG_TARGET_orion_generic) += wrt350nv2-builder upslug2 tools-$(CONFIG_TARGET_x86) += qemu tools-$(CONFIG_TARGET_mxs) += elftosb sdimage tools-$(CONFIG_TARGET_ar71xx) += lzma-old @@ -33,6 +34,7 @@ tools-y += lzma squashfskit4 zip tools-$(BUILD_ISL) += isl tools-$(CONFIG_USE_SPARSE) += sparse tools-$(CONFIG_TARGET_apm821xx)$(CONFIG_TARGET_gemini) += genext2fs +tools-$(CONFIG_TARGET_tegra) += cbootimage cbootimage-configs # builddir dependencies $(curdir)/bison/compile := $(curdir)/flex/compile @@ -67,8 +69,10 @@ $(curdir)/mkimage/compile += $(curdir)/libressl/compile $(curdir)/firmware-utils/compile += $(curdir)/libressl/compile $(curdir)/zlib/compile $(curdir)/cmake/compile += $(curdir)/libressl/compile $(curdir)/zlib/compile := $(curdir)/cmake/compile +$(curdir)/wrt350nv2-builder/compile := $(curdir)/zlib/compile $(curdir)/lzma-old/compile := $(curdir)/zlib/compile $(curdir)/make-ext4fs/compile := $(curdir)/zlib/compile +$(curdir)/cbootimage/compile += $(curdir)/automake/compile ifneq ($(HOST_OS),Linux) $(curdir)/squashfskit4/compile += $(curdir)/coreutils/compile diff --git a/tools/cbootimage-configs/Makefile b/tools/cbootimage-configs/Makefile new file mode 100644 index 0000000000..5a1fc568cb --- /dev/null +++ b/tools/cbootimage-configs/Makefile @@ -0,0 +1,32 @@ +# +# Copyright (c) 2017-2019 Tomasz Maciej Nowak +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# +include $(TOPDIR)/rules.mk + +PKG_NAME := cbootimage-configs + +PKG_SOURCE_DATE := 2017-04-13 +PKG_SOURCE_PROTO := git +PKG_SOURCE_URL := https://github.com/NVIDIA/cbootimage-configs.git +PKG_SOURCE_VERSION := 7c3b458b93ed6947cd083623f543e93f9103cc0f +PKG_MIRROR_HASH := 1d24421af8cf74ec2d625e237aa8121b1273774c4380ad333e2954e052a5a4fe + +include $(INCLUDE_DIR)/host-build.mk + +define Host/Compile +endef + +define Host/Install + $(INSTALL_DIR) $(STAGING_DIR_HOST)/share/$(PKG_NAME) + $(CP) $(HOST_BUILD_DIR)/* \ + $(STAGING_DIR_HOST)/share/$(PKG_NAME) +endef + +define Host/Clean + rm -fR $(STAGING_DIR_HOST)/share/$(PKG_NAME) +endef + +$(eval $(call HostBuild)) diff --git a/tools/cbootimage/Makefile b/tools/cbootimage/Makefile new file mode 100644 index 0000000000..42640eab36 --- /dev/null +++ b/tools/cbootimage/Makefile @@ -0,0 +1,31 @@ +# +# Copyright (c) 2017-2019 Tomasz Maciej Nowak +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# +include $(TOPDIR)/rules.mk + +PKG_NAME := cbootimage +PKG_VERSION := 1.8 + +PKG_SOURCE_PROTO := git +PKG_SOURCE_URL := https://github.com/NVIDIA/cbootimage.git +PKG_SOURCE_VERSION := 7c9db585d06cce9efffa2a82245f233233680060 +PKG_MIRROR_HASH := 84d9abaaa3eddde05f506dc16effe1c9e18eb94727ed59c5e0a879baeb04e0b2 + +HOST_BUILD_PARALLEL := 1 + +include $(INCLUDE_DIR)/host-build.mk + +define Host/Configure + (cd $(HOST_BUILD_DIR); autoreconf --install --symlink) + $(call Host/Configure/Default) +endef + +define Host/Clean + rm -f $(STAGING_DIR_HOST)/bin/$(PKG_NAME) \ + $(STAGING_DIR_HOST)/share/man/man1/$(PKG_NAME).1 +endef + +$(eval $(call HostBuild)) diff --git a/tools/ccache/Makefile b/tools/ccache/Makefile index 175cb11bdf..2612c5100f 100644 --- a/tools/ccache/Makefile +++ b/tools/ccache/Makefile @@ -8,12 +8,11 @@ include $(TOPDIR)/rules.mk include $(INCLUDE_DIR)/target.mk PKG_NAME:=ccache -PKG_VERSION:=3.5 +PKG_VERSION:=3.7.1 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz -PKG_SOURCE_URL:=https://download.samba.org/pub/ccache/ \ - https://samba.org/ftp/ccache/ -PKG_HASH:=bdd44b72ae4506a2e2deef9fefb15c606a474bbca7658cd2be26105155eec012 +PKG_SOURCE_URL:=https://github.com/ccache/ccache/releases/download/v$(PKG_VERSION) +PKG_HASH:=66fc121a2a33968f9ec428e02f48ff4b8896fbabb759e9c09352267014dcbe65 include $(INCLUDE_DIR)/host-build.mk diff --git a/tools/ccache/patches/100-honour-copts.patch b/tools/ccache/patches/100-honour-copts.patch index 60bb5e0c12..785a4b0e8c 100644 --- a/tools/ccache/patches/100-honour-copts.patch +++ b/tools/ccache/patches/100-honour-copts.patch @@ -1,6 +1,6 @@ --- a/src/ccache.c +++ b/src/ccache.c -@@ -1940,6 +1940,7 @@ calculate_object_hash(struct args *args, +@@ -2169,6 +2169,7 @@ calculate_object_hash(struct args *args, "CPLUS_INCLUDE_PATH", "OBJC_INCLUDE_PATH", "OBJCPLUS_INCLUDE_PATH", // clang diff --git a/tools/cmake/patches/150-C-feature-checks-Match-warnings-more-strictly.patch b/tools/cmake/patches/150-C-feature-checks-Match-warnings-more-strictly.patch new file mode 100644 index 0000000000..674ff0d392 --- /dev/null +++ b/tools/cmake/patches/150-C-feature-checks-Match-warnings-more-strictly.patch @@ -0,0 +1,25 @@ +From 4ca5a815f2dfe9e1116cc2ccd5ddb56d0d00d12e Mon Sep 17 00:00:00 2001 +From: Brad King +Date: Thu, 7 Mar 2019 14:55:54 -0500 +Subject: [PATCH] C++ feature checks: Match warnings more strictly + +Require the word "warning" to appear at the start of a line, after +whitespace, or after a `:`. This is the same that CTest launchers use +to match warnings. It avoids matching "warning" inside file paths. + +Fixes: #19019 +--- + Source/Checks/cm_cxx_features.cmake | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/Source/Checks/cm_cxx_features.cmake ++++ b/Source/Checks/cm_cxx_features.cmake +@@ -25,7 +25,7 @@ function(cm_check_cxx_feature name) + # Filter out xcodebuild warnings. + string(REGEX REPLACE "[^\n]* xcodebuild\\[[0-9]*:[0-9]*\\] warning: [^\n]*" "" check_output "${check_output}") + # If using the feature causes warnings, treat it as broken/unavailable. +- if(check_output MATCHES "[Ww]arning") ++ if(check_output MATCHES "(^|[ :])[Ww][Aa][Rr][Nn][Ii][Nn][Gg]") + set(CMake_HAVE_CXX_${FEATURE} OFF CACHE INTERNAL "TRY_COMPILE" FORCE) + endif() + if(CMake_HAVE_CXX_${FEATURE}) diff --git a/tools/firmware-utils/Makefile b/tools/firmware-utils/Makefile index 864a3df15d..bde90f0ecd 100644 --- a/tools/firmware-utils/Makefile +++ b/tools/firmware-utils/Makefile @@ -23,7 +23,7 @@ define Host/Compile $(call cc,otrx) $(call cc,motorola-bin) $(call cc,dgfirmware) - $(call cc,mksenaofw md5) + $(call cc,mksenaofw md5, -Wall --std=gnu99) $(call cc,trx2usr) $(call cc,ptgen) $(call cc,srec2bin) @@ -85,6 +85,7 @@ define Host/Compile $(call cc,mkdlinkfw mkdlinkfw-lib, -lz -Wall --std=c99) $(call cc,dns313-header, -Wall) $(call cc,mksercommfw, -Wall) + $(call cc,nec-enc, -Wall --std=gnu99) endef define Host/Install diff --git a/tools/firmware-utils/src/jcgimage.c b/tools/firmware-utils/src/jcgimage.c index 5bf7178602..b762d85df4 100644 --- a/tools/firmware-utils/src/jcgimage.c +++ b/tools/firmware-utils/src/jcgimage.c @@ -2,6 +2,7 @@ * jcgimage - Create a JCG firmware image * * Copyright (C) 2015 Reinhard Max + * Copyright (C) 2019 Davide Fioravanti * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -45,6 +46,11 @@ * requiring JTAG to revive the board. To prevent such bricking from * happening, this tool refuses to build such overlong images. * + * Using -m is possible to set the maximum size of the payload. + * Otherwise the default MAXSIZE will be used. + * For an 8Mb flash, the corresponding maxsize is: + * 8 * 1024 * 1024 - 5 * 64 * 1024 = 8388608 - 327680 = 8060928 + * * Two more conditions have to be met for a JCG image to be accepted * as a valid update by the web interface of the stock firware: * @@ -92,6 +98,7 @@ #include #include #include +#include /* * JCG Firmware image header @@ -148,12 +155,12 @@ opensize(char *name, size_t *size) { struct stat s; int fd = open(name, O_RDONLY); - if (fd < 0) { + if (fd < 0) err(1, "cannot open \"%s\"", name); - } - if (fstat(fd, &s) == -1) { + + if (fstat(fd, &s) == -1) err(1, "cannot stat \"%s\"", name); - } + *size = s.st_size; return fd; } @@ -183,17 +190,15 @@ mkjcgheader(struct jcg_header *h, size_t psize, char *version) void *payload = (void *)h + sizeof(*h); time_t t; - if (source_date_epoch != -1) { + if (source_date_epoch != -1) t = source_date_epoch; - } else if ((time(&t) == (time_t)(-1))) { + else if ((time(&t) == (time_t)(-1))) err(1, "time call failed"); - } - if (version != NULL) { - if (sscanf(version, "%hu.%hu", &major, &minor) != 2) { + + if (version != NULL) + if (sscanf(version, "%hu.%hu", &major, &minor) != 2) err(1, "cannot parse version \"%s\"", version); - } - } memset(h, 0, sizeof(*h)); h->jh_magic = htonl(JH_MAGIC); @@ -267,14 +272,14 @@ craftcrc(uint32_t dcrc, uint8_t *buf, size_t len) a = ~dcrc; for (i = 0; i < 32; i++) { - if (patch & 1) { + if (patch & 1) patch = (patch >> 1) ^ 0xedb88320L; - } else { + else patch >>= 1; - } - if (a & 1) { + + if (a & 1) patch ^= 0x5b358fd3L; - } + a >>= 1; } patch ^= ~crc32(crc, buf, len - 4); @@ -285,17 +290,17 @@ craftcrc(uint32_t dcrc, uint8_t *buf, size_t len) /* Verify that we actually get the desired result */ crc = crc32(0L, Z_NULL, 0); crc = crc32(crc, buf, len); - if (crc != dcrc) { + if (crc != dcrc) errx(1, "CRC patching is broken: wanted %08x, but got %08x.", dcrc, crc); - } + } void usage() { fprintf(stderr, "Usage:\n" - "jcgimage -o outfile -u uImage [-v version]\n" - "jcgimage -o outfile -k kernel -f rootfs [-v version]\n"); + "jcgimage -o outfile -u uImage [-m maxsize] [-v version]\n" + "jcgimage -o outfile -k kernel -f rootfs [-m maxsize] [-v version]\n"); exit(1); } @@ -316,6 +321,8 @@ main(int argc, char **argv) char *file1 = NULL; char *file2 = NULL; char *version = NULL; + size_t maxsize = MAXSIZE; + char *endptr; int mode = MODE_UNKNOWN; int fdo, fd1, fd2; size_t size1, size2, sizeu, sizeo, off1, off2; @@ -326,31 +333,36 @@ main(int argc, char **argv) assert(sizeof(struct uimage_header) == 64); set_source_date_epoch(); - while ((c = getopt(argc, argv, "o:k:f:u:v:h")) != -1) { + while ((c = getopt(argc, argv, "o:k:f:u:v:m:h")) != -1) { switch (c) { case 'o': imagefile = optarg; break; case 'k': - if (mode == MODE_UIMAGE) { + if (mode == MODE_UIMAGE) errx(1,"-k cannot be combined with -u"); - } + mode = MODE_KR; file1 = optarg; break; case 'f': - if (mode == MODE_UIMAGE) { + if (mode == MODE_UIMAGE) errx(1,"-f cannot be combined with -u"); - } + mode = MODE_KR; file2 = optarg; break; case 'u': - if (mode == MODE_KR) { + if (mode == MODE_KR) errx(1,"-u cannot be combined with -k and -r"); - } + mode = MODE_UIMAGE; file1 = optarg; + break; + case 'm': + if (optarg != NULL) + maxsize = strtoimax(optarg, &endptr, 10); + break; case 'v': version = optarg; @@ -360,19 +372,19 @@ main(int argc, char **argv) usage(); } } - if (optind != argc) { + if (optind != argc) errx(1, "illegal arg \"%s\"", argv[optind]); - } - if (imagefile == NULL) { + + if (imagefile == NULL) errx(1, "no output file specified"); - } - if (mode == MODE_UNKNOWN) { + + if (mode == MODE_UNKNOWN) errx(1, "specify either -u or -k and -r"); - } + if (mode == MODE_KR) { - if (file1 == NULL || file2 == NULL) { - errx(1,"need -k and -r"); - } + if (file1 == NULL || file2 == NULL) + errx(1, "need -k and -r"); + fd2 = opensize(file2, &size2); } fd1 = opensize(file1, &size1); @@ -387,37 +399,37 @@ main(int argc, char **argv) sizeo = sizeof(*jh) + sizeu; } - if (sizeo > MAXSIZE) { - errx(1,"payload too large: %zd > %zd\n", sizeo, MAXSIZE); - } + if (sizeo > maxsize) + errx(1, "payload too large: %zd > %zd\n", sizeo, maxsize); + fdo = open(imagefile, O_RDWR | O_CREAT | O_TRUNC, 00644); - if (fdo < 0) { + if (fdo < 0) err(1, "cannot open \"%s\"", imagefile); - } - if (ftruncate(fdo, sizeo) == -1) { + + if (ftruncate(fdo, sizeo) == -1) err(1, "cannot grow \"%s\" to %zd bytes", imagefile, sizeo); - } + map = mmap(NULL, sizeo, PROT_READ|PROT_WRITE, MAP_SHARED, fdo, 0); uh = map + sizeof(*jh); - if (map == MAP_FAILED) { + if (map == MAP_FAILED) err(1, "cannot mmap \"%s\"", imagefile); - } - if (read(fd1, map + off1, size1) != size1) { + + if (read(fd1, map + off1, size1) != size1) err(1, "cannot copy %s", file1); - } + if (mode == MODE_KR) { - if (read(fd2, map+off2, size2) != size2) { + if (read(fd2, map+off2, size2) != size2) err(1, "cannot copy %s", file2); - } + mkuheader(uh, size1, size2); - } else if (mode == MODE_UIMAGE) { + } else if (mode == MODE_UIMAGE) craftcrc(ntohl(uh->ih_dcrc), (void*)uh + sizeof(*uh), sizeu - sizeof(*uh)); - } + mkjcgheader(map, sizeu, version); munmap(map, sizeo); close(fdo); diff --git a/tools/firmware-utils/src/mkdlinkfw.c b/tools/firmware-utils/src/mkdlinkfw.c index 71828bd91a..3b59a5d2df 100644 --- a/tools/firmware-utils/src/mkdlinkfw.c +++ b/tools/firmware-utils/src/mkdlinkfw.c @@ -99,6 +99,7 @@ struct file_info image_info; char *ofname; char *progname; uint32_t firmware_size; +uint32_t image_offset; uint16_t family_member; char *rom_id[12] = { 0 }; char image_type; @@ -403,7 +404,7 @@ int fill_sch2(struct sch2_header *header, char *kernel_ptr, char *rootfs_ptr) header->image_crc32 = crc32(0, (uint8_t *) kernel_ptr, kernel_info.file_size); header->start_addr = RAM_ENTRY_ADDR; header->rootfs_addr = - JBOOT_SIZE + STAG_SIZE + SCH2_SIZE + kernel_info.file_size; + image_offset + STAG_SIZE + SCH2_SIZE + kernel_info.file_size; header->rootfs_len = rootfs_info.file_size; header->rootfs_crc32 = crc32(0, (uint8_t *) rootfs_ptr, rootfs_info.file_size); header->header_crc32 = 0; @@ -446,9 +447,9 @@ int fill_auh(struct auh_header *header, uint32_t length) header->lpvs = AUH_LVPS; header->mbz = 0; header->time_stamp = jboot_timestamp(); - header->erase_start = JBOOT_SIZE; + header->erase_start = image_offset; header->erase_length = firmware_size; - header->data_offset = JBOOT_SIZE; + header->data_offset = image_offset; header->data_length = length; header->space4 = 0; header->space5 = 0; @@ -603,11 +604,12 @@ int main(int argc, char *argv[]) image_type = SYSUPGRADE; family_member = 0; firmware_size = 0; + image_offset = JBOOT_SIZE; while (1) { int c; - c = getopt(argc, argv, "f:F:i:hk:m:o:r:s:"); + c = getopt(argc, argv, "f:F:i:hk:m:o:O:r:s:"); if (c == -1) break; @@ -632,6 +634,9 @@ int main(int argc, char *argv[]) case 'r': rootfs_info.file_name = optarg; break; + case 'O': + sscanf(optarg, "0x%x", &image_offset); + break; case 'o': ofname = optarg; break; diff --git a/tools/firmware-utils/src/mksenaofw.c b/tools/firmware-utils/src/mksenaofw.c index 0f10ebdfbe..b0fb7203c3 100644 --- a/tools/firmware-utils/src/mksenaofw.c +++ b/tools/firmware-utils/src/mksenaofw.c @@ -55,6 +55,7 @@ typedef enum { } op_mode; static firmware_type FIRMWARE_TYPES[] = { + { 0x00, "combo" }, /* Used for new capwap-included style header */ { 0x01, "bootloader" }, { 0x02, "kernel" }, { 0x03, "kernelapp" }, @@ -70,6 +71,21 @@ static firmware_type FIRMWARE_TYPES[] = { { 0x0c, "langpack (D-Link)" } }; +#define MOD_DEFAULT 0x616C6C00 +#define SKU_DEFAULT 0x0 +#define DATECODE_NONE 0xFFFFFFFF +#define FIRMWARE_TYPE_NONE 0xFF + +struct capwap_header { + uint32_t mod; + uint32_t sku; + uint32_t firmware_ver[3]; + uint32_t datecode; + uint32_t capwap_ver[3]; + uint32_t model_size; + uint8_t model[]; +}; + static long get_file_size(const char *filename) { FILE *fp_file; @@ -84,15 +100,14 @@ static long get_file_size(const char *filename) return result; } -static int header_checksum(void *data, int len) +static int header_checksum(void *data, size_t len) { - int i; - int sum; + int sum = 0; /* shouldn't this be unsigned ? */ + size_t i; - sum = 0; - if (data != NULL && len >= 0) { + if (data != NULL && len > 0) { for (i = 0; i < len; ++i) - sum += *(unsigned char *) (data + i); + sum += ((unsigned char *)data)[i]; return sum; } @@ -124,18 +139,20 @@ static int md5_file(const char *filename, uint8_t *dst) } static int encode_image(const char *input_file_name, - const char *output_file_name, img_header *header, int block_size) + const char *output_file_name, img_header *header, + struct capwap_header *cw_header, int block_size) { char buf[BUF_SIZE]; - size_t bytes_read; size_t pad_len = 0; size_t bytes_avail; + size_t bytes_read; - FILE *fp_input; FILE *fp_output; + FILE *fp_input; - int i; + int model_size; long magic; + size_t i; fp_input = fopen(input_file_name, "r+b"); if (!fp_input) { @@ -172,6 +189,11 @@ static int encode_image(const char *input_file_name, } header->zero = 0; header->chksum = header_checksum(header, HDR_LEN); + if (cw_header) { + header->chksum += header_checksum(cw_header, + sizeof(struct capwap_header) + cw_header->model_size); + } + header->head = htonl(header->head); header->vendor_id = htonl(header->vendor_id); header->product_id = htonl(header->product_id); @@ -183,6 +205,22 @@ static int encode_image(const char *input_file_name, fwrite(header, HDR_LEN, 1, fp_output); + if (cw_header) { + model_size = cw_header->model_size; + cw_header->mod = htonl(cw_header->mod); + cw_header->sku = htonl(cw_header->sku); + cw_header->firmware_ver[0] = htonl(cw_header->firmware_ver[0]); + cw_header->firmware_ver[1] = htonl(cw_header->firmware_ver[1]); + cw_header->firmware_ver[2] = htonl(cw_header->firmware_ver[2]); + cw_header->datecode = htonl(cw_header->datecode); + cw_header->capwap_ver[0] = htonl(cw_header->capwap_ver[0]); + cw_header->capwap_ver[1] = htonl(cw_header->capwap_ver[1]); + cw_header->capwap_ver[2] = htonl(cw_header->capwap_ver[2]); + cw_header->model_size = htonl(cw_header->model_size); + fwrite(cw_header, sizeof(struct capwap_header) + model_size, 1, + fp_output); + } + while (!feof(fp_input) || pad_len > 0) { if (!feof(fp_input)) @@ -212,32 +250,33 @@ static int encode_image(const char *input_file_name, int decode_image(const char *input_file_name, const char *output_file_name) { - img_header header; + struct capwap_header cw_header; char buf[BUF_SIZE]; + img_header header; + char *pmodel = NULL; FILE *fp_input; FILE *fp_output; - unsigned int i; size_t bytes_read; size_t bytes_written; + unsigned int i; fp_input = fopen(input_file_name, "r+b"); if (!fp_input) { fprintf(stderr, "Cannot open %s !!\n", input_file_name); - fclose(fp_input); return -1; } fp_output = fopen(output_file_name, "w+b"); if (!fp_output) { fprintf(stderr, "Cannot open %s !!\n", output_file_name); - fclose(fp_output); + fclose(fp_input); return -1; } if (fread(&header, 1, HDR_LEN, fp_input) != HDR_LEN) { - fprintf(stderr, "Incorrect header size!!"); + fprintf(stderr, "Incorrect header size reading base header!!"); fclose(fp_input); fclose(fp_output); return -1; @@ -251,6 +290,44 @@ int decode_image(const char *input_file_name, const char *output_file_name) header.chksum = ntohl(header.chksum); header.magic = ntohl(header.magic); + /* read capwap header if firmware_type is zero */ + if (header.firmware_type == 0) { + if (fread(&cw_header, 1, sizeof(struct capwap_header), + fp_input) != sizeof(struct capwap_header)) { + fprintf(stderr, "Incorrect header size reading capwap_header!!"); + fclose(fp_input); + fclose(fp_output); + return -1; + } + cw_header.mod = ntohl(cw_header.mod); + cw_header.sku = ntohl(cw_header.sku); + cw_header.firmware_ver[0] = ntohl(cw_header.firmware_ver[0]); + cw_header.firmware_ver[1] = ntohl(cw_header.firmware_ver[1]); + cw_header.firmware_ver[2] = ntohl(cw_header.firmware_ver[2]); + cw_header.datecode = ntohl(cw_header.datecode); + cw_header.capwap_ver[0] = ntohl(cw_header.capwap_ver[0]); + cw_header.capwap_ver[1] = ntohl(cw_header.capwap_ver[1]); + cw_header.capwap_ver[2] = ntohl(cw_header.capwap_ver[2]); + cw_header.model_size = ntohl(cw_header.model_size); + + pmodel = malloc(cw_header.model_size + 1); + if (pmodel) { + pmodel[cw_header.model_size] = '\0'; + if (fread(pmodel, 1, cw_header.model_size, fp_input) != + cw_header.model_size) { + fprintf(stderr, "Incorrect header size reading model name!!"); + fclose(fp_input); + fclose(fp_output); + return -1; + } + } else { + fprintf(stderr, "Incorrect header size reading model name!!"); + fclose(fp_input); + fclose(fp_output); + return -1; + } + } + bytes_written = 0; while (!feof(fp_input)) { @@ -281,7 +358,7 @@ int decode_image(const char *input_file_name, const char *output_file_name) static void usage(const char *progname, int status) { FILE *stream = (status != EXIT_SUCCESS) ? stderr : stdout; - int i; + size_t i; fprintf(stream, "Usage: %s [OPTIONS...]\n", progname); fprintf(stream, "\n" @@ -301,28 +378,47 @@ static void usage(const char *progname, int status) " -m set encoding magic \n" " -z enable image padding to \n" " -b set image , defaults to %u\n" + " -c add capwap header with (e.g. 171101)\n" + " -w firmware version for capwap header (e.g. 3.0.1)\n" + " -x capwap firmware version for capwap header (e.g. 1.8.53)\n" + " -n model name for capwap header (e.g. ENS620EXT)\n" " -h show this screen\n", DEFAULT_BLOCK_SIZE); exit(status); } int main(int argc, char *argv[]) { - int opt; - char *input_file, *output_file, *progname = NULL; + static const char period[2] = "."; + struct capwap_header cw_header; + img_header header; + + struct capwap_header *pcw_header = NULL; + char *output_file = NULL; + char *input_file = NULL; + char *progname = NULL; + char *mod_name = NULL; + char *token; + op_mode mode = NONE; - int tmp, i, pad = 0; + int tmp, pad = 0; int block_size; - img_header header; + size_t i; + int opt; block_size = DEFAULT_BLOCK_SIZE; progname = basename(argv[0]); - memset(&header, 0, sizeof( img_header )); + memset(&header, 0, sizeof(img_header)); header.magic = DEFAULT_MAGIC; header.head = DEFAULT_HEAD_VALUE; + header.firmware_type = FIRMWARE_TYPE_NONE; + memset(&cw_header, 0, sizeof(struct capwap_header)); + cw_header.mod = MOD_DEFAULT; + cw_header.sku = SKU_DEFAULT; + cw_header.datecode = DATECODE_NONE; strncpy( (char*)&header.version, DEFAULT_VERSION, VERSION_SIZE - 1); - while ((opt = getopt(argc, argv, ":o:e:d:t:v:r:p:m:b:h?z")) != -1) { + while ((opt = getopt(argc, argv, ":o:e:d:t:v:r:p:m:b:c:w:x:n:h?z")) != -1) { switch (opt) { case 'e': input_file = optarg; @@ -344,7 +440,7 @@ int main(int argc, char *argv[]) break; } } - if (header.firmware_type == 0) { + if (header.firmware_type == FIRMWARE_TYPE_NONE) { fprintf(stderr, "Invalid firmware type \"0\"!\n"); usage(progname, EXIT_FAILURE); } @@ -368,6 +464,31 @@ int main(int argc, char *argv[]) case 'b': block_size = strtol(optarg, 0, 10); break; + case 'c': + cw_header.datecode = strtoul(optarg, 0, 10); + break; + case 'w': + token = strtok(optarg, period); + i = 0; + while (token && (i < 3)) { + cw_header.firmware_ver[i++] = + strtoul(token, 0, 10); + token = strtok(NULL, period); + } + break; + case 'x': + token = strtok(optarg, period); + i = 0; + while (token && (i < 3)) { + cw_header.capwap_ver[i++] = + strtoul(token, 0, 10); + token = strtok(NULL, period); + } + break; + case 'n': + mod_name = optarg; + cw_header.model_size = strlen(mod_name); + break; case 'h': usage(progname, EXIT_SUCCESS); break; @@ -403,17 +524,46 @@ int main(int argc, char *argv[]) return EXIT_SUCCESS; } - if (header.firmware_type == 0) { - fprintf(stderr, "Firmware type must be defined\n"); + if ((header.firmware_type == 0) && + (cw_header.datecode == DATECODE_NONE)) { + fprintf(stderr, "Firmware type must be non-zero for non-capwap images\n"); usage(progname, EXIT_FAILURE); } if (header.vendor_id == 0 || header.product_id == 0) { - fprintf(stderr, "Vendor ID and Product ID must be defined and non-zero\n"); + fprintf(stderr, "Vendor ID and Product ID must be defined and non-zero\n"); usage(progname, EXIT_FAILURE); } - if (encode_image(input_file, output_file, &header, pad ? block_size : 0) < 0) + /* Check capwap header specific arguments */ + if (cw_header.datecode != DATECODE_NONE) { + if (!mod_name) { + fprintf(stderr, "Capwap header specified: model name must be specified\n"); + usage(progname, EXIT_FAILURE); + } + if (!cw_header.firmware_ver[0] && !cw_header.firmware_ver[1] && + !cw_header.firmware_ver[2]) { + fprintf(stderr, "Capwap header specified, fw_ver must be non-zero\n"); + } + if (!cw_header.capwap_ver[0] && !cw_header.capwap_ver[1] && + !cw_header.capwap_ver[2]) { + fprintf(stderr, "Capwap header specified, cw_ver must be non-zero\n"); + } + pcw_header = malloc(sizeof(struct capwap_header) + + cw_header.model_size); + if (pcw_header) { + memcpy(pcw_header, &cw_header, + sizeof(struct capwap_header)); + memcpy(&(pcw_header->model), mod_name, + cw_header.model_size); + } else { + fprintf(stderr, "Failed to allocate memory\n"); + return EXIT_FAILURE; + } + } + + if (encode_image(input_file, output_file, &header, pcw_header, + pad ? block_size : 0) < 0) return EXIT_FAILURE; return EXIT_SUCCESS; diff --git a/tools/firmware-utils/src/mktplinkfw2.c b/tools/firmware-utils/src/mktplinkfw2.c index 35db848bba..102d72b1cc 100644 --- a/tools/firmware-utils/src/mktplinkfw2.c +++ b/tools/firmware-utils/src/mktplinkfw2.c @@ -158,6 +158,18 @@ static struct flash_layout layouts[] = { .kernel_la = 0x80000000, .kernel_ep = 0x80000000, .rootfs_ofs = 0x140000, + }, { + .id = "8Mqca", + .fw_max_len = 0x7a0000, + .kernel_la = 0x80060000, + .kernel_ep = 0x80060000, + .rootfs_ofs = 0x140000, + }, { + .id = "16Mqca", + .fw_max_len = 0xf90000, + .kernel_la = 0x80060000, + .kernel_ep = 0x80060000, + .rootfs_ofs = 0x140000, }, { /* terminating entry */ } diff --git a/tools/firmware-utils/src/nec-enc.c b/tools/firmware-utils/src/nec-enc.c new file mode 100644 index 0000000000..771b29297e --- /dev/null +++ b/tools/firmware-utils/src/nec-enc.c @@ -0,0 +1,129 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* + * nec-enc.c - encode/decode nec firmware with key + * + * based on xorimage.c in libreCMC + * + */ + +#include +#include +#include +#include +#include + +#define KEY_LEN 16 +#define PATTERN_LEN 251 + +static int +xor_pattern(uint8_t *data, size_t len, const char *key, int k_len, int k_off) +{ + int offset = k_off; + + while (len--) { + *data ^= key[offset]; + data++; + offset = (offset + 1) % k_len; + } + + return offset; +} + +static void xor_data(uint8_t *data, size_t len, const uint8_t *pattern) +{ + for (int i = 0; i < len; i++) { + *data ^= pattern[i]; + data++; + } +} + +static void __attribute__((noreturn)) usage(void) +{ + fprintf(stderr, "Usage: nec-enc -i infile -o outfile -k \n"); + exit(EXIT_FAILURE); +} + +static unsigned char buf_pattern[4096], buf[4096]; + +int main(int argc, char **argv) +{ + int k_off = 0, ptn = 0, c, ret = EXIT_SUCCESS; + char *ifn = NULL, *ofn = NULL, *key = NULL; + size_t n, k_len; + FILE *out, *in; + + while ((c = getopt(argc, argv, "i:o:k:h")) != -1) { + switch (c) { + case 'i': + ifn = optarg; + break; + case 'o': + ofn = optarg; + break; + case 'k': + key = optarg; + break; + case 'h': + default: + usage(); + } + } + + if (optind != argc || optind == 1) { + fprintf(stderr, "illegal arg \"%s\"\n", argv[optind]); + usage(); + } + + in = fopen(ifn, "r"); + if (!in) { + perror("can not open input file"); + usage(); + } + + out = fopen(ofn, "w"); + if (!out) { + perror("can not open output file"); + usage(); + } + + if (!key) { + fprintf(stderr, "key is not specified\n"); + usage(); + } + + k_len = strnlen(key, KEY_LEN + 1); + if (k_len == 0 || k_len > KEY_LEN) { + fprintf(stderr, "key length is not in range (0,%d)\n", KEY_LEN); + usage(); + } + + while ((n = fread(buf, 1, sizeof(buf), in)) > 0) { + for (int i = 0; i < n; i++) { + buf_pattern[i] = ptn + 1; + ptn++; + + if (ptn > 250) + ptn = 0; + } + + k_off = xor_pattern(buf_pattern, n, key, k_len, k_off); + xor_data(buf, n, buf_pattern); + + if (fwrite(buf, 1, n, out) != n) { + perror("failed to write"); + ret = EXIT_FAILURE; + goto out; + } + } + + if (ferror(in)) { + perror("failed to read"); + ret = EXIT_FAILURE; + goto out; + } + +out: + fclose(in); + fclose(out); + return ret; +} diff --git a/tools/firmware-utils/src/tplink-safeloader.c b/tools/firmware-utils/src/tplink-safeloader.c index 075cd8a7ed..b38e37510c 100644 --- a/tools/firmware-utils/src/tplink-safeloader.c +++ b/tools/firmware-utils/src/tplink-safeloader.c @@ -182,8 +182,42 @@ static struct device_info boards[] = { {"device-info", 0x31400, 0x00400}, {"signature", 0x32000, 0x00400}, {"device-id", 0x33000, 0x00100}, - {"os-image", 0x40000, 0x1c0000}, - {"file-system", 0x200000, 0x5b0000}, + {"firmware", 0x40000, 0x770000}, + {"soft-version", 0x7b0000, 0x00100}, + {"support-list", 0x7b1000, 0x01000}, + {"user-config", 0x7c0000, 0x10000}, + {"default-config", 0x7d0000, 0x10000}, + {"log", 0x7e0000, 0x10000}, + {"radio", 0x7f0000, 0x10000}, + {NULL, 0, 0} + }, + + .first_sysupgrade_partition = "os-image", + .last_sysupgrade_partition = "support-list", + }, + + /** Firmware layout for the CPE210 V3 */ + { + .id = "CPE210V3", + .vendor = "CPE210(TP-LINK|UN|N300-2|00000000):3.0\r\n", + .support_list = + "SupportList:\r\n" + "CPE210(TP-LINK|EU|N300-2|45550000):3.0\r\n" + "CPE210(TP-LINK|UN|N300-2|00000000):3.0\r\n" + "CPE210(TP-LINK|UN|N300-2):3.0\r\n" + "CPE210(TP-LINK|EU|N300-2):3.0\r\n", + .support_trail = '\xff', + .soft_ver = NULL, + + .partitions = { + {"fs-uboot", 0x00000, 0x20000}, + {"partition-table", 0x20000, 0x01000}, + {"default-mac", 0x30000, 0x00020}, + {"product-info", 0x31100, 0x00100}, + {"device-info", 0x31400, 0x00400}, + {"signature", 0x32000, 0x00400}, + {"device-id", 0x33000, 0x00100}, + {"firmware", 0x40000, 0x770000}, {"soft-version", 0x7b0000, 0x00100}, {"support-list", 0x7b1000, 0x01000}, {"user-config", 0x7c0000, 0x10000}, @@ -784,7 +818,8 @@ static struct device_info boards[] = { "{product_name:Archer C7,product_ver:5.0.0,special_id:43410000}\n" "{product_name:Archer C7,product_ver:5.0.0,special_id:4A500000}\n" "{product_name:Archer C7,product_ver:5.0.0,special_id:54570000}\n" - "{product_name:Archer C7,product_ver:5.0.0,special_id:52550000}\n", + "{product_name:Archer C7,product_ver:5.0.0,special_id:52550000}\n" + "{product_name:Archer C7,product_ver:5.0.0,special_id:4B520000}\n", .support_trail = '\x00', .soft_ver = "soft_ver:1.0.0\n", @@ -1144,6 +1179,38 @@ static struct device_info boards[] = { .last_sysupgrade_partition = "file-system" }, + /** Firmware layout for the RE350K v1 */ + { + .id = "RE350K-V1", + .vendor = "", + .support_list = + "SupportList:\n" + "{product_name:RE350K,product_ver:1.0.0,special_id:00000000,product_region:US}\n", + .support_trail = '\x00', + .soft_ver = NULL, + + /** We're using a dynamic kernel/rootfs split here */ + .partitions = { + {"fs-uboot", 0x00000, 0x20000}, + {"firmware", 0x20000, 0xd70000}, + {"partition-table", 0xd90000, 0x02000}, + {"default-mac", 0xda0000, 0x00020}, + {"pin", 0xda0100, 0x00020}, + {"product-info", 0xda1100, 0x01000}, + {"soft-version", 0xdb0000, 0x01000}, + {"support-list", 0xdb1000, 0x01000}, + {"profile", 0xdb2000, 0x08000}, + {"user-config", 0xdc0000, 0x10000}, + {"default-config", 0xdd0000, 0x10000}, + {"device-id", 0xde0000, 0x00108}, + {"radio", 0xff0000, 0x10000}, + {NULL, 0, 0} + }, + + .first_sysupgrade_partition = "os-image", + .last_sysupgrade_partition = "file-system" + }, + /** Firmware layout for the RE355 */ { .id = "RE355", diff --git a/tools/libelf/Makefile b/tools/libelf/Makefile index ab7360ffee..31e2eaf0a8 100644 --- a/tools/libelf/Makefile +++ b/tools/libelf/Makefile @@ -13,8 +13,9 @@ PKG_HASH:=591a9b4ec81c1f2042a97aa60564e0cb79d041c52faa7416acb38bc95bd2c76d PKG_RELEASE:=1 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz -PKG_SOURCE_URL:=http://www.mr511.de/software/ - +PKG_SOURCE_URL:= \ + http://distfiles.gentoo.org/distfiles/ \ + http://distcache.freebsd.org/ports-distfiles/ HOST_BUILD_PARALLEL:=1 include $(INCLUDE_DIR)/host-build.mk diff --git a/tools/make-ext4fs/Makefile b/tools/make-ext4fs/Makefile index f67ab6e5b5..e8d409a281 100644 --- a/tools/make-ext4fs/Makefile +++ b/tools/make-ext4fs/Makefile @@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=make-ext4fs -PKG_SOURCE_URL=$(PROJECT_GIT)/project/make_ext4fs.git +PKG_SOURCE_URL=$(PROJECT_GIT)/make_ext4fs.git PKG_SOURCE_PROTO:=git PKG_SOURCE_DATE:=2016-08-14 PKG_SOURCE_VERSION:=484903e4332be6c317f531b008cb2a841a18c506 diff --git a/tools/mkimage/Makefile b/tools/mkimage/Makefile index d0ff5f7e37..fbcf87cfc6 100644 --- a/tools/mkimage/Makefile +++ b/tools/mkimage/Makefile @@ -10,9 +10,7 @@ PKG_NAME:=mkimage PKG_VERSION:=2018.03 PKG_SOURCE:=u-boot-$(PKG_VERSION).tar.bz2 -PKG_SOURCE_URL:=\ - http://mirror2.openwrt.org/sources \ - ftp://ftp.denx.de/pub/u-boot +PKG_SOURCE_URL:=http://ftp.denx.de/pub/u-boot PKG_HASH:=7e7477534409d5368eb1371ffde6820f0f79780a1a1f676161c48442cb303dfd HOST_BUILD_DIR:=$(BUILD_DIR_HOST)/u-boot-$(PKG_VERSION) diff --git a/tools/mtd-utils/Makefile b/tools/mtd-utils/Makefile index ff000b99e3..e0e083d2b6 100644 --- a/tools/mtd-utils/Makefile +++ b/tools/mtd-utils/Makefile @@ -7,11 +7,11 @@ include $(TOPDIR)/rules.mk PKG_NAME:=mtd-utils -PKG_VERSION:=2.0.2 +PKG_VERSION:=2.1.1 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2 PKG_SOURCE_URL:=ftp://ftp.infradead.org/pub/mtd-utils/ -PKG_HASH:=fb3de61be8e932abb424e8ea3c30298f553d5f970ad158a737bb303bbf9660b8 +PKG_HASH:=8d15e8b70f036d6af1a66011f8ca0e048e9675fa7983d33bea92c24313a232d2 PKG_FIXUP:=autoreconf @@ -32,7 +32,9 @@ HOST_CONFIGURE_VARS+= \ HOST_CONFIGURE_ARGS+= \ --disable-tests \ + --without-crypto \ --without-xattr \ + --without-zstd \ --without-lzo HOST_MAKE_FLAGS += \ diff --git a/tools/mtd-utils/patches/110-portability.patch b/tools/mtd-utils/patches/110-portability.patch index a2942270d7..067526171a 100644 --- a/tools/mtd-utils/patches/110-portability.patch +++ b/tools/mtd-utils/patches/110-portability.patch @@ -70,7 +70,7 @@ #include --- a/ubifs-utils/mkfs.ubifs/mkfs.ubifs.c +++ b/ubifs-utils/mkfs.ubifs/mkfs.ubifs.c -@@ -1219,6 +1219,7 @@ static int add_inode(struct stat *st, in +@@ -1503,6 +1503,7 @@ static int add_inode(struct stat *st, in if (c->default_compr != UBIFS_COMPR_NONE) use_flags |= UBIFS_COMPR_FL; @@ -78,15 +78,15 @@ if (flags & FS_COMPR_FL) use_flags |= UBIFS_COMPR_FL; if (flags & FS_SYNC_FL) -@@ -1229,6 +1230,7 @@ static int add_inode(struct stat *st, in - use_flags |= UBIFS_APPEND_FL; - if (flags & FS_DIRSYNC_FL && S_ISDIR(st->st_mode)) +@@ -1515,6 +1516,7 @@ static int add_inode(struct stat *st, in use_flags |= UBIFS_DIRSYNC_FL; + if (fctx) + use_flags |= UBIFS_CRYPT_FL; +#endif - memset(ino, 0, UBIFS_INO_NODE_SZ); -@@ -1293,7 +1295,9 @@ static int add_dir_inode(const char *pat + ino_key_init(&key, inum); +@@ -1600,7 +1602,9 @@ static int add_dir_inode(const char *pat fd = dirfd(dir); if (fd == -1) return sys_err_msg("dirfd failed"); @@ -96,15 +96,15 @@ flags = 0; } -@@ -1476,6 +1480,7 @@ static int add_file(const char *path_nam +@@ -1811,6 +1815,7 @@ static int add_file(const char *path_nam + dn->ch.node_type = UBIFS_DATA_NODE; key_write(&key, &dn->key); - dn->size = cpu_to_le32(bytes_read); out_len = NODE_BUFFER_SIZE - UBIFS_DATA_NODE_SZ; +#ifndef NO_NATIVE_SUPPORT if (c->default_compr == UBIFS_COMPR_NONE && - (flags & FS_COMPR_FL)) + !c->encrypted && (flags & FS_COMPR_FL)) #ifdef WITHOUT_LZO -@@ -1484,6 +1489,7 @@ static int add_file(const char *path_nam +@@ -1819,6 +1824,7 @@ static int add_file(const char *path_nam use_compr = UBIFS_COMPR_LZO; #endif else @@ -112,7 +112,7 @@ use_compr = c->default_compr; compr_type = compress_data(buf, bytes_read, &dn->data, &out_len, use_compr); -@@ -1527,7 +1533,9 @@ static int add_non_dir(const char *path_ +@@ -1876,7 +1882,9 @@ static int add_non_dir(const char *path_ if (fd == -1) return sys_err_msg("failed to open file '%s'", path_name); diff --git a/tools/mtd-utils/patches/201-ubinize-add-terminator-support.patch b/tools/mtd-utils/patches/201-ubinize-add-terminator-support.patch index 0da28b71f2..d765cdc6cc 100644 --- a/tools/mtd-utils/patches/201-ubinize-add-terminator-support.patch +++ b/tools/mtd-utils/patches/201-ubinize-add-terminator-support.patch @@ -47,7 +47,7 @@ case 'v': args.verbose = 1; break; -@@ -559,6 +569,18 @@ int main(int argc, char * const argv[]) +@@ -582,6 +592,18 @@ int main(int argc, char * const argv[]) printf("\n"); } diff --git a/tools/patch/Makefile b/tools/patch/Makefile index cab9fee9f6..e0481204f7 100644 --- a/tools/patch/Makefile +++ b/tools/patch/Makefile @@ -8,7 +8,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=patch PKG_VERSION:=2.7.6 -PKG_RELEASE:=4 +PKG_RELEASE:=6 PKG_CPE_ID:=cpe:/a:gnu:patch PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz diff --git a/tools/patch/patches/050-CVE-2019-13636.patch b/tools/patch/patches/050-CVE-2019-13636.patch new file mode 100644 index 0000000000..e62c3d4175 --- /dev/null +++ b/tools/patch/patches/050-CVE-2019-13636.patch @@ -0,0 +1,108 @@ +From dce4683cbbe107a95f1f0d45fabc304acfb5d71a Mon Sep 17 00:00:00 2001 +From: Andreas Gruenbacher +Date: Mon, 15 Jul 2019 16:21:48 +0200 +Subject: Don't follow symlinks unless --follow-symlinks is given + +* src/inp.c (plan_a, plan_b), src/util.c (copy_to_fd, copy_file, +append_to_file): Unless the --follow-symlinks option is given, open files with +the O_NOFOLLOW flag to avoid following symlinks. So far, we were only doing +that consistently for input files. +* src/util.c (create_backup): When creating empty backup files, (re)create them +with O_CREAT | O_EXCL to avoid following symlinks in that case as well. +--- + src/inp.c | 12 ++++++++++-- + src/util.c | 14 +++++++++++--- + 2 files changed, 21 insertions(+), 5 deletions(-) + +diff --git a/src/inp.c b/src/inp.c +index 32d0919..22d7473 100644 +--- a/src/inp.c ++++ b/src/inp.c +@@ -238,8 +238,13 @@ plan_a (char const *filename) + { + if (S_ISREG (instat.st_mode)) + { +- int ifd = safe_open (filename, O_RDONLY|binary_transput, 0); ++ int flags = O_RDONLY | binary_transput; + size_t buffered = 0, n; ++ int ifd; ++ ++ if (! follow_symlinks) ++ flags |= O_NOFOLLOW; ++ ifd = safe_open (filename, flags, 0); + if (ifd < 0) + pfatal ("can't open file %s", quotearg (filename)); + +@@ -340,6 +345,7 @@ plan_a (char const *filename) + static void + plan_b (char const *filename) + { ++ int flags = O_RDONLY | binary_transput; + int ifd; + FILE *ifp; + int c; +@@ -353,7 +359,9 @@ plan_b (char const *filename) + + if (instat.st_size == 0) + filename = NULL_DEVICE; +- if ((ifd = safe_open (filename, O_RDONLY | binary_transput, 0)) < 0 ++ if (! follow_symlinks) ++ flags |= O_NOFOLLOW; ++ if ((ifd = safe_open (filename, flags, 0)) < 0 + || ! (ifp = fdopen (ifd, binary_transput ? "rb" : "r"))) + pfatal ("Can't open file %s", quotearg (filename)); + if (TMPINNAME_needs_removal) +diff --git a/src/util.c b/src/util.c +index 1cc08ba..fb38307 100644 +--- a/src/util.c ++++ b/src/util.c +@@ -388,7 +388,7 @@ create_backup (char const *to, const struct stat *to_st, bool leave_original) + + try_makedirs_errno = ENOENT; + safe_unlink (bakname); +- while ((fd = safe_open (bakname, O_CREAT | O_WRONLY | O_TRUNC, 0666)) < 0) ++ while ((fd = safe_open (bakname, O_CREAT | O_EXCL | O_WRONLY | O_TRUNC, 0666)) < 0) + { + if (errno != try_makedirs_errno) + pfatal ("Can't create file %s", quotearg (bakname)); +@@ -579,10 +579,13 @@ create_file (char const *file, int open_flags, mode_t mode, + static void + copy_to_fd (const char *from, int tofd) + { ++ int from_flags = O_RDONLY | O_BINARY; + int fromfd; + ssize_t i; + +- if ((fromfd = safe_open (from, O_RDONLY | O_BINARY, 0)) < 0) ++ if (! follow_symlinks) ++ from_flags |= O_NOFOLLOW; ++ if ((fromfd = safe_open (from, from_flags, 0)) < 0) + pfatal ("Can't reopen file %s", quotearg (from)); + while ((i = read (fromfd, buf, bufsize)) != 0) + { +@@ -625,6 +628,8 @@ copy_file (char const *from, char const *to, struct stat *tost, + else + { + assert (S_ISREG (mode)); ++ if (! follow_symlinks) ++ to_flags |= O_NOFOLLOW; + tofd = create_file (to, O_WRONLY | O_BINARY | to_flags, mode, + to_dir_known_to_exist); + copy_to_fd (from, tofd); +@@ -640,9 +645,12 @@ copy_file (char const *from, char const *to, struct stat *tost, + void + append_to_file (char const *from, char const *to) + { ++ int to_flags = O_WRONLY | O_APPEND | O_BINARY; + int tofd; + +- if ((tofd = safe_open (to, O_WRONLY | O_BINARY | O_APPEND, 0)) < 0) ++ if (! follow_symlinks) ++ to_flags |= O_NOFOLLOW; ++ if ((tofd = safe_open (to, to_flags, 0)) < 0) + pfatal ("Can't reopen file %s", quotearg (to)); + copy_to_fd (from, tofd); + if (close (tofd) != 0) +-- +cgit v1.0-41-gc330 + diff --git a/tools/patch/patches/060-CVE-2019-13638.patch b/tools/patch/patches/060-CVE-2019-13638.patch new file mode 100644 index 0000000000..38caff628a --- /dev/null +++ b/tools/patch/patches/060-CVE-2019-13638.patch @@ -0,0 +1,38 @@ +From 3fcd042d26d70856e826a42b5f93dc4854d80bf0 Mon Sep 17 00:00:00 2001 +From: Andreas Gruenbacher +Date: Fri, 6 Apr 2018 19:36:15 +0200 +Subject: Invoke ed directly instead of using the shell + +* src/pch.c (do_ed_script): Invoke ed directly instead of using a shell +command to avoid quoting vulnerabilities. +--- + src/pch.c | 6 ++---- + 1 file changed, 2 insertions(+), 4 deletions(-) + +diff --git a/src/pch.c b/src/pch.c +index 4fd5a05..16e001a 100644 +--- a/src/pch.c ++++ b/src/pch.c +@@ -2459,9 +2459,6 @@ do_ed_script (char const *inname, char const *outname, + *outname_needs_removal = true; + copy_file (inname, outname, 0, exclusive, instat.st_mode, true); + } +- sprintf (buf, "%s %s%s", editor_program, +- verbosity == VERBOSE ? "" : "- ", +- outname); + fflush (stdout); + + pid = fork(); +@@ -2470,7 +2467,8 @@ do_ed_script (char const *inname, char const *outname, + else if (pid == 0) + { + dup2 (tmpfd, 0); +- execl ("/bin/sh", "sh", "-c", buf, (char *) 0); ++ assert (outname[0] != '!' && outname[0] != '-'); ++ execlp (editor_program, editor_program, "-", outname, (char *) NULL); + _exit (2); + } + else +-- +cgit v1.0-41-gc330 + diff --git a/tools/scons/Makefile b/tools/scons/Makefile index fc325bff02..5ec6554165 100644 --- a/tools/scons/Makefile +++ b/tools/scons/Makefile @@ -8,12 +8,12 @@ include $(TOPDIR)/rules.mk PKG_NAME:=scons -PKG_VERSION:=3.0.1 +PKG_VERSION:=3.0.5 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz PKG_SOURCE_URL:=@SF/scons \ http://fossies.org/linux/misc/ -PKG_HASH:=24475e38d39c19683bc88054524df018fe6949d70fbd4c69e298d39a0269f173 +PKG_HASH:=df676f23dc6d4bfa384fc389d95dcd21ab907e6349d4c848958ba4befb73c73e include $(INCLUDE_DIR)/host-build.mk diff --git a/tools/tar/Makefile b/tools/tar/Makefile index 2565262d4d..d69ee40f01 100644 --- a/tools/tar/Makefile +++ b/tools/tar/Makefile @@ -8,11 +8,11 @@ include $(TOPDIR)/rules.mk PKG_NAME:=tar PKG_CPE_ID:=cpe:/a:gnu:tar -PKG_VERSION:=1.31 +PKG_VERSION:=1.32 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz PKG_SOURCE_URL:=@GNU/tar -PKG_HASH:=37f3ef1ceebd8b7e1ebf5b8cc6c65bb8ebf002c7d049032bf456860f25ec2dc1 +PKG_HASH:=d0d3ae07f103323be809bc3eac0dcc386d52c5262499fe05511ac4788af1fdd8 HOST_BUILD_PARALLEL:=1 diff --git a/tools/wrt350nv2-builder/Makefile b/tools/wrt350nv2-builder/Makefile new file mode 100644 index 0000000000..375044a66c --- /dev/null +++ b/tools/wrt350nv2-builder/Makefile @@ -0,0 +1,41 @@ +# +# Copyright (C) 2006-2012 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +include $(TOPDIR)/rules.mk + +PKG_NAME:=wrt350nv2-builder +PKG_VERSION:=2.4 +PKG_REVISION:=2 + +HOST_BUILD_DIR:=$(BUILD_DIR_HOST)/${PKG_NAME}-$(PKG_VERSION) + +include $(INCLUDE_DIR)/host-build.mk + +define Host/Compile + $(HOSTCC) $(HOST_CFLAGS) -c src/md5.c -o $(HOST_BUILD_DIR)/md5.o + $(HOSTCC) $(HOST_CFLAGS) -c src/ioapi.c -o $(HOST_BUILD_DIR)/ioapi.o + $(HOSTCC) $(HOST_CFLAGS) -c src/wrt350nv2-builder.c -o $(HOST_BUILD_DIR)/wrt350nv2-builder.o + $(HOSTCC) $(HOST_CFLAGS) $(HOST_LDFLAGS) -o $(HOST_BUILD_DIR)/wrt350nv2-builder \ + $(HOST_BUILD_DIR)/wrt350nv2-builder.o $(HOST_BUILD_DIR)/md5.o $(HOST_BUILD_DIR)/ioapi.o +endef + +define Host/Install + $(INSTALL_DIR) $(STAGING_DIR_HOST)/bin + $(INSTALL_BIN) $(HOST_BUILD_DIR)/wrt350nv2-builder $(STAGING_DIR_HOST)/bin/ +# optionally the builder can add a u-boot binary to create a complete webupgrade image, but this is not mandatory +# u-boot images from stock firmware are available at ftp://ftp.maddes.net/librecmc/trunk/orion/stock/binaries/ + [ ! -f "files/u-boot.bin" ] || ( \ + $(INSTALL_DIR) $(STAGING_DIR_HOST)/share/wrt350nv2-builder; \ + $(CP) files/u-boot.bin $(STAGING_DIR_HOST)/share/wrt350nv2-builder/; ) +endef + +define Host/Clean + rm -f $(STAGING_DIR_HOST)/bin/wrt350nv2-builder + rm -f $(STAGING_DIR_HOST)/share/wrt350nv2-builder +endef + +$(eval $(call HostBuild)) diff --git a/tools/wrt350nv2-builder/src/crypt.h b/tools/wrt350nv2-builder/src/crypt.h new file mode 100644 index 0000000000..622f4bc2ec --- /dev/null +++ b/tools/wrt350nv2-builder/src/crypt.h @@ -0,0 +1,132 @@ +/* crypt.h -- base code for crypt/uncrypt ZIPfile + + + Version 1.01e, February 12th, 2005 + + Copyright (C) 1998-2005 Gilles Vollant + + This code is a modified version of crypting code in Infozip distribution + + The encryption/decryption parts of this source code (as opposed to the + non-echoing password parts) were originally written in Europe. The + whole source package can be freely distributed, including from the USA. + (Prior to January 2000, re-export from the US was a violation of US law.) + + This encryption code is a direct transcription of the algorithm from + Roger Schlafly, described by Phil Katz in the file appnote.txt. This + file (appnote.txt) is distributed with the PKZIP program (even in the + version without encryption capabilities). + + If you don't need crypting in your application, just define symbols + NOCRYPT and NOUNCRYPT. + + This code support the "Traditional PKWARE Encryption". + + The new AES encryption added on Zip format by Winzip (see the page + http://www.winzip.com/aes_info.htm ) and PKWare PKZip 5.x Strong + Encryption is not supported. +*/ + +#define CRC32(c, b) ((*(pcrc_32_tab+(((int)(c) ^ (b)) & 0xff))) ^ ((c) >> 8)) + +/*********************************************************************** + * Return the next byte in the pseudo-random sequence + */ +static int decrypt_byte(unsigned long* pkeys, const unsigned long* pcrc_32_tab) +{ + unsigned temp; /* POTENTIAL BUG: temp*(temp^1) may overflow in an + * unpredictable manner on 16-bit systems; not a problem + * with any known compiler so far, though */ + + temp = ((unsigned)(*(pkeys+2)) & 0xffff) | 2; + return (int)(((temp * (temp ^ 1)) >> 8) & 0xff); +} + +/*********************************************************************** + * Update the encryption keys with the next byte of plain text + */ +static int update_keys(unsigned long* pkeys,const unsigned long* pcrc_32_tab,int c) +{ + (*(pkeys+0)) = CRC32((*(pkeys+0)), c); + (*(pkeys+1)) += (*(pkeys+0)) & 0xff; + (*(pkeys+1)) = (*(pkeys+1)) * 134775813L + 1; + { + register int keyshift = (int)((*(pkeys+1)) >> 24); + (*(pkeys+2)) = CRC32((*(pkeys+2)), keyshift); + } + return c; +} + + +/*********************************************************************** + * Initialize the encryption keys and the random header according to + * the given password. + */ +static void init_keys(const char* passwd,unsigned long* pkeys,const unsigned long* pcrc_32_tab) +{ + *(pkeys+0) = 305419896L; + *(pkeys+1) = 591751049L; + *(pkeys+2) = 878082192L; + while (*passwd != '\0') { + update_keys(pkeys,pcrc_32_tab,(int)*passwd); + passwd++; + } +} + +#define zdecode(pkeys,pcrc_32_tab,c) \ + (update_keys(pkeys,pcrc_32_tab,c ^= decrypt_byte(pkeys,pcrc_32_tab))) + +#define zencode(pkeys,pcrc_32_tab,c,t) \ + (t=decrypt_byte(pkeys,pcrc_32_tab), update_keys(pkeys,pcrc_32_tab,c), t^(c)) + +#ifdef INCLUDECRYPTINGCODE_IFCRYPTALLOWED + +#define RAND_HEAD_LEN 12 + /* "last resort" source for second part of crypt seed pattern */ +# ifndef ZCR_SEED2 +# define ZCR_SEED2 3141592654UL /* use PI as default pattern */ +# endif + +static int crypthead(passwd, buf, bufSize, pkeys, pcrc_32_tab, crcForCrypting) + const char *passwd; /* password string */ + unsigned char *buf; /* where to write header */ + int bufSize; + unsigned long* pkeys; + const unsigned long* pcrc_32_tab; + unsigned long crcForCrypting; +{ + int n; /* index in random header */ + int t; /* temporary */ + int c; /* random byte */ + unsigned char header[RAND_HEAD_LEN-2]; /* random header */ + static unsigned calls = 0; /* ensure different random header each time */ + + if (bufSize> 7) & 0xff; + header[n] = (unsigned char)zencode(pkeys, pcrc_32_tab, c, t); + } + /* Encrypt random header (last two bytes is high word of crc) */ + init_keys(passwd, pkeys, pcrc_32_tab); + for (n = 0; n < RAND_HEAD_LEN-2; n++) + { + buf[n] = (unsigned char)zencode(pkeys, pcrc_32_tab, header[n], t); + } + buf[n++] = zencode(pkeys, pcrc_32_tab, (int)(crcForCrypting >> 16) & 0xff, t); + buf[n++] = zencode(pkeys, pcrc_32_tab, (int)(crcForCrypting >> 24) & 0xff, t); + return n; +} + +#endif diff --git a/tools/wrt350nv2-builder/src/ioapi.c b/tools/wrt350nv2-builder/src/ioapi.c new file mode 100644 index 0000000000..f1bee23e64 --- /dev/null +++ b/tools/wrt350nv2-builder/src/ioapi.c @@ -0,0 +1,177 @@ +/* ioapi.c -- IO base function header for compress/uncompress .zip + files using zlib + zip or unzip API + + Version 1.01e, February 12th, 2005 + + Copyright (C) 1998-2005 Gilles Vollant +*/ + +#include +#include +#include + +#include "zlib.h" +#include "ioapi.h" + + + +/* I've found an old Unix (a SunOS 4.1.3_U1) without all SEEK_* defined.... */ + +#ifndef SEEK_CUR +#define SEEK_CUR 1 +#endif + +#ifndef SEEK_END +#define SEEK_END 2 +#endif + +#ifndef SEEK_SET +#define SEEK_SET 0 +#endif + +voidpf ZCALLBACK fopen_file_func OF(( + voidpf opaque, + const char* filename, + int mode)); + +uLong ZCALLBACK fread_file_func OF(( + voidpf opaque, + voidpf stream, + void* buf, + uLong size)); + +uLong ZCALLBACK fwrite_file_func OF(( + voidpf opaque, + voidpf stream, + const void* buf, + uLong size)); + +long ZCALLBACK ftell_file_func OF(( + voidpf opaque, + voidpf stream)); + +long ZCALLBACK fseek_file_func OF(( + voidpf opaque, + voidpf stream, + uLong offset, + int origin)); + +int ZCALLBACK fclose_file_func OF(( + voidpf opaque, + voidpf stream)); + +int ZCALLBACK ferror_file_func OF(( + voidpf opaque, + voidpf stream)); + + +voidpf ZCALLBACK fopen_file_func (opaque, filename, mode) + voidpf opaque; + const char* filename; + int mode; +{ + FILE* file = NULL; + const char* mode_fopen = NULL; + if ((mode & ZLIB_FILEFUNC_MODE_READWRITEFILTER)==ZLIB_FILEFUNC_MODE_READ) + mode_fopen = "rb"; + else + if (mode & ZLIB_FILEFUNC_MODE_EXISTING) + mode_fopen = "r+b"; + else + if (mode & ZLIB_FILEFUNC_MODE_CREATE) + mode_fopen = "wb"; + + if ((filename!=NULL) && (mode_fopen != NULL)) + file = fopen(filename, mode_fopen); + return file; +} + + +uLong ZCALLBACK fread_file_func (opaque, stream, buf, size) + voidpf opaque; + voidpf stream; + void* buf; + uLong size; +{ + uLong ret; + ret = (uLong)fread(buf, 1, (size_t)size, (FILE *)stream); + return ret; +} + + +uLong ZCALLBACK fwrite_file_func (opaque, stream, buf, size) + voidpf opaque; + voidpf stream; + const void* buf; + uLong size; +{ + uLong ret; + ret = (uLong)fwrite(buf, 1, (size_t)size, (FILE *)stream); + return ret; +} + +long ZCALLBACK ftell_file_func (opaque, stream) + voidpf opaque; + voidpf stream; +{ + long ret; + ret = ftell((FILE *)stream); + return ret; +} + +long ZCALLBACK fseek_file_func (opaque, stream, offset, origin) + voidpf opaque; + voidpf stream; + uLong offset; + int origin; +{ + int fseek_origin=0; + long ret; + switch (origin) + { + case ZLIB_FILEFUNC_SEEK_CUR : + fseek_origin = SEEK_CUR; + break; + case ZLIB_FILEFUNC_SEEK_END : + fseek_origin = SEEK_END; + break; + case ZLIB_FILEFUNC_SEEK_SET : + fseek_origin = SEEK_SET; + break; + default: return -1; + } + ret = 0; + fseek((FILE *)stream, offset, fseek_origin); + return ret; +} + +int ZCALLBACK fclose_file_func (opaque, stream) + voidpf opaque; + voidpf stream; +{ + int ret; + ret = fclose((FILE *)stream); + return ret; +} + +int ZCALLBACK ferror_file_func (opaque, stream) + voidpf opaque; + voidpf stream; +{ + int ret; + ret = ferror((FILE *)stream); + return ret; +} + +void fill_fopen_filefunc (pzlib_filefunc_def) + zlib_filefunc_def* pzlib_filefunc_def; +{ + pzlib_filefunc_def->zopen_file = fopen_file_func; + pzlib_filefunc_def->zread_file = fread_file_func; + pzlib_filefunc_def->zwrite_file = fwrite_file_func; + pzlib_filefunc_def->ztell_file = ftell_file_func; + pzlib_filefunc_def->zseek_file = fseek_file_func; + pzlib_filefunc_def->zclose_file = fclose_file_func; + pzlib_filefunc_def->zerror_file = ferror_file_func; + pzlib_filefunc_def->opaque = NULL; +} diff --git a/tools/wrt350nv2-builder/src/ioapi.h b/tools/wrt350nv2-builder/src/ioapi.h new file mode 100644 index 0000000000..5fa9786148 --- /dev/null +++ b/tools/wrt350nv2-builder/src/ioapi.h @@ -0,0 +1,75 @@ +/* ioapi.h -- IO base function header for compress/uncompress .zip + files using zlib + zip or unzip API + + Version 1.01e, February 12th, 2005 + + Copyright (C) 1998-2005 Gilles Vollant +*/ + +#ifndef _ZLIBIOAPI_H +#define _ZLIBIOAPI_H + + +#define ZLIB_FILEFUNC_SEEK_CUR (1) +#define ZLIB_FILEFUNC_SEEK_END (2) +#define ZLIB_FILEFUNC_SEEK_SET (0) + +#define ZLIB_FILEFUNC_MODE_READ (1) +#define ZLIB_FILEFUNC_MODE_WRITE (2) +#define ZLIB_FILEFUNC_MODE_READWRITEFILTER (3) + +#define ZLIB_FILEFUNC_MODE_EXISTING (4) +#define ZLIB_FILEFUNC_MODE_CREATE (8) + + +#ifndef ZCALLBACK + +#if (defined(WIN32) || defined (WINDOWS) || defined (_WINDOWS)) && defined(CALLBACK) && defined (USEWINDOWS_CALLBACK) +#define ZCALLBACK CALLBACK +#else +#define ZCALLBACK +#endif +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +typedef voidpf (ZCALLBACK *open_file_func) (voidpf opaque, const char* filename, int mode); +typedef uLong (ZCALLBACK *read_file_func) (voidpf opaque, voidpf stream, void* buf, uLong size); +typedef uLong (ZCALLBACK *write_file_func) (voidpf opaque, voidpf stream, const void* buf, uLong size); +typedef long (ZCALLBACK *tell_file_func) (voidpf opaque, voidpf stream); +typedef long (ZCALLBACK *seek_file_func) (voidpf opaque, voidpf stream, uLong offset, int origin); +typedef int (ZCALLBACK *close_file_func) (voidpf opaque, voidpf stream); +typedef int (ZCALLBACK *testerror_file_func) (voidpf opaque, voidpf stream); + +typedef struct zlib_filefunc_def_s +{ + open_file_func zopen_file; + read_file_func zread_file; + write_file_func zwrite_file; + tell_file_func ztell_file; + seek_file_func zseek_file; + close_file_func zclose_file; + testerror_file_func zerror_file; + voidpf opaque; +} zlib_filefunc_def; + + + +void fill_fopen_filefunc (zlib_filefunc_def* pzlib_filefunc_def); + +#define ZREAD(filefunc,filestream,buf,size) ((*((filefunc).zread_file))((filefunc).opaque,filestream,buf,size)) +#define ZWRITE(filefunc,filestream,buf,size) ((*((filefunc).zwrite_file))((filefunc).opaque,filestream,buf,size)) +#define ZTELL(filefunc,filestream) ((*((filefunc).ztell_file))((filefunc).opaque,filestream)) +#define ZSEEK(filefunc,filestream,pos,mode) ((*((filefunc).zseek_file))((filefunc).opaque,filestream,pos,mode)) +#define ZCLOSE(filefunc,filestream) ((*((filefunc).zclose_file))((filefunc).opaque,filestream)) +#define ZERROR(filefunc,filestream) ((*((filefunc).zerror_file))((filefunc).opaque,filestream)) + + +#ifdef __cplusplus +} +#endif + +#endif + diff --git a/tools/wrt350nv2-builder/src/md5.c b/tools/wrt350nv2-builder/src/md5.c new file mode 100644 index 0000000000..c35d96c5ef --- /dev/null +++ b/tools/wrt350nv2-builder/src/md5.c @@ -0,0 +1,381 @@ +/* + Copyright (C) 1999, 2000, 2002 Aladdin Enterprises. All rights reserved. + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising 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. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. + + L. Peter Deutsch + ghost@aladdin.com + + */ +/* $Id: md5.c,v 1.6 2002/04/13 19:20:28 lpd Exp $ */ +/* + Independent implementation of MD5 (RFC 1321). + + This code implements the MD5 Algorithm defined in RFC 1321, whose + text is available at + http://www.ietf.org/rfc/rfc1321.txt + The code is derived from the text of the RFC, including the test suite + (section A.5) but excluding the rest of Appendix A. It does not include + any code or documentation that is identified in the RFC as being + copyrighted. + + The original and principal author of md5.c is L. Peter Deutsch + . Other authors are noted in the change history + that follows (in reverse chronological order): + + 2002-04-13 lpd Clarified derivation from RFC 1321; now handles byte order + either statically or dynamically; added missing #include + in library. + 2002-03-11 lpd Corrected argument list for main(), and added int return + type, in test program and T value program. + 2002-02-21 lpd Added missing #include in test program. + 2000-07-03 lpd Patched to eliminate warnings about "constant is + unsigned in ANSI C, signed in traditional"; made test program + self-checking. + 1999-11-04 lpd Edited comments slightly for automatic TOC extraction. + 1999-10-18 lpd Fixed typo in header comment (ansi2knr rather than md5). + 1999-05-03 lpd Original version. + */ + +#include "md5.h" +#include + +#undef BYTE_ORDER /* 1 = big-endian, -1 = little-endian, 0 = unknown */ +#ifdef ARCH_IS_BIG_ENDIAN +# define BYTE_ORDER (ARCH_IS_BIG_ENDIAN ? 1 : -1) +#else +# define BYTE_ORDER 0 +#endif + +#define T_MASK ((md5_word_t)~0) +#define T1 /* 0xd76aa478 */ (T_MASK ^ 0x28955b87) +#define T2 /* 0xe8c7b756 */ (T_MASK ^ 0x173848a9) +#define T3 0x242070db +#define T4 /* 0xc1bdceee */ (T_MASK ^ 0x3e423111) +#define T5 /* 0xf57c0faf */ (T_MASK ^ 0x0a83f050) +#define T6 0x4787c62a +#define T7 /* 0xa8304613 */ (T_MASK ^ 0x57cfb9ec) +#define T8 /* 0xfd469501 */ (T_MASK ^ 0x02b96afe) +#define T9 0x698098d8 +#define T10 /* 0x8b44f7af */ (T_MASK ^ 0x74bb0850) +#define T11 /* 0xffff5bb1 */ (T_MASK ^ 0x0000a44e) +#define T12 /* 0x895cd7be */ (T_MASK ^ 0x76a32841) +#define T13 0x6b901122 +#define T14 /* 0xfd987193 */ (T_MASK ^ 0x02678e6c) +#define T15 /* 0xa679438e */ (T_MASK ^ 0x5986bc71) +#define T16 0x49b40821 +#define T17 /* 0xf61e2562 */ (T_MASK ^ 0x09e1da9d) +#define T18 /* 0xc040b340 */ (T_MASK ^ 0x3fbf4cbf) +#define T19 0x265e5a51 +#define T20 /* 0xe9b6c7aa */ (T_MASK ^ 0x16493855) +#define T21 /* 0xd62f105d */ (T_MASK ^ 0x29d0efa2) +#define T22 0x02441453 +#define T23 /* 0xd8a1e681 */ (T_MASK ^ 0x275e197e) +#define T24 /* 0xe7d3fbc8 */ (T_MASK ^ 0x182c0437) +#define T25 0x21e1cde6 +#define T26 /* 0xc33707d6 */ (T_MASK ^ 0x3cc8f829) +#define T27 /* 0xf4d50d87 */ (T_MASK ^ 0x0b2af278) +#define T28 0x455a14ed +#define T29 /* 0xa9e3e905 */ (T_MASK ^ 0x561c16fa) +#define T30 /* 0xfcefa3f8 */ (T_MASK ^ 0x03105c07) +#define T31 0x676f02d9 +#define T32 /* 0x8d2a4c8a */ (T_MASK ^ 0x72d5b375) +#define T33 /* 0xfffa3942 */ (T_MASK ^ 0x0005c6bd) +#define T34 /* 0x8771f681 */ (T_MASK ^ 0x788e097e) +#define T35 0x6d9d6122 +#define T36 /* 0xfde5380c */ (T_MASK ^ 0x021ac7f3) +#define T37 /* 0xa4beea44 */ (T_MASK ^ 0x5b4115bb) +#define T38 0x4bdecfa9 +#define T39 /* 0xf6bb4b60 */ (T_MASK ^ 0x0944b49f) +#define T40 /* 0xbebfbc70 */ (T_MASK ^ 0x4140438f) +#define T41 0x289b7ec6 +#define T42 /* 0xeaa127fa */ (T_MASK ^ 0x155ed805) +#define T43 /* 0xd4ef3085 */ (T_MASK ^ 0x2b10cf7a) +#define T44 0x04881d05 +#define T45 /* 0xd9d4d039 */ (T_MASK ^ 0x262b2fc6) +#define T46 /* 0xe6db99e5 */ (T_MASK ^ 0x1924661a) +#define T47 0x1fa27cf8 +#define T48 /* 0xc4ac5665 */ (T_MASK ^ 0x3b53a99a) +#define T49 /* 0xf4292244 */ (T_MASK ^ 0x0bd6ddbb) +#define T50 0x432aff97 +#define T51 /* 0xab9423a7 */ (T_MASK ^ 0x546bdc58) +#define T52 /* 0xfc93a039 */ (T_MASK ^ 0x036c5fc6) +#define T53 0x655b59c3 +#define T54 /* 0x8f0ccc92 */ (T_MASK ^ 0x70f3336d) +#define T55 /* 0xffeff47d */ (T_MASK ^ 0x00100b82) +#define T56 /* 0x85845dd1 */ (T_MASK ^ 0x7a7ba22e) +#define T57 0x6fa87e4f +#define T58 /* 0xfe2ce6e0 */ (T_MASK ^ 0x01d3191f) +#define T59 /* 0xa3014314 */ (T_MASK ^ 0x5cfebceb) +#define T60 0x4e0811a1 +#define T61 /* 0xf7537e82 */ (T_MASK ^ 0x08ac817d) +#define T62 /* 0xbd3af235 */ (T_MASK ^ 0x42c50dca) +#define T63 0x2ad7d2bb +#define T64 /* 0xeb86d391 */ (T_MASK ^ 0x14792c6e) + + +static void +md5_process(md5_state_t *pms, const md5_byte_t *data /*[64]*/) +{ + md5_word_t + a = pms->abcd[0], b = pms->abcd[1], + c = pms->abcd[2], d = pms->abcd[3]; + md5_word_t t; +#if BYTE_ORDER > 0 + /* Define storage only for big-endian CPUs. */ + md5_word_t X[16]; +#else + /* Define storage for little-endian or both types of CPUs. */ + md5_word_t xbuf[16]; + const md5_word_t *X; +#endif + + { +#if BYTE_ORDER == 0 + /* + * Determine dynamically whether this is a big-endian or + * little-endian machine, since we can use a more efficient + * algorithm on the latter. + */ + static const int w = 1; + + if (*((const md5_byte_t *)&w)) /* dynamic little-endian */ +#endif +#if BYTE_ORDER <= 0 /* little-endian */ + { + /* + * On little-endian machines, we can process properly aligned + * data without copying it. + */ + if (!((data - (const md5_byte_t *)0) & 3)) { + /* data are properly aligned */ + X = (const md5_word_t *)data; + } else { + /* not aligned */ + memcpy(xbuf, data, 64); + X = xbuf; + } + } +#endif +#if BYTE_ORDER == 0 + else /* dynamic big-endian */ +#endif +#if BYTE_ORDER >= 0 /* big-endian */ + { + /* + * On big-endian machines, we must arrange the bytes in the + * right order. + */ + const md5_byte_t *xp = data; + int i; + +# if BYTE_ORDER == 0 + X = xbuf; /* (dynamic only) */ +# else +# define xbuf X /* (static only) */ +# endif + for (i = 0; i < 16; ++i, xp += 4) + xbuf[i] = xp[0] + (xp[1] << 8) + (xp[2] << 16) + (xp[3] << 24); + } +#endif + } + +#define ROTATE_LEFT(x, n) (((x) << (n)) | ((x) >> (32 - (n)))) + + /* Round 1. */ + /* Let [abcd k s i] denote the operation + a = b + ((a + F(b,c,d) + X[k] + T[i]) <<< s). */ +#define F(x, y, z) (((x) & (y)) | (~(x) & (z))) +#define SET(a, b, c, d, k, s, Ti)\ + t = a + F(b,c,d) + X[k] + Ti;\ + a = ROTATE_LEFT(t, s) + b + /* Do the following 16 operations. */ + SET(a, b, c, d, 0, 7, T1); + SET(d, a, b, c, 1, 12, T2); + SET(c, d, a, b, 2, 17, T3); + SET(b, c, d, a, 3, 22, T4); + SET(a, b, c, d, 4, 7, T5); + SET(d, a, b, c, 5, 12, T6); + SET(c, d, a, b, 6, 17, T7); + SET(b, c, d, a, 7, 22, T8); + SET(a, b, c, d, 8, 7, T9); + SET(d, a, b, c, 9, 12, T10); + SET(c, d, a, b, 10, 17, T11); + SET(b, c, d, a, 11, 22, T12); + SET(a, b, c, d, 12, 7, T13); + SET(d, a, b, c, 13, 12, T14); + SET(c, d, a, b, 14, 17, T15); + SET(b, c, d, a, 15, 22, T16); +#undef SET + + /* Round 2. */ + /* Let [abcd k s i] denote the operation + a = b + ((a + G(b,c,d) + X[k] + T[i]) <<< s). */ +#define G(x, y, z) (((x) & (z)) | ((y) & ~(z))) +#define SET(a, b, c, d, k, s, Ti)\ + t = a + G(b,c,d) + X[k] + Ti;\ + a = ROTATE_LEFT(t, s) + b + /* Do the following 16 operations. */ + SET(a, b, c, d, 1, 5, T17); + SET(d, a, b, c, 6, 9, T18); + SET(c, d, a, b, 11, 14, T19); + SET(b, c, d, a, 0, 20, T20); + SET(a, b, c, d, 5, 5, T21); + SET(d, a, b, c, 10, 9, T22); + SET(c, d, a, b, 15, 14, T23); + SET(b, c, d, a, 4, 20, T24); + SET(a, b, c, d, 9, 5, T25); + SET(d, a, b, c, 14, 9, T26); + SET(c, d, a, b, 3, 14, T27); + SET(b, c, d, a, 8, 20, T28); + SET(a, b, c, d, 13, 5, T29); + SET(d, a, b, c, 2, 9, T30); + SET(c, d, a, b, 7, 14, T31); + SET(b, c, d, a, 12, 20, T32); +#undef SET + + /* Round 3. */ + /* Let [abcd k s t] denote the operation + a = b + ((a + H(b,c,d) + X[k] + T[i]) <<< s). */ +#define H(x, y, z) ((x) ^ (y) ^ (z)) +#define SET(a, b, c, d, k, s, Ti)\ + t = a + H(b,c,d) + X[k] + Ti;\ + a = ROTATE_LEFT(t, s) + b + /* Do the following 16 operations. */ + SET(a, b, c, d, 5, 4, T33); + SET(d, a, b, c, 8, 11, T34); + SET(c, d, a, b, 11, 16, T35); + SET(b, c, d, a, 14, 23, T36); + SET(a, b, c, d, 1, 4, T37); + SET(d, a, b, c, 4, 11, T38); + SET(c, d, a, b, 7, 16, T39); + SET(b, c, d, a, 10, 23, T40); + SET(a, b, c, d, 13, 4, T41); + SET(d, a, b, c, 0, 11, T42); + SET(c, d, a, b, 3, 16, T43); + SET(b, c, d, a, 6, 23, T44); + SET(a, b, c, d, 9, 4, T45); + SET(d, a, b, c, 12, 11, T46); + SET(c, d, a, b, 15, 16, T47); + SET(b, c, d, a, 2, 23, T48); +#undef SET + + /* Round 4. */ + /* Let [abcd k s t] denote the operation + a = b + ((a + I(b,c,d) + X[k] + T[i]) <<< s). */ +#define I(x, y, z) ((y) ^ ((x) | ~(z))) +#define SET(a, b, c, d, k, s, Ti)\ + t = a + I(b,c,d) + X[k] + Ti;\ + a = ROTATE_LEFT(t, s) + b + /* Do the following 16 operations. */ + SET(a, b, c, d, 0, 6, T49); + SET(d, a, b, c, 7, 10, T50); + SET(c, d, a, b, 14, 15, T51); + SET(b, c, d, a, 5, 21, T52); + SET(a, b, c, d, 12, 6, T53); + SET(d, a, b, c, 3, 10, T54); + SET(c, d, a, b, 10, 15, T55); + SET(b, c, d, a, 1, 21, T56); + SET(a, b, c, d, 8, 6, T57); + SET(d, a, b, c, 15, 10, T58); + SET(c, d, a, b, 6, 15, T59); + SET(b, c, d, a, 13, 21, T60); + SET(a, b, c, d, 4, 6, T61); + SET(d, a, b, c, 11, 10, T62); + SET(c, d, a, b, 2, 15, T63); + SET(b, c, d, a, 9, 21, T64); +#undef SET + + /* Then perform the following additions. (That is increment each + of the four registers by the value it had before this block + was started.) */ + pms->abcd[0] += a; + pms->abcd[1] += b; + pms->abcd[2] += c; + pms->abcd[3] += d; +} + +void +md5_init(md5_state_t *pms) +{ + pms->count[0] = pms->count[1] = 0; + pms->abcd[0] = 0x67452301; + pms->abcd[1] = /*0xefcdab89*/ T_MASK ^ 0x10325476; + pms->abcd[2] = /*0x98badcfe*/ T_MASK ^ 0x67452301; + pms->abcd[3] = 0x10325476; +} + +void +md5_append(md5_state_t *pms, const md5_byte_t *data, int nbytes) +{ + const md5_byte_t *p = data; + int left = nbytes; + int offset = (pms->count[0] >> 3) & 63; + md5_word_t nbits = (md5_word_t)(nbytes << 3); + + if (nbytes <= 0) + return; + + /* Update the message length. */ + pms->count[1] += nbytes >> 29; + pms->count[0] += nbits; + if (pms->count[0] < nbits) + pms->count[1]++; + + /* Process an initial partial block. */ + if (offset) { + int copy = (offset + nbytes > 64 ? 64 - offset : nbytes); + + memcpy(pms->buf + offset, p, copy); + if (offset + copy < 64) + return; + p += copy; + left -= copy; + md5_process(pms, pms->buf); + } + + /* Process full blocks. */ + for (; left >= 64; p += 64, left -= 64) + md5_process(pms, p); + + /* Process a final partial block. */ + if (left) + memcpy(pms->buf, p, left); +} + +void +md5_finish(md5_state_t *pms, md5_byte_t digest[16]) +{ + static const md5_byte_t pad[64] = { + 0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 + }; + md5_byte_t data[8]; + int i; + + /* Save the length before padding. */ + for (i = 0; i < 8; ++i) + data[i] = (md5_byte_t)(pms->count[i >> 2] >> ((i & 3) << 3)); + /* Pad to 56 bytes mod 64. */ + md5_append(pms, pad, ((55 - (pms->count[0] >> 3)) & 63) + 1); + /* Append the length. */ + md5_append(pms, data, 8); + for (i = 0; i < 16; ++i) + digest[i] = (md5_byte_t)(pms->abcd[i >> 2] >> ((i & 3) << 3)); +} diff --git a/tools/wrt350nv2-builder/src/md5.h b/tools/wrt350nv2-builder/src/md5.h new file mode 100644 index 0000000000..698c995d8f --- /dev/null +++ b/tools/wrt350nv2-builder/src/md5.h @@ -0,0 +1,91 @@ +/* + Copyright (C) 1999, 2002 Aladdin Enterprises. All rights reserved. + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising 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. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. + + L. Peter Deutsch + ghost@aladdin.com + + */ +/* $Id: md5.h,v 1.4 2002/04/13 19:20:28 lpd Exp $ */ +/* + Independent implementation of MD5 (RFC 1321). + + This code implements the MD5 Algorithm defined in RFC 1321, whose + text is available at + http://www.ietf.org/rfc/rfc1321.txt + The code is derived from the text of the RFC, including the test suite + (section A.5) but excluding the rest of Appendix A. It does not include + any code or documentation that is identified in the RFC as being + copyrighted. + + The original and principal author of md5.h is L. Peter Deutsch + . Other authors are noted in the change history + that follows (in reverse chronological order): + + 2002-04-13 lpd Removed support for non-ANSI compilers; removed + references to Ghostscript; clarified derivation from RFC 1321; + now handles byte order either statically or dynamically. + 1999-11-04 lpd Edited comments slightly for automatic TOC extraction. + 1999-10-18 lpd Fixed typo in header comment (ansi2knr rather than md5); + added conditionalization for C++ compilation from Martin + Purschke . + 1999-05-03 lpd Original version. + */ + +#ifndef md5_INCLUDED +# define md5_INCLUDED + +/* + * This package supports both compile-time and run-time determination of CPU + * byte order. If ARCH_IS_BIG_ENDIAN is defined as 0, the code will be + * compiled to run only on little-endian CPUs; if ARCH_IS_BIG_ENDIAN is + * defined as non-zero, the code will be compiled to run only on big-endian + * CPUs; if ARCH_IS_BIG_ENDIAN is not defined, the code will be compiled to + * run on either big- or little-endian CPUs, but will run slightly less + * efficiently on either one than if ARCH_IS_BIG_ENDIAN is defined. + */ + +typedef unsigned char md5_byte_t; /* 8-bit byte */ +typedef unsigned int md5_word_t; /* 32-bit word */ + +/* Define the state of the MD5 Algorithm. */ +typedef struct md5_state_s { + md5_word_t count[2]; /* message length in bits, lsw first */ + md5_word_t abcd[4]; /* digest buffer */ + md5_byte_t buf[64]; /* accumulate block */ +} md5_state_t; + +#ifdef __cplusplus +extern "C" +{ +#endif + +/* Initialize the algorithm. */ +void md5_init(md5_state_t *pms); + +/* Append a string to the message. */ +void md5_append(md5_state_t *pms, const md5_byte_t *data, int nbytes); + +/* Finish the message and return the digest. */ +void md5_finish(md5_state_t *pms, md5_byte_t digest[16]); + +#ifdef __cplusplus +} /* end extern "C" */ +#endif + +#endif /* md5_INCLUDED */ diff --git a/tools/wrt350nv2-builder/src/upgrade.h b/tools/wrt350nv2-builder/src/upgrade.h new file mode 100644 index 0000000000..2b5953acc8 --- /dev/null +++ b/tools/wrt350nv2-builder/src/upgrade.h @@ -0,0 +1,77 @@ +#ifndef _UPGRADE_H_ +#define _UPGRADE_H_ + +#define FLASH_END_ADDR 0xffffffff +#define FLASH_ADDR_BASE 0xff800000 +#define BOOT_ADDR_BASE 0xfffc0000 +#define BOOT_ADDR_BASE_OFF 0x7c0000 +#define FLASH_SIZE 0x800000 +#define BOOT_SIZE 0x40000 +//NVRAM in boot area +//#define NVRAM_ADDR_BASE 0xfff90000 +//#define NVRAM_ADDR_BASE_OFF 0x790000 +//#define NVRAM_SIZE 0x10000 + +#define PID_OFFSET (BOOT_SIZE- 0x46) +#define NODE_ADDRESS (BOOT_SIZE-0x60) +#define NODE_BASE_OFF (FLASH_SIZE-0x60) +#define PIN_ADDRESS (BOOT_SIZE-0x70)//WPS PIN,8bytes +#define PIN_OFF (FLASH_SIZE-0x70) +#define KERNEL_CODE_OFFSET 0 +#define SN_ADDRESS (BOOT_SIZE-0x80) //12bytes +#define SN_OFF (FLASH_SIZE-0x80) + + +#define UPGRADE_START_OFFSET 0 +#define UPGRADE_END_OFFSET 0x7A0000 +#define PRODUCT_ID_OFFSET 0x75ffe0//(UPGRADE_END_OFFSET - 0x10) +#define PROTOCOL_ID_OFFSET (PRODUCT_ID_OFFSET + 0x02) +#define FW_VERSION_OFFSET (PRODUCT_ID_OFFSET + 0x04) +#define SIGN_OFFSET (PRODUCT_ID_OFFSET + 0x08) /* eRcOmM */ + +//#define LANG_UPGRADE +#ifdef LANG_UPGRADE +#define LANGBUF_BEGIN 0x1300000 +#define LANGBUF_END 0x1f00000 +#define LANGBUF_LENTH (LANGBUF_END - LANGBUF_BEGIN) +#endif +#ifndef ERROR +#define ERROR -1 +#endif + +#ifndef OK +#define OK 0 +#endif + +#ifndef NULL +#define NULL 0 +#endif + + +void do_boot(void); +void Download(void); +void Assign(void); + +void gpio_init(void); +void Led_Power(int value); +void Led_security(int value); +int PushButton(void); + +static unsigned short xchg ( unsigned short dwData); +int FlashDriver(unsigned long dlAddress,unsigned char *dbData,unsigned long dlLength,unsigned long dlFlag); +int ProgramChip(unsigned long dlAddress,unsigned char * dbData,unsigned long dlLength); +int dl_Initialize(void); +void dl_GetAddr(unsigned char *node); +int dl_Receive(void); +int dl_Transmit(char *buf,int len); +void reset(void); +void AssignHWAddress(unsigned char *psBuffer); +int ResetChip(unsigned long ulRomDstAddr); +int GetFlashType(void); + +#ifdef LANG_UPGRADE +int save_lang_buf(unsigned long flash_addr, char *mem_addr,unsigned long length); +int LangDriver(unsigned long flash_addr, char *mem_addr,unsigned long length, unsigned long dlFlag); +#endif +#endif + diff --git a/tools/wrt350nv2-builder/src/wrt350nv2-builder.c b/tools/wrt350nv2-builder/src/wrt350nv2-builder.c new file mode 100644 index 0000000000..653126d4e5 --- /dev/null +++ b/tools/wrt350nv2-builder/src/wrt350nv2-builder.c @@ -0,0 +1,1126 @@ +/* + + WRT350Nv2-Builder 2.4 (previously called buildimg) + Copyright (C) 2008-2009 Dirk Teurlings + Copyright (C) 2009-2011 Matthias Buecher (http://www.maddes.net/) + + 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 + + A lot of thanks to Kaloz and juhosg from OpenWRT and Lennert Buytenhek from + marvell for helping me figure this one out. This code is based on bash + scripts wrote by Peter van Valderen so the real credit should go to him. + + This program reads the provided parameter file and creates an image which can + be used to flash a Linksys WRT350N v2 from stock firmware. + The trick is to fill unused space in the bin file with random, so that the + resulting zip file passes the size check of the stock firmware. + + The parameter file layout for an original Linksys firmware: + :kernel 0x001A0000 /path/to/uImage + :rootfs 0 /path/to/root.squashfs + :u-boot 0 /path/to/u-boot.bin + #version 0x2020 + + Additionally since v2.4 an already complete image can be used: + :image 0 /path/to/librecmc-wrt350nv2-[squashfs|jffs2-64k].img + + args: + 1 wrt350nv2.par parameter file describing the image layout + 2 wrt350nv2.img output file for linksys style image + + A u-boot image inside the bin file is not necessary. + The version is not important. + The name of the bin file is not important, but still "wrt350n.bin" is used to + keep as close as possible to the stock firmware. + + Linksys assumes that no mtd will be used to its maximum, so the last 16 bytes + of the mtd are abused to define the length of the next mtd content (4 bytes for + size + 12 pad bytes). + + At the end of "rootfs" additional 16 bytes are abused for some data and a + highly important eRcOmM identifier, so the last 32 bytes of "rootfs" are abused. + + At the end of "u-boot" 128 bytes are abused for some data, a checksum and a + highly important sErCoMm identifier. + + + This program uses a special GNU scanf modifier to allocate + sufficient memory for a strings with unknown length. + See http://www.kernel.org/doc/man-pages/online/pages/man3/scanf.3.html#NOTES + + + To extract everything from a Linksys style firmware image see + https://forum.openwrt.org/viewtopic.php?pid=92928#p92928 + + Changelog: + v2.4 - added ":image" definition for parameter file, this allows + to use a complete sysupgrade image without any kernel size check + v2.3 - allow jffs by adding its magic number (0x8519) + added parameter option -i to ignore unknown magic numbers + v2.2 - fixed checksum byte calculation for other versions than 0x2019 + fixed rare problem with padsize + updated info to stock firmware 2.00.20 + fixed typos + v2.1 - used "wrt350n.bin" for the created image (closer to stock) + added option to create the image in two separate steps (-b / -z) + v2.0 - complete re-write + +*/ + +// includes +#define _GNU_SOURCE // for GNU's basename() +#include +#include // errno +#include +#include // fopen(), fread(), fclose(), etc. +#include // system(), etc. +#include // basename(), strerror(), strdup(), etc. +#include // optopt(), access(), etc. +#include +#include // WEXITSTATUS, etc. + +// custom includes +#include "md5.h" // MD5 routines +#include "upgrade.h" // Linksys definitions from firmware 2.0.19 (unchanged up to 2.0.20) + + +// version info +#define VERSION "2.4" +char program_info[] = "WRT350Nv2-Builder v%s by Dirk Teurlings and Matthias Buecher (http://www.maddes.net/)\n"; + +// verbosity +#define DEBUG 1 +#define DEBUG_LVL2 2 +int verbosity = 0; + +// mtd info +typedef struct { + char *name; + int offset; + int size; + char *filename; + long int filesize; + unsigned char magic[2]; +} mtd_info; + +mtd_info mtd_kernel = { "kernel", 0, 0, NULL, 0L, { 0, 0 } }; +mtd_info mtd_rootfs = { "rootfs", 0, 0, NULL, 0L, { 0, 0 } }; +mtd_info mtd_image = { "image", 0, 0, NULL, 0L, { 0, 0 } }; +mtd_info mtd_uboot = { "u-boot", 0, 0, NULL, 0L, { 0, 0 } }; + +#define ROOTFS_END_OFFSET 0x00760000 +#define ROOTFS_MIN_OFFSET 0x00640000 // should be filled up to here, to make sure that the zip file is big enough to pass the size check of the stock firmware + // 2.0.17: filled up to 0x00640000 + // 2.0.19: filled up to 0x00670000 + // 2.0.20: filled up to 0x00670000 + +// rootfs statics via: hexdump -v -e '1/1 "0x%02X, "' -s 0x0075FFE0 -n 16 "wrt350n.bin" ; echo -en "\n" +unsigned char product_id[] = { 0x00, 0x03 }; // seems to be a fixed value +unsigned char protocol_id[] = { 0x00, 0x00 }; // seems to be a fixed value +unsigned char fw_version[] = { 0x20, 0x20 }; +unsigned char rootfs_unknown[] = { 0x90, 0xF7 }; // seems to be a fixed value +unsigned char sign[] = { 0x65, 0x52, 0x63, 0x4F, 0x6D, 0x4D, 0x00, 0x00 }; // eRcOmM + +// u-boot statics via: hexdump -v -e '1/1 "0x%02X, "' -s 0x007FFF80 -n 128 "wrt350n.bin" ; echo -en "\n" +//unsigned char sn[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; // (12) seems to be an unused value +//unsigned char pin[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; // (8) seems to be an unused value +//unsigned char node[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // (25) seems to be an unused value +// 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; +//unsigned char checksum[] = { 0xE9 }; // (1) is calculated, does it belong to node? +unsigned char pid[] = { 0x73, 0x45, 0x72, 0x43, 0x6F, 0x4D, 0x6D, 0x00, 0x01, 0x00, 0x00, 0x59, 0x42, 0x50, 0x00, 0x01, // (70) seems to be a fixed value, except for fw version + 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, // protocol id? + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, // protocol id? + 0x12, 0x34, // firmware version, same as in rootfs + 0x00, 0x00, 0x00, 0x04, + 0x73, 0x45, 0x72, 0x43, 0x6F, 0x4D, 0x6D }; // sErCoMm + +// img statics via: hexdump -v -e '1/1 "0x%02X, "' -s 0 -n 512 "WRT350N-EU-ETSI-2.00.19.img" ; echo -en "\n" (unchanged up to 2.0.20) +unsigned char img_hdr[] = { 0x00, 0x01, 0x00, 0x00, 0x59, 0x42, 0x50, 0x00, 0x01, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, + 0x00, 0x00, + 0x12, 0x34, // firmware version, same as in rootfs + 0x00, 0x00, 0x00, 0x04, 0x61, 0x44, 0x6D, 0x42, 0x6C, 0x4B, 0x3D, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x12, 0x34, 0x56, 0x78, 0x9A, 0xBC, 0xDE, 0xF0, 0x12, 0x34, 0x56, 0x78, 0x9A, 0xBC, 0xDE, 0xF0, // md5 checksum + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; + +unsigned char img_eof[] = { 0xFF }; + + +void lprintf(int outputlevel, char *fmt, ...) { + va_list argp; + if (outputlevel <= verbosity) { + va_start(argp, fmt); + vprintf(fmt, argp); + va_end(argp); + } +} + + +int parse_par_file(FILE *f_par) { + int exitcode = 0; + + char *buffer; + size_t buffer_size; + char *line; + + int lineno; + int count; + + char string1[256]; + char string2[256]; + int value; + + mtd_info *mtd; + FILE *f_in; + int f_exitcode = 0; + + // read all lines + buffer_size = 1000; + buffer = NULL; + lineno = 0; + while (!feof(f_par)) { + // read next line into memory + do { + // allocate memory for input line + if (!buffer) { + buffer = malloc(buffer_size); + } + if (!buffer) { + exitcode = 1; + printf("parse_par_file: can not allocate %i bytes\n", (int) buffer_size); + break; + } + + line = fgets(buffer, buffer_size, f_par); + if (!line) { + exitcode = ferror(f_par); + if (exitcode) { + printf("parse_par_file: %s\n", strerror(exitcode)); + } + break; + } + + // if buffer was not completely filled, then assume that line is complete + count = strlen(buffer) + 1; + if (count-- < buffer_size) { + break; + } + + // otherwise.... + + // reset file position to line start + value = fseek(f_par, -count, SEEK_CUR); + if (value == -1) { + exitcode = errno; + printf("parse_par_file: %s\n", strerror(exitcode)); + break; + } + + // double buffer size + free(buffer); + buffer = NULL; + buffer_size *= 2; + lprintf(DEBUG_LVL2, " extending buffer to %i bytes\n", buffer_size); + } while (1); + if ((!line) || (exitcode)) { + break; + } + + lineno++; // increase line number + + lprintf(DEBUG_LVL2, " line %i (%i) %s", lineno, count, line); + + value = 0; + mtd = NULL; + + // split line if starting with a colon + switch (line[0]) { + case ':': + count = sscanf(line, ":%255s %i %255s", string1, &value, string2); + if (count != 3) { + printf("line %i does not meet defined format (: )\n", lineno); + } else { + // populate mtd_info if supported mtd names + if (!strcmp(string1, mtd_kernel.name)) { + mtd = &mtd_kernel; + } else if (!strcmp(string1, mtd_rootfs.name)) { + mtd = &mtd_rootfs; + } else if (!strcmp(string1, mtd_uboot.name)) { + mtd = &mtd_uboot; + } else if (!strcmp(string1, mtd_image.name)) { + mtd = &mtd_image; + } + + if (!mtd) { + printf("unknown mtd %s in line %i\n", string1, lineno); + } else if (mtd->filename) { + f_exitcode = 1; + printf("mtd %s in line %i multiple definitions\n", string1, lineno); + } else { + mtd->size = value; + mtd->filename = strdup(string2); + + // Get file size + f_in = fopen(mtd->filename, "rb"); + if (!f_in) { + f_exitcode = errno; + printf("input file %s: %s\n", mtd->filename, strerror(f_exitcode)); + } else { + value = fread(&mtd->magic, 1, 2, f_in); + if (value < 2) { + if (ferror(f_in)) { + f_exitcode = ferror(f_in); + printf("input file %s: %s\n", mtd->filename, strerror(f_exitcode)); + } else { + f_exitcode = 1; + printf("input file %s: smaller than two bytes, no magic code\n", mtd->filename); + } + } + + value = fseek(f_in, 0, SEEK_END); + if (value == -1) { + f_exitcode = errno; + printf("input file %s: %s\n", mtd->filename, strerror(f_exitcode)); + } else { + mtd->filesize = ftell(f_in); + if (mtd->filesize == -1) { + f_exitcode = errno; + printf("input file %s: %s\n", mtd->filename, strerror(f_exitcode)); + } + } + + fclose(f_in); + } + + lprintf(DEBUG, "mtd %s in line %i: size=0x%08X, filesize=0x%08lX, magic=0x%02X%02X, file=%s\n", mtd->name, lineno, mtd->size, mtd->filesize, mtd->magic[0], mtd->magic[1], mtd->filename); + } + } + break; + case '#': // integer values + count = sscanf(line, "#%255s %i", string1, &value); + if (count != 2) { + printf("line %i does not meet defined format (# \n", lineno); + } else { + if (!strcmp(string1, "version")) { + // changing version + fw_version[0] = 0x000000FF & ( value >> 8 ); + fw_version[1] = 0x000000FF & value; + } else { + printf("unknown integer variable %s in line %i\n", string1, lineno); + } + + lprintf(DEBUG, "integer variable %s in line %i: 0x%08X\n", string1, lineno, value); + } + break; + case '$': // strings + count = sscanf(line, "$%255s %255s", string1, string2); + if (count != 2) { + printf("line %i does not meet defined format (: )\n", lineno); + } else { +/* + if (!strcmp(string1, "something")) { + something = strdup(string2); + } else { +*/ + printf("unknown string variable %s in line %i\n", string1, lineno); +// } + lprintf(DEBUG, "string variable %s in line %i: %s\n", string1, lineno, string2); + } + break; + default: + break; + } + } + free(buffer); + + if (!exitcode) { + exitcode = f_exitcode; + } + + return exitcode; +} + + +int create_bin_file(char *bin_filename) { + int exitcode = 0; + + unsigned char *buffer; + + int i; + mtd_info *mtd; + int addsize; + int padsize; + + char *rand_filename = "/dev/urandom"; + FILE *f_in; + int size; + + unsigned long int csum; + unsigned char checksum; + + FILE *f_out; + + // allocate memory for bin file + buffer = malloc(KERNEL_CODE_OFFSET + FLASH_SIZE); + if (!buffer) { + exitcode = 1; + printf("create_bin_file: can not allocate %i bytes\n", FLASH_SIZE); + } else { + // initialize with zero + memset(buffer, 0, KERNEL_CODE_OFFSET + FLASH_SIZE); + } + + // add files + if (!exitcode) { + for (i = 1; i <= 4; i++) { + addsize = 0; + padsize = 0; + + switch (i) { + case 1: + mtd = &mtd_image; + padsize = ROOTFS_MIN_OFFSET - mtd->filesize; + break; + case 2: + mtd = &mtd_kernel; + break; + case 3: + mtd = &mtd_rootfs; + addsize = mtd->filesize; + padsize = ROOTFS_MIN_OFFSET - mtd_kernel.size - mtd->filesize; + break; + case 4: + mtd = &mtd_uboot; + addsize = mtd->filesize; + break; + default: + mtd = NULL; + exitcode = 1; + printf("create_bin_file: unknown mtd %i\n", i); + break; + } + if (!mtd) { + break; + } + if (!mtd->filename) { + continue; + } + + lprintf(DEBUG, "adding mtd %s file %s\n", mtd->name, mtd->filename); + + // adding file size + if (addsize) { + buffer[KERNEL_CODE_OFFSET + mtd->offset - 16] = 0x000000FFL & ( addsize >> 24 ); + buffer[KERNEL_CODE_OFFSET + mtd->offset - 15] = 0x000000FFL & ( addsize >> 16 ); + buffer[KERNEL_CODE_OFFSET + mtd->offset - 14] = 0x000000FFL & ( addsize >> 8 ); + buffer[KERNEL_CODE_OFFSET + mtd->offset - 13] = 0x000000FFL & addsize; + } + + // adding file content + f_in = fopen(mtd->filename, "rb"); + if (!f_in) { + exitcode = errno; + printf("input file %s: %s\n", mtd->filename, strerror(exitcode)); + } else { + size = fread(&buffer[KERNEL_CODE_OFFSET + mtd->offset], mtd->filesize, 1, f_in); + if (size < 1) { + if (ferror(f_in)) { + exitcode = ferror(f_in); + printf("input file %s: %s\n", mtd->filename, strerror(exitcode)); + } else { + exitcode = 1; + printf("input file %s: smaller than before *doh*\n", mtd->filename); + } + } + fclose(f_in); + } + + // padding + if (padsize > 0) { + addsize = padsize & 0x0000FFFF; // start on next 64KB border + padsize -= addsize; + } + if (padsize > 0) { + printf("mtd %s input file %s is too small (0x%08lX), adding 0x%08X random bytes\n", mtd->name, mtd->filename, mtd->filesize, padsize); + + addsize += KERNEL_CODE_OFFSET + mtd->offset + mtd->filesize; // get offset + lprintf(DEBUG, " padding offset 0x%08X length 0x%08X\n", addsize, padsize); + + f_in = fopen(rand_filename, "rb"); + if (!f_in) { + exitcode = errno; + printf("input file %s: %s\n", rand_filename, strerror(exitcode)); + } else { + size = fread(&buffer[addsize], padsize, 1, f_in); + if (size < 1) { + if (ferror(f_in)) { + exitcode = ferror(f_in); + printf("input file %s: %s\n", rand_filename, strerror(exitcode)); + } else { + exitcode = 1; + printf("input file %s: smaller than before *doh*\n", rand_filename); + } + } + } + fclose(f_in); + } + } + } + + // add special contents + if (!exitcode) { + lprintf(DEBUG, "adding rootfs special data\n"); + memcpy(&buffer[KERNEL_CODE_OFFSET + PRODUCT_ID_OFFSET], product_id, 2); + memcpy(&buffer[KERNEL_CODE_OFFSET + PROTOCOL_ID_OFFSET], protocol_id, 2); + memcpy(&buffer[KERNEL_CODE_OFFSET + FW_VERSION_OFFSET], fw_version, 2); + memcpy(&buffer[KERNEL_CODE_OFFSET + FW_VERSION_OFFSET + 2], rootfs_unknown, 2); + memcpy(&buffer[KERNEL_CODE_OFFSET + SIGN_OFFSET], sign, 8); // eRcOmM + + lprintf(DEBUG, "adding u-boot special data\n"); +// memcpy(&buffer[KERNEL_CODE_OFFSET + SN_OFF], sn, 12); // ToDo: currently zero, find out what's this for? +// memcpy(&buffer[KERNEL_CODE_OFFSET + PIN_OFF], pin, 8); // ToDo: currently zero, find out what's this for? +// memcpy(&buffer[KERNEL_CODE_OFFSET + NODE_BASE_OFF], node, 25); // ToDo: currently zero, find out what's this for? + memcpy(&buffer[KERNEL_CODE_OFFSET + BOOT_ADDR_BASE_OFF + PID_OFFSET], pid, 70); // sErCoMm + memcpy(&buffer[KERNEL_CODE_OFFSET + BOOT_ADDR_BASE_OFF + PID_OFFSET + 57], fw_version, 2); + + lprintf(DEBUG, "adding checksum byte\n"); + csum = 0; + for (i = 0; i < KERNEL_CODE_OFFSET + FLASH_SIZE; i++) { + csum += buffer[i]; + } + lprintf(DEBUG_LVL2, " checksum 0x%016lX (%li)\n", csum, csum); + + buffer[KERNEL_CODE_OFFSET + NODE_BASE_OFF + 25] = ~csum + 1; + lprintf(DEBUG, " byte 0x%02X\n", buffer[KERNEL_CODE_OFFSET + NODE_BASE_OFF + 25]); + } + + // write bin file + if (!exitcode) { + lprintf(DEBUG, "writing file %s\n", bin_filename); + f_out = fopen(bin_filename, "wb"); + if (!f_out) { + exitcode = errno; + printf("output file %s: %s\n", bin_filename, strerror(exitcode)); + } else { + size = fwrite(buffer, KERNEL_CODE_OFFSET + FLASH_SIZE, 1, f_out); + if (size < 1) { + if (ferror(f_out)) { + exitcode = ferror(f_out); + printf("output file %s: %s\n", bin_filename, strerror(exitcode)); + } else { + exitcode = 1; + printf("output file %s: unspecified write error\n", bin_filename); + } + } + fclose(f_out); + } + } + + return exitcode; +} + + +int create_zip_file(char *zip_filename, char *bin_filename) { + int exitcode = 0; + + char *buffer; + size_t buffer_size; + int count; + + buffer_size = 1000; + buffer = NULL; + do { + // allocate memory for command line + if (!buffer) { + buffer = malloc(buffer_size); + } + if (!buffer) { + exitcode = 1; + printf("create_zip_file: can not allocate %i bytes\n", (int) buffer_size); + break; + } + + // if buffer was not completely filled, then line fit in completely + count = snprintf(buffer, buffer_size, "zip \"%s\" \"%s\"", zip_filename, bin_filename); + if ((count > -1) && (count < buffer_size)) { + break; + } + + // otherwise try again with more space + if (count > -1) { // glibc 2.1 + buffer_size = count + 1; // precisely what is needed + } else { // glibc 2.0 + buffer_size *= 2; // twice the old size + } + free(buffer); + buffer = NULL; + lprintf(DEBUG_LVL2, " extending buffer to %i bytes\n", buffer_size); + } while (1); + + if (!exitcode) { + // zipping binfile + lprintf(DEBUG, "%s\n", buffer); + count = system(buffer); + if ((count < 0) || (WEXITSTATUS(count))) { + exitcode = 1; + printf("create_zip_file: can not execute %s bytes\n", buffer); + } + } + + return exitcode; +} + + +int create_img_file(FILE *f_out, char *out_filename, char *zip_filename) { + int exitcode = 0; + + md5_state_t state; + md5_byte_t digest[16]; + + int i; + int size; + + FILE *f_in; + unsigned char buffer[1]; + + // copy firmware version + memcpy(&img_hdr[50], fw_version, 2); + + // clear md5 checksum + memset(&img_hdr[480], 0, 16); + + // prepare md5 checksum calculation + md5_init(&state); + + // add img header + lprintf(DEBUG_LVL2, " adding img header\n"); + for (i = 0; i < 512; i++) { + size = fputc(img_hdr[i], f_out); + if (size == EOF) { + exitcode = ferror(f_out); + printf("output file %s: %s\n", out_filename, strerror(exitcode)); + break; + } + md5_append(&state, (const md5_byte_t *)&img_hdr[i], 1); + } + + // adding zip file + if (!exitcode) { + lprintf(DEBUG_LVL2, " adding zip file\n"); + f_in = fopen(zip_filename, "rb"); + if (!f_in) { + exitcode = errno; + printf("input file %s: %s\n", zip_filename, strerror(exitcode)); + } else { + while ((size = fgetc(f_in)) != EOF) { + buffer[0] = size; + + size = fputc(buffer[0], f_out); + if (size == EOF) { + exitcode = ferror(f_out); + printf("output file %s: %s\n", out_filename, strerror(exitcode)); + break; + } + md5_append(&state, (const md5_byte_t *)buffer, 1); + } + if (ferror(f_in)) { + exitcode = ferror(f_in); + printf("input file %s: %s\n", zip_filename, strerror(exitcode)); + } + } + + } + + // add end byte + if (!exitcode) { + lprintf(DEBUG_LVL2, " adding img eof byte\n"); + size = fputc(img_eof[0], f_out); + if (size == EOF) { + exitcode = ferror(f_out); + printf("output file %s: %s\n", out_filename, strerror(exitcode)); + } + md5_append(&state, (const md5_byte_t *)img_eof, 1); + } + + // append salt to md5 checksum + md5_append(&state, (const md5_byte_t *)"A^gU*<>?RFY@#DR&Z", 17); + + // finish md5 checksum calculation + md5_finish(&state, digest); + + // write md5 checksum into img header + if (!exitcode) { + lprintf(DEBUG_LVL2, " writing md5 checksum into img header of file\n"); + + size = fseek(f_out, 480, SEEK_SET); + if (size == -1) { + exitcode = errno; + printf("output file %s: %s\n", out_filename, strerror(exitcode)); + } else { + size = fwrite(digest, 16, 1, f_out); + if (size < 1) { + if (ferror(f_out)) { + exitcode = ferror(f_out); + printf("output file %s: %s\n", out_filename, strerror(exitcode)); + } else { + exitcode = 1; + printf("output file %s: unspecified write error\n", out_filename); + } + } + } + + fclose(f_in); + } + + return exitcode; +} + + +int main(int argc, char *argv[]) { + int exitcode = 0; + + int help; + int onlybin; + int havezip; + int ignoremagic; + char option; + char *par_filename = NULL; + char *img_filename = NULL; + char *base_filename = NULL; + char *bin_filename = NULL; + char *zip_filename = NULL; + + FILE *f_par = NULL; + FILE *f_img = NULL; + + int i; + mtd_info *mtd; + int noupdate; + int sizecheck; + int magiccheck; + int magicerror; + + +// display program header + printf(program_info, VERSION); + + +// command line processing + // options + help = 0; + onlybin = 0; + havezip = 0; + ignoremagic = 0; + while ((option = getopt(argc, argv, "hbzif:v")) != -1) { + switch(option) { + case 'h': + help = 1; + break; + case 'b': + onlybin = 1; + break; + case 'z': + havezip = 1; + break; + case 'i': + ignoremagic = 1; + break; + case 'f': + sizecheck = sscanf(optarg, "%i", &i); + if (sizecheck != 1) { + printf("Firmware version of -f option not a valid integer\n"); + exitcode = 1; + } else { + fw_version[0] = 0x000000FF & ( i >> 8 ); + fw_version[1] = 0x000000FF & i; + } + break; + case 'v': + verbosity++; + break; + case ':': // option with missing operand + printf("Option -%c requires an operand\n", optopt); + exitcode = 1; + break; + case '?': + printf("Unrecognized option: -%c\n", optopt); + exitcode = 1; + break; + } + } + + // files + for ( ; optind < argc; optind++) { + if (!par_filename) { + par_filename = argv[optind]; + + if (access(par_filename, R_OK)) { + if (havezip) { + printf("No read access to zip file %s\n", par_filename); + } else { + printf("No read access to parameter or zip file %s\n", par_filename); + } + exitcode = 1; + } + + continue; + } + + if ((!onlybin) && (!img_filename)) { + img_filename = argv[optind]; + + if (!access(img_filename, F_OK)) { // if file already exists then check write access + if (access(img_filename, W_OK)) { + printf("No write access to image file %s\n", img_filename); + exitcode = 1; + } + } + + continue; + } + + printf("Too many files stated\n"); + exitcode = 1; + break; + } + + // file name checks + if (!par_filename) { + if (havezip) { + printf("Zip file not stated\n"); + } else { + printf("Parameter file not stated\n"); + } + exitcode = 1; + } else { + base_filename = basename(par_filename); + if (!base_filename) { + if (havezip) { + printf("Zip file is a directory\n"); + } else { + printf("Parameter file is a directory\n"); + } + exitcode = 1; + } + } + + if (!onlybin) { + if (!img_filename) { + printf("Image file not stated\n"); + exitcode = 1; + } else { + base_filename = basename(img_filename); + if (!base_filename) { + printf("Image file is a directory\n"); + exitcode = 1; + } + } + } + + // check for mutually exclusive options + if ((onlybin) && (havezip)) { + printf("Option -b and -z are mutually exclusive\n"); + exitcode = 1; + } + + // react on option problems or help request, then exit + if ((exitcode) || (help)) { + if (help) { + printf("This program creates Linksys style images for the WRT350Nv2 router.\n"); + } + printf(" Usage:\n\ + %s [-h] [-b] [-z] [-i] [-f ] [-v] []\n\n\ + Options:\n\ + -h - Show this help\n\ + -b - Create only bin file, no img or zip file is created\n\ + -z - Have zip file, the img file will be directly created from it\n\ + -i - Ignore unknown magic numbers\n\ + -f - Wanted firmware version to use with -z\n\ + Default firmware version is 0x2020 = 2.00.20.\n\ + Note: version from parameter file will supersede this\n\ + -v - Increase debug verbosity level\n\n\ + Example:\n\ + %s wrt350nv2.par wrt350nv2.img\n\n", argv[0], argv[0]); + return exitcode; + } + + // handle special case when zipfile is stated + if (havezip) { + zip_filename = par_filename; + par_filename = NULL; + } + + lprintf(DEBUG_LVL2, " Verbosity: %i\n", verbosity); + lprintf(DEBUG_LVL2, " Program: %s\n", argv[0]); + + if (par_filename) { + lprintf(DEBUG, "Parameter file: %s\n", par_filename); + } + if (zip_filename) { + lprintf(DEBUG, "Zip file: %s\n", zip_filename); + } + if (img_filename) { + lprintf(DEBUG, "Image file: %s\n", img_filename); + } + + +// open files from command line + // parameter/zip file + if (par_filename) { + f_par = fopen(par_filename, "rt"); + if (!f_par) { + exitcode = errno; + printf("Input file %s: %s\n", par_filename, strerror(exitcode)); + } + } + + // image file + if (img_filename) { + f_img = fopen(img_filename, "wb"); + if (!f_img) { + exitcode = errno; + printf("Output file %s: %s\n", img_filename, strerror(exitcode)); + } + } + + if (exitcode) { + return exitcode; + } + + +// parameter file processing + if ((!exitcode) && (f_par)) { + lprintf(DEBUG, "parsing parameter file...\n"); + + exitcode = parse_par_file(f_par); + + lprintf(DEBUG, "...done parsing file\n"); + } + if (f_par) { + fclose(f_par); + } + + +// check all input data + if ((!exitcode) && (par_filename)) { + lprintf(DEBUG, "checking mtd data...\n"); + + for (i = 1; i <= 4; i++) { + noupdate = 0; + sizecheck = 0; + magiccheck = 0; + + switch (i) { + case 1: + mtd = &mtd_image; + sizecheck = ROOTFS_END_OFFSET; + magiccheck = 1; + break; + case 2: + mtd = &mtd_kernel; + sizecheck = mtd_kernel.size - 16; + magiccheck = 1; + break; + case 3: + mtd = &mtd_rootfs; + mtd->offset = mtd_kernel.size; + mtd->size = ROOTFS_END_OFFSET - mtd_kernel.size; + sizecheck = PRODUCT_ID_OFFSET - mtd_kernel.size; + magiccheck = 1; + break; + case 4: + mtd = &mtd_uboot; + mtd->offset = BOOT_ADDR_BASE_OFF; + noupdate = 1; + sizecheck = SN_OFF - BOOT_ADDR_BASE_OFF; + break; + default: + mtd = NULL; + exitcode = 1; + printf("unknown mtd check %i\n", i); + break; + } + if (!mtd) { + break; + } + + lprintf(DEBUG_LVL2, " checking mtd %s\n", mtd->name); + + // general checks + + // no further checks if no file data present + if (!mtd->filename) { + continue; + } + + // not updated by stock firmware + if (noupdate) { + printf("mtd %s is specified, but will not be updated as of Linksys firmware 2.0.19\n", mtd->name); + } + + // general magic number check + magicerror = 0; + if (magiccheck) { + switch (i) { + case 1: // image + case 2: // kernel + if (!( + ((mtd->magic[0] == 0x27) && (mtd->magic[1] == 0x05)) // uImage + )) { + magicerror = 1; + } + break; + case 3: // rootfs + if (!( + ((mtd->magic[0] == 0x68) && (mtd->magic[1] == 0x73)) // squashfs + || ((mtd->magic[0] == 0x85) && (mtd->magic[1] == 0x19)) // jffs + )) { + magicerror = 1; + } + break; + default: + magicerror = 1; + break; + } + if (magicerror) { + printf("mtd %s input file %s has unknown magic number (0x%02X%02X)", mtd->name, mtd->filename, mtd->magic[0], mtd->magic[1]); + if (ignoremagic) { + printf("...ignoring"); + } else { + exitcode = 1; + } + printf("\n"); + } + } + + // mtd specific size check + if (mtd == &mtd_image) { + if (mtd->filesize < 0x00200000) { + exitcode = 1; + printf("mtd %s input file %s too unrealistic small (0x%08lX)\n", mtd->name, mtd->filename, mtd->filesize); + } + } + + if (mtd == &mtd_kernel) { + if (mtd->filesize < 0x00080000) { + exitcode = 1; + printf("mtd %s input file %s too unrealistic small (0x%08lX)\n", mtd->name, mtd->filename, mtd->filesize); + } + } + + // general size check + if (sizecheck) { + if (sizecheck <= 0) { + exitcode = 1; + printf("mtd %s bad file size check (%i) due to input data\n", mtd->name, sizecheck); + } else { + if (mtd->filesize > sizecheck) { + exitcode = 1; + printf("mtd %s input file %s too big (0x%08lX)\n", mtd->name, mtd->filename, mtd->filesize); + } + } + } + } + + // Check for mandatory parts + if ((!mtd_image.filename) && (!mtd_kernel.filename || !mtd_rootfs.filename)) { + exitcode = 1; + if (mtd_kernel.filename && !mtd_rootfs.filename) { + printf("Kernel without rootfs, either incorrectly specified or not at all in parameter file\n"); + } else if (!mtd_kernel.filename && mtd_rootfs.filename) { + printf("Rootfs without kernel, either incorrectly specified or not at all in parameter file\n"); + } else { + printf("Neither an image nor kernel with rootfs was/were correctly specified or at all in parameter file\n"); + } + } + + // Check for duplicate parts + if ((mtd_image.filename) && (mtd_kernel.filename || mtd_rootfs.filename)) { + exitcode = 1; + printf("Image and kernel/rootfs specified in parameter file\n"); + } + + lprintf(DEBUG, "...done checking mtd data\n"); + } + + +// bin creation in memory + if ((!exitcode) && (par_filename)) { + bin_filename = "wrt350n.bin"; + + lprintf(DEBUG, "creating bin file %s...\n", bin_filename); + + exitcode = create_bin_file(bin_filename); + + lprintf(DEBUG, "...done creating bin file\n"); + } + +// zip file creation + if ((!exitcode) && (!onlybin) && (!zip_filename)) { + zip_filename = "wrt350n.zip"; + + lprintf(DEBUG, "creating zip file %s...\n", zip_filename); + + exitcode = create_zip_file(zip_filename, bin_filename); + + lprintf(DEBUG, "...done creating zip file\n"); + } + + +// img file creation + if ((!exitcode) && (f_img)) { + lprintf(DEBUG, "creating img file...\n"); + + exitcode = create_img_file(f_img, img_filename, zip_filename); + + lprintf(DEBUG, "...done creating img file\n"); + } + +// clean up + if (f_img) { + fclose(f_img); + } + +// end program + return exitcode; +} diff --git a/tools/xz/Makefile b/tools/xz/Makefile index 5d574892bb..21029a74aa 100644 --- a/tools/xz/Makefile +++ b/tools/xz/Makefile @@ -1,4 +1,4 @@ -# +# # Copyright (C) 2006-2015 OpenWrt.org # # This is free software, licensed under the GNU General Public License v2. @@ -25,7 +25,8 @@ HOSTCXX := $(HOSTCXX_NOCACHE) HOST_CONFIGURE_ARGS += \ --enable-static=yes \ --enable-shared=no \ - --disable-doc + --disable-doc \ + --with-pic define Host/Install +$(MAKE) $(HOST_JOBS) -C $(HOST_BUILD_DIR) install xzlinks="unxz xzcat" -- 2.25.1